Bug: Mac - Camera position not updated when minimized

,

Please create simple camera animation with two scenes and run this script:

UI.start_timer(5.0,true) { mod=Sketchup.active_model; mod.pages.selected_page = mod.pages[(mod.pages.selected_page==mod.pages[0] ? 1 : 0)] ; mod.active_view.invalidate; puts mod.active_view.camera.eye.to_s }

On Mac when you minimize SketchUp you will see that camera eye position gets frozen. It is reported in the console, but its position do not change with scene change.


(488,393686 cm, 49,020739 cm, 198,525246 cm)
(824,540738 cm, -714,830276 cm, 347,58559 cm)
(488,393686 cm, 49,020739 cm, 198,525246 cm)
(824,540738 cm, -714,830276 cm, 347,58559 cm)
Minimized
(488,393686 cm, 49,020739 cm, 198,525246 cm)
Other window in focus
(822,405475 cm, -736,018289 cm, 349,082864 cm)
(822,405475 cm, -736,018289 cm, 349,082864 cm)
(822,405475 cm, -736,018289 cm, 349,082864 cm)

In Thea for SketchUp I allow so called Batch Rendering which renders selected scenes. I rely on SketchUp updating the model accordingly with the selected scene. Unfortunately it doesn’t work when minimized.

It is fine on Windows.

I tried view.refresh / .invalidate.
I guess I will have to log it in github… but maybe someone knows a trick how to force SketchUp on Mac to update the model in accordance with the active scene.

You are relying upon …

puts mod.active_view.camera.eye.to_s

… as a test. The puts method is an IO method, which takes time.
(But I cannot think that it would take more than 5 secs.)


Also it may take time for the scene page to transition from one to another.
It could be that the puts is doing it’s thing before the scene page transition is complete.

Switch off transition time and transition delay like so …

def disable_animation_time
  mod = Sketchup.active_model
  opts = mod.options
  delay = opts["SlideshowOptions"]["SlideTime"]
  opts["SlideshowOptions"]["SlideTime"]= 0.0
  time = opts["PageOptions"]["TransitionTime"]
  opts["PageOptions"]["TransitionTime"]= 0.0
  trans = opts["PageOptions"]["ShowTransition"]
  opts["PageOptions"]["ShowTransition"]= false
  return delay, time, trans
end

Use the saved delay, time and trans references to reset the options when you are done.

def reset_animation_opts(delay, time, trans)
  mod = Sketchup.active_model
  opts = mod.options
  opts["SlideshowOptions"]["SlideTime"]= delay
  opts["PageOptions"]["TransitionTime"]= time
  opts["PageOptions"]["ShowTransition"]= trans
end

Thank you Dan, but I am doing this already. The code I posted is a simple illustration of the issue.

No problem. When I post in the forums, I post for general information that may help any reader that might be interested.

I do not have a Mac so I cannot confirm what you see.

But I can note that another coder has found an issue with the Mac Ruby Console that crashes SketchUp in the 21.1.0 release. See Issue 649 in the GitHub tracker. So I would not be surprised if there were to be other issues with the console.


When you say “Other window in focus” are you speaking of another model document window within SketchUp ? I ask because in you 1st post you said “On Mac when you minimize SketchUp …”

So I’m wondering if you are minimizing the whole application or just one of the document windows ?

I was not precise using Windows naming.
I first minimize active document (model) and then activate a different application (“other window in focus”).

Okay … please file a report in the Issue tracker (with SketchUp versions that this occurs.)