[Bf-blender-cvs] [ca45c2dc59a] master: Fix T103756: wrong anonymous attribute tooltip

Jacques Lucke noreply at git.blender.org
Mon Jan 9 14:52:15 CET 2023


Commit: ca45c2dc59ab663835d2c85e6b22a0f77ab46568
Author: Jacques Lucke
Date:   Mon Jan 9 14:52:06 2023 +0100
Branches: master
https://developer.blender.org/rBca45c2dc59ab663835d2c85e6b22a0f77ab46568

Fix T103756: wrong anonymous attribute tooltip

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

M	source/blender/blenkernel/BKE_anonymous_attribute_id.hh
M	source/blender/blenkernel/BKE_geometry_fields.hh
M	source/blender/blenkernel/intern/anonymous_attribute_id.cc
M	source/blender/nodes/NOD_geometry_exec.hh
M	source/blender/nodes/intern/node_geometry_exec.cc

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

diff --git a/source/blender/blenkernel/BKE_anonymous_attribute_id.hh b/source/blender/blenkernel/BKE_anonymous_attribute_id.hh
index b738ff50604..7e4ca4b7afd 100644
--- a/source/blender/blenkernel/BKE_anonymous_attribute_id.hh
+++ b/source/blender/blenkernel/BKE_anonymous_attribute_id.hh
@@ -47,6 +47,8 @@ class AnonymousAttributeID {
     return name_;
   }
 
+  virtual std::string user_name() const;
+
   void user_add() const
   {
     users_.fetch_add(1);
diff --git a/source/blender/blenkernel/BKE_geometry_fields.hh b/source/blender/blenkernel/BKE_geometry_fields.hh
index 967bb912cc6..085bade618c 100644
--- a/source/blender/blenkernel/BKE_geometry_fields.hh
+++ b/source/blender/blenkernel/BKE_geometry_fields.hh
@@ -268,7 +268,7 @@ class AnonymousAttributeFieldInput : public GeometryFieldInput {
   AnonymousAttributeFieldInput(AutoAnonymousAttributeID anonymous_id,
                                const CPPType &type,
                                std::string producer_name)
-      : GeometryFieldInput(type, anonymous_id->name()),
+      : GeometryFieldInput(type, anonymous_id->user_name()),
         anonymous_id_(std::move(anonymous_id)),
         producer_name_(producer_name)
   {
diff --git a/source/blender/blenkernel/intern/anonymous_attribute_id.cc b/source/blender/blenkernel/intern/anonymous_attribute_id.cc
index e15ea6b643c..38f9c3df772 100644
--- a/source/blender/blenkernel/intern/anonymous_attribute_id.cc
+++ b/source/blender/blenkernel/intern/anonymous_attribute_id.cc
@@ -4,6 +4,11 @@
 
 namespace blender::bke {
 
+std::string AnonymousAttributeID::user_name() const
+{
+  return this->name();
+}
+
 bool AnonymousAttributePropagationInfo::propagate(const AnonymousAttributeID &anonymous_id) const
 {
   if (this->propagate_all) {
diff --git a/source/blender/nodes/NOD_geometry_exec.hh b/source/blender/nodes/NOD_geometry_exec.hh
index ed0ba4105fd..088e076be35 100644
--- a/source/blender/nodes/NOD_geometry_exec.hh
+++ b/source/blender/nodes/NOD_geometry_exec.hh
@@ -49,12 +49,16 @@ using geo_eval_log::NodeWarningType;
  */
 class NodeAnonymousAttributeID : public AnonymousAttributeID {
   std::string long_name_;
+  std::string socket_name_;
 
  public:
   NodeAnonymousAttributeID(const Object &object,
                            const ComputeContext &compute_context,
                            const bNode &bnode,
-                           const StringRef identifier);
+                           const StringRef identifier,
+                           const StringRef name);
+
+  std::string user_name() const override;
 };
 
 class GeoNodeExecParams {
@@ -288,13 +292,15 @@ class GeoNodeExecParams {
     if (!this->anonymous_attribute_output_is_required(output_identifier) && !force_create) {
       return {};
     }
+    const bNodeSocket &output_socket = node_.output_by_identifier(output_identifier);
     const GeoNodesLFUserData &user_data = *this->user_data();
     const ComputeContext &compute_context = *user_data.compute_context;
     return MEM_new<NodeAnonymousAttributeID>(__func__,
                                              *user_data.modifier_data->self_object,
                                              compute_context,
                                              node_,
-                                             output_identifier);
+                                             output_identifier,
+                                             output_socket.name);
   }
 
   /**
diff --git a/source/blender/nodes/intern/node_geometry_exec.cc b/source/blender/nodes/intern/node_geometry_exec.cc
index c338ecacbc9..1824ff965ea 100644
--- a/source/blender/nodes/intern/node_geometry_exec.cc
+++ b/source/blender/nodes/intern/node_geometry_exec.cc
@@ -18,7 +18,9 @@ namespace blender::nodes {
 NodeAnonymousAttributeID::NodeAnonymousAttributeID(const Object &object,
                                                    const ComputeContext &compute_context,
                                                    const bNode &bnode,
-                                                   const StringRef identifier)
+                                                   const StringRef identifier,
+                                                   const StringRef name)
+    : socket_name_(name)
 {
   const ComputeContextHash &hash = compute_context.hash();
   {
@@ -36,6 +38,11 @@ NodeAnonymousAttributeID::NodeAnonymousAttributeID(const Object &object,
   }
 }
 
+std::string NodeAnonymousAttributeID::user_name() const
+{
+  return socket_name_;
+}
+
 void GeoNodeExecParams::error_message_add(const NodeWarningType type,
                                           const StringRef message) const
 {



More information about the Bf-blender-cvs mailing list