def EditCloth_Execute(): add_to_path() if not xsi.Selection(0): uitk.MsgBox('No Model selected.') return prop = get_cloth_prop(xsi.Selection(0)) if prop: edit_prop(xsi.Selection(0)) else: import utils utils.add_cloth_property(xsi.Selection(0)) edit_prop(xsi.Selection(0))
def ClothCreate_Execute(): add_to_path() if not xsi.Selection(0): uitk.MsgBox('No Model selected.') return prop = get_cloth_prop(xsi.Selection(0)) if prop: if uitk.MsgBox( 'Already is cloth, delete the existing cloth and create a new one?', 4) == 6: xsi.DeleteObj(prop) else: return import utils utils.add_cloth_property(xsi.Selection(0)) edit_prop(xsi.Selection(0))
def build_cloth(self): """Build enveloped geometry with special cloth properties.""" logging.info("Building %s as cloth(originally %s).", self.model.name, self.model.model_type) vertex_positions = self.get_vertex_positions() faces = self.get_faces() if self.model.parent_name: parent = self.chainbuilder.name_dict[self.model.parent_name] else: parent = self.xsi.ActiveSceneRoot if not parent: logging.error("Cant find parent %s for %s.", self.model.parent_name, self.model.name) try: self.si_model = parent.AddPolygonMesh(vertex_positions, faces, self.model.name) except com_error: logging.exception("verts: %s, faces: %s, name: %s.", vertex_positions, faces, self.model.name) self.imp.abort_checklog() self.geo = self.si_model.ActivePrimitive.GetGeometry2(0) self.process_uvs() self.set_transform() self.set_vis() import utils cloth_prop = utils.add_cloth_property(self.si_model) cloth_prop.Parameters("collisions").Value = ",".join([c.name for c in self.model.segments[0].collisions]) cloth_prop.Parameters("texture").Value = self.model.segments[0].texture self.geo.AddCluster(const.siVertexCluster, "ZEFixedPoints", self.model.segments[0].vertices.fixed_indices())