Sam Jones Posted January 21, 2023 Share Posted January 21, 2023 How can I get a handle to the light contained in a Lighting Device? I am assuming this would be the light in the Visualization palette that I can turn on and off there. However, I need a handle to that light in order to control it with scripts. Yet again, TIA. Quote Link to comment
Pat Stanford Posted January 21, 2023 Share Posted January 21, 2023 I have been thinking the same thing Sam. I think you have to do a FirstIn3D and check the object types. But I don't think all Light Fixtures have Light Objects in them. I think some/most use an Emitter instead. So you will probably need to check for 3D loci also and then use SetObjectVariableBoolean to turn off the emitter. Or maybe that doesn't work. JBenghiat has said you can't do it. But I am stubborn enough to try and prove it for myself. Or to let you prove it for me. 😉 Quote Link to comment
JBenghiat Posted January 21, 2023 Share Posted January 21, 2023 It depends what you want to do with the light. The light that appears in the Viz palette is in the profile group of the object (which is true for all PIO’s that appear in Visualization). This is what allows you to edit the light via Viz and have the modifications persist. (That is, the light doesn’t redraw of every regen). You start with getting a handle to the profile group and then iterate through the objects until you find the light. There’s also a light that gets placed inside the object geometry. Due to a myriad of reasons, this geometry is not so easy to parse. Do some exploring with Debug List View. If I remember correctly, the geometry is in the aux list, which means you can access via Python but not VS. But depending on what you are doing, you may not need to access this light. Quote Link to comment
Sam Jones Posted January 21, 2023 Author Share Posted January 21, 2023 I need to turn the light on and off. Quote Link to comment
Sam Jones Posted January 21, 2023 Author Share Posted January 21, 2023 Got it for now, but I have only experimented with ETC Source 4 conventionals shiipping with the program. Entering the profile group and adjusting the light object with SetLightInfo() procedure seems to do the trick. I'll see what happens when I find a Lighting Device that uses an emitter. Quote Link to comment
Jesse Cogswell Posted January 22, 2023 Share Posted January 22, 2023 (edited) Here's a snippet from my own code that I use to toggle whether a light is on or off. I wrote it to combat the annoying "feature" introduced in VW2022 where new Lighting Device objects defaulted to being "on." It will take any selected Lighting Device object and toggle the state of the internal light. It works for standard Light Devices as well as Lighting Devices using the Emitter settings. PROCEDURE ToggleState(h:HANDLE); {Polls embedded Light object and toggles its on/off state} CONST kLight = 81; kLightOn = 50; VAR h2,lightHd:HANDLE; currentState:BOOLEAN; BEGIN selDeviceCount:=selDeviceCount+1; h2:=FInGroup(GetCustomObjectProfileGroup(h)); WHILE(h2<>NIL) DO BEGIN IF(GetTypeN(h2)=kLight) THEN BEGIN lightHd:=h2; currentState:=GetObjectVariableBoolean(lightHd,kLightOn); h2:=NIL; END ELSE h2:=NextObj(h2); END; SetObjectVariableBoolean(lightHd,kLightOn,NOT currentState); ResetObject(h); END; Edited January 22, 2023 by Jesse Cogswell Quote Link to comment
Sam Jones Posted January 22, 2023 Author Share Posted January 22, 2023 @Jesse Cogswell Thank you Jesse! Setting the object variable seems to have the same efficiency as the SetLightInfo procedure, but looks a little cleaner to me. I would use your code, but when I found the asdfasd procedure I added adjusting the brightness to the functionality, but I have other uses for that object variable. I am constantly and presently surprised by the hooks avalable to scripts in the object variable list. I just wish I could decipher its organization in a manner that would let me find the hooks I need more easily. Quote Link to comment
Jesse Cogswell Posted January 22, 2023 Share Posted January 22, 2023 I've attached a couple other menu commands that I've done in case you want to borrow any other features from them. Set Emitters by Fixture Type: This is a command that I wrote to take advantage of new object variables added in VW2020 to deal with emitter settings. I often use emitters to get more realistic output for Renderworks renderings (don't work in Redshift unfortunately), and was getting frustrated with having to manually input the emitter data every time I changed a fixture type. This command will detect the selected fixture types and scale a dialog box allowing you to set the emitter settings for each type. Once you click OK, the settings will be updated for all selected Lighting Device objects. Set Light Levels by Channel: This command will likewise scale a dialog by number of selected lighting fixtures (up to 100 channels), allowing you to quickly set levels based on a bunch of channels at once. Set Emitters By Fixture.vsm Set Light Levels by Channel.vsm 2 Quote Link to comment
Sam Jones Posted January 22, 2023 Author Share Posted January 22, 2023 @Jesse Cogswell Thank you. Dealing with emitters is in my near future. Quote Link to comment
JBenghiat Posted January 22, 2023 Share Posted January 22, 2023 Just flagging some cross-nomenclature here. @Sam Jones, you're referring to multiple emitters in a lighting device symbol definition. In this case, you're only going to have one render light per cell in the profile group that masters each set of emitters. (You do need to check for multiple lights for multiple cells). @Jesse Cogswellis referring to the emitter properties of a light object that allow it to behave more realistically. 2 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.