This file contains hidden or 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 maya.api.OpenMaya as om2 | |
import numpy as np | |
maya_useNewAPI = True | |
class blendPose(om2.MPxNode): | |
typeName = "blendPose" | |
typeId = om2.MTypeId(0x00122717) |
This file contains hidden or 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 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) |
This file contains hidden or 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 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, |
This file contains hidden or 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 print_function | |
import os | |
import shutil | |
import time | |
from maya import cmds | |
RELEASE_TYPES = ["Debug", "RelWithDebInfo", "Release"] | |
def reloadPlugin( |
This file contains hidden or 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 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) |
This file contains hidden or 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
<?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> |
This file contains hidden or 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
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): |
This file contains hidden or 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 numpy as np | |
import imath | |
from ctypes import ( | |
c_bool, c_byte, c_ubyte, c_short, c_ushort, | |
c_int, c_uint, c_float, c_double | |
) | |
# imathArrayType: (numpyDType, ctype, dim, dataShape) | |
_CONVERT_DICT = { | |
# vertices |
This file contains hidden or 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
setlocal | |
SET BUILD=mayabuild18 | |
SET MAYA_VERSION=2018 | |
SET COMPILER=Visual Studio 15 2017 Win64 | |
SET PFX=%~dp0 | |
cd %PFX% | |
rmdir %BUILD% /s /q | |
mkdir %BUILD% |
This file contains hidden or 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 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), |
NewerOlder