Skip to content

Latest commit

 

History

History
98 lines (58 loc) · 5.88 KB

class_resource.rst

File metadata and controls

98 lines (58 loc) · 5.88 KB

Resource

Inherits: Reference<class_reference> < Object<class_object>

Inherited By: Theme<class_theme>, AudioStream<class_audiostream>, Sky<class_sky>, CubeMap<class_cubemap>, DynamicFontData<class_dynamicfontdata>, InputEvent<class_inputevent>, Translation<class_translation>, Curve2D<class_curve2d>, Shape<class_shape>, Shape2D<class_shape2d>, Curve<class_curve>, StyleBox<class_stylebox>, Environment<class_environment>, GDNativeLibrary<class_gdnativelibrary>, Material<class_material>, VideoStream<class_videostream>, PackedScene<class_packedscene>, Texture<class_texture>, Mesh<class_mesh>, ButtonGroup<class_buttongroup>, TileSet<class_tileset>, ShortCut<class_shortcut>, BitMap<class_bitmap>, Animation<class_animation>, BakedLightmapData<class_bakedlightmapdata>, PolygonPathFinder<class_polygonpathfinder>, Shader<class_shader>, Script<class_script>, AudioBusLayout<class_audiobuslayout>, World<class_world>, AudioEffect<class_audioeffect>, VisualScriptNode<class_visualscriptnode>, World2D<class_world2d>, GIProbeData<class_giprobedata>, Font<class_font>, SpriteFrames<class_spriteframes>, MeshLibrary<class_meshlibrary>, Curve3D<class_curve3d>, NavigationPolygon<class_navigationpolygon>, EditorSettings<class_editorsettings>, Image<class_image>, Gradient<class_gradient>, OccluderPolygon2D<class_occluderpolygon2d>, MultiMesh<class_multimesh>, PackedDataContainer<class_packeddatacontainer>, NavigationMesh<class_navigationmesh>

Category: Core

Brief Description

Base class for all resources.

Member Functions

void _setup_local_to_scene<class_Resource__setup_local_to_scene> ( ) virtual
Resource<class_resource> duplicate<class_Resource_duplicate> ( bool<class_bool> subresources=false ) const
Node<class_node> get_local_scene<class_Resource_get_local_scene> ( ) const
RID<class_rid> get_rid<class_Resource_get_rid> ( ) const
void setup_local_to_scene<class_Resource_setup_local_to_scene> ( )
void take_over_path<class_Resource_take_over_path> ( String<class_string> path )

Signals

  • changed ( )

Member Variables

  • bool<class_bool> resource_local_to_scene
  • String<class_string> resource_name
  • String<class_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 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 Node<class_node> or another resource.

Member Function Description

  • void _setup_local_to_scene ( ) virtual
  • Resource<class_resource> duplicate ( bool<class_bool> subresources=false ) const
  • Node<class_node> get_local_scene ( ) const
  • RID<class_rid> get_rid ( ) const

Return the RID of the resource (or an empty RID). Many resources (such as Texture<class_texture>, Mesh<class_mesh>, etc) are high level abstractions of resources stored in a server, so this function will return the original RID.

  • void setup_local_to_scene ( )
  • void take_over_path ( String<class_string> path )

Set the path of the resource. Differs from set_path(), if another Resource exists with "path" it over-takes it, instead of failing.