Skip to content

Instantly share code, notes, and snippets.

@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
@tbttfox
tbttfox / mayaToNumpy.py
Last active May 8, 2024 07:50
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),
# python api1.0 getWeight(),setWeights()
# http://ueta.hateblo.jp/entry/2015/08/24/102937
import time
import maya.OpenMaya as OpenMaya
import maya.OpenMayaAnim as OpenMayaAnim
#_time = time.time
_time = time.clock
# python api2.0 setWeights(),setWeight()
# http://ueta.hateblo.jp/entry/2015/08/24/102937
import time
import maya.api.OpenMaya as OpenMaya2
import maya.api.OpenMayaAnim as OpenMayaAnim2
#_time = time.time
_time = time.clock
@mrkline
mrkline / c_sharp_for_python.md
Last active May 6, 2024 12:43
An intro to C# for a Python developer. Made for one of my coworkers.

C# For Python Programmers

Syntax and core concepts

Basic Syntax

  • Single-line comments are started with //. Multi-line comments are started with /* and ended with */.

  • C# uses braces ({ and }) instead of indentation to organize code into blocks. If a block is a single line, the braces can be omitted. For example,

@raphigaziano
raphigaziano / qtdbg.py
Last active August 16, 2021 15:12
A simple PyQt output widget which can be used as basic debug console
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
qtdbg.py
A simple PyQt output widget.
It's main use case is to serve as an output console, for debugging or
other purposes.
It provides a file-like interface for ease of integration with other
python features such as the logging module, on top of a slightly