Skip to content

Commit ba6efe4

Browse files
committed
hover preview validity checks
stop the asset browser version of the function if browser is opened outside of pac check in case we change event class (property enums become wrong)
1 parent fcf7662 commit ba6efe4

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

lua/pac3/editor/client/asset_browser.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,8 @@ local function create_material_icon(path, grid_panel)
498498

499499
icon.Think = function()
500500
if not preview_mats:GetBool() then return end
501+
if not IsValid(pace.current_part) then return end
502+
if not pace.IsActive() then return end
501503
icon.hovering = icon:IsHovered()
502504
if icon.hovering then
503505
pace.current_part:SetProperty(pace.model_browser_part_key, mat_path)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ function pace.GoToPart(part)
7272
end
7373

7474
local function install_generic_preview_hover(option, key, preview_value)
75+
if not key then return end
7576
option.Think = function()
7677
option.hovering = option:IsHovered()
7778
if option.hovering then
@@ -722,6 +723,8 @@ function pace.CreateSearchList(property, key, name, add_columns, get_list, get_c
722723

723724
if preview_hovers:GetBool() and not hoverpreview_excluded[property.CurrentKey] then
724725
pnl.Think = function()
726+
if not IsValid(pace.current_part) then return end
727+
if not property or not property.CurrentKey then return end
725728
pnl.hovering = pnl:IsHovered()
726729
if pnl.hovering then
727730
pace.current_part:SetProperty(property.CurrentKey, val)

0 commit comments

Comments
 (0)