Cleanup: Use const when retrieving custom data layers
Knowing when layers are retrieved for write access will be essential when adding proper copy-on-write support. This commit makes that clearer by adding `const` where the retrieved data is not modified. Ref T95842
This commit is contained in:
@@ -446,9 +446,9 @@ static bool bake_object_check(ViewLayer *view_layer,
|
||||
}
|
||||
|
||||
if (target == R_BAKE_TARGET_VERTEX_COLORS) {
|
||||
MPropCol *mcol = CustomData_get_layer(&me->vdata, CD_PROP_COLOR);
|
||||
const MPropCol *mcol = CustomData_get_layer(&me->vdata, CD_PROP_COLOR);
|
||||
const bool mcol_valid = (mcol != NULL);
|
||||
MLoopCol *mloopcol = CustomData_get_layer(&me->ldata, CD_PROP_BYTE_COLOR);
|
||||
const MLoopCol *mloopcol = CustomData_get_layer(&me->ldata, CD_PROP_BYTE_COLOR);
|
||||
if (mloopcol == NULL && !mcol_valid) {
|
||||
BKE_reportf(reports,
|
||||
RPT_ERROR,
|
||||
@@ -943,9 +943,9 @@ static bool bake_targets_init_vertex_colors(BakeTargets *targets, Object *ob, Re
|
||||
}
|
||||
|
||||
Mesh *me = ob->data;
|
||||
MPropCol *mcol = CustomData_get_layer(&me->vdata, CD_PROP_COLOR);
|
||||
const MPropCol *mcol = CustomData_get_layer(&me->vdata, CD_PROP_COLOR);
|
||||
const bool mcol_valid = (mcol != NULL);
|
||||
MLoopCol *mloopcol = CustomData_get_layer(&me->ldata, CD_PROP_BYTE_COLOR);
|
||||
const MLoopCol *mloopcol = CustomData_get_layer(&me->ldata, CD_PROP_BYTE_COLOR);
|
||||
if (mloopcol == NULL && !mcol_valid) {
|
||||
BKE_report(reports, RPT_ERROR, "No vertex colors layer found to bake to");
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user