You can add a Default Value node to your graph. This way, MyColor provides a default input value, while the user can also provide an alternate input value. If an alternate is provided, it is used. Otherwise, the default value is used.
Add the default value nodes to the graph:
-
Enter the group view and -click the work area and choose Tools Toggle Advanced Mode to go into advanced mode. This mode provides a larger selection of nodes.
- -click the work area and choose Graph Nodes Code Control Default Value to create a Default Value node.
- Connect the nodes as follows:
- Connect the RGB attribute of MyColor to the Default attribute of Default Value.
- Connect the Alternate attribute of Default Value to the group node. A new Alternate 0 port appears automatically.
- Connect the Result attribute of Default Value to the Value attribute of Multiply.
- (Optional) Create a second Default Value node and connect it to MyMultiplier as follows:
- Connect the Float attribute of MyMultiplier to the Default attribute of Default Value.
- Connect the Alternate attribute of Default Value to the group node. An Alternate 1 port appears automatically.
- Connect the Result attribute of Default Value to the Value attribute of Multiply.
Group node ports are renamed (in the parent group node at left).
Label the group node ports:
- Select the group node. On the Properties panel, make sure that Active Socket is set to 0, then change the Active Socket Label to MyColor.
The first port of the group node is now renamed to MyColor 0.
- Repeat for the second port. Set Active Socket to 1, and change the Active Socket Label to MyMultiplier.
The second port of the group node is now renamed to MyMultiplier 1.
Choose the Active Socket value, then enter the Active Socket Label.
Supply an alternate input value:
- Exit the group view and create a Color node (Hw Shader Nodes Values Color).
- Connect the RGB attribute of the Color node to the MyColor attribute of the group node.
- This alternate Color node is used instead of the default value.
Color node provides alternate input value and its value is used instead of the default value.
- (Optional) Repeat for the Float multiplier. Create a Float node (Hw Shader Nodes Values Float) and connect its Float attribute it to the MyMultiplier port of the group node.
Remove the color override: