Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions src/core/Locales.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/res/lang/en_US.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions src/res/lang/fr_FR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 :',
Expand Down
17 changes: 17 additions & 0 deletions src/views/SemanticWorkflow/Implementations/InputListGui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
16 changes: 13 additions & 3 deletions src/views/SemanticWorkflow/Implementations/InputsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/views/SemanticWorkflow/Implementations/Sheet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/views/SemanticWorkflow/Main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Binary file added src/views/SemanticWorkflow/Resources/loop.png
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that this icon is the cycle from google's Material Symbols library.
https://fonts.google.com/icons?selected=Material+Symbols+Outlined:cycle:FILL@0;wght@400;GRAD@0;opsz@24&icon.query=arrow&icon.set=Material+Symbols&icon.size=24&icon.color=%23e3e3e3

As this is licensed under Apache 2.0, the license needs to be added to the repository and distributions for this file specifically.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/views/SemanticWorkflow/Resources/loop_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.