diff options
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 456791e99fc..1e345605ec2 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -40,6 +40,7 @@ #include "DNA_armature_types.h" #include "DNA_camera_types.h" #include "DNA_constraint_types.h" +#include "DNA_gpencil_types.h" #include "DNA_group_types.h" #include "DNA_key_types.h" #include "DNA_lamp_types.h" @@ -389,7 +390,7 @@ void BKE_object_free_ex(Object *ob, bool do_id_user) /* disconnect specific data, but not for lib data (might be indirect data, can get relinked) */ if (ob->data) { ID *id = ob->data; - id->us--; + id_us_min(id); if (id->us == 0 && id->lib == NULL) { switch (ob->type) { case OB_MESH: @@ -408,7 +409,8 @@ void BKE_object_free_ex(Object *ob, bool do_id_user) if (ob->mat) { for (a = 0; a < ob->totcol; a++) { - if (ob->mat[a]) ob->mat[a]->id.us--; + if (ob->mat[a]) + id_us_min(&ob->mat[a]->id); } MEM_freeN(ob->mat); } @@ -420,8 +422,10 @@ void BKE_object_free_ex(Object *ob, bool do_id_user) if (ob->bb) MEM_freeN(ob->bb); ob->bb = NULL; if (ob->adt) BKE_animdata_free((ID *)ob); - if (ob->poselib) ob->poselib->id.us--; - if (ob->gpd) ((ID *)ob->gpd)->us--; + if (ob->poselib) + id_us_min(&ob->poselib->id); + if (ob->gpd) + id_us_min(&ob->gpd->id); if (ob->defbase.first) BLI_freelistN(&ob->defbase); if (ob->pose) @@ -1656,8 +1660,8 @@ void BKE_object_make_local(Object *ob) while (base) { if (base->object == ob) { base->object = ob_new; - ob_new->id.us++; - ob->id.us--; + id_us_plus(&ob_new->id); + id_us_min(&ob->id); } base = base->next; } |