SketchUp / api-issue-tracker

Public issue tracker for the SketchUp and LayOut's APIs
https://developer.sketchup.com/
39 stars 10 forks source link

Sketchup::Page - Missing methods (set camera, rendering options, ....) #878

Open Fredosixx opened 1 year ago

Fredosixx commented 1 year ago

The Sketchup::Page class seems to be missing crucial methods.

For instance, I did not find a direct way to set a camera for scene via the API. There is no method like page.camera=.

So, you have to

  1. Save the current view and current scene if any
  2. Set the page as the current scene
  3. set the camera in the view
  4. call page.update to store the camera (ideally, we should just unset all use_ flags to make sure we just update the camera and then restore them after.
  5. restore the view camera
  6. select the original scene if any

The same happens for rendering_options, shadows, etc....

DanRathbun commented 1 year ago

A longstanding challenge. I described it in detail as the use case "elaboration" requested by @thomthom in https://github.com/SketchUp/api-issue-tracker/issues/876#issuecomment-1471151303, for why a "quick iterator" that temporarily switches off scene transitions is needed.

thomthom commented 1 year ago

Would fixing this make #876 obsolete?

DanRathbun commented 1 year ago

Would fixing this make #876 obsolete?

Not, in my opinion. (More discussed in #876.)

But being able to set page properties without going through the clunky page.update from the active view (and it's rendering options) certainly will help avoid situations that cause buggy code.

For example, in the workaround described, any ViewObserver or FramechangeObserver will fire (perhaps twice each, maybe more.) This could cause other unneeded side-effects.

sketchup[bot] commented 1 year ago

Logged as: SKEXT-3662