Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
- AESContext
- AStar2D
- AStar3D
- AStarGrid2D
- AudioEffectInstance (1)
- AudioSample
- AudioSamplePlayback
- AudioStreamPlayback (5)
- CameraFeed
- CharFXTransform
- ConfigFile
- Crypto
- DTLSServer
- DirAccess
- ENetConnection
- EditorContextMenuPlugin
- EditorDebuggerPlugin
- EditorDebuggerSession
- EditorExportPlatform (6)
- EditorExportPlugin
- EditorExportPreset
- EditorFeatureProfile
- EditorFileSystemImportFormatSupportQuery
- EditorInspectorPlugin
- EditorResourceConversionPlugin
- EditorResourcePreviewGenerator
- EditorResourceTooltipPlugin
- EditorSceneFormatImporter (4)
- EditorScenePostImport
- EditorScenePostImportPlugin
- EditorScript
- EditorTranslationParserPlugin
- EncodedObjectAsID
- EngineProfiler
- Expression
- FileAccess
- GLTFObjectModelProperty
- HMACContext
- HTTPClient
- HashingContext
- ImageFormatLoader (1)
- JavaClass
- JavaObject
- JavaScriptObject
- KinematicCollision2D
- KinematicCollision3D
- Lightmapper (1)
- MeshConvexDecompositionSettings
- MeshDataTool
- MultiplayerAPI (2)
- Mutex
- NavigationPathQueryParameters2D
- NavigationPathQueryParameters3D
- NavigationPathQueryResult2D
- NavigationPathQueryResult3D
- Node3DGizmo (1)
- OggPacketSequencePlayback
- OpenXRAPIExtension
- PCKPacker
- PackedDataContainerRef
- PacketPeer (8)
- PhysicsPointQueryParameters2D
- PhysicsPointQueryParameters3D
- PhysicsRayQueryParameters2D
- PhysicsRayQueryParameters3D
- PhysicsShapeQueryParameters2D
- PhysicsShapeQueryParameters3D
- PhysicsTestMotionParameters2D
- PhysicsTestMotionParameters3D
- PhysicsTestMotionResult2D
- PhysicsTestMotionResult3D
- RDAttachmentFormat
- RDFramebufferPass
- RDPipelineColorBlendState
- RDPipelineColorBlendStateAttachment
- RDPipelineDepthStencilState
- RDPipelineMultisampleState
- RDPipelineRasterizationState
- RDPipelineSpecializationConstant
- RDSamplerState
- RDShaderSource
- RDTextureFormat
- RDTextureView
- RDUniform
- RDVertexAttribute
- RandomNumberGenerator
- RegEx
- RegExMatch
- RenderSceneBuffers (2)
- RenderSceneBuffersConfiguration
- Resource (103)
- ResourceFormatLoader
- ResourceFormatSaver
- ResourceImporter (16)
- SceneState
- SceneTreeTimer
- Semaphore
- SkinReference
- StreamPeer (5)
- SurfaceTool
- TCPServer
- TLSOptions
- TextLine
- TextParagraph
- TextServer (1)
- Thread
- TranslationDomain
- TriangleMesh
- Tween
- Tweener (5)
- UDPServer
- UPNP
- UPNPDevice
- WeakRef
- WebRTCPeerConnection (1)
- XMLParser
- XRInterface (4)
- XRPose
- XRTracker (2)
- ZIPPacker
- ZIPReader
- Animation
- AnimationLibrary
- AnimationNode (6)
- AnimationNodeStateMachinePlayback
- AnimationNodeStateMachineTransition
- AudioBusLayout
- AudioEffect (17)
- AudioStream (10)
- BitMap
- BoneMap
- ButtonGroup
- CameraAttributes (2)
- ColorPalette
- Compositor
- CompositorEffect
- CryptoKey
- Curve
- Curve2D
- Curve3D
- EditorNode3DGizmoPlugin
- EditorSettings
- Environment
- Font (3)
- GDExtension
- GLTFAccessor
- GLTFAnimation
- GLTFBufferView
- GLTFCamera
- GLTFDocument (1)
- GLTFDocumentExtension (1)
- GLTFLight
- GLTFMesh
- GLTFNode
- GLTFPhysicsBody
- GLTFPhysicsShape
- GLTFSkeleton
- GLTFSkin
- GLTFSpecGloss
- GLTFState (1)
- GLTFTexture
- GLTFTextureSampler
- Gradient
- Image
- ImporterMesh
- InputEvent (6)
- JSON
- LabelSettings
- LightmapGIData
- Material (9)
- Mesh (4)
- MeshLibrary
- MissingResource
- MultiMesh
- NavigationMesh
- NavigationMeshSourceGeometryData2D
- NavigationMeshSourceGeometryData3D
- NavigationPolygon
- Noise (1)
- Occluder3D (5)
- OccluderPolygon2D
- OggPacketSequence
- OpenXRAction
- OpenXRActionMap
- OpenXRActionSet
- OpenXRBindingModifier (2)
- OpenXRHapticBase (1)
- OpenXRIPBinding
- OpenXRInteractionProfile
- PackedDataContainer
- PackedScene
- PhysicsMaterial
- PolygonPathFinder
- RDShaderFile
- RDShaderSPIRV
- RichTextEffect
- SceneReplicationConfig
- Script (3)
- Shader (1)
- ShaderInclude
- Shape2D (8)
- Shape3D (9)
- Shortcut
- SkeletonModification2D (7)
- SkeletonModificationStack2D
- SkeletonProfile (1)
- Skin
- Sky
- SpriteFrames
- StyleBox (4)
- SyntaxHighlighter (2)
- Texture (3)
- Theme
- TileMapPattern
- TileSet
- TileSetSource (2)
- Translation (1)
- VideoStream (1)
- VideoStreamPlayback
- VisualShaderNode (62)
- VoxelGIData
- World2D
- World3D
- X509Certificate
- VisualShaderNodeBillboard
- VisualShaderNodeClamp
- VisualShaderNodeColorFunc
- VisualShaderNodeColorOp
- VisualShaderNodeCompare
- VisualShaderNodeConstant (9)
- VisualShaderNodeCubemap
- VisualShaderNodeCustom
- VisualShaderNodeDerivativeFunc
- VisualShaderNodeDeterminant
- VisualShaderNodeDistanceFade
- VisualShaderNodeDotProduct
- VisualShaderNodeFloatFunc
- VisualShaderNodeFloatOp
- VisualShaderNodeFresnel
- VisualShaderNodeIf
- VisualShaderNodeInput
- VisualShaderNodeIntFunc
- VisualShaderNodeIntOp
- VisualShaderNodeIs
- VisualShaderNodeLinearSceneDepth
- VisualShaderNodeMix
- VisualShaderNodeMultiplyAdd
- VisualShaderNodeOuterProduct
- VisualShaderNodeOutput (1)
- VisualShaderNodeParameter (10)
- VisualShaderNodeParameterRef
- VisualShaderNodeParticleAccelerator
- VisualShaderNodeParticleConeVelocity
- VisualShaderNodeParticleEmit
- VisualShaderNodeParticleEmitter (4)
- VisualShaderNodeParticleMultiplyByAxisAngle
- VisualShaderNodeParticleRandomness
- VisualShaderNodeProximityFade
- VisualShaderNodeRandomRange
- VisualShaderNodeRemap
- VisualShaderNodeReroute
- VisualShaderNodeResizableBase (4)
- VisualShaderNodeRotationByAxis
- VisualShaderNodeSDFRaymarch
- VisualShaderNodeSDFToScreenUV
- VisualShaderNodeSample3D (2)
- VisualShaderNodeScreenNormalWorldSpace
- VisualShaderNodeScreenUVToSDF
- VisualShaderNodeSmoothStep
- VisualShaderNodeStep
- VisualShaderNodeSwitch
- VisualShaderNodeTexture
- VisualShaderNodeTextureSDF
- VisualShaderNodeTextureSDFNormal
- VisualShaderNodeTransformCompose
- VisualShaderNodeTransformDecompose
- VisualShaderNodeTransformFunc
- VisualShaderNodeTransformOp
- VisualShaderNodeTransformVecMult
- VisualShaderNodeUIntFunc
- VisualShaderNodeUIntOp
- VisualShaderNodeUVFunc
- VisualShaderNodeUVPolarCoord
- VisualShaderNodeVarying (2)
- VisualShaderNodeVectorBase (8)
- VisualShaderNodeWorldPositionFromDepth
Table of contents
-
virtual const func _get_category() -> String -
virtual const func _get_code(type: int enumVisualShader.Type) -> String -
virtual const func _get_default_input_port(type: int enumVisualShaderNode.PortType) -> int -
virtual const func _get_description() -> String -
virtual const func _get_func_code(type: int enumVisualShader.Type) -> String -
virtual const func _get_global_code(mode: int enumShader.Mode) -> String -
virtual const func _get_input_port_count() -> int -
virtual const func _get_input_port_default_value(port: int) -> Variant -
virtual const func _get_input_port_name(port: int) -> String -
virtual const func _get_input_port_type(port: int) -> intVisualShaderNode.PortType -
virtual const func _get_name() -> String -
virtual const func _get_output_port_count() -> int -
virtual const func _get_output_port_name(port: int) -> String -
virtual const func _get_output_port_type(port: int) -> intVisualShaderNode.PortType -
virtual const func _get_property_count() -> int -
virtual const func _get_property_default_index(index: int) -> int -
virtual const func _get_property_name(index: int) -> String -
virtual const func _get_property_options(index: int) -> PackedStringArray -
virtual const func _get_return_icon_type() -> intVisualShaderNode.PortType -
virtual const func _is_available(type: int enumVisualShader.Type) -> bool -
virtual const func _is_highend() -> bool -
const func get_option_index(option: int) -> int
VisualShaderNodeCustom #
is_refcounted, is_instantiable, resource, core, not_builtin_classes
Virtual class to define custom VisualShaderNodes for use in the Visual Shader Editor.
By inheriting this class you can create a custom VisualShader script addon which will be automatically added to the Visual Shader Editor. The VisualShaderNode's behavior is defined by overriding the provided virtual methods.
In order for the node to be registered as an editor addon, you must use the @tool annotation and provide a class_name for your custom script. For example:
@tool
extends VisualShaderNodeCustom
class_name VisualShaderNodeNoise Members #
Methods #
virtual const func _get_category() -> String#
Override this method to define the path to the associated custom node in the Visual Shader Editor's members dialog. The path may look like "MyGame/MyFunctions/Noise".
Defining this method is optional. If not overridden, the node will be filed under the "Addons" category.
virtual const func _get_code(type: int enumVisualShader.Type) -> String#
Override this method to define the actual shader code of the associated custom node. The shader code should be returned as a string, which can have multiple lines (the """ multiline string construct can be used for convenience).
The input_vars and output_vars arrays contain the string names of the various input and output variables, as defined by _get_input_* and _get_output_* virtual methods in this class.
The output ports can be assigned values in the shader code. For example, return output_vars0 + " = " + input_vars0 + ";".
You can customize the generated code based on the shader mode (see Shader.Mode) and/or type (see VisualShader.Type).
Defining this method is required.
virtual const func _get_default_input_port(type: int enumVisualShaderNode.PortType) -> int#
Override this method to define 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.
Defining this method is optional. If not overridden, the connection will be created to the first valid port.
virtual const func _get_description() -> String#
Override this method to define the description of the associated custom node in the Visual Shader Editor's members dialog.
Defining this method is optional.
virtual const func _get_func_code(type: int enumVisualShader.Type) -> String#
Override this method to add a shader code to the beginning of each shader function (once). The shader code should be returned as a string, which can have multiple lines (the """ multiline string construct can be used for convenience).
If there are multiple custom nodes of different types which use this feature the order of each insertion is undefined.
You can customize the generated code based on the shader mode (see Shader.Mode) and/or type (see VisualShader.Type).
Defining this method is optional.
virtual const func _get_global_code(mode: int enumShader.Mode) -> String#
Override this method to add shader code on top of the global shader, to define your own standard library of reusable methods, varyings, constants, uniforms, etc. The shader code should be returned as a string, which can have multiple lines (the """ multiline string construct can be used for convenience).
Be careful with this functionality as it can cause name conflicts with other custom nodes, so be sure to give the defined entities unique names.
You can customize the generated code based on the shader mode (see Shader.Mode).
Defining this method is optional.
virtual const func _get_input_port_count() -> int#
Override this method to define the number of input ports of the associated custom node.
Defining this method is required. If not overridden, the node has no input ports.
virtual const func _get_input_port_default_value(port: int) -> Variant#
Override this method to define the default value for the specified input port. Prefer use this over VisualShaderNode.set_input_port_default_value.
Defining this method is required. If not overridden, the node has no default values for their input ports.
virtual const func _get_input_port_name(port: int) -> String#
Override this method to define the names of input ports of the associated custom node. The names are used both for the input slots in the editor and as identifiers in the shader code, and are passed in the input_vars array in _get_code.
Defining this method is optional, but recommended. If not overridden, input ports are named as "in" + str(port).
virtual const func _get_input_port_type(port: int) -> intVisualShaderNode.PortType#
Override this method to define the returned type of each input port of the associated custom node (see VisualShaderNode.PortType for possible types).
Defining this method is optional, but recommended. If not overridden, input ports will return the VisualShaderNode.PORT_TYPE_SCALAR type.
virtual const func _get_name() -> String#
Override this method to define the name of the associated custom node in the Visual Shader Editor's members dialog and graph.
Defining this method is optional, but recommended. If not overridden, the node will be named as "Unnamed".
virtual const func _get_output_port_count() -> int#
Override this method to define the number of output ports of the associated custom node.
Defining this method is required. If not overridden, the node has no output ports.
virtual const func _get_output_port_name(port: int) -> String#
Override this method to define the names of output ports of the associated custom node. The names are used both for the output slots in the editor and as identifiers in the shader code, and are passed in the output_vars array in _get_code.
Defining this method is optional, but recommended. If not overridden, output ports are named as "out" + str(port).
virtual const func _get_output_port_type(port: int) -> intVisualShaderNode.PortType#
Override this method to define the returned type of each output port of the associated custom node (see VisualShaderNode.PortType for possible types).
Defining this method is optional, but recommended. If not overridden, output ports will return the VisualShaderNode.PORT_TYPE_SCALAR type.
virtual const func _get_property_count() -> int#
Override this method to define the number of the properties.
Defining this method is optional.
virtual const func _get_property_default_index(index: int) -> int#
Override this method to define the default index of the property of the associated custom node.
Defining this method is optional.
virtual const func _get_property_name(index: int) -> String#
Override this method to define the names of the property of the associated custom node.
Defining this method is optional.
virtual const func _get_property_options(index: int) -> PackedStringArray#
Override this method to define the options inside the drop-down list property of the associated custom node.
Defining this method is optional.
virtual const func _get_return_icon_type() -> intVisualShaderNode.PortType#
Override this method to define the return icon of the associated custom node in the Visual Shader Editor's members dialog.
Defining this method is optional. If not overridden, no return icon is shown.
virtual const func _is_available(type: int enumVisualShader.Type) -> bool#
Override this method to prevent the node to be visible in the member dialog for the certain mode (see Shader.Mode) and/or type (see VisualShader.Type).
Defining this method is optional. If not overridden, it's true.
virtual const func _is_highend() -> bool#
Override this method to enable high-end mark in the Visual Shader Editor's members dialog.
Defining this method is optional. If not overridden, it's false.
const func get_option_index(option: int) -> int#
Returns the selected index of the drop-down list option within a graph. You may use this function to define the specific behavior in the _get_code or _get_global_code.