summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/main.cpp b/main.cpp
index 76b085e..bb780c4 100644
--- a/main.cpp
+++ b/main.cpp
@@ -187,7 +187,7 @@ Main_InputTest(project_data *File, project_state *State, memory *Memory, ui *UI,
// }
ImGui_Timeline(File, State, Memory, UI, io, Sorted.CompArray, Sorted.LayerArray, Sorted.PropertyInfo, Sorted.PropertyArray);
ImGui_File(File, State, Memory, io, Sorted.CompArray, Sorted.LayerArray);
- ImGui_PropertiesPanel(File, State, UI, Memory, io, Sorted.PropertyArray);
+ ImGui_PropertiesPanel(File, State, UI, Memory, io, Sorted.CompArray, Sorted.LayerArray, Sorted.PropertyInfo, Sorted.PropertyArray);
ImGui_ColorPanel(File, State, UI, Memory, io);
ImGui_EffectsPanel(File, State, Memory, UI, io);
#if STABLE
@@ -221,22 +221,24 @@ Render_Main(void *Data, void *OutputBuffer, render_type RenderType, rectangle Re
}
static void
-Layer_UpdateAllKeyframes(project_data *File, project_state *State, memory *Memory, block_layer *Layer, uint16 Index_Physical, sorted_property_info *SortedPropertyInfo, uint16 *SortedPropertyArray, uint16 Frame_Current)
+Layer_UpdateAllKeyframes(project_data *File, project_state *State, memory *Memory, block_layer *Layer, uint16 Index_Physical,
+ sorted_property_info *SortedProperty, uint16 *SortedKeyframe, uint16 Frame_Current)
{
int32 Offset = (State->Interact_Active == interact_type_keyframe_move) ? (int32)State->Interact_Offset[0] : 0;
- for (int h = 0; h < AmountOf(Layer->Property); h++) {
- property_channel *Property = &Layer->Property[h];
- sorted_property_info *InfoLocation = Property_GetSortedInfo(SortedPropertyInfo, Index_Physical, h);
- uint16 *ArrayLocation = Property_GetSortedArray(SortedPropertyArray, Index_Physical, h);
+ int h = 0, c = 0, p = 0;
+ property_channel *Property = NULL;
+ while (Layer_LoopChannels(State, Memory, &SortedProperty, &SortedKeyframe, Layer, &Property, NULL, &h, &c, &p))
+ {
+ Assert(Property);
if (Property->Block_Bezier_Count) {
real32 MinY, MaxY;
- Property_MinMax_Y(Memory, State, Property, InfoLocation, &MinY, &MaxY);
+ Property_MinMax_Y(Memory, State, Property, SortedProperty, &MinY, &MaxY);
real32 Y_Increment = 1 / (MaxY - MinY);
v2 FirstPointPos[3];
- bezier_point *FirstPointAddress = Bezier_LookupAddress(Memory, Property, ArrayLocation[0]);
+ bezier_point *FirstPointAddress = Bezier_LookupAddress(Memory, Property, SortedKeyframe[0]);
Bezier_EvaluateValue(State, FirstPointAddress, FirstPointPos);
v2 LastPointPos[3];
- bezier_point *LastPointAddress = Bezier_LookupAddress(Memory, Property, ArrayLocation[Property->Keyframe_Count - 1]);
+ bezier_point *LastPointAddress = Bezier_LookupAddress(Memory, Property, SortedKeyframe[Property->Keyframe_Count - 1]);
Bezier_EvaluateValue(State, LastPointAddress, LastPointPos);
if (FirstPointPos[0].x >= Frame_Current) {
Property->CurrentValue = FirstPointPos[0].y;
@@ -246,17 +248,17 @@ Layer_UpdateAllKeyframes(project_data *File, project_state *State, memory *Memor
int KeyframeIndex = 0;
for (;;) {
v2 PointPos[3];
- bezier_point *PointAddress = Bezier_LookupAddress(Memory, Property, ArrayLocation[KeyframeIndex + 1]);
+ bezier_point *PointAddress = Bezier_LookupAddress(Memory, Property, SortedKeyframe[KeyframeIndex + 1]);
Bezier_EvaluateValue(State, PointAddress, PointPos, 1, Y_Increment);
if (PointPos[0].x >= Frame_Current)
break;
KeyframeIndex++;
}
v2 PointPos[3];
- bezier_point *PointAddress = Bezier_LookupAddress(Memory, Property, ArrayLocation[KeyframeIndex]);
+ bezier_point *PointAddress = Bezier_LookupAddress(Memory, Property, SortedKeyframe[KeyframeIndex]);
Bezier_EvaluateValue(State, PointAddress, PointPos, 1, Y_Increment);
v2 NextPointPos[3];
- bezier_point *NextPointAddress = Bezier_LookupAddress(Memory, Property, ArrayLocation[KeyframeIndex + 1]);
+ bezier_point *NextPointAddress = Bezier_LookupAddress(Memory, Property, SortedKeyframe[KeyframeIndex + 1]);
Bezier_EvaluateValue(State, NextPointAddress, NextPointPos, 1, Y_Increment);
if (PointAddress->Type == interpolation_type_hold) {
Property->CurrentValue = PointPos[0].y;
@@ -298,7 +300,9 @@ Render_Comp(project_data *File, project_state *State, memory *Memory, ImGuiIO io
Layer->Frame_End > Frame_Current && Layer->IsVisible)
{
if (State->UpdateKeyframes) {
- Layer_UpdateAllKeyframes(File, State, Memory, Layer, Index_Physical, SortedPropertyInfo, SortedPropertyArray, Frame_Current);
+ sorted_property_info *SortedLayerProperties = SortedPropertyInfo + SortedLayerInfo->SortedPropertyStart;
+ uint16 *SortedLayerKeyframes = SortedPropertyArray + SortedLayerInfo->SortedKeyframeStart;
+ Layer_UpdateAllKeyframes(File, State, Memory, Layer, Index_Physical, SortedLayerProperties, SortedLayerKeyframes, Frame_Current);
}
layer_bitmap_state *BitmapState = &State->Render.Bitmap[Index_Physical];
@@ -628,6 +632,13 @@ int main(int argc, char *argv[]) {
curl_state ProgHandle = {};
#endif
+#if DEBUG
+ sprintf(State->DummyName, "test2");
+ File_Open(File, State, &Memory, State->DummyName);
+ State->UpdateFrame = true;
+ State->MostRecentlySelectedLayer = 0;
+#endif
+
while (State->IsRunning)
{
// State->Interact_Active = interact_type_layer_move;