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.

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
282 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
0 answers
23 views

How to handle invalid context in Blender 4.0 after render

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 ...
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
24 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
628 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
76 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
46 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
96 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
21 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
14 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
215 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
259 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
73 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
393 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
56 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
29 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: ...
0 votes
1 answer
33 views

Props Dialog Width Issue

context.window_manager.invoke_props_dialog(self, width=400) Should be giving me a popup window that is 400 wide, but it isn’t. At least not right away: https://www....
0 votes
1 answer
736 views

Render layer selection when rendering via python

I'm working on a script that renders certain render layers defined in the operator. The script is supposed to make a list of currently enabled render layers, disable all of them, and then enable the ...
4 votes
1 answer
293 views

What does the use_local_location mean for bones

To test this, I run a test to show the difference of use local location or not. C.object.data.bones['upperArm.R'].use_local_location = False C.object.data.bones['upperArm.R']....
2 votes
1 answer
35 views

Correct way of using bpy.ops.import_mesh.stl bpy function?

First time here! So, I'm trying to create a python script that uses bpy (This script is not being used from within blender, but rather bpy is being called from python as a module), and in this script ...

15 30 50 per page
1
2 3 4 5
266