Skip to content

Commit ba54007

Browse files
committed
small material fixes
unlit hack option for submaterial. because unlit materials from pac weren't being correctly used. works by forcing pac.Material lookup to replace the default fallback "Fix" material created by the submaterial. reapply the hide flag on material part on initialize. because the fact that hiding the part should prevent auto-applying the material on its parent wasn't being obeyed at weartime
1 parent ba7dc80 commit ba54007

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lua/pac3/core/client/parts/material.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ for shader_name, groups in pairs(shader_params.shaders) do
271271
self.rotation_angle = Angle(0, 0, 0)
272272
timer.Simple(0, function()
273273
self:SetbasetexturetransformAngle(self:GetbasetexturetransformAngle())
274+
self:SetHide(self:GetHide())
274275
end)
275276
end
276277

lua/pac3/core/client/parts/submaterial.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ BUILDER:StartStorableVars()
2323
return tbl
2424
end,
2525
})
26+
BUILDER:GetSet("UnlitMaterialHack", false, {description = "hacky fix if the material comes from a material part with unlitgeneric shader.\nBut it will break raw url textures!"})
2627
BUILDER:GetSet("RootOwner", false, { hide_in_editor = true })
2728
BUILDER:EndStorableVars()
2829

@@ -63,6 +64,7 @@ function PART:UpdateSubMaterialId(id, material)
6364
ent.pac_submaterials = ent.pac_submaterials or {}
6465

6566
local mat = self.Materialm
67+
if self.UnlitMaterialHack then mat = pac.Material(self.Material, self) end
6668

6769
if not material then
6870
if self.Material and self.Material ~= "" and mat and not mat:IsError() then
@@ -79,6 +81,11 @@ function PART:UpdateSubMaterialId(id, material)
7981
end
8082
end
8183

84+
function PART:SetUnlitMaterialHack(b)
85+
self.UnlitMaterialHack = b
86+
self:UpdateSubMaterialId()
87+
end
88+
8289
function PART:PostApplyFixes()
8390
self:UpdateSubMaterialId()
8491
end

0 commit comments

Comments
 (0)