This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
import logging | |
import os | |
import re | |
import time | |
import click | |
LOG = logging.getLogger(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
import logging | |
import os | |
import click | |
import requests | |
LOG = logging.getLogger(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A Google app script that gathers threads from your inbox and sorts the | |
* sender domains by quantity of emails, then outputs to a spreadsheet. | |
*/ | |
/** Given a sender, return just the domain of the email address. */ | |
function getSenderDomain(sender) { | |
// parse from '"My Name" <[email protected]>' | |
var regex = RegExp("(?:<.*@)([^>]*)"); | |
var matches = regex.exec(sender); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a standard workspace using the primary root, sgtk user, and current host name. | |
# Intended to be run in the Python Console from ShotGrid Desktop. | |
import os | |
import socket | |
from pathlib import Path | |
import sgtk | |
p4fw = sgtk.platform.framework.load_framework(engine, engine.get_env(), 'tk-framework-perforce2_v0.x.x') | |
root_path = tk.roots['primary'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import json | |
def import_anim(path: str): | |
with open(path) as fp: | |
data = json.load(fp) | |
all_layers = get_layers(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shotgun_data = sgtk.platform.import_framework("tk-framework-shotgunutils", "shotgun_data") | |
shotgun_globals = sgtk.platform.import_framework("tk-framework-shotgunutils", "shotgun_globals") | |
shotgun_model = sgtk.platform.import_framework("tk-framework-shotgunutils", "shotgun_model") | |
task_manager = sgtk.platform.import_framework("tk-framework-shotgunutils", "task_manager") | |
class MyWidget(QtGui.QWidget): | |
def __init__(self, parent): | |
super().__init__(parent) | |
self._task_manager = task_manager.BackgroundTaskManager(self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymel.core as pm | |
def is_soft_edge(edge): | |
vtx_faces = pm.polyListComponentConversion(edge, fromEdge=True, toVertexFace=True) | |
expanded_vtx_faces = pm.filterExpand(vtx_faces, expand=True, selectionMask=70) | |
vtx_faces_by_vtx = dict() | |
for vtx_face in expanded_vtx_faces: | |
vtx = pm.polyListComponentConversion(vtx_face, fromVertexFace=True, toVertex=True) | |
vtx_str = str(vtx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymel.core as pm | |
def center_twist_joint(twist_joint, end_joint): | |
""" | |
Center a twist joint between it's parent and an end joint | |
""" | |
root_joint = twist_joint.getParent() | |
center = (root_joint.getTranslation(space='world') + end_joint.getTranslation(space='world')) / 2.0 | |
twist_joint.setTranslation(center, space='world') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymel.core as pm | |
def sort_by_name(nodes): | |
# get sorted list of nodes | |
sorted_nodes = sorted(nodes) | |
for node in sorted_nodes: | |
pm.reorder(node, back=True) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
# assumes a specific tk-core version is installed, other tk-core acquisition methods are available | |
tk_core_path = "C:/Program Files/Shotgun/Resources/Desktop/Python/bundle_cache/app_store/tk-core/v0.20.12/python" | |
# the project id to use for the context | |
project_id = 369 | |
sys.path.append(tk_core_path) | |
import sgtk |
NewerOlder