Skip to content

Instantly share code, notes, and snippets.

View defTechAndrew's full-sized avatar

Andrew Christophersen defTechAndrew

View GitHub Profile
@defTechAndrew
defTechAndrew / maya_mixin_widget.txt
Last active June 14, 2024 00:08
Base widget class for using Maya's MayaQWidgetDockableMixin class that handles showing and restoring of the UI.
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin
import maya.cmds as cmds
import PySide2.QtWidgets as qtwidgets
import maya.OpenMayaUI as omui
class DockableMixinWidget(MayaQWidgetDockableMixin, qtwidgets.QWidget):
_instance = None
_show_kwargs = {} # see kwargs for setDockableParameters in mayaMixin.py
@defTechAndrew
defTechAndrew / pymel_sucks.py
Created September 20, 2023 21:24
PyMel makes your code pretty and slow.
import timeit
pymel_setup = '''
import pymel.core as pm
def create_sphere():
s = pm.polySphere()[0]
for vertex in s.vtx:
vertex.setPosition((10, 10, 10))
pm.delete(s)'''
@defTechAndrew
defTechAndrew / fbx_animation_editing.py
Created April 1, 2019 22:01
Here are some useful calls I've developed for editing FBX animation files using the Python FBX SDK.
import FbxCommon
def fbx_trim_keys(scene, start, end, take_buffer=10):
"""
Uses the FBX SDK to remove unnecessary keys.
:param scene: FBX SDK scene class that hold data to edit
:param int start: start frame of animation keys to keep
:param int end: end frame of animation keys to keep