Skip to content

Instantly share code, notes, and snippets.

View tbttfox's full-sized avatar

Tyler Fox tbttfox

View GitHub Profile
@tbttfox
tbttfox / print_alembic_hierarchy.py
Last active June 4, 2025 18:03
A quick script to print the hierarchy of an alembic file and its properties.Sorry, no nice command line interface. You've gotta edit it yourself
import os
from alembic.Abc import IArchive
from alembic.AbcGeom import (
IXform,
IPolyMesh,
ICamera,
ICurves,
ILight,
INuPatch,
IPoints,
@tbttfox
tbttfox / quickKeys.py
Created May 31, 2025 18:08
Plugin to set keys on multiple attributes over multiple frames
from __future__ import absolute_import, print_function
import sys
import maya.api.OpenMaya as OpenMaya
import maya.api.OpenMayaAnim as OpenMayaAnim
from six.moves import range
maya_useNewAPI = True
"""Build a matrix from translation values
This should give you a feel for how transformation matrices actually WORK in Maya.
Transformation matrices can be thought of as 3 vectors, and a point.
So I made 4 objects. One representing each of the X Y and Z axis vectors
And a fourth representing the translation point.
Then I connected the translation values of each object to a fourByFourMatrix node which
builds a matrix from 16 values. Then I connected that matrix to the model.
@tbttfox
tbttfox / blendPose.py
Last active May 8, 2025 18:38
An example poseBlending maya plugin using the same idea as my poseblendlib
import maya.api.OpenMaya as om2
import numpy as np
maya_useNewAPI = True
class blendPose(om2.MPxNode):
typeName = "blendPose"
typeId = om2.MTypeId(0x00122717)
@tbttfox
tbttfox / poseblendlib.py
Created May 2, 2025 23:14
Blendshapes, but for quaternions.
import numpy as np
def positve_scalar(q: np.ndarray) -> np.ndarray:
"""Ensure the scalar value of an array of quaternions is positive"""
shape = q.shape
q = q.reshape((-1, 4))
q[q[:, 3] < 0] *= -1
return q.reshape(shape)
@tbttfox
tbttfox / numpytoimath.py
Last active April 12, 2025 01:02
Pure python implementation of imathnumpy for opexr and alembic
import imath
import ctypes
import numpy as np
from typing import TypeVar, Type
NTYPEDICT: dict[type, type] = {
ctypes.c_bool: bool,
ctypes.c_byte: np.int8,
ctypes.c_double: np.float64,
from __future__ import print_function
import os
import shutil
import time
from maya import cmds
RELEASE_TYPES = ["Debug", "RelWithDebInfo", "Release"]
def reloadPlugin(
from maya import cmds
from itertools import groupby
def mayaSelRange(vals):
"""Convert maya cmds.ls() component selection list into indices
Arguments:
vals (list): A list of components like what you get out of cmds.ls(sl=True)
@tbttfox
tbttfox / Maya2020.natvis
Created August 17, 2022 06:09
A file that enables sane viewing of Maya 2020 array types in the Visual Studio debugger
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="Autodesk::Maya::OpenMaya20200000::MAttributePatternArray">
<DisplayString>{{ length = {((size_t*)(arr))[4]} }}</DisplayString>
<Expand>
<Item Name="[Length]">((size_t*)(arr))[4]</Item>
<ArrayItems>
<Size>((size_t*)(arr))[4]</Size>
<ValuePointer>debugPeekValue</ValuePointer>
</ArrayItems>
def combineFaces(faces, edgesToDelete):
""" This is where the edge deletion actually happens
Turn a group of connected faces into a new polygon
"""
# TODO
pass
def deleteEdges(counts, connects, edgesToDelete):