Created
May 10, 2019 09:29
-
-
Save tokejepsen/7beb77760aa06f0aec47eb17555f29e0 to your computer and use it in GitHub Desktop.
mGear Post Script StudioLibrary Import
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 os | |
import pymel.core as pc | |
from studiolibrarymaya import animitem | |
basename = os.path.basename(pc.sceneName()) | |
filename = os.path.splitext(basename)[0] | |
directory = os.path.dirname(pc.sceneName()) | |
# Find *.anim folder starting with same name as current file | |
anim_folder = None | |
for f in os.listdir(directory): | |
if f == (filename + ".anim"): | |
anim_folder = f | |
# Loading an animation item | |
if anim_folder: | |
item = animitem.AnimItem(os.path.join(directory, anim_folder)) | |
item.load( | |
objects=[], | |
namespaces=[], | |
option=animitem.PasteOption.ReplaceCompletely, | |
connect=False, | |
currentTime=False | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment