This file contains 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
""" | |
Functions for generating spline weights. | |
Usage: | |
This modules functions each take curve parameters and output control point weights. The weights are generated using | |
a modified version of de Boor's algorithm. These weights can be used to create a weighted sum to find a point or | |
tangent on a spline. | |
While these functions are written for usage in Autodesk Maya, they don't actually have any Maya-specific libraries. | |
Additionally none of these functions actually care about the data type of provided control points. This way these |
This file contains 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
# Public domain | |
from pymel import core as pm | |
import re | |
def resetJointOnCluster(joint, skinClusterPreMatrixPlug): | |
inverseMatrix = joint.attr('worldInverseMatrix').get() | |
curMatrix = skinClusterPreMatrixPlug.get() | |
if curMatrix is not None: | |
different = any(abs(a-b) > 0.00001 for a, b in zip(inverseMatrix, curMatrix)) |
This file contains 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 pymel.core as pm | |
""" | |
Take a collection of attributes and interpolate them along a curve. | |
It uses a master remapValue that drives multiple remapValues | |
to simulate the effect of a multi-out curve node. | |
References to "twist", because it was originally written for twisting ribbon IK | |
But it can interpolate any custom attributes you wish | |
Written by Chris Lesage, June 2019 |
This file contains 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.cmds as cmds | |
''' | |
# EXAMPLE USAGES: | |
# Removes all unused influences from skinCluster1 | |
remove_unused_influences('skinCluster1') | |
# Removes the two specified joints from Body_SkinCluster, | |
but only if they are not currently weighted to anything. | |
remove_unused_influences('Body_SkinCluster', ['leg_L0_5_jnt', 'leg_R0_5_jnt']) |
This file contains 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 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 |
This file contains 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 pyfbsdk import FBSystem, FBNamespaceAction, FBPlugModificationFlag | |
def DeleteNameSpace(namespace): | |
FBSystem().Scene.NamespaceDeleteContent(namespace, FBPlugModificationFlag.kFBPlugAllContent, True) | |
def AddNamespace(components, namespace): | |
for comp in components: | |
comp.ProcessObjectNamespace(FBNamespaceAction.kFBConcatNamespace, namespace) | |
def SafeDeleteList(components): |
This file contains 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 bpy | |
path = bpy.path.abspath('//') #path of .blend | |
objname = bpy.context.active_object.name #select rig | |
singleanim = True | |
if singleanim == True: | |
action = bpy.context.active_object.animation_data.action |
This file contains 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
# Credit to Ryan Porter (yantor3d) | |
from maya import cmds | |
for jnt in cmds.ls(sl=True, type="joint"): | |
matrixPlugs = cmds.listConnections(jnt + ".worldMatrix", type="skinCluster", p=True) or [] | |
for mp in matrixPlugs: | |
bindPreMatrixPlug = mp.replace('matrix', 'bindPreMatrix') | |
if cmds.listConnections(bindPreMatrixPlug, s=True, d=False): |
This file contains 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
""" | |
Example of callbacks used for Blender integer property | |
""" | |
import bpy | |
# Some global values | |
values = {} | |
default_value = -1 |
NewerOlder