Questions tagged [python]

Python is an object-oriented programming language. In Blender, it is used as a general purpose scripting language and to create add-ons to extend Blender's functionality.

Filter by
Sorted by
Tagged with
0 votes
1 answer
188 views

Blender / Python convert form radians to degrees;

I'd like to create a text object that displays the rotation angle, in degrees, of an object. I found this code snippet which does almost exactly what I want, except gives units in radians. I'm a noob ...
0 votes
1 answer
13 views

Material node tree missing on scripting output

I am trying to check material nodes on a mesh with Python scripting. I was using a Iridescence material. In this material, there are two different output nodes named "Material Output" and &...
5 votes
1 answer
4k views

name 'bpy' is undefined

In test.py I have the following line. It was taken from this page: bpy.data.objects Then I start blender from the bash prompt:...
0 votes
0 answers
4 views

Load matrix transform from armature bones problem

I have a problem and I'm stuck right now in the matrix. xd some explanation: I have an armature object in blender called "Original_Armature" from which I want to print the transformations of ...
0 votes
1 answer
12 views

How to check if selected edges forms a continuous line?

How to check, if selected edges is a continuous line? Note that one edge is deselected.
0 votes
1 answer
21 views

How to change the scale of each bone?

I would like to change the bone scale for a material. I want to change the specified bone to scale -1 for XYZ as shown in the video below. I have drawn a script to try it out as shown below, but I can'...
0 votes
1 answer
345 views

How to configure the python values to fix the facial movements of a new 3d character not originally thought to work with those

I've just tracked and saved on the timeline the facial movements of Victor using OPEN CV and following this tutorial : https://www.youtube.com/watch?v=RY_eErKlilw The result has been good,as u can ...
1 vote
1 answer
339 views

How to apply a material to a selection in Text using Python

The Blender documentation explains how to apply multiple materials to various selections in Text: (source: blender.org) For example, to create Fig. Red Green Blue. you would need to create three ...
0 votes
1 answer
16 views

Simple script crashes blender when I run it?

I am following a tutorial series on learning python for blender. The next part of the tutorial is creating a circle and to try and learn better I work ahead, but whenever I try to run my script it ...
0 votes
1 answer
516 views

bpy.types.PropertyGroup properties not updating when changed in Redo Panel

EDIT So after some more reading I now have the following, but still cannot modify any of the values... ...
0 votes
0 answers
10 views

How to get PoseBone local axis direction vectors in world space?

To get a bone's local Y direction vector in world space all I have to do is: PoseBone.tail - PoseBone.head Now what is the formula to also get X and Z direction ...
1 vote
1 answer
50 views

Grease pencil stroke is very thick but can't find adjustment

I'm a new user of blender. I'm importing a svg file with python and setting the material with python as well. However, somewhere in the process the thickness is getting ruined. svg looks nice without ...
1 vote
0 answers
12 views

Shape Key interpolation

I'm trying to change Shape Key keyframe interpolation from Python. It is possible in Dope Sheet's Shape Key Editor, but can't find a way to change it from python. I can't even access shape keys. I'm ...
0 votes
0 answers
8 views

blender how to import fbx operate by csv file

Is there any way to import fbx file using csv. For example in my folder with fbx files I have those files 1.cube.fbx 2.cone.fbx 3.sphere.fbx 4.plane.fbx 5.cylinder.fbx I would like to import only ...
1 vote
0 answers
11 views

How to get the resolution of a movie sequence in VSE via python

I added a movie to the sequencer with this code. filepath = /to/my/video/ ...
0 votes
1 answer
742 views

Getting blender camera fov or focal length from the unity3d camera fov

I'm trying to match the fov of blender camera with unity 3d camera fov. Basically i want to calculate blender's camera FOV or focal length, given the fov of unity3d camera. Please help.
1 vote
2 answers
687 views

Using Python to select Inner loop in my mesh is producing unexpected results. Any suggestions? Blender 2.8

I have many 2d meshes that have many edge loops created with the Inset Straight Skeleton Tool and I'm hoping I can clean up some of the unwanted edge loops in an automated way. So far I've found: <...
0 votes
0 answers
15 views

How to distribute opencv in an addon?

I would like to use the cv2 contained in opencv (Below the example). I'm not sure if it can be done, the goal is to distribute ...
-1 votes
0 answers
11 views

How to render preview png´s for outside of blender [closed]

I need to have previews outside of Blender. The best may be for Materials too. How can i do this in python or else?
0 votes
0 answers
9 views

Is it possible for a script to act upon two different selection types?

I'm trying to create a script that triples an n-gon based on a user selected vertex. I've done this sort of thing in the past using MODO where I selected the vertex then placed the cursor over the ...
0 votes
0 answers
9 views

How to convert posebone fcurve quaternion values to world space?

I am making an exporter for a custom file format that supports animations. In this file to make animations work I need to provide anim data as quaternions in world space. My issue is that the bone ...
1 vote
1 answer
462 views

How can I make an animation using importing several x3d files to Blender by scripting?

I have some x3d files made by ParaView. I need to write a script to import these objects sequentially to Blender and make an animation. When each object is imported to 3D View Editor, a keyframe ...
0 votes
0 answers
12 views

How to output in ACIS formats like .sat or .sab?

I am currently writing a program that is outputting a 3D model into a simulation software. Currently I am ouputting in .stl file format for the object using the blender python function that does this ...
0 votes
0 answers
17 views

Apply a boolean modification so that it remains even without the boolean operand

I'm doing to loop through the .stl files of a folder to perform a boolean modification on them. Once the boolean modification is performed, I want to delete the boolean operand object (...
1 vote
1 answer
27 views

Convert curve to mesh with specified resolution via API

I am looking for a way to convert a curve into a mesh with specified resolution via Python API. For example, a 100 m curve should be turned into a mesh where vertices are placed every 1 m along the ...
2 votes
2 answers
222 views

Modifying single-object Python script to execute on all selected objects

I have a Python script that I am currently using to (excuse the confusing description) rename a given object's material's image-datablock-names to their actual filenames. It works correctly, for a ...
3 votes
2 answers
2k views

Get and Set Hide in viewport and Disable in viewport via Python API

In my plugin I have an operator that needs to iterate through potentially 100's of objects that might be 'hidden in viewport' or 'disabled in viewport' and perform some operations that require the ...
0 votes
0 answers
9 views

using python to set nla subtracks to active so I can insert animations with python

[ If you look at the first picture (bottom pic) you'll see I can activate an NLA track and insert an action strip using python - it works fine no problem The problem (look at second picture) Is I cant ...
0 votes
2 answers
179 views

Not seeing AddonPreferences after registering

I'm sure I am just doing something stupid here, but whenever I create an addon preferences class and register it, I am not seeing it appear in ...
0 votes
0 answers
14 views

Capture user-selected edge and the face under the mouse cursor

I'm trying to write a script that remembers a user-selected edge and selects the face under the cursor for use in follow-on functions. I've written my script as an operator so that I can assign it a ...
0 votes
0 answers
16 views

Blender 3.5: Can't install Free KitOps [closed]

I use Blender through Steam so it automatically updated from 3.4 to 3.5 and wiped all my addons. I had to reinstall all of them but the only addon giving me a problem is KitOps. Here's what it says ...
1 vote
0 answers
33 views

Using ExportHelper, how do you set ex. movie or image filters in python?

How do you set ex. use_filter_movie to true before opening the file browser(using ExportHelper)? This doesn't work: ...
0 votes
1 answer
15 views

Enable/Disable Mask Modifier depending on object visiblity

I would like to know if it possible for mask modifier to be automatically displayed based on the visibility of some object. Example: I have a character with some basic clothes. Body of the character ...
3 votes
1 answer
177 views

Exporting a UV in background mode

I am running background mode on a VM without GPU. When I call bpy.ops.uv.export_layout I'm getting an error "GPU functions for drawing are not available in background mode" I'm just calling: ...
0 votes
0 answers
19 views

Showing the object xyz axis lines via python when moving an object

In Python selecting an object does not display the axis lines, bpy.data.objects['Cube'].x = 5 simply moves the object. I've tried injecting keystrokes like G + X ...
0 votes
0 answers
18 views

Modal draw operator repeat draw function 8 times on every action

Need advice. Is it intendant behavior? In this simple example every action in blender modal operator prints me 8 time "Hello!" (in complex it calculates coordinates and draw some shape in a ...
0 votes
1 answer
298 views

Get Bone directions

As far as i was able to notice, there is option to get the direction of the bone using bone.vector . what if i want to know the side or up vector of the bone ? There is at-least option to get the ...
0 votes
1 answer
909 views

AttributeError: 'list' object has no attribute

I tried to use IsDecomposedBy and Decomposes code in Python Console in Blender bim but it shows this error: ...
1 vote
1 answer
32 views

blender python check if the Rotate or grab mode is active?

Is there a way to know with python if the user has activated the Rotate or grab mode ( R key or G key) for a pose bone ? Thanks
2 votes
1 answer
295 views

How to bind Mesh Deform modifier with Python?

I'm trying to bind a Mesh Deform modifier to an object, but when I do that via script it creates one, sets the object to deform with (here child). But when I call bind from the script I does not bind ...
0 votes
0 answers
95 views
+50

Get if a drag and drop was done from the asset browser in python?

My idea is to use a modal operator, or a modal function that runs in the background. The idea is to get an if statemen event based on a hypothetical drag and drop from the asset browser. ...
0 votes
0 answers
20 views

Google Colab: Render terminates itself [closed]

I've been trying to render a water simulation with Google colab. I followed a bunch of youtube tutorials, but I always get the same error when trying to render. Input: ...
0 votes
1 answer
17 views

python navigation to NLA sub-track of an object

I need to fix up animation on a character mesh every time I resync a linked armature, because the related mesh shape_keys animation gets deleted. Manually I have to navigate to the mesh object, ...
0 votes
0 answers
11 views

Handling changes in the depsgraph crashes Blender

I am trying to watch changes in the depsgraph so that ever time I assign a material to a mesh, all its sibling meshes (those that share a parent) are assigned the same color. The way I do that is in ...
0 votes
1 answer
188 views

Matrix not applying to pose bone correctly

I'm attempting to import animations from text files but I can't seem to figure out how to properly import it. If I make a list of positions in a text file like here ...
0 votes
1 answer
24 views

python code for Ctrl +Z

I have a small problem. I couldn't find anything even close to it in the blender stack exchange website. I have a python code for duplicating the selected mesh as many times as specified by the user ...
4 votes
1 answer
2k views

How to add points to a grease pencil stroke (or make new one) with python script?

I want to draw script-calculated curves with the grease pencil. Using this line of python I'm able to redefine the points of an existing stroke, shown below. So far I can't add a point like this: <...
-1 votes
0 answers
9 views

How to create prop_search with a custom PropertyGroup and how access?

...
0 votes
0 answers
42 views

Edit Source Code of OpenVR Streamer

I've been testing out this blender addon that allows you to control objects with a VR remote in blender. It works well apart from one feature that I would like to change. When you offset the object's ...
0 votes
0 answers
12 views

How to add an Icon to my costum Pie menu?

I want to add an Icon to my pie menu. How I can do that? ...

1
2 3 4 5
245