Author Topic: Lightselect Element from Selection  (Read 2862 times)

2018-06-20, 10:15:25

FlorianW.

  • Active Users
  • **
  • Posts: 53
    • View Profile
with the updated maxscript access on corona 2.0, will it be possible to write a script to generate a lightselect element from selected lights with one button? Setup Lightmix is good but not for inbetween tasks.

Cheers
3dsMax 2021 - Corona 5

2018-06-20, 10:49:49
Reply #1

Njen

  • Active Users
  • **
  • Posts: 557
    • View Profile
    • Cyan Eyed
This has been possible for a while:

Code: [Select]
foo = getCurrentSelection()
re = maxOps.GetCurRenderElementMgr()
re.addrenderelement (Cshading_LightSelect elementName:"myLightSelect" includedNodes:foo addEnvironment:false useDenoise:true)

2018-06-20, 12:33:00
Reply #2

FlorianW.

  • Active Users
  • **
  • Posts: 53
    • View Profile
nice!!! thanks so much. i didn't know about the "addrenderelement" command. Do you know if i can also access the "merge" button in the render elements tab.

Cheers
3dsMax 2021 - Corona 5

2018-06-20, 14:42:55
Reply #3

FlorianW.

  • Active Users
  • **
  • Posts: 53
    • View Profile
thanks again, tool is already up an running :)

3dsMax 2021 - Corona 5

2018-06-20, 21:01:32
Reply #4

Njen

  • Active Users
  • **
  • Posts: 557
    • View Profile
    • Cyan Eyed
Excellent. You can also add in some sort of loop check to make sure that only valid objects are being included in the selection. Something like:

if classof blah == coronaLight do
(I'm not in front of a copy of Max right now)

2018-07-24, 11:46:35
Reply #5

FlorianW.

  • Active Users
  • **
  • Posts: 53
    • View Profile
Would it be possible to integrate a "Lightmix Checker" into the script, which looks for the lightmix node in the renderelements tab and if it doesn't exist, creates one?

So easily explained, can i look if a lightmix node exists via maxscript?

Thanks in Advance!!!

3dsMax 2021 - Corona 5

2018-07-24, 18:57:02
Reply #6

Njen

  • Active Users
  • **
  • Posts: 557
    • View Profile
    • Cyan Eyed
This would be easy to do. I'm not in front of a Corona license at the moment to actually write the code, but all you would have to do is collect all of the existing render elements in an array, check for the class of the specific light mix element, and if no match exists, simply create one.