refactored clips -> patterns
This commit is contained in:
parent
82ed9d84ac
commit
a52d8645e6
|
@ -109,7 +109,7 @@ StartDragTimeMarker(rect2 TimelineBounds, frame_range VisibleFrames, app_state*
|
|||
|
||||
#define CLICK_ANIMATION_BLOCK_EDGE_MAX_SCREEN_DISTANCE 10
|
||||
|
||||
OPERATION_STATE_DEF(drag_animation_clip_state)
|
||||
OPERATION_STATE_DEF(drag_animation_block_state)
|
||||
{
|
||||
rect2 TimelineBounds;
|
||||
handle BlockHandle;
|
||||
|
@ -129,9 +129,9 @@ AttemptToSnapPosition(u32 SnappingFrame, u32 SnapToFrame)
|
|||
return Result;
|
||||
}
|
||||
|
||||
OPERATION_RENDER_PROC(UpdateDragAnimationClip)
|
||||
OPERATION_RENDER_PROC(UpdateDragAnimationBlock)
|
||||
{
|
||||
drag_animation_clip_state* OpState = (drag_animation_clip_state*)Operation.OpStateMemory;
|
||||
drag_animation_block_state* OpState = (drag_animation_block_state*)Operation.OpStateMemory;
|
||||
|
||||
animation* ActiveAnim = AnimationSystem_GetActiveAnimation(&State->AnimationSystem);
|
||||
|
||||
|
@ -228,7 +228,7 @@ OPERATION_RENDER_PROC(UpdateDragAnimationClip)
|
|||
AnimationBlock->Range.Max = (u32)Clamp(PlayableStartFrame, (s32)AnimationBlock->Range.Max, PlayableEndFrame);
|
||||
}
|
||||
|
||||
input_command DragAnimationClipCommands [] = {
|
||||
input_command DragAnimationBlockCommands [] = {
|
||||
{ KeyCode_MouseLeftButton, KeyCode_Invalid, Command_Ended, 0 },
|
||||
};
|
||||
|
||||
|
@ -238,11 +238,11 @@ SelectAndBeginDragAnimationBlock(animation_timeline_state* TimelineState, handle
|
|||
TimelineState->SelectedBlockHandle = BlockHandle;
|
||||
|
||||
animation* ActiveAnim = AnimationSystem_GetActiveAnimation(&State->AnimationSystem);
|
||||
operation_mode* DragAnimationClipMode = ActivateOperationModeWithCommands(&State->Modes, DragAnimationClipCommands, UpdateDragAnimationClip);
|
||||
operation_mode* DragAnimationBlockMode = ActivateOperationModeWithCommands(&State->Modes, DragAnimationBlockCommands, UpdateDragAnimationBlock);
|
||||
|
||||
drag_animation_clip_state* OpState = CreateOperationState(DragAnimationClipMode,
|
||||
drag_animation_block_state* OpState = CreateOperationState(DragAnimationBlockMode,
|
||||
&State->Modes,
|
||||
drag_animation_clip_state);
|
||||
drag_animation_block_state);
|
||||
OpState->TimelineBounds = TimelineBounds;
|
||||
OpState->BlockHandle = BlockHandle;
|
||||
OpState->VisibleRange = VisibleRange;
|
||||
|
@ -580,7 +580,7 @@ PANEL_MODAL_OVERRIDE_CALLBACK(LoadAnimationFileCallback)
|
|||
{
|
||||
gs_file AnimFile = ReadEntireFile(Context.ThreadContext.FileHandler, FileInfo.Path);
|
||||
gs_string AnimFileString = MakeString((char*)AnimFile.Data.Memory, AnimFile.Data.Size);
|
||||
animation NewAnim = AnimParser_Parse(AnimFileString, State->AnimationSystem.Storage, GlobalAnimationClipsCount, GlobalAnimationClips);
|
||||
animation NewAnim = AnimParser_Parse(AnimFileString, State->AnimationSystem.Storage, GlobalAnimationPatternsCount, GlobalAnimationPatterns);
|
||||
|
||||
u32 NewAnimIndex = AnimationArray_Push(&State->AnimationSystem.Animations, NewAnim);
|
||||
State->AnimationSystem.ActiveAnimationIndex = NewAnimIndex;
|
||||
|
@ -588,15 +588,15 @@ PANEL_MODAL_OVERRIDE_CALLBACK(LoadAnimationFileCallback)
|
|||
}
|
||||
|
||||
internal void
|
||||
DrawAnimationClipsList(rect2 PanelBounds, ui_interface* Interface, u32 SelectedAnimationLayerHandle, animation_system* AnimationSystem)
|
||||
DrawAnimationPatternList(rect2 PanelBounds, ui_interface* Interface, u32 SelectedAnimationLayerHandle, animation_system* AnimationSystem)
|
||||
{
|
||||
ui_layout Layout = ui_CreateLayout(Interface, PanelBounds);
|
||||
ui_PushLayout(Interface, Layout);
|
||||
for (s32 i = 0; i < GlobalAnimationClipsCount; i++)
|
||||
for (s32 i = 0; i < GlobalAnimationPatternsCount; i++)
|
||||
{
|
||||
animation_clip Clip = GlobalAnimationClips[i];
|
||||
gs_string ClipName = MakeString(Clip.Name, Clip.NameLength);
|
||||
if (ui_LayoutListEntry(Interface, &Layout, ClipName, i))
|
||||
animation_pattern Pattern = GlobalAnimationPatterns[i];
|
||||
gs_string PatternName = MakeString(Pattern.Name, Pattern.NameLength);
|
||||
if (ui_LayoutListEntry(Interface, &Layout, PatternName, i))
|
||||
{
|
||||
AddAnimationBlockAtCurrentTime(i + 1, SelectedAnimationLayerHandle, AnimationSystem);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ struct animation_system
|
|||
};
|
||||
|
||||
// TODO(pjs): Better name - something like animation_prototype
|
||||
struct animation_clip
|
||||
struct animation_pattern
|
||||
{
|
||||
char* Name;
|
||||
s32 NameLength;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#ifndef FOLDHAUS_ANIMATION_SERIALIZER_CPP
|
||||
|
||||
internal gs_string
|
||||
AnimSerializer_Serialize(animation Anim, animation_clip* GlobalClips, gs_memory_arena* Arena)
|
||||
AnimSerializer_Serialize(animation Anim, animation_pattern* GlobalClips, gs_memory_arena* Arena)
|
||||
{
|
||||
serializer Serializer = {0};
|
||||
Serializer.String = PushString(Arena, 4096);
|
||||
|
@ -48,7 +48,7 @@ AnimSerializer_Serialize(animation Anim, animation_clip* GlobalClips, gs_memory_
|
|||
// TODO(pjs): Systematize the AnimationProcHandle
|
||||
// :AnimProcHandle
|
||||
u32 AnimationProcIndex = AnimationBlockAt.AnimationProcHandle - 1;
|
||||
animation_clip Animation = GlobalClips[AnimationProcIndex];
|
||||
animation_pattern Animation = GlobalClips[AnimationProcIndex];
|
||||
|
||||
Serializer_OpenStruct(&Serializer, AnimField_Block);
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ AnimSerializer_Serialize(animation Anim, animation_clip* GlobalClips, gs_memory_
|
|||
}
|
||||
|
||||
internal animation
|
||||
AnimParser_Parse(gs_string File, gs_memory_arena* Arena, u32 AnimClipsCount, animation_clip* AnimClips)
|
||||
AnimParser_Parse(gs_string File, gs_memory_arena* Arena, u32 AnimClipsCount, animation_pattern* AnimClips)
|
||||
{
|
||||
animation Result = {0};
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ UPDATE_AND_RENDER(UpdateAndRender)
|
|||
|
||||
// :AnimProcHandle
|
||||
u32 AnimationProcIndex = Block.AnimationProcHandle - 1;
|
||||
animation_proc* AnimationProc = GlobalAnimationClips[AnimationProcIndex].Proc;
|
||||
animation_proc* AnimationProc = GlobalAnimationPatterns[AnimationProcIndex].Proc;
|
||||
AnimationProc(&LayerLEDBuffers[Layer], *Assembly, SecondsIntoBlock, State->Transient);
|
||||
}
|
||||
|
||||
|
|
|
@ -209,8 +209,8 @@ EndCurrentOperationMode(app_state* State)
|
|||
DeactivateCurrentOperationMode(&State->Modes);
|
||||
}
|
||||
|
||||
s32 GlobalAnimationClipsCount = 3;
|
||||
animation_clip GlobalAnimationClips[] = {
|
||||
s32 GlobalAnimationPatternsCount = 3;
|
||||
animation_pattern GlobalAnimationPatterns[] = {
|
||||
{ "Test Pattern One", 16, TestPatternOne },
|
||||
{ "Test Pattern Two", 16, TestPatternTwo },
|
||||
{ "Test Pattern Three", 18, TestPatternThree },
|
||||
|
|
|
@ -479,8 +479,6 @@ WinMain (
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
MainWindow = Win32CreateWindow (HInstance, "Foldhaus", 1440, 768, HandleWindowEvents);
|
||||
Win32UpdateWindowDimension(&MainWindow);
|
||||
|
||||
|
|
Loading…
Reference in New Issue