Add _get_func_code/_is_available virtual functions to custom nodes

This commit is contained in:
Yuri Roubinsky
2022-02-07 22:58:37 +03:00
parent f470979732
commit 4d6790e9df
6 changed files with 167 additions and 48 deletions

View File

@@ -44,6 +44,17 @@
Defining this method is [b]optional[/b].
</description>
</method>
<method name="_get_func_code" qualifiers="virtual const">
<return type="String" />
<argument index="0" name="mode" type="int" enum="Shader.Mode" />
<argument index="1" name="type" type="int" enum="VisualShader.Type" />
<description>
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 [code]"""[/code] 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 [code]mode[/code] (see [enum Shader.Mode]) and/or [code]type[/code] (see [enum VisualShader.Type]).
Defining this method is [b]optional[/b].
</description>
</method>
<method name="_get_global_code" qualifiers="virtual const">
<return type="String" />
<argument index="0" name="mode" type="int" enum="Shader.Mode" />
@@ -114,11 +125,20 @@
Defining this method is [b]optional[/b]. If not overridden, no return icon is shown.
</description>
</method>
<method name="_is_available" qualifiers="virtual const">
<return type="bool" />
<argument index="0" name="mode" type="int" enum="Shader.Mode" />
<argument index="1" name="type" type="int" enum="VisualShader.Type" />
<description>
Override this method to prevent the node to be visible in the member dialog for the certain [code]mode[/code] (see [enum Shader.Mode]) and/or [code]type[/code] (see [enum VisualShader.Type]).
Defining this method is [b]optional[/b]. If not overridden, it's [code]true[/code].
</description>
</method>
<method name="_is_highend" qualifiers="virtual const">
<return type="bool" />
<description>
Override this method to enable high-end mark in the Visual Shader Editor's members dialog.
Defining this method is [b]optional[/b]. If not overridden, it's false.
Defining this method is [b]optional[/b]. If not overridden, it's [code]false[/code].
</description>
</method>
</methods>