Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

11
votes
2answers
2k views

Assign datablock to custom property

With bpy.props I can assign bool, int, float and string ...
2
votes
0answers
302 views

Blender communication with SuperCollider via OSC [closed]

Halo to everyone, I need help with OSC output. Three years ago I used movements in Blender to control some variables in the SuperCollider. Now with the new versions of Blender and SuperCollider it ...
5
votes
2answers
547 views

How to know what object the snap function is targeting (in Python)?

When using the snapping function during a translation in a script, is there a way to know which object, vertex, edge, or face was used as the snapping target?
5
votes
1answer
2k views

Blender as python module, 'Context' object has no attribute 'object'

I understand that running blender without a GUI does not provide bpy.context for the 3d View. Can anyone help me with a work around. This results in a 'Context' ...
9
votes
1answer
790 views

Console vs scripting python constants

Using 2.67b for python scripting I get this: while importing math, numpy on the scripting console, internal variables seem to be ...
10
votes
2answers
37k views

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 ...
31
votes
0answers
1k 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 ...
7
votes
2answers
2k views

Dynamic creation of properties for export script

This time I have a question about Properties in Blender. I want the operator window of my add-on to have one BoolProperty per action defined in ...
8
votes
2answers
4k views

How do you export bones relative to parent?

I'm currently writing an exporter script. So far, I can export meshes just fine, but I've got some problems with exporting the armature. According to the python api, there are three different types ...
2
votes
0answers
56 views

Is it possible to print message to the info view? [duplicate]

Is it possible to print message to the info view? I used Mac OS,Blender2.6.7. thank you.
12
votes
3answers
1k views

Is it possible to render only keyframes from Dope-sheet?

I want to render only keyframes from Dope-sheet without the in-between frames. Effectively creating hold of last keyframe till there is new keyframe by re-saving (not re-rendering) the previously ...
1
vote
1answer
1k views

Visual programming with Blender Python

Does anyone know if there is some sort of visual programming software for Blender? I know there is one called "visual bpy". I watched a demonstration of it. It looks quite promising and should save us ...
9
votes
3answers
2k views

How to monitor render process in a thread-safe manner?

I'm currently writing an addon, the purpose of which requires it to render several parts of active scene sequentially, preferably with UI-responsiveness intact. The problem is the UI freezes if I just ...
7
votes
1answer
1k views

How are the Bones assigned to the Vertex_Groups in the API?

I´m working on an export script for Blender and I´m currently stuck at exporting bone weights. Here is what i have so far(excuse me if my Python is not that clean, the syntax is pretty new to me): <...
3
votes
3answers
57k views

How can I check the returned boolean of a function?

I am attempting the check whether a function returns True or False in order to procede to the next step of a separate function. For example, here is a stripped down version of what I have: ...
11
votes
1answer
983 views

Access skin modifier radius data

With Skin Modifier, we can "weight" a vertex (in Edit Mode) so that the resulting Skin mesh is bigger or smaller - similar to Curve objects which has "Scale Feather" adjustable. Manually, we can hit ...
7
votes
0answers
4k views

Using blender as a python module [closed]

How can I import Blender modules into any external Python IDE and use its features from the IDE itself? I found the tutorial "BlenderAsPyModule" but I am unable to follow it… specifically I ...
9
votes
1answer
397 views

Is there a post-finish operator hook in the python API

I'm writing a generic add-on bpy.types.Operator based on this question. It creates and arranges planes along an object, then splits the object along each new plane. ...
5
votes
1answer
817 views

Blender - Plot viewport-independent 2D-Labels

I am creating program that translates lithological data to colored 3D-columns which can be imported into Blender. Because the amount of single objects would be huge and disastrous on the readability ...
6
votes
1answer
3k views

How to iterate over custom properties?

I have a number of custom string properties that I added to my scene with: ...
10
votes
1answer
1k views

How can I call a specific keymap to draw within my AddonPreferences?

The add-on I've written defines several custom hotkeys, allowing the user to call custom menus created by the add-on. To be more user-friendly, I'd like to make it easy for the user to change the ...
8
votes
1answer
1k views

Getting hair vertices via python

We can convert hair into 3D editable objects via the modifier tab, this means there must be an API to get the hair vertices instantly from python. Can you explain it and all it's parameters and ...
15
votes
4answers
8k views

Efficient way to get selected vertices via python (without iterating over the entire mesh)

What's the best/fastest way to construct a list of selected vertices for a mesh object in python? I want to avoid iterating over every vertex in the mesh if possible, since that seems like a really ...
45
votes
3answers
28k 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 ...
10
votes
2answers
1k views

Scripting metaballs with negative influence

I'm generating metaballs with a python script, and I need to be able to toggle the negative option for some of the metaballs. (Edit: ...
4
votes
1answer
243 views

Point and Edges based on Armature Hierarchy

Someone asked me if we can do what the Skin Modifier does, but in reverse. For example, you started with some Edges and then create an Armature based on those Edges. If I started with Human Meta Rig ...
4
votes
1answer
1k views

Can I access the render screen size in a custom filter 2D in the game engine?

I am using Blender Game Engines Filter 2D to make a post effect with GLSL. In an fragment shader applied on the frame buffer, I want to access the size in pixels of that buffer in GLSL. ...
13
votes
2answers
20k views

How can I get vertex positions from a mesh?

I want to read the vertex x and y coordinates with a script or a function. How can I do that? The MeshVertex appears to have ...
12
votes
1answer
5k 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, ...
26
votes
3answers
10k views

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 ...
54
votes
5answers
16k 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) ...
7
votes
4answers
4k views

Blender becomes very slow with large amount of objects sharing mesh data

In my script I am importing a large amount of objects (+2500) but sharing the mesh data from one single primitive. While this has taken care of importing speed, it completely slows blender down. ...
7
votes
1answer
1k views

Is it possible to add a custom property on bpy.types.Sequence?

I am in the process of writing a tool that makes uses of Sequences in the Sequence Editor. I was trying the following in my add-on (register() method) ...
20
votes
2answers
590 views

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

Which modules are guaranteed to be included in Blender's custom Python build?
19
votes
1answer
2k views

Blender UI Multithreading Progressbar

The following question might've been asked several times, but I've found no satisfactory answer. Short question: How can I show progress of background task in Blender UI? Explanation: I have a ...
3
votes
1answer
219 views

How can I optimize the code to parse lines in a file?

I have a working importer that needs to handle large data sets ie. thousands of primitives. When I import a file containing 2500 objects it takes roughly 90 seconds to import. Now if I import the ...
5
votes
2answers
1k views

What is the difference between bpy.types.IntProperty and bpy.props.IntProperty?

I am always confused between bpy.types.IntProperty and bpy.props.IntProperty. (similarly with other properties) Most of the ...
8
votes
3answers
3k views

Execute function on object property change

I'm searching an equivalent to the observer design pattern. I want to execute a script function every time an object position changes. To achieve this there might be some options directly in blender ...
7
votes
3answers
2k views

How to find back-faces and delete them with python?

Is there a python code to find and delete back-faces? As a way to do "back-face culling".
6
votes
1answer
2k views

Draw geometry on screen using BGL module

I am trying to use the bgl module to draw triangles on top of the Blender interface. My understanding is that glBegin/glEnd are deprecated, and vertex array or display list or VBO should be used ...
-5
votes
1answer
1k views

proper bpy.ops context setup in a plugin [closed]

How can I properly set up context in plugins? I am importing Digital Terrain Models using a python plugin. ...
4
votes
1answer
2k views

Play 1000 Frames Per Second in Blender

I am trying to animate using Blender. I want to play 1000 frames per second, but Blender only seems to allow a maximum of 120. I am not super conscious about quality but I have thousand different ...
5
votes
3answers
980 views

How should I handle a large number of objects?

I am working on updating an importer for Structure Synth and I am realizing that it might actually not be practical. In structure synth, you can create thousands and thousands of objects, each of ...
7
votes
2answers
519 views

How to create a script that connects points in an animation?

I want to create a script driven animation with Blender. I want to create an animation of lines connecting a bunch of vertices. Is it possible to do this? How would I change the properties of the ...
12
votes
1answer
2k views

Bake Fluid Simulation via CLI or Python?

I would like to run a fluid simulation on a headless Ubuntu machine I have lying around. I did manage to find a bug report on the issue but to no avail. Has anyone else had any success? Or perhaps a ...
14
votes
3answers
4k views

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.
10
votes
2answers
7k views

How to add a UV Map to a Mesh Using Python

I've made a script that creates a mesh in Blender using a binary file containing mesh data. That works fine, but now I need to get textures on the mesh and I want to create a UV map from the UV data ...
5
votes
2answers
1k views

Must I add a license block to all files in a multi file addon?

When an addon grows it becomes convenient to break it out into modules, do those other modules (.py files) also need a license block or is it sufficient to only put ...
6
votes
1answer
3k views

Getting the list of points that describe a Curve without converting to mesh

I've used mathutils.geometry.interpolate_bezier() in the past to create points for a curve using the bezier handle and knot coordinates. from the docs: ...
15
votes
2answers
2k views

How can I navigate the viewport using Python?

Normally, with most actions that you want to script with Python there is a pop-up tooltip that shows you the function that you want to use. However, for viewport navigation there are no pop-ups, you ...