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

Scripting in python for a blender file will sometimes flag script entries (python commands) as "CANCELLED" What is causing this?

While running a python script in blender 3.6 (and apparently in v4), execution of the script will stop with single or multiple lines in the script generating a "CANCELLED" response in the ...
GaryM's user avatar
  • 1
0 votes
0 answers
13 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
0 votes
1 answer
29 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
14 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
15 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
25 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
29 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
19 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
  • 488
0 votes
1 answer
35 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
14 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
24 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
50 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
94 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
26 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
85 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
0 answers
10 views

Is it possible to display Face Sets in edit mode with python? [closed]

Is it possible to write an addon that will enable face set visibility in edit mode?
Vopper's user avatar
  • 1
0 votes
1 answer
48 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
39 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
  • 315
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
  • 488
1 vote
0 answers
18 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
  • 488
0 votes
0 answers
19 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
37 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
14 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
16 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
  • 488
0 votes
0 answers
24 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
0 votes
0 answers
25 views

How can values transferred to Blender be changed to float type?

I transferred data from Matlab to Blender. The data is stored in the variables prop0-prop5 (6 variables in total) The values I transferred are decimal, and when transferring the data to Blender I see ...
yuvi's user avatar
  • 11
1 vote
1 answer
23 views

The mouse event can not change with mosuemove

I use the msbug API to detect SpaceProperties.context, which, when switched to a context, triggers an Operator operation and binds the mouse event, but the mouse coordinates detected in the mouse ...
fage's user avatar
  • 57
0 votes
2 answers
40 views

Adding a camera in front of an object based on xyz rotation (Euler to Spherical conversion)

About the script: I would like to add a camera in front of a selected object. The front of the object is based on a calculation using a pre-defined polarangle, azimuthal angle and distance. The ...
Sneider's user avatar
0 votes
0 answers
31 views

Blender 3.6.2 > Move a selection of vertex's from selected vertex

Have a object (10 disks with 5 round holes in them). After selecting a cluster of vertex (total 4) the script need to: Move selected cluster down by 1mm Select next cluster (to the left) and move ...
Tekkies's user avatar
2 votes
0 answers
18 views

How to reload a blf font id when user changes theme?

Suppose you draw some text in viewport via draw_handler_add ...
X Y's user avatar
  • 5,327
1 vote
0 answers
17 views

How to detect keyboard input in languages ​other than English in Operator modal via Python

When the user uses keyboard languages ​​such as Chinese and Japanese, how to catch the text input in operator modal? ...
X Y's user avatar
  • 5,327
0 votes
0 answers
20 views

Duplicating GreasePencilFrames changes their editing behaviour? (Bug?)

Im instancing some GreasePencilFrames via code. With: ...
Ommadawn's user avatar
  • 488
0 votes
0 answers
15 views

Create a skewed (non-physical) camera with a custom matrix

I'm creating a stylized world where the vertical dimension is distorted relative to the forward dimension. Right now in script, I'm doing : ...
pixelpax's user avatar
  • 101
2 votes
1 answer
32 views

Change Material Properties of Multiple Materials

I'm importing hundreds of different textures into Blender and I want to change the blend mode on all of them from Alpha Blend to Opaque. I understand I will need to run a python command, however the ...
David's user avatar
  • 23
1 vote
1 answer
77 views

Is it possible to automatically create a plane between two spheres when they move and reach each other?

Is it possible in Blender to do something like, whenever these two spheres move and reach each other, a plane automatically gets created between them? I tried the answer below and then changed the ...
dsa's user avatar
  • 35
4 votes
2 answers
56 views

Why does this script crash Blender 3.6.5?

I think this it's this line obj.hide_viewport = False ...
Richard's user avatar
  • 340
0 votes
0 answers
19 views

Export folder of FBX to GLB

I have made a little script that takes an FBX, removes the materials, add a material again, and attaches an Image Texture. It then saves the result in a GLB with Texture combined. This works fine for ...
E.S.'s user avatar
  • 101
2 votes
1 answer
42 views

How can I access the transform sidebar with python scripting?

I am new to scripting with python in Blender. I want to get the coordinates of a vertex (x, y, z) from the transform sidebar in Blender with python script and print it out in the system console. How ...
nikhil's user avatar
  • 23
0 votes
0 answers
15 views

Curve mapping in a Operator property panel?

I'd like to add a curve mapping in my operator's undo panel, along with its properties. As far as I know, is not possible and is pretty hacky; we have to basically add a Curve node in shader tree, and ...
Ommadawn's user avatar
  • 488
2 votes
1 answer
165 views

How to find out what buttons without a python tooltip actually do?

Most things in the blender interface show info about what Python is used. Others do not: How do I find out what is actually happening when I click these other buttons?
Ascalon's user avatar
  • 6,459
0 votes
0 answers
9 views

Can I make vertices from multiple objects move a set distance along an axis automatically?

I have created a simple "matchbox" for my 3D Printer, and it has three parts: the box itself, a hole shape for a lid, and the actual box lid. If I want to change the size of the box, I need ...
The Greatest Duck With Grapes's user avatar
0 votes
0 answers
17 views

How to add a curve2D/mapping property to an Operator? (Image inside, I don't know its name)

I would like to add this kind of curve property that I've seen in different Blender's operators to my custom operator: (This one shows when we interpolate strokes in ...
Ommadawn's user avatar
  • 488
1 vote
0 answers
7 views

Make a Linked Scene local with Python?

I have a scene linked from another file. It can be made Local by clicking this button: How do I do this with python? For Objects, you can use bpy.ops.object.make_local. There does not seem to be any ...
Ascalon's user avatar
  • 6,459
0 votes
0 answers
29 views

Bulk Texture Baking of multiple models in Blender

Is there any way to bake the textures of the 1000s of buildings using any plugins or python scripts in Blender? Each building has two models: High poly model and Low poly Model I want the textures ...
Saif Burki's user avatar

1
2 3 4 5
125