diff options
Diffstat (limited to 'editor/editor_plugin.cpp')
-rw-r--r-- | editor/editor_plugin.cpp | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index a12bf036bc..091c5bea44 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -553,21 +553,21 @@ void EditorPlugin::notify_resource_saved(const Ref<Resource> &p_resource) { } bool EditorPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p_event) { - if (get_script_instance() && get_script_instance()->has_method("forward_canvas_gui_input")) { - return get_script_instance()->call("forward_canvas_gui_input", p_event); + if (get_script_instance() && get_script_instance()->has_method("_forward_canvas_gui_input")) { + return get_script_instance()->call("_forward_canvas_gui_input", p_event); } return false; } void EditorPlugin::forward_canvas_draw_over_viewport(Control *p_overlay) { - if (get_script_instance() && get_script_instance()->has_method("forward_canvas_draw_over_viewport")) { - get_script_instance()->call("forward_canvas_draw_over_viewport", p_overlay); + if (get_script_instance() && get_script_instance()->has_method("_forward_canvas_draw_over_viewport")) { + get_script_instance()->call("_forward_canvas_draw_over_viewport", p_overlay); } } void EditorPlugin::forward_canvas_force_draw_over_viewport(Control *p_overlay) { - if (get_script_instance() && get_script_instance()->has_method("forward_canvas_force_draw_over_viewport")) { - get_script_instance()->call("forward_canvas_force_draw_over_viewport", p_overlay); + if (get_script_instance() && get_script_instance()->has_method("_forward_canvas_force_draw_over_viewport")) { + get_script_instance()->call("_forward_canvas_force_draw_over_viewport", p_overlay); } } @@ -591,110 +591,110 @@ int EditorPlugin::update_overlays() const { } bool EditorPlugin::forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) { - if (get_script_instance() && get_script_instance()->has_method("forward_spatial_gui_input")) { - return get_script_instance()->call("forward_spatial_gui_input", p_camera, p_event); + if (get_script_instance() && get_script_instance()->has_method("_forward_spatial_gui_input")) { + return get_script_instance()->call("_forward_spatial_gui_input", p_camera, p_event); } return false; } void EditorPlugin::forward_spatial_draw_over_viewport(Control *p_overlay) { - if (get_script_instance() && get_script_instance()->has_method("forward_spatial_draw_over_viewport")) { - get_script_instance()->call("forward_spatial_draw_over_viewport", p_overlay); + if (get_script_instance() && get_script_instance()->has_method("_forward_spatial_draw_over_viewport")) { + get_script_instance()->call("_forward_spatial_draw_over_viewport", p_overlay); } } void EditorPlugin::forward_spatial_force_draw_over_viewport(Control *p_overlay) { - if (get_script_instance() && get_script_instance()->has_method("forward_spatial_force_draw_over_viewport")) { - get_script_instance()->call("forward_spatial_force_draw_over_viewport", p_overlay); + if (get_script_instance() && get_script_instance()->has_method("_forward_spatial_force_draw_over_viewport")) { + get_script_instance()->call("_forward_spatial_force_draw_over_viewport", p_overlay); } } String EditorPlugin::get_name() const { - if (get_script_instance() && get_script_instance()->has_method("get_plugin_name")) { - return get_script_instance()->call("get_plugin_name"); + if (get_script_instance() && get_script_instance()->has_method("_get_plugin_name")) { + return get_script_instance()->call("_get_plugin_name"); } return String(); } const Ref<Texture2D> EditorPlugin::get_icon() const { - if (get_script_instance() && get_script_instance()->has_method("get_plugin_icon")) { - return get_script_instance()->call("get_plugin_icon"); + if (get_script_instance() && get_script_instance()->has_method("_get_plugin_icon")) { + return get_script_instance()->call("_get_plugin_icon"); } return Ref<Texture2D>(); } bool EditorPlugin::has_main_screen() const { - if (get_script_instance() && get_script_instance()->has_method("has_main_screen")) { - return get_script_instance()->call("has_main_screen"); + if (get_script_instance() && get_script_instance()->has_method("_has_main_screen")) { + return get_script_instance()->call("_has_main_screen"); } return false; } void EditorPlugin::make_visible(bool p_visible) { - if (get_script_instance() && get_script_instance()->has_method("make_visible")) { - get_script_instance()->call("make_visible", p_visible); + if (get_script_instance() && get_script_instance()->has_method("_make_visible")) { + get_script_instance()->call("_make_visible", p_visible); } } void EditorPlugin::edit(Object *p_object) { - if (get_script_instance() && get_script_instance()->has_method("edit")) { + if (get_script_instance() && get_script_instance()->has_method("_edit")) { if (p_object->is_class("Resource")) { - get_script_instance()->call("edit", Ref<Resource>(Object::cast_to<Resource>(p_object))); + get_script_instance()->call("_edit", Ref<Resource>(Object::cast_to<Resource>(p_object))); } else { - get_script_instance()->call("edit", p_object); + get_script_instance()->call("_edit", p_object); } } } bool EditorPlugin::handles(Object *p_object) const { - if (get_script_instance() && get_script_instance()->has_method("handles")) { - return get_script_instance()->call("handles", p_object); + if (get_script_instance() && get_script_instance()->has_method("_handles")) { + return get_script_instance()->call("_handles", p_object); } return false; } Dictionary EditorPlugin::get_state() const { - if (get_script_instance() && get_script_instance()->has_method("get_state")) { - return get_script_instance()->call("get_state"); + if (get_script_instance() && get_script_instance()->has_method("_get_state")) { + return get_script_instance()->call("_get_state"); } return Dictionary(); } void EditorPlugin::set_state(const Dictionary &p_state) { - if (get_script_instance() && get_script_instance()->has_method("set_state")) { - get_script_instance()->call("set_state", p_state); + if (get_script_instance() && get_script_instance()->has_method("_set_state")) { + get_script_instance()->call("_set_state", p_state); } } void EditorPlugin::clear() { - if (get_script_instance() && get_script_instance()->has_method("clear")) { - get_script_instance()->call("clear"); + if (get_script_instance() && get_script_instance()->has_method("_clear")) { + get_script_instance()->call("_clear"); } } // if editor references external resources/scenes, save them void EditorPlugin::save_external_data() { - if (get_script_instance() && get_script_instance()->has_method("save_external_data")) { - get_script_instance()->call("save_external_data"); + if (get_script_instance() && get_script_instance()->has_method("_save_external_data")) { + get_script_instance()->call("_save_external_data"); } } // if changes are pending in editor, apply them void EditorPlugin::apply_changes() { - if (get_script_instance() && get_script_instance()->has_method("apply_changes")) { - get_script_instance()->call("apply_changes"); + if (get_script_instance() && get_script_instance()->has_method("_apply_changes")) { + get_script_instance()->call("_apply_changes"); } } void EditorPlugin::get_breakpoints(List<String> *p_breakpoints) { - if (get_script_instance() && get_script_instance()->has_method("get_breakpoints")) { - PackedStringArray arr = get_script_instance()->call("get_breakpoints"); + if (get_script_instance() && get_script_instance()->has_method("_get_breakpoints")) { + PackedStringArray arr = get_script_instance()->call("_get_breakpoints"); for (int i = 0; i < arr.size(); i++) { p_breakpoints->push_back(arr[i]); } @@ -779,8 +779,8 @@ int find(const PackedStringArray &a, const String &v) { void EditorPlugin::enable_plugin() { // Called when the plugin gets enabled in project settings, after it's added to the tree. // You can implement it to register autoloads. - if (get_script_instance() && get_script_instance()->has_method("enable_plugin")) { - get_script_instance()->call("enable_plugin"); + if (get_script_instance() && get_script_instance()->has_method("_enable_plugin")) { + get_script_instance()->call("_enable_plugin"); } } @@ -788,26 +788,26 @@ void EditorPlugin::disable_plugin() { // Last function called when the plugin gets disabled in project settings. // Implement it to cleanup things from the project, such as unregister autoloads. - if (get_script_instance() && get_script_instance()->has_method("disable_plugin")) { - get_script_instance()->call("disable_plugin"); + if (get_script_instance() && get_script_instance()->has_method("_disable_plugin")) { + get_script_instance()->call("_disable_plugin"); } } void EditorPlugin::set_window_layout(Ref<ConfigFile> p_layout) { - if (get_script_instance() && get_script_instance()->has_method("set_window_layout")) { - get_script_instance()->call("set_window_layout", p_layout); + if (get_script_instance() && get_script_instance()->has_method("_set_window_layout")) { + get_script_instance()->call("_set_window_layout", p_layout); } } void EditorPlugin::get_window_layout(Ref<ConfigFile> p_layout) { - if (get_script_instance() && get_script_instance()->has_method("get_window_layout")) { - get_script_instance()->call("get_window_layout", p_layout); + if (get_script_instance() && get_script_instance()->has_method("_get_window_layout")) { + get_script_instance()->call("_get_window_layout", p_layout); } } bool EditorPlugin::build() { - if (get_script_instance() && get_script_instance()->has_method("build")) { - return get_script_instance()->call("build"); + if (get_script_instance() && get_script_instance()->has_method("_build")) { + return get_script_instance()->call("_build"); } return true; @@ -898,29 +898,29 @@ void EditorPlugin::_bind_methods() { ClassDB::bind_method(D_METHOD("add_debugger_plugin", "script"), &EditorPlugin::add_debugger_plugin); ClassDB::bind_method(D_METHOD("remove_debugger_plugin", "script"), &EditorPlugin::remove_debugger_plugin); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_canvas_gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_canvas_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_canvas_force_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_spatial_gui_input", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera3D"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_spatial_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_spatial_force_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_plugin_name")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(PropertyInfo(Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "get_plugin_icon")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "has_main_screen")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("make_visible", PropertyInfo(Variant::BOOL, "visible"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("edit", PropertyInfo(Variant::OBJECT, "object"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "handles", PropertyInfo(Variant::OBJECT, "object"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::DICTIONARY, "get_state")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_state", PropertyInfo(Variant::DICTIONARY, "state"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("clear")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("save_external_data")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("apply_changes")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::PACKED_STRING_ARRAY, "get_breakpoints")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("get_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "build")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("enable_plugin")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("disable_plugin")); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_forward_canvas_gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"))); + BIND_VMETHOD(MethodInfo("_forward_canvas_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control"))); + BIND_VMETHOD(MethodInfo("_forward_canvas_force_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_forward_spatial_gui_input", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera3D"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"))); + BIND_VMETHOD(MethodInfo("_forward_spatial_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control"))); + BIND_VMETHOD(MethodInfo("_forward_spatial_force_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control"))); + BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_plugin_name")); + BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "_get_plugin_icon")); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_has_main_screen")); + BIND_VMETHOD(MethodInfo("_make_visible", PropertyInfo(Variant::BOOL, "visible"))); + BIND_VMETHOD(MethodInfo("_edit", PropertyInfo(Variant::OBJECT, "object"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_handles", PropertyInfo(Variant::OBJECT, "object"))); + BIND_VMETHOD(MethodInfo(Variant::DICTIONARY, "_get_state")); + BIND_VMETHOD(MethodInfo("_set_state", PropertyInfo(Variant::DICTIONARY, "state"))); + BIND_VMETHOD(MethodInfo("_clear")); + BIND_VMETHOD(MethodInfo("_save_external_data")); + BIND_VMETHOD(MethodInfo("_apply_changes")); + BIND_VMETHOD(MethodInfo(Variant::PACKED_STRING_ARRAY, "_get_breakpoints")); + BIND_VMETHOD(MethodInfo("set_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); + BIND_VMETHOD(MethodInfo("_get_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_build")); + BIND_VMETHOD(MethodInfo("_enable_plugin")); + BIND_VMETHOD(MethodInfo("_disable_plugin")); ADD_SIGNAL(MethodInfo("scene_changed", PropertyInfo(Variant::OBJECT, "scene_root", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); ADD_SIGNAL(MethodInfo("scene_closed", PropertyInfo(Variant::STRING, "filepath"))); |