From 7ff135b0158e0b5dd7a85d98aecd7ff0975e7e43 Mon Sep 17 00:00:00 2001 From: kobewi Date: Sat, 15 May 2021 23:48:59 +0200 Subject: [PATCH] Consistently prefix bound virtual methods with _ --- core/io/resource_loader.cpp | 38 +- core/io/resource_saver.cpp | 18 +- doc/classes/AnimationNode.xml | 118 ++-- doc/classes/Control.xml | 206 +++--- doc/classes/EditorImportPlugin.xml | 50 +- doc/classes/EditorInspectorPlugin.xml | 112 ++- doc/classes/EditorNode3DGizmo.xml | 138 ++-- doc/classes/EditorNode3DGizmoPlugin.xml | 206 +++--- doc/classes/EditorPlugin.xml | 658 +++++++++--------- doc/classes/EditorProperty.xml | 18 +- doc/classes/EditorResourcePicker.xml | 34 - .../EditorResourcePreviewGenerator.xml | 16 +- doc/classes/EditorScenePostImport.xml | 20 +- doc/classes/EditorSyntaxHighlighter.xml | 2 +- doc/classes/EditorTranslationParserPlugin.xml | 14 +- doc/classes/FileSystemDock.xml | 34 - doc/classes/ResourceFormatLoader.xml | 12 +- doc/classes/ResourceFormatSaver.xml | 8 +- doc/classes/ScriptEditor.xml | 34 - doc/classes/ScriptEditorBase.xml | 2 +- doc/classes/Tree.xml | 2 +- doc/classes/Viewport.xml | 2 +- editor/action_map_editor.cpp | 6 +- editor/create_dialog.cpp | 6 +- editor/editor_audio_buses.cpp | 6 +- editor/editor_autoload_settings.cpp | 6 +- editor/editor_inspector.cpp | 49 +- editor/editor_plugin.cpp | 140 ++-- editor/editor_properties_array_dict.cpp | 4 +- editor/editor_resource_picker.cpp | 6 +- editor/editor_resource_preview.cpp | 34 +- editor/editor_translation_parser.cpp | 12 +- editor/filesystem_dock.cpp | 6 +- editor/import/editor_import_plugin.cpp | 72 +- editor/import/resource_importer_scene.cpp | 6 +- editor/node_3d_editor_gizmos.cpp | 36 +- editor/plugins/node_3d_editor_plugin.cpp | 76 +- .../resource_preloader_editor_plugin.cpp | 6 +- editor/plugins/script_editor_plugin.cpp | 8 +- editor/plugins/script_text_editor.cpp | 6 +- editor/plugins/skeleton_3d_editor_plugin.cpp | 6 +- .../plugins/sprite_frames_editor_plugin.cpp | 6 +- editor/plugins/tiles/tile_set_editor.cpp | 4 +- .../plugins/visual_shader_editor_plugin.cpp | 10 +- editor/project_export.cpp | 6 +- editor/scene_tree_editor.cpp | 6 +- .../visual_script/visual_script_editor.cpp | 6 +- scene/animation/animation_tree.cpp | 30 +- scene/gui/control.cpp | 22 +- scene/scene_string_names.cpp | 8 +- scene/scene_string_names.h | 8 +- 51 files changed, 1107 insertions(+), 1232 deletions(-) diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 9839a563fde..1700766cbf6 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -68,17 +68,17 @@ bool ResourceFormatLoader::recognize_path(const String &p_path, const String &p_ } bool ResourceFormatLoader::handles_type(const String &p_type) const { - if (get_script_instance() && get_script_instance()->has_method("handles_type")) { + if (get_script_instance() && get_script_instance()->has_method("_handles_type")) { // I guess custom loaders for custom resources should use "Resource" - return get_script_instance()->call("handles_type", p_type); + return get_script_instance()->call("_handles_type", p_type); } return false; } String ResourceFormatLoader::get_resource_type(const String &p_path) const { - if (get_script_instance() && get_script_instance()->has_method("get_resource_type")) { - return get_script_instance()->call("get_resource_type", p_path); + if (get_script_instance() && get_script_instance()->has_method("_get_resource_type")) { + return get_script_instance()->call("_get_resource_type", p_path); } return ""; @@ -101,8 +101,8 @@ bool ResourceFormatLoader::exists(const String &p_path) const { } void ResourceFormatLoader::get_recognized_extensions(List *p_extensions) const { - if (get_script_instance() && get_script_instance()->has_method("get_recognized_extensions")) { - PackedStringArray exts = get_script_instance()->call("get_recognized_extensions"); + if (get_script_instance() && get_script_instance()->has_method("_get_recognized_extensions")) { + PackedStringArray exts = get_script_instance()->call("_get_recognized_extensions"); { const String *r = exts.ptr(); @@ -115,8 +115,8 @@ void ResourceFormatLoader::get_recognized_extensions(List *p_extensions) RES ResourceFormatLoader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) { // Check user-defined loader if there's any. Hard fail if it returns an error. - if (get_script_instance() && get_script_instance()->has_method("load")) { - Variant res = get_script_instance()->call("load", p_path, p_original_path, p_use_sub_threads, p_cache_mode); + if (get_script_instance() && get_script_instance()->has_method("_load")) { + Variant res = get_script_instance()->call("_load", p_path, p_original_path, p_use_sub_threads, p_cache_mode); if (res.get_type() == Variant::INT) { // Error code, abort. if (r_error) { @@ -135,8 +135,8 @@ RES ResourceFormatLoader::load(const String &p_path, const String &p_original_pa } void ResourceFormatLoader::get_dependencies(const String &p_path, List *p_dependencies, bool p_add_types) { - if (get_script_instance() && get_script_instance()->has_method("get_dependencies")) { - PackedStringArray deps = get_script_instance()->call("get_dependencies", p_path, p_add_types); + if (get_script_instance() && get_script_instance()->has_method("_get_dependencies")) { + PackedStringArray deps = get_script_instance()->call("_get_dependencies", p_path, p_add_types); { const String *r = deps.ptr(); @@ -148,13 +148,13 @@ void ResourceFormatLoader::get_dependencies(const String &p_path, List * } Error ResourceFormatLoader::rename_dependencies(const String &p_path, const Map &p_map) { - if (get_script_instance() && get_script_instance()->has_method("rename_dependencies")) { + if (get_script_instance() && get_script_instance()->has_method("_rename_dependencies")) { Dictionary deps_dict; for (Map::Element *E = p_map.front(); E; E = E->next()) { deps_dict[E->key()] = E->value(); } - int64_t res = get_script_instance()->call("rename_dependencies", deps_dict); + int64_t res = get_script_instance()->call("_rename_dependencies", deps_dict); return (Error)res; } @@ -163,16 +163,16 @@ Error ResourceFormatLoader::rename_dependencies(const String &p_path, const Map< void ResourceFormatLoader::_bind_methods() { { - MethodInfo info = MethodInfo(Variant::NIL, "load", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "original_path"), PropertyInfo(Variant::BOOL, "use_sub_threads"), PropertyInfo(Variant::INT, "cache_mode")); + MethodInfo info = MethodInfo(Variant::NIL, "_load", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "original_path"), PropertyInfo(Variant::BOOL, "use_sub_threads"), PropertyInfo(Variant::INT, "cache_mode")); info.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT; - ClassDB::add_virtual_method(get_class_static(), info); + BIND_VMETHOD(info); } - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::PACKED_STRING_ARRAY, "get_recognized_extensions")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "handles_type", PropertyInfo(Variant::STRING_NAME, "typename"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_resource_type", PropertyInfo(Variant::STRING, "path"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("get_dependencies", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "add_types"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "rename_dependencies", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "renames"))); + BIND_VMETHOD(MethodInfo(Variant::PACKED_STRING_ARRAY, "_get_recognized_extensions")); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_handles_type", PropertyInfo(Variant::STRING_NAME, "typename"))); + BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_resource_type", PropertyInfo(Variant::STRING, "path"))); + BIND_VMETHOD(MethodInfo("_get_dependencies", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "add_types"))); + BIND_VMETHOD(MethodInfo(Variant::INT, "_rename_dependencies", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "renames"))); BIND_ENUM_CONSTANT(CACHE_MODE_IGNORE); BIND_ENUM_CONSTANT(CACHE_MODE_REUSE); diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp index f7ddea7266d..389a4fdbbd3 100644 --- a/core/io/resource_saver.cpp +++ b/core/io/resource_saver.cpp @@ -41,24 +41,24 @@ bool ResourceSaver::timestamp_on_save = false; ResourceSavedCallback ResourceSaver::save_callback = nullptr; Error ResourceFormatSaver::save(const String &p_path, const RES &p_resource, uint32_t p_flags) { - if (get_script_instance() && get_script_instance()->has_method("save")) { - return (Error)get_script_instance()->call("save", p_path, p_resource, p_flags).operator int64_t(); + if (get_script_instance() && get_script_instance()->has_method("_save")) { + return (Error)get_script_instance()->call("_save", p_path, p_resource, p_flags).operator int64_t(); } return ERR_METHOD_NOT_FOUND; } bool ResourceFormatSaver::recognize(const RES &p_resource) const { - if (get_script_instance() && get_script_instance()->has_method("recognize")) { - return get_script_instance()->call("recognize", p_resource); + if (get_script_instance() && get_script_instance()->has_method("_recognize")) { + return get_script_instance()->call("_recognize", p_resource); } return false; } void ResourceFormatSaver::get_recognized_extensions(const RES &p_resource, List *p_extensions) const { - if (get_script_instance() && get_script_instance()->has_method("get_recognized_extensions")) { - PackedStringArray exts = get_script_instance()->call("get_recognized_extensions", p_resource); + if (get_script_instance() && get_script_instance()->has_method("_get_recognized_extensions")) { + PackedStringArray exts = get_script_instance()->call("_get_recognized_extensions", p_resource); { const String *r = exts.ptr(); @@ -74,11 +74,11 @@ void ResourceFormatSaver::_bind_methods() { PropertyInfo arg0 = PropertyInfo(Variant::STRING, "path"); PropertyInfo arg1 = PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource"); PropertyInfo arg2 = PropertyInfo(Variant::INT, "flags"); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "save", arg0, arg1, arg2)); + BIND_VMETHOD(MethodInfo(Variant::INT, "_save", arg0, arg1, arg2)); } - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::PACKED_STRING_ARRAY, "get_recognized_extensions", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "recognize", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource"))); + BIND_VMETHOD(MethodInfo(Variant::PACKED_STRING_ARRAY, "_get_recognized_extensions", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_recognize", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource"))); } Error ResourceSaver::save(const String &p_path, const RES &p_resource, uint32_t p_flags) { diff --git a/doc/classes/AnimationNode.xml b/doc/classes/AnimationNode.xml index 8204b456d97..fddd8989abc 100644 --- a/doc/classes/AnimationNode.xml +++ b/doc/classes/AnimationNode.xml @@ -11,6 +11,65 @@ https://docs.godotengine.org/en/latest/tutorials/animation/animation_tree.html + + + + + Gets the text caption for this node (used by some editors). + + + + + + + + + Gets a child node by index (used by editors inheriting from [AnimationRootNode]). + + + + + + + Gets all children nodes in order as a [code]name: node[/code] dictionary. Only useful when inheriting [AnimationRootNode]. + + + + + + + + + Gets the default value of a parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees. + + + + + + + Gets the property information for parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees. Format is similar to [method Object.get_property_list]. + + + + + + + Returns [code]true[/code] whether you want the blend tree editor to display filter editing on this node. + + + + + + + + + + + User-defined callback called when a custom node is processed. The [code]time[/code] parameter is a relative delta, unless [code]seek[/code] is [code]true[/code], in which case it is absolute. + Here, call the [method blend_input], [method blend_node] or [method blend_animation] functions. You can also use [method get_parameter] and [method set_parameter] to modify local memory. + This function should return the time left for the current animation to finish (if unsure, pass the value from the main blend being called). + + @@ -77,29 +136,6 @@ Blend another animation node (in case this node contains children animation nodes). This function is only useful if you inherit from [AnimationRootNode] instead, else editors will not display your node for addition. - - - - - Gets the text caption for this node (used by some editors). - - - - - - - - - Gets a child node by index (used by editors inheriting from [AnimationRootNode]). - - - - - - - Gets all children nodes in order as a [code]name: node[/code] dictionary. Only useful when inheriting [AnimationRootNode]. - - @@ -125,29 +161,6 @@ Gets the value of a parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees. - - - - - - - Gets the default value of a parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees. - - - - - - - Gets the property information for parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees. Format is similar to [method Object.get_property_list]. - - - - - - - Returns [code]true[/code] whether you want the blend tree editor to display filter editing on this node. - - @@ -157,19 +170,6 @@ Returns [code]true[/code] whether a given path is filtered. - - - - - - - - - User-defined callback called when a custom node is processed. The [code]time[/code] parameter is a relative delta, unless [code]seek[/code] is [code]true[/code], in which case it is absolute. - Here, call the [method blend_input], [method blend_node] or [method blend_animation] functions. You can also use [method get_parameter] and [method set_parameter] to modify local memory. - This function should return the time left for the current animation to finish (if unsure, pass the value from the main blend being called). - - diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index 9c61fca598a..33969cf4c30 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -22,6 +22,34 @@ https://github.com/godotengine/godot-demo-projects/tree/master/gui + + + + + + + + + Godot calls this method to test if [code]data[/code] from a control's [method _get_drag_data] can be dropped at [code]position[/code]. [code]position[/code] is local to this control. + This method should only be used to test the data. Process the data in [method _drop_data]. + [codeblocks] + [gdscript] + func _can_drop_data(position, data): + # Check position if it is relevant to you + # Otherwise, just check data + return typeof(data) == TYPE_DICTIONARY and data.has("expected") + [/gdscript] + [csharp] + public override bool CanDropData(Vector2 position, object data) + { + // Check position if it is relevant to you + // Otherwise, just check data + return data is Godot.Collections.Dictionary && (data as Godot.Collections.Dictionary).Contains("expected"); + } + [/csharp] + [/codeblocks] + + @@ -30,6 +58,61 @@ If not overridden, defaults to [code]false[/code]. + + + + + + + + + Godot calls this method to pass you the [code]data[/code] from a control's [method _get_drag_data] result. Godot first calls [method _can_drop_data] to test if [code]data[/code] is allowed to drop at [code]position[/code] where [code]position[/code] is local to this control. + [codeblocks] + [gdscript] + func _can_drop_data(position, data): + return typeof(data) == TYPE_DICTIONARY and data.has("color") + func _drop_data(position, data): + var color = data["color"] + [/gdscript] + [csharp] + public override bool CanDropData(Vector2 position, object data) + { + return data is Godot.Collections.Dictionary && (data as Godot.Collections.Dictionary).Contains("color"); + } + public override void DropData(Vector2 position, object data) + { + Color color = (Color)(data as Godot.Collections.Dictionary)["color"]; + } + [/csharp] + [/codeblocks] + + + + + + + + + Godot calls this method to get data that can be dragged and dropped onto controls that expect drop data. Returns [code]null[/code] if there is no data to drag. Controls that want to receive drop data should implement [method _can_drop_data] and [method _drop_data]. [code]position[/code] is local to this control. Drag may be forced with [method force_drag]. + A preview that will follow the mouse that should represent the data can be set with [method set_drag_preview]. A good time to set the preview is in this method. + [codeblocks] + [gdscript] + func _get_drag_data(position): + var mydata = make_data() # This is your custom method generating the drag data. + set_drag_preview(make_preview(mydata)) # This is your custom method generating the preview of the drag data. + return mydata + [/gdscript] + [csharp] + public override object GetDragData(Vector2 position) + { + object mydata = MakeData(); // This is your custom method generating the drag data. + SetDragPreview(MakePreview(mydata)); // This is your custom method generating the preview of the drag data. + return mydata; + } + [/csharp] + [/codeblocks] + + @@ -68,13 +151,24 @@ [/csharp] [/codeblocks] The event won't trigger if: - * clicking outside the control (see [method has_point]); + * clicking outside the control (see [method _has_point]); * control has [member mouse_filter] set to [constant MOUSE_FILTER_IGNORE]; * control is obstructed by another [Control] on top of it, which doesn't have [member mouse_filter] set to [constant MOUSE_FILTER_IGNORE]; * control's parent has [member mouse_filter] set to [constant MOUSE_FILTER_STOP] or has accepted the event; * it happens outside parent's rectangle and the parent has either [member rect_clip_content] or [method _clips_input] enabled. + + + + + + + Virtual method to be implemented by the user. Returns whether the given [code]point[/code] is inside this control. + If not overridden, default behavior is checking if the point is within control's Rect. + [b]Note:[/b] If you want to check if a point is inside the control, you can use [code]get_rect().has_point(point)[/code]. + + @@ -249,63 +343,6 @@ [/codeblocks] - - - - - - - - - Godot calls this method to test if [code]data[/code] from a control's [method get_drag_data] can be dropped at [code]position[/code]. [code]position[/code] is local to this control. - This method should only be used to test the data. Process the data in [method drop_data]. - [codeblocks] - [gdscript] - func can_drop_data(position, data): - # Check position if it is relevant to you - # Otherwise, just check data - return typeof(data) == TYPE_DICTIONARY and data.has("expected") - [/gdscript] - [csharp] - public override bool CanDropData(Vector2 position, object data) - { - // Check position if it is relevant to you - // Otherwise, just check data - return data is Godot.Collections.Dictionary && (data as Godot.Collections.Dictionary).Contains("expected"); - } - [/csharp] - [/codeblocks] - - - - - - - - - - - Godot calls this method to pass you the [code]data[/code] from a control's [method get_drag_data] result. Godot first calls [method can_drop_data] to test if [code]data[/code] is allowed to drop at [code]position[/code] where [code]position[/code] is local to this control. - [codeblocks] - [gdscript] - func can_drop_data(position, data): - return typeof(data) == TYPE_DICTIONARY and data.has("color") - func drop_data(position, data): - var color = data["color"] - [/gdscript] - [csharp] - public override bool CanDropData(Vector2 position, object data) - { - return data is Godot.Collections.Dictionary && (data as Godot.Collections.Dictionary).Contains("color"); - } - public override void DropData(Vector2 position, object data) - { - Color color = (Color)(data as Godot.Collections.Dictionary)["color"]; - } - [/csharp] - [/codeblocks] - - @@ -328,8 +365,8 @@ - Forces drag and bypasses [method get_drag_data] and [method set_drag_preview] by passing [code]data[/code] and [code]preview[/code]. Drag will start even if the mouse is neither over nor pressed on this control. - The methods [method can_drop_data] and [method drop_data] must be implemented on controls that want to receive drop data. + Forces drag and bypasses [method _get_drag_data] and [method set_drag_preview] by passing [code]data[/code] and [code]preview[/code]. Drag will start even if the mouse is neither over nor pressed on this control. + The methods [method _can_drop_data] and [method _drop_data] must be implemented on controls that want to receive drop data. @@ -364,32 +401,6 @@ Returns the mouse cursor shape the control displays on mouse hover. See [enum CursorShape]. - - - - - - - Godot calls this method to get data that can be dragged and dropped onto controls that expect drop data. Returns [code]null[/code] if there is no data to drag. Controls that want to receive drop data should implement [method can_drop_data] and [method drop_data]. [code]position[/code] is local to this control. Drag may be forced with [method force_drag]. - A preview that will follow the mouse that should represent the data can be set with [method set_drag_preview]. A good time to set the preview is in this method. - [codeblocks] - [gdscript] - func get_drag_data(position): - var mydata = make_data() # This is your custom method generating the drag data. - set_drag_preview(make_preview(mydata)) # This is your custom method generating the preview of the drag data. - return mydata - [/gdscript] - [csharp] - public override object GetDragData(Vector2 position) - { - object mydata = MakeData(); // This is your custom method generating the drag data. - SetDragPreview(MakePreview(mydata)); // This is your custom method generating the preview of the drag data. - return mydata; - } - [/csharp] - [/codeblocks] - - @@ -577,17 +588,6 @@ Returns [code]true[/code] if this is the current focused control. See [member focus_mode]. - - - - - - - Virtual method to be implemented by the user. Returns whether the given [code]point[/code] is inside this control. - If not overridden, default behavior is checking if the point is within control's Rect. - [b]Note:[/b] If you want to check if a point is inside the control, you can use [code]get_rect().has_point(point)[/code]. - - @@ -856,7 +856,7 @@ Forwards the handling of this control's drag and drop to [code]target[/code] control. - Forwarding can be implemented in the target control similar to the methods [method get_drag_data], [method can_drop_data], and [method drop_data] but with two differences: + Forwarding can be implemented in the target control similar to the methods [method _get_drag_data], [method _can_drop_data], and [method _drop_data] but with two differences: 1. The function name must be suffixed with [b]_fw[/b] 2. The function must take an extra argument that is the control doing the forwarding [codeblocks] @@ -871,13 +871,13 @@ # TargetControl.gd extends Control - func can_drop_data_fw(position, data, from_control): + func _can_drop_data_fw(position, data, from_control): return true - func drop_data_fw(position, data, from_control): + func _drop_data_fw(position, data, from_control): my_handle_data(data) # Your handler method. - func get_drag_data_fw(position, from_control): + func _get_drag_data_fw(position, from_control): set_drag_preview(my_preview) return my_data() [/gdscript] @@ -922,12 +922,12 @@ - Shows the given control at the mouse pointer. A good time to call this method is in [method get_drag_data]. The control must not be in the scene tree. You should not free the control, and you should not keep a reference to the control beyond the duration of the drag. It will be deleted automatically after the drag has ended. + Shows the given control at the mouse pointer. A good time to call this method is in [method _get_drag_data]. The control must not be in the scene tree. You should not free the control, and you should not keep a reference to the control beyond the duration of the drag. It will be deleted automatically after the drag has ended. [codeblocks] [gdscript] export (Color, RGBA) var color = Color(1, 0, 0, 1) - func get_drag_data(position): + func _get_drag_data(position): # Use a control that is not in the tree var cpb = ColorPickerButton.new() cpb.color = color diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml index 663eb0ff5c6..a532e9bc2b8 100644 --- a/doc/classes/EditorImportPlugin.xml +++ b/doc/classes/EditorImportPlugin.xml @@ -5,45 +5,45 @@ EditorImportPlugins provide a way to extend the editor's resource import functionality. Use them to import resources from custom files or to provide alternatives to the editor's existing importers. Register your [EditorPlugin] with [method EditorPlugin.add_import_plugin]. - EditorImportPlugins work by associating with specific file extensions and a resource type. See [method get_recognized_extensions] and [method get_resource_type]. They may optionally specify some import presets that affect the import process. EditorImportPlugins are responsible for creating the resources and saving them in the [code].godot/imported[/code] directory. + EditorImportPlugins work by associating with specific file extensions and a resource type. See [method _get_recognized_extensions] and [method _get_resource_type]. They may optionally specify some import presets that affect the import process. EditorImportPlugins are responsible for creating the resources and saving them in the [code].godot/imported[/code] directory. Below is an example EditorImportPlugin that imports a [Mesh] from a file with the extension ".special" or ".spec": [codeblocks] [gdscript] tool extends EditorImportPlugin - func get_importer_name(): + func _get_importer_name(): return "my.special.plugin" - func get_visible_name(): + func _get_visible_name(): return "Special Mesh" - func get_recognized_extensions(): + func _get_recognized_extensions(): return ["special", "spec"] - func get_save_extension(): + func _get_save_extension(): return "mesh" - func get_resource_type(): + func _get_resource_type(): return "Mesh" - func get_preset_count(): + func _get_preset_count(): return 1 - func get_preset_name(i): + func _get_preset_name(i): return "Default" - func get_import_options(i): + func _get_import_options(i): return [{"name": "my_option", "default_value": false}] - func import(source_file, save_path, options, platform_variants, gen_files): + func _import(source_file, save_path, options, platform_variants, gen_files): var file = File.new() if file.open(source_file, File.READ) != OK: return FAILED var mesh = ArrayMesh.new() # Fill the Mesh with data read in "file", left as an exercise to the reader. - var filename = save_path + "." + get_save_extension() + var filename = save_path + "." + _get_save_extension() return ResourceSaver.save(filename, mesh) [/gdscript] [csharp] @@ -113,7 +113,7 @@ https://docs.godotengine.org/en/latest/tutorials/plugins/editor/import_plugins.html - + @@ -122,21 +122,21 @@ Gets the options and default values for the preset at this index. Returns an Array of Dictionaries with the following keys: [code]name[/code], [code]default_value[/code], [code]property_hint[/code] (optional), [code]hint_string[/code] (optional), [code]usage[/code] (optional). - + Gets the order of this importer to be run when importing resources. Higher values will be called later. Use this to ensure the importer runs after the dependencies are already imported. - + Gets the unique name of the importer. - + @@ -147,7 +147,7 @@ This method can be overridden to hide specific import options if conditions are met. This is mainly useful for hiding options that depend on others if one of them is disabled. For example: [codeblocks] [gdscript] - func get_option_visibility(option, options): + func _get_option_visibility(option, options): # Only show the lossy quality setting if the compression mode is set to "Lossy". if option == "compress/lossy_quality" and options.has("compress/mode"): return int(options["compress/mode"]) == COMPRESS_LOSSY # This is a constant that you set @@ -170,14 +170,14 @@ Return [code]true[/code] to make all options always visible. - + - Gets the number of initial presets defined by the plugin. Use [method get_import_options] to get the default options for the preset and [method get_preset_name] to get the name of the preset. + Gets the number of initial presets defined by the plugin. Use [method _get_import_options] to get the default options for the preset and [method _get_preset_name] to get the name of the preset. - + @@ -186,42 +186,42 @@ Gets the name of the options preset at this index. - + Gets the priority of this plugin for the recognized extension. Higher priority plugins will be preferred. The default priority is [code]1.0[/code]. - + Gets the list of file extensions to associate with this loader (case-insensitive). e.g. [code]["obj"][/code]. - + Gets the Godot resource type associated with this loader. e.g. [code]"Mesh"[/code] or [code]"Animation"[/code]. - + Gets the extension used to save this resource in the [code].godot/imported[/code] directory. - + Gets the name to display in the import window. You should choose this name as a continuation to "Import as", e.g. "Import as Special Mesh". - + diff --git a/doc/classes/EditorInspectorPlugin.xml b/doc/classes/EditorInspectorPlugin.xml index b092a53676c..c992d0fbb4d 100644 --- a/doc/classes/EditorInspectorPlugin.xml +++ b/doc/classes/EditorInspectorPlugin.xml @@ -6,15 +6,64 @@ These plugins allow adding custom property editors to [EditorInspector]. Plugins are registered via [method EditorPlugin.add_inspector_plugin]. - When an object is edited, the [method can_handle] function is called and must return [code]true[/code] if the object type is supported. - If supported, the function [method parse_begin] will be called, allowing to place custom controls at the beginning of the class. - Subsequently, the [method parse_category] and [method parse_property] are called for every category and property. They offer the ability to add custom controls to the inspector too. - Finally, [method parse_end] will be called. + When an object is edited, the [method _can_handle] function is called and must return [code]true[/code] if the object type is supported. + If supported, the function [method _parse_begin] will be called, allowing to place custom controls at the beginning of the class. + Subsequently, the [method _parse_category] and [method _parse_property] are called for every category and property. They offer the ability to add custom controls to the inspector too. + Finally, [method _parse_end] will be called. On each of these calls, the "add" functions can be called. + + + + + + + Returns [code]true[/code] if this object can be handled by this plugin. + + + + + + + Called to allow adding controls at the beginning of the list. + + + + + + + + + Called to allow adding controls at the beginning of the category. + + + + + + + Called to allow adding controls at the end of the list. + + + + + + + + + + + + + + + + + Called to allow adding property specific editors to the inspector. Usually these inherit [EditorProperty]. Returning [code]true[/code] removes the built-in editor for this property, otherwise allows to insert a custom editor before the built-in one. + + @@ -48,61 +97,6 @@ Adds an editor that allows modifying multiple properties, this must inherit [EditorProperty]. - - - - - - - Returns [code]true[/code] if this object can be handled by this plugin. - - - - - - - - - Called to allow adding controls at the beginning of the list. - - - - - - - - - - - Called to allow adding controls at the beginning of the category. - - - - - - - Called to allow adding controls at the end of the list. - - - - - - - - - - - - - - - - - - - Called to allow adding property specific editors to the inspector. Usually these inherit [EditorProperty]. Returning [code]true[/code] removes the built-in editor for this property, otherwise allows to insert a custom editor before the built-in one. - - diff --git a/doc/classes/EditorNode3DGizmo.xml b/doc/classes/EditorNode3DGizmo.xml index 45541b9263d..dcc6d6ef124 100644 --- a/doc/classes/EditorNode3DGizmo.xml +++ b/doc/classes/EditorNode3DGizmo.xml @@ -9,13 +9,76 @@ + + + + + + + + + + + Commit a handle being edited (handles must have been previously added by [method add_handles]). + If the [code]cancel[/code] parameter is [code]true[/code], an option to restore the edited value to the original is provided. + + + + + + + + + Gets the name of an edited handle (handles must have been previously added by [method add_handles]). + Handles can be named for reference to the user when editing. + + + + + + + + + Gets actual value of a handle. This value can be anything and used for eventually undoing the motion when calling [method _commit_handle]. + + + + + + + + + Returns [code]true[/code] if the handle at index [code]index[/code] is highlighted by being hovered with the mouse. + + + + + + + This function is called when the [Node3D] this gizmo refers to changes (the [method Node3D.update_gizmo] is called). + + + + + + + + + + + + + This function is used when the user drags a gizmo handle (previously added with [method add_handles]) in screen coordinates. + The [Camera3D] is also provided so screen coordinates can be converted to raycasts. + + - Adds the specified [code]segments[/code] to the gizmo's collision shape for picking. Call this function during [method redraw]. + Adds the specified [code]segments[/code] to the gizmo's collision shape for picking. Call this function during [method _redraw]. @@ -24,7 +87,7 @@ - Adds collision triangles to the gizmo for picking. A [TriangleMesh] can be generated from a regular [Mesh] too. Call this function during [method redraw]. + Adds collision triangles to the gizmo for picking. A [TriangleMesh] can be generated from a regular [Mesh] too. Call this function during [method _redraw]. @@ -40,7 +103,7 @@ Adds a list of handles (points) which can be used to deform the object being edited. - There are virtual functions which will be called upon editing of these handles. Call this function during [method redraw]. + There are virtual functions which will be called upon editing of these handles. Call this function during [method _redraw]. @@ -55,7 +118,7 @@ - Adds lines to the gizmo (as sets of 2 points), with a given material. The lines are used for visualizing the gizmo. Call this function during [method redraw]. + Adds lines to the gizmo (as sets of 2 points), with a given material. The lines are used for visualizing the gizmo. Call this function during [method _redraw]. @@ -70,7 +133,7 @@ - Adds a mesh to the gizmo with the specified [code]billboard[/code] state, [code]skeleton[/code] and [code]material[/code]. If [code]billboard[/code] is [code]true[/code], the mesh will rotate to always face the camera. Call this function during [method redraw]. + Adds a mesh to the gizmo with the specified [code]billboard[/code] state, [code]skeleton[/code] and [code]material[/code]. If [code]billboard[/code] is [code]true[/code], the mesh will rotate to always face the camera. Call this function during [method _redraw]. @@ -83,7 +146,7 @@ - Adds an unscaled billboard for visualization. Call this function during [method redraw]. + Adds an unscaled billboard for visualization. Call this function during [method _redraw]. @@ -93,39 +156,6 @@ Removes everything in the gizmo including meshes, collisions and handles. - - - - - - - - - - - Commit a handle being edited (handles must have been previously added by [method add_handles]). - If the [code]cancel[/code] parameter is [code]true[/code], an option to restore the edited value to the original is provided. - - - - - - - - - Gets the name of an edited handle (handles must have been previously added by [method add_handles]). - Handles can be named for reference to the user when editing. - - - - - - - - - Gets actual value of a handle. This value can be anything and used for eventually undoing the motion when calling [method commit_handle]. - - @@ -140,36 +170,6 @@ Returns the Node3D node associated with this gizmo. - - - - - - - Returns [code]true[/code] if the handle at index [code]index[/code] is highlighted by being hovered with the mouse. - - - - - - - This function is called when the [Node3D] this gizmo refers to changes (the [method Node3D.update_gizmo] is called). - - - - - - - - - - - - - This function is used when the user drags a gizmo handle (previously added with [method add_handles]) in screen coordinates. - The [Camera3D] is also provided so screen coordinates can be converted to raycasts. - - diff --git a/doc/classes/EditorNode3DGizmoPlugin.xml b/doc/classes/EditorNode3DGizmoPlugin.xml index 34657a1c080..55513265331 100644 --- a/doc/classes/EditorNode3DGizmoPlugin.xml +++ b/doc/classes/EditorNode3DGizmoPlugin.xml @@ -10,25 +10,14 @@ https://docs.godotengine.org/en/latest/tutorials/plugins/editor/spatial_gizmos.html - - - - - - - - - Adds a new material to the internal material list for the plugin. It can then be accessed with [method get_material]. Should not be overridden. - - - + Override this method to define whether the gizmo can be hidden or not. Returns [code]true[/code] if not overridden. - + @@ -43,13 +32,112 @@ Override this method to commit gizmo handles. Called for this plugin's active gizmos. - + - Override this method to return a custom [EditorNode3DGizmo] for the spatial nodes of your choice, return [code]null[/code] for the rest of nodes. See also [method has_gizmo]. + Override this method to return a custom [EditorNode3DGizmo] for the spatial nodes of your choice, return [code]null[/code] for the rest of nodes. See also [method _has_gizmo]. + + + + + + + Override this method to provide the name that will appear in the gizmo visibility menu. + + + + + + + + + + + Override this method to provide gizmo's handle names. Called for this plugin's active gizmos. + + + + + + + + + + + Gets actual value of a handle from gizmo. Called for this plugin's active gizmos. + + + + + + + Override this method to set the gizmo's priority. Higher values correspond to higher priority. If a gizmo with higher priority conflicts with another gizmo, only the gizmo with higher priority will be used. + All built-in editor gizmos return a priority of [code]-1[/code]. If not overridden, this method will return [code]0[/code], which means custom gizmos will automatically override built-in gizmos. + + + + + + + + + Override this method to define which Node3D nodes have a gizmo from this plugin. Whenever a [Node3D] node is added to a scene this method is called, if it returns [code]true[/code] the node gets a generic [EditorNode3DGizmo] assigned and is added to this plugin's list of active gizmos. + + + + + + + + + + + Gets whether a handle is highlighted or not. Called for this plugin's active gizmos. + + + + + + + Override this method to define whether Node3D with this gizmo should be selectable even when the gizmo is hidden. + + + + + + + + + Callback to redraw the provided gizmo. Called for this plugin's active gizmos. + + + + + + + + + + + + + + + Update the value of a handle after it has been updated. Called for this plugin's active gizmos. + + + + + + + + + + + Adds a new material to the internal material list for the plugin. It can then be accessed with [method get_material]. Should not be overridden. @@ -98,35 +186,6 @@ Creates an unshaded material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorNode3DGizmo.add_mesh] and [method EditorNode3DGizmo.add_lines]. Should not be overridden. - - - - - Override this method to provide the name that will appear in the gizmo visibility menu. - - - - - - - - - - - Override this method to provide gizmo's handle names. Called for this plugin's active gizmos. - - - - - - - - - - - Gets actual value of a handle from gizmo. Called for this plugin's active gizmos. - - @@ -138,65 +197,6 @@ Gets material from the internal list of materials. If an [EditorNode3DGizmo] is provided, it will try to get the corresponding variant (selected and/or editable). - - - - - Override this method to set the gizmo's priority. Higher values correspond to higher priority. If a gizmo with higher priority conflicts with another gizmo, only the gizmo with higher priority will be used. - All built-in editor gizmos return a priority of [code]-1[/code]. If not overridden, this method will return [code]0[/code], which means custom gizmos will automatically override built-in gizmos. - - - - - - - - - Override this method to define which Node3D nodes have a gizmo from this plugin. Whenever a [Node3D] node is added to a scene this method is called, if it returns [code]true[/code] the node gets a generic [EditorNode3DGizmo] assigned and is added to this plugin's list of active gizmos. - - - - - - - - - - - Gets whether a handle is highlighted or not. Called for this plugin's active gizmos. - - - - - - - Override this method to define whether Node3D with this gizmo should be selectable even when the gizmo is hidden. - - - - - - - - - Callback to redraw the provided gizmo. Called for this plugin's active gizmos. - - - - - - - - - - - - - - - Update the value of a handle after it has been updated. Called for this plugin's active gizmos. - - diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml index 6c40b7aa9d7..2736414cb17 100644 --- a/doc/classes/EditorPlugin.xml +++ b/doc/classes/EditorPlugin.xml @@ -10,6 +10,330 @@ https://docs.godotengine.org/en/latest/tutorials/plugins/editor/index.html + + + + + This method is called when the editor is about to save the project, switch to another tab, etc. It asks the plugin to apply any pending state changes to ensure consistency. + This is used, for example, in shader editors to let the plugin know that it must apply the shader code being written by the user to the object. + + + + + + + This method is called when the editor is about to run the project. The plugin can then perform required operations before the project runs. + This method must return a boolean. If this method returns [code]false[/code], the project will not run. The run is aborted immediately, so this also prevents all other plugins' [method _build] methods from running. + + + + + + + Clear all the state and reset the object being edited to zero. This ensures your plugin does not keep editing a currently existing node, or a node from the wrong scene. + + + + + + + Called by the engine when the user disables the [EditorPlugin] in the Plugin tab of the project settings window. + + + + + + + + + This function is used for plugins that edit specific object types (nodes or resources). It requests the editor to edit the given object. + + + + + + + Called by the engine when the user enables the [EditorPlugin] in the Plugin tab of the project settings window. + + + + + + + + + Called by the engine when the 2D editor's viewport is updated. Use the [code]overlay[/code] [Control] for drawing. You can update the viewport manually by calling [method update_overlays]. + [codeblocks] + [gdscript] + func _forward_canvas_draw_over_viewport(overlay): + # Draw a circle at cursor position. + overlay.draw_circle(overlay.get_local_mouse_position(), 64, Color.white) + + func _forward_canvas_gui_input(event): + if event is InputEventMouseMotion: + # Redraw viewport when cursor is moved. + update_overlays() + return true + return false + [/gdscript] + [csharp] + public override void ForwardCanvasDrawOverViewport(Godot.Control overlay) + { + // Draw a circle at cursor position. + overlay.DrawCircle(overlay.GetLocalMousePosition(), 64, Colors.White); + } + + public override bool ForwardCanvasGuiInput(InputEvent @event) + { + if (@event is InputEventMouseMotion) + { + // Redraw viewport when cursor is moved. + UpdateOverlays(); + return true; + } + return false; + [/csharp] + [/codeblocks] + + + + + + + + + This method is the same as [method _forward_canvas_draw_over_viewport], except it draws on top of everything. Useful when you need an extra layer that shows over anything else. + You need to enable calling of this method by using [method set_force_draw_over_forwarding_enabled]. + + + + + + + + + Called when there is a root node in the current edited scene, [method _handles] is implemented and an [InputEvent] happens in the 2D viewport. Intercepts the [InputEvent], if [code]return true[/code] [EditorPlugin] consumes the [code]event[/code], otherwise forwards [code]event[/code] to other Editor classes. Example: + [codeblocks] + [gdscript] + # Prevents the InputEvent to reach other Editor classes + func _forward_canvas_gui_input(event): + return true + [/gdscript] + [csharp] + // Prevents the InputEvent to reach other Editor classes + public override bool ForwardCanvasGuiInput(InputEvent @event) + { + return true; + } + [/csharp] + [/codeblocks] + Must [code]return false[/code] in order to forward the [InputEvent] to other Editor classes. Example: + [codeblocks] + [gdscript] + # Consumes InputEventMouseMotion and forwards other InputEvent types. + func _forward_canvas_gui_input(event): + return event is InputEventMouseMotion + [/gdscript] + [csharp] + // Consumes InputEventMouseMotion and forwards other InputEvent types. + public override bool ForwardCanvasGuiInput(InputEvent @event) + { + return @event is InputEventMouseMotion; + } + [/csharp] + [/codeblocks] + + + + + + + + + Called by the engine when the 3D editor's viewport is updated. Use the [code]overlay[/code] [Control] for drawing. You can update the viewport manually by calling [method update_overlays]. + [codeblocks] + [gdscript] + func _forward_spatial_draw_over_viewport(overlay): + # Draw a circle at cursor position. + overlay.draw_circle(overlay.get_local_mouse_position(), 64) + + func _forward_spatial_gui_input(camera, event): + if event is InputEventMouseMotion: + # Redraw viewport when cursor is moved. + update_overlays() + return true + return false + [/gdscript] + [csharp] + public override void ForwardSpatialDrawOverViewport(Godot.Control overlay) + { + // Draw a circle at cursor position. + overlay.DrawCircle(overlay.GetLocalMousePosition(), 64, Colors.White); + } + + public override bool ForwardSpatialGuiInput(Godot.Camera3D camera, InputEvent @event) + { + if (@event is InputEventMouseMotion) + { + // Redraw viewport when cursor is moved. + UpdateOverlays(); + return true; + } + return false; + [/csharp] + [/codeblocks] + + + + + + + + + This method is the same as [method _forward_spatial_draw_over_viewport], except it draws on top of everything. Useful when you need an extra layer that shows over anything else. + You need to enable calling of this method by using [method set_force_draw_over_forwarding_enabled]. + + + + + + + + + + + Called when there is a root node in the current edited scene, [method _handles] is implemented and an [InputEvent] happens in the 3D viewport. Intercepts the [InputEvent], if [code]return true[/code] [EditorPlugin] consumes the [code]event[/code], otherwise forwards [code]event[/code] to other Editor classes. Example: + [codeblocks] + [gdscript] + # Prevents the InputEvent to reach other Editor classes. + func _forward_spatial_gui_input(camera, event): + return true + [/gdscript] + [csharp] + // Prevents the InputEvent to reach other Editor classes. + public override bool ForwardSpatialGuiInput(Camera3D camera, InputEvent @event) + { + return true; + } + [/csharp] + [/codeblocks] + Must [code]return false[/code] in order to forward the [InputEvent] to other Editor classes. Example: + [codeblocks] + [gdscript] + # Consumes InputEventMouseMotion and forwards other InputEvent types. + func _forward_spatial_gui_input(camera, event): + return event is InputEventMouseMotion + [/gdscript] + [csharp] + // Consumes InputEventMouseMotion and forwards other InputEvent types. + public override bool ForwardSpatialGuiInput(Camera3D camera, InputEvent @event) + { + return @event is InputEventMouseMotion; + } + [/csharp] + [/codeblocks] + + + + + + + This is for editors that edit script-based objects. You can return a list of breakpoints in the format ([code]script:line[/code]), for example: [code]res://path_to_script.gd:25[/code]. + + + + + + + Override this method in your plugin to return a [Texture2D] in order to give it an icon. + For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", and "AssetLib" buttons. + Ideally, the plugin icon should be white with a transparent background and 16x16 pixels in size. + [codeblocks] + [gdscript] + func _get_plugin_icon(): + # You can use a custom icon: + return preload("res://addons/my_plugin/my_plugin_icon.svg") + # Or use a built-in icon: + return get_editor_interface().get_base_control().get_icon("Node", "EditorIcons") + [/gdscript] + [csharp] + public override Texture2D GetPluginIcon() + { + // You can use a custom icon: + return ResourceLoader.Load<Texture2D>("res://addons/my_plugin/my_plugin_icon.svg"); + // Or use a built-in icon: + return GetEditorInterface().GetBaseControl().GetIcon("Node", "EditorIcons"); + } + [/csharp] + [/codeblocks] + + + + + + + Override this method in your plugin to provide the name of the plugin when displayed in the Godot editor. + For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", and "AssetLib" buttons. + + + + + + + Gets the state of your plugin editor. This is used when saving the scene (so state is kept when opening it again) and for switching tabs (so state can be restored when the tab returns). + + + + + + + + + Gets the GUI layout of the plugin. This is used to save the project's editor layout when [method queue_save_layout] is called or the editor layout was changed(For example changing the position of a dock). + + + + + + + + + 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_spatial_gui_input] these will be called too. + + + + + + + Returns [code]true[/code] if this is a main screen editor plugin (it goes in the workspace selector together with [b]2D[/b], [b]3D[/b], [b]Script[/b] and [b]AssetLib[/b]). + + + + + + + + + This function will be called when the editor is requested to become visible. It is used for plugins that edit a specific object type. + Remember that you have to manage the visibility of all your editor controls manually. + + + + + + + This method is called after the editor saves the project or when it's closed. It asks the plugin to save edited external scenes/resources. + + + + + + + + + Restore the state saved by [method _get_state]. + + @@ -72,7 +396,7 @@ Adds a custom type, which will appear in the list of nodes or resources. An icon can be optionally passed. When given node or resource is selected, the base type will be instanced (e.g. "Node3D", "Control", "Resource"), then the script will be loaded and set to this object. - You can use the virtual method [method handles] to check if your custom object is being edited by checking the script or using the [code]is[/code] keyword. + You can use the virtual method [method _handles] to check if your custom object is being edited by checking the script or using the [code]is[/code] keyword. During run-time, this will be a simple object with a script so this function does not need to be called then. @@ -188,237 +512,6 @@ The callback should have 4 arguments: [Object] [code]undo_redo[/code], [Object] [code]modified_object[/code], [String] [code]property[/code] and [Variant] [code]new_value[/code]. They are, respectively, the [UndoRedo] object used by the inspector, the currently modified object, the name of the modified property and the new value the property is about to take. - - - - - This method is called when the editor is about to save the project, switch to another tab, etc. It asks the plugin to apply any pending state changes to ensure consistency. - This is used, for example, in shader editors to let the plugin know that it must apply the shader code being written by the user to the object. - - - - - - - This method is called when the editor is about to run the project. The plugin can then perform required operations before the project runs. - This method must return a boolean. If this method returns [code]false[/code], the project will not run. The run is aborted immediately, so this also prevents all other plugins' [method build] methods from running. - - - - - - - Clear all the state and reset the object being edited to zero. This ensures your plugin does not keep editing a currently existing node, or a node from the wrong scene. - - - - - - - Called by the engine when the user disables the [EditorPlugin] in the Plugin tab of the project settings window. - - - - - - - - - This function is used for plugins that edit specific object types (nodes or resources). It requests the editor to edit the given object. - - - - - - - Called by the engine when the user enables the [EditorPlugin] in the Plugin tab of the project settings window. - - - - - - - - - Called by the engine when the 2D editor's viewport is updated. Use the [code]overlay[/code] [Control] for drawing. You can update the viewport manually by calling [method update_overlays]. - [codeblocks] - [gdscript] - func forward_canvas_draw_over_viewport(overlay): - # Draw a circle at cursor position. - overlay.draw_circle(overlay.get_local_mouse_position(), 64, Color.white) - - func forward_canvas_gui_input(event): - if event is InputEventMouseMotion: - # Redraw viewport when cursor is moved. - update_overlays() - return true - return false - [/gdscript] - [csharp] - public override void ForwardCanvasDrawOverViewport(Godot.Control overlay) - { - // Draw a circle at cursor position. - overlay.DrawCircle(overlay.GetLocalMousePosition(), 64, Colors.White); - } - - public override bool ForwardCanvasGuiInput(InputEvent @event) - { - if (@event is InputEventMouseMotion) - { - // Redraw viewport when cursor is moved. - UpdateOverlays(); - return true; - } - return false; - [/csharp] - [/codeblocks] - - - - - - - - - This method is the same as [method forward_canvas_draw_over_viewport], except it draws on top of everything. Useful when you need an extra layer that shows over anything else. - You need to enable calling of this method by using [method set_force_draw_over_forwarding_enabled]. - - - - - - - - - Called when there is a root node in the current edited scene, [method handles] is implemented and an [InputEvent] happens in the 2D viewport. Intercepts the [InputEvent], if [code]return true[/code] [EditorPlugin] consumes the [code]event[/code], otherwise forwards [code]event[/code] to other Editor classes. Example: - [codeblocks] - [gdscript] - # Prevents the InputEvent to reach other Editor classes - func forward_canvas_gui_input(event): - return true - [/gdscript] - [csharp] - // Prevents the InputEvent to reach other Editor classes - public override bool ForwardCanvasGuiInput(InputEvent @event) - { - return true; - } - [/csharp] - [/codeblocks] - Must [code]return false[/code] in order to forward the [InputEvent] to other Editor classes. Example: - [codeblocks] - [gdscript] - # Consumes InputEventMouseMotion and forwards other InputEvent types. - func forward_canvas_gui_input(event): - return event is InputEventMouseMotion - [/gdscript] - [csharp] - // Consumes InputEventMouseMotion and forwards other InputEvent types. - public override bool ForwardCanvasGuiInput(InputEvent @event) - { - return @event is InputEventMouseMotion; - } - [/csharp] - [/codeblocks] - - - - - - - - - Called by the engine when the 3D editor's viewport is updated. Use the [code]overlay[/code] [Control] for drawing. You can update the viewport manually by calling [method update_overlays]. - [codeblocks] - [gdscript] - func forward_spatial_draw_over_viewport(overlay): - # Draw a circle at cursor position. - overlay.draw_circle(overlay.get_local_mouse_position(), 64) - - func forward_spatial_gui_input(camera, event): - if event is InputEventMouseMotion: - # Redraw viewport when cursor is moved. - update_overlays() - return true - return false - [/gdscript] - [csharp] - public override void ForwardSpatialDrawOverViewport(Godot.Control overlay) - { - // Draw a circle at cursor position. - overlay.DrawCircle(overlay.GetLocalMousePosition(), 64, Colors.White); - } - - public override bool ForwardSpatialGuiInput(Godot.Camera3D camera, InputEvent @event) - { - if (@event is InputEventMouseMotion) - { - // Redraw viewport when cursor is moved. - UpdateOverlays(); - return true; - } - return false; - [/csharp] - [/codeblocks] - - - - - - - - - This method is the same as [method forward_spatial_draw_over_viewport], except it draws on top of everything. Useful when you need an extra layer that shows over anything else. - You need to enable calling of this method by using [method set_force_draw_over_forwarding_enabled]. - - - - - - - - - - - Called when there is a root node in the current edited scene, [method handles] is implemented and an [InputEvent] happens in the 3D viewport. Intercepts the [InputEvent], if [code]return true[/code] [EditorPlugin] consumes the [code]event[/code], otherwise forwards [code]event[/code] to other Editor classes. Example: - [codeblocks] - [gdscript] - # Prevents the InputEvent to reach other Editor classes. - func forward_spatial_gui_input(camera, event): - return true - [/gdscript] - [csharp] - // Prevents the InputEvent to reach other Editor classes. - public override bool ForwardSpatialGuiInput(Camera3D camera, InputEvent @event) - { - return true; - } - [/csharp] - [/codeblocks] - Must [code]return false[/code] in order to forward the [InputEvent] to other Editor classes. Example: - [codeblocks] - [gdscript] - # Consumes InputEventMouseMotion and forwards other InputEvent types. - func forward_spatial_gui_input(camera, event): - return event is InputEventMouseMotion - [/gdscript] - [csharp] - // Consumes InputEventMouseMotion and forwards other InputEvent types. - public override bool ForwardSpatialGuiInput(Camera3D camera, InputEvent @event) - { - return @event is InputEventMouseMotion; - } - [/csharp] - [/codeblocks] - - - - - - - This is for editors that edit script-based objects. You can return a list of breakpoints in the format ([code]script:line[/code]), for example: [code]res://path_to_script.gd:25[/code]. - - @@ -426,41 +519,6 @@ Returns the [EditorInterface] object that gives you control over Godot editor's window and its functionalities. - - - - - Override this method in your plugin to return a [Texture2D] in order to give it an icon. - For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", and "AssetLib" buttons. - Ideally, the plugin icon should be white with a transparent background and 16x16 pixels in size. - [codeblocks] - [gdscript] - func get_plugin_icon(): - # You can use a custom icon: - return preload("res://addons/my_plugin/my_plugin_icon.svg") - # Or use a built-in icon: - return get_editor_interface().get_base_control().get_icon("Node", "EditorIcons") - [/gdscript] - [csharp] - public override Texture2D GetPluginIcon() - { - // You can use a custom icon: - return ResourceLoader.Load<Texture2D>("res://addons/my_plugin/my_plugin_icon.svg"); - // Or use a built-in icon: - return GetEditorInterface().GetBaseControl().GetIcon("Node", "EditorIcons"); - } - [/csharp] - [/codeblocks] - - - - - - - Override this method in your plugin to provide the name of the plugin when displayed in the Godot editor. - For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", and "AssetLib" buttons. - - @@ -469,13 +527,6 @@ [b]Note:[/b] Users can configure it before use. - - - - - Gets the state of your plugin editor. This is used when saving the scene (so state is kept when opening it again) and for switching tabs (so state can be restored when the tab returns). - - @@ -483,31 +534,6 @@ Gets the undo/redo object. Most actions in the editor can be undoable, so use this object to make sure this happens when it's worth it. - - - - - - - Gets the GUI layout of the plugin. This is used to save the project's editor layout when [method queue_save_layout] is called or the editor layout was changed(For example changing the position of a dock). - - - - - - - - - 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_spatial_gui_input] these will be called too. - - - - - - - Returns [code]true[/code] if this is a main screen editor plugin (it goes in the workspace selector together with [b]2D[/b], [b]3D[/b], [b]Script[/b] and [b]AssetLib[/b]). - - @@ -522,16 +548,6 @@ - - - - - - - This function will be called when the editor is requested to become visible. It is used for plugins that edit a specific object type. - Remember that you have to manage the visibility of all your editor controls manually. - - @@ -667,34 +683,18 @@ Removes a callback previsously added by [method add_undo_redo_inspector_hook_callback]. - - - - - This method is called after the editor saves the project or when it's closed. It asks the plugin to save edited external scenes/resources. - - - Enables calling of [method forward_canvas_force_draw_over_viewport] for the 2D editor and [method forward_spatial_force_draw_over_viewport] for the 3D editor when their viewports are updated. You need to call this method only once and it will work permanently for this plugin. + Enables calling of [method _forward_canvas_force_draw_over_viewport] for the 2D editor and [method _forward_spatial_force_draw_over_viewport] for the 3D editor when their viewports are updated. You need to call this method only once and it will work permanently for this plugin. - Use this method if you always want to receive inputs from 3D view screen inside [method forward_spatial_gui_input]. It might be especially usable if your plugin will want to use raycast in the scene. - - - - - - - - - Restore the state saved by [method get_state]. + Use this method if you always want to receive inputs from 3D view screen inside [method _forward_spatial_gui_input]. It might be especially usable if your plugin will want to use raycast in the scene. @@ -703,14 +703,14 @@ - Restore the plugin GUI layout saved by [method get_window_layout]. + Restore the plugin GUI layout saved by [method _get_window_layout]. - Updates the overlays of the 2D and 3D editor viewport. Causes methods [method forward_canvas_draw_over_viewport], [method forward_canvas_force_draw_over_viewport], [method forward_spatial_draw_over_viewport] and [method forward_spatial_force_draw_over_viewport] to be called. + Updates the overlays of the 2D and 3D editor viewport. Causes methods [method _forward_canvas_draw_over_viewport], [method _forward_canvas_force_draw_over_viewport], [method _forward_spatial_draw_over_viewport] and [method _forward_spatial_force_draw_over_viewport] to be called. diff --git a/doc/classes/EditorProperty.xml b/doc/classes/EditorProperty.xml index fd9fae435b6..549d2c1628b 100644 --- a/doc/classes/EditorProperty.xml +++ b/doc/classes/EditorProperty.xml @@ -9,6 +9,13 @@ + + + + + When this virtual function is called, you must update your editor. + + @@ -44,7 +51,7 @@ - Gets the edited property. If your editor is for a single property (added via [method EditorInspectorPlugin.parse_property]), then this will return the property. + Gets the edited property. If your editor is for a single property (added via [method EditorInspectorPlugin._parse_property]), then this will return the property. @@ -63,13 +70,6 @@ Adds controls with this function if you want them on the bottom (below the label). - - - - - When this virtual function is called, you must update your editor. - - @@ -101,7 +101,7 @@ - Emit it if you want multiple properties modified at the same time. Do not use if added via [method EditorInspectorPlugin.parse_property]. + Emit it if you want multiple properties modified at the same time. Do not use if added via [method EditorInspectorPlugin._parse_property]. diff --git a/doc/classes/EditorResourcePicker.xml b/doc/classes/EditorResourcePicker.xml index 30c73daa77b..508b546ef3d 100644 --- a/doc/classes/EditorResourcePicker.xml +++ b/doc/classes/EditorResourcePicker.xml @@ -10,30 +10,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - @@ -41,16 +17,6 @@ Returns a list of all allowed types and subtypes corresponding to the [member base_type]. If the [member base_type] is empty, an empty list is returned. - - - - - - - - - - diff --git a/doc/classes/EditorResourcePreviewGenerator.xml b/doc/classes/EditorResourcePreviewGenerator.xml index c191c9db123..3594474e361 100644 --- a/doc/classes/EditorResourcePreviewGenerator.xml +++ b/doc/classes/EditorResourcePreviewGenerator.xml @@ -9,15 +9,15 @@ - + - If this function returns [code]true[/code], the generator will call [method generate] or [method generate_from_path] for small previews as well. + If this function returns [code]true[/code], the generator will call [method _generate] or [method _generate_from_path] for small previews as well. By default, it returns [code]false[/code]. - + @@ -30,7 +30,7 @@ Care must be taken because this function is always called from a thread (not the main thread). - + @@ -38,20 +38,20 @@ - Generate a preview directly from a path with the specified size. Implementing this is optional, as default code will load and call [method generate]. + Generate a preview directly from a path with the specified size. Implementing this is optional, as default code will load and call [method _generate]. Returning an empty texture is an OK way to fail and let another generator take care. Care must be taken because this function is always called from a thread (not the main thread). - + - If this function returns [code]true[/code], the generator will automatically generate the small previews from the normal preview texture generated by the methods [method generate] or [method generate_from_path]. + If this function returns [code]true[/code], the generator will automatically generate the small previews from the normal preview texture generated by the methods [method _generate] or [method _generate_from_path]. By default, it returns [code]false[/code]. - + diff --git a/doc/classes/EditorScenePostImport.xml b/doc/classes/EditorScenePostImport.xml index 789366c2a4c..d2b5e84ff76 100644 --- a/doc/classes/EditorScenePostImport.xml +++ b/doc/classes/EditorScenePostImport.xml @@ -5,14 +5,14 @@ Imported scenes can be automatically modified right after import by setting their [b]Custom Script[/b] Import property to a [code]tool[/code] script that inherits from this class. - The [method post_import] callback receives the imported scene's root node and returns the modified version of the scene. Usage example: + The [method _post_import] callback receives the imported scene's root node and returns the modified version of the scene. Usage example: [codeblocks] [gdscript] tool # Needed so it runs in editor. extends EditorScenePostImport # This sample changes all node names. # Called right after the scene is imported and gets the root node. - func post_import(scene): + func _post_import(scene): # Change all node names to "modified_[oldnodename]" iterate(scene) return scene # Remember to return the imported scene @@ -55,14 +55,7 @@ https://docs.godotengine.org/en/latest/getting_started/workflow/assets/importing_scenes.html#custom-script - - - - - Returns the source file path which got imported (e.g. [code]res://scene.dae[/code]). - - - + @@ -71,6 +64,13 @@ Called after the scene was imported. This method must return the modified version of the scene. + + + + + Returns the source file path which got imported (e.g. [code]res://scene.dae[/code]). + + diff --git a/doc/classes/EditorSyntaxHighlighter.xml b/doc/classes/EditorSyntaxHighlighter.xml index b80e81928f3..d81b25345f4 100644 --- a/doc/classes/EditorSyntaxHighlighter.xml +++ b/doc/classes/EditorSyntaxHighlighter.xml @@ -5,7 +5,7 @@ Base syntax highlighter resource all editor syntax highlighters extend from, it is used in the [ScriptEditor]. - Add a syntax highlighter to an individual script by calling [method ScriptEditorBase.add_syntax_highlighter]. To apply to all scripts on open, call [method ScriptEditor.register_syntax_highlighter] + Add a syntax highlighter to an individual script by calling [method ScriptEditorBase._add_syntax_highlighter]. To apply to all scripts on open, call [method ScriptEditor.register_syntax_highlighter] diff --git a/doc/classes/EditorTranslationParserPlugin.xml b/doc/classes/EditorTranslationParserPlugin.xml index 349d2ec9340..a9f4e90e726 100644 --- a/doc/classes/EditorTranslationParserPlugin.xml +++ b/doc/classes/EditorTranslationParserPlugin.xml @@ -4,7 +4,7 @@ Plugin for adding custom parsers to extract strings that are to be translated from custom files (.csv, .json etc.). - Plugins are registered via [method EditorPlugin.add_translation_parser_plugin] method. To define the parsing and string extraction logic, override the [method parse_file] method in script. + Plugins are registered via [method EditorPlugin.add_translation_parser_plugin] method. To define the parsing and string extraction logic, override the [method _parse_file] method in script. Add the extracted strings to argument [code]msgids[/code] or [code]msgids_context_plural[/code] if context or plural is used. When adding to [code]msgids_context_plural[/code], you must add the data using the format [code]["A", "B", "C"][/code], where [code]A[/code] represents the extracted string, [code]B[/code] represents the context, and [code]C[/code] represents the plural version of the extracted string. If you want to add only context but not plural, put [code]""[/code] for the plural slot. The idea is the same if you only want to add plural but not context. See the code below for concrete examples. The extracted strings will be written into a POT file selected by user under "POT Generation" in "Localization" tab in "Project Settings" menu. @@ -14,7 +14,7 @@ tool extends EditorTranslationParserPlugin - func parse_file(path, msgids, msgids_context_plural): + func _parse_file(path, msgids, msgids_context_plural): var file = File.new() file.open(path, File.READ) var text = file.get_as_text() @@ -23,7 +23,7 @@ msgids.append(s) #print("Extracted string: " + s) - func get_recognized_extensions(): + func _get_recognized_extensions(): return ["csv"] [/gdscript] [csharp] @@ -76,12 +76,12 @@ For example: [codeblocks] [gdscript] - func parse_file(path, msgids, msgids_context_plural): + func _parse_file(path, msgids, msgids_context_plural): var res = ResourceLoader.load(path, "Script") var text = res.source_code # Parsing logic. - func get_recognized_extensions(): + func _get_recognized_extensions(): return ["gd"] [/gdscript] [csharp] @@ -102,14 +102,14 @@ - + Gets the list of file extensions to associate with this parser, e.g. [code]["csv"][/code]. - + diff --git a/doc/classes/FileSystemDock.xml b/doc/classes/FileSystemDock.xml index c553f90e37b..15f92e90e37 100644 --- a/doc/classes/FileSystemDock.xml +++ b/doc/classes/FileSystemDock.xml @@ -7,40 +7,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/classes/ResourceFormatLoader.xml b/doc/classes/ResourceFormatLoader.xml index aed194095bb..6abe5c813b4 100644 --- a/doc/classes/ResourceFormatLoader.xml +++ b/doc/classes/ResourceFormatLoader.xml @@ -11,7 +11,7 @@ - + @@ -23,14 +23,14 @@ [b]Note:[/b] Custom resource types defined by scripts aren't known by the [ClassDB], so you might just return [code]"Resource"[/code] for them. - + Gets the list of extensions for files this loader is able to read. - + @@ -40,7 +40,7 @@ [b]Note:[/b] Custom resource types defined by scripts aren't known by the [ClassDB], so you might just return [code]"Resource"[/code] for them. - + @@ -50,7 +50,7 @@ [b]Note:[/b] Custom resource types defined by scripts aren't known by the [ClassDB], so you might just handle [code]"Resource"[/code] for them. - + @@ -66,7 +66,7 @@ The [code]cache_mode[/code] property defines whether and how the cache should be used or updated when loading the resource. See [enum CacheMode] for details. - + diff --git a/doc/classes/ResourceFormatSaver.xml b/doc/classes/ResourceFormatSaver.xml index edbf8d73f85..df71e05d025 100644 --- a/doc/classes/ResourceFormatSaver.xml +++ b/doc/classes/ResourceFormatSaver.xml @@ -10,16 +10,16 @@ - + - Returns the list of extensions available for saving the resource object, provided it is recognized (see [method recognize]). + Returns the list of extensions available for saving the resource object, provided it is recognized (see [method _recognize]). - + @@ -28,7 +28,7 @@ Returns whether the given resource object can be saved by this saver. - + diff --git a/doc/classes/ScriptEditor.xml b/doc/classes/ScriptEditor.xml index 28620bd29bc..31dbf7453fe 100644 --- a/doc/classes/ScriptEditor.xml +++ b/doc/classes/ScriptEditor.xml @@ -9,30 +9,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - @@ -47,16 +23,6 @@ Returns a [Script] that is currently active in editor. - - - - - - - - - - diff --git a/doc/classes/ScriptEditorBase.xml b/doc/classes/ScriptEditorBase.xml index e5c4c324504..a135062bd8a 100644 --- a/doc/classes/ScriptEditorBase.xml +++ b/doc/classes/ScriptEditorBase.xml @@ -9,7 +9,7 @@ - + diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml index c31467c67e4..fe83bf9c2d0 100644 --- a/doc/classes/Tree.xml +++ b/doc/classes/Tree.xml @@ -361,7 +361,7 @@ The number of columns. - The drop mode as an OR combination of flags. See [enum DropModeFlags] constants. Once dropping is done, reverts to [constant DROP_MODE_DISABLED]. Setting this during [method Control.can_drop_data] is recommended. + The drop mode as an OR combination of flags. See [enum DropModeFlags] constants. Once dropping is done, reverts to [constant DROP_MODE_DISABLED]. Setting this during [method Control._can_drop_data] is recommended. This controls the drop sections, i.e. the decision and drawing of possible drop locations based on the mouse position. diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 2f3782c517d..96d63b27ad4 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -111,7 +111,7 @@ - Returns the drag data from the GUI, that was previously returned by [method Control.get_drag_data]. + Returns the drag data from the GUI, that was previously returned by [method Control._get_drag_data]. diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp index d195561a852..cc07d589c50 100644 --- a/editor/action_map_editor.cpp +++ b/editor/action_map_editor.cpp @@ -969,9 +969,9 @@ void ActionMapEditor::_notification(int p_what) { } void ActionMapEditor::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &ActionMapEditor::get_drag_data_fw); - ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &ActionMapEditor::can_drop_data_fw); - ClassDB::bind_method(D_METHOD("drop_data_fw"), &ActionMapEditor::drop_data_fw); + ClassDB::bind_method(D_METHOD("_get_drag_data_fw"), &ActionMapEditor::get_drag_data_fw); + ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &ActionMapEditor::can_drop_data_fw); + ClassDB::bind_method(D_METHOD("_drop_data_fw"), &ActionMapEditor::drop_data_fw); ADD_SIGNAL(MethodInfo("action_added", PropertyInfo(Variant::STRING, "name"))); ADD_SIGNAL(MethodInfo("action_edited", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::DICTIONARY, "new_action"))); diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 1c0a55e4eca..968b24893c3 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -643,9 +643,9 @@ void CreateDialog::_load_favorites_and_history() { void CreateDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("_save_and_update_favorite_list"), &CreateDialog::_save_and_update_favorite_list); - ClassDB::bind_method("get_drag_data_fw", &CreateDialog::get_drag_data_fw); - ClassDB::bind_method("can_drop_data_fw", &CreateDialog::can_drop_data_fw); - ClassDB::bind_method("drop_data_fw", &CreateDialog::drop_data_fw); + ClassDB::bind_method("_get_drag_data_fw", &CreateDialog::get_drag_data_fw); + ClassDB::bind_method("_can_drop_data_fw", &CreateDialog::can_drop_data_fw); + ClassDB::bind_method("_drop_data_fw", &CreateDialog::drop_data_fw); ADD_SIGNAL(MethodInfo("create")); ADD_SIGNAL(MethodInfo("favorites_updated")); diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 4317760379a..13296e2f239 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -757,9 +757,9 @@ void EditorAudioBus::_bind_methods() { ClassDB::bind_method("update_bus", &EditorAudioBus::update_bus); ClassDB::bind_method("update_send", &EditorAudioBus::update_send); ClassDB::bind_method("_gui_input", &EditorAudioBus::_gui_input); - ClassDB::bind_method("get_drag_data_fw", &EditorAudioBus::get_drag_data_fw); - ClassDB::bind_method("can_drop_data_fw", &EditorAudioBus::can_drop_data_fw); - ClassDB::bind_method("drop_data_fw", &EditorAudioBus::drop_data_fw); + ClassDB::bind_method("_get_drag_data_fw", &EditorAudioBus::get_drag_data_fw); + ClassDB::bind_method("_can_drop_data_fw", &EditorAudioBus::can_drop_data_fw); + ClassDB::bind_method("_drop_data_fw", &EditorAudioBus::drop_data_fw); ADD_SIGNAL(MethodInfo("duplicate_request")); ADD_SIGNAL(MethodInfo("delete_request")); diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index d46df05f6e8..a39e693912d 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -749,9 +749,9 @@ void EditorAutoloadSettings::autoload_remove(const String &p_name) { void EditorAutoloadSettings::_bind_methods() { ClassDB::bind_method("_autoload_open", &EditorAutoloadSettings::_autoload_open); - ClassDB::bind_method("get_drag_data_fw", &EditorAutoloadSettings::get_drag_data_fw); - ClassDB::bind_method("can_drop_data_fw", &EditorAutoloadSettings::can_drop_data_fw); - ClassDB::bind_method("drop_data_fw", &EditorAutoloadSettings::drop_data_fw); + ClassDB::bind_method("_get_drag_data_fw", &EditorAutoloadSettings::get_drag_data_fw); + ClassDB::bind_method("_can_drop_data_fw", &EditorAutoloadSettings::can_drop_data_fw); + ClassDB::bind_method("_drop_data_fw", &EditorAutoloadSettings::drop_data_fw); ClassDB::bind_method("update_autoload", &EditorAutoloadSettings::update_autoload); ClassDB::bind_method("autoload_add", &EditorAutoloadSettings::autoload_add); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 20abe72750a..69709315ff8 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -380,7 +380,7 @@ StringName EditorProperty::get_edited_property() { void EditorProperty::update_property() { if (get_script_instance()) { - get_script_instance()->call("update_property"); + get_script_instance()->call("_update_property"); } } @@ -753,7 +753,7 @@ void EditorProperty::_gui_input(const Ref &p_event) { call_deferred("emit_changed", property, object->get(property).operator int64_t() + 1, "", false); } - call_deferred("update_property"); + call_deferred("_update_property"); } } if (delete_rect.has_point(mpos)) { @@ -965,9 +965,7 @@ void EditorProperty::_bind_methods() { ADD_SIGNAL(MethodInfo("object_id_selected", PropertyInfo(Variant::STRING_NAME, "property"), PropertyInfo(Variant::INT, "id"))); ADD_SIGNAL(MethodInfo("selected", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::INT, "focusable_idx"))); - MethodInfo vm; - vm.name = "update_property"; - BIND_VMETHOD(vm); + BIND_VMETHOD(MethodInfo("_update_property")); } EditorProperty::EditorProperty() { @@ -1023,20 +1021,20 @@ void EditorInspectorPlugin::add_property_editor_for_multiple_properties(const St bool EditorInspectorPlugin::can_handle(Object *p_object) { if (get_script_instance()) { - return get_script_instance()->call("can_handle", p_object); + return get_script_instance()->call("_can_handle", p_object); } return false; } void EditorInspectorPlugin::parse_begin(Object *p_object) { if (get_script_instance()) { - get_script_instance()->call("parse_begin", p_object); + get_script_instance()->call("_parse_begin", p_object); } } void EditorInspectorPlugin::parse_category(Object *p_object, const String &p_parse_category) { if (get_script_instance()) { - get_script_instance()->call("parse_category", p_object, p_parse_category); + get_script_instance()->call("_parse_category", p_object, p_parse_category); } } @@ -1050,14 +1048,14 @@ bool EditorInspectorPlugin::parse_property(Object *p_object, Variant::Type p_typ }; Callable::CallError err; - return get_script_instance()->call("parse_property", (const Variant **)&argptr, 6, err); + return get_script_instance()->call("_parse_property", (const Variant **)&argptr, 6, err); } return false; } void EditorInspectorPlugin::parse_end() { if (get_script_instance()) { - get_script_instance()->call("parse_end"); + get_script_instance()->call("_parse_end"); } } @@ -1066,30 +1064,11 @@ void EditorInspectorPlugin::_bind_methods() { ClassDB::bind_method(D_METHOD("add_property_editor", "property", "editor"), &EditorInspectorPlugin::add_property_editor); ClassDB::bind_method(D_METHOD("add_property_editor_for_multiple_properties", "label", "properties", "editor"), &EditorInspectorPlugin::add_property_editor_for_multiple_properties); - MethodInfo vm; - vm.name = "can_handle"; - vm.return_val.type = Variant::BOOL; - vm.arguments.push_back(PropertyInfo(Variant::OBJECT, "object")); - BIND_VMETHOD(vm); - vm.name = "parse_begin"; - vm.return_val.type = Variant::NIL; - BIND_VMETHOD(vm); - vm.name = "parse_category"; - vm.arguments.push_back(PropertyInfo(Variant::STRING, "category")); - BIND_VMETHOD(vm); - vm.arguments.pop_back(); - vm.name = "parse_property"; - vm.return_val.type = Variant::BOOL; - vm.arguments.push_back(PropertyInfo(Variant::INT, "type")); - vm.arguments.push_back(PropertyInfo(Variant::STRING, "path")); - vm.arguments.push_back(PropertyInfo(Variant::INT, "hint")); - vm.arguments.push_back(PropertyInfo(Variant::STRING, "hint_text")); - vm.arguments.push_back(PropertyInfo(Variant::INT, "usage")); - BIND_VMETHOD(vm); - vm.arguments.clear(); - vm.name = "parse_end"; - vm.return_val.type = Variant::NIL; - BIND_VMETHOD(vm); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_can_handle", PropertyInfo(Variant::OBJECT, "object"))); + BIND_VMETHOD(MethodInfo(Variant::NIL, "_parse_begin")); + BIND_VMETHOD(MethodInfo(Variant::NIL, "_parse_category", PropertyInfo(Variant::STRING, "category"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_parse_property", PropertyInfo(Variant::INT, "type"), PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::INT, "hint"), PropertyInfo(Variant::STRING, "hint_text"), PropertyInfo(Variant::INT, "usage"))); + BIND_VMETHOD(MethodInfo(Variant::NIL, "_parse_end")); } //////////////////////////////////////////////// @@ -1290,7 +1269,7 @@ void EditorInspectorSection::_notification(int p_what) { Control *editor_property = Object::cast_to(vbox->get_child(child_idx)); // Test can_drop_data and can_drop_data_fw, since can_drop_data only works if set up with forwarding or if script attached. - if (editor_property && (editor_property->can_drop_data(Point2(), dd) || editor_property->call("can_drop_data_fw", Point2(), dd, this))) { + if (editor_property && (editor_property->can_drop_data(Point2(), dd) || editor_property->call("_can_drop_data_fw", Point2(), dd, this))) { children_can_drop = true; break; } diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index a12bf036bc7..091c5bea442 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -553,21 +553,21 @@ void EditorPlugin::notify_resource_saved(const Ref &p_resource) { } bool EditorPlugin::forward_canvas_gui_input(const Ref &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 &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 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(); } 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(Object::cast_to(p_object))); + get_script_instance()->call("_edit", Ref(Object::cast_to(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 *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 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 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"))); diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index bfa85f4aabc..66fabcd9400 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -567,8 +567,8 @@ void EditorPropertyArray::setup(Variant::Type p_array_type, const String &p_hint } void EditorPropertyArray::_bind_methods() { - ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &EditorPropertyArray::can_drop_data_fw); - ClassDB::bind_method(D_METHOD("drop_data_fw"), &EditorPropertyArray::drop_data_fw); + ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &EditorPropertyArray::can_drop_data_fw); + ClassDB::bind_method(D_METHOD("_drop_data_fw"), &EditorPropertyArray::drop_data_fw); } EditorPropertyArray::EditorPropertyArray() { diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index d1a0bfeded0..495e43577cf 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -625,9 +625,9 @@ void EditorResourcePicker::drop_data_fw(const Point2 &p_point, const Variant &p_ void EditorResourcePicker::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_resource_preview"), &EditorResourcePicker::_update_resource_preview); - ClassDB::bind_method(D_METHOD("get_drag_data_fw", "position", "from"), &EditorResourcePicker::get_drag_data_fw); - ClassDB::bind_method(D_METHOD("can_drop_data_fw", "position", "data", "from"), &EditorResourcePicker::can_drop_data_fw); - ClassDB::bind_method(D_METHOD("drop_data_fw", "position", "data", "from"), &EditorResourcePicker::drop_data_fw); + ClassDB::bind_method(D_METHOD("_get_drag_data_fw", "position", "from"), &EditorResourcePicker::get_drag_data_fw); + ClassDB::bind_method(D_METHOD("_can_drop_data_fw", "position", "data", "from"), &EditorResourcePicker::can_drop_data_fw); + ClassDB::bind_method(D_METHOD("_drop_data_fw", "position", "data", "from"), &EditorResourcePicker::drop_data_fw); ClassDB::bind_method(D_METHOD("set_base_type", "base_type"), &EditorResourcePicker::set_base_type); ClassDB::bind_method(D_METHOD("get_base_type"), &EditorResourcePicker::get_base_type); diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index d9520e0aa85..0f1b70936ac 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -40,22 +40,22 @@ #include "editor_settings.h" bool EditorResourcePreviewGenerator::handles(const String &p_type) const { - if (get_script_instance() && get_script_instance()->has_method("handles")) { - return get_script_instance()->call("handles", p_type); + if (get_script_instance() && get_script_instance()->has_method("_handles")) { + return get_script_instance()->call("_handles", p_type); } - ERR_FAIL_V_MSG(false, "EditorResourcePreviewGenerator::handles needs to be overridden."); + ERR_FAIL_V_MSG(false, "EditorResourcePreviewGenerator::_handles needs to be overridden."); } Ref EditorResourcePreviewGenerator::generate(const RES &p_from, const Size2 &p_size) const { - if (get_script_instance() && get_script_instance()->has_method("generate")) { - return get_script_instance()->call("generate", p_from, p_size); + if (get_script_instance() && get_script_instance()->has_method("_generate")) { + return get_script_instance()->call("_generate", p_from, p_size); } - ERR_FAIL_V_MSG(Ref(), "EditorResourcePreviewGenerator::generate needs to be overridden."); + ERR_FAIL_V_MSG(Ref(), "EditorResourcePreviewGenerator::_generate needs to be overridden."); } Ref EditorResourcePreviewGenerator::generate_from_path(const String &p_path, const Size2 &p_size) const { - if (get_script_instance() && get_script_instance()->has_method("generate_from_path")) { - return get_script_instance()->call("generate_from_path", p_path, p_size); + if (get_script_instance() && get_script_instance()->has_method("_generate_from_path")) { + return get_script_instance()->call("_generate_from_path", p_path, p_size); } RES res = ResourceLoader::load(p_path); @@ -66,27 +66,27 @@ Ref EditorResourcePreviewGenerator::generate_from_path(const String & } bool EditorResourcePreviewGenerator::generate_small_preview_automatically() const { - if (get_script_instance() && get_script_instance()->has_method("generate_small_preview_automatically")) { - return get_script_instance()->call("generate_small_preview_automatically"); + if (get_script_instance() && get_script_instance()->has_method("_generate_small_preview_automatically")) { + return get_script_instance()->call("_generate_small_preview_automatically"); } return false; } bool EditorResourcePreviewGenerator::can_generate_small_preview() const { - if (get_script_instance() && get_script_instance()->has_method("can_generate_small_preview")) { - return get_script_instance()->call("can_generate_small_preview"); + if (get_script_instance() && get_script_instance()->has_method("_can_generate_small_preview")) { + return get_script_instance()->call("_can_generate_small_preview"); } return false; } void EditorResourcePreviewGenerator::_bind_methods() { - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "handles", PropertyInfo(Variant::STRING, "type"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(CLASS_INFO(Texture2D), "generate", PropertyInfo(Variant::OBJECT, "from", PROPERTY_HINT_RESOURCE_TYPE, "Resource"), PropertyInfo(Variant::VECTOR2, "size"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(CLASS_INFO(Texture2D), "generate_from_path", PropertyInfo(Variant::STRING, "path", PROPERTY_HINT_FILE), PropertyInfo(Variant::VECTOR2, "size"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "generate_small_preview_automatically")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "can_generate_small_preview")); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_handles", PropertyInfo(Variant::STRING, "type"))); + BIND_VMETHOD(MethodInfo(CLASS_INFO(Texture2D), "_generate", PropertyInfo(Variant::OBJECT, "from", PROPERTY_HINT_RESOURCE_TYPE, "Resource"), PropertyInfo(Variant::VECTOR2, "size"))); + BIND_VMETHOD(MethodInfo(CLASS_INFO(Texture2D), "_generate_from_path", PropertyInfo(Variant::STRING, "path", PROPERTY_HINT_FILE), PropertyInfo(Variant::VECTOR2, "size"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_generate_small_preview_automatically")); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_can_generate_small_preview")); } EditorResourcePreviewGenerator::EditorResourcePreviewGenerator() { diff --git a/editor/editor_translation_parser.cpp b/editor/editor_translation_parser.cpp index 75bdfa47964..27d428e6829 100644 --- a/editor/editor_translation_parser.cpp +++ b/editor/editor_translation_parser.cpp @@ -42,10 +42,10 @@ Error EditorTranslationParserPlugin::parse_file(const String &p_path, Vectorhas_method("parse_file")) { + if (get_script_instance()->has_method("_parse_file")) { Array ids; Array ids_ctx_plural; - get_script_instance()->call("parse_file", p_path, ids, ids_ctx_plural); + get_script_instance()->call("_parse_file", p_path, ids, ids_ctx_plural); // Add user's extracted translatable messages. for (int i = 0; i < ids.size(); i++) { @@ -75,8 +75,8 @@ void EditorTranslationParserPlugin::get_recognized_extensions(List *r_ex return; } - if (get_script_instance()->has_method("get_recognized_extensions")) { - Array extensions = get_script_instance()->call("get_recognized_extensions"); + if (get_script_instance()->has_method("_get_recognized_extensions")) { + Array extensions = get_script_instance()->call("_get_recognized_extensions"); for (int i = 0; i < extensions.size(); i++) { r_extensions->push_back(extensions[i]); } @@ -86,8 +86,8 @@ void EditorTranslationParserPlugin::get_recognized_extensions(List *r_ex } void EditorTranslationParserPlugin::_bind_methods() { - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::NIL, "parse_file", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::ARRAY, "msgids"), PropertyInfo(Variant::ARRAY, "msgids_context_plural"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::ARRAY, "get_recognized_extensions")); + BIND_VMETHOD(MethodInfo(Variant::NIL, "_parse_file", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::ARRAY, "msgids"), PropertyInfo(Variant::ARRAY, "msgids_context_plural"))); + BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_recognized_extensions")); } ///////////////////////// diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index bd1aaf76113..9efdd20499f 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -2751,9 +2751,9 @@ void FileSystemDock::_bind_methods() { ClassDB::bind_method(D_METHOD("_tree_thumbnail_done"), &FileSystemDock::_tree_thumbnail_done); ClassDB::bind_method(D_METHOD("_select_file"), &FileSystemDock::_select_file); - ClassDB::bind_method(D_METHOD("get_drag_data_fw", "position", "from"), &FileSystemDock::get_drag_data_fw); - ClassDB::bind_method(D_METHOD("can_drop_data_fw", "position", "data", "from"), &FileSystemDock::can_drop_data_fw); - ClassDB::bind_method(D_METHOD("drop_data_fw", "position", "data", "from"), &FileSystemDock::drop_data_fw); + ClassDB::bind_method(D_METHOD("_get_drag_data_fw", "position", "from"), &FileSystemDock::get_drag_data_fw); + ClassDB::bind_method(D_METHOD("_can_drop_data_fw", "position", "data", "from"), &FileSystemDock::can_drop_data_fw); + ClassDB::bind_method(D_METHOD("_drop_data_fw", "position", "data", "from"), &FileSystemDock::drop_data_fw); ClassDB::bind_method(D_METHOD("navigate_to_path", "path"), &FileSystemDock::navigate_to_path); ClassDB::bind_method(D_METHOD("_update_import_dock"), &FileSystemDock::_update_import_dock); diff --git a/editor/import/editor_import_plugin.cpp b/editor/import/editor_import_plugin.cpp index 44aff874eb6..8660289c405 100644 --- a/editor/import/editor_import_plugin.cpp +++ b/editor/import/editor_import_plugin.cpp @@ -35,63 +35,63 @@ EditorImportPlugin::EditorImportPlugin() { } String EditorImportPlugin::get_importer_name() const { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_importer_name")), ""); - return get_script_instance()->call("get_importer_name"); + ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_get_importer_name")), ""); + return get_script_instance()->call("_get_importer_name"); } String EditorImportPlugin::get_visible_name() const { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_visible_name")), ""); - return get_script_instance()->call("get_visible_name"); + ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_get_visible_name")), ""); + return get_script_instance()->call("_get_visible_name"); } void EditorImportPlugin::get_recognized_extensions(List *p_extensions) const { - ERR_FAIL_COND(!(get_script_instance() && get_script_instance()->has_method("get_recognized_extensions"))); - Array extensions = get_script_instance()->call("get_recognized_extensions"); + ERR_FAIL_COND(!(get_script_instance() && get_script_instance()->has_method("_get_recognized_extensions"))); + Array extensions = get_script_instance()->call("_get_recognized_extensions"); for (int i = 0; i < extensions.size(); i++) { p_extensions->push_back(extensions[i]); } } String EditorImportPlugin::get_preset_name(int p_idx) const { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_preset_name")), ""); - return get_script_instance()->call("get_preset_name", p_idx); + ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_get_preset_name")), ""); + return get_script_instance()->call("_get_preset_name", p_idx); } int EditorImportPlugin::get_preset_count() const { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_preset_count")), 0); - return get_script_instance()->call("get_preset_count"); + ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_get_preset_count")), 0); + return get_script_instance()->call("_get_preset_count"); } String EditorImportPlugin::get_save_extension() const { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_save_extension")), ""); - return get_script_instance()->call("get_save_extension"); + ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_get_save_extension")), ""); + return get_script_instance()->call("_get_save_extension"); } String EditorImportPlugin::get_resource_type() const { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_resource_type")), ""); - return get_script_instance()->call("get_resource_type"); + ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_get_resource_type")), ""); + return get_script_instance()->call("_get_resource_type"); } float EditorImportPlugin::get_priority() const { - if (!(get_script_instance() && get_script_instance()->has_method("get_priority"))) { + if (!(get_script_instance() && get_script_instance()->has_method("_get_priority"))) { return ResourceImporter::get_priority(); } - return get_script_instance()->call("get_priority"); + return get_script_instance()->call("_get_priority"); } int EditorImportPlugin::get_import_order() const { - if (!(get_script_instance() && get_script_instance()->has_method("get_import_order"))) { + if (!(get_script_instance() && get_script_instance()->has_method("_get_import_order"))) { return ResourceImporter::get_import_order(); } - return get_script_instance()->call("get_import_order"); + return get_script_instance()->call("_get_import_order"); } void EditorImportPlugin::get_import_options(List *r_options, int p_preset) const { - ERR_FAIL_COND(!(get_script_instance() && get_script_instance()->has_method("get_import_options"))); + ERR_FAIL_COND(!(get_script_instance() && get_script_instance()->has_method("_get_import_options"))); Array needed; needed.push_back("name"); needed.push_back("default_value"); - Array options = get_script_instance()->call("get_import_options", p_preset); + Array options = get_script_instance()->call("_get_import_options", p_preset); for (int i = 0; i < options.size(); i++) { Dictionary d = options[i]; ERR_FAIL_COND(!d.has_all(needed)); @@ -119,18 +119,18 @@ void EditorImportPlugin::get_import_options(List } bool EditorImportPlugin::get_option_visibility(const String &p_option, const Map &p_options) const { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_option_visibility")), true); + ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_get_option_visibility")), true); Dictionary d; Map::Element *E = p_options.front(); while (E) { d[E->key()] = E->get(); E = E->next(); } - return get_script_instance()->call("get_option_visibility", p_option, d); + return get_script_instance()->call("_get_option_visibility", p_option, d); } Error EditorImportPlugin::import(const String &p_source_file, const String &p_save_path, const Map &p_options, List *r_platform_variants, List *r_gen_files, Variant *r_metadata) { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("import")), ERR_UNAVAILABLE); + ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_import")), ERR_UNAVAILABLE); Dictionary options; Array platform_variants, gen_files; @@ -139,7 +139,7 @@ Error EditorImportPlugin::import(const String &p_source_file, const String &p_sa options[E->key()] = E->get(); E = E->next(); } - Error err = (Error)get_script_instance()->call("import", p_source_file, p_save_path, options, platform_variants, gen_files).operator int64_t(); + Error err = (Error)get_script_instance()->call("_import", p_source_file, p_save_path, options, platform_variants, gen_files).operator int64_t(); for (int i = 0; i < platform_variants.size(); i++) { r_platform_variants->push_back(platform_variants[i]); @@ -151,16 +151,16 @@ Error EditorImportPlugin::import(const String &p_source_file, const String &p_sa } void EditorImportPlugin::_bind_methods() { - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_importer_name")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_visible_name")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "get_preset_count")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_preset_name", PropertyInfo(Variant::INT, "preset"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::ARRAY, "get_recognized_extensions")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::ARRAY, "get_import_options", PropertyInfo(Variant::INT, "preset"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_save_extension")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_resource_type")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::FLOAT, "get_priority")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "get_import_order")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "get_option_visibility", PropertyInfo(Variant::STRING, "option"), PropertyInfo(Variant::DICTIONARY, "options"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "import", PropertyInfo(Variant::STRING, "source_file"), PropertyInfo(Variant::STRING, "save_path"), PropertyInfo(Variant::DICTIONARY, "options"), PropertyInfo(Variant::ARRAY, "platform_variants"), PropertyInfo(Variant::ARRAY, "gen_files"))); + BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_importer_name")); + BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_visible_name")); + BIND_VMETHOD(MethodInfo(Variant::INT, "_get_preset_count")); + BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_preset_name", PropertyInfo(Variant::INT, "preset"))); + BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_recognized_extensions")); + BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_import_options", PropertyInfo(Variant::INT, "preset"))); + BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_save_extension")); + BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_resource_type")); + BIND_VMETHOD(MethodInfo(Variant::FLOAT, "_get_priority")); + BIND_VMETHOD(MethodInfo(Variant::INT, "_get_import_order")); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_get_option_visibility", PropertyInfo(Variant::STRING, "option"), PropertyInfo(Variant::DICTIONARY, "options"))); + BIND_VMETHOD(MethodInfo(Variant::INT, "_import", PropertyInfo(Variant::STRING, "source_file"), PropertyInfo(Variant::STRING, "save_path"), PropertyInfo(Variant::DICTIONARY, "options"), PropertyInfo(Variant::ARRAY, "platform_variants"), PropertyInfo(Variant::ARRAY, "gen_files"))); } diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index b589a6aaa09..e4d88850ea0 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -120,13 +120,13 @@ void EditorSceneImporter::_bind_methods() { ///////////////////////////////// void EditorScenePostImport::_bind_methods() { - BIND_VMETHOD(MethodInfo(Variant::OBJECT, "post_import", PropertyInfo(Variant::OBJECT, "scene"))); + BIND_VMETHOD(MethodInfo(Variant::OBJECT, "_post_import", PropertyInfo(Variant::OBJECT, "scene"))); ClassDB::bind_method(D_METHOD("get_source_file"), &EditorScenePostImport::get_source_file); } Node *EditorScenePostImport::post_import(Node *p_scene) { if (get_script_instance()) { - return get_script_instance()->call("post_import", p_scene); + return get_script_instance()->call("_post_import", p_scene); } return p_scene; @@ -1508,7 +1508,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p if (!scene) { EditorNode::add_io_error( TTR("Error running post-import script:") + " " + post_import_script_path + "\n" + - TTR("Did you return a Node-derived object in the `post_import()` method?")); + TTR("Did you return a Node-derived object in the `_post_import()` method?")); return err; } } diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp index 9323c31faeb..5c69a1e9754 100644 --- a/editor/node_3d_editor_gizmos.cpp +++ b/editor/node_3d_editor_gizmos.cpp @@ -104,8 +104,8 @@ void EditorNode3DGizmo::clear() { } void EditorNode3DGizmo::redraw() { - if (get_script_instance() && get_script_instance()->has_method("redraw")) { - get_script_instance()->call("redraw"); + if (get_script_instance() && get_script_instance()->has_method("_redraw")) { + get_script_instance()->call("_redraw"); return; } @@ -114,8 +114,8 @@ void EditorNode3DGizmo::redraw() { } String EditorNode3DGizmo::get_handle_name(int p_idx) const { - if (get_script_instance() && get_script_instance()->has_method("get_handle_name")) { - return get_script_instance()->call("get_handle_name", p_idx); + if (get_script_instance() && get_script_instance()->has_method("_get_handle_name")) { + return get_script_instance()->call("_get_handle_name", p_idx); } ERR_FAIL_COND_V(!gizmo_plugin, ""); @@ -123,8 +123,8 @@ String EditorNode3DGizmo::get_handle_name(int p_idx) const { } bool EditorNode3DGizmo::is_handle_highlighted(int p_idx) const { - if (get_script_instance() && get_script_instance()->has_method("is_handle_highlighted")) { - return get_script_instance()->call("is_handle_highlighted", p_idx); + if (get_script_instance() && get_script_instance()->has_method("_is_handle_highlighted")) { + return get_script_instance()->call("_is_handle_highlighted", p_idx); } ERR_FAIL_COND_V(!gizmo_plugin, false); @@ -132,8 +132,8 @@ bool EditorNode3DGizmo::is_handle_highlighted(int p_idx) const { } Variant EditorNode3DGizmo::get_handle_value(int p_idx) { - if (get_script_instance() && get_script_instance()->has_method("get_handle_value")) { - return get_script_instance()->call("get_handle_value", p_idx); + if (get_script_instance() && get_script_instance()->has_method("_get_handle_value")) { + return get_script_instance()->call("_get_handle_value", p_idx); } ERR_FAIL_COND_V(!gizmo_plugin, Variant()); @@ -141,8 +141,8 @@ Variant EditorNode3DGizmo::get_handle_value(int p_idx) { } void EditorNode3DGizmo::set_handle(int p_idx, Camera3D *p_camera, const Point2 &p_point) { - if (get_script_instance() && get_script_instance()->has_method("set_handle")) { - get_script_instance()->call("set_handle", p_idx, p_camera, p_point); + if (get_script_instance() && get_script_instance()->has_method("_set_handle")) { + get_script_instance()->call("_set_handle", p_idx, p_camera, p_point); return; } @@ -151,8 +151,8 @@ void EditorNode3DGizmo::set_handle(int p_idx, Camera3D *p_camera, const Point2 & } void EditorNode3DGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p_cancel) { - if (get_script_instance() && get_script_instance()->has_method("commit_handle")) { - get_script_instance()->call("commit_handle", p_idx, p_restore, p_cancel); + if (get_script_instance() && get_script_instance()->has_method("_commit_handle")) { + get_script_instance()->call("_commit_handle", p_idx, p_restore, p_cancel); return; } @@ -739,16 +739,16 @@ void EditorNode3DGizmo::_bind_methods() { ClassDB::bind_method(D_METHOD("clear"), &EditorNode3DGizmo::clear); ClassDB::bind_method(D_METHOD("set_hidden", "hidden"), &EditorNode3DGizmo::set_hidden); - BIND_VMETHOD(MethodInfo("redraw")); - BIND_VMETHOD(MethodInfo(Variant::STRING, "get_handle_name", PropertyInfo(Variant::INT, "index"))); - BIND_VMETHOD(MethodInfo(Variant::BOOL, "is_handle_highlighted", PropertyInfo(Variant::INT, "index"))); + BIND_VMETHOD(MethodInfo("_redraw")); + BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_handle_name", PropertyInfo(Variant::INT, "index"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_is_handle_highlighted", PropertyInfo(Variant::INT, "index"))); - MethodInfo hvget(Variant::NIL, "get_handle_value", PropertyInfo(Variant::INT, "index")); + MethodInfo hvget(Variant::NIL, "_get_handle_value", PropertyInfo(Variant::INT, "index")); hvget.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT; BIND_VMETHOD(hvget); - BIND_VMETHOD(MethodInfo("set_handle", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera3D"), PropertyInfo(Variant::VECTOR2, "point"))); - MethodInfo cm = MethodInfo("commit_handle", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::NIL, "restore"), PropertyInfo(Variant::BOOL, "cancel")); + BIND_VMETHOD(MethodInfo("_set_handle", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera3D"), PropertyInfo(Variant::VECTOR2, "point"))); + MethodInfo cm = MethodInfo("_commit_handle", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::NIL, "restore"), PropertyInfo(Variant::BOOL, "cancel")); cm.default_arguments.push_back(false); BIND_VMETHOD(cm); } diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 6ab15f763f6..551ec351dc5 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -3551,8 +3551,8 @@ Dictionary Node3DEditorViewport::get_state() const { void Node3DEditorViewport::_bind_methods() { ClassDB::bind_method(D_METHOD("update_transform_gizmo_view"), &Node3DEditorViewport::update_transform_gizmo_view); // Used by call_deferred. - ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &Node3DEditorViewport::can_drop_data_fw); - ClassDB::bind_method(D_METHOD("drop_data_fw"), &Node3DEditorViewport::drop_data_fw); + ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &Node3DEditorViewport::can_drop_data_fw); + ClassDB::bind_method(D_METHOD("_drop_data_fw"), &Node3DEditorViewport::drop_data_fw); ADD_SIGNAL(MethodInfo("toggle_maximize_view", PropertyInfo(Variant::OBJECT, "viewport"))); ADD_SIGNAL(MethodInfo("clicked", PropertyInfo(Variant::OBJECT, "viewport"))); @@ -7475,15 +7475,15 @@ Ref EditorNode3DGizmoPlugin::get_material(const String &p_na } String EditorNode3DGizmoPlugin::get_gizmo_name() const { - if (get_script_instance() && get_script_instance()->has_method("get_gizmo_name")) { - return get_script_instance()->call("get_gizmo_name"); + if (get_script_instance() && get_script_instance()->has_method("_get_gizmo_name")) { + return get_script_instance()->call("_get_gizmo_name"); } return TTR("Nameless gizmo"); } int EditorNode3DGizmoPlugin::get_priority() const { - if (get_script_instance() && get_script_instance()->has_method("get_priority")) { - return get_script_instance()->call("get_priority"); + if (get_script_instance() && get_script_instance()->has_method("_get_priority")) { + return get_script_instance()->call("_get_priority"); } return 0; } @@ -7510,8 +7510,8 @@ Ref EditorNode3DGizmoPlugin::get_gizmo(Node3D *p_spatial) { void EditorNode3DGizmoPlugin::_bind_methods() { #define GIZMO_REF PropertyInfo(Variant::OBJECT, "gizmo", PROPERTY_HINT_RESOURCE_TYPE, "EditorNode3DGizmo") - BIND_VMETHOD(MethodInfo(Variant::BOOL, "has_gizmo", PropertyInfo(Variant::OBJECT, "spatial", PROPERTY_HINT_RESOURCE_TYPE, "Node3D"))); - BIND_VMETHOD(MethodInfo(GIZMO_REF, "create_gizmo", PropertyInfo(Variant::OBJECT, "spatial", PROPERTY_HINT_RESOURCE_TYPE, "Node3D"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_has_gizmo", PropertyInfo(Variant::OBJECT, "spatial", PROPERTY_HINT_RESOURCE_TYPE, "Node3D"))); + BIND_VMETHOD(MethodInfo(GIZMO_REF, "_create_gizmo", PropertyInfo(Variant::OBJECT, "spatial", PROPERTY_HINT_RESOURCE_TYPE, "Node3D"))); ClassDB::bind_method(D_METHOD("create_material", "name", "color", "billboard", "on_top", "use_vertex_color"), &EditorNode3DGizmoPlugin::create_material, DEFVAL(false), DEFVAL(false), DEFVAL(false)); ClassDB::bind_method(D_METHOD("create_icon_material", "name", "texture", "on_top", "color"), &EditorNode3DGizmoPlugin::create_icon_material, DEFVAL(false), DEFVAL(Color(1, 1, 1, 1))); @@ -7520,38 +7520,38 @@ void EditorNode3DGizmoPlugin::_bind_methods() { ClassDB::bind_method(D_METHOD("get_material", "name", "gizmo"), &EditorNode3DGizmoPlugin::get_material, DEFVAL(Ref())); - BIND_VMETHOD(MethodInfo(Variant::STRING, "get_gizmo_name")); - BIND_VMETHOD(MethodInfo(Variant::INT, "get_priority")); - BIND_VMETHOD(MethodInfo(Variant::BOOL, "can_be_hidden")); - BIND_VMETHOD(MethodInfo(Variant::BOOL, "is_selectable_when_hidden")); + BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_gizmo_name")); + BIND_VMETHOD(MethodInfo(Variant::INT, "_get_priority")); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_can_be_hidden")); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_is_selectable_when_hidden")); - BIND_VMETHOD(MethodInfo("redraw", GIZMO_REF)); - BIND_VMETHOD(MethodInfo(Variant::STRING, "get_handle_name", GIZMO_REF, PropertyInfo(Variant::INT, "index"))); + BIND_VMETHOD(MethodInfo("_redraw", GIZMO_REF)); + BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_handle_name", GIZMO_REF, PropertyInfo(Variant::INT, "index"))); - MethodInfo hvget(Variant::NIL, "get_handle_value", GIZMO_REF, PropertyInfo(Variant::INT, "index")); + MethodInfo hvget(Variant::NIL, "_get_handle_value", GIZMO_REF, PropertyInfo(Variant::INT, "index")); hvget.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT; BIND_VMETHOD(hvget); - BIND_VMETHOD(MethodInfo("set_handle", GIZMO_REF, PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera3D"), PropertyInfo(Variant::VECTOR2, "point"))); - MethodInfo cm = MethodInfo("commit_handle", GIZMO_REF, PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::NIL, "restore"), PropertyInfo(Variant::BOOL, "cancel")); + BIND_VMETHOD(MethodInfo("_set_handle", GIZMO_REF, PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera3D"), PropertyInfo(Variant::VECTOR2, "point"))); + MethodInfo cm = MethodInfo("_commit_handle", GIZMO_REF, PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::NIL, "restore"), PropertyInfo(Variant::BOOL, "cancel")); cm.default_arguments.push_back(false); BIND_VMETHOD(cm); - BIND_VMETHOD(MethodInfo(Variant::BOOL, "is_handle_highlighted", GIZMO_REF, PropertyInfo(Variant::INT, "index"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_is_handle_highlighted", GIZMO_REF, PropertyInfo(Variant::INT, "index"))); #undef GIZMO_REF } bool EditorNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - if (get_script_instance() && get_script_instance()->has_method("has_gizmo")) { - return get_script_instance()->call("has_gizmo", p_spatial); + if (get_script_instance() && get_script_instance()->has_method("_has_gizmo")) { + return get_script_instance()->call("_has_gizmo", p_spatial); } return false; } Ref EditorNode3DGizmoPlugin::create_gizmo(Node3D *p_spatial) { - if (get_script_instance() && get_script_instance()->has_method("create_gizmo")) { - return get_script_instance()->call("create_gizmo", p_spatial); + if (get_script_instance() && get_script_instance()->has_method("_create_gizmo")) { + return get_script_instance()->call("_create_gizmo", p_spatial); } Ref ref; @@ -7562,55 +7562,55 @@ Ref EditorNode3DGizmoPlugin::create_gizmo(Node3D *p_spatial) } bool EditorNode3DGizmoPlugin::can_be_hidden() const { - if (get_script_instance() && get_script_instance()->has_method("can_be_hidden")) { - return get_script_instance()->call("can_be_hidden"); + if (get_script_instance() && get_script_instance()->has_method("_can_be_hidden")) { + return get_script_instance()->call("_can_be_hidden"); } return true; } bool EditorNode3DGizmoPlugin::is_selectable_when_hidden() const { - if (get_script_instance() && get_script_instance()->has_method("is_selectable_when_hidden")) { - return get_script_instance()->call("is_selectable_when_hidden"); + if (get_script_instance() && get_script_instance()->has_method("_is_selectable_when_hidden")) { + return get_script_instance()->call("_is_selectable_when_hidden"); } return false; } void EditorNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { - if (get_script_instance() && get_script_instance()->has_method("redraw")) { + if (get_script_instance() && get_script_instance()->has_method("_redraw")) { Ref ref(p_gizmo); - get_script_instance()->call("redraw", ref); + get_script_instance()->call("_redraw", ref); } } String EditorNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { - if (get_script_instance() && get_script_instance()->has_method("get_handle_name")) { - return get_script_instance()->call("get_handle_name", p_gizmo, p_idx); + if (get_script_instance() && get_script_instance()->has_method("_get_handle_name")) { + return get_script_instance()->call("_get_handle_name", p_gizmo, p_idx); } return ""; } Variant EditorNode3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { - if (get_script_instance() && get_script_instance()->has_method("get_handle_value")) { - return get_script_instance()->call("get_handle_value", p_gizmo, p_idx); + if (get_script_instance() && get_script_instance()->has_method("_get_handle_value")) { + return get_script_instance()->call("_get_handle_value", p_gizmo, p_idx); } return Variant(); } void EditorNode3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { - if (get_script_instance() && get_script_instance()->has_method("set_handle")) { - get_script_instance()->call("set_handle", p_gizmo, p_idx, p_camera, p_point); + if (get_script_instance() && get_script_instance()->has_method("_set_handle")) { + get_script_instance()->call("_set_handle", p_gizmo, p_idx, p_camera, p_point); } } void EditorNode3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { - if (get_script_instance() && get_script_instance()->has_method("commit_handle")) { - get_script_instance()->call("commit_handle", p_gizmo, p_idx, p_restore, p_cancel); + if (get_script_instance() && get_script_instance()->has_method("_commit_handle")) { + get_script_instance()->call("_commit_handle", p_gizmo, p_idx, p_restore, p_cancel); } } bool EditorNode3DGizmoPlugin::is_handle_highlighted(const EditorNode3DGizmo *p_gizmo, int p_idx) const { - if (get_script_instance() && get_script_instance()->has_method("is_handle_highlighted")) { - return get_script_instance()->call("is_handle_highlighted", p_gizmo, p_idx); + if (get_script_instance() && get_script_instance()->has_method("_is_handle_highlighted")) { + return get_script_instance()->call("_is_handle_highlighted", p_gizmo, p_idx); } return false; } diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index b4b8e821241..b8b2c6d3434 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -339,9 +339,9 @@ void ResourcePreloaderEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_library"), &ResourcePreloaderEditor::_update_library); ClassDB::bind_method(D_METHOD("_remove_resource", "to_remove"), &ResourcePreloaderEditor::_remove_resource); - ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &ResourcePreloaderEditor::get_drag_data_fw); - ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &ResourcePreloaderEditor::can_drop_data_fw); - ClassDB::bind_method(D_METHOD("drop_data_fw"), &ResourcePreloaderEditor::drop_data_fw); + ClassDB::bind_method(D_METHOD("_get_drag_data_fw"), &ResourcePreloaderEditor::get_drag_data_fw); + ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &ResourcePreloaderEditor::can_drop_data_fw); + ClassDB::bind_method(D_METHOD("_drop_data_fw"), &ResourcePreloaderEditor::drop_data_fw); } ResourcePreloaderEditor::ResourcePreloaderEditor() { diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index b89992b03ce..0410ab3a45c 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -230,7 +230,7 @@ void ScriptEditorBase::_bind_methods() { ADD_SIGNAL(MethodInfo("search_in_files_requested", PropertyInfo(Variant::STRING, "text"))); ADD_SIGNAL(MethodInfo("replace_in_files_requested", PropertyInfo(Variant::STRING, "text"))); - BIND_VMETHOD(MethodInfo("add_syntax_highlighter", PropertyInfo(Variant::OBJECT, "highlighter"))); + BIND_VMETHOD(MethodInfo("_add_syntax_highlighter", PropertyInfo(Variant::OBJECT, "highlighter"))); } static bool _is_built_in_script(Script *p_script) { @@ -3276,9 +3276,9 @@ void ScriptEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("register_syntax_highlighter", "syntax_highlighter"), &ScriptEditor::register_syntax_highlighter); ClassDB::bind_method(D_METHOD("unregister_syntax_highlighter", "syntax_highlighter"), &ScriptEditor::unregister_syntax_highlighter); - ClassDB::bind_method(D_METHOD("get_drag_data_fw", "point", "from"), &ScriptEditor::get_drag_data_fw); - ClassDB::bind_method(D_METHOD("can_drop_data_fw", "point", "data", "from"), &ScriptEditor::can_drop_data_fw); - ClassDB::bind_method(D_METHOD("drop_data_fw", "point", "data", "from"), &ScriptEditor::drop_data_fw); + ClassDB::bind_method(D_METHOD("_get_drag_data_fw", "point", "from"), &ScriptEditor::get_drag_data_fw); + ClassDB::bind_method(D_METHOD("_can_drop_data_fw", "point", "data", "from"), &ScriptEditor::can_drop_data_fw); + ClassDB::bind_method(D_METHOD("_drop_data_fw", "point", "data", "from"), &ScriptEditor::drop_data_fw); ClassDB::bind_method(D_METHOD("goto_line", "line_number"), &ScriptEditor::_goto_script_line2); ClassDB::bind_method(D_METHOD("get_current_script"), &ScriptEditor::_get_current_script); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 8fa6b66edab..1f6da30547f 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1343,9 +1343,9 @@ void ScriptTextEditor::_notification(int p_what) { void ScriptTextEditor::_bind_methods() { ClassDB::bind_method("_update_connected_methods", &ScriptTextEditor::_update_connected_methods); - ClassDB::bind_method("get_drag_data_fw", &ScriptTextEditor::get_drag_data_fw); - ClassDB::bind_method("can_drop_data_fw", &ScriptTextEditor::can_drop_data_fw); - ClassDB::bind_method("drop_data_fw", &ScriptTextEditor::drop_data_fw); + ClassDB::bind_method("_get_drag_data_fw", &ScriptTextEditor::get_drag_data_fw); + ClassDB::bind_method("_can_drop_data_fw", &ScriptTextEditor::can_drop_data_fw); + ClassDB::bind_method("_drop_data_fw", &ScriptTextEditor::drop_data_fw); ClassDB::bind_method(D_METHOD("add_syntax_highlighter", "highlighter"), &ScriptTextEditor::add_syntax_highlighter); } diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 6dc98503cae..a97584ebce0 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -666,9 +666,9 @@ void Skeleton3DEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_properties"), &Skeleton3DEditor::_update_properties); ClassDB::bind_method(D_METHOD("_on_click_option"), &Skeleton3DEditor::_on_click_option); - ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &Skeleton3DEditor::get_drag_data_fw); - ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &Skeleton3DEditor::can_drop_data_fw); - ClassDB::bind_method(D_METHOD("drop_data_fw"), &Skeleton3DEditor::drop_data_fw); + ClassDB::bind_method(D_METHOD("_get_drag_data_fw"), &Skeleton3DEditor::get_drag_data_fw); + ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &Skeleton3DEditor::can_drop_data_fw); + ClassDB::bind_method(D_METHOD("_drop_data_fw"), &Skeleton3DEditor::drop_data_fw); ClassDB::bind_method(D_METHOD("move_skeleton_bone"), &Skeleton3DEditor::move_skeleton_bone); } diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 59bc8f9e550..a5a3d624ec0 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -964,9 +964,9 @@ void SpriteFramesEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da void SpriteFramesEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_library", "skipsel"), &SpriteFramesEditor::_update_library, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &SpriteFramesEditor::get_drag_data_fw); - ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &SpriteFramesEditor::can_drop_data_fw); - ClassDB::bind_method(D_METHOD("drop_data_fw"), &SpriteFramesEditor::drop_data_fw); + ClassDB::bind_method(D_METHOD("_get_drag_data_fw"), &SpriteFramesEditor::get_drag_data_fw); + ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &SpriteFramesEditor::can_drop_data_fw); + ClassDB::bind_method(D_METHOD("_drop_data_fw"), &SpriteFramesEditor::drop_data_fw); } SpriteFramesEditor::SpriteFramesEditor() { diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index 6078c986cb9..11842981f38 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -436,8 +436,8 @@ void TileSetEditor::_undo_redo_inspector_callback(Object *p_undo_redo, Object *p } void TileSetEditor::_bind_methods() { - ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &TileSetEditor::can_drop_data_fw); - ClassDB::bind_method(D_METHOD("drop_data_fw"), &TileSetEditor::drop_data_fw); + ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &TileSetEditor::can_drop_data_fw); + ClassDB::bind_method(D_METHOD("_drop_data_fw"), &TileSetEditor::drop_data_fw); } TileDataEditor *TileSetEditor::get_tile_data_editor(String p_property) { diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 2bb9e642622..9217f2ac4c4 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -72,13 +72,13 @@ const int MAX_FLOAT_CONST_DEFS = sizeof(float_constant_defs) / sizeof(FloatConst Control *VisualShaderNodePlugin::create_editor(const Ref &p_parent_resource, const Ref &p_node) { if (get_script_instance()) { - return get_script_instance()->call("create_editor", p_parent_resource, p_node); + return get_script_instance()->call("_create_editor", p_parent_resource, p_node); } return nullptr; } void VisualShaderNodePlugin::_bind_methods() { - BIND_VMETHOD(MethodInfo(Variant::OBJECT, "create_editor", PropertyInfo(Variant::OBJECT, "parent_resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource"), PropertyInfo(Variant::OBJECT, "for_node", PROPERTY_HINT_RESOURCE_TYPE, "VisualShaderNode"))); + BIND_VMETHOD(MethodInfo(Variant::OBJECT, "_create_editor", PropertyInfo(Variant::OBJECT, "parent_resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource"), PropertyInfo(Variant::OBJECT, "for_node", PROPERTY_HINT_RESOURCE_TYPE, "VisualShaderNode"))); } /////////////////// @@ -3694,9 +3694,9 @@ void VisualShaderEditor::_bind_methods() { ClassDB::bind_method("_update_uniform", &VisualShaderEditor::_update_uniform); ClassDB::bind_method("_expand_output_port", &VisualShaderEditor::_expand_output_port); - ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &VisualShaderEditor::get_drag_data_fw); - ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &VisualShaderEditor::can_drop_data_fw); - ClassDB::bind_method(D_METHOD("drop_data_fw"), &VisualShaderEditor::drop_data_fw); + ClassDB::bind_method(D_METHOD("_get_drag_data_fw"), &VisualShaderEditor::get_drag_data_fw); + ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &VisualShaderEditor::can_drop_data_fw); + ClassDB::bind_method(D_METHOD("_drop_data_fw"), &VisualShaderEditor::drop_data_fw); ClassDB::bind_method("_is_available", &VisualShaderEditor::_is_available); } diff --git a/editor/project_export.cpp b/editor/project_export.cpp index d72028cd0a3..7ca2d4d324a 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -978,9 +978,9 @@ void ProjectExportDialog::_export_all(bool p_debug) { } void ProjectExportDialog::_bind_methods() { - ClassDB::bind_method("get_drag_data_fw", &ProjectExportDialog::get_drag_data_fw); - ClassDB::bind_method("can_drop_data_fw", &ProjectExportDialog::can_drop_data_fw); - ClassDB::bind_method("drop_data_fw", &ProjectExportDialog::drop_data_fw); + ClassDB::bind_method("_get_drag_data_fw", &ProjectExportDialog::get_drag_data_fw); + ClassDB::bind_method("_can_drop_data_fw", &ProjectExportDialog::can_drop_data_fw); + ClassDB::bind_method("_drop_data_fw", &ProjectExportDialog::drop_data_fw); ClassDB::bind_method("_export_all", &ProjectExportDialog::_export_all); ClassDB::bind_method("set_export_path", &ProjectExportDialog::set_export_path); ClassDB::bind_method("get_export_path", &ProjectExportDialog::get_export_path); diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 6f9b0ae8730..a5620f8cc53 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -1129,9 +1129,9 @@ void SceneTreeEditor::_bind_methods() { ClassDB::bind_method("_rename_node", &SceneTreeEditor::_rename_node); ClassDB::bind_method("_test_update_tree", &SceneTreeEditor::_test_update_tree); - ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &SceneTreeEditor::get_drag_data_fw); - ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &SceneTreeEditor::can_drop_data_fw); - ClassDB::bind_method(D_METHOD("drop_data_fw"), &SceneTreeEditor::drop_data_fw); + ClassDB::bind_method(D_METHOD("_get_drag_data_fw"), &SceneTreeEditor::get_drag_data_fw); + ClassDB::bind_method(D_METHOD("_can_drop_data_fw"), &SceneTreeEditor::can_drop_data_fw); + ClassDB::bind_method(D_METHOD("_drop_data_fw"), &SceneTreeEditor::drop_data_fw); ClassDB::bind_method(D_METHOD("update_tree"), &SceneTreeEditor::update_tree); diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 5cfc228fae4..f5a365f199d 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -4243,9 +4243,9 @@ void VisualScriptEditor::_bind_methods() { ClassDB::bind_method("_create_new_node_from_name", &VisualScriptEditor::_create_new_node_from_name); - ClassDB::bind_method("get_drag_data_fw", &VisualScriptEditor::get_drag_data_fw); - ClassDB::bind_method("can_drop_data_fw", &VisualScriptEditor::can_drop_data_fw); - ClassDB::bind_method("drop_data_fw", &VisualScriptEditor::drop_data_fw); + ClassDB::bind_method("_get_drag_data_fw", &VisualScriptEditor::get_drag_data_fw); + ClassDB::bind_method("_can_drop_data_fw", &VisualScriptEditor::can_drop_data_fw); + ClassDB::bind_method("_drop_data_fw", &VisualScriptEditor::drop_data_fw); ClassDB::bind_method("_input", &VisualScriptEditor::_input); diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index 7369713e693..6fac70bdd5a 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -37,7 +37,7 @@ void AnimationNode::get_parameter_list(List *r_list) const { if (get_script_instance()) { - Array parameters = get_script_instance()->call("get_parameter_list"); + Array parameters = get_script_instance()->call("_get_parameter_list"); for (int i = 0; i < parameters.size(); i++) { Dictionary d = parameters[i]; ERR_CONTINUE(d.is_empty()); @@ -48,7 +48,7 @@ void AnimationNode::get_parameter_list(List *r_list) const { Variant AnimationNode::get_parameter_default_value(const StringName &p_parameter) const { if (get_script_instance()) { - return get_script_instance()->call("get_parameter_default_value", p_parameter); + return get_script_instance()->call("_get_parameter_default_value", p_parameter); } return Variant(); } @@ -73,7 +73,7 @@ Variant AnimationNode::get_parameter(const StringName &p_name) const { void AnimationNode::get_child_nodes(List *r_child_nodes) { if (get_script_instance()) { - Dictionary cn = get_script_instance()->call("get_child_nodes"); + Dictionary cn = get_script_instance()->call("_get_child_nodes"); List keys; cn.get_key_list(&keys); for (List::Element *E = keys.front(); E; E = E->next()) { @@ -299,7 +299,7 @@ String AnimationNode::get_input_name(int p_input) { String AnimationNode::get_caption() const { if (get_script_instance()) { - return get_script_instance()->call("get_caption"); + return get_script_instance()->call("_get_caption"); } return "Node"; @@ -330,7 +330,7 @@ void AnimationNode::remove_input(int p_index) { float AnimationNode::process(float p_time, bool p_seek) { if (get_script_instance()) { - return get_script_instance()->call("process", p_time, p_seek); + return get_script_instance()->call("_process", p_time, p_seek); } return 0; @@ -357,6 +357,10 @@ bool AnimationNode::is_path_filtered(const NodePath &p_path) const { } bool AnimationNode::has_filter() const { + if (get_script_instance()) { + return get_script_instance()->call("_has_filter"); + } + return false; } @@ -387,7 +391,7 @@ void AnimationNode::_validate_property(PropertyInfo &property) const { Ref AnimationNode::get_child_by_name(const StringName &p_name) { if (get_script_instance()) { - return get_script_instance()->call("get_child_by_name", p_name); + return get_script_instance()->call("_get_child_by_name", p_name); } return Ref(); } @@ -418,17 +422,17 @@ void AnimationNode::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter_enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_filter_enabled", "is_filter_enabled"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "filters", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_filters", "_get_filters"); - BIND_VMETHOD(MethodInfo(Variant::DICTIONARY, "get_child_nodes")); - BIND_VMETHOD(MethodInfo(Variant::ARRAY, "get_parameter_list")); - BIND_VMETHOD(MethodInfo(Variant::OBJECT, "get_child_by_name", PropertyInfo(Variant::STRING, "name"))); + BIND_VMETHOD(MethodInfo(Variant::DICTIONARY, "_get_child_nodes")); + BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_parameter_list")); + BIND_VMETHOD(MethodInfo(Variant::OBJECT, "_get_child_by_name", PropertyInfo(Variant::STRING, "name"))); { - MethodInfo mi = MethodInfo(Variant::NIL, "get_parameter_default_value", PropertyInfo(Variant::STRING_NAME, "name")); + MethodInfo mi = MethodInfo(Variant::NIL, "_get_parameter_default_value", PropertyInfo(Variant::STRING_NAME, "name")); mi.return_val.usage = PROPERTY_USAGE_NIL_IS_VARIANT; BIND_VMETHOD(mi); } - BIND_VMETHOD(MethodInfo("process", PropertyInfo(Variant::FLOAT, "time"), PropertyInfo(Variant::BOOL, "seek"))); - BIND_VMETHOD(MethodInfo(Variant::STRING, "get_caption")); - BIND_VMETHOD(MethodInfo(Variant::BOOL, "has_filter")); + BIND_VMETHOD(MethodInfo("_process", PropertyInfo(Variant::FLOAT, "time"), PropertyInfo(Variant::BOOL, "seek"))); + BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_caption")); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_has_filter")); ADD_SIGNAL(MethodInfo("removed_from_graph")); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 5afe813ee0b..c84627c21e5 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -662,7 +662,7 @@ bool Control::has_point(const Point2 &p_point) const { Variant v = p_point; const Variant *p = &v; Callable::CallError ce; - Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->has_point, &p, 1, ce); + Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->_has_point, &p, 1, ce); if (ce.error == Callable::CallError::CALL_OK) { return ret; } @@ -687,7 +687,7 @@ Variant Control::get_drag_data(const Point2 &p_point) { Object *obj = ObjectDB::get_instance(data.drag_owner); if (obj) { Control *c = Object::cast_to(obj); - return c->call("get_drag_data_fw", p_point, this); + return c->call("_get_drag_data_fw", p_point, this); } } @@ -695,7 +695,7 @@ Variant Control::get_drag_data(const Point2 &p_point) { Variant v = p_point; const Variant *p = &v; Callable::CallError ce; - Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->get_drag_data, &p, 1, ce); + Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->_get_drag_data, &p, 1, ce); if (ce.error == Callable::CallError::CALL_OK) { return ret; } @@ -709,7 +709,7 @@ bool Control::can_drop_data(const Point2 &p_point, const Variant &p_data) const Object *obj = ObjectDB::get_instance(data.drag_owner); if (obj) { Control *c = Object::cast_to(obj); - return c->call("can_drop_data_fw", p_point, p_data, this); + return c->call("_can_drop_data_fw", p_point, p_data, this); } } @@ -717,7 +717,7 @@ bool Control::can_drop_data(const Point2 &p_point, const Variant &p_data) const Variant v = p_point; const Variant *p[2] = { &v, &p_data }; Callable::CallError ce; - Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->can_drop_data, p, 2, ce); + Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->_can_drop_data, p, 2, ce); if (ce.error == Callable::CallError::CALL_OK) { return ret; } @@ -731,7 +731,7 @@ void Control::drop_data(const Point2 &p_point, const Variant &p_data) { Object *obj = ObjectDB::get_instance(data.drag_owner); if (obj) { Control *c = Object::cast_to(obj); - c->call("drop_data_fw", p_point, p_data, this); + c->call("_drop_data_fw", p_point, p_data, this); return; } } @@ -740,7 +740,7 @@ void Control::drop_data(const Point2 &p_point, const Variant &p_data) { Variant v = p_point; const Variant *p[2] = { &v, &p_data }; Callable::CallError ce; - Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->drop_data, p, 2, ce); + Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->_drop_data, p, 2, ce); if (ce.error == Callable::CallError::CALL_OK) { return; } @@ -2775,12 +2775,12 @@ void Control::_bind_methods() { BIND_VMETHOD(MethodInfo("_gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"))); BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_get_minimum_size")); - MethodInfo get_drag_data = MethodInfo("get_drag_data", PropertyInfo(Variant::VECTOR2, "position")); + MethodInfo get_drag_data = MethodInfo("_get_drag_data", PropertyInfo(Variant::VECTOR2, "position")); get_drag_data.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT; BIND_VMETHOD(get_drag_data); - BIND_VMETHOD(MethodInfo(Variant::BOOL, "can_drop_data", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::NIL, "data"))); - BIND_VMETHOD(MethodInfo("drop_data", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::NIL, "data"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_can_drop_data", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::NIL, "data"))); + BIND_VMETHOD(MethodInfo("_drop_data", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::NIL, "data"))); BIND_VMETHOD(MethodInfo( PropertyInfo(Variant::OBJECT, "control", PROPERTY_HINT_RESOURCE_TYPE, "Control"), "_make_custom_tooltip", PropertyInfo(Variant::STRING, "for_text"))); @@ -2940,5 +2940,5 @@ void Control::_bind_methods() { ADD_SIGNAL(MethodInfo("minimum_size_changed")); ADD_SIGNAL(MethodInfo("theme_changed")); - BIND_VMETHOD(MethodInfo(Variant::BOOL, "has_point", PropertyInfo(Variant::VECTOR2, "point"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_has_point", PropertyInfo(Variant::VECTOR2, "point"))); } diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index 7575ccd5c3b..8e5f271cc79 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -155,13 +155,13 @@ SceneStringNames::SceneStringNames() { area_entered = StaticCString::create("area_entered"); area_exited = StaticCString::create("area_exited"); - has_point = StaticCString::create("has_point"); + _has_point = StaticCString::create("_has_point"); line_separation = StaticCString::create("line_separation"); - get_drag_data = StaticCString::create("get_drag_data"); - drop_data = StaticCString::create("drop_data"); - can_drop_data = StaticCString::create("can_drop_data"); + _get_drag_data = StaticCString::create("_get_drag_data"); + _drop_data = StaticCString::create("_drop_data"); + _can_drop_data = StaticCString::create("_can_drop_data"); _im_update = StaticCString::create("_im_update"); // Sprite3D diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index a5b489eddc6..10b0707cab2 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -138,10 +138,10 @@ public: StringName grouped; StringName ungrouped; - StringName has_point; - StringName get_drag_data; - StringName can_drop_data; - StringName drop_data; + StringName _has_point; + StringName _get_drag_data; + StringName _can_drop_data; + StringName _drop_data; StringName screen_entered; StringName screen_exited;