Skip to main content

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.

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 ...
P i's user avatar
  • 3,951
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 ...
BenjaminGolder's user avatar
83 votes
3 answers
56k views

How can I quickly generate / create a large city without modeling it all by hand?

I am trying to create an urban open-world environment in Blender that would be about one square kilometre in size. To avoid having to model hundred of individual buildings, I am looking for a way to ...
A A's user avatar
  • 933
71 votes
6 answers
25k views

Is there a tool for scientific visualization using Blender?

Is there an interface or API that allows using Blender as a tool for mathematical and scientific visualization? It should allow Blender to read in data (a la gnuplot or matlab, perhaps using scipy) ...
KDN's user avatar
  • 812
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 ...
Gouwi's user avatar
  • 701
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. ...
BenC's user avatar
  • 793
58 votes
5 answers
83k views

Python: How to completely remove an object

How can I completely remove an object (for example a camera) using python scripting? Using something like: scene.objects.unlink(camera) Does not work, since it ...
Jan Rüegg's user avatar
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 ...
DragonautX's user avatar
  • 1,316
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!
Jonathan's user avatar
  • 621
49 votes
3 answers
101k views

Selecting an object via scripting?

As shown below, I have 2 nested spheres, each with a different material (inner = "1", outer = "2"). Ultimately, I need to select the inner sphere (material "1") via ...
AaronJPung's user avatar
49 votes
1 answer
3k views

Custom trackpad pan/zoom/rotate behavior add-on

I'm trying to write an addon to customize the trackpad panning, zoomimg, and rotating gestures, but can't find a way to read the actual trackpad parameters for position and so on. The properties in ...
rraallvv's user avatar
  • 4,561
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?
binaryBigInt's user avatar
  • 1,047
46 votes
11 answers
58k 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 ...
ideasman42's user avatar
  • 47.6k
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?
binaryBigInt's user avatar
  • 1,047
38 votes
2 answers
34k views

How to get the directory of open blend file? (from Python)

What's the best way to get the full directory of the current Blender file in Python? It should be cross-platform.
Garrett's user avatar
  • 6,596

15 30 50 per page
1
2 3 4 5
884