diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-11-09 21:47:10 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-11-09 23:00:53 +0300 |
commit | 865796375bcfa6be4288cca4243dddcb4092f70b (patch) | |
tree | 5264d4b9b0f9d392b6e1b942e0f6fd802de1fff4 /source/blender/collada | |
parent | cf959a879eb5ffbdfa573c5f3a00965e69d7a976 (diff) |
Cleanup: avoid incrementing/decrementing id->us outside of BKE_library.
We have callbacks for that, they also do some checks and help ensure things are done
correctly. Only place where this is assumed not true is blenloader (since here we
may affect refcount of library IDs as well...).
Diffstat (limited to 'source/blender/collada')
-rw-r--r-- | source/blender/collada/DocumentImporter.cpp | 4 | ||||
-rw-r--r-- | source/blender/collada/MeshImporter.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 674a79f0fe7..498e65790f3 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -388,7 +388,7 @@ Object *DocumentImporter::create_camera_object(COLLADAFW::InstanceCamera *camera Camera *cam = uid_camera_map[cam_uid]; Camera *old_cam = (Camera *)ob->data; ob->data = cam; - old_cam->id.us--; + id_us_min(&old_cam->id); if (old_cam->id.us == 0) BKE_libblock_free(G.main, old_cam); return ob; @@ -406,7 +406,7 @@ Object *DocumentImporter::create_lamp_object(COLLADAFW::InstanceLight *lamp, Sce Lamp *la = uid_lamp_map[lamp_uid]; Lamp *old_lamp = (Lamp *)ob->data; ob->data = la; - old_lamp->id.us--; + id_us_min(&old_lamp->id); if (old_lamp->id.us == 0) BKE_libblock_free(G.main, old_lamp); return ob; diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 2adbdd27cdf..64df42fc823 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -1176,7 +1176,7 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry *geom) const std::string& str_geom_id = mesh->getName().size() ? mesh->getName() : mesh->getOriginalId(); Mesh *me = BKE_mesh_add(G.main, (char *)str_geom_id.c_str()); - me->id.us--; // is already 1 here, but will be set later in BKE_mesh_assign_object + id_us_min(&me->id); // is already 1 here, but will be set later in BKE_mesh_assign_object // store the Mesh pointer to link it later with an Object // mesh_geom_map needed to map mesh to its geometry name (for shape key naming) |