build update
This commit is contained in:
@@ -1,29 +1,37 @@
|
||||
extends Node3D
|
||||
|
||||
var meshInstance: MeshInstance3D
|
||||
var default_materials
|
||||
|
||||
#var build_material
|
||||
@onready var build_material = load("res://Shaders/build_transparent.gdshader")
|
||||
@export var meshInstance: MeshInstance3D
|
||||
@export var greenMeshInstance: MeshInstance3D
|
||||
@export var RedMeshInstance: MeshInstance3D
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
default_materials = Array()
|
||||
meshInstance = $DoubleBeds
|
||||
default_materials.resize(meshInstance.get_surface_override_material_count())
|
||||
set_default_materials()
|
||||
Global.preview_created.connect(_on_preview_create)
|
||||
print(build_material)
|
||||
|
||||
func set_default_materials():
|
||||
for i in meshInstance.get_surface_override_material_count():
|
||||
default_materials[i] = meshInstance.get_surface_override_material(i)
|
||||
Global.object_placed.connect(_on_object_placed)
|
||||
|
||||
|
||||
func set_green_color():
|
||||
for i in meshInstance.get_surface_override_material_count():
|
||||
meshInstance.set_surface_override_material(i, Global.build_material)
|
||||
hide_mainMesh()
|
||||
greenMeshInstance.visible = true
|
||||
|
||||
func set_red_color():
|
||||
hide_mainMesh()
|
||||
RedMeshInstance.visible = true
|
||||
|
||||
func hide_mainMesh():
|
||||
meshInstance.visible = false
|
||||
|
||||
func show_mainMesh():
|
||||
meshInstance.visible = true
|
||||
greenMeshInstance.visible = false
|
||||
RedMeshInstance.visible = false
|
||||
|
||||
func _on_preview_create():
|
||||
set_green_color()
|
||||
|
||||
|
||||
func _on_object_placed():
|
||||
show_mainMesh()
|
||||
greenMeshInstance.queue_free()
|
||||
RedMeshInstance.queue_free()
|
||||
|
||||
Reference in New Issue
Block a user