Env texturetoggle: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
Tip:You can fire 
)(not in 
)
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.
		
	
Thunder4ik (talk | contribs) m (→top: Unicodifying, replaced: {{language subpage → {{langsp)  | 
				 ("addoutput texframeindex <n>" doesn't seem to work in portal2. Probably since csgo?)  | 
				||
| Line 2: | Line 2: | ||
{{lang|Env texturetoggle}}[[File:env_texturetoggle.png|left|link=]]  | {{lang|Env texturetoggle}}[[File:env_texturetoggle.png|left|link=]]  | ||
{{CD|CTextureToggle|file1=env_texturetoggle.cpp}}  | {{CD|CTextureToggle|file1=env_texturetoggle.cpp}}  | ||
{{this is a|name=env_texturetoggle  | {{this is a|point entity|name=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.  | ||
{{clr}}  | {{clr}}  | ||
| Line 24: | Line 24: | ||
Such a VMT file could look like the one on the right.  | 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. {{csgo|in}}{{portal2|not}}}}  | ||
{{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.}}  | {{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.}}  | ||
Revision as of 20:53, 28 January 2024

| CTextureToggle | 
env_texturetoggle  is a   point entity  available in all 
 Source games.
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.
AddOutput texframeindex # which will change the texture's frame index without needing this entity. (in 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
- Name (targetname) <string>[ Edit ]
 - The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. 
parentnameortarget).
Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities 
- 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.