2
0

class_reference.rst 6.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the Reference.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_Reference:
  6. Reference
  7. =========
  8. **Inherits:** :ref:`Object<class_Object>`
  9. **Inherited By:** :ref:`ARVRInterface<class_ARVRInterface>`, :ref:`AStar<class_AStar>`, :ref:`AStar2D<class_AStar2D>`, :ref:`AnimationTrackEditPlugin<class_AnimationTrackEditPlugin>`, :ref:`AudioEffectInstance<class_AudioEffectInstance>`, :ref:`AudioStreamPlayback<class_AudioStreamPlayback>`, :ref:`CameraFeed<class_CameraFeed>`, :ref:`CharFXTransform<class_CharFXTransform>`, :ref:`ConfigFile<class_ConfigFile>`, :ref:`Crypto<class_Crypto>`, :ref:`DTLSServer<class_DTLSServer>`, :ref:`Directory<class_Directory>`, :ref:`EditorExportPlugin<class_EditorExportPlugin>`, :ref:`EditorFeatureProfile<class_EditorFeatureProfile>`, :ref:`EditorInspectorPlugin<class_EditorInspectorPlugin>`, :ref:`EditorResourceConversionPlugin<class_EditorResourceConversionPlugin>`, :ref:`EditorResourcePreviewGenerator<class_EditorResourcePreviewGenerator>`, :ref:`EditorSceneImporter<class_EditorSceneImporter>`, :ref:`EditorScenePostImport<class_EditorScenePostImport>`, :ref:`EditorScript<class_EditorScript>`, :ref:`EncodedObjectAsID<class_EncodedObjectAsID>`, :ref:`Expression<class_Expression>`, :ref:`File<class_File>`, :ref:`FuncRef<class_FuncRef>`, :ref:`GDNative<class_GDNative>`, :ref:`GDScriptFunctionState<class_GDScriptFunctionState>`, :ref:`HTTPClient<class_HTTPClient>`, :ref:`HashingContext<class_HashingContext>`, :ref:`JSONParseResult<class_JSONParseResult>`, :ref:`JavaClass<class_JavaClass>`, :ref:`KinematicCollision<class_KinematicCollision>`, :ref:`KinematicCollision2D<class_KinematicCollision2D>`, :ref:`MeshDataTool<class_MeshDataTool>`, :ref:`MultiplayerAPI<class_MultiplayerAPI>`, :ref:`Mutex<class_Mutex>`, :ref:`PCKPacker<class_PCKPacker>`, :ref:`PackedDataContainerRef<class_PackedDataContainerRef>`, :ref:`PacketPeer<class_PacketPeer>`, :ref:`Physics2DShapeQueryParameters<class_Physics2DShapeQueryParameters>`, :ref:`Physics2DShapeQueryResult<class_Physics2DShapeQueryResult>`, :ref:`Physics2DTestMotionResult<class_Physics2DTestMotionResult>`, :ref:`PhysicsShapeQueryParameters<class_PhysicsShapeQueryParameters>`, :ref:`PhysicsShapeQueryResult<class_PhysicsShapeQueryResult>`, :ref:`RandomNumberGenerator<class_RandomNumberGenerator>`, :ref:`RegEx<class_RegEx>`, :ref:`RegExMatch<class_RegExMatch>`, :ref:`Resource<class_Resource>`, :ref:`ResourceFormatLoader<class_ResourceFormatLoader>`, :ref:`ResourceFormatSaver<class_ResourceFormatSaver>`, :ref:`ResourceImporter<class_ResourceImporter>`, :ref:`ResourceInteractiveLoader<class_ResourceInteractiveLoader>`, :ref:`SceneState<class_SceneState>`, :ref:`SceneTreeTimer<class_SceneTreeTimer>`, :ref:`Semaphore<class_Semaphore>`, :ref:`SkinReference<class_SkinReference>`, :ref:`SpatialGizmo<class_SpatialGizmo>`, :ref:`SpatialVelocityTracker<class_SpatialVelocityTracker>`, :ref:`StreamPeer<class_StreamPeer>`, :ref:`SurfaceTool<class_SurfaceTool>`, :ref:`TCP_Server<class_TCP_Server>`, :ref:`Thread<class_Thread>`, :ref:`TriangleMesh<class_TriangleMesh>`, :ref:`UDPServer<class_UDPServer>`, :ref:`UPNP<class_UPNP>`, :ref:`UPNPDevice<class_UPNPDevice>`, :ref:`VisualScriptFunctionState<class_VisualScriptFunctionState>`, :ref:`WeakRef<class_WeakRef>`, :ref:`WebRTCPeerConnection<class_WebRTCPeerConnection>`, :ref:`XMLParser<class_XMLParser>`
  10. Base class for reference-counted objects.
  11. Description
  12. -----------
  13. Base class for any object that keeps a reference count. :ref:`Resource<class_Resource>` and many other helper objects inherit this class.
  14. Unlike :ref:`Object<class_Object>`\ s, References keep an internal reference counter so that they are automatically released when no longer in use, and only then. References therefore do not need to be freed manually with :ref:`Object.free<class_Object_method_free>`.
  15. In the vast majority of use cases, instantiating and using ``Reference``-derived types is all you need to do. The methods provided in this class are only for advanced users, and can cause issues if misused.
  16. Tutorials
  17. ---------
  18. - :doc:`../getting_started/workflow/best_practices/node_alternatives`
  19. Methods
  20. -------
  21. +-------------------------+--------------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`init_ref<class_Reference_method_init_ref>` **(** **)** |
  23. +-------------------------+--------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`reference<class_Reference_method_reference>` **(** **)** |
  25. +-------------------------+--------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | :ref:`unreference<class_Reference_method_unreference>` **(** **)** |
  27. +-------------------------+--------------------------------------------------------------------+
  28. Method Descriptions
  29. -------------------
  30. .. _class_Reference_method_init_ref:
  31. - :ref:`bool<class_bool>` **init_ref** **(** **)**
  32. Initializes the internal reference counter. Use this only if you really know what you are doing.
  33. Returns whether the initialization was successful.
  34. ----
  35. .. _class_Reference_method_reference:
  36. - :ref:`bool<class_bool>` **reference** **(** **)**
  37. Increments the internal reference counter. Use this only if you really know what you are doing.
  38. Returns ``true`` if the increment was successful, ``false`` otherwise.
  39. ----
  40. .. _class_Reference_method_unreference:
  41. - :ref:`bool<class_bool>` **unreference** **(** **)**
  42. Decrements the internal reference counter. Use this only if you really know what you are doing.
  43. Returns ``true`` if the decrement was successful, ``false`` otherwise.
  44. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  45. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  46. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`