28 lines
837 B
GDScript
28 lines
837 B
GDScript
extends MeshInstance3D
|
|
|
|
func change_color_suit(new_color: Color):
|
|
# Ensure the material is unique so it doesn't change all instances
|
|
var material = get_active_material(0).duplicate()
|
|
set_surface_override_material(0, material)
|
|
|
|
# Change the albedo (base) color
|
|
material.albedo_color = new_color
|
|
|
|
|
|
func change_color_highlight(new_color: Color):
|
|
# Ensure the material is unique so it doesn't change all instances
|
|
var material = get_active_material(0).duplicate()
|
|
for surface in range(4, get_surface_override_material_count()):
|
|
set_surface_override_material(surface, material)
|
|
|
|
# Change the albedo (base) color
|
|
material.albedo_color = new_color
|
|
|
|
|
|
func _on_color_picker_color_changed(color: Color) -> void:
|
|
change_color_suit(color)
|
|
|
|
|
|
func _on_color_picker_2_color_changed(color: Color) -> void:
|
|
change_color_highlight(color)
|