Env texturetoggle: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
 
 Example: If we have a brush entity named
Example: If we have a brush entity named 
		
	
|  (Illustrated possible outputs in a outputs table. Note about when a brush has multiple togglable textures.) | m (swapped template) | ||
| Line 1: | Line 1: | ||
| {{lang|Env texturetoggle}} | {{lang|Env texturetoggle}} | ||
| [[File:env_texturetoggle.png|left|link=]] | [[File:env_texturetoggle.png|left|link=]] | ||
| {{ | {{entity|type=e0|env_texturetoggle}} | ||
| It allows you to change the textures on brush entities or overlays. | It allows you to change the textures on brush entities or overlays. | ||
| {{code class|CTextureToggle|env_texturetoggle.cpp}} | {{code class|CTextureToggle|env_texturetoggle.cpp}} | ||
| Line 25: | Line 25: | ||
| Such a VMT file could look like the one on the right. | Such a VMT file could look like the one on the right. | ||
| {{ | {{ModernTip|You can fire <code>[[AddOutput]] texframeindex #</code> which will change the texture's frame index without needing this entity.}} | ||
| {{ | {{ModernExample| If we have a brush entity named <code>brush</code> and an env_texturetoggle named <code>toggle</code> whose target brush is <code>brush</code>, then we can use any of the following outputs on a [[func_button]] to toggle the texture for the <code>brush</code>. The second and third output have the same effect.}} | ||
| :{| {{OutputsTable}} | :{| {{OutputsTable}} | ||
| |+ '''Inputs to toggle textures''' | |+ '''Inputs to toggle textures''' | ||
| Line 37: | Line 37: | ||
| |} | |} | ||
| {{ | {{ModernNote|If a brush has multiple textures with multiple frames, an output will affect all of these textures.}} | ||
| ==Keyvalues== | ==Keyvalues== | ||
Revision as of 03:23, 20 April 2023

Template:Entity It allows you to change the textures on brush entities or overlays.
Entity Description
LightmappedGeneric
{
  $basetexture "path/to/a/VTF/file/with/multiple/frames"
  Proxies
  {
    ToggleTexture
    {
      ToggleTextureVar         $basetexture
      ToggleTextureFrameNumVar $frame
    }
  }
}
In order for env_texturetoggle to work properly, your overlay or at least one face of your brush must use a VMT material with the ToggleTexture proxy defined and pointing to an animated VTF file with at least two frames.
Such a VMT file could look like the one on the right.
 Example: If we have a brush entity named
Example: If we have a brush entity named brush and an env_texturetoggle named toggle whose target brush is brush, then we can use any of the following outputs on a func_button to toggle the texture for the brush. The second and third output have the same effect.Keyvalues
- Target Brush(es) (target) <targetname>
- Name of the brushes or info_overlays. All ToggleTexturematerials on all entities (including sprites) matching the targetname will be affected.
Inputs
- IncrementTextureIndex <void>
- Increments target brush's current texture frame by one. In other words: switches to the next texture.
- SetTextureIndex <integer>
- Sets target brush's texture frame to the specified index.



























