Garry's Mod

Garry's Mod

Proxy Color Tool
Showing 1-10 of 11 entries
< 1  2 >
Update: Apr 4, 2021 @ 7:00am

Easter Rainbow Update:
Added a seventh proxy.
Proper wiki on GitHub.
Clientside entities can now be colored with proxy colors. example[github.com]

There are now enough colors for a rainbow!

Update: Aug 8, 2020 @ 7:59am

Added 2 functions:
ProxyColor.RandFromTable( ent, ctable, spawnonly )
ProxyColor.Random( ent, spawnonly )

SIMFPHYS EXAMPLE
------------------------------
OnSpawn = function(ent)
if (ProxyColor) then
local CarCols = {}
CarCols[1] = {Color(100, 100, 100)}
CarCols[2] = {Color(90, 87, 82)}
CarCols[3] = {Color(45, 58, 53)}
CarCols[4] = {Color(109, 122, 136)}
CarCols[5] = {Color(111, 103, 95)}
CarCols[6] = {Color(95, 10, 21)}
CarCols[7] = {Color(122, 117, 96)}
ProxyColor.RandFromTable(ent,CarCols,true)
end
end,
------------------------------

The "spawnonly" bool will only apply the colors if there is no preexisting proxycolors. I use it on Simfphys vehicles so when they are duplicated the proxycolors are not overwritten when it is pasted.
Probably better to think of it as a one-time only random color I guess.

Update: Jul 26, 2020 @ 9:29pm

https://github.com/NotAKidOnSteam/Proxy-Color-Tool/issues/2

Should have fixed duplications and setting proxy colors on spawn from the server from failing to network to the client properly.

Not the best fix in the world. It is working and should not cause issues but I can't test every possibility.

Update: Jul 25, 2020 @ 7:14pm

Restructured most of the tool, should be much more reliable.

There are still a few issues that I don't know how to fix which all happen with Multiplayer, but I will update the addon once I know how to fix them.

Outstanding Issues:
If setting proxycolors on an entity that just spawned, the client must know that the entity exists before the proxycolors are networked. Otherwise the client will not apply the colors as it doesnt know of the entity yet.
If a player joins late they will not see proxy colors.

I have *somewhat* attempted to workaround this with a 1 second delay for duplications on servers that have proxycolors stored, but it is not foolproof.


I am thinking maybe a table should be stored on the server with every (existing) entity that has proxycolors applied, then sending it to the client to apply those colors to once they join.
For setting proxycolors as an entity spawns, I am honestly not sure. SetColor works, but I dont know how. Ive looked into ways to check if the entity exists on the client before networking, but I have found nothing. Not sure how to implement it so I guess one of the most important things in a color tool will be missing from my addon...

Update: May 29, 2020 @ 5:26am

hotfix cause i accidently deleted the entire tool last update

Update: May 29, 2020 @ 4:05am

Worked on some stuff for ent:SetProxyColor(ColorTable) to work better with entitys that just spawned.

On servers you will need to apply the proxy colors in a 0.1 second timer. I still cant figure out why.

You require a name in your vmt file or the tool will not show that color slot at all anymore.

Update: May 23, 2020 @ 7:02am

Fixed the tool, now it is less garbage. Hopfully now people will adopt it.

local ColorTable = {Color(255,255,255),Color(23,54,65)}
ent:SetProxyColor( ColorTable )
^^ can have up to 6 colors in the color table

ent:GetProxyColor()
returns the proxy color table on both server & client if needed

Can use ProxyColor to check if the tool is installed to add support but not be needed

Duplicator works again.

Right click to copy color works again.


EXAMPLE CODE FROM MY GTAV DUKES


if ( ProxyColor ) then -- randomly color all 6 color channels on spawn
local ColorTable = {}

for i=1,6 do
local cs_r = math.random(0,255)
local cs_g = math.random(0,255)
local cs_b = math.random(0,255)
table.insert(ColorTable, i, Color(cs_r,cs_g,cs_b) )
end

ent:SetProxyColor( ColorTable )
end

Update: Apr 24, 2020 @ 1:35am

fixed the fcolor thing

sorry

If multiple materials on a model use the same proxy, the one above the other (check with submaterial tool) will take priority with both name and fcolor.
Keep that in mind when setting them!

Update: Apr 22, 2020 @ 1:29am

Added command to use in a vmt file to set a default spawn color.

fcolor ".12 .12 .12"

just like that. dont use {} or [] in the quotes

Also a sound plays now when you first click a model.
Its there to alert you that you selected a model and the tool panel has been rebuilt.


I am putting a lot of time into learning more about vmt files and proxies to improve this tool as much as I can. If you want to suggest something or know more about vmts and proxies them please contact me.

Update: Apr 20, 2020 @ 2:53pm

Since this hit front page so quick I wanted to make sure I had something presentable uploaded.

Here is 2-3 days STRAIGHT worth of work.

I am currently running on the fumes from nonstop energy drinks and doritos.
(meaning i am way way tired)
Please be lax with bullying me if I broke something :<

Removed the old VehColor and VehColor2 proxies
Generalized them to keep people from thinking this tool is just for vehicles.

Supported Proxies:
ColorSlot1
ColorSlot2
ColorSlot3
ColorSlot4
ColorSlot5
ColorSlot6

You must add this to your material for it to work with the tool.

Proxies
{
ColorSlot(1-6){
name "Can be anything, required for tool"
resultVar $color2 // leave this be unless you know what its doing .-.
}
}

BEWARE, if you have a colorslot proxy defined in more than one material that can be found on a single model, the name argument may be overwritten. It will be fine if you have the names the same across both materials.
If you set the spawn color as well it applies to any material on the model with that color slot. Use them wisely. (i will look into making them for each material & each colorslot proxy)

BUGS:
Duping in multiplayer doesnt work I think
Tool cant copy color at the moment with Right Click
Context menu doesnt set the proxy color atm

NOTHING IS FINAL OTHER THAN:
The proxies ColorSlot1-6
Setting the name in that proxy with name "This Is A Name"
Most likely the toolguns layout.



I have disabled the context menu option for now as I am integrating a new model previewer into it. (thx sakarias88 & sgm) <3

yeah i know this kinda grew from justttt a color tool but shh i want it to be good

Sorry if something isnt working. I am rewritting this for a fifth time once I get everything completely working. Dont question my dev style.
BTW this code is probably really really really messy right now. As stated above, I am pretty much dead from exhaustion.
(I spent 4-5 hours looking for a bug that was a typo... im really tired)