class_visualshadernode.rst 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/VisualShaderNode.xml.
  6. .. _class_VisualShaderNode:
  7. VisualShaderNode
  8. ================
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`VisualShaderNodeBillboard<class_VisualShaderNodeBillboard>`, :ref:`VisualShaderNodeClamp<class_VisualShaderNodeClamp>`, :ref:`VisualShaderNodeColorFunc<class_VisualShaderNodeColorFunc>`, :ref:`VisualShaderNodeColorOp<class_VisualShaderNodeColorOp>`, :ref:`VisualShaderNodeCompare<class_VisualShaderNodeCompare>`, :ref:`VisualShaderNodeConstant<class_VisualShaderNodeConstant>`, :ref:`VisualShaderNodeCubemap<class_VisualShaderNodeCubemap>`, :ref:`VisualShaderNodeCustom<class_VisualShaderNodeCustom>`, :ref:`VisualShaderNodeDerivativeFunc<class_VisualShaderNodeDerivativeFunc>`, :ref:`VisualShaderNodeDeterminant<class_VisualShaderNodeDeterminant>`, :ref:`VisualShaderNodeDistanceFade<class_VisualShaderNodeDistanceFade>`, :ref:`VisualShaderNodeDotProduct<class_VisualShaderNodeDotProduct>`, :ref:`VisualShaderNodeFloatFunc<class_VisualShaderNodeFloatFunc>`, :ref:`VisualShaderNodeFloatOp<class_VisualShaderNodeFloatOp>`, :ref:`VisualShaderNodeFresnel<class_VisualShaderNodeFresnel>`, :ref:`VisualShaderNodeIf<class_VisualShaderNodeIf>`, :ref:`VisualShaderNodeInput<class_VisualShaderNodeInput>`, :ref:`VisualShaderNodeIntFunc<class_VisualShaderNodeIntFunc>`, :ref:`VisualShaderNodeIntOp<class_VisualShaderNodeIntOp>`, :ref:`VisualShaderNodeIs<class_VisualShaderNodeIs>`, :ref:`VisualShaderNodeLinearSceneDepth<class_VisualShaderNodeLinearSceneDepth>`, :ref:`VisualShaderNodeMix<class_VisualShaderNodeMix>`, :ref:`VisualShaderNodeMultiplyAdd<class_VisualShaderNodeMultiplyAdd>`, :ref:`VisualShaderNodeOuterProduct<class_VisualShaderNodeOuterProduct>`, :ref:`VisualShaderNodeOutput<class_VisualShaderNodeOutput>`, :ref:`VisualShaderNodeParameter<class_VisualShaderNodeParameter>`, :ref:`VisualShaderNodeParameterRef<class_VisualShaderNodeParameterRef>`, :ref:`VisualShaderNodeParticleAccelerator<class_VisualShaderNodeParticleAccelerator>`, :ref:`VisualShaderNodeParticleConeVelocity<class_VisualShaderNodeParticleConeVelocity>`, :ref:`VisualShaderNodeParticleEmit<class_VisualShaderNodeParticleEmit>`, :ref:`VisualShaderNodeParticleEmitter<class_VisualShaderNodeParticleEmitter>`, :ref:`VisualShaderNodeParticleMultiplyByAxisAngle<class_VisualShaderNodeParticleMultiplyByAxisAngle>`, :ref:`VisualShaderNodeParticleRandomness<class_VisualShaderNodeParticleRandomness>`, :ref:`VisualShaderNodeProximityFade<class_VisualShaderNodeProximityFade>`, :ref:`VisualShaderNodeRandomRange<class_VisualShaderNodeRandomRange>`, :ref:`VisualShaderNodeRemap<class_VisualShaderNodeRemap>`, :ref:`VisualShaderNodeReroute<class_VisualShaderNodeReroute>`, :ref:`VisualShaderNodeResizableBase<class_VisualShaderNodeResizableBase>`, :ref:`VisualShaderNodeRotationByAxis<class_VisualShaderNodeRotationByAxis>`, :ref:`VisualShaderNodeSample3D<class_VisualShaderNodeSample3D>`, :ref:`VisualShaderNodeScreenNormalWorldSpace<class_VisualShaderNodeScreenNormalWorldSpace>`, :ref:`VisualShaderNodeScreenUVToSDF<class_VisualShaderNodeScreenUVToSDF>`, :ref:`VisualShaderNodeSDFRaymarch<class_VisualShaderNodeSDFRaymarch>`, :ref:`VisualShaderNodeSDFToScreenUV<class_VisualShaderNodeSDFToScreenUV>`, :ref:`VisualShaderNodeSmoothStep<class_VisualShaderNodeSmoothStep>`, :ref:`VisualShaderNodeStep<class_VisualShaderNodeStep>`, :ref:`VisualShaderNodeSwitch<class_VisualShaderNodeSwitch>`, :ref:`VisualShaderNodeTexture<class_VisualShaderNodeTexture>`, :ref:`VisualShaderNodeTextureSDF<class_VisualShaderNodeTextureSDF>`, :ref:`VisualShaderNodeTextureSDFNormal<class_VisualShaderNodeTextureSDFNormal>`, :ref:`VisualShaderNodeTransformCompose<class_VisualShaderNodeTransformCompose>`, :ref:`VisualShaderNodeTransformDecompose<class_VisualShaderNodeTransformDecompose>`, :ref:`VisualShaderNodeTransformFunc<class_VisualShaderNodeTransformFunc>`, :ref:`VisualShaderNodeTransformOp<class_VisualShaderNodeTransformOp>`, :ref:`VisualShaderNodeTransformVecMult<class_VisualShaderNodeTransformVecMult>`, :ref:`VisualShaderNodeUIntFunc<class_VisualShaderNodeUIntFunc>`, :ref:`VisualShaderNodeUIntOp<class_VisualShaderNodeUIntOp>`, :ref:`VisualShaderNodeUVFunc<class_VisualShaderNodeUVFunc>`, :ref:`VisualShaderNodeUVPolarCoord<class_VisualShaderNodeUVPolarCoord>`, :ref:`VisualShaderNodeVarying<class_VisualShaderNodeVarying>`, :ref:`VisualShaderNodeVectorBase<class_VisualShaderNodeVectorBase>`, :ref:`VisualShaderNodeWorldPositionFromDepth<class_VisualShaderNodeWorldPositionFromDepth>`
  11. Base class for :ref:`VisualShader<class_VisualShader>` nodes. Not related to scene nodes.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. 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 also has connection ports that allow to connect it to another nodes and control the flow of the shader.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - :doc:`Using VisualShaders <../tutorials/shaders/visual_shaders>`
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +-----------------------+---------------------------------------------------------------------------------------------+--------+
  26. | :ref:`int<class_int>` | :ref:`linked_parent_graph_frame<class_VisualShaderNode_property_linked_parent_graph_frame>` | ``-1`` |
  27. +-----------------------+---------------------------------------------------------------------------------------------+--------+
  28. | :ref:`int<class_int>` | :ref:`output_port_for_preview<class_VisualShaderNode_property_output_port_for_preview>` | ``-1`` |
  29. +-----------------------+---------------------------------------------------------------------------------------------+--------+
  30. .. rst-class:: classref-reftable-group
  31. Methods
  32. -------
  33. .. table::
  34. :widths: auto
  35. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | |void| | :ref:`clear_default_input_values<class_VisualShaderNode_method_clear_default_input_values>`\ (\ ) |
  37. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`int<class_int>` | :ref:`get_default_input_port<class_VisualShaderNode_method_get_default_input_port>`\ (\ type\: :ref:`PortType<enum_VisualShaderNode_PortType>`\ ) |const| |
  39. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`Array<class_Array>` | :ref:`get_default_input_values<class_VisualShaderNode_method_get_default_input_values>`\ (\ ) |const| |
  41. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`Variant<class_Variant>` | :ref:`get_input_port_default_value<class_VisualShaderNode_method_get_input_port_default_value>`\ (\ port\: :ref:`int<class_int>`\ ) |const| |
  43. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | |void| | :ref:`remove_input_port_default_value<class_VisualShaderNode_method_remove_input_port_default_value>`\ (\ port\: :ref:`int<class_int>`\ ) |
  45. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | |void| | :ref:`set_default_input_values<class_VisualShaderNode_method_set_default_input_values>`\ (\ values\: :ref:`Array<class_Array>`\ ) |
  47. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | |void| | :ref:`set_input_port_default_value<class_VisualShaderNode_method_set_input_port_default_value>`\ (\ port\: :ref:`int<class_int>`, value\: :ref:`Variant<class_Variant>`, prev_value\: :ref:`Variant<class_Variant>` = null\ ) |
  49. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. .. rst-class:: classref-section-separator
  51. ----
  52. .. rst-class:: classref-descriptions-group
  53. Enumerations
  54. ------------
  55. .. _enum_VisualShaderNode_PortType:
  56. .. rst-class:: classref-enumeration
  57. enum **PortType**: :ref:`🔗<enum_VisualShaderNode_PortType>`
  58. .. _class_VisualShaderNode_constant_PORT_TYPE_SCALAR:
  59. .. rst-class:: classref-enumeration-constant
  60. :ref:`PortType<enum_VisualShaderNode_PortType>` **PORT_TYPE_SCALAR** = ``0``
  61. Floating-point scalar. Translated to ``float`` type in shader code.
  62. .. _class_VisualShaderNode_constant_PORT_TYPE_SCALAR_INT:
  63. .. rst-class:: classref-enumeration-constant
  64. :ref:`PortType<enum_VisualShaderNode_PortType>` **PORT_TYPE_SCALAR_INT** = ``1``
  65. Integer scalar. Translated to ``int`` type in shader code.
  66. .. _class_VisualShaderNode_constant_PORT_TYPE_SCALAR_UINT:
  67. .. rst-class:: classref-enumeration-constant
  68. :ref:`PortType<enum_VisualShaderNode_PortType>` **PORT_TYPE_SCALAR_UINT** = ``2``
  69. Unsigned integer scalar. Translated to ``uint`` type in shader code.
  70. .. _class_VisualShaderNode_constant_PORT_TYPE_VECTOR_2D:
  71. .. rst-class:: classref-enumeration-constant
  72. :ref:`PortType<enum_VisualShaderNode_PortType>` **PORT_TYPE_VECTOR_2D** = ``3``
  73. 2D vector of floating-point values. Translated to ``vec2`` type in shader code.
  74. .. _class_VisualShaderNode_constant_PORT_TYPE_VECTOR_3D:
  75. .. rst-class:: classref-enumeration-constant
  76. :ref:`PortType<enum_VisualShaderNode_PortType>` **PORT_TYPE_VECTOR_3D** = ``4``
  77. 3D vector of floating-point values. Translated to ``vec3`` type in shader code.
  78. .. _class_VisualShaderNode_constant_PORT_TYPE_VECTOR_4D:
  79. .. rst-class:: classref-enumeration-constant
  80. :ref:`PortType<enum_VisualShaderNode_PortType>` **PORT_TYPE_VECTOR_4D** = ``5``
  81. 4D vector of floating-point values. Translated to ``vec4`` type in shader code.
  82. .. _class_VisualShaderNode_constant_PORT_TYPE_BOOLEAN:
  83. .. rst-class:: classref-enumeration-constant
  84. :ref:`PortType<enum_VisualShaderNode_PortType>` **PORT_TYPE_BOOLEAN** = ``6``
  85. Boolean type. Translated to ``bool`` type in shader code.
  86. .. _class_VisualShaderNode_constant_PORT_TYPE_TRANSFORM:
  87. .. rst-class:: classref-enumeration-constant
  88. :ref:`PortType<enum_VisualShaderNode_PortType>` **PORT_TYPE_TRANSFORM** = ``7``
  89. Transform type. Translated to ``mat4`` type in shader code.
  90. .. _class_VisualShaderNode_constant_PORT_TYPE_SAMPLER:
  91. .. rst-class:: classref-enumeration-constant
  92. :ref:`PortType<enum_VisualShaderNode_PortType>` **PORT_TYPE_SAMPLER** = ``8``
  93. Sampler type. Translated to reference of sampler uniform in shader code. Can only be used for input ports in non-uniform nodes.
  94. .. _class_VisualShaderNode_constant_PORT_TYPE_MAX:
  95. .. rst-class:: classref-enumeration-constant
  96. :ref:`PortType<enum_VisualShaderNode_PortType>` **PORT_TYPE_MAX** = ``9``
  97. Represents the size of the :ref:`PortType<enum_VisualShaderNode_PortType>` enum.
  98. .. rst-class:: classref-section-separator
  99. ----
  100. .. rst-class:: classref-descriptions-group
  101. Property Descriptions
  102. ---------------------
  103. .. _class_VisualShaderNode_property_linked_parent_graph_frame:
  104. .. rst-class:: classref-property
  105. :ref:`int<class_int>` **linked_parent_graph_frame** = ``-1`` :ref:`🔗<class_VisualShaderNode_property_linked_parent_graph_frame>`
  106. .. rst-class:: classref-property-setget
  107. - |void| **set_frame**\ (\ value\: :ref:`int<class_int>`\ )
  108. - :ref:`int<class_int>` **get_frame**\ (\ )
  109. Represents the index of the frame this node is linked to. If set to ``-1`` the node is not linked to any frame.
  110. .. rst-class:: classref-item-separator
  111. ----
  112. .. _class_VisualShaderNode_property_output_port_for_preview:
  113. .. rst-class:: classref-property
  114. :ref:`int<class_int>` **output_port_for_preview** = ``-1`` :ref:`🔗<class_VisualShaderNode_property_output_port_for_preview>`
  115. .. rst-class:: classref-property-setget
  116. - |void| **set_output_port_for_preview**\ (\ value\: :ref:`int<class_int>`\ )
  117. - :ref:`int<class_int>` **get_output_port_for_preview**\ (\ )
  118. Sets the output port index which will be showed for preview. If set to ``-1`` no port will be open for preview.
  119. .. rst-class:: classref-section-separator
  120. ----
  121. .. rst-class:: classref-descriptions-group
  122. Method Descriptions
  123. -------------------
  124. .. _class_VisualShaderNode_method_clear_default_input_values:
  125. .. rst-class:: classref-method
  126. |void| **clear_default_input_values**\ (\ ) :ref:`🔗<class_VisualShaderNode_method_clear_default_input_values>`
  127. Clears the default input ports value.
  128. .. rst-class:: classref-item-separator
  129. ----
  130. .. _class_VisualShaderNode_method_get_default_input_port:
  131. .. rst-class:: classref-method
  132. :ref:`int<class_int>` **get_default_input_port**\ (\ type\: :ref:`PortType<enum_VisualShaderNode_PortType>`\ ) |const| :ref:`🔗<class_VisualShaderNode_method_get_default_input_port>`
  133. Returns the input port which should be connected by default when this node is created as a result of dragging a connection from an existing node to the empty space on the graph.
  134. .. rst-class:: classref-item-separator
  135. ----
  136. .. _class_VisualShaderNode_method_get_default_input_values:
  137. .. rst-class:: classref-method
  138. :ref:`Array<class_Array>` **get_default_input_values**\ (\ ) |const| :ref:`🔗<class_VisualShaderNode_method_get_default_input_values>`
  139. 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, ...]``.
  140. .. rst-class:: classref-item-separator
  141. ----
  142. .. _class_VisualShaderNode_method_get_input_port_default_value:
  143. .. rst-class:: classref-method
  144. :ref:`Variant<class_Variant>` **get_input_port_default_value**\ (\ port\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_VisualShaderNode_method_get_input_port_default_value>`
  145. Returns the default value of the input ``port``.
  146. .. rst-class:: classref-item-separator
  147. ----
  148. .. _class_VisualShaderNode_method_remove_input_port_default_value:
  149. .. rst-class:: classref-method
  150. |void| **remove_input_port_default_value**\ (\ port\: :ref:`int<class_int>`\ ) :ref:`🔗<class_VisualShaderNode_method_remove_input_port_default_value>`
  151. Removes the default value of the input ``port``.
  152. .. rst-class:: classref-item-separator
  153. ----
  154. .. _class_VisualShaderNode_method_set_default_input_values:
  155. .. rst-class:: classref-method
  156. |void| **set_default_input_values**\ (\ values\: :ref:`Array<class_Array>`\ ) :ref:`🔗<class_VisualShaderNode_method_set_default_input_values>`
  157. 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)]``.
  158. .. rst-class:: classref-item-separator
  159. ----
  160. .. _class_VisualShaderNode_method_set_input_port_default_value:
  161. .. rst-class:: classref-method
  162. |void| **set_input_port_default_value**\ (\ port\: :ref:`int<class_int>`, value\: :ref:`Variant<class_Variant>`, prev_value\: :ref:`Variant<class_Variant>` = null\ ) :ref:`🔗<class_VisualShaderNode_method_set_input_port_default_value>`
  163. Sets the default ``value`` for the selected input ``port``.
  164. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  165. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  166. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  167. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  168. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  169. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  170. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  171. .. |void| replace:: :abbr:`void (No return value.)`