[Bf-blender-cvs] [1cd47ba37e1] temp-derived-node-tree-refactor: operator bool

Jacques Lucke noreply at git.blender.org
Wed Mar 3 09:57:02 CET 2021


Commit: 1cd47ba37e12f242117e1189b99e0ba98f269d33
Author: Jacques Lucke
Date:   Wed Mar 3 09:03:56 2021 +0100
Branches: temp-derived-node-tree-refactor
https://developer.blender.org/rB1cd47ba37e12f242117e1189b99e0ba98f269d33

operator bool

===================================================================

M	source/blender/nodes/NOD_XXX_node_tree.hh

===================================================================

diff --git a/source/blender/nodes/NOD_XXX_node_tree.hh b/source/blender/nodes/NOD_XXX_node_tree.hh
index 0a3c6052d8a..18462c7bf8e 100644
--- a/source/blender/nodes/NOD_XXX_node_tree.hh
+++ b/source/blender/nodes/NOD_XXX_node_tree.hh
@@ -63,6 +63,8 @@ struct XXXNode {
   friend bool operator==(const XXXNode &a, const XXXNode &b);
   friend bool operator!=(const XXXNode &a, const XXXNode &b);
 
+  operator bool() const;
+
   uint64_t hash() const;
 };
 
@@ -76,6 +78,8 @@ struct XXXSocket {
   friend bool operator==(const XXXSocket &a, const XXXSocket &b);
   friend bool operator!=(const XXXSocket &a, const XXXSocket &b);
 
+  operator bool() const;
+
   uint64_t hash() const;
 };
 
@@ -88,6 +92,8 @@ struct XXXInputSocket {
   friend bool operator==(const XXXInputSocket &a, const XXXInputSocket &b);
   friend bool operator!=(const XXXInputSocket &a, const XXXInputSocket &b);
 
+  operator bool() const;
+
   uint64_t hash() const;
 };
 
@@ -100,6 +106,8 @@ struct XXXOutputSocket {
   friend bool operator==(const XXXOutputSocket &a, const XXXOutputSocket &b);
   friend bool operator!=(const XXXOutputSocket &a, const XXXOutputSocket &b);
 
+  operator bool() const;
+
   uint64_t hash() const;
 };
 
@@ -168,6 +176,11 @@ inline bool operator!=(const XXXNode &a, const XXXNode &b)
   return !(a == b);
 }
 
+inline XXXNode::operator bool() const
+{
+  return node != nullptr;
+}
+
 inline uint64_t XXXNode::hash() const
 {
   return DefaultHash<XXXNodeTreeContext>{}(context) ^ DefaultHash<const NodeRef *>{}(node);
@@ -197,6 +210,11 @@ inline bool operator!=(const XXXSocket &a, const XXXSocket &b)
   return !(a == b);
 }
 
+inline XXXSocket::operator bool() const
+{
+  return socket != nullptr;
+}
+
 inline uint64_t XXXSocket::hash() const
 {
   return DefaultHash<XXXNodeTreeContext>{}(context) ^ DefaultHash<const SocketRef *>{}(socket);
@@ -221,6 +239,11 @@ inline bool operator!=(const XXXInputSocket &a, const XXXInputSocket &b)
   return !(a == b);
 }
 
+inline XXXInputSocket::operator bool() const
+{
+  return socket != nullptr;
+}
+
 inline uint64_t XXXInputSocket::hash() const
 {
   return DefaultHash<XXXNodeTreeContext>{}(context) ^
@@ -246,6 +269,11 @@ inline bool operator!=(const XXXOutputSocket &a, const XXXOutputSocket &b)
   return !(a == b);
 }
 
+inline XXXOutputSocket::operator bool() const
+{
+  return socket != nullptr;
+}
+
 inline uint64_t XXXOutputSocket::hash() const
 {
   return DefaultHash<XXXNodeTreeContext>{}(context) ^



More information about the Bf-blender-cvs mailing list