:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/VisualShader.xml. .. _class_VisualShader: VisualShader ============ **Inherits:** :ref:`Shader` **<** :ref:`Resource` **<** :ref:`Reference` **<** :ref:`Object` A custom shader program with a visual editor. .. rst-class:: classref-introduction-group Description ----------- This class allows you to define a custom shader program that can be used for various materials to render objects. The visual shader editor creates the shader. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +-------------------------------+---------------------------------------------------------------+---------------------+ | :ref:`Vector2` | :ref:`graph_offset` | ``Vector2( 0, 0 )`` | +-------------------------------+---------------------------------------------------------------+---------------------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_node` **(** :ref:`Type` type, :ref:`VisualShaderNode` node, :ref:`Vector2` position, :ref:`int` id **)** | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`can_connect_nodes` **(** :ref:`Type` type, :ref:`int` from_node, :ref:`int` from_port, :ref:`int` to_node, :ref:`int` to_port **)** |const| | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`connect_nodes` **(** :ref:`Type` type, :ref:`int` from_node, :ref:`int` from_port, :ref:`int` to_node, :ref:`int` to_port **)** | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`connect_nodes_forced` **(** :ref:`Type` type, :ref:`int` from_node, :ref:`int` from_port, :ref:`int` to_node, :ref:`int` to_port **)** | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`disconnect_nodes` **(** :ref:`Type` type, :ref:`int` from_node, :ref:`int` from_port, :ref:`int` to_node, :ref:`int` to_port **)** | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`VisualShaderNode` | :ref:`get_node` **(** :ref:`Type` type, :ref:`int` id **)** |const| | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_node_connections` **(** :ref:`Type` type **)** |const| | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PoolIntArray` | :ref:`get_node_list` **(** :ref:`Type` type **)** |const| | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_node_position` **(** :ref:`Type` type, :ref:`int` id **)** |const| | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_valid_node_id` **(** :ref:`Type` type **)** |const| | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_node_connection` **(** :ref:`Type` type, :ref:`int` from_node, :ref:`int` from_port, :ref:`int` to_node, :ref:`int` to_port **)** |const| | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_node` **(** :ref:`Type` type, :ref:`int` id **)** | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_mode` **(** :ref:`Mode` mode **)** | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_node_position` **(** :ref:`Type` type, :ref:`int` id, :ref:`Vector2` position **)** | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Enumerations ------------ .. _enum_VisualShader_Type: .. rst-class:: classref-enumeration enum **Type**: .. _class_VisualShader_constant_TYPE_VERTEX: .. rst-class:: classref-enumeration-constant :ref:`Type` **TYPE_VERTEX** = ``0`` A vertex shader, operating on vertices. .. _class_VisualShader_constant_TYPE_FRAGMENT: .. rst-class:: classref-enumeration-constant :ref:`Type` **TYPE_FRAGMENT** = ``1`` A fragment shader, operating on fragments (pixels). .. _class_VisualShader_constant_TYPE_LIGHT: .. rst-class:: classref-enumeration-constant :ref:`Type` **TYPE_LIGHT** = ``2`` A shader for light calculations. .. _class_VisualShader_constant_TYPE_MAX: .. rst-class:: classref-enumeration-constant :ref:`Type` **TYPE_MAX** = ``3`` Represents the size of the :ref:`Type` enum. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Constants --------- .. _class_VisualShader_constant_NODE_ID_INVALID: .. rst-class:: classref-constant **NODE_ID_INVALID** = ``-1`` .. _class_VisualShader_constant_NODE_ID_OUTPUT: .. rst-class:: classref-constant **NODE_ID_OUTPUT** = ``0`` .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_VisualShader_property_graph_offset: .. rst-class:: classref-property :ref:`Vector2` **graph_offset** = ``Vector2( 0, 0 )`` .. rst-class:: classref-property-setget - void **set_graph_offset** **(** :ref:`Vector2` value **)** - :ref:`Vector2` **get_graph_offset** **(** **)** The offset vector of the whole graph. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_VisualShader_method_add_node: .. rst-class:: classref-method void **add_node** **(** :ref:`Type` type, :ref:`VisualShaderNode` node, :ref:`Vector2` position, :ref:`int` id **)** Adds the specified node to the shader. .. rst-class:: classref-item-separator ---- .. _class_VisualShader_method_can_connect_nodes: .. rst-class:: classref-method :ref:`bool` **can_connect_nodes** **(** :ref:`Type` type, :ref:`int` from_node, :ref:`int` from_port, :ref:`int` to_node, :ref:`int` to_port **)** |const| Returns ``true`` if the specified nodes and ports can be connected together. .. rst-class:: classref-item-separator ---- .. _class_VisualShader_method_connect_nodes: .. rst-class:: classref-method :ref:`Error` **connect_nodes** **(** :ref:`Type` type, :ref:`int` from_node, :ref:`int` from_port, :ref:`int` to_node, :ref:`int` to_port **)** Connects the specified nodes and ports. .. rst-class:: classref-item-separator ---- .. _class_VisualShader_method_connect_nodes_forced: .. rst-class:: classref-method void **connect_nodes_forced** **(** :ref:`Type` type, :ref:`int` from_node, :ref:`int` from_port, :ref:`int` to_node, :ref:`int` to_port **)** Connects the specified nodes and ports, even if they can't be connected. Such connection is invalid and will not function properly. .. rst-class:: classref-item-separator ---- .. _class_VisualShader_method_disconnect_nodes: .. rst-class:: classref-method void **disconnect_nodes** **(** :ref:`Type` type, :ref:`int` from_node, :ref:`int` from_port, :ref:`int` to_node, :ref:`int` to_port **)** Connects the specified nodes and ports. .. rst-class:: classref-item-separator ---- .. _class_VisualShader_method_get_node: .. rst-class:: classref-method :ref:`VisualShaderNode` **get_node** **(** :ref:`Type` type, :ref:`int` id **)** |const| Returns the shader node instance with specified ``type`` and ``id``. .. rst-class:: classref-item-separator ---- .. _class_VisualShader_method_get_node_connections: .. rst-class:: classref-method :ref:`Array` **get_node_connections** **(** :ref:`Type` type **)** |const| Returns the list of connected nodes with the specified type. .. rst-class:: classref-item-separator ---- .. _class_VisualShader_method_get_node_list: .. rst-class:: classref-method :ref:`PoolIntArray` **get_node_list** **(** :ref:`Type` type **)** |const| Returns the list of all nodes in the shader with the specified type. .. rst-class:: classref-item-separator ---- .. _class_VisualShader_method_get_node_position: .. rst-class:: classref-method :ref:`Vector2` **get_node_position** **(** :ref:`Type` type, :ref:`int` id **)** |const| Returns the position of the specified node within the shader graph. .. rst-class:: classref-item-separator ---- .. _class_VisualShader_method_get_valid_node_id: .. rst-class:: classref-method :ref:`int` **get_valid_node_id** **(** :ref:`Type` type **)** |const| .. container:: contribute There is currently no description for this method. Please help us by :ref:`contributing one `! .. rst-class:: classref-item-separator ---- .. _class_VisualShader_method_is_node_connection: .. rst-class:: classref-method :ref:`bool` **is_node_connection** **(** :ref:`Type` type, :ref:`int` from_node, :ref:`int` from_port, :ref:`int` to_node, :ref:`int` to_port **)** |const| Returns ``true`` if the specified node and port connection exist. .. rst-class:: classref-item-separator ---- .. _class_VisualShader_method_remove_node: .. rst-class:: classref-method void **remove_node** **(** :ref:`Type` type, :ref:`int` id **)** Removes the specified node from the shader. .. rst-class:: classref-item-separator ---- .. _class_VisualShader_method_set_mode: .. rst-class:: classref-method void **set_mode** **(** :ref:`Mode` mode **)** Sets the mode of this shader. .. rst-class:: classref-item-separator ---- .. _class_VisualShader_method_set_node_position: .. rst-class:: classref-method void **set_node_position** **(** :ref:`Type` type, :ref:`int` id, :ref:`Vector2` position **)** Sets the position of the specified node. .. |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.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`