New tool's "initialize" starts bf prev tool's "deactivate"
-
Hi all of you. It's giving me a headache...
I've got these two tools which do actually the same during the initialize method and the deactivate method.
On initialize they need to watch which ents were visible and hide them in order to only show the ents that are needed for the tool to work with. On deactivate it's visa versa: only show the ents that were visible before the tool was activated. Now I have this issue:
When tool_1 is active and I select tool_2, SketchUp first runs the initialize-method of tool_2 and then runs the deactivate-method of tool_1. So, instead of showing the ents I need for tool_2, it shows the ent's that were visible before initializing tool_1.It's strange because I never had issues with that in the past. Only difference is that I used to work with different layers (each ent in a specefic layer) and toggeling those layers and now I just work with one layer and toggeling the visible state of the ents.
I hope I made myself clear? Anyone has got these issues too?
-
Do you stuff in the Tool's
activate
callback. That should trigger afterdeactivate
. Initialize triggers when you create the tool instance - not when it's activated. You can reuse a tool instance - whereactivate
is the one that will trigger when your tool activates.(How do you activate the tools btw?
model.select_tool
ormodel.tools.push_tool
?) -
@thomthom said:
Do you stuff in the Tool's
activate
callback. That should trigger afterdeactivate
. Initialize triggers when you create the tool instance - not when it's activated. You can reuse a tool instance - whereactivate
is the one that will trigger when your tool activates.(How do you activate the tools btw?
model.select_tool
ormodel.tools.push_tool
?)Hi Thomthom. Man, such a stupid error of me. I did use the
initialize
method instead of theactivate
method.
Btw, I useselect_tool ToolName.new
Thanks for the answer, funny I didn't saw the error myself
Advertisement