diff --git a/fast64_internal/oot/oot_anim.py b/fast64_internal/oot/oot_anim.py index 49fc71b9c..57a4a26fc 100644 --- a/fast64_internal/oot/oot_anim.py +++ b/fast64_internal/oot/oot_anim.py @@ -12,6 +12,7 @@ getFrameInterval, getTranslationRelativeToRest, getRotationRelativeToRest, + stashActionInArmature, ) from .oot_utility import ( @@ -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) @@ -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) @@ -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 @@ -605,6 +614,8 @@ def ootImportLinkAnimationC( if armatureObj.animation_data is None: armatureObj.animation_data_create() + + stashActionInArmature(armatureObj, anim) armatureObj.animation_data.action = anim diff --git a/fast64_internal/sm64/sm64_anim.py b/fast64_internal/sm64/sm64_anim.py index 676883c60..0d0c669f5 100644 --- a/fast64_internal/sm64/sm64_anim.py +++ b/fast64_internal/sm64/sm64_anim.py @@ -33,6 +33,7 @@ decompFolderMessage, makeWriteInfoBox, writeBoxExportType, + stashActionInArmature, enumExportHeaderType, ) @@ -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) @@ -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) diff --git a/fast64_internal/sm64/sm64_constants.py b/fast64_internal/sm64/sm64_constants.py index c16864f10..ed20b6dd0 100644 --- a/fast64_internal/sm64/sm64_constants.py +++ b/fast64_internal/sm64/sm64_constants.py @@ -1802,213 +1802,213 @@ def __init__(self, geoAddr, level, switchDict): marioAnimations = [ # ( Adress, "Animation name" ), - ( 5162640, "0 - Climb up ledge (right leg going up)"), - ( 5165520, "1 - Thrown from painting"), - ( 5165544, "2 - Blown by wind"), - ( 5172396, "3 - Dying on ground"), + ( 5162640, "0 - Slow ledge climb up"), + ( 5165520, "1 - Fall over backwards"), + ( 5165544, "2 - Backward air kb"), + ( 5172396, "3 - Dying on back"), ( 5177044, "4 - Backflip"), - ( 5179584, "5 - Climbing up tree movement"), - ( 5185656, "6 - In tree"), - ( 5186824, "7 - Swinging from tree"), - ( 5186848, "8 - Go back into tree"), - ( 5191920, "9 - Jump out of tree from hand stand"), - ( 5194740, "10 - Hand stand in tree"), - ( 5194764, "11 - Go back from hand stand"), - ( 5188592, "12 - Hand stand in tree"), - ( 5196388, "13 - In tree?"), - ( 5197436, "14 - Standing straight with arms out"), + ( 5179584, "5 - Climbing up pole"), + ( 5185656, "6 - Grab pole short"), + ( 5186824, "7 - Grab pole swing part 1"), + ( 5186848, "8 - Grab pole swing part 2"), + ( 5191920, "9 - Handstand idle"), + ( 5194740, "10 - Handstand jump"), + ( 5194764, "11 - Start handstand"), + ( 5188592, "12 - Return from handstand"), + ( 5196388, "13 - Idle on pole"), + ( 5197436, "14 - A pose"), ( 5197792, "15 - Skid on ground"), - ( 5197816, "16 - Skid on ground, go back to normal"), - ( 5199596, "17 - Crouching"), - ( 5201048, "18 - Return from long jump"), - ( 5202644, "19 - Forward long jump"), - ( 5204600, "20 - Backward long jump"), - ( 5205980, "21 - Launched from cannon"), - ( 5207188, "22 - Walk while holding small object"), - ( 5211916, "23 - Run while holding small object?"), - ( 5215136, "24 - Walk while holding small object?"), - ( 5219864, "25 - Cold, rubbing hands together"), - ( 5225496, "26 - Cold (part 2)"), - ( 5226920, "27 - Cold (part 3)"), - ( 5230056, "28 - Climb on ledge"), - ( 5231112, "29 - Waving"), - ( 5232768, "30 - Look upward"), - ( 5234576, "31 - Look upward then downward"), - ( 5235700, "32 - Summon Peach"), - ( 5243100, "33 - Lift hand"), - ( 5245988, "34 - Take cap off"), - ( 5248016, "35 - Walking at end, looking backward to sky"), - ( 5256508, "36 - Look backward then run (at end)"), - ( 5266160, "37 - Lift hand (slower?)"), - ( 5274456, "38 - Fly at end"), - ( 5282084, "39 - Peace sign"), - ( 5291340, "40 - Get out of sand / snow"), - ( 5292628, "41 - Jumping from lava"), - ( 5293488, "42 - Flying (wing cap)"), - ( 5295016, "43 - Hang onto monkey-bar"), - ( 5296876, "44 - Thrown onto ground"), - ( 5296900, "45 - Thrown forward"), - ( 5302796, "46 - Dying while on stomach"), - ( 5306100, "47 - Dying in gas"), - ( 5313796, "48 - Coughing in gas"), - ( 5319500, "49 - Throw key in air, catch it"), - ( 5330436, "50 - Normal death"), - ( 5338604, "51 - Hang from ledge"), - ( 5341720, "52 - Lift up on ledge quickly"), - ( 5343296, "53 - Wobble while on monkey-bars"), - ( 5347276, "54 - Put hat on"), - ( 5351252, "55 - Putting star under hat"), - ( 5358356, "56 - Putting star under hat (part 2)"), - ( 5359476, "57 - Head stuck under sand"), - ( 5372172, "58 - Sliding on bottom"), - ( 5372824, "59 - Triple jump then ground-pound"), - ( 5374304, "60 - Ground-pound"), - ( 5374328, "61 - Ground-pound part"), - ( 5375380, "62 - Bottom stuck in snow / sand"), - ( 5387148, "63 - Standing and holding small object"), - ( 5390520, "64 - Pick up small object"), - ( 5391892, "65 - Jump with small object (wearing wing cap)"), - ( 5392704, "66 - Pick up small object"), - ( 5393936, "67 - Coming down with small object (wearing wing cap)"), - ( 5394296, "68 - Slide then fall with small object"), - ( 5395224, "69 - Sliding with small object"), - ( 5395248, "70 - Get up from ground with small object"), - ( 5396716, "71 - On Koopa shell"), - ( 5397832, "72 - Walking (not running)"), - ( 5403208, "73 - Side flip?"), - ( 5404784, "74 - Jump while riding shell"), - ( 5405676, "75 - Landing from double jump"), - ( 5407340, "76 - Mid-air part of double jump"), - ( 5408288, "77 - Normal jump"), - ( 5408312, "78 - Land from normal jump"), - ( 5411044, "79 - Kick in mid-air"), - ( 5412900, "80 - Double jump"), - ( 5413596, "81 - Triple jump?"), - ( 5414876, "82 - Throw object"), - ( 5416032, "83 - Slide kick"), - ( 5418280, "84 - On Koopa shell"), - ( 5419872, "85 - Legs stuck under snow / sand"), - ( 5431416, "86 - Fall from height"), - ( 5431440, "87 - Fall hard from double jump"), - ( 5433276, "88 - Picked up by enemy"), - ( 5434636, "89 - Pick up large object"), - ( 5437964, "90 - Get up after being thrown"), - ( 5441520, "91 - Launch into flying position"), - ( 5442516, "92 - Move on monkey-bars"), - ( 5444052, "93 - Move on monkey-bars (part 2)"), - ( 5445472, "94 - Missing cap after getting star"), - ( 5457860, "95 - Open door and walk in"), - ( 5463196, "96 - Exit door"), - ( 5467492, "97 - Open door with key"), - ( 5480428, "98 - Unknown, looks like Mario is bowing"), - ( 5481448, "99 - Similar to last"), - ( 5483352, "100 - Animates both last"), - ( 5484876, "101 - Unknown, Mario moves arms"), - ( 5486852, "102 - Kick in mid-air and land"), - ( 5489076, "103 - Unknown, similar to 04F14C, punch left?"), - ( 5489740, "104 - Punch left (part 2)"), - ( 5490356, "105 - Punch right"), - ( 5491396, "106 - Punch left (part 3)"), - ( 5492732, "107 - Pick up small object and stand"), - ( 5493948, "108 - Push against something while walking"), - ( 5495508, "109 - Jump on Koopa shell (part 2)"), - ( 5497072, "110 - Set small object down"), - ( 5498484, "111 - Special triple jump"), - ( 5498508, "112 - Similar to last, backward"), - ( 5498884, "113 - Do a trip and go back to crouching"), + ( 5197816, "16 - Stop skid"), + ( 5199596, "17 - Crouch from fast longjump"), + ( 5201048, "18 - Crouch from a slow longjump"), + ( 5202644, "19 - Fast longjump"), + ( 5204600, "20 - Slow longjump"), + ( 5205980, "21 - Airborne on stomach"), + ( 5207188, "22 - Walk with light object"), + ( 5211916, "23 - Run with light object"), + ( 5215136, "24 - Slow walk with light object"), + ( 5219864, "25 - Shivering and warming hands"), + ( 5225496, "26 - Shivering return to idle "), + ( 5226920, "27 - Shivering"), + ( 5230056, "28 - Climb down on ledge"), + ( 5231112, "29 - Credits - Waving"), + ( 5232768, "30 - Credits - Look up"), + ( 5234576, "31 - Credits - Return from look up"), + ( 5235700, "32 - Credits - Raising hand"), + ( 5243100, "33 - Credits - Lowering hand"), + ( 5245988, "34 - Credits - Taking off cap"), + ( 5248016, "35 - Credits - Start walking and look up"), + ( 5256508, "36 - Credits - Look back then run"), + ( 5266160, "37 - Final Bowser - Raise hand and spin"), + ( 5274456, "38 - Final Bowser - Wing cap take off"), + ( 5282084, "39 - Credits - Peach sign"), + ( 5291340, "40 - Stand up from lava boost"), + ( 5292628, "41 - Fire/Lava burn"), + ( 5293488, "42 - Wing cap flying"), + ( 5295016, "43 - Hang on owl"), + ( 5296876, "44 - Land on stomach"), + ( 5296900, "45 - Air forward kb"), + ( 5302796, "46 - Dying on stomach"), + ( 5306100, "47 - Suffocating"), + ( 5313796, "48 - Coughing"), + ( 5319500, "49 - Throw catch key"), + ( 5330436, "50 - Dying fall over"), + ( 5338604, "51 - Idle on ledge"), + ( 5341720, "52 - Fast ledge grab"), + ( 5343296, "53 - Hang on ceiling"), + ( 5347276, "54 - Put cap on"), + ( 5351252, "55 - Take cap off then on"), + ( 5358356, "56 - Quickly put cap on"), + ( 5359476, "57 - Head stuck in ground"), + ( 5372172, "58 - Ground pound landing"), + ( 5372824, "59 - Triple jump ground-pound"), + ( 5374304, "60 - Start ground-pound"), + ( 5374328, "61 - Ground-pound"), + ( 5375380, "62 - Bottom stuck in ground"), + ( 5387148, "63 - Idle with light object"), + ( 5390520, "64 - Jump land with light object"), + ( 5391892, "65 - Jump with light object"), + ( 5392704, "66 - Fall land with light object"), + ( 5393936, "67 - Fall with light object"), + ( 5394296, "68 - Fall from sliding with light object"), + ( 5395224, "69 - Sliding on bottom with light object"), + ( 5395248, "70 - Stand up from sliding with light object"), + ( 5396716, "71 - Riding shell"), + ( 5397832, "72 - Walking"), + ( 5403208, "73 - Forward flip"), + ( 5404784, "74 - Jump riding shell"), + ( 5405676, "75 - Land from double jump"), + ( 5407340, "76 - Double jump fall"), + ( 5408288, "77 - Single jump"), + ( 5408312, "78 - Land from single jump"), + ( 5411044, "79 - Air kick"), + ( 5412900, "80 - Double jump rise"), + ( 5413596, "81 - Start forward spinning"), + ( 5414876, "82 - Throw light object"), + ( 5416032, "83 - Fall from slide kick"), + ( 5418280, "84 - Bend kness riding shell"), + ( 5419872, "85 - Legs stuck in ground"), + ( 5431416, "86 - General fall"), + ( 5431440, "87 - General land"), + ( 5433276, "88 - Being grabbed"), + ( 5434636, "89 - Grab heavy object"), + ( 5437964, "90 - Slow land from dive"), + ( 5441520, "91 - Fly from cannon"), + ( 5442516, "92 - Moving right while hanging"), + ( 5444052, "93 - Moving left while hanging"), + ( 5445472, "94 - Missing cap"), + ( 5457860, "95 - Pull door walk in"), + ( 5463196, "96 - Push door walk in"), + ( 5467492, "97 - Unlock door"), + ( 5480428, "98 - Start reach pocket"), + ( 5481448, "99 - Reach pocket"), + ( 5483352, "100 - Stop reach pocket"), + ( 5484876, "101 - Ground throw"), + ( 5486852, "102 - Ground kick"), + ( 5489076, "103 - First punch"), + ( 5489740, "104 - Second punch"), + ( 5490356, "105 - First punch fast"), + ( 5491396, "106 - Second punch fast"), + ( 5492732, "107 - Pick up light object"), + ( 5493948, "108 - Pushing"), + ( 5495508, "109 - Start riding shell"), + ( 5497072, "110 - Place light object"), + ( 5498484, "111 - Forward spinning"), + ( 5498508, "112 - Backward spinning"), + ( 5498884, "113 - Breakdance"), ( 5501240, "114 - Running"), - ( 5501264, "115 - Running"), - ( 5505884, "116 - Get bumped by enemy"), - ( 5508004, "117 - Get bumped by enemy (from behind)"), - ( 5510172, "118 - Dying in sand"), - ( 5515096, "119 - Stuck, looking around"), - ( 5517836, "120 - Walking through sand"), - ( 5528568, "121 - Dying from shock"), - ( 5532480, "122 - Getting shocked"), - ( 5533160, "123 - Bump into wall"), - ( 5535796, "124 - Fall forward"), - ( 5538372, "125 - Holding large object"), - ( 5539764, "126 - Against wall"), - ( 5544580, "127 - Sidestepping against wall"), - ( 5548480, "128 - Sidestepping against wall"), - ( 5553004, "129 - Sleepy (part 1)"), - ( 5557588, "130 - Sleepy (part 2)"), - ( 5563636, "131 - Sleepy (part 3)"), - ( 5568648, "132 - Sleepy (part 4)"), - ( 5573680, "133 - Sleeping"), - ( 5574280, "134 - Lay down"), - ( 5577460, "135 - Laying and sleeping"), - ( 5579300, "136 - Belly flop"), - ( 5579324, "137 - On belly"), - ( 5580860, "138 - Get up after bumping into wall"), - ( 5584116, "139 - Get up after belly flop, holding small object"), - ( 5587364, "140 - Beginning of side kick"), - ( 5588288, "141 - Get up from slide kick, go back to crouching"), - ( 5589652, "142 - Sliding with hands back"), - ( 5589676, "143 - Get up and stand"), - ( 5591572, "144 - Go into falling from height position"), - ( 5592860, "145 - Slide with hands back animation"), + ( 5501264, "115 - Running (unused)"), + ( 5505884, "116 - Soft back kb"), + ( 5508004, "117 - Soft front kb"), + ( 5510172, "118 - Dying in quicksand"), + ( 5515096, "119 - Idle in quicksand"), + ( 5517836, "120 - Move in quicksand"), + ( 5528568, "121 - Electrocution"), + ( 5532480, "122 - Shocked"), + ( 5533160, "123 - Backward kb"), + ( 5535796, "124 - Forward kb"), + ( 5538372, "125 - Idle heavy object"), + ( 5539764, "126 - Stand against wall"), + ( 5544580, "127 - Side step left"), + ( 5548480, "128 - Side step right"), + ( 5553004, "129 - Start sleep idle"), + ( 5557588, "130 - Start sleep scratch"), + ( 5563636, "131 - Start sleep yawn"), + ( 5568648, "132 - Start sleep sitting"), + ( 5573680, "133 - Sleep idle"), + ( 5574280, "134 - Sleep start laying"), + ( 5577460, "135 - Sleep laying"), + ( 5579300, "136 - Dive"), + ( 5579324, "137 - Slide dive"), + ( 5580860, "138 - Ground bonk"), + ( 5584116, "139 - Stop slide light object"), + ( 5587364, "140 - Slide kick"), + ( 5588288, "141 - Crouch from slide kick"), + ( 5589652, "142 - Slide motionless"), + ( 5589676, "143 - Stop slide"), + ( 5591572, "144 - Fall from slide"), + ( 5592860, "145 - Slide"), ( 5593404, "146 - Tiptoe"), - ( 5599280, "147 - Land from spin jump"), - ( 5600160, "148 - Spin jump"), - ( 5600516, "149 - Start spin jump"), - ( 5601072, "150 - Come up from crouch"), - ( 5602028, "151 - Start crouch"), + ( 5599280, "147 - Twirl land"), + ( 5600160, "148 - Twirl"), + ( 5600516, "149 - Start twirl"), + ( 5601072, "150 - Stop crouching"), + ( 5602028, "151 - Start crouching"), ( 5602720, "152 - Crouching"), ( 5605756, "153 - Crawling"), - ( 5613048, "154 - Come up from crawling"), - ( 5613968, "155 - In crawling position"), - ( 5614876, "156 - Opening door with star"), - ( 5620036, "157 - Opening door with star end, walk in"), - ( 5622256, "158 - Hit by something (underwater start)"), - ( 5626540, "159 - Kick legs while holding object"), - ( 5627592, "160 - Holding object"), - ( 5628260, "161 - Swimming while holding object"), - ( 5629456, "162 - Stop while holding object"), - ( 5631180, "163 - Let go of object"), - ( 5634048, "164 - Holding object"), - ( 5635976, "165 - Drowning"), - ( 5641400, "166 - Die, slump over"), - ( 5646324, "167 - Die, slump over?"), - ( 5649660, "168 - Get hit from behind"), - ( 5653848, "169 - Walking (metal Mario)"), - ( 5655852, "170 - Single stroke from tapping A"), - ( 5657100, "171 - Stop swimming"), - ( 5658128, "172 - Strokes from holding A"), - ( 5660112, "173 - Stop in water"), - ( 5662248, "174 - Grab object"), - ( 5663480, "175 - Press B"), - ( 5665916, "176 - Jump (metal Mario)"), - ( 5666632, "177 - Throw object"), - ( 5669328, "178 - Floating"), - ( 5671428, "179 - Get star"), - ( 5678200, "180 - Get star (part 2) (underwater End)"), - ( 5680324, "181 - Grab Bowser's tail"), - ( 5680348, "182 - Holding Bowser"), - ( 5682008, "183 - Let go of Bowser"), - ( 5685264, "184 - Holding Bowser animation"), - ( 5686316, "185 - Throw large object"), - ( 5688660, "186 - Low energy"), - ( 5689924, "187 - Walking with large object"), - ( 5694332, "188 - Skid on ground start"), - ( 5694356, "189 - Switch direction quickly"), - ( 5696160, "190 - Land from side flip?"), + ( 5613048, "154 - Stop crawling"), + ( 5613968, "155 - Start crawling"), + ( 5614876, "156 - Summon star"), + ( 5620036, "157 - Return star approach door"), + ( 5622256, "158 - Backwards water kb"), + ( 5626540, "159 - Swim with object part 1"), + ( 5627592, "160 - Swim with object part 2"), + ( 5628260, "161 - Flutter kick with object"), + ( 5629456, "162 - Action end with object in water"), + ( 5631180, "163 - Stop holding object in water"), + ( 5634048, "164 - Holding object in water"), + ( 5635976, "165 - Drowning part 1"), + ( 5641400, "166 - Drowning part 2"), + ( 5646324, "167 - Dying in water"), + ( 5649660, "168 - Forward kb in water"), + ( 5653848, "169 - Falling from water"), + ( 5655852, "170 - Swimming part 1"), + ( 5657100, "171 - Swimming part 2"), + ( 5658128, "172 - Flutter kick"), + ( 5660112, "173 - Action end in water"), + ( 5662248, "174 - Pick up object in water"), + ( 5663480, "175 - Grab object in water part 2"), + ( 5665916, "176 - Grab object in water part 1"), + ( 5666632, "177 - Throw object in water"), + ( 5669328, "178 - Idle in water"), + ( 5671428, "179 - Star dance in water"), + ( 5678200, "180 - Return from in water star dance"), + ( 5680324, "181 - Grab bowser"), + ( 5680348, "182 - Swing bowser"), + ( 5682008, "183 - Release bowser"), + ( 5685264, "184 - Holding bowser"), + ( 5686316, "185 - Heavy throw"), + ( 5688660, "186 - Walk panting"), + ( 5689924, "187 - Walk with heavy object"), + ( 5694332, "188 - Turning part 1"), + ( 5694356, "189 - Turning part 2"), + ( 5696160, "190 - Side flip land"), ( 5697196, "191 - Side flip"), - ( 5699408, "192 - Land from back flip / triple jump"), + ( 5699408, "192 - Triple jump land"), ( 5702136, "193 - Triple jump"), - ( 5704880, "194 - Reading sign"), - ( 5710580, "195 - Standing normal (part 1)"), - ( 5712800, "196 - Standing normal (part 2)"), - ( 5715020, "197 - Standing normal (part 3)"), - ( 5717240, "198 - Hanging on monkey-bar"), - ( 5719184, "199 - Hanging on monkey-bar, look around"), - ( 5722304, "200 - Get up after sleeping (sitting)"), - ( 5724228, "201 - Get up after sleeping (laying)"), - ( 5726444, "202 - Begin walking"), - ( 5728720, "203 - Wall kick/jump from tree"), - ( 5728744, "204 - Hang onto pole / tree"), - ( 5730404, "205 - Get star"), - ( 5735864, "206 - End get star"), - ( 5737600, "207 - Triple jump and start flying"), - ( 5740584, "208 - Start special triple jump?"), + ( 5704880, "194 - First person"), + ( 5710580, "195 - Idle head left"), + ( 5712800, "196 - Idle head right"), + ( 5715020, "197 - Idle head center"), + ( 5717240, "198 - Handstand left"), + ( 5719184, "199 - Handstand right"), + ( 5722304, "200 - Wake up from sleeping"), + ( 5724228, "201 - Wake up from laying"), + ( 5726444, "202 - Start tiptoeing"), + ( 5728720, "203 - Slide jump"), + ( 5728744, "204 - Start wallkick"), + ( 5730404, "205 - Star dance"), + ( 5735864, "206 - Return from star dance"), + ( 5737600, "207 - Forwards spinning flip"), + ( 5740584, "208 - Triple jump fly"), ] diff --git a/fast64_internal/utility_anim.py b/fast64_internal/utility_anim.py index ddca99149..7807dea84 100644 --- a/fast64_internal/utility_anim.py +++ b/fast64_internal/utility_anim.py @@ -179,6 +179,25 @@ def getIntersectionInterval(): return range_get_by_choice[anim_range_choice]() +def stashActionInArmature(armatureObj: bpy.types.Object, action: bpy.types.Action): + """ + Stashes an animation (action) into an armatureĀ“s nla tracks. + This prevents animations from being deleted by blender or + purged by the user on accident. + """ + + for track in armatureObj.animation_data.nla_tracks: + for strip in track.strips: + if strip.action is None: + continue + + if strip.action.name == action.name: + return + + print(f"Stashing \"{action.name}\" in the object \"{armatureObj.name}\".") + + track = armatureObj.animation_data.nla_tracks.new() + track.strips.new(action.name, int(action.frame_range[0]), action) classes = (ArmatureApplyWithMeshOperator,)