• DModelPanel DIconLayout clips out.
    2 replies, posted
[img]http://i.imgur.com/8dp2q1P.jpg[/img] I don't really know how to fix it. I used this link but I never used it before so I can't figure out how is working. 1.[url]http://www.facepunch.com/showthread.php?t=1294025&p=41636220[/url] 2.[url]https://www.facepunch.com/showthread.php?t=1293629[/url] 3.[url]https://facepunch.com/showthread.php?t=1285791[/url] [lua] // My Icon local objlist = vgui.Create("DScrollPanel",bg) objlist:SetSize(bg:GetWide(),bg:GetTall()-35) objlist:SetPos(10,30) objlist:GetVBar().Paint = function() return true end objlist:GetVBar().btnUp.Paint = function() return true end objlist:GetVBar().btnDown.Paint = function() return true end objlist:GetVBar().btnGrip.Paint = function() return true end function objlist:OnScrollbarAppear() return true end objects = vgui.Create("DIconLayout",objlist) objects:SetSize(objlist:GetWide(),objlist:GetTall()) objects:SetPos(0,0) objects:SetSpaceY(5) objects:SetSpaceX(5) objlist:AddItem(objects) objcreate = objects:Add("DPanel") objcreate:SetSize(62,62) icon = vgui.Create("DModelPanel",objcreate) icon:SetSize(62,62) icon:SetFOV(20) function icon:LayoutEntity( Entity ) return end icon:SetAnimated(false) icon:SetCamPos( Vector( 50, 80, 20 )) icon:SetLookAt( Vector( 7, 0, 8 )) icon:SetModel(cmodel) [/lua]
You need to scissor the drawing of the model panels - change the paint code.
[lua]local modelFix = {} modelFix[1] = icon -- this is a table of all DModelPanels that need fixing (for your case, icon) -- then a loop that applies the patch to everything in the table above, instead of having to retype the whole function for every DModelPanel for k, v in pairs( modelFix ) do local oldpaint = v.Paint function v:Paint() local pnl = self:GetParent():GetParent() local x2, y2 = pnl:LocalToScreen( 0, 0 ) local w2, h2 = pnl:GetSize() render.SetScissorRect( x2, y2, x2 + w2, y2 + h2, true ) oldpaint( self ) render.SetScissorRect( 0, 0, 0, 0, false ) end end[/lua]
Sorry, you need to Log In to post a reply to this thread.