diff --git a/doc/classes/VisualShader.xml b/doc/classes/VisualShader.xml index c9e1849e94e..745a7aa626b 100644 --- a/doc/classes/VisualShader.xml +++ b/doc/classes/VisualShader.xml @@ -186,6 +186,11 @@ + + + Deprecated. + + A vertex shader, operating on vertices. diff --git a/misc/extension_api_validation/4.4-stable.expected b/misc/extension_api_validation/4.4-stable.expected index 3cb9583e692..4b084079191 100644 --- a/misc/extension_api_validation/4.4-stable.expected +++ b/misc/extension_api_validation/4.4-stable.expected @@ -321,11 +321,3 @@ Validate extension JSON: Error: Field 'classes/RichTextLabel/methods/add_image/a Validate extension JSON: Error: Field 'classes/RichTextLabel/methods/update_image/arguments': size changed value in new API, from 11 to 12. Optional argument added. Compatibility methods registered. - - -GH-98566 --------- -Validate extension JSON: API was removed: classes/VisualShader/methods/set_graph_offset -Validate extension JSON: API was removed: classes/VisualShader/methods/get_graph_offset - -The graph_offset property was removed from the resource. This information is now stored in `vs_editor_cache.cfg`. diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index 22b2c455387..503909021c6 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -1466,6 +1466,17 @@ bool VisualShader::is_text_shader() const { return false; } +#ifndef DISABLE_DEPRECATED +void VisualShader::set_graph_offset(const Vector2 &p_offset) { + WARN_DEPRECATED_MSG("graph_offset property is deprecated. Setting it has no effect."); +} + +Vector2 VisualShader::get_graph_offset() const { + WARN_DEPRECATED_MSG("graph_offset property is deprecated. Getting it always returns Vector2()."); + return Vector2(); +} +#endif + String VisualShader::generate_preview_shader(Type p_type, int p_node, int p_port, Vector &default_tex_params) const { Ref node = get_node(p_type, p_node); ERR_FAIL_COND_V(node.is_null(), String()); @@ -3154,6 +3165,12 @@ void VisualShader::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_shader"), &VisualShader::_update_shader); +#ifndef DISABLE_DEPRECATED + ClassDB::bind_method(D_METHOD("set_graph_offset", "offset"), &VisualShader::set_graph_offset); + ClassDB::bind_method(D_METHOD("get_graph_offset"), &VisualShader::get_graph_offset); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "graph_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_graph_offset", "get_graph_offset"); +#endif + ADD_PROPERTY_DEFAULT("code", ""); // Inherited from Shader, prevents showing default code as override in docs. BIND_ENUM_CONSTANT(TYPE_VERTEX); diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h index 4b5ed0607d8..6ca86c7b47b 100644 --- a/scene/resources/visual_shader.h +++ b/scene/resources/visual_shader.h @@ -242,6 +242,11 @@ public: // internal methods virtual bool is_text_shader() const override; +#ifndef DISABLE_DEPRECATED + void set_graph_offset(const Vector2 &p_offset); + Vector2 get_graph_offset() const; +#endif + String generate_preview_shader(Type p_type, int p_node, int p_port, Vector &r_default_tex_params) const; String validate_port_name(const String &p_port_name, VisualShaderNode *p_node, int p_port_id, bool p_output) const;