diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_library.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 8 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_defaults.c | 2 | ||||
-rw-r--r-- | source/blender/collada/DocumentImporter.cpp | 2 |
4 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index ff0cad2e5ed..336928575af 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -109,7 +109,7 @@ void BKE_main_id_clear_newpoins(struct Main *bmain); void BKE_main_lib_objects_recalc_all(struct Main *bmain); -void rename_id(struct ID *id, const char *name); +void BKE_rename_id(struct Main *bmain, struct ID *id, const char *name); void name_uiprefix_id(char *name, const struct ID *id); void test_idbutton(char *name); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 14e21a8b014..39feb4065eb 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1831,12 +1831,14 @@ void test_idbutton(char *name) /** * Sets the name of a block to name, suitably adjusted for uniqueness. */ -void rename_id(ID *id, const char *name) +void BKE_rename_id(Main *bmain, ID *id, const char *name) { ListBase *lb; - BLI_strncpy(id->name + 2, name, sizeof(id->name) - 2); - lb = which_libbase(G.main, GS(id->name)); + if (!bmain) + bmain = G.main; + + lb = which_libbase(bmain, GS(id->name)); new_id(lb, id, name); } diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index cf0e4438963..1dc3128319f 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -234,7 +234,7 @@ void BLO_update_defaults_startup_blend(Main *bmain) br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Twist"); if (br) { - rename_id(&br->id, "Rotate"); + BKE_rename_id(bmain, &br->id, "Rotate"); } } } diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 498e65790f3..45b8a4fe5d4 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -654,7 +654,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA for (std::vector<Object *>::iterator it = objects_done->begin(); it != objects_done->end(); ++it) { ob = *it; std::string nodename = node->getName().size() ? node->getName() : node->getOriginalId(); - rename_id(&ob->id, (char *)nodename.c_str()); + BKE_rename_id(NULL, &ob->id, (char *)nodename.c_str()); object_map.insert(std::pair<COLLADAFW::UniqueId, Object *>(node->getUniqueId(), ob)); node_map[node->getUniqueId()] = node; |