From 36a51c19b411206213b27e30106fff161251b652 Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Sun, 27 Nov 2022 11:45:11 -0500 Subject: graph fixes --- createcalls.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'createcalls.cpp') diff --git a/createcalls.cpp b/createcalls.cpp index de81c1e..d6cfc6c 100644 --- a/createcalls.cpp +++ b/createcalls.cpp @@ -203,6 +203,7 @@ Bezier_EvaluateValue(project_state *State, bezier_point *PointAddress, v2 *Pos, } } + static void Bezier_Add(memory *Memory, property_channel *Property, bezier_point PointData) { @@ -481,6 +482,40 @@ Property_GetSortedArray(uint16 *SortedPropertyArray, int i, int h) return SortedPropertyArray + (i * 8 * MAX_KEYFRAMES_PER_BLOCK) + (h * MAX_KEYFRAMES_PER_BLOCK); } +static void +Bezier_Commit(project_data *File, project_state *State, memory *Memory, uint16 *SortedPropertyArray) { + History_Entry_Commit(Memory, "Move keyframe"); + int h = 0, c = 0, i = 0; + while (Block_Loop(Memory, F_Layers, File->Layer_Count, &h, &c, &i)) { + block_layer *Layer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, i); + if (!Layer->IsSelected) + continue; + for (int h = 0; h < AmountOf(Layer->Property); h++) { + uint16 *ArrayLocation = Property_GetSortedArray(SortedPropertyArray, i, h); + property_channel *Property = &Layer->Property[h]; + for (int p = 0; p < Property->Keyframe_Count; p++) { + int k = ArrayLocation[p]; + bezier_point *PointAddress = Bezier_LookupAddress(Memory, Property, k); + if (PointAddress->IsSelected) { + v2 NewPos[3]; + Bezier_EvaluateValue(State, PointAddress, NewPos); + History_Action_Swap(Memory, F_Bezier, sizeof(PointAddress->Pos), &PointAddress->Pos); + PointAddress->Pos[0] = NewPos[0]; + PointAddress->Pos[1] = NewPos[1]; + PointAddress->Pos[2] = NewPos[2]; + } + } + } + } + History_Entry_End(Memory); + State->Interact_Offset[0] = 0; + State->Interact_Offset[1] = 0; + State->Interact_Offset[2] = 0; + State->Interact_Offset[3] = 0; + State->Interact_Active = interact_type_none; + State->Interact_Modifier = 0; +} + void Clipboard_Store(project_data *File, project_state *State, memory *Memory, sorted_comp_info *SortedCompInfo, sorted_layer *SortedLayerInfo, sorted_property_info *SortedPropertyInfo, uint16 *SortedPropertyArray) { int LocalOffset = 0; -- cgit v1.2.3