def run_create_crack_distance(self, *args): objects = cmds.ls(sl=True) objects = oopmaya.get_object_type(objects, 'mesh') simulation_tool.Simulation_Tool().create_crack_distance(objects) oopmaya.message('Added crack distance!')
def run_bake_sim( self, *args ): objects = cmds.ls( sl = True ) objects = oopmaya.get_object_type( objects, 'mesh' ) simulation_tool.Simulation_Tool().bake_sim( objects, bake_attr = ['translate'] ) oopmaya.message( 'Finished baking simulation!' )
def run_create_crack_distance( self, *args ): objects = cmds.ls( sl = True ) objects = oopmaya.get_object_type( objects, 'mesh' ) simulation_tool.Simulation_Tool().create_crack_distance( objects ) oopmaya.message( 'Added crack distance!' )
def run_bake_sim(self, *args): objects = cmds.ls(sl=True) objects = oopmaya.get_object_type(objects, 'mesh') simulation_tool.Simulation_Tool().bake_sim(objects, bake_attr=['translate']) oopmaya.message('Finished baking simulation!')
def convert_mesh_to_joints(self, objects): mesh_joints = [] joints_dag = [] cluster_joints = [] cluster_data = {} meshes = oopmaya.get_object_type(objects, 'mesh') cluster_handles = oopmaya.get_object_type(objects, 'cluster1Handle') for mesh in meshes: cmds.select(cl=True) mesh_joints.append(cmds.joint(n='{0}_jnt'.format(mesh))) joint_dag = oopmaya.DAG_Node() joints_dag.append(joint_dag) cmds.parentConstraint(mesh, joint_dag.name()) for cluster_handle in cluster_handles: cluster_vert = oopmaya.get_cluster_verts(cluster_handle) if cluster_vert: mesh_shape = cmds.cluster(cluster_handle, geometry=True, q=True) mesh_transform = cmds.listRelatives(mesh_shape, parent=True) cluster_data[mesh_transform] = [cluster_handles, cluster_vert] cluster_joints.append( cmds.joint(n='{0}_jnt'.format(cluster_handle))) joint_dag = oopmaya.DAG_Node() joints_dag.append(joint_dag) cmds.parentConstraint(cluster_handle, joint_dag.name()) simulation_tool.Simulation_Tool().bake_sim(mesh_joints, cluster_joints) cmds.delete(objects, cn=True) for obj_dag, joint_dag in zip(meshes, joints_dag): if obj_dag.name() in cluster_data: print 1 obj_dag.parent_constraint(joint_dag)
def run_add_rigid_body( self, *args ): mag_value = cmds.floatField( self.magnitude_float, value = True, q = True ) objects = cmds.ls( sl = True ) objects = oopmaya.get_object_type( objects, 'mesh' ) simulation_tool.Simulation_Tool().add_rigid_body( objects, magnitude = mag_value ) oopmaya.message( 'Added rigid body!' )
def run_add_rigid_body(self, *args): mag_value = cmds.floatField(self.magnitude_float, value=True, q=True) objects = cmds.ls(sl=True) objects = oopmaya.get_object_type(objects, 'mesh') simulation_tool.Simulation_Tool().add_rigid_body(objects, magnitude=mag_value) oopmaya.message('Added rigid body!')
def convert_mesh_to_joints( self, objects ): mesh_joints = [] joints_dag = [] cluster_joints = [] cluster_data = {} meshes = oopmaya.get_object_type( objects, 'mesh' ) cluster_handles = oopmaya.get_object_type( objects, 'cluster1Handle' ) for mesh in meshes: cmds.select( cl = True ) mesh_joints.append( cmds.joint( n = '{0}_jnt'.format( mesh ) ) ) joint_dag = oopmaya.DAG_Node() joints_dag.append( joint_dag ) cmds.parentConstraint( mesh, joint_dag.name() ) for cluster_handle in cluster_handles: cluster_vert = oopmaya.get_cluster_verts( cluster_handle ) if cluster_vert: mesh_shape = cmds.cluster( cluster_handle, geometry = True, q = True ) mesh_transform = cmds.listRelatives( mesh_shape, parent = True ) cluster_data[mesh_transform] = [cluster_handles, cluster_vert] cluster_joints.append( cmds.joint( n = '{0}_jnt'.format( cluster_handle ) ) ) joint_dag = oopmaya.DAG_Node() joints_dag.append( joint_dag ) cmds.parentConstraint( cluster_handle, joint_dag.name() ) simulation_tool.Simulation_Tool().bake_sim( mesh_joints, cluster_joints ) cmds.delete( objects, cn = True ) for obj_dag, joint_dag in zip( meshes, joints_dag ): if obj_dag.name() in cluster_data: print 1 obj_dag.parent_constraint( joint_dag )
def attach_plane_rig(self, objects): plane_name = "plane_nurb" if plane_name in objects: cmds.select(plane_name, deselect=True) transform_nodes = oopmaya.get_object_type(objects, "mesh") cmds.select(transform_nodes) cmds.select(plane_name, add=True) cmds.CreateWrap()
def attach_plane_rig( self, objects ): plane_name = 'plane_nurb' if plane_name in objects: cmds.select( plane_name, deselect = True ) transform_nodes = oopmaya.get_object_type( objects, 'mesh' ) cmds.select( transform_nodes ) cmds.select( plane_name, add = True ) cmds.CreateWrap()