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).

Filter by
Sorted by
Tagged with
1 vote
2 answers
25 views

Restore selection after running script

I a writing a small script that periodically reloads an stl file into the scene, every X seconds. I managed to reload the stl object in my scene with the current script: ...
J.M's user avatar
  • 167
0 votes
0 answers
13 views

How Can I Create Value Slider In Blender 3.6 With Python Api?

How can I create a value silder like dimensions panel in Blender 3.6 with Python Api. I can already access dimension value and change those value with python script. I have the code for my slider ...
nikhil's user avatar
  • 23
0 votes
0 answers
10 views

Baking from script on Blender 4.0

This is the code required to bake a particle system on Blender 3.6: ...
Jorge J González's user avatar
0 votes
0 answers
7 views

Drawing folding/collapsible sections in an Operator's Undo panel?

I'm making an operator that is getting big in terms of properties and options. I thought about separating those properties into different kind of tabs that depending the selection, X or Y properties ...
Ommadawn's user avatar
  • 508
1 vote
0 answers
27 views

Prevent that changing an Operator's property retriggers the operator?

I'm making an operator that has the bl_options = {'REGISTER','UNDO'} in order to call the undo menu. Since my menu's draw() is ...
Ommadawn's user avatar
  • 508
0 votes
0 answers
16 views

Blender crashes when executing bpy.node.view_all(). How can I fix this?

When I try to execute bpy.node.view_all() within my code, Blender crashes. I'm attempting to override the Blender context to run bpy.node.view_all() or ...
Nattear's user avatar
0 votes
0 answers
14 views

How to make prop_search in call_menu automatically show all dropdown list

I'm creating a menu that lists all materials, but the dropdown list doesn't automatically show, and the user can't type in the search box straight away. I tried using 'activate_int,' but that doesn't ...
Riki maru's user avatar
  • 151
0 votes
0 answers
17 views

I don't know how to make add-ons that respond to renderings [closed]

Outline size changes with distance. Add-ons are created. We have created a behavior where you click a button and the line size changes and is rendered. However, I would like to implement a movement ...
Cow's user avatar
  • 1
0 votes
0 answers
26 views

How to build a scene with Curved World effect

Is there a way to have a curved world like Death Spank or Animal Crossing? This effect used to be called Rolling Log Effect (by Nintendo) also World Bending Effect is another name. This effect is a ...
Roozy's user avatar
  • 145
1 vote
0 answers
21 views

Can't call a method inside a setter? (Operator)

I would like to understand what is happening here. I'm simply trying to call a method inside the setter of a property in an Operator (in order to not repeat code). But I'm getting: ...
Ommadawn's user avatar
  • 508
0 votes
0 answers
26 views

How can I trigger Geometry Nodes with the keyboard?

I'm replicating PowerPoint with Geometry Nodes. I have a "slide" integer input. As I increase the number, a camera moves along a line. I do that using a simulation zone. See, I want the ...
Robin's user avatar
  • 3
0 votes
2 answers
34 views

How to Set Selected Edge Bevel Weight in Blender 4.0

I have code that sets the bevel weight of selected edges in an object like this in Blender 3.3 LTS: ...
Christopher Gearhart's user avatar
0 votes
1 answer
6 views

Moving an EditBone along a local axis in Python

I'm attempting to write a script that helps automate rig creation for a specific type of armature, and the current minor issue I'm having is that I would like to create a pole target with as minimal ...
N-cognito's user avatar
0 votes
0 answers
15 views

UPBGE error. Why can't I run my script via Logic Node Editor?

Why does an error occur when running a script using a "Run Python Code" node? For some reason, in the error description my script is called a module
Давид Сировский's user avatar
3 votes
1 answer
123 views

Indent Guideline in Text Editor

Does the text editor have a feature that shows the indentation of the code? If it does, that would be nice to know.
Riki maru's user avatar
  • 151
0 votes
1 answer
27 views

where is stored the data of the projects? [closed]

good evening. I am developing a little program with Python, and I need the coordinates of every vertex in a project written somewhere, since making it manual would take a lot of time. Since blender (...
Emilio Canuto's user avatar
1 vote
0 answers
17 views

How to run an operator on UILayout.prop changes

I have a UILayout.prop(object, 'rotation_euler') to rotate the active object, a UILayout.prop(object, 'rotation_quaternion') and an operator to update the object rotation_quaternion property. ...
Antonio's user avatar
  • 325
0 votes
0 answers
7 views

Simple script to set origin of FBX files

I am trying to understand how to work with multiple files in Blender scripting. For some reason, I cannot get this to work properly. The script I am trying here is super simple. I have a bunch of FBX ...
E.S.'s user avatar
  • 101
0 votes
0 answers
20 views

Adding constraints to an IK hand bone in rigify?

I want to rig a character with a staff with Rigify. The easiest way would be to have the IK hand bone in the generated rig parented to the staff bone, so that rotating the staff bone would also move ...
Legoman's user avatar
  • 1,771
0 votes
0 answers
25 views

Create instanced "linked duplicate" of mesh respecting selected meshes location, rotation and scale

I am using the below code to create an instance "linked duplicate" of the last selected mesh in the location, rotation and scale of the previously selected meshes. However the below code ...
SarahLee's user avatar
  • 149
1 vote
0 answers
27 views

How to know if the active node in a node tree change?

I need to know if the active node of a node changes. I have found this example for the active object, that works very well: ...
frantz's user avatar
  • 11
0 votes
0 answers
14 views

Cursor to pivot error with context call [duplicate]

I had a script for placing the pivot on a selected vertex or in the center of multiple selected verts that stopped working after updating to 4.0.1. This is the script: ...
JeeperCreeper's user avatar
1 vote
1 answer
48 views

How to get what a node group's name is inside a material?

My script prints every node group name, how many nodes are inside it, and its users. The node groups are sorted by how many nodes are inside them so I can find possible redundant/duplicated node ...
Don Cheadle's user avatar
0 votes
0 answers
15 views

How to Create a Pop-Up Message (or Something Similar) When Blender Is Frozen

I have created a Blender addon that requires a lot of computational power and takes some time to process. It is an automatic camera tracking addon. The only thing the user needs to do is enter their ...
Axel Olsson's user avatar
1 vote
0 answers
21 views

How to add VIEW3D_MT menu in scripting?

I'm trying (with help from ChatGPT) to write an addon that will simplify baking. What I'm essentially stuck on is adding a baking menu next to the other VIEW3D_MT menus. Did something change in 4.0 to ...
HalValla01's user avatar
1 vote
0 answers
26 views

Created Bezier Curve doesn't link to scene

I would like to start by expressing my gratitude to this community for providing solutions to programming problems related to BPY. I usually find answers here without submitting my question, but this ...
kakts's user avatar
  • 11
0 votes
1 answer
30 views

Where is my script?

I started using Blender recently. I wrote a very nice and long script doing an animation in the text editor. I saved my project. When I reopened my project, I couldn't find my script! Where did it go?
Mason Wang's user avatar
0 votes
1 answer
20 views

Get (and set) vertex/point weight from/to a GreasePencilPoint? (Python)

Im a bit confused. I'm trying to get the weight from every vertex/point in a GreasePencil Stroke, to later assign them to another stroke in a different frame. I can access the (active) GreasePencil by ...
Ommadawn's user avatar
  • 508
0 votes
1 answer
37 views

What Blender type should be used for custom list of objects?

Lets say I have defined a new class ...
aheuchamps's user avatar
0 votes
0 answers
23 views

Applying specific Geometry Nodes modifier to an object with python [duplicate]

I am very new to python and writing blender addons. I am currently trying to make an addon that takes the selected object, makes a new cube at that location, and then applies a set of custom geo nodes ...
michael warneke's user avatar
0 votes
0 answers
15 views

Changing the size of the box by the user

I want to create a box, export it using Blend4Web to html and post it on the site. And so that the site visitor chooses the width, height and depth of the box. I need these parameters to be changeable....
fornit32's user avatar
-1 votes
0 answers
27 views

Scripting Error - IndexError: bpy_prop_collection[index]: index 0 out of range, size 0

disclaimer - I did not write this code, this helpful script was written by @nicko16 When I run the code I get this error and I cannot work out why File "\GMapFixer", line 159, in IndexError:...
Fnordcorps's user avatar
0 votes
0 answers
51 views

How do I create a delete handler in Blender 3.5 onwards

In the past I have been able to execute code before deleting an object in blender using the method described in this post: Object delete handler As far as i know this method wont work in blender 3.5 ...
Matt Hooper's user avatar
3 votes
1 answer
222 views

`ValueError: 1-2 args execution context is supported` on call to `bpy.ops.outliner.show_hierarchy` in Blender 4.0.1

I have the following code which I use for expanding all collections in the outliner ...
ellipticaldoor's user avatar
0 votes
0 answers
27 views

Get a group note from the scope of a node within that group

Is there a way to get to the group node from the scope of a active node with the group? Let's say I have a material with a group (G). With that group I have let's say a Noise node. How can I get to ...
Andreas Resch's user avatar
1 vote
2 answers
87 views

Low level fast way to create cube

In the answer to this question it's said that the high level ops functions have low performance since they do a scene update: Python performance with Blender operators I'm looking for a low level ...
BroDude's user avatar
  • 15
0 votes
1 answer
51 views

How can I render text above mesh in Blender 3.6 with Python Script?

Do anyone knows how can I render the text or number like 0.618m in 3d viewport on the selected mesh/object. I am calculating the distance between two vertices using python script and I want render the ...
nikhil's user avatar
  • 23
0 votes
0 answers
49 views

Displaying and changing selected edges Mean Crease in python

I'm building a custom menu using Serpens and python and I'm trying to recreate the same behavior than the menu we can find in the Item tab: In order to do that I have this little code I'm using in ...
Julien Gauthier's user avatar
0 votes
0 answers
12 views

Append custom code to UI events

is there any way to extend Blender UI behavior executing custom code when user interacts with it? Les's say I wanted to change some rendering option when I select a different view layer, can I capture ...
Antonio's user avatar
  • 325
2 votes
1 answer
40 views

Drawing a circle that faces towards the view with GPU/BGL?

Im trying to draw a circle using the GPU/BGL module that appears on a given certain 3D position (in my example, the cursor's location) and, when drawing, it points towards the current view. I'm using: ...
Ommadawn's user avatar
  • 508
1 vote
0 answers
19 views

Iterate over all panels in screen?

I have a timer that is running in the background. I'm trying to identify the running operator by its panel, so when that operator's panel goes away, I execute some code. I thought about iterating all ...
Ommadawn's user avatar
  • 508
1 vote
3 answers
126 views

Connect multiple vertex pairs

I would like to have a script that connects multiple pairs of vertices. My selection order is vertex-13, vertex-14, vertex-11, vertex-9, vertex-19 and then vertex-16. And the result is supposed to ...
Lala_Ghost's user avatar
1 vote
0 answers
45 views

Script works in python console and "run script' but cannot be enabled as an addon

I am a beginner in scripting so I am aware that this might be trivial thing, but I will appreciate any help. I was trying to make some automation to my geometry node workflow. The main utility of it, ...
Krzysztof Galant's user avatar
1 vote
1 answer
18 views

How do I call execution code in two classes?

There are two classes A_H1 and A_V1 whose meaning is to add different objects in the top and fronts view respectively, now I want to build a third class A_H1V1 whose role is to execute the contents of ...
lee blues's user avatar
  • 121
0 votes
0 answers
15 views

Is it possible to change first object's place in array modifier with script?

In blender i have a curve and a cylinder that i want to go along the curve, and i use array and curve modifiers for that. But i want to change the place where my first cylinder is placed, it is placed ...
Dan's user avatar
  • 1
0 votes
0 answers
17 views

Drawing Gizmo in 3D Viewport while operator's panel is showing?

I'm working in an operator that has as properties a point (Vector) in the 3D space and a radius (float). I'd like to show in the viewport some kind of circle/sphere with that position and its radius, ...
Ommadawn's user avatar
  • 508
0 votes
0 answers
25 views

How to cut a curve object with python sctipt

In blender i want to cut a curve with a specific distance (for example as much as a cylinder's radius). I can do it by hand but can't do with python scripts. I tried converting it into a mesh object ...
Dan's user avatar
  • 1
1 vote
0 answers
40 views

Add Input variable on driver shapekeys with python

I try to transfert a facial animation using shapekeys from one model to my target model using Rigify rig and drivers facial animation. It works to do it by hand with this technique : I copy as new ...
Pomess's user avatar
  • 431
0 votes
0 answers
9 views

When i set obj parent as bone, it's just jumping away from last position

Before: After: Code: ...
CoCuCka's user avatar
0 votes
1 answer
25 views

Align vertices behind each other

Have seven objects behind each other in a straight row and aligned with x,y axis. Zooming in, the vertex's from each object does not align to each other. Here and there they do, most are scattered. Is ...
Tekkies's user avatar

1
2 3 4 5
126