Permalink
Browse files

Replaced ValidPanel with IsValid

Replaced all instances of ValidPanel with IsValid, since ValidPanel is
deprecated.
  • Loading branch information...
1 parent c93ba9e commit 2299062c2f7165782b210901dfb4e35965c96408 @robotboy655 robotboy655 committed Sep 28, 2014
@@ -298,7 +298,7 @@ hook.Add( "GUIMousePressed", "SpawnMenuOpenGUIMousePressed", SpawnMenuOpenGUIMou
-----------------------------------------------------------]]
local function SpawnMenuOpenGUIMouseReleased()
- if ( !ValidPanel( g_SpawnMenu ) ) then return end
+ if ( !IsValid( g_SpawnMenu ) ) then return end
if ( !g_SpawnMenu:IsVisible() ) then return end
g_SpawnMenu:Close()
@@ -694,15 +694,15 @@ if CLIENT then
end
if should_open then
- if ValidPanel(printspanel) then
+ if IsValid(printspanel) then
printspanel:Remove()
end
local tester = GetTester(LocalPlayer())
printspanel = ShowPrintsPopup(item_prints, tester)
else
- if ValidPanel(printspanel) then
+ if IsValid(printspanel) then
printspanel:UpdatePrints(item_prints)
end
end
@@ -733,7 +733,7 @@ if CLIENT then
net.Receive("TTT_ScanResult", RecvScan)
function SWEP:ClosePrintsPanel()
- if ValidPanel(printspanel) then
+ if IsValid(printspanel) then
printspanel:Close()
end
end
@@ -157,7 +157,7 @@ local function TraitorMenuPopup()
end
-- Close any existing traitor menu
- if eqframe and ValidPanel(eqframe) then eqframe:Close() end
+ if eqframe and IsValid(eqframe) then eqframe:Close() end
local credits = ply:GetCredits()
local can_order = credits > 0
@@ -426,7 +426,7 @@ end
concommand.Add("ttt_cl_traitorpopup", TraitorMenuPopup)
local function ForceCloseTraitorMenu(ply, cmd, args)
- if ValidPanel(eqframe) then
+ if IsValid(eqframe) then
eqframe:Close()
end
end
@@ -221,7 +221,7 @@ vgui.Register("TTTTips", PANEL, "Panel")
local tips_panel = nil
function TIPS.Create()
- if ValidPanel(tips_panel) then
+ if IsValid(tips_panel) then
tips_panel:Remove()
tips_panel = nil
end
@@ -419,7 +419,7 @@ g_VoicePanelList = nil
-- 255 at 100
-- 5 at 5000
local function VoiceNotifyThink(pnl)
- if not (ValidPanel(pnl) and LocalPlayer() and IsValid(pnl.ply)) then return end
+ if not (IsValid(pnl) and LocalPlayer() and IsValid(pnl.ply)) then return end
if not (GetGlobalBool("ttt_locational_voice", false) and (not pnl.ply:IsSpec()) and (pnl.ply != LocalPlayer())) then return end
if LocalPlayer():IsActiveTraitor() && pnl.ply:IsActiveTraitor() then return end
@@ -186,7 +186,7 @@ function PANEL:PerformLayout()
-- can't just use pairs (undefined ordering) or ipairs (group 2 and 3 might not exist)
for i=1, GROUP_COUNT do
local group = self.ply_groups[i]
- if ValidPanel(group) then
+ if IsValid(group) then
if group:HasRows() then
group:SetVisible(true)
group:SetPos(0, gy)
@@ -282,7 +282,7 @@ function PANEL:UpdateScoreboard( force )
end
for k, group in pairs(self.ply_groups) do
- if ValidPanel(group) then
+ if IsValid(group) then
group:SetVisible( group:HasRows() )
group:UpdatePlayerData()
end
@@ -4,8 +4,8 @@
include("sb_row.lua")
local function CompareScore(pa, pb)
- if not ValidPanel(pa) then return false end
- if not ValidPanel(pb) then return true end
+ if not IsValid(pa) then return false end
+ if not IsValid(pb) then return true end
local a = pa:GetPlayer()
local b = pb:GetPlayer()
@@ -127,7 +127,7 @@ function PANEL:UpdatePlayerData()
local to_remove = {}
for k,v in pairs(self.rows) do
-- Player still belongs in this group?
- if ValidPanel(v) and IsValid(v:GetPlayer()) and ScoreGroup(v:GetPlayer()) == self.group then
+ if IsValid(v) and IsValid(v:GetPlayer()) and ScoreGroup(v:GetPlayer()) == self.group then
v:UpdatePlayerData()
else
-- can't remove now, will break pairs
@@ -139,7 +139,7 @@ function PANEL:UpdatePlayerData()
for k,ply in pairs(to_remove) do
local pnl = self.rows[ply]
- if ValidPanel(pnl) then
+ if IsValid(pnl) then
pnl:Remove()
end
@@ -53,7 +53,7 @@ function PANEL:SetText(txt)
-- but it does.
local pnl = self.Panel
timer.Simple(0, function()
- if ValidPanel(pnl) then
+ if IsValid(pnl) then
pnl:UpdateScrollState()
end
end)
@@ -109,7 +109,7 @@ end
-- Add a panel to this icon. Most recent addition will be the top layer.
function PANEL:AddLayer(pnl)
- if not ValidPanel(pnl) then return end
+ if not IsValid(pnl) then return end
pnl:SetParent(self)
@@ -1,19 +1,19 @@
PANEL = {}
-local Distance = 256
+local Distance = 256
local BlurSize = 0.5
local Passes = 12
local Steps = 24
local Shape = 0.5
local SuperDOFWindow = nil
-local Status = "Preview"
+local Status = "Preview"
-local sldDistance = nil
-local lblDistance = nil
-local lblSize = nil
-local FocusGrabber = false
+local sldDistance = nil
+local lblDistance = nil
+local lblSize = nil
+local FocusGrabber = false
local ScreenshotTimer = 0
function PANEL:Init()
@@ -48,7 +48,7 @@ function PANEL:Init()
self.Distance:Dock( TOP )
self.Distance:SetDark( true )
self.Distance:SetToolTip( "#superdof_pp.distance.tooltip" )
-
+
Panel:SetPos( 10, 30 )
Panel:SetSize( 300, 90 )
Panel:DockPadding( 8, 8, 8, 8 )
@@ -101,7 +101,7 @@ function PANEL:Init()
Panel:Dock( RIGHT )
local Panel = vgui.Create( "DPanel", self )
-
+
self.Render = vgui.Create( "DButton", Panel )
self.Render:SetText( "#superdof_pp.render" )
function self.Render:DoClick() Status = "Render" end
@@ -130,9 +130,9 @@ function PANEL:Init()
Panel:DockMargin( 0, 4, 0, 0 )
Panel:SetTall( 28 );
Panel:MoveToBack()
-
+
self:SetSize( 600, 220 )
-
+
end
function PANEL:ChangeDistanceTo( dist )
@@ -144,7 +144,7 @@ end
local paneltypeSuperDOF = vgui.RegisterTable( PANEL, "DFrame" )
local texFSB = render.GetSuperFPTex()
local matFSB = Material( "pp/motionblur" )
-local matFB = Material( "pp/fb" )
+local matFB = Material( "pp/fb" )
function RenderDoF( vOrigin, vAngle, vFocus, fAngleSize, radial_steps, passes, bSpin, inView, ViewFOV )
@@ -180,7 +180,7 @@ function RenderDoF( vOrigin, vAngle, vFocus, fAngleSize, radial_steps, passes, b
render.Clear( 0, 0, 0, 255, true, true )
matFB:SetFloat( "$alpha", 1 )
render.SetMaterial( matFB )
- render.DrawScreenQuad()
+ render.DrawScreenQuad()
local Radials = ( math.pi * 2 ) / radial_steps
@@ -192,8 +192,8 @@ function RenderDoF( vOrigin, vAngle, vFocus, fAngleSize, radial_steps, passes, b
local VA = vAngle * 1 -- hack - this makes it copy the angles instead of the reference
local VRot = vAngle * 1
-- Rotate around the focus point
- VA:RotateAroundAxis( VRot:Right(), math.sin( i + ( mul ) ) * fAngleSize * mul * ( Shape ) * 2 )
- VA:RotateAroundAxis( VRot:Up(), math.cos( i + ( mul ) ) * fAngleSize * mul * ( 1 - Shape ) * 2 )
+ VA:RotateAroundAxis( VRot:Right(), math.sin( i + ( mul ) ) * fAngleSize * mul * ( Shape ) * 2 )
+ VA:RotateAroundAxis( VRot:Up(), math.cos( i + ( mul ) ) * fAngleSize * mul * ( 1 - Shape ) * 2 )
view.origin = vFocus - VA:Forward() * fDistance
view.angles = VA
@@ -206,8 +206,8 @@ function RenderDoF( vOrigin, vAngle, vFocus, fAngleSize, radial_steps, passes, b
-- Copy it to our floating point buffer at a reduced alpha
render.SetRenderTarget( texFSB )
- local alpha = ( Radials / ( math.pi * 2 ) ) -- Divide alpha by number of radials
- alpha = alpha * ( 1 - mul ) -- Reduce alpha the further away from center we are
+ local alpha = ( Radials / ( math.pi * 2 ) ) -- Divide alpha by number of radials
+ alpha = alpha * ( 1 - mul ) -- Reduce alpha the further away from center we are
matFB:SetFloat( "$alpha", alpha )
render.SetMaterial( matFB )
@@ -248,7 +248,7 @@ function RenderDoF( vOrigin, vAngle, vFocus, fAngleSize, radial_steps, passes, b
-- Render our result buffer to the screen
matFSB:SetFloat( "$alpha", 1 )
matFSB:SetTexture( "$basetexture", texFSB )
-
+
render.SetMaterial( matFSB )
render.DrawScreenQuad()
@@ -306,7 +306,7 @@ end
local function RenderSceneHook( ViewOrigin, ViewAngles, ViewFOV )
- if ( !ValidPanel( SuperDOFWindow ) ) then return end
+ if ( !IsValid( SuperDOFWindow ) ) then return end
-- Don't render it when the console is up
if ( FrameTime() == 0 ) then return end
@@ -321,7 +321,7 @@ local function OpenWindow()
Status = "Preview"
- if ( ValidPanel( SuperDOFWindow ) ) then
+ if ( IsValid( SuperDOFWindow ) ) then
SuperDOFWindow:Remove()
end
@@ -341,7 +341,7 @@ concommand.Add( "pp_superdof", OpenWindow )
-----------------------------------------------------------]]
local function MouseDown( mouse )
- if ( !ValidPanel( SuperDOFWindow ) ) then return end
+ if ( !IsValid( SuperDOFWindow ) ) then return end
vgui.GetWorldPanel():MouseCapture( true )
FocusGrabber = true
@@ -354,7 +354,7 @@ hook.Add( "GUIMousePressed", "SuperDOFMouseDown", MouseDown )
-----------------------------------------------------------]]
local function MouseUp( mouse )
- if ( !ValidPanel( SuperDOFWindow ) ) then return end
+ if ( !IsValid( SuperDOFWindow ) ) then return end
vgui.GetWorldPanel():MouseCapture( false )
FocusGrabber = false
@@ -376,6 +376,6 @@ list.Set( "PostProcess", "#superdof_pp", {
--
hook.Add( "PreventScreenClicks", "SuperDOFPreventClicks", function()
- if ( ValidPanel( SuperDOFWindow ) ) then return true end
+ if ( IsValid( SuperDOFWindow ) ) then return true end
end )

0 comments on commit 2299062

Please sign in to comment.