mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Improve ResourceLoader.get_dependencies()'s description
This commit is contained in:
@@ -45,11 +45,14 @@
|
||||
<param index="0" name="path" type="String" />
|
||||
<description>
|
||||
Returns the dependencies for the resource at the given [param path].
|
||||
[b]Note:[/b] The dependencies are returned with slices separated by [code]::[/code]. You can use [method String.get_slice] to get their components.
|
||||
Each dependency is a string that can be divided into sections by [code]::[/code]. There can be either one section or three sections, with the second section always being empty. When there is one section, it contains the file path. When there are three sections, the first section contains the UID and the third section contains the fallback path.
|
||||
[codeblock]
|
||||
for dependency in ResourceLoader.get_dependencies(path):
|
||||
print(dependency.get_slice("::", 0)) # Prints the UID.
|
||||
print(dependency.get_slice("::", 2)) # Prints the path.
|
||||
if dependency.contains("::"):
|
||||
print(dependency.get_slice("::", 0)) # Prints the UID.
|
||||
print(dependency.get_slice("::", 2)) # Prints the fallback path.
|
||||
else:
|
||||
print(dependency) # Prints the path.
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
|
||||
Reference in New Issue
Block a user