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

Campbell Barton noreply at git.blender.org
Thu Mar 9 06:40:04 CET 2017


Commit: a68c631cf86ebc878ac5b96ef5fb69db15be9161
Author: Campbell Barton
Date:   Thu Mar 9 16:33:20 2017 +1100
Branches: blender2.8
https://developer.blender.org/rBa68c631cf86ebc878ac5b96ef5fb69db15be9161

Merge branch 'master' into blender2.8

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



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

diff --cc source/blender/editors/space_view3d/view3d_select.c
index 921ac136dad,49f24ef634f..3f6afb2634d
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@@ -1059,13 -1087,14 +1059,15 @@@ static void deselectall_except(SceneLay
  	}
  }
  
- static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int *buffer, int hits, const int mval[2], short toggle)
+ static Base *object_mouse_select_menu(
+         bContext *C, ViewContext *vc, unsigned int *buffer, int hits,
+         const int mval[2], bool toggle)
  {
- 	short baseCount = 0;
+ 	int baseCount = 0;
  	bool ok;
  	LinkNode *linklist = NULL;
 -	
 +
 +	/* handle base->selcol */
  	CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
  	{
  		ok = false;
diff --cc source/blender/editors/space_view3d/view3d_view.c
index 687a9a398d9,20361b73e78..637479f9ee3
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@@ -1167,10 -1173,9 +1167,10 @@@ static void view3d_select_loop(ViewCont
  short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const rcti *input, bool do_nearest)
  {
  	Scene *scene = vc->scene;
 +	SceneLayer *sl = vc->sl;
  	View3D *v3d = vc->v3d;
  	ARegion *ar = vc->ar;
- 	rctf rect;
+ 	rcti rect;
  	short hits;
  	const bool use_obedit_skip = (scene->obedit != NULL) && (vc->obedit == NULL);
  	const bool do_passes = do_nearest && GPU_select_query_check_active();
diff --cc source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c
index 500092f5f2d,00000000000..2dd02450dcf
mode 100644,000000..100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c
@@@ -1,760 -1,0 +1,757 @@@
 +/*
 + * ***** 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.
 + *
 + * The Original Code is Copyright (C) 2014 Blender Foundation.
 + * All rights reserved.
 + *
 + * Contributor(s): Blender Foundation
 + *
 + * ***** END GPL LICENSE BLOCK *****
 + */
 +
 +/** \file blender/windowmanager/manipulators/intern/wm_manipulatormap.c
 + *  \ingroup wm
 + */
 +
 +#include <string.h>
 +
 +#include "BKE_context.h"
 +
 +#include "BLI_listbase.h"
 +#include "BLI_math.h"
 +#include "BLI_string.h"
 +#include "BLI_ghash.h"
 +
 +#include "ED_screen.h"
 +#include "ED_view3d.h"
 +
 +#include "GPU_glew.h"
 +#include "GPU_select.h"
 +
 +#include "MEM_guardedalloc.h"
 +
 +#include "WM_api.h"
 +#include "WM_types.h"
 +#include "wm_event_system.h"
 +
 +/* own includes */
 +#include "wm_manipulator_wmapi.h"
 +#include "wm_manipulator_intern.h"
 +
 +/**
 + * Store all manipulator-maps here. Anyone who wants to register a manipulator for a certain
 + * area type can query the manipulator-map to do so.
 + */
 +static ListBase manipulatormaptypes = {NULL, NULL};
 +
 +/**
 + * Manipulator-map update tagging.
 + */
 +enum eManipulatorMapUpdateFlags {
 +	/* Tag manipulator-map for refresh. */
 +	MANIPULATORMAP_REFRESH = (1 << 0),
 +};
 +
 +
 +/* -------------------------------------------------------------------- */
 +/** \name wmManipulatorMap
 + *
 + * \{ */
 +
 +/**
 + * Creates a manipulator-map with all registered manipulators for that type
 + */
 +wmManipulatorMap *WM_manipulatormap_new_from_type(const struct wmManipulatorMapType_Params *mmap_params)
 +{
 +	wmManipulatorMapType *mmaptype = WM_manipulatormaptype_ensure(mmap_params);
 +	wmManipulatorMap *mmap;
 +
 +	mmap = MEM_callocN(sizeof(wmManipulatorMap), "ManipulatorMap");
 +	mmap->type = mmaptype;
 +	mmap->update_flag = MANIPULATORMAP_REFRESH;
 +
 +	/* create all manipulator-groups for this manipulator-map. We may create an empty one
 +	 * too in anticipation of manipulators from operators etc */
 +	for (wmManipulatorGroupType *mgrouptype = mmaptype->manipulator_grouptypes.first;
 +	     mgrouptype;
 +	     mgrouptype = mgrouptype->next)
 +	{
 +		wmManipulatorGroup *mgroup = wm_manipulatorgroup_new_from_type(mgrouptype);
 +		BLI_addtail(&mmap->manipulator_groups, mgroup);
 +	}
 +
 +	return mmap;
 +}
 +
 +void wm_manipulatormap_selected_delete(wmManipulatorMap *mmap)
 +{
 +	MEM_SAFE_FREE(mmap->mmap_context.selected_manipulator);
 +	mmap->mmap_context.tot_selected = 0;
 +}
 +
 +void wm_manipulatormap_delete(wmManipulatorMap *mmap)
 +{
 +	if (!mmap)
 +		return;
 +
 +	for (wmManipulatorGroup *mgroup = mmap->manipulator_groups.first, *mgroup_next; mgroup; mgroup = mgroup_next) {
 +		mgroup_next = mgroup->next;
 +		wm_manipulatorgroup_free(NULL, mmap, mgroup);
 +	}
 +	BLI_assert(BLI_listbase_is_empty(&mmap->manipulator_groups));
 +
 +	wm_manipulatormap_selected_delete(mmap);
 +
 +	MEM_freeN(mmap);
 +}
 +
 +/**
 + * Creates and returns idname hash table for (visible) manipulators in \a mmap
 + *
 + * \param poll  Polling function for excluding manipulators.
 + * \param data  Custom data passed to \a poll
 + */
 +static GHash *WM_manipulatormap_manipulator_hash_new(
 +        const bContext *C, wmManipulatorMap *mmap,
 +        bool (*poll)(const wmManipulator *, void *),
 +        void *data, const bool include_hidden)
 +{
 +	GHash *hash = BLI_ghash_str_new(__func__);
 +
 +	/* collect manipulators */
 +	for (wmManipulatorGroup *mgroup = mmap->manipulator_groups.first; mgroup; mgroup = mgroup->next) {
 +		if (!mgroup->type->poll || mgroup->type->poll(C, mgroup->type)) {
 +			for (wmManipulator *manipulator = mgroup->manipulators.first;
 +			     manipulator;
 +			     manipulator = manipulator->next)
 +			{
 +				if ((include_hidden || (manipulator->flag & WM_MANIPULATOR_HIDDEN) == 0) &&
 +				    (!poll || poll(manipulator, data)))
 +				{
 +					BLI_ghash_insert(hash, manipulator->idname, manipulator);
 +				}
 +			}
 +		}
 +	}
 +
 +	return hash;
 +}
 +
 +void WM_manipulatormap_tag_refresh(wmManipulatorMap *mmap)
 +{
 +	if (mmap) {
 +		mmap->update_flag |= MANIPULATORMAP_REFRESH;
 +	}
 +}
 +
 +static void manipulatormap_tag_updated(wmManipulatorMap *mmap)
 +{
 +	mmap->update_flag = 0;
 +}
 +
 +static bool manipulator_prepare_drawing(
 +        wmManipulatorMap *mmap, wmManipulator *manipulator,
 +        const bContext *C, ListBase *draw_manipulators)
 +{
 +	if (!wm_manipulator_is_visible(manipulator)) {
 +		/* skip */
 +	}
 +	else {
 +		wm_manipulator_update(manipulator, C, (mmap->update_flag & MANIPULATORMAP_REFRESH) != 0);
 +		BLI_addhead(draw_manipulators, BLI_genericNodeN(manipulator));
 +		return true;
 +	}
 +
 +	return false;
 +}
 +
 +/**
 + * Update manipulators of \a mmap to prepare for drawing. Adds all manipulators that
 + * should be drawn to list \a draw_manipulators, note that added items need freeing.
 + */
 +static void manipulatormap_prepare_drawing(
 +        wmManipulatorMap *mmap, const bContext *C, ListBase *draw_manipulators, const int drawstep)
 +{
 +	if (!mmap || BLI_listbase_is_empty(&mmap->manipulator_groups))
 +		return;
 +	wmManipulator *active_manipulator = mmap->mmap_context.active_manipulator;
 +
 +	/* only active manipulator needs updating */
 +	if (active_manipulator) {
 +		if (manipulator_prepare_drawing(mmap, active_manipulator, C, draw_manipulators)) {
 +			manipulatormap_tag_updated(mmap);
 +		}
 +		/* don't draw any other manipulators */
 +		return;
 +	}
 +
 +	for (wmManipulatorGroup *mgroup = mmap->manipulator_groups.first; mgroup; mgroup = mgroup->next) {
 +		/* check group visibility - drawstep first to avoid unnecessary call of group poll callback */
 +		if (!wm_manipulatorgroup_is_visible_in_drawstep(mgroup, drawstep) ||
 +		    !wm_manipulatorgroup_is_visible(mgroup, C))
 +		{
 +			continue;
 +		}
 +
 +		/* needs to be initialized on first draw */
 +		wm_manipulatorgroup_ensure_initialized(mgroup, C);
 +		/* update data if needed */
 +		/* XXX weak: Manipulator-group may skip refreshing if it's invisible (map gets untagged nevertheless) */
 +		if (mmap->update_flag & MANIPULATORMAP_REFRESH && mgroup->type->refresh) {
 +			mgroup->type->refresh(C, mgroup);
 +		}
 +		/* prepare drawing */
 +		if (mgroup->type->draw_prepare) {
 +			mgroup->type->draw_prepare(C, mgroup);
 +		}
 +
 +		for (wmManipulator *manipulator = mgroup->manipulators.first; manipulator; manipulator = manipulator->next) {
 +			manipulator_prepare_drawing(mmap, manipulator, C, draw_manipulators);
 +		}
 +	}
 +
 +	manipulatormap_tag_updated(mmap);
 +}
 +
 +/**
 + * Draw all visible manipulators in \a mmap.
 + * Uses global draw_manipulators listbase.
 + */
 +static void manipulators_draw_list(const wmManipulatorMap *mmap, const bContext *C, ListBase *draw_manipulators)
 +{
 +	if (!mmap)
 +		return;
 +	BLI_assert(!BLI_listbase_is_empty(&mmap->manipulator_groups));
 +
 +	/* draw_manipulators contains all visible manipulators - draw them */
 +	for (LinkData *link = draw_manipulators->first, *link_next; link; link = link_next) {
 +		wmManipulator *manipulator = link->data;
 +		link_next = link->next;
 +
 +		manipulator->draw(C, manipulator);
 +		/* free/remove manipulator link after drawing */
 +		BLI_freelinkN(draw_manipulators, link);
 +	}
 +}
 +
 +void WM_manipulatormap_draw(wmManipulatorMap *mmap, const bContext *C, const int drawstep)
 +{
 +	ListBase draw_manipulators = {NULL};
 +
 +	manipulatormap_prepare_drawing(mmap, C, &draw_manipulators, drawstep);
 +	manipulators_draw_list(mmap, C, &draw_manipulators);
 +	BLI_assert(BLI_listbase_is_empty(&draw_manipulators));
 +}
 +
 +static void manipulator_find_active_3D_loop(const bContext *C, ListBase *visible_manipulators)
 +{
 +	int

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list