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:
authorJulian Eisel <eiseljulian@gmail.com>2017-03-01 18:32:13 +0300
committerJulian Eisel <eiseljulian@gmail.com>2017-03-01 18:34:16 +0300
commit18684e546f25feefa5a696b786e74fd63b590d10 (patch)
tree26ca4b6896783bfe2b822f2e4b2a3009df824f45 /source/blender/blenkernel/intern/collection.c
parentb00b9dadd819d3b94405f755131e609afa827438 (diff)
Outliner: Make sure collection name is unique after renaming
Diffstat (limited to 'source/blender/blenkernel/intern/collection.c')
-rw-r--r--source/blender/blenkernel/intern/collection.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 18af75771c0..b9a554f181f 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -62,9 +62,7 @@ SceneCollection *BKE_collection_add(Scene *scene, SceneCollection *sc_parent, co
sc_parent = sc_master;
}
- BLI_strncpy(sc->name, name, sizeof(sc->name));
- BLI_uniquename(&sc_master->scene_collections, sc, DATA_("Collection"), '.', offsetof(SceneCollection, name), sizeof(sc->name));
-
+ BKE_collection_rename(scene, sc, name);
BLI_addtail(&sc_parent->scene_collections, sc);
BKE_layer_sync_new_scene_collection(scene, sc_parent, sc);
@@ -181,6 +179,15 @@ SceneCollection *BKE_collection_master(const Scene *scene)
return scene->collection;
}
+void BKE_collection_rename(const Scene *scene, SceneCollection *sc, const char *name)
+{
+ SceneCollection *sc_master = BKE_collection_master(scene);
+
+ BLI_strncpy(sc->name, name, sizeof(sc->name));
+ BLI_uniquename(&sc_master->scene_collections, sc, DATA_("Collection"), '.', offsetof(SceneCollection, name),
+ sizeof(sc->name));
+}
+
/**
* Free (or release) any data used by the master collection (does not free the master collection itself).
* Used only to clear the entire scene data since it's not doing re-syncing of the LayerCollection tree