这篇条目有关 Source引擎。如需详情,点击这里。

env_texturetoggle

From Valve Developer Community
< Zh
Revision as of 02:14, 22 July 2025 by POCIX (talk | contribs) (Created page with "{{subst:#if: Translation of 'Env texturetoggle' to '中文' via Template:LanguageBar buttons * * * * * * * * * * * * * * * * * * * * * * * * * * * *...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

{{subst:#if:|||

Important step for replacing wikilinks after you've created this page

After you click 'Edit' do what the image shows. If you can't see editing toolbar you need to enable it in 'Preferences' -> Editing -> checkbox 'Enable the editing toolbar'

Preload - Language Links Replace.jpg
参见:  {{LAuto}}

--- DON'T JUST BLINDLY DELETE THIS PART. DO REPLACE THE LINKS AND CATEGORIES. THE PICTURE SHOWS HOW TO USE IT ! ---

SEARCH FOR: \[\[(?!#|File(?:[ _]talk)?:|Image(?:[ _]talk)?:|Media:|Template(?:[ _]talk)?:|MediaWiki(?:[ _]talk)?:|Talk:|Category[ _]talk:|Project[ _]talk:|Valve[ _]Developer[ _]Community[ _]talk:|Help[ _]talk:|User(?:[ _]talk)?:|c:|commons:|Dictionary:|Google:|GoogleGroups:|IMDB:|M:|Meta:|Metawikipedia:|MW:|SdkBug:|SourceForge:|Steampowered:|W:|Wiki:|WikiBooks:|Wikipedia:|Wikiquote:|Wiktionary:|WP:)(:?(?:Category|Category|Help|Project|Valve[ _]Developer[ _]Community|Special|)(?:[^\|\]]+))(\|?.*?)\]\]

REPLACE WITH: {{subst:LAuto|$1$2}}

}}
Under construction.png
This page is actively undergoing a major edit.
As a courtesy, please do not edit this while this message is displayed.
If this page has not been edited for at least several hours to a few days, please remove this template. This message is intended to help reduce edit conflicts; please remove it between editing sessions to allow others to edit the page.

The person who added this notice will be listed in its edit history should you wish to contact them.

Info content.png
This page is being translated.
You can help by finishing the translation.
If this page cannot be translated for some reason, or is left untranslated for an extended period of time after this notice is posted, the page should be requested to be deleted.
Also, please make sure the article complies with the alternate languages guide.(en)
English (en)中文 (zh)Translate (Translate)
Env texturetoggle.png
C++ 类层级
CTextureToggle
CPointEntity
CBaseEntity
C++ env_texturetoggle.cpp

env_texturetoggle是一个点实体(en),可在所有的 起源 起源 游戏中使用。 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.

PlacementTip.png示例: 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
Note.png注意:If a brush has multiple textures with multiple frames, an output will affect all of these textures.
Cpp.png代码:An entity's texture frame can be set via code using the SetTextureFrameIndex() function.
Icon-Bug.png错误:Identical textures on visible unnamed overlays may also be impacted.  (tested in: 传送门)

Keyvalues

Name (目标名称) <target_source>[ Edit ]
这个名称是其他实体通过 输入/输出(en) 或其他 关键值(en)(如 parentnametarget) 来引用该实体时使用的标识符。
该名称也会显示在 Hammer 编辑器的 2D 视图和 实体报告(en) 中。
参见:  所有实体均可使用的 通用键值、输入与输出(en)
Target Brush(es) (target) <target_destination>
Name of the brush entities or 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 <整数(en)>
Sets target brush's texture frame to the specified index.
Note.png注意:While this parameter takes an integer, it writes to an unsigned char without any bounds checking. Values above 255 or below 0 will Wikipedia icon overflow.

See also