[Bf-blender-cvs] [9ad04b85efb] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object
Antonio Vazquez
noreply at git.blender.org
Sat Jun 16 10:17:15 CEST 2018
Commit: 9ad04b85efb25c7edf74e13732309cad9f3adfe5
Author: Antonio Vazquez
Date: Sat Jun 16 10:01:21 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB9ad04b85efb25c7edf74e13732309cad9f3adfe5
Merge branch 'blender2.8' into greasepencil-object
Conflicts:
source/blender/blenkernel/intern/gpencil.c
===================================================================
===================================================================
diff --cc source/blender/blenkernel/intern/gpencil.c
index c327369e7fe,6a59ea4439f..87e891ff173
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@@ -698,27 -785,31 +698,29 @@@ bGPdata *BKE_gpencil_data_duplicate(Mai
/* Yuck and super-uber-hyper yuck!!!
* Should be replaceable with a no-main copy (LIB_ID_COPY_NO_MAIN etc.), but not sure about it,
* so for now keep old code for that one. */
- if (internal_copy) {
- const bGPDlayer *gpl_src;
- bGPDlayer *gpl_dst;
- bGPdata *gpd_dst;
+
+ /* error checking */
+ if (gpd_src == NULL) {
+ return NULL;
+ }
+ if (internal_copy) {
/* make a straight copy for undo buffers used during stroke drawing */
gpd_dst = MEM_dupallocN(gpd_src);
-
- /* copy layers */
- BLI_listbase_clear(&gpd_dst->layers);
- for (gpl_src = gpd_src->layers.first; gpl_src; gpl_src = gpl_src->next) {
- /* make a copy of source layer and its data */
- gpl_dst = BKE_gpencil_layer_duplicate(gpl_src);
- BLI_addtail(&gpd_dst->layers, gpl_dst);
- }
-
- /* return new */
- return gpd_dst;
}
else {
- /* make a copy when others use this */
- gpd_dst = BKE_libblock_copy(bmain, &gpd_src->id);
- gpd_dst->runtime.batch_cache_data = NULL;
+ BLI_assert(bmain != NULL);
+ bGPdata *gpd_copy;
+ BKE_id_copy_ex(bmain, &gpd_src->id, (ID **)&gpd_copy, 0, false);
++ gpd_copy->runtime.batch_cache_data = NULL;
+ return gpd_copy;
}
+
+ /* Copy internal data (layers, etc.) */
+ BKE_gpencil_copy_data(bmain, gpd_dst, gpd_src, 0);
+
+ /* return new */
+ return gpd_dst;
}
void BKE_gpencil_make_local(Main *bmain, bGPdata *gpd, const bool lib_local)
More information about the Bf-blender-cvs
mailing list