Questions tagged [scripting]
Questions concerning scripting in Blender using the Python programming language. Also use this tag for questions about scripting in OSL (Open Shading Language).
6,654 questions
1
vote
1
answer
66
views
Problem with unregistering PropertyGroups
I had a complex code, which failed. To test things out I simplified it to this:
...
2
votes
1
answer
58
views
Is there a normal / light direction UI layout template?
I have a FloatVectorProperty that stores a normal. I'd like to visualize and make it editable with an editor similar to the "Light Direction" available in ...
0
votes
0
answers
50
views
Why Can’t I Assign Vertices to a Vertex Group in Edit Mode via Python?
When manually assigning vertices to a Vertex Group, I must be in Edit Mode. However, when attempting to automate this or do the same operation via Python, Blender throws an error unless I switch to ...
0
votes
1
answer
42
views
Script that flips quat then applies insert keyframe for multiple keyframes?
The quaternion rotations on this bone (Bip01 Non Accum) is messed up, and they need to be flipped. All the keyframes from 532 to 592 need to have their quat rotations flipped and inserted as new ...
0
votes
0
answers
47
views
Script for Automate Vertex Weight Mix modifier
i usually have to merge a lot of weights to make them work on a game and i am looking into ways to automate it by just changing the bone names in a script, so far after googling for hours i have found ...
1
vote
1
answer
47
views
How to set Viewport Shading Wire Color to Object via Python?
How to set Viewport Shading Wire Color to Object via Python? When I right click on the Object button
And do Copy Full Data Path, it gives me:
...
0
votes
1
answer
112
views
How to create an automatic generator for mesh objects along a curve which is attatched to an existing curve object
I am trying to create an automated railroad track system in which I can place a railroad track via a curve, and then easily adjust it by moving the curve points. I already have most of what I need, I ...
0
votes
0
answers
49
views
Custom script directory doesn't work, what to do?
I'm using blender 4.0.2, my addons are all installed on the local disk C:
But I want to move for my local disk E:
How do I do this? I've tried installing manually and it's always installed on the ...
1
vote
0
answers
76
views
How to create a persistent floating window that remains until a button closes it
I've managed to create a window in Blender full of controls, however the only issue is the window closes if I click outside it. I need to to remain on screen until a 'close' button is clicked.
My ...
0
votes
0
answers
35
views
How to insert popover menu in existing blender UI controls?
I am able to draw popover menu at header section by appending/prepending.
but I want to draw it in existing controls of blender like viewport shading as highlighted in red in below screenshot.
The ...
0
votes
0
answers
20
views
Trouble with bpy.types.ShapeKeyPoint
I am trying to write a baking script that takes my Shrinkwrap modifier and applies it to local space before my armature modifier. I have the world space point, the world space point before the ...
0
votes
2
answers
56
views
Handler in load_post not called When Using bl_info Header in Addon
I'm trying to execute automatic actions after an addon starts. When starting test addon with Visual Studio Code (VSCode) and including the bl_info header in my ...
4
votes
2
answers
230
views
Vertex Custom Attribute of type STRING not showing up in Geometry Nodes Viewer
I have some custom attributes created via python like so:
mesh.attributes.new(name="jbeam_node_props", type="STRING", domain="POINT")
...
0
votes
0
answers
19
views
How to run multiple modal operators to download images using separate threads?
Let say I have an Operator.bl_idname=download.image with url: StringProperty(),
I am drawing this operator in a ...
1
vote
1
answer
26
views
What does the cursor parameter do in bpy.ops.screen.area_split()?
What is the purpose of the cursor parameter in bpy.ops.screen.area_split()? I've experimented with various values, but nothing ...
2
votes
1
answer
110
views
How to scale an object with respect to another object?
I want to be able to scale an object with respect to another object. In my example here I have a circle mesh that I want to scale to the sphere (target object that can be any shape). I want to be able ...
4
votes
1
answer
70
views
How to remove Socket in Group output node using python
I am trying to remove the unconnected sockets of Group Output node using python,
I tried this -
...
0
votes
1
answer
94
views
I can't twist a bone past 180 degrees
How can I twist a bone past 180 degrees without this happening?
the issue isnt really the bone, but the vertices in the middle not really knowing how to connect to the each end of the mesh.
edit: ...
0
votes
1
answer
28
views
Collection asset export missing preview image, while object export works (Python API,)
I'm writing a script to export assets with custom previews. The script works perfectly for objects, but collections show no previews. The preview data appears to be missing in collection assets.
...
3
votes
0
answers
44
views
How to Set a Custom Label for the Export Button in File Dialog?
Is there a way to customize the export button label in the File Dialog? Currently, the button always uses the bl_label of the operator, but I’d like to set a ...
0
votes
0
answers
10
views
Integrate geometry in other curved
Hi,
I am new to Blender, i was wondering how I could integrate this in my 3D volume brace model. (see pictures). I tried using a lattice, then getting it over the curvature and then shrinkwrapping it. ...
0
votes
1
answer
44
views
Can I Attach a 3D Object to a Rigify Armature Using Python Scripting?
I'm working on a project where I need to automate some rigging tasks, and I've encountered a challenge. I have a character with a Rigify-generated armature, and I want to attach a 3D object (such as a ...
0
votes
1
answer
88
views
Registered script does not run on launch
A registered script will run with Blender 4.1
However, the same does not happen with Blender 4.3. When I launch it, nothing happens. I'm using the portable sandbox version of Blender 4.3, with the ...
0
votes
0
answers
25
views
getting two render image pair using python API
I've been working on this for several days, but haven't found any solutions. Please help me out
I want two images per render scene.
ordinary color rendered image
only page masked image(Using Material ...
0
votes
0
answers
15
views
Writing python script to generate a L shaped hollow pipe [duplicate]
I am kind of new to blender.
I am trying to create a L shaped pipe with python script.
what I want is:
My gpt generated code is this:
...
4
votes
1
answer
81
views
force TOPBAR_MT_editor_menus redraw
I added a small play button and a frame_current display in the top bar. The issue is that the frame_current only updates when I ...
0
votes
0
answers
19
views
How to use all bake for hair dynamic. Script doesn't work?
I want to all bake hair dynamics.
...
1
vote
0
answers
25
views
Closing a face on geometry produced by spin()
The following code spins (or rotates and extrudes) a square (or flattened cube).
The last face is not present, and I am not clear how best to access the vertices to make a call to bm.faces.new() (...
0
votes
0
answers
18
views
python how can i get all of the gpus of a system? [duplicate]
how can i get all of the gpus in the system and enable gpu rendering
if it is a amd gpu use hip
if it is a nvidia gpu use opeix
this is why
flamenco
i have some computer with amd and some with nvidia ...
0
votes
0
answers
31
views
How do I properly perform a loopcut?
I'm trying to perform a loopcut in script, but I am unable to get the loop to cut between the desired edges. I must be misunderstanding how loopcuts work because my script does not do anything, but ...
2
votes
0
answers
83
views
How to view operator's DEBUG reports?
I can't figure out how to view the DEBUG reports generated by calling self.report({'DEBUG'}, 'DEBUG') in an operator.
Steps to reproduce:
Launch blender with the ...
1
vote
0
answers
31
views
Insert Operator Button into Modifierpanel
i'm trying to add a small operator button, or property into one of the modifier panels, has anyone experience in doing so? Is it even possible at all? (rough example)
I just can't seem to get it to ...
0
votes
0
answers
38
views
How to append something, preferably a Node Tree, from a current file to a target file or my choosing using python scripts
I'm working on an add-on that takes a node I selected and automatically appends it to a target file, where all the node trees will be stored permanently. I'm currently using, ...
4
votes
1
answer
118
views
How to automate the process of disabling compress when doing a save as
I have a blender 3.6.5 version. As I have 100s of files with compress enabled I need a script to disable the compress option while doing a save as. In the info panel the operator I can see ...
1
vote
1
answer
34
views
Rendering Different Images as a Cube Moves Every 10 Frames
I created a cube that moves every 10 frames. I’m trying to capture an image from the camera at each step. However, all the rendered images are based on the first frame. Here is my Python code:
...
3
votes
0
answers
55
views
How to Create a Collection at the Top Using Python
When you create a collection manually, you can drag it around, but I'm not sure what the Python command for this is. I tried:
...
0
votes
0
answers
26
views
Adjust Last Operation Panel Not Showing When Using Operator Poll Method with Mesh Object Check
I have an operator that creates bones in an armature, where each bone's tail points
toward a random vertex on a selected target mesh object. The operator works as expected,
and I can adjust the number ...
0
votes
1
answer
128
views
How do I pass arguments into an operator class from panel? [duplicate]
I have a bpy.types.Panel where I have two buttons. The first button is 'test render' and second is 'final render'. I'd basically want to call the same operator class for both these buttons just that ...
0
votes
1
answer
115
views
bpy.app.handlers.depsgraph_update_post.remove throws ValueError: list.remove(x): x not in list
I'm running the following code as part of addon in the __init__.py file. I'm trying to remove a handler that I added to ...
0
votes
0
answers
48
views
Custom Icon Bad Quality
I'm trying to use custom icons, but I noticed that my imported icons appear very pixelated. Here is a comparison between the default Blender icon and the same SVG icon after importing it.
Any idea of ...
0
votes
0
answers
27
views
scripting geometry node network when rendering with CYCLES
I have a small Geometry Node network I'm using to generate some spheres arranged in a pattern (a larger sphere). I have a node that I can use to set the number of spheres to make. I would like to be ...
2
votes
2
answers
123
views
How can I remove unused shader nodes in all my materials?
400+ materials in the shader editor currently have approx. 3 duplicates from running another script multiple times.
The current script is unsuccessful.
...
2
votes
1
answer
113
views
How to check the Automatically Pack Resources toggle value?
I want to be able to determine the value of the "automatically pack resources" option in blender through script.
Right now the only thing I can do (to my knowledge) is ...
2
votes
1
answer
54
views
How can I create bones in an armature that are connected via Python?
When I create an armature with 1 bone and then press E on one end, I can extrude to form another connected bone. But when I try do do the same via Python, the bones are not connected:
...
0
votes
0
answers
35
views
get bl-label and bl_category from external file
I'm trying to get my add-on preferences from external json
Starting from bl_label and bl_category in order to TD personalize the visible "name" of the addon, not the real one.
But I couldn't ...
1
vote
0
answers
86
views
How can I cycle through node outputs now that the viewer node is gone in the shader editor?
I used to be able to (ctrl shift LMB), and the node I clicked on's output would go to a viewer node for previewing. If I (ctrl shift LMB) again, it would cycle through the other node outputs. Now that ...
3
votes
2
answers
243
views
Rename multiple objects with python script using list of pre-set names
I have a list of names
names = a1, a2, a3, a4
I need to rename objects in my scene so they have names from the list
This is what I was trying to do but all my ...
0
votes
0
answers
30
views
Script for copying MeasureIt measures from one obj to another one
I'm trying to make a script to copy all the MeasureIt informations contained in one obj into another one ( they are twins ). In the following simple example file you see 2 columns. The first one with ...
6
votes
3
answers
702
views
how do I make a child object ignore the parent's rotation and keep its own orientation when the parent rotates?
I have a requirement for a parent-child relationship in Blender. Based on input received from the UI, I am changing the parent’s orientation. However, this also modifies the child’s orientation. How ...
1
vote
0
answers
19
views
scripting with gizmo
is there a way to add 2 arrow gizmo in the active face aligning to the normal x, y-axis of the face that can control the UV position? i figured out how to manipulate uv in viewport only the gizmo is ...