Using Model Panel but half of the model gets cut off.
5 replies, posted
[CODE]local function inventory( ply )
local frame = vgui.Create( "DFrame" )
frame:SetPos( 500, 500 )
frame:SetSize( 500, 400 )
frame:SetTitle( "inventory" )
frame:Center()
frame:MakePopup()
local grid = vgui.Create( "DGrid", frame )
grid:SetPos( 10, 50 )
grid:SetSize( 400, 400 )
grid:SetCols( 10 )
grid:SetColWide( 80 )
for k, v in pairs( ply:GetWeapons() ) do
local modelPanel = vgui.Create( "SpawnIcon" )
modelPanel:SetSize( 80, 40 )
modelPanel:SetModel( v:GetWeaponWorldModel() )
grid:AddItem( modelPanel )
end
end
concommand.Add( "TD_inventory", inventory )[/CODE]
I can't figure this out!
Try running [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Panel/RebuildSpawnIcon]Panel:RebuildSpawnIcon[/url] on it- perhaps the camera angles and all that start off a bit stuffed up
Still not working!
[IMG]http://i.imgur.com/rMqh3u0.jpg?1[/IMG]
This might not work, but I find [URL="https://wiki.garrysmod.com/page/Panel/Dock"]docking[/URL] to solve most problems like this. For example, docking would work with this like this:
[CODE]
local grid = vgui.Create( "DGrid", frame )
grid:Dock( FILL ) -- no need to set the size or position anymore
grid:SetCols( 10 )
grid:SetColWide( 80 )
[/CODE]
If that doesn't work, try [URL="https://wiki.garrysmod.com/page/Panel/InvalidateLayout"]invalidating the layout[/URL] of the grid
If I have to guess, you are not setting DGrid:SetRowHeight( 40 )
Thank you @Robotboy655 and @Mpan1 It worked!!
Sorry, you need to Log In to post a reply to this thread.