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
2
votes
1answer
24 views

Using bpy in a standalone python script dies when rendering

EDIT (Solution): I was able to fix this by adding the following line: bpy.context.scene.render.engine = 'CYCLES' This works fine for me as I need to use the cycles ...
3
votes
1answer
42 views

Detect user event (bpy.types.Event) anywhere from blender?

In blender interface, when multiple objects are selected if we press "ALT" on the keyboard while changing a property, the behavior of the property execution change (in this case we can batch ...
1
vote
0answers
13 views

I have a problem with addon Spark AR Toolkit in Blender [closed]

I have a problem in Blender 2.9. WhenI click anywhere in the workspace and an error appears. ...
0
votes
0answers
10 views

Can I use a property defined in a script as an input to a shader network? [duplicate]

I have a script with a property settings group. It defines a FloatProperty called grid_unit_size. I'd like this property to be used as the input to a shading network. Is there a way to do this? <...
2
votes
1answer
31 views

can't find update callback for CollectionProperty

I'm new to python and I encounter a problem with update callback function. I have a UiList of items, and I'm looking for a way to display a popup window when user click on one of the items in the ...
0
votes
0answers
14 views

Bake Split Mesh Script

I am using blenderGIS to create a mesh, out of a large area. I do this frequently at my job. The texture comes in at 650mb or so, and I need to chop it and the mesh up. I found a script which will ...
0
votes
0answers
19 views

How to find the UI code for a node/modifier

I want to be able to see the UI code for modifiers and nodes, which "edit source" doesn't work on. It instead gives the error "Active button is not from a script, cannot edit source&...
1
vote
1answer
15 views

How to tag a redraw in all viewports?

I've designed a modal operator that changes the geometry of a mesh when the user clicks and drags the mouse. I'm able to see the geometry update in the viewport I'm dragging in by tagging a redraw ...
3
votes
1answer
18 views

Path following via API

Apologies if this question has been answered already, but I can't seem to get this thing working. What I am trying to do is have a cube follow a curve interpolated out of coordinates. Manually this ...
1
vote
0answers
13 views

How can I apply transform on a linked object via Python?

I have myself a linked object in my scene. I can't move it manually, but I can change it's location with Python. However I also want to apply the transform. I tried it using ob.transform_apply (loc=...
0
votes
0answers
7 views

Can I display a BoolProperty as a push button? [duplicate]

I have three BoolProperties in my addon (they represent the X Y and Z axes). At the moment when I add add them in the draw method my panel, they are displaying as checkboxes. I'd prefer a pushbutton ...
1
vote
0answers
13 views

How to access/calculate tangent and bitangent vectors from BMLoop via script?

This question has an answer when using MeshLoops: Script access to tangent and bitangent, per face: how? But I'm working with BMLoops to collect vertex data. I haven't yet found a good way to ...
1
vote
1answer
21 views

Extract object properties from animation for each frame

I am an absolute beginner, please forgive me if this is a basic question. I am using Blender 2.91. So I have n objects one in the middle and others surrounding it and the one in the middle is the ...
0
votes
0answers
16 views

Draw built-in icon in handler

I want A way to draw blender icon in handler. ...
1
vote
1answer
23 views

diffuse color material in python error

I am trying to add materials via python (which I am new to) but I can not even get copy and pasted code from here to work. colorsys is imported and I'm using Blender 2.91. ...
0
votes
0answers
18 views

Ways to optimize run-time of _view_layer_update calls? [duplicate]

I've been working on an Add On project for a while to generate buildings/terrain procedurally out of "primitive" Blender objects as elements. As you might expect, one of the most common ...
5
votes
1answer
124 views

Anti-Aliasing in GPU shader Module(OpenGL)

How to smooth the bound of the shape? If you run the following script in blender, you can see the Jagged Edge in that shape. ...
0
votes
0answers
19 views

Python: Node context missing [duplicate]

I'm new to scripting in Blender 2.91.0 and I'm trying to modify nodes via code. According to the API I should be able to access my current node selection via the Node Context. My material is using ...
0
votes
0answers
16 views

My script doesn't work like an add-on

I am writing a script for the Composition tab and it works when I run it in the Scripts tab, so I want it to be an add-on. I found the manual and added the lines that need to be added, then I ...
2
votes
1answer
29 views

Modify node value in all materials with variable name?

I'm trying to automate a process where I have to change a Value node for all materials starting with the prefix mb:. I've been messing with it, but I'm such a ...
4
votes
1answer
18 views

Blender Scripting: ERROR: too much data in this layer, compared to elements in mesh, skipping!

I am working on a Blender script that does rendering of FBX file based on the software it was originally generated in Eg. 3D Max, CLO, AutoCAD etc. The script works perfect for all the FBX other than ...
0
votes
0answers
18 views

Script taking photos of 3D models with blender

I am trying to emulate the process used to produce the images from 3D models in the smallNORB dataset https://cs.nyu.edu/~ylclab/data/norb-v1.0-small/. I have a series of 3D models which are in a .stl ...
0
votes
0answers
19 views

How to reset EnumProperty value when the enumeration items are changed

I tried to make and display the EnumProperty whose items are object name existing in Blender. However, the value of EnumProperty ...
1
vote
0answers
20 views

Is there a way to change default Modifiers' options?

Is there a way to change the default Modifiers' options? For example, Boolean options. Let me explain: I work with high-poly models for 3D printing. And each time I forget to turn off preview option I ...
2
votes
1answer
48 views

API command for general Edit Mode toggling (TAB press)?

I tried imitating Blender's TAB press (Edit Mode Toggle) by using object.mode_set(mode='EDIT'), but this doesn't work for grease pencil objects which require ...
2
votes
0answers
55 views

bl_options = {'REGISTER', 'UNDO'} not working… Blender 2.9 | trying to link props to my Operator in separate files

I have an add-on split into multiple files. Here is my file structure: ...
0
votes
0answers
10 views

link objects to scene without opening blend file

I'm using this line of code to write one or more objects to a new file bpy.data.libraries.write(self.filepath, datablocks, fake_user = True) When opening the ...
0
votes
0answers
19 views

Run Blender Import-Addon from Python

I try too call a Import-Function from Command-Line or Python Script. (Addon: https://github.com/neverhood311/Stop-motion-OBJ) However, with ...
0
votes
0answers
9 views

How to delete segment on curve using Blender 2.8 Python API?

I have a bezier curve in 3D space, made of several points. I want to be able to delete the segment that goes from (let's say) point 12 to point 13, so that now my curve has a gap where it was ...
0
votes
0answers
12 views

Does the “diameter” in “bmesh.ops.create_uvsphere” actually mean “radius”?

I created a sphere using bmesh.ops.create_uvsphere(bm, u_segments=32, v_segments=16, diameter=1) but later I noticed the radius of the sphere was 1 grid. As the ...
0
votes
0answers
17 views

How to have WorkSpaceTool pass mouse events on to Operator?

I came across the UI Tool Sample script in the Python/Templates menu and thought it would be useful for an addon I'm making. The example shows how to use the ...
1
vote
1answer
29 views

How to have Blender run my script from the filesystem rather than the script window? [duplicate]

I'm trying to figure out a workflow to allow me to develop addons in Blender that doesn't require me to use the Scripting window. The scripting window is great if your script can be done in a single ...
2
votes
0answers
25 views

Blender doesn't recognize Cython created module

I'm trying to speed up some erosion simulations (simulating 10's of thousands of raindrops) I have in python but I cannot get Blender to even import a cython created module. I've created a super ...
1
vote
0answers
23 views

Python learning

I started to learn python for Blender and wish to follow a path so I can master it (... and of course constantly keep learning). My end goal is character animation. In particular I wish to use python ...
1
vote
1answer
25 views

Run Python code from external process

Is there a way for an external process (e.g. shell command) to cause Blender to execute a fragment of Python code (on Linux)? Essentially I would like to make my own version of the "Python ...
0
votes
0answers
8 views

Scripting, setting the active Posebone [duplicate]

How can i change the active poseBone when i'm in pose mode via python in blender 2.91? I tried with ...
2
votes
1answer
32 views

Node group not found after script execution

I was trying to recreate script from video, but with my own node group and I ended up with an Error which is too hard for me to understand. Script did works and create node groupe, but for some reason ...
0
votes
0answers
9 views

Can I have a Panel only display in Object mode?

I've created a panel which should only be displayed in Object mode. I've tried adding bl_context = "object" to the class fields, but that stops the panel ...
0
votes
0answers
9 views

Changing active object to copied instance of active object [duplicate]

Simple bpy question, but I can't figure it out. Is there a way to change a new instance to be the active object after it is copied from the active object, without using its name? For Example: ...
2
votes
0answers
9 views

Accessing Python Command Line Script Objects

If I generate an object in a python script e.g. called draw_a_cube.py def my_mesh_func(*kwargs): return useful_mesh ...
0
votes
1answer
26 views

How to make a Panel accessible while modal operator running?

In my script, I've created an Operator, a PropertiesGroup which holds the properties of my operator and a Panel which lets the user change the properties and start the operator running. My operator ...
1
vote
1answer
25 views

How to create list bullets in an operator's class description? (see example)

I noticed this description for the measure tool. How do you create list bullets in an operator's class description?
2
votes
0answers
27 views

How to select a meta strip inside another meta strip using python?

I have a main meta-strip which contains a sub meta-strip. In the sub meta-strip, there is a regular sequence named BaseSequence. I want to write a script to add some effect strips(e.g. Transform strip)...
1
vote
0answers
23 views

Python API – Access Grease Pencil stroke point weights

I need to read Grease Pencil bone weights from the Python API so I can add that data to an export script I'm using. I can't find where the per-point weight groups are stored. So far, I'm able to ...
0
votes
1answer
27 views

How to make custom hotkeys? [duplicate]

Is there a way to make a custom hotkey for specific functions? Like to solve my problem here: I’m working on a piece, its a replica and I have many references setup in some collections and I need to ...
0
votes
0answers
16 views

How to add wav file to video sequecer in blender python

I have tried importing Audio with code like the following, referring to past questions and answers. ...
0
votes
0answers
10 views

I'm writing a python file exporter for Blender 2.91. How can I make temporary duplicate objects/meshes and apply all modifiers to them for export? [duplicate]

I had an existing python exporter for Blender 2.7 which iterated through all the visible objects in the scene, grabbed any child meshes and duplicated them, applied modifiers, triangulated the ...
0
votes
1answer
15 views

Seperate objects by loose parts automatically in python

A have some objects that undergo several boolean. This leaves parts as unconnected. I know that I can: Enter edit mode Enter face select Select a face "Ctrl+L" for select linked all (done ...
1
vote
1answer
31 views

Set a projector at UVProjection modifier (script)

I am trying to create a script that involves the creation and setup of a UV Project modifier. When it comes to set the UV Map of the projector, there is no problem at all: ...
0
votes
1answer
20 views

How to set up __init__.py for my addon? [duplicate]

I've written a script and am trying to turn it into an addon. I've been trying to copy an existing addon which is working, but for some reason my variation isn't working. I've created a directory ...

1
2
3 4 5
95