Set material override and capture set names

woohoou
Posts: 3
Joined: Wed Jun 28, 2017 4:48 pm

Set material override and capture set names

Postby woohoou » Sat Jan 20, 2018 2:03 am

Hi Grant,

I need to set the material override in capture sets with MaxScript but there is no way to do this according to the documentation. Do you know if this is possible in some way?

Thanks,
Heber.

admin
Site Admin
Posts: 136
Joined: Mon Jun 19, 2017 4:08 pm

Re: Set material override and capture set names

Postby admin » Sun Jan 21, 2018 1:39 pm

Hi

To set the material of the first capture set, for the first pass, to (say) the active material in the medit, you can do:

mat = (medit.GetTopMtlSlot (medit.getActiveMtlSlot()))
capsets = #(1)
passes = #(1)
RPMCaptureProps.captureCapSetMaterial capsets passes mat

-- and to enable the 'on' checkbox:

for capset in capsets do
(
custAtt = custAttributes.get TrackViewNodes.RenderPassManager.rendermanager_captureSets (capset + 1)
dataArray = for j in custAtt.RMdataStor collect j
for pass in passes do
(
numbS = rpmdata.getUniqueFromIndex pass as string
indx = finditem dataArray numbS
custAtt.RMcapSetEnable[indx] = true
)
)

See if that works for you, if the UI is open it won't refresh with the code above. Though, if you have the UI open, it's a much simpler maxscript call for the active pass:

mat = (medit.GetTopMtlSlot (medit.getActiveMtlSlot()))
rpmdata.RPMObjProp.moAltMat.picked mat

which should both set the material and turn on the checkbox. If you pass undefined as the mat it'll clear it and turn off the checkbox.

cheers,
grant


Return to “Questions”

Who is online

Users browsing this forum: No registered users and 7 guests

cron