本文整理汇总了Python中shotgun_api3.Shotgun.schema_field_create方法的典型用法代码示例。如果您正苦于以下问题:Python Shotgun.schema_field_create方法的具体用法?Python Shotgun.schema_field_create怎么用?Python Shotgun.schema_field_create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shotgun_api3.Shotgun
的用法示例。
在下文中一共展示了Shotgun.schema_field_create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import schema_field_create [as 别名]
#.........这里部分代码省略.........
# create the note
noteID = self.sg.create('Note',data)
return noteID
def versionCreate(self, project, shot, verName, description, framePath, firstFrame, lastFrame, clientName=None, sourceFile=None, task=None, user=None, final=False, makeThumb=False, makeThumbShot=False):
'''Create a version
Parameters : (project, shotID, verName, description, framePath, firstFrame, lastFrame, clientName=None, sourceFile=None, task=None)
Output : versionID
'''
data = {'project': project,
'code': verName,
'description': description,
'sg_path_to_frames': framePath,
#'sg_frame_range': str(firstFrame) + '-' + str(lastFrame),
'sg_first_frame' : int(firstFrame),
'sg_last_frame' : int(lastFrame),
'sg_status_list': 'rev',
'entity': shot}
#if user != None:
#data['user']
if task != None:
filters = [['content','is',task],['entity','is',shot]]
taskID = self.sg.find_one('Task',filters)
data['sg_task']=taskID
#if final == True and 'send
# in case we're putting a client version in here we need this code.
# we are expecting a field called self.sg_client_name in the version table.
# please make sure you create this in the shotgun setup
# read the schema and if the client_name is not found, create it.
'''
versionFields = self.sg.schema_field_read('Version')
if 'sg_client_name' not in versionFields and clientName != None:
newField = self.sg.schema_field_create('Version','text','Client Name')
if clientName != None :
data['sg_client_name'] = clientName
#'user': {'type':'HumanUser', 'id':165} }
# here we need to create a field for storing the source file that created this version.
# if it's not there, create the field, and if it's there just update it.
if 'sg_source_file' not in versionFields and sourceFile != None:
newField = self.sg.schema_field_create('Version','text','Source File')
if sourceFile != None:
data['sg_source_file'] = sourceFile
'''
versionData = self.sg.create('Version',data)
# handle the thumbnail grabbing here
middleFrame = (int(firstFrame) + int(lastFrame)) / 2
padding, padString = fxpipe.framePad(framePath)
paddedFrame = padString % (middleFrame)
if makeThumb == True:
thumbData = self.sg.upload_thumbnail('Version', versionData['id'], framePath.replace(padding,paddedFrame))
if makeThumbShot == True:
thumbData = self.sg.upload_thumbnail('Shot', shot['id'], framePath.replace(padding,paddedFrame))
return versionData
#add a task version to the system
def versionCreateTask(self, project, shot, verName, description, framePath, firstFrame, lastFrame, task, sourceFile = ''):
'''
DEPRECATED : USE versionCreate instead with the task='TASKNAME'
Parameters : (project, shot, verName, description, framePath, firstFrame, lastFrame, task, sourceFile = '')
Output : Version ID
'''
示例2: legwork
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import schema_field_create [as 别名]
elif method == 'find_one':
result = sg.find_one(payload['entity'], payload['filters'], payload['fields'], payload['order'], payload['filter_operator'])
elif method == 'create':
result = sg.create(payload['entity'], payload['data'])
elif method == 'update':
result = sg.update(payload['entity'], payload['id'], payload['data'])
elif method == 'delete':
result = sg.delete(payload['entity'], payload['id'])
elif method == 'upload':
result = sg.upload(payload['entity'], payload['id'], payload['path'], payload['field_name'], payload['display_name'])
elif method == 'upload_thumbnail':
result = sg.upload_thumbnail(payload['entity'], payload['id'], payload['path'])
elif method == 'schema_field_read':
result = sg.schema_field_read(payload['entity'])
elif method == 'schema_field_create':
result = sg.schema_field_create(payload['entity'], payload['type'], payload['name'], payload['attrs'])
elif method == '_url_for_attachment_id':
entity_id = payload['id']
# Do a lot of legwork (based on Shotgun.download_attachment())
sid = sg._get_session_token()
domain = urlparse(sg.base_url)[1].split(':',1)[0]
cj = cookielib.LWPCookieJar()
c = cookielib.Cookie('0', '_session_id', sid, None, False, domain, False, False, "/", True, False, None, True, None, None, {})
cj.set_cookie(c)
cookie_handler = urllib2.HTTPCookieProcessor(cj)
urllib2.install_opener(urllib2.build_opener(cookie_handler))
url = '%s/file_serve/attachment/%s' % (sg.base_url, entity_id)
request = urllib2.Request(url)
request.add_header('User-agent','Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.7) Gecko/2009021906 Firefox/3.0.7')