Ejemplo n.º 1
0
def get_solver_steps_from_collection(col):
    """
    Load all steps from collection.

    :param col: The Collection to query.
    :type col: Collection

    :rtype: list of SolverStep
    """
    assert isinstance(col, mmapi.Collection)
    if col is None:
        return []
    node = col.get_node()
    if maya.cmds.objExists(node) is False:
        return []
    data_list = col_state.get_value_structure_from_node(
        col.get_node(),
        const.SOLVER_STEP_ATTR,
        attr_type=const.SOLVER_STEP_ATTR_TYPE,
        default_value=const.SOLVER_STEP_DEFAULT_VALUE,
    )
    if data_list is None:
        data_list = list()
    step_list = [solver_step.SolverStep(d) for d in data_list]
    return step_list
Ejemplo n.º 2
0
def create_solver_step():
    data = const.SOLVER_STEP_DATA_DEFAULT.copy()

    data['name'] = str(uuid.uuid4())

    start, end = maya_utils.get_timeline_range_inner()
    frame_list = list(xrange(start, end + 1))
    data['frame_list'] = frame_list

    step = solver_step.SolverStep(data=data)
    return step
Ejemplo n.º 3
0
def get_solver_steps_from_collection(col):
    """
    Load all steps from collection.

    :param col: The Collection to query.
    :type col: Collection

    :rtype: list of SolverStep
    """
    node = col.get_node()
    ensure_solver_steps_attr_exists(col)
    data_list = mmapi.get_data_on_node_attr(node, const.SOLVER_STEP_ATTR)
    step_list = map(lambda x: solver_step.SolverStep(x), data_list)
    return step_list
Ejemplo n.º 4
0
def create_solver_step():
    """
    Create a SolverStep object and return it.
    """
    data = const.SOLVER_STEP_DATA_DEFAULT.copy()

    data['name'] = str(uuid.uuid4())

    start, end = utils_time.get_maya_timeline_range_inner()
    frame_list = list(range(start, end + 1))
    data['frame_list'] = frame_list

    step = solver_step.SolverStep(data=data)
    return step
Ejemplo n.º 5
0
def get_solver_steps_from_collection(col):
    """
    Load all steps from collection.

    :param col: The Collection to query.
    :type col: Collection

    :rtype: list of SolverStep
    """
    assert isinstance(col, mmapi.Collection)
    if col is None:
        return []
    node = col.get_node()
    if maya.cmds.objExists(node) is False:
        return []
    ensure_solver_steps_attr_exists(col)
    data_list = mmapi.get_data_on_node_attr(node, const.SOLVER_STEP_ATTR)
    step_list = [solver_step.SolverStep(d) for d in data_list]
    return step_list