From bd716a693a0c0f544ba61693614f00890060f735 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Sat, 27 Apr 2024 21:56:24 +0800 Subject: [PATCH] Only add warning label for Layout group in Control category --- editor/plugins/control_editor_plugin.cpp | 8 ++++++++ editor/plugins/control_editor_plugin.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/editor/plugins/control_editor_plugin.cpp b/editor/plugins/control_editor_plugin.cpp index 5b0831eeb85..939527b56f6 100644 --- a/editor/plugins/control_editor_plugin.cpp +++ b/editor/plugins/control_editor_plugin.cpp @@ -413,7 +413,15 @@ bool EditorInspectorPluginControl::can_handle(Object *p_object) { return Object::cast_to(p_object) != nullptr; } +void EditorInspectorPluginControl::parse_category(Object *p_object, const String &p_category) { + inside_control_category = p_category == "Control"; +} + void EditorInspectorPluginControl::parse_group(Object *p_object, const String &p_group) { + if (!inside_control_category) { + return; + } + Control *control = Object::cast_to(p_object); if (!control || p_group != "Layout") { return; diff --git a/editor/plugins/control_editor_plugin.h b/editor/plugins/control_editor_plugin.h index 4a411c0241f..207a6923941 100644 --- a/editor/plugins/control_editor_plugin.h +++ b/editor/plugins/control_editor_plugin.h @@ -127,8 +127,11 @@ public: class EditorInspectorPluginControl : public EditorInspectorPlugin { GDCLASS(EditorInspectorPluginControl, EditorInspectorPlugin); + bool inside_control_category = false; + public: virtual bool can_handle(Object *p_object) override; + virtual void parse_category(Object *p_object, const String &p_category) override; virtual void parse_group(Object *p_object, const String &p_group) override; virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField p_usage, const bool p_wide = false) override; };