[Bf-blender-cvs] [046d8ef6f17] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object
Antonio Vazquez
noreply at git.blender.org
Fri Dec 22 16:58:59 CET 2017
Commit: 046d8ef6f17445ed56ab0557f6542592f61d31f5
Author: Antonio Vazquez
Date: Fri Dec 22 16:46:27 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rB046d8ef6f17445ed56ab0557f6542592f61d31f5
Merge branch 'blender2.8' into greasepencil-object
Conflicts:
source/blender/blenloader/intern/versioning_280.c
===================================================================
===================================================================
diff --cc source/blender/blenloader/intern/versioning_280.c
index 3a3c0756273,b864c75c90f..1669abb9ae1
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -610,70 -599,38 +605,104 @@@ void do_versions_after_linking_280(Mai
}
}
+ {
+ for (Object *object = main->object.first; object; object = object->id.next) {
+ #ifndef VERSION_280_SUBVERSION_4
+ /* If any object already has an initialized value for
+ * duplicator_visibility_flag it means we've already doversioned it.
+ * TODO(all) remove the VERSION_280_SUBVERSION_4 code once the subversion was bumped. */
+ if (object->duplicator_visibility_flag != 0) {
+ break;
+ }
+ #endif
+ if (object->particlesystem.first) {
+ object->duplicator_visibility_flag = OB_DUPLI_FLAG_VIEWPORT;
+ for (ParticleSystem *psys = object->particlesystem.first; psys; psys=psys->next) {
+ if (psys->part->draw & PART_DRAW_EMITTER) {
+ object->duplicator_visibility_flag |= OB_DUPLI_FLAG_RENDER;
+ #ifndef VERSION_280_SUBVERSION_4
+ psys->part->draw &= ~PART_DRAW_EMITTER;
+ #else
+ break;
+ #endif
+ }
+ }
+ }
+ else if (object->transflag & OB_DUPLI){
+ object->duplicator_visibility_flag = OB_DUPLI_FLAG_VIEWPORT;
+ }
+ else {
+ object->duplicator_visibility_flag = OB_DUPLI_FLAG_VIEWPORT | OB_DUPLI_FLAG_RENDER;
+ }
+ }
+ }
+ }
++ }
++
+ /* Grease Pencil Object */
+ if (!MAIN_VERSION_ATLEAST(main, 280, 2)) {
+ /* Convert grease pencil datablock to GP object */
+ for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+ if (scene->gpd) {
+ Object *ob;
+ ViewLayer *view_layer = BKE_view_layer_from_scene_get(scene);
+ 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);
+ scene->gpd = NULL;
+
+ /* set cache as dirty */
+ BKE_gpencil_batch_cache_dirty(ob->data);
+ }
+ }
+ /* init grease pencil grids and paper */
+ for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
+ for (ScrArea *area = screen->areabase.first; area; area = area->next) {
+ for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ v3d->gpencil_grid_size[0] = GP_DEFAULT_GRID_SIZE;
+ v3d->gpencil_grid_size[1] = GP_DEFAULT_GRID_SIZE;
+ ARRAY_SET_ITEMS(v3d->gpencil_paper_color, 1.0f, 1.0f, 1.0f, 0.7f);
+ }
+ }
+ }
+ }
+
+ /* 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);
+ }
+ }
+ }
+
+ }
+}
static void do_version_layer_collections_idproperties(ListBase *lb)
{
More information about the Bf-blender-cvs
mailing list