Last active
December 28, 2015 09:48
-
-
Save yamahigashi/7481145 to your computer and use it in GitHub Desktop.
Unity3d で 自動クリップ作成サンプル
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
class FbxImporter(AssetPostprocessor): | |
def OnPostprocessModel(go as GameObject): | |
im as ModelImporter = assetImporter | |
ap as string = assetPath | |
make_clip(im, ap) | |
def make_clip(importer as ModelImporter, path as string): | |
AssetDatabase.StartAssetEditing() | |
log "アニメーション分割開始" | |
motions as ArrayList = motionSplitInfoFromConfig(path) | |
mica as (ModelImporterClipAnimation) = array(ModelImporterClipAnimation, motions.Count) | |
for i as int, entry as ArrayList in enumerate(motions): | |
clipName = fname + entry[0] | |
start = entry[1] | |
try: | |
end = entry[2] | |
except ArgumentOutOfRangeException: | |
end = _getFBXFrame(path) | |
mica[i] = ModelImporterClipAnimation() | |
mica[i].takeName = clipName | |
mica[i].name = clipName | |
mica[i].firstFrame = start | |
mica[i].lastFrame = end | |
importer.clipAnimations = mica | |
EditorApplication.SaveAssets() | |
AssetDatabase.StopAssetEditing() | |
AssetDatabase.Refresh() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment