Questions tagged [python]

Python is an object-oriented programming language. In Blender, it is used as a general purpose scripting language and to create add-ons to extend Blender's functionality.

Filter by
Sorted by
Tagged with
1 vote
0 answers
11 views

Python: Access preset of curve bevel custom profile

Is there a way to use Python in order to select one of the presets for profiles of curve bevels?
0 votes
0 answers
5 views

Is it possible to update image texture by using image buffer pointer?

I want to know if it is possible to pass bpy.data.images["image"].as_pointer() to a C function to update image pixels directly, instead of using ...
2 votes
1 answer
6 views

Iterate through list of files & run script

I created a script that runs on an individual file, but I want to automate it to run on a long list of files. Essentially, I want to automate this: Import file from list Various script steps Export ...
0 votes
0 answers
7 views

What is the purpose of context's `tree_type` in comparison with `tree.bl_idname`?

What is the difference between context.space_data.edit_tree.bl_idname and context.space_data.tree_type ?
0 votes
0 answers
6 views

UPBGE error. Why can't I run my script via Logic Node Editor?

Why does an error occur when running a script using a "Run Python Code" node? For some reason, in the error description my script is called a module
8 votes
4 answers
3k views

How can I display what happens in the system console inside blender's console?

I have a button created by my script. I wonder how I can display what the system console displays but inside blender's console. CoDEmanX did this by running a script inside it as shown here, but I ...
1 vote
0 answers
32 views

How to get backface state for faces in view?

Is this value somewhere? I can only calculate faces that are not aligned to a view. But this method is not accurate. Here is my simple method to select faces that not aligned to view ...
1 vote
1 answer
27 views

Indent Guideline in Text Editor

Does the text editor have a feature that shows the indentation of the code? If it does, that would be nice to know.
1 vote
1 answer
16 views

Python API - run commands before / after .execute of the operator with file selection

I can start an operator with file selection by adding "INVOK_DEFAULT" to it's call, e.g. ...
1 vote
0 answers
15 views

How to run an operator on UILayout.prop changes

I have a UILayout.prop(object, 'rotation_euler') to rotate the active object, a UILayout.prop(object, 'rotation_quaternion') and an operator to update the object rotation_quaternion property. ...
1 vote
1 answer
101 views

How can I export the coordinates of selected object vertices to a CSV file?

I need to save the vertex locations of selected objects in Blender to use as offset values in another application. Ideally, I would like to have these as a CSV file (either as x, y, z per column or a ...
0 votes
1 answer
23 views

where is stored the data of the projects? [closed]

good evening. I am developing a little program with Python, and I need the coordinates of every vertex in a project written somewhere, since making it manual would take a lot of time. Since blender (...
4 votes
1 answer
290 views

How to change the color of my custom node's label

My extension uses nodes and I would like to be able to change the color of their label. At the bottom of the page is a picture of what I'm talking about
0 votes
0 answers
27 views

How to calculate pose bone values (pose_bone.matrix_basis)?

I tried to write own importer for custom model, but have some troubles with it: i don't understand how values of pose's B-bone are calculated. I have a skeleton with 2 bones: parent bone - A, and ...
0 votes
1 answer
378 views

Changing the name/icon/function of menu/pie menu/panel with a condition?

for example in this pie menu below ...
0 votes
0 answers
33 views

How to Set Handles Correctly for Bezier Curves

I'm toying with Blender's bezier curves and I'm trying to make the following spline: I believe I've coded everything correctly, but it seems like I'm not setting the handles correctly. The curve ...
1 vote
1 answer
9 views

How to add a driver to a shape key and modify the fcurves through Blender python?

My question is how do I reference a the fcurve modifier on a shape key driver in Python? I have the following code at the moment: ...
0 votes
1 answer
38 views

Why does this tiny script not work in 4.0? [duplicate]

This script works till 3.6, but not 4.0. ...
4 votes
1 answer
69 views

How to view datablock dependency hierarchy?

In my startup file I have various node groups that I keep on hand for common tasks. Sometimes I will add a new node group or material that contains an existing group inside it. So what happens is <...
0 votes
0 answers
15 views

ray_cast normals misalignment with respect to face normals

I'm trying to code an add-on that creates instances of an object on the surface of a target object, having the instances aligned with the normal of the face of the target. I can't use Geometry Nodes ...
1 vote
0 answers
26 views

How to know if the active node in a node tree change?

I need to know if the active node of a node changes. I have found this example for the active object, that works very well: ...
0 votes
1 answer
50 views

Ripping vertices with more than two connected edges

I'm trying to find a way to rip all vertices with more than two connected edges on a mesh, then move the resulting verts away from each other slightly afterwards. Is there a way to do this in geometry ...
0 votes
0 answers
17 views

Create instanced "linked duplicate" of mesh respecting selected meshes location, rotation and scale

I am using the below code to create an instance "linked duplicate" of the last selected mesh in the location, rotation and scale of the previously selected meshes. However the below code ...
0 votes
0 answers
16 views

Pose nodes in blender [closed]

i want to create an addon that can access poses through nodes. So that animation be created procedurally. But i dont have knoledge of python Can anyone tell me how to do that
5 votes
1 answer
96 views
+100

Align & Scale Light (Portal) to Face

I am an ArchViz artist and during my work I often have to do this tedious task manually: Setting up light portals to align exactly with the window pane mesh. First I have to snap it to the window pane,...
3 votes
1 answer
44 views

Add or Remove item / socket in Nodetree / Node group - New "Items Tree" - Blender 4.0

First of all, I want to mention that I'm quite new to programming with Python and Blender. Now, I wanted to know how I can create (or remove) a new socket in a custom nodetree considering the new &...
0 votes
1 answer
32 views

Calling view_all() operator from another context is not working specifically on 4.0 [duplicate]

I have this code in my addon. It just runs view_all() operator from another context. ...
0 votes
0 answers
48 views

blender 4.0 AttributeError: 'Context' object has no attribute 'selected_ids'

I upgraded blender to version 4.0, but I can't use the code bpy.context.selected_ids in version 4.0. The console gives an error ...
10 votes
1 answer
936 views

Addon to display the current 3D Viewport Zoom

I want to use a panel to expose the Zoom ratio that is currently being used in the 3D viewport. I can see that there are bpy.ops functions that can be used to set this ratio, but I do not want to ...
0 votes
0 answers
41 views

How to write a python code for changing color space of image texture attached to normal map as well as strength of normal map?

I want to write a code for changing color space of all image textures attached to normal maps as well as strength of all normal maps to 1.
0 votes
0 answers
24 views

How to access functions in other .py file in same directory?

I'm writing an addon which has the standard main init.py file and from that file, I'd like to import sets of functions based on the version of Blender currently running the script. These functions ...
0 votes
0 answers
29 views

How to embed file browser into the Blender addon interface

I'm trying to find a way to display the items in the target folder in the addon interface, i.e. like in the Blender file browser: I tried to make a text picture for an example: ...
0 votes
1 answer
35 views

using x-plane resources in blender

Can I import or directly use resources (scenery, meshes) from x-plane12 in blender 3.6? X-plane, world editor, and ac3d use resources such as object, meshes, scenery files to build realistic items ...
0 votes
1 answer
677 views

bpy.types.PropertyGroup properties not updating when changed in Redo Panel

EDIT So after some more reading I now have the following, but still cannot modify any of the values... ...
0 votes
0 answers
14 views

How To Fix Boolean Modifier with Python Script

I have this object with holes in the scene, that i want to cut with the bumpy surface, but when i apply boolean modifier with 'Difference', the result is not what i want. As my object is not solid, ...
4 votes
2 answers
530 views

Bpy get the name of a collection an object belongs to

For an if statement, I want to check if my current object is in collection 'coll' Here's what I have so far: ...
0 votes
1 answer
52 views

Keymaps for pie menu addon not being added regardless of method used

Blender Version: 3.6.5 from Steam i'm currently working on an add-on for a pie menu, currently none of the methods i could find online nor my own mixes of those seems to work keymaps are not being ...
0 votes
2 answers
821 views

Python Bmesh get vertices / edges from selected face

So I made a bmesh script in python. So far it works but I am stuck at getting the edges and vertices from the face I selected. Code so far Make circle ...
2 votes
1 answer
325 views

How to view all autocomplete options?

I wanted to view all the stuff inside bpy.types so I used the autocomplete inside the python console. However the results are cut off. How can I get the full list? I'm trying to find a method so I can ...
0 votes
0 answers
14 views

Cursor to pivot error with context call [duplicate]

I had a script for placing the pivot on a selected vertex or in the center of multiple selected verts that stopped working after updating to 4.0.1. This is the script: ...
0 votes
0 answers
29 views

Module use of Python311.dll conflicts with this version of Python

Trying to use an add-on which everyone else has working fine but I keep getting this error, seems to be saying that the expat.py module which is packaged as part of the Blender installation is looking ...
7 votes
2 answers
4k views

Python Implementation of Track-to/aim constraint

I'm writing a python script that creates a large number of objects and I'd like them all to point at a certain point in 3d space. (left is what I've got, right is what I want) Pretty much exactly ...
0 votes
0 answers
17 views

How to run modal operators after normal Blender operations

I'm trying to create a modal operator to detect the 3D cursor position when I click on the 3D_View area. The final goal is to put instances of an object on the surface of another object until a ...
0 votes
0 answers
19 views

I can't export GLTF [closed]

...
1 vote
1 answer
45 views

How to get what a node group's name is inside a material?

My script prints every node group name, how many nodes are inside it, and its users. The node groups are sorted by how many nodes are inside them so I can find possible redundant/duplicated node ...
0 votes
1 answer
241 views

How to export objects as gltf?

I want to export objects from the active collection as gltf file. But it's not exporting any object in the gltf file and the file size is 1kb Code- ...
0 votes
1 answer
509 views

Further python development using Serpens 3 generated code for already existing panel. Buttons added after each script run

I want to develop Blender 3.1 plugins with Python and use Serpens 3 as well to generate some starting points. I generated a simple layout in an already existing panel in Object Data Properties->...
1 vote
1 answer
316 views

Passing variables in IntProperty constructors ignores changes in the variable when creating more instances using CollectionProperty.add()?

Sorry if the title is unclear. I'm working on an addon which involves a UI with a list of IntProperties. I need to be able to add and remove elements from that list on the fly, and I want the min/max ...
0 votes
1 answer
285 views

What are the Images in the UV editor for and how to prevent them affecting OBJ export?

I'm not sure I understand the UV image editor and its ability to hold images. I thought it was purely to get a visual comparison between your UVs and the image you use for texture mapping, but it ...
25 votes
7 answers
33k views

How to show to the user a progression in a script?

I'm making an python script which create a lot of object and this could take a lot of time. My question is how to show to the user of my script, the "progression" of the script? For now I print an ...

1
2 3 4 5
257