shader
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
@tool
|
||||
extends Node3D
|
||||
|
||||
const ToonApply = preload("res://shader/toon_apply.gd")
|
||||
|
||||
|
||||
@export var cartoon_material: ShaderMaterial:
|
||||
set(value):
|
||||
cartoon_material = value
|
||||
_apply_materials()
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_apply_materials()
|
||||
|
||||
func _apply_materials():
|
||||
if not is_inside_tree():
|
||||
return
|
||||
|
||||
# 未指定时默认使用 ToonApply
|
||||
var mat: Material = cartoon_material if cartoon_material != null else ToonApply as Material
|
||||
|
||||
for node in find_children("*", "MeshInstance3D", true, false):
|
||||
if node is MeshInstance3D:
|
||||
node.material_override = mat
|
||||
Reference in New Issue
Block a user