Skip to content

Commit

Permalink
Expose EditorProperty._set_read_only virtual method
Browse files Browse the repository at this point in the history
  • Loading branch information
Zylann committed Sep 19, 2022
1 parent 9087953 commit 056a418
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/classes/EditorProperty.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
<tutorials>
</tutorials>
<methods>
<method name="_set_read_only" qualifiers="virtual">
<return type="void" />
<param index="0" name="read_only" type="bool" />
<description>
Called when the read-only status of the property is changed. It may be used to change custom controls into a read-only or modifiable state.
</description>
</method>
<method name="_update_property" qualifiers="virtual">
<return type="void" />
<description>
Expand Down
5 changes: 5 additions & 0 deletions editor/editor_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,9 @@ void EditorProperty::_set_read_only(bool p_read_only) {

void EditorProperty::set_read_only(bool p_read_only) {
read_only = p_read_only;
if (GDVIRTUAL_CALL(_set_read_only, p_read_only)) {
return;
}
_set_read_only(p_read_only);
}

Expand Down Expand Up @@ -985,6 +988,8 @@ void EditorProperty::_bind_methods() {
ADD_SIGNAL(MethodInfo("selected", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::INT, "focusable_idx")));

GDVIRTUAL_BIND(_update_property)
GDVIRTUAL_BIND(_set_read_only, "read_only")

ClassDB::bind_method(D_METHOD("_update_editor_property_status"), &EditorProperty::update_editor_property_status);
}

Expand Down
2 changes: 2 additions & 0 deletions editor/editor_inspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ class EditorProperty : public Container {
HashMap<StringName, Variant> cache;

GDVIRTUAL0(_update_property)
GDVIRTUAL1(_set_read_only, bool)

void _update_pin_flags();

protected:
Expand Down

0 comments on commit 056a418

Please sign in to comment.