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
1
vote
1answer
16 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
31 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
19 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
16 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
14 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
15 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
21 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
13 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
6 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
32 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
13 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
19 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
0answers
17 views
+100

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

...
0
votes
0answers
15 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
24 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
54 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
17 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
15 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
15 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
10 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
14 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
10 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
19 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
14 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
30 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
9 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
18 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
21 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
24 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
20 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
85 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 ...
0
votes
0answers
22 views

Generate/Get all keyframes with python

I'm working on a project which requires me to export all keyframes for 1 object (the camera) in a "generated" state, meaning all the control points as well as all the keyframes generated by ...
0
votes
0answers
21 views

Is there Way to Cover Surface this Ways not Working Very well { Fill/Grid Fill/Beautify Faces } take match more time to solve

My Problem is Fill Around holes and used all ways but not Working as I wish , manual Editing take More time
0
votes
0answers
16 views

Change 3d viewport to othrogonal in python [duplicate]

I would like to change the 3d viewport to orthogonal from a python script. From the key mapping I found this command "view3d.view_persportho". I always find it tricky when I have to mess ...
0
votes
0answers
68 views

My panel appears twice

I'm making an addon where I added a panel to a popover button. See the following example: Here we can see (in image number 2) a popover button in Shadows. This panel is shown only on this button. I ...
0
votes
1answer
16 views

Removing objects from collection with script works but gives an error

I'm sorry in advance if my script looks really messy and not optimised, it's my first time using python or a dev language for that matters. I've tried to setup a script that, among other things, ...
2
votes
1answer
28 views

How to focus a property field in an Operator dialog by default (v2.91)

This existing question has some answers that attempt to make a property field focused when it appears, but none of them seem to work in 2.91. If you run the code below, you will see that the field is ...
1
vote
1answer
33 views

Blender scripting: How to change texture color

I'm trying to create a picture in Blender using only Python/scripting (no animation). I have a model loaded in and I can change it's base color using active_material.diffuse_color but now I want to ...
0
votes
2answers
82 views

Blender 2.8+, How to execute an operator in another window?

Some operators are global. Some are not. Transform for example is bound to the window where it gets executed in. As an example let's say i want to perform the ...
0
votes
0answers
32 views

How do I run a script after renaming a collection or object in the Outliner?

I'm not a programmer. I want to write a script to make my work in Blender 2.91.0 easier. How do I run a script after renaming a collection or object in the Outliner? For example, I entered the name of ...
1
vote
0answers
24 views

How to add the properties dynamically by using bpy.types.CollectionProperty?

I'm trying to create an add-on which changes the number of bpy.types.BoolProperty dynamically along with the context by using bpy.props.CollectionProperty. But, Blender will crash when I changes the ...
0
votes
1answer
39 views

Toggle UI from python

I am trying to toggle fullscreen and 3dview sidebar panels from python (shortcut 'shift+alt+space' and 'n' respectively). I found these commands, but I can't get them to work: ...
0
votes
0answers
30 views

why bgl meshes flip when nothing is selected?

As described in API the following script will create a mesh from active object using bgl module: ...
1
vote
1answer
26 views

Blender displays the wrong X-relosution for JPEGs,

A bit of context first, I setup a Node group that helps me scale textures to real world scale. So I use the images DPI or PPM for this. Thus I scripted the inputs for the Node groups to automatically ...
0
votes
0answers
22 views

How to Import Blender 3D Models into Webots

I am having trouble importing a Blender 3D Model into Webots. Currently, I am using Blender 2.79 and the most updated version of Webots. I am attempting to import the default cube model, but I am ...
1
vote
1answer
25 views

Saving objects' coordinates as RGBA

I need to save multiple objects' location in XYZ as RGBA data on an image. The colors should match that of blender in metric, so if I move the object up 105.4 centimeters in blender, the color should ...
1
vote
0answers
17 views

Where can I find context commands for every line

I'm fairly new to blender scripting and I'm having some trouble figuring out the context in which every command must be to work. My code looks like this: ...
0
votes
0answers
15 views

Saving multiple objects' location + rotation in RGBA [duplicate]

I recently asked a question in here, and wanted to ask a new one, as it was very convoluted, and I now know what I need to know. I need to save multiple objects' location in XYZ as RGBA data on an ...

1
2 3 4 5
94