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:
authorCampbell Barton <ideasman42@gmail.com>2010-01-07 17:59:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-01-07 17:59:22 +0300
commit0983aae01959c2819dcc9fa3ce32f0a558cfa338 (patch)
tree8de9481b2b7f696bc2e156254becc18058e2e17a
parentba645ad67e83d1d12e247fd91e1decc9083342c1 (diff)
last commit didnt work properly, all groups were added. Tested to work with existing groups, link & append.
-rw-r--r--source/blender/blenloader/intern/readfile.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 163d6a33a2d..05f709f99a7 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -11619,19 +11619,34 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, int is
}
/* when *lib set, it also does objects that were in the appended group */
-static void give_base_to_groups(Main *mainvar, Scene *sce)
+static void give_base_to_groups(Main *mainvar, Scene *scene, Library *lib, int flag)
{
Group *group;
- Object *ob;
/* give all objects which are LIB_INDIRECT a base, or for a group when *lib has been set */
for(group= mainvar->group.first; group; group= group->id.next) {
- if((group->id.flag & LIB_APPEND_TAG)==0) {
- ob= add_object(sce, OB_EMPTY);
+ if( ((flag & FILE_LINK) && (group->id.lib == lib) && (group->id.flag & LIB_INDIRECT)==0) || /* linking, directly */
+ ((flag & FILE_LINK)==0 && (group->id.flag & LIB_APPEND_TAG)==0) /* appending */
+ ) {
+ Base *base;
+
+ /* add_object(...) messes with the selection */
+ Object *ob= add_only_object(OB_EMPTY, group->id.name+2);
+ ob->type= OB_EMPTY;
+ ob->lay= scene->lay;
+
+ /* assign the base */
+ base= scene_add_base(scene, ob);
+ base->flag |= SELECT;
+ base->object->flag= base->flag;
+ ob->recalc |= OB_RECALC;
+ scene->basact= base;
+
+ /* assign the group */
ob->dup_group= group;
ob->transflag |= OB_DUPLIGROUP;
- rename_id(&ob->id, group->id.name);
- VECCOPY(ob->loc, sce->cursor);
+ rename_id(&ob->id, group->id.name+2);
+ VECCOPY(ob->loc, scene->cursor);
}
}
}
@@ -11839,7 +11854,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
}
if (flag & FILE_GROUP_INSTANCE) {
- give_base_to_groups(mainvar, scene);
+ give_base_to_groups(mainvar, scene, mainl->curlib, flag);
}
} else {
give_base_to_objects(mainvar, scene, NULL, 0);