Sculpt-dev: fix merge errors in attribute code

This commit is contained in:
Joseph Eagar 2022-05-11 23:30:09 -07:00
parent e5a111c637
commit 7677b2428a
5 changed files with 18 additions and 33 deletions

View File

@ -603,23 +603,22 @@ class MESH_UL_color_attributes(UIList, ColorAttributesListBase):
split.emboss = 'NONE'
split.prop(attribute, "name", text="", icon='GROUP_VCOL')
active_render = _index == data.color_attributes.render_color_index
row = split.row()
row.emboss = 'NONE'
prop = split.operator(
"geometry.color_attribute_render_set",
text="",
icon='RESTRICT_RENDER_OFF' if active_render else 'RESTRICT_RENDER_ON',
)
props.name = attribute.name
sub = split.row()
sub.alignment = 'RIGHT'
sub.active = False
sub.label(text="%s%s" % (domain_name, data_type.name))
active_render = _index == data.color_attributes.render_color_index
row = layout.row()
row.emboss = 'NONE'
prop = row.operator(
"geometry.color_attribute_render_set",
text="",
icon='RESTRICT_RENDER_OFF' if active_render else 'RESTRICT_RENDER_ON',
)
prop.name = attribute.name
class MESH_UL_color_attributes_selector(UIList, ColorAttributesListBase):
def draw_item(self, _context, layout, _data, attribute, _icon, _active_data, _active_propname, _index):

View File

@ -93,7 +93,7 @@ static CustomData *attribute_customdata_find(ID *id, CustomDataLayer *layer)
for (AttributeDomain domain = 0; domain < ATTR_DOMAIN_NUM; domain++) {
CustomData *customdata = info[domain].customdata;
if (customdata &&
ARRAY_HAS_ITEM(layer, (CustomDataLayer const *)customdata->layers, customdata->totlayer)) {
ARRAY_HAS_ITEM((CustomDataLayer *)layer, customdata->layers, customdata->totlayer)) {
return customdata;
}
}
@ -285,13 +285,7 @@ int BKE_id_attributes_length(const ID *id, AttributeDomainMask domain_mask, Cust
CustomData *customdata = info[domain].customdata;
if (customdata && ((1 << (int)domain) & domain_mask)) {
for (int i = 0; i < customdata->totlayer; i++) {
CustomDataLayer *layer = customdata->layers + i;
if ((mask & CD_TYPE_AS_MASK(layer->type)) && !(layer->flag & CD_FLAG_TEMPORARY)) {
length++;
}
}
length += CustomData_number_of_layers_typemask(customdata, mask);
}
}
@ -305,7 +299,8 @@ AttributeDomain BKE_id_attribute_domain(const ID *id, const CustomDataLayer *lay
for (AttributeDomain domain = 0; domain < ATTR_DOMAIN_NUM; domain++) {
CustomData *customdata = info[domain].customdata;
if (customdata && ARRAY_HAS_ITEM(layer, customdata->layers, customdata->totlayer)) {
if (customdata &&
ARRAY_HAS_ITEM((CustomDataLayer *)layer, customdata->layers, customdata->totlayer)) {
return domain;
}
}
@ -335,7 +330,8 @@ int BKE_id_attribute_data_length(ID *id, CustomDataLayer *layer)
for (AttributeDomain domain = 0; domain < ATTR_DOMAIN_NUM; domain++) {
CustomData *customdata = info[domain].customdata;
if (customdata && ARRAY_HAS_ITEM(layer, customdata->layers, customdata->totlayer)) {
if (customdata &&
ARRAY_HAS_ITEM((CustomDataLayer *)layer, customdata->layers, customdata->totlayer)) {
return info[domain].length;
}
}

View File

@ -447,11 +447,6 @@ MeshRenderData *mesh_render_data_create(Object *object,
mr->edit_bmesh = me->edit_mesh;
mr->me = (do_final) ? editmesh_eval_final : editmesh_eval_cage;
mr->me->attributes_active_index = me->attributes_active_index;
mr->me->attr_color_active = me->attr_color_active;
mr->me->attr_color_render = me->attr_color_render;
mr->edit_data = is_mode_active ? mr->me->runtime.edit_data : NULL;
if (mr->edit_data) {

View File

@ -24,7 +24,6 @@ extern "C" {
#endif
struct DRWSubdivCache;
struct AttributeRef;
#define MIN_RANGE_LEN 1024
@ -361,10 +360,6 @@ extern const MeshExtract extract_vert_idx;
extern const MeshExtract extract_fdot_idx;
extern const MeshExtract extract_attr[GPU_MAX_ATTR];
int mesh_cd_get_active_color_i(const Mesh *me, const CustomData *cd_vdata, const CustomData *cd_ldata);
int mesh_cd_get_render_color_i(const Mesh *me, const CustomData *cd_vdata, const CustomData *cd_ldata);
int mesh_cd_get_vcol_i(const Mesh *me, const CustomData *cd_vdata, const CustomData *cd_ldata, const struct AttributeRef *ref);
#ifdef __cplusplus
}
#endif

View File

@ -456,7 +456,7 @@ int rna_AttributeGroup_color_length(PointerRNA *ptr)
CD_MASK_PROP_COLOR | CD_MASK_PROP_BYTE_COLOR);
}
int rna_AttributeGroup_length(PointerRNA *ptr)
ATTR_NO_OPT int rna_AttributeGroup_length(PointerRNA *ptr)
{
return BKE_id_attributes_length(ptr->owner_id, ATTR_DOMAIN_MASK_ALL, CD_MASK_PROP_ALL);
}