Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated mario animation names and added automatic stashing #231

Merged
merged 3 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions fast64_internal/oot/oot_anim.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
getFrameInterval,
getTranslationRelativeToRest,
getRotationRelativeToRest,
stashActionInArmature,
)

from .oot_utility import (
Expand Down Expand Up @@ -330,7 +331,10 @@ def ootConvertLinkAnimationData(anim, armatureObj, convertTransformMatrix, *, fr
def ootExportNonLinkAnimation(armatureObj, convertTransformMatrix, skeletonName):
if armatureObj.animation_data is None or armatureObj.animation_data.action is None:
raise PluginError("No active animation selected.")

anim = armatureObj.animation_data.action
stashActionInArmature(armatureObj, anim)

ootAnim = OOTAnimation(toAlnum(skeletonName + anim.name.capitalize() + "Anim"))

skeleton = ootConvertArmatureToSkeletonWithoutMesh(armatureObj, convertTransformMatrix, skeletonName)
Expand Down Expand Up @@ -377,7 +381,10 @@ def ootExportNonLinkAnimation(armatureObj, convertTransformMatrix, skeletonName)
def ootExportLinkAnimation(armatureObj, convertTransformMatrix, skeletonName):
if armatureObj.animation_data is None or armatureObj.animation_data.action is None:
raise PluginError("No active animation selected.")

anim = armatureObj.animation_data.action
stashActionInArmature(armatureObj, anim)

ootAnim = OOTLinkAnimation(toAlnum(skeletonName + anim.name.capitalize() + "Anim"))

frame_start, frame_last = getFrameInterval(anim)
Expand Down Expand Up @@ -486,6 +493,8 @@ def ootImportNonLinkAnimationC(armatureObj, filepath, animName, actorScale, isCu

if armatureObj.animation_data is None:
armatureObj.animation_data_create()

stashActionInArmature(armatureObj, anim)
armatureObj.animation_data.action = anim


Expand Down Expand Up @@ -605,6 +614,8 @@ def ootImportLinkAnimationC(

if armatureObj.animation_data is None:
armatureObj.animation_data_create()

stashActionInArmature(armatureObj, anim)
armatureObj.animation_data.action = anim


Expand Down
7 changes: 6 additions & 1 deletion fast64_internal/sm64/sm64_anim.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
decompFolderMessage,
makeWriteInfoBox,
writeBoxExportType,
stashActionInArmature,
enumExportHeaderType,
)

Expand Down Expand Up @@ -348,7 +349,10 @@ def exportAnimationInsertableBinary(filepath, armatureObj, isDMA, loopAnim):
def exportAnimationCommon(armatureObj, loopAnim, name):
if armatureObj.animation_data is None or armatureObj.animation_data.action is None:
raise PluginError("No active animation selected.")

anim = armatureObj.animation_data.action
stashActionInArmature(armatureObj, anim)

sm64_anim = SM64_Animation(toAlnum(name + "_" + anim.name))

nodeCount = len(armatureObj.data.bones)
Expand Down Expand Up @@ -544,8 +548,9 @@ def importAnimationToBlender(romfile, startAddress, armatureObj, segmentData, is

if armatureObj.animation_data is None:
armatureObj.animation_data_create()
armatureObj.animation_data.action = anim

stashActionInArmature(armatureObj, anim)
armatureObj.animation_data.action = anim

def readAnimation(name, romfile, startAddress, segmentData, isDMA):
animationHeader = readAnimHeader(name, romfile, startAddress, segmentData, isDMA)
Expand Down
Loading