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:
authorJacques Lucke <jacques@blender.org>2021-09-11 14:05:20 +0300
committerJacques Lucke <jacques@blender.org>2021-09-11 14:05:20 +0300
commit4e78b89e487e9b9707d583c6b2578ad122c59d5e (patch)
tree620c9d0e0114488328cc55187dadfdb4f8a05754 /source/blender/blenkernel
parent166c8be7ac018c461514453b9947a23b7ac2ef26 (diff)
Geometry Nodes: add field support for socket inspection
Since fields were committed to master, socket inspection did not work correctly for all socket types anymore. Now the same functionality as before is back. Furthermore, fields that depend on some input will now show the inputs in the socket inspection. I added support for evaluating constant fields more immediately. This has the benefit that the same constant field is not evaluated more than once. It also helps with making the field independent of the multi-functions that it uses. We might still want to change the ownership handling for the multi-functions of nodes a bit, but that can be done separately. Differential Revision: https://developer.blender.org/D12444
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_geometry_set.hh9
-rw-r--r--source/blender/blenkernel/intern/attribute_access.cc16
2 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh
index c3d594d7dcd..3da35cb4fe1 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -657,10 +657,17 @@ class AttributeFieldInput : public fn::FieldInput {
{
}
+ StringRefNull attribute_name() const
+ {
+ return name_;
+ }
+
const GVArray *get_varray_for_context(const fn::FieldContext &context,
IndexMask mask,
ResourceScope &scope) const override;
+ std::string socket_inspection_name() const override;
+
uint64_t hash() const override;
bool is_equal_to(const fn::FieldNode &other) const override;
};
@@ -683,6 +690,8 @@ class AnonymousAttributeFieldInput : public fn::FieldInput {
IndexMask mask,
ResourceScope &scope) const override;
+ std::string socket_inspection_name() const override;
+
uint64_t hash() const override;
bool is_equal_to(const fn::FieldNode &other) const override;
};
diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc
index 08bd5dc5981..2a5bb99a18b 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -32,6 +32,8 @@
#include "BLI_float2.hh"
#include "BLI_span.hh"
+#include "BLT_translation.h"
+
#include "CLG_log.h"
#include "NOD_type_conversions.hh"
@@ -1318,6 +1320,13 @@ const GVArray *AttributeFieldInput::get_varray_for_context(const fn::FieldContex
return nullptr;
}
+std::string AttributeFieldInput::socket_inspection_name() const
+{
+ std::stringstream ss;
+ ss << TIP_("Attribute: ") << name_;
+ return ss.str();
+}
+
uint64_t AttributeFieldInput::hash() const
{
return get_default_hash_2(name_, type_);
@@ -1346,6 +1355,13 @@ const GVArray *AnonymousAttributeFieldInput::get_varray_for_context(
return nullptr;
}
+std::string AnonymousAttributeFieldInput::socket_inspection_name() const
+{
+ std::stringstream ss;
+ ss << TIP_("Anonymous Attribute: ") << debug_name_;
+ return ss.str();
+}
+
uint64_t AnonymousAttributeFieldInput::hash() const
{
return get_default_hash_2(anonymous_id_.get(), type_);