I have created a tool for drawing Bezier curves. To activate the tool, I have added a button on the toolbar by subclassing WorkSpaceTool (following the ‘UI Tool Simple’ template).
I am facinng a few issues with this:
-
If the type is
{"type": 'LEFTMOUSE', "value": 'PRESS'}
, the user needs to first click the tool button and click again in the 3d viewport, to activate the tool.
If the type is{"type": 'MOUSEMOVE', "value": 'ANY'}
there are too many instantiations of the add-on class.
So how to make Blender call execute or invoke of the tool class immediately after click on the tool button? -
I haven’t been able to figure out a way to catch the tool button deactivation event. So if user opens a new blend file, the toolbar gets reset and the class seems to get removed. This leaves some invalid references and the button does not work any more after this.
-
If the user clicks the tool button twice, I would like to ignore the second click. But I am unable to find a place where this piece of code should go.
Would appreciate any help.