Open DanRathbun opened 6 years ago
I suspect more properties doesn't update the GUI. I think I ran into this when working on my DevCamp 2017 presentation.
Logged as SU-38427
Needs SketchUp and RubyAPI labels.
An attempted workaround (up through SU2021.0) to call UI.refresh_inspectors
only updates the inspector dialog.
The display name for the scene page tab remains unchanged.
Cycling the display of page tabs either manually or via Sketchup.send_action(10534)
(on WIN) does not update the display of the scene tabs.
Note that UI.refresh_toolbars
also has no effect.
What I did find that does work, is to manually move the page one direction (and then back if desired.) Unfortunately, I do not see a way to change page positions via the API.
Inserting a temporary page (via the API) before or after the mislabled page also has no effect to correct the label. Calling page update via the API has no effect. Changing the selected page and back again also has no effect to fix the label.
Ye to me only reopening of the file works.. No need of closing the sKetchup.
I was writing a code to do something with sKetchup pages (scenes) and I messed up.. I forgot in some point that I have a Pages Observer created.. but except messing my scenes names, it accidentally did something more.. refreshed a scene tabs.. I spent long time on it out of curiousity but still didn't make it somehow usable.. But I reduced it to some reasonably short file which still refresh the pages.. I don't know why it works but I had to make two observers, and include_in_animation= method in it.. and it has to make some renaming.. Last tab is not updated
module TJD_Tools_Scene_Names
# This is an example of an observer that watches the pages for new ones.
class SN_PagesObserver < Sketchup::PagesObserver
def initialize()
@default_pages = SN_PagesObserver.load_default()
end
# overriding onElementAdded
def onElementAdded(pages, page)
@default_pages.each do |name|
unless pages[name]
page.name= name
page.include_in_animation= false
end
end # each
end
# loading default names from file
def self.load_default()
scene_names = TJD_Tools_Scene_Names::NAMES
end
end # class
# importing scene names from a list
def self.import_pages(pages)
scene_names = pages
scenes = Sketchup.active_model.pages
scene_names.each {|s_name|
scenes.add(s_name)
}
end # def import
NAMES = ["a","b","c","d"]
pages = Sketchup.active_model.pages
pages.add_observer(SN_PagesObserver.new)
pages.add_observer(SN_PagesObserver.new)
import_pages(NAMES)
end #module TJD_Tools...
Hope it will give some clue to wiser than me to where the problem is exactly..
Simple workaround:
def rerename(page)
origname = page.name
page.name = origname + page.inspect
page.name = origname
end
model = Sketchup.active_model
pages = model.pages
pages.selected_page.include_in_animation = false
rerename(pages.selected_page)
Platform: Win10
SketchUp Ruby API Issue
Sketchup::Page.include_in_animation=
setter method does not update GUIREF API DOC:
Sketchup::Page.include_in_animation=
Public forum discussion: 2018 UI not updating when using include_in_animation from console
Bug Report
Using the
Sketchup::Page.include_in_animation=
setter method does not update the following GUI controls:Expected result would be that the GUI elements would be updated (refreshed) when this flag is changed.