Cleanup: Make object material count function take a const pointer

This commit is contained in:
Hans Goudey 2023-08-04 13:26:04 -04:00
parent f97a51350d
commit 39c3a86d8e
2 changed files with 4 additions and 4 deletions

View File

@ -151,7 +151,7 @@ void BKE_id_material_clear(struct Main *bmain, struct ID *id);
* material indices might be overwritten by the object.
*/
struct Material *BKE_object_material_get_eval(struct Object *ob, short act);
int BKE_object_material_count_eval(struct Object *ob);
int BKE_object_material_count_eval(const struct Object *ob);
void BKE_id_material_eval_assign(struct ID *id, int slot, struct Material *material);
/**
* Add an empty material slot if the id has no material slots. This material slot allows the

View File

@ -773,15 +773,15 @@ Material *BKE_object_material_get_eval(Object *ob, short act)
return nullptr;
}
int BKE_object_material_count_eval(Object *ob)
int BKE_object_material_count_eval(const Object *ob)
{
BLI_assert(DEG_is_evaluated_object(ob));
if (ob->type == OB_EMPTY) {
return 0;
}
BLI_assert(ob->data != nullptr);
ID *id = get_evaluated_object_data_with_materials(ob);
const short *len_p = BKE_id_material_len_p(id);
const ID *id = get_evaluated_object_data_with_materials(const_cast<Object *>(ob));
const short *len_p = BKE_id_material_len_p(const_cast<ID *>(id));
return len_p ? *len_p : 0;
}