[Bf-blender-cvs] [90250f8] master: Support for copy/paste groups
Campbell Barton
noreply at git.blender.org
Mon Jan 11 20:43:27 CET 2016
Commit: 90250f856817b68f29924be8a60152ec3a2486a8
Author: Campbell Barton
Date: Tue Jan 12 06:31:50 2016 +1100
Branches: master
https://developer.blender.org/rB90250f856817b68f29924be8a60152ec3a2486a8
Support for copy/paste groups
Developer node, now bases are instanced by give_base_to_objects,
needed for correct OB_FROMGROUP base-flag assignment.
===================================================================
M source/blender/blenkernel/intern/blender.c
M source/blender/blenloader/BLO_readfile.h
M source/blender/blenloader/intern/readfile.c
M source/blender/editors/space_view3d/view3d_ops.c
===================================================================
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 743fd58..e7026f7 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -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);
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index 9f549bb..bf47682 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 a8c868a..505c236 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);
+ }
}
}
}
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index bebaa5e..b5c1a4e 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -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);
More information about the Bf-blender-cvs
mailing list