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,575 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
37
votes
1answer
2k 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 ...
18
votes
0answers
801 views

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 ...
14
votes
0answers
546 views

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 ...
9
votes
1answer
271 views

Branching and swirling mesh on a ring

I need help constructing this ring. I thought it would be simpler, but the splitting and recombining of curves that swirl in variously symmetrical ways make the intricacy a little more difficult than ...
9
votes
1answer
323 views

What do different execution contexts mean?

The documentation says that I can invoke an operator with a different execution context, either invoking or executing it. What I know is that invoke will most often ...
8
votes
0answers
297 views

How to call original operator from operator's override?

I would like to amend functionality of an existing operator with a condition check and then "proceed" with the original operator (if condition check allows it). It is essentially what is ...
7
votes
0answers
261 views

Tracking script in Python

I am attempting to make these GUI steps into a script. When I follow this process manually, I get a tracking error under 1 and I get some great matches. This is far better than autotrack. ...
7
votes
0answers
261 views

Copy scene node tree to other scenes

I have a Blender file wih many scenes and I want to copy the node tree of one of them to the other scenes. From Blender interface it is a very simple task, in python I have tried using bpy.ops.node....
7
votes
0answers
201 views

Set Active FCurve in Graph Editor through python

I'm trying to set an FCurve in the Graph Editor to "Active" through python. In the API FCurves don't actually have an "Active" property, but manually click-selecting a channel or keyframe on an ...
7
votes
0answers
256 views

Blender on Windows is skipping python script. (brenda on windows)

We've been using Brenda for quite some time now for rendering architectural stills. Since our editing stations are doing nothing at night, I started making a desktop app that allows you to pick jobs ...
7
votes
0answers
436 views

Save screenshot (bge) without writing to disk

This is a little odd but I need to save a screen-shot as an array (numpy array for eg) without writing to disk. The idea here is to create and then call the array once per frame in an external script ...
6
votes
0answers
94 views

How can I get a list of currently running modal operators?

Here I found a working solution using ctypes which allows to find out if any modal operator is currently running. I am not good in C and don't understand how it works. But I'm sure someone does, so is ...
6
votes
0answers
80 views

Play/animate images, spritesheets or video files in 'template_icon_view'

I want to "play" some animation in this UI space, the template_icon_view: I can load all the images I want, for example: I know that the gif format is ...
6
votes
0answers
494 views

How to bring the context “back” after running read_homefile()?

When I run import bpy bpy.ops.wm.read_homefile() and then I replace the above with this (in the same text data block) ...
5
votes
0answers
81 views

Copy framebuffer of 3D View into custom frame buffer

General question: Is there a reliable way to directly access the OpenGL framebuffer of a View3D for copying? (Please see the end of the post for more detailed questions) I need a very fast way to copy ...
5
votes
0answers
98 views

How to access Density/Flame grid via Python in 2.82 (Mantaflow)

Does anyone know how do I access the density/flame grid for the new Mantaflow fluid simulation engine in Blender 2.82? The old path still exists: ...
5
votes
0answers
432 views

Use self and the slow python expression

In putting together an answer to Changing Multiple Influences Simultaneously I came across the Slow python script warning in the drivers editor Using a set up as outlined here driving a pose bone's ...
5
votes
0answers
311 views

Update function for NodeSocket?

How do I set a callback for socket input change (value or link change) when having a custom node? I have a socket defined like: ...
5
votes
0answers
459 views

PyOpenGL and VBO Indexes

Long story short, I'm trying to do a modal handler that draws using OpenGL into the viewport. Immediate mode through BGL works fine, but is dog slow. I tried using VBOs through BGL but there seems to ...
5
votes
0answers
2k views

How to convert image pixel values from 8bit to 32bit properly? - answered.. but why byte image buffer is stored with non-linear color values?

I'm testing code from this question: `` import bpy ...
5
votes
1answer
272 views

“Search for unknown operator” On Start-Up After Removing Module and Shortcuts

For lack of a less drastic alternative, I created a whole module just for setting bpy.context.window.screen to a specific screen, since ...
5
votes
1answer
1k views

Vertex Normals different from loop normals

I'm writing a model exporter in Blender 2.77 and except from triangles and vertex positions, I also want their normals and tangents. As an example, I'm using a simple cube centered at the Origin (0,0,...
5
votes
0answers
122 views

What do all of the mode enums mean?

What do all the various mode constants in blender operators documentation do? bpy.ops.object.duplicate(linked=False, mode='TRANSLATION') - Duplicate selected objects Parameters: ...
5
votes
1answer
170 views

Cannot mix .user and .addon keyconfigs in register()

I've been messing around with keymaps lately and I've come across behavior that doesn't make much sense to me. I am searching the current keyconfig for a specific keymap item, removing it, then adding ...
5
votes
0answers
269 views

Does anyone have an example of template_curve_mapping?

I'm doing some test with template_curve_mapping. I have write this code: ...
5
votes
0answers
710 views

Converting an obj sequence to a .bobj fluid sim cache?

I'm wondering if there is any way to accomplish turning an obj sequence exported from realflow into a .bobj fluid cache that I could then trick blender into loading as a native fluid sim cache. So far ...
4
votes
0answers
41 views

Recover python script after blender crash

When writing a script and Blender crashes I lose the changes in my script? If blender crashes, I can only get the scripts I've saved manually saved (via Alt+S or Edit > Save). Often I will do Run ...
4
votes
0answers
39 views

Python Autocompletion

Is there any option for Python autocomplete to work properly in Blender? Currently it shows under Tab all the possible options that were entered previously in the code. It doesn't make any sense to ...
4
votes
0answers
57 views

Blender python interpreter doesn't like cuda: Trying to run cupy

I'm trying to launch some form of cuda interaction via the blender python interpreter and keep running into Segmentation Faults. After tracing through the code with python's ...
4
votes
0answers
154 views

Is there a low level alternative for bpy.ops.mesh.separate()?

I am dealing with a great model, I have a problem, I want to divide it by parts, but bpy.ops.mesh.separate(type = 'LOOSE') seems to have a big problem, that is not ...
4
votes
0answers
90 views

How to redraw status bar in Blender 2.80

I've added my own progress bar to the Blender 2.80 status bar (the footer of Blender) with the following abstracted code: ...
4
votes
0answers
136 views

sending Data or Values to linked Objects in Blender 2.80 / 2.81

I work a lot with linked data and library objects or linked collections. Is it possible to send values or variables between the different hierachical structures ? So for example: SCENEFILE (var = ...
4
votes
0answers
87 views

When is the depsgraph_update handler triggered? (and how does the depsgraph work? )

I've been looking at the depsgraph changes in the documentation here, but I don't know if I understood it right: the dependency graph is a sort of diagram that links data blocks to each other so that ...
4
votes
0answers
129 views

Setting custom prop to Sequence

I need props in sequencer strips, to store data in each individual strip. One of the prop should link to other strips but: I can’t make PointerProperty(type=bpy.types.Sequence). I get this error: <...
4
votes
0answers
49 views

Blender Python: Output Paragraph of Text?

Is there any built-in support for automatic line breaks when writing text to the UI, such as through the layout.label() function? For example, if I set text that ...
4
votes
0answers
98 views

Is there a way to get a node's dimensions without displaying it in the Node Editor?

The aim of the question is to calculate a node tree layout for a generated node tree. Nodes have height, width and ...
4
votes
0answers
158 views

official name and meanings of properties (Custom, RNA , ID etc)

I sometimes feel difficult to call type of properties which user (or add on) added. and choice of them.(set driver etc) I know there are clear difference and how to add new properties, but I still ...
4
votes
0answers
106 views

Call pie menu in holding state

so here is what i want to do: holding state = when you hold the key when calling vie keymap tapping state = when you tap the key when calling vie keymap call a pie menu from another pie menu set the ...
4
votes
0answers
70 views

Programmatically changing UV/Image Editor Image

For a school project, i am trying to combine openCV and Blender and for this very spesific reason, i would like to use Blender's internal Image Editor to show my frames instead of cv2.imshow() ...
4
votes
0answers
101 views

What is the appropriate way to write and distribute an addon that works with both blender 2.80 and 2.79?

I have written a python addon which is compatible with both 2.79 and 2.80. When setting the "blender" key in bl_info to the appropriate version, the code works otherwise unmodified in both versions, ...
4
votes
0answers
431 views

How to use bgl?

I want to render simple lines on the 3D viewport through a modal operator but not using glBegin/End because those commands are deprecated in opengl 3.3 and will not be avaliable on 2.8 leaving me ...
4
votes
1answer
327 views

ATOM : setup blender python environment in my IDE

Anyone using atom here for developing blender addon etc ? How can i setup the blender environment (autocomplete, lib access etc) in Atom ? Tried to googling it but can't found any help. Some tutorial ...
4
votes
0answers
449 views

Can Blender automatically reload external script files when they are changed?

I came across this question: Is it possible to run a script from an external editor without reloading the file? Which also was asked over here in a similair format: Workflow for developing add-on/...
4
votes
1answer
874 views

A working guidance for building blender as bpy python module?

There are informations on how to build a bpy python module from blender source but, it does not work (for me) using Ubuntu x64 16.04LTS. We need a working guidance !? Building it up with: https://...
4
votes
0answers
463 views

Viewport widgets with draw handler

Is it possible to create viewport widgets with draw handler? I have an operator which produces simple mesh geometry, I use operator redo properties panel to edit the result as shown in animation ...
4
votes
0answers
985 views

Controll cube with arduino + mpu6050

So i have an arduino with an mpu6050 attached to it. It is currently set up to send the raw data from the imu sensor to my computer. I would like to use this data to control a cube in blender with ...
4
votes
0answers
289 views

How does 'Align Active Camera to Selected' decide where to place the camera?

Thanks to this answer, I'm using bpy.ops.view3d.camera_to_view_selected() to automatically place a camera so that it frames the selected object for rendering. But ...
4
votes
1answer
1k views

How to update compositing nodes via script?

I create some nodes in compositing via python script: ...
4
votes
0answers
255 views

Is there a low level alternative for bpy.ops.object.convert(target='CURVE')?

(Note: Somebody asked there nearly the same question as me and got a very nice answer. However, this was to convert an object to a mesh. I have exactly the same context as this person but I want to ...
4
votes
0answers
173 views

How can I derive from an existing Operator in Python?

When creating a new Blender Operator, you'll derive the class from bpy.types.Operator, like this: ...

1
2 3 4 5
52