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
2 answers
44 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
21 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
16 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
10 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
16 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
155 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
25 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
29 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
39 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
26 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
87 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 ...
  • 626
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
23 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
21 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
4 votes
0 answers
36 views

Python access Bevel Custom Profile handles

We can access the profile points via obj.modifiers["Bevel"].custom_profile.points[1].location But how to get the handles location at that point?
  • 3,582
0 votes
1 answer
37 views

How do you create a drop down menu with buttons

I'm trying to figure out how to create a drop-down list inside of panel, that has buttons in it, like you see in the image for "Mirror". At the moment, I've already figured out how to add a ...
  • 172
1 vote
0 answers
22 views

Own property layer, default values for extrusion, duplicating, etc

I'm trying to create an unique identifier per face like so: l_face_id = l_bm.faces.layers.int.new('id') The problem comes when extruding or duplicating the faces, ...
  • 27
1 vote
0 answers
56 views

Get property that the operator was invoked for

Operators like anim.keyframe_insert_button can be invoked by right clicking a property or hovering over a property and hitting I. How does the operator know which ...
  • 169
2 votes
0 answers
36 views

GPU Module Color Picking Wrong Values

Please, I would like to know the following: My target is to have a color picking for the OpenGL shapes in the viewport using unique custom color for each generated object (If there is any other way ...
0 votes
1 answer
42 views

How do I get an animated camera's position at every frame with python?

I have a scene - which I have not created - in which the camera and the light set move with every frame (9 in total). I would like to print out the camera and lights position for every frame using ...
  • 663
1 vote
2 answers
61 views

Programmatically crop render region to geometry

I have a complex geometry nodes setup and a script to render out multiple viewlayers as separate images. For context, I'm generating the fixed imagery necessary for previewing a framed canvas product ...
  • 161
1 vote
1 answer
87 views

Beveling sharp edges with nearby vertices

I am having difficulty programmatically beveling an edge when there are (unselected) vertices just inside of that edge. The selected edges are beveled, but the nearby vertices produce undesirable ...
1 vote
1 answer
22 views

How to reupdate all drivers after using Python script?

I need drivers and properties to be changed at the same time via my script. But the drivers are not updated after I press the "Run" button. After a property has been changed with a script, ...
  • 172
1 vote
1 answer
32 views

Disable rendering for specific pixels in Blender Python API

Is there a way to control the sample rate or disable specific pixels in Blender using Python API? Is there a way for example to access the sample map and either disable the pixel or set the number of ...
0 votes
1 answer
36 views

Blender parametric modeling !help!

I have been trying to define a set of parameters that I can change and iterate over to make a number of different blobs or shapes depending on the parameters. The scrip is as follows: ...
0 votes
1 answer
36 views

Batch importing, texturing, and rendering via Python

Suppose I have a directory structure like thus: ...
0 votes
1 answer
57 views

"_PropertyDeferred' error when accesing a List of Lists

I have a list of lists declared like this: ...
  • 27
1 vote
1 answer
34 views

Blender Python controlling add on

I'm using an add-on (latex2blender). If I change one parameter, it will show me in the console how it was done it was done in python. Here I am changing the input to "$ x $": Now I know I ...
0 votes
1 answer
36 views

Rigid Body properties

I'm new in using blender and bpy python module. I have a set of 20 cubes and I might to give them a rigid body properties, I saw to doing it, it need select the cube one by one. Is there a way to give ...
0 votes
0 answers
24 views

How to split a mesh into multiple parts at arbitrary locations with Python?

I ran the following Python script, from the link below, in Blender and it works very well splitting the selected mesh into 4 equal parts. However, I'd like to cut the mesh at specific locations not ...
  • 131
0 votes
1 answer
15 views

Simple armature creation script results in a crash when attempting to set bone parenting

My full script is more complex than this, but the issue I'm having can be reproduced with these 9 lines of Python code that create an armature with a single bone: ...
0 votes
2 answers
31 views

How to calculate x, y, z numbers of a pose_bone in Axis Angle Mode

I am trying to write a script that make a bone rotate with using 2 vectors. v1 = Vector((a1, b1, c1)) v2 = Vector((a2, b2, c2)) I can calculate the angle (W in Blender rotation field) with the formula ...
  • 1
0 votes
0 answers
5 views

Is it possible to retrieve AOV Output values on Python?

I want to use Shader Nodes to control things on a script, and I'm wondering if it's possible to read AOV Output values from Python. I have a simple setup: From my understanding, the steps required ...
1 vote
1 answer
58 views

Error when Installing my addon

I was installing my blender addon when I get an error: ...
1 vote
1 answer
25 views

Making a Text object to a grease object with Python

I would like to convert an existing text object to a grease object. Meaning that the text is a path with a grease material. All with Python. Does anyone have experience with this?
5 votes
2 answers
430 views

Blender python - set location does not use centimeters

I can update a 3d object position with: some_3d_variable.obj.location = (0, 1, 0) This sets this object in meters i.e. 100 centimeters: This is not what I ...
0 votes
1 answer
37 views

BPY add the same keyframe for all frames

I need to keyframe thousands of frames. First I would like to keyframe the visibility for 1 object for all frames with the same value (let's say that I need to hide an object on all keyframes but I ...
  • 37
-1 votes
1 answer
48 views

Python: Traceback (most recent call last): line 131, in execute in button3 AttributeError: 'NoneType' object has no attribute 'data'

I was making a Blender add-on that can create a predefined light-setup and generate HDRIs. For this it changes some settings of the camera in the scene. The script creates two sections named Illumin8r ...
0 votes
0 answers
25 views

Copy compositor nodes from one scene to another

I have two scenes, one with a Cycle compositor and one without. I want to copy or link the compositor. sceneA.node_tree = sceneB.node_tree This results in a ...
0 votes
0 answers
10 views

Can particle velocity be set to zero?

If yes, how would does the Blender User do this? Prior to this action forces would have been applied in the normal fashion. Later the same particles can have more forces applied. A force of type ...
1 vote
2 answers
48 views

Assigning mahjong tile faces from SVG

I'm working on a scene involving a Riichi Mahjong table. Here's what I got: All these tiles are linked duplicates of one mesh. Now before me is the most daunting task, which is giving all these tiles ...