[Bf-blender-cvs] [c7612fca5fd] custom-manipulators: Merge branch '28' into custom-manipulators

Campbell Barton noreply at git.blender.org
Thu Jun 8 00:03:53 CEST 2017


Commit: c7612fca5fd6858f26855f4898f3e098279e9497
Author: Campbell Barton
Date:   Thu Jun 8 08:05:30 2017 +1000
Branches: custom-manipulators
https://developer.blender.org/rBc7612fca5fd6858f26855f4898f3e098279e9497

Merge branch '28' into custom-manipulators

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



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

diff --cc source/blender/editors/manipulator_library/CMakeLists.txt
index 00000000000,bcb814e963f..633a44df997
mode 000000,100644..100644
--- a/source/blender/editors/manipulator_library/CMakeLists.txt
+++ b/source/blender/editors/manipulator_library/CMakeLists.txt
@@@ -1,0 -1,56 +1,57 @@@
+ # ***** 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 *****
+ 
+ set(INC
+ 	../include
+ 	../../blenkernel
+ 	../../blenlib
+ 	../../blentranslation
+ 	../../bmesh
+ 	../../depsgraph
+ 	../../gpu
+ 	../../makesdna
+ 	../../makesrna
+ 	../../windowmanager
+ 	../../../../intern/guardedalloc
+ 	../../../../intern/eigen
+ 	../../../../intern/glew-mx
+ )
+ 
+ set(INC_SYS
+ 	${GLEW_INCLUDE_PATH}
+ )
+ 
+ set(SRC
+ 	arrow2d_manipulator.c
+ 	arrow3d_manipulator.c
+ 	cage2d_manipulator.c
+ 	dial3d_manipulator.c
++	facemap3d_manipulator.c
+ 	geom_arrow_manipulator.c
+ 	geom_cube_manipulator.c
+ 	manipulator_draw_utils.c
+ 	manipulator_library_utils.c
+ 	primitive3d_manipulator.c
+ 
+ 	manipulator_geometry.h
+ 	manipulator_library_intern.h
+ )
+ 
+ add_definitions(${GL_DEFINITIONS})
+ 
+ blender_add_lib(bf_editor_manipulator_library "${SRC}" "${INC}" "${INC_SYS}")
diff --cc source/blender/editors/manipulator_library/facemap3d_manipulator.c
index 2fa9d54831b,00000000000..7912aeedf17
mode 100644,000000..100644
--- a/source/blender/editors/manipulator_library/facemap3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/facemap3d_manipulator.c
@@@ -1,156 -1,0 +1,146 @@@
 +/*
 + * ***** 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/widgets/intern/widget_library/facemap_manipulator.c
 + *  \ingroup wm
 + *
 + * \name Facemap Manipulator
 + *
 + * 3D Manipulator
 + *
 + * \brief Manipulator representing shape of a face map.
 + * Currently no own handling, use with operator only.
 + */
 +
 +#include <stdlib.h>
 +
 +#include "BIF_gl.h"
 +
 +#include "BKE_context.h"
 +
 +#include "BLI_listbase.h"
 +
 +#include "DNA_manipulator_types.h"
 +#include "DNA_object_types.h"
 +
 +#include "ED_screen.h"
 +#include "ED_view3d.h"
++#include "ED_manipulator_library.h"
 +
 +#include "GPU_select.h"
 +#include "GPU_matrix.h"
 +
 +#include "MEM_guardedalloc.h"
 +
 +/* own includes */
- #include "WM_manipulator_api.h"
- #include "WM_manipulator_types.h"
- #include "WM_manipulator_library.h"
- #include "wm_manipulator_wmapi.h"
- #include "wm_manipulator_intern.h"
++#include "WM_api.h"
++#include "WM_types.h"
 +
 +
 +typedef struct FacemapManipulator {
 +	struct wmManipulator widget;
 +	Object *ob;
 +	int facemap;
 +	int style;
 +} FacemapManipulator;
 +
 +
 +/* -------------------------------------------------------------------- */
 +
 +static void widget_facemap_draw(const bContext *C, struct wmManipulator *widget)
 +{
 +	FacemapManipulator *fmap_widget = (FacemapManipulator *)widget;
- 	const float *col = (widget->state & WM_MANIPULATOR_SELECTED) ? widget->col_hi : widget->col;
++	const float *col = (widget->state & WM_MANIPULATOR_STATE_SELECT) ? widget->col_hi : widget->col;
 +
 +	gpuPushMatrix();
 +	gpuMultMatrix(fmap_widget->ob->obmat);
 +	gpuTranslate3fv(widget->offset);
 +	ED_draw_object_facemap(CTX_data_scene(C), fmap_widget->ob, col, fmap_widget->facemap);
 +	gpuPopMatrix();
 +}
 +
 +static void widget_facemap_render_3d_intersect(const bContext *C, struct wmManipulator *widget, int selectionbase)
 +{
 +	GPU_select_load_id(selectionbase);
 +	widget_facemap_draw(C, widget);
 +}
 +
 +#if 0
 +static int widget_facemap_invoke(bContext *UNUSED(C), const wmEvent *event, struct wmManipulator *widget)
 +{
 +	return OPERATOR_PASS_THROUGH;
 +}
 +
 +static int widget_facemap_handler(bContext *C, const wmEvent *event, struct wmManipulator *widget)
 +{
 +	return OPERATOR_PASS_THROUGH;
 +}
 +#endif
 +
 +/* -------------------------------------------------------------------- */
 +/** \name Facemap Widget API
 + *
 + * \{ */
 +
- struct wmManipulator *MANIPULATOR_facemap_new(
++struct wmManipulator *ED_manipulator_facemap_new(
 +        wmManipulatorGroup *wgroup, const char *name, const int style,
 +        Object *ob, const int facemap)
 +{
- 	const wmManipulatorType *mpt = WM_manipulatortype_find("MANIPULATOR_WT_facemap", false);
++	const wmManipulatorType *mpt = WM_manipulatortype_find("MANIPULATOR_WT_facemap3d", false);
 +	FacemapManipulator *fmap_widget = (FacemapManipulator *)WM_manipulator_new(mpt, wgroup, name);
 +
 +	BLI_assert(facemap > -1);
 +
 +	fmap_widget->ob = ob;
 +	fmap_widget->facemap = facemap;
 +	fmap_widget->style = style;
 +
 +	return (struct wmManipulator *)fmap_widget;
 +}
 +
- bFaceMap *MANIPULATOR_facemap_get_fmap(struct wmManipulator *widget)
++bFaceMap *ED_manipulator_facemap_get_fmap(struct wmManipulator *widget)
 +{
 +	FacemapManipulator *fmap_widget = (FacemapManipulator *)widget;
 +	return BLI_findlink(&fmap_widget->ob->fmaps, fmap_widget->facemap);
 +}
 +
- static void MANIPULATOR_WT_facemap(wmManipulatorType *wt)
++static void MANIPULATOR_WT_facemap3d(wmManipulatorType *wt)
 +{
 +	/* identifiers */
- 	wt->idname = "MANIPULATOR_WT_facemap";
++	wt->idname = "MANIPULATOR_WT_facemap3d";
 +
 +	/* api callbacks */
 +	wt->draw = widget_facemap_draw;
 +	wt->draw_select = widget_facemap_render_3d_intersect;
 +
 +	wt->size = sizeof(FacemapManipulator);
 +}
 +
- void ED_manipulatortypes_facemap(void)
++void ED_manipulatortypes_facemap_3d(void)
 +{
- 	WM_manipulatortype_append(MANIPULATOR_WT_facemap);
++	WM_manipulatortype_append(MANIPULATOR_WT_facemap3d);
 +}
 +
 +/** \} */ // Facemap Widget API
- 
- 
- /* -------------------------------------------------------------------- */
- 
- void fix_linking_manipulator_facemap(void)
- {
- 	(void)0;
- }
diff --cc source/blender/editors/space_api/spacetypes.c
index dd8e2cd2ee9,16ccf1da916..7f1c665f8ff
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@@ -126,21 -127,11 +127,12 @@@ void ED_spacetypes_init(void
  	ED_operatortypes_ui();
  
  	/* manipulator types */
- 
- 	/* FIXME */
- 	extern void ED_manipulatortypes_dial(void);
- 	extern void ED_manipulatortypes_arrow_2d(void);
- 	extern void ED_manipulatortypes_arrow_3d(void);
- 	extern void ED_manipulatortypes_facemap(void);
- 	extern void ED_manipulatortypes_primitive(void);
- 	extern void ED_manipulatortypes_cage(void);
- 
- 	ED_manipulatortypes_dial();
+ 	ED_manipulatortypes_dial_3d();
  	ED_manipulatortypes_arrow_2d();
  	ED_manipulatortypes_arrow_3d();
- 	ED_manipulatortypes_facemap();
- 	ED_manipulatortypes_primitive();
- 	ED_manipulatortypes_cage();
++	ED_manipulatortypes_facemap_3d();
+ 	ED_manipulatortypes_primitive_3d();
+ 	ED_manipulatortypes_cage_2d();
  
  	/* register types for operators and manipulators */
  	spacetypes = BKE_spacetypes_list();
diff --cc source/blender/editors/space_view3d/view3d_manipulators.c
index 68edfc24d1d,87513a6294b..a88078a8a67
--- a/source/blender/editors/space_view3d/view3d_manipulators.c
+++ b/source/blender/editors/space_view3d/view3d_manipulators.c
@@@ -356,207 -356,3 +357,207 @@@ void VIEW3D_WGT_force_field(wmManipulat
  }
  
  /** \} */
 +
 +/* -------------------------------------------------------------------- */
 +
 +/** \name Face Maps
 + * \{ */
 +
 +
 +#define MAX_ARMATURE_FACEMAP_NAME (2 * MAX_NAME + 1) /* "OBJECTNAME_FACEMAPNAME" */
 +
 +
 +static bool WIDGETGROUP_armature_facemaps_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgrouptype))
 +{
 +	Object *ob = CTX_data_active_object(C);
 +
 +	if (ob && BKE_object_pose_context_check(ob)) {
 +		for (bPoseChannel *pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
 +			if (pchan->fmap_data) {
 +				return true;
 +			}
 +		}
 +	}
 +	return false;
 +}
 +
 +#if 0
 +static void WIDGET_armature_facemaps_select(bContext *C, wmManipulator *widget, const int action)
 +{
 +	Object *ob = CTX_data_active_object(C);
 +
 +	switch (action) {
 +		case SEL_SELECT:
 +			for (bPoseChannel *pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
 +				if (pchan->fmap_data && pchan->fmap_data->fmap == MANIPULATOR_facemap_get_fmap(widget)) {
 +					/* deselect all first */
 +					ED_pose_de_selectall(ob, SEL_DESELECT, false);
 +					ED_pose_bone_select(ob, pchan, true);
 +				}
 +			}
 +			break;
 +		default:
 +			BLI_assert(0);
 +	}
 +}
 +#endif
 +
 +/**
 + * Get a string that equals a string generated using #armature_facemap_hashname_create,
 + * but without allocating it. Only use for comparing with string stored as hash key.
 + */
 +BLI_INLINE void armature_facemap_hashkey_get(
 +        Object *fmap_ob, bFaceMap *fmap, size_t

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list