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

    Add_group() + outliner = bugsplat

    Scheduled Pinned Locked Moved Developers' Forum
    12 Posts 3 Posters 2.0k Views 3 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.
    • jiminy-billy-bobJ Offline
      jiminy-billy-bob
      last edited by

      Hi !

      In my Layers Panel plugin, I use a modification of TIG's layer.delete() snippet.
      I use it as a method for my namespace module, and wrap everything in start_operation/commit_operation. Everything seemed to work fine since I added this, but today I noticed that it creates a bugsplat when outliner is opened.

      <span class="syntaxdefault">def self</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">deleteLayer</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">layer</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> delete_geometry</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">false</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">start_operation</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"jbb is an awesome guy !"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    group</span><span class="syntaxkeyword">=@</span><span class="syntaxdefault">model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_group</span><span class="syntaxkeyword">()<br /></span><span class="syntaxdefault">    group</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">layer</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">nil<br />    gents</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">group</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities<br />    temp</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">gents</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_group</span><span class="syntaxkeyword">()</span><span class="syntaxdefault"> </span><span class="syntaxcomment">### <- It bugsplats here<br /><br /></span><span class="syntaxdefault">    </span><span class="syntaxcomment">#some code...<br /><br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">commit_operation<br />end</span><span class="syntaxcomment">#def        &nbsp;</span><span class="syntaxdefault"></span>
      

      The thing is, it doesn't bugsplat when not wrapped up in start/commit_operation...

      Has anybody experienced something like that ? Any hint why it does that ?

      25% off Skatter for SketchUcation Premium Members

      1 Reply Last reply Reply Quote 0
      • jiminy-billy-bobJ Offline
        jiminy-billy-bob
        last edited by

        What would be best ? Leaving it like that with the risk that people will try deleting/purging layers with Outline opened, and inevitably get bugsplats. Or start the operation after temp=gents.add_group(), so there would be 2 more transactions in the undo stack for everyone ?

        25% off Skatter for SketchUcation Premium Members

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          Try this just to be sure:

          
          def self.deleteLayer(layer, delete_geometry=false)
              #
              disable_ui = true
              @model.start_operation( "jbb Op test", disable_ui ) # SU ver 7+
                  #
                  group=@model.entities.add_group()
                  #
                  cp1 = group.entities.add_cpoint(ORIGIN)
                  #
                  group.layer=nil
                  gents=group.entities
                  temp=gents.add_group() ### <- It bugsplats here
                  #
                  cp2 = temp.entities.add_cpoint(ORIGIN)
                  #
                  # some code...
                  #
                  temp.entities.erase_entities(cp2)
                  group.entities.erase_entities(cp1)
                  #
              @model.commit_operation
          end#def
          
          

          💭

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            @jiminy-billy-bob said:

            What would be best ? Leaving it like that with the risk that people will try deleting/purging layers with Outline opened, ...

            Best to always use the **disable_ui** arg set to true during the operation.

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • jiminy-billy-bobJ Offline
              jiminy-billy-bob
              last edited by

              **disable_ui** works like a charm ! 😍

              Thanks a lot Dan ! 👍 👍

              25% off Skatter for SketchUcation Premium Members

              1 Reply Last reply Reply Quote 0
              • tt_suT Offline
                tt_su
                last edited by

                I'm not able to reproduce this.

                Can you provide a full working example, so I can hit run and it calls the method with the exact arguments you do?
                Also, does it crash only under Windows? Or also OSX?
                Does it crash only on SU2013, or also older versions?

                Even though you found a workaround I would like to find the cause of this crash.

                1 Reply Last reply Reply Quote 0
                • jiminy-billy-bobJ Offline
                  jiminy-billy-bob
                  last edited by

                  Install my plugin, and try to purge/delete layers from the dialog while having outliner opened. You'll get a bugsplat.
                  Tested on win7, SU8/13.

                  25% off Skatter for SketchUcation Premium Members

                  1 Reply Last reply Reply Quote 0
                  • tt_suT Offline
                    tt_su
                    last edited by

                    I can reproduce this.

                    1 Reply Last reply Reply Quote 0
                    • jiminy-billy-bobJ Offline
                      jiminy-billy-bob
                      last edited by

                      Ok, so no need to PM you the old version ?
                      If you're trying to reproduce it within the plugin, change line 100 to @model.start_operation("Delete layer", false), and line 465 to @model.start_operation("Purge unused layers", false)

                      25% off Skatter for SketchUcation Premium Members

                      1 Reply Last reply Reply Quote 0
                      • jiminy-billy-bobJ Offline
                        jiminy-billy-bob
                        last edited by

                        @tt_su said:

                        (Also, what did you do to avoid the crash?)

                        What Dan told me above : Disable UI during the operation.

                        25% off Skatter for SketchUcation Premium Members

                        1 Reply Last reply Reply Quote 0
                        • tt_suT Offline
                          tt_su
                          last edited by

                          Yea, I realized that after posting. I've logged a bug internally.

                          1 Reply Last reply Reply Quote 0
                          • jiminy-billy-bobJ Offline
                            jiminy-billy-bob
                            last edited by

                            Great, thanks !

                            25% off Skatter for SketchUcation Premium Members

                            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