• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Editing geometry while onActivePathChanged

Scheduled Pinned Locked Moved Developers' Forum
1 Posts 1 Posters 122 Views
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.
  • T Offline
    thomthom
    last edited by 6 Apr 2009, 18:27

    I'm using the ModelObserver's onActivePathChanged event to detect when components/groups are closed after editing. When that condition is met I call a method which deletes and adds some edges to a component definition in the model.

    However, when an edge is added or removed onActivePathChanged is called again for every change. And since onActivePathChanged calls the method which causes the edges to be added or removed I now suddenly have an endless loop that runs until the call stack is full and SU bugsplats.

    
    onActivePathChanged -- calls --> updateComponentMethod
    updateComponentMethod -- when adding/removing edges; calls --> onActivePathChanged --> LOOP!!!
    
    

    If I remove the lines that add or removed the edges the loop doesn't occur.
    I have worked around it by setting a module variable when I start updating which makes onActivePathChanged exit immediately if the update flag is set to true.

    But I don't understand at all why onActivePathChanged is called back when I add/remove edges. Some kind of weird bug?

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

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

    Advertisement