• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

State of Observers Redux — 18 August 2011

Scheduled Pinned Locked Moved Developers' Forum
30 Posts 4 Posters 5.3k 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 12 Sept 2010, 12:38

    I've begun on a revision of the State of Observers:
    http://www.thomthom.net/software/sketchup/observers/

    StateOfObservers.png

    Could you please have a look and let me know if have information that would fit in this.

    (p.s. The page is in HTML5 - so if you use silly old browsers it might not look good - I've not tested it yes, just in Firefox 3.6. Atm I'm focusing on the content.)


    Added public bug tracker to the BitBucket repo:
    https://bitbucket.org/thomthom/sketchup-observers/issues?status=new&status=open

    People can add reports of broken observer events there.

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

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 12 Sept 2010, 13:02

      Was there an observer hidden in the API docs somewhere that was listed in between the methods of another class instead of a class of its own?

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

      1 Reply Last reply Reply Quote 0
      • D Offline
        Dan Rathbun
        last edited by 12 Sept 2010, 13:38

        @thomthom said:

        Was there an observer hidden in the API docs somewhere that was listed in between the methods of another class instead of a class of its own?

        Yes.. it is the FrameChangeObserver, see the Pages class.

        @unknownuser said:

        (http://forums.sketchucation.com/viewtopic.php?f )":223huwu2]
        @mtalbott said:

        I am trying to animate objects based on Scene Changes and not with the interact tool.

        topic: Dynamic Components that react to scene (aka page) changes

        in this post: Re: Using an observer to delete a screen note I said the following:

        @chris fullmer said:

        That's interesting. I've never noticed that [FrameChangeObserver observer] ...

        Yes that is because is one of the API missing class boo-boos. It IS mentioned within the API, in passing.
        Pages.add_frame_change_observer
        Pages.remove_frame_change_observer

        It was featured (documented) in the Sketchup API BlogSpot:
        Dynamic Components that react to scene (aka page) changes

        ('scenes.rb') Code properly formatted (by Todd Burch) at:
        http://www.smustard.com/forum/viewtopic.php?f=9&t=25

        It basically only has one event callback:
        frameChange( fromPage, toPage, percent_done ),
        the intialize method, plus any custom method(s) you need inside to keep your code readable and organized.

        ~

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • D Offline
          Dan Rathbun
          last edited by 12 Sept 2010, 13:45

          And I think Jim had doubts whether it worked during an animation export.

          PS, the table page looks fine under MSIE 7.
          "Depreciated" has no "i" in it. And the methods that were removed can not be "Deprecated", they are "Abandoned", "Deceased".. whatever they are no longer even in the Observer protoclass.
          .

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • K Offline
            Krisidious
            last edited by 12 Sept 2010, 13:55

            they should have you on staff Thom...

            By: Kristoff Rand
            Home DesignerUnique House Plans

            1 Reply Last reply Reply Quote 0
            • D Offline
              Dan Rathbun
              last edited by 12 Sept 2010, 14:01

              MaterialsObserver.onMaterialRefChange

              "When purging materials, or right-clicking a material in the Material Browser this event triggers one time for every entity with a material. This cause a long series of events to trigger unnessesary."

              should read:
              "When purging materials, or right-clicking a material in the Material Browser, this event triggers one time for every entity with a material. This causes a long series of events to trigger unnecessarily."

              ~

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • J Offline
                Jim
                last edited by 12 Sept 2010, 14:08

                Great work, and great resource. Thanks for doing it.

                Hi

                1 Reply Last reply Reply Quote 0
                • T Offline
                  thomthom
                  last edited by 12 Sept 2010, 14:48

                  Thanks Dan, knew it was hiding somewhere.

                  Thanks for the spelling control - I didn't run a spell-checker or proofread yet.

                  @dan rathbun said:

                  "Depreciated" has no "i" in it. And the methods that were removed can not be "Deprecated", they are "Abandoned", "Deceased".. whatever they are no longer even in the Observer protoclass.

                  It's what the API docs said. I've not tested if the events are actually removed, or just aliased to their new names...

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

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    thomthom
                    last edited by 12 Sept 2010, 14:50

                    @dan rathbun said:

                    "Depreciated" has no "i" in it.

                    http://dictionary.reference.com/browse/Depreciated?r=75&src=ref&ch=dic ❓

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

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      thomthom
                      last edited by 12 Sept 2010, 14:52

                      Oh, "Depreciated" refer to value...

                      grumble something about English and too similar words

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

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        thomthom
                        last edited by 12 Sept 2010, 15:04

                        Another issue, I imagine I read some reports on MaterialObserver.onMaterialSetCurrent not working as it should on OSX in some versions of SU?

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

                        1 Reply Last reply Reply Quote 0
                        • D Offline
                          Dan Rathbun
                          last edited by 12 Sept 2010, 15:06

                          @thomthom said:

                          It's what the API docs said. I've not tested if the events are actually removed, or just aliased to their new names...

                          I did test the MaterialObserver's Bulk change method. It has been removed from the superclass, so when you create an instance of a MaterialObserver subclass, it just is not there, and if you were to explicitly call the callback, a NoMethodError exception will be raised. Ie, there is no aliasing to the individual change callback(s).

                          So if you wanted to handle events in a bulk manner, you'd need to do it on the Ruby side, perhaps with a Ruby standard Observer class, or a bulkchange boolean flag variable and an Array of changed objects (each individual SU change callback would need to push it's object into the Array.)

                          I'm not here much anymore.

                          1 Reply Last reply Reply Quote 0
                          • D Offline
                            Dan Rathbun
                            last edited by 12 Sept 2010, 15:12

                            @thomthom said:

                            Another issue, I imagine I read some reports on MaterialObserver.onMaterialSetCurrent not working as it should on OSX in some versions of SU?

                            YES.. I posted the answer that Scott gave me. He says it's logged as an internal bug.

                            See GG post: Materials.current on OS X
                            .

                            I'm not here much anymore.

                            1 Reply Last reply Reply Quote 0
                            • T Offline
                              thomthom
                              last edited by 12 Sept 2010, 15:17

                              http://code.google.com/apis/sketchup/docs/ourdoc/pages.html#add_frame_change_observer
                              Sketchup::Pages.add_frame_change_observer(FrameChangeObserver.new)

                              This, surprisingly worked.

                              I'd thought you'd have to reference the model first...
                              Sketchup.active_model.pages.add_frame_change_observer(FrameChangeObserver.new)

                              ❓

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

                              1 Reply Last reply Reply Quote 0
                              • T Offline
                                thomthom
                                last edited by 12 Sept 2010, 15:19

                                @dan rathbun said:

                                @thomthom said:

                                Another issue, I imagine I read some reports on MaterialObserver.onMaterialSetCurrent not working as it should on OSX in some versions of SU?

                                YES.. I posted the answer that Scott gave me. He says it's logged as an internal bug.

                                See GG post: Materials.current on OS X
                                .

                                So it's bugged on SU6, SU7.0, SU 7.1?

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

                                1 Reply Last reply Reply Quote 0
                                • T Offline
                                  thomthom
                                  last edited by 12 Sept 2010, 15:20

                                  @dan rathbun said:

                                  @thomthom said:

                                  It's what the API docs said. I've not tested if the events are actually removed, or just aliased to their new names...

                                  I did test the MaterialObserver's Bulk change method. It has been removed from the superclass, so when you create an instance of a MaterialObserver subclass, it just is not there, and if you were to explicitly call the callback, a NoMethodError exception will be raised. Ie, there is no aliasing to the individual change callback(s).

                                  So if you wanted to handle events in a bulk manner, you'd need to do it on the Ruby side, perhaps with a Ruby standard Observer class, or a bulkchange boolean flag variable and an Array of changed objects (each individual SU change callback would need to push it's object into the Array.)

                                  bulk change event? Is that one that has been removed from the API?
                                  That was a troublesome points when I made this chart - they recently removed some events from the API....

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

                                  1 Reply Last reply Reply Quote 0
                                  • D Offline
                                    Dan Rathbun
                                    last edited by 12 Sept 2010, 15:27

                                    @thomthom said:

                                    So it's bugged on SU6, SU7.0, SU 7.1?

                                    Careful.. the collection getter method Materials.current IS bugged, the question remains, is the MaterialsObserver bugged as well. You'd need to test versions on the Mac to find out.
                                    .

                                    I'm not here much anymore.

                                    1 Reply Last reply Reply Quote 0
                                    • D Offline
                                      Dan Rathbun
                                      last edited by 12 Sept 2010, 15:34

                                      @thomthom said:

                                      bulk change event? Is that one that has been removed from the API?
                                      That was a troublesome points when I made this chart - they recently removed some events from the API....

                                      Yes.. the MaterialsObserver.onMaterialRemoveAll callback was removed, as it never worked, and/or never got called. So there was no point in deprecating it.

                                      I'm not here much anymore.

                                      1 Reply Last reply Reply Quote 0
                                      • T Offline
                                        thomthom
                                        last edited by 12 Sept 2010, 15:42

                                        @dan rathbun said:

                                        @thomthom said:

                                        bulk change event? Is that one that has been removed from the API?
                                        That was a troublesome points when I made this chart - they recently removed some events from the API....

                                        Yes.. the MaterialsObserver.onMaterialRemoveAll callback was removed, as it never worked, and/or never got called. So there was no point in deprecating it.

                                        I'd like to add it for historic purpose - anyone remembers it parameters?

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

                                        1 Reply Last reply Reply Quote 0
                                        • T Offline
                                          thomthom
                                          last edited by 12 Sept 2010, 15:43

                                          @thomthom said:

                                          @dan rathbun said:

                                          @thomthom said:

                                          bulk change event? Is that one that has been removed from the API?
                                          That was a troublesome points when I made this chart - they recently removed some events from the API....

                                          Yes.. the MaterialsObserver.onMaterialRemoveAll callback was removed, as it never worked, and/or never got called. So there was no point in deprecating it.

                                          I'd like to add it for historic purpose - anyone remembers it parameters?

                                          Ah - already got it. 😄
                                          Thought there was an event named onBulkChange, like the SelectionObserver has.

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

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

                                          Advertisement