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
9 views

Scripting Access soft body modifier settings [duplicate]

When you add a modifier with a script like that bpy.ops.object.modifier_add(type='SOFT_BODY') How can i change the settings, i tried with the previous method but ...
0
votes
1answer
19 views

How to get face normal from a mesh loop?

I'm iterating through the loops of my mesh and would like to get the face it is attached to (so I can get the face's normal). I'm looking specifically for the face normal, not the vertex or loop ...
0
votes
1answer
20 views

How to check if a PointerProperty has a value?

I've written a script that contains a bpy.props.PointerProperty which the user can set to an Object. I'm having trouble finding any examples on how to access the contents of this property. How do I ...
2
votes
1answer
60 views

How to remove text written over top of FloatVectorProperty

I'm writing a panel that displays a vector that in meant to indicate the direction of a normal. Using FloatVectorProperty with ...
0
votes
1answer
31 views

How do I add a new tab to the 3D Viewport? [duplicate]

I'm creating a Panel that sits in the 3D Viewport. Right now when it runs, it is inserted under the Misc tab. I'd like to create my own tab to place it in. How do I do that? ...
1
vote
1answer
18 views

Script to help with edge loop deletion

I'm not new to Blender but I am new to the scripting aspect, so this isn't something I can throw together yet.. But I need this functionality to speed up my workflow. I would like to ask if the ...
0
votes
0answers
10 views

Create default scene with Screen cast keys addon enabled and the display turned on

I always want to enable the Screencast keys addon when using Blender. I'm trying to avoid having to remember to turn it on for each new Blender project. I tried turning the checkbox for it on in the N-...
1
vote
1answer
27 views

2.9x Why can't I see my scripted print function results in the console? [duplicate]

import bpy print ("something") When I run this script nothing happens, nothing appears. The only answers to where it prints I find are from 6 years ago. ...
1
vote
0answers
8 views

How to make a text box active(Similar to rename by F2) in blender python?

I have a panel that pops up when a user presses some shortcut key and the panel has one text box(row.prop(....)).Now i want to make the text box active so that when the user presses the shortcut key ...
0
votes
0answers
31 views

Tutorial for OpenCV real-time Facial Motion capture's script doesn't work in 2.91

This is the tutorial I'm following: https://www.youtube.com/watch?v=RY_eErKlilw&ab_channel=GadgetWorkbench It contains scripts to be run inside Blender's script window, not to be installed as an ...
1
vote
1answer
26 views

Reconstructing vertices and uv separate from polygons

I am trying to export the vertices, triangles, vertex normals, and UVs with blender's Python (bpy). I need code that actually works. My program is supposed to run like this: Loop through and create a ...
1
vote
1answer
37 views

Blender python to hook vertex and empty

I am looking at how to use python and make a code that automatically detects an empty on a vertex point and hooks them together. How can I do this and add it to the code I already have? ...
1
vote
0answers
14 views

How to get Panel to use properties from a PropertyGroup? [duplicate]

I'm trying to create a PropertyGroup so that I can share my addon's properties between several different panels and operators. The below is the best I came up with ...
3
votes
0answers
34 views

How to write unittest to test Add-on

How to write unit tests in blender and how to compile them to see there are running perfectly. note: unit tests to test add-on. Thank you.
0
votes
0answers
18 views

Blender vertex mapping code

This below is my code that is trying to put empties over the verts on the selected mesh but for some reason every time I run the code blender just crashes. I am testing the code on the basic cube. <...
1
vote
1answer
37 views

How to get operator object from id?

I'm writing a script that contains both an operator and a panel. Both the operator and the panel are created in the script's register() method. In my panel's <...
0
votes
2answers
69 views

Simple python code does not work

Not sure why this simple code does not work. I tried several things... but it only works if the values are statics . In this example I put one dinamic value (does not work) and another that works but ...
1
vote
1answer
30 views

Create default scene with Screen cast keys addon enabled and turned on

I always want to enable the Screencast keys addon when using Blender. I'm trying to avoid having to remember to turn it on for each new Blender project. I tried turning the checkbox for it on in the N-...
1
vote
0answers
41 views

Looking for pyqt combobox and listwidget equivalents in blender

I need to port a tool from nuke (to blender). The nuke tool uses pyqt comboboxes and listwidgets. The widgets are populated with info from an external database. The widgets are displayed vertically....
0
votes
0answers
23 views

Select an object from its location with Python

I would like to select one object among more than 8,000 objects from location. I have a CSV data which determines each object(plane) location. After putting all planes, I need to move some vertices ...
1
vote
0answers
25 views

How to get the file path of the current theme?

I have an addon that allows changing your current theme to a custom one using bpy.ops.preferences.theme_install(path), but I also want to allow going back to the ...
0
votes
0answers
20 views

How to expand the code hint?

I'm working on a python script for my addon, but I can't find a correct reference for changing Freestyle lines set from script. When I hover mouse over a toggle button for example: I see only ...
0
votes
1answer
21 views

Bevel with specified radius in python script

I think this is kinda simple. I currently make a Bezier curve and set a circle curve as the bevel object. ...
0
votes
0answers
22 views

Shaders Nodes - Attaching and detaching nodes with python [duplicate]

I would like to import an image as a plane, then add a MixShader and a Transparent BSDF, detach the Material Output Surface link, attach the BSDF to the MixShader, to the Material Output, then add the ...
1
vote
0answers
15 views

Attempting to rotate bones to align with a nurbs path line

I have an array of head positions of bones only, and I am trying to pose a skeleton based on that only. In pose mode you are unable to change the location of bones that are not the main bone, so I ...
0
votes
0answers
9 views

Save selected object via popup filebrowser to new blend using python Blender 2.8

Is it possible to modify the Text Editor > Templates > Operator Export File in order to save the selected object in the current Blender session via popup ...
1
vote
1answer
38 views

Create a folder dialog box for an addon (2.91)

I'm trying to add a folder dialog box in the add-on I'm working on. I managed to add a button that opens a folder dialog and setup the path, but I'd like to be able to see that path rather than just ...
0
votes
1answer
19 views

Cant change objects' property - Writing to ID classes in this context is not allowed. location: <unknown location>:-1

I can change object's property using operator or just pasting bpy.data.objects["BF_platform_twelve"].hide_viewport = True at the beigining of file or in ...
0
votes
0answers
26 views

How to export each animation to its own fbx file?

I like to export each and every animation into separate fbx files like mixamo gives, one mesh other skeletons, and like unreal do when import to it. Animations to one file works fine but I want to ...
0
votes
1answer
59 views

How do I modify this script to affect bones instead of shape keys?

...
0
votes
0answers
21 views

Automating Replacing Materials From Library Then Saving With Material Name

I've been looking around the forums on here and BlenderArtists, as well as the Blender API documentation to try and create a script that suites my needs. This is as far as I got, though it doesn't ...
0
votes
0answers
35 views

How do I Add Vertices to a NURBS path?

I'd appreciate any help with this simple script that I cannot get to work properly for Blender 2.8+ All I want to do is to take a selected NURBS path as input, and create a new NURBS path that is ...
1
vote
4answers
68 views

Python path for allowing animation of viewport and render visibility of objects

EDIT: It turns out I formulated this question out of a misunderstanding of my own old code. See @batFINGER and @scurest answers. I'm working on a script which automates some animation, which includes ...
2
votes
0answers
18 views

Enable show keyboard-shortcuts in Toolbar?

Is there a way to preview the keyboard shortcuts of a common command in the standard toolbar much like this? I've been told I should use the F3/spacebar search options but retrieval adds time to ...
1
vote
0answers
19 views

Adding objects to new .blend files using python

I want to save a number of objects of my project file to a new external .blend file using python. ...
0
votes
0answers
15 views

How to get data automatically in a script

For example if i have a cube and i want to save this information in a json .i want to save for example each face, vertices but automatically and every time that i edit a face of the cube it update in ...
1
vote
1answer
21 views

How to register a collection property to a custom property group

I would like to register a collection property for a list to a property group that I have already created. Unfortunately, this doesn't seem to work: ...
0
votes
0answers
12 views

Problems rendering camera motion (Euler angles) and lighting

I am having trouble rendering camera motion and lighting. In the example below, my scene contains a sphere and a plate, and some light. But while rendering, the light does not seem to lit the plate. ...
0
votes
0answers
10 views

Draw handler only updates when moving the mouse [duplicate]

I am writing a simple add-on to move the 3D Cursor. It works with a modal operator, the 3D locations follows the mouse position, but it gets the input from the keyboard if the user wants to type a ...
1
vote
0answers
17 views

Exporting FBX Files - One Action per FBX?

Hello everyone! I am new at blender but i need to learn it for a job. I worked like 3 years on maya but I would like to add my maya workflow on blender... My probleme is : I would like to export each ...
2
votes
0answers
13 views

Change image “Color Space” setting from script

I`m loading some images from script and I need to be able to change their "Color Space" setting from python. Some of the images are normal maps and it took me a while to get what was going ...
0
votes
1answer
25 views

Slicing an object into parts along axes other than x, y, z with a python script

Using these examples Slicing an object in 4 parts How can I evenly split a cube? I was able to cut an object into pieces along the x, y and z axes with a python script. But I can't do it along ...
0
votes
0answers
17 views

How to isolate edge loops along axis in python?

Using python scripting, I want to make changes to edge loops that roughly follow a given axis, (Z in this case) but I don't even know how to isolate the loops I want. To illustrate, I've selected the ...
0
votes
0answers
31 views

No module named 'branch'

i was making a addon and i have this problem , i was looking for two days ago and i have not found nothing , im so tired with this. i saw a lot of question about this but they are not help me when i ...
1
vote
0answers
10 views

Create Depth Pass Based on Real World Units

I'm trying to generate synthetic training data as part of some research for my university. This data should resemble depth images captured from my camera (Realsense L515). I've been able to get good ...
1
vote
0answers
22 views

Stop modal operator externaly

I have a modal operator that runs in the 3d viewport. Its basically the raytracer from the template. It can be canceled with escape. But I have several other operators which can be executed from ...
0
votes
0answers
24 views

No module named 'particles_to_leaves'

i was making a addon to create a stylized tree and when i run the script in the text editor of blender it run well , but when i convert it to a package ZIP to use it like a addon . Console show me No ...
0
votes
0answers
26 views

How to check whether the Blender application is focused / on the foreground / active (Windows and Linux) in Python

Is there a way to check whether Blender is currently focused / on the foreground / active (in both Windows and Linux)? We're sending data to Blender, and this would help us determine which Blender ...
1
vote
1answer
21 views

Why is my own add-on not showing in the Preferences panel when installed?

I made a super-simple, one script add-on that duplicates objects and moves them to a hidden 'Backups' collection. It installs and works fine, but for reasons unknown to me does not show up in the Add-...
3
votes
1answer
93 views

Run code when addon is disabled through preferences but NOT when blender closes

I noticed that when it comes to addons, unregister() gets called both when disabling the addon AND when exiting blender. I have an operation I only want to perform if the addon is disabled from the ...

1 2
3
4 5
95