How is the best way to update pages?
I’m developing a function that turn off one or more layers in all the scenes.
Im’ finding problems to update the scenes.
Here is the idea (later i’ll post the code, I’m out of the office).
Activate the page
Turn the layer off
Update the scene
The problem is: Update of the scene happens before view is oriented, so the camera of the scene changes.
So between selecting the scene and updating, you’re moving the camera?
If you were doing this using the native tools and all you want to do is update the layer state, you would set Camera and other scene attributes to be left alone by unticking the boxes in Properties to save. Can you do that in your code?
As I understand, activating a scene (page) changes the camera to the one saved in the scene, but you want to update different scenes without having a visible effect to the user.
The question is why you activate the scene at all. The Ruby API allows to get a reference to any scene – not necessarily the active one. You can change a scene’s layer visibility setting without turning the actual on layer on/off. Or is there a limitation of what the API makes possible?
This is the better way at the end; quick and easy.
I was looking for something general (to change other properties in the future)
But I will deal with the problem when it will be
By using a reference to the page you want to modify (instead of making it active), you can call the update(flags) method to update specific properties.
It seems the API lacks a way to specify the values of these properties, but it can only take them from the current view, which requires changing the camera of the active view. The better solution would be if the page had a camera= method.
Mutating a global model option (to achieve a local effect through this script) may not be in the interest of the user. You can do this as a workaround and remember to set the PageOptions back to their previous value afterwards.