main sync #3

Merged
Patrick Busch merged 318 commits from blender/blender:main into main 2023-03-17 15:52:21 +01:00
4 changed files with 12 additions and 75 deletions
Showing only changes of commit ee18b625ca - Show all commits

View File

@ -106,21 +106,6 @@ int BKE_id_attribute_to_index(const struct ID *id,
eAttrDomainMask domain_mask, eAttrDomainMask domain_mask,
eCustomDataMask layer_mask); eCustomDataMask layer_mask);
/**
* Sets up a temporary ID with arbitrary CustomData domains. `r_id` will
* be zero initialized with ID type id_type and any non-nullptr
* CustomData parameter will be copied into the appropriate struct members.
*
* \param r_id: Pointer to storage sufficient for ID type-code id_type.
*/
void BKE_id_attribute_copy_domains_temp(short id_type,
const struct CustomData *vdata,
const struct CustomData *edata,
const struct CustomData *ldata,
const struct CustomData *pdata,
const struct CustomData *cdata,
struct ID *r_id);
const char *BKE_id_attributes_active_color_name(const struct ID *id); const char *BKE_id_attributes_active_color_name(const struct ID *id);
const char *BKE_id_attributes_default_color_name(const struct ID *id); const char *BKE_id_attributes_default_color_name(const struct ID *id);
void BKE_id_attributes_active_color_set(struct ID *id, const char *name); void BKE_id_attributes_active_color_set(struct ID *id, const char *name);

View File

@ -830,55 +830,6 @@ CustomDataLayer *BKE_id_attributes_color_find(const ID *id, const char *name)
return nullptr; return nullptr;
} }
void BKE_id_attribute_copy_domains_temp(short id_type,
const CustomData *vdata,
const CustomData *edata,
const CustomData *ldata,
const CustomData *pdata,
const CustomData *cdata,
ID *r_id)
{
CustomData reset;
CustomData_reset(&reset);
switch (id_type) {
case ID_ME: {
Mesh *me = (Mesh *)r_id;
memset((void *)me, 0, sizeof(*me));
me->edit_mesh = nullptr;
me->vdata = vdata ? *vdata : reset;
me->edata = edata ? *edata : reset;
me->ldata = ldata ? *ldata : reset;
me->pdata = pdata ? *pdata : reset;
break;
}
case ID_PT: {
PointCloud *pointcloud = (PointCloud *)r_id;
memset((void *)pointcloud, 0, sizeof(*pointcloud));
pointcloud->pdata = vdata ? *vdata : reset;
break;
}
case ID_CV: {
Curves *curves = (Curves *)r_id;
memset((void *)curves, 0, sizeof(*curves));
curves->geometry.point_data = vdata ? *vdata : reset;
curves->geometry.curve_data = cdata ? *cdata : reset;
break;
}
default:
break;
}
*((short *)r_id->name) = id_type;
}
const char *BKE_uv_map_vert_select_name_get(const char *uv_map_name, char *buffer) const char *BKE_uv_map_vert_select_name_get(const char *uv_map_name, char *buffer)
{ {

View File

@ -573,27 +573,28 @@ void bmo_reverse_uvs_exec(BMesh *bm, BMOperator *op)
/**************************************************************************** * /**************************************************************************** *
* Cycle colors for a face * Cycle colors for a face
**************************************************************************** */ **************************************************************************** */
static void bmo_get_loop_color_ref(BMesh *bm, static void bmo_get_loop_color_ref(BMesh *bm,
int index, int index,
int *r_cd_color_offset, int *r_cd_color_offset,
int *r_cd_color_type) int *r_cd_color_type)
{ {
Mesh me_query; Mesh me_query;
memset(&me_query, 0, sizeof(Mesh));
BKE_id_attribute_copy_domains_temp( CustomData_reset(&me_query.vdata);
ID_ME, &bm->vdata, NULL, &bm->ldata, NULL, NULL, &me_query.id); CustomData_reset(&me_query.edata);
CustomData_reset(&me_query.pdata);
me_query.ldata = bm->ldata;
*((short *)me_query.id.name) = ID_ME;
CustomDataLayer *layer = BKE_id_attribute_from_index( CustomDataLayer *layer = BKE_id_attribute_from_index(
&me_query.id, index, ATTR_DOMAIN_MASK_COLOR, CD_MASK_COLOR_ALL); &me_query.id, index, ATTR_DOMAIN_MASK_CORNER, CD_MASK_COLOR_ALL);
if (!layer) {
if (!layer || BKE_id_attribute_domain(&me_query.id, layer) != ATTR_DOMAIN_CORNER) {
*r_cd_color_offset = -1; *r_cd_color_offset = -1;
return; return;
} }
int layer_i = CustomData_get_layer_index(&bm->ldata, layer->type); *r_cd_color_offset = layer->offset;
*r_cd_color_offset = bm->ldata.layers[layer_i].offset;
*r_cd_color_type = layer->type; *r_cd_color_type = layer->type;
} }

View File

@ -3133,7 +3133,7 @@ static int edbm_rotate_colors_exec(bContext *C, wmOperator *op)
} }
int color_index = BKE_id_attribute_to_index( int color_index = BKE_id_attribute_to_index(
&me->id, layer, ATTR_DOMAIN_MASK_COLOR, CD_MASK_COLOR_ALL); &me->id, layer, ATTR_DOMAIN_MASK_CORNER, CD_MASK_COLOR_ALL);
EDBM_op_init(em, EDBM_op_init(em,
&bmop, &bmop,
op, op,
@ -3187,7 +3187,7 @@ static int edbm_reverse_colors_exec(bContext *C, wmOperator *op)
BMOperator bmop; BMOperator bmop;
int color_index = BKE_id_attribute_to_index( int color_index = BKE_id_attribute_to_index(
&me->id, layer, ATTR_DOMAIN_MASK_COLOR, CD_MASK_COLOR_ALL); &me->id, layer, ATTR_DOMAIN_MASK_CORNER, CD_MASK_COLOR_ALL);
EDBM_op_init( EDBM_op_init(
em, &bmop, op, "reverse_colors faces=%hf color_index=%i", BM_ELEM_SELECT, color_index); em, &bmop, op, "reverse_colors faces=%hf color_index=%i", BM_ELEM_SELECT, color_index);