Skip to content

Instantly share code, notes, and snippets.

@awforsythe
awforsythe / tpose_to_apose.py
Created August 30, 2020 23:48
Quick Maya script that uses the OpenMaya API to make one joint hierarchy match the pose of another. Created so I could take a Unreal SkeletalMeshes authored in T-pose and rebind them in A-pose to exactly match the UE4 Mannequin from the AnimStarterPack.
"""
This is a quick Maya script designed to update a skeletal mesh (dst) to match
the joint transforms of a different skeletal mesh (src). This will only work
if both meshes have the same set of joints with identical names and joint
orientations.
My initial rationale for needing this script:
The UE4 Mannequin included in Epic's Animation Starter Pack is authored in
A-Pose, whereas the meshes in the Prototype Characters pack (from Ying Pei
{
"name": "Forsythe",
"author": "Alex Forsythe",
"variables":
{
"base_bg": "hsl(0, 0%, 13%)",
"base_fg": "hsl(0, 0%, 90%)",
"highlight_fg": "hsl(40, 100%, 80%)",
"highlight_fg_dim": "hsl(40, 80%, 70%)",
"""
switch_file_from_project.py
Place in any folder under %APPDATA%\Sublime Text 3\Packages, then add a
line to User Keybindings like so:
{ "keys": ["alt+o"], "command": "switch_file_from_project" }
A quick-and-dirty command for Sublime Text 3. Based on the built-in command
switch_project, but rather than looking for a file in the current file's
import random
import time
def get_snail_name():
class Letters(object):
def __init__(self):
self._chars = list('nnaaiieeuh') + ['gh']
@awforsythe
awforsythe / scrape_commenters.py
Last active December 21, 2015 08:19
Scrapes commenter usernames from a YouTube video using BeautifulSoup and the all_comments URL.
'''
scrape_commenters.py
by Alex Forsythe
19 August 2013
Uses the youtube all_comments page together with BeautifulSoup (not included in
the standard library) to generate a list of the users who have commented on a
specific video. Since YouTube aggressively throttles responses to all_comments,
it may take multiple attempts (separated by a lengthy timeout) to pull down all
comments.
@awforsythe
awforsythe / retrieve_commenters.py
Created August 20, 2013 03:01
Retrieves commenter usernames (up to the first 1000 comments) from a YouTube video using the v2 API.
'''
retrieve_commenters.py
by Alex Forsythe
19 August 2013
Uses the YouTube API v2 to generate a list of the users who have commented on a
specific video. Thanks to the limitations of this API, only examines the first
1000 comments.
1. Place this script in the desired directory.
@awforsythe
awforsythe / rename_selected_relation_box.py
Created April 18, 2013 02:33
Allows the user to rename boxes in MotionBuilder relation constraints.
'''
rename_selected_relation_box.py
Written by Alex Forsythe (awforsythe.com)
When executed, attempts to locate any selected box within any relation
constraint in the scene. If a selected relation box is found, prompts the user
to enter a new name for that box. Allows relation boxes to be given more
descriptive names. I'd recommend binding this script to a keyboard shortcut
(see MotionBuilder/bin/config/Scripts/ActionScript.txt) for quick access.
'''
@awforsythe
awforsythe / DeleteNamespace.py
Created April 5, 2013 20:00
Deletes all components in a MotionBuilder namespace. Slight adaptation of a script by Marcus Krautwurst: http://www.marcuskrautwurst.com/2013/04/deleting-objects-in-motionbuilder.html
def DeleteNamespace(namespace):
in_namespace = lambda c: ('%s:' % namespace) in c.LongName
delete_comp = lambda c: c.FBDelete()
delete_in_namespace = lambda cs: map(delete_comp, filter(in_namespace, cs))
scene = FBSystem().Scene
map(delete_in_namespace, [
scene.Constraints,