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,645
questions
52
votes
2
answers
48k
views
poll() failed, context incorrect? - Example: bpy.ops.view3d.background_image_add()
I keep on getting context errors in the Blender Python API.
I don't understand the issue of the context in the API, how do I know which is the correct context?
Thanks!
57
votes
2
answers
60k
views
How to create a custom UI?
I was watching this video on making a custom UI tab using Python, and in the line from bpy.types import Menu, Panel, UIList, I see the names of objects that look ...
47
votes
3
answers
28k
views
Control Cycles/Eevee material nodes and material properties using python?
How can I define the different properties of an Cycles/Eevee material? Such things as glossy, glass, diffuse, RGB-color, emissive via python scripting?
38
votes
2
answers
15k
views
Python performance with Blender operators
In my script, I have for loop over many cube objects (~1000) and the treatment is very slow. Looking more in details, I notice that in the same amount of loops:
if ...
70
votes
10
answers
60k
views
Using 3rd party Python modules
I'm currently developing a script for Blender to handle Mesh Frequency Decomposition.
The script is nearly complete, but i need one more thing: The SciPy library to compute eigenvalues and ...
99
votes
10
answers
129k
views
Where does console output go
I'm trying to debug a Python script by placing a print("foo=" + foo) statement in my code.
But where does the output appear?
It doesn't appear on the Python ...
27
votes
1
answer
14k
views
Create an interface which is similar to the material list box
How can I make a Interface which is similar to the Material-Interface within Blender via Python?
It should look like these. Could you guide me to the right direction? I don't think it's in bpy.ops, ...
34
votes
4
answers
6k
views
Why avoid bpy.ops?
Simple and maybe stupid question:
I was reading this lot of time, that
"you should avoid using bpy.ops, or "instead of ...
69
votes
5
answers
41k
views
How to pass command line arguments to a Blender Python script?
Let's say we have a Python script my_script.py that does some data processing with Blender. This script accepts some arguments (e.g. ...
11
votes
3
answers
4k
views
How do I get a mesh data-block with modifiers and shape keys applied in Blender 2.8?
I'm trying to update an exporter to work with Blender 2.8 but can't seem to get a mesh data-block modified by modifiers or shape keys. It always gives me the base mesh.
I'm currently using ...
41
votes
1
answer
51k
views
How to assign a new material to an object in the scene from Python?
How can I assign a new material to an object in the scene via Python?
17
votes
1
answer
4k
views
How to pass multiple operator properties via UI layout?
Basically, I want to have a single operator which can do multiple things, based on some attributes values.
...
15
votes
1
answer
11k
views
How to create a Folder/File Dialog?
So I need to allow the user of my script to choose a directory that contains images, and then run my script on each image. I already have my script made here. I looked at this question already, but ...
10
votes
1
answer
9k
views
How to Link/Append a data-block using the Python API?
I'm searching a way to append a group in Python.
It should behave exactly like the Append function (ShiftF1) works, all objects should be local and editable. The idea is to append a character (with ...
92
votes
4
answers
90k
views
How can I run blender from command line or a python script without opening a GUI?
I'm interested in using Blender for producing images, 3d files, or calculating geometry on a server.
Can I make blender run a python script without opening a GUI?
If not, can I incorporate Blender's ...