Skip to content

Instantly share code, notes, and snippets.

View tbttfox's full-sized avatar

Tyler Fox tbttfox

View GitHub Profile
@tbttfox
tbttfox / mayaToNumpy.py
Last active April 11, 2025 15:15
Blazing fast maya api types to Numpy conversion
from maya import OpenMaya as om
import numpy as np
from ctypes import c_float, c_double, c_int, c_uint
_CONVERT_DICT = {
om.MPointArray: (float, 4, c_double, om.MScriptUtil.asDouble4Ptr),
om.MFloatPointArray: (float, 4, c_float , om.MScriptUtil.asFloat4Ptr),
om.MVectorArray: (float, 3, c_double, om.MScriptUtil.asDouble3Ptr),
om.MFloatVectorArray: (float, 3, c_float , om.MScriptUtil.asFloat3Ptr),
om.MDoubleArray: (float, 1, c_double, om.MScriptUtil.asDoublePtr),
@tbttfox
tbttfox / fuzzyfinder.py
Created December 2, 2016 20:27
Python no-import fuzzy finder
def fuzzyfinder(pattern, collection):
results = []
for item in collection:
key = []
# Start the find at the beginning of the string
index = -1
for x in pattern:
# Find the next letter in the pattern after the prevous match