Skip to content

Commit 8325af1

Browse files
committed
further bulk select update
pac_bulk_select_cursor_info option to draw text next to the cursor when there is a bulk selection or a bulk clipboard, this is to further inform users. something right on the cursor is one of the closest non-invasive ways to inform add a basic cvar-setting derma prompt to the bulk halo highlighting mode menu option (which was purely for information), use more concise text to describe the option deprecate the default bulk_copy shortcut keyword in the experimental presets since it wasn't used (the actual working keyword was copy_bulkselect), but now it's usable as a fallback
1 parent 9f7fbcb commit 8325af1

File tree

2 files changed

+48
-9
lines changed

2 files changed

+48
-9
lines changed

lua/pac3/editor/client/parts.lua

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ CreateConVar( "pac_hover_halo_limit", 100, FCVAR_ARCHIVE, "max number of parts b
2525
CreateConVar("pac_bulk_select_key", "ctrl", FCVAR_ARCHIVE, "Button to hold to use bulk select")
2626
CreateConVar("pac_bulk_select_halo_mode", 1, FCVAR_ARCHIVE, "Halo Highlight mode.\n0 is no highlighting\n1 is passive\n2 is when the same key as bulk select is pressed\n3 is when control key pressed\n4 is when shift key is pressed.")
2727
local bulk_select_subsume = CreateConVar("pac_bulk_select_subsume", "1", FCVAR_ARCHIVE, "Whether bulk-selecting a part implicitly deselects its children since they are covered by the parent already.\nWhile it can provide a clearer view of what's being selected globally which simplifies broad operations like deleting, moving and copying, it prevents targeted operations on nested parts like bulk property editing.")
28+
local bulkselect_cursortext = CreateConVar("pac_bulk_select_cursor_info", "1", FCVAR_ARCHIVE, "Whether to draw some info next to your cursor when there is a bulk selection")
2829

2930
CreateConVar("pac_copilot_partsearch_depth", -1, FCVAR_ARCHIVE, "amount of copiloting in the searchable part menu\n-1:none\n0:auto-focus on the text edit for events\n1:bring up a list of clickable event types\nother parts aren't supported yet")
3031
CreateConVar("pac_copilot_make_popup_when_selecting_event", 1, FCVAR_ARCHIVE, "whether to create a popup so you can read what an event does")
@@ -3841,13 +3842,16 @@ function pace.addPartMenuComponent(menu, obj, option_name)
38413842

38423843
local mode = GetConVar("pac_bulk_select_halo_mode"):GetInt()
38433844
local info
3844-
if mode == 0 then info = "not halo-highlighted"
3845-
elseif mode == 1 then info = "automatically halo-highlighted"
3846-
elseif mode == 2 then info = "halo-highlighted on custom keypress:"..GetConVar("pac_bulk_select_halo_key"):GetString()
3847-
elseif mode == 3 then info = "halo-highlighted on preset keypress: control"
3848-
elseif mode == 4 then info = "halo-highlighted on preset keypress: shift" end
3849-
3850-
bulk_menu:AddOption(L"Bulk select info: "..info):SetImage(pace.MiscIcons.info)
3845+
if mode == 0 then info = "none"
3846+
elseif mode == 1 then info = "passive"
3847+
elseif mode == 2 then info = "custom keypress:"..GetConVar("pac_bulk_select_halo_key"):GetString()
3848+
elseif mode == 3 then info = "preset keypress: control"
3849+
elseif mode == 4 then info = "preset keypress: shift" end
3850+
3851+
bulk_menu:AddOption(L"Bulk select highlight mode: "..info, function()
3852+
Derma_StringRequest("Change bulk select halo highlighting mode", "0 is no highlighting\n1 is passive\n2 is when the same key as bulk select is pressed\n3 is when control key pressed\n4 is when shift key is pressed.",
3853+
tostring(mode), function(str) RunConsoleCommand("pac_bulk_select_halo_mode", str) end)
3854+
end):SetImage(pace.MiscIcons.info)
38513855
if #pace.BulkSelectList == 0 then
38523856
bulk_menu:AddOption(L"Bulk select info: nothing selected"):SetImage(pace.MiscIcons.info)
38533857
else
@@ -3882,7 +3886,8 @@ function pace.addPartMenuComponent(menu, obj, option_name)
38823886
end
38833887
local subsume_pnl = bulk_menu:AddCVar("bulk select subsume", "pac_bulk_select_subsume", "1", "0")
38843888
subsume_pnl:SetTooltip("Whether bulk select should take the hierarchy into account, deselecting children when selecting a part.\nEnable this if you commonly do broad operations like copying, deleting or moving parts.\nDisable this for targeted operations like property editing on nested model structures, for example.")
3885-
3889+
bulk_menu:AddCVar("draw bulk select info next to cursor", "pac_bulk_select_cursor_info", "1", "0")
3890+
38863891
local resetting_mode, resetpnl = bulk_menu:AddSubMenu("Clear selection after operation?") resetpnl:SetImage("icon16/table_delete.png")
38873892
local resetting_mode1 = resetting_mode:AddOption("Yes") resetting_mode1:SetIsCheckable(true) resetting_mode1:SetRadio(true)
38883893
local resetting_mode2 = resetting_mode:AddOption("No") resetting_mode2:SetIsCheckable(true) resetting_mode2:SetRadio(true)
@@ -5166,3 +5171,36 @@ tbl = {
51665171
51675172
]]
51685173

5174+
local bsel_main_icon = Material("icon16/table_multiple.png")
5175+
local bsel_clipboard_icon = Material("icon16/page_white_text.png")
5176+
local white = Color(255,255,255)
5177+
5178+
pac.AddHook("DrawOverlay", "bulkselect_cursor_info", function()
5179+
if not bulkselect_cursortext:GetBool() then return end
5180+
if not pace then return end
5181+
if not pace.IsFocused() then return end
5182+
local mx, my = input.GetCursorPos()
5183+
5184+
surface.SetFont("BudgetLabel")
5185+
surface.SetMaterial(Material("icon16/table_multiple.png"))
5186+
surface.SetTextColor(white)
5187+
surface.SetDrawColor(white)
5188+
local base_y = my + 8
5189+
5190+
if pace.BulkSelectList then
5191+
if #pace.BulkSelectList > 0 then
5192+
surface.DrawTexturedRect(mx + 10, base_y, 16, 16)
5193+
surface.SetTextPos(mx + 12 + 16, base_y)
5194+
surface.DrawText("bulk select [" .. #pace.BulkSelectList .."]")
5195+
base_y = base_y + 16
5196+
end
5197+
end
5198+
if pace.BulkSelectClipboard then
5199+
if #pace.BulkSelectClipboard > 0 then
5200+
surface.SetMaterial(Material("icon16/page_white_text.png"))
5201+
surface.DrawTexturedRect(mx + 10, base_y, 16, 16)
5202+
surface.SetTextPos(mx + 12 + 16, base_y)
5203+
surface.DrawText("bulk clipboard [" .. #pace.BulkSelectClipboard .."]")
5204+
end
5205+
end
5206+
end)

lua/pac3/editor/client/shortcuts.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ pace.PACActionShortcut_Experimental = {
229229
[1] = {"CTRL", "c"}
230230
},
231231

232-
["bulk_copy"] = {
232+
["copy_bulkselect"] = {
233233
[1] = {"SHIFT", "CTRL", "c"}
234234
},
235235

@@ -680,6 +680,7 @@ function pace.DoShortcutFunc(action)
680680
pace.DoBulkSelect(pace.current_part)
681681
end
682682
if action == "clear_bulkselect" then pace.ClearBulkList() end
683+
if action == "bulk_copy" then pace.BulkCopy(pace.current_part) end --deprecated keyword
683684
if action == "copy_bulkselect" then pace.BulkCopy(pace.current_part) end
684685
if action == "bulk_insert" then pace.BulkCutPaste(pace.current_part) end
685686
if action == "bulk_delete" then pace.BulkRemovePart() end

0 commit comments

Comments
 (0)