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.

1
vote
0answers
3 views
0
votes
0answers
4 views

Adapt Limit Location Constraint to Bounds of Mesh Object

I recently asked a question here looking for advice on constraining a bone to within the internal space of a custom mesh object, using the default bone constraints available in Blender. I've been ...
2
votes
1answer
49 views

Clip depth field of view in nodes

I am a beginner in Blender. This is what I do to save the depth: I can get the real Z in meter from the camera to the object. But how to simulate the field of view ...
0
votes
0answers
38 views

My imported .obj model is appearing as a tiny dot

I wanted to extract some models from ps2 games to blender. I followed this tutorial here: https://www.youtube.com/watch?v=iHlJ3qO4lys and got through all the steps, extracted my model exactly as shown ...
0
votes
0answers
7 views

How to export Python animation to gltf from Blender 2.80?

I have some 3d objects that I use Python code to rotate. In the Blender preview this works fine. How can I export the animation caused by the Python code to gltf? The normal gltf export exposes the ...
0
votes
0answers
9 views

How to remove an app timer

I have an addon that draws text, and after n seconds removes the draw handler, I need to unregister the previous timer at the start of the operator. ...
2
votes
1answer
1k views

Loading an image to a texture from a python script file

I made a plugin to use on blender, installing the plugin will display a panel, and I wanted to display an image on that panel, so I create a texture in the script file with type 'IMAGE': ...
1
vote
1answer
27 views

How should operator id_remap be used?

I'm trying to use id_remap on some materials, but Blender crashes when I try to use the operator. I've tried many different ways to invoke it. Right now I have: ...
0
votes
1answer
19 views

How to get the length of an mp4 video inside a node?

Work with python in blender 2.8 , i try to find a command for get the lenght of an video inside at image node. ...
0
votes
0answers
7 views

Impact Forces in Blender Game Engine

I am using the blender game engine to run drop test physics simulations and I was wondering if there is a way to collect the force and impact data from the collision. Maybe using "appliedImpulse"? I ...
1
vote
1answer
31 views

mapping using cylindrical map via script

I'm trying to create a default mapping mode for an object. I followed through understanding the python API for blender, and things are making more sense at this point, however I'm not able to create ...
0
votes
1answer
6 views

How to stash all actions to current armature?

I just imported a bunch of actions from different files into one blend, but the GLTF exporter can't locate them without them being in the NLA stash. (There used to be a plugin that would export all ...
2
votes
0answers
18 views

Non English 3d Text with Python

I am trying to create 3d text object using python. The text has non english letters and the default 3d text font doesn't have these letters. I can use another font file that supports the entire ...
4
votes
1answer
193 views

Blender 2.8: dynamically set particle locations via python

In Blender 2.7 it was possible to set particle locations dynamically as demonstrated in this answer. In 2.8 particle data isn't up to date unless evaluating the emitter via the depsgraph as shown in ...
0
votes
0answers
25 views

How can I detect text from a non-text object in Blender? [on hold]

Is it possible to detect text in a non-text object? Say for instance you have a picture of a receipt or something and you have some python code that runs over each possible character and matches it ...
1
vote
1answer
16 views

Where are the Shape keys names located? (Scripting)

How can I call up this name (Key.001) in python? Every object has it's own one Key name (Key, Key.001, Key.002, Key.003...) Here it is in the in the console. in order to show it up I had to drag the ...
1
vote
2answers
28 views

Get particle location using python

Is it possible to get the location (world space) of every mesh particle of a particle system and following that the vertex locations of every mesh particle using python?
0
votes
1answer
158 views

sapling tree gen problems 2.8

The problem occured unexpectedly and appears only in one particular .blend file. After shift-a then curve>sapling tree gen no new object is created. Info shows up, pointing three lines in py's and ...
6
votes
4answers
502 views

How to create a Tetrix/Sierpinski Tetrahedron fractal radiating from 0,0,0 ? Python or nodes

Mesh. I want to create it not by dissection of edges, but instead by splitting 1 into 4, or should I say, add 3 more to the original location before moving all 4 away from Local 0,0,0 , and then doing ...
0
votes
0answers
26 views

Low level rendering functionality in Blender's API

While all Blender functionality is exposed through operators, their indirect way of acquiring data for a certain task is tedious. Especially when the data we want them to operate on is acquired ...
1
vote
1answer
44 views

Blender Collision Simulation Data

Is it possible to access data from a collision, such as point of collision and impact force? I am trying to simulate a "drop test" in Blender and cannot figure out how to access the information. As of ...
1
vote
0answers
44 views

How to properly import an obj with all materials and textures using python?

I'm just about to import an .obj mesh to Blender and render it all by using a python script. There are three files: .obj, <...
1
vote
1answer
32 views

Change color space of image texture node using python?

I have trouble to get a script working within Blender 2.8. What is the correct way to change Color Space mode of an image texture node? ...
1
vote
0answers
15 views

Automated rendering actions in modal operator is cancelled

I'm trying to render a bunch of actions with a modal operator that is called with a timer. The first action is rendered as expected, and strangely some times the second and third are rendered aswell, ...
1
vote
1answer
28 views

Clean up when raising an error with python

I have a script that look like this: ...
0
votes
1answer
59 views

Boolean on two simple bmesh

I'm a newbie in blender and I'm trying to play around with the boolean difference modifier. I have two concentric disks and I want to perform the boolean differece between them. I'm using the python ...
0
votes
1answer
12 views

PyQt and Tkinter seem to not work with Blender 2.8

When importing PyQt5 blender throws this: ...
0
votes
0answers
6 views

Check for modifier key when opening a menu

Is there any way to make a different menu appear when a user holds a modifier key when clicking the menu name in a header? I've created a menu that is appended to the 3d view header. I want to have it ...
0
votes
1answer
25 views

Blender Python - Call function when face is newly selected in edit mode?

What I'm making is a script that assigns values to each face, I have a GUI that has fields for each value assigned to each face. So when I click a face I the GUI element to be set to whatever the ...
0
votes
0answers
11 views

How to proper run a python script and a physics simulation simultaneously?

I'm trying to animate objects via script and simultaneously run a physics simulation, but it's not working correctly. The physics simulation is several frames off: The Setup is quite simple: I ...
0
votes
0answers
11 views

How to implement a simple chat option for server-client based game [migrated]

I want 2 players to be able to chat with eachother. I have a running server-client game, but I'm kind of stuck on this one.
29
votes
3answers
15k views

Control Cycles material nodes and material properties in Python

How can I define the different properties of an Cycles material? Such things as glossy, glass, diffuse, RGB-color, emissive via Python scripting?
1
vote
1answer
28 views

Can mesh analysis colours be applied to face material colour

The mesh analysis overhang tool gives me a coloured heatmap in edit mode. Is there any way to use these colours and apply them to the face material colours, so they are visible in object mode? perhaps ...
-1
votes
1answer
59 views

Selecting a new material slot to selected vertices

I have a few vertices selected and would like to change the colour of those vertices with Python script. This means adding a new material slot. I have tried this script, however it changes all the ...
1
vote
0answers
53 views

Python Mix Shader Diffuse BSDF Glossy BSDF Nodes

I am trying to create a plane object in python that uses a mix shader with the first shader being a Diffuse BSDF Shader, color black, roughness 0.200 and the second shader being a Glossy BSDF shader, ...
1
vote
1answer
22 views

Blender UI button creation

I have made a script which I wanna activate with that M button. I've seen tutorials on how to do the simple buttons but I can't seem to figure it out how to make a button there and how to add an icon ...
0
votes
0answers
18 views

Does an assimp based importer already exist?

I'm looking for but for now I haven't found one, I'm thinking of writing one, some good reason not to do it? assimp It already has a python binding even though I'm not sure the status for python3.
0
votes
0answers
11 views

Custom importer for amature bones

I'm trying to make an Amature/Bone Importer in Python for a custom file format in Blender 2.80. In this file format I have the following data: Bone Name Parent Bone Name (Quaternion) Rotation to ...
0
votes
1answer
33 views

What context does save_as need?

I'm trying to save a texture using save_as, because I want to use the optional Copy parameter. I'm using this code: ...
2
votes
1answer
54 views

How do I get a clean slate after every run of my add-on?

So I have been working on an exporter as part of my Google Summer of Code project. As I am new to Blender add-on development, I was under the impression that my code would get a clean slate every time ...
1
vote
1answer
141 views

Knife tool with bmesh API

I need to find the intersection curve between two (open) meshes, and I can do that interactively with the knife tool. In search for a way to do it from a script, I came across the following highly ...
0
votes
0answers
15 views

Create custom layout.prop_menu_enum changes listener

I've got something for you: I made a python script with that creates a custom submenu in the TOPBAR_MT_edit blender menu. It's a layout.prop_menu_enum with multiple choices which items come from a ...
1
vote
1answer
28 views

Paint circle with Python in 3D view direction

I want to draw a circle into the 3d view in the direction of the current view rotation. I have 2 vectors (center, mouse_pos), so I have two points in 3d space, so I have the radius - fine. This is ...
-1
votes
0answers
18 views

Render from many cameras with python script

I have six cameras set up in my scene. Is it possible to render from each camera one after the other with a python script and saving the files.
0
votes
0answers
9 views

How to make one value influence another value in the node editor if theres no input socket?

I am currently trying to have a node setup where a value node output is linked to the Mix input of a Glare node. However, there's no input socket for the Mix input, only a number value. Is it possible ...
0
votes
1answer
29 views

Run modal operator while tool is selected

For my addon in blender 2.8 I need to have a modal operator running while my custom tool in the new toolbar is selected, or at least know when it is selected/deselected so that I can invoke/stop a ...
5
votes
0answers
78 views
+100

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....
6
votes
1answer
3k views

Get/Set coordinates for UV vertices using Python

I got this UV map, and I want to set the position coordinates for all the four vertices to x=0.5 and y=0.5 (in the center of the ...
1
vote
1answer
31 views

connect each vertex by a 3D curve

From this blend file created in Python see file link: https://drive.google.com/file/d/1x3cjvxuWx5PHjViX3jD3HzfCwBMUxm7M/view?usp=sharing Where a grid of vertices is created, I wish to connect each ...