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.

Python is an interactive 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.

See the wiki article on scripts development for more info.

13079 questions
38
votes
2 answers

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
  • 6,596
  • 6
  • 47
  • 75
32
votes
3 answers

Is the Blender GUI package available for other programs?

I really love the look of Blender's built-in GUI, and would potentially like to use these tools in some of my other Python applications. As I understand it, Blender created all of these tools from scratch, instead of inheriting them from one of the…
Gwen
  • 11,636
  • 14
  • 68
  • 88
31
votes
3 answers

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.79 though. How should I select (multiple) objects with Python in Blender 2.8?
Michael Teiniker
  • 1,094
  • 1
  • 12
  • 26
26
votes
8 answers

How to show to the user a progression in a script?

I'm making an python script which create a lot of object and this could take a lot of time. My question is how to show to the user of my script, the "progression" of the script? For now I print an progress bar in the system console. But you have to…
lucblender
  • 3,333
  • 3
  • 25
  • 36
26
votes
1 answer

Property Panel Custom Popup Menu when user presses hotkey over an input field

is it possible to trigger this kind of menu: in the property panel when I press a hotkey over a button/input field? I want to specifically,when the user presses a specific hotkey when over an input field, call a function that checks if this input…
Luca Scheller
  • 517
  • 3
  • 8
24
votes
3 answers

Pointing the camera in a particular direction programmatically

I'm trying to use Python to place a camera. I know the camera's location, and the forward and up vectors for the camera (i.e. the direction it's pointing and its orientation). How do I do this? I know that it's possible to calculate a raw world…
David Given
  • 562
  • 1
  • 3
  • 12
23
votes
2 answers

How to make a dynamically expanding menu in Blender?

Say we want to navigate a tree structure without knowing all the data ahead of time, is it possible to do this in Blender? For example, a menu which dynamically loaded a directory hierarchy from the filesystem (without having to scan the filesystem…
ideasman42
  • 47,387
  • 10
  • 141
  • 223
22
votes
6 answers

Where can I find what version of python is bundled with certain Blender versions?

The question is where I can reliably find the information on which python version is bundled with a certain Blender release (like 2.72b at the moment)? I need to find the major and minor version numbers as soon as a new release is out (well, as soon…
Mayqel
  • 443
  • 1
  • 5
  • 12
21
votes
3 answers

Is it possible to print to the Report window in the Info view?

I wonder if it is currently possible to print or send messages to the Report window in the Info view? this would be quite useful sometimes.
zeffii
  • 39,634
  • 9
  • 103
  • 186
21
votes
2 answers

Which modules are guaranteed to be present in Blender's Python?

Which modules are guaranteed to be included in Blender's custom Python build?
Forest Katsch
  • 885
  • 1
  • 7
  • 22
16
votes
1 answer

What is the difference between items listed in bpy.ops bpy.data and bpy.context

When accessing items in a python script somethings are prefixed with bpy.data some with bpy.context and others with bpy.ops What is the difference between these prefixes?
sambler
  • 55,387
  • 3
  • 59
  • 192
15
votes
3 answers

Setting objects into edit mode often seems to fail in python script

I am only just starting to learn/use python in blender. I have the following script import bpy for obj in bpy.data.objects: if obj.name[0:4] == "Text" and obj.type == "MESH": bpy.context.scene.objects.active = obj …
MrVimes
  • 557
  • 2
  • 4
  • 10
15
votes
2 answers

Is it possible to dump an Objects Properties and Methods?

Due to the lack of a class diagramm I need to explore the data structures by dumping objects to see what is in there. How can I dump the Objects internals to the console? In this snippet I tried to print the objects but I only get error messages…
stacker
  • 38,549
  • 31
  • 141
  • 243
15
votes
1 answer

Where is the system console?

I just ran a python script in blender. However it gave me an errror: Python script failed, check the message in the system console. I've searched online but i can't find the system console. I have two terminals open to the blender file already but…
nammerkage
  • 153
  • 1
  • 2
  • 14
14
votes
3 answers

How to list all selected elements in python?

If I select a face of a cube and switch over to the internal Python console and pass: bpy.context.selected_objects I get: [bpy.data.objects['Cube']] instead of something like [bpy.data.objects['Cube'].f[1]]. Coming from Maya I was looking for…
Bleeding Fingers
  • 1,585
  • 3
  • 13
  • 13
1
2 3
99 100