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

how to emulate weight paint brush stroke using python?

I need to emulate brush stroke in weight paint mode but I don't know how. I am trying to use the code but error code says RuntimeError: Operator bpy.ops.paint.weight_paint.poll() failed, context is ...
Yokomizo's user avatar
  • 381
0 votes
0 answers
33 views

Scripted expression: Can I even include &&s? If else and special conditions

I'm attempting my luck with scripted expressions today, and my specific situation is about using &&s as following: ...
xDonnervogelx's user avatar
0 votes
0 answers
36 views

When looping the selection_history of a bemesh it Crashes With Error: HIPEW initialization failed: Error opening HIP dynamic library

I'm Making a tool for boundary weight paint pinning from selection with bmesh Am i supposed to report this as a Bug ? Edit: the script works with no issues when using selection_history.active instead ...
ValyArhal's user avatar
1 vote
1 answer
41 views

Transform tab, increasing dimensions decimal precision

I realized I left out a few details and overcomplicated this. I'm working in inches which only has 1 decimal place in the dimensions tab and I'm trying to add more decimal places. I'm trying to get ...
Hackshop's user avatar
2 votes
1 answer
41 views

How to detect active modifier changed

My goal is to print out a message when you click on the UI to change the active modifier. I tried different methods but failed ...
X Y's user avatar
  • 5,482
0 votes
1 answer
58 views

Importing image texture with python

I'm trying to import an image texture (in image texture node on shader editor, not as a plane) after removing the previously existing one using a script in text editor. The file path of image texture ...
Cgpixelz's user avatar
0 votes
1 answer
31 views

How to save a list of objects as a scene property for operator filtering objects

is there a way to have an equivalent of a list/tuple as a scene property? something similar to c++ like "array< classname >* object list" the operator i'm working with hides any ...
ValyArhal's user avatar
0 votes
0 answers
55 views

Numpy array to openvdb conversion returns a shuffled volume

I have a 3d numpy array containing results from a simulation which I want to render using Blender. When visualized using napari I get the expected result: Using ...
Tom Aubier's user avatar
1 vote
2 answers
41 views

How to parent specific objects to newly created collections?

I used this python code to set the parent (link) the specific objects to newly created collection. The code is working well, but I can see the same objects instance outside(Scene Collection) the newly ...
Subin Gopi's user avatar
0 votes
1 answer
42 views

Scipt for selecting only the active collections

can you guys tell me how to do this but only selecting "active" collections not all collections ...
alexander kosti's user avatar
0 votes
1 answer
89 views

Select Element in Outliner "File Mode" based on Object Name

I've added an EDIT at the Bottom. I want to select the corresponding element in the "File View" Outliner Mode to the active Object in the scene context. Is this possible? I know its possible ...
Chris's user avatar
  • 811
0 votes
0 answers
35 views

How to get Shape Key box working in Pose Mode

Back again with another add-on in development. The add-on that I am currently working on is a Viewport Sidebar version of the Properties Editor, with various improvements that are just not possible ...
Sonario648's user avatar
1 vote
1 answer
79 views

Python script for geometry node

My question concerns the use of scripts to generate nodetrees. If I manage to use and link all the nodes offered by Blender on the same tree, I can't find a way of using a custom group. an example ...
Crys's user avatar
  • 45
0 votes
0 answers
77 views

Camera rotating around the object in a regular way with python blender

I want a camera that rotates regularly around the object I have taken with the blender package in python, and I want to take the image of the three-dimensional object from certain angles at the time ...
Serhat Bilal's user avatar
1 vote
0 answers
18 views

How to color or overlay on vertices via the Python api? [duplicate]

For a plugin I am making, I need to highlight the vertices that the user hovers over. I could not work out this color assignment part yet. I have tried methods then found out they were obsolete. I ...
SKB_BGPL's user avatar
-3 votes
1 answer
59 views

Attempt at Blender with a lot of help from ChatGPT could not complete the task, which should be straight forward

I am trying to build an object model on 3D. It should consist of the intersection of the surfaces of a cone and a square pyramid. Once the intersection object is built the cone and pyramid should ...
Giorgio Antonelli's user avatar
0 votes
0 answers
21 views

How can I create a list of unique class instances for an object?

I am working on a project that requires each object to have a list of custom class instances, so that I can get and set things from the list as needed. I tried to do something like this (the code is ...
Golden Dragon's user avatar
0 votes
1 answer
35 views

How do I get a list of all Render Engine Options?

I want to get all the render engine options as a list but struggling to find the function for it, any help would be appreciated.
Shamiel's user avatar
2 votes
1 answer
117 views

Search upwards within script

This has boggled my mind for a while now and I've searched everywhere. Whenever I have a long script, I use the [find/replace] tool on the sidebar to search for parts of my code However, it only ...
JeeperCreeper's user avatar
0 votes
1 answer
31 views

Assign a custom material property to models

I need an explanation how to access and iterate over Materials in Objects. I want to add few Custom Properties in a set of files (I want to import each file, add Properties to every material in that ...
tomangelo's user avatar
3 votes
1 answer
120 views

How Can I Automatically Separate a Mesh into Individual Faces (meshes) in Blender?

How do I separate a selected mesh into multiple meshes based on its faces. What I know how to do: enter Edit mode, select a face of a cube, press P for separate, press S for selection, and repeat this ...
Eco_Editor's user avatar
0 votes
0 answers
44 views

Collapse sub-panel on operator execution

How do I have a sub-panel collapse when "List Data-Block Users" is pressed? Or have all sub-panels start collapsed? bl_options = {'DEFAULT_CLOSED'} makes ...
Don Cheadle's user avatar
1 vote
0 answers
29 views

How to execute a code after an operator has been executed?

My problem: I need to execute a code after an operator has finished. The operator is a non modal operator with the UNDO option to show the operator menu with its ...
Ommadawn's user avatar
  • 598
0 votes
0 answers
60 views

How to select hidden objects in the outliner?

I'm trying to highlight a hidden object in the outliner, but this doesn't work: obj = bpy.data.objects["Cube"] obj.select_set(True) Unhiding, selecting, ...
Don Cheadle's user avatar
0 votes
0 answers
25 views

Ray_cast cannot ignore external objects and related issues in LocalView?

blender: 4.0.1 Q1: The results of the plug -in and the script editor are inconsistent mesh a in local view, ...
zeronofreya's user avatar
0 votes
0 answers
36 views

Automated rotations

I am stuck on a problem in Blender. I am trying to create a function that automatically aligns an object based on its dimensions to the world axis. This mean for example the largest axis will be ...
Alessandro leone's user avatar
1 vote
1 answer
24 views

How to check if an object is in a local view?

I found a lot of places and mentioned that this is a bug, and I have tried it. such as: How to get a list of objects that's currently in Local View? ...
zeronofreya's user avatar
1 vote
1 answer
35 views

How to ensure consistency when converting from quaternion to Eulers via Python?

My program must interpolate between two sets of quaternion fcurves by a given value. Normally, one would SLERP or LERP. However, my program includes the option to 'turn off' the individual x/y/z axes, ...
Meatis O'Malley's user avatar
0 votes
0 answers
10 views

Copy shape key animation data to another object out of order (python)

I am trying to copy shape key animation data from on object to another. Each object shares the exact same shape key names, but they are in a different order. Also, the first frame of each object has a ...
Tyson Paris-Hansen's user avatar
0 votes
0 answers
38 views

Reverse GreasePencil frames via python?

I'm trying to make a operator/script that reverses the selected Here is the script with the basic code: ...
Ommadawn's user avatar
  • 598
0 votes
0 answers
95 views

How to view the selected node in the shader editor?

The code below switches the shader editor’s material, selects a node, and then calls bpy.ops.node.view_selected() ...
Don Cheadle's user avatar
0 votes
0 answers
8 views

How can I show an image with its original resolution using template_icon() method?

I have a template_icon() UI inside a box UI. Since I am using template_icon() UI to show an image, its resolution looks ...
DagaPop's user avatar
0 votes
2 answers
82 views

How do I snap the 2D cursor to the origin point using python code?

I'm trying to snap the 2D cursor to the origin point(u=0,v=0) via python code. Initial state: Final State: Could anyone help me do that using python code?
Alexandre Leles Sousa's user avatar
3 votes
2 answers
181 views

animating sine wave expression

I am trying to modify an animation someone else made, but I'm having trouble animating the speed of this expression. It is an expression driving a shape key, and it is supposed to be cycling between 0 ...
Szilárd Egyed's user avatar
0 votes
0 answers
15 views

How to enable editing collections in addon

I´m using blender 3.6 and I can´t figure out how to enable editing collection inputs in N-panel. Thanks for any help
Tobiáš Pisarovič's user avatar
2 votes
2 answers
37 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
  • 177
0 votes
0 answers
26 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
76 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
14 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
  • 598
1 vote
0 answers
34 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
  • 598
0 votes
0 answers
22 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
15 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
1 vote
0 answers
57 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
  • 155
1 vote
0 answers
23 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
  • 598
0 votes
0 answers
39 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
  • 15
0 votes
2 answers
125 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
9 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
54 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
138 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
28 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