Author Topic: Maxscript to connect lots of maps to 'CoronaMultiMap' node  (Read 3323 times)

2016-10-07, 12:13:13

Njen

  • Active Users
  • **
  • Posts: 557
    • View Profile
    • Cyan Eyed
So in the Slate material editor, I have a whole bunch of CoronaBitmap nodes that have loopable names (for example: 'mask_1001', 'mask_1002', etc.) all with textures and settings I want.

Does anyone know how to use maxscript to wire existing nodes in the SME to a 'CoronaMultiMap' node? I've been racking my brain, and I can't figure it out myself...

Btw, I know how to add new CoronaBitmap nodes to the CoronaMultiMap, but not existing nodes.

2016-10-07, 17:47:22
Reply #1

Jahman

  • Active Users
  • **
  • Posts: 45
  • Panteleev Sergey
    • View Profile
    • some of my scripts for 3ds max
Code: [Select]
-- max 2014 and above
fn getSMEselectedMtls = (

viewNode = sme.GetView (sme.activeView)
smeSelMats = #()
for n = 1 to trackViewNodes[#sme][(sme.activeView)].numSubs do (
m = trackViewNodes[#sme][sme.activeView][n].reference
b = viewNode.GetNodeByRef m
if b.selected do append smeSelMats m
)
smeSelMats

)


fn connectMapsToCoronaMM = (

maps = for m in getSMEselectedMtls() where superclassof m == textureMap collect m

if maps.count == 0 or maps == undefined do (
format "No maps selected"
return false
)

coronaMM = for m in maps where classof m == CoronaMultiMap collect m
if coronaMM.count > 0 then coronaMM = coronaMM[1] else (
format "CoronaMultiMap is not selected"
return false
)

for i=1 to maps.count where maps[i] != coronaMM do (

coronaMM.texmaps[i-1] = maps[i]

)


)

connectMapsToCoronaMM()


select all the map nodes you wish to connect and target coronaMultiMap node then run script

2016-10-07, 18:21:05
Reply #2

Njen

  • Active Users
  • **
  • Posts: 557
    • View Profile
    • Cyan Eyed