In my code I’d like to turn some observers off and reset them if they were on in the first place.
I’ve figured out that by checking the “singleton frame change observer object” SPY - I get the following data where if @oid is non nil, the observer is running. But with my rudimentary ruby skills, I don’t know how to parse & save the variable @oid
Could someone explain how to save the @oid variable?
Thank you
command prompt accessing the observer status:
SAA::SAA_sceneOptionsChangerObserver::SPY
=> #<SAA::SAA_sceneOptionsChangerObserver::FrameChangeObserver:0x00000278031ef320 @current_page=#<Sketchup::Page:0x000002b920b80548>, @oid=nil, @check=0, @prompt="Click to enable Scene Change Components.">
SAA::SAA_sceneOptionsChangerObserver::SPY
=> #<SAA::SAA_sceneOptionsChangerObserver::FrameChangeObserver:0x00000278031ef320 @current_page=#<Sketchup::Page:0x000002b920b80548>, @oid=34, @check=8, @prompt="Click to disable Scene Change Components.">
my pseudo code:
# save state of observer
@orig_observerState = (something) @oid
# (do stuff)
# at end reset original state of observer
if !@orig_observerState.nil?
SAA::SAA_sceneOptionsChangerObserver::SPY::restart
end
The observer code comes from scenes_v2.rb from this post: Update to "scenes.rb" example (from the old API blog)