Justas
  • Member for 4 years, 10 months
  • Last seen more than a month ago
4 answers
16 votes
19k views
How to make object A a parent of object B via Blender's Python API?
16 votes

If the child object moves after setting the parent, use the following to move it back: # After both parent and child have been link()ed to the scene: childObject.parent = parentObject childObject....

View answer
2 answers
23 votes
5k views
Blender UI Multithreading Progressbar
7 votes

I've been able to create a progress bar in the top header for a long-running method. It looks as follows and it disappears once progress reaches 100%. It does update a custom Scene 'PERCENTAGE' ...

View answer
2 answers
6 votes
475 views
Create a tree of properties?
4 votes

I have found that one way around the circular class registration issue is to monkey patch the node children properties after your PropertyGroup class definition, like this: import bpy # Create your ...

View answer
6 answers
13 votes
11k views
How to find if a point is inside a mesh?
3 votes

If false-inside positives are important to you, consider the following tweak of the dot-product method. One issue with the dot-product method is that if the angle between the closest-face normal ...

View answer
6 answers
21 votes
29k views
How to convert coordinates from vertex to world-space?
3 votes

If you have your coords in a flat numpy.array from foreach_get("co", coords), the following dot product of the world matrix with the local coordinates will get their their global version: import ...

View answer
3 answers
5 votes
3k views
How can I create many objects quickly?
2 votes

In Blender, calls to bpy.data.objects.new() and .copy() become slow when there are many objects in the scene. So far, I've discovered that using a Particle system with Render->Object and Convert ...

View answer
1 answers
0 votes
327 views
How do I "Lock Camera to View" using Python?
2 votes

This code checks the "Lock Camera to View" box: for area in bpy.context.screen.areas: if area.type == 'VIEW_3D': for space in area.spaces: if space.type == 'VIEW_3D': ...

View answer
2 answers
7 votes
3k views
Remove from CollectionProperty
1 votes

Use the CollectionProperty.find(name) to find the index of the item to remove. Then remove the item with remove(index) method. For example: def remove_item(collection, item): collection.remove(...

View answer