Quick ones to continue testing would be:
-Unisolate: "IsolateSelection.ExitIsolateSelectionMode()"
-Switch to camera view: "viewport.setType(#view_camera)". However if you have multiple cameras you would get a prompt to choose a camera
-Scene HDRI: Depends where and how it is stored
But basically my approach would be to remember
every change made without exception for reverting later (when releasing the button) so the button can be used for any scene without leaving traces behind. Meaning:
Button toggle on:
- Save viewport type, save camera reference if it is a camera viewport. (See "viewport.getType()" and "viewport.getCamera()")
- (Maybe even save viewport layout and active viewport in case someone changes it during tweaking)
- Save renderer environment setting ("renderers.current.bg_source", can be 3dsMax (0), Corona single (1) or Corona multiple (2), this also answers your question about switching environment setting by script)
- If you choose to always use 3dsmax env for tweaking and Corona env for rendering and renderers.current.bg_source is not set to 3ds max env and it's empty, plug tweak map into 3ds max environment while saving the currently assigned one if present.
- Save states of Corona overrides ("renderers.current.bg_overrideDirect/Refract/Reflect") and switch them off
- Optionally open SME, create a new tab "Tweaking" and fetch all materials from selected objects automatically (bonus task I would like to have :)
- Isolate+zoom selection
Tweak
Button toggle off:
- Delete SME tab "Tweaking" (bonus task)
- Restore saved 3ds max env map if one was present
- Restore saved renderer environment setting (see above)
- Restore saved states of Corona overrides
- Switch to saved viewport type, switch to saved camera if it has been a camera view (""viewport.setType()" and "viewport.setCamera()")
- Unisolate
For personal/inhouse use you can of course simplify everything. As mentioned, I pretty much love the idea of having a "Let's tweak this!" button, maybe I'll give it a try someday.
Good Luck
Edit: 3dsMax (1), Corona single (2) or Corona multiple (3) -> 3dsMax (0), Corona single (1) or Corona multiple (2)
« Last Edit: 2019-07-02, 12:53:34 by Frood »
Logged
Never underestimate the power of a well placed level one spell.