1
[Max] I need help! / Re: Select the light mix list item by light
« on: Today at 13:22:00 »
Well I dont know how to access the UI but you can use this instead, select a light and run this script, it will give you a messagebox with the Light Select Elements name:
Edit:
I think access to Lightmix via maxscript is currently in development (by user request). Once this is rolled out we should have access directly to the value/color in the lightmix which would be great because we can extend this script and build a little UI so when you select a light you can directly change properties in the lightmix as needed.
Code: [Select]
-- Struct to hold LightSelect Element and Lights associated to that Element
struct LightMixData
(
elementName,
lights
)
-- Add the Lights & Elements to the Struct
lightMixTable = #()
for i in getclassinstances CShading_LightSelect do
(
lightMixEntry = LightMixData()
lightMixEntry.elementName = i.name
lightMixEntry.lights = i.includedNodes
append lightMixTable lightMixEntry
)
-- Messagebox to show user the light element for selected light
fn ShowMessageForSelectedLight =
(
-- Get the currently selected nodes
selectedNodes = getCurrentSelection()
if selectedNodes.count == 0 then exit
for node in selectedNodes do
(
if isKindOf node Light do
(
elementName = for entry in lightMixTable where findItem entry.lights node != 0 collect entry.elementName
if elementName.count > 0 then
messageBox ("Element Name: " + elementName[1] + "\nLight Name: " + node.name)
else
messageBox("Element Name not found for: " + node.name)
)
)
)
-- Run Main Function
ShowMessageForSelectedLight()
Edit:
I think access to Lightmix via maxscript is currently in development (by user request). Once this is rolled out we should have access directly to the value/color in the lightmix which would be great because we can extend this script and build a little UI so when you select a light you can directly change properties in the lightmix as needed.