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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
40 views

Render face of a mesh using bpy?

Im trying to write a script for baking all the faces of a mesh with whatever renderer is used in the viewport. At first, I was gonna move the viewport around and take "screenshots" of each ...
Willy Wonka's user avatar
2 votes
0 answers
20 views

How to make a collection's custom property animatable?

As far as I understand, custom property in UI, is nothing more than an "add-on" written in python. But for some reason collection's custom property cannot be animated. Does anyone have any ...
Dmitriy's user avatar
  • 41
2 votes
1 answer
32 views

Baking the same object multiple times makes it get slightly darker with each bake

When I Bake my object it gets slightly darker with each bake. So when you start with white it eventually becomes gray and then dark until it's black. Is it maybe lighting that causes this? But I am ...
Megan Love's user avatar
1 vote
1 answer
30 views

how to get 2d bounding box(x_min,x_max,y_min,y_max values) from IndexOB output of RenderLayer node in Blender compositor?

I'm doing synthetic data generation for AI training. I need to render lots of images a scene, and giving the 2d bounding box value of each object in the image(assuming that all object in the scene ...
miaomiao's user avatar
2 votes
1 answer
79 views

Generate Rig from vertecies

I am looking for a way to automate this setup: Basically, i want to generate a armature with bones for every vertex of a selected mesh. Ideally, the bones should point in the vertex's normal ...
Julez Chilluminati's user avatar
1 vote
0 answers
49 views

How to get the last saved file name in Blender's file browser, using Blender's Python

If I open Blender's file browser (in my particular case, it would be the one invoked by "Save image" in the Blender render window, "Image" menu), the filename text field will ...
Etord's user avatar
  • 45
0 votes
0 answers
22 views

Animating custom attributes with python

I'm looking for a way to animate custom Blender attributes. Let's say we have an attribute created using the solution from this post: Manually setting custom attributes per edge / vertex / etc ...
websterek's user avatar
0 votes
1 answer
20 views

blender 4.1 how use `bpy.ops.object.geometry_node_bake_single`

In Blender 4.1's Geometry Nodes, the Bake node has been updated. The bake button within it has a Python code: ...
levosaber's user avatar
  • 129
3 votes
1 answer
59 views

How can you access a registered class of a Blender add-on from another Blender add-on?

TL;DR: I would like to use a subclass of PropertyGroup defined in one add-on as the type of a PointerProperty property of another add-on. I have two addons, Foo and Bar like this: Foo ...
T1nk-R's user avatar
  • 43
0 votes
0 answers
18 views

How do you add extra socket types to shader node groups in Blender 4.0+?

Before 4.0, you were able to run a script like this: import bpy bpy.data.node_groups['NODE_GROUP_NAME'].inputs.new('NodeSocketFloat', 'SOCKET_NAME') and it would ...
LuigiTKO's user avatar
1 vote
1 answer
17 views

Adding a color field in the addon Panel

I wanted to add a color field to my Blender addon panel, with which I can adjust the color input of a Principled Volume node. But i´m struggling, how I can insert such a color field there and ...
VICUBE Animation's user avatar
0 votes
1 answer
11 views

Rendering text strip in VSE is not working

The code works fine in viewport until I start rendering. The text strip just get freeze. It does not have evaluated_get unlike the objects that's why Depsgraph ...
Muzammil12's user avatar
0 votes
0 answers
13 views

What is the proper and reliable way to get a newly created UV map via python?

Since Blender currently adds a newly created UV map at the end of the UV Map list, I initially retrieved a newly created UV map like this: ...
Megan Love's user avatar
0 votes
0 answers
24 views

Delete vertices one by one, when using the 'Add Mesh: Extra Objects' addon to plot points

I am using the 'Add Mesh: Extra Objects' addon in Blender to plot points at specified coordinates. Each point is added to a mesh of points instead of being a separate object. My goal is to implement a ...
crisplettuce's user avatar
0 votes
1 answer
19 views

Set two objects with the same rotation quaternion but their rotation euler are different

As far as I understand, Euler angles and quaternions are two approaches for rotation. So I suppose that if the directions of two objects are set by the same quaternion then their Euler angles are ...
Ta Thanh Dinh's user avatar
0 votes
0 answers
7 views

How to convert fisheye model parameters calibrated in OpenCV into fisheye in Blender?

I want to simulate a real-world fisheye in Blender, using parameters calibrated in OpenCV. However, I don't know how to map these parameters into Blender.
wangwang's user avatar
1 vote
0 answers
22 views

Python scripting in Blender: cannot import pytorch

I'm using Blender 4.0, and my machine runs Ubuntu 22.04. Here is my basic problem: I have a python file, call it rendering.py, that will set up multiple scenes and ...
ahotpotato's user avatar
0 votes
0 answers
21 views

Getting two defining points for almost rectangular objects

I have a large number of objects that represents windows and doors in a building. These objects are almost rectangular and vertical and I now need to find two representing points for each of these ...
Max's user avatar
  • 11
0 votes
1 answer
38 views

Blender 4.0 geo nodes: Bezier curve with 5 vertices subdivide only top 2 and bottom 2

how can i make in blender geo nodes the bezier curve only subdivide inbetween the top 2 vertices and the bottom ones, while the one vertice in the middle is unsubdivided? Appreciate any reply
Murat G's user avatar
2 votes
0 answers
22 views

How can I get the final evaluated material color of each face?

I want to be able to get the final evaluated color for each face regardless of what shader node setup I have. I just want to get the final color result flowing into the Base Color socket of the ...
Megan Love's user avatar
2 votes
1 answer
48 views

Python: What is the fastest way to change the 3DView shading type in Blender Python?

Is there a way in Blender Python to change the 3D Viewport space shading.type or the shading.color_type directly? I mean: without parsing all the screen areas for the 'VIEW_3D' type and change it then?...
Christoph Werner's user avatar
2 votes
1 answer
18 views

Where to find docs for TRANSFORM_OT_shrink_fatten?

I have a python script I made two years ago. It doesn't work anymore. So I thought I would upgrade it to work with the latest version of Blender. The failing line is: ...
Gunslinger's user avatar
  • 6,392
0 votes
1 answer
24 views

Blender hanging when using threading cond.wait() in python

I have this code that iterates over a lot of .obj files, applies some properties, plays the animation, then write some information about it to a file ...
AskedSuperior's user avatar
4 votes
1 answer
136 views

How to validate a float input to 2 precision in panel?

I'm trying to validate the inputs in a FloatProperty and make sure precision is always up to 2 decimal places. Apparently ...
Megan Love's user avatar
1 vote
0 answers
25 views

How can I extract warnings/messages from the system console in blender to python script

How can I extract warnings or other messages from the Blenders system console into my Python script? For instance, I would like to be able to check if a specific warning has occurred during the use of ...
Axel Olsson's user avatar
0 votes
0 answers
14 views

Handle when material is dragged and dropped onto object

I need to handle some special steps for my material system, when a material is assigned. I've followed this tip so far, and it works well if assigning through the properties UI. It does not work when ...
Xoliul's user avatar
  • 65
-1 votes
1 answer
150 views

How to apply changes to an installed multi-file add-on without restarting .blend-file?

I was revisiting and enhancing some of the add-ons I've created in the past. I wonder, is there a way to update an installed multi-file add-on (if it has been changed) without reloading the Blender ...
Yaroslav's user avatar
  • 435
1 vote
0 answers
33 views

How do I check two nodes indirect connection

What is the best way to check if two nodes are indirectly connected? Let's take for example the RGB node and the Hue/Saturation/Value nodes. They are not directly, but connected, with other nodes ...
Tsybe's user avatar
  • 469
1 vote
1 answer
17 views

Is it possible to pass args in bpy.app.handlers.frame_change_post?

Like the obj argument I want to send more arguments to the function. It is not working right-now. Thanks in advance ...
Muzammil12's user avatar
0 votes
0 answers
10 views

Script Does not work on Cloudrig after regeneration auto executon but it works when I execute it manually

Script Does not work on Cloudrig after regeneration auto executon but it works when I execute it manually ...
Luka Javakhadze's user avatar
0 votes
1 answer
28 views

How to link object data but keep size of objects

This question has been asked already, but no solutions were proposed. I have a huge set of imported tree objects, each as a separate data block, each with scale applied. I want to link them all into a ...
michalpe's user avatar
  • 135
1 vote
1 answer
30 views

Catch Warning message of operator

When the bind button is clicked, it will display some message in the UI I'm trying to store a message as a global variable while handling that operation through the API. ...
X Y's user avatar
  • 5,293
2 votes
0 answers
15 views

Add custom Asset Library path on startup

I run a small studio and we are looking into centralizing blender install. OCIO and addons I can deal with a custom startup.py script that I launch when blender is started, but I cant find a way to ...
user3427317's user avatar
0 votes
0 answers
22 views

How to add custom sliders UI in blender to change the material properties of a collection and also drive an animation using drivers?

In the pics below Animagraffs has added custom slider UI where he can change the transparency of an object within a collection by changing the value of the alha of the material. He also drives the ...
Rickter Hashimov's user avatar
2 votes
1 answer
80 views

How to make popup auto adjust width?

I want my popups to be wider to fit the label but it seems it is limited to this width as shown with a label with ellipsis. How do I make it wider? I tried ...
Megan Love's user avatar
4 votes
1 answer
106 views

How to get updated mesh locations after object collisions?

I am very new to blender. I have a scene like this, The top plane is a cloth, the two cylinders and rectangle are collision objects. I click play on the timeline and get this after a few seconds, I ...
AskedSuperior's user avatar
4 votes
1 answer
125 views

Show Texture preview via Gpu module

We can show a image (bpy.types.Image) on viewport through the following python code. But how about a texture (bpy.types.Texture) ...
X Y's user avatar
  • 5,293
3 votes
1 answer
21 views

How to get a list of filepaths to all external files used in Blender project?

Let's say I have a very complex Blender project with a lot of external data, such as images, geometry cache files, VDB sequences, text scripts, and maybe something else I don't even know about. How ...
Andrey Sokolov's user avatar
0 votes
0 answers
17 views

Determine if keyframe of Enum Set match in Python

If the keyframe matches, it appears yellow in the UI, otherwise it appears brown. Now, add a keyframe to Data Transfer Modifier (data_types_verts) ...
X Y's user avatar
  • 5,293
0 votes
0 answers
16 views

How to zoom in on a video clip with Python?

How to zoom in on a video clip with Python? I would like to zoom in "dynamically" starting from first frame and ending on last one. I am using a sequencer to add image sequences like that: <...
Knight of Ni's user avatar
3 votes
1 answer
42 views

How can I display a bpy.types.Text custom properties in the interface?

Re an interesting question in another Q&A : https://blender.stackexchange.com/a/315212/86891 bpy.types.Text, which inherits bpy.types.ID, supports custom properties. It is possible to access, read,...
Gorgious's user avatar
  • 30.8k
3 votes
2 answers
119 views

How to add click event listener to button operator?

How do you add a listener to a button? I need to handle something in the panel once a button is clicked but I don't know how to add this click event listener. import bpy ...
Megan Love's user avatar
0 votes
0 answers
28 views

Is there a way to adjust the python version for a blender addon by changing the code of it?

I'm not really into coding, but the error message looks quite simple, can I just rewrite it in some file or something similar? I'm using 4.1 Release Candidate Version.
vp.gestaltung's user avatar
4 votes
1 answer
81 views

GN: Setting modifier property via python does not update the 3D view

I copied full datapath for my property Vertices X as shown below and set it via python using ...
Megan Love's user avatar
2 votes
1 answer
38 views

Python - Attach property to current blend file

My goal I'm currently working on an addon. I'm quite new to Python, but I'm fluent in programmation in general. My addon's goal is to speed up the process of naming output files, keep track of version ...
Lutzi's user avatar
  • 1,017
0 votes
1 answer
27 views

Is there any limitations in fbx for UV's count?

I'm trying to find out, is there any limitations for UV's export from Blender? My situation: I have skeletal mesh in Blender with 6 UVs, which I'm trying to export into Unreal Engine 5.3. I've tried ...
Сергей's user avatar
0 votes
0 answers
18 views

Learning Scripting with Python and Blender Edge or vertices question

I'm learning to write script in Blender (along my path of coding education and practical usage) and I'm to a point where i'm wanting to adjust certain vertices and certain edges. Can I create vertex ...
Rplogix88's user avatar
0 votes
1 answer
8 views

Selection of bones to selection of tails of bones

I have an armature with a bunch of bones with zero length, and I can select one and do Select > Similar > Length to get all of the bones with no length, ...
snipers500's user avatar
1 vote
1 answer
17 views

What's the correct context for bpy.ops.mesh.rip_move()?

I'm trying to write a script to rip and move the selected vertices of an object, but I keep getting an error that my context is incorrect. I'm writing this on Blender 3.3, but I suspect the context ...
Dr. Cyanide's user avatar
0 votes
0 answers
27 views

Undocumented API change between 3.5 and 3.6 UV Map

I have a script that duplicates a sourceobject N times, one for each entry in a array, and then scales the UV for that object to 1/n the height, and moves it vertically in the UV map to not have ...
teckenflaska's user avatar