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.

0
votes
1answer
41 views

Uniquely addressing vertices in python

This has been driving me crazy for some time, because it seems so simple, but I just cannot find a way to do it despite exhaustive searching. Say I'm in bmesh, and I create a vertex, and I add it to ...
0
votes
0answers
56 views

How to make the button Edit and Object mode in Blender 2.8?

In Blender 2.8, some classes, or rather buttons, do not work in my addon. Which worked in version 2.79. Please tell me how to make your own button. For example, the simplest. Object and Edit mode. And ...
0
votes
1answer
26 views

finding the source for “API Defined” custom properties

It seems that I have a couple plugins automatically creating custom properties with "api defined values" on every object i make. Now that I'm starting to make drivers with custom properties, I want to ...
1
vote
1answer
158 views

Registering classes in Blender 2.8

Can you please tell me how to remake it for Blender 2.8x version? ...
0
votes
1answer
55 views

Editor and ways recommendation for Python addon development

I am a Vim user and generally happy with it but I see some drags with Blender addon development when I use it. What editors and ways do you use to do your Blender development? Vim oriented solutions ...
1
vote
1answer
32 views

Get position of node socket in python

Is there a way to get the position (x/y coordinates) of a socket on a node in the node editor? I'm working on auto layout functionality and having the actual socket position would make it much more ...
0
votes
0answers
30 views

Programmatically assigning EnumProperty items in a CollectionProperty

I have a CollectionProperty which contains an EnumProperty, and I need to programatically assign each ...
0
votes
0answers
89 views

Extrude doesn't work “Traceback (most recent call last)” error message

I was using edit mode for some basic modeling and animation. But, in the day after that, I opened the file and it's verticies/edges/faces wouldn't extrude, with a giant python related error message ...
1
vote
1answer
33 views

Blender GLTF : which rotation values are really exported?

I am using https://github.com/KhronosGroup/glTF-Blender-Exporter in a script and trying to compare the exported rotation values. But none of them seem to match. Ie. for exported values in the gltf ...
1
vote
1answer
63 views

3D desktop application with Blender

I'm currently in the process of looking for the best tool to develop an application. Based on the following specification, I'd love to hear from you blender experts whether it's the right framework ...
1
vote
1answer
60 views

Python script for adding Child Of bone constraint with 'Set Inverse' to multiple bones?

Completely new to scripting and was hoping someone would help me out here. I've imported a rig twice and want to add a "Child Of" bone constraint to each bone in the first rig using the matching bone ...
1
vote
0answers
14 views

App Handlers - change order of multiple addons?

Its clear that "bpy.app.handlers.render_pre" gets called before "bpy.app.handlers.render_post". But what happens if I have two or more addons which all add to the "bpy.app.handlers.render_pre"? How ...
3
votes
0answers
20 views

Getting Color Values Produced by Dynamic Paint

I am having trouble with the python code to get the colors of vertices when using Dynamic Paint. If I try painting a cube using the Vertex Paint mode I can get the rgb values of the vertices using the ...
2
votes
0answers
34 views

Python: bmesh.verts not loading all vertices of mesh

As the title says, I am using bmesh.verts to load in all the vertices of a mesh to then check if their coordinates are within a certain box, and if they are select them. The problem is that the ...
0
votes
1answer
26 views

Deleting an Object in the Blender Game Engine using a Mouse Click Event

This might be a simple question, but how would one delete an object on a mouse click when the object is clicked? Picture below. Logic bricks or python is accepted. Thanks in advance
-1
votes
0answers
40 views

Bake to texture crashes with several materials using Blender's Python API

I'm trying to bake multi materials from an object to another one. I've set up a test scene with a cube with two simple Cycles materials on it. I select my cube and then launch the script. Although ...
0
votes
0answers
18 views

Are BMesh MeshLoops an only/preferred way to iterate over mesh triangle polygons?

I'm writing a simple script that has to iterate over triangular faces of mesh (not n-gon polygons). I need to access theire data (vertices, edges, material indexes) Basically I'm doing it like this: ...
0
votes
1answer
64 views

render multiple frames using a for loop, stack overflow after one image. Is there anyway to avoid stacking while rendering?

I am trying to move the camera around an interested object, and then render frames along the camera trajectory. The trajectory part worked well, but when I tried to render frames and save the depth ...
0
votes
2answers
66 views

How to scale an object via a slider in Python?

First: I'm new to Python programming in Blender. I already know how add a row to scale one single axis of an object by using a slider in the tools panel e.g. I'm using this code snippet to do this: <...
6
votes
1answer
117 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 ...
2
votes
0answers
25 views

Variable invalidated after CTRL+Z

I recently observed a behavior in blender scripting which I do not understand. Can you help me understand what is happening in the following example? Start blender, add a cube, go to scripting view ...
0
votes
0answers
22 views

Loading a model into the scene

I've downloaded a football model and want to load it into my scene with a script. The download was a zip file containing these files: ...
3
votes
1answer
44 views

Why isn't my 'frame_change' app handler working?

I am new to scripting in Blender and I am having trouble attaching an app handler to keyframe changes during an animation. Below is my Python code: ...
0
votes
1answer
50 views

Animate an object by moving it according to a list of coordinates

I have the list of coordinates of an object (a ball) in 3d space in a csv file. How can I create an animation in blender of that ball moving through those coordinates?
1
vote
0answers
36 views

Writing an exporter - learning the API [closed]

I'm researching the Blender API while working on a custom exporter. The features I want to implement are similar to the IQM exporter. I'm trying to get a better understanding of some of the API calls ...
1
vote
1answer
33 views

python: pie menu to display the pivot center modes

I would like to create an operator that would trigger a pie menu containing the "pivot center modes" in it (median point, individual origins, 3d cursor, ...). Now I could get started with the code ...
1
vote
0answers
51 views

How to draw custom, complicated ui element

Is it possible to add custom drawn elements to UI? e.g. access OpenGL and draw shapes from code, create some "canvas" in UI and draw on it. e.g. I'd like to create a complicated interface, something ...
2
votes
0answers
15 views

Auto-keyframing fails to record when a modal timer op is setting position/rotation?

I have a serious problem in understanding how the Modal Operator works. I created a Python script using the Modal Operator Timer template, which basically translates and rotates the camera of the ...
1
vote
1answer
51 views

Python: Selecting vertices and separating them into new object

I have a mesh with millions of densely packed vertices, and I what I want to do is be able to bisect them into separate objects. What I struggle with is selecting the vertices I want to be separated ...
0
votes
0answers
33 views

Is it possible to add images in the Text Editor?

A little bit of context: I've beeng working around some "interoperability" between Blender and other software/hardware like: Pure Data, reacTIVision, Arduino, Raspberry Pi, etc. I toyed with doing ...
2
votes
1answer
45 views

How do I initiate a render from Python but still show progress bar and UI updates?

When I run bpy.ops.render.render(write_still=True) from Python on large files, Blender goes into "(Not responding)" mode and the CPU spins like crazy for a few ...
0
votes
0answers
18 views

Raycast hit problem.

I'm using the raycast function to get the location of the hit of each ray onto an object. My problem is that the ray doesn't stop on the first hit on the surface of the model, it keeps going to until ...
0
votes
0answers
13 views

How to wait for completion of animation_play()?

I am implementing Blender animation in my simulation package salabim. I can do the actual animation in one frame handler. But the problem is that after the call to animation_play() I want to wait for ...
1
vote
1answer
31 views

Where does python output go in the game engine?

I've been messing around with the game engine for a bit and decided to do some testing with python. What I have set up is a logic brick that executes a python script every time I press "W". The script ...
0
votes
0answers
16 views

How to set different interpolation type in both Location and Material(diffuse color) animation keyframes by Python code?

I use object.data.materials[0].keyframe_insert('diffuse_color') to insert multiple(hundreds) objects' diffuse colors, and use ...
0
votes
0answers
113 views

Blender ImportError: cannot import name urandom

I have an old addon for blender-2.49bpy-linux-glibc236-py26-x86_64 and I installed python 2.6.2 but when I run my old addon RoRImporter in Blender I'v got this error ...
0
votes
1answer
47 views

BKE_bpath_absolute_convert: basedir='', this is a bug

I am getting this error in the terminal after running my script(2.79b). What am I supposed to do? This is basically my script ...
3
votes
1answer
123 views

Rendering large amount of short videos with different generated “animation”?

I have a very specific and probably strange question to which I couldn't find any answers. I'm a computer vision researcher and I need some data for a "small" side project, I want to know if it's ...
0
votes
1answer
81 views

Edge length font size

Is it possible to change part of source code inside blender which determines the edge length font size? I know, the scale of the interface can be changed, but this also changes the size of the other ...
3
votes
1answer
65 views

Python with Blender: Using EnumProperty the dynamic way

I want to use the EnumProperty the dynamic way. I've got two dialog boxes. In the first one I'm asking for database parameters and in the second one the user has to ...
0
votes
1answer
75 views

Set inverse Child OF constraints via python [duplicate]

A few years ago I used to be using a little script found here in order to reset every "Stretch to" constraints of an armature, in pose mode, even on unselected/offlayered bones : ...
0
votes
0answers
20 views

How to set visibility on view layers via python?

What was obj.hide in Blender 2.79 is now obj.hide_viewport in 2.80. This is different from the newly introduced visibility on view layers, which describes visibility on different viewlayers, and is ...
1
vote
1answer
25 views

Simple Python script - Adding a primitive object to the active layer

I use great "Pie Menu Editor" addon and in the "command" section I would like to add command that adds a primitive object to the scene, but only to the active layer. Default code that can be copied ...
0
votes
0answers
14 views

Need to use dill inside blender

Does anybody know how I can use dill inside blender. I am unable to pip install it to the blender version of python. I have it installed locally but cannot use it in blender. What are my options?
0
votes
0answers
21 views

Blender game without bge?

If we clean all the interface shortcuts, delete all the menu entries, enable full screen and disable overlays, we have a locked viewport. But if a modal operator is trigered somehow, it can act like ...
1
vote
1answer
70 views

How to get the speed of a Camera with Python?

I'm currently working on a project in 2.79b containing multiple shots that require several cameras (2+ keyframes for Location with a ...
0
votes
1answer
57 views

Orientation perpendicular to Edge

I have got a mesh that's converted from curve. It has only edges. I need to successively orient one of the objects in the scene to the direction pointed by the blue arrow in the illustration above (...
1
vote
1answer
57 views

Why would adding a parent with Python make the child unmovable?

update: As it turns out, it was because I scaled the child object to z = 0 - c.scale(1,1,0) - scaling to non-zero works just fine I have a child called c and a parent called p. I use Python to ...
0
votes
1answer
107 views

How to mirror a mesh on x-axis on pivot point with python?

I've an object with pivot point in the centre (0,0,0). I want to mirror it by python on the x-axis and do it for all objects in my current scene. I tried this, but the second line seems not to be ...
1
vote
1answer
45 views

How do I choose the next item after using Autocomplete in the Python Console?

The list that populates below bpy. after using Autocomplete (Ctrl+Space) in the Python Console is: app, ...