예제 #1
0
    def prod_render(my,dirs):
        search_type = my.sobject.get_value("search_type")
        search_id = my.sobject.get_value("search_id")

        ref_sobject = Search.get_by_search_key("%s|%s" % (search_type,search_id))
        # get shot and episode code
        shot_code = ref_sobject.get_value("code")
        shot = Shot.get_by_code(shot_code)
        episode_code = ''
        if shot:
            episode_code = shot.get_value("episode_code")

        name = ''
        if ref_sobject.has_value('name'):
            name = ref_sobject.get_value("name")

        # build the path
        dirs = my.get_default(dirs)
        dirs.append(episode_code)
        dirs.append(shot_code)
        if name:
            dirs.append(name)

        version = my.sobject.get_value("version")
        dirs.append("%04d" % version)

        return dirs
예제 #2
0
    def get(cls, texture_code, parent_code, project_code=None, is_multi=False):
        if not project_code:
            project_code = Project.get_project_code()
        search = Search(cls.SEARCH_TYPE, project_code)

        #search.set_show_retired(True)

        if texture_code:
            search.add_filter('code', texture_code)

        # backward compatible with using shot code
        if isinstance(parent_code, basestring):
            from pyasm.prod.biz import Shot
            parent = Shot.get_by_code(parent_code)
        else:
            parent = parent_code
        if not parent:
            if is_multi:
                return []
            else:
                return None

        search.add_filter('search_type', parent.get_search_type())
        search.add_filter('search_id', parent.get_id())
        parent_key = SearchKey.get_by_sobject(parent)

        search_type = search.get_search_type()
        key = "%s|%s|%s" % (search_type, texture_code, parent_key)
        sobj = cls.get_by_search(search, key, is_multi=is_multi)

        return sobj
예제 #3
0
파일: texture.py 프로젝트: mincau/TACTIC
    def get(cls, texture_code, parent_code, project_code=None, is_multi=False):
        if not project_code:
            project_code = Project.get_project_code()
        search = Search( cls.SEARCH_TYPE, project_code )
        
        #search.set_show_retired(True)
        
        if texture_code:
            search.add_filter('code', texture_code)
        
        # backward compatible with using shot code
        if isinstance(parent_code, basestring):
            from pyasm.prod.biz import Shot
            parent = Shot.get_by_code(parent_code)
        else:
            parent = parent_code
        if not parent:
            if is_multi:
                return []
            else:
                return None

        search.add_filter('search_type',  parent.get_search_type())
        search.add_filter('search_id',  parent.get_id())
        parent_key = SearchKey.get_by_sobject(parent)
        
        search_type = search.get_search_type()
        key = "%s|%s|%s" % (search_type, texture_code, parent_key)
        sobj = cls.get_by_search(search, key, is_multi=is_multi)
       
        return sobj
예제 #4
0
    def prod_render(my, dirs):
        search_type = my.sobject.get_value("search_type")
        search_id = my.sobject.get_value("search_id")

        ref_sobject = Search.get_by_search_key("%s|%s" %
                                               (search_type, search_id))
        # get shot and episode code
        shot_code = ref_sobject.get_value("code")
        shot = Shot.get_by_code(shot_code)
        episode_code = ''
        if shot:
            episode_code = shot.get_value("episode_code")

        name = ''
        if ref_sobject.has_value('name'):
            name = ref_sobject.get_value("name")

        # build the path
        dirs = my.get_default(dirs)
        dirs.append(episode_code)
        dirs.append(shot_code)
        if name:
            dirs.append(name)

        version = my.sobject.get_value("version")
        dirs.append("%04d" % version)

        return dirs
예제 #5
0
파일: naming.py 프로젝트: 0-T-0/TACTIC
    def get_sobject_by_filename(my, filename):
        '''extract the code from the filename'''
        naming = Naming.get_by_search_type('prod/shot_audio')
        if not naming:  
            return None

        shot_code = NamingUtil.extract_sobject_code(naming, filename, 'shot_code')
        # verify the code
        from pyasm.prod.biz import Shot
        shot = Shot.get_by_code(shot_code)
        if not shot:
            return None

        from pyasm.prod.biz import ShotAudio
        audio = ShotAudio.get_by_shot_code(shot_code)
        
        if not audio:
            audio = ShotAudio.create(shot_code)

        return audio
예제 #6
0
 def execute(self):
     self.add_description('Add shots in bulk')
     # add from shot 00001 to 00050 if they do not exist already
     count = 0
     for x in xrange(1, 51):
         shot_code = '%s_%0.3d'%(self.seq_code, x)
         shot = Shot.get_by_code(shot_code)
         if not shot:
             print "[%s] to be created." %shot_code
             shot = Shot.create(shot_code, 'Shot %s' %shot_code)
             shot.set_value('sequence_code', self.seq_code)
             # assuming this is one of the values in project settings
             # shot_status
             shot.set_value('status', 'online')
             # this is the default
             shot.set_value('pipeline_code','shot')
             shot.commit()
             count += 1
         else:
             print "[%s] already exists." %shot_code
     print "%d shot(s) created." %count
예제 #7
0
    def get_sobject_by_filename(my, filename):
        '''extract the code from the filename'''
        naming = Naming.get_by_search_type('prod/shot_audio')
        if not naming:
            return None

        shot_code = NamingUtil.extract_sobject_code(naming, filename,
                                                    'shot_code')
        # verify the code
        from pyasm.prod.biz import Shot
        shot = Shot.get_by_code(shot_code)
        if not shot:
            return None

        from pyasm.prod.biz import ShotAudio
        audio = ShotAudio.get_by_shot_code(shot_code)

        if not audio:
            audio = ShotAudio.create(shot_code)

        return audio