From a30cf97f8a7aa7a8e527efb0b40bd964f9bd2780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojte=CC=8Cch=20Struha=CC=81r?= Date: Tue, 13 May 2025 14:16:39 +0200 Subject: [PATCH] Add a special editor-only preview material --- .../portals/materials/editor-preview-portal-material.tres | 5 +++++ addons/portals/scripts/portal_3d.gd | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 addons/portals/materials/editor-preview-portal-material.tres diff --git a/addons/portals/materials/editor-preview-portal-material.tres b/addons/portals/materials/editor-preview-portal-material.tres new file mode 100644 index 0000000..f516e06 --- /dev/null +++ b/addons/portals/materials/editor-preview-portal-material.tres @@ -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) diff --git a/addons/portals/scripts/portal_3d.gd b/addons/portals/scripts/portal_3d.gd index 9a8ee30..78b5648 100644 --- a/addons/portals/scripts/portal_3d.gd +++ b/addons/portals/scripts/portal_3d.gd @@ -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)