summaryrefslogtreecommitdiff
path: root/src/createcalls.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/createcalls.cpp')
-rw-r--r--src/createcalls.cpp71
1 files changed, 66 insertions, 5 deletions
diff --git a/src/createcalls.cpp b/src/createcalls.cpp
index 4334dc8..2a344a0 100644
--- a/src/createcalls.cpp
+++ b/src/createcalls.cpp
@@ -1,3 +1,7 @@
+#if SPECIAL
+#include "main.h"
+#endif
+
static void
PostMsg(project_state *State, char *msg)
{
@@ -459,7 +463,7 @@ void Property_MinMax_X(memory *Memory, project_state *State, property_channel *P
*Max = LastPointPos[0].x;
}
void Property_MinMax_Y(memory *Memory, project_state *State, property_channel *Property,
- sorted_property_array *PropertyStart, real32 *Min, real32 *Max, bool32 Evaluate = 1)
+ sorted_property_array *PropertyStart, real32 *Min, real32 *Max, bool32 Evaluate)
{
if (Evaluate) {
v2 MinYPointPos[3];
@@ -610,6 +614,53 @@ Property_IsGraphSelected(memory *Memory, property_channel *Property, uint16 *Arr
}
static void
+Project_Layer_Duplicate(project_data *File, project_state *State, memory *Memory,
+ sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, v2 Offset, bool32 FakeOnly)
+{
+ for (int c = 0; c < File->Comp_Count; c++) {
+ sorted_comp_array SortedCompStart = SortedCompArray[c];
+ sorted_layer_array *SortedLayerStart = Sorted_GetLayerStart(SortedLayerArray, SortedCompArray, c);
+ int LayerCount = SortedCompStart.LayerCount + SortedCompStart.FakeLayerCount;
+ int Increment = 0;
+ for (int i = 0; i < LayerCount; i++)
+ {
+ sorted_layer_array SortEntry = SortedLayerStart[i];
+ uint32 Index_Physical = SortEntry.Block_Layer_Index;
+ block_layer *Layer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, Index_Physical);
+ if ((FakeOnly && SortEntry.IsFake) || (!FakeOnly && Layer->IsSelected))
+ {
+ if (!FakeOnly)
+ Layer->IsSelected = false;
+
+ block_layer *NewLayer = (block_layer *)Memory_Block_AllocateAddress(Memory, F_Layers);
+ History_Action_Block_Swap(Memory, F_Layers, NewLayer);
+ *NewLayer = *Layer;
+ NewLayer->IsSelected = true;
+
+ Assert(!NewLayer->x.Keyframe_Count);
+ Assert(!NewLayer->y.Keyframe_Count);
+ NewLayer->x.CurrentValue += Offset.x;
+ NewLayer->y.CurrentValue += Offset.y;
+
+ NewLayer->Block_String_Index = Memory_Block_AllocateNew(Memory, F_Strings);
+ block_string *String = (block_string *)Memory_Block_AddressAtIndex(Memory, F_Strings, NewLayer->Block_String_Index, 0);
+ sprintf(String->Char, "Layer %i", File->Layer_Count + 1); // CSbros...
+ History_Action_Swap(Memory, F_Strings, sizeof(String->Occupied), &String->Occupied);
+ String->Occupied = 1;
+
+ History_Action_Swap(Memory, F_File, sizeof(File->Layer_Count), &File->Layer_Count);
+ File->Layer_Count++;
+
+ Increment++;
+ } else {
+ // History_Action_Swap(Memory, F_File, sizeof(Layer->Vertical_Offset), &Layer->Vertical_Offset);
+ Layer->IsSelected = false;
+ }
+ }
+ }
+}
+
+static void
Project_ShapeLayer_New(project_data *File, project_state *State, memory *Memory)
{
int TopOffset = Layer_GetTopOffset(File, Memory);
@@ -635,6 +686,13 @@ Project_ShapeLayer_New(project_data *File, project_state *State, memory *Memory)
Memory_PopScratch(Memory, sizeof(nvg_point) * 128);
Shape->Width = Max.x - Min.x;
Shape->Height = Max.y - Min.y;
+ for (int i = 0; i < Shape->Point_Count; i++) {
+ bezier_point *Point = Bezier_LookupAddress(Memory, Shape->Block_Bezier_Index, i, 1);
+ for (int a = 0; a < 3; a++) {
+ Point->Pos[a] = (Point->Pos[a] - Min) / V2(Shape->Width, Shape->Height);
+ }
+ }
+
Layer->x.CurrentValue = Min.x + (Shape->Width / 2);
Layer->y.CurrentValue = Min.y + (Shape->Height / 2);
@@ -657,10 +715,6 @@ Project_ShapeLayer_New(project_data *File, project_state *State, memory *Memory)
Layer->x.CurrentValue = Min.x + (ShapeSize.x / 2);
Layer->y.CurrentValue = Min.y + (ShapeSize.y / 2);
*/
- for (int i = 0; i < Shape->Point_Count; i++) {
- bezier_point *Point = Bezier_LookupAddress(Memory, Shape->Block_Bezier_Index, i, 1);
- Point->Pos[0] = Point->Pos[0] - Min;
- }
History_Action_Swap(Memory, F_Layers, sizeof(Layer->Shape), &Layer->Shape);
Layer->Shape = File->UI.Shape;
@@ -723,6 +777,13 @@ void Source_UICreateButton(project_data *File, project_state *State, memory *Mem
Layer->Vertical_Offset = TopOffset-1;
Layer->Frame_Start = Comp->Frame_Start;
Layer->Frame_End = Comp->Frame_End;
+ if (Source->HasVideo) {
+ av_info *AV = (av_info *)Memory_Block_AllocateAddress(Memory, P_AVInfo);
+ AV->Occupied = 1;
+ AV->Block_Source_Index = Layer->Block_Source_Index;
+ AV_Init(Source, AV, Memory);
+ State->AVCount++;
+ }
}
State->UpdateFrame = true;
}