1
0
Fork 0

Change `_can_handle` and `_edit` virtual methods to take `Object*`

This commit is contained in:
Marc Gilleron 2022-09-19 17:39:35 +01:00 committed by Rémi Verschelde
parent f0c9ed4b55
commit d2b4e30058
No known key found for this signature in database
GPG Key ID: C3336907360768E1
5 changed files with 7 additions and 11 deletions

View File

@ -18,7 +18,7 @@
<methods> <methods>
<method name="_can_handle" qualifiers="virtual const"> <method name="_can_handle" qualifiers="virtual const">
<return type="bool" /> <return type="bool" />
<param index="0" name="object" type="Variant" /> <param index="0" name="object" type="Object" />
<description> <description>
Returns [code]true[/code] if this object can be handled by this plugin. Returns [code]true[/code] if this object can be handled by this plugin.
</description> </description>

View File

@ -38,7 +38,7 @@
</method> </method>
<method name="_edit" qualifiers="virtual"> <method name="_edit" qualifiers="virtual">
<return type="void" /> <return type="void" />
<param index="0" name="object" type="Variant" /> <param index="0" name="object" type="Object" />
<description> <description>
This function is used for plugins that edit specific object types (nodes or resources). It requests the editor to edit the given object. 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. [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.
@ -295,7 +295,7 @@
</method> </method>
<method name="_handles" qualifiers="virtual const"> <method name="_handles" qualifiers="virtual const">
<return type="bool" /> <return type="bool" />
<param index="0" name="object" type="Variant" /> <param index="0" name="object" type="Object" />
<description> <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. 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> </description>

View File

@ -223,7 +223,7 @@ public:
protected: protected:
static void _bind_methods(); static void _bind_methods();
GDVIRTUAL1RC(bool, _can_handle, Variant) GDVIRTUAL1RC(bool, _can_handle, Object *)
GDVIRTUAL1(_parse_begin, Object *) GDVIRTUAL1(_parse_begin, Object *)
GDVIRTUAL2(_parse_category, Object *, String) GDVIRTUAL2(_parse_category, Object *, String)
GDVIRTUAL2(_parse_group, Object *, String) GDVIRTUAL2(_parse_group, Object *, String)

View File

@ -662,11 +662,7 @@ void EditorPlugin::make_visible(bool p_visible) {
} }
void EditorPlugin::edit(Object *p_object) { 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 { bool EditorPlugin::handles(Object *p_object) const {

View File

@ -164,8 +164,8 @@ protected:
GDVIRTUAL0RC(Ref<Texture2D>, _get_plugin_icon) GDVIRTUAL0RC(Ref<Texture2D>, _get_plugin_icon)
GDVIRTUAL0RC(bool, _has_main_screen) GDVIRTUAL0RC(bool, _has_main_screen)
GDVIRTUAL1(_make_visible, bool) GDVIRTUAL1(_make_visible, bool)
GDVIRTUAL1(_edit, Variant) GDVIRTUAL1(_edit, Object *)
GDVIRTUAL1RC(bool, _handles, Variant) GDVIRTUAL1RC(bool, _handles, Object *)
GDVIRTUAL0RC(Dictionary, _get_state) GDVIRTUAL0RC(Dictionary, _get_state)
GDVIRTUAL1(_set_state, Dictionary) GDVIRTUAL1(_set_state, Dictionary)
GDVIRTUAL0(_clear) GDVIRTUAL0(_clear)