如果要通过脚本更新项目的核心版本以便采用非交互方式运行该版本,可以使用以下代码执行此操作:
import sys sys.path.append("<path_to_your_config>/install/core/python") import sgtk # substitute your Project id here or alternatively use sgtk_from_path() tk = sgtk.sgtk_from_entity('Project', 161) c=tk.get_command("core") # setup authentication if hasattr(sgtk, "set_authenticated_user"): from tank_vendor.shotgun_authentication import ShotgunAuthenticator user = ShotgunAuthenticator(sgtk.util.CoreDefaultsManager()).get_default_user() sgtk.set_authenticated_user(user) # finally, execute the command c.execute({})
此操作会将 Toolkit 核心更新为最新版本,而无需执行任何进一步交互或确认操作。如果您正在从共享核心运行,此操作将更新共享此核心版本的所有项目使用的核心版本!在继续之前,请确保了解这一点。
另请参见:
0 评论