diff options
author | Bhupendra Aole <bhupendra.aole@gmail.com> | 2019-09-01 01:51:33 -0400 |
---|---|---|
committer | Bhupendra Aole <bhupendra.aole@gmail.com> | 2019-09-01 01:51:33 -0400 |
commit | 3518e7a6c7f0a0b32bb6809183515344914151a2 (patch) | |
tree | 14c899add38289e9e699e627cfaebcf2260a3905 | |
parent | b17b51d9701459d43da7c6766642762649802ff0 (diff) |
Expose current path to EditorPlugin
get_selected_path returns only the resource directory.
get_current_path fulfils the need to get the full path.
This does not break backward compatibility and the function (get_current_path)
is already available in FileSystemDock just like get_selected_path.
Fixes 30652.
-rw-r--r-- | editor/editor_plugin.cpp | 5 | ||||
-rw-r--r-- | editor/editor_plugin.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index e27f1ab9eb..77ab34dedf 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -211,6 +211,10 @@ String EditorInterface::get_selected_path() const { return EditorNode::get_singleton()->get_filesystem_dock()->get_selected_path(); } +String EditorInterface::get_current_path() const { + return EditorNode::get_singleton()->get_filesystem_dock()->get_current_path(); +} + void EditorInterface::inspect_object(Object *p_obj, const String &p_for_property) { EditorNode::get_singleton()->push_item(p_obj, p_for_property); @@ -288,6 +292,7 @@ void EditorInterface::_bind_methods() { ClassDB::bind_method(D_METHOD("make_mesh_previews", "meshes", "preview_size"), &EditorInterface::_make_mesh_previews); ClassDB::bind_method(D_METHOD("select_file", "file"), &EditorInterface::select_file); ClassDB::bind_method(D_METHOD("get_selected_path"), &EditorInterface::get_selected_path); + ClassDB::bind_method(D_METHOD("get_current_path"), &EditorInterface::get_current_path); ClassDB::bind_method(D_METHOD("set_plugin_enabled", "plugin", "enabled"), &EditorInterface::set_plugin_enabled); ClassDB::bind_method(D_METHOD("is_plugin_enabled", "plugin"), &EditorInterface::is_plugin_enabled); diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index 8941dfa28c..63f5a4f87a 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -78,6 +78,7 @@ public: void select_file(const String &p_file); String get_selected_path() const; + String get_current_path() const; void inspect_object(Object *p_obj, const String &p_for_property = String()); |