[Bf-blender-cvs] [29937dce8f5] blender2.8: Merge branch 'master' into blender2.8

Campbell Barton noreply at git.blender.org
Wed Aug 1 00:44:28 CEST 2018


Commit: 29937dce8f518b09838f58abcc42a43fb29bf64f
Author: Campbell Barton
Date:   Wed Aug 1 08:42:00 2018 +1000
Branches: blender2.8
https://developer.blender.org/rB29937dce8f518b09838f58abcc42a43fb29bf64f

Merge branch 'master' into blender2.8

Move 'View3D.flag3' options into 'gp_flag'.

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



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

diff --cc source/blender/blenloader/intern/versioning_280.c
index d2a1cc1f4f1,00000000000..ab787a52cfd
mode 100644,000000..100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -1,1835 -1,0 +1,1832 @@@
 +/*
 + * ***** 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.
 + *
 + * Contributor(s): Dalai Felinto
 + *
 + * ***** END GPL LICENSE BLOCK *****
 + *
 + */
 +
 +/** \file blender/blenloader/intern/versioning_280.c
 + *  \ingroup blenloader
 + */
 +
 +/* allow readfile to use deprecated functionality */
 +#define DNA_DEPRECATED_ALLOW
 +
 +#include <string.h>
 +#include <float.h>
 +
 +#include "BLI_listbase.h"
 +#include "BLI_math.h"
 +#include "BLI_mempool.h"
 +#include "BLI_string.h"
 +#include "BLI_string_utf8.h"
 +#include "BLI_utildefines.h"
 +
 +#include "DNA_object_types.h"
 +#include "DNA_camera_types.h"
 +#include "DNA_constraint_types.h"
 +#include "DNA_gpu_types.h"
 +#include "DNA_group_types.h"
 +#include "DNA_lamp_types.h"
 +#include "DNA_layer_types.h"
 +#include "DNA_lightprobe_types.h"
 +#include "DNA_material_types.h"
 +#include "DNA_mesh_types.h"
 +#include "DNA_particle_types.h"
 +#include "DNA_rigidbody_types.h"
 +#include "DNA_scene_types.h"
 +#include "DNA_screen_types.h"
 +#include "DNA_view3d_types.h"
 +#include "DNA_genfile.h"
 +#include "DNA_gpencil_types.h"
 +#include "DNA_workspace_types.h"
 +
 +#include "BKE_collection.h"
 +#include "BKE_constraint.h"
 +#include "BKE_customdata.h"
 +#include "BKE_colortools.h"
 +#include "BKE_freestyle.h"
 +#include "BKE_idprop.h"
 +#include "BKE_image.h"
 +#include "BKE_layer.h"
 +#include "BKE_main.h"
 +#include "BKE_material.h"
 +#include "BKE_mesh.h"
 +#include "BKE_node.h"
 +#include "BKE_pointcache.h"
 +#include "BKE_report.h"
 +#include "BKE_scene.h"
 +#include "BKE_screen.h"
 +#include "BKE_sequencer.h"
 +#include "BKE_studiolight.h"
 +#include "BKE_workspace.h"
 +#include "BKE_gpencil.h"
 +#include "BKE_paint.h"
 +#include "BKE_object.h"
 +
 +#include "BLO_readfile.h"
 +#include "readfile.h"
 +
 +#include "MEM_guardedalloc.h"
 +
 +static bScreen *screen_parent_find(const bScreen *screen)
 +{
 +	/* can avoid lookup if screen state isn't maximized/full (parent and child store the same state) */
 +	if (ELEM(screen->state, SCREENMAXIMIZED, SCREENFULL)) {
 +		for (const ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
 +			if (sa->full && sa->full != screen) {
 +				BLI_assert(sa->full->state == screen->state);
 +				return sa->full;
 +			}
 +		}
 +	}
 +
 +	return NULL;
 +}
 +
 +static void do_version_workspaces_create_from_screens(Main *bmain)
 +{
 +	for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
 +		const bScreen *screen_parent = screen_parent_find(screen);
 +		WorkSpace *workspace;
 +		if (screen->temp) {
 +			continue;
 +		}
 +
 +		if (screen_parent) {
 +			/* fullscreen with "Back to Previous" option, don't create
 +			 * a new workspace, add layout workspace containing parent */
 +			workspace = BLI_findstring(
 +			        &bmain->workspaces, screen_parent->id.name + 2, offsetof(ID, name) + 2);
 +		}
 +		else {
 +			workspace = BKE_workspace_add(bmain, screen->id.name + 2);
 +		}
 +		if (workspace == NULL) {
 +			continue;  /* Not much we can do.. */
 +		}
 +		BKE_workspace_layout_add(bmain, workspace, screen, screen->id.name + 2);
 +	}
 +}
 +
 +static void do_version_area_change_space_to_space_action(ScrArea *area, const Scene *scene)
 +{
 +	SpaceType *stype = BKE_spacetype_from_id(SPACE_ACTION);
 +	SpaceAction *saction = (SpaceAction *)stype->new(area, scene);
 +	ARegion *region_channels;
 +
 +	/* Properly free current regions */
 +	for (ARegion *region = area->regionbase.first; region; region = region->next) {
 +		BKE_area_region_free(area->type, region);
 +	}
 +	BLI_freelistN(&area->regionbase);
 +
 +	area->type = stype;
 +	area->spacetype = stype->spaceid;
 +
 +	BLI_addhead(&area->spacedata, saction);
 +	area->regionbase = saction->regionbase;
 +	BLI_listbase_clear(&saction->regionbase);
 +
 +	/* Different defaults for timeline */
 +	region_channels = BKE_area_find_region_type(area, RGN_TYPE_CHANNELS);
 +	region_channels->flag |= RGN_FLAG_HIDDEN;
 +
 +	saction->mode = SACTCONT_TIMELINE;
 +	saction->ads.flag |= ADS_FLAG_SUMMARY_COLLAPSED;
 +	saction->ads.filterflag |= ADS_FILTER_SUMMARY;
 +}
 +
 +/**
 + * \brief After lib-link versioning for new workspace design.
 + *
 + * - Adds a workspace for (almost) each screen of the old file
 + *   and adds the needed workspace-layout to wrap the screen.
 + * - Active screen isn't stored directly in window anymore, but in the active workspace.
 + * - Active scene isn't stored in screen anymore, but in window.
 + * - Create workspace instance hook for each window.
 + *
 + * \note Some of the created workspaces might be deleted again in case of reading the default startup.blend.
 + */
 +static void do_version_workspaces_after_lib_link(Main *bmain)
 +{
 +	BLI_assert(BLI_listbase_is_empty(&bmain->workspaces));
 +
 +	do_version_workspaces_create_from_screens(bmain);
 +
 +	for (wmWindowManager *wm = bmain->wm.first; wm; wm = wm->id.next) {
 +		for (wmWindow *win = wm->windows.first; win; win = win->next) {
 +			bScreen *screen_parent = screen_parent_find(win->screen);
 +			bScreen *screen = screen_parent ? screen_parent : win->screen;
 +
 +			if (screen->temp) {
 +				/* We do not generate a new workspace for those screens... still need to set some data in win. */
 +				win->workspace_hook = BKE_workspace_instance_hook_create(bmain);
 +				win->scene = screen->scene;
 +				/* Deprecated from now on! */
 +				win->screen = NULL;
 +				continue;
 +			}
 +
 +			WorkSpace *workspace = BLI_findstring(&bmain->workspaces, screen->id.name + 2, offsetof(ID, name) + 2);
 +			BLI_assert(workspace != NULL);
 +			ListBase *layouts = BKE_workspace_layouts_get(workspace);
 +
 +			win->workspace_hook = BKE_workspace_instance_hook_create(bmain);
 +
 +			BKE_workspace_active_set(win->workspace_hook, workspace);
 +			BKE_workspace_active_layout_set(win->workspace_hook, layouts->first);
 +
 +			/* Move scene and view layer to window. */
 +			Scene *scene = screen->scene;
 +			ViewLayer *layer = BLI_findlink(&scene->view_layers, scene->r.actlay);
 +			if (!layer) {
 +				layer = BKE_view_layer_default_view(scene);
 +			}
 +
 +			win->scene = scene;
 +			STRNCPY(win->view_layer_name, layer->name);
 +
 +			/* Deprecated from now on! */
 +			win->screen = NULL;
 +		}
 +	}
 +
 +	for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
 +		/* Deprecated from now on! */
 +		BLI_freelistN(&screen->scene->transform_spaces);
 +		screen->scene = NULL;
 +	}
 +}
 +
 +#ifdef USE_COLLECTION_COMPAT_28
 +enum {
 +	COLLECTION_DEPRECATED_VISIBLE    = (1 << 0),
 +	COLLECTION_DEPRECATED_VIEWPORT   = (1 << 0),
 +	COLLECTION_DEPRECATED_SELECTABLE = (1 << 1),
 +	COLLECTION_DEPRECATED_DISABLED   = (1 << 2),
 +	COLLECTION_DEPRECATED_RENDER     = (1 << 3),
 +};
 +
 +static void do_version_view_layer_visibility(ViewLayer *view_layer)
 +{
 +	/* Convert from deprecated VISIBLE flag to DISABLED */
 +	LayerCollection *lc;
 +	for (lc = view_layer->layer_collections.first;
 +	     lc;
 +	     lc = lc->next)
 +	{
 +		if (lc->flag & COLLECTION_DEPRECATED_DISABLED) {
 +			lc->flag &= ~COLLECTION_DEPRECATED_DISABLED;
 +		}
 +
 +		if ((lc->flag & COLLECTION_DEPRECATED_VISIBLE) == 0) {
 +			lc->flag |= COLLECTION_DEPRECATED_DISABLED;
 +		}
 +
 +		lc->flag |= COLLECTION_DEPRECATED_VIEWPORT | COLLECTION_DEPRECATED_RENDER;
 +	}
 +}
 +
 +static void do_version_layer_collection_pre(
 +        ViewLayer *view_layer,
 +        ListBase *lb,
 +        GSet *enabled_set,
 +        GSet *selectable_set)
 +{
 +	/* Convert from deprecated DISABLED to new layer collection and collection flags */
 +	for (LayerCollection *lc = lb->first; lc; lc = lc->next) {
 +		if (lc->scene_collection) {
 +			if (!(lc->flag & COLLECTION_DEPRECATED_DISABLED)) {
 +				BLI_gset_insert(enabled_set, lc->scene_collection);
 +			}
 +			if (lc->flag & COLLECTION_DEPRECATED_SELECTABLE) {
 +				BLI_gset_insert(selectable_set, lc->scene_collection);
 +			}
 +		}
 +
 +		do_version_layer_collection_pre(view_layer, &lc->layer_collections, enabled_set, selectable_set);
 +	}
 +}
 +
 +static void do_version_layer_collection_post(
 +        ViewLayer *view_layer,
 +        ListBase *lb,
 +        GSet *enabled_set,
 +        GSet *selectable_set,
 +        GHash *collection_map)
 +{
 +	/* Apply layer collection exclude flags. */
 +	for (LayerCollection *lc = lb->first; lc; lc = lc->next) {
 +		if (!(lc->collection->flag & COLLECTION_IS_MASTER)) {
 +			SceneCollection *sc = BLI_ghash_lookup(collection_map, lc->collection);
 +			const bool enabled = (sc && BLI_gset_haskey(enabled_set, sc));
 +			const bool selectable = (sc && BLI_gset_haskey(selectable_set, sc));
 +
 +			if (!enabled) {
 +				lc->flag |= LAYER_COLLECTION_EXCLUDE;
 +			}
 +			if (enabled && !selectable) {
 +				lc->collection->flag |= COLLECTION_RESTRICT_SELECT;
 +			}
 +		}
 +
 +		do_version_layer_collection_post(
 +		        view_layer, &lc->layer_collections, enabled_set, selectable_set, collection_map);
 +	}
 +}
 +
 +static void do_version_scene_collection_convert(
 +        Main *bmain,
 +        ID *id,
 +        SceneCollection *sc,
 +        Collection *collection,
 +        GHash *collection_map)
 +{
 +	if (collection_map) {
 +		BLI_ghash_insert(collection_map, collection, sc);
 +	}
 +
 +	for (SceneCollection *nsc = sc

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list