Add a special editor-only preview material

This commit is contained in:
Vojtěch Struhár 2025-05-13 14:16:39 +02:00
parent 4961d18cad
commit a30cf97f8a
2 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,5 @@
[gd_resource type="StandardMaterial3D" format=3 uid="uid://dcfkcyddxkglf"]
[resource]
cull_mode = 2
albedo_color = Color(0.849621, 0.849621, 0.849621, 1)

View File

@ -310,7 +310,8 @@ var _watchlist_teleportables: Dictionary[int, TeleportableMeta] = {}
#region Editor Configuration Stuff
const _PORTAL_SHADER = preload("uid://bhdb2skdxehes")
const _PORTAL_SHADER: Shader = preload("uid://bhdb2skdxehes")
const _EDITOR_PREVIEW_PORTAL_MATERIAL: StandardMaterial3D = preload("uid://dcfkcyddxkglf")
# _ready(), but only in editor.
func _editor_ready() -> void:
@ -569,6 +570,9 @@ func _setup_mesh() -> void:
mi.mesh = p
mi.scale.z = _portal_thickness
# Editor-only material. Will be replaced when game starts.
mi.material_override = _EDITOR_PREVIEW_PORTAL_MATERIAL
add_child_in_editor(self, mi)
_portal_mesh_path = get_path_to(mi)