当前位置: 首页>>代码示例>>Python>>正文


Python Shotgun.create方法代码示例

本文整理汇总了Python中shotgun_api3.Shotgun.create方法的典型用法代码示例。如果您正苦于以下问题:Python Shotgun.create方法的具体用法?Python Shotgun.create怎么用?Python Shotgun.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shotgun_api3.Shotgun的用法示例。


在下文中一共展示了Shotgun.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getProjects

# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import create [as 别名]
def getProjects():
	
	site = 'https://chimneypot.shotgunstudio.com'	
	scriptName = 'AssetBrowser'
	scriptKey = 'c35ab5f5322d4b1e8b6488bb315c03e5f38881ea'	
	
	repo = '/mnt/karramba/'	
		
	rootList = ['film', 'out', 'ref', 'src', 'temp']
	filmList = ['assets', 'sequences']	
	assetList = ['light', 'material', 'mattepaint', 'model', 'rig', 'shader', 'textures']
	shotList = ['anim', 'comp', 'data', 'fx', 'light', 'out', 'src', 'tmp']
	sqList = ['anim', 'comp', 'data', 'fx', 'light', 'out', 'shots']
	dataList = ['cache', 'geo', 'render', 'shadowmap', 'sim', 'track', 'photonmap']
	outList = ['dailies', 'hires']

	prName = raw_input('Print project name:')
	
	prPath = repo + prName 	
	
	if not os.path.exists(prPath):
		os.mkdir(prPath)
		for i in rootList:
			os.makedirs(prPath + os.sep + i)
		for i in filmList:
			os.makedirs(prPath + os.sep + 'film' + os.sep + i)	
		for i in assetList:
			os.makedirs(prPath + os.sep + 'film' + os.sep + 'assets' + os.sep + i)
		for i in outList:
			os.makedirs(prPath + os.sep + 'out' + os.sep + i)

	sg = Shotgun(site, scriptName, scriptKey)
	sg.create('Project', {'name':prName})
开发者ID:horitin,项目名称:pipeline,代码行数:35,代码来源:asset_browser_functions.py

示例2: createProject

# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import create [as 别名]
def createProject():
    
    site = 'https://chimneypot.shotgunstudio.com'    
    scriptName = 'createProject'
    scriptKey = '90699580e396b61d3acfb71e0595adde7458dfd4'    
    
    repo = '/mnt/karramba/'    
        
    rootList = ['film', 'out', 'ref', 'src', 'temp']
    filmList = ['assets', 'sequences']    
    assetList = ['light', 'material', 'mattepaint', 'model', 'rig', 'shader', 'textures']
    shotList = ['anim', 'comp', 'data', 'fx', 'light', 'out', 'src', 'tmp']
    sqList = ['anim', 'comp', 'data', 'fx', 'light', 'out', 'shots']
    dataList = ['cache', 'geo', 'render', 'shadowmap', 'sim', 'track', 'photonmap']
    outList = ['dailies', 'hires']

    prName = raw_input('Print project name:')
    
    prPath = repo + prName     
    
    if not os.path.exists(prPath):
        os.mkdir(prPath)
        for i in rootList:
            os.makedirs(prPath + os.sep + i)
        for i in filmList:
            os.makedirs(prPath + os.sep + 'film' + os.sep + i)    
        for i in assetList:
            os.makedirs(prPath + os.sep + 'film' + os.sep + 'assets' + os.sep + i)
        for i in outList:
            os.makedirs(prPath + os.sep + 'out' + os.sep + i)

    sg = Shotgun(site, scriptName, scriptKey)
    sg.create('Project', {'name':prName})    
开发者ID:horitin,项目名称:pipeline,代码行数:35,代码来源:addProject.py

示例3: submitShotgunTicket

# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import create [as 别名]
def submitShotgunTicket(output, jobList):

	currentuser = str(User.currentUser().name())
	title = "AtS - %s"%currentuser

	desc = []
	desc.append(output+"\n")
	desc.append("JOBLIST:") 

	for job in jobList:
	    desc.append(str(job.key())+" - "+str(job.name())) 
			
	sg = Shotgun(SERVER_PATH, SCRIPT_USER, SCRIPT_KEY)
	
        id = sg.find("HumanUser",[['login','is',currentuser]],['id'])
        userid = id[0]

        ticket_data = {
            'created_by': {'type':'HumanUser','id':userid['id']},
            'title': title,
            'description': "\n".join(desc),
            'addressings_to':[{'type':'Group', 'id':19}, {'type':'HumanUser','id':userid['id']}],
            'project': {'type':'Project', 'id':178},
            'sg_service': {'type':'CustomNonProjectEntity01', 'id':27},
        }
        sg_ticket = sg.create('Ticket', ticket_data, ['id'])
        new_ticket_url = SERVER_PATH + "/detail/Ticket/" + str(sg_ticket['id'])
        QDesktopServices.openUrl( QUrl(new_ticket_url) )
开发者ID:attila3d,项目名称:arsenalsuite,代码行数:30,代码来源:shotgunPlugin.py

示例4: _moveFilesToPublish

# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import create [as 别名]
    def _moveFilesToPublish(self):
        base_url    = "http://bubblebathbay.shotgunstudio.com"
        script_name = 'playBlastPublisher'
        api_key     = '718daf67bfd2c7e974f24e7cbd55b86bb101c4e5618e6d5468bc4145840e4558'

        sgsrv = Shotgun(base_url = base_url , script_name = script_name, api_key = api_key, ensure_ascii=True, connect=True)
        selectedShots = [item.text(0) for item in self.treeWidgetItems if item.checkState(0)]
        if selectedShots:
            for each in selectedShots:
                episode = each.split('sh')[0]
                shotName = '%s_sh%s' % (each.split('sh')[0], each.split('sh')[1].split('Lay')[0])
                self.publishPath = self.publishingPath(episode, shotName)
                for root, dirs, files in os.walk(self.shFldPath):
                    for fl in sorted(files):
                        if fl.endswith('.mov') and fl == '%s.mov' % each:
                            srcPath = os.path.join(root,fl)
                            self.playblastName = fl
                            while os.path.exists(os.path.join(self.publishPath, fl)):
                                allFiles= os.listdir(self.publishPath)
                                publishFiles = []
                                if allFiles:
                                    for allFile in allFiles:
                                        if allFile.endswith('.mov'):
                                            publishFiles.append(allFile)
                                versionNumber = int(sorted(publishFiles)[-1].split('.v')[1].split('.mov')[0])
                                versionNumber += 1
                                if versionNumber < 10:
                                    publishFileName = '%sLayout.v%03d.mov' % (shotName.replace('_', ''), versionNumber)
                                    self.publishPath = os.path.join(self.publishPath, publishFileName)
                                    self.playblastName = os.path.basename(self.publishPath)
                                else:
                                    publishFileName = '%sLayout.v%02d.mov' % (shotName.replace('_', ''), versionNumber)
                                    self.publishPath = os.path.join(self.publishPath, publishFileName)
                                    self.playblastName = os.path.basename(self.publishPath)

                            shutil.copy2(srcPath, self.publishPath)
                            publishMovPath = os.path.join(self.publishingPath(episode, shotName), self.playblastName)
                            getShotTasks =  sgsrv.find_one('Shot',  filters = [["code", "is", shotName]], fields=['id', 'tasks'])

                            for key, values in getShotTasks.iteritems():
                                if key == 'tasks':
                                    for value in values:
                                        if value['name'] == 'Layout':
                                            self.taskId = value['id']
                            if self.publishPath.endswith('review'):
                                self.publishPath = os.path.join(self.publishPath,fl)
                                self.playblastName = fl
                            data = { 'project': {'type':'Project','id': 66},
                                     'code':  self.playblastName,
                                     'description': 'Layout playblast published',
                                     'sg_path_to_movie': publishMovPath,
                                     'sg_status_list': 'rev',
                                     'entity': {'type':'Shot', 'id':getShotTasks['id']},
                                     'sg_task': {'type':'Task', 'id':self.taskId},
                                     'user': {'type':'HumanUser', 'id':92} }
                            result = sgsrv.create('Version', data)
                            result2 = sgsrv.upload("Version", result['id'], publishMovPath, "sg_uploaded_movie")
                print "Done"
开发者ID:vipul-rathod,项目名称:AppleTree,代码行数:60,代码来源:test_v002.py

示例5: _pubBttn

# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import create [as 别名]
    def _pubBttn(self):
        base_url    = "http://bubblebathbay.shotgunstudio.com"
        script_name = 'playBlastPublisher'
        api_key     = '718daf67bfd2c7e974f24e7cbd55b86bb101c4e5618e6d5468bc4145840e4558'

        sgsrv = Shotgun(base_url = base_url , script_name = script_name, api_key = api_key, ensure_ascii=True, connect=True)

        selectedShots = sorted([item.text(0) for item in self.shotTreeWidgetItems if item.checkState(0)])
        for shot in selectedShots:
            if shot in self.srcPath.keys():
                destPath = self._getPublishPath(shot)
                srcPath = self.srcPath[str(shot)]
                ext = os.path.splitext(srcPath)[-1]
#                 print os.path.basename(srcPath)
#                 while os.path.exists(os.path.join(str(destPath), os.path.basename(srcPath))):
#                     print "In Loop"
#                     print os.path.basename(srcPath)
#                     allFiles= os.listdir(destPath)
#                     publishFiles = []
#                     if allFiles:
#                         for allFile in allFiles:
#                             if allFile.endswith(ext):
#                                 print allFile
#                                 publishFiles.append(allFile)
#                     versionNumber = int(sorted(publishFiles)[-1].split('.v')[1].split(ext)[0])
#                     versionNumber += 1
#                     if versionNumber < 10:
#                         publishFileName = '%sLayout.v%03d%s' % (shotName.replace('_', ''), versionNumber, ext)
#                         self.publishPath = os.path.join(self.publishPath, publishFileName)
#                         self.playblastName = os.path.basename(self.publishPath)
#                     else:
#                         publishFileName = '%sLayout.v%02d%s' % (shotName.replace('_', ''), versionNumber, ext)
#                         self.publishPath = os.path.join(self.publishPath, publishFileName)
#                         self.playblastName = os.path.basename(self.publishPath)
#                 shutil.copy2(srcPath, destPath)

                shotName = '%s_%s' % (self._getEpisodeName(shot), self._getShotName(shot))
                getShotTasks =  self.tk.shotgun.find_one('Shot',  filters = [["code", "is", shotName]], fields=['id', 'tasks'])
                taskName = self.comboBox.currentText()
                self.playblastName = os.path.basename(srcPath)
                publishMovPath = os.path.join(destPath, self.playblastName).replace('\\', '/')
                shutil.copy2(srcPath, destPath)
                for task in getShotTasks['tasks']:
                    if task['name'] == taskName:
                        taskId = task['id']
                        data = { 'project': {'type':'Project','id': 66},
                             'code':  self.playblastName,
                             'description': 'Playblast published',
                             'sg_path_to_movie': publishMovPath,
                             'sg_status_list': 'rev',
                             'entity': {'type':'Shot', 'id':getShotTasks['id']},
                             'sg_task': {'type':'Task', 'id':taskId},
                             'user': {'type':'HumanUser', 'id':92} }
                        result = sgsrv.create('Version', data)
                        result2 = sgsrv.upload("Version", result['id'], publishMovPath, "sg_uploaded_movie")
                        print "Published %s" % self.playblastName
开发者ID:vipul-rathod,项目名称:AppleTree,代码行数:58,代码来源:genericPublishPlayblast.py

示例6: StoryboardFileManagement

# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import create [as 别名]

#.........这里部分代码省略.........
        self.doFileCheckboxes(myPath)
                 
    def _versionUp(self, path):
        return int(max(os.listdir(path)).split('.v')[-1].split('.mov')[0]) + 1 
    
    def addStoryboardVersionToShotgun(self, path, epName, shotName, verNum, fullVersPublishName):
        """
        Function to add the audio asset to shotgun correctly for tasks etc and the pipeline to see it
        """
        #self.shotNum = each.text().split('.mov')[0]
        #self.addStoryboardVersionToShotgun(str(self.shotReviewDir), str(self.epName), self.shotNum, self.vNum, self.shotReviewFileName)
        ## Now start processing stuff..
        self.epName     = epName.lower()
        self.shotName   = shotName.lower()
        self.boardName  = fullVersPublishName.lower()
        self.taskName   = 'StoryBoard'
        self.sg_version = verNum
               
        self.pathToMovie = '%s%s' % (path, self.boardName)
        
        ## First find it the task exists
        self.getShotTasks =  self.sgsrv.find_one('Shot',  filters = [["code", "is", self.shotName]], fields=['id', 'tasks'])
        
        ## Now check and see if the task we need is there...
        self.tasks = []
        self.taskList = []
        if self.getShotTasks:
            for eachTaskDict in self.getShotTasks['tasks']:
                self.tasks.append(eachTaskDict['name'])
                self.taskList.append(eachTaskDict)

            if self.taskName not in self.tasks:
                ## Create new task for the shot
                self.myNewTask = self.sgsrv.create(
                                                   'Task', 
                                                   {
                                                    'project': 
                                                            {
                                                             'type': 'Project',
                                                             'id': 66
                                                             }, 
                                                    'step': {
                                                             'type': 'Step', 
                                                             'id': 72, 
                                                             'name': 'StoryBoard'
                                                            }, 
                                                    'content': 'StoryBoard',
                                                    'sg_status_list': 'apr',
                                                    'template_task': {
                                                                      'type': 'Task', 
                                                                      'id': 31333
                                                                      }
                                                    }
                                                   )
                self.taskId = int(self.myNewTask['id'])
                ## Returns {'project': {'type': 'Project', 'id': 66, 'name': 'bubblebathbay'}, 'step': {'type': 'Step', 'id': 72, 'name': 'StoryBoard'}, 'type': 'Task', 'id': 32335}
                 
                ## Add this dict to the list of dict for updating the shot task list with.
                self.taskList.append({'type': 'Task', 'id': self.myNewTask['id'], 'name': 'StoryBoard'})
    
                ## Now update the shots task list.
                self.sgsrv.update(
                                  'Shot', 
                                  self.getShotTasks['id'], 
                                  {
                                   'project': {
开发者ID:vipul-rathod,项目名称:lsapipeline,代码行数:70,代码来源:bbb_storyboardFileManagement.py

示例7: Shotgun

# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import create [as 别名]
__author__ = 'andrew.willis'

from shotgun_api3 import Shotgun

sg = Shotgun("http://andrewwillish.shotgunstudio.com", "scriptTest", "8b7db88321b7c296541580d1659872d2e63527c040b37b4a2ca0eb47f9da04cb")
proj = sg.find_one("Project",[['name','is','KIKO']])
print sg.create("shot",{'code':'SEQ01','project':proj})
#sg.update('Shot',shot['id'],{"sg_status_list":"ip"})
#sg.delete("Shot", 1160)
开发者ID:andrewwillish,项目名称:shotgunInterface,代码行数:11,代码来源:shotgunInterface.py

示例8: studioShotgun

# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import create [as 别名]
class studioShotgun(object):
    def __init__(self, path, name, key, project):
        self.SERVER_PATH = path
        self.SCRIPT_NAME = name     
        self.SCRIPT_KEY = key
        self.project_id = project
        self.sg = Shotgun(self.SERVER_PATH, self.SCRIPT_NAME, self.SCRIPT_KEY)

    #----------------------------------------------------------------------
    ## set Project id by ID
    def setProjectId(self, newId):
        self.project_id = newId

    #----------------------------------------------------------------------
    ## set Project id by ID
    def setProjectName(self, name):
        newId = 0
        projects = self.sg.find('Project', [], ['name'])
        for project in projects:
            if project['name'] == name:
                newId = project['id']

        self.project_id = newId

    #----------------------------------------------------------------------
    ## find asset by name
    def findAssetByName(self, name):
        fields = ['id', 'code', 'sg_asset_type', 'tasks']
        filters = [['project', 'is', {'type': 'Project', 'id': self.project_id}], ['code', 'is', name]]
        
        result = self.sg.find('Asset', filters, fields)
    
        return result
    
    #----------------------------------------------------------------------
    ## find shot by name
    def findShotByName(self, episode, shot):
        fields = ['id', 'code', 'sg_asset_type', 'tasks', 'sg_sequence']
        filters = [['project', 'is', {'type': 'Project', 'id': self.project_id}], ['code', 'is', shot]]
        
        result = self.sg.find('Shot', filters, fields)
    
        for x in result:
            name = x['sg_sequence']['name'].split('_')[0]
            if name == episode:
                return x
    
        return []

    #----------------------------------------------------------------------
    ## upload thumbnail to asset
    def uploadThumbnail(self, asset, thumbnail):
        upload = 0
        asset = self.findAssetByName(asset)
        if asset:
            upload = self.sg.upload_thumbnail("Asset", asset[0]['id'], thumbnail)
    
        return upload

    #----------------------------------------------------------------------
    ## create new asset
    def createAsset(self, asset, assetType, template, assetFile='', description=''):
        ## find asset
        asset = self.findAssetByName(asset)
        
        if not asset:
            ## create asset + task template
            filters = [['code', 'is', template]]
            template = self.sg.find_one('TaskTemplate', filters)
            
            data = {'project': {'type': 'Project', 'id': self.project_id}, 
                    'code': asset,
                    'description': description, 
                    'sg_asset_type': assetType, 
                    'sg_url_perforce': assetFile, 
                    'task_template': template}
    
            asset = self.sg.create('Asset', data)
    
        return asset

    #----------------------------------------------------------------------
    ## update file path in asset
    def updateAssetFilePath(self, asset, filename):
        asset = self.findAssetByName(asset)
    
        data = {'sg_url_perforce': filename}
        asset = self.sg.update("Asset", asset[0]['id'], data)
    
        return asset

    #----------------------------------------------------------------------
    ## create new version
    def createVersion(self, shotId, taskId, userId, filename, comment=''):
        curTime = datetime.now().strftime('%Y.%m.%d_%H.%M')
        fname = str(filename.split('/')[-1].split('.')[0]) + '_' + curTime
    
        data = {'project': {'type': 'Project', 'id': self.project_id},
                'code': fname,
                'description': comment,
#.........这里部分代码省略.........
开发者ID:kuzubov,项目名称:maya_python_scripts,代码行数:103,代码来源:shotgun.py

示例9: Shotgun

# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import create [as 别名]
'''

from shotgun_api3 import Shotgun
from pprint import pprint

SERVER_PATH = 'http://****.shotgunstudio.com' #your server path here
SCRIPT_USER = '*********' #your script name 
SCRIPT_KEY =  '*********' #your key here
URL_OF_CGI = "http://www.YOURURL.***/cgi-bin/set_current_version_posthandler_cgi.py"
title = "Set As Current Version"
entity_type = "Version"
selection_required = True



# initiate a shotgun API instance
sg = Shotgun(SERVER_PATH, SCRIPT_USER, SCRIPT_KEY)

#define the action menu item
data = {
  "title": title,
  "url": URL_OF_CGI,
  "list_order": 1,
  "entity_type": entity_type,
  "selection_required": selection_required, 

}

#Create the menu item
menu_item = sg.create("ActionMenuItem", data)
pprint(menu_item) # keep the output in case you need to delete the menu later!
开发者ID:ProjectGuerilla,项目名称:Shotgun-Code-Snippets,代码行数:33,代码来源:create_actionmenu.py

示例10: connect

# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import create [as 别名]
from tests import connect

from shotgun_api3 import Shotgun

if True:
    sg = connect()
else:
    sg = Shotgun('http://127.0.0.1:8020', 'name', 'key')

print sg.server_info


proj =  sg.create('Project', {'name': 'Mock Project Test'})
seq = sg.create('Sequence', {'code': 'AA', 'project': proj})
shot = sg.create('Shot', {'code': 'AA_001', 'sg_sequence': seq})

print proj
print seq
print shot
#
# print sg.find('Project', [('id', 'is_not', 0)], ['name'], order=[
#     {'field_name': 'id', 'direction': 'asc'},
# ])

print sg._call_rpc('count', None)
exit()

print sg.create('Project', {'name': 'Test Project'})
print sg.count()
print sg.find_one('Project', [], order=[
    {'field_name': 'id', 'direction': 'asc'},
开发者ID:westernx,项目名称:sgcache,代码行数:33,代码来源:basics.py

示例11: gethostname

# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import create [as 别名]
        #print "fkey: %s fvalue: %s" % ( key, value )
        ret[key.strip()] = value.strip()
    return ret

hostname = gethostname().split('.', 1)[0]

asset = sg.find_one("Asset",[['code','is',hostname]],['id'])
if not asset:
    print "couldn't find asset"
else:
    # if we find a valid asset, sync the facts for it
    fact_data = get_fact_data()

    for fact_name,fact_value in fact_data.items():
        if not fact_name in facts_to_sync: continue

        fact_data = {
            'code': fact_name,
            'sg_asset': {'type':'Asset', 'id':asset['id']},
            'description': fact_value,
            'project': {'type':'Project', 'id':178},
        }
        existing_fact = sg.find_one('CustomEntity01', [['code','is',fact_name],['sg_asset','is',{'type':'Asset','id': asset['id']}]],['id'])
        if existing_fact:
            print "asset %s has existing fact %s, updating to %s" % ( hostname, fact_name, fact_value )
            sg.update('CustomEntity01', existing_fact['id'], fact_data)
        else:
            print "asset %s creating fact %s : %s" % ( hostname, fact_name, fact_value )
            sg.create('CustomEntity01', fact_data, return_fields=['id'])

开发者ID:achayan,项目名称:anim-studio-tools,代码行数:31,代码来源:syncFacts.py

示例12: str

# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import create [as 别名]
        playlist_user = {'type' : 'HumanUser' , 'id' : script_user_id}
        versions_list = [ {'type' : 'Version', 'id' : x } for x in version_ids ]
        data = {
            'project': { 'type' : 'Project' , 'id' : PROJECT_ID } ,
            'code' : playlist_name ,
            'description' : playlist_description ,
            'sg_status' : PLAYLIST_STATUS ,
            'versions' : versions_list ,
            'sg_type' : PLAYLIST_TYPE ,
            'sg_script_user' : playlist_user ,
            'sg_date_and_time' : now
            }
        
        
        #Create the Playlist in Shotgun
        playlist = sg.create("Playlist",data)

        if not playlist : #error! nothing came back from SG!
            success = False

    if success: #everything has gone well and the user gets a message
                    print '</br>'
                    print "<b>Playlist successfully created</b>"
                    path_to_playlist = SERVER_PATH + '/detail/Playlist/' + str(playlist['id'])
                    #print '<a href="%s">Visit Playlist Now</a>' % path_to_playlist 
                    #print '</br>Will redirect automatically in 5 seconds'
                    print '''<a href="#" onclick="window.opener.location.href='%s'; window.opener='x';window.close();">Visit Playlist Now</a>''' % path_to_playlist
                    #print'<meta http-equiv="REFRESH" content="3;url=%s">' % path_to_playlist
                    print '</br>'

    print "</body>"
开发者ID:ProjectGuerilla,项目名称:Shotgun-Code-Snippets,代码行数:33,代码来源:sg_create_playlist_step_2.py

示例13: __init__

# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import create [as 别名]
class genericUtils:
    def __init__(self):
        self.sg = Shotgun('https://' + URL,name,API)

    def getFields (self, entity):
        '''get the fields for a type/entity as a list so we can pass it as an arg easily
        this is used all the time to make sure we get all the fields that we may ever need for a type/entity
        '''
        allFields = []
        fields = self.sg.schema_field_read(entity)
        for field in fields:
            allFields.append(field)
        return allFields  
    
    def project (self, project):
        '''Gets the Shotgun project name and ID
        '''
        retFields = self.getFields('Project')
        project = project.replace('_', ' ')
        return self.sg.find_one("Project", [["name", "is", project]], retFields )   

    def sequence (self, project, sequence):
        '''Returns the shotgun sequence name and ID 
        Parameters : (project, sequence)
        '''
        retFields = self.getFields('Sequence')
        return self.sg.find_one("Sequence", [["code", "is", sequence],['project','is',project]], retFields)
    
    def shot (self, project, shot):
        '''Returns the shotgun shot name and ID 
        Parameters : (project, shot)
        '''        
        retFields = self.getFields('Shot')
        return self.sg.find_one('Shot',[['code','is',shot],['project','is',project]],retFields)
    
    def createProject (self, project):
        '''Creates a project in Shotgun given a project name
        Parameters : (project)
        '''        
        filters = [['code','is','a']]
        template = self.sg.find_one('Project',[['name','is','a']],['layout_project','id'])
        data = {'name':project,
                'layout_project': template
                }
        return self.sg.create('Project',data)
    
    def createSequence (self, project, sequence):
        '''Creates a sequence in shotgun given 
        Parameters : (project, sequence)
        '''        
        data = {'project': {"type":"Project","id": project['id']},
                 'code': sequence}
        return self.sg.create('Sequence', data)
    
    def createShot (self, project, shot, seq='', taskTemplateName=''):
        '''Creates a sequence in shotgun given 
        Parameters : (project, shot, seq='', taskTemplateName='Basic shot template'
        '''          
        filters = [['code','is',taskTemplateName ]]
        template = self.sg.find_one('TaskTemplate',filters)
    
        data = { 'project': {"type":"Project","id": project['id']},
                 'code': shot,
                 'task_template' : template,
                 'description': '',
                 'self.sg_sequence': seq,
                 'self.sg_status_list': 'wtg' }
        result = self.sg.create('Shot', data)
        return result
    
    def notesFind (self, shotID):
        '''Find all notes on a shot 
        Parameters : (shotID)
        Output : Note data :
        ['tasks', 'attachments', 'updated_at', 'replies', 'id', 'subject', 'playlist', '
        addressings_to', 'created_by', 'content', 'sg_status_list', 'reply_content', 
        'updated_by', 'addressings_cc', 'read_by_current_user', 'user', 'note_links', 
        'created_at', 'sg_note_from', 'project', 'sg_note_type', 'tag_list']        
        '''
        note = self.sg.find('Note',[['note_links','is', shotID]],['subject','content', 'created_at'],[{'field_name':'created_at','direction':'desc'}])
        return note
    
    def notesFindLatest (self, shotID):
        '''Find the latest note on a shot
        Parameters : (shotID)
        Call with notesFindLatest(shot)['content'] for the note content only
        Output : Note data:
        ['tasks', 'attachments', 'updated_at', 'replies', 'id', 'subject', 'playlist', '
        addressings_to', 'created_by', 'content', 'sg_status_list', 'reply_content', 
        'updated_by', 'addressings_cc', 'read_by_current_user', 'user', 'note_links', 
        'created_at', 'sg_note_from', 'project', 'sg_note_type', 'tag_list']        
        '''
        note = self.notesFind(shotID)[0]
        return note
    
    
    def notesCreate(self, project, shotID, subject, content):
        '''Create a note for a shot given
        Parameters : (project, shotID, subject, content)
        Output : noteID
#.........这里部分代码省略.........
开发者ID:jiangjia,项目名称:vfxpipe,代码行数:103,代码来源:genericUtils.py

示例14: transform_asset

# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import create [as 别名]
FROM item i
JOIN product p ON i.product_id = p.product_id
WHERE product_n not like 'Unknown %'
ORDER BY item_sc DESC
''')

row = cur.fetchone()
while row:
    if not row['item_sc']:
        row = cur.fetchone()
        continue
    asset_data = transform_asset( row )

    existing_asset = sg.find_one('Asset', [['code','is',asset_data['code']]])

    if existing_asset:
        print "asset %s exists" % ( asset_data['code'] )
        sg.update('Asset', existing_asset['id'], asset_data)
    else:
        print "asset %s creating" % ( asset_data['code'] )
        try:
            sg.create('Asset', asset_data, return_fields=['id'])
            pass
        except Exception:
            pprint.pprint(row)
            pprint.pprint(asset_data)
    row = cur.fetchone()

conn.close()

开发者ID:achayan,项目名称:anim-studio-tools,代码行数:31,代码来源:syncAssets.py

示例15:

# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import create [as 别名]
    'project': {'type':'Project','id':146}
    }


asset = sg.find_one("Asset", [["code","is","afficheOeuvre"]], ["code"])

sg_user = sg.find_one('HumanUser', [['login', 'is', "houdon.thibault"]])
data = {
    'project': {'type':'Project','id':project_id},
    'note_links': [asset],
    'user': sg_user,
    'content':'Test',
    'subject':"Thibault's Note on afficheOeuvre"
    }

sg.create("Note", data)

#version = sg.create("Version", data)


#sg.upload("Version", version["id"], "Z:/Groupes-cours/NAND999-A15-N01/Nature/assets/mod/.thumb/blocCadre_01_full.jpg", "image", "Test")


# data = {
#     'project': {'type':'Project','id':project_id},
#     'code':'Test',
#     'description':'Finir le modeling du lion',
#     'sg_status_list':'ip',
#     'shots':xxxx_shot
#     }
开发者ID:ThibH,项目名称:project_manager,代码行数:32,代码来源:shotgun.py


注:本文中的shotgun_api3.Shotgun.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。