class_visualshadernode.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the VisualShaderNode.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_VisualShaderNode:
  6. VisualShaderNode
  7. ================
  8. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. **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>`
  10. Base class for nodes in a visual shader graph.
  11. Description
  12. -----------
  13. 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.
  14. Tutorials
  15. ---------
  16. - :doc:`../tutorials/shaders/visual_shaders`
  17. Properties
  18. ----------
  19. +-----------------------+-----------------------------------------------------------------------------------------+--------+
  20. | :ref:`int<class_int>` | :ref:`output_port_for_preview<class_VisualShaderNode_property_output_port_for_preview>` | ``-1`` |
  21. +-----------------------+-----------------------------------------------------------------------------------------+--------+
  22. Methods
  23. -------
  24. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Array<class_Array>` | :ref:`get_default_input_values<class_VisualShaderNode_method_get_default_input_values>` **(** **)** |const| |
  26. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Variant<class_Variant>` | :ref:`get_input_port_default_value<class_VisualShaderNode_method_get_input_port_default_value>` **(** :ref:`int<class_int>` port **)** |const| |
  28. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | void | :ref:`set_default_input_values<class_VisualShaderNode_method_set_default_input_values>` **(** :ref:`Array<class_Array>` values **)** |
  30. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | 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 **)** |
  32. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. Signals
  34. -------
  35. .. _class_VisualShaderNode_signal_editor_refresh_request:
  36. - **editor_refresh_request** **(** **)**
  37. 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).
  38. Enumerations
  39. ------------
  40. .. _enum_VisualShaderNode_PortType:
  41. .. _class_VisualShaderNode_constant_PORT_TYPE_SCALAR:
  42. .. _class_VisualShaderNode_constant_PORT_TYPE_VECTOR:
  43. .. _class_VisualShaderNode_constant_PORT_TYPE_BOOLEAN:
  44. .. _class_VisualShaderNode_constant_PORT_TYPE_TRANSFORM:
  45. .. _class_VisualShaderNode_constant_PORT_TYPE_SAMPLER:
  46. .. _class_VisualShaderNode_constant_PORT_TYPE_MAX:
  47. enum **PortType**:
  48. - **PORT_TYPE_SCALAR** = **0** --- Floating-point scalar. Translated to ``float`` type in shader code.
  49. - **PORT_TYPE_VECTOR** = **1** --- 3D vector of floating-point values. Translated to ``vec3`` type in shader code.
  50. - **PORT_TYPE_BOOLEAN** = **2** --- Boolean type. Translated to ``bool`` type in shader code.
  51. - **PORT_TYPE_TRANSFORM** = **3** --- Transform type. Translated to ``mat4`` type in shader code.
  52. - **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.
  53. - **PORT_TYPE_MAX** = **5** --- Represents the size of the :ref:`PortType<enum_VisualShaderNode_PortType>` enum.
  54. Property Descriptions
  55. ---------------------
  56. .. _class_VisualShaderNode_property_output_port_for_preview:
  57. - :ref:`int<class_int>` **output_port_for_preview**
  58. +-----------+------------------------------------+
  59. | *Default* | ``-1`` |
  60. +-----------+------------------------------------+
  61. | *Setter* | set_output_port_for_preview(value) |
  62. +-----------+------------------------------------+
  63. | *Getter* | get_output_port_for_preview() |
  64. +-----------+------------------------------------+
  65. Sets the output port index which will be showed for preview. If set to ``-1`` no port will be open for preview.
  66. Method Descriptions
  67. -------------------
  68. .. _class_VisualShaderNode_method_get_default_input_values:
  69. - :ref:`Array<class_Array>` **get_default_input_values** **(** **)** |const|
  70. 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, ...]``.
  71. ----
  72. .. _class_VisualShaderNode_method_get_input_port_default_value:
  73. - :ref:`Variant<class_Variant>` **get_input_port_default_value** **(** :ref:`int<class_int>` port **)** |const|
  74. Returns the default value of the input ``port``.
  75. ----
  76. .. _class_VisualShaderNode_method_set_default_input_values:
  77. - void **set_default_input_values** **(** :ref:`Array<class_Array>` values **)**
  78. 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)]``.
  79. ----
  80. .. _class_VisualShaderNode_method_set_input_port_default_value:
  81. - void **set_input_port_default_value** **(** :ref:`int<class_int>` port, :ref:`Variant<class_Variant>` value **)**
  82. Sets the default value for the selected input ``port``.
  83. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  84. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  85. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`