mirror of
https://github.com/Relintai/pandemonium_engine_docs.git
synced 2025-01-21 15:07:22 +01:00
308 lines
21 KiB
ReStructuredText
308 lines
21 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the Curve.xml source instead.
|
|
.. The source is found in doc/classes or modules/<name>/doc_classes.
|
|
|
|
.. _class_Curve:
|
|
|
|
Curve
|
|
=====
|
|
|
|
**Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
|
|
|
|
A mathematic curve.
|
|
|
|
Description
|
|
-----------
|
|
|
|
A curve that can be saved and re-used for other objects. By default, it ranges between ``0`` and ``1`` on the Y axis and positions points relative to the ``0.5`` Y position.
|
|
|
|
Properties
|
|
----------
|
|
|
|
+---------------------------+--------------------------------------------------------------+---------+
|
|
| :ref:`int<class_int>` | :ref:`bake_resolution<class_Curve_property_bake_resolution>` | ``100`` |
|
|
+---------------------------+--------------------------------------------------------------+---------+
|
|
| :ref:`float<class_float>` | :ref:`max_value<class_Curve_property_max_value>` | ``1.0`` |
|
|
+---------------------------+--------------------------------------------------------------+---------+
|
|
| :ref:`float<class_float>` | :ref:`min_value<class_Curve_property_min_value>` | ``0.0`` |
|
|
+---------------------------+--------------------------------------------------------------+---------+
|
|
|
|
Methods
|
|
-------
|
|
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`add_point<class_Curve_method_add_point>` **(** :ref:`Vector2<class_Vector2>` position, :ref:`float<class_float>` left_tangent=0, :ref:`float<class_float>` right_tangent=0, :ref:`TangentMode<enum_Curve_TangentMode>` left_mode=0, :ref:`TangentMode<enum_Curve_TangentMode>` right_mode=0 **)** |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`bake<class_Curve_method_bake>` **(** **)** |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`clean_dupes<class_Curve_method_clean_dupes>` **(** **)** |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`clear_points<class_Curve_method_clear_points>` **(** **)** |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_point_count<class_Curve_method_get_point_count>` **(** **)** |const| |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`TangentMode<enum_Curve_TangentMode>` | :ref:`get_point_left_mode<class_Curve_method_get_point_left_mode>` **(** :ref:`int<class_int>` index **)** |const| |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`get_point_left_tangent<class_Curve_method_get_point_left_tangent>` **(** :ref:`int<class_int>` index **)** |const| |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2<class_Vector2>` | :ref:`get_point_position<class_Curve_method_get_point_position>` **(** :ref:`int<class_int>` index **)** |const| |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`TangentMode<enum_Curve_TangentMode>` | :ref:`get_point_right_mode<class_Curve_method_get_point_right_mode>` **(** :ref:`int<class_int>` index **)** |const| |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`get_point_right_tangent<class_Curve_method_get_point_right_tangent>` **(** :ref:`int<class_int>` index **)** |const| |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`interpolate<class_Curve_method_interpolate>` **(** :ref:`float<class_float>` offset **)** |const| |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`interpolate_baked<class_Curve_method_interpolate_baked>` **(** :ref:`float<class_float>` offset **)** |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`remove_point<class_Curve_method_remove_point>` **(** :ref:`int<class_int>` index **)** |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_point_left_mode<class_Curve_method_set_point_left_mode>` **(** :ref:`int<class_int>` index, :ref:`TangentMode<enum_Curve_TangentMode>` mode **)** |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_point_left_tangent<class_Curve_method_set_point_left_tangent>` **(** :ref:`int<class_int>` index, :ref:`float<class_float>` tangent **)** |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`set_point_offset<class_Curve_method_set_point_offset>` **(** :ref:`int<class_int>` index, :ref:`float<class_float>` offset **)** |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_point_right_mode<class_Curve_method_set_point_right_mode>` **(** :ref:`int<class_int>` index, :ref:`TangentMode<enum_Curve_TangentMode>` mode **)** |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_point_right_tangent<class_Curve_method_set_point_right_tangent>` **(** :ref:`int<class_int>` index, :ref:`float<class_float>` tangent **)** |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_point_value<class_Curve_method_set_point_value>` **(** :ref:`int<class_int>` index, :ref:`float<class_float>` y **)** |
|
|
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
Signals
|
|
-------
|
|
|
|
.. _class_Curve_signal_range_changed:
|
|
|
|
- **range_changed** **(** **)**
|
|
|
|
Emitted when :ref:`max_value<class_Curve_property_max_value>` or :ref:`min_value<class_Curve_property_min_value>` is changed.
|
|
|
|
Enumerations
|
|
------------
|
|
|
|
.. _enum_Curve_TangentMode:
|
|
|
|
.. _class_Curve_constant_TANGENT_FREE:
|
|
|
|
.. _class_Curve_constant_TANGENT_LINEAR:
|
|
|
|
.. _class_Curve_constant_TANGENT_MODE_COUNT:
|
|
|
|
enum **TangentMode**:
|
|
|
|
- **TANGENT_FREE** = **0** --- The tangent on this side of the point is user-defined.
|
|
|
|
- **TANGENT_LINEAR** = **1** --- The curve calculates the tangent on this side of the point as the slope halfway towards the adjacent point.
|
|
|
|
- **TANGENT_MODE_COUNT** = **2** --- The total number of available tangent modes.
|
|
|
|
Property Descriptions
|
|
---------------------
|
|
|
|
.. _class_Curve_property_bake_resolution:
|
|
|
|
- :ref:`int<class_int>` **bake_resolution**
|
|
|
|
+-----------+----------------------------+
|
|
| *Default* | ``100`` |
|
|
+-----------+----------------------------+
|
|
| *Setter* | set_bake_resolution(value) |
|
|
+-----------+----------------------------+
|
|
| *Getter* | get_bake_resolution() |
|
|
+-----------+----------------------------+
|
|
|
|
The number of points to include in the baked (i.e. cached) curve data.
|
|
|
|
----
|
|
|
|
.. _class_Curve_property_max_value:
|
|
|
|
- :ref:`float<class_float>` **max_value**
|
|
|
|
+-----------+----------------------+
|
|
| *Default* | ``1.0`` |
|
|
+-----------+----------------------+
|
|
| *Setter* | set_max_value(value) |
|
|
+-----------+----------------------+
|
|
| *Getter* | get_max_value() |
|
|
+-----------+----------------------+
|
|
|
|
The maximum value the curve can reach.
|
|
|
|
----
|
|
|
|
.. _class_Curve_property_min_value:
|
|
|
|
- :ref:`float<class_float>` **min_value**
|
|
|
|
+-----------+----------------------+
|
|
| *Default* | ``0.0`` |
|
|
+-----------+----------------------+
|
|
| *Setter* | set_min_value(value) |
|
|
+-----------+----------------------+
|
|
| *Getter* | get_min_value() |
|
|
+-----------+----------------------+
|
|
|
|
The minimum value the curve can reach.
|
|
|
|
Method Descriptions
|
|
-------------------
|
|
|
|
.. _class_Curve_method_add_point:
|
|
|
|
- :ref:`int<class_int>` **add_point** **(** :ref:`Vector2<class_Vector2>` position, :ref:`float<class_float>` left_tangent=0, :ref:`float<class_float>` right_tangent=0, :ref:`TangentMode<enum_Curve_TangentMode>` left_mode=0, :ref:`TangentMode<enum_Curve_TangentMode>` right_mode=0 **)**
|
|
|
|
Adds a point to the curve. For each side, if the ``*_mode`` is :ref:`TANGENT_LINEAR<class_Curve_constant_TANGENT_LINEAR>`, the ``*_tangent`` angle (in degrees) uses the slope of the curve halfway to the adjacent point. Allows custom assignments to the ``*_tangent`` angle if ``*_mode`` is set to :ref:`TANGENT_FREE<class_Curve_constant_TANGENT_FREE>`.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_bake:
|
|
|
|
- void **bake** **(** **)**
|
|
|
|
Recomputes the baked cache of points for the curve.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_clean_dupes:
|
|
|
|
- void **clean_dupes** **(** **)**
|
|
|
|
Removes points that are closer than ``CMP_EPSILON`` (0.00001) units to their neighbor on the curve.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_clear_points:
|
|
|
|
- void **clear_points** **(** **)**
|
|
|
|
Removes all points from the curve.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_get_point_count:
|
|
|
|
- :ref:`int<class_int>` **get_point_count** **(** **)** |const|
|
|
|
|
Returns the number of points describing the curve.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_get_point_left_mode:
|
|
|
|
- :ref:`TangentMode<enum_Curve_TangentMode>` **get_point_left_mode** **(** :ref:`int<class_int>` index **)** |const|
|
|
|
|
Returns the left :ref:`TangentMode<enum_Curve_TangentMode>` for the point at ``index``.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_get_point_left_tangent:
|
|
|
|
- :ref:`float<class_float>` **get_point_left_tangent** **(** :ref:`int<class_int>` index **)** |const|
|
|
|
|
Returns the left tangent angle (in degrees) for the point at ``index``.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_get_point_position:
|
|
|
|
- :ref:`Vector2<class_Vector2>` **get_point_position** **(** :ref:`int<class_int>` index **)** |const|
|
|
|
|
Returns the curve coordinates for the point at ``index``.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_get_point_right_mode:
|
|
|
|
- :ref:`TangentMode<enum_Curve_TangentMode>` **get_point_right_mode** **(** :ref:`int<class_int>` index **)** |const|
|
|
|
|
Returns the right :ref:`TangentMode<enum_Curve_TangentMode>` for the point at ``index``.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_get_point_right_tangent:
|
|
|
|
- :ref:`float<class_float>` **get_point_right_tangent** **(** :ref:`int<class_int>` index **)** |const|
|
|
|
|
Returns the right tangent angle (in degrees) for the point at ``index``.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_interpolate:
|
|
|
|
- :ref:`float<class_float>` **interpolate** **(** :ref:`float<class_float>` offset **)** |const|
|
|
|
|
Returns the Y value for the point that would exist at the X position ``offset`` along the curve.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_interpolate_baked:
|
|
|
|
- :ref:`float<class_float>` **interpolate_baked** **(** :ref:`float<class_float>` offset **)**
|
|
|
|
Returns the Y value for the point that would exist at the X position ``offset`` along the curve using the baked cache. Bakes the curve's points if not already baked.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_remove_point:
|
|
|
|
- void **remove_point** **(** :ref:`int<class_int>` index **)**
|
|
|
|
Removes the point at ``index`` from the curve.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_set_point_left_mode:
|
|
|
|
- void **set_point_left_mode** **(** :ref:`int<class_int>` index, :ref:`TangentMode<enum_Curve_TangentMode>` mode **)**
|
|
|
|
Sets the left :ref:`TangentMode<enum_Curve_TangentMode>` for the point at ``index`` to ``mode``.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_set_point_left_tangent:
|
|
|
|
- void **set_point_left_tangent** **(** :ref:`int<class_int>` index, :ref:`float<class_float>` tangent **)**
|
|
|
|
Sets the left tangent angle for the point at ``index`` to ``tangent``.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_set_point_offset:
|
|
|
|
- :ref:`int<class_int>` **set_point_offset** **(** :ref:`int<class_int>` index, :ref:`float<class_float>` offset **)**
|
|
|
|
Sets the offset from ``0.5``.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_set_point_right_mode:
|
|
|
|
- void **set_point_right_mode** **(** :ref:`int<class_int>` index, :ref:`TangentMode<enum_Curve_TangentMode>` mode **)**
|
|
|
|
Sets the right :ref:`TangentMode<enum_Curve_TangentMode>` for the point at ``index`` to ``mode``.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_set_point_right_tangent:
|
|
|
|
- void **set_point_right_tangent** **(** :ref:`int<class_int>` index, :ref:`float<class_float>` tangent **)**
|
|
|
|
Sets the right tangent angle for the point at ``index`` to ``tangent``.
|
|
|
|
----
|
|
|
|
.. _class_Curve_method_set_point_value:
|
|
|
|
- void **set_point_value** **(** :ref:`int<class_int>` index, :ref:`float<class_float>` y **)**
|
|
|
|
Assigns the vertical position ``y`` to the point at ``index``.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|