Skip to main content

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

How to update compositing nodes via script?

I create some nodes in compositing via python script: ...
5 votes
1 answer
144 views

How to Print to Console When Hidden?

I'm trying to print to the console in Blender using the following function. However, it does not work if the console is not in view (i.e. it's not part of ...
15 votes
2 answers
3k views

Adding operator to the toolshelf?

I'm just starting to learn scripting in Blender with Python. I made a simple operator following the quickstart intro on the Blender documentation: ...
0 votes
1 answer
387 views

Rendering on GPU cluster

I'm trying to render a scene on a remote server with GPU cluster, this is the used setup: Centos 7 Blender 2.8 4 Nvidia 1080 ti while rendering I can see that all the GPUs take part in rendering but ...
3 votes
0 answers
29 views

How to get Named Attributes in Geometry Nodes Modifier in Python

How to get Named Attributes used in Geometry Nodes Modifier via API? I want to get a list represented by strings ...
3 votes
2 answers
777 views

How to trigger a script after completing object transform?

If I move an object or rotate an object and press Enter to confirm, I would like to trigger a function. Is this possible? I did research on app handlers and msgbus to no avail. Is msgbus deprecated in ...
0 votes
1 answer
20 views

How to pause function call(back) for ie intproperty value setting, which has update function?

We have ui panel with intproperty & stringproperty fields (all those below 'timezone'): ba_props.py all those properties have 'update=update_coordinates' ...
3 votes
2 answers
105 views

How to reload ONE particular UI script? (an alternative to 'Reload Scripts' )

My add-on edits Blender's UI scripts. To apply changes to UI - edited scripts should be reloaded. For this purpose I use bpy.ops.script.reload() It does the job, ...
0 votes
1 answer
47 views

How to change exporting scale using Python?

When we export an .stl via File>Export>STL - we see a window which has a Scale variable. This one: • This variable is named ...
2 votes
0 answers
33 views

Time since last function call

зThere is an operator “A_TimeSincePriorHotkey” in the autohokey program. It returns the time elapsed since the last call of this function. With this operator it is very easy to work with double clicks ...
2 votes
1 answer
1k views

How do I set the bone length after setting a new bone matrix?

In version 2.77a; the docs show that the edit_bone.matrix is no longer read only, but a note warns "does not include bone length". Luckily, ...
1 vote
4 answers
390 views

How to get all hidden objects by script?

I selected some objects in outliner, all of them are hidden. Now I want to know how to get these objects? I tried using bpy.context.selected_objects , but it prints ...
1 vote
0 answers
17 views

How to make Collection sockets working in addon panel? [closed]

I can´t figure out how to enable editing collection inputs in N-panel. Thanks for any help
0 votes
1 answer
57 views

How can I make this script not get exponentially slower?

I'm trying to linked-duplicate an object with nested sub-objects. I've rewritten bpy.ops.duplicate_move_linked() as a function without ...
2 votes
2 answers
558 views

Change Navigation into walk Navigation with scripting

I'm now trying to change Navigation into walk Navigation in the 3D viewport. So I write the code below. ...
49 votes
1 answer
3k views

Custom trackpad pan/zoom/rotate behavior add-on

I'm trying to write an addon to customize the trackpad panning, zoomimg, and rotating gestures, but can't find a way to read the actual trackpad parameters for position and so on. The properties in ...
0 votes
0 answers
14 views

Continue baking after changing modifier and adding a new object

blenderers! I want to write a Python script to simulate two clothes being dropped on top of a cube. Here are the steps that I want to take: I want to drop the first cloth and simulate the physics for ...
1 vote
1 answer
33 views

Creating a Shortcut to Toggle Wireframe and Solid Display for a Singular Mesh with a Single Key Press

I want to hotkey the display as wireframe for an individual mesh with a keystroke, and then on the next press, it will go back to solid. I've tried to create a shortcut, but all I get is the "...
1 vote
0 answers
19 views

How to make separate curves to have the same tangent on their points

I have individual Bezier curves that are needed to create the road. There are meshes of different lengths - these are sections of the road that can have different curvature of turns and elevation ...
0 votes
1 answer
16 views

bpy.ops.transform.skin_resize script issue

I am iterating through vertices and applying `bpy.ops.transform.skin_resize" to each vertex. In the info panel, I can see that the correct value is being applied to each vertex, but in the ...
1 vote
0 answers
26 views

How can I determine if the Dope Sheet menu state is expanded or closed via Python?

Is there a way I can access certain UI elements through a script in Blender? I am trying to access information within the Dope Sheet Editor. One thing I would like to achieve is to determine if a menu ...
4 votes
1 answer
2k views

broken script to bake keyframes from driver controlled shape keys

I found a script on the web that is supposed to set key frames for driver driven shape keys. however its giving me an error. I need this so i can remove the drivers for the render farm I use wont ...
1 vote
2 answers
1k views

How do i change the active keying set by Python?

You can call the Change Keying Set menu by hotkey Shift+Ctrl+Alt+I. But you cannot assign a hotkey to one of the single keying sets. It's always the whole menu. So I want to create a button in the ...
0 votes
2 answers
2k views

How to stash all actions to current armature?

I just imported a bunch of actions from different files into one blend, but the GLTF exporter can't locate them without them being in the NLA stash. (There used to be a plugin that would export all ...
5 votes
1 answer
923 views

How can I use the 'Copy as driver' and 'Paste driver' functionality in Python?

I'm writing an addon for Blender 2.8. I have an object and want to drive the Y & Z Scale with the X Scale. Doing it manually with right click on the Scale shows me these commands: ...
0 votes
1 answer
348 views

How to change window size from script?

I'm trying to set my window to full screen/maximised mode How do I achieve this via script? I tried this answer but it's obviously for windows operating system whereas I'm using Ubuntu 22.04.1 LTS
7 votes
3 answers
4k views

Python Geometry Node Trees

I'm trying to make a script that assigns a custom Geometry Node Tree to a bezier curve. The node tree contains 3 custom node groups. I have created the groups with code but I can't assign them to the ...
1 vote
2 answers
2k views

Export FBX while keeping Collections Hierarchy

I am looking for a way to transfer the hierarchy of the collections from Blender to Unity. In other programs, like Cinema 4D, this works without any problems. Is it possible to export a fbx-file with ...
0 votes
2 answers
99 views

How to force UNDO panel to be maximized in custom operator

I made an operator, which have an UNDO panel with my custom properties. If UNDO panel was collapsed – it remembers this state and next time will appear also collapsed: __ It's not ok in my case. I ...
0 votes
1 answer
61 views

How to reload UI without restarting Blender

I'm writing addon which edits default UI. To be specific - it works with VIEW3D_MT_mesh_add The functionality I need goes beyond standard ...
1 vote
1 answer
38 views

How can I count the number of visible objects in a rendered image?

I used to do this on blender2.78c+ubuntu20.04(cuda11.8+4090), but it will error after process around 700+ images. ...
5 votes
1 answer
5k views

How can I convert a complex point cloud to mesh?

I come from this question where I have generated a Point Cloud from a simple script which I want to convert into a mesh. I see there is this question and this question, which was unfortunately marked ...
3 votes
2 answers
2k views

Make a rotations-only parent BGE

There is a way to make an object parented to another object, but only for the rotations, not for the location. If i move the parent, the child may dont move. If i rotate the parent, the child must ...
3 votes
1 answer
38 views

How to grey out a modifier panel UI element?

I would like to achieve a greyed-out effect similar to this: Except in the object modifiers menu: The parameter can be accessed by ...
1 vote
1 answer
20 views

Set up Flamenco to support multiple Blender versions?

I have some older workstations that are not supported by the latest versions of Blender, but I still use interactively. I want to send jobs from these workstations to my Flamenco/Blender "farm&...
8 votes
1 answer
159 views

What do all of the mode enums in bpy.ops.object.duplicate mean?

What do all the various mode constants in blender operators documentation do? bpy.ops.object.duplicate(linked=False, mode='**TRANSLATION**') - Duplicate selected ...
6 votes
0 answers
469 views

How do I change the width of the Adjust Last Operation panel?

I've done this simple operator taken from templates. How can I change the width of the Adjust Last Operation panel? I tried scale_x and ...
0 votes
2 answers
46 views

Set Origin to a specific vertex

I need some help with my script. The main task is to move the origin to the position of a certain vertex. In theory this works quite well, but unfortunately the meshes are always moved after i run the ...
0 votes
1 answer
31 views

Blender 4.1 how to correctly use "#Frame"?

How to correctly use #Frame to rotate camera around object? Parent camera to empty. select Empty. Rotation Z: #Frame/30 Syntax ...
3 votes
1 answer
380 views

Animation Loop Add-On Problem

So I've worked on a local add-on that would allow me to adjust the start frame and the end frame of the playback loop. I created an enum list with three options: default, A, and B. Basically want I ...
0 votes
1 answer
445 views

How to set up driver via python script between Custom Properties of objects?

I want to set up drivers: from Custom Properties of a Camera to Custom Properties of selected object. Based on a script from 6 year old post: How to put together a driver with python, I manage to ...
0 votes
0 answers
20 views

Modify face orientations in bulk

I wrote a script for batch change orientation. Here is a script I wrote: ...
2 votes
0 answers
30 views

Text in reflection

I'm new here in this blender world and I really need your help with a college project. I'm sorry if anything is written wrong as I'm using Google Translate. I am from Brazil How to create a script in ...
1 vote
1 answer
388 views

Rigify: Set the IK Target via Python?

I have a character animation using a rigify human rig. I blocked the animations using different IK Parents for the hand controllers. Before I start splining I want to unify the IK Parent for all my ...
1 vote
1 answer
29 views

How to Align Icon to the Right in Blender Panel Header using python?

I’m trying to customize a panel using python in Blender 4.1, and I want to align an icon to the right side of the panel header. (like this) I’ve tried a few approaches, but I can’t seem to get it ...
0 votes
1 answer
367 views

Define the fbx file name : collection or active object name with a checkbox

I try to create this script but I’m newbie in python The aim is to export a fbx in specific folder when you click Export button. If the checkbox is True, then the filename get the name of collection. ...
0 votes
0 answers
26 views

change modifiers values ​with a gizmo

I see a lot of potential in gizmos, yet there is very little info on it. For example, I want to modify the properties of the modifiers or geometry nodes of my object with a gizmo. How to do this ? ...
0 votes
1 answer
559 views

Problem with bpy.ops.sculpt.brush_stroke

Bear with me, this is complicated to describe. I am writing an add-on for Blender which involves using bpy.ops.sculpt.brush_stroke in Sculpt Mode to essentially ...
22 votes
5 answers
33k views

How to join objects with Python?

I try to do this: bpy.ops.object.select_all() bpy.ops.object.join() in my script. It selects all the stuff like CtrlA but fails on ...
0 votes
0 answers
19 views

How do I convert camera's rotation from Z-Up to Y-Up?

So I have this script that exports data on the location and rotation of the camera every keyframe to a json file, and this is working great but the problem is that I need to convert the rotation from ...

1
2 3 4 5
129