Notifications
Clear all

[Closed] Access material properties of an xRef Material

So the backstory of what I’m trying to accomplish is that we have workflow where where use a VRaySwitchMtl with xref’d materials in it’s slots to easily switch carpaints.

now I got the part to switch the material covered in my tool, where I switch the index of the switchMtl.

But I’d also like to change a colorpicker to the diffuse color of the chosen index’s material, which is an xref material.

I have NO clue how to access those properties. I know I am supposed to be looking at the Interface: objXRefMgr section of the docs, but I can make heads nor tails of how that part works.

I get to this point:
obj.material.switchMtl[5]
which returns
object:xref
I also tried
obj.material.switchMtl[5].xrefrecord
gives me
<MixinInterface:IXRefRecord>
and then I’m stumped.

So either I’m trying to accomplish something that can’t be done (which I can’t imagine) or I’m going to need some help here to fetch my material properties.

1 Reply

Solution posted Here by DenisT

basically we’re looking for
xrefmat.getsourcematerial false
(or true if you want to resolve nested xrefs)

so in my case it would be
srcMat = obj.material.switchMtl[5].getsourcematerial false