Skip to main content

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
3 votes
0 answers
14 views

how can i import bmesh module just like bpy?

I try to install bpy to my local python package.It work well,but I just want to import bmesh is not found.What can I solve it? I git clone blender git,and run "make bpy" to import bpy.
0 votes
0 answers
12 views

Blender scripting, run the operator after the save window is closed?

have a problem with my addon. I have a button that is intended to first save a copy of the file (a basic save copy window shows up) and then it runs some operations on the file's model etc. So ...
1 vote
1 answer
526 views

How to convert Euler to Quaternions keyframes for objects?

How to convert Quaternions keyframes to Euler ones in several Actions? There is a script here to convert Quaternion keyframes to Euler for objects (not bones, so rigify wont work), is there one to do ...
1 vote
1 answer
3k 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 ...
1 vote
0 answers
29 views

How to handle invalid context in Blender 4.0 after render [duplicate]

In my Python script, I rotate a randomized dice with a rigid body, play the animation using bpy.ops.screen.animation_play() to apply the physics, and then render ...
2 votes
1 answer
585 views

How to specify the size of a text box in a panel?

Please consider the following image: The text box with the value "127.0.0.1:56661" is just too big, it occupies a considerable percentage of the row in the panel leaving small space for the label "...
0 votes
1 answer
283 views

Set player position

Ex. You want to move your character to coordinate 0,-10,1 but you don't want to add location normally. When you touch an item, i want to SET the position to those coordinates. The motion actuator can'...
2 votes
1 answer
428 views

get newly created keyframe in python

I would like to get a reference to a keyframe when I create it. Alas, keyframe_insert() returns a bool indicating success, not a handle to the keyframe. In my application, each keyframe may need a ...
1 vote
1 answer
281 views

Scripting the generation of a curve from the set of mesh centers drawn using BTrace add-on

I'm writing a script to generate a (smooth) curve joined from the centers of several meshes. So, here is my code: ...
-2 votes
1 answer
25 views

AttributeError: 'NoneType' object has no attribute 'type' [closed]

Good time of the day, all. Can't get rid of this error message. Although the function is working, but I get "AttributeError: 'NoneType' object has no attribute 'type'" error message. Code: <...
1 vote
1 answer
38 views

Addon works from Text Editor, but fails to enable from Add-ons preferences [duplicate]

I've written very simple addon that exports triangulated and quad mesh of selected object, deleting all material slots and applying transformation. And all work fine if I run it from the Text Editor, ...
1 vote
1 answer
2k views

I could use some help finding the scripting tab

Hello I am just starting out with blender. I am taking the animation class on bloop one of the lessons calls for using the scripting tab to find rigify I think its called. My problem is I can't find ...
0 votes
1 answer
507 views

Baking AO map with Python in Blender 3.0

I'm fairly new to Blender and I've been looking for a way to bake an ao map using python with blender 3.0. I've been trying to adapt this code to the new version of blender, but I'm struggling ...
0 votes
1 answer
439 views

Batch export GLTF from separate Blend files?

I am trying to find or make a means of opening separate Blender files and exporting the a GLTF from each separate blend file using the same export settings? Not sure whether to start by making a batch ...
0 votes
1 answer
629 views

object has no attribute 'material'

I am using blender 3.2, am trying to execute the below steps using python script s1) Import Rigged avatar (.glb) into Blender s2) Select the mesh of upper human body s3) Go to shade editor, delete ...
2 votes
1 answer
78 views

How to get not active object?

What I'm trying to do is select two objects, add Data Transfer modifier to active object in selection and then use not active as source. So, active object is ...
0 votes
0 answers
50 views

How can I transfer settings from Blender 4.1 to 4.2? [duplicate]

I recently installed Blender 4.2, but it’s starting with the default factory settings—meaning all my key mappings, shortcuts, and startup preferences are gone. It seems like Blender 4.2 starts from ...
2 votes
1 answer
437 views

knife intersect cut with python scripting?

I want to cut some holes in a shape with a python script in Blender (3.3) I have some images here illustrating a simplified version of what I want to do, to remove the cylinder shape from the cube, ...
1 vote
0 answers
18 views

Making a basic n panel template with working properties [duplicate]

I'm trying to display some different property types on a n-panel. I would like to level up from using operator buttons, but I'm having trouble figuring out how to make a panel with some properties. <...
2 votes
0 answers
101 views

Custom Blender Python icons with adjustable colours

I am writing a Blender add-on and I want to add a custom icon into the UI panel. I can do this with bpy.utils.previews, but it seems to only want PNG files so if I ...
0 votes
0 answers
23 views

Georeference 3D data generated using BlenderGIS

I generated a 3D model (terrain + extruded buildings) using BlenderGIS,and I was wondering if I could integrate them into an ifc project having the right georeferencing using BlenderBIM. The problem ...
0 votes
0 answers
11 views

Binding of machine gun ammunition chain

I made the skeleton of a machine gun, and because I want to achieve the effect of the remaining bullets disappearing bit by bit after finishing the bullet in UE, the parent-child relationship of my ...
0 votes
0 answers
15 views

Regarding the issue of Blender importing FBX large files being too slow and often unresponsive

May I ask everyone, it always takes a long time for me to import FBX model files that exceed 150M or 200M in Blender, and I often encounter unresponsive situations? How can I solve this problem? First,...
0 votes
0 answers
7 views

How can I rig human-looking face onto a 3d FLAME mesh talking head?

Noob question here as I've just started working with Blender and 3d models: I'm currently working with Blender 3.4.1 and I'm using Python script which runs blender on ...
0 votes
0 answers
8 views

Copy/Paste and Duplication Differ with Cloth Simulation

I have a baked cloth simulation that looks as follows: I need to create meshes for each part of the shirt, so I copied and pasted the shirt repeatedly and created a mask for each part of the shirt ...
1 vote
1 answer
651 views

Is there any way of manually creating volume grid data?

I would like to know if there is a way of manually creating volume grids. Like the data we obtain from mantaflow simulations or import from external vdb files. For example, is the creation of volume ...
4 votes
1 answer
217 views

How can I run a function when opening Blender that requires context?

My initial attempt was to call that function directly from the register part. However, I soon realized that this isn't possible for a function that needs context. I also tried using a load_post ...
0 votes
0 answers
14 views

How can I run code whenever any object is added? [duplicate]

When I add an object, I want to run some initialisation code on it first. How can I do that?
-1 votes
0 answers
18 views

How to access data (point_data, cell_data) written by meshio in Blender shader editor? [closed]

Conext: I have a mesh (N points, M cells) in my Python script (outside Blender). I associate to each point and to each cell a ...
1 vote
0 answers
20 views

Subtracting overlapping 2D mesh with Python using Blender API

Supposing I have two 2D mesh objects, A and B. I would like to programmatically subtract the overlapping portion of one from ...
0 votes
0 answers
13 views

Index Error Concerning Bound Box When Exporting GM [closed]

As the title says, I'm getting an index (or location unknown) error when exporting a GM. I'm not very experienced with Blender, but it seems Python cannot locate the bound box and I'm uncertain how to ...
2 votes
1 answer
31 views

How can I add a library override to a non-API custom property from a linked file with Python?

The question regards setting custom properties of a linked file via Python. Because when setting the property like ...
0 votes
0 answers
13 views

How do I close an area using Python in Blender 4.1? [duplicate]

I want to close a panel from within my Python addon. Existing questions and answers seem to yield results that no longer work as they are very dated. The suggested code to run is: ...
0 votes
2 answers
260 views

Function not working when being called by operator

I'm doing a scritp with several functions. All of them have been tested and work fine if you execute them from a py file. The problem is when I put them on an operator and call them when pressing the ...
0 votes
1 answer
74 views

How to recalculate pose bone rotations when armature bone rotation is changed?

I'm trying to import bones and animation data in to blender. The quaternions I have for each keyframe are correct if the armature's bones do not have any rotation. However I also need to import the ...
0 votes
0 answers
13 views

Save an image of an area by it's index [duplicate]

General Question: Is there a way to capture a raw image, so no overlay or gizmo, of an area within Blender only by its index? I would need a script that writes the pixels of the area to an image ...
1 vote
0 answers
36 views

Is there a way to restart a modified addon without restarting blender? [closed]

This was answered 10 Years ago. Unfortunately, it doesnt work anymore. It should be a simple console command: bpy.ops.script.reload() However, it only reloads the <...
2 votes
1 answer
352 views

Call operator with tweak popup window

I'm making a panel with buttons to do different actions for modeling. One one of my button I want to merge vertex by distance when I click on it, but merge to center when I CTRL + Click. I got this ...
3 votes
0 answers
38 views

How to create unsigned Int property?

I need a property that can accept the 2267538950 number, unfortunately by default Blender uses a signed int range. There was a way to set subtype="UNSIGNED" in the previous versions but it ...
1 vote
1 answer
334 views

Vscode debugger ignores breakpoints in imported modules

I am not a programmer. I am trying to create an addon using VScode and jacqueslucke.blender-development addon. I configured the system according to directions shown here: https://polynook.com/tutorial/...
0 votes
2 answers
332 views

'import aud' works in viewport, but no audio in renders

Have an animation (made from geometry nodes) along with the script below. Everything works fine in viewport, the animation plays and the test.wav plays when it should. During render there is no sound, ...
0 votes
1 answer
394 views

Import Python Dependencies from current script/addon directory. (Filepath shows up as /script.py, or blender install)

I'm trying to import a github python directory, which is not on PyPi, and I am attempting to develop an addon for blender. I cannot use the method which automatically downloads dependencies because of ...
0 votes
0 answers
29 views

Copy framebuffer of 3D View into image

General Question: How can I copy the frame buffer of the currently active viewport to an image within Blender? The following link already addressed the question, however it utilizes a modal operator ...
3 votes
1 answer
57 views

How can I instantiate a Simulation Zone input / output node's socket via python?

I couldn't find an interface like the node tree interface where I can add sockets using interface.new_socket(). In the documentation, the only method I found for ...
2 votes
1 answer
30 views

direction perpendicular to screen

I want to create a script that squeezes a curve along the vertical direction of the screen. Currently, I am using `def get_view_direction(): ...
3 votes
1 answer
463 views

Custom Icons not showing up in Add-on

The structure of my add-on files is this: ...
1 vote
1 answer
27 views

Python: Randomly selecting 1 object in a set

I have a set up like this: Where there are 3 or sometimes more grids of different objects one behind the other. The objects are regularly spaced around 20 units in each axis, tho their origins are ...
2 votes
0 answers
25 views

Operator called by another operator does not trigger Adjust Last Operation panel

I have an Operator defined as ImportImageOperator which calls another operator ...
0 votes
1 answer
520 views

BPY in Game Engine Workaround?

I hope that someone might be able to explain me a workaround on how to use the bpy module in the game engine as a standalone. I've read of methods like modifying Blender and import it as a module into ...
1 vote
1 answer
520 views

Modifying the Emission Strength of a material in Python

Linked to my previous question about the colour, I would like to modify the strength of the emission. I did something similar with the colour, but it's not working: ...

1
2 3 4 5
266