Env texturetoggle: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (swapped template)
(-added class hierarchy, cleanup)
Line 1: Line 1:
__NOTOC__
{{lang|Env texturetoggle}}
{{lang|Env texturetoggle}}
[[File:env_texturetoggle.png|left|link=]]
[[File:env_texturetoggle.png|left|link=]]
{{CD|CTextureToggle|file1=env_texturetoggle.cpp}}
{{entity|type=e0|env_texturetoggle}}
{{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.
Line 40: Line 42:


==Keyvalues==
==Keyvalues==
{{KV Targetname}}
{{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|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}}


==Inputs==
==Inputs==
{{IO|IncrementTextureIndex|param=void|Increments target brush's current texture frame by one. In other words: switches to the ''next'' texture.}}
{{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}}
==Outputs==
{{O BaseEntity|l4d=1}}


==See Also==
==See Also==
*{{ent|material_modify_control}}
*{{ent|material_modify_control}}

Revision as of 05:01, 20 June 2023

English (en)中文 (zh)Translate (Translate)
Env texturetoggle.png
C++ Class hierarchy
CTextureToggle
CPointEntity
CBaseEntity
C++ env_texturetoggle.cpp

Template:Entity It allows you to change the textures on brush entities or overlays.

C++ In code, it is represented by theCTextureToggleclass, defined in theenv_texturetoggle.cppfile.

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.

Template:ModernTip

PlacementTip.pngExample: 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.
  My Output Target Entity Target Input Parameter Delay Only Once
Inputs to toggle textures
Io11.png OnPressed toggle IncrementTextureIndex 0 No
Io11.png OnPressed toggle SetTextureIndex <n> 0 No
Io11.png OnPressed brush AddOutput texframeindex <n> 0 No

Template:ModernNote

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
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 ToggleTexture materials 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 <integerRedirectInput/integer>
Sets target brush's texture frame to the specified index.

See Also