Files
godot-docs-l10n/sphinx/templates/getting_started/step_by_step/resources.pot
2020-08-11 14:46:10 +02:00

227 lines
13 KiB
Plaintext

# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2014-2020, Juan Linietsky, Ariel Manzur and the Godot community (CC-BY 3.0)
# This file is distributed under the same license as the Godot Engine package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine latest\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-11 13:45+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../../docs/getting_started/step_by_step/resources.rst:4
msgid "Resources"
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:7
msgid "Nodes and resources"
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:9
msgid "Up to this tutorial, we focused on the :ref:`Node <class_Node>` class in Godot as that's the one you use to code behavior and most of the engine's features rely on it. There is another datatype that is just as important: :ref:`Resource <class_Resource>`."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:15
msgid "*Nodes* give you functionality: they draw sprites, 3D models, simulate physics, arrange user interfaces, etc. **Resources** are **data containers**. They don't do anything on their own: instead, nodes use the data contained in resources."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:19
msgid "Anything Godot saves or loads from disk is a resource. Be it a scene (a ``.tscn`` or an ``.scn`` file), an image, a script... Here are some ``Resource`` examples: :ref:`Texture <class_Texture>`, :ref:`Script <class_Script>`, :ref:`Mesh <class_Mesh>`, :ref:`Animation <class_Animation>`, :ref:`AudioStream <class_AudioStream>`, :ref:`Font <class_Font>`, :ref:`Translation <class_Translation>`."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:26
msgid "When the engine loads a resource from disk, **it only loads it once**. If a copy of that resource is already in memory, trying to load the resource again will return the same copy every time. As resources only contain data, there is no need to duplicate them."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:31
msgid "Every object, be it a Node or a Resource, can export properties. There are many types of Properties, like String, integer, Vector2, etc., and any of these types can become a resource. This means that both nodes and resources can contain resources as properties:"
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:39
msgid "External vs built-in"
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:41
msgid "There are two ways to save resources. They can be:"
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:43
msgid "**External** to a scene, saved on the disk as individual files."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:44
msgid "**Built-in**, saved inside the ``.tscn`` or the ``.scn`` file they're attached to."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:46
msgid "To be more specific, here's a :ref:`Texture <class_Texture>` in a :ref:`Sprite <class_Sprite>` node:"
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:51
msgid "Clicking the resource preview allows us to view and edit the resource's properties."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:55
msgid "The path property tells us where the resource comes from. In this case, it comes from a PNG image called ``robi.png``. When the resource comes from a file like this, it is an external resource. If you erase the path or this path is empty, it becomes a built-in resource."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:60
msgid "The switch between built-in and external resources happens when you save the scene. In the example above, if you erase the path ``\"res://robi.png\"`` and save, Godot will save the image inside the ``.tscn`` scene file."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:66
msgid "Even if you save a built-in resource, when you instance a scene multiple times, the engine will only load one copy of it."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:70
msgid "Loading resources from code"
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:72
msgid "There are two ways to load resources from code. First, you can use the ``load()`` function anytime:"
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:90
msgid "You can also ``preload`` resources. Unlike ``load``, this function will read the file from disk and load it at compile-time. As a result, you cannot call preload with a variable path: you need to use a constant string."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:106
msgid "Loading scenes"
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:108
msgid "Scenes are also resources, but there is a catch. Scenes saved to disk are resources of type :ref:`PackedScene <class_PackedScene>`. The scene is packed inside a resource."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:112
msgid "To get an instance of the scene, you have to use the :ref:`PackedScene.instance() <class_PackedScene_method_instance>` method."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:133
msgid "This method creates the nodes in the scene's hierarchy, configures them, and returns the root node of the scene. You can then add it as a child of any other node."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:137
msgid "The approach has several advantages. As the :ref:`PackedScene.instance() <class_PackedScene_method_instance>` function is fast, you can create new enemies, bullets, effects, etc. without having to load them again from disk each time. Remember that, as always, images, meshes, etc. are all shared between the scene instances."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:144
msgid "Freeing resources"
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:146
msgid "When a ``Resource`` is no longer in use, it will automatically free itself. Since, in most cases, Resources are contained in Nodes, when you free a node, the engine frees all the resources it owns as well if no other node uses them."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:151
msgid "Creating your own resources"
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:153
msgid "Like any Object in Godot, users can also script Resources. Resource scripts inherit the ability to freely translate between object properties and serialized text or binary data (\\*.tres, \\*.res). They also inherit the reference-counting memory management from the Reference type."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:158
msgid "This comes with many distinct advantages over alternative data structures, such as JSON, CSV, or custom TXT files. Users can only import these assets as a :ref:`Dictionary <class_Dictionary>` (JSON) or as a :ref:`File <class_File>` to parse. What sets Resources apart is their inheritance of :ref:`Object <class_Object>`, :ref:`Reference <class_Reference>`, and :ref:`Resource <class_Resource>` features:"
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:165
msgid "They can define constants, so constants from other data fields or objects are not needed."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:167
msgid "They can define methods, including setter/getter methods for properties. This allows for abstraction and encapsulation of the underlying data. If the Resource script's structure needs to change, the game using the Resource need not also change."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:169
msgid "They can define signals, so Resources can trigger responses to changes in the data they manage."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:171
msgid "They have defined properties, so users know 100% that their data will exist."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:173
msgid "Resource auto-serialization and deserialization is a built-in Godot Engine feature. Users do not need to implement custom logic to import/export a resource file's data."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:175
msgid "Resources can even serialize sub-Resources recursively, meaning users can design even more sophisticated data structures."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:177
msgid "Users can save Resources as version-control-friendly text files (\\*.tres). Upon exporting a game, Godot serializes resource files as binary files (\\*.res) for increased speed and compression."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:179
msgid "Godot Engine's Inspector renders and edits Resource files out-of-the-box. As such, users often do not need to implement custom logic to visualize or edit their data. To do so, double-click the resource file in the FileSystem dock or click the folder icon in the Inspector and open the file in the dialog."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:181
msgid "They can extend **other** resource types besides just the base Resource."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:183
msgid "Godot makes it easy to create custom Resources in the Inspector."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:185
msgid "Create a plain Resource object in the Inspector. This can even be a type that derives Resource, so long as your script is extending that type."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:186
msgid "Set the ``script`` property in the Inspector to be your script."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:188
msgid "The Inspector will now display your Resource script's custom properties. If one edits those values and saves the resource, the Inspector serializes the custom properties too! To save a resource from the Inspector, click the Inspector's tools menu (top right), and select \"Save\" or \"Save As...\"."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:193
msgid "If the script's language supports :ref:`script classes <doc_scripting_continued_class_name>`, then it streamlines the process. Defining a name for your script alone will add it to the Inspector's creation dialog. This will auto-add your script to the Resource object you create."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:198
msgid "Let's see some examples."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:271
msgid "Resource scripts are similar to Unity's ScriptableObjects. The Inspector provides built-in support for custom resources. If desired though, users can even design their own Control-based tool scripts and combine them with an :ref:`EditorPlugin <class_EditorPlugin>` to create custom visualizations and editors for their data."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:277
msgid "Unreal Engine 4's DataTables and CurveTables are also easy to recreate with Resource scripts. DataTables are a String mapped to a custom struct, similar to a Dictionary mapping a String to a secondary custom Resource script."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:313
msgid "Instead of just inlining the Dictionary values, one could also, alternatively..."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:315
msgid "Import a table of values from a spreadsheet and generate these key-value pairs, or..."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:317
msgid "Design a visualization within the editor and create a simple plugin that adds it to the Inspector when you open these types of Resources."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:320
msgid "CurveTables are the same thing, except mapped to an Array of float values or a :ref:`Curve <class_Curve>`/:ref:`Curve2D <class_Curve2D>` resource object."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:325
msgid "Beware that resource files (\\*.tres/\\*.res) will store the path of the script they use in the file. When loaded, they will fetch and load this script as an extension of their type. This means that trying to assign a subclass, i.e. an inner class of a script (such as using the ``class`` keyword in GDScript) won't work. Godot will not serialize the custom properties on the script subclass properly."
msgstr ""
#: ../../docs/getting_started/step_by_step/resources.rst:331
msgid "In the example below, Godot would load the ``Node`` script, see that it doesn't extend ``Resource``, and then determine that the script failed to load for the Resource object since the types are incompatible."
msgstr ""