Skip to content

Instantly share code, notes, and snippets.

View kporangehat's full-sized avatar
🏠
Working from home

KP kporangehat

🏠
Working from home
View GitHub Profile
@kporangehat
kporangehat / sgtk_user_auth_interactive.py
Last active September 25, 2017 23:38
Shotgun Toolkit Authentication examples
# Import Toolkit so we can access to Toolkit specific features.
import sgtk
# Import the ShotgunAuthenticator from the tank_vendor.shotgun_authentication
# module. This class allows you to authenticate either programmatically or, in this
# case, interactively.
from tank_vendor.shotgun_authentication import ShotgunAuthenticator
# Instantiate the CoreDefaultsManager. This allows the ShotgunAuthenticator to
# retrieve the site, proxy and optional script_user credentials from shotgun.yml
@kporangehat
kporangehat / filter_publishes.py
Last active April 8, 2021 23:08
Shotgun Toolkit filter_publishes hook for tk-multi-workfiles2. This hook ensures path cache entries are generated for any publishes that were generated using `register_publish()` for entities that may not have folders created yet.
import os
import re
import sgtk
HookClass = sgtk.get_hook_baseclass()
class FilterPublishes(HookClass):
"""
@kporangehat
kporangehat / transfer_worker.py
Created November 23, 2021 20:34
adding Group from addressings to the context in Create Shipment
# We use the Project context, not the app context, to evaluate the root for all local copies, which shouldn't be
# dependent on individual Versions. This allow as well to have a template defined as a `path` template
# instead of a `string` template and not having TK failing for a missing path on the file system.
project_context = self._app.sgtk.context_from_entity_dictionary(
self._app.context.project
)
field_data = project_context.as_template_fields(
template,
)
@kporangehat
kporangehat / dialog.py
Created February 9, 2023 20:44
SGTK App with QScrollArea tabs example
# Copyright (c) 2013 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.