コード例 #1
0
    def rig(self, component_node, control, object_space_list, bake_controls = True, default_space = None, use_global_queue = False, **kwargs):
        autokey_state = pm.autoKeyframe(q=True, state=True)
        pm.autoKeyframe(state=False)

        character_settings = v1_core.global_settings.GlobalSettings().get_category(v1_core.global_settings.CharacterSettings)
        if bake_controls:
            bake_controls = not character_settings.no_bake_overdrivers

        if not super(Overdriver, self).rig(component_node, control, object_space_list, bake_controls, use_global_queue = use_global_queue, **kwargs):
            return False

        driver_control = self.rig_setup(control, object_space_list, bake_controls, default_space)

        if character_settings.bake_drivers:
            temp_constraint_list = []
            for object_space in object_space_list:
                temp_constraint_list.append(pm.parentConstraint(control, object_space, mo=True))

            maya_utils.baking.bake_objects(object_space_list, True, True, False, use_settings = True, simulation = False)

            pm.delete(temp_constraint_list)
        else:
            if bake_controls:
                self.run_bake(use_global_queue)

        if use_global_queue:
            maya_utils.baking.Global_Bake_Queue().add_post_process(self.save_animation, {})
            maya_utils.baking.Global_Bake_Queue().add_post_process(self.bind_controls, {})
        else:
            self.save_animation()
            self.bind_controls()

        pm.autoKeyframe(state=autokey_state)

        return True
コード例 #2
0
    def animLoad(_):

        if pm.autoKeyframe(q=True, state=True) == False:
            pm.autoKeyframe(state=True)
            resetAutoKey = 1

        animRead = open(
            r'\\p.sv\Prism\project\SER\user\chew\ref\animPose\taiso.pose', 'r')
        animDump = []
        for i in animRead:
            animDump.append(i)
        animRead.close()

        animData = {}
        for i in animDump:
            if i.split()[0] not in animData:
                animData[i.split()[0]] = []
            animData[i.split()[0]].append(i)

        pm.currentTime(0)
        pm.setKeyframe(
            pm.listRelatives('Character_Reference', ad=True, type='joint'))
        for i in sorted(animData):
            pm.currentTime(i, update=False)
            for jointData in animData[i]:
                split = jointData.split()
                pm.xform(split[1],
                         translation=[split[2], split[3], split[4]],
                         rotation=[split[5], split[6], split[7]])
        if resetAutoKey == 1:
            pm.autoKeyframe(state=False)
コード例 #3
0
    def space_switcher(self, index, start_frame, end_frame, key_switch):
        # Temporary disable cycle checks during swapping
        cycle_check = pm.cycleCheck(q=True, e=True)
        pm.cycleCheck(e=False)
        autokey_state = pm.autoKeyframe(q=True, state=True)
        pm.autoKeyframe(state=False)

        try:
            # Disable viewport refresh to speed up execution
            pm.refresh(su=True)

            pm.currentTime(start_frame)
            current_space = self.get_current_space()
            if current_space != None:
                control = self.network['controls'].get_first_connection()
                matrix_list = maya_utils.baking.get_bake_values([control], start_frame, end_frame)
            
                self.swap_space(index, current_space, start_frame, key_switch)
                self.swap_space(current_space, index, end_frame, key_switch, end_cap = True)

                maya_utils.baking.space_switch_bake([control], start_frame, end_frame, matrix_list)

            pm.currentTime(start_frame)
        except Exception, e:
            exception_info = sys.exc_info()
            v1_core.exceptions.except_hook(exception_info[0], exception_info[1], exception_info[2])
コード例 #4
0
    def bake_and_remove(self, use_global_queue=True, local_queue=None):
        autokey_state = pm.autoKeyframe(q=True, state=True)
        pm.autoKeyframe(state=False)

        will_attach = False
        attachment_joint_list = self.network['attachment'].get_connections()
        for attach_jnt in attachment_joint_list:
            if len(
                    list(
                        set(
                            pm.listConnections(
                                attach_jnt, type='constraint', s=True,
                                d=False)))) > 1:
                will_attach = True
                break

        if will_attach:
            self.bake_non_attach_joints()
        else:
            self.bake_joints(use_global_queue=use_global_queue)

        if use_global_queue:
            maya_utils.baking.Global_Bake_Queue().add_post_process(
                self.remove, {})
        else:
            self.remove()

        pm.autoKeyframe(state=autokey_state)

        return True
コード例 #5
0
def disable_auto_keyframe():
    """
    Disable auto-keyframe within a with block.
    """
    original_auto_keyframe = pm.autoKeyframe(q=True, state=True)
    try:
        pm.autoKeyframe(state=False)
        yield
    finally:
        pm.autoKeyframe(state=original_auto_keyframe)
コード例 #6
0
    def fix_heel(self, fix_range):
        autokey_state = pm.autoKeyframe(q=True, state=True)
        pm.autoKeyframe(state=False)

        character_network = self.network['character']
        rigging.rig_base.Component_Base.zero_all_overdrivers(character_network)
        rigging.rig_base.Component_Base.zero_all_rigging(character_network)

        heel_loc = pm.spaceLocator(name="rf_fix_heel_loc")
        toe_rot_loc = pm.spaceLocator(name="rf_fix_toe_rot_loc")
        toe_ik_pos_loc = pm.spaceLocator(name="rf_fix_toe_ik_pos_loc")

        control_list = self.network['controls'].get_connections()
        to_order_list = [x for x in control_list if 'toe_ik' not in x.name()]
        ordered_controls = rigging.skeleton.sort_chain_by_hierarchy(
            to_order_list)
        ik_control = get_first_or_default(
            [x for x in control_list if x not in ordered_controls])

        del_constraint = []
        pm.delete(pm.parentConstraint(ordered_controls[-1], heel_loc,
                                      mo=False))
        del_constraint.append(
            pm.parentConstraint(ordered_controls[0], heel_loc, mo=True))
        del_constraint.append(
            pm.parentConstraint(ordered_controls[1], toe_rot_loc, mo=False))
        del_constraint.append(
            pm.parentConstraint(ik_control, toe_ik_pos_loc, mo=False))

        maya_utils.baking.bake_objects([heel_loc, toe_rot_loc, toe_ik_pos_loc],
                                       True, True, False)
        pm.delete(del_constraint)
        pm.currentTime(pm.currentTime(
        ))  # Maya may not update the scene properly after this bake

        del_constraint = []
        del_constraint.append(
            pm.parentConstraint(heel_loc, ordered_controls[-1], mo=False))
        del_constraint.append(
            pm.orientConstraint(toe_rot_loc, ordered_controls[1], mo=False))
        del_constraint.append(
            pm.pointConstraint(toe_ik_pos_loc, ik_control, mo=False))

        bake_list = [ordered_controls[-1], ordered_controls[1], ik_control]
        maya_utils.baking.bake_objects(bake_list,
                                       True,
                                       True,
                                       False,
                                       bake_range=fix_range,
                                       preserveOutsideKeys=True)

        pm.delete(del_constraint + [heel_loc, toe_rot_loc, toe_ik_pos_loc])

        pm.autoKeyframe(state=autokey_state)
コード例 #7
0
def createPanel():
    pm.window(windowID, title='Animation Tools', width=500)
    form = pm.formLayout(numberOfDivisions=50)
    pm.columnLayout(adjustableColumn=True,
                    columnAttach=('both', 5),
                    rowSpacing=10,
                    columnWidth=250)
    pm.autoKeyframe(state=True)

    pm.text(label='Channel Box')
    pm.channelBox('myChannelBox')

    #this section shows the current frame, start frame and the end frame.

    cmds.rowColumnLayout(w=500,
                         h=100,
                         nc=2,
                         cs=[(1, 30), (2, 100), (3, 30)],
                         rs=(1, 5))
    pm.text(label='Current Frame')
    pm.textField(text=pm.currentTime(query=True))
    pm.text(label='Start Frame')
    pm.textField(text=cmds.playbackOptions(q=True, min=True))
    pm.text(label='End Frame')
    pm.textField(text=cmds.playbackOptions(q=True, max=True))

    cmds.setParent('..')
    seprator1 = cmds.separator(w=400, h=10)

    cmds.rowColumnLayout(w=500,
                         h=100,
                         nc=2,
                         cs=[(1, 30), (2, 100), (3, 30), (4, 30), (5, 100),
                             (6, 30)],
                         rs=(1, 5))
    pm.button(label='Set Keyframe', command=SetKeyframeFromUI)
    pm.button(label='Copy Keyframe', command=copyKeyframe)
    pm.button(label='Paste Keyframe', command=pasteKeyframe)
    pm.button(label='Playblast', command=PlayblastVideo)
    pm.button(label='Open Graph Editor', command=animationEditor)
    pm.button(label='Show/Hide Nurbs Curves', command=ToggleNurbsCurves)

    cmds.setParent('..')
    seprator1 = cmds.separator(w=400, h=10)

    pm.text(label='')

    pm.formLayout(form, edit=True)
    allowedAreas = ['right', 'left']
    cmds.dockControl('Animation Tools',
                     a='right',
                     con=windowID,
                     aa=allowedAreas)
コード例 #8
0
    def rig(self, component_node, control, object_space, bake_controls = False, default_space = None, use_global_queue = False, **kwargs):
        autokey_state = pm.autoKeyframe(q=True, state=True)
        pm.autoKeyframe(state=False)
        bake_dynamics = not use_global_queue
        use_global_queue = False

        if not super(Overdriver, self).rig(component_node, control, object_space, False, default_space, use_global_queue, **kwargs):
            return False

        driver_control = self.rig_setup(control, object_space)

        object_space = object_space[1] if len(object_space) > 1 else object_space[0]
        self.apply_dynamics(driver_control, object_space, bake_dynamics)

        self.save_animation()
        self.bind_controls()

        pm.autoKeyframe(state=autokey_state)

        return True
コード例 #9
0
    def rig(self,
            skeleton_dict,
            side,
            region,
            world_space=False,
            control_holder_list=None,
            use_global_queue=False,
            additive=False,
            reverse=False,
            **kwargs):
        if not self.valid_check(skeleton_dict, side, region):
            return False

        autokey_state = pm.autoKeyframe(q=True, state=True)
        pm.autoKeyframe(state=False)

        # Start Component Creation
        super(IK, self).rig(skeleton_dict, side, region, world_space,
                            not use_global_queue, **kwargs)

        character_category = v1_core.global_settings.GlobalSettings(
        ).get_category(v1_core.global_settings.CharacterSettings)

        control_grp = self.create_control_grp(side, region)
        maya_utils.node_utils.force_align(self.skel_root, control_grp)
        world_group = self.create_world_grp(side, region)

        rigging_chain = self.network['rigging'].get_connections()
        rigging_chain = rigging.skeleton.sort_chain_by_hierarchy(rigging_chain)

        ik_solved_chain = rigging.skeleton.duplicate_chain(
            rigging_chain, self.namespace, 'ik_solved', self.prefix)
        ik_solved_chain_root = rigging.skeleton.get_chain_root(ik_solved_chain)
        ik_solved_chain_root.setParent(self.network['component'].group)

        ik_solver = 'ikRPsolver' if len(rigging_chain) > 2 else 'ikSCsolver'
        ik_handle, end_effector = pm.ikHandle(
            sj=ik_solved_chain[-1],
            ee=get_first_or_default(ik_solved_chain),
            sol=ik_solver,
            name="{0}{1}_{2}_ikHandle".format(self.namespace, side, region))
        ik_handle.setParent(world_group)
        rigging.skeleton.force_set_attr(ik_handle.visibility, False)

        control_chain = rigging.skeleton.duplicate_chain(
            [get_first_or_default(rigging_chain)], self.namespace, 'control',
            self.prefix)
        control_root = rigging.skeleton.get_chain_root(control_chain)

        check_world_orient_ik = kwargs.get('world_orient_ik') if kwargs.get(
            'world_orient_ik') != None else character_category.world_orient_ik
        if check_world_orient_ik:
            control_root.setParent(None)
            control_root.jointOrient.set([0, 0, 0])
            control_root.rotate.set([0, 0, 0])
        self.network['component'].set('ik_local_orient',
                                      not check_world_orient_ik, 'bool')
        control_root.setParent(world_group)

        self.network['controls'].connect_nodes(control_chain)
        self.create_controls(control_chain, side, region, 'ik_handle',
                             control_holder_list)
        for control in control_chain:
            control_property = metadata.meta_properties.get_property(
                control, metadata.meta_properties.ControlProperty)
            control_property.set('world_space', True, 'bool')

        skel_root = skeleton_dict[side][region]['root']
        skel_end = skeleton_dict[side][region]['end']
        skeleton_chain = rigging.skeleton.get_joint_chain(skel_root, skel_end)
        if len(rigging_chain) > 2:
            pv_position = rigging.skeleton.calculate_pole_vector_position(
                rigging_chain, pm.currentTime())
            pm.select(
                None
            )  # select None to make sure joint doesn't parent to anything
            pv_control = pm.joint(name="{0}control_{1}_{2}_ik_pv".format(
                self.namespace, side, region),
                                  position=pv_position)
            pv_control.setParent(world_group)
            pm.poleVectorConstraint(pv_control, ik_handle)
            self.network['controls'].connect_node(pv_control)
            self.create_controls([pv_control], side, region, 'pv',
                                 control_holder_list)
            pm.controller(
                [pv_control, get_first_or_default(control_chain)], p=True)

            pv_control_property = metadata.meta_properties.get_property(
                pv_control, metadata.meta_properties.ControlProperty)
            pv_control_property.set('world_space', True, 'bool')

        pm.parentConstraint(self.character_root, world_group, mo=True)
        pm.pointConstraint(get_first_or_default(control_chain),
                           ik_handle,
                           mo=False)

        self.attach_component(True)

        if rigging.skeleton.is_animated(skeleton_chain):
            self.attach_and_bake(self.skeleton_dict, use_global_queue)

        if use_global_queue:
            if not additive:
                maya_utils.baking.Global_Bake_Queue().add_post_process(
                    self.save_animation, {})
            maya_utils.baking.Global_Bake_Queue().add_post_process(
                self.bind_chain_process, {
                    'rigging_chain': rigging_chain,
                    'ik_solved_chain': ik_solved_chain,
                    'skeleton_chain': skeleton_chain,
                    'control_chain': control_chain,
                    'additive': additive
                })
        else:
            if not additive:
                self.save_animation()
            self.bind_chain_process(rigging_chain, ik_solved_chain,
                                    skeleton_chain, control_chain, additive)

        pm.autoKeyframe(state=autokey_state)

        return True
コード例 #10
0
def load_from_json(character_network, file_path, side_filter = [], region_filter = []):
    '''
    load_from_json(character_network, file_path)
    Loads a rig configuration json file onto a character.  Reads all rig components from file and applies them
    to the character by region.

    Args:
        character_network (PyNode): The Maya scene character network node for the character to save
        file_path (str): Full file path to the location to save the json file
    '''
    bake_settings = v1_core.global_settings.GlobalSettings().get_category(v1_core.global_settings.BakeSettings)
    user_bake_settings = bake_settings.force_bake_key_range()

    rig_file_path = v1_shared.file_path_utils.full_path_to_relative(file_path)
    character_network.set('rig_file_path', rig_file_path)

    autokey_state = pm.autoKeyframe(q=True, state=True)
    pm.autoKeyframe(state=False)

    start_time = time.clock()

    load_data = v1_core.json_utils.read_json(file_path)

    rigging_data = load_data['rigging']
    addon_data = load_data['addons']

    joint_core_network = character_network.get_downstream(metadata.network_core.JointsCore)
    target_skeleton_dict = rigging.skeleton.get_skeleton_dict( get_first_or_default(joint_core_network.get_connections()) )

    control_holder_list, imported_nodes = rigging.rig_base.Component_Base.import_control_shapes(character_network.group)

    rigging.skeleton.zero_character(get_first_or_default(joint_core_network.get_connections()), ignore_rigged = False)
    rigging.rig_base.Component_Base.zero_all_overdrivers(character_network)
    rigging.rig_base.Component_Base.zero_all_rigging(character_network)

    # Make sure we have a clean queue incase something left items in it unrelated to this file load
    maya_utils.baking.Global_Bake_Queue().clear()

    # Build Components
    set_control_var_dict = {}
    create_time = time.clock()
    created_rigging = {}
    side_iteritems = [(x,y) for x,y in rigging_data.iteritems() if x in side_filter] if side_filter else rigging_data.iteritems()
    for side, region_dict in side_iteritems:
        created_rigging.setdefault(side, {})
        region_iteritems = [(x,y) for x,y in region_dict.iteritems() if x in region_filter] if region_filter else region_dict.iteritems()
        for region, component_dict in region_iteritems:
            component_type = getattr(sys.modules[component_dict['module']], component_dict['type'])
            side_data = target_skeleton_dict.get(side)
            region_data = side_data.get(region) if side_data else None
            if region_data:
                component, did_exist = component_type.rig_from_json(side, region, target_skeleton_dict, component_dict, control_holder_list)
                set_control_var_dict[component.set_control_vars] = component_dict.get('control_vars')
                created_rigging[side][region] = (component, did_exist)
    v1_core.v1_logging.get_logger().info("Rigging Created in {0} Seconds".format(time.clock() - create_time))

    queue_time = time.clock()
    maya_utils.baking.Global_Bake_Queue().run_queue()

    for control_var_method, args in set_control_var_dict.iteritems():
        control_var_method(args)
    v1_core.v1_logging.get_logger().info("Batching Queue Completed in {0} Seconds".format(time.clock() - queue_time))

    rigging.skeleton.zero_character(get_first_or_default(joint_core_network.get_connections()), ignore_rigged = False)
    rigging.rig_base.Component_Base.zero_all_overdrivers(character_network)
    rigging.rig_base.Component_Base.zero_all_rigging(character_network)

    # Make sure we have a clean queue incase something left items in it unrelated to this file load
    maya_utils.baking.Global_Bake_Queue().clear()

    # Build Overdrivers
    addon_time = time.clock()
    side_addon_iteritems = [(x,y) for x,y in addon_data.iteritems() if x in side_filter] if side_filter else addon_data.iteritems()
    for side, region_dict in side_addon_iteritems:
        region_addon_iteritems = [(x,y) for x,y in region_dict.iteritems() if x in region_filter] if region_filter else region_dict.iteritems()
        for region, component_type_dict in region_addon_iteritems:
            for addon, addon_component_dict in component_type_dict.iteritems():
                created_side = created_rigging.get(side)
                created_region = created_side.get(region) if created_side else None
                component, did_exist = created_region if created_region else (None, False)
                target_data = rigging.rig_base.ControlInfo.parse_string(addon_component_dict['target_data'])
                # Continue if the overdriver is attached to a skeleton joint or scene object
                # Otherwise make sure that the rig controls were created before trying to attach to them
                if target_data.control_type == "skeleton" or target_data.control_type == "object":
                    target_region = True
                else:
                    target_side = created_rigging.get(target_data.side)
                    target_region = target_side.get(target_data.region) if target_side else None

                if component and not did_exist and target_region:
                    addon_component_type = getattr(sys.modules[addon_component_dict['module']], addon_component_dict['type'])
                    addon_component = addon_component_type.rig_from_json(component, addon_component_dict, created_rigging)
    v1_core.v1_logging.get_logger().info("Addons Created in {0} Seconds".format(time.clock() - addon_time))

    queue_time = time.clock()
    maya_utils.baking.Global_Bake_Queue().run_queue()
    v1_core.v1_logging.get_logger().info("Batching Queue Completed in {0} Seconds".format(time.clock() - queue_time))

    bake_settings.restore_bake_settings(user_bake_settings)
    pm.delete([x for x in imported_nodes if x.exists()])
    v1_core.v1_logging.get_logger().info("Rigging Completed in {0} Seconds".format(time.clock() - start_time))

    maya_utils.scene_utils.set_current_frame()
    pm.autoKeyframe(state=autokey_state)

    return created_rigging
#endregion 
コード例 #11
0
def load_settings_from_json(character_grp, file_path, binding_list = rigging.settings_binding.Binding_Sets.ALL):
    '''
    Loads a character settings json file onto a character

    Args:
        character_grp (PyNode): A Maya scene node that is the top level group of a character hierarchy
        file_path (str): Full file path to the location to save the json file
        binding_list (list<Binding>): List of all Binding objects to handle saving different settings
    '''
    autokey_state = pm.autoKeyframe(q=True, state=True)
    pm.autoKeyframe(state=False)

    load_data = v1_core.json_utils.read_json(file_path).get('skeleton')

    character_network = metadata.network_core.MetaNode.get_first_network_entry(character_grp, metadata.network_core.CharacterCore)
    joints_network = character_network.get_downstream(metadata.network_core.JointsCore)
    target_namespace = character_grp.namespace()

    # Create any missing joints, parented to world so we know to fill them in next
    if binding_list != rigging.settings_binding.Binding_Sets.PROPERTIES:
        for jnt_name, data in load_data.iteritems():
            if not pm.objExists( target_namespace + jnt_name ):
                v1_core.v1_logging.get_logger().info("Creating Joint - {0}".format(jnt_name))
                pm.select(None) # Clear selection before making joints so no auto-parenting happens
                new_jnt = pm.joint(name = target_namespace + jnt_name)
                pm.addAttr(new_jnt, ln='bind_translate', dt='double3')
                pm.addAttr(new_jnt, ln='bind_rotate', dt='double3')

                rigging.settings_binding.Bind_Translate().load_data(data, new_jnt)
                rigging.settings_binding.Bind_Rotate().load_data(data, new_jnt)

                joints_network.connect_node(new_jnt)
            else:
                jnt = get_first_or_default(pm.ls(target_namespace + jnt_name, type='joint'), default = pm.PyNode(target_namespace + jnt_name))
                target_parent_name = target_namespace + data['parent']
                target_parent = pm.PyNode(target_parent_name) if pm.objExists(target_parent_name) else None
                if jnt.getParent() != None and (jnt.getParent() == target_parent or jnt.getParent() == character_grp):
                    xform_binding_list = []
                    for b in binding_list:
                        if type(b).__name__ in rigging.settings_binding.XForm_Binding.get_inherited_class_strings():
                            xform_binding_list.append(b)
                    for binding in xform_binding_list:
                        binding.load_data(data, jnt, target_namespace)

    load_property_jnt = None
    for jnt_name, data in load_data.iteritems():
        load_property_jnt = pm.PyNode(target_namespace + jnt_name) if pm.objExists(target_namespace + jnt_name) else None
        joint_list = pm.ls(target_namespace + jnt_name, type='joint')
        load_property_jnt = get_first_or_default(joint_list, default = load_property_jnt)
        # If the joint from the settings file exists in the skeleton
        if load_property_jnt:
            # Joints we just made above should be the only ones without a parent
            if load_property_jnt.getParent() == None:
                for binding in rigging.settings_binding.Binding_Sets.NEW_JOINT:
                    binding.load_data(data, load_property_jnt, target_namespace)

            if rigging.settings_binding.Properties_Binding in [type(x) for x in binding_list]:
                rigging.settings_binding.Properties_Binding().load_data(data, load_property_jnt)

    for load_jnt in joints_network.get_connections():
        rigging.skeleton.remove_invalid_rig_markup(load_jnt)

    pm.autoKeyframe(state=autokey_state)
コード例 #12
0
    def build_aim_constraint(self, vm, event_args):
        '''
        get_frame(self, vm, event_args)
        Event method to get the current frame and pass it to C#

        Args:
            vm (Freeform.Rigging.AimConstraintDialogue.AimConstraintDialogueVM): C# view model object sending the command
            event_args (VectorEventArgs): EventArgs to store the vector of which axis to aim along
        '''
        autokey_state = pm.autoKeyframe(q=True, state=True)
        pm.autoKeyframe(state=False)
        event_vector = pm.dt.Vector(event_args.Vector.X, event_args.Vector.Y,
                                    event_args.Vector.Z)

        selection_list = pm.ls(sl=True)
        distance = 100
        if len(selection_list) > 1:
            aim_space = selection_list[0]
            target = selection_list[1]
            distance = maya_utils.node_utils.get_distance(aim_space, target)
        elif len(selection_list) == 1:
            if event_vector == pm.dt.Vector.zero:
                v1_shared.usertools.message_dialogue.open_dialogue(
                    "Auto Option needs both an aim target and aim object selected",
                    "Aim Target Not Selected")
                return
            target = selection_list[0]
            aim_space = pm.spaceLocator(n=target.name() +
                                        "_temp_aimspace_target")
            aim_space.localScale.set(10, 10, 10)

            character_network = metadata.network_core.MetaNode.get_first_network_entry(
                target, metadata.network_core.CharacterCore)
            if character_network:
                scalar = character_network.get('scalar', 'float')
                scalar = 1 if not scalar else scalar
                distance *= scalar
        else:
            v1_shared.usertools.message_dialogue.open_dialogue(
                "Please select something", "Nothing Selected")
            return

        distance = maya_utils.node_utils.convert_scene_units(distance)

        if event_vector == pm.dt.Vector.zero:
            event_vector = rigging.constraints.get_offset_vector(
                target, aim_space)

        aim_parent = aim_space.getParent()

        aim_space.setParent(target)
        aim_space.translate.set(event_vector * distance)
        aim_space.setParent(aim_parent)

        roll_object = pm.duplicate(target, po=True)[0]
        maya_utils.node_utils.unlock_transforms(roll_object)
        roll_object.setParent(None)
        roll_object.rename(target.name() + "_temp_aimspace_roll_object")

        up_object = pm.duplicate(target, po=True)[0]
        maya_utils.node_utils.unlock_transforms(up_object)
        up_object.setParent(roll_object)
        up_object.rename(target.name() + "_temp_aimspace_up_object")

        bake_constraint_list = []
        bake_constraint_list.append(
            pm.parentConstraint(target, aim_space, mo=True))
        bake_constraint_list.append(
            pm.parentConstraint(target, up_object, mo=False))
        maya_utils.baking.bake_objects([aim_space, up_object], True, True,
                                       False)
        pm.delete(bake_constraint_list)

        pm.pointConstraint(target, roll_object, mo=False)

        aim_constraint = rigging.constraints.aim_constraint(
            aim_space, target, up_object, roll_object=roll_object, mo=False)

        pm.select(aim_space, r=True)
        pm.autoKeyframe(state=autokey_state)

        self.vm.Close()
コード例 #13
0
ファイル: mayaSceneUtil.py プロジェクト: clamdragon/SurfRig
 def __exit__(self, *args):
     pmc.autoKeyframe(state=self.state)
コード例 #14
0
    def rig(self,
            skeleton_dict,
            side,
            region,
            world_space=True,
            control_holder_list=None,
            use_global_queue=False,
            additive=False,
            reverse=False,
            **kwargs):
        if not self.valid_check(skeleton_dict, side, region):
            return False

        autokey_state = pm.autoKeyframe(q=True, state=True)
        pm.autoKeyframe(state=False)

        super(ReverseFoot, self).rig(skeleton_dict, side, region, world_space,
                                     not use_global_queue, **kwargs)

        character_category = v1_core.global_settings.GlobalSettings(
        ).get_category(v1_core.global_settings.CharacterSettings)

        control_grp = self.create_control_grp(side, region)
        maya_utils.node_utils.force_align(self.skel_root, control_grp)

        skeleton_chain = self.network['skeleton'].get_connections()
        skeleton_chain = rigging.skeleton.sort_chain_by_hierarchy(
            skeleton_chain)

        rigging_chain = self.network['rigging'].get_connections()
        control_chain = rigging.skeleton.duplicate_chain(
            rigging_chain, self.namespace, 'control', self.prefix)
        rigging.skeleton.reverse_joint_chain(control_chain)

        self.network['controls'].connect_nodes(control_chain)
        control_root = rigging.skeleton.get_chain_root(control_chain)
        control_root.setParent(control_grp)

        rigging_chain = rigging.skeleton.sort_chain_by_hierarchy(rigging_chain)
        control_chain = rigging.skeleton.sort_chain_by_hierarchy(control_chain)
        control_chain.reverse()

        toe_joint = skeleton_chain[-3]
        toe_children = toe_joint.getChildren(type='joint')
        toe_ik_joint = get_first_or_default(
            [x for x in toe_children if x not in skeleton_chain])
        toe_ik_control = None
        if toe_ik_joint:
            toe_ik_control = get_first_or_default(pm.duplicate(toe_ik_joint))
            toe_ik_control.rename(self.namespace + 'control_' +
                                  toe_ik_joint.name())
            toe_ik_control.setParent(get_index_or_default(control_chain, -3))
            self.network['controls'].connect_node(toe_ik_control)

        control_chain_start = get_first_or_default(control_chain)
        control_chain_end = get_last_or_default(control_chain)

        # Orient heel joint to world space
        if character_category.world_orient_ik:
            control_chain[1].setParent(None)
            control_chain_start.setParent(None)
            control_chain_start.jointOrient.set([0, 0, 0])
            control_chain_start.rotate.set([0, 0, 0])
            pm.delete(
                pm.aimConstraint(toe_joint,
                                 control_chain_start,
                                 aim=[0, -1, 0],
                                 upVector=[0, 0, 1],
                                 wut="scene",
                                 mo=False))
            control_chain_start.setParent(control_grp)
            control_chain[1].setParent(control_chain_start)

        delete_chain = rigging_chain[:-3]
        rigging_chain = rigging_chain[-3:]
        pm.delete(delete_chain)

        # toe_ik will be inserted as index 0 (in place of the attach jonit) if it exists, if it doesn't we want to
        # move all control indicies up 1 since we don't allow control of the attach joint
        index_offset = -1
        if toe_ik_joint:
            index_offset = 0
            rigging.skeleton.force_set_attr(toe_ik_joint.visibility, False)
            rigging.skeleton.force_set_attr(toe_ik_control.visibility, True)
            self.create_controls([toe_ik_control], side, region, 'toe_ik',
                                 control_holder_list)
        self.create_controls(control_chain, side, region, 'reverse_fk',
                             control_holder_list, index_offset)

        control_property = metadata.meta_properties.get_property(
            control_chain_start, metadata.meta_properties.ControlProperty)
        control_property.set('world_space', True, 'bool')

        for i, child_control in enumerate(control_chain[:-1]):
            pm.controller([control_chain[i + 1], child_control], p=True)

        ball_ik_handle, end_effector = pm.ikHandle(
            sj=rigging_chain[2],
            ee=rigging_chain[1],
            sol='ikSCsolver',
            name="{0}{1}_{2}_rv_ball_ikHandle".format(self.namespace, side,
                                                      region))
        ball_ik_handle.setParent(control_chain[-2])
        rigging.skeleton.force_set_attr(ball_ik_handle.visibility, False)

        toe_ik_handle, end_effector = pm.ikHandle(
            sj=rigging_chain[1],
            ee=rigging_chain[0],
            sol='ikSCsolver',
            name="{0}{1}_{2}_rv_toe_ikHandle".format(self.namespace, side,
                                                     region))
        ik_parent = toe_ik_control if toe_ik_joint else control_chain[-3]
        toe_ik_handle.setParent(ik_parent)
        rigging.skeleton.force_set_attr(toe_ik_handle.visibility, False)

        control_chain_end.rename(control_chain_end + "_attach")
        self.network['attachment'].connect_node(skeleton_chain[-1])

        for control in control_chain[:-1]:
            rigging.skeleton.force_set_attr(control.visibility, True)

        rigging.skeleton.force_set_attr(control_chain_end.visibility, False)
        rigging.skeleton.force_set_attr(skeleton_chain[-3].visibility, False)

        rigging.skeleton.force_set_attr(rigging_chain[-1].visibility, False)

        rigging.constraints.bind_chains([control_chain_end],
                                        [rigging_chain[2]], self.exclude)

        self.attach_component(True)

        if rigging.skeleton.is_animated(skeleton_chain):
            self.attach_and_bake(self.skeleton_dict, use_global_queue)
            if not use_global_queue:
                rigging.skeleton.remove_animation(skeleton_chain)

        if use_global_queue:
            if not additive:
                maya_utils.baking.Global_Bake_Queue().add_post_process(
                    self.save_animation, {})
            maya_utils.baking.Global_Bake_Queue().add_post_process(
                self.bind_chain_process, {
                    'skeleton_chain': skeleton_chain,
                    'rigging_chain': rigging_chain
                })
        else:
            if not additive:
                self.save_animation()
            self.bind_chain_process(skeleton_chain, rigging_chain)

        pm.autoKeyframe(state=autokey_state)

        return True
コード例 #15
0
                    self.post_process_list)))
            for post_process in self.post_process_list:
                method_time = time.clock()
                method = post_process[0]
                kwargs = post_process[1]
                method(**kwargs)
                v1_core.v1_logging.get_logger().debug(
                    "POST-PROCESS {0} : {1} : Completed in {2} seconds".format(
                        method.__name__, method.__repr__(),
                        time.clock() - method_time))
        except Exception, e:
            exception_text = v1_core.exceptions.get_exception_message()

            v1_core.v1_logging.get_logger().error(exception_text)
        finally:
            pm.autoKeyframe(state=autokey_state)
            self.clear()


def bake_objects(obj_list,
                 translate,
                 rotate,
                 scale,
                 use_settings=True,
                 custom_attrs=None,
                 bake_range=None,
                 **kwargs):
    '''
    Wrapper around pm.bakeResults and sets up the scene to ensure the objects are bake-able and using the user's custom 
    bake settings.
    Note: At the end we set a key at -10000 and value 0 for rotation as a reference point for a eurler filter operation.
コード例 #16
0
    def import_rigs(self, rig_path_list, do_update=False):
        '''
        import_rigs(self, vm, event_args)
        Import the selected character from the UI, transfer animation from the source character, and remove the source
        character to perform a character swap

        Args:
            vm (Freeform.Rigging.CharacterPicker.CharacterPickerVM): C# view model object sending the command
            event_args (ImportRigsEventArgs): Stores the list of selected rig files from the UI
        '''
        if len(rig_path_list) != 1:
            v1_shared.usertools.message_dialogue.open_dialogue(
                "Please Select (1) Character.",
                title="Incorrect Selection Found")
            return

        autokey_state = pm.autoKeyframe(q=True, state=True)
        pm.autoKeyframe(state=False)

        source_network = metadata.network_core.MetaNode.create_from_node(
            self.source_node)
        source_joint_core_network = source_network.get_downstream(
            metadata.network_core.JointsCore)
        source_joint = source_joint_core_network.get_first_connection()
        source_root_joint = rigging.skeleton.get_root_joint(source_joint)
        source_mesh_group_list = [
            x for x in source_network.group.listRelatives()
            if not x.listRelatives(ad=True, type='joint')
        ]
        source_morph_group_list = [
            x for x in source_mesh_group_list if 'morph' in x.name().lower()
            and 'components' not in x.name().lower()
        ]

        for source_morph_group in source_morph_group_list:
            # Remove any file references from the current character so they can be replaced by the imported file
            remove_reference_list = maya_utils.node_utils.get_live_references_from_group(
                source_morph_group)
            for remove_reference in remove_reference_list:
                remove_reference.remove()

        source_namespace = source_root_joint.namespace()
        if not source_namespace:
            source_namespace = "transfer:"
            if not pm.namespace(exists="transfer"):
                pm.namespace(add="transfer")

        # importing a file with a reference will parent referenced objects under the current scene node if name matches
        # change namespace before that so new references will parent correctly
        pm.namespace(
            rename=[source_namespace, source_namespace[:-1] + "_temp"])

        playback_values = maya_utils.node_utils.get_playback()
        super(RigSwapper, self).import_rigs(rig_path_list, do_update)
        maya_utils.node_utils.set_playback(playback_values)

        character_node_list = [
            x for x in pm.ls(self.new_nodes.values()[0], type='network')
            if x.meta_type.get() == str(metadata.network_core.CharacterCore)
        ]
        if len(character_node_list) == 1:
            character_node = get_first_or_default(character_node_list)
        else:
            character_node = get_first_or_default([
                x for x in character_node_list
                if 'head' not in x.character_name.get().lower()
            ])
        character_network = metadata.network_core.MetaNode.create_from_node(
            character_node)
        joint_core_network = character_network.get_downstream(
            metadata.network_core.JointsCore)
        character_joint = joint_core_network.get_first_connection()
        character_root_joint = rigging.skeleton.get_root_joint(character_joint)

        source_root_properties = metadata.meta_properties.get_properties_dict(
            source_root_joint)
        animation_asset_list = source_root_properties.get(
            metadata.meta_properties.CharacterAnimationAsset)
        if animation_asset_list:
            for animation_asset in animation_asset_list:
                animation_asset.disconnect_node(source_root_joint)
                animation_asset.connect_node(character_root_joint)

        self.transfer_skeleton_and_model(source_network, character_network)

        pm.autoKeyframe(state=autokey_state)

        scene_tools.scene_manager.SceneManager().run_by_string('RiggerUI')
        self.vm.Close()

        if self.post_process:
            self.post_process(self.new_nodes)

        head_node = [
            x for x in character_node_list if 'head' in x.name().lower()
        ]

        return [self.source_node, head_node[0]
                ] if head_node else [self.source_node]
コード例 #17
0
    def switch_PS_tankard(self, x):

        self.logger.debug('--- switch_PS_tankard()')

        tmp_sel = pm.ls(sl = True)
        self.logger.debug('selection: ' + str(tmp_sel))
        
        if tmp_sel[0] != (self.namespace_tankard + self.root_obj_tankard):

            pm.warning('Select root controller of initialized tankard or initialize selected!')

        else:

            sel_val = pm.optionMenu('optionMenu_tankard', query = True, value = True)
            sel_item = pm.optionMenu('optionMenu_tankard', query = True, select = True)
            
            self.logger.debug(sel_val)
            self.logger.debug(sel_item)

            if sel_item == 1:

                pm.warning('Select parent space!')
                return

            tmp_oldTrans = pm.xform(self.switch_obj_tankard, ws = 1, q = 1, t = 1)
            tmp_oldRot = pm.xform(self.switch_obj_tankard, ws = 1, q = 1, ro = 1)
            self.logger.debug(tmp_oldTrans)

            currentTime = pm.currentTime()
            autoKeyState = pm.autoKeyframe(q = True, state = True)

            self.logger.debug(currentTime)
            self.logger.debug(autoKeyState)

            if autoKeyState:
                pm.autoKeyframe(state = 0)

            pm.setKeyframe(self.switch_obj_tankard, time = currentTime - 1)
            pm.setKeyframe(self.switch_attr_tankard, time = currentTime - 1)
            
            self.logger.debug('---if')

            for iterator, obj in enumerate(self.follow_values):
                if sel_val == obj:
                    pm.setAttr(self.switch_attr_tankard, iterator)

            tmp_trans = pm.xform(self.switch_obj_tankard, ws = 1, q = 1, t = 1)
            tmp_rot = pm.xform(self.switch_obj_tankard, ws = 1, q = 1, ro = 1)
            self.logger.debug(tmp_trans)

            pm.xform(self.switch_obj_tankard, ws = 1, t = tmp_oldTrans)
            pm.xform(self.switch_obj_tankard, ws = 1, ro = tmp_oldRot)        

            tmp_trans = pm.xform(self.switch_obj_tankard, ws=1, q=1, t=1)
            self.logger.debug(tmp_trans)

            pm.setKeyframe(self.switch_obj_tankard, time = currentTime)
            pm.setKeyframe(self.switch_attr_tankard, time = currentTime)
            
            if autoKeyState:
                pm.autoKeyframe(state = 1)

        self.logger.debug('--- DONE: switch(): ')
コード例 #18
0
    def export_fbx(self, time_range):
        sys.stdout.write('# Preparing to write FBX file...\n')

        # maybe autokeyframe messes up something
        autoKeyState = bool(pm.autoKeyframe(q=True, state=True))
        pm.autoKeyframe(state=False)

        # set fbx options
        try:
            pm.mel.eval('FBXResetExport'
                        )  # reset any user preferences so we start clean
            pm.mel.eval('FBXExportAnimationOnly -v %d' %
                        int(self.animation_only_checkbox.isChecked()))
            pm.mel.eval('FBXExportBakeComplexAnimation -v 0')
            pm.mel.eval('FBXExportBakeComplexStart -v %d' % time_range[0])
            pm.mel.eval('FBXExportBakeComplexEnd -v %d' % time_range[1])
            pm.mel.eval('FBXExportBakeResampleAnimation -v 0')
            pm.mel.eval('FBXExportCameras -v 1')
            pm.mel.eval('FBXExportConstraints -v %d' %
                        int(self.constraints_checkbox.isChecked()))
            pm.mel.eval('FBXExportLights -v 1')
            pm.mel.eval('FBXExportQuaternion -v quaternion')
            pm.mel.eval('FBXExportAxisConversionMethod none')
            pm.mel.eval('FBXExportApplyConstantKeyReducer -v 0')
            pm.mel.eval('FBXExportSmoothMesh -v 0'
                        )  # do not export subdivision version
            pm.mel.eval(
                'FBXExportShapes -v 1')  # needed for skins and blend shapes
            pm.mel.eval('FBXExportSkins -v 1')
            pm.mel.eval('FBXExportSkeletonDefinitions -v 1')
            pm.mel.eval('FBXExportEmbeddedTextures -v 0')
            pm.mel.eval('FBXExportInputConnections -v %d' %
                        int(self.input_connections_checkbox.isChecked()))
            pm.mel.eval('FBXExportInstances -v 1'
                        )  # preserve instances by sharing same mesh
            pm.mel.eval('FBXExportUseSceneName -v 1')
            pm.mel.eval(
                'FBXExportSplitAnimationIntoTakes -c')  # clear previous clips

            if self.animation_clip_checkbox.isChecked():
                for row in self.clip_data:
                    pm.mel.eval(
                        'FBXExportSplitAnimationIntoTakes -v \"%s\" %f %f' %
                        (str(row[0]), int(float(row[1])), int(float(row[2]))))

            pm.mel.eval('FBXExportGenerateLog -v 0')
            pm.mel.eval('FBXExportInAscii -v 0')
        except Exception as e:
            sys.stdout.write(str(e) + '\n')

        # save the fbx
        f = self.save_dir + '/' + self.file_name

        d = os.path.dirname(f)
        if not os.path.isdir(d):
            try:
                os.makedirs(d)
            except Exception as e:
                sys.stdout.write(str(e) + '\n')
                return

        # maya.utils.processIdleEvents()

        try:
            pm.mel.eval('FBXExport -f "%s" -s' % f)
        except Exception as e:
            sys.stdout.write(str(e) + '\n')

        maya.utils.processIdleEvents()

        sys.stdout.write('# Saved fbx to: %s\n' % f)
        pm.autoKeyframe(state=autoKeyState)
コード例 #19
0
    def switch_space(self, vm, event_args):
        '''
        switch_space(self, vm, event_args)
        Event method to get the current frame and pass it to C#

        Args:
            vm (Freeform.Rigging.RigSwitcher.RigSwitcherVM): C# view model object sending the command
            event_args (SwitchSpaceEventArgs): EventArgs to store space to switch to, start and end frames
        '''
        # This could be moved to a being set on a UI event on combo box selection
        self.component = rigging.rig_base.Component_Base.create_from_network_node(
            self.index_rig_dict[event_args.Space].node)

        start_frame = event_args.StartFrame
        end_frame = event_args.EndFrame
        if start_frame > end_frame:
            return None

        if start_frame == end_frame:
            start_frame = int(pm.playbackOptions(q=True, ast=True))
            end_frame = int(pm.playbackOptions(q=True, aet=True))

        component_jnt = self.component.network.get(
            'skeleton').get_first_connection()
        component_network_list = rigging.skeleton.get_active_rig_network(
            component_jnt)

        constraint_attr_list = []
        for jnt in self.component.network.get('skeleton').get_connections():
            for constraint in list(set(
                    jnt.listConnections(type='constraint'))):
                constraint_attr_list.extend(
                    constraint.listAttr(ud=True, k=True))

        control_list = self.component.network.get('controls').get_connections()

        # Bake animation to the swapping component within the keyframe
        pm.refresh(su=True)
        autokey_state = pm.autoKeyframe(q=True, state=True)
        pm.autoKeyframe(state=False)
        try:
            # Bookend keys in the current rig component space
            if event_args.KeySwitch:
                self.component.match_to_skeleton([start_frame, end_frame],
                                                 True)

                pm.currentTime(start_frame - 1)
                pm.setKeyframe(constraint_attr_list)
                pm.setKeyframe(control_list)

                pm.currentTime(end_frame + 1)
                pm.setKeyframe(constraint_attr_list)
                pm.setKeyframe(control_list)

                # Key the switch to the new driving component
                pm.currentTime(start_frame)
                self.component.switch_current_component()
                pm.setKeyframe(constraint_attr_list)

                pm.currentTime(end_frame)
                self.component.switch_current_component()
                pm.setKeyframe(constraint_attr_list)
            else:
                self.component.switch_current_component()

        except Exception, e:
            exception_info = sys.exc_info()
            v1_core.exceptions.except_hook(exception_info[0],
                                           exception_info[1],
                                           exception_info[2])
コード例 #20
0
ファイル: ribbon.py プロジェクト: V1Interactive/FreeformTools
    def rig(self,
            skeleton_dict,
            side,
            region,
            world_space=False,
            control_holder_list=None,
            use_global_queue=False,
            additive=False,
            reverse=False,
            **kwargs):
        self.reverse = reverse

        autokey_state = pm.autoKeyframe(q=True, state=True)
        pm.autoKeyframe(state=False)

        super(Ribbon, self).rig(skeleton_dict, side, region, world_space,
                                not use_global_queue, **kwargs)

        if kwargs.get("up_axis"):
            self.up_axis = kwargs.get("up_axis")

        self.network['component'].set("up_axis", self.up_axis)

        control_grp = self.create_control_grp(side, region)
        maya_utils.node_utils.force_align(self.skel_root, control_grp)
        world_goup = self.create_world_grp(side, region)

        rigging_chain = self.network['rigging'].get_connections()
        rigging_chain = rigging.skeleton.sort_chain_by_hierarchy(rigging_chain)
        skeleton_chain = self.network['skeleton'].get_connections()
        skeleton_chain = rigging.skeleton.sort_chain_by_hierarchy(
            skeleton_chain)

        # Measure all joints to create ribbon at the right length
        ribbon_length = 0
        for i in range(len(rigging_chain) - 1):
            pos_start = pm.dt.Vector(
                pm.xform(rigging_chain[i], q=True, ws=True, t=True))
            pos_end = pm.dt.Vector(
                pm.xform(rigging_chain[i + 1], q=True, ws=True, t=True))
            ribbon_length += (pos_end - pos_start).length()
        number_of_follicles = len(rigging_chain)

        ribbon, follicle_list = self.create_ribbon(ribbon_length,
                                                   number_of_follicles)
        ribbon.setParent(world_goup)
        rigging.skeleton.force_set_attr(ribbon.visibility, False)
        for follicle in follicle_list:
            follicle.getParent().setParent(world_goup)

        control_chain = self.create_ribbon_controls(rigging_chain)
        self.align_ribbon_controls(control_chain, rigging_chain, ribbon,
                                   follicle_list)
        control_zero_list = self.create_controls(control_chain, side, region,
                                                 self.prefix,
                                                 control_holder_list)
        for control_zero in control_zero_list:
            control_zero.setParent(control_grp)

        pm.parentConstraint(self.character_root, world_goup, mo=True)

        self.attach_component(True)
        if rigging.skeleton.is_animated(skeleton_chain):
            self.attach_and_bake(self.skeleton_dict, use_global_queue)

        if use_global_queue:
            if not additive:
                maya_utils.baking.Global_Bake_Queue().add_post_process(
                    self.save_animation, {})
            maya_utils.baking.Global_Bake_Queue().add_post_process(
                self.bind_chain_process, {
                    'skeleton_chain': skeleton_chain,
                    'follicle_list': follicle_list,
                    'additive': additive
                })
        else:
            if not additive:
                self.save_animation()
            self.bind_chain_process(skeleton_chain, follicle_list, additive)

        pm.autoKeyframe(state=autokey_state)

        return True
コード例 #21
0
    def run_queue(self):
        '''
        Runs all commands in the queue in the order of pre-process, queue, post_process
        '''
        autokey_state = pm.autoKeyframe(q=True, state=True)
        pm.autoKeyframe(state=False)

        try:
            if not (self.queue or self.pre_process_list
                    or self.post_process_list):
                return

            v1_core.v1_logging.get_logger().info(
                "============     Bake Queue Running - {0}     ============".
                format(self.name))
            constraint_list = []
            v1_core.v1_logging.get_logger().debug(
                "Running {0} Pre-Processes".format(len(self.pre_process_list)))

            priority_dict = {}
            for pre_process in self.pre_process_list:
                priority_dict.setdefault(pre_process[2], [])
                priority_dict[pre_process[2]].append(pre_process[:2])

            key_priority = priority_dict.keys()
            key_priority.sort()

            for key in key_priority:
                for pre_process in priority_dict[key]:
                    method = pre_process[0]
                    kwargs = pre_process[1]
                    method_time = time.clock()
                    constraint_list = constraint_list + method(**kwargs)
                    v1_core.v1_logging.get_logger().debug(
                        "PRE-PROCESS {0} : {1} : Completed in {2} seconds".
                        format(method.__name__, method.__repr__(),
                               time.clock() - method_time))

            v1_core.v1_logging.get_logger().debug(
                "Running {0} Bake Processes".format(len(self.queue.values())))
            for method, obj_list, kwargs in self.queue.itervalues():
                method_time = time.clock()
                if obj_list:
                    method(obj_list, **kwargs)
                else:
                    method(**kwargs)
                v1_core.v1_logging.get_logger().debug(
                    "BAKE PROCESS {0} : {1} : Completed in {2} seconds".format(
                        method.__name__, method.__repr__(),
                        time.clock() - method_time))

            pm.delete(constraint_list)

            v1_core.v1_logging.get_logger().debug(
                "Running {0} Post-Processes".format(len(
                    self.post_process_list)))
            for post_process in self.post_process_list:
                method_time = time.clock()
                method = post_process[0]
                kwargs = post_process[1]
                method(**kwargs)
                v1_core.v1_logging.get_logger().debug(
                    "POST-PROCESS {0} : {1} : Completed in {2} seconds".format(
                        method.__name__, method.__repr__(),
                        time.clock() - method_time))
        except Exception, e:
            exception_text = v1_core.exceptions.get_exception_message()

            v1_core.v1_logging.get_logger().error(exception_text)
コード例 #22
0
ファイル: mayaSceneUtil.py プロジェクト: clamdragon/SurfRig
 def __enter__(self):
     self.state = pmc.autoKeyframe(q=True, state=True)
     pmc.autoKeyframe(state=False)