diff options
author | Hans Goudey <h.goudey@me.com> | 2022-05-31 14:20:16 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-05-31 14:20:16 +0300 |
commit | 4669178fc3786e1aebb117892d8dc6a2ce4dc955 (patch) | |
tree | 3680859a3b4337bd91669bd9a048afcbe46d6ba3 /source/blender/blenkernel | |
parent | 39c14f4e84c0813241659c9b56bef5a62d55e6c8 (diff) |
Attributes: Hide internal UI attributes and disallow procedural access
This commit hides "UI attributes" described in T97452 from the UI lists
in mesh, curve, and point cloud properties, and disallow accessing them
in geometry nodes.
Internal UI attributes like selection and hiding values should use the
attribute system for simplicity and performance, but we don't want to
expose those attributes in the attribute panel, which is meant for
regular user interaction. Procedural access may be misleading or cause
problems, as described in the design task above.
These attributes are added by two upcoming patches: D14934, D14685
Differential Revision: https://developer.blender.org/D15069
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_attribute.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_attribute_access.hh | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/attribute.cc | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/attribute_access.cc | 8 |
4 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_attribute.h b/source/blender/blenkernel/BKE_attribute.h index cc50076e964..ebc95c4247c 100644 --- a/source/blender/blenkernel/BKE_attribute.h +++ b/source/blender/blenkernel/BKE_attribute.h @@ -49,6 +49,7 @@ typedef enum AttributeDomainMask { /* Attributes. */ bool BKE_id_attributes_supported(struct ID *id); +bool BKE_attribute_allow_procedural_access(const char *attribute_name); /** * Create a new attribute layer. diff --git a/source/blender/blenkernel/BKE_attribute_access.hh b/source/blender/blenkernel/BKE_attribute_access.hh index 8d449a124ec..c8c7c4c6808 100644 --- a/source/blender/blenkernel/BKE_attribute_access.hh +++ b/source/blender/blenkernel/BKE_attribute_access.hh @@ -77,6 +77,9 @@ class AttributeIDRef { friend std::ostream &operator<<(std::ostream &stream, const AttributeIDRef &attribute_id); }; +bool allow_procedural_attribute_access(StringRef attribute_name); +extern const char *no_procedural_access_message; + } // namespace blender::bke /** diff --git a/source/blender/blenkernel/intern/attribute.cc b/source/blender/blenkernel/intern/attribute.cc index 0007fea62cb..cfddae7721b 100644 --- a/source/blender/blenkernel/intern/attribute.cc +++ b/source/blender/blenkernel/intern/attribute.cc @@ -23,6 +23,7 @@ #include "BLI_string_utils.h" #include "BKE_attribute.h" +#include "BKE_attribute_access.hh" #include "BKE_curves.h" #include "BKE_customdata.h" #include "BKE_editmesh.h" @@ -116,6 +117,11 @@ bool BKE_id_attributes_supported(ID *id) return false; } +bool BKE_attribute_allow_procedural_access(const char *attribute_name) +{ + return blender::bke::allow_procedural_attribute_access(attribute_name); +} + bool BKE_id_attribute_rename(ID *id, CustomDataLayer *layer, const char *new_name, diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc index e86bac21084..e487bf4acf6 100644 --- a/source/blender/blenkernel/intern/attribute_access.cc +++ b/source/blender/blenkernel/intern/attribute_access.cc @@ -55,6 +55,14 @@ std::ostream &operator<<(std::ostream &stream, const AttributeIDRef &attribute_i return stream; } +const char *no_procedural_access_message = + "This attribute can not be accessed in a procedural context"; + +bool allow_procedural_attribute_access(StringRef attribute_name) +{ + return !attribute_name.startswith(".selection"); +} + static int attribute_data_type_complexity(const CustomDataType data_type) { switch (data_type) { |