diff --git a/Cool b/Cool index 2a9de9ef..6a4eac5c 160000 --- a/Cool +++ b/Cool @@ -1 +1 @@ -Subproject commit 2a9de9ef9a49cb1bf029f8545925c132648fac33 +Subproject commit 6a4eac5cdaa9365f09929e46f99ce68be4f84471 diff --git a/changelog.md b/changelog.md index aeee1568..99b3dc12 100644 --- a/changelog.md +++ b/changelog.md @@ -22,6 +22,7 @@ - ✨ The slider for some parameters (Zoom, Time Speed, etc.) now behaves logarithmically, meaning it will have equal precision in the 0-1 range as in 1-∞. Basically this means they are more practical to use. - ✨ When using a Drag widget, the mouse position now stays locked in place instead of wrapping around the screen. +- ✨ Some node inputs now have a little info icon next to their pin, explaining what the parameter does in more details. - 🐛 Remove incompatible link when creating a link backward from a pin ## 🐣beta-15 diff --git a/src/Nodes/NodeInputDefinition.h b/src/Nodes/NodeInputDefinition.h index cdd18d01..a8f1356f 100644 --- a/src/Nodes/NodeInputDefinition.h +++ b/src/Nodes/NodeInputDefinition.h @@ -15,6 +15,7 @@ class NodeInputDefinition { NodeInputDefinition(NodeInputDefinition_Data const&); auto name() const -> auto const& { return _data.name; } + auto description() const -> auto const& { return _data.description; } auto signature() const -> auto const& { return _data.signature; } void set_description(std::string const& description) { _data.description = description; } diff --git a/src/Nodes/NodesConfig.cpp b/src/Nodes/NodesConfig.cpp index 4a825c09..f4df17e3 100644 --- a/src/Nodes/NodesConfig.cpp +++ b/src/Nodes/NodesConfig.cpp @@ -410,13 +410,13 @@ static auto make_node(Cool::NodeDefinitionAndCategoryName const& cat_id, Cool::G { for (size_t i = 0; i < def.signature().arity; ++i) { - node.input_pins().push_back(Cool::InputPin{/*pin_name=*/Cool::String::replace_all(def.main_function().argument_names[i], "_", " ")}); + node.input_pins().push_back(Cool::InputPin{/*pin_name=*/Cool::String::replace_all(def.main_function().argument_names[i], "_", " "), ""}); } } - node.output_pins().emplace_back("OUT"); + node.output_pins().emplace_back("OUT", ""); for (auto const& function_input : def.function_inputs()) - node.input_pins().push_back(Cool::InputPin{function_input.name()}); + node.input_pins().push_back(Cool::InputPin{function_input.name(), function_input.description()}); for (auto const& value_input_def : def.value_inputs()) { @@ -429,7 +429,7 @@ static auto make_node(Cool::NodeDefinitionAndCategoryName const& cat_id, Cool::G }; }, value_input_def )); - node.input_pins().push_back(Cool::InputPin{std::visit([](auto&& value_input_def) { return value_input_def.var_data.name; }, value_input_def)}); + node.input_pins().push_back(std::visit([](auto&& value_input_def) { return Cool::InputPin{value_input_def.var_data.name, value_input_def.description.value_or("")}; }, value_input_def)); } // Get the variables from the inputs @@ -440,7 +440,7 @@ static auto make_node(Cool::NodeDefinitionAndCategoryName const& cat_id, Cool::G apply_settings_to_inputs_no_history(settings, node.value_inputs(), to_string(node)); for (auto const& output_index_name : def.output_indices()) - node.output_pins().push_back(Cool::OutputPin{output_index_name}); + node.output_pins().push_back(Cool::OutputPin{output_index_name, ""}); return node; } diff --git a/website/content/Tutorials/30-Writing Nodes/20-Inputs.md b/website/content/Tutorials/30-Writing Nodes/20-Inputs.md index 00751584..4b270248 100644 --- a/website/content/Tutorials/30-Writing Nodes/20-Inputs.md +++ b/website/content/Tutorials/30-Writing Nodes/20-Inputs.md @@ -61,4 +61,15 @@ To declare a function that takes multiple inputs, here is the syntax: INPUT (Oklab_PremultipliedA, Oklab_PremultipliedA)->Oklab_PremultipliedA 'Blend Mode'; ``` -All the possible types for function inputs are the same as for the `main` function (see the [Primitive Types section](10-Primitive%20types.md)). \ No newline at end of file +All the possible types for function inputs are the same as for the `main` function (see the [Primitive Types section](10-Primitive%20types.md)). + +## Descriptions + +You can add a description to your inputs, by using a comment with **3 slashes (`///`)** : + +```glsl +INPUT float 'Progression'; /// When set to 0 you get Curve 1; when set to 1 you get Curve 2. +``` + +This will add a "" next to the pin, that will show your description when hovered. +![Description](img/description.png) \ No newline at end of file diff --git a/website/content/Tutorials/30-Writing Nodes/img/description.png b/website/content/Tutorials/30-Writing Nodes/img/description.png new file mode 100644 index 00000000..7f25a524 Binary files /dev/null and b/website/content/Tutorials/30-Writing Nodes/img/description.png differ