.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead. .. _class_Resource: Resource ======== **Inherits:** :ref:`Reference` **<** :ref:`Object` **Inherited By:** :ref:`Theme`, :ref:`AudioStream`, :ref:`EventStream`, :ref:`CubeMap`, :ref:`DynamicFontData`, :ref:`Translation`, :ref:`Curve2D`, :ref:`Shape`, :ref:`Shape2D`, :ref:`Shader`, :ref:`ColorRamp`, :ref:`StyleBox`, :ref:`Material`, :ref:`VideoStream`, :ref:`RoomBounds`, :ref:`PackedScene`, :ref:`Texture`, :ref:`Script`, :ref:`OccluderPolygon2D`, :ref:`Mesh`, :ref:`TileSet`, :ref:`ShortCut`, :ref:`BitMap`, :ref:`Animation`, :ref:`Sample`, :ref:`PolygonPathFinder`, :ref:`BakedLight`, :ref:`World`, :ref:`SampleLibrary`, :ref:`World2D`, :ref:`Font`, :ref:`SpriteFrames`, :ref:`MeshLibrary`, :ref:`Curve3D`, :ref:`NavigationPolygon`, :ref:`EditorSettings`, :ref:`Environment`, :ref:`MultiMesh`, :ref:`CanvasItemMaterial`, :ref:`PackedDataContainer`, :ref:`NavigationMesh` **Category:** Core Brief Description ----------------- Base class for all resources. Member Functions ---------------- +----------------------------------+-----------------------------------------------------------------------------------------------------------+ | void | :ref:`_setup_local_to_scene` **(** **)** virtual | +----------------------------------+-----------------------------------------------------------------------------------------------------------+ | :ref:`Resource` | :ref:`duplicate` **(** :ref:`bool` subresources=false **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------+ | :ref:`Node` | :ref:`get_local_scene` **(** **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_name` **(** **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_path` **(** **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`get_rid` **(** **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_local_to_scene` **(** **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------+ | void | :ref:`set_local_to_scene` **(** :ref:`bool` enable **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------+ | void | :ref:`set_name` **(** :ref:`String` name **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------+ | void | :ref:`set_path` **(** :ref:`String` path **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------+ | void | :ref:`setup_local_to_scene` **(** **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------+ | void | :ref:`take_over_path` **(** :ref:`String` path **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------+ Signals ------- - **changed** **(** **)** Member Variables ---------------- - :ref:`bool` **resource_local_to_scene** - :ref:`String` **resource_name** - :ref:`String` **resource_path** Description ----------- Resource is the base class for all resource types. Resources are primarily data containers. They are reference counted and freed when no longer in use. They are also loaded only once from disk, and further attempts to load the resource will return the same reference (all this in contrast to a :ref:`Node`, which is not reference counted and can be instanced from disk as many times as desired). Resources can be saved externally on disk or bundled into another object, such as a :ref:`Node` or another resource. Member Function Description --------------------------- .. _class_Resource__setup_local_to_scene: - void **_setup_local_to_scene** **(** **)** virtual .. _class_Resource_duplicate: - :ref:`Resource` **duplicate** **(** :ref:`bool` subresources=false **)** const .. _class_Resource_get_local_scene: - :ref:`Node` **get_local_scene** **(** **)** const .. _class_Resource_get_name: - :ref:`String` **get_name** **(** **)** const Return the name of the resources, any name is valid (it doesn't have to be unique). Name is for descriptive purposes only. .. _class_Resource_get_path: - :ref:`String` **get_path** **(** **)** const Return the path of the resource. This is useful mainly for editors when saving/loading, and shouldn't be changed by anything else. .. _class_Resource_get_rid: - :ref:`RID` **get_rid** **(** **)** const Return the RID of the resource (or an empty RID). Many resources (such as :ref:`Texture`, :ref:`Mesh`, etc) are high level abstractions of resources stored in a server, so this function will return the original RID. .. _class_Resource_is_local_to_scene: - :ref:`bool` **is_local_to_scene** **(** **)** const .. _class_Resource_set_local_to_scene: - void **set_local_to_scene** **(** :ref:`bool` enable **)** .. _class_Resource_set_name: - void **set_name** **(** :ref:`String` name **)** Set the name of the resources, any name is valid (it doesn't have to be unique). Name is for descriptive purposes only. .. _class_Resource_set_path: - void **set_path** **(** :ref:`String` path **)** Set the path of the resource. This is useful mainly for editors when saving/loading, and shouldn't be changed by anything else. Fails if another :ref:`Resource` already has path "path". .. _class_Resource_setup_local_to_scene: - void **setup_local_to_scene** **(** **)** .. _class_Resource_take_over_path: - void **take_over_path** **(** :ref:`String` path **)** Set the path of the resource. Differs from set_path(), if another :ref:`Resource` exists with "path" it over-takes it, instead of failing.