[Bf-blender-cvs] [a1be8ef68e3] greasepencil-object: Fix merge problems and parameter list changes

Antonio Vazquez noreply at git.blender.org
Sat May 19 13:25:07 CEST 2018


Commit: a1be8ef68e3d54dc35f3d8ab26a6cf309f41c6c0
Author: Antonio Vazquez
Date:   Sat May 19 13:24:56 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBa1be8ef68e3d54dc35f3d8ab26a6cf309f41c6c0

Fix merge problems and parameter list changes

===================================================================

M	source/blender/blenkernel/intern/object.c
M	source/blender/blenloader/intern/versioning_280.c
D	source/blender/editors/transform/transform_snap_object.c.orig
M	source/blender/modifiers/intern/MOD_gpencilinstance.c

===================================================================

diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 70c57db5a25..3cc556b4fde 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -849,8 +849,8 @@ Object *BKE_object_add_for_data(
 	BKE_view_layer_base_deselect_all(view_layer);
 	DEG_id_tag_update_ex(bmain, &ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
 
-	layer_collection = BKE_layer_collection_get_active_ensure(scene, view_layer);
-	BKE_collection_object_add(&scene->id, layer_collection->scene_collection, ob);
+	layer_collection = BKE_layer_collection_get_active(view_layer);
+	BKE_collection_object_add(bmain, layer_collection->collection, ob);
 
 	base = BKE_view_layer_base_find(view_layer, ob);
 	BKE_view_layer_base_select(view_layer, base);
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 889dfd87cb8..1019e61c293 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -848,102 +848,103 @@ void do_versions_after_linking_280(Main *main)
 				}
 			}
 		}
-	}
 
-	/* Grease Pencil Object */
-	/* Convert grease pencil datablock to GP object */
+
+		/* Grease Pencil Object */
+		/* Convert grease pencil datablock to GP object */
 #if 0 /* XXX: Needs review - maybe we don't want to do this, as annotations could cause havok on cycles files! */
-	for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
-		if (scene->gpd) {
-			Object *ob;
-			ViewLayer *view_layer = scene->view_layers.first; /* Weak, but at least it goes somewhere... */
-			if (view_layer == NULL) {
-				view_layer = BKE_view_layer_add(scene, "Viewport");
-				printf("added scene layer again - %p\n", view_layer);
-			}
-
-			ob = BKE_object_add_for_data(main, scene, view_layer, OB_GPENCIL, "GP_Scene", &scene->gpd->id, false);
-			zero_v3(ob->loc);
-
-			/* convert grease pencil palettes (version >= 2.78)  to materials and weights */
-			bGPdata *gpd = scene->gpd;
-			for (const bGPDpalette *palette = gpd->palettes.first; palette; palette = palette->next) {
-				for (bGPDpalettecolor *palcolor = palette->colors.first; palcolor; palcolor = palcolor->next) {
-
-					/* create material slot */
-					BKE_object_material_slot_add(ob);
-					Material *ma = BKE_material_add_gpencil(main, palcolor->info);
-					assign_material(ob, ma, ob->totcol, BKE_MAT_ASSIGN_EXISTING);
-
-					/* copy color settings */
-					MaterialGPencilStyle *gp_style = ma->gp_style;
-					copy_v4_v4(gp_style->rgb, palcolor->color);
-					copy_v4_v4(gp_style->fill, palcolor->fill);
-					gp_style->flag = palcolor->flag;
-
-					/* fix strokes */
-					for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
-						for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
-							for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
-								if (STREQ(gps->colorname, palcolor->info)) {
-									gps->mat_nr = ob->totcol - 1;
+		for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+			if (scene->gpd) {
+				Object *ob;
+				ViewLayer *view_layer = scene->view_layers.first; /* Weak, but at least it goes somewhere... */
+				if (view_layer == NULL) {
+					view_layer = BKE_view_layer_add(scene, "Viewport");
+					printf("added scene layer again - %p\n", view_layer);
+				}
+
+				ob = BKE_object_add_for_data(main, scene, view_layer, OB_GPENCIL, "GP_Scene", &scene->gpd->id, false);
+				zero_v3(ob->loc);
+
+				/* convert grease pencil palettes (version >= 2.78)  to materials and weights */
+				bGPdata *gpd = scene->gpd;
+				for (const bGPDpalette *palette = gpd->palettes.first; palette; palette = palette->next) {
+					for (bGPDpalettecolor *palcolor = palette->colors.first; palcolor; palcolor = palcolor->next) {
+
+						/* create material slot */
+						BKE_object_material_slot_add(ob);
+						Material *ma = BKE_material_add_gpencil(main, palcolor->info);
+						assign_material(ob, ma, ob->totcol, BKE_MAT_ASSIGN_EXISTING);
+
+						/* copy color settings */
+						MaterialGPencilStyle *gp_style = ma->gp_style;
+						copy_v4_v4(gp_style->rgb, palcolor->color);
+						copy_v4_v4(gp_style->fill, palcolor->fill);
+						gp_style->flag = palcolor->flag;
+
+						/* fix strokes */
+						for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+							for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
+								for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
+									if (STREQ(gps->colorname, palcolor->info)) {
+										gps->mat_nr = ob->totcol - 1;
+									}
+									/* create weights array */
+									gps->dvert = MEM_callocN(sizeof(gps->dvert) * gps->totpoints, "gp_stroke_weights");
 								}
-								/* create weights array */
-								gps->dvert = MEM_callocN(sizeof(gps->dvert) * gps->totpoints, "gp_stroke_weights");
 							}
 						}
 					}
 				}
-			}
 
-			/* set cache as dirty */
-			BKE_gpencil_batch_cache_dirty(ob->data);
+				/* set cache as dirty */
+				BKE_gpencil_batch_cache_dirty(ob->data);
 
-			scene->gpd = NULL;
+				scene->gpd = NULL;
+			}
 		}
-	}
 
-	/* Handle object-linked grease pencil datablocks */
-	for (Object *ob = main->object.first; ob; ob = ob->id.next) {
-		if (ob->gpd) {
-			if (ob->type == OB_GPENCIL) {
-				/* GP Object - remap the links */
-				ob->data = ob->gpd;
-				ob->gpd = NULL;
-			}
-			else if (ob->type == OB_EMPTY) {
-				/* Empty with GP data - This should be able to be converted
-				 * to a GP object with little data loss
-				 */
-				ob->data = ob->gpd;
-				ob->gpd = NULL;
-				ob->type = OB_GPENCIL;
-			}
-			else {
-				/* FIXME: What to do in this case?
-				 *
-				 * We cannot create new objects for these, as we don't have a scene & scene layer
-				 * to put them into from here...
-				 */
-				printf("WARNING: Old Grease Pencil data ('%s') still exists on Object '%s'\n",
-					ob->gpd->id.name + 2, ob->id.name + 2);
+		/* Handle object-linked grease pencil datablocks */
+		for (Object *ob = main->object.first; ob; ob = ob->id.next) {
+			if (ob->gpd) {
+				if (ob->type == OB_GPENCIL) {
+					/* GP Object - remap the links */
+					ob->data = ob->gpd;
+					ob->gpd = NULL;
+				}
+				else if (ob->type == OB_EMPTY) {
+					/* Empty with GP data - This should be able to be converted
+					 * to a GP object with little data loss
+					 */
+					ob->data = ob->gpd;
+					ob->gpd = NULL;
+					ob->type = OB_GPENCIL;
+				}
+				else {
+					/* FIXME: What to do in this case?
+					 *
+					 * We cannot create new objects for these, as we don't have a scene & scene layer
+					 * to put them into from here...
+					 */
+					printf("WARNING: Old Grease Pencil data ('%s') still exists on Object '%s'\n",
+						ob->gpd->id.name + 2, ob->id.name + 2);
+				}
 			}
 		}
-	}
 #endif
-}
+	}
 
 #ifdef USE_COLLECTION_COMPAT_28
-	if (use_collection_compat_28 && !MAIN_VERSION_ATLEAST(main, 280, 14)) {
-		for (Collection *group = main->collection.first; group; group = group->id.next) {
-			do_version_group_collection_to_collection(main, group);
-		}
+		if (use_collection_compat_28 && !MAIN_VERSION_ATLEAST(main, 280, 14)) {
+			for (Collection *group = main->collection.first; group; group = group->id.next) {
+				do_version_group_collection_to_collection(main, group);
+			}
 
-		for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
-			do_version_scene_collection_to_collection(main, scene);
+			for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+				do_version_scene_collection_to_collection(main, scene);
+			}
 		}
-	}
 #endif
+	
 }
 
 void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
@@ -1180,7 +1181,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
 			}
 		}
 	}
-#endif
 
 	if (!MAIN_VERSION_ATLEAST(main, 280, 6)) {
 		if (DNA_struct_elem_find(fd->filesdna, "SpaceOops", "int", "filter") == false) {
diff --git a/source/blender/editors/transform/transform_snap_object.c.orig b/source/blender/editors/transform/transform_snap_object.c.orig
deleted file mode 100644
index 31cf5e8a826..00000000000
--- a/source/blender/editors/transform/transform_snap_object.c.orig
+++ /dev/null
@@ -1,2314 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/transform/transform_snap_object.c
- *  \ingroup edtransform
- */
-
-#include <stdlib.h>
-#include <math.h>
-#include <float.h>
-#include <stdio.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_math.h"
-#include "BLI_kdopbvh.h"
-#include "BLI_memarena.h"
-#include "BLI_ghash.h"
-#include "BLI_linklist.h"
-#include "BLI_listbase.h"
-#include "BLI_utildefines.h"
-
-#include "DNA_armature_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_object_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_bvhutils.h"
-#include "BKE_armature.h"
-#include "BKE_curve.h"
-#include "BKE_object.h"
-#include "BKE_anim.h"  /* for duplis */
-#include "BKE_editmesh.h"
-#include "BKE_main.h"
-#include "BKE_tracking.h"
-#include "BKE_context.h"
-#include "BKE_mesh.h"
-
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_query.h"
-
-#include "ED_transform.h"
-#include "ED_transform_snap_object_context.h"
-#include "ED_view3d.h"
-#include "ED_arma

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list