Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change _can_handle and _edit virtual methods to take Object* #66121

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/classes/EditorInspectorPlugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<methods>
<method name="_can_handle" qualifiers="virtual const">
<return type="bool" />
<param index="0" name="object" type="Variant" />
<param index="0" name="object" type="Object" />
<description>
Returns [code]true[/code] if this object can be handled by this plugin.
</description>
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/EditorPlugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</method>
<method name="_edit" qualifiers="virtual">
<return type="void" />
<param index="0" name="object" type="Variant" />
<param index="0" name="object" type="Object" />
<description>
This function is used for plugins that edit specific object types (nodes or resources). It requests the editor to edit the given object.
[param object] can be [code]null[/code] if the plugin was editing an object, but there is no longer any selected object handled by this plugin. It can be used to cleanup editing state.
Expand Down Expand Up @@ -295,7 +295,7 @@
</method>
<method name="_handles" qualifiers="virtual const">
<return type="bool" />
<param index="0" name="object" type="Variant" />
<param index="0" name="object" type="Object" />
<description>
Implement this function if your plugin edits a specific type of object (Resource or Node). If you return [code]true[/code], then you will get the functions [method _edit] and [method _make_visible] called when the editor requests them. If you have declared the methods [method _forward_canvas_gui_input] and [method _forward_3d_gui_input] these will be called too.
</description>
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_inspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class EditorInspectorPlugin : public RefCounted {
protected:
static void _bind_methods();

GDVIRTUAL1RC(bool, _can_handle, Variant)
GDVIRTUAL1RC(bool, _can_handle, Object *)
GDVIRTUAL1(_parse_begin, Object *)
GDVIRTUAL2(_parse_category, Object *, String)
GDVIRTUAL2(_parse_group, Object *, String)
Expand Down
6 changes: 1 addition & 5 deletions editor/editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,11 +662,7 @@ void EditorPlugin::make_visible(bool p_visible) {
}

void EditorPlugin::edit(Object *p_object) {
if (Object::cast_to<Resource>(p_object)) {
GDVIRTUAL_CALL(_edit, Ref<Resource>(Object::cast_to<Resource>(p_object)));
} else {
GDVIRTUAL_CALL(_edit, p_object);
}
GDVIRTUAL_CALL(_edit, p_object);
}

bool EditorPlugin::handles(Object *p_object) const {
Expand Down
4 changes: 2 additions & 2 deletions editor/editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ class EditorPlugin : public Node {
GDVIRTUAL0RC(Ref<Texture2D>, _get_plugin_icon)
GDVIRTUAL0RC(bool, _has_main_screen)
GDVIRTUAL1(_make_visible, bool)
GDVIRTUAL1(_edit, Variant)
GDVIRTUAL1RC(bool, _handles, Variant)
GDVIRTUAL1(_edit, Object *)
GDVIRTUAL1RC(bool, _handles, Object *)
GDVIRTUAL0RC(Dictionary, _get_state)
GDVIRTUAL1(_set_state, Dictionary)
GDVIRTUAL0(_clear)
Expand Down