From 2926a49b024d02294706d3f805d0b89d73994cb0 Mon Sep 17 00:00:00 2001 From: hugou74130 Date: Sat, 25 Apr 2026 21:43:34 +0200 Subject: [PATCH 1/3] add loop target fields and localization for loop functionality --- src/core/Locales.lua | 2 ++ src/res/lang/en_US.lua | 2 ++ src/res/lang/fr_FR.lua | 2 ++ .../Implementations/InputsTab.lua | 16 +++++++++++++--- .../SemanticWorkflow/Implementations/Sheet.lua | 1 - src/views/SemanticWorkflow/Main.lua | 2 +- src/views/SemanticWorkflow/Resources/loop.png | Bin 0 -> 623 bytes .../SemanticWorkflow/Resources/loop_light.png | Bin 0 -> 550 bytes 8 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 src/views/SemanticWorkflow/Resources/loop.png create mode 100644 src/views/SemanticWorkflow/Resources/loop_light.png diff --git a/src/core/Locales.lua b/src/core/Locales.lua index 2f3f6be..353102a 100644 --- a/src/core/Locales.lua +++ b/src/core/Locales.lua @@ -98,6 +98,8 @@ Locales = {} ---@field public SEMANTIC_WORKFLOW_INPUTS_END_ACTION string ---@field public SEMANTIC_WORKFLOW_INPUTS_END_ACTION_TOOL_TIP string ---@field public SEMANTIC_WORKFLOW_INPUTS_END_ACTION_TYPE_TO_SEARCH_TOOL_TIP string +---@field public SEMANTIC_WORKFLOW_INPUTS_LOOP_TARGET string +---@field public SEMANTIC_WORKFLOW_INPUTS_LOOP_TARGET_TOOL_TIP string ---@field public SEMANTIC_WORKFLOW_PREFERENCES_EDIT_ENTIRE_STATE string ---@field public SEMANTIC_WORKFLOW_PREFERENCES_FAST_FORWARD string ---@field public SEMANTIC_WORKFLOW_PREFERENCES_DEFAULT_SECTION_TIMEOUT string diff --git a/src/res/lang/en_US.lua b/src/res/lang/en_US.lua index efd2d96..d99552d 100644 --- a/src/res/lang/en_US.lua +++ b/src/res/lang/en_US.lua @@ -116,6 +116,8 @@ This action cannot be undone. SEMANTIC_WORKFLOW_INPUTS_END_ACTION = 'End action:', SEMANTIC_WORKFLOW_INPUTS_END_ACTION_TOOL_TIP = 'End section when Mario enters this action', SEMANTIC_WORKFLOW_INPUTS_END_ACTION_TYPE_TO_SEARCH_TOOL_TIP = 'Type to filter actions', + SEMANTIC_WORKFLOW_INPUTS_LOOP_TARGET = 'Target', + SEMANTIC_WORKFLOW_INPUTS_LOOP_TARGET_TOOL_TIP = 'Click an input to set it as the loop jump target', SEMANTIC_WORKFLOW_PREFERENCES_TAB_NAME = 'Preferences', SEMANTIC_WORKFLOW_PREFERENCES_EDIT_ENTIRE_STATE = 'Edit entire state', SEMANTIC_WORKFLOW_PREFERENCES_FAST_FORWARD = 'Fast Forward', diff --git a/src/res/lang/fr_FR.lua b/src/res/lang/fr_FR.lua index dcb33f6..7d9f61e 100644 --- a/src/res/lang/fr_FR.lua +++ b/src/res/lang/fr_FR.lua @@ -118,6 +118,8 @@ Cette action est irréversible. SEMANTIC_WORKFLOW_INPUTS_END_ACTION = 'Action de fin :', SEMANTIC_WORKFLOW_INPUTS_END_ACTION_TOOL_TIP = 'Terminer la section quand Mario entre dans cette action', SEMANTIC_WORKFLOW_INPUTS_END_ACTION_TYPE_TO_SEARCH_TOOL_TIP = 'Taper pour filtrer les actions', + SEMANTIC_WORKFLOW_INPUTS_LOOP_TARGET = 'Cible', + SEMANTIC_WORKFLOW_INPUTS_LOOP_TARGET_TOOL_TIP = 'Cliquer un input pour le définir comme cible du saut de loop', SEMANTIC_WORKFLOW_PREFERENCES_EDIT_ENTIRE_STATE = 'Modifier l\'état entier', SEMANTIC_WORKFLOW_PREFERENCES_FAST_FORWARD = 'Avance rapide', SEMANTIC_WORKFLOW_PREFERENCES_DEFAULT_SECTION_TIMEOUT = 'Délai de section par défaut :', diff --git a/src/views/SemanticWorkflow/Implementations/InputsTab.lua b/src/views/SemanticWorkflow/Implementations/InputsTab.lua index 086b607..9b4bdf8 100644 --- a/src/views/SemanticWorkflow/Implementations/InputsTab.lua +++ b/src/views/SemanticWorkflow/Implementations/InputsTab.lua @@ -124,12 +124,16 @@ local function controls_for_end_action(input, draw, column, top) end ---@param input SectionInputs +---@return boolean any_changes local function controls_for_loop(input, draw, column, top) + local any_changes = false + local had_loop = input.loop ~= nil local has_loop = ugui.toggle_button({ uid = UID.LoopToggle, rectangle = grid_rect(column, top, Gui.MEDIUM_CONTROL_HEIGHT, Gui.MEDIUM_CONTROL_HEIGHT), text = "[icon:loop]", - is_checked = input.loop and true or false + is_checked = had_loop, + styler_mixin = { icon_size = 14 }, }) if not has_loop then input.loop = nil @@ -140,19 +144,23 @@ local function controls_for_loop(input, draw, column, top) runtime_counter = 0, } end + any_changes = any_changes or (had_loop ~= (input.loop ~= nil)) if input.loop then + local old_count = input.loop.count input.loop.count = ugui.numberbox({ uid = UID.LoopCount, rectangle = grid_rect(column + 1, top, 2, Gui.MEDIUM_CONTROL_HEIGHT), places = 2, value = input.loop.count, }) + any_changes = any_changes or old_count ~= input.loop.count if ugui.button({ uid = UID.LoopSelectTarget, rectangle = grid_rect(column + 3, top, 3, Gui.MEDIUM_CONTROL_HEIGHT), text = Locales.str("SEMANTIC_WORKFLOW_INPUTS_LOOP_TARGET"), + tooltip = Locales.str("SEMANTIC_WORKFLOW_INPUTS_LOOP_TARGET_TOOL_TIP"), }) then -- TODO: avoid crisis when retiming atan at the same time InputListGui.special_select_handler = function(selection) @@ -161,10 +169,13 @@ local function controls_for_loop(input, draw, column, top) if own_index >= selection.input_index then input.loop.jump_target = input_list[selection.input_index] InputListGui.special_select_handler = nil + SemanticWorkflowProject:asserted_current():run_to_preview() end end end end + + return any_changes end local function section_controls_for_selected(draw, edited_input) @@ -193,7 +204,7 @@ local function section_controls_for_selected(draw, edited_input) controls_for_end_action(edited_input, draw, 0, top) if end_action_search_text == nil then - controls_for_loop(edited_input, draw, 0, top + 1) + any_changes = any_changes or controls_for_loop(edited_input, draw, 0, top + 1) end if any_changes then @@ -295,7 +306,6 @@ local function select_atan_end(selection_input) end local function select_atan_start(selection_input) - print(selection_input) local sheet = SemanticWorkflowProject:asserted_current() previous_preview_input = sheet.preview_input sheet.preview_input = selection_input diff --git a/src/views/SemanticWorkflow/Implementations/Sheet.lua b/src/views/SemanticWorkflow/Implementations/Sheet.lua index 36efec0..c98883d 100644 --- a/src/views/SemanticWorkflow/Implementations/Sheet.lua +++ b/src/views/SemanticWorkflow/Implementations/Sheet.lua @@ -71,7 +71,6 @@ function __impl:evaluate_frame() self._input_index = 1 end else - print(input.loop.runtime_counter) input.loop.runtime_counter = input.loop.runtime_counter + 1 self._input_index = IndexOf(section.inputs, input.loop.jump_target) or 1 -- TODO: this feels uncleaaaan end diff --git a/src/views/SemanticWorkflow/Main.lua b/src/views/SemanticWorkflow/Main.lua index e3ccc8c..5f8f689 100644 --- a/src/views/SemanticWorkflow/Main.lua +++ b/src/views/SemanticWorkflow/Main.lua @@ -90,7 +90,7 @@ SemanticWorkflowDialog = nil local ugui_icon_draw = ugui.standard_styler.draw_icon local custom_icons = { 'navigate_back', 'arrow_up', 'arrow_down', 'base_sheet', 'without_save', 'delete', - 'next_page', 'previous_page', 'duplicate', 'action', 'clone_up', 'clone_down', 'merge_up'} + 'next_page', 'previous_page', 'duplicate', 'action', 'clone_up', 'clone_down', 'merge_up', 'loop'} ugui.standard_styler.draw_icon = function(rectangle, color, visual_state, key) local postfix = Drawing.IsLightMode() and '' or '_light' diff --git a/src/views/SemanticWorkflow/Resources/loop.png b/src/views/SemanticWorkflow/Resources/loop.png new file mode 100644 index 0000000000000000000000000000000000000000..78f3a3eb4716820224912058e7dfd85ef9ff3815 GIT binary patch literal 623 zcmV-#0+9WQP)HsOUneqU1lIqN9tBj*iYIDN;H*Ro3qrnK`p7 z8&2GE=E*zn^?B!#NxAgHpT8$C#!SRhAc8fS5hulCUf6t2L$6;AowQ=|s+V;Y|& zHpbNCG{)2g%^eB}2v`Dkbi3WPz69-ywgMAW_HMo_Wb(5ail3R1LoZ zZqup^+@3SZVLHO(DONOBEWG}`aYUtOzkU-85JR9~82AjX*tio*% z=KkZ;1TLM9r|A4Y`U~?h0@?kEP)09}sZEnMB$_npKhUHN8#ZX#v`HhfY_#jQ$2ph##)U7| z-kh29+IQ~Au~Pcw&;JVqK~RNHFo`~nwOKD9_XHHHaX^C?nANC(--KP9nzo2PM6LiC z+t9F6PJ9R)LxY4a*qnJ{K9MUxzYZxatZ>UZ2Ar3$jPn2rNBT-KCcyFbp|Gw*8a&7r zk(_Jdt1uHzfR6UQuY6X|+d@N~-ns7SEibV`(uklg5;Fz<_H;M@N+)P0%1`}X7v`7Q zhS$@9DMYg?M2Aq9<@~JASvoG6YR+W@8G=X`ocqROQ8Ta`sketktgx4*(O>;uYpyB0^VW2i7o}p z-WN0Y$504|A)6(V?CEQ)L&OBU^1Y9aD0DN)@AbQ=vR1Paxo!aZoH2gk2LG!T#+ZPd zBy3@A$n|KTQG(0CM#={M2Gks~xuxd2E-Uht5>O107S>*uo0K$*&L%bOlVfO7lWMMD zrhozz44^R49=^jQYD$3Nr6v<{1(Jz0v41e(-#9rs2__$37O)lw)mbmX3F{SXAwB>A o0RR6K4|W9r000I_L_t&o08gyOD&uTE9{>OV07*qoM6N<$f>`?Uu>b%7 literal 0 HcmV?d00001 From c77d956aa147e067837109ad05193f37d3ddd583 Mon Sep 17 00:00:00 2001 From: hugou74130 Date: Sun, 26 Apr 2026 16:16:08 +0200 Subject: [PATCH 2/3] add loop target highlighting in section drawing --- .../Implementations/InputListGui.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/views/SemanticWorkflow/Implementations/InputListGui.lua b/src/views/SemanticWorkflow/Implementations/InputListGui.lua index 3b805ba..c923693 100644 --- a/src/views/SemanticWorkflow/Implementations/InputListGui.lua +++ b/src/views/SemanticWorkflow/Implementations/InputListGui.lua @@ -275,6 +275,15 @@ local function draw_sections_gui(sheet, draw, section_rect, button_draw_data) end end + local loop_targets = {} + for _, section in ipairs(sheet.sections) do + for _, inp in ipairs(section.inputs) do + if inp.loop and inp.loop.jump_target then + loop_targets[inp.loop.jump_target] = true + end + end + end + iterate_input_rows(sheet, function(section, input, section_index, input_index, row_count) if row_count <= scroll_offset then return false end @@ -488,6 +497,14 @@ local function draw_sections_gui(sheet, draw, section_rect, button_draw_data) BreitbandGraphics.draw_ellipse(rect, input.joy[v.input] and '#000000FF' or '#00000050', 1) end + if loop_targets[input] then + BreitbandGraphics.draw_rectangle(section_rect, '#FF8000FF', 2) + end + + if input.loop then + BreitbandGraphics.draw_rectangle(section_rect, '#0064FFFF', 2) + end + if section_index == sheet.preview_input.section_index and sheet.preview_input.input_index == input_index then BreitbandGraphics.draw_rectangle(section_rect, '#FF0000FF', 1) end From 02ca50d04e185703c51e03e4e1dc87cb90eccc15 Mon Sep 17 00:00:00 2001 From: hugou74 Date: Sun, 3 May 2026 17:27:56 +0000 Subject: [PATCH 3/3] chore: add Apache 2.0 license notice for Material Symbols icons FramePerfection requested in review that the loop/loop_light icons (cycle from Google Material Symbols) carry a license notice. Refs: PR #114 review comment --- NOTICE | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 NOTICE diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..44e1178 --- /dev/null +++ b/NOTICE @@ -0,0 +1,11 @@ +Third-Party Assets +================== + +The following assets are licensed under the Apache License, Version 2.0: + +- src/views/SemanticWorkflow/Resources/loop.png +- src/views/SemanticWorkflow/Resources/loop_light.png + + Source: Google Material Symbols — "cycle" icon + URL: https://fonts.google.com/icons?selected=Material+Symbols+Outlined:cycle + License: Apache-2.0