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

Sergey Sharybin noreply at git.blender.org
Thu Feb 15 14:16:25 CET 2018


Commit: df1c88b652e6977491b7f2b019c326518ccdc320
Author: Sergey Sharybin
Date:   Thu Feb 15 14:15:55 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBdf1c88b652e6977491b7f2b019c326518ccdc320

Merge branch 'master' into blender2.8

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



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

diff --cc source/blender/blenkernel/intern/group.c
index ca6d92efa80,6dc8cc5aff1..c615f67fe42
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@@ -369,45 -367,12 +369,45 @@@ void BKE_group_handle_recalc_and_update
  #endif
  	{
  		/* only do existing tags, as set by regular depsgraph */
 -		for (go = group->gobject.first; go; go = go->next) {
 -			if (go->ob) {
 -				if (go->ob->recalc) {
 -					BKE_object_handle_update(eval_ctx, scene, go->ob);
 -				}
 +		FOREACH_GROUP_OBJECT(group, object)
 +		{
 +			if (object->id.recalc & ID_RECALC_ALL) {
 +				BKE_object_handle_update(eval_ctx, scene, object);
  			}
  		}
 +		FOREACH_GROUP_OBJECT_END
 +	}
 +}
 +
 +/* ******** Dependency graph evaluation ******** */
 +
 +static void group_eval_layer_collections(
 +        const struct EvaluationContext *eval_ctx,
 +        Group *group,
 +        ListBase *layer_collections,
 +        LayerCollection *parent_layer_collection)
 +{
- 	BLI_LISTBASE_FOREACH (LayerCollection *, layer_collection, layer_collections) {
++	LISTBASE_FOREACH (LayerCollection *, layer_collection, layer_collections) {
 +		/* Evaluate layer collection itself. */
 +		BKE_layer_eval_layer_collection(eval_ctx,
 +		                                layer_collection,
 +		                                parent_layer_collection);
 +		/* Evaluate nested collections. */
 +		group_eval_layer_collections(eval_ctx,
 +		                             group,
 +		                             &layer_collection->layer_collections,
 +		                             layer_collection);
  	}
  }
 +
 +void BKE_group_eval_view_layers(const struct EvaluationContext *eval_ctx,
 +                                Group *group)
 +{
 +	DEBUG_PRINT("%s on %s (%p)\n", __func__, group->id.name, group);
 +	BKE_layer_eval_layer_collection_pre(eval_ctx, &group->id, group->view_layer);
 +	group_eval_layer_collections(eval_ctx,
 +	                             group,
 +	                             &group->view_layer->layer_collections,
 +	                             NULL);
 +	BKE_layer_eval_layer_collection_post(eval_ctx, group->view_layer);
 +}
diff --cc source/blender/blenkernel/intern/workspace.c
index bc5731b9574,00000000000..9251c6630a5
mode 100644,000000..100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@@ -1,537 -1,0 +1,537 @@@
 +/*
 + * ***** 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/blenkernel/intern/workspace.c
 + *  \ingroup bke
 + */
 +
 +/* allow accessing private members of DNA_workspace_types.h */
 +#define DNA_PRIVATE_WORKSPACE_ALLOW
 +
 +#include <stdlib.h>
 +
 +#include "BLI_utildefines.h"
 +#include "BLI_string.h"
 +#include "BLI_string_utf8.h"
 +#include "BLI_string_utils.h"
 +#include "BLI_listbase.h"
 +
 +#include "BKE_global.h"
 +#include "BKE_library.h"
 +#include "BKE_main.h"
 +#include "BKE_scene.h"
 +#include "BKE_screen.h"
 +#include "BKE_object.h"
 +#include "BKE_workspace.h"
 +
 +#include "DNA_object_types.h"
 +#include "DNA_scene_types.h"
 +#include "DNA_screen_types.h"
 +#include "DNA_workspace_types.h"
 +
 +#include "DEG_depsgraph.h"
 +
 +#include "MEM_guardedalloc.h"
 +
 +
 +/* -------------------------------------------------------------------- */
 +/* Internal utils */
 +
 +static void workspace_layout_name_set(
 +        WorkSpace *workspace, WorkSpaceLayout *layout, const char *new_name)
 +{
 +	BLI_strncpy(layout->name, new_name, sizeof(layout->name));
 +	BLI_uniquename(&workspace->layouts, layout, "Layout", '.', offsetof(WorkSpaceLayout, name), sizeof(layout->name));
 +}
 +
 +/**
 + * This should only be used directly when it is to be expected that there isn't
 + * a layout within \a workspace that wraps \a screen. Usually - especially outside
 + * of BKE_workspace - #BKE_workspace_layout_find should be used!
 + */
 +static WorkSpaceLayout *workspace_layout_find_exec(
 +        const WorkSpace *workspace, const bScreen *screen)
 +{
 +	return BLI_findptr(&workspace->layouts, screen, offsetof(WorkSpaceLayout, screen));
 +}
 +
 +static void workspace_relation_add(
 +        ListBase *relation_list, void *parent, void *data)
 +{
 +	WorkSpaceDataRelation *relation = MEM_callocN(sizeof(*relation), __func__);
 +	relation->parent = parent;
 +	relation->value = data;
 +	/* add to head, if we switch back to it soon we find it faster. */
 +	BLI_addhead(relation_list, relation);
 +}
 +static void workspace_relation_remove(
 +        ListBase *relation_list, WorkSpaceDataRelation *relation)
 +{
 +	BLI_remlink(relation_list, relation);
 +	MEM_freeN(relation);
 +}
 +
 +static void workspace_relation_ensure_updated(
 +        ListBase *relation_list, void *parent, void *data)
 +{
 +	WorkSpaceDataRelation *relation = BLI_findptr(relation_list, parent, offsetof(WorkSpaceDataRelation, parent));
 +	if (relation != NULL) {
 +		relation->value = data;
 +		/* reinsert at the head of the list, so that more commonly used relations are found faster. */
 +		BLI_remlink(relation_list, relation);
 +		BLI_addhead(relation_list, relation);
 +	}
 +	else {
 +		/* no matching relation found, add new one */
 +		workspace_relation_add(relation_list, parent, data);
 +	}
 +}
 +
 +static void *workspace_relation_get_data_matching_parent(
 +        const ListBase *relation_list, const void *parent)
 +{
 +	WorkSpaceDataRelation *relation = BLI_findptr(relation_list, parent, offsetof(WorkSpaceDataRelation, parent));
 +	if (relation != NULL) {
 +		return relation->value;
 +	}
 +	else {
 +		return NULL;
 +	}
 +}
 +
 +static void workspace_relation_remove_from_value(
 +        ListBase *relation_list, const void *value)
 +{
 +	for (WorkSpaceDataRelation *relation = relation_list->first, *relation_next; relation; relation = relation_next) {
 +		relation_next = relation->next;
 +
 +		if (relation->value == value) {
 +			workspace_relation_remove(relation_list, relation);
 +		}
 +	}
 +}
 +
 +/**
 + * Checks if \a screen is already used within any workspace. A screen should never be assigned to multiple
 + * WorkSpaceLayouts, but that should be ensured outside of the BKE_workspace module and without such checks.
 + * Hence, this should only be used as assert check before assigining a screen to a workspace.
 + */
 +#ifndef NDEBUG
 +static bool workspaces_is_screen_used
 +#else
 +static bool UNUSED_FUNCTION(workspaces_is_screen_used)
 +#endif
 +        (const Main *bmain, bScreen *screen)
 +{
 +	for (WorkSpace *workspace = bmain->workspaces.first; workspace; workspace = workspace->id.next) {
 +		if (workspace_layout_find_exec(workspace, screen)) {
 +			return true;
 +		}
 +	}
 +
 +	return false;
 +}
 +
 +/* -------------------------------------------------------------------- */
 +/* Create, delete, init */
 +
 +WorkSpace *BKE_workspace_add(Main *bmain, const char *name)
 +{
 +	WorkSpace *new_workspace = BKE_libblock_alloc(bmain, ID_WS, name, 0);
 +	return new_workspace;
 +}
 +
 +/**
 + * The function that actually frees the workspace data (not workspace itself). It shouldn't be called
 + * directly, instead #BKE_workspace_remove should be, which calls this through #BKE_libblock_free then.
 + *
 + * Should something like a bke_internal.h be added, this should go there!
 + */
 +void BKE_workspace_free(WorkSpace *workspace)
 +{
 +	BKE_workspace_relations_free(&workspace->hook_layout_relations);
 +	BKE_workspace_relations_free(&workspace->scene_viewlayer_relations);
 +
 +	BLI_freelistN(&workspace->layouts);
 +	BLI_freelistN(&workspace->transform_orientations);
 +
 +	BKE_viewrender_free(&workspace->view_render);
 +}
 +
 +/**
 + * Remove \a workspace by freeing itself and its data. This is a higher-level wrapper that
 + * calls #BKE_workspace_free (through #BKE_libblock_free) to free the workspace data, and frees
 + * other data-blocks owned by \a workspace and its layouts (currently that is screens only).
 + *
 + * Always use this to remove (and free) workspaces. Don't free non-ID workspace members here.
 + */
 +void BKE_workspace_remove(Main *bmain, WorkSpace *workspace)
 +{
 +	for (WorkSpaceLayout *layout = workspace->layouts.first, *layout_next; layout; layout = layout_next) {
 +		layout_next = layout->next;
 +		BKE_workspace_layout_remove(bmain, workspace, layout);
 +	}
 +	BKE_libblock_free(bmain, workspace);
 +}
 +
 +WorkSpaceInstanceHook *BKE_workspace_instance_hook_create(const Main *bmain)
 +{
 +	WorkSpaceInstanceHook *hook = MEM_callocN(sizeof(WorkSpaceInstanceHook), __func__);
 +
 +	/* set an active screen-layout for each possible window/workspace combination */
 +	for (WorkSpace *workspace = bmain->workspaces.first; workspace; workspace = workspace->id.next) {
 +		BKE_workspace_hook_layout_for_workspace_set(hook, workspace, workspace->layouts.first);
 +	}
 +
 +	return hook;
 +}
 +void BKE_workspace_instance_hook_free(const Main *bmain, WorkSpaceInstanceHook *hook)
 +{
 +	/* workspaces should never be freed before wm (during which we call this function) */
 +	BLI_assert(!BLI_listbase_is_empty(&bmain->workspaces));
 +
 +	/* Free relations for this hook */
 +	for (WorkSpace *workspace = bmain->workspaces.first; workspace; workspace = workspace->id.next) {
 +		for (WorkSpaceDataRelation *relation = workspace->hook_layout_relations.first, *relation_next;
 +		     relation;
 +		     relation = relation_next)
 +		{
 +			relation_next = relation->next;
 +			if (relation->parent == hook) {
 +				workspace_relation_remove(&workspace->hook_lay

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list