pandemonium_engine_docs/classes/class_visualshadernode.rst

142 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/3.5/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/3.5/doc/classes/VisualShaderNode.xml.
.. _class_VisualShaderNode:
VisualShaderNode
================
**Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
**Inherited By:** :ref:`VisualShaderNodeBooleanConstant<class_VisualShaderNodeBooleanConstant>`, :ref:`VisualShaderNodeColorConstant<class_VisualShaderNodeColorConstant>`, :ref:`VisualShaderNodeColorFunc<class_VisualShaderNodeColorFunc>`, :ref:`VisualShaderNodeColorOp<class_VisualShaderNodeColorOp>`, :ref:`VisualShaderNodeCompare<class_VisualShaderNodeCompare>`, :ref:`VisualShaderNodeCubeMap<class_VisualShaderNodeCubeMap>`, :ref:`VisualShaderNodeCustom<class_VisualShaderNodeCustom>`, :ref:`VisualShaderNodeDeterminant<class_VisualShaderNodeDeterminant>`, :ref:`VisualShaderNodeDotProduct<class_VisualShaderNodeDotProduct>`, :ref:`VisualShaderNodeFaceForward<class_VisualShaderNodeFaceForward>`, :ref:`VisualShaderNodeFresnel<class_VisualShaderNodeFresnel>`, :ref:`VisualShaderNodeGroupBase<class_VisualShaderNodeGroupBase>`, :ref:`VisualShaderNodeIf<class_VisualShaderNodeIf>`, :ref:`VisualShaderNodeInput<class_VisualShaderNodeInput>`, :ref:`VisualShaderNodeIs<class_VisualShaderNodeIs>`, :ref:`VisualShaderNodeOuterProduct<class_VisualShaderNodeOuterProduct>`, :ref:`VisualShaderNodeOutput<class_VisualShaderNodeOutput>`, :ref:`VisualShaderNodeScalarClamp<class_VisualShaderNodeScalarClamp>`, :ref:`VisualShaderNodeScalarConstant<class_VisualShaderNodeScalarConstant>`, :ref:`VisualShaderNodeScalarDerivativeFunc<class_VisualShaderNodeScalarDerivativeFunc>`, :ref:`VisualShaderNodeScalarFunc<class_VisualShaderNodeScalarFunc>`, :ref:`VisualShaderNodeScalarInterp<class_VisualShaderNodeScalarInterp>`, :ref:`VisualShaderNodeScalarOp<class_VisualShaderNodeScalarOp>`, :ref:`VisualShaderNodeScalarSmoothStep<class_VisualShaderNodeScalarSmoothStep>`, :ref:`VisualShaderNodeSwitch<class_VisualShaderNodeSwitch>`, :ref:`VisualShaderNodeTexture<class_VisualShaderNodeTexture>`, :ref:`VisualShaderNodeTransformCompose<class_VisualShaderNodeTransformCompose>`, :ref:`VisualShaderNodeTransformConstant<class_VisualShaderNodeTransformConstant>`, :ref:`VisualShaderNodeTransformDecompose<class_VisualShaderNodeTransformDecompose>`, :ref:`VisualShaderNodeTransformFunc<class_VisualShaderNodeTransformFunc>`, :ref:`VisualShaderNodeTransformMult<class_VisualShaderNodeTransformMult>`, :ref:`VisualShaderNodeTransformVecMult<class_VisualShaderNodeTransformVecMult>`, :ref:`VisualShaderNodeUniform<class_VisualShaderNodeUniform>`, :ref:`VisualShaderNodeUniformRef<class_VisualShaderNodeUniformRef>`, :ref:`VisualShaderNodeVec3Constant<class_VisualShaderNodeVec3Constant>`, :ref:`VisualShaderNodeVectorClamp<class_VisualShaderNodeVectorClamp>`, :ref:`VisualShaderNodeVectorCompose<class_VisualShaderNodeVectorCompose>`, :ref:`VisualShaderNodeVectorDecompose<class_VisualShaderNodeVectorDecompose>`, :ref:`VisualShaderNodeVectorDerivativeFunc<class_VisualShaderNodeVectorDerivativeFunc>`, :ref:`VisualShaderNodeVectorDistance<class_VisualShaderNodeVectorDistance>`, :ref:`VisualShaderNodeVectorFunc<class_VisualShaderNodeVectorFunc>`, :ref:`VisualShaderNodeVectorInterp<class_VisualShaderNodeVectorInterp>`, :ref:`VisualShaderNodeVectorLen<class_VisualShaderNodeVectorLen>`, :ref:`VisualShaderNodeVectorOp<class_VisualShaderNodeVectorOp>`, :ref:`VisualShaderNodeVectorRefract<class_VisualShaderNodeVectorRefract>`, :ref:`VisualShaderNodeVectorScalarMix<class_VisualShaderNodeVectorScalarMix>`, :ref:`VisualShaderNodeVectorScalarSmoothStep<class_VisualShaderNodeVectorScalarSmoothStep>`, :ref:`VisualShaderNodeVectorScalarStep<class_VisualShaderNodeVectorScalarStep>`, :ref:`VisualShaderNodeVectorSmoothStep<class_VisualShaderNodeVectorSmoothStep>`
Base class for nodes in a visual shader graph.
Description
-----------
Visual shader graphs consist of various nodes. Each node in the graph is a separate object and they are represented as a rectangular boxes with title and a set of properties. Each node has also connection ports that allow to connect it to another nodes and control the flow of the shader.
Tutorials
---------
- :doc:`../tutorials/shaders/visual_shaders`
Properties
----------
+-----------------------+-----------------------------------------------------------------------------------------+--------+
| :ref:`int<class_int>` | :ref:`output_port_for_preview<class_VisualShaderNode_property_output_port_for_preview>` | ``-1`` |
+-----------------------+-----------------------------------------------------------------------------------------+--------+
Methods
-------
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>` | :ref:`get_default_input_values<class_VisualShaderNode_method_get_default_input_values>` **(** **)** |const| |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Variant<class_Variant>` | :ref:`get_input_port_default_value<class_VisualShaderNode_method_get_input_port_default_value>` **(** :ref:`int<class_int>` port **)** |const| |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_default_input_values<class_VisualShaderNode_method_set_default_input_values>` **(** :ref:`Array<class_Array>` values **)** |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_input_port_default_value<class_VisualShaderNode_method_set_input_port_default_value>` **(** :ref:`int<class_int>` port, :ref:`Variant<class_Variant>` value **)** |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Signals
-------
.. _class_VisualShaderNode_signal_editor_refresh_request:
- **editor_refresh_request** **(** **)**
Emitted when the node requests an editor refresh. Currently called only in setter of :ref:`VisualShaderNodeTexture.source<class_VisualShaderNodeTexture_property_source>`, :ref:`VisualShaderNodeTexture<class_VisualShaderNodeTexture>`, and :ref:`VisualShaderNodeCubeMap<class_VisualShaderNodeCubeMap>` (and their derivatives).
Enumerations
------------
.. _enum_VisualShaderNode_PortType:
.. _class_VisualShaderNode_constant_PORT_TYPE_SCALAR:
.. _class_VisualShaderNode_constant_PORT_TYPE_VECTOR:
.. _class_VisualShaderNode_constant_PORT_TYPE_BOOLEAN:
.. _class_VisualShaderNode_constant_PORT_TYPE_TRANSFORM:
.. _class_VisualShaderNode_constant_PORT_TYPE_SAMPLER:
.. _class_VisualShaderNode_constant_PORT_TYPE_MAX:
enum **PortType**:
- **PORT_TYPE_SCALAR** = **0** --- Floating-point scalar. Translated to ``float`` type in shader code.
- **PORT_TYPE_VECTOR** = **1** --- 3D vector of floating-point values. Translated to ``vec3`` type in shader code.
- **PORT_TYPE_BOOLEAN** = **2** --- Boolean type. Translated to ``bool`` type in shader code.
- **PORT_TYPE_TRANSFORM** = **3** --- Transform type. Translated to ``mat4`` type in shader code.
- **PORT_TYPE_SAMPLER** = **4** --- Sampler type. Translated to reference of sampler uniform in shader code. Can only be used for input ports in non-uniform nodes.
- **PORT_TYPE_MAX** = **5** --- Represents the size of the :ref:`PortType<enum_VisualShaderNode_PortType>` enum.
Property Descriptions
---------------------
.. _class_VisualShaderNode_property_output_port_for_preview:
- :ref:`int<class_int>` **output_port_for_preview**
+-----------+------------------------------------+
| *Default* | ``-1`` |
+-----------+------------------------------------+
| *Setter* | set_output_port_for_preview(value) |
+-----------+------------------------------------+
| *Getter* | get_output_port_for_preview() |
+-----------+------------------------------------+
Sets the output port index which will be showed for preview. If set to ``-1`` no port will be open for preview.
Method Descriptions
-------------------
.. _class_VisualShaderNode_method_get_default_input_values:
- :ref:`Array<class_Array>` **get_default_input_values** **(** **)** |const|
Returns an :ref:`Array<class_Array>` containing default values for all of the input ports of the node in the form ``[index0, value0, index1, value1, ...]``.
----
.. _class_VisualShaderNode_method_get_input_port_default_value:
- :ref:`Variant<class_Variant>` **get_input_port_default_value** **(** :ref:`int<class_int>` port **)** |const|
Returns the default value of the input ``port``.
----
.. _class_VisualShaderNode_method_set_default_input_values:
- void **set_default_input_values** **(** :ref:`Array<class_Array>` values **)**
Sets the default input ports values using an :ref:`Array<class_Array>` of the form ``[index0, value0, index1, value1, ...]``. For example: ``[0, Vector3(0, 0, 0), 1, Vector3(0, 0, 0)]``.
----
.. _class_VisualShaderNode_method_set_input_port_default_value:
- void **set_input_port_default_value** **(** :ref:`int<class_int>` port, :ref:`Variant<class_Variant>` value **)**
Sets the default value for the selected input ``port``.
.. |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.)`