| 1 |
# meta-description: Visual shader's node plugin template |
| 2 |
|
| 3 |
@tool |
| 4 |
# Having a class name is required for a custom node. |
| 5 |
class_name VisualShaderNode_CLASS_ |
| 6 |
extends _BASE_ |
| 7 |
|
| 8 |
|
| 9 |
func _get_name() -> String: |
| 10 |
return "_CLASS_" |
| 11 |
|
| 12 |
|
| 13 |
func _get_category() -> String: |
| 14 |
return "" |
| 15 |
|
| 16 |
|
| 17 |
func _get_description() -> String: |
| 18 |
return "" |
| 19 |
|
| 20 |
|
| 21 |
func _get_return_icon_type() -> PortType: |
| 22 |
return PORT_TYPE_SCALAR |
| 23 |
|
| 24 |
|
| 25 |
func _get_input_port_count() -> int: |
| 26 |
return 0 |
| 27 |
|
| 28 |
|
| 29 |
func _get_input_port_name(port: int) -> String: |
| 30 |
return "" |
| 31 |
|
| 32 |
|
| 33 |
func _get_input_port_type(port: int) -> PortType: |
| 34 |
return PORT_TYPE_SCALAR |
| 35 |
|
| 36 |
|
| 37 |
func _get_output_port_count() -> int: |
| 38 |
return 1 |
| 39 |
|
| 40 |
|
| 41 |
func _get_output_port_name(port: int) -> String: |
| 42 |
return "result" |
| 43 |
|
| 44 |
|
| 45 |
func _get_output_port_type(port: int) -> PortType: |
| 46 |
return PORT_TYPE_SCALAR |
| 47 |
|
| 48 |
|
| 49 |
func _get_code(input_vars: Array[String], output_vars: Array[String], |
| 50 |
mode: Shader.Mode, type: VisualShader.Type) -> String: |
| 51 |
return output_vars[0] + " = 0.0;" |