Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2015-12-28 01:22:43 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-12-28 01:22:43 +0300
commit540ab7a55af91ae1eca00a90cc53f293d876f5a8 (patch)
tree387111cbb6ecbc36fa759aadd5ad8192f76927e7
parentc4c3d84d5805d8c91aa3ef06f70492d60f4e7778 (diff)
Changes to rename_id function:
* Don't copy name before entering new_id function. new_id does that for us already. * Take a main argument to make the function possible to use with different databases * Append BKE_ to rename_id
-rw-r--r--source/blender/blenkernel/BKE_library.h2
-rw-r--r--source/blender/blenkernel/intern/library.c8
-rw-r--r--source/blender/blenloader/intern/versioning_defaults.c2
-rw-r--r--source/blender/collada/DocumentImporter.cpp2
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;