Skip to content

Commit 291ba39

Browse files
committed
fix: early return
- Remove early exits before EndChild. - Don't prepend a favorite symbol to the selectable if we're in the favorites tab.
1 parent 833ba96 commit 291ba39

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

SSV2/includes/frontend/yim_actions/actions_ui.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ local t_ActionsSidebarItems <const> = {
3737
},
3838
}
3939

40+
---@type array<fun(): string>
4041
local SideBarTips <const> = {
4142
function() return _F(_T("YAV3_STOP_BTN_HINT"), GVars.keyboard_keybinds.stop_anim) end,
4243
function() return _F(_T("YAV3_SYMBOL_DEFS_HINT"), "[*]", "[C]", "[U]") end,
@@ -88,9 +89,9 @@ local function DrawActionsSidebar()
8889
GUI:PlaySound(GUI.Sounds.Nav)
8990
if (sidebarTipIndex == 1) then
9091
sidebarTipIndex = #SideBarTips
91-
return
92+
else
93+
sidebarTipIndex = sidebarTipIndex - 1
9294
end
93-
sidebarTipIndex = sidebarTipIndex - 1
9495
end
9596
GUI:Tooltip(_T("GENERIC_PREVIOUS"))
9697

@@ -99,9 +100,9 @@ local function DrawActionsSidebar()
99100
GUI:PlaySound(GUI.Sounds.Nav)
100101
if (sidebarTipIndex == #SideBarTips) then
101102
sidebarTipIndex = 1
102-
return
103+
else
104+
sidebarTipIndex = sidebarTipIndex + 1
103105
end
104-
sidebarTipIndex = sidebarTipIndex + 1
105106
end
106107
GUI:Tooltip(_T("GENERIC_NEXT"))
107108
ImGui.SetWindowFontScale(1.0)

SSV2/includes/services/asset_browsers/ActionBrowser.lua

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,44 +406,50 @@ function ActionBrowser:DrawItemContext(k, v)
406406

407407
local current_label = self.m_name_resolver(v)
408408
local current_cat = self.m_category_name
409+
local current_mode = self.m_mode
409410
local is_favorite = YimActions:DoesFavoriteExist(current_cat, current_label)
411+
-- local is_user_gen = current_cat == "anims" and (Backend.debug_mode and YimActions:GetUGA()[current_label] ~= nil) or false -- TODO: Add an option to create new anim defs
410412
local has_command = YimActions.Commands[current_label] ~= nil
411413
local indicators = ""
412414

413-
if (is_favorite) then
415+
if (is_favorite and current_mode.name ~= "favorites") then
414416
indicators = indicators .. "[*] "
415417
end
416418

417419
if (has_command) then
418420
indicators = indicators .. "[C] "
419421
end
420422

423+
-- if (is_user_gen) then
424+
-- indicators = indicators .. "[U] "
425+
-- end
426+
421427
local avail = ImGui.GetContentRegionAvail()
422428
local textWidth = ImGui.CalcTextSize(indicators)
423429
ImGui.SameLine(avail - textWidth)
424430
ImGui.TextDisabled(indicators)
425431

426432
if (ImGui.BeginPopup(context_label)) then
427433
if (is_favorite) then
428-
if (self.m_mode.can_remove_favorite and ImGui.MenuItem("Remove From Favorites")) then
434+
if (current_mode.can_remove_favorite and ImGui.MenuItem("Remove From Favorites")) then
429435
GUI:PlaySound("Click")
430436
YimActions:RemoveFromFavorites(current_cat, current_label)
431437
end
432438
else
433-
if (self.m_mode.can_add_favorite and ImGui.MenuItem("Add To Favorites")) then
439+
if (current_mode.can_add_favorite and ImGui.MenuItem("Add To Favorites")) then
434440
GUI:PlaySound("Click")
435441
YimActions:AddToFavorites(current_cat, current_label, v, self.m_type)
436442
end
437443
end
438444

439445
if (self.m_type ~= Enums.eActionType.CLIPSET) then
440446
if (has_command) then
441-
if (self.m_mode.can_remove_command and ImGui.MenuItem("Remove Command")) then
447+
if (current_mode.can_remove_command and ImGui.MenuItem("Remove Command")) then
442448
GUI:PlaySound("Click")
443449
YimActions:RemoveCommandAction(current_label)
444450
end
445451
else
446-
if (self.m_mode.can_add_command and ImGui.MenuItem("Create Command")) then
452+
if (current_mode.can_add_command and ImGui.MenuItem("Create Command")) then
447453
GUI:PlaySound("Click")
448454
YimActions.DrawNewCommandWindow = true
449455
end

0 commit comments

Comments
 (0)