diff options
author | Marc Gilleron <marc.gilleron@gmail.com> | 2018-06-11 02:59:53 +0200 |
---|---|---|
committer | Marc Gilleron <marc.gilleron@gmail.com> | 2018-12-15 05:34:53 +0000 |
commit | 065e2670af53ae2f71b78d57f8a217b4539cbbe2 (patch) | |
tree | a6b802b74f6f7ebd2018b5a3d35061bdcb91eb9d /doc/classes | |
parent | ca28c455bfdc8408485c217c17f07011c0b43f64 (diff) |
Added basic support for custom resource savers and loaders
Diffstat (limited to 'doc/classes')
24 files changed, 456 insertions, 0 deletions
diff --git a/doc/classes/ResourceFormatDDS.xml b/doc/classes/ResourceFormatDDS.xml new file mode 100644 index 0000000000..e237dfc6a5 --- /dev/null +++ b/doc/classes/ResourceFormatDDS.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatDDS" inherits="ResourceFormatLoader" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatImporter.xml b/doc/classes/ResourceFormatImporter.xml new file mode 100644 index 0000000000..fa5b44fa18 --- /dev/null +++ b/doc/classes/ResourceFormatImporter.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatImporter" inherits="ResourceFormatLoader" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatLoader.xml b/doc/classes/ResourceFormatLoader.xml new file mode 100644 index 0000000000..f03f0bbf54 --- /dev/null +++ b/doc/classes/ResourceFormatLoader.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatLoader" inherits="Reference" category="Core" version="3.1"> + <brief_description> + Loads a specific resource type from a file. + </brief_description> + <description> + Godot loads resources in the editor or in exported games using ResourceFormatLoaders. They get queried when you call `load`, or when a resource with internal dependencies is loaded. Each file type may load as a different resource type, so multiple ResourceFormatLoader are registered in the engine. + Extending this class allows you to define your own. You should give it a global class name with `class_name` for it to be registered. You may as well implement a [ResourceFormatSaver]. + Note: you can also extend [EditorImportPlugin] if the resource type you need exists but Godot is unable to load its format. Choosing one way over another depends if the format is suitable or not for the final exported game. Example: it's better to import .PNG textures as .STEX first, so they can be loaded with better efficiency on the graphics card. + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_dependencies" qualifiers="virtual"> + <return type="void"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <argument index="1" name="add_types" type="String"> + </argument> + <description> + If implemented, gets the dependencies of a given resource. If add_types is true, paths should be appended "::TypeName", where `TypeName` is the class name of the dependency. Note that custom resource types defined by scripts aren't known by the [ClassDB], so you might just return "Resource" for them. + </description> + </method> + <method name="get_recognized_extensions" qualifiers="virtual"> + <return type="PoolStringArray"> + </return> + <description> + Gets the list of extensions for files this loader is able to read. + </description> + </method> + <method name="get_resource_type" qualifiers="virtual"> + <return type="String"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <description> + Gets the class name of the resource associated with the given path. If the loader cannot handle it, it should return "". Note that custom resource types defined by scripts aren't known by the [ClassDB], so you might just return "Resource" for them. + </description> + </method> + <method name="handles_type" qualifiers="virtual"> + <return type="bool"> + </return> + <argument index="0" name="typename" type="String"> + </argument> + <description> + Tells which resource class this loader can load. Note that custom resource types defined by scripts aren't known by the [ClassDB], so you might just return "Resource" for them. + </description> + </method> + <method name="load" qualifiers="virtual"> + <return type="Variant"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <argument index="1" name="original_path" type="String"> + </argument> + <description> + Loads a resource when the engine finds this loader to be compatible. original_path: If the loaded resource is the result of an import, original_path will target the source file. Returns a resource object if succeeded, or an ERR_* constant listed in [@GlobalScope] if it failed. + </description> + </method> + <method name="rename_dependencies" qualifiers="virtual"> + <return type="int"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <argument index="1" name="renames" type="String"> + </argument> + <description> + If implemented, renames dependencies within the given resource and saves it. renames is a dictionary { String => String } mapping old dependency paths to new paths. Returns OK on success, or an ERR_* constant listed in [@GlobalScope] in case of failure. + </description> + </method> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatLoaderBMFont.xml b/doc/classes/ResourceFormatLoaderBMFont.xml new file mode 100644 index 0000000000..1e999353f8 --- /dev/null +++ b/doc/classes/ResourceFormatLoaderBMFont.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatLoaderBMFont" inherits="ResourceFormatLoader" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatLoaderBinary.xml b/doc/classes/ResourceFormatLoaderBinary.xml new file mode 100644 index 0000000000..3c768851e2 --- /dev/null +++ b/doc/classes/ResourceFormatLoaderBinary.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatLoaderBinary" inherits="ResourceFormatLoader" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatLoaderDynamicFont.xml b/doc/classes/ResourceFormatLoaderDynamicFont.xml new file mode 100644 index 0000000000..4cd5c9b2a6 --- /dev/null +++ b/doc/classes/ResourceFormatLoaderDynamicFont.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatLoaderDynamicFont" inherits="ResourceFormatLoader" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatLoaderGDScript.xml b/doc/classes/ResourceFormatLoaderGDScript.xml new file mode 100644 index 0000000000..b661e4746a --- /dev/null +++ b/doc/classes/ResourceFormatLoaderGDScript.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatLoaderGDScript" inherits="ResourceFormatLoader" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatLoaderImage.xml b/doc/classes/ResourceFormatLoaderImage.xml new file mode 100644 index 0000000000..5f7e55af28 --- /dev/null +++ b/doc/classes/ResourceFormatLoaderImage.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatLoaderImage" inherits="ResourceFormatLoader" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatLoaderNativeScript.xml b/doc/classes/ResourceFormatLoaderNativeScript.xml new file mode 100644 index 0000000000..496602e7dd --- /dev/null +++ b/doc/classes/ResourceFormatLoaderNativeScript.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatLoaderNativeScript" inherits="ResourceFormatLoader" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatLoaderShader.xml b/doc/classes/ResourceFormatLoaderShader.xml new file mode 100644 index 0000000000..0948810532 --- /dev/null +++ b/doc/classes/ResourceFormatLoaderShader.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatLoaderShader" inherits="ResourceFormatLoader" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatLoaderStreamTexture.xml b/doc/classes/ResourceFormatLoaderStreamTexture.xml new file mode 100644 index 0000000000..34843f9e1a --- /dev/null +++ b/doc/classes/ResourceFormatLoaderStreamTexture.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatLoaderStreamTexture" inherits="ResourceFormatLoader" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatLoaderText.xml b/doc/classes/ResourceFormatLoaderText.xml new file mode 100644 index 0000000000..db3b28f233 --- /dev/null +++ b/doc/classes/ResourceFormatLoaderText.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatLoaderText" inherits="ResourceFormatLoader" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatLoaderTextureLayered.xml b/doc/classes/ResourceFormatLoaderTextureLayered.xml new file mode 100644 index 0000000000..cd31f35e49 --- /dev/null +++ b/doc/classes/ResourceFormatLoaderTextureLayered.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatLoaderTextureLayered" inherits="ResourceFormatLoader" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatLoaderTheora.xml b/doc/classes/ResourceFormatLoaderTheora.xml new file mode 100644 index 0000000000..dff7e2f3dc --- /dev/null +++ b/doc/classes/ResourceFormatLoaderTheora.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatLoaderTheora" inherits="ResourceFormatLoader" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatLoaderWebm.xml b/doc/classes/ResourceFormatLoaderWebm.xml new file mode 100644 index 0000000000..f2b403161e --- /dev/null +++ b/doc/classes/ResourceFormatLoaderWebm.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatLoaderWebm" inherits="ResourceFormatLoader" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatPKM.xml b/doc/classes/ResourceFormatPKM.xml new file mode 100644 index 0000000000..aa511823d3 --- /dev/null +++ b/doc/classes/ResourceFormatPKM.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatPKM" inherits="ResourceFormatLoader" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatPVR.xml b/doc/classes/ResourceFormatPVR.xml new file mode 100644 index 0000000000..4f3b4f670f --- /dev/null +++ b/doc/classes/ResourceFormatPVR.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatPVR" inherits="ResourceFormatLoader" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatSaver.xml b/doc/classes/ResourceFormatSaver.xml new file mode 100644 index 0000000000..d15d97fc84 --- /dev/null +++ b/doc/classes/ResourceFormatSaver.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatSaver" inherits="Reference" category="Core" version="3.1"> + <brief_description> + Saves a specific resource type to a file. + </brief_description> + <description> + The engine can save resources when you do it from the editor, or when you call `ResourceSaver.save(resource)`. This is accomplished with multiple `ResourceFormatSavers`, each handling its own format. + By default, Godot saves resources as `.tres`, `.res` or another built-in format, but you can choose to create your own format by extending this class. You should give it a global class name with `class_name` for it to be registered. You may as well implement a [ResourceFormatLoader]. + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_recognized_extensions" qualifiers="virtual"> + <return type="PoolStringArray"> + </return> + <argument index="0" name="resource" type="Resource"> + </argument> + <description> + Gets the list of extensions for files this saver is able to write. + </description> + </method> + <method name="recognize" qualifiers="virtual"> + <return type="bool"> + </return> + <argument index="0" name="resource" type="Resource"> + </argument> + <description> + Returns true if the given resource object can be saved by this saver. + </description> + </method> + <method name="save" qualifiers="virtual"> + <return type="int"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <argument index="1" name="resource" type="Resource"> + </argument> + <argument index="2" name="flags" type="int"> + </argument> + <description> + Saves the given resource object to a file. flags is a bitmask composed with FLAG_* constants defined in [ResourceSaver]. Returns OK on success, or an ERR_* constant listed in [@GlobalScope] if it failed. + </description> + </method> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatSaverBinary.xml b/doc/classes/ResourceFormatSaverBinary.xml new file mode 100644 index 0000000000..7afec9ba23 --- /dev/null +++ b/doc/classes/ResourceFormatSaverBinary.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatSaverBinary" inherits="ResourceFormatSaver" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatSaverGDScript.xml b/doc/classes/ResourceFormatSaverGDScript.xml new file mode 100644 index 0000000000..27964c7c9b --- /dev/null +++ b/doc/classes/ResourceFormatSaverGDScript.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatSaverGDScript" inherits="ResourceFormatSaver" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatSaverNativeScript.xml b/doc/classes/ResourceFormatSaverNativeScript.xml new file mode 100644 index 0000000000..9f8c0ccc78 --- /dev/null +++ b/doc/classes/ResourceFormatSaverNativeScript.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatSaverNativeScript" inherits="ResourceFormatSaver" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatSaverShader.xml b/doc/classes/ResourceFormatSaverShader.xml new file mode 100644 index 0000000000..cdc512dfea --- /dev/null +++ b/doc/classes/ResourceFormatSaverShader.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatSaverShader" inherits="ResourceFormatSaver" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceFormatSaverText.xml b/doc/classes/ResourceFormatSaverText.xml new file mode 100644 index 0000000000..6ae4ff4a2c --- /dev/null +++ b/doc/classes/ResourceFormatSaverText.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceFormatSaverText" inherits="ResourceFormatSaver" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/ResourceSaverPNG.xml b/doc/classes/ResourceSaverPNG.xml new file mode 100644 index 0000000000..a161a4de5f --- /dev/null +++ b/doc/classes/ResourceSaverPNG.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceSaverPNG" inherits="ResourceFormatSaver" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> |