summaryrefslogtreecommitdiff
path: root/my_imgui_widgets.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'my_imgui_widgets.cpp')
-rw-r--r--my_imgui_widgets.cpp225
1 files changed, 200 insertions, 25 deletions
diff --git a/my_imgui_widgets.cpp b/my_imgui_widgets.cpp
index cf33666..2ecdf9e 100644
--- a/my_imgui_widgets.cpp
+++ b/my_imgui_widgets.cpp
@@ -288,14 +288,6 @@ ImGui_SD_Thumbnail(project_data *File, project_state *State, ui *UI, memory *Mem
draw_list->AddImage((void *)(intptr_t)Source->ThumbnailTex, ImgMin, ImgMax);
if (ImGui::IsItemHovered()) {
- int h = 0, c = 0, a = 0;
- while (Block_Loop(Memory, F_Layers, File->Layer_Count, &h, &c, &a)) {
- block_layer *Layer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, a);
- if (Layer->Block_Source_Index == SourceArray[i] && Layer->IsSelected) {
- State->PreviewLayer = a;
- break;
- }
- }
State->PreviewSource = SourceArray[i];
State->UpdateFrame = true;
Active = true;
@@ -311,7 +303,6 @@ ImGui_SD_Thumbnail(project_data *File, project_state *State, ui *UI, memory *Mem
}
if (State->PreviewSource != -1 && !Active) {
State->PreviewSource = -1;
- State->PreviewLayer = -1;
State->UpdateFrame = true;
}
if (ImGui::BeginPopup("temptosource")) {
@@ -418,6 +409,7 @@ ImGui_SD_Prompt(project_data *File, project_state *State, ui *UI, memory *Memory
if (SD->Mode) {
ImGui::SliderFloat("Denoising strength", &SD->DenoisingStrength, 0, 1, "%.2f");
}
+ ImGui::SliderInt("Batch size", &SD->BatchSize, 1, 8, "%i");
ImGui::InputInt("Seed", &SD->Seed);
ImGui::End();
}
@@ -804,18 +796,35 @@ ImGui_TransformUI(project_data *File, project_state *State, memory *Memory, ui *
// Second condition so you don't have to reach for Enter.
if (ImGui::IsKeyPressed(ImGuiKey_Enter) || (ImGui::IsMouseClicked(ImGuiMouseButton_Left) && io.KeyCtrl)) {
int h = 0, c = 0, i = 0;
- History_Entry_Commit(Memory, "Transform layers");
+ if (!io.KeyCtrl)
+ History_Entry_Commit(Memory, "Transform layers");
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) {
- History_Action_Swap(Memory, F_File, sizeof(Layer->x.CurrentValue), &Layer->x.CurrentValue);
- History_Action_Swap(Memory, F_File, sizeof(Layer->y.CurrentValue), &Layer->y.CurrentValue);
- History_Action_Swap(Memory, F_File, sizeof(Layer->scale.CurrentValue), &Layer->scale.CurrentValue);
- History_Action_Swap(Memory, F_File, sizeof(Layer->rotation.CurrentValue), &Layer->rotation.CurrentValue);
- Transform_ApplyInteractive(*(interact_transform *)&State->Interact_Offset[0], &Layer->x.CurrentValue, &Layer->y.CurrentValue, &Layer->rotation.CurrentValue, &Layer->scale.CurrentValue);
+ if (io.KeyCtrl) {
+ layer_transforms T = Layer_GetTransforms(Layer);
+ Transform_ApplyInteractive(*(interact_transform *)&State->Interact_Offset[0], &T.x, &T.y, &T.rotation, &T.scale);
+ property_channel *Property[4] = { &Layer->x, &Layer->y, &Layer->rotation, &Layer->scale };
+ real32 Val[4] = { T.x, T.y, T.rotation, T.scale };
+ for (int a = 0; a < 4; a++) {
+ if (Property[a]->CurrentValue != Val[a]) {
+ History_Entry_Commit(Memory, "Add keyframe");
+ bezier_point Point = { 1, {(real32)State->Frame_Current, Val[a], -1, 0, 1, 0}, interpolation_type_linear, 0, {0, 0, 0}, 0 };
+ Bezier_Add(Memory, Property[a], Point);
+ History_Entry_End(Memory);
+ }
+ }
+ } else {
+ History_Action_Swap(Memory, F_File, sizeof(Layer->x.CurrentValue), &Layer->x.CurrentValue);
+ History_Action_Swap(Memory, F_File, sizeof(Layer->y.CurrentValue), &Layer->y.CurrentValue);
+ History_Action_Swap(Memory, F_File, sizeof(Layer->scale.CurrentValue), &Layer->scale.CurrentValue);
+ History_Action_Swap(Memory, F_File, sizeof(Layer->rotation.CurrentValue), &Layer->rotation.CurrentValue);
+ Transform_ApplyInteractive(*(interact_transform *)&State->Interact_Offset[0], &Layer->x.CurrentValue, &Layer->y.CurrentValue, &Layer->rotation.CurrentValue, &Layer->scale.CurrentValue);
+ }
}
}
- History_Entry_End(Memory);
+ if (!io.KeyCtrl)
+ History_Entry_End(Memory);
State->Interact_Active = interact_type_none;
State->UpdateFrame = true;
}
@@ -2041,18 +2050,14 @@ ImGui_Timeline(project_data *File, project_state *State, memory *Memory, ui *UI,
if (State->Interact_Active == interact_type_keyframe_move ||
State->Interact_Active == interact_type_keyframe_rotate ||
State->Interact_Active == interact_type_keyframe_scale) {
- // bool32 CommitAction = 0;
- // if (!CommitAction) {
- // History_Entry_Commit(Memory, "Delete source");
- // CommitAction = 1;
- History_Entry_Commit(Memory, "Add keyframe");
+ 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 = SortedPropertyArray + (i * 7 * MAX_KEYFRAMES_PER_BLOCK) + (h * MAX_KEYFRAMES_PER_BLOCK);
+ 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];
@@ -2074,6 +2079,7 @@ ImGui_Timeline(project_data *File, project_state *State, memory *Memory, ui *UI,
State->Interact_Offset[2] = 0;
State->Interact_Offset[3] = 0;
State->Interact_Active = interact_type_none;
+ State->Interact_Modifier = 0;
}
UI->BoxSelect = true;
}
@@ -2127,9 +2133,16 @@ ImGui_ProcessInputs(project_data *File, project_state *State, ui *UI, memory *Me
}
}
if (ImGui::IsKeyPressed(ImGuiKey_X)) {
- v4 Temp = UI->Color;
- UI->Color = UI->AltColor;
- UI->AltColor = Temp;
+ if (State->Interact_Active == interact_type_keyframe_move) {
+ if (State->Interact_Modifier != 1)
+ State->Interact_Modifier = 1;
+ else
+ State->Interact_Modifier = 0;
+ } else {
+ v4 Temp = UI->Color;
+ UI->Color = UI->AltColor;
+ UI->AltColor = Temp;
+ }
}
if (ImGui::IsKeyPressed(ImGuiKey_V)) {
State->Tool = tool_default;
@@ -3799,6 +3812,168 @@ static char ImGuiPrefs[] = "[Window][DockSpaceViewport_11111111]"
"\n DockNode ID=0x00000008 Parent=0x00000006 SizeRef=502,256 Selected=0x812F222D"
"\n DockNode ID=0x00000002 Parent=0x8B93E3BD SizeRef=3200,627 HiddenTabBar=1 Selected=0x0F18B61B";
+[Window][DockSpaceViewport_11111111]
+Pos=0,0
+Size=3200,1800
+Collapsed=0
+
+[Window][Debug##Default]
+Pos=122,442
+Size=400,400
+Collapsed=0
+
+[Window][Viewport]
+Pos=596,34
+Size=2079,1149
+Collapsed=0
+DockId=0x00000010,0
+
+[Window][###Properties]
+Pos=0,34
+Size=594,452
+Collapsed=0
+DockId=0x0000000B,0
+
+[Window][Timeline]
+Pos=0,1185
+Size=3200,615
+Collapsed=0
+DockId=0x0000000A,0
+
+[Window][Dear ImGui Demo]
+Pos=2677,34
+Size=523,633
+Collapsed=0
+DockId=0x00000011,1
+
+[Window][Files]
+Pos=2677,669
+Size=523,514
+Collapsed=0
+DockId=0x00000012,0
+
+[Window][Effects list]
+Pos=2717,414
+Size=483,623
+Collapsed=0
+DockId=0x00000008,0
+
+[Window][Graph editor]
+Pos=0,949
+Size=3200,526
+Collapsed=0
+DockId=0x00000009,0
+
+[Window][undotree]
+Pos=2367,83
+Size=256,565
+Collapsed=0
+
+[Window][memoryviewer]
+Pos=50,273
+Size=800,200
+Collapsed=0
+
+[Window][Example: Custom rendering]
+Pos=758,789
+Size=485,414
+Collapsed=0
+
+[Window][Memory viewer]
+Pos=2677,669
+Size=523,514
+Collapsed=0
+DockId=0x00000012,1
+
+[Window][Graph info]
+Pos=1303,1142
+Size=235,353
+Collapsed=0
+
+[Window][Properties]
+Pos=0,34
+Size=495,1056
+Collapsed=0
+DockId=0x0000000F,0
+
+[Window][Colors]
+Pos=2677,34
+Size=523,633
+Collapsed=0
+DockId=0x00000011,0
+
+[Window][Menu]
+Pos=0,0
+Size=3200,32
+Collapsed=0
+DockId=0x0000000D,0
+
+[Window][Stable Diffusion]
+Pos=2206,684
+Size=421,462
+Collapsed=0
+
+[Window][SD prompt input]
+Pos=2677,669
+Size=523,514
+Collapsed=0
+DockId=0x00000012,2
+
+[Window][Example: Console]
+Pos=747,851
+Size=520,600
+Collapsed=0
+
+[Window][SD gallery]
+Pos=0,488
+Size=594,695
+Collapsed=0
+DockId=0x0000000C,0
+
+[Table][0x861D378E,3]
+Column 0 Weight=1.0000
+Column 1 Weight=1.0000
+Column 2 Weight=1.0000
+
+[Table][0x1F146634,3]
+RefScale=13
+Column 0 Width=63
+Column 1 Width=63
+Column 2 Width=63
+
+[Table][0x64418101,3]
+RefScale=13
+Column 0 Width=63
+Column 1 Width=63
+Column 2 Width=63
+
+[Table][0xC9935533,3]
+Column 0 Weight=1.0000
+Column 1 Weight=1.0000
+Column 2 Weight=1.0000
+
+[Docking][Data]
+DockSpace ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,0 Size=3200,1800 Split=Y Selected=0x13926F0B
+ DockNode ID=0x0000000D Parent=0x8B93E3BD SizeRef=3200,32 HiddenTabBar=1 Selected=0xA57AB2C6
+ DockNode ID=0x0000000E Parent=0x8B93E3BD SizeRef=3200,1766 Split=Y
+ DockNode ID=0x00000001 Parent=0x0000000E SizeRef=3200,1149 Split=X Selected=0x13926F0B
+ DockNode ID=0x00000003 Parent=0x00000001 SizeRef=594,1171 Split=Y Selected=0xDBB8CEFA
+ DockNode ID=0x0000000B Parent=0x00000003 SizeRef=521,452 Selected=0xDBB8CEFA
+ DockNode ID=0x0000000C Parent=0x00000003 SizeRef=521,695 Selected=0x56290987
+ DockNode ID=0x00000004 Parent=0x00000001 SizeRef=2604,1171 Split=X Selected=0x13926F0B
+ DockNode ID=0x00000005 Parent=0x00000004 SizeRef=2079,1171 Split=X Selected=0x13926F0B
+ DockNode ID=0x0000000F Parent=0x00000005 SizeRef=495,856 Selected=0x199AB496
+ DockNode ID=0x00000010 Parent=0x00000005 SizeRef=2199,856 CentralNode=1 Selected=0x13926F0B
+ DockNode ID=0x00000006 Parent=0x00000004 SizeRef=523,1171 Split=Y Selected=0x86FA2F90
+ DockNode ID=0x00000007 Parent=0x00000006 SizeRef=502,412 Split=Y Selected=0x86FA2F90
+ DockNode ID=0x00000011 Parent=0x00000007 SizeRef=483,633 Selected=0xBF7DFDC9
+ DockNode ID=0x00000012 Parent=0x00000007 SizeRef=483,514 Selected=0x59A2A092
+ DockNode ID=0x00000008 Parent=0x00000006 SizeRef=502,623 Selected=0x812F222D
+ DockNode ID=0x00000002 Parent=0x0000000E SizeRef=3200,615 Split=Y Selected=0x0F18B61B
+ DockNode ID=0x00000009 Parent=0x00000002 SizeRef=3250,526 Selected=0xA1F22F4D
+ DockNode ID=0x0000000A Parent=0x00000002 SizeRef=3250,323 HiddenTabBar=1 Selected=0x0F18B61B
+
+
/*
// Graph window