Example #1
0
    def draw_node(self, ref_nodes, table):
        if not ref_nodes:
            return

        for ref_node in ref_nodes:
            snapshot = Snapshot.get_ref_snapshot_by_node(ref_node,
                                                         mode='latest')
            if not snapshot:
                print "Snapshot for ref_node does not exist"
                continue

            render = snapshot.get_parent()
            table.add_row()

            parent = render.get_parent()
            table.add_cell(parent.get_name())

            table.add_cell(self.get_open_wdg(render))

            dir = render.get_client_lib_dir()
            table.add_cell("<i>%s</i>" % dir)
Example #2
0
    def draw_node(self, ref_nodes, table):
        if not ref_nodes:
            return
        
        for ref_node in ref_nodes:
            snapshot = Snapshot.get_ref_snapshot_by_node(ref_node, mode='latest')
            if not snapshot:
                print "Snapshot for ref_node does not exist"
                continue

            render = snapshot.get_parent()
            table.add_row()


            parent = render.get_parent()
            table.add_cell( parent.get_name() )

            table.add_cell( self.get_open_wdg(render) )

            dir = render.get_client_lib_dir()
            table.add_cell( "<i>%s</i>" % dir )
Example #3
0
    def get_version_wdgs(my):
        '''get a list of version wdgs'''
        if my.version_wdgs:
            return my.version_wdgs
        xml = my.snapshot.get_xml_value("snapshot")
        refs = xml.get_nodes("snapshot/file/ref")
        if not refs:
            return my.version_wdgs

       
        # handle subreferences
        for ref in refs:

            instance = Xml.get_attribute(ref, "instance")
            node_name = Xml.get_attribute(ref, "node_name")
            snapshot = Snapshot.get_ref_snapshot_by_node(ref, mode='current')
            if not snapshot:
                print "WARNING: reference in snapshot [%s] does not exist" % my.snapshot.get_code()
                continue

            #checkin_snapshot = Snapshot.get_ref_snapshot_by_node(ref)

            parent = snapshot.get_parent()
                
            asset_code = parent.get_code()

            # namespace = "veryron_rig"
            # node_name = "stool_model:furn001"
            # instance =  "stool_model"
            
            # HACK: if node name was not specified, then try to guess it
            # (for backwards compatibility)
            if not node_name: 
                node_name = my.get_node_name(snapshot, asset_code, my.namespace)
                # HACK
                parts = node_name.split(":")
                parts.insert(1, instance)
                node_name = ":".join(parts)
                print "WARNING: node_name not given: using [%s]" % node_name


            # Add the current namespace to the node 
            # in session
            checked_node_name = node_name

            # FIXME: this is Maya-specific and meant for referencing a shot
            '''
            if app_name == 'Maya':
                
                if not node_name.startswith("%s:" % my.namespace):
                    node_name = "%s:%s" % (my.namespace, node_name)
            elif app_name == "XSI":
                pass
            ''' 
            # get the latest information
            latest_version = snapshot.get_value("version")
            latest_context = snapshot.get_value("context")
            latest_revision = snapshot.get_value("revision", no_exception=True)
            latest_snapshot_type = snapshot.get_value("snapshot_type")


            # get the session information
            my.session.set_asset_mode(False)
            session_context = my.session.get_context(node_name, asset_code, latest_snapshot_type)
            session_version = my.session.get_version(node_name, asset_code, latest_snapshot_type)
            session_revision = my.session.get_revision(node_name, asset_code, latest_snapshot_type)
            #print "session: ", session_version, session_context, session_revision
            # add to outdated ref list here
            version_wdg = LatestVersionContextWdg()
            data = {'session_version': session_version, \
                'session_context': session_context,  \
                'session_revision': session_revision,  \
                'latest_context': latest_context, \
                'latest_version': latest_version, \
                'latest_revision': latest_revision,\
                'asset_code': asset_code,\
                'node_name': checked_node_name ,\
                'sobject': parent,\
                'snapshot': snapshot}

            version_wdg.set_options(data)
            my.version_wdgs.append(version_wdg)

            # This only adds when it is being drawn with the corresponding process selected
            # so not that useful, commented out for now.
            #if version_wdg.get_status() not in [ VersionWdg.NOT_LOADED, VersionWdg.UPDATED]:
            #    SubRefWdg.add_outdated_ref(version_wdg)

        return my.version_wdgs
Example #4
0
    def get_version_wdgs(my):
        '''get a list of version wdgs'''
        if my.version_wdgs:
            return my.version_wdgs
        xml = my.snapshot.get_xml_value("snapshot")
        refs = xml.get_nodes("snapshot/file/ref")
        if not refs:
            return my.version_wdgs

        # handle subreferences
        for ref in refs:

            instance = Xml.get_attribute(ref, "instance")
            node_name = Xml.get_attribute(ref, "node_name")
            snapshot = Snapshot.get_ref_snapshot_by_node(ref, mode='current')
            if not snapshot:
                print "WARNING: reference in snapshot [%s] does not exist" % my.snapshot.get_code(
                )
                wdg = UnknownVersionContextWdg()
                context = Xml.get_attribute(ref, "context")
                version = Xml.get_attribute(ref, "version")
                try:
                    version = int(version)
                except ValueError:
                    versionm = 0
                data = {
                    'node_name': node_name,
                    'context': context,
                    'version': version
                }
                wdg.set_options(data)

                my.version_wdgs.append(wdg)
                continue

            #checkin_snapshot = Snapshot.get_ref_snapshot_by_node(ref)

            parent = snapshot.get_parent()

            asset_code = parent.get_code()

            # namespace = "veryron_rig"
            # node_name = "stool_model:furn001"
            # instance =  "stool_model"

            # HACK: if node name was not specified, then try to guess it
            # (for backwards compatibility)
            if not node_name:
                node_name = my.get_node_name(snapshot, asset_code,
                                             my.namespace)
                # HACK
                parts = node_name.split(":")
                parts.insert(1, instance)
                node_name = ":".join(parts)
                print "WARNING: node_name not given: using [%s]" % node_name

            # Add the current namespace to the node
            # in session
            checked_node_name = node_name

            # FIXME: this is Maya-specific and meant for referencing a shot
            '''
            if app_name == 'Maya':
                
                if not node_name.startswith("%s:" % my.namespace):
                    node_name = "%s:%s" % (my.namespace, node_name)
            elif app_name == "XSI":
                pass
            '''
            # get the current information
            current_version = snapshot.get_value("version")
            current_context = snapshot.get_value("context")
            current_revision = snapshot.get_value("revision",
                                                  no_exception=True)
            current_snapshot_type = snapshot.get_value("snapshot_type")

            # get the session information
            my.session.set_asset_mode(False)
            session_context = my.session.get_context(node_name, asset_code,
                                                     current_snapshot_type)
            session_version = my.session.get_version(node_name, asset_code,
                                                     current_snapshot_type)
            session_revision = my.session.get_revision(node_name, asset_code,
                                                       current_snapshot_type)
            #print "session: ", session_version, session_context, session_revision
            # add to outdated ref list here, this is really current even though it's called current

            version_wdg = CurrentVersionContextWdg()
            data = {'session_version': session_version, \
                'session_context': session_context,  \
                'session_revision': session_revision,  \
                'current_context': current_context, \
                'current_version': current_version, \
                'current_revision': current_revision,\
                'asset_code': asset_code,\
                'node_name': checked_node_name ,\
                'sobject': parent,\
                'snapshot': snapshot}

            version_wdg.set_options(data)
            my.version_wdgs.append(version_wdg)

            # This only adds when it is being drawn with the corresponding process selected
            # so not that useful, commented out for now.
            #if version_wdg.get_status() not in [ VersionWdg.NOT_LOADED, VersionWdg.UPDATED]:
            #    SubRefWdg.add_outdated_ref(version_wdg)

        return my.version_wdgs