summaryrefslogtreecommitdiff
path: root/createcalls.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'createcalls.cpp')
-rw-r--r--createcalls.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/createcalls.cpp b/createcalls.cpp
index d0ca03e..5c569fb 100644
--- a/createcalls.cpp
+++ b/createcalls.cpp
@@ -57,10 +57,14 @@ static property_info
Property_GetInfo(memory *Memory, property_channel *Property)
{
property_info PropertyInfo = {};
- for (int k = 0; k < Property->Keyframe_Count; k++) {
+ int k = 0;
+ for (;;) {
bezier_point *Point = Bezier_Lookup(Memory, Property, k);
+ if (!Point->Occupied)
+ break;
PropertyInfo.MinVal = (Point->Pos[0].y < PropertyInfo.MinVal) ? Point->Pos[0].y : PropertyInfo.MinVal;
PropertyInfo.MaxVal = (Point->Pos[0].y > PropertyInfo.MaxVal) ? Point->Pos[0].y : PropertyInfo.MaxVal;
+ k++;
}
return PropertyInfo;
}
@@ -75,7 +79,7 @@ Graph_GetInfo(project_data *File, memory *Memory)
continue;
for (int h = 0; h < AmountOf(Layer->Property); h++) {
property_channel *Property = &Layer->Property[h];
- if (Property->Keyframe_Count) {
+ if (Property->Block_Bezier_Count) {
property_info PropertyInfo = Property_GetInfo(Memory, Property);
GraphInfo.MinVal = (PropertyInfo.MinVal < GraphInfo.MinVal) ? PropertyInfo.MinVal : GraphInfo.MinVal;
GraphInfo.MaxVal = (PropertyInfo.MaxVal > GraphInfo.MaxVal) ? PropertyInfo.MaxVal : GraphInfo.MaxVal;
@@ -87,6 +91,25 @@ Graph_GetInfo(project_data *File, memory *Memory)
}
static void
+Keyframe_Interact_Evaluate(memory *Memory, project_state *State, uint8 IsSelected, v2 Pos_Initial[3], v2 Pos_New[3])
+{
+ Assert(Pos_New[0].y == Pos_Initial[0].y);
+ v2 Offset = V2(State->Interact_Offset[0], State->Interact_Offset[1]);
+ if (State->Interact_Active == interact_type_keyframe_move) {
+ Pos_New[0] = Pos_New[0] + Offset;
+ } else if (State->Interact_Active == interact_type_keyframe_scale) {
+ Pos_New[1].x += (IsSelected - 1 == 0 || IsSelected - 1 == 1) ? Offset.x : 0;
+ Pos_New[2].x -= (IsSelected - 1 == 0 || IsSelected - 1 == 2) ? Offset.x : 0;
+ } else if (State->Interact_Active == interact_type_keyframe_rotate) {
+ real32 Rad = State->Interact_Offset[0];
+ v2 XAxis = V2(8, 8) * V2(cos(Rad), sin(Rad));
+ v2 YAxis = V2(sin(Rad), -cos(Rad));
+ Pos_New[2].x += XAxis.x + XAxis.y;
+ Pos_New[2].y += YAxis.x + YAxis.y;
+ }
+}
+
+static void
Layer_Interact_Evaluate(memory *Memory, project_state *State, uint16 Layer_Index_Physical, sorted_comp_info SortedCompInfo, sorted_layer *SortedLayerInfo,
int32 *Frame_Start, int32 *Frame_End, real32 *Vertical_Offset)
{