Permalink
Browse files

Populate spawnmenu tabs as soon as possible

Removes the initial hang when opening the spawnmenu, technically moves
it to the loading screen time where it actually belongs.
  • Loading branch information...
1 parent 7fab76f commit 3e0d413c7328078f6276615eec57885b7a3efa72 @robotboy655 robotboy655 committed May 8, 2016
@@ -1,3 +1,4 @@
+
AddCSLuaFile()
local default_animations = { "idle_all_01", "menu_walk" }
@@ -132,7 +133,7 @@ list.Set( "DesktopWindows", "PlayerEditor", {
local function RebuildBodygroupTab()
bdcontrolspanel:Clear()
-
+
bgtab.Tab:SetVisible( false )
local nskins = mdl.Entity:SkinCount() - 1
@@ -147,11 +148,11 @@ list.Set( "DesktopWindows", "PlayerEditor", {
skins:SetValue( GetConVarNumber( "cl_playerskin" ) )
skins.type = "skin"
skins.OnValueChanged = UpdateBodyGroups
-
+
bdcontrolspanel:AddItem( skins )
mdl.Entity:SetSkin( GetConVarNumber( "cl_playerskin" ) )
-
+
bgtab.Tab:SetVisible( true )
end
@@ -170,11 +171,11 @@ list.Set( "DesktopWindows", "PlayerEditor", {
bgroup:SetMax( mdl.Entity:GetBodygroupCount( k ) - 1 )
bgroup:SetValue( groups[ k + 1 ] or 0 )
bgroup.OnValueChanged = UpdateBodyGroups
-
+
bdcontrolspanel:AddItem( bgroup )
-
+
mdl.Entity:SetBodygroup( k, groups[ k + 1 ] or 0 )
-
+
bgtab.Tab:SetVisible( true )
end
end
@@ -234,7 +235,7 @@ list.Set( "DesktopWindows", "PlayerEditor", {
if ( self.Pressed ) then
local mx, my = gui.MousePos()
self.Angles = self.Angles - Angle( 0, ( self.PressX or mx ) - mx, 0 )
-
+
self.PressX, self.PressY = gui.MousePos()
end
@@ -31,18 +31,14 @@ function PANEL:Populate()
self:AddSheet( k, pnl, v.Icon, nil, nil, v.Tooltip )
- --
- -- On paint, remove the paint function and populate the panel
- --
- pnl.Paint = function()
-
- pnl.Paint = nil
-
+ -- Populate the panel
+ -- We have to add the timer to make sure g_Spawnmenu is available
+ -- in case some addon needs it ready when populating the creation tab.
+ timer.Simple( 0, function()
local childpnl = v.Function()
childpnl:SetParent( pnl )
childpnl:Dock( FILL )
-
- end
+ end )
end

0 comments on commit 3e0d413

Please sign in to comment.