Page 1 of 1

Set material override and capture set names

Posted: Sat Jan 20, 2018 2:03 am
by woohoou
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.

Re: Set material override and capture set names

Posted: Sun Jan 21, 2018 1:39 pm
by admin
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