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
0 answers
6 views

blender python check if the Rotate or grab mode is active?

Is there a way to know with python if the user has activated the Rotate or grab mode ( R key or G key) for a pose bone ? Thanks
  • 225
0 votes
0 answers
7 views

Handling changes in the depsgraph crashes Blender

I am trying to watch changes in the depsgraph so that ever time I assign a material to a mesh, all its sibling meshes (those that share a parent) are assigned the same color. The way I do that is in ...
  • 663
0 votes
1 answer
13 views

python navigation to NLA sub-track of an object

I need to fix up animation on a character mesh every time I resync a linked armature, because the related mesh shape_keys animation gets deleted. Manually I have to navigate to the mesh object, ...
  • 4,250
0 votes
1 answer
22 views

python code for Ctrl +Z

I have a small problem. I couldn't find anything even close to it in the blender stack exchange website. I have a python code for duplicating the selected mesh as many times as specified by the user ...
0 votes
0 answers
9 views

Edit Source Code of OpenVR Streamer

I've been testing out this blender addon that allows you to control objects with a VR remote in blender. It works well apart from one feature that I would like to change. When you offset the object's ...
  • 31
-1 votes
0 answers
9 views

How to create prop_search with a custom PropertyGroup and how access?

...
0 votes
0 answers
11 views

How to add an Icon to my costum Pie menu?

I want to add an Icon to my pie menu. How I can do that? ...
0 votes
0 answers
3 views

liboverride_troubleshoot_operation() proper context sought

If I try to invoke the bpy.ops.outliner.liboverride_troubleshoot_operation(...) from a script I get an improper context error, although I've set_select(True) the ...
  • 4,250
0 votes
0 answers
7 views

How to get feedback from particle when it is colliding collision mesh in bpy?

Is there any option in bpy to get a feedback from the particle when it collides with the collision object? I tried to search in the attributes of ...
1 vote
0 answers
17 views

In Python how do you set filters when using ExportHelper?

How do you set ex. use_filter_movie to true before opening the file browser(using ExportHelper)?
  • 2,111
0 votes
2 answers
30 views

Get python version

I've installed multiple Blender versions on my System an therefore have multiple python executables. How can I find out which <...
  • 109
0 votes
0 answers
28 views

Add UI slider to custom panel via script

I am pretty new to scripting in Blender and I am trying to make a test UI panel with sliders. I made a custom property like this: This is what I am trying to do: I have already tried doing this: ...
0 votes
1 answer
29 views

How to trigger an event by reseclecting nodes in the shader workspace PYTHON

All I need is actually just a script or something that acts as an event through which other operators can be triggered. The event should be triggered when a user selects a new node in the shader ...
0 votes
0 answers
15 views

How to write blender python code to set the rotation angle to 15 degrees when the z-axis position is at its maximum in a sincurve animation? [closed]

I want to make an object fly; the sincurve blender python code runs fine, but when I write the code to specify the angle, there is no error but the angle does not change. How can I achieve this in ...
3 votes
2 answers
31 views

Most effective technique to detect changes in mesh-data's?

What would be the most effective way to track changes in the user mesh-data's? I would like to receive a notification signal if a user mesh data has changed. I see a few (fast) approaches possible: ...
  • 1,741
2 votes
1 answer
95 views

Can't see my blender addon after installing and enableling it

I am currently trying to create a panel blender addon with more than one python script (init.py, data.py) . However when I try to test out the code by installing the addon through zip then enabling it,...
0 votes
0 answers
9 views

Select Mode Pie

I'am trying to write a small add-on, with the Select Modes for 3D View and UV Editor. Could do most of the job, but now I'm trying to list the add-on keymap under the add-on tab itself. I've tried a ...
0 votes
1 answer
21 views

How to copy an object but not share the material using python API?

I use the code below to copy a cube: ...
  • 137
0 votes
0 answers
19 views

How change scale text

in command bpy.ops.object.text_add scale not worked #scale=(0.005, 0.005, 0.005) ...
1 vote
1 answer
14 views

How to make a blender library override in python

I like to create some automation in Python on a library override of a linked collection in Blender 3.4.1. I fail to make object P2 editable using Python (see image below). The operator that does the ...
  • 11
0 votes
0 answers
10 views

How to get last message in console via Python

How to making a function that return the last line of string in the console (Assuming the console is not open). I'm using blender 3.4 and trying to use the stdout ...
  • 3,582
0 votes
0 answers
6 views

How to render out png´s or export the pictures from the blender asset browser in python

I want to batch render materials from a bunch of blend files. There are only materials in it no collections or objects. But i need the pictures as png files in 256x256 size. How can i achieve that ...
  • 73
0 votes
2 answers
30 views

How to join mesh using bmesh?

I wrote a script to join mesh using bmesh module but the meshes are joining in one location. ...
  • 628
4 votes
1 answer
26 views

How to add multiple startup files, with different names?

How is it possible (with or without coding) to create more startup options without replacing the old ones?
  • 43
0 votes
0 answers
13 views

Python - exposing built-in enum to layout function

I am building a system where it makes sense to change the transform pivot point when scaling, as pictured here in the editor: Is there a way to point to this in my draw function as well? It can be ...
  • 1
3 votes
1 answer
55 views

How to get which object from the collection is used as particle instance in the particle system via bpy?

If particle system uses Collection as particles in the Render tab of the Particle System settings is there a way to get exact object which each particle is assigned to via bpy? I know that other ...
0 votes
0 answers
17 views

blender python how to apply material one by one and render it in loop

Hello I wrote this code to apply a specific material to the specific object. And make render it. The material are made in advance and exist in blender scene apply material for all object in ...
  • 21
0 votes
0 answers
11 views

Keyframe action/pose

I'm working on an NFT randomization script for Blender. The script keyframes the unique combinations of objects over the timeline (1 keyframe = 1 unique combination). One of the things that should be ...
  • 37
0 votes
0 answers
73 views
+50

Get if a drag and drop was done from the asset browser in python?

My idea is to use a modal operator, or a modal function that runs in the background. The idea is to get an if statemen event based on a hypothetical drag and drop from the asset browser. ...
  • 1,096
0 votes
1 answer
22 views

Cannot flip normals in python with `flip()`

I want to flip the normals via python. I have a single polygon as an object loaded. I am using blender 3.4.1. I try to do the following in python: ...
  • 105
0 votes
0 answers
9 views

Is there any way to add a handler function that runs after opening a file, and before custom nodes are updated?

Basically what the title says. I'm trying to use bpy.app.handlers to run some functions just after a file is opened. I have tried using ...
0 votes
0 answers
20 views

Mesh distortion using automatic weights

I want to make an automatic animation program using python scripts. Now I have some problem when I use the automatic weights function: ...
0 votes
1 answer
25 views

How to replace an image texture with another one using python API?

As shown in the screenshot below, There is a cube labeled 1, and I copied it with ctrl+c and ctrl+v, and then I got Cube 2. Question: The question is on cube 2. I need to replace the image texture &...
  • 137
0 votes
0 answers
15 views

How to assign an image texture to multiple faces with python API? [duplicate]

As shown in the screenshot below, I assign an image texture to the multiple faces with mouse, But I need to do it with python API, how to do it?
  • 137
0 votes
1 answer
29 views

How to get Splines/Curves generated with Geometry Nodes on Mesh object using bpy?

I add Geometry Nodes to the default Cube but instead of using its geometry I use a Curve Line: How to get this Curve Line data with bpy? I've tried the following ...
-1 votes
0 answers
37 views

Blender Script to rename and Merge vertex groups

I am modifying a script to, when run, will rename the vertex groups of the object and skeleton, how ever I need it to also merge certain groups like the weight mix modifier. is this even possible ...
0 votes
1 answer
14 views

Copy a texture from BlendDataTextures via Python

How to copy a texture from bpy.data.textures ...
  • 3,582
0 votes
0 answers
13 views

Automate preinstalled Add-On action (3D-Print Toolbox)

I've been using the 3D Print Toolbox Add-on in Blender to check for and fix non manifold edges and would like to automate the actions on a list of STL files. Right now I do the following: Import an ...
  • 101
0 votes
0 answers
19 views

How to delete animation keyframes from shaders parameters?

Does any body know how to clear animation from shader nodes (for example, animation from roughness,or transparency and so on) My aim is to iterate all nodes of one material firstly and clear them from ...
1 vote
1 answer
25 views

How to assign a material to multiple faces with python? [duplicate]

How to assign a material to multiple faces with python? As shown in the following image, there is a cube, I subdivide one big face into 49 small faces, then I assign the green material to the 49 small ...
  • 137
0 votes
0 answers
15 views

Deleting model from scene

I'm trying to make a script that opens the .obj files from a folder one by one and performs a boolean operation based on an .stl file called rail.stl. Then I want this script to transform the .obj ...
  • 1
0 votes
1 answer
13 views

Is there a way to delete a Material by name from a Python script?

I have a script in which I read an FBX File in and replace the input material with a Blender material. The old FBX material remains in the scene tough until the file is closed. I have the name of the ...
  • 330
0 votes
0 answers
8 views

How to add a sequence of key frames with given consecutive rotations of bones?

I'm trying to add a sequence of frame with given consecutive rotations of bones. But, obviously, it is not practical to add the rotation frame by frame. There must be some concise and simple problem ...
0 votes
0 answers
25 views

Property fields are not shown in popup dialog, why?

I am attempting to learn Blender and therefore following some Youtube "courses"... The below code should present a popup dialog with two property fields. ...
  • 25
0 votes
0 answers
15 views

Multiple UV maps into Unreal [closed]

Im trying to make pivot based animations for my foliage meshes, for this i made script for blender to save the data as additional UV layers. But for some reason the values im geting in the engine are ...
  • 11
0 votes
1 answer
42 views

How can I make a custom math node?

I'm continuing to work on a procedural skin system, and it's got so complex that my PC is having trouble running it. My workaround so far has been to just turn parts of it off while I work on other ...
3 votes
2 answers
112 views

Blender Python module (bpy): use integer property with exponential increment [duplicate]

I have an integer property I would like to increment as 2^int property. If that isn't possible, I would alternatively like to just have regular increment, but display the value in the panel as 2^...
0 votes
0 answers
22 views

Blender Python BVHTree.overlap not detecting overlaps

Why is overlap not being detected with any of the 3 selected objects and the lake (center) overlapping them? Meshes are in the same plane, same collection. Thanks in advance, cheers! Screenshot: <...
  • 11
0 votes
0 answers
22 views

Get a mesh from a frame of a MeshSequenceCache in script

As the title says, I need help to understand how to access individual meshes from an object with a mesh sequence cache modifier that was created by importing an alembic animation. I want to access it ...
0 votes
0 answers
18 views

How to hide local collections (thus in local viewport only) from script?

I'm working on a script that add a new Workspace with a 3D View and I want to hide some collections only in that viewport. I've seen that there is this property: ...
  • 177

1
2 3 4 5
245