Garry's Mod

Garry's Mod

Material Editor Tool
Thomas 18 Jan, 2017 @ 8:44pm
Clearing materials does not work as intended
Hiya.

Applying a material to an entity, clearing it (via Reload), and waiting for the 30-second 'AdvMatSync' timer to iterate will result in the material being reapplied. Duping it while it's "cleared" will also result in the material being reapplied.

From a quick glance, you aren't clearing the entity's MaterialData table in materials:Set(). You'd also want to clear the duplicator data so that duping a "cleared" entity doesn't just reapply the material again.

There might be more to it, but doing at least this appears to resolve it:

-- line 26 in autorun/sh_mateditor.lua if (texture == nil or texture == "") then if (IsValid(ent)) then ent:SetMaterial(""); ent.MaterialData = nil; -- clear the table so it doesn't get reapplied duplicator.ClearEntityModifier(ent, "MaterialData"); -- clear modifier end; return; end;
Last edited by Thomas; 18 Jan, 2017 @ 8:46pm
< >
Showing 1-11 of 11 comments
Thomas 4 Feb, 2017 @ 8:00pm 
Could you please look into this?
Thomas 24 Apr, 2017 @ 5:31pm 
Still waiting for an update concerning this bug. It's a pretty big one in terms of usability and has a really simple fix as shown above.
IvanTheRexouium 26 Nov, 2019 @ 9:19am 
I thought I had an addon conflicting this entire time...this still happens, even now.
Veeanith 15 Dec, 2019 @ 11:23am 
i found the github release, i might release it as a new addon and fix the issue because its really ♥♥♥♥♥♥♥ annoying when im trying to remove a texture from something i didnt mean to texture
Sanders 23 Jul, 2020 @ 7:21pm 
Originally posted by VCSoldier:
i found the github release, i might release it as a new addon and fix the issue because its really ♥♥♥♥♥♥♥ annoying when im trying to remove a texture from something i didnt mean to texture
still doing it now you plan on doing what you said?
Thomas 23 Jul, 2020 @ 11:50pm 
He did make a fork of the original code, it's at https://github.com/VCSoldier/Material-Editor

I've also got a fork of a fork here https://github.com/IJWTB/material-editor

Both repos have the fix I supplied up above.
Sanders 24 Jul, 2020 @ 1:22pm 
Originally posted by IJWTB Thomas:
He did make a fork of the original code, it's at https://github.com/VCSoldier/Material-Editor

I've also got a fork of a fork here https://github.com/IJWTB/material-editor

Both repos have the fix I supplied up above.
:steamhappy:
itskenji82 27 Sep, 2021 @ 7:51pm 
j o e
Veeanith 9 Nov, 2021 @ 7:33am 
Sorry to necro, but if anyone is still encountering this issue, i heavily recommend you just install ADV MAT 2 which has more features, and doesnt have this removal issue. (it is still a bit buggy on servers) https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2414556240
ToppyPoppy 25 Jul, 2023 @ 9:59am 
Yeah this is exactly what i'm dealing with
< >
Showing 1-11 of 11 comments
Per page: 1530 50