Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
8 views

Apply armature transform through Python

I'm trying to autom the applying of several objects armature transformation. Nevertheless, I cannot achieve it with the code below. On tests, it seems that the problem lies in the last but one line. <...
0
votes
0answers
16 views

Incorrect context .poll

Do you have any idea how to make this piece of code working? I keep getting this error when trying to execute the unused data-blocks: RuntimeError: Operator bpy.ops.outliner.orphans_purge.poll() ...
0
votes
0answers
22 views

Conversion of orientation quaternion from ROS / Quaternions.online to Blender

I have an issue using quaternions that are coming from ROS. I have already seen this post (How to use quaternions coming from ros?) but I am unable to comment since I do not have enough reputation yet....
1
vote
1answer
25 views

BPy add Path in Textfile from Text-Editor

.hi guys i have a problem by set a path in text line. I put in a picture, maybe you understand what I mean. i don't know how to implement the code in such a way that the path is included in the text ...
1
vote
0answers
15 views

Code works in Console, not as registered Operator

I made a scene with a cube and a sphere. The sphere has a "displace" modifier on it, which I want to apply while having the cube (or nothing at all) selected. Executing the following lines one by one ...
0
votes
2answers
34 views

Python: doing an action depending of the type of object [closed]

hello i have a really simple problem if my active object is an mesh i want to do an action, if its an empty another one, ... ect so i want for example in this case, move the location of the active ...
0
votes
0answers
12 views

Reloading Blender During Looping

After spamming you here many times with the proper way to purge data I've read the source file for purging orphan data and it seems they reload modules to purge orphan data. Now loading and reloading ...
0
votes
0answers
19 views

Rotate vertices around point

I have a list of vertices (mathutils.Vector), which form a rectangle in 3d space. I need to rotate these vertices around the pivot point. So I have two tasks: Find the pivot point rotate the vertices ...
1
vote
1answer
48 views

Why do I have the 2.80 API on blender 2.79

When I compare the latest blender api to the 2.79b API (based on the current link from https://docs.blender.org/api/), I see that the ...
0
votes
1answer
20 views

Extrude face with Python

I want to extrude a face in the direction of the face normal, here is the code so far: ...
0
votes
4answers
50 views

Delete object by location

How can I do something like, bpy.ops.object.select(object at location x,y,z) bpy.ops.object.delete()
1
vote
0answers
15 views

Import STL and render image

I am not very familiar with blender, more of a python programmer trying to use blender headless. I want to import an STL to a scene and render an image from different angles. So I botched a code ...
0
votes
1answer
29 views

Calculate 3D Vertices with Python

I have 2 vertices in 3d space (P1, P3) I want to create a rectangle that is aligned along the viewrotation. The vertices P1, P3 are already aligned to the current viewrotation matrix. How can I ...
0
votes
0answers
7 views

Python: get mask data from sculpt mode

Is there a way to access the the mask data from sculpt mode trough python? It seems there is no mask data stored on each vertex trough object.data.vertices[i] or <...
0
votes
1answer
24 views

Setting constraint influence in Python behaves differently inside vs outside 'If' statement?

The code snippet below contains a block code; running once in the global scope, and once inside the else branch of a condition: ...
1
vote
1answer
22 views

Cursor location accessing methods

Can you provide me with different methods, or at least one, for accessing the vector of cursor location? I need anything but the one described in this line of code: ...
2
votes
0answers
20 views

Why is there a difference in getsizeof() returns for Blender's python console and Python Shell? (for basic types)

This is a getsizeof() return for basic types in blender's python console: And this is one (same args) in Python Shell:
2
votes
0answers
36 views

Select pass mode via python script

I want to change the value of "Pass" type inside the "UV/Image Editor" area as shown on image. The default "Pass" value is "Combined" and I want to change the value to other available types with ...
1
vote
1answer
31 views

Given location(x,y,z), check if object exists at that position

As the title says, I want to be able to check a location for the existence of an object. I'm randomly filling a space with objects and want to make sure I'm not placing an object somewhere that is ...
0
votes
0answers
7 views

In Blender, how do I export multiple sets of vertex colours into UV channels during FBX export?

I currently have painted some data onto additional sets of vertex colours. And i'm trying to figure out how to export these additional sets of vertex colour information into UV channels of the FBX ...
0
votes
0answers
14 views

python bpy.ops.screen.screenshot of 3D view with alpha

based on this answer here, I know its possible to screenshot only 1 window at a time, the thing is: How can I do the same (or very similar) thing with a transparent background / alpha? I understand ...
1
vote
0answers
18 views

Export Material Node Animations in GLTF (or other) exporter

I'm trying to do a best-as-I-can recreation of a blender scene in three.js simply from exporting it. So far the simplest / best way to start doing this is through the GTLF exporter / loader in THREE....
0
votes
0answers
19 views

How to change the font size of a row inside a script via blender python

Hi Blender Python users, This is a super simple question but I can't seem to find the answer anywhere. Does anyone know how to change the size of a font inside of a panel row. For example say I ...
0
votes
0answers
18 views

A.N.T landscape error?

When ever i try enabling it gives me this error ...
0
votes
0answers
32 views

Purge Orphan Data

The third time I ask for a practical solution to purge data of a running code and (keep the code running after) and no one good solution worked for my case. I guess I don't get it at one part or ...
1
vote
0answers
22 views

How to register bpy.types.INFO_MT_mesh_add.append(addMenu) blender 2.80

I have this add-on which works fine in 2.79 but not in 2.80 I don't know how to register this code. bpy.types.INFO_MT_mesh_add.append(addMenu) When I try it ...
0
votes
1answer
30 views

How to use bl_label inside an operator?

How do I reference the bl_label inside operators? I want to know the name of the operator based on the bl_label to be precise.
0
votes
1answer
29 views

How to keyframe smoke particle size via python script

Hi Blender Python users! I was just wondering if anyone knows a way to key frame the particle size of a smoke flow particle system over time with a python script. For example: I would like to ...
2
votes
0answers
37 views

Set Active FCurve in Graph Editor through python

I'm trying to set an FCurve in the Graph Editor to "Active" through python. In the API FCurves don't actually have an "Active" property, but manually click-selecting a channel or keyframe on an ...
2
votes
1answer
25 views

How to specify Nurbs path vertices in python?

I'm trying to write a script which creates a Nurbs path curve, bevels it, and then stores the location of each vertex/point in that curve. I've been writing it based on the code displayed in the info ...
2
votes
0answers
29 views

What is the appropriate way to write and distribute an addon that works with both blender 2.80 and 2.79?

I have written a python addon which is compatible with both 2.79 and 2.80. When setting the "blender" key in bl_info to the appropriate version, the code works otherwise unmodified in both versions, ...
0
votes
1answer
17 views

Get Bone directions

As far as i was able to notice, there is option to get the direction of the bone using bone.vector . what if i want to know the side or up vector of the bone ? There is at-least option to get the ...
1
vote
1answer
15 views

mask object spline points coordinates

I'm trying to export mask spline points x and y data by using: bpy.data.masks['Mask'].layers['0'].splines[0].points[0].co but i get an x, y vector with an ...
0
votes
0answers
9 views

Blender python : how to set order of selection? [duplicate]

I have 3 objects and pick one by one in such order. So now all objects are selected. Try to get them in order : ...
0
votes
0answers
19 views

Blender python : How to use environment variable?

I did this : import os print(os.environ['BLENDER_USER_SCRIPTS']) and got error : ...
1
vote
1answer
23 views

Blender python : How to set object appearance in viewport?

I want to set object to be as textured or wire like in Property/object/viewport Display/Display as .. How to do this using python ? Thanks
1
vote
1answer
95 views

How do I register 'Scene' properties with Python in 2.8?

I'm currently udpating some 2.7x script for 2.8. Everything is going fine except for one thing: Currently the script uses a class to store some properties like so: ...
0
votes
1answer
11 views

Paint circle with Python in 3D view direction

I want to draw a circle into the 3d view in the direction of the current view rotation. I have 2 vectors (center, mouse_pos), so I have two points in 3d space, so I have the radius - fine. This is ...
0
votes
1answer
21 views

Python Script: Run two different commands that depend on 3D View update

I'm developing an addon that need to capture the position of the same object in one and other frame. Actually I had to create four buttons for it, one to put on start frame, other to end frame, other ...
0
votes
1answer
41 views

How do I pass an argument to an operator that is called inside a panel?

I would like to be able to pass aarguments to operators that I am calling from panels/buttons but I do not know how to do that. At the moment I use "global" variables but they tend to make the code a ...
2
votes
1answer
82 views

Change active collection

Is there a way to change the "active" collection? I can check witch collection is currently selected with this code: ...
0
votes
0answers
42 views

Blender 2.8. Simple addon does not work after late december update. Please help!

Please help. This addon used to work like 10 days ago but with latest build it gives: "bpy.context.scene.transform_orientation = 'GLOBAL' AttributeError: 'Scene' object has no attribute '...
0
votes
1answer
19 views

How delete a pythom list from scene ID properties?

I created a list using this method: ...
1
vote
1answer
31 views

Blender Addon save Hotkey Preferences

I have for my Blender 2.8 addon 2 keyboard shortcuts that I add to the AddonPreferences: In the init file I use this code to draw them: ...
0
votes
0answers
58 views

TypeError: string indices must be integers

I have a python script addon that imports and exports .SCNE (.json) files. While trying tom import an error comes up saying File "C:\Users\BROWN\AppData\Roaming\Blender Foundation\Blender\2.79\...
0
votes
1answer
15 views

Python draw with different Y axis

I have an addon with that you can define widgets (like panels) that are drawn into the 3d view. The are defined using gpu module, that has this coordinate system: So the widget would be at about (800,...
0
votes
0answers
21 views

Python mouse cursor left click

Is it possible to check with Python in a draw handler of an addon if the left click of the mouse was in 3D View (X1) or in a panel (X2) of a 3D view?
0
votes
0answers
24 views

BPy Create an Empty object without lost the selections before it (Blender v2.70)

i have again tiny problem :( is it possible in blender python to create an Empty object without lost the selections before it ? I have selected some objects and when i create an Empty object, I lose ...
0
votes
1answer
38 views

Script/API - Snap selection to grid, but only one axis

by script I can do a snap-to-grid of the selected vertices: bpy.context.space_data.grid_scale = 0.125 bpy.ops.view3d.snap_selected_to_grid() But I need to ...
1
vote
0answers
12 views

Moving an armature over [-pi,+pi] radians

I am working with robots, ROS and MORSE simulator. And I have a problem when I tried to control a robot simulated in MORSE using ROS. As MORSE is based on BGE, I am asking here my question. My robot ...