コード例 #1
0
def _get_settings_for_animation(robot):
    """
    Get the animation parameters start frame, end frame, framerate, and total time
    in seconds from Maya.
    :return:
    """
    start_frame = pm.intField("i_programStartFrame", query=True, value=True)
    end_frame = pm.intField("i_programEndFrame", query=True, value=True)
    framerate = mimic_utils.get_maya_framerate()

    # Define the animation time in seconds.
    animation_time_sec = ((end_frame) - start_frame) / framerate

    # Raise warning if end frame and start frame incompatible
    if end_frame <= start_frame:
        warning = 'End Frame must be larger than Start Frame'
        raise mimic_utils.MimicError(warning)

    # Create output dictionary
    animation_settings = {
        'Start Frame': start_frame,
        'End Frame': end_frame,
        'Framerate': framerate,
        'Animation Time (sec)': animation_time_sec
    }
    return animation_settings
コード例 #2
0
def _get_settings_for_animation(robot):
    """
    Get the animation parameters start frame, end frame, framerate, and total time
    in seconds from Maya.
    :return:
    """
    start_frame = pm.intField("i_programStartFrame", query=True, value=True)
    end_frame = pm.intField("i_programEndFrame", query=True, value=True)
    framerate = mimic_utils.get_maya_framerate()

    # Define the animation time in seconds.
    animation_time_sec = ((end_frame) - start_frame) / framerate

    # Raise warning if end frame and start frame incompatible
    if end_frame <= start_frame:
        warning = 'End Frame must be larger than Start Frame'
        raise mimic_utils.MimicError(warning)

    '''
    # Raise warning if no keyframes are set
    closest_ik_key = mimic_utils.get_closest_ik_keyframe(robot, start_frame)[0]
    if not type(closest_ik_key) == float:
        warning = 'You must set an IK or FK keyframe to ensure ' \
                  'proper evaluation when saving a program; ' \
                  'no program written'
        raise mimic_utils.MimicError(warning)
    '''
    # All good, create output dictionary
    animation_settings = {'Start Frame': start_frame,
                          'End Frame': end_frame,
                          'Framerate': framerate,
                          'Animation Time (sec)': animation_time_sec}
    return animation_settings