SetTextureFrameIndex()

From Valve Developer Community
(Redirected from SetTextureFrameIndex)
Jump to navigation Jump to search

SetTextureFrameIndex() is a C++ function available for the CBaseEntity class in all Source Source games. It takes one input, an integer. It sets the texture frame of all materials with the ToggleTexture to the specified integer.

Note.pngNote:This function writes the input integer to an unsigned char without any bounds checking. As such, values above 255 or below 0 will Wikipedia icon overflow. If this is an issue, clamp the input before calling this function.

In most games, only env_texturetoggle uses this function. Half-Life: Source Half-Life: Source uses this function to indicate whether health stations and HEV chargers have juice left or not.

Todo: Example code (perhaps by re-implementing func_wall's texture toggling from GoldSrc?)
Confirm:Does this work on models and sprites?