def material(self, skeletonctxt): # This is the default function for assigning a material to an # element. When a Mesh is created, a different function may # be used in some circumstances (see Relax). # If this element is part of an ElementGroup that has an # explicitly assigned Material, return that Material. If it's # part of more than one such group, return the Material that # was assigned most recently. Otherwise, return the material # assigned to the element's dominant pixel. lasttime = timestamp.timeZero lastmaterial = None for group in self.groups: matl, ts = skeletonctxt.elementgroups.getMaterialAndTime(group) if matl is not None and ts > lasttime: lastmaterial, lasttime = matl, ts if lastmaterial is not None: return lastmaterial ms = skeletonctxt.getObject().MS dominantpixel = self.dominantPixel(ms) if dominantpixel is not None: return material.getMaterialFromCategory(ms, dominantpixel)
def material(self, skeleton): dominantpixel = self.dominantPixel(skeleton.MS) if dominantpixel is not None: return material.getMaterialFromCategory(skeleton.MS, dominantpixel)