本文整理汇总了Python中ShotgunORM.addOnEntityCreate方法的典型用法代码示例。如果您正苦于以下问题:Python ShotgunORM.addOnEntityCreate方法的具体用法?Python ShotgunORM.addOnEntityCreate怎么用?Python ShotgunORM.addOnEntityCreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShotgunORM
的用法示例。
在下文中一共展示了ShotgunORM.addOnEntityCreate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onEntityCreate
# 需要导入模块: import ShotgunORM [as 别名]
# 或者: from ShotgunORM import addOnEntityCreate [as 别名]
# The callback that will be registered to onEntityCreate() and will add the
# name field to ApiUser Entity objects.
#
################################################################################
def addApiUserNameField(sgEntity):
'''
This example callback shows how to add user fields to Entity objects as they
are created.
A SgUserField will be created for all ApiUser Entity objects that adds a name
field for the Entity. ApiUsers do not contain a "name" field as part of the
Shotgun schema.
'''
if sgEntity.type == 'ApiUser':
if not sgEntity.hasField('name'):
sgEntity.addField(ApiUserNameField())
################################################################################
#
# Register the callback with ShotgunORM onEntityCreate().
#
################################################################################
ShotgunORM.addOnEntityCreate(
addApiUserNameField,
filterName='ApiUser',
description='callback that adds a name field to ApiUser Entity objects'
)