ckohl_art
(Chris Kohl)
February 24, 2021, 6:05am
5
You can store custom properties on the scene and object data blocks. For example this add-on adds a boolproperty to the Scene block.
bpy.types.Scene.inactive_wire_shading = bpy.props.BoolProperty(name="Inactive Wire Shading", default=False, update=update_inactive_shading)
Hello,
There is a little addon that we created with collaboration of people from this topic
many Big thanks to them! (@MACHIN3 , @ckohl_art )
What addon does
It make all inactive objects look wireframe
[IS_101]
[IS_location]
Inactive_Shading_v_1_0_3.py (4.0 KB)
Feel free to modify for your best usability or make improvement.
And just in case, I’m not a coder, but only a person who proposed an idea. =)
=====================================================
Ver 1.0.4
With toggling Wire …
(It also makes use of a @persistent
decorator and some handlers to keep running across file loads and blender restarts.)
And here a property is being added onto an object:
not as a direct reference to the object itself. Blender doesn’t guarantee an object will ever be in the same place in memory, and recommends never caching objects and trying to recall them later. This is one of the easiest ways to crash Blender from a python script.
You can, however, store an object’s name as a StringProperty- or if you’re worried about the user renaming the object, you can tag it with a custom key and then find it again later. For example:
my_obj = bpy.data.objects[0]
my_obj[…
If you need to store several bits of info you could use multiple props or maybe search around and see if you can store a dict on the Scene (or the armature itself?) to hold all your armature info.
python
1 Like