Garry's Mod Wiki

matproxy.Add

matproxy.Add( table MatProxyData )

Description

Adds a material proxy.

Arguments

1 table MatProxyData
The information about the proxy. See Structures/MatProxyData

Example

Adds PlayerColor proxy. Example taken from lua/matproxy/player_color.lua.

matproxy.Add({ name = "PlayerColor", init = function( self, mat, values ) -- Store the name of the variable we want to set self.ResultTo = values.resultvar end, bind = function( self, mat, ent ) -- If the target ent has a function called GetPlayerColor then use that -- The function SHOULD return a Vector with the chosen player's colour. -- In sandbox this function is created as a network function, -- in player_sandbox.lua in SetupDataTables if ( ent.GetPlayerColor ) then mat:SetVector( self.ResultTo, ent:GetPlayerColor() ) end end })
Output: Adds PlayerColor proxy.

Example

Material proxy values are stored like this:

  • In the .vmt:
Proxies { PlayerColor { resultVar $color2 myVariable $color } }
values = { resultvar = "$color2" myvariable = "$color" }

Page Links


Special Pages


Wikis

?

Render Time: 47ms

DB GetPage 4
Generate Html 10
SaveChanges (1) 10
Render Body 0
Render Sidebar 19