python way to query/set lighting mode buttons on viewport?

   2608   3   0
User Avatar
Member
36 posts
Joined: April 2015
Offline
I am trying to create a new floating viewport that matches an existing desktop viewport.

I have been using the hscript viewcopy command to copy settings from one viewport to the other and that works pretty well. The only thing it seems to miss is the state of the Lighting buttons (No lights, headlight, normal lights, etc.). Is there any other way to query which lighting button is being used on a viewport, and also a way to set them?

Attachments:
lighting_buttons.png (16.4 KB)

User Avatar
Member
36 posts
Joined: April 2015
Offline
So the ‘use headlight’ option of a viewer can be switched on/off using the hscript command:

vieweroption -h 0|1 <viewername>

However I still cannot find a way to query the state of ‘use headlight’ in one viewer so that I may set it to correspond in another. :cry:
User Avatar
Staff
5295 posts
Joined: July 2005
Offline
The lighting modes aren't directly represented by a single setting in the viewport, they're more like macros that set these 4 settings:

viewlight -l on|off // Lighting on/off
vieweroption -h on|off // Headlight on/off
viewlight -h on|off // HQ Lighting on/off
viewdisplay -X on|off // shadows on/off

HQ Lighting is only available when lighting is on and headlight is off, and shadows are only available when HQ Lighting is on. Normal quality lighting is invoked when HQ is off, Headlight is Off and Lighting is On.

There's currently no way to query these settings. This is probably something that HOM would need to address, as the view* hscript commands are a bit of a mess; not sure how they'd be modified to query individual settings given the state they're in currently.
User Avatar
Member
36 posts
Joined: April 2015
Offline
Thanks for the insight.

On a related topic= do you know if there is any way to query the ‘visbility of external objects’ button on a SceneViewer pane? I can create a new floating panel SceneViewer, set the camera and cwd to match the original scene view, and use hscript viewcopy to match most of the viewport settings. I have given up on matching the state of headlight view, but I am still trying to figure out a way to get the state of external object visbility to match. Currently it seems the new floating panel scene viewer defaults to ‘Ghost Other Objects’ and I can't control that.
  • Quick Links