summaryrefslogtreecommitdiff
path: root/src/createcalls.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/createcalls.cpp')
-rw-r--r--src/createcalls.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/createcalls.cpp b/src/createcalls.cpp
index 8b0ebf7..4bdd6d7 100644
--- a/src/createcalls.cpp
+++ b/src/createcalls.cpp
@@ -610,6 +610,42 @@ Property_IsGraphSelected(memory *Memory, property_channel *Property, uint16 *Arr
}
static void
+Project_ShapeLayer_New(project_data *File, project_state *State, memory *Memory, v2 Point, v2 Vector)
+{
+ int TopOffset = Layer_GetTopOffset(File, Memory);
+ block_composition *MainComp = (block_composition *)Memory_Block_AddressAtIndex(Memory, F_Precomps, File->PrincipalCompIndex);
+ Layer_DeselectAll(File, State, Memory);
+ History_Entry_Commit(Memory, "New shape layer");
+ block_layer *Layer = Layer_Init(File, Memory);
+ Layer->IsShapeLayer = true;
+ Layer->x.CurrentValue = MainComp->Width / 2;
+ Layer->y.CurrentValue = MainComp->Height / 2;
+ if (File->Layer_Count == 1) {
+ Layer->Vertical_Offset = 11 - 1;
+ } else {
+ Layer->Vertical_Offset = TopOffset - 1;
+ }
+ Layer->Frame_Start = MainComp->Frame_Start;
+ Layer->Frame_End = MainComp->Frame_End;
+ Layer_Select(Memory, State, Memory_Block_LazyIndexAtAddress(Memory, F_Layers, Layer));
+
+ Layer->Shape.Block_Bezier_Index[0] = Memory_Block_AllocateNew(Memory, F_Bezier);
+ block_bezier *Bezier = (block_bezier *)Memory_Block_AddressAtIndex(Memory, F_Bezier, Layer->Shape.Block_Bezier_Index[0], 0);
+ Bezier->Occupied = true;
+ v2 BezierPoint[3] = { Point, V2(000, 000), V2(000, 000) };
+ interpolation_type Type = interpolation_type_linear;
+ if (Vector.x) {
+ BezierPoint[1] = Vector;
+ BezierPoint[2] = Vector * -1;
+ Type = interpolation_type_bezier;
+ }
+ Bezier->Point[0] = { 1, { BezierPoint[0], BezierPoint[1], BezierPoint[2] }, Type, 0 };
+
+ History_Entry_End(Memory);
+ State->UpdateFrame = true;
+}
+
+static void
Project_PaintLayer_New(project_data *File, project_state *State, memory *Memory)
{
int TopOffset = Layer_GetTopOffset(File, Memory);