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
1answer
251 views

How can I make an animation using importing several x3d files to Blender by scripting?

I have some x3d files made by ParaView. I need to write a script to import these objects sequentially to Blender and make an animation. When each object is imported to 3D View Editor, a keyframe ...
0
votes
0answers
20 views

ValueError: math domain error when length is 4 and height is 2

Breaking my head over this. I am getting the ValueError: math domain error when running this script. But only when lenght1=4 and height1=2 change 1 of the numbers and the script runs just fine. When ...
4
votes
1answer
381 views

Is possible to generate a preview material from python?

I would like to generate the preview of a list of materials. I could create a sphere and apply the material, render and save it in a loop, but what I would like is to use the internal functionality of ...
4
votes
1answer
109 views

Can we trust the blender alpha or beta versions API?

Does the API of a blender alpha or beta version remain the same or does it change until the official release of a new blender version? I am concerned about the compatibility of my add-ons. Sometimes I ...
0
votes
0answers
22 views

Get the Array Modifier Count when Fit length with Python

I want to output a list of all my objects in a collection and how much of each there are. But for this I need the number of how much the array modifier has added, but I dont see it when I use "...
4
votes
1answer
81 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.
1
vote
1answer
499 views

ModuleNotFoundError: No module named 'bpy'

I am attempting to use blender from the command line including bpy functions using https://pypi.org/project/bpy/ I have completed a pip installation and have had no errors or warnings, however when I ...
1
vote
1answer
18 views

Update Scene.statistics for verts, faces, tris count after modifiers

I've written a python batching function that runs though a list of OBJ files. It imports the OBJ, adds some modifiers, then saves. I want to know the statistics at the start and at the end. However, I ...
1
vote
1answer
29 views

Blender Python Script - Add Base Color Alpha to Principled BSDF Alpha and change Settings>Blend Mode to Alpha Clip for all materials In Collection

I'm trying to do as the title says: I have several hundred models that have image textures that we're imported into the Base Color node. These textures have transparency and I've been able to fix the ...
1
vote
2answers
147 views

How to find the armatures which are hidden in the camera perspective by other parts?

I am new to blender, I have an object that during the animation some armatures are going to be hidden by other parts, How I could find these hidden armatures? As you can see in the picture ...
-1
votes
0answers
8 views

Rigify snap IK-FK using python [duplicate]

Im novice in Blender Phyton, and I need help for snap IK to FK or reversal using coding of Rigify addon. Any help? Thanks.
0
votes
0answers
15 views

Rigify, Snapping By Phyton [closed]

Im novice in Phyton, and I need help for snap IK to FK or reversal using coding of Rigify addon. Any help? Thanks.
0
votes
0answers
9 views

Knot Vector in NURBS Curve (PYTHON)

I have been trying to convert Bezier to NURBS (Converting Bezier to NURBS Curve). But by clicking the Set Spline Type menu, there is no curve created. So thought of doing it through python. But the ...
2
votes
0answers
22 views

how to write text in the 3d viewport as statistics does?

Is it possible to "write" in the viewport as statistic does? or this? ...and no, i don't wanna parent text objects to my camera.... ;)
0
votes
0answers
29 views

context.active_object vs context.scene.objects.active

Both context.active_object and context.scene.objects.active allow to get the active object in the scene. In most cases, they ...
3
votes
1answer
819 views

How to export Bone Weights?

I am editing the default OBJ exporter of Blender (io_scene_obj) to create my own version which supports bone weights, for skeletal animation. I now know how to access the bone weights per vertex in ...
1
vote
1answer
21 views

Unable to change focal length of camera using python

I want to add a camera from my scene using python. I followed the answer and it created the camera but I am not being able to change the focal length. I even tried using this answer but the focal ...
1
vote
1answer
19 views

Blender 2.9 import fbx python Operator bpy.ops.object.mode_set.poll() failed, context is incorrect

I'm a bpy beginner and I'm facing a error with python scripting on the line bpy.ops.import_scene.fbx(filepath="humor.fbx") I tried several method but ...
0
votes
0answers
16 views

ShapeNet not rendered with two-sided brdf

I am super new to Blender and was trying to render ShapeNet. I used this link as a reference: ShapeNet Renderer. The code works for the most part except some categories such as a car or a plane. I ...
0
votes
1answer
30 views

import script into __init__.py from subdirectory

I am struggling with importing a script from a sub sub folder I have the __init__.py in folder X. Inside folder X there is folder Y and in folder Y is folder Z I ...
0
votes
1answer
526 views

Is there a way to assign an object to coordinates on the local axis using Python?

The current task I'm working on is moving objects in 4 basic relative directions. By using the local axes this can be accomplished relatively easy through View3d port. However to script this ...
0
votes
0answers
29 views

How to append empty and its child in python?

Is there any way to append the child to the empty too ? Context: I have file1.blend that just contains an empty. I have file2.blend that contains an empty with some children. (let's say cube, ...
0
votes
1answer
22 views

How to automate specific task in Blender video sequencer

How, using Python script can I automate task like this: I have a Blender file with bunch of movie strips in the VSE (no sounds or music, all having transparent backgrounds, different lengths), a text ...
3
votes
1answer
108 views

Why does 'bpy.ops.nla.fmodifier_add' fail due to 'context is incorrect' error?

My nla strip confirmed that the active attribute is True, but bpy.ops.nla.fmodifier_add failed due to the context is correct ...
0
votes
0answers
18 views

Copying vertex data in a blender script

I'm trying to make an add-on where the add-on copies the positions of the selected vertices and pastes it to another set of selected vertices to change their positions. I know how to access the ...
3
votes
1answer
85 views

How to identify/derive the pixel coordinate of vertices of an object in the render of a scene?

I am using version 2.93.6 of Blender and I am fairly new to Blender. I am struggling to find correct functions/APIs which would help me achieve the following: From the example below we can see a scene ...
0
votes
1answer
33 views

how to move cursor in uv viewport to selected? And how to fix the error?

Why gives an error on bpy.ops.uv.snap_cursor(target='SELECTED') ?
0
votes
1answer
128 views

Using object.convert function after creating object

I'm creating an object from code obj = bpy.data.objects.new("ObjectName", SomeMeshData) bpy.context.scene.collection.objects.link(obj) Now, i want to convert ...
1
vote
1answer
27 views

copy cursor rotation to geometry in edit mode with python

using bmesh I want to use cursor matrix to rotate some selected geometry (edges or faces). using just cursor rotation, and using rotation and location to rotate around cursor
0
votes
1answer
238 views

How to configure the python values to fix the facial movements of a new 3d character not originally thought to work with those

I've just tracked and saved on the timeline the facial movements of Victor using OPEN CV and following this tutorial : https://www.youtube.com/watch?v=RY_eErKlilw The result has been good,as u can ...
1
vote
2answers
124 views

Running simulations and extracting data from Blender for analysis

Suppose I want to build a scene in Blender where many balls collide. Once everything has settled, I want to find out if a particular ball has rolled outside the circle, where the collisions occurred. ...
2
votes
0answers
31 views

How to fit uv into a rectangle in python?

Given object 1: Given object 2: The result should be like this:
0
votes
0answers
36 views

Blender with python api [duplicate]

Hello I'm new in blender api. I know python good but I can't start to make some changes for example with Screw modifier. How to edit the source on this type or try to write own version of this ...
1
vote
1answer
80 views

How to get "true" face normal in scaled object?

I work on addon for UV box mapping. In my addon I need to check face normal to sort X,Y or Z oriented faces. By following this topic I found how to compensate object rotation by multiplying object ...
0
votes
1answer
425 views

Problem with bpy.ops.sculpt.brush_stroke

Bear with me, this is complicated to describe. I am writing an add-on for Blender which involves using bpy.ops.sculpt.brush_stroke in Sculpt Mode to essentially ...
0
votes
0answers
586 views

Batch script execution help

I've got an automated process that produces 100's of blend files for use in Unity. I need to change each of these files to fix some things. I've got other scripts that are ugly but get the job done, ...
0
votes
1answer
871 views

Blender 2.80+ Game Engine Replacement with Python

I was mostly using Blender for simulations and interactive visualizations controlled by Python. Now 2.80 REMOVED the Blender Game Engine with no replacement!!!! Really not cool to remove something ...
9
votes
1answer
5k views

Mesh generation from PointCloud?

The figure below is the pointcloud imported as .ply file into blender. However, I would like to perform triangulation on it to produce the surface as seen in picture below(Accomplished using ...
0
votes
0answers
12 views

Initialize collection property during register

I'm writing an addon in which I can select multiple resolutions to render the image at, and each selected resolution has its own options, like quality (i.e. number of samples), etc. All selectable ...
0
votes
0answers
21 views

Calculate rotation angle of each uv triangle

I try to create a javascript/python function that works like 'Preserve UVs' in 3DS Max. So the goal is to be able to modify the position of vertices without breaking/stretching/... the uv map. The uv ...
0
votes
0answers
5 views

Archipack Thumbnails and Roof Draft mode issue

Good morning gurus, please am I notice that my Blender 2.82+ can't display presets Thumbnails and Draft mode for Roofing. I follow a link to github where I downloaded Archipack library and install it ...
1
vote
1answer
32 views

Blender Python: How to address a particular node when multiple nodes of same name are present?

I use this command for extracting the diffuse bsdfs: base_material = bpy.data.materials['base_material'] ...
0
votes
0answers
38 views

File names correct in the console, wrong in the UI

I have made an enum property that has filenames as items. Strangely it is not able to handle umlauts. When I print the files in the console, everything looks right. What am I doing wrong? ...
0
votes
1answer
9 views

Why FloatVectorProperty of subtype 'QUATERNION' is of type EULER?

The FloatVectorProperty gets subtype argument to change the data type of float vector. After setting this argument to subtype <...
0
votes
1answer
17 views

Making a chain of bones without bpy.ops

While making mesh objects with Python, I felt encouraged by the community to avoid using bpy.ops, as it is less efficient. I am now making armature objects. I am making a kind of snake where the body ...
3
votes
1answer
32 views

How to assign multiple color for inside (face) and outside (face) of a room in blender?

I have a building model in Blender created from python using vertices and faces. For making it look as realistic as possible, I want to render color on the outer face/outside walls of the room to be '...
0
votes
1answer
35 views

Refresh time slider UI

When you run the following code from the script editor when having a cube selected: ...
1
vote
1answer
258 views

Blender Python: Generate custom property (due to error bpy_struct[key]: key "PropertyName" not found)?

Is there a way to force Blender to generate a custom property ahead of time? It looks like custom properties added to objects are only generated when the user changes them from the default in the UI, ...
1
vote
2answers
36 views

Why is globalString not being updated by localUpdate in this add-on?

From the print statements in localUpdate it appears that changing the value of localString in the ...

1
2 3 4 5
204