Author Topic: add lights to existing lightselect element via maxscript?  (Read 1964 times)

2020-10-15, 15:24:11

TYCHE

  • Active Users
  • **
  • Posts: 13
    • View Profile
Is that possible?

I know the workaround to delete the Element entirely and genereate a new one with all included lights, but this is messing up the sorting of lightselect elements in the coronabuffer. so is there a way to merge them onto an existing one?

Thanks!


2020-10-15, 16:40:41
Reply #1

Frood

  • Active Users
  • **
  • Posts: 1922
    • View Profile
    • Rakete GmbH
Possible, yes. But what keeps you from adding/removing lights by UI?


Good Luck




Never underestimate the power of a well placed level one spell.

2020-12-01, 14:55:42
Reply #2

TYCHE

  • Active Users
  • **
  • Posts: 13
    • View Profile
Because we develop an inhouse toolbar where we want to easiliy add and remove Lights. Opening the render elements dialog isn't qick enough for me.

2020-12-02, 12:08:01
Reply #3

Frood

  • Active Users
  • **
  • Posts: 1922
    • View Profile
    • Rakete GmbH
The question is: how you would identify the appropriate light select render element. Anyhow, something like this is basically what you would need:

Code: [Select]
mgr=maxOps.GetCurRenderElementMgr()
for i=0 to (mgr.NumRenderElements()-1) do (
rElement=mgr.getRenderElement(i)
format("Element %:\tName:'%'\tClass: %\n") i rElement.elementName (classof(rElement))
if (classof(rElement)==CShading_LightSelect) do (format "\tLight sources:%\n" rElement.includedNodes)
)

"includedNodes" is the ArrayParameter where you would add/remove items.


Good Luck



Never underestimate the power of a well placed level one spell.

2020-12-02, 13:57:58
Reply #4

TYCHE

  • Active Users
  • **
  • Posts: 13
    • View Profile
Thanks so much!

Yeah you're right, but in out team the Sun LightselectElement always has the same string so this works fine. Not the ideal solution if someone else would work with this, but thats not necessary here.

Thank you for your help!