classref: Add property overview and setter/getter like in editor docs

Output from godotengine/godot#22013.
Fixes #1729.
This commit is contained in:
Rémi Verschelde
2018-09-13 11:06:52 +02:00
parent f9caa4be29
commit ab3f908221
578 changed files with 33831 additions and 6706 deletions

View File

@@ -8,6 +8,7 @@ Camera2D
========
**Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
**Category:** Core
Brief Description
@@ -15,6 +16,59 @@ Brief Description
Camera node for 2D scenes.
Properties
----------
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`AnchorMode<enum_Camera2D_AnchorMode>` | :ref:`anchor_mode<class_Camera2D_anchor_mode>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`current<class_Camera2D_current>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`Node<class_Node>` | :ref:`custom_viewport<class_Camera2D_custom_viewport>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`drag_margin_bottom<class_Camera2D_drag_margin_bottom>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`drag_margin_h_enabled<class_Camera2D_drag_margin_h_enabled>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`drag_margin_left<class_Camera2D_drag_margin_left>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`drag_margin_right<class_Camera2D_drag_margin_right>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`drag_margin_top<class_Camera2D_drag_margin_top>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`drag_margin_v_enabled<class_Camera2D_drag_margin_v_enabled>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`editor_draw_drag_margin<class_Camera2D_editor_draw_drag_margin>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`editor_draw_limits<class_Camera2D_editor_draw_limits>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`editor_draw_screen<class_Camera2D_editor_draw_screen>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`limit_bottom<class_Camera2D_limit_bottom>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`limit_left<class_Camera2D_limit_left>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`limit_right<class_Camera2D_limit_right>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`limit_smoothed<class_Camera2D_limit_smoothed>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`limit_top<class_Camera2D_limit_top>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`offset<class_Camera2D_offset>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`offset_h<class_Camera2D_offset_h>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`offset_v<class_Camera2D_offset_v>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`rotating<class_Camera2D_rotating>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`smoothing_enabled<class_Camera2D_smoothing_enabled>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`smoothing_speed<class_Camera2D_smoothing_speed>` |
+---------------------------------------------+------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`zoom<class_Camera2D_zoom>` |
+---------------------------------------------+------------------------------------------------------------------------+
Methods
-------
@@ -39,12 +93,11 @@ Enumerations
.. _enum_Camera2D_AnchorMode:
enum **AnchorMode**
enum **AnchorMode**:
- **ANCHOR_MODE_FIXED_TOP_LEFT** = **0** --- The camera's position is fixed so that the top-left corner is always at the origin.
- **ANCHOR_MODE_DRAG_CENTER** = **1** --- The camera's position takes into account vertical/horizontal offsets and the screen size.
Description
-----------
@@ -57,141 +110,330 @@ Property Descriptions
.. _class_Camera2D_anchor_mode:
- :ref:`AnchorMode<enum_Camera2D_AnchorMode>` **anchor_mode** - The Camera2D's anchor point. See ``ANCHOR_MODE_*`` constants.
- :ref:`AnchorMode<enum_Camera2D_AnchorMode>` **anchor_mode**
+----------+------------------------+
| *Setter* | set_anchor_mode(value) |
+----------+------------------------+
| *Getter* | get_anchor_mode() |
+----------+------------------------+
The Camera2D's anchor point. See ``ANCHOR_MODE_*`` constants.
.. _class_Camera2D_current:
- :ref:`bool<class_bool>` **current** - If ``true`` the camera is the active camera for the current scene. Only one camera can be current, so setting a different camera ``current`` will disable this one.
- :ref:`bool<class_bool>` **current**
+----------+--------------+
| *Getter* | is_current() |
+----------+--------------+
If ``true`` the camera is the active camera for the current scene. Only one camera can be current, so setting a different camera ``current`` will disable this one.
.. _class_Camera2D_custom_viewport:
- :ref:`Node<class_Node>` **custom_viewport** - The custom :ref:`Viewport<class_Viewport>` node attached to the ``Camera2D``. If null or not a :ref:`Viewport<class_Viewport>`, uses the default viewport instead.
- :ref:`Node<class_Node>` **custom_viewport**
+----------+----------------------------+
| *Setter* | set_custom_viewport(value) |
+----------+----------------------------+
| *Getter* | get_custom_viewport() |
+----------+----------------------------+
The custom :ref:`Viewport<class_Viewport>` node attached to the ``Camera2D``. If null or not a :ref:`Viewport<class_Viewport>`, uses the default viewport instead.
.. _class_Camera2D_drag_margin_bottom:
- :ref:`float<class_float>` **drag_margin_bottom** - Bottom margin needed to drag the camera. A value of ``1`` makes the camera move only when reaching the edge of the screen.
- :ref:`float<class_float>` **drag_margin_bottom**
+----------+------------------------+
| *Setter* | set_drag_margin(value) |
+----------+------------------------+
| *Getter* | get_drag_margin() |
+----------+------------------------+
Bottom margin needed to drag the camera. A value of ``1`` makes the camera move only when reaching the edge of the screen.
.. _class_Camera2D_drag_margin_h_enabled:
- :ref:`bool<class_bool>` **drag_margin_h_enabled** - If ``true`` the camera only moves when reaching the horizontal drag margins. If ``false`` the camera moves horizontally regardless of margins. Default value: ``true``.
- :ref:`bool<class_bool>` **drag_margin_h_enabled**
+----------+---------------------------+
| *Setter* | set_h_drag_enabled(value) |
+----------+---------------------------+
| *Getter* | is_h_drag_enabled() |
+----------+---------------------------+
If ``true`` the camera only moves when reaching the horizontal drag margins. If ``false`` the camera moves horizontally regardless of margins. Default value: ``true``.
.. _class_Camera2D_drag_margin_left:
- :ref:`float<class_float>` **drag_margin_left** - Left margin needed to drag the camera. A value of ``1`` makes the camera move only when reaching the edge of the screen.
- :ref:`float<class_float>` **drag_margin_left**
+----------+------------------------+
| *Setter* | set_drag_margin(value) |
+----------+------------------------+
| *Getter* | get_drag_margin() |
+----------+------------------------+
Left margin needed to drag the camera. A value of ``1`` makes the camera move only when reaching the edge of the screen.
.. _class_Camera2D_drag_margin_right:
- :ref:`float<class_float>` **drag_margin_right** - Right margin needed to drag the camera. A value of ``1`` makes the camera move only when reaching the edge of the screen.
- :ref:`float<class_float>` **drag_margin_right**
+----------+------------------------+
| *Setter* | set_drag_margin(value) |
+----------+------------------------+
| *Getter* | get_drag_margin() |
+----------+------------------------+
Right margin needed to drag the camera. A value of ``1`` makes the camera move only when reaching the edge of the screen.
.. _class_Camera2D_drag_margin_top:
- :ref:`float<class_float>` **drag_margin_top** - Top margin needed to drag the camera. A value of ``1`` makes the camera move only when reaching the edge of the screen.
- :ref:`float<class_float>` **drag_margin_top**
+----------+------------------------+
| *Setter* | set_drag_margin(value) |
+----------+------------------------+
| *Getter* | get_drag_margin() |
+----------+------------------------+
Top margin needed to drag the camera. A value of ``1`` makes the camera move only when reaching the edge of the screen.
.. _class_Camera2D_drag_margin_v_enabled:
- :ref:`bool<class_bool>` **drag_margin_v_enabled** - If ``true`` the camera only moves when reaching the vertical drag margins. If ``false`` the camera moves vertically regardless of margins. Default value: ``true``.
- :ref:`bool<class_bool>` **drag_margin_v_enabled**
+----------+---------------------------+
| *Setter* | set_v_drag_enabled(value) |
+----------+---------------------------+
| *Getter* | is_v_drag_enabled() |
+----------+---------------------------+
If ``true`` the camera only moves when reaching the vertical drag margins. If ``false`` the camera moves vertically regardless of margins. Default value: ``true``.
.. _class_Camera2D_editor_draw_drag_margin:
- :ref:`bool<class_bool>` **editor_draw_drag_margin** - If ``true`` draws the camera's drag margin rectangle in the editor. Default value: ``false``
- :ref:`bool<class_bool>` **editor_draw_drag_margin**
+----------+-----------------------------------+
| *Setter* | set_margin_drawing_enabled(value) |
+----------+-----------------------------------+
| *Getter* | is_margin_drawing_enabled() |
+----------+-----------------------------------+
If ``true`` draws the camera's drag margin rectangle in the editor. Default value: ``false``
.. _class_Camera2D_editor_draw_limits:
- :ref:`bool<class_bool>` **editor_draw_limits** - If ``true`` draws the camera's limits rectangle in the editor. Default value: ``true``
- :ref:`bool<class_bool>` **editor_draw_limits**
+----------+----------------------------------+
| *Setter* | set_limit_drawing_enabled(value) |
+----------+----------------------------------+
| *Getter* | is_limit_drawing_enabled() |
+----------+----------------------------------+
If ``true`` draws the camera's limits rectangle in the editor. Default value: ``true``
.. _class_Camera2D_editor_draw_screen:
- :ref:`bool<class_bool>` **editor_draw_screen** - If ``true`` draws the camera's screen rectangle in the editor. Default value: ``false``
- :ref:`bool<class_bool>` **editor_draw_screen**
+----------+-----------------------------------+
| *Setter* | set_screen_drawing_enabled(value) |
+----------+-----------------------------------+
| *Getter* | is_screen_drawing_enabled() |
+----------+-----------------------------------+
If ``true`` draws the camera's screen rectangle in the editor. Default value: ``false``
.. _class_Camera2D_limit_bottom:
- :ref:`int<class_int>` **limit_bottom** - Bottom scroll limit in pixels. The camera stops moving when reaching this value.
- :ref:`int<class_int>` **limit_bottom**
+----------+------------------+
| *Setter* | set_limit(value) |
+----------+------------------+
| *Getter* | get_limit() |
+----------+------------------+
Bottom scroll limit in pixels. The camera stops moving when reaching this value.
.. _class_Camera2D_limit_left:
- :ref:`int<class_int>` **limit_left** - Left scroll limit in pixels. The camera stops moving when reaching this value.
- :ref:`int<class_int>` **limit_left**
+----------+------------------+
| *Setter* | set_limit(value) |
+----------+------------------+
| *Getter* | get_limit() |
+----------+------------------+
Left scroll limit in pixels. The camera stops moving when reaching this value.
.. _class_Camera2D_limit_right:
- :ref:`int<class_int>` **limit_right** - Right scroll limit in pixels. The camera stops moving when reaching this value.
- :ref:`int<class_int>` **limit_right**
+----------+------------------+
| *Setter* | set_limit(value) |
+----------+------------------+
| *Getter* | get_limit() |
+----------+------------------+
Right scroll limit in pixels. The camera stops moving when reaching this value.
.. _class_Camera2D_limit_smoothed:
- :ref:`bool<class_bool>` **limit_smoothed** - If ``true`` the camera smoothly stops when reaches its limits. Default value: ``false``
- :ref:`bool<class_bool>` **limit_smoothed**
+----------+------------------------------------+
| *Setter* | set_limit_smoothing_enabled(value) |
+----------+------------------------------------+
| *Getter* | is_limit_smoothing_enabled() |
+----------+------------------------------------+
If ``true`` the camera smoothly stops when reaches its limits. Default value: ``false``
.. _class_Camera2D_limit_top:
- :ref:`int<class_int>` **limit_top** - Top scroll limit in pixels. The camera stops moving when reaching this value.
- :ref:`int<class_int>` **limit_top**
+----------+------------------+
| *Setter* | set_limit(value) |
+----------+------------------+
| *Getter* | get_limit() |
+----------+------------------+
Top scroll limit in pixels. The camera stops moving when reaching this value.
.. _class_Camera2D_offset:
- :ref:`Vector2<class_Vector2>` **offset** - The camera's offset, useful for looking around or camera shake animations.
- :ref:`Vector2<class_Vector2>` **offset**
+----------+-------------------+
| *Setter* | set_offset(value) |
+----------+-------------------+
| *Getter* | get_offset() |
+----------+-------------------+
The camera's offset, useful for looking around or camera shake animations.
.. _class_Camera2D_offset_h:
- :ref:`float<class_float>` **offset_h** - The horizontal offset of the camera, relative to the drag margins. Default value: ``0``
- :ref:`float<class_float>` **offset_h**
+----------+---------------------+
| *Setter* | set_h_offset(value) |
+----------+---------------------+
| *Getter* | get_h_offset() |
+----------+---------------------+
The horizontal offset of the camera, relative to the drag margins. Default value: ``0``
.. _class_Camera2D_offset_v:
- :ref:`float<class_float>` **offset_v** - The vertical offset of the camera, relative to the drag margins. Default value: ``0``
- :ref:`float<class_float>` **offset_v**
+----------+---------------------+
| *Setter* | set_v_offset(value) |
+----------+---------------------+
| *Getter* | get_v_offset() |
+----------+---------------------+
The vertical offset of the camera, relative to the drag margins. Default value: ``0``
.. _class_Camera2D_rotating:
- :ref:`bool<class_bool>` **rotating** - If ``true`` the camera rotates with the target. Default value: ``false``
- :ref:`bool<class_bool>` **rotating**
+----------+---------------------+
| *Setter* | set_rotating(value) |
+----------+---------------------+
| *Getter* | is_rotating() |
+----------+---------------------+
If ``true`` the camera rotates with the target. Default value: ``false``
.. _class_Camera2D_smoothing_enabled:
- :ref:`bool<class_bool>` **smoothing_enabled** - If ``true`` the camera smoothly moves towards the target at :ref:`smoothing_speed<class_Camera2D_smoothing_speed>`. Default value: ``false``
- :ref:`bool<class_bool>` **smoothing_enabled**
+----------+------------------------------------+
| *Setter* | set_enable_follow_smoothing(value) |
+----------+------------------------------------+
| *Getter* | is_follow_smoothing_enabled() |
+----------+------------------------------------+
If ``true`` the camera smoothly moves towards the target at :ref:`smoothing_speed<class_Camera2D_smoothing_speed>`. Default value: ``false``
.. _class_Camera2D_smoothing_speed:
- :ref:`float<class_float>` **smoothing_speed** - Speed in pixels per second of the camera's smoothing effect when :ref:`smoothing_enabled<class_Camera2D_smoothing_enabled>` is ``true``
- :ref:`float<class_float>` **smoothing_speed**
+----------+-----------------------------+
| *Setter* | set_follow_smoothing(value) |
+----------+-----------------------------+
| *Getter* | get_follow_smoothing() |
+----------+-----------------------------+
Speed in pixels per second of the camera's smoothing effect when :ref:`smoothing_enabled<class_Camera2D_smoothing_enabled>` is ``true``
.. _class_Camera2D_zoom:
- :ref:`Vector2<class_Vector2>` **zoom** - The camera's zoom relative to the viewport. Values larger than ``Vector2(1, 1)`` zoom out and smaller values zoom in. For an example, use ``Vector2(0.5, 0.5)`` for a 2x zoom in, and ``Vector2(4, 4)`` for a 4x zoom out.
- :ref:`Vector2<class_Vector2>` **zoom**
+----------+-----------------+
| *Setter* | set_zoom(value) |
+----------+-----------------+
| *Getter* | get_zoom() |
+----------+-----------------+
The camera's zoom relative to the viewport. Values larger than ``Vector2(1, 1)`` zoom out and smaller values zoom in. For an example, use ``Vector2(0.5, 0.5)`` for a 2x zoom in, and ``Vector2(4, 4)`` for a 4x zoom out.
Method Descriptions
-------------------
.. _class_Camera2D_align:
.. _class_Camera2D_align:
- void **align** **(** **)**
Align the camera to the tracked node
.. _class_Camera2D_clear_current:
.. _class_Camera2D_clear_current:
- void **clear_current** **(** **)**
Removes any ``Camera2D`` from the ancestor :ref:`Viewport<class_Viewport>`'s internal currently-assigned camera.
.. _class_Camera2D_force_update_scroll:
.. _class_Camera2D_force_update_scroll:
- void **force_update_scroll** **(** **)**
Force the camera to update scroll immediately.
.. _class_Camera2D_get_camera_position:
.. _class_Camera2D_get_camera_position:
- :ref:`Vector2<class_Vector2>` **get_camera_position** **(** **)** const
Return the camera position.
.. _class_Camera2D_get_camera_screen_center:
.. _class_Camera2D_get_camera_screen_center:
- :ref:`Vector2<class_Vector2>` **get_camera_screen_center** **(** **)** const
Returns the location of the ``Camera2D``'s screen-center, relative to the origin.
.. _class_Camera2D_make_current:
.. _class_Camera2D_make_current:
- void **make_current** **(** **)**
Make this the current 2D camera for the scene (viewport and layer), in case there's many cameras in the scene.
.. _class_Camera2D_reset_smoothing:
.. _class_Camera2D_reset_smoothing:
- void **reset_smoothing** **(** **)**
@@ -199,4 +441,3 @@ Set the camera's position immediately to its current smoothing destination.
This has no effect if smoothing is disabled.