Example #1
0
    def get_process(my):
        '''Get from the ProcessFilterWdg in SObjectLoadWdg,
            otherwise get from FilterData'''

        process = ''

        # Ususally there is no pipeline defined for prod/shot_instance
        # so get from prod/shot
        search_type = my.search_type
        if search_type == 'prod/shot_instance':
            search_type = 'prod/shot'

        state = Container.get("global_state")
        if state:
            process = state.get('process')
        else:

            # get it from FilterData
            data = FilterData.get()
            values = data.get_values_by_prefix('view_action_option')
            if values:
                process = values[0].get('load_%s_process' % search_type)

        if not process:
            from pyasm.prod.web import ProcessFilterWdg
            process_filter = ProcessFilterWdg(None, search_type)
            process = process_filter.get_value()
        return process
Example #2
0
    def get_process(my):
        '''Get from the ProcessFilterWdg in SObjectLoadWdg,
            otherwise get from FilterData'''

        process = ''

        # Ususally there is no pipeline defined for prod/shot_instance
        # so get from prod/shot
        search_type = my.search_type
        if search_type =='prod/shot_instance':
            search_type = 'prod/shot'

        state = Container.get("global_state")
        if state:
            process = state.get('process')
        else:
            
            # get it from FilterData
            data = FilterData.get()
            values = data.get_values_by_prefix('view_action_option')
            if values:
                process = values[0].get('load_%s_process' %search_type)

        if not process:
            from pyasm.prod.web import ProcessFilterWdg
            process_filter = ProcessFilterWdg(None, search_type)
            process = process_filter.get_value()
        return process
Example #3
0
    def get_display(self):

        widget = DivWdg()
        self.set_as_panel(
            widget,
            class_name='spt_view_panel spt_panel spt_app_asset_inst_panel')

        parent_search_type = self.search_type

        if self.show_search:
            # Have to limit this search to just its parent.. cuz if the target is prod/shot_instance
            # and its parent search is ShotFilterWdg, it's hard to isolate what shot has been selected
            search_bvr = {
                'type':
                'click_up',
                'cbjs_action':
                'spt.dg_table.search_cbk(evt, bvr)',
                'override_class_name':
                'tactic.ui.cgapp.AppAssetInstancePanelWdg',
                'override_target':
                "bvr.src_el.getParent('.spt_app_asset_inst_panel')"
            }

            search_wdg = SearchWdg(search_type=parent_search_type, view='search_shot_loader', parent_key='', filter=''\
            , display='block', custom_filter_view='', state=None, run_search_bvr=search_bvr)
            widget.add(HtmlElement.spacer_div(1, 10))
            widget.add(search_wdg)

            # if there is result, it could only be one shot
            search = search_wdg.get_search()
            shots = search.get_sobjects()

            if not self.shot and len(shots) == 1:
                self.shot = shots[0]

        # create the asset table
        table_id = "main_body_asset_instance_table"

        if not self.shot:
            return widget
        # get any parent shots
        parent_code = self.shot.get_value("parent_code")
        shot_code = self.shot.get_code()

        # add the search make sure set elements are not shown
        search = Search(self.instance_search_type)
        if parent_code != "":
            search.add_filters(self.shot.get_foreign_key(),
                               [shot_code, parent_code])
        else:
            search.add_filter(self.shot.get_foreign_key(), shot_code)

        search.add_where("\"type\" in ('set_item', 'asset')")
        search.add_order_by('asset_code')

        instances = search.get_sobjects()

        # if parent shot and current shot has the same instance, hide the
        # parent's one

        top_instances = []
        for instance in instances:
            if instance.get_value('type') != 'set_item':
                top_instances.append(instance)

        #instances = ShotInstance.filter_instances(instances, shot_code)
        top_instances = ShotInstance.filter_instances(top_instances, shot_code)
        # TODO: just add asset name to the ShotInstance table
        # get the original asset names

        aux_data = ShotInstance.get_aux_data(top_instances,
                                             self.asset_search_type)

        values = FilterData.get().get_values_by_index('view_action_option', 0)
        state = {}

        if not self.show_search:
            if values:
                state['process'] = values.get('load_%s_process' %
                                              parent_search_type)
            else:
                process_filter = ProcessFilterWdg(None, parent_search_type)
                state['process'] = process_filter.get_value()

        Container.put("global_state", state)

        from tactic.ui.cgapp import CGAppLoaderWdg
        cg_wdg = CGAppLoaderWdg(view='load',
                                search_type=self.instance_search_type)
        widget.add(cg_wdg)

        if not top_instances:
            widget.add('No Asset Instances in Shot.')
        else:
            asset_table = TableLayoutWdg(table_id = table_id, search_type=self.instance_search_type,\
                view="load", inline_search=False, aux_info = aux_data, mode='simple')

            #asset_table = ViewPanelWdg( search_type=search_type,  inline_search=False, \
            #        show_general_search=False, view='load', state=state, mode='simple')

            asset_table.set_sobjects(top_instances)
            widget.add(asset_table)

            shot_inst_names = [inst.get_code() for inst in instances]

            self.add_unassigned_instances(widget, shot_inst_names)
        return widget
Example #4
0
    def get_display(self):

        widget = Widget()
        self.search_type = self.options.get("search_type")
        if not self.search_type:
            self.search_type = self.kwargs.get("search_type")

        assert self.search_type

        self.load_options_class = self.kwargs.get('load_options_class')

        state = Container.get("global_state")
        if state:
            self.process = state.get("process")
        else:
            self.process = None

        # the filter for searching assets
        div = DivWdg(css='filter_box')
        div.add_color("background", "background2", -35)

        from app_init_wdg import PyMayaInit, PyXSIInit, PyHoudiniInit
        if WebContainer.get_web().get_selected_app() == 'Maya':
            app = PyMayaInit()
        elif WebContainer.get_web().get_selected_app() == 'XSI':
            app = PyXSIInit()
        elif WebContainer.get_web().get_selected_app() == 'Houdini':
            app = PyHoudiniInit()
        div.add(app)

        # add the possibility of a custom callback
        callback = self.options.get('callback')
        if callback:
            hidden = HiddenWdg("callback", callback)
            div.add(hidden)

        # or add the possiblity of a switch mode
        pipeline_type = "load"
        hidden = HiddenWdg("pipeline_type", pipeline_type)

        if self.process:
            process_div = DivWdg()
            process_div.add_style("margin: 10px")
            process_div.add("PROCESS: %s" % self.process)
            process_div.add_style("font-size: 20px")
            widget.add(process_div)

            hidden_wdg = HiddenWdg("process_select_%s" % self.search_type)
            hidden_wdg.set_value(self.process)
            widget.add(hidden_wdg)
        else:
            search_type = self.search_type
            if search_type == 'prod/shot_instance':
                search_type = 'prod/shot'

            process_filter = ProcessFilterWdg(
                self.get_context_data(search_type), search_type)
            span = SpanWdg(process_filter, css='med')
            div.add(span)
            widget.add(div)

        # load options for diff search type
        if self.load_options_class:
            load_options = Common.create_from_class_path(
                self.load_options_class)
        elif self.search_type == 'prod/asset':
            load_options = LoadOptionsWdg()
        elif self.search_type == 'prod/shot':
            load_options = ShotLoadOptionsWdg()
        elif self.search_type == 'prod/shot_instance':
            load_options = AnimLoadOptionsWdg()
        else:
            load_options = LoadOptionsWdg()
        load_options.set_prefix(self.search_type)

        widget.add(load_options)

        return widget
Example #5
0
    def get_display(my):
        
        widget = DivWdg()
        my.set_as_panel(widget, class_name='spt_view_panel spt_panel spt_app_asset_inst_panel')
        
        parent_search_type= my.search_type
        
        if my.show_search:
            # Have to limit this search to just its parent.. cuz if the target is prod/shot_instance
            # and its parent search is ShotFilterWdg, it's hard to isolate what shot has been selected
            search_bvr = {
                'type':         'click_up',
                'cbjs_action':  'spt.dg_table.search_cbk(evt, bvr)',
                'override_class_name': 'tactic.ui.cgapp.AppAssetInstancePanelWdg',
                'override_target': "bvr.src_el.getParent('.spt_app_asset_inst_panel')"
            }

            search_wdg = SearchWdg(search_type=parent_search_type, view='search_shot_loader', parent_key='', filter=''\
            , display='block', custom_filter_view='', state=None, run_search_bvr=search_bvr)
            widget.add( HtmlElement.spacer_div(1,10) )
            widget.add(search_wdg)


            # if there is result, it could only be one shot
            search = search_wdg.get_search()
            shots = search.get_sobjects()
            
            if not my.shot and len(shots) == 1:
                my.shot= shots[0]

        # create the asset table
        table_id = "main_body_asset_instance_table" 
              
        if not my.shot:
            return widget
        # get any parent shots
        parent_code = my.shot.get_value("parent_code")
        shot_code = my.shot.get_code()

        # add the search make sure set elements are not shown
        search = Search(my.instance_search_type)
        if parent_code != "":
            search.add_filters(my.shot.get_foreign_key(), [shot_code,parent_code] )
        else:
            search.add_filter(my.shot.get_foreign_key(), shot_code )

        search.add_where("\"type\" in ('set_item', 'asset')")
        search.add_order_by('asset_code')
        
        instances = search.get_sobjects()

        # if parent shot and current shot has the same instance, hide the 
        # parent's one
        
        top_instances = []
        for instance in instances:
            if instance.get_value('type') != 'set_item':
                top_instances.append(instance)

        #instances = ShotInstance.filter_instances(instances, shot_code)
        top_instances = ShotInstance.filter_instances(top_instances, shot_code)
        # TODO: just add asset name to the ShotInstance table
        # get the original asset names

        aux_data = ShotInstance.get_aux_data(top_instances, my.asset_search_type)

        values = FilterData.get().get_values_by_index('view_action_option', 0)
        state = {}
        
        if not my.show_search:
            if values:
                state['process'] = values.get('load_%s_process'% parent_search_type)
            else:
                process_filter = ProcessFilterWdg(None, parent_search_type)
                state['process'] = process_filter.get_value()

        Container.put("global_state", state)
        
        from tactic.ui.cgapp import CGAppLoaderWdg
        cg_wdg = CGAppLoaderWdg(view='load', search_type=my.instance_search_type)
        widget.add(cg_wdg)

        if not top_instances:
            widget.add('No Asset Instances in Shot.')
        else:
            asset_table = TableLayoutWdg(table_id = table_id, search_type=my.instance_search_type,\
                view="load", inline_search=False, aux_info = aux_data, mode='simple')

            #asset_table = ViewPanelWdg( search_type=search_type,  inline_search=False, \
            #        show_general_search=False, view='load', state=state, mode='simple') 

            asset_table.set_sobjects(top_instances)
            widget.add(asset_table)

            shot_inst_names = [inst.get_code() for inst in instances]
            
            my.add_unassigned_instances(widget, shot_inst_names)
        return widget