summaryrefslogtreecommitdiffstats
path: root/editor/editor_properties.cpp
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2023-12-08 16:58:39 +0100
committerYuri Sizov <yuris@humnom.net>2023-12-08 16:58:39 +0100
commit7fbaefd244a35a71ca09b3b8124dc02dabff6330 (patch)
tree30ecafd2ccab71ec492915d0ef417d238cce96eb /editor/editor_properties.cpp
parent7798ea773b03e600aa066a0da97042c3ac0eb9f6 (diff)
parent429f24e6656cd5752e7d9964c4749b1d65cfd45b (diff)
downloadredot-engine-7fbaefd244a35a71ca09b3b8124dc02dabff6330.tar.gz
Merge pull request #85723 from ilyabelow/84609-visual-shader-viewport-texture-error
Add a specific error when creating a ViewportTexture in a Texture2D node
Diffstat (limited to 'editor/editor_properties.cpp')
-rw-r--r--editor/editor_properties.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 6d27829e2e..f891bfbff7 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -56,6 +56,7 @@
#include "scene/resources/font.h"
#include "scene/resources/mesh.h"
#include "scene/resources/packed_scene.h"
+#include "scene/resources/visual_shader_nodes.h"
///////////////////// Nil /////////////////////////
@@ -3204,6 +3205,13 @@ void EditorPropertyResource::_resource_changed(const Ref<Resource> &p_resource)
Ref<ViewportTexture> vpt = p_resource;
if (vpt.is_valid()) {
r = Object::cast_to<Resource>(get_edited_object());
+ if (Object::cast_to<VisualShaderNodeTexture>(r)) {
+ EditorNode::get_singleton()->show_warning(TTR("Can't create a ViewportTexture in a Texture2D node because the texture will not be bound to a scene.\nUse a Texture2DParameter node instead and set the texture in the \"Shader Parameters\" tab."));
+ emit_changed(get_edited_property(), Ref<Resource>());
+ update_property();
+ return;
+ }
+
if (r && r->get_path().is_resource_file()) {
EditorNode::get_singleton()->show_warning(TTR("Can't create a ViewportTexture on resources saved as a file.\nResource needs to belong to a scene."));
emit_changed(get_edited_property(), Ref<Resource>());