Skip to content

Instantly share code, notes, and snippets.

View Meatplowz's full-sized avatar

Randall Meatplowz

View GitHub Profile
@Meatplowz
Meatplowz / FBX_Scene.py
Last active January 24, 2024 06:03
This is a wrapper FBX class useful in accessing and modifying the FBX Scene
"""
MIT License
Copyright (c) [year] [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@Meatplowz
Meatplowz / maya_external_client.py
Last active June 29, 2023 06:28
Maya Threaded Server example with Client
"""
External Maya Client
This can be run outside of Maya
Use in idle or an IDE that can accept input.
"""
import socket
import logging
@Meatplowz
Meatplowz / performFileDropAction.mel
Last active June 28, 2023 14:21
Override the Maya Drag and Drop Behavior for File Open/Import
// Randall Hess randall.hess@gmail.com
// Instructions: Copy this file over your local maya version to override the default behavior
// Maya 2022 and Higher
// Additional: You can also build and load this as a module and not overwrite the local maya file.
// Location: C:\Program Files\Autodesk\MayaXX\scripts\others\performFileDropAction.mel
global proc int
performFileDropAction (string $theFile)
@Meatplowz
Meatplowz / maya_psyide_ui_convert.py
Last active March 9, 2023 01:36
Convert a designer .UI file to .Py file and insert into an existing .Py tool file
import os
from shutil import copyfile
try:
# Pyside
from pysideuic import compileUi
except:
# Pyside2
from pyside2uic import compileUi
@Meatplowz
Meatplowz / create_pivot_bone.py
Last active June 20, 2022 22:32
Create a joint based on the manipulator position and orientation
import maya.cmds as cmds
import pymel.core as pymel
def create_pivot_bone():
"""
Create a bone from the customPivot context
In component mode of a mesh:
Press "D" or "Insert" to go into custom pivot context
If you click on edges verts or faces the pivot will auto align
@Meatplowz
Meatplowz / FBX_Character_Cleanup.py
Last active January 20, 2022 15:22
This is used with the FBX_Scene Class in cleaning up an exported skeletal mesh fbx
import FBX_Scene
import FbxCommon
def clean_character_scene(fbx_filename):
"""
Clean up character fbx file
"""
# open the fbx scenes and get the scene nodes
fbx_file = FBX_Class(fbx_filename)
if not fbx_file:
@Meatplowz
Meatplowz / get_clipboard_data.py
Created April 25, 2017 15:04
Maya get_clipboard_data
def get_clipboard_data():
"""
Get data from the clipboard
*Arguments:*
* ``None``
*Keyword Arguments:*
* ``None``
@Meatplowz
Meatplowz / FBX_Remove_Layers.py
Last active November 29, 2019 08:09
Remove Display Layers from an FBX Scene
def remove_layers(fbx_file, layers):
"""
Remove layers from the FBX Scene
"""
layer_names = []
for layer in layers:
layer_names.append(layer.GetName())
# set these property values
try:
@Meatplowz
Meatplowz / adjust_pv_to_elbow.py
Last active November 29, 2019 08:08
Brute force method to adjust the poleVector of one ik chain to line up the elbow joint of a similar arm chain
'''
Brute force method to adjust the poleVector of one ik chain
to line up the elbow joint of a similar arm chain
'''
import pymel.core as pymel
import maya.OpenMaya as OpenMaya
def adjust_pv_to_elbow(poleVector, ik_elbow, elbow):
"""
def unparent_nodes(fbx_filename):
'''
Unparent Hiearchy Nodes
In an effort to clean your fbx scene
This code is looking for specific nodes in your scene
In my example I have a heirarchy that houses an entire character or weapon
Character
-> Rig_Group
-> Bind_Skeleton (root)