summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Brucker <hendrik.brucker@mail.de>2024-04-18 02:39:29 +0200
committerHendrik Brucker <hendrik.brucker@mail.de>2024-04-18 02:39:29 +0200
commit735c45dc8ec91b8ba8410cd40ef06746184fe157 (patch)
tree9b9dc860583037f877a8a20dfda047bb864ab5bb
parent4b7776e31bf91bd3d710277b505c196b38d8fff3 (diff)
downloadredot-engine-735c45dc8ec91b8ba8410cd40ef06746184fe157.tar.gz
[Compatibility] Add stub for VisualShaderNodeComment
-rw-r--r--doc/classes/VisualShaderNodeComment.xml16
-rw-r--r--misc/extension_api_validation/4.2-stable.expected6
-rw-r--r--scene/register_scene_types.cpp3
-rw-r--r--scene/resources/visual_shader.cpp21
-rw-r--r--scene/resources/visual_shader.h22
5 files changed, 64 insertions, 4 deletions
diff --git a/doc/classes/VisualShaderNodeComment.xml b/doc/classes/VisualShaderNodeComment.xml
new file mode 100644
index 0000000000..28496a715a
--- /dev/null
+++ b/doc/classes/VisualShaderNodeComment.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualShaderNodeComment" inherits="VisualShaderNodeFrame" deprecated="This class has no function anymore and only exists for compatibility." xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
+ <brief_description>
+ Only exists for compatibility. Use [VisualShaderNodeFrame] as a replacement.
+ </brief_description>
+ <description>
+ This node was replaced by [VisualShaderNodeFrame] and only exists to preserve compatibility. In the [VisualShader] editor it behaves exactly like [VisualShaderNodeFrame].
+ </description>
+ <tutorials>
+ </tutorials>
+ <members>
+ <member name="description" type="String" setter="set_description" getter="get_description" default="&quot;&quot;">
+ This property only exists to preserve data authored in earlier versions of Godot. It has currently no function.
+ </member>
+ </members>
+</class>
diff --git a/misc/extension_api_validation/4.2-stable.expected b/misc/extension_api_validation/4.2-stable.expected
index 6471c5a142..ea97a2150e 100644
--- a/misc/extension_api_validation/4.2-stable.expected
+++ b/misc/extension_api_validation/4.2-stable.expected
@@ -256,9 +256,9 @@ Compatibility methods registered.
GH-88014
--------
-Validate extension JSON: API was removed: classes/VisualShaderNodeComment
-
-Removed VisualShaderNodeComment, which is replaced by VisualShaderNodeFrame.
+Validate extension JSON: API was removed: classes/VisualShaderNodeComment/methods/get_title
+Validate extension JSON: API was removed: classes/VisualShaderNodeComment/methods/set_title
+Validate extension JSON: API was removed: classes/VisualShaderNodeComment/properties/title
GH-87888
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 1c8833494d..d13f338444 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -657,6 +657,9 @@ void register_scene_types() {
GDREGISTER_ABSTRACT_CLASS(VisualShaderNodeConstant);
GDREGISTER_ABSTRACT_CLASS(VisualShaderNodeVectorBase);
GDREGISTER_CLASS(VisualShaderNodeFrame);
+#ifndef DISABLE_DEPRECATED
+ GDREGISTER_CLASS(VisualShaderNodeComment); // Deprecated, just for compatibility.
+#endif
GDREGISTER_CLASS(VisualShaderNodeFloatConstant);
GDREGISTER_CLASS(VisualShaderNodeIntConstant);
GDREGISTER_CLASS(VisualShaderNodeUIntConstant);
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 9ac899ad78..7e80d0be3c 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -4206,7 +4206,7 @@ VisualShaderNodeResizableBase::VisualShaderNodeResizableBase() {
set_allow_v_resize(true);
}
-////////////// Comment
+////////////// Frame
String VisualShaderNodeFrame::get_caption() const {
return title;
@@ -4323,6 +4323,25 @@ void VisualShaderNodeFrame::_bind_methods() {
VisualShaderNodeFrame::VisualShaderNodeFrame() {
}
+////////////// Comment (Deprecated)
+
+#ifndef DISABLE_DEPRECATED
+void VisualShaderNodeComment::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_description", "description"), &VisualShaderNodeComment::set_description);
+ ClassDB::bind_method(D_METHOD("get_description"), &VisualShaderNodeComment::get_description);
+
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "description"), "set_description", "get_description");
+}
+
+void VisualShaderNodeComment::set_description(const String &p_description) {
+ description = p_description;
+}
+
+String VisualShaderNodeComment::get_description() const {
+ return description;
+}
+#endif
+
////////////// GroupBase
void VisualShaderNodeGroupBase::set_inputs(const String &p_inputs) {
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index 3ef6dcd4f9..d7270f3ac6 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -767,6 +767,28 @@ public:
VisualShaderNodeFrame();
};
+#ifndef DISABLE_DEPRECATED
+// Deprecated, for compatibility only.
+class VisualShaderNodeComment : public VisualShaderNodeFrame {
+ GDCLASS(VisualShaderNodeComment, VisualShaderNodeFrame);
+
+ String description;
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual String get_caption() const override { return "Comment(Deprecated)"; }
+
+ virtual Category get_category() const override { return CATEGORY_NONE; }
+
+ void set_description(const String &p_description);
+ String get_description() const;
+
+ VisualShaderNodeComment() {}
+};
+#endif
+
class VisualShaderNodeGroupBase : public VisualShaderNodeResizableBase {
GDCLASS(VisualShaderNodeGroupBase, VisualShaderNodeResizableBase);