Env texturetoggle: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
 
 Tip:You can fire
Tip:You can fire 
 Example: If we have a brush entity named
Example: If we have a brush entity named 
 Note:If a brush has multiple textures with multiple frames, an output will affect all of these textures.
Note:If a brush has multiple textures with multiple frames, an output will affect all of these textures.
		
	
|  (Added example VMT with the ToggleTexture proxy.) |  (Illustrated possible outputs in a outputs table. Note about when a brush has multiple togglable textures.) | ||
| Line 1: | Line 1: | ||
| {{lang|Env texturetoggle}} | {{lang|Env texturetoggle}} | ||
| [[File:env_texturetoggle.png|left|link=]]{{base point|env_texturetoggle}} It allows you to change the textures on brush entities or overlays. | [[File:env_texturetoggle.png|left|link=]] | ||
| {{base point|env_texturetoggle}} | |||
| It allows you to change the textures on brush entities or overlays. | |||
| {{code class|CTextureToggle|env_texturetoggle.cpp}} | |||
| {{clr}} | |||
| == Entity Description == | |||
| <source lang=php style="float:right; background:none"> | |||
| <source lang=php> | |||
| LightmappedGeneric | LightmappedGeneric | ||
| { | { | ||
| Line 19: | Line 21: | ||
| } | } | ||
| </source> | </source> | ||
| In order for <code>env_texturetoggle</code> to work properly, your [[info_overlay|overlay]] or at least one face of your [[brush]] must use a [[VMT]] material with the <code>[[List Of Material Proxies#Texture manipulation|ToggleTexture</code> 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. | |||
| {{tip|You can fire <code>[[AddOutput]] texframeindex #</code> which will change the texture's frame index without needing this entity.}} | {{tip|You can fire <code>[[AddOutput]] texframeindex #</code> which will change the texture's frame index without needing this entity.}} | ||
| {{example| 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}} | |||
| |+ '''Inputs to toggle textures''' | |||
| | [[File:io11.png]] || OnPressed || toggle || IncrementTextureIndex || || 0 || No | |||
| |- | |||
| | [[File:io11.png]] || OnPressed || toggle || SetTextureIndex || <n> || 0 || No | |||
| |- | |||
| | [[File:io11.png]] || OnPressed || brush || AddOutput || texframeindex <n> || 0 || No | |||
| |} | |||
| {{note|If a brush has multiple textures with multiple frames, an output will affect all of these textures.}} | |||
| ==Keyvalues== | ==Keyvalues== | ||
| {{KV|Target Brush(es)  | {{KV|Target Brush(es)|intn=target|target_destination|Name of the brushes or {{ent|info_overlay}}s. All <code>ToggleTexture</code> materials on all entities (including sprites) matching the targetname will be affected.}} | ||
| {{KV BaseEntity}} | {{KV BaseEntity}} | ||
| ==Inputs== | ==Inputs== | ||
| {{IO|IncrementTextureIndex|Increments target brush's current texture frame by one.}} | {{IO|IncrementTextureIndex|param=void|Increments target brush's current texture frame by one. In other words: switches to the ''next'' texture.}} | ||
| {{IO|SetTextureIndex|param=integer|Sets target brush's texture frame to the specified index.}} | {{IO|SetTextureIndex|param=integer|Sets target brush's texture frame to the specified index.}} | ||
| {{I BaseEntity}} | {{I BaseEntity}} | ||
Revision as of 06:47, 13 December 2021

Template:Base point 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.
 Tip:You can fire
Tip:You can fire AddOutput texframeindex # which will change the texture's frame index without needing this entity. 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. Note:If a brush has multiple textures with multiple frames, an output will affect all of these textures.
Note:If a brush has multiple textures with multiple frames, an output will affect all of these textures.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.



























