feat: update

This commit is contained in:
2026-04-28 01:22:38 +08:00
parent b76dd2e737
commit 1585b91509
9 changed files with 529 additions and 229 deletions
+26 -2
View File
@@ -242,7 +242,18 @@ func _apply_skin_data(character_root: Node3D, skin: Dictionary) -> void:
if mode == "overlay":
mn.material_overlay = mat
else:
mn.set_surface_override_material(0, mat)
# PRESERVE OUTLINE SHADER: Check if existing material has a next_pass (outline shader)
var existing_mat = mn.get_surface_override_material(0)
var preserved_next_pass = null
if existing_mat and existing_mat.next_pass:
preserved_next_pass = existing_mat.next_pass
# Apply the skin material
var skin_mat = mat.duplicate() if mat else null
if skin_mat and preserved_next_pass:
skin_mat.next_pass = preserved_next_pass
mn.set_surface_override_material(0, skin_mat)
func _clear_slot(char_node: Node3D, slot: Dictionary) -> void:
@@ -254,7 +265,20 @@ func _clear_slot(char_node: Node3D, slot: Dictionary) -> void:
if mode == "overlay":
mn.material_overlay = null
else:
mn.set_surface_override_material(0, null)
# PRESERVE OUTLINE SHADER: When clearing, check if we need to restore outline
var existing_mat = mn.get_surface_override_material(0)
if existing_mat and existing_mat.next_pass:
# Has outline - restore base material with outline preserved
var base_mat = mn.get_active_material(0)
if base_mat:
var restored_mat = base_mat.duplicate()
restored_mat.next_pass = existing_mat.next_pass
mn.set_surface_override_material(0, restored_mat)
else:
# No base material, just clear but this shouldn't happen normally
mn.set_surface_override_material(0, null)
else:
mn.set_surface_override_material(0, null)
func _get_char_node(character_root: Node3D, char_name: String) -> Node3D: