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

Zh/Env texturetoggle: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
(Created page with "{{subst:#if: Translation of 'Env texturetoggle' to '中文' via Template:LanguageBar buttons * * * * * * * * * * * * * * * * * * * * * * * * * * * *...")
 
No edit summary
Line 1: Line 1:
{{subst:#if:|||{{LAuto/t}}


--- 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}}
}}{{wip}}{{translating}}
__NOTOC__
__NOTOC__
{{LanguageBar}}
{{LanguageBar}}
Line 15: Line 5:
{{CD|CTextureToggle|file1=env_texturetoggle.cpp}}
{{CD|CTextureToggle|file1=env_texturetoggle.cpp}}
{{This is a|point entity|name=env_texturetoggle}}
{{This is a|point entity|name=env_texturetoggle}}
It allows you to change the textures on brush entities or overlays.
它可以让你更改笔刷实体(brush entities)或覆盖层(overlays)的纹理。
{{clr}}
{{clr}}
== Entity Description ==
== 实体描述 ==
<syntaxhighlight lang=php style="float:right; background:none">
<syntaxhighlight lang=php style="float:right; background:none">
LightmappedGeneric
LightmappedGeneric
Line 32: Line 22:
}
}
</syntaxhighlight>
</syntaxhighlight>
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#Entity integration|ToggleTexture</code> proxy]] defined and pointing to an animated [[VTF]] file with at least two frames.
要使 <code>env_texturetoggle</code> 正常工作,你的 {{L|info_overlay|覆盖层(overlay)}} 或至少一个 {{L|brush|笔刷(brush)}} 面必须使用带有 <code>{{L|List Of Material Proxies#Entity integration|切换纹理</code>代理}} 的 {{L|VMT}} 材质,并且该代理需指向一个至少包含两帧的动画的 {{L|VTF}} 文件。


Such a VMT file could look like the one on the right.
这样的 VMT 文件可以类似于右侧所示的示例。


{{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.}}
{{示例| 假设我们有一个名为 <code>brush</code> 的笔刷实体(brush entity)和一个名为 <code>toggle</code> 的 env_texturetoggle(其目标笔刷(target brush)设为 <code>brush</code>),那么可以在 [[func_button]] 上使用以下任意一种输出(Output)来切换该 <code>笔刷(brush)</code> 的纹理。其中,第二和第三种输出的效果相同。}}
:{| {{OutputsTable}}
:{| {{OutputsTable}}
|+ '''Inputs to toggle textures'''
|+ '''用于切换纹理的输入'''
| [[File:io11.png]] || OnPressed || toggle || IncrementTextureIndex || || 0 || No
| [[File:io11.png]] || OnPressed || toggle || IncrementTextureIndex || || 0 || No
|-
|-
Line 44: Line 34:
|}
|}


{{note|If a brush has multiple textures with multiple frames, an output will affect all of these textures.}}
{{提示|如果一个笔刷(brush)包含多个含多帧的纹理,那么执行输出(output)时将会同时影响所有这些纹理。}}
{{codenote|An entity's texture frame can be set via code using the {{codelink|SetTextureFrameIndex()}} function.}}
{{代码注释|可以通过代码使用 {{L|codelink|SetTextureFrameIndex()}} 函数来设置实体的纹理帧索引。}}
{{bug|tested={{portal}}|Identical textures on visible unnamed overlays may also be impacted.}}
{{bug|tested={{L|portal}}|可见的未命名覆盖层(overlay)上相同的纹理也可能受到影响。}}


== Keyvalues ==
== 键值 ==
{{KV Targetname}}
{{KV Targetname}}
{{KV|Target Brush(es)|intn=target|target_destination|Name of the [[brush entity|brush entities]] or [[overlay]]s. All <code>ToggleTexture</code> materials on all entities (including sprites) matching the targetname will be affected.}}
{{KV|Target Brush(es)|intn=目标|target_destination| {{L|brush entity|笔刷实体(brush entity)}} 或 {{L|overlay|覆盖层(overlays)}}的名称。所有所有匹配该目标名称(targetname)的实体(包括精灵/sprites)上的 <code>ToggleTexture</code> 材质都将受到影响。}}


== Inputs ==
== 输入 ==
{{I|IncrementTextureIndex|param=void|Increments target brush's current texture frame by one. In other words: switches to the ''next'' texture.}}
{{I|IncrementTextureIndex|param=无效|将目标笔刷的当前纹理帧索引值递增 1(即切换至''下一帧''纹理)。}}
{{I|SetTextureIndex|param=integer|Sets target brush's texture frame to the specified index.}}
{{I|SetTextureIndex|param=整数|将目标笔刷(brush)的纹理帧索引设置为指定数值。}}
:{{note|While this parameter takes an integer, it writes to an [[byte|unsigned char]] without any bounds checking. Values above 255 or below 0 will {{w|Integer overflow|overflow}}.}}
:{{note|该参数虽然接收整型数值,但会直接写入无符号字符型 {{L|byte|无符号字符型}} 变量且不做边界检查。若数值超过255或小于0,将发生 {{w|Integer overflow|溢出}}}}


== See also ==
== 另请参阅 ==
* {{ent|material_modify_control}}
* {{L|material_modify_control|材料修改控制}}

Revision as of 04:29, 22 July 2025


English (en)中文 (zh)Translate (Translate)
Env texturetoggle.png
C++ 类层级
CTextureToggle
CPointEntity
CBaseEntity
C++ env_texturetoggle.cpp

env_texturetoggle是一个点实体(en),可在所有的 起源 起源 游戏中使用。 它可以让你更改笔刷实体(brush entities)或覆盖层(overlays)的纹理。

实体描述

LightmappedGeneric
{
  $basetexture "path/to/a/VTF/file/with/multiple/frames"
  Proxies
  {
    ToggleTexture
    {
      ToggleTextureVar         $basetexture
      ToggleTextureFrameNumVar $frame
    }
  }
}

要使 env_texturetoggle 正常工作,你的 覆盖层(overlay)(en) 或至少一个 笔刷(brush)(en) 面必须使用带有 切换纹理代理(en)VMT(en) 材质,并且该代理需指向一个至少包含两帧的动画的 VTF(en) 文件。

这样的 VMT 文件可以类似于右侧所示的示例。

Template:示例

  My Output Target Entity Target Input Parameter Delay Only Once
用于切换纹理的输入
Io11.png OnPressed toggle IncrementTextureIndex 0 No
Io11.png OnPressed toggle SetTextureIndex <n> 0 No
Tip.png提示:如果一个笔刷(brush)包含多个含多帧的纹理,那么执行输出(output)时将会同时影响所有这些纹理。

Template:代码注释

Icon-Bug.png错误:可见的未命名覆盖层(overlay)上相同的纹理也可能受到影响。  (tested in: portal(en))

键值

Name (目标名称) <target_source>[ Edit ]
这个名称是其他实体通过 输入/输出(en) 或其他 关键值(en)(如 parentnametarget) 来引用该实体时使用的标识符。
该名称也会显示在 Hammer 编辑器的 2D 视图和 实体报告(en) 中。
参见:  所有实体均可使用的 通用键值、输入与输出(en)

Target Brush(es) (目标) <target_destination>
笔刷实体(brush entity)(en)覆盖层(overlays)(en)的名称。所有所有匹配该目标名称(targetname)的实体(包括精灵/sprites)上的 ToggleTexture 材质都将受到影响。

输入

IncrementTextureIndex <无效(en)>
将目标笔刷的当前纹理帧索引值递增 1(即切换至下一帧纹理)。
SetTextureIndex <整数(en)>
将目标笔刷(brush)的纹理帧索引设置为指定数值。
Note.png注意:该参数虽然接收整型数值,但会直接写入无符号字符型 无符号字符型(en) 变量且不做边界检查。若数值超过255或小于0,将发生 Wikipedia icon 溢出

另请参阅