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.cpp48
1 files changed, 36 insertions, 12 deletions
diff --git a/my_imgui_widgets.cpp b/my_imgui_widgets.cpp
index eaa7eb9..70d4ffc 100644
--- a/my_imgui_widgets.cpp
+++ b/my_imgui_widgets.cpp
@@ -307,7 +307,7 @@ ImGui_SD_Thumbnail(project_data *File, project_state *State, ui *UI, memory *Mem
ImVec2 ViewportMin = ImGui::GetCursorScreenPos();
ImVec2 ViewportScale = ImGui::GetContentRegionAvail();
ImVec2 ViewportMax = ImVec2(ViewportMin.x + ViewportScale.x, ViewportMin.y + ViewportScale.y);
- if (!SourceCount) {
+ if (!SourceCount || ViewportScale.x < 50) {
ImGui::End();
return;
}
@@ -435,7 +435,7 @@ ImGui_SD_Prompt(project_data *File, project_state *State, ui *UI, memory *Memory
}
ImGui::InputText("Address", SD->ServerAddress, SD_LEN_ADDRESS);
if (State->Initializing && (SD->ServerAddress[0] == '\0')) {
- sprintf(SD->Prompt, "%s", "1girl, looking at viewer, smile, hakurei reimu, cowboy shot");
+ sprintf(SD->Prompt, "%s", "scan, highres, monochrome, traditional medium, (sketch:1.2), flat shading, earth, globe, effects, clouds, lightning, fire");
sprintf(SD->NegPrompt, "%s", "nsfw, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark");
sprintf(SD->ServerAddress, "%s", "http://127.0.0.1:7860");
}
@@ -1055,16 +1055,18 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory,
sorted_layer *SortedLayerInfo = Layer_GetSortedArray(SortedLayerArray, SortedCompArray, File->PrincipalCompIndex);
sorted_comp_info SortedCompInfo = SortedCompArray[File->PrincipalCompIndex];
if (!io.KeyCtrl) {
- for (int i = SortedCompInfo.LayerCount - 1; i >= 0; i--) {
- sorted_layer SortEntry = SortedLayerInfo[i];
- uint32 Index_Physical = SortEntry.Block_Layer_Index;
- block_layer *Layer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, Index_Physical);
- block_source *Source = (block_source *)Memory_Block_AddressAtIndex(Memory, F_Sources, Layer->Block_Source_Index);
- if (Layer->IsSelected && Source->Type == source_type_principal) {
- Arbitrary_Zero((uint8 *)State->Brush.TransientBitmap, 2048*2048*4);
- State->Interact_Active = interact_type_brush;
- State->Brush.LayerToPaint_Index = Index_Physical;
- break;
+ 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->IsPrecomp) {
+ block_source *Source = (block_source *)Memory_Block_AddressAtIndex(Memory, F_Sources, Layer->Block_Source_Index);
+ if (Layer->IsSelected && Source->Type == source_type_principal) {
+ Arbitrary_Zero((uint8 *)State->Brush.TransientBitmap, 2048*2048*4);
+ State->Interact_Active = interact_type_brush;
+ State->Brush.LayerToPaint_Index = i;
+ break;
+ }
}
}
}
@@ -1715,10 +1717,32 @@ ImGui_Timeline_DrawPrecomp(project_data *File, project_state *State, memory *Mem
ImGui::OpenPopupOnItemClick("layerpopup", ImGuiPopupFlags_MouseButtonRight);
if (ImGui::BeginPopup("layerpopup")) {
+ if (ImGui::Selectable("Visible")) {
+ bool32 Commit = false;
+ int h = 0, z = 0, i = 0;
+ while (Block_Loop(Memory, F_Layers, File->Layer_Count, &h, &z, &i)) {
+ block_layer *Layer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, i);
+ if (Layer->IsSelected) {
+ if (!Commit) {
+ History_Entry_Commit(Memory, "Toggle visibility");
+ Commit = true;
+ }
+ History_Action_Swap(Memory, F_File, sizeof(Layer->IsVisible), &Layer->IsVisible);
+ Layer->IsVisible ^= 1;
+ }
+ }
+ if (Commit) {
+ History_Entry_End(Memory);
+ State->UpdateFrame = true;
+ }
+ }
if (ImGui::MenuItem("Pre-compose layer")) {
Precomp_UICreateButton(File, State, Memory, CompIndex, SortedCompInfo, SortedLayerInfo);
State->UpdateKeyframes = true;
}
+ if (ImGui::MenuItem("Duplicate layer")) {
+ Precomp_UIDuplicate(File, State, Memory, CompIndex, SortedCompInfo, SortedLayerInfo);
+ }
if (ImGui::BeginMenu("Layer color"))
{
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 0.0f));