16
[Max] I need help! / Re: Maxscript to connect lots of maps to 'CoronaMultiMap' node
« on: 2016-10-07, 17:47:22 »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