New answers tagged

0 votes

Exporting X & Y coordinates to file

You can get the location coordinates of an object called 'Cube' with the following code: ...
MSDMMM's user avatar
  • 85
-1 votes

How can I fully select a collection using python with blue highlight?

Each outliner area has individual selection (blue highlight). But only one active collection as seen below (gray highlight on icon). If you press F2 in any one ...
JayReigns's user avatar
1 vote

Unexpected result setting a shear matrix as transform

I guess I'm too late to the party but there is still a bit hacky way to do it - won't affect the actual geometry and will allow you to add ANY possible transform to your project, even a shear ...
FamousSnake's user avatar
2 votes

Repeteadly calling one modifier upon other

bpy.ops.object.modifier_apply(modifier="modifier_name") takes actual modifier name, which is unique for every modifier. What you are passing is modifier ...
JayReigns's user avatar
0 votes

Python - How to scale vertices with pivot being set to cursor?

This is a year later but I wanted to propose a solution I came across online to this problem. Other solutions here have proposed math calculations to "get around" this issue, but there is ...
OctavoPE's user avatar
1 vote
Accepted

Dynamically adding/deleting foldable panels

The problem is that you want to control multiple properties with a single variable, which is not possible. I think you need to read about bpy.props.CollectionProperty. It lets you create a dynamically-...
Gorgious's user avatar
  • 28.7k
1 vote

Make an object turn / rotate with its front face to the next location in an animation

I don't want to create rotation keyframes manually nor set specific rotation at each location keyframe manually. No problem. Animate your cube's location as desired. Set extrapolation mode in graph ...
Nathan's user avatar
  • 20.5k
1 vote

Can the blender api be used to create alternate viewport control modes

I’ve derived a rudimentary way of acheiving the kind of controls i need, thank—in small part—to chat gpt and stack exchange. It turned out that using a modal operator was all it took to override the ...
NotImportant's user avatar
0 votes

How to enable the move gizmo via script?

The actual solution for saving UI settings is to set them and save a startup file - File -> Defaults -> Save Startup File however if one wanted to run a startup script changing the UI, one could ...
Martynas Žiemys's user avatar
1 vote
Accepted

Activate addon not working

It turns out the blender field should be included in the bl_info dictionary. Otherwise, Blender will just ignore the script. the ...
BlenderEnthusiast's user avatar
2 votes

How can I assign material colors to a color attribute?

Here's an example script. I'll assume you use V3.6+ Create a new color attribute Iterate over all materials and fetch their color Iterate over all polygons and fill out the correct colors into the ...
Gorgious's user avatar
  • 28.7k
1 vote

EXCEPTION_ACCESS_VIOLATION when running python in background mode and calling region_3d.update()

As @Iván found out in a similar post, there is a bug report which states that this is not considered a bug, quote: I don't consider this a bug. Calling an operator from background can be expected to ...
taiyo's user avatar
  • 3,080
3 votes
Accepted

Why I need to run my script twice to get it to work?

The error does not pop up for the first time only, you can provoke it also when running the script multiple times. After running the script, move into the sphere (such that you are inside) and run the ...
taiyo's user avatar
  • 3,080
1 vote
Accepted

Get relative position to root

This: obj.pose.bones['Bone'].head gets bone position in object space (relative to object's root)
Crantisz's user avatar
  • 33.2k
3 votes
Accepted

Using python to set inputs on geometry nodes

I think you want to set values for modifier inputs and not the inputs of the node group. (for tooltips like that enable Python Tooltips in the Preferences, Interface tab, Display panel) So that would ...
Martynas Žiemys's user avatar
2 votes

Uv coordinates values seem to be placed on the wrong vertices

I have made the following experiment of changing the vertex indices of the plane, and you will notice that there is no obvious pattern to determine which vertex is used to map to which UV coordinate. ...
Harry McKenzie's user avatar
-1 votes

Using python to set inputs on geometry nodes

nodeGroup.inputs[3] this will give you the Input object which has multiple properties. Try to print it to explore more. Or try it in blender python console. What ...
Reigen's user avatar
  • 865
1 vote
Accepted

with bgl deprecated in b3.5+ how to compensate for loss of GL_POLYGON_OFFSET_FILL and bgl.glPolygonOffset

This can be achieved using a Geometry Shader. I used the following references: https://www.informit.com/articles/article.aspx?p=2120983&seqNum=2 https://github.com/nortikin/sverchok/pull/4983#...
zeffii's user avatar
  • 39.3k
2 votes

How can I convert a complex point cloud to mesh?

Use geometry nodes, I know that blender 4.0 comes with a points to curves node, from there you can convert those points to mesh, alternatively you can convert the points to volume and convert to mesh ...
Sooroojdeen's user avatar
0 votes
Accepted

Mirroring/copying relative animations locations?

A solution I made with script, for easy access I recommend to set this up as an addon with shortcut/hotkeys ...
Itay's user avatar
  • 11
0 votes

How can I create a point cloud from the surfaces of a model?

You can also use this simple Geometry Nodes setup to create a Point Cloud: You may not see any output, but when you apply the modifier, it shows as Point Cloud.
Harry McKenzie's user avatar
1 vote

Scripting for loop adding attribute incorrectly

Thanks to @Ratt for the solution: Adding the following line of code to the for loop solved the issue: ...
aidan Barry's user avatar
0 votes

Rendering on GPU cluster

Blender can't saturate alone a beefy GPU, let alone 4. Try using only one GPU at a time. BTW I work with synthetic datasets (basically render as a map reduce process) and we use an approach kind of ...
Lucas Eduardo's user avatar
0 votes

How to apply transformations to an object using the world matrix?

I hope it is not too late, but as far as I remember, matrix multiplication in python requires '@' instead of '*'. For me, this worked instantly
Alex's user avatar
  • 11
1 vote

Should I delete/comment all the asserts in my code when my addon is finished?

A different solution: turn it into a debug feature in your addon. In my addon convertRotationMode, I started development using prints everywhere to monitor how things went, and even though it ...
L0Lock's user avatar
  • 13.7k
1 vote
Accepted

How to update the texture in the UI when using "template_preview"

I had this problem too, if you have found a proper way to update template_preview please share, meanwhile I have found a workaround that works for me. As you noticed when you manually resize the image ...
Ēriks Rasolovs's user avatar
6 votes
Accepted

Should I delete/comment all the asserts in my code when my addon is finished?

Assertions are a feature specifically designed to allow to easily disable the checks in the production code. You can do so by compiling your Python code to a .pyc ...
Markus von Broady's user avatar
0 votes

Mirroring/copying relative animations locations?

The easiest way to create an offset is to parent the object. Add an empty to the scene and parent the left cube to that empty. Then assign the action to the left cube so that you can see where it ...
Nathan's user avatar
  • 20.5k
1 vote

Activate addon not working

If you execute the code you provided from the text editor, you get the error: ...
L0Lock's user avatar
  • 13.7k
1 vote
Accepted

How to make an int array/list property?

CollectionProperty is what you need. First define your integer property class like so: ...
user3768771's user avatar
1 vote
Accepted

Block undo from changing UIList index

This is one of old core issues. You can't do much about it
Crantisz's user avatar
  • 33.2k
0 votes

the results of world_to_camera_view( ) are not correct

I found the solution. It's not because of world_to_camera_view(), or camera, or anything about the computation. I changed the mode to Edit Mode to pose the armature ...
555 xxw's user avatar
2 votes

How to replace all material nodetrees on selected objects for random colors?

Try this script for your first problem: ...
taiyo's user avatar
  • 3,080
2 votes
Accepted

How to transform the mesh by points?

You can get get the 3 outermost vertices and get consistent ordering (to avoid matching clockwise with counter-clockwise) by sorting them by angle: Sorting vertices counter-clockwise The question is a ...
Markus von Broady's user avatar
-1 votes

How can I copy the location of multiple bones of a skeleton and paste them to another skeleton?

I think what you're looking for is called animation retargeting. and there are a few addons that do this inside of blender. Rokoko (free) https://support.rokoko.com/hc/en-us/articles/4410463492241-...
Dulsara Dhanuka's user avatar
3 votes
Accepted

Check if a Blender class has a property?

You can use this little function: ...
taiyo's user avatar
  • 3,080
4 votes
Accepted

Blender Python: How to test for "selectable" objects in viewport?

I've found a solution for my situation: ...
Christoph Werner's user avatar
3 votes

Blender Python: How to test for "selectable" objects in viewport?

You can query the Object Types Visibility dialog, for example for the MESH type: ...
taiyo's user avatar
  • 3,080
4 votes

Blender Python: How to test for "selectable" objects in viewport?

You can use the property hide_select to set an object's selectability: ...
Harry McKenzie's user avatar
3 votes
Accepted

msgbus for collection selection in outliner

The msgbus is quite limited, I don't think there is a solution using that, but you can use the depsgraph_update_post application ...
Harry McKenzie's user avatar

Top 50 recent answers are included