Cleanup/refactor: BKE_libblock_alloc -> BKE_id_new in ID creation code.

Better use higher-level code from common ID management when possible.
Helps to de-duplicate logic, and reduces outside usages of more
'dangerous' functions.

Note that we could get rid of many of those `BKE_<id_type>_add`
functions now, but on the other hand several of those take extra
parameters and perform additional actions, so think we can keep them all
for now as 'non-standard ID specific creation functions'.
This commit is contained in:
2020-10-08 12:50:04 +02:00
parent df5fe9718b
commit 1cf5ce5e25
28 changed files with 30 additions and 63 deletions

View File

@@ -860,9 +860,7 @@ Mesh *BKE_mesh_add(Main *bmain, const char *name)
{
Mesh *me;
me = BKE_libblock_alloc(bmain, ID_ME, name, 0);
mesh_init_data(&me->id);
me = BKE_id_new(bmain, ID_ME, name);
return me;
}