diff --git a/garrysmod/gamemodes/sandbox/gamemode/spawnmenu/controlpanel.lua b/garrysmod/gamemodes/sandbox/gamemode/spawnmenu/controlpanel.lua index 3a57e20223..e7c17b6474 100644 --- a/garrysmod/gamemodes/sandbox/gamemode/spawnmenu/controlpanel.lua +++ b/garrysmod/gamemodes/sandbox/gamemode/spawnmenu/controlpanel.lua @@ -263,11 +263,6 @@ function PANEL:AddControl( control, data ) if ( data.default ) then ctrl:SetDefaultValue( data.default ) - elseif ( data.command ) then - local cvar = GetConVar( data.command ) - if ( cvar ) then - ctrl:SetDefaultValue( cvar:GetDefault() ) - end end return ctrl diff --git a/garrysmod/lua/autorun/utilities_menu.lua b/garrysmod/lua/autorun/utilities_menu.lua index fd5d976d6e..57158b835a 100644 --- a/garrysmod/lua/autorun/utilities_menu.lua +++ b/garrysmod/lua/autorun/utilities_menu.lua @@ -19,7 +19,7 @@ end local function ServerSettings( pnl ) - pnl:AddControl( "Header", { Description = "#utilities.serversettings" } ) + pnl:Help( "#utilities.serversettings" ) local ConVarsDefault = { hostname = "Garry's Mod", @@ -40,36 +40,42 @@ local function ServerSettings( pnl ) g_ragdoll_maxcount = "32", sv_timeout = "65" } - pnl:AddControl( "ComboBox", { MenuButton = 1, Folder = "util_server", Options = { [ "#preset.default" ] = ConVarsDefault }, CVars = table.GetKeys( ConVarsDefault ) } ) + pnl:ToolPresets( "util_server", ConVarsDefault ) - pnl:AddControl( "TextBox", { Label = "#utilities.hostname", Command = "hostname", WaitForEnter = "1" } ) - pnl:AddControl( "TextBox", { Label = "#utilities.password", Command = "sv_password", WaitForEnter = "1" } ) + pnl:TextEntry( "#utilities.hostname", "hostname" ) + pnl:TextEntry( "#utilities.password", "sv_password" ) - pnl:AddControl( "CheckBox", { Label = "#utilities.kickerrornum", Command = "sv_kickerrornum" } ) - pnl:AddControl( "CheckBox", { Label = "#utilities.allowcslua", Command = "sv_allowcslua" } ) - pnl:AddControl( "CheckBox", { Label = "#utilities.sticktoground", Command = "sv_sticktoground", Help = true } ) - pnl:AddControl( "CheckBox", { Label = "#utilities.epickupallowed", Command = "sv_playerpickupallowed" } ) - pnl:AddControl( "CheckBox", { Label = "#utilities.falldamage", Command = "mp_falldamage" } ) - pnl:AddControl( "CheckBox", { Label = "#utilities.gmod_suit", Command = "gmod_suit" } ) + pnl:CheckBox( "#utilities.kickerrornum", "sv_kickerrornum" ) + pnl:CheckBox( "#utilities.allowcslua", "sv_allowcslua" ) + + pnl:CheckBox( "#utilities.sticktoground", "sv_sticktoground" ) + pnl:ControlHelp( "#utilities.sticktoground.help" ) + + pnl:CheckBox( "#utilities.epickupallowed", "sv_playerpickupallowed" ) + pnl:CheckBox( "#utilities.falldamage", "mp_falldamage" ) + pnl:CheckBox( "#utilities.gmod_suit", "gmod_suit" ) -- Fun convars - pnl:AddControl( "Slider", { Label = "#utilities.gravity", Type = "Integer", Command = "sv_gravity", Min = "-500", Max = "1000" } ) - pnl:AddControl( "Slider", { Label = "#utilities.friction", Type = "Integer", Command = "sv_friction", Min = "0", Max = "16" } ) -- Float - pnl:AddControl( "Slider", { Label = "#utilities.timescale", Type = "Float", Command = "phys_timescale", Min = "0", Max = "2" } ) - pnl:AddControl( "Slider", { Label = "#utilities.deployspeed", Type = "Float", Command = "sv_defaultdeployspeed", Min = "0.1", Max = "10" } ) - pnl:AddControl( "Slider", { Label = "#utilities.noclipspeed", Type = "Integer", Command = "sv_noclipspeed", Min = "1", Max = "10" } ) -- Switch this and friction back to Float once Sliders don't reset the convar from 8 to 8.00, etc - pnl:AddControl( "Slider", { Label = "#utilities.maxammo", Type = "Integer", Command = "gmod_maxammo", Min = "0", Max = "9999", Help = true } ) - pnl:AddControl( "Slider", { Label = "#utilities.max_ragdolls", Type = "Integer", Command = "g_ragdoll_maxcount", Min = "0", Max = "128" } ) + pnl:NumSlider( "#utilities.gravity", "sv_gravity", -500, 1000, 0 ) + pnl:NumSlider( "#utilities.friction", "sv_friction", 0, 16, 0 ) + pnl:NumSlider( "#utilities.timescale", "phys_timescale", 0, 2 ) + pnl:NumSlider( "#utilities.deployspeed", "sv_defaultdeployspeed", 0.1, 10 ) + pnl:NumSlider( "#utilities.noclipspeed", "sv_noclipspeed", 1, 10, 0 ) -- TODO: Switch this and friction back to Float once the sliders dont reset the convar from 8 to 8.00 + + pnl:NumSlider( "#utilities.maxammo", "gmod_maxammo", 0, 9999, 0 ) + pnl:ControlHelp( "#utilities.maxammo.help" ) + + pnl:NumSlider( "#utilities.max_ragdolls", "g_ragdoll_maxcount", 0, 128, 0 ) -- Technical convars - pnl:AddControl( "Slider", { Label = "#utilities.iterations", Type = "Integer", Command = "gmod_physiterations", Min = "1", Max = "10" } ) - pnl:AddControl( "Slider", { Label = "#utilities.sv_timeout", Type = "Integer", Command = "sv_timeout", Min = "60", Max = "300" } ) + pnl:NumSlider( "#utilities.iterations", "gmod_physiterations", 1, 10, 0 ) + pnl:NumSlider( "#utilities.sv_timeout", "sv_timeout", 60, 300, 0 ) end local function SandboxClientSettings( pnl ) - pnl:AddControl( "Header", { Description = "#utilities.sandboxsettings_cl" } ) + pnl:Help( "#utilities.sandboxsettings_cl" ) local ConVarsDefault = { sbox_search_maxresults = "1024", @@ -83,30 +89,26 @@ local function SandboxClientSettings( pnl ) cl_drawthrusterseffects = "1", cl_showhints = "1", } + pnl:ToolPresets( "util_sandbox_cl", ConVarsDefault ) - pnl:AddControl( "ComboBox", { MenuButton = 1, Folder = "util_sandbox_cl", Options = { [ "#preset.default" ] = ConVarsDefault }, CVars = table.GetKeys( ConVarsDefault ) } ) - - pnl:AddControl( "Slider", { Label = "#utilities.max_results", Type = "Integer", Command = "sbox_search_maxresults", Min = "1024", Max = "8192", Help = true } ) - - local function AddCheckbox( title, cvar ) - pnl:AddControl( "CheckBox", { Label = title, Command = cvar } ) - end + pnl:NumSlider( "#utilities.max_results", "sbox_search_maxresults", 1024, 8192, 0 ) + pnl:ControlHelp( "#utilities.max_results.help" ) - AddCheckbox( "#menubar.drawing.hud", "cl_drawhud" ) - AddCheckbox( "#menubar.drawing.toolhelp", "gmod_drawhelp" ) - AddCheckbox( "#menubar.drawing.toolui", "gmod_drawtooleffects" ) - AddCheckbox( "#menubar.drawing.world_tooltips", "cl_drawworldtooltips" ) - AddCheckbox( "#menubar.drawing.spawn_effect", "cl_drawspawneffect" ) - AddCheckbox( "#menubar.drawing.effect_rings", "cl_draweffectrings" ) - AddCheckbox( "#menubar.drawing.cameras", "cl_drawcameras" ) - AddCheckbox( "#menubar.drawing.thrusters", "cl_drawthrusterseffects" ) - AddCheckbox( "#menubar.drawing.hints", "cl_showhints" ) + pnl:CheckBox( "#menubar.drawing.hud", "cl_drawhud" ) + pnl:CheckBox( "#menubar.drawing.toolhelp", "gmod_drawhelp" ) + pnl:CheckBox( "#menubar.drawing.toolui", "gmod_drawtooleffects" ) + pnl:CheckBox( "#menubar.drawing.world_tooltips", "cl_drawworldtooltips" ) + pnl:CheckBox( "#menubar.drawing.spawn_effect", "cl_drawspawneffect" ) + pnl:CheckBox( "#menubar.drawing.effect_rings", "cl_draweffectrings" ) + pnl:CheckBox( "#menubar.drawing.cameras", "cl_drawcameras" ) + pnl:CheckBox( "#menubar.drawing.thrusters", "cl_drawthrusterseffects" ) + pnl:CheckBox( "#menubar.drawing.hints", "cl_showhints" ) end local function SandboxSettings( pnl ) - pnl:AddControl( "Header", { Description = "#utilities.sandboxsettings" } ) + pnl:Help( "#utilities.sandboxsettings" ) local ConVarsDefault = { sbox_persist = "", @@ -134,33 +136,32 @@ local function SandboxSettings( pnl ) } ) end - pnl:AddControl( "ComboBox", { MenuButton = 1, Folder = "util_sandbox", Options = { [ "#preset.default" ] = ConVarsDefault }, CVars = table.GetKeys( ConVarsDefault ) } ) + pnl:ToolPresets( "util_sandbox", ConVarsDefault ) - pnl:AddControl( "TextBox", { Label = "#persistent_mode", Command = "sbox_persist", WaitForEnter = "1" } ) + pnl:TextEntry( "#persistent_mode", "sbox_persist" ) pnl:ControlHelp( "#persistent_mode.help" ):DockMargin( 16, 4, 16, 8 ) - pnl:AddControl( "CheckBox", { Label = "#enable_weapons", Command = "sbox_weapons" } ) - pnl:AddControl( "CheckBox", { Label = "#allow_god_mode", Command = "sbox_godmode" } ) + pnl:CheckBox( "#enable_weapons", "sbox_weapons" ) + pnl:CheckBox( "#allow_god_mode", "sbox_godmode" ) pnl:ControlHelp( "#utilities.mp_only" ):DockMargin( 16, 16, 16, 4 ) - pnl:AddControl( "CheckBox", { Label = "#players_damage_players", Command = "sbox_playershurtplayers" } ) - pnl:AddControl( "CheckBox", { Label = "#allow_noclip", Command = "sbox_noclip" } ) + pnl:CheckBox( "#players_damage_players", "sbox_playershurtplayers" ) + pnl:CheckBox( "#allow_noclip", "sbox_noclip" ) - pnl:AddControl( "CheckBox", { Label = "#bone_manipulate_npcs", Command = "sbox_bonemanip_npc" } ) - pnl:AddControl( "CheckBox", { Label = "#bone_manipulate_players", Command = "sbox_bonemanip_player" } ) - pnl:AddControl( "CheckBox", { Label = "#bone_manipulate_others", Command = "sbox_bonemanip_misc" } ) + pnl:CheckBox( "#bone_manipulate_npcs", "sbox_bonemanip_npc" ) + pnl:CheckBox( "#bone_manipulate_players", "sbox_bonemanip_player" ) + pnl:CheckBox( "#bone_manipulate_others", "sbox_bonemanip_misc" ) for id, t in SortedPairsByMemberValue( ConVarsLimits, "label" ) do - local ctrl = pnl:AddControl( "Slider", { Label = t.label, Command = t.command, Min = "0", Max = "200" } ) - ctrl:SetHeight( 16 ) -- This makes the controls all bunched up like how we want + pnl:NumSlider( t.label, t.command, 0, 200, 0 ):SetHeight( 16 ) -- This makes the controls all bunched up like how we want end end local function PhysgunSettings( pnl ) - pnl:AddControl( "Header", { Description = "#utilities.physgunsettings" } ) + pnl:Help( "#utilities.physgunsettings" ) local ConVarsDefault = { physgun_halo = "1", @@ -172,24 +173,24 @@ local function PhysgunSettings( pnl ) physgun_rotation_sensitivity = "0.05", physgun_wheelspeed = "10" } - pnl:AddControl( "ComboBox", { MenuButton = 1, Folder = "util_physgun", Options = { [ "#preset.default" ] = ConVarsDefault }, CVars = table.GetKeys( ConVarsDefault ) } ) + pnl:ToolPresets( "util_physgun", ConVarsDefault ) - pnl:AddControl( "CheckBox", { Label = "#utilities.physgun_halo", Command = "physgun_halo" } ) - pnl:AddControl( "CheckBox", { Label = "#utilities.physgun_drawbeams", Command = "physgun_drawbeams" } ) - pnl:AddControl( "CheckBox", { Label = "#menubar.drawing.freeze", Command = "effects_freeze" } ) - pnl:AddControl( "CheckBox", { Label = "#menubar.drawing.unfreeze", Command = "effects_unfreeze" } ) + pnl:CheckBox( "#utilities.physgun_halo", "physgun_halo" ) + pnl:CheckBox( "#utilities.physgun_drawbeams", "physgun_drawbeams" ) + pnl:CheckBox( "#menubar.drawing.freeze", "effects_freeze" ) + pnl:CheckBox( "#menubar.drawing.unfreeze", "effects_unfreeze" ) - pnl:AddControl( "Slider", { Label = "#utilities.gm_snapgrid", Type = "Integer", Command = "gm_snapgrid", Min = "0", Max = "128" } ) - pnl:AddControl( "Slider", { Label = "#utilities.gm_snapangles", Type = "Integer", Command = "gm_snapangles", Min = "5", Max = "90" } ) + pnl:NumSlider( "#utilities.gm_snapgrid", "gm_snapgrid", 0, 128, 0 ) + pnl:NumSlider( "#utilities.gm_snapangles", "gm_snapangles", 5, 90, 0 ) - pnl:AddControl( "Slider", { Label = "#utilities.physgun_rotation_sensitivity", Type = "Float", Command = "physgun_rotation_sensitivity", Min = "0.01", Max = "1" } ) - pnl:AddControl( "Slider", { Label = "#utilities.physgun_wheelspeed", Type = "Integer", Command = "physgun_wheelspeed", Min = "0", Max = "50" } ) + pnl:NumSlider( "#utilities.physgun_rotation_sensitivity", "physgun_rotation_sensitivity", 0.01, 1, 2 ) + pnl:NumSlider( "#utilities.physgun_wheelspeed", "physgun_wheelspeed", 0, 50, 0 ) end local function PhysgunSVSettings( pnl ) - pnl:AddControl( "Header", { Description = "#utilities.physgunsvsettings" } ) + pnl:Help( "#utilities.physgunsvsettings" ) local ConVarsDefault = { physgun_limited = "0", @@ -200,22 +201,24 @@ local function PhysgunSVSettings( pnl ) physgun_timeToArrive = "0.05", physgun_timeToArriveRagdoll = "0.1" } - pnl:AddControl( "ComboBox", { MenuButton = 1, Folder = "util_physgun_sv", Options = { [ "#preset.default" ] = ConVarsDefault }, CVars = table.GetKeys( ConVarsDefault ) } ) + pnl:ToolPresets( "util_physgun_sv", ConVarsDefault ) - pnl:AddControl( "CheckBox", { Label = "#utilities.physgun_limited", Command = "physgun_limited", Help = true } ) + pnl:CheckBox( "#utilities.physgun_limited", "physgun_limited" ) + pnl:ControlHelp( "#utilities.physgun_limited.help" ) - pnl:AddControl( "Slider", { Label = "#utilities.physgun_maxrange", Type = "Integer", Command = "physgun_maxrange", Min = "128", Max = "8192" } ) - pnl:AddControl( "Slider", { Label = "#utilities.physgun_tpdist", Type = "Integer", Command = "physgun_teleportdistance", Min = "0", Max = "10000" } ) - pnl:AddControl( "Slider", { Label = "#utilities.physgun_maxspeed", Type = "Integer", Command = "physgun_maxspeed", Min = "0", Max = "10000" } ) - pnl:AddControl( "Slider", { Label = "#utilities.physgun_maxangular", Type = "Integer", Command = "physgun_maxangular", Min = "0", Max = "10000" } ) - pnl:AddControl( "Slider", { Label = "#utilities.physgun_timetoarrive", Type = "Float", Command = "physgun_timetoarrive", Min = "0", Max = "2" } ) - pnl:AddControl( "Slider", { Label = "#utilities.physgun_timetoarriveragdoll", Type = "Float", Command = "physgun_timetoarriveragdoll", Min = "0", Max = "2", Help = true } ) + pnl:NumSlider( "#utilities.physgun_maxrange", "physgun_maxrange", 128, 8192, 0 ) + pnl:NumSlider( "#utilities.physgun_tpdist", "physgun_teleportdistance", 0, 10000, 0 ) + pnl:NumSlider( "#utilities.physgun_maxspeed", "physgun_maxspeed", 0, 10000, 0 ) + pnl:NumSlider( "#utilities.physgun_maxangular", "physgun_maxangular", 0, 10000, 0 ) + pnl:NumSlider( "#utilities.physgun_timetoarrive", "physgun_timetoarrive", 0, 2, 2 ) + pnl:NumSlider( "#utilities.physgun_timetoarriveragdoll", "physgun_timetoarriveragdoll", 0, 2, 2 ) + pnl:ControlHelp( "#utilities.physgun_timetoarriveragdoll.help" ) end local function PlayerOptions( pnl ) - pnl:AddControl( "Header", { Description = "#smwidget.playermodel_title" } ) + pnl:Help( "#smwidget.playermodel_title" ) pnl:Button( "#smwidget.playermodel_title", "open_playermodel_selector" ) diff --git a/garrysmod/lua/includes/modules/cleanup.lua b/garrysmod/lua/includes/modules/cleanup.lua index c4bc56aad0..a45e92a43e 100644 --- a/garrysmod/lua/includes/modules/cleanup.lua +++ b/garrysmod/lua/includes/modules/cleanup.lua @@ -215,7 +215,7 @@ else local Panel = controlpanel.Get( "User_Cleanup" ) if ( IsValid( Panel ) ) then Panel:Clear() - Panel:AddControl( "Header", { Description = "#spawnmenu.utilities.cleanup.help" } ) + Panel:Help( "#spawnmenu.utilities.cleanup.help" ) Panel:Button( "#CleanupAll", "gmod_cleanup" ) for key, val in SortedPairs( cleanup_types_s ) do @@ -226,7 +226,7 @@ else local AdminPanel = controlpanel.Get( "Admin_Cleanup" ) if ( IsValid( AdminPanel ) ) then AdminPanel:Clear() - AdminPanel:AddControl( "Header", { Description = "#spawnmenu.utilities.cleanup.help" } ) + AdminPanel:Help( "#spawnmenu.utilities.cleanup.help" ) AdminPanel:Button( "#CleanupAll", "gmod_admin_cleanup" ) for key, val in SortedPairs( cleanup_types_s ) do diff --git a/garrysmod/lua/includes/modules/undo.lua b/garrysmod/lua/includes/modules/undo.lua index 0b0a45b7a0..8f0da71f4f 100644 --- a/garrysmod/lua/includes/modules/undo.lua +++ b/garrysmod/lua/includes/modules/undo.lua @@ -31,7 +31,7 @@ if ( CLIENT ) then if ( !IsValid( Panel ) ) then return end Panel:Clear() - Panel:AddControl( "Header", { Description = "#spawnmenu.utilities.undo.help" } ) + Panel:Help( "#spawnmenu.utilities.undo.help" ) local ComboBox = Panel:ListBox() ComboBox:SetTall( 500 ) diff --git a/garrysmod/lua/postprocess/bloom.lua b/garrysmod/lua/postprocess/bloom.lua index c98e212881..d61e72f246 100644 --- a/garrysmod/lua/postprocess/bloom.lua +++ b/garrysmod/lua/postprocess/bloom.lua @@ -81,11 +81,10 @@ list.Set( "PostProcess", "#bloom_pp", { cpanel = function( CPanel ) - CPanel:AddControl( "Header", { Description = "#bloom_pp.desc" } ) - CPanel:AddControl( "CheckBox", { Label = "#bloom_pp.enable", Command = "pp_bloom" } ) + CPanel:Help( "#bloom_pp.desc" ) + CPanel:CheckBox( "#bloom_pp.enable", "pp_bloom" ) - local params = { Options = {}, CVars = {}, MenuButton = "1", Folder = "bloom" } - params.Options[ "#preset.default" ] = { + local options = { pp_bloom_passes = "4", pp_bloom_darken = "0.65", pp_bloom_multiply = "1.0", @@ -96,17 +95,16 @@ list.Set( "PostProcess", "#bloom_pp", { pp_bloom_color_g = "255", pp_bloom_color_b = "255" } - params.CVars = table.GetKeys( params.Options[ "#preset.default" ] ) - CPanel:AddControl( "ComboBox", params ) + CPanel:ToolPresets( "bloom", options ) - CPanel:AddControl( "Slider", { Label = "#bloom_pp.passes", Command = "pp_bloom_passes", Type = "Integer", Min = "0", Max = "30" } ) - CPanel:AddControl( "Slider", { Label = "#bloom_pp.darken", Command = "pp_bloom_darken", Type = "Float", Min = "0", Max = "1" } ) - CPanel:AddControl( "Slider", { Label = "#bloom_pp.multiply", Command = "pp_bloom_multiply", Type = "Float", Min = "0", Max = "5" } ) - CPanel:AddControl( "Slider", { Label = "#bloom_pp.blurx", Command = "pp_bloom_sizex", Type = "Float", Min = "0", Max = "50" } ) - CPanel:AddControl( "Slider", { Label = "#bloom_pp.blury", Command = "pp_bloom_sizey", Type = "Float", Min = "0", Max = "50" } ) - CPanel:AddControl( "Slider", { Label = "#bloom_pp.multiplier", Command = "pp_bloom_color", Type = "Float", Min = "0", Max = "20" } ) + CPanel:NumSlider( "#bloom_pp.passes", "pp_bloom_passes", 0, 30, 0 ) + CPanel:NumSlider( "#bloom_pp.darken", "pp_bloom_darken", 0, 1 ) + CPanel:NumSlider( "#bloom_pp.multiply", "pp_bloom_multiply", 0, 5 ) + CPanel:NumSlider( "#bloom_pp.blurx", "pp_bloom_sizex", 0, 50 ) + CPanel:NumSlider( "#bloom_pp.blury", "pp_bloom_sizey", 0, 50 ) + CPanel:NumSlider( "#bloom_pp.multiplier", "pp_bloom_color", 0, 20 ) - CPanel:AddControl( "Color", { Label = "#bloom_pp.color", Red = "pp_bloom_color_r", Green = "pp_bloom_color_g", Blue = "pp_bloom_color_b", ShowAlpha = "0", ShowHSV = "1", ShowRGB = "1" } ) + CPanel:ColorPicker( "#bloom_pp.color", "pp_bloom_color_r", "pp_bloom_color_g", "pp_bloom_color_b" ) end diff --git a/garrysmod/lua/postprocess/color_modify.lua b/garrysmod/lua/postprocess/color_modify.lua index 6f3ae2b6ae..7910986d1e 100644 --- a/garrysmod/lua/postprocess/color_modify.lua +++ b/garrysmod/lua/postprocess/color_modify.lua @@ -62,21 +62,30 @@ list.Set( "PostProcess", "#colormod_pp", { cpanel = function( CPanel ) - CPanel:AddControl( "Header", { Description = "#colormod_pp.desc" } ) - CPanel:AddControl( "CheckBox", { Label = "#colormod_pp.enable", Command = "pp_colormod" } ) - - local params = { Options = {}, CVars = {}, MenuButton = "1", Folder = "colormod" } - params.Options[ "#preset.default" ] = { pp_colormod_addr = "0", pp_colormod_addg = "0", pp_colormod_addb = "0", pp_colormod_brightness = "0", pp_colormod_contrast = "1", pp_colormod_color = "1", pp_colormod_mulr = "0", pp_colormod_mulg = "0", pp_colormod_mulb = "0", pp_colormod_inv = "0" } - params.CVars = table.GetKeys( params.Options[ "#preset.default" ] ) - CPanel:AddControl( "ComboBox", params ) - - CPanel:AddControl( "Slider", { Label = "#colormod_pp.brightness", Command = "pp_colormod_brightness", Type = "Float", Min = "-2", Max = "2" } ) - CPanel:AddControl( "Slider", { Label = "#colormod_pp.contrast", Command = "pp_colormod_contrast", Type = "Float", Min = "0", Max = "10" } ) - CPanel:AddControl( "Slider", { Label = "#colormod_pp.color", Command = "pp_colormod_color", Type = "Float", Min = "0", Max = "5" } ) - CPanel:AddControl( "Slider", { Label = "#colormod_pp.invert", Command = "pp_colormod_inv", Type = "Float", Min = "0", Max = "1" } ) - - CPanel:AddControl( "Color", { Label = "#colormod_pp.color_add", Red = "pp_colormod_addr", Green = "pp_colormod_addg", Blue = "pp_colormod_addb", ShowAlpha = "0", ShowHSV = "1", ShowRGB = "1" } ) - CPanel:AddControl( "Color", { Label = "#colormod_pp.color_multiply", Red = "pp_colormod_mulr", Green = "pp_colormod_mulg", Blue = "pp_colormod_mulb", ShowAlpha = "0", ShowHSV = "1", ShowRGB = "1" } ) + CPanel:Help( "#colormod_pp.desc" ) + CPanel:CheckBox( "#colormod_pp.enable", "pp_colormod" ) + + local options = { + pp_colormod_addr = "0", + pp_colormod_addg = "0", + pp_colormod_addb = "0", + pp_colormod_brightness = "0", + pp_colormod_contrast = "1", + pp_colormod_color = "1", + pp_colormod_mulr = "0", + pp_colormod_mulg = "0", + pp_colormod_mulb = "0", + pp_colormod_inv = "0" + } + CPanel:ToolPresets( "colormod", options ) + + CPanel:NumSlider( "#colormod_pp.brightness", "pp_colormod_brightness", -2, 2 ) + CPanel:NumSlider( "#colormod_pp.contrast", "pp_colormod_contrast", 0, 10 ) + CPanel:NumSlider( "#colormod_pp.color", "pp_colormod_color", 0, 5 ) + CPanel:NumSlider( "#colormod_pp.invert", "pp_colormod_inv", 0, 1 ) + + CPanel:ColorPicker( "#colormod_pp.color_add", "pp_colormod_addr", "pp_colormod_addg", "pp_colormod_addb" ) + CPanel:ColorPicker( "#colormod_pp.color_multiply", "pp_colormod_mulr", "pp_colormod_mulg", "pp_colormod_mulb" ) end diff --git a/garrysmod/lua/postprocess/dof.lua b/garrysmod/lua/postprocess/dof.lua index 13a20c2c23..5fc94b61e3 100644 --- a/garrysmod/lua/postprocess/dof.lua +++ b/garrysmod/lua/postprocess/dof.lua @@ -73,16 +73,13 @@ list.Set( "PostProcess", "#dof_pp", { cpanel = function( CPanel ) - CPanel:AddControl( "Header", { Description = "#dof_pp.desc" } ) - CPanel:AddControl( "CheckBox", { Label = "#dof_pp.enable", Command = "pp_dof" } ) + CPanel:Help( "#dof_pp.desc" ) + CPanel:CheckBox( "#dof_pp.enable", "pp_dof" ) - local params = { Options = {}, CVars = {}, MenuButton = "1", Folder = "dof" } - params.Options[ "#preset.default" ] = { pp_dof_initlength = "256", pp_dof_spacing = "512" } - params.CVars = table.GetKeys( params.Options[ "#preset.default" ] ) - CPanel:AddControl( "ComboBox", params ) + CPanel:ToolPresets( "dof", { pp_dof_initlength = "256", pp_dof_spacing = "512" } ) - CPanel:AddControl( "Slider", { Label = "#dof_pp.spacing", Command = "pp_dof_spacing", Type = "Float", Min = "8", Max = "1024" } ) - CPanel:AddControl( "Slider", { Label = "#dof_pp.start_distance", Command = "pp_dof_initlength", Type = "Float", Min = "9", Max = "1024" } ) + CPanel:NumSlider( "#dof_pp.spacing", "pp_dof_spacing", 8, 1024 ) + CPanel:NumSlider( "#dof_pp.start_distance", "pp_dof_initlength", 9, 1024 ) end diff --git a/garrysmod/lua/postprocess/frame_blend.lua b/garrysmod/lua/postprocess/frame_blend.lua index 4580a792b6..9fc9ac6b24 100644 --- a/garrysmod/lua/postprocess/frame_blend.lua +++ b/garrysmod/lua/postprocess/frame_blend.lua @@ -193,18 +193,15 @@ list.Set( "PostProcess", "#frame_blend_pp", { cpanel = function( CPanel ) - CPanel:AddControl( "Header", { Description = "#frame_blend_pp.desc" } ) - CPanel:AddControl( "Header", { Description = "#frame_blend_pp.desc2" } ) + CPanel:Help( "#frame_blend_pp.desc" ) + CPanel:Help( "#frame_blend_pp.desc2" ) - CPanel:AddControl( "CheckBox", { Label = "#frame_blend_pp.enable", Command = "pp_fb" } ) + CPanel:CheckBox( "#frame_blend_pp.enable", "pp_fb" ) - local params = { Options = {}, CVars = {}, MenuButton = "1", Folder = "frame_blend" } - params.Options[ "#preset.default" ] = { pp_fb_frames = "16", pp_fb_shutter = "0.5" } - params.CVars = table.GetKeys( params.Options[ "#preset.default" ] ) - CPanel:AddControl( "ComboBox", params ) + CPanel:ToolPresets( "frame_blend", { pp_fb_frames = "16", pp_fb_shutter = "0.5" } ) - CPanel:AddControl( "Slider", { Label = "#frame_blend_pp.frames", Command = "pp_fb_frames", Type = "Int", Min = "3", Max = "64" } ) - CPanel:AddControl( "Slider", { Label = "#frame_blend_pp.shutter", Command = "pp_fb_shutter", Type = "Float", Min = "0", Max = "0.99" } ) + CPanel:NumSlider( "#frame_blend_pp.frames", "pp_fb_frames", 3, 64, 0 ) + CPanel:NumSlider( "#frame_blend_pp.shutter", "pp_fb_shutter", 0, 0.99 ) end diff --git a/garrysmod/lua/postprocess/motion_blur.lua b/garrysmod/lua/postprocess/motion_blur.lua index bdb5f7e16b..c6eb80ce77 100644 --- a/garrysmod/lua/postprocess/motion_blur.lua +++ b/garrysmod/lua/postprocess/motion_blur.lua @@ -73,17 +73,19 @@ list.Set( "PostProcess", "#motion_blur_pp", { cpanel = function( CPanel ) - CPanel:AddControl( "Header", { Description = "#motion_blur_pp.desc" } ) - CPanel:AddControl( "CheckBox", { Label = "#motion_blur_pp.enable", Command = "pp_motionblur" } ) - - local params = { Options = {}, CVars = {}, MenuButton = "1", Folder = "motionblur" } - params.Options[ "#preset.default" ] = { pp_motionblur_addalpha = "0.2", pp_motionblur_delay = "0.05", pp_motionblur_drawalpha = "0.99" } - params.CVars = table.GetKeys( params.Options[ "#preset.default" ] ) - CPanel:AddControl( "ComboBox", params ) - - CPanel:AddControl( "Slider", { Label = "#motion_blur_pp.add_alpha", Command = "pp_motionblur_addalpha", Type = "Float", Min = "0", Max = "1" } ) - CPanel:AddControl( "Slider", { Label = "#motion_blur_pp.draw_alpha", Command = "pp_motionblur_drawalpha", Type = "Float", Min = "0", Max = "1" } ) - CPanel:AddControl( "Slider", { Label = "#motion_blur_pp.delay", Command = "pp_motionblur_delay", Type = "Float", Min = "0", Max = "1" } ) + CPanel:Help( "#motion_blur_pp.desc" ) + CPanel:CheckBox( "#motion_blur_pp.enable", "pp_motionblur" ) + + local options = { + pp_motionblur_addalpha = "0.2", + pp_motionblur_delay = "0.05", + pp_motionblur_drawalpha = "0.99" + } + CPanel:ToolPresets( "motionblur", options ) + + CPanel:NumSlider( "#motion_blur_pp.add_alpha", "pp_motionblur_addalpha", 0, 1 ) + CPanel:NumSlider( "#motion_blur_pp.draw_alpha", "pp_motionblur_drawalpha", 0, 1 ) + CPanel:NumSlider( "#motion_blur_pp.delay", "pp_motionblur_delay", 0, 1 ) end diff --git a/garrysmod/lua/postprocess/overlay.lua b/garrysmod/lua/postprocess/overlay.lua index 6d0a027762..4c543754de 100644 --- a/garrysmod/lua/postprocess/overlay.lua +++ b/garrysmod/lua/postprocess/overlay.lua @@ -96,14 +96,11 @@ list.Set( "PostProcess", "#overlay_pp", { cpanel = function( CPanel ) - CPanel:AddControl( "Header", { Description = "#overlay_pp.desc" } ) + CPanel:Help( "#overlay_pp.desc" ) - local params = { Options = {}, CVars = {}, MenuButton = "1", Folder = "overlay" } - params.Options[ "#preset.default" ] = { pp_mat_overlay_refractamount = "0.3" } - params.CVars = table.GetKeys( params.Options[ "#preset.default" ] ) - CPanel:AddControl( "ComboBox", params ) + CPanel:ToolPresets( "overlay", { pp_mat_overlay_refractamount = "0.3" } ) - CPanel:AddControl( "Slider", { Label = "#overlay_pp.refract", Command = "pp_mat_overlay_refractamount", Type = "Float", Min = "-1", Max = "1" } ) + CPanel:NumSlider( "#overlay_pp.refract", "pp_mat_overlay_refractamount", -1, 1 ) end diff --git a/garrysmod/lua/postprocess/sharpen.lua b/garrysmod/lua/postprocess/sharpen.lua index 605d739857..3b1f286cd0 100644 --- a/garrysmod/lua/postprocess/sharpen.lua +++ b/garrysmod/lua/postprocess/sharpen.lua @@ -38,16 +38,13 @@ list.Set( "PostProcess", "#sharpen_pp", { cpanel = function( CPanel ) - CPanel:AddControl( "Header", { Description = "#sharpen_pp.desc" } ) - CPanel:AddControl( "CheckBox", { Label = "#sharpen_pp.enable", Command = "pp_sharpen" } ) + CPanel:Help( "#sharpen_pp.desc" ) + CPanel:CheckBox( "#sharpen_pp.enable", "pp_sharpen" ) - local params = { Options = {}, CVars = {}, MenuButton = "1", Folder = "sharpen" } - params.Options[ "#preset.default" ] = { pp_sharpen_distance = "1", pp_sharpen_contrast = "1" } - params.CVars = table.GetKeys( params.Options[ "#preset.default" ] ) - CPanel:AddControl( "ComboBox", params ) + CPanel:ToolPresets( "sharpen", { pp_sharpen_distance = "1", pp_sharpen_contrast = "1" } ) - CPanel:AddControl( "Slider", { Label = "#sharpen_pp.distance", Command = "pp_sharpen_distance", Type = "Float", Min = "-5", Max = "5" } ) - CPanel:AddControl( "Slider", { Label = "#sharpen_pp.contrast", Command = "pp_sharpen_contrast", Type = "Float", Min = "0", Max = "20" } ) + CPanel:NumSlider( "#sharpen_pp.distance", "pp_sharpen_distance", -5, 5 ) + CPanel:NumSlider( "#sharpen_pp.contrast", "pp_sharpen_contrast", 0, 20 ) end diff --git a/garrysmod/lua/postprocess/sobel.lua b/garrysmod/lua/postprocess/sobel.lua index f593b069c8..6218fe94f6 100644 --- a/garrysmod/lua/postprocess/sobel.lua +++ b/garrysmod/lua/postprocess/sobel.lua @@ -34,15 +34,12 @@ list.Set( "PostProcess", "#sobel_pp", { cpanel = function( CPanel ) - CPanel:AddControl( "Header", { Description = "#sobel_pp.desc" } ) - CPanel:AddControl( "CheckBox", { Label = "#sobel_pp.enable", Command = "pp_sobel" } ) + CPanel:Help( "#sobel_pp.desc" ) + CPanel:CheckBox( "#sobel_pp.enable", "pp_sobel" ) - local params = { Options = {}, CVars = {}, MenuButton = "1", Folder = "sobel" } - params.Options[ "#preset.default" ] = { pp_sobel_threshold = "0.11" } - params.CVars = table.GetKeys( params.Options[ "#preset.default" ] ) - CPanel:AddControl( "ComboBox", params ) + CPanel:ToolPresets( "sobel", { pp_sobel_threshold = "0.11" } ) - CPanel:AddControl( "Slider", { Label = "#sobel_pp.threshold", Command = "pp_sobel_threshold", Type = "Float", Min = "0", Max = "1" } ) + CPanel:NumSlider( "#sobel_pp.threshold", "pp_sobel_threshold", 0, 1 ) end diff --git a/garrysmod/lua/postprocess/stereoscopy.lua b/garrysmod/lua/postprocess/stereoscopy.lua index ccee6cac4d..b6a8cbba33 100644 --- a/garrysmod/lua/postprocess/stereoscopy.lua +++ b/garrysmod/lua/postprocess/stereoscopy.lua @@ -58,15 +58,12 @@ list.Set( "PostProcess", "#stereoscopy_pp", { cpanel = function( CPanel ) - CPanel:AddControl( "Header", { Description = "#stereoscopy_pp.desc" } ) - CPanel:AddControl( "CheckBox", { Label = "#stereoscopy_pp.enable", Command = "pp_stereoscopy" } ) + CPanel:Help( "#stereoscopy_pp.desc" ) + CPanel:CheckBox( "#stereoscopy_pp.enable", "pp_stereoscopy" ) - local params = { Options = {}, CVars = {}, MenuButton = "1", Folder = "stereoscopy" } - params.Options[ "#preset.default" ] = { pp_stereoscopy_size = "6" } - params.CVars = table.GetKeys( params.Options[ "#preset.default" ] ) - CPanel:AddControl( "ComboBox", params ) + CPanel:ToolPresets( "stereoscopy", { pp_stereoscopy_size = "6" } ) - CPanel:AddControl( "Slider", { Label = "#stereoscopy_pp.size", Command = "pp_stereoscopy_size", Type = "Float", Min = "0", Max = "10" } ) + CPanel:NumSlider( "#stereoscopy_pp.size", "pp_stereoscopy_size", 0, 10 ) end diff --git a/garrysmod/lua/postprocess/sunbeams.lua b/garrysmod/lua/postprocess/sunbeams.lua index ef80e94607..506f48200a 100644 --- a/garrysmod/lua/postprocess/sunbeams.lua +++ b/garrysmod/lua/postprocess/sunbeams.lua @@ -57,17 +57,20 @@ list.Set( "PostProcess", "#sunbeams_pp", { cpanel = function( CPanel ) - CPanel:AddControl( "Header", { Description = "#sunbeams_pp.desc" } ) - CPanel:AddControl( "CheckBox", { Label = "#sunbeams_pp.enable", Command = "pp_sunbeams" } ) - - local params = { Options = {}, CVars = {}, MenuButton = "1", Folder = "sunbeams" } - params.Options[ "#preset.default" ] = { pp_sunbeams = "0", pp_sunbeams_darken = "0.95", pp_sunbeams_multiply = "1", pp_sunbeams_sunsize = "0.075" } - params.CVars = table.GetKeys( params.Options[ "#preset.default" ] ) - CPanel:AddControl( "ComboBox", params ) - - CPanel:AddControl( "Slider", { Label = "#sunbeams_pp.multiply", Command = "pp_sunbeams_multiply", Type = "Float", Min = "0", Max = "1" } ) - CPanel:AddControl( "Slider", { Label = "#sunbeams_pp.darken", Command = "pp_sunbeams_darken", Type = "Float", Min = "0", Max = "1" } ) - CPanel:AddControl( "Slider", { Label = "#sunbeams_pp.size", Command = "pp_sunbeams_sunsize", Type = "Float", Min = "0.01", Max = "0.25" } ) + CPanel:Help( "#sunbeams_pp.desc" ) + CPanel:CheckBox( "#sunbeams_pp.enable", "pp_sunbeams" ) + + local options = { + pp_sunbeams = "0", + pp_sunbeams_darken = "0.95", + pp_sunbeams_multiply = "1", + pp_sunbeams_sunsize = "0.075" + } + CPanel:ToolPresets( "sunbeams", options ) + + CPanel:NumSlider( "#sunbeams_pp.multiply", "pp_sunbeams_multiply", 0, 1 ) + CPanel:NumSlider( "#sunbeams_pp.darken", "pp_sunbeams_darken", 0, 1 ) + CPanel:NumSlider( "#sunbeams_pp.size", "pp_sunbeams_sunsize", 0.01, 0.25 ) end diff --git a/garrysmod/lua/postprocess/toytown.lua b/garrysmod/lua/postprocess/toytown.lua index 0440299dcc..7a48c52758 100644 --- a/garrysmod/lua/postprocess/toytown.lua +++ b/garrysmod/lua/postprocess/toytown.lua @@ -48,16 +48,13 @@ list.Set( "PostProcess", "#toytown_pp", { cpanel = function( CPanel ) - CPanel:AddControl( "Header", { Description = "#toytown_pp.desc" } ) - CPanel:AddControl( "CheckBox", { Label = "#toytown_pp.enable", Command = "pp_toytown" } ) + CPanel:Help( "#toytown_pp.desc" ) + CPanel:CheckBox( "#toytown_pp.enable", "pp_toytown" ) - local params = { Options = {}, CVars = {}, MenuButton = "1", Folder = "frame_blend" } - params.Options[ "#preset.default" ] = { pp_toytown_passes = "3", pp_toytown_size = "0.5" } - params.CVars = table.GetKeys( params.Options[ "#preset.default" ] ) - CPanel:AddControl( "ComboBox", params ) + CPanel:ToolPresets( "toytown", { pp_toytown_passes = "3", pp_toytown_size = "0.5" } ) - CPanel:AddControl( "Slider", { Label = "#toytown_pp.passes", Command = "pp_toytown_passes", Type = "Int", Min = "1", Max = "100" } ) - CPanel:AddControl( "Slider", { Label = "#toytown_pp.height", Command = "pp_toytown_size", Type = "Float", Min = "0", Max = "1" } ) + CPanel:NumSlider( "#toytown_pp.passes", "pp_toytown_passes", 1, 100, 0 ) + CPanel:NumSlider( "#toytown_pp.height", "pp_toytown_size", 0, 1 ) end