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

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 applied to it that was created by importing an alembic animation. I want ...
0 votes
0 answers
10 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
0 votes
0 answers
14 views

How to stretch armature according to two different points

I an trying to create my own addon. I have a button which adds two points for positioning ("Start_point" and "End_point"). Then another button should stretch a bone between the two ...
0 votes
0 answers
12 views

context.temp_override

I don't understand one small thing regarding temp_override. The simple script is this: ...
  • 667
0 votes
1 answer
16 views

Add the suffix "_low" to all selected objects

There is a certain number of objects and it is necessary to add the suffix "_low" to all selected objects. The screenshot shows an example of how this is implemented in a blender and what I ...
0 votes
0 answers
7 views

how to render data (cube, cone, etc) created by using bpy module in PyQt application?

I want to write a simple APP that use PyQt as GUI, and can create/translate/rotate/reflect the objects that's created by using bpy python module. (Optionally, can I ...
  • 23
0 votes
0 answers
16 views

How to make (a piano) sound when instance is a certain location?

Currently I am creating pendulum waves in geometry nodes in Blender 3.4. Everything regarding movement works perfectly but what I want to add is a sound when each pendulum hits the ground or wall. I ...
0 votes
0 answers
11 views

Compare two materials using node_tree

I'm trying to write some code to clean up duplicate materials after some imports but having a bit of trouble with comparing them. I have used chatGPT to try and progress but I fear as the latest ...
0 votes
0 answers
20 views

Texture Bake Return Value

I would like to print to the console when the texture bake is finished, using this line of code: bpy.ops.object.bake() Is there a return value for this, like if it is canceled or when it's finished? ...
  • 415
2 votes
3 answers
30 views

Align Camera to and Instance in Geometry nodes

I would love some help on this! I have made a GN set up that creates a UVsphere(generated in GN) and the orginal geometry where the GN is the modifier a CUBE. Is a simple Instance on points to create ...
0 votes
1 answer
38 views

I want a python script that can join all the touching meshes in a collection automatically

I have a collection of over 2000 small meshes. I want to automatically have them joined in case meshes touch each other. So, after running python code, I want to end up with fewer meshes. I tried the ...
0 votes
0 answers
9 views

Adding items to VIEW3D_HT_tool_header **after** existing settings/tools

I know how to append and prepend any draw items or operators to the tool_header section: ...
  • 1,867
1 vote
1 answer
15 views

Unable to set Layer Selection value on Data Transfer modifier via Python

When the Source vertex group named "ALL", How to change the value of the vertex group "ALL"? When run ...
  • 3,580
0 votes
1 answer
9 views

Converting Rigify Rig To/From 2.79 and 2.93

I have a Rigify Rig I created in 2.79. If I open that file in 2.93, the bones and constraints and all that work correctly, but the buttons do not. The IK2FK and FK2IK, etc. I understand that this ...
  • 77
0 votes
0 answers
11 views

Python Error on FBX Import

so I'm making a plane for Roblox (I know stupid right) But I keep getting this line of errors: Python: Traceback (most recent call last): File "C:\Program Files\Blender Foundation\Blender 2.91\2....
0 votes
0 answers
17 views

How to add a RMB menu item for a property

When over shader node property, I want to add a RMB Custom menu item to call a function: For what it's worth, the function would add a custom property with the name of the Node.field, and would add a ...
  • 4,233
2 votes
1 answer
37 views

how to get the custom attribute of a bezier point set by GN

I have changed my curve in GN like this: So i simply set a "spline fac" to the control point (via store named attribute) Now i want to read these values via python. I tried this: ...
  • 47.1k
0 votes
0 answers
15 views

Is there a documented list of types like "bpy.types.VIEW3D_MT_object"

I am trying to find some documented list of types like: bpy.types.VIEW3D_*, bpy.types.3D*, bpy.types.TOPBAR_MT* and other types that relate to parts of the UI, especially those that relate to where I ...
  • 4,233
0 votes
1 answer
26 views

blender keeps crushing on startup because of an object [closed]

I have downloaded an assets from blender kit addon (a carpet) and tried to apply an image texture to it. suddenly it crushed. I reopened the file, and deleted that carpet, tried another one, again - ...
0 votes
0 answers
6 views

Switch Direction curve splines without bpy.ops?

Is it possible to switch direction curve without calling bpy.ops.curve.switch_direction() ? its would be nice if there a way to switch direction from the data curve ...
0 votes
0 answers
19 views

Create bmesh & save into OBJ format without opening blender

I want to create a mesh outside of blender, using bmesh module, and save it into an OBJ or whatever, completely through a python script. ...
0 votes
0 answers
16 views

is it possible to customize "Weight Paint Sample Group" menu?

I would like to customize this menu, Weight Paint Sample Group pop-up. Is there anyway to customize this pop-up menu? I always use this menu but my mesh has lots of vertex groups and some vertex ...
  • 173
0 votes
1 answer
23 views

Swap 2D Object for 3D object from Asset Browser

Good morning, long time reader, first time poster! I receive many DXF drawings with 2D objects. I'd like to create a script which looks up the name of the 2D object and replaces it with a 3D ...
2 votes
1 answer
66 views

Geometry Nodes set subset scale and interpolate others

I'm new to blender and am wondering how I can have n cube geometry nodes in a line where a random subset of x of them are given ...
  • 123
0 votes
0 answers
9 views

How do I add a modal handler to another area?

I want to add a modal operator (a set of shortcuts) to the asset browser whn a button on the menu on the 3D viewer is clicked. I know that by using ...
  • 663
0 votes
0 answers
9 views

How to place a mesh on segmented plane from an image using Blender python?

So I have a segmented mask of a tabletop, and I need to place an object on that tabletop. The position and orientation of the object have to be randomly sampled, but the object should always lie on ...
0 votes
2 answers
26 views

Add node groups with python where the user is located

I am making an add-on in which many node groups can be inserted using: ...
  • 667
0 votes
2 answers
41 views

How to build a quarter cylinder using python script?

I am a new Blender user and couldn't find the API for adding a quarter-cylinder object. And I also want to build the object like the picture shows. Thanks if you can help!
  • 1
-1 votes
1 answer
20 views

Addon not running/ui not showing

When I enable my addon the ui does not show. I tryed adding a print statement to see if that does anything (it does not). Idk if it is my code but here it is ...
0 votes
0 answers
12 views

How to Quickly Remove Overlap and Merge Objects into One Mesh

I am currently working on a project where I am randomly generating many connected, overlapping shapes. This ranges from 100 - 3000 shapes. After generating the shapes I am combining them into one mesh ...
  • 1
0 votes
0 answers
24 views

Garbage characters appeared in my Enum property [duplicate]

I was making an addon which required a feature to select a material in an enum property. This is part of the code which I wrote to generate the enum property. ...
0 votes
0 answers
9 views

Python - Pick collection with eyedropper

I have created a system that lets users assemble pieces from collections, placed inside of a master collection. Right now I am letting the users choose which one is the master by manually typing the ...
  • 1
0 votes
1 answer
18 views

What is ObjectShaderFx in bpy?

Searching through the bpy hierarchy in Blender 3.3.3 I've found that objects in Blender have shader_effects attribute. It has <...
1 vote
1 answer
13 views

How to get access to <class bpy_prop_array> via bpy?

For my script I need to recursively iterate through bpy hierarchy and check if attributes suit several conditions. One of those conditions is if the attribute is an instance of the ...
0 votes
0 answers
22 views

Spawn Object with Random Color (Viewport Shading)

I've been stuck trying to instance objects with a random color set when the Viewport Shader color is set to Random. bpy.context.object.color = self.color The line ...
  • 101
1 vote
0 answers
14 views

Intended way to change object color outline during modal?

Let's say, when you moving the object (by pressing G) the outline color would change to white during operation. Since I don't know how to achieve that, so i tried to implement that by changing the ...
3 votes
1 answer
149 views

How do I get the shader node type in python?

If I do: print(some_node.type) I get things such as MIX_SHADER but if I do: ...
  • 663
0 votes
0 answers
24 views

How can I tell if two meshes touch each other?

This question seems to have been asked before without an answer here and with a pointer to this answer, which, however, refers to intersections. What would be the solution for meshes that just touch (...
  • 663
2 votes
0 answers
26 views

Blender crashes when render call back calls render

I am trying to hook up an additional blender script after the rendering is done, to render the same scene with different parameters and to do some additional processing there. I have simplified my ...
  • 153
-1 votes
0 answers
34 views

I’m seeking a method for programatically creating a traffic scene

I need to simulate a traffic scene. Ideally I could pass in a list of vehicle names and the vehicles would be emitted along a curve in that order. I would also need to manipulate their speed. I tried ...
  • 1
2 votes
0 answers
38 views

How can I tell if a mesh is visible and not occluded in a render with an orthographic camera using python

I have an imported model with a complex set of parts, some of which are internal - i.e.: always occluded by other parts - think of an inside lining in a sofa. Is it possible somehow to tell ...
  • 663
1 vote
1 answer
25 views

Wanna learn python and MEL for 3d scripting [closed]

I want to explore python and MEL for 3d scripting. I have knowledge of blender and Maya (modeling, animation, rigging and a little bit of simulation ), and basic OOP coding knowledge. But I don't know ...
0 votes
0 answers
23 views

Specify image by name

I made a specific image for the selected object,Now there are three planes in the scene,Plane.1, Plane.2, Plane.3 respectively,If there are three images with the same name in this folder,How to add ...
3 votes
1 answer
83 views

How to make snapping similar to measure tool?

I am making an addon where I need a snapping function similar to the measure tool. And it would be awesome if you can extend that function to snap to the grid. I know how to draw on viewport with the ...
  • 611
0 votes
0 answers
16 views

Blender python copy as driver

I'm making addon and I need to create a driver in one of the ui operators to change motor angular velocity in real time. I need to use something like ...
0 votes
0 answers
21 views

Batch add image

I have made a book turning animation. There is a file containing hundreds of image sequences, but it is difficult to add images to hundreds of planes. How can I use python to make a plug-in?
1 vote
0 answers
22 views

Create Camera Objects from Mesh Objects with scripting

I know this is a very specific use case, but maybe the answer could be useful for other people who want to automate rendering large batches of cameras in Blender. In another program I generated mesh ...
0 votes
0 answers
30 views

How to specify different sequence frame images for multiple planes

If there are hundreds of planes in the scene and hundreds of sequence images in the folder, how can they be mapped at one time? How to write such a script?
0 votes
1 answer
20 views

Images added with image_strip_add not orientated correctly. Any idea why?

I am adding a number of images to a video editor strip using image_strip_add according to this answer: https://blender.stackexchange.com/a/286951/75609 However, my images are not orientated correctly, ...
  • 101
0 votes
1 answer
19 views

Losing reference to class variables after undo

I have a simple script that instantiates random objects from specific collections. In order to make sure I always do this correctly, I've created a class with some internal variables to access those ...
  • 1

1
2 3 4 5
244