Support for copy/paste groups
Developer node, now bases are instanced by give_base_to_objects, needed for correct OB_FROMGROUP base-flag assignment.
This commit is contained in:
@@ -1072,7 +1072,7 @@ int BKE_copybuffer_paste(bContext *C, const char *libname, const short flag, Rep
|
||||
/* here appending/linking starts */
|
||||
mainl = BLO_library_link_begin(bmain, &bh, libname);
|
||||
|
||||
BLO_library_link_all(mainl, bh, flag, scene, v3d);
|
||||
BLO_library_link_copypaste(mainl, bh);
|
||||
|
||||
BLO_library_link_end(mainl, &bh, flag, scene, v3d);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_group_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
@@ -78,6 +79,17 @@ static int view3d_copybuffer_exec(bContext *C, wmOperator *op)
|
||||
BKE_copybuffer_tag_ID(&ob->id);
|
||||
}
|
||||
CTX_DATA_END;
|
||||
|
||||
for (Group *group = bmain->group.first; group; group = group->id.next) {
|
||||
for (GroupObject *go = group->gobject.first; go; go = go->next) {
|
||||
if (go->ob && (go->ob->id.tag & LIB_TAG_DOIT)) {
|
||||
BKE_copybuffer_tag_ID(&group->id);
|
||||
/* don't expand out to all other objects */
|
||||
group->id.tag &= ~LIB_TAG_NEED_EXPAND;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BLI_make_file_string("/", str, BKE_tempdir_base(), "copybuffer.blend");
|
||||
BKE_copybuffer_save(str, op->reports);
|
||||
|
||||
Reference in New Issue
Block a user