Skip to content

Commit

Permalink
Merge pull request #91252 from timothyqiu/control-category
Browse files Browse the repository at this point in the history
Only add warning label for Layout group in Control category
  • Loading branch information
akien-mga committed Apr 29, 2024
2 parents 947f5a8 + bd716a6 commit 78f03f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions editor/plugins/control_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,15 @@ bool EditorInspectorPluginControl::can_handle(Object *p_object) {
return Object::cast_to<Control>(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<Control>(p_object);
if (!control || p_group != "Layout") {
return;
Expand Down
3 changes: 3 additions & 0 deletions editor/plugins/control_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,11 @@ class EditorPropertySizeFlags : public EditorProperty {
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<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
};
Expand Down

0 comments on commit 78f03f8

Please sign in to comment.