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>2016-01-11 22:31:50 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-01-11 22:36:03 +0300
commit90250f856817b68f29924be8a60152ec3a2486a8 (patch)
treeae98c2d35529c9e47293f914038b55e1da317a90
parent72e31d6a7292ccd827a52afe351ffe89f31739f8 (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.
-rw-r--r--source/blender/blenkernel/intern/blender.c2
-rw-r--r--source/blender/blenloader/BLO_readfile.h4
-rw-r--r--source/blender/blenloader/intern/readfile.c17
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c12
4 files changed, 27 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 743fd58f829..e7026f7ed71 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 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);
+ }
}
}
}
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index bebaa5e5203..b5c1a4e335e 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);