Skip to content

Commit

Permalink
Clear Keyframes script now supports clearing all for a CHR0
Browse files Browse the repository at this point in the history
  • Loading branch information
soopercool101 committed Oct 17, 2020
1 parent 706f6a3 commit 14d4651
Showing 1 changed file with 35 additions and 11 deletions.
46 changes: 35 additions & 11 deletions Loaders/Utility/Clear Keyframes.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,48 @@
from BrawlCrate.API import *
from BrawlCrate.NodeWrappers import CHR0EntryWrapper
from BrawlCrate.API import *
from BrawlCrate.NodeWrappers import CHR0Wrapper, CHR0EntryWrapper
from BrawlLib.SSBB.ResourceNodes import *
from BrawlLib.Wii.Animations import *
from System.Windows.Forms import ToolStripMenuItem

def clear_translation(sender, event_args):
for x in range(0, BrawlAPI.SelectedNode.FrameCount):
BrawlAPI.SelectedNode.RemoveKeyframeOnlyTrans(x)
if isinstance(BrawlAPI.SelectedNode, CHR0Node):
for node in BrawlAPI.SelectedNode.Children:
clear_node_translation(node)
else:
clear_node_translation(BrawlAPI.SelectedNode)
BrawlAPI.RefreshPreview()

def clear_node_translation(node):
for x in range(0, node.FrameCount):
node.RemoveKeyframeOnlyTrans(x)

def clear_scale(sender, event_args):
for x in range(0, BrawlAPI.SelectedNode.FrameCount):
BrawlAPI.SelectedNode.RemoveKeyframeOnlyScale(x)
if isinstance(BrawlAPI.SelectedNode, CHR0Node):
for node in BrawlAPI.SelectedNode.Children:
clear_node_scale(node)
else:
clear_node_scale(BrawlAPI.SelectedNode)
BrawlAPI.RefreshPreview()

def clear_node_scale(node):
for x in range(0, node.FrameCount):
node.RemoveKeyframeOnlyScale(x)

def clear_rotation(sender, event_args):
for x in range(0, BrawlAPI.SelectedNode.FrameCount):
BrawlAPI.SelectedNode.RemoveKeyframeOnlyRot(x)
if isinstance(BrawlAPI.SelectedNode, CHR0Node):
for node in BrawlAPI.SelectedNode.Children:
clear_node_rotation(node)
else:
clear_node_rotation(BrawlAPI.SelectedNode)
BrawlAPI.RefreshPreview()

BrawlAPI.AddContextMenuItem(CHR0EntryWrapper, None, 'Clears Translation', None, ToolStripMenuItem('Clear Translation', None, clear_translation))
BrawlAPI.AddContextMenuItem(CHR0EntryWrapper, None, 'Clears Rotation', None, ToolStripMenuItem('Clear Rotation', None, clear_rotation))
BrawlAPI.AddContextMenuItem(CHR0EntryWrapper, None, 'Clears Scale', None, ToolStripMenuItem('Clear Scale', None, clear_scale))
def clear_node_rotation(node):
for x in range(0, node.FrameCount):
node.RemoveKeyframeOnlyRot(x)

BrawlAPI.AddContextMenuItem(CHR0Wrapper, None, 'Clears translation keyframes for all entries', None, ToolStripMenuItem('Clear Translation', None, clear_translation))
BrawlAPI.AddContextMenuItem(CHR0Wrapper, None, 'Clears rotation keyframes for all entries', None, ToolStripMenuItem('Clear Rotation', None, clear_rotation))
BrawlAPI.AddContextMenuItem(CHR0Wrapper, None, 'Clears scale keyframes for all entries', None, ToolStripMenuItem('Clear Scale', None, clear_scale))
BrawlAPI.AddContextMenuItem(CHR0EntryWrapper, None, 'Clears translation keyframes', None, ToolStripMenuItem('Clear Translation', None, clear_translation))
BrawlAPI.AddContextMenuItem(CHR0EntryWrapper, None, 'Clears rotation keyframes', None, ToolStripMenuItem('Clear Rotation', None, clear_rotation))
BrawlAPI.AddContextMenuItem(CHR0EntryWrapper, None, 'Clears scale keyframes', None, ToolStripMenuItem('Clear Scale', None, clear_scale))

0 comments on commit 14d4651

Please sign in to comment.