GFShaderParameterAction¶
API Reference / Action Queue / 类索引
- 路径:
addons/gf/extensions/action_queue/actions/gf_shader_parameter_action.gd - 模块:
Action Queue - 继承:
GFVisualAction - API:
public - 类别:运行时句柄 (
runtime_handle) - 首次版本:
4.2.0
通用 ShaderMaterial 参数动作。 将 ShaderMaterial 的某个 uniform 参数写入或缓动到目标值。 它只处理参数写入、Tween 宿主和可选材质实例化,不绑定具体 shader、特效或业务语义。
成员概览¶
| 类型 | 名称 | 签名 |
|---|---|---|
| 属性 | target |
var target: Object |
| 属性 | parameter_name |
var parameter_name: StringName = &"" |
| 属性 | target_value |
var target_value: Variant = null |
| 属性 | duration |
var duration: float = 0.2 |
| 属性 | material_property |
var material_property: NodePath = ^"material" |
| 属性 | host_node |
var host_node: Node |
| 属性 | transition_type |
var transition_type: Tween.TransitionType = Tween.TRANS_CUBIC |
| 属性 | ease_type |
var ease_type: Tween.EaseType = Tween.EASE_OUT |
| 属性 | duplicate_material_on_execute |
var duplicate_material_on_execute: bool = false |
| 属性 | restore_initial_value_on_cancel |
var restore_initial_value_on_cancel: bool = false |
| 属性 | restore_initial_value_on_finish |
var restore_initial_value_on_finish: bool = false |
| 方法 | execute |
func execute() -> Variant: |
| 方法 | cancel |
func cancel() -> void: |
| 方法 | pause |
func pause() -> void: |
| 方法 | resume |
func resume() -> void: |
| 方法 | finish |
func finish() -> void: |
| 方法 | get_wait_guard_node |
func get_wait_guard_node() -> Node: |
属性¶
target¶
- API:
public
目标对象。可以直接是 ShaderMaterial,也可以是持有材质属性的对象。
parameter_name¶
- API:
public
Shader uniform 参数名。
target_value¶
- API:
public
要写入的目标参数值。
结构:
target_value: Variant,可被 Tween 插值并写入 parameter_name 的目标值。
duration¶
- API:
public
Tween 持续时间。小于等于 0 时立即写入。
material_property¶
- API:
public
当 target 不是 ShaderMaterial 时,用于读取材质的属性路径。
host_node¶
- API:
public
可选 Tween 宿主节点。target 不是 Node 时,带时长动作必须提供。
transition_type¶
- API:
public
Tween 过渡类型。
ease_type¶
- API:
public
Tween 缓动类型。
duplicate_material_on_execute¶
- API:
public
执行前是否复制材质并写回 material_property,避免修改共享材质资源。
restore_initial_value_on_cancel¶
- API:
public
取消动作时是否恢复执行前捕获的参数值。
restore_initial_value_on_finish¶
- API:
public
动作自然结束或 finish() 时是否恢复执行前捕获的参数值。
方法¶
execute¶
- API:
public
执行 Shader 参数写入或 Tween。
返回:需要等待时返回内部完成 Signal;目标、材质或参数无效时返回 null。
结构:
return: Variant,返回内部完成 Signal 或 null。
cancel¶
- API:
public
取消当前 Tween,并按配置恢复参数值。
pause¶
- API:
public
暂停当前 Tween。
resume¶
- API:
public
恢复当前 Tween。
finish¶
- API:
public
立即完成当前 Tween,并按配置恢复参数值。
get_wait_guard_node¶
- API:
public
获取用于保护等待生命周期的 Tween 宿主节点。
返回:有效宿主节点;无效时返回 null。