diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-01-11 22:31:50 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-01-11 22:36:03 +0300 |
commit | 90250f856817b68f29924be8a60152ec3a2486a8 (patch) | |
tree | ae98c2d35529c9e47293f914038b55e1da317a90 /source/blender/blenloader | |
parent | 72e31d6a7292ccd827a52afe351ffe89f31739f8 (diff) |
Support for copy/paste groups
Developer node, now bases are instanced by give_base_to_objects,
needed for correct OB_FROMGROUP base-flag assignment.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/BLO_readfile.h | 4 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 17 |
2 files changed, 14 insertions, 7 deletions
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 9f549bb4e7b..bf47682297d 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -103,9 +103,7 @@ struct ID *BLO_library_link_named_part_ex( struct Scene *scene, struct View3D *v3d); void BLO_library_link_end(struct Main *mainl, BlendHandle **bh, short flag, struct Scene *scene, struct View3D *v3d); -void BLO_library_link_all( - struct Main *mainl, BlendHandle *bh, const short flag, - struct Scene *scene, struct View3D *v3d); +void BLO_library_link_copypaste(struct Main *mainl, BlendHandle *bh); void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index a8c868a6210..505c236e01f 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9704,7 +9704,7 @@ static void link_object_postprocess(ID *id, Scene *scene, View3D *v3d, const sho /** * Simple reader for copy/paste buffers. */ -void BLO_library_link_all(Main *mainl, BlendHandle *bh, const short flag, Scene *scene, View3D *v3d) +void BLO_library_link_copypaste(Main *mainl, BlendHandle *bh) { FileData *fd = (FileData *)(bh); BHead *bhead; @@ -9714,15 +9714,24 @@ void BLO_library_link_all(Main *mainl, BlendHandle *bh, const short flag, Scene if (bhead->code == ENDB) break; - if (bhead->code == ID_OB) + if (ELEM(bhead->code, ID_OB, ID_GR)) { read_libblock(fd, mainl, bhead, LIB_TAG_TESTIND, &id); - + } + + if (id) { /* sort by name in list */ ListBase *lb = which_libbase(mainl, GS(id->name)); id_sort_by_name(lb, id); - link_object_postprocess(id, scene, v3d, flag); + if (bhead->code == ID_OB) { + /* Instead of instancing Base's directly, postpone until after groups are loaded + * otherwise the base's flag is set incorrecty when groups are used */ + Object *ob = (Object *)id; + ob->mode = OB_MODE_OBJECT; + /* ensure give_base_to_objects runs on this object */ + BLI_assert(id->us == 0); + } } } } |