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
0answers
10 views

Save modified image as a direct copy via scripting API

So it turns out pre-processing some image data in Blender is fairly non-trivial and unfruitful task without extra libraries. If I modify raw pixels (pixels prop on BlendDataImages object) Blender wont ...
0
votes
1answer
20 views

Is there a way to save all settings of the sequence editor to disk and load them when needed?

In Python, is there a simple way to save everything in an editor, ex. the Sequence Editor to disk and later when needed load everything again? The reason for this ...
0
votes
0answers
12 views

How change a tooltip on a Thumbnail image?

Actually, I have no idea if it is possible to change the tooltip on a thumbnail image. I want to display the name of each preview image as a tooltip, but only the name of the Enum property is ...
0
votes
1answer
56 views

How to get a vector type from a FloatVectorProperty?

How do I get the mathutils.Vector from the FloatVectorProperty in a python script? Sometimes it works other times I get a type ...
0
votes
0answers
11 views

Create separate animation tracks for multiple animations?

I have a binary animation data I successfully parsed to bone:state. Here is pseudocode how I currently create animation: ...
0
votes
0answers
23 views

Calculatring distance matrix efficently

I'm creating automatic UV unwrapper. Most of the algorithms for decomposition use distance matrix, let us call it D, witch means that we construct a matrxi NxN (N - number of faces), where D[i, j] = ...
1
vote
1answer
28 views

Scripting about properties panel

When my mouse in properties panel, How can I create a shortcut such that when I press 'FIVE' then toggle to modifier panel. Blender Ver: 2.91
2
votes
3answers
65 views

How to add a mirror modifier to all objects of a certain collection?

I'd like to add a mirror modifier to each object of a certain collection. The problem is that the modifier will be only added to the last object which even gets the same modifier several times and I ...
0
votes
1answer
11 views

How to restore menus after unregistering a menu-altering-add-on?

If you create an add-on which replaces existing menus in order to ex. add elements in between the existing elements, installing it works fine, but uninstalling it removes the entire menu. So the ...
0
votes
0answers
21 views

Creating a procedural/auto generated trench system? [closed]

​Hey, I was hoping someone can help me find a solution on how to create a procedural or auto generated trench system in Unreal engine? Any kind of solution will help, I am currently working with a ...
1
vote
2answers
74 views

How to *efficiently* find all lights within a scene?

I'd like to fill a custom UI list with all the lights that are in the current scene, but am unsure of the best way to do this. We could iterate over ...
0
votes
0answers
17 views

RuntimeError: Error: Image too small when setting render region, rendering in python

I'm trying to write a python script that automatically sets the render region, like so: ...
0
votes
2answers
57 views

Menu list keeps on growing every time I debug my Operator script [duplicate]

This is a question about the process of developing an addon rather than a specific error in the script. I'm creating an Operator that I want to show up in the UV Unwrap menu. I'm editing the script ...
0
votes
1answer
37 views

How to add an Empty to all selected objects? [duplicate]

I have about 30 planes and would like to add an empty to each one of them, is there a way to do it using python instead of having to do it manually?
0
votes
0answers
24 views

Python script: problems in adding curves_galores

I'm trying to create a batch array of curves galore changing randomly the parameters. I've created a script that works but since I could not find bpy.ops.curve.curveaceous_galore_add I needed to use ...
1
vote
1answer
18 views

How to call rigify operators?

I'd like to run some rigify operators. As you might know, the operators are "unique" for each armature because of their rig_id. If I have the ...
1
vote
2answers
45 views

It is possible repeat a set of commands for multiple objects? [closed]

I have 645 objects and I would like to repeat the same commands for each one. I followed this tutorial: Is there a way to repeat a set of actions on an object? But the script gives me an error. ...
2
votes
2answers
67 views

Assigning an empty parent object

I wrote an operator to create an empty object and then make it a parent to the currently selected object. However, when I assign the parent object, the child object moves unless it is at the origin. ...
0
votes
1answer
28 views

How to connect two vertices of two objects in python

I have two objects where I want to randomly link different vertices. Is there a way to select two vertices and connect them if I know their coordinates?
1
vote
0answers
20 views

Unexpected size for script generated mesh

I'm using a script to generate a mesh: https://gist.github.com/dwatrous/efa2ea82fc2269e59afa182bf5ced0df I have my scene units set at millimeters with a scale factor of 1 For some reason, when I run ...
0
votes
1answer
42 views

How can I protect my addon code from scammers? [duplicate]

I am working on an addon which I am close to finish and I'll share it totally free with a game community. But... As in outer life, this game community has some "weird" guys. These "...
0
votes
0answers
22 views

Scaling from 3D Cursor works in object mode but not in edit mode

I'm trying to scale down my model using the 3D Cursor pivot point, so I wrote this script ...
0
votes
0answers
16 views

How to distribute obfuscated add-ons with PyArmor [duplicate]

I want to obfuscate and distribute a Python add-on. I use a library called PyArmor and Anaconda Prompt for obfuscation. Obfuscation of the add-on "test.py" using PyArmor will generate a file ...
-1
votes
1answer
177 views

How do you save texture as an image to disk with python

Okay, I got an working example that I was able to assemble, by setting the image settings I was able to get a smaller array size to disk with a smaller image. So I saved an image to disk, loaded it ...
2
votes
3answers
44 views

How to remove extra materials from a mesh if the mesh has more than 1 material?

I am trying to write a little script that checks if mesh has more than one material, and if it does, remove materials until there is only one left on the item. Here is what I have so far: ...
2
votes
1answer
49 views

How can I loop through screen areas and point to specific area?

To loop through screen areas and find IMAGE_EDITOR I do: ...
1
vote
1answer
26 views

Python - Iterate over each object and unwrap - Problem

posting a gif for reference. When I run this script on one object I get exactly what I want, the object is unwrapped and fits fully in its UV space. But when I run the script on both objects selected, ...
2
votes
1answer
33 views

How calculate the surface curvature for each vertex of a mesh?

I want to calculate the curvature value for each vertex of my mesh. All the scripts suggested here Is there a way to calculate mean curvature of a triangular mesh? don't work for me. These are the ...
2
votes
1answer
27 views

How to hook a vertex of a curve to a certain object?

I'm trying to hook a curve vertex to an object and this method works perfectly: bpy.ops.object.hook_add_selob(use_bone=False) The problem is when I try to do this ...
0
votes
0answers
22 views

BPY import/append .blend asset from another file? ( ideally by clicking a button) [duplicate]

How to automate the process in Python of importing any one out of 10 assets from another .blend file? (ideally by clicking a button) I am trying to use append, but I am not so sure about the correct ...
0
votes
0answers
19 views

How to create a subpanel that has a checkbox - Python Blender [duplicate]

I am creating an Addon with Python and BPY, and I would want to have something like this: How are these things called? Subpanels? I have been looking and couldn't find any info. I would like to know ...
0
votes
0answers
22 views

Problem Automating UV packing each object

new to python here. Hoping to get some help on a script. Im trying to unwrapp and pack uvs for multiple objects. The problem is this script packs uvs as if all of the objects selected were one object (...
0
votes
0answers
15 views

Problem about a code. This the code is crash (audio visualization)

I have problem. I write a code to create visualization music, but this the code is crash everytime, when I run it. I need help ! What is going on ? Code : ...
0
votes
0answers
20 views

Unable to delete non-quad faces

Given below is the code. First I make a cone(frustum), then I go through all the faces and select the faces with more than 4 vertices, that will be the 2 circular faces on the top and bottom. The ones ...
0
votes
0answers
29 views

How do I Include / add path to blender's python to read extra directory

I get warnings while installing modules with pip from command line and I think this is one of other issues that I must solve to make Tensorflow work with blender ...
0
votes
0answers
20 views

Can't invoke pop-up of operation? [duplicate]

I want to make an interface so that I can control my python methods I have already made. So I am trying to make a pop-up of an operation I made (see code below). But I get an error in the last line ...
1
vote
0answers
18 views

How to arrange multiple buttons vertically

I wrote the following code. ...
0
votes
1answer
33 views

Why after transforming an object with the matrix_world of another object the reference and target object have different transformation matrices?

I'm quite confused on how the matrix_world is applyed to an object. Why the transformed object has a different transformation matrix of the reference one? Why the parented objects do not apparently ...
0
votes
1answer
32 views

How to load an image from disc and assign it to a newly created image texture node?

I'm trying to load an image from jpeg file and to add the material to the cube using the following code: ...
0
votes
0answers
12 views

Fetch RGB/hex values of object material color for all frames where shader nodes have been used

I need to fetch RGB values of object material for all the frames where shader nodes have been used to change colors. I'm not able to fetch values with scripting by using ...
1
vote
1answer
17 views

The value of TextBox cannot be obtained and an error occurs

I wrote the following code. This is just the code to get the value from the textbox and print it. But this doesn't work. When I run this code, blender crashes. What's wrong with this code? ...
2
votes
1answer
39 views

How to control spacing/alignment of Label + Horizontal Enum Property?

I would like to achieve the layout of this panel but I'm having some issues. The example is from blender's Bevel Operator. As far as I can tell it's just an Enum Property without the enum_flag since ...
0
votes
0answers
17 views

Why isn't addons_contrib\module in sys.path? (2.90)

From reading the manual, I'm assuming that the proper place to put my own scripts and modules (in Windows) is ...
1
vote
0answers
8 views

Mysterious CUDA cuModuleLoad during long Cycles render session

I am using Blender's python interface to render many thousands of small images for a machine-learning dataset and I'm running into a strange problem that I'm wondering if someone can help me with: I ...
0
votes
0answers
19 views

Animation Nodes: Problem with script node

When I enter a simple opperation in the text part of the script node it doesn't work. The result doesn't change like you see in my pictures. However I try to follow instructions from tutorials. I don'...
-1
votes
1answer
59 views

How can I change some image editor options using python?

Let's say my UI looks like this: What I want to do is to change some Image Editor bpy.context.window_manager.windows[0].screen.areas[1] options through my addon. ...
0
votes
1answer
43 views

Change status in status bar

I want to use bpy.context.workspace.status_text_set(text="HelloWorld") The problem is it is working just in draw, modal, execute methods of my operators, ...
1
vote
0answers
33 views

How do you import json files into blender?

I am Following Chris P's 'Visualize Real-world JSON Data in Blender (3D Chart Animation Nodes Tutorial)' on YouTube but I seem to have got stuck at the first hurdle of importing the data. I have ...
0
votes
1answer
35 views

Boolean with bevel bezier curve

I have loaded an stl file and want to do some boolean stuff on it using python API (see code below). First I create the bevel spline and move the end points where I want them. Then I create a boolean ...
0
votes
0answers
29 views

What can I do to get better renderings of metallic object with holes?

Dear blender community, I like to have nice renderings of metallic objects with holes from different perspective with a black background. I want sharpe edges and holes. Like always it should look good....

1
2 3 4 5
91