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.
2,640
questions
14
votes
2
answers
4k
views
Is it possible to make a sequence of renders and give the user the option to cancel the process through the UI at any given time?
I'm trying to make a script where I have to render several images of the same scene at the same frame, and write to disk with appropriate names. The problem is that although this works fine with a non-...
25
votes
2
answers
15k
views
TypeError: Element-wise multiplication: not supported between 'Matrix' and 'Vector'
Blender 2.8 produces the following error whilst multiplying a combination of matrices and vectors
...
14
votes
2
answers
2k
views
A comprehensive list of operator overrides
I feel like I'm always spending far too much time playing scripting whack-a-mole whenever I want to override an operator in one of my scripts. I'd like to build a comprehensive one-stop-shop list for ...
46
votes
11
answers
59k
views
How to install Pip for Blender's bundled Python?
Blender comes with Python, and includes a stand-alone Python executable.
However pip is not part of the official Python distribution so it needs to be added separately.
How do you setup ...
13
votes
1
answer
12k
views
How to call a confirmation dialog box?
I have a button in my menu named "New File" as shown:
and I want when I click on the "New File" button to imitate what the Blender File->New does, where a check message box appear first confirming ...
32
votes
1
answer
18k
views
What do operator methods do? (poll, invoke, execute, draw & modal)
I've seen the functions called poll and invoke used in scripts. I'm curious what these are for and when they are called.
31
votes
2
answers
14k
views
Is it possible to create image data and save to a file from a script
I'm currently trying to extract textures from a binary file, and ideally I'd like to save each texture to a file or embed in the .blend file. However, before saving ...
6
votes
3
answers
6k
views
Script to render one object from different angles
I'm new to Blender. I'm currently working on a 3D reconstruction project using neural networks. I need to create my data set. Therefore I need to render a 3D body scan from different angles and save ...
22
votes
6
answers
36k
views
How to convert coordinates from vertex to world-space?
How do I convert from object-space to world-space?
I suspect it is:
vert_os = obj.vertices[foo]
vert_ws = vert_os.getPositionFromMatrix(obj.matrixWorld)
but ...
16
votes
3
answers
14k
views
How to get world-space matrix of any pose bone?
Is there a command for getting world-space matrix of pose bones, same as obj.matrix_world for objects? I found pose_bone.matrix, ...
10
votes
2
answers
4k
views
Object selection box with eyedropper
How to add an eyedropper functionality to prop_search in my addon?
...
22
votes
5
answers
33k
views
How to join objects with Python?
I try to do this:
bpy.ops.object.select_all()
bpy.ops.object.join()
in my script. It selects all the stuff like CtrlA but fails on ...
21
votes
6
answers
16k
views
How to access Render Result pixels from python script?
Render Result exists in bpy.data.images["Render Result"] but it contains no data.
Also bpy.data.images["Render Result"].size[0] ...
10
votes
2
answers
16k
views
Create model from XYZ data points
I'm trying to create a 3D heat map model out of data that I have from a csv file. I have a few thousand data points with XYZ coordinates.
I'm able to import the data into blender as a point cloud ...
31
votes
3
answers
55k
views
Python: Selecting object by name in 2.8
The following:
bpy.data.objects['Cube'].select = True
bpy.context.scene.objects.active = bpy.data.objects['Sphere.017']
don't work in Blender 2.8, they did in 2....