This is my first foray into tools- typically I deal strictly with operators, but I have some artists at my studio who are requesting some toolbar tools to facilitate their workflow. My first stop when messing with anything new in blender is the built-in templates to get a basic idea of how a concept works, but the one that ships with Blender 2.93 LTS (ui_tool_simple.py) seems a bit broken? the unregister function is never called, so if you modify the template and re-run it you will immediately get an exception thrown because a tool called āmy_template.my_circle_selectā already exists. I canāt manually unregister a tool because they arenāt registered like a normal class and thus do not appear in bpy.types like operators/panels/menus/literally everything else.
OK, so thatās just an issue with working with a template in the blender text editor- so I set up a bare-bones addon version of the template and treat the tool class exactly like an operator class (caching the object during initialization so it can be referenced during unregister)- but when itās time to unregister I get an AttributeError exception thrown while calling bpy.utils.unregister_tool saying _bl_tool did not exist (Iām not aware of such an attribute?)
Traceback (most recent call last):
File "\Text", line 43, in <module>
File "\Text", line 34, in register
File "\Text", line 39, in unregister
File "e:\blender-2.93.0\2.93\scripts\modules\bpy\utils\__init__.py", line 951, in unregister_tool
tool_def = tool_cls._bl_tool
AttributeError: type object 'MyTool' has no attribute '_bl_tool'
So yeah, anybody have any idea what the proper way to unregister a tool is? Clearly Iām doing something wrong because there are plenty of addons available that use tools.