基础可涂色物
所有可涂色实体的基类。该类提供了材质自定义功能,公开了常用函数以允许你设置自定义材质参数,包括从磁盘加载纹理。
Base ClassAPI Source
👪Base Class
This is a Base Class, an abstract definition that shares common methods and events with it's child classes. You cannot spawn it, and you cannot call anything on the Base Class name itself. Use any class that inherits it.
Classes that share methods and events from this Base Class: Billboard, Blueprint, Cable, Character, CharacterSimple, Decal, Grenade, InstancedStaticMesh, Melee, Prop, StaticMesh, Text3D, VehicleWheeled, VehicleWater, Weapon.
Classes that share methods and events from this Base Class: Billboard, Blueprint, Cable, Character, CharacterSimple, Decal, Grenade, InstancedStaticMesh, Melee, Prop, StaticMesh, Text3D, VehicleWheeled, VehicleWater, Weapon.
🦠 函数
| Returns | Name | Description | |
|---|---|---|---|
| Color | GetMaterialColorParameter | 从该 Actor 的材质中获取 Color 参数 | |
| float | GetMaterialScalarParameter | 从该 Actor 的材质中获取 Scalar 参数 | |
| string | GetMaterialTextureParameter | 从该 Actor 的材质中获取 Texture 参数 | |
| Vector | GetMaterialVectorParameter | 从该 Actor 的材质中获取 Vector 参数 | |
ResetMaterial | 将指定索引处的材质重置为原始材质 | ||
SetMaterial | 设置该 Actor 指定索引处的材质 | ||
SetMaterialColorParameter | 设置该 Actor 材质中的 Color 参数 | ||
SetMaterialFromCanvas | 将该 Actor 指定索引处的材质设为 Canvas 对象 | ||
SetMaterialFromSceneCapture | 将该 Actor 指定索引处的材质设为 SceneCapture 对象 | ||
SetMaterialFromWebUI | 将该 Actor 指定索引处的材质设为 WebUI 对象 | ||
SetMaterialScalarParameter | 设置该 Actor 材质中的 Scalar 参数 | ||
SetMaterialTextureParameter | 将该 Actor 材质中的纹理参数设为一张图像 | ||
SetMaterialVectorParameter | 设置该 Actor 材质中的 Vector 参数 | ||
SetPhysicalMaterial | 使用新的物理材质覆盖该 Actor 的物理材质 |
Optimal

GetMaterialColorParameter
从该 Actor 的材质中获取 Color 参数
local color = my_paintable:GetMaterialColorParameter(parameter_name, index?, attachable_id?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | parameter_name | Required parameter | 材质参数的名称 |
| integer | index? | -1 | 要获取的材质索引 |
| string | attachable_id? | | 用于获取材质参数的附加物 ID(通过 AddSkeletalMeshAttached 或 AddStaticMeshAttached 设置)。传入空字符串则仅从主网格体中获取 |
Returns
| Type | Description |
|---|---|
| Color | 如果未找到参数则返回 nil |
See also SetMaterialColorParameter.
Optimal

GetMaterialScalarParameter
从该 Actor 的材质中获取 Scalar 参数
local scalar = my_paintable:GetMaterialScalarParameter(parameter_name, index?, attachable_id?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | parameter_name | Required parameter | 材质参数的名称 |
| integer | index? | -1 | 要获取的材质索引 |
| string | attachable_id? | | 用于获取材质参数的附加物 ID(通过 AddSkeletalMeshAttached 或 AddStaticMeshAttached 设置)。传入空字符串则仅从主网格体中获取 |
Returns
| Type | Description |
|---|---|
| float | 如果未找到参数则返回 nil |
See also SetMaterialScalarParameter.
Optimal

GetMaterialTextureParameter
从该 Actor 的材质中获取 Texture 参数
local texture = my_paintable:GetMaterialTextureParameter(parameter_name, index?, attachable_id?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | parameter_name | Required parameter | 材质参数的名称 |
| integer | index? | -1 | 要获取的材质索引 |
| string | attachable_id? | | 用于获取材质参数的附加物 ID(通过 AddSkeletalMeshAttached 或 AddStaticMeshAttached 设置)。传入空字符串则仅从主网格体中获取 |
Returns
| Type | Description |
|---|---|
| string | 如果未找到参数则返回 nil |
See also SetMaterialTextureParameter.
Optimal

GetMaterialVectorParameter
从该 Actor 的材质中获取 Vector 参数
local vector = my_paintable:GetMaterialVectorParameter(parameter_name, index?, attachable_id?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | parameter_name | Required parameter | 材质参数的名称 |
| integer | index? | -1 | 要获取的材质索引 |
| string | attachable_id? | | 用于获取材质参数的附加物 ID(通过 AddSkeletalMeshAttached 或 AddStaticMeshAttached 设置)。传入空字符串则仅从主网格体中获取 |
Returns
| Type | Description |
|---|---|
| Vector | 如果未找到参数则返回 nil |
See also SetMaterialVectorParameter.
Moderate

ResetMaterial
将指定索引处的材质重置为原始材质
my_paintable:ResetMaterial(index?, attachable_id?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| integer | index? | -1 | 要应用的材质索引(-1 表示所有索引) |
| string | attachable_id? | | 用于重置材质的附加物 ID(通过 AddSkeletalMeshAttached 或 AddStaticMeshAttached 设置)。传入空字符串则仅在主网格体上重置 |
Slow

SetMaterial
设置该 Actor 指定索引处的材质
my_paintable:SetMaterial(material_path, index?, attachable_id?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Material Reference | material_path | Required parameter | 要应用的新材质。 注:根据你应用材质的实体,需要在材质设置中将材质配置为“Used with Skeletal Mesh”或“Used with Particles”等,否则可能无法正确应用 |
| integer | index? | -1 | 要应用的材质索引(-1 表示所有索引) |
| string | attachable_id? | | 用于应用材质的附加物 ID(通过 AddSkeletalMeshAttached 或 AddStaticMeshAttached 设置)。传入空字符串则仅在主网格体上设置 |
Moderate

SetMaterialColorParameter
设置该 Actor 材质中的 Color 参数
my_paintable:SetMaterialColorParameter(parameter_name, color, index?, attachable_id?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | parameter_name | Required parameter | 材质参数的名称 |
| Color | color | Required parameter | 要设置的值 |
| integer | index? | -1 | 要应用的材质索引(-1 表示所有索引) |
| string | attachable_id? | | 用于应用材质参数的附加物 ID(通过 AddSkeletalMeshAttached 或 AddStaticMeshAttached 设置)。传入空字符串则仅在主网格体上设置 |
See also GetMaterialColorParameter.
Moderate

SetMaterialFromCanvas
将该 Actor 指定索引处的材质设为 Canvas 对象
my_paintable:SetMaterialFromCanvas(canvas, index?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Canvas | canvas | Required parameter | 要用作材质的 Canvas 对象 |
| integer | index? | -1 | 要应用的材质索引(-1 表示所有索引) |
Moderate

SetMaterialFromSceneCapture
将该 Actor 指定索引处的材质设为 SceneCapture 对象
my_paintable:SetMaterialFromSceneCapture(scene_capture, index?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| SceneCapture | scene_capture | Required parameter | 要用作材质的 SceneCapture 对象 |
| integer | index? | -1 | 要应用的材质索引(-1 表示所有索引) |
Moderate

SetMaterialFromWebUI
将该 Actor 指定索引处的材质设为 WebUI 对象
my_paintable:SetMaterialFromWebUI(webui, index?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| WebUI | webui | Required parameter | 要用作材质的 WebUI 对象 |
| integer | index? | -1 | 要应用的材质索引(-1 表示所有索引) |
Moderate

SetMaterialScalarParameter
设置该 Actor 材质中的 Scalar 参数
my_paintable:SetMaterialScalarParameter(parameter_name, scalar, index?, attachable_id?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | parameter_name | Required parameter | 材质参数的名称 |
| float | scalar | Required parameter | 要设置的值 |
| integer | index? | -1 | 要应用的材质索引(-1 表示所有索引) |
| string | attachable_id? | | 用于应用材质参数的附加物 ID(通过 AddSkeletalMeshAttached 或 AddStaticMeshAttached 设置)。传入空字符串则仅在主网格体上设置 |
See also GetMaterialScalarParameter.
Slow

SetMaterialTextureParameter
将该 Actor 材质中的纹理参数设为一张图像
my_paintable:SetMaterialTextureParameter(parameter_name, texture_path, index?, attachable_id?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | parameter_name | Required parameter | 材质参数的名称 |
| Image Path | texture_path | Required parameter | 纹理的路径,可以是一个 URL 或 base64 字符串 |
| integer | index? | -1 | 要应用的材质索引(-1 表示所有索引) |
| string | attachable_id? | | 用于应用材质参数的附加物 ID(通过 AddSkeletalMeshAttached 或 AddStaticMeshAttached 设置)。传入空字符串则仅在主网格体上设置 |
See also GetMaterialTextureParameter.
Optimal

SetMaterialVectorParameter
设置该 Actor 材质中的 Vector 参数
my_paintable:SetMaterialVectorParameter(parameter_name, vector, index?, attachable_id?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | parameter_name | Required parameter | 材质参数的名称 |
| Vector | vector | Required parameter | 要设置的值 |
| integer | index? | -1 | 要应用的材质索引(-1 表示所有索引) |
| string | attachable_id? | | 用于应用材质参数的附加物 ID(通过 AddSkeletalMeshAttached 或 AddStaticMeshAttached 设置)。传入空字符串则仅在主网格体上设置 |
See also GetMaterialVectorParameter.
Moderate

SetPhysicalMaterial
使用新的物理材质覆盖该 Actor 的物理材质
my_paintable:SetPhysicalMaterial(physical_material_path)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Material Reference | physical_material_path | Required parameter | 要进行覆盖的物理材质 |


