[Bf-blender-cvs] [d2913c1] id-remap: Merge branch 'master' into id-remap
Bastien Montagne
noreply at git.blender.org
Tue Nov 10 20:15:25 CET 2015
Commit: d2913c14092525b889e02c02c9f329aa2a84f33e
Author: Bastien Montagne
Date: Tue Nov 10 19:59:44 2015 +0100
Branches: id-remap
https://developer.blender.org/rBd2913c14092525b889e02c02c9f329aa2a84f33e
Merge branch 'master' into id-remap
Conflicts:
source/blender/blenkernel/intern/object.c
===================================================================
===================================================================
diff --cc source/blender/blenkernel/intern/object.c
index cc081b1,b305387..b2b56e6
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@@ -383,30 -383,60 +383,29 @@@ void BKE_object_free_caches(Object *obj
}
}
-/* do not free object itself */
-void BKE_object_free_ex(Object *ob, bool do_id_user)
+/** Free (or release) any data used by this object (does not free the object itself). */
+void BKE_object_free(Object *ob)
{
- int a;
-
+ BKE_animdata_free((ID *)ob);
+
+ BKE_object_free_modifiers(ob);
-
- /* disconnect specific data, but not for lib data (might be indirect data, can get relinked) */
- if (ob->data) {
- ID *id = ob->data;
- id_us_min(id);
- if (id->us == 0 && id->lib == NULL) {
- switch (ob->type) {
- case OB_MESH:
- BKE_mesh_unlink((Mesh *)id);
- break;
- case OB_CURVE:
- BKE_curve_unlink((Curve *)id);
- break;
- case OB_MBALL:
- BKE_mball_unlink((MetaBall *)id);
- break;
- }
- }
- ob->data = NULL;
- }
+
- if (ob->mat) {
- for (a = 0; a < ob->totcol; a++) {
- if (ob->mat[a])
- id_us_min(&ob->mat[a]->id);
- }
- MEM_freeN(ob->mat);
+ MEM_SAFE_FREE(ob->mat);
+ MEM_SAFE_FREE(ob->matbits);
+ MEM_SAFE_FREE(ob->iuser);
+ MEM_SAFE_FREE(ob->bb);
+
+ BLI_freelistN(&ob->defbase);
+ if (ob->pose) {
+ BKE_pose_free_ex(ob->pose, false);
+ ob->pose = NULL;
}
- if (ob->matbits) MEM_freeN(ob->matbits);
- ob->mat = NULL;
- ob->matbits = NULL;
- if (ob->iuser) MEM_freeN(ob->iuser);
- ob->iuser = NULL;
- if (ob->bb) MEM_freeN(ob->bb);
- ob->bb = NULL;
- if (ob->adt) BKE_animdata_free((ID *)ob);
- 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)
- BKE_pose_free_ex(ob->pose, do_id_user);
- if (ob->mpath)
+ if (ob->mpath) {
animviz_free_motionpath(ob->mpath);
+ ob->mpath = NULL;
+ }
BKE_bproperty_free_list(&ob->prop);
- BKE_object_free_modifiers(ob);
-
- BKE_object_free_derived_caches(ob);
-
+
free_sensors(&ob->sensors);
free_controllers(&ob->controllers);
free_actuators(&ob->actuators);
diff --cc source/blender/blenloader/intern/readfile.c
index 6996133,1108a75..77862e1
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -7927,10 -7927,8 +7927,10 @@@ static BHead *read_libblock(FileData *f
/* clear first 8 bits */
id->flag = (id->flag & 0xFF00) | flag | LIB_NEED_LINK;
+ /* clear first 16 bits */
+ id->flag2 = (id->flag2 & 0xFFFF0000);
id->lib = main->curlib;
- id->us = (id->flag & LIB_FAKEUSER) ? 1 : 0;
+ id->us = ID_FAKE_USERS(id);
id->icon_id = 0;
id->flag &= ~(LIB_ID_RECALC | LIB_ID_RECALC_DATA | LIB_DOIT | LIB_MISSING);
More information about the Bf-blender-cvs
mailing list