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
This commit is contained in:
2022-05-31 13:20:16 +02:00
parent 39c14f4e84
commit 4669178fc3
13 changed files with 85 additions and 3 deletions

View File

@@ -497,6 +497,16 @@ class MESH_UL_attributes(UIList):
'CORNER': "Face Corner",
}
def filter_items(self, context, data, property):
attributes = getattr(data, property)
flags = []
indices = [i for i in range(len(attributes))]
for index, item in enumerate(attributes):
flags.append(self.bitflag_filter_item if item.is_internal else 0)
return flags, indices
def draw_item(self, _context, layout, _data, attribute, _icon, _active_data, _active_propname, _index):
data_type = attribute.bl_rna.properties['data_type'].enum_items[attribute.data_type]
@@ -576,7 +586,7 @@ class ColorAttributesListBase():
'CORNER': "Face Corner",
}
def filter_items(self, _context, data, property):
def filter_items(self, context, data, property):
attrs = getattr(data, property)
ret = []
idxs = []
@@ -584,7 +594,8 @@ class ColorAttributesListBase():
for idx, item in enumerate(attrs):
skip = (
(item.domain not in {"POINT", "CORNER"}) or
(item.data_type not in {"FLOAT_COLOR", "BYTE_COLOR"})
(item.data_type not in {"FLOAT_COLOR", "BYTE_COLOR"}) or
(not item.is_internal)
)
ret.append(self.bitflag_filter_item if not skip else 0)
idxs.append(idx)