sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    New tool's "initialize" starts bf prev tool's "deactivate"

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 153 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      SR20VET
      last edited by Gábor

      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?

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        Do you stuff in the Tool's activate callback. That should trigger after deactivate. Initialize triggers when you create the tool instance - not when it's activated. You can reuse a tool instance - where activate is the one that will trigger when your tool activates.

        (How do you activate the tools btw? model.select_tool or model.tools.push_tool ?)

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • S Offline
          SR20VET
          last edited by

          @thomthom said:

          Do you stuff in the Tool's activate callback. That should trigger after deactivate. Initialize triggers when you create the tool instance - not when it's activated. You can reuse a tool instance - where activate is the one that will trigger when your tool activates.

          (How do you activate the tools btw? model.select_tool or model.tools.push_tool ?)

          Hi Thomthom. Man, such a stupid error of me. I did use the initialize method instead of the activate method.
          Btw, I use select_tool ToolName.new

          Thanks for the answer, funny I didn't saw the error myself 😳

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement