Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Matthews <guitargeek>2021-09-24 18:02:51 +0300
committerJacques Lucke <jacques@blender.org>2021-09-24 18:13:40 +0300
commitef45399f3be0955ba8a8c678a5f5ed18ed8c7759 (patch)
tree96384293376901e39c364ed7f01b690a95ddfe42 /source/blender/nodes/NOD_node_declaration.hh
parent4a2c63f4bd7e3cbb8cd80655270f3184d660e51d (diff)
Nodes: initial support for socket tooltips
This adds initial limited support for socket tooltips. It's limited in a couple of ways for now: * Only works when hovering over the socket shape, not when hovering over the value in the socket. * Only works for built-in nodes that already use the new node declaration system. This can later be extended to support pynodes. Those limitations are well worth it for now, given that the implementation is quite simple and the impact on usability is quite large. More complex updates to the layout system, that would allow showing socket tooltips in the nodes, can be done later. With the current implementation we can at least start writing tooltips for geometry nodes now. This commit already adds tooltips for the Cylinder node as an example. Differential Revision: https://developer.blender.org/D12607
Diffstat (limited to 'source/blender/nodes/NOD_node_declaration.hh')
-rw-r--r--source/blender/nodes/NOD_node_declaration.hh11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/nodes/NOD_node_declaration.hh b/source/blender/nodes/NOD_node_declaration.hh
index 6780dfcad59..8c7d343c001 100644
--- a/source/blender/nodes/NOD_node_declaration.hh
+++ b/source/blender/nodes/NOD_node_declaration.hh
@@ -119,6 +119,7 @@ class SocketDeclaration {
protected:
std::string name_;
std::string identifier_;
+ std::string description_;
bool hide_label_ = false;
bool hide_value_ = false;
bool is_multi_input_ = false;
@@ -138,6 +139,7 @@ class SocketDeclaration {
virtual bNodeSocket &update_or_build(bNodeTree &ntree, bNode &node, bNodeSocket &socket) const;
StringRefNull name() const;
+ StringRefNull description() const;
StringRefNull identifier() const;
InputSocketFieldType input_field_type() const;
@@ -186,6 +188,11 @@ class SocketDeclarationBuilder : public BaseSocketDeclarationBuilder {
return *(Self *)this;
}
+ Self &description(std::string value = "")
+ {
+ decl_->description_ = std::move(value);
+ return *(Self *)this;
+ }
Self &no_muted_links(bool value = true)
{
decl_->no_mute_links_ = value;
@@ -297,6 +304,10 @@ inline StringRefNull SocketDeclaration::identifier() const
return identifier_;
}
+inline StringRefNull SocketDeclaration::description() const
+{
+ return description_;
+}
inline InputSocketFieldType SocketDeclaration::input_field_type() const
{
return input_field_type_;