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

Python script to add VertexWeightMix modifier to a Mesh?

Is there a Python script to add multiple VertexWeightMix Modifiers to a mesh with a specified Vertex Group A and B plus setting the mix mode and mix set?
0
votes
0answers
5 views

How can I rename bones that have certain prefixes in their names in a script?

I have a script made for 3dsmax that renames bones in batch like this: ( local nameMap = #( \ ...
0
votes
0answers
10 views

How do I change the bone layer with a script?

I wanted to make a small script that loops though all the bones in the selected armature and puts the ones that match into another bone layer. ...
0
votes
1answer
15 views

How to make object A a parent(keep_transform) of object B via Blender's Python API?

parent keep transform?? objects = bpy.data.objects a = objects['Cube'] b = objects['Cube.001'] b.parent.keep_transform = a CODE: ...
0
votes
0answers
10 views

Is there a command to open the preview icon popup?

Is there a python command in the blender api to automatically open the popup icon custom preview (bpy.data.window_managers) without having to click on it? To simplify the call it could take place ...
0
votes
1answer
12 views

Blender 2.8 (Python) - resetting camera rotation to (0,0,0)

I am trying to set the camera rotation to 0,0,0. It is not known in advance what the X,Y,Z rotation angles are before doing so. My thought is to get the current rotation parameters using ...
0
votes
0answers
13 views

Problem with camera_viewport_addin (view_matrix, perspective_matrix)

I have some problem with camera_viewport_addin.py I need some tool to replicate some design. I have just pictures with some angles how was done this all, but it's hard to explain all situation and ...
0
votes
0answers
21 views

EnumProperty with an item displaying as empty

I have made 4 enums that get filled from a dict that gets created from a folder structure when blender launches (I have reduced the script for readability). However when I change the enums in this ...
0
votes
0answers
29 views

Blender Python: Fixed size list of elements?

I need 4 instances of a property group sub-class in my primary class, and I want to access them (main.sub[*].x) based on an enum or index. Here's a fictitious (and ...
5
votes
1answer
60 views

Converting the Clifford Attractor equation into python to animate it in blender 2.8

I'm trying to re-create and animate a "Whispy Clifford Attractors" this http://paulbourke.net/fractals/clifford/5.jpg from this site http://paulbourke.net/fractals/clifford/ I can create the ...
2
votes
0answers
15 views

How do I filter UIlist items prior to displaying them?

I am using the UIlist to create a list interface, it works well but I am puzzled about how to list data blocks with certain features or properties. I would like to not show them in the UIlist at all. ...
0
votes
0answers
7 views

Driver input as location in other object's transform space

I would like to have a driver input variable controlled as the location of some object in another object's transform space. Is there an easier way of doing this than having input variables for all of ...
0
votes
0answers
6 views

How do I merge all coinciding vertices using a Python script? [duplicate]

I've spent awhile using the extrude tool to construct a mesh, but once problem I've noticed is that if I'm creating a shape with some kind of concavity and two parts of the mesh come back together, ...
0
votes
0answers
17 views

Blender Dev: Loop() or Selection Event?

Is it possible to detect changes in object and collection selections or activations (bpy.context.object/collection)? I'm most interested in detecting changes in the ...
0
votes
0answers
10 views

Negative Mass for Rigid Bodies

I'm trying to create rigid body balloons in Blender, but I can't figure out a way to make them work. I've tried using multiple rigid body world groups, but that doesn't work the way intended. I know ...
0
votes
3answers
16 views

Blender 2.8 (Python) - very slow rendering to .jpg

My script seems to be taking a very long time to write to disk a .jpg file. The output should be about 1.5-2.0mb in size and shouldn't take more than a minute or two to write to disk. Monitoring ...
1
vote
1answer
10 views

Blender 2.8 (Python) - what does this console error mean

It occurs when I am printing to disk a .jpg image of my scene: AL lib: (EE) ALCmmdevPlayback_mixerProc: WaitForSingleObjectEx error: 0x102 My script just ...
0
votes
0answers
6 views

Finding display state of a dynamic property

There is a BoolProperty p defined in a custom PropertyGroup class; and p is displayed in a panel based on some conditions (say cond1). Later in the code, I need to find out whether p was displayed ...
1
vote
0answers
18 views

Blender 2.8 (python) - this line of code causes inexplicable fatal crash

This line of code worked fine until I dropped it into a function. Now when it executes, blender shuts down without throwing an error: ...
0
votes
1answer
15 views

How to change world in blender 2.79?

I created two materials for world, World and WorldMask. How to change world from World to WorldMask using python script?
0
votes
0answers
17 views

Blender 2.8 - export 'perspective' view the same way as camera

I'm writing a exporter, got everything working the way I need except the export of perspective view - so that you do not need to have a camera in the scene to export. I currently export the camera ...
2
votes
0answers
20 views

How to check if mouse is in View3D Window from modal operator (2.80)

In the context of a modal operator, I would like to perform an operation when the left mouse button is clicked in the VIEW_3D area, ...
0
votes
0answers
11 views

Getting the context is incorrect error while importing alembics via python

I keep getting the context is incorrect error and the error is: Error: Operator bpy.ops.wm.alembic_import.poll() failed. Can someone tell me the right context or the way to figure it out? I am ...
0
votes
1answer
11 views

make Tab the autocomplete shortcut in the Python Console

When working in the Python Console inside of Blender, Ctrl+Space is the default keyboard shortcut for autocomplete. And there is also an Autocomplete button on the console bar that can be clicked. ...
0
votes
1answer
10 views

How can i append a material from a blend file using python script

I wan't a script that could append a particular material only from a particular blend file so that i can just run the script and the material is there
1
vote
1answer
30 views

Appending a sub-menu under an existing sub-menu in Blender 2.8

I can add menus to Blender 2.8 with the python code below but how can I add a sub-menu using python to one of Blenders existing menus? I'm trying to add the rtMyMenu sub-menu under Blenders Add-Curve ...
1
vote
1answer
19 views

Blender Python: Declare Property Group (on the stack?)

The questions keep coming, I know. I cannot find this simple answer anywhere. It may be because I'm not sure exactly how to phrase it in searches. Is it possible to declare a variable of a custom ...
0
votes
0answers
14 views

Blender Python: Default Property Type

Short version: Is there a way to specify the default property type of enum flags or bit-flags in the ...
1
vote
1answer
62 views

How to change a *VectorProperty size?

Let's say I've created a scene property named a: ...
0
votes
1answer
25 views

Blender Python: Property Description String Limit?

Is there a string length limit for the descriptions of properties? I assume there is. Does anyone know what that length is, and is there a safety mechanism to catch strings that are too long? ...
0
votes
0answers
18 views

Object selection error

I have noticed there are two different options to select an object: what is the difference between the "brown" selection and the "orange" one? By using a script how can I select an object? ...
1
vote
0answers
13 views

Blender Python: Access Selected Collections?

How would I go about accessing the list of selected collections? It seems as though the selection state of collections is something specific to the Outliner? But I can't seem to find anything in the ...
0
votes
1answer
36 views

Mesh is Grey after adding an Image/Texture to a material

I need some help making a mesh colorful. The image I add to a material does not show up on my mesh. A snippet of the code is below ...
0
votes
0answers
19 views

Python scripting: Best method to store and use more complex objects?

Before I move forward with this next step, I'm trying to figure out whether or not it's better to try and capture/code the generation of more complex meshes or to save them in a file bundled with the ...
0
votes
0answers
25 views

Blender 2.8 (Python) - how to put mesh into edit mode

For this line of code: bm = bmesh.from_edit_mesh(mesh) I am encountering the error 'ValueError: The mesh must be in editmode' I am not certain how to fix this ...
0
votes
0answers
20 views

How can I draw multiple OpenGL primitives with the GPU module?

Is it possible to draw multiple types of Opengl draw methods inside the same shader batch? Based on the the GPU module documentation, please see the code below. For instance I have this line. <...
0
votes
0answers
28 views

Blender Python: Print debugging text from functions

I'm looking for a simple text-print setup where I can see multiple text outputs (multiple lines of text), similar to writing to a text file while ending every statement with an end-of-line. A simple ...
1
vote
1answer
21 views

How can I make Blender to exit with the same exit code as the python expression?

I am running a python expression through blender from the commandline. I want to know if the python expression is executed correctly or not. But Blender always exits with a 0 code. Is there any way to ...
1
vote
0answers
21 views

Hide header from python

I need to hide the part of the header that has transform orientation, snapping etc. buttons using python script. ...
0
votes
0answers
22 views

How to convert string from EnumProperty to command python?

I have an EnumProperty declared in a context of bpy.types.PropertyGroup The value is as follows: ...
0
votes
1answer
23 views

Adding camera to scene

I'm trying to add a new camera to the scene and render it using multiview (with python script). at first, I remove all the objects besides the light from the scene: ...
0
votes
1answer
18 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
1answer
39 views

Plot single vertices based on xy coordinates from CSV file

I'm aware there are numerous posts/questions already been raised on this, but upon reading the previous posts, I'm not quite able to find exactly what I'm looking for. So apologies if there's a ...
0
votes
0answers
15 views

Blender Python: Convert Enum Flags into String?

It seems difficult to find any information about enum-flag usage and workflow. I'm familiar with bitflags and related operations, but the blender/python specifics are fun to figure out. Is there any ...
0
votes
1answer
18 views

Blender 2.8 (python) - how do I get the vector of the direction the camera points

In python, how do I calculate/find/retrieve the XYZ vector from the location of the camera and through the midpoint of the camera view? In the example below the camera is at location (7.4, -6.9, 5.0) ...
1
vote
1answer
32 views

Remove sequence Text strip in Blender 2.80

In 2.80 I can add a Text effect strip with the following: ...
0
votes
1answer
22 views

Blender Python: setter not working

Can anyone help me understand why my setter works sometimes, then it will stop working, then start again? For example, I can referesh my add-on, the setter will not do anything but throws no error, ...
0
votes
0answers
22 views

Is it possible, with Python, to select an object by its scene graph path alone?

So I've been a programmer for a long time, and a modeler for a while now, and I've just gotten started on using Python in Blender. One thing bugs me about the interface and I'm hoping I'm just ...
0
votes
0answers
17 views

property get/set example does not work [duplicate]

I would like to be able to adjust a property of an object in my addon. In particular, the min value of one property needs to depend on the value of another property. How should this be accomplished? ...