Exemple #1
0
def replace_reference(select_info, prefix, options):
    from tactic_load import load_anim, load
    # quick hack
    '''
    if options.find("connection=file system") != -1:
        options = "load_mode=replace|connection=file system"
    else:
        options = "load_mode=replace|connection=http"
    '''
    info = TacticInfo.get()
    server = info.get_xmlrpc_server()
    ticket = info.get_ticket()

    option_dict = Common.get_option_dict(options)
    option_dict['load_mode'] = 'replace'

    # check if user wants to pick a node to update
    user_selected_nodes = []
    if option_dict.get('replace_selected') == 'true':
        user_selected_nodes = info.get_app().get_selected_nodes()
        if not user_selected_nodes:
            raise TacticException(
                'A minimum of 1 node must be selected for this "replace selected reference" operation'
            )

    # some instance reference is actually just replace assets from model pipeline
    # In that case, there are only 4 items
    items = select_info.split("|")
    if prefix == 'prod/shot_instance' and len(items) == 6:
        snapshot_code, shot_code, instance, context, ns, snap_node_name = \
            select_info.split("|")
        if not user_selected_nodes:
            user_selected_nodes = [snap_node_name]

        for user_selected_node in user_selected_nodes:
            node_name = _check_node_exists(user_selected_node, ns)
            if node_name:
                option_dict['replacee'] = node_name
            options = Common.get_option_str(option_dict)
            load_anim(snapshot_code, shot_code, instance, context, options)

    else:
        # this assumes only 1 instance of this asset exist
        snapshot_code, context, ns, snap_node_name = select_info.split("|")

        if not user_selected_nodes:
            user_selected_nodes = [snap_node_name]

        for user_selected_node in user_selected_nodes:
            node_name = _check_node_exists(user_selected_node, ns)

            if node_name:
                option_dict['replacee'] = node_name
            options = Common.get_option_str(option_dict)
            load(snapshot_code, context, options)
Exemple #2
0
def replace_reference(select_info, prefix, options):
    from tactic_load import load_anim, load
    # quick hack
    '''
    if options.find("connection=file system") != -1:
        options = "load_mode=replace|connection=file system"
    else:
        options = "load_mode=replace|connection=http"
    '''
    info = TacticInfo.get() 
    server = info.get_xmlrpc_server()
    ticket = info.get_ticket()
   
    option_dict  = Common.get_option_dict(options)
    option_dict['load_mode'] = 'replace'

    
    # check if user wants to pick a node to update
    user_selected_nodes = []
    if option_dict.get('replace_selected') =='true':
        user_selected_nodes = info.get_app().get_selected_nodes()
        if not user_selected_nodes:
            raise TacticException('A minimum of 1 node must be selected for this "replace selected reference" operation')

    # some instance reference is actually just replace assets from model pipeline
    # In that case, there are only 4 items
    items = select_info.split("|")
    if prefix =='prod/shot_instance' and len(items) == 6:
        snapshot_code, shot_code, instance, context, ns, snap_node_name = \
            select_info.split("|")
        if not user_selected_nodes:
            user_selected_nodes = [snap_node_name]

        for user_selected_node in user_selected_nodes:
            node_name = _check_node_exists(user_selected_node, ns) 
            if node_name:
                option_dict['replacee']= node_name
            options = Common.get_option_str(option_dict)
            load_anim(snapshot_code, shot_code, instance, context, options)
       

    else:
        # this assumes only 1 instance of this asset exist
        snapshot_code, context, ns, snap_node_name = select_info.split("|")
        
        if not user_selected_nodes:
            user_selected_nodes = [snap_node_name]

        for user_selected_node in user_selected_nodes:
            node_name = _check_node_exists(user_selected_node, ns) 

            if node_name:
                option_dict['replacee']= node_name
            options = Common.get_option_str(option_dict)
            load(snapshot_code, context, options)
Exemple #3
0
def update(select_info, is_anim, options):

    from tactic_load import load_anim, load

    # remove the set
    delete(select_info, is_anim)

    # and reload it
    if is_anim =='instance':
        snapshot_code, shot_code, instance, context, ns, snap_node_name = select_info.split("|")
        load_anim(snapshot_code, shot_code, instance, context, options)
    else:
        # this assumes only 1 instance of this asset exist
        snapshot_code, context, ns, snap_node_name = select_info.split("|")
        load(snapshot_code, context, options)
Exemple #4
0
def update(select_info, is_anim, options):

    from tactic_load import load_anim, load

    # remove the set
    delete(select_info, is_anim)

    # and reload it
    if is_anim == 'instance':
        snapshot_code, shot_code, instance, context, ns, snap_node_name = select_info.split(
            "|")
        load_anim(snapshot_code, shot_code, instance, context, options)
    else:
        # this assumes only 1 instance of this asset exist
        snapshot_code, context, ns, snap_node_name = select_info.split("|")
        load(snapshot_code, context, options)