Notifications
Clear all
[Closed] Getting a selected face's material
May 20, 2015 7:39 am
Hello,
I want to write a script that gets the material of the currently selected face and put it in the current active material editor slot.
I wrote this:
medit.PutMtlToMtlEditor selection[1].mat activeMeditSlot
but if i'm in polygon subobject mode and the object's material is a multimaterial and I select a face whose material I want, it puts the multimaterial in the active slot, rather than the face's material. I'd like for the code to work just like the eye-dropper tool in the material editor. Its a simple problem but I can't for the life of me figure out how to do it. Any help would be greatly appreciated.
2 Replies
May 20, 2015 7:39 am
(
fn PolygonMatToMeditSlot node = if classof node == Editable_Poly do
(
faceSel = polyop.getFaceSelection node
if faceSel.numberset == 1 do
(
faceMat = polyop.getFaceMatID node (faceSel as array)[1]
meditMaterials[activeMeditSlot] = node.material[faceMat]
)
)
PolygonMatToMeditSlot $
)