Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lua/autorun/prop2mesh.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ if SERVER then
resource.AddWorkshop("2458909924")

CreateConVar("prop2mesh_disable_allowed", 0, {FCVAR_NOTIFY, FCVAR_ARCHIVE}, "prevents prop2mesh data from networking")
CreateConVar("prop2mesh_disabled_transparency_enabled", 1, {FCVAR_NOTIFY, FCVAR_ARCHIVE}, "enables transparency support for disabled prop2mesh entities")

AddCSLuaFile("prop2mesh/cl_meshlab.lua")
AddCSLuaFile("prop2mesh/cl_modelfixer.lua")
Expand Down
14 changes: 13 additions & 1 deletion lua/entities/sent_prop2mesh/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,23 @@ local function getComplex(crc, uniqueID)
end

local vec = Vector()

CreateClientConVar("prop2mesh_disabled_transparency", 0.05, true, false, "Disable transparency on prop2mesh entities (forces all to be opaque)", 0, 1)

local serverAllowsTransparency = GetConVar("prop2mesh_disabled_transparency_enabled"):GetBool()

local debugwhite = CreateMaterial("p2mdebugwhite", "UnlitGeneric", {
["$basetexture"] = "color/white",
["$vertexcolor"] = 1
["$vertexcolor"] = 1,
["$alpha"] = serverAllowsTransparency and GetConVar("prop2mesh_disabled_transparency"):GetFloat() or 1
})

if serverAllowsTransparency then
cvars.AddChangeCallback("prop2mesh_disabled_transparency", function(cvar, old, new)
debugwhite:SetFloat("$alpha", math.Clamp(tonumber(new) or 0, 0, 1))
end, "p2mdebugwhitealpha")
end

local renderOverride
do
local Vec_Dot = vecMeta.Dot
Expand Down
7 changes: 7 additions & 0 deletions lua/weapons/gmod_tool/stools/prop2mesh.lua
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,13 @@ local function BuildPanel_AddonSettings(self)
cbox.Label:SetTextColor(value and Color(255, 0, 0) or nil)
end

local slider = pnl:NumSlider("Transparency:", "prop2mesh_disabled_transparency", 0, 1, 2)

local serverAllowsTransparency = GetConVar("prop2mesh_disabled_transparency_enabled"):GetBool()
if not serverAllowsTransparency then
slider:SetEnabled( false )
end

local cbox = pnl:CheckBox("Disable everything", "prop2mesh_disable")
cbox:SetTooltip("Note: unless you rejoin, this will not apply to already generated meshes")
cbox.OnChange = function(_, value)
Expand Down