Files
godot-docs/classes/class_graphelement.rst
2025-12-15 22:19:00 +00:00

298 lines
10 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/GraphElement.xml.
.. _class_GraphElement:
GraphElement
============
**Experimental:** This class may be changed or removed in future versions.
**Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
**Inherited By:** :ref:`GraphFrame<class_GraphFrame>`, :ref:`GraphNode<class_GraphNode>`
A container that represents a basic element that can be placed inside a :ref:`GraphEdit<class_GraphEdit>` control.
.. rst-class:: classref-introduction-group
Description
-----------
**GraphElement** allows to create custom elements for a :ref:`GraphEdit<class_GraphEdit>` graph. By default such elements can be selected, resized, and repositioned, but they cannot be connected. For a graph element that allows for connections see :ref:`GraphNode<class_GraphNode>`.
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
+-------------------------------+---------------------------------------------------------------------+-------------------+
| :ref:`bool<class_bool>` | :ref:`draggable<class_GraphElement_property_draggable>` | ``true`` |
+-------------------------------+---------------------------------------------------------------------+-------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`position_offset<class_GraphElement_property_position_offset>` | ``Vector2(0, 0)`` |
+-------------------------------+---------------------------------------------------------------------+-------------------+
| :ref:`bool<class_bool>` | :ref:`resizable<class_GraphElement_property_resizable>` | ``false`` |
+-------------------------------+---------------------------------------------------------------------+-------------------+
| :ref:`bool<class_bool>` | :ref:`scaling_menus<class_GraphElement_property_scaling_menus>` | ``false`` |
+-------------------------------+---------------------------------------------------------------------+-------------------+
| :ref:`bool<class_bool>` | :ref:`selectable<class_GraphElement_property_selectable>` | ``true`` |
+-------------------------------+---------------------------------------------------------------------+-------------------+
| :ref:`bool<class_bool>` | :ref:`selected<class_GraphElement_property_selected>` | ``false`` |
+-------------------------------+---------------------------------------------------------------------+-------------------+
.. rst-class:: classref-reftable-group
Theme Properties
----------------
.. table::
:widths: auto
+-----------------------------------+-------------------------------------------------------+
| :ref:`Texture2D<class_Texture2D>` | :ref:`resizer<class_GraphElement_theme_icon_resizer>` |
+-----------------------------------+-------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Signals
-------
.. _class_GraphElement_signal_delete_request:
.. rst-class:: classref-signal
**delete_request**\ (\ ) :ref:`🔗<class_GraphElement_signal_delete_request>`
Emitted when removing the GraphElement is requested.
.. rst-class:: classref-item-separator
----
.. _class_GraphElement_signal_dragged:
.. rst-class:: classref-signal
**dragged**\ (\ from\: :ref:`Vector2<class_Vector2>`, to\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_GraphElement_signal_dragged>`
Emitted when the GraphElement is dragged.
.. rst-class:: classref-item-separator
----
.. _class_GraphElement_signal_node_deselected:
.. rst-class:: classref-signal
**node_deselected**\ (\ ) :ref:`🔗<class_GraphElement_signal_node_deselected>`
Emitted when the GraphElement is deselected.
.. rst-class:: classref-item-separator
----
.. _class_GraphElement_signal_node_selected:
.. rst-class:: classref-signal
**node_selected**\ (\ ) :ref:`🔗<class_GraphElement_signal_node_selected>`
Emitted when the GraphElement is selected.
.. rst-class:: classref-item-separator
----
.. _class_GraphElement_signal_position_offset_changed:
.. rst-class:: classref-signal
**position_offset_changed**\ (\ ) :ref:`🔗<class_GraphElement_signal_position_offset_changed>`
Emitted when the GraphElement is moved.
.. rst-class:: classref-item-separator
----
.. _class_GraphElement_signal_raise_request:
.. rst-class:: classref-signal
**raise_request**\ (\ ) :ref:`🔗<class_GraphElement_signal_raise_request>`
Emitted when displaying the GraphElement over other ones is requested. Happens on focusing (clicking into) the GraphElement.
.. rst-class:: classref-item-separator
----
.. _class_GraphElement_signal_resize_end:
.. rst-class:: classref-signal
**resize_end**\ (\ new_size\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_GraphElement_signal_resize_end>`
Emitted when releasing the mouse button after dragging the resizer handle (see :ref:`resizable<class_GraphElement_property_resizable>`).
.. rst-class:: classref-item-separator
----
.. _class_GraphElement_signal_resize_request:
.. rst-class:: classref-signal
**resize_request**\ (\ new_size\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_GraphElement_signal_resize_request>`
Emitted when resizing the GraphElement is requested. Happens on dragging the resizer handle (see :ref:`resizable<class_GraphElement_property_resizable>`).
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_GraphElement_property_draggable:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **draggable** = ``true`` :ref:`🔗<class_GraphElement_property_draggable>`
.. rst-class:: classref-property-setget
- |void| **set_draggable**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_draggable**\ (\ )
If ``true``, the user can drag the GraphElement.
.. rst-class:: classref-item-separator
----
.. _class_GraphElement_property_position_offset:
.. rst-class:: classref-property
:ref:`Vector2<class_Vector2>` **position_offset** = ``Vector2(0, 0)`` :ref:`🔗<class_GraphElement_property_position_offset>`
.. rst-class:: classref-property-setget
- |void| **set_position_offset**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
- :ref:`Vector2<class_Vector2>` **get_position_offset**\ (\ )
The offset of the GraphElement, relative to the scroll offset of the :ref:`GraphEdit<class_GraphEdit>`.
.. rst-class:: classref-item-separator
----
.. _class_GraphElement_property_resizable:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **resizable** = ``false`` :ref:`🔗<class_GraphElement_property_resizable>`
.. rst-class:: classref-property-setget
- |void| **set_resizable**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_resizable**\ (\ )
If ``true``, the user can resize the GraphElement.
\ **Note:** Dragging the handle will only emit the :ref:`resize_request<class_GraphElement_signal_resize_request>` and :ref:`resize_end<class_GraphElement_signal_resize_end>` signals, the GraphElement needs to be resized manually.
.. rst-class:: classref-item-separator
----
.. _class_GraphElement_property_scaling_menus:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **scaling_menus** = ``false`` :ref:`🔗<class_GraphElement_property_scaling_menus>`
.. rst-class:: classref-property-setget
- |void| **set_scaling_menus**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_scaling_menus**\ (\ )
If ``true``, :ref:`PopupMenu<class_PopupMenu>`\ s that are descendants of the GraphElement are scaled with the :ref:`GraphEdit<class_GraphEdit>` zoom.
.. rst-class:: classref-item-separator
----
.. _class_GraphElement_property_selectable:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **selectable** = ``true`` :ref:`🔗<class_GraphElement_property_selectable>`
.. rst-class:: classref-property-setget
- |void| **set_selectable**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_selectable**\ (\ )
If ``true``, the user can select the GraphElement.
.. rst-class:: classref-item-separator
----
.. _class_GraphElement_property_selected:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **selected** = ``false`` :ref:`🔗<class_GraphElement_property_selected>`
.. rst-class:: classref-property-setget
- |void| **set_selected**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_selected**\ (\ )
If ``true``, the GraphElement is selected.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Theme Property Descriptions
---------------------------
.. _class_GraphElement_theme_icon_resizer:
.. rst-class:: classref-themeproperty
:ref:`Texture2D<class_Texture2D>` **resizer** :ref:`🔗<class_GraphElement_theme_icon_resizer>`
The icon used for the resizer, visible when :ref:`resizable<class_GraphElement_property_resizable>` is enabled.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |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.)`
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
.. |void| replace:: :abbr:`void (No return value.)`