コード例 #1
0
ファイル: asset_loader_wdg.py プロジェクト: 0-T-0/TACTIC
    def get_title(my):
        mode = my.get_option("mode")
        if mode == "input":
            return "Input"


        widget = Widget()

        float_menu = WebContainer.get_float_menu()
        icon = float_menu.get_icon()
        widget.add(SpanWdg(icon, css='small'))

        #widget.add(super(AssetLoaderWdg,my).get_title())
        my.shot = ProdContext.get_shot()

        load_button = ProdIconButtonWdg("Load", long=True)
        load_button.set_id(my.LOAD_BUTTON_ID)
        prefix = my.PREFIX
        load_button.add_behavior({"type": "click_up", \
            "cbjs_action":
            "setTimeout(function() { load_selected_snapshots_cbk('%s', '%s', bvr)}, 200)" \
            % (prefix, my.CB_NAME)
            })
        widget.add(load_button)

        update_button = ProdIconButtonWdg("Update", long=True)
        update_button.add_event("onclick", "setTimeout(function() {py_replace_reference('%s','%s')}, 200)" % \
            (prefix, my.CB_NAME))
        widget.add(update_button)

        # get the session
        my.session = SessionContents.get()
        
        return widget
コード例 #2
0
ファイル: asset_loader_wdg.py プロジェクト: rajubuddha/TACTIC
    def get_title(my):
        mode = my.get_option("mode")
        if mode == "input":
            return "Input"

        widget = Widget()

        float_menu = WebContainer.get_float_menu()
        icon = float_menu.get_icon()
        widget.add(SpanWdg(icon, css='small'))

        #widget.add(super(AssetLoaderWdg,my).get_title())
        my.shot = ProdContext.get_shot()

        load_button = ProdIconButtonWdg("Load", long=True)
        load_button.set_id(my.LOAD_BUTTON_ID)
        prefix = my.PREFIX
        load_button.add_behavior({"type": "click_up", \
            "cbjs_action":
            "setTimeout(function() { load_selected_snapshots_cbk('%s', '%s', bvr)}, 200)" \
            % (prefix, my.CB_NAME)
            })
        widget.add(load_button)

        update_button = ProdIconButtonWdg("Update", long=True)
        update_button.add_event("onclick", "setTimeout(function() {py_replace_reference('%s','%s')}, 200)" % \
            (prefix, my.CB_NAME))
        widget.add(update_button)

        # get the session
        my.session = SessionContents.get()

        return widget
コード例 #3
0
ファイル: asset_loader_wdg.py プロジェクト: 0-T-0/TACTIC
    def get_title(my):
        mode = my.get_option("mode")
        if mode == "input":
            return "Input"

        widget = SpanWdg()
        #widget.add(super(AssetLoaderWdg,my).get_title())
        
        widget.set_attr("nowrap", "1")
        load_button = ProdIconButtonWdg("Load Shot")
        load_button.set_id(my.LOAD_BUTTON_ID) 
        prefix = my.PREFIX
        load_button.add_behavior(
                {'type': "click_up", 
                "cbjs_action":
                "setTimeout(function() {load_selected_snapshots_cbk('%s', '%s', bvr)}, 200) " \
                % (prefix, my.CB_NAME) \
                })
        widget.add(load_button)

        #multiplier = HiddenWdg()
        #multiplier.set_id("load_multiplier")
        #multiplier.set_value("1")
        #widget.add( multiplier )
        # xsi doesn't reference shot in now
        if WebContainer.get_web().get_selected_app() != 'XSI':
            update_button = ProdIconButtonWdg("Update", long=True)
           
            prefix = my.PREFIX
            update_button.add_event("onclick", "setTimeout( function() {py_replace_reference('%s','%s')}, 200)" % \
                (prefix, my.CB_NAME))

            widget.add(update_button)


        # Get the session. This overrides what is run in preprocess()
        my.session = SessionContents.get(asset_mode=True)

        return widget
コード例 #4
0
ファイル: asset_loader_wdg.py プロジェクト: rajubuddha/TACTIC
    def get_title(my):
        mode = my.get_option("mode")
        if mode == "input":
            return "Input"

        widget = SpanWdg()
        #widget.add(super(AssetLoaderWdg,my).get_title())

        widget.set_attr("nowrap", "1")
        load_button = ProdIconButtonWdg("Load Shot")
        load_button.set_id(my.LOAD_BUTTON_ID)
        prefix = my.PREFIX
        load_button.add_behavior(
                {'type': "click_up",
                "cbjs_action":
                "setTimeout(function() {load_selected_snapshots_cbk('%s', '%s', bvr)}, 200) " \
                % (prefix, my.CB_NAME) \
                })
        widget.add(load_button)

        #multiplier = HiddenWdg()
        #multiplier.set_id("load_multiplier")
        #multiplier.set_value("1")
        #widget.add( multiplier )
        # xsi doesn't reference shot in now
        if WebContainer.get_web().get_selected_app() != 'XSI':
            update_button = ProdIconButtonWdg("Update", long=True)

            prefix = my.PREFIX
            update_button.add_event("onclick", "setTimeout( function() {py_replace_reference('%s','%s')}, 200)" % \
                (prefix, my.CB_NAME))

            widget.add(update_button)

        # Get the session. This overrides what is run in preprocess()
        my.session = SessionContents.get(asset_mode=True)

        return widget
コード例 #5
0
ファイル: asset_loader_wdg.py プロジェクト: 0-T-0/TACTIC
    def get_bottom(my):
        if my.get_option('mode') =='input':
            return 
        web = WebContainer.get_web()
        if web.get_selected_app() not in ['XSI','Maya']:
            return
        div = DivWdg( css='spt_outdated_ref')
       

        refs = my.session.get_data().get_nodes("session/node/ref")
        snap_codes = []
        snap_contexts = []
        sobjects = []
        session_data_dict = {}
        asset_codes = []
        current_snapshots = []
        node_names = []
        session_versions = []
        for ref in refs:
            snap_code = Xml.get_attribute(ref, "asset_snapshot_code")
            node_name = Xml.get_attribute(ref, "name")
            version = Xml.get_attribute(ref, "asset_snapshot_version")
            asset_code = Xml.get_attribute(ref, "asset_code")
            if snap_code in snap_codes:
                continue
            snap_codes.append(snap_code)
            snap_contexts.append(Xml.get_attribute(ref, "asset_snapshot_context"))
            asset_codes.append(asset_code)
            session_data_dict[snap_code] = version, node_name  
        
        
        # must search one by one
        warnings=[]
        for idx, snap_code in enumerate(snap_codes):
            snapshot = Snapshot.get_by_code(snap_code)
            if not snapshot:
                continue
            search_type = snapshot.get_value('search_type')
            search_id = snapshot.get_value('search_id')
            current_snapshot = Snapshot.get_snapshot(search_type, search_id, context=snap_contexts[idx], version=0)
            if not current_snapshot:
                warnings.append("Current version for [%s|%s] context [%s] not found" %(search_type, search_id, snap_contexts[idx]))
                continue
            session_version, node_name  = session_data_dict.get(snap_code)
            if session_version and int(current_snapshot.get_version()) > int(session_version):
                current_snapshots.append(current_snapshot)
                sobjects.append(current_snapshot.get_sobject())
                node_names.append(node_name)
                session_versions.append(int(session_version))
        

        title = DivWdg('Outdated References')
        title.add_style('text-decoration','underline')
        div.add(title)

        # draw the nodes to be udpated
        for idx, current_snap in enumerate(current_snapshots):
            
            cb = CheckboxWdg(my.REF_CB_NAME)
            cb.add_class('spt_ref')
            cb.add_style('display: none')
            sobj = sobjects[idx]
            node_name = node_names[idx]
            session_version = session_versions[idx]
            snapshot = current_snap
            cb_value = my.get_input_value(sobj, snapshot)
            items = cb_value.split('|')
            items[-1] = node_name
            cb_value = '|'.join(items)
            cb.set_option('value', cb_value)
            div.add(cb)
            
            div.add('%0.1d. %s v%0.3d -> v%0.3d\n' \
                %(idx+1, node_name, session_version, snapshot.get_version()))
            div.add(HtmlElement.br())

        for warning in warnings:
            div.add(SpanWdg(warning, css='warning'))
        div.add(HtmlElement.br())
        if current_snapshots:
            # add the button
            prefix = my.PREFIX 
            update_button = ProdIconButtonWdg("Update all references")
            update_button.add_behavior({'type': "click_up",\
            'cbjs_action': '''var cousins = bvr.src_el.getParent('.spt_outdated_ref').getElements('.spt_ref');
                             cousins.each( function(x) {x.checked=true;}); py_replace_reference('%s','%s')'''
                    % (prefix, my.REF_CB_NAME)})
            div.add( SpanWdg(update_button, css='small'))
        
        return div
コード例 #6
0
ファイル: asset_loader_wdg.py プロジェクト: rajubuddha/TACTIC
    def get_bottom(my):
        if my.get_option('mode') == 'input':
            return
        web = WebContainer.get_web()
        if web.get_selected_app() not in ['XSI', 'Maya']:
            return
        div = DivWdg(css='spt_outdated_ref')

        refs = my.session.get_data().get_nodes("session/node/ref")
        snap_codes = []
        snap_contexts = []
        sobjects = []
        session_data_dict = {}
        asset_codes = []
        current_snapshots = []
        node_names = []
        session_versions = []
        for ref in refs:
            snap_code = Xml.get_attribute(ref, "asset_snapshot_code")
            node_name = Xml.get_attribute(ref, "name")
            version = Xml.get_attribute(ref, "asset_snapshot_version")
            asset_code = Xml.get_attribute(ref, "asset_code")
            if snap_code in snap_codes:
                continue
            snap_codes.append(snap_code)
            snap_contexts.append(
                Xml.get_attribute(ref, "asset_snapshot_context"))
            asset_codes.append(asset_code)
            session_data_dict[snap_code] = version, node_name

        # must search one by one
        warnings = []
        for idx, snap_code in enumerate(snap_codes):
            snapshot = Snapshot.get_by_code(snap_code)
            if not snapshot:
                continue
            search_type = snapshot.get_value('search_type')
            search_id = snapshot.get_value('search_id')
            current_snapshot = Snapshot.get_snapshot(
                search_type, search_id, context=snap_contexts[idx], version=0)
            if not current_snapshot:
                warnings.append(
                    "Current version for [%s|%s] context [%s] not found" %
                    (search_type, search_id, snap_contexts[idx]))
                continue
            session_version, node_name = session_data_dict.get(snap_code)
            if session_version and int(
                    current_snapshot.get_version()) > int(session_version):
                current_snapshots.append(current_snapshot)
                sobjects.append(current_snapshot.get_sobject())
                node_names.append(node_name)
                session_versions.append(int(session_version))

        title = DivWdg('Outdated References')
        title.add_style('text-decoration', 'underline')
        div.add(title)

        # draw the nodes to be udpated
        for idx, current_snap in enumerate(current_snapshots):

            cb = CheckboxWdg(my.REF_CB_NAME)
            cb.add_class('spt_ref')
            cb.add_style('display: none')
            sobj = sobjects[idx]
            node_name = node_names[idx]
            session_version = session_versions[idx]
            snapshot = current_snap
            cb_value = my.get_input_value(sobj, snapshot)
            items = cb_value.split('|')
            items[-1] = node_name
            cb_value = '|'.join(items)
            cb.set_option('value', cb_value)
            div.add(cb)

            div.add('%0.1d. %s v%0.3d -> v%0.3d\n' \
                %(idx+1, node_name, session_version, snapshot.get_version()))
            div.add(HtmlElement.br())

        for warning in warnings:
            div.add(SpanWdg(warning, css='warning'))
        div.add(HtmlElement.br())
        if current_snapshots:
            # add the button
            prefix = my.PREFIX
            update_button = ProdIconButtonWdg("Update all references")
            update_button.add_behavior({'type': "click_up",\
            'cbjs_action': '''var cousins = bvr.src_el.getParent('.spt_outdated_ref').getElements('.spt_ref');
                             cousins.each( function(x) {x.checked=true;}); py_replace_reference('%s','%s')'''
                    % (prefix, my.REF_CB_NAME)})
            div.add(SpanWdg(update_button, css='small'))

        return div