Skip to content

Commit 5ad9bec

Browse files
committed
fix previous commit
the parsing error was because these strings for the arrows and property key text at 2146 & 2148 weren't being assigned to the variable, free strings breaking syntax
1 parent e7de05b commit 5ad9bec

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

lua/pac3/editor/client/panels/extra_properties.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,9 @@ do -- script proxy
12561256
local old = pnl.Paint
12571257
pnl.Paint = function(...)
12581258
if not self:IsValid() then pnl:Remove() return end
1259-
1259+
local x, y = self:LocalToScreen()
1260+
y = math.Clamp(y,0,ScrH() - self:GetTall())
1261+
pnl:SetPos(x + 5 + inset_x, y)
12601262
surface.SetFont(pnl:GetFont())
12611263
local w = surface.GetTextSize(pnl:GetText()) + 6
12621264

lua/pac3/editor/client/panels/properties.lua

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,11 @@ do -- list
839839
if prop.udata and prop.udata.editor_panel then
840840
T = prop.udata.editor_panel or T
841841
elseif pace.PanelExists("properties_" .. prop.key:lower()) then
842-
T = prop.key:lower()
842+
--is it code bloat to fix weird edge cases like bodygroups on specific models???
843+
--idk but it's more egregious to allow errors just because of what bodygroups the model has
844+
if prop.key:lower() ~= "container" then
845+
T = prop.key:lower()
846+
end
843847
elseif not pace.PanelExists("properties_" .. T) then
844848
T = "string"
845849
end
@@ -2072,6 +2076,7 @@ do -- base editable
20722076
local hookID = tostring({})
20732077
local textEntry = pnl
20742078
local delay = os.clock() + 0.1
2079+
local inset_x = self:GetTextInset()
20752080

20762081
pac.AddHook('Think', hookID, function(code)
20772082
if not IsValid(self) or not IsValid(textEntry) then return pac.RemoveHook('Think', hookID) end
@@ -2090,7 +2095,6 @@ do -- base editable
20902095
--pnl:SetPos(x+3,y-4)
20912096
--pnl:Dock(FILL)
20922097
local x, y = self:LocalToScreen()
2093-
local inset_x = self:GetTextInset()
20942098
pnl:SetPos(x+5 + inset_x, y)
20952099
pnl:SetSize(self:GetSize())
20962100
pnl:SetWide(ScrW())
@@ -2109,6 +2113,11 @@ do -- base editable
21092113
local old = pnl.Paint
21102114
pnl.Paint = function(...)
21112115
if not self:IsValid() then pnl:Remove() return end
2116+
local x, y = self:LocalToScreen()
2117+
local _,prop_y = pace.properties:LocalToScreen(0,0)
2118+
y = math.Clamp(y,prop_y,ScrH() - self:GetTall())
2119+
2120+
pnl:SetPos(x + 5 + inset_x, y)
21122121

21132122
surface.SetFont(pnl:GetFont())
21142123
local w = surface.GetTextSize(pnl:GetText()) + 6
@@ -2122,6 +2131,34 @@ do -- base editable
21222131
old(...)
21232132
end
21242133

2134+
local skincolor = self:GetSkin().Colours.Category.Line.Button
2135+
local col = Color(skincolor.r,skincolor.g,skincolor.b, 255)
2136+
2137+
--draw a rectangle with property key's name and arrows to show where the line is scrolling out of bounds
2138+
pac.AddHook('PostRenderVGUI', hookID .. "2", function(code)
2139+
if not IsValid(self) or not IsValid(pnl) then pac.RemoveHook('Think', hookID .. "2") return end
2140+
local _,prop_y = pace.properties:LocalToScreen(0,0)
2141+
local x, y = self:LocalToScreen()
2142+
local overflow = y < prop_y or y > ScrH() - self:GetTall()
2143+
if overflow then
2144+
local str = ""
2145+
if y > ScrH() then
2146+
str = "↓↓ " .. " " .. self.CurrentKey .. " " .. " ↓↓"
2147+
else
2148+
str = "↑↑ " .. " " .. self.CurrentKey .. " " .. " ↑↑"
2149+
end
2150+
y = math.Clamp(y,prop_y,ScrH() - self:GetTall())
2151+
surface.SetFont(pnl:GetFont())
2152+
local w2 = surface.GetTextSize(str)
2153+
2154+
surface.SetDrawColor(col)
2155+
surface.DrawRect(x - w2, y, w2, pnl:GetTall())
2156+
surface.SetTextColor(self:GetSkin().Colours.Category.Line.Text)
2157+
surface.SetTextPos(x - w2, y)
2158+
surface.DrawText(str)
2159+
end
2160+
end)
2161+
21252162
pace.BusyWithProperties = pnl
21262163
end
21272164

@@ -2197,6 +2234,13 @@ do -- vector
21972234
local left = pace.CreatePanel("properties_number", self)
21982235
local middle = pace.CreatePanel("properties_number", self)
21992236
local right = pace.CreatePanel("properties_number", self)
2237+
--a hack so that the scrolling out-of-bounds indicator rectangle with arrows has the key
2238+
timer.Simple(0, function()
2239+
if not IsValid(left) then return end
2240+
left.CurrentKey = self.CurrentKey
2241+
middle.CurrentKey = self.CurrentKey
2242+
right.CurrentKey = self.CurrentKey
2243+
end)
22002244

22012245
left.PopulateContextMenu = function(_, menu) self:PopulateContextMenu(menu) end
22022246
middle.PopulateContextMenu = function(_, menu) self:PopulateContextMenu(menu) end

0 commit comments

Comments
 (0)