diff options
author | Hans Goudey <h.goudey@me.com> | 2022-06-07 19:55:56 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-06-07 19:55:56 +0300 |
commit | 9fda23389758c80d97439a0f5ee718d0f898ff79 (patch) | |
tree | 889fd1d36729a7243f4147104cb869b18fcc64b9 /source/blender/editors | |
parent | d39e0f9616680042d67979424e400bdf8a4b89f4 (diff) |
Cleanup: Use const pointers in attribute API
Diffstat (limited to 'source/blender/editors')
5 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/editors/geometry/geometry_attributes.cc b/source/blender/editors/geometry/geometry_attributes.cc index c9677da1af5..ed5787c8277 100644 --- a/source/blender/editors/geometry/geometry_attributes.cc +++ b/source/blender/editors/geometry/geometry_attributes.cc @@ -44,9 +44,9 @@ namespace blender::ed::geometry { static bool geometry_attributes_poll(bContext *C) { - Object *ob = ED_object_context(C); - Main *bmain = CTX_data_main(C); - ID *data = (ob) ? static_cast<ID *>(ob->data) : nullptr; + const Object *ob = ED_object_context(C); + const Main *bmain = CTX_data_main(C); + const ID *data = (ob) ? static_cast<ID *>(ob->data) : nullptr; return (ob && BKE_id_is_editable(bmain, &ob->id) && data && BKE_id_is_editable(bmain, data)) && BKE_id_attributes_supported(data); } @@ -106,7 +106,7 @@ static int geometry_attribute_add_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static void next_color_attribute(struct ID *id, CustomDataLayer *layer, bool is_render) +static void next_color_attribute(ID *id, CustomDataLayer *layer, bool is_render) { int index = BKE_id_attribute_to_index(id, layer, ATTR_DOMAIN_MASK_COLOR, CD_MASK_COLOR_ALL); @@ -129,7 +129,7 @@ static void next_color_attribute(struct ID *id, CustomDataLayer *layer, bool is_ } } -static void next_color_attributes(struct ID *id, CustomDataLayer *layer) +static void next_color_attributes(ID *id, CustomDataLayer *layer) { next_color_attribute(id, layer, false); /* active */ next_color_attribute(id, layer, true); /* render */ diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index feecefdb7ea..1febc429edc 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -3092,8 +3092,8 @@ static int edbm_rotate_colors_exec(bContext *C, wmOperator *op) BMOperator bmop; - Mesh *me = BKE_object_get_original_mesh(ob); - CustomDataLayer *layer = BKE_id_attributes_active_color_get(&me->id); + const Mesh *me = BKE_object_get_original_mesh(ob); + const CustomDataLayer *layer = BKE_id_attributes_active_color_get(&me->id); if (!layer || BKE_id_attribute_domain(&me->id, layer) != ATTR_DOMAIN_CORNER) { continue; @@ -3144,8 +3144,8 @@ static int edbm_reverse_colors_exec(bContext *C, wmOperator *op) continue; } - Mesh *me = BKE_object_get_original_mesh(obedit); - CustomDataLayer *layer = BKE_id_attributes_active_color_get(&me->id); + const Mesh *me = BKE_object_get_original_mesh(obedit); + const CustomDataLayer *layer = BKE_id_attributes_active_color_get(&me->id); if (!layer || BKE_id_attribute_domain(&me->id, layer) != ATTR_DOMAIN_CORNER) { continue; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.cc b/source/blender/editors/sculpt_paint/paint_vertex.cc index fea501f20a9..8dd0ae7fea5 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.cc +++ b/source/blender/editors/sculpt_paint/paint_vertex.cc @@ -139,7 +139,7 @@ struct NormalAnglePrecalc { /* Returns number of elements. */ static int get_vcol_elements(Mesh *me, size_t *r_elem_size) { - CustomDataLayer *layer = BKE_id_attributes_active_color_get(&me->id); + const CustomDataLayer *layer = BKE_id_attributes_active_color_get(&me->id); eAttrDomain domain = BKE_id_attribute_domain(&me->id, layer); if (r_elem_size) { diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 87f6198ce0b..17a0463abd0 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -148,7 +148,7 @@ const float *SCULPT_vertex_co_get(SculptSession *ss, int index) bool SCULPT_has_loop_colors(const Object *ob) { Mesh *me = BKE_object_get_original_mesh(ob); - CustomDataLayer *layer = BKE_id_attributes_active_color_get(&me->id); + const CustomDataLayer *layer = BKE_id_attributes_active_color_get(&me->id); return layer && BKE_id_attribute_domain(&me->id, layer) == ATTR_DOMAIN_CORNER; } diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index f6b24bede61..e82f14b1ca7 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -1465,7 +1465,7 @@ static bool sculpt_attribute_ref_equals(SculptAttrRef *a, SculptAttrRef *b) static void sculpt_save_active_attribute(Object *ob, SculptAttrRef *attr) { Mesh *me = BKE_object_get_original_mesh(ob); - CustomDataLayer *layer; + const CustomDataLayer *layer; if (ob && me && (layer = BKE_id_attributes_active_color_get((ID *)me))) { attr->domain = BKE_id_attribute_domain((ID *)me, layer); |