class_resource.rst 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Resource.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Resource:
  5. Resource
  6. ========
  7. **Inherits:** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  8. **Inherited By:** :ref:`Theme<class_theme>`, :ref:`AudioStream<class_audiostream>`, :ref:`Sky<class_sky>`, :ref:`CubeMap<class_cubemap>`, :ref:`DynamicFontData<class_dynamicfontdata>`, :ref:`InputEvent<class_inputevent>`, :ref:`Translation<class_translation>`, :ref:`Curve2D<class_curve2d>`, :ref:`Shape<class_shape>`, :ref:`Shape2D<class_shape2d>`, :ref:`Curve<class_curve>`, :ref:`StyleBox<class_stylebox>`, :ref:`Environment<class_environment>`, :ref:`GDNativeLibrary<class_gdnativelibrary>`, :ref:`Material<class_material>`, :ref:`VideoStream<class_videostream>`, :ref:`PackedScene<class_packedscene>`, :ref:`Texture<class_texture>`, :ref:`Mesh<class_mesh>`, :ref:`ButtonGroup<class_buttongroup>`, :ref:`TileSet<class_tileset>`, :ref:`ShortCut<class_shortcut>`, :ref:`BitMap<class_bitmap>`, :ref:`Animation<class_animation>`, :ref:`BakedLightmapData<class_bakedlightmapdata>`, :ref:`PolygonPathFinder<class_polygonpathfinder>`, :ref:`Shader<class_shader>`, :ref:`Script<class_script>`, :ref:`AudioBusLayout<class_audiobuslayout>`, :ref:`World<class_world>`, :ref:`AudioEffect<class_audioeffect>`, :ref:`VisualScriptNode<class_visualscriptnode>`, :ref:`World2D<class_world2d>`, :ref:`GIProbeData<class_giprobedata>`, :ref:`Font<class_font>`, :ref:`SpriteFrames<class_spriteframes>`, :ref:`MeshLibrary<class_meshlibrary>`, :ref:`Curve3D<class_curve3d>`, :ref:`NavigationPolygon<class_navigationpolygon>`, :ref:`EditorSettings<class_editorsettings>`, :ref:`Image<class_image>`, :ref:`Gradient<class_gradient>`, :ref:`OccluderPolygon2D<class_occluderpolygon2d>`, :ref:`MultiMesh<class_multimesh>`, :ref:`PackedDataContainer<class_packeddatacontainer>`, :ref:`NavigationMesh<class_navigationmesh>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Base class for all resources.
  13. Member Functions
  14. ----------------
  15. +----------------------------------+---------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`_setup_local_to_scene<class_Resource__setup_local_to_scene>` **(** **)** virtual |
  17. +----------------------------------+---------------------------------------------------------------------------------------------------------+
  18. | :ref:`Resource<class_resource>` | :ref:`duplicate<class_Resource_duplicate>` **(** :ref:`bool<class_bool>` subresources=false **)** const |
  19. +----------------------------------+---------------------------------------------------------------------------------------------------------+
  20. | :ref:`Node<class_node>` | :ref:`get_local_scene<class_Resource_get_local_scene>` **(** **)** const |
  21. +----------------------------------+---------------------------------------------------------------------------------------------------------+
  22. | :ref:`RID<class_rid>` | :ref:`get_rid<class_Resource_get_rid>` **(** **)** const |
  23. +----------------------------------+---------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`setup_local_to_scene<class_Resource_setup_local_to_scene>` **(** **)** |
  25. +----------------------------------+---------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`take_over_path<class_Resource_take_over_path>` **(** :ref:`String<class_string>` path **)** |
  27. +----------------------------------+---------------------------------------------------------------------------------------------------------+
  28. Signals
  29. -------
  30. .. _class_Resource_changed:
  31. - **changed** **(** **)**
  32. Member Variables
  33. ----------------
  34. .. _class_Resource_resource_local_to_scene:
  35. - :ref:`bool<class_bool>` **resource_local_to_scene**
  36. .. _class_Resource_resource_name:
  37. - :ref:`String<class_string>` **resource_name**
  38. .. _class_Resource_resource_path:
  39. - :ref:`String<class_string>` **resource_path**
  40. Description
  41. -----------
  42. 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<class_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<class_node>` or another resource.
  43. Member Function Description
  44. ---------------------------
  45. .. _class_Resource__setup_local_to_scene:
  46. - void **_setup_local_to_scene** **(** **)** virtual
  47. .. _class_Resource_duplicate:
  48. - :ref:`Resource<class_resource>` **duplicate** **(** :ref:`bool<class_bool>` subresources=false **)** const
  49. .. _class_Resource_get_local_scene:
  50. - :ref:`Node<class_node>` **get_local_scene** **(** **)** const
  51. .. _class_Resource_get_rid:
  52. - :ref:`RID<class_rid>` **get_rid** **(** **)** const
  53. Return the RID of the resource (or an empty RID). Many resources (such as :ref:`Texture<class_texture>`, :ref:`Mesh<class_mesh>`, etc) are high level abstractions of resources stored in a server, so this function will return the original RID.
  54. .. _class_Resource_setup_local_to_scene:
  55. - void **setup_local_to_scene** **(** **)**
  56. .. _class_Resource_take_over_path:
  57. - void **take_over_path** **(** :ref:`String<class_string>` path **)**
  58. Set the path of the resource. Differs from set_path(), if another ``Resource`` exists with "path" it over-takes it, instead of failing.