Created
March 7, 2021 16:33
-
-
Save me2beats/d6c6ff4ced33462bdb1934682a22feb4 to your computer and use it in GitHub Desktop.
Godot FileSystem utils
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class_name FileSystemU | |
const NodeU = preload("node.gd") | |
static func get_tree(plugin:EditorPlugin): | |
var dock = plugin.get_editor_interface().get_file_system_dock() | |
return NodeU.get_child_by_class_path(dock, ['VSplitContainer','Tree']) | |
static func get_path(item:TreeItem)->String: | |
var res = "" | |
var parents = TreeU.get_parents(item) | |
var parents_texts = PoolStringArray() | |
for i in parents: | |
parents_texts.push_back(i.get_text(0)) | |
if parents_texts[0] == "": | |
parents_texts.remove(0) | |
res = parents_texts.join("/") | |
res = res.replace("///", "//") | |
return res |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment