Forum: Poser Python Scripting


Subject: Apply material across all parts of an object

maur_2005 opened this issue on Sep 25, 2021 ยท 10 posts


structure posted Thu, 14 October 2021 at 1:20 AM Forum Coordinator

import os
import poser

scene = poser.Scene()
actor = scene.CurrentActor()
figure = scene.CurrentFigure()
# get the mat you want to copy
# you can use other methods to find the material you want.
material = scene.CurrentMaterial()

actor.SaveMaterialSet( os.path.join( poser.TempLocation(), "tempmat.mt5") )
if not actor.IsBodyPart():
    for material in actor.Materials():
        actor.LoadMaterialSet( os.path.join( poser.TempLocation(), "tempmat.mt5") )
else:
    for material in figure.Materials():
        actor.LoadMaterialSet( os.path.join( poser.TempLocation(), "tempmat.mt5") )
scene.DrawAll()
# cleanup
# delete temporary material file
os.unlink( os.path.join( poser.TempLocation(), "tempmat.mt5") )

Locked Out