[Bf-blender-cvs] [ae55eeb] temp_manipulators_core: Initially add widget files and get them compiling

Julian Eisel noreply at git.blender.org
Fri Sep 9 14:53:29 CEST 2016


Commit: ae55eeb2ce4e2a8aa8be5122a2a3be2df453ecd2
Author: Julian Eisel
Date:   Thu Sep 8 21:32:44 2016 +0200
Branches: temp_manipulators_core
https://developer.blender.org/rBae55eeb2ce4e2a8aa8be5122a2a3be2df453ecd2

Initially add widget files and get them compiling

Another temp_ branch :S This time for preparing custom manipulators core code for merge.

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

M	source/blender/CMakeLists.txt
M	source/blender/blenlib/BLI_math_vector.h
M	source/blender/blenlib/intern/math_vector.c
M	source/blender/editors/interface/resources.c
M	source/blender/makesdna/DNA_screen_types.h
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesdna/DNA_view3d_types.h
A	source/blender/makesdna/DNA_widget_types.h
M	source/blender/makesdna/intern/makesdna.c
M	source/blender/windowmanager/CMakeLists.txt
M	source/blender/windowmanager/WM_api.h
M	source/blender/windowmanager/WM_types.h
A	source/blender/windowmanager/widgets/WM_widget_api.h
A	source/blender/windowmanager/widgets/WM_widget_library.h
A	source/blender/windowmanager/widgets/WM_widget_types.h
A	source/blender/windowmanager/widgets/intern/widget_library/arrow2d_widget.c
A	source/blender/windowmanager/widgets/intern/widget_library/arrow_widget.c
A	source/blender/windowmanager/widgets/intern/widget_library/cage_widget.c
A	source/blender/windowmanager/widgets/intern/widget_library/dial_widget.c
A	source/blender/windowmanager/widgets/intern/widget_library/geom_arrow_widget.c
A	source/blender/windowmanager/widgets/intern/widget_library/geom_cube_widget.c
A	source/blender/windowmanager/widgets/intern/widget_library/geom_dial_widget.c
A	source/blender/windowmanager/widgets/intern/widget_library/primitive_widget.c
A	source/blender/windowmanager/widgets/intern/widget_library/widget_geometry.h
A	source/blender/windowmanager/widgets/intern/widget_library/widget_library_intern.h
A	source/blender/windowmanager/widgets/intern/widget_library/widget_library_utils.c
A	source/blender/windowmanager/widgets/intern/wm_widget.c
A	source/blender/windowmanager/widgets/intern/wm_widget_intern.h
A	source/blender/windowmanager/widgets/intern/wm_widgetgroup.c
A	source/blender/windowmanager/widgets/intern/wm_widgetmap.c
A	source/blender/windowmanager/widgets/wm_widget_wmapi.h
M	source/blender/windowmanager/wm_event_system.h
M	source/blender/windowmanager/wm_event_types.h

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

diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index 6f2b78e..92d0fbe 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -87,6 +87,7 @@ set(SRC_DNA_INC
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_vfont_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_view2d_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_view3d_types.h
+	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_widget_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_windowmanager_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_world_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_movieclip_types.h
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index d15fe1a..f5beda0 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -304,6 +304,7 @@ void ortho_basis_v3v3_v3(float r_n1[3], float r_n2[3], const float n[3]);
 void ortho_v3_v3(float out[3], const float v[3]);
 void ortho_v2_v2(float out[2], const float v[2]);
 void bisect_v3_v3v3v3(float r[3], const float a[3], const float b[3], const float c[3]);
+void rotate_v2_v2fl(float r[2], const float p[2], const float angle);
 void rotate_v3_v3v3fl(float v[3], const float p[3], const float axis[3], const float angle);
 void rotate_normalized_v3_v3v3fl(float out[3], const float p[3], const float axis[3], const float angle);
 
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index 95d5c9f..90e39da 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -772,6 +772,20 @@ void ortho_v2_v2(float out[2], const float v[2])
 }
 
 /**
+ * Rotate a point \a p by \a angle around origin (0, 0)
+ */
+void rotate_v2_v2fl(float r[2], const float p[2], const float angle)
+{
+	const float co = cosf(angle);
+	const float si = sinf(angle);
+
+	BLI_assert(r != p);
+
+	r[0] = co * p[0] - si * p[1];
+	r[1] = si * p[0] + co * p[1];
+}
+
+/**
  * Rotate a point \a p by \a angle around an arbitrary unit length \a axis.
  * http://local.wasp.uwa.edu.au/~pbourke/geometry/
  */
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index c8ff335..2676581 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1656,6 +1656,8 @@ void init_userdef_do_versions(void)
 		U.tw_size = 25;          /* percentage of window size */
 		U.tw_handlesize = 16;    /* percentage of widget radius */
 	}
+	if (U.widget_scale == 0)
+		U.widget_scale = 75;
 	if (U.pad_rot_angle == 0.0f)
 		U.pad_rot_angle = 15.0f;
 	
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index e208ef3..f2442ee 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -264,6 +264,7 @@ typedef struct ARegion {
 	ListBase ui_lists;			/* uiList */
 	ListBase ui_previews;		/* uiPreview */
 	ListBase handlers;			/* wmEventHandler */
+	ListBase widgetmaps;		/* widgetmaps */
 	ListBase panels_category;	/* Panel categories runtime */
 	
 	struct wmTimer *regiontimer; /* blend in/out */
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 41188c2..0541a8a 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -46,6 +46,7 @@
 #include "DNA_node_types.h"         /* for bNodeInstanceKey */
 /* Hum ... Not really nice... but needed for spacebuts. */
 #include "DNA_view2d_types.h"
+#include "DNA_widget_types.h"
 
 struct ID;
 struct Text;
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 02a0b41..5b807fa 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -490,6 +490,8 @@ typedef struct UserDef {
 	short tb_leftmouse, tb_rightmouse;
 	struct SolidLight light[3];
 	short tw_hotspot, tw_flag, tw_handlesize, tw_size;
+	short widget_flag, widget_scale;
+	int pad3;
 	short textimeout, texcollectrate;
 	short wmdrawmethod; /* removed wmpad */
 	short dragthreshold;
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 4c24350..a4a3395 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -368,6 +368,8 @@ enum {
 #define V3D_USE_MANIPULATOR		1
 #define V3D_DRAW_MANIPULATOR	2
 /* #define V3D_CALC_MANIPULATOR	4 */ /*UNUSED*/
+#define V3D_3D_WIDGETS          (1 << 2)
+#define V3D_SHADED_WIDGETS      (1 << 3)
 
 /* BGPic->flag */
 /* may want to use 1 for select ? */
diff --git a/source/blender/makesdna/DNA_widget_types.h b/source/blender/makesdna/DNA_widget_types.h
new file mode 100644
index 0000000..9d77eab
--- /dev/null
+++ b/source/blender/makesdna/DNA_widget_types.h
@@ -0,0 +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.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file DNA_widget_types.h
+ *  \ingroup DNA
+ */
+
+#ifndef __DNA_WIDGET_TYPES_H__
+#define __DNA_WIDGET_TYPES_H__
+
+typedef enum WidgetType {
+	WT_TRANSLATE = 0,
+	WT_ROTATE    = 1,
+	WT_SCALE     = 2,
+	WT_CUSTOM    = 3,
+} WidgetType;
+
+typedef struct wmWidgetGroup {
+	struct wmWidgetGroup *next, *prev;
+
+	struct wmWidgetGroupType *type;
+	ListBase widgets;
+
+	void *py_instance;            /* python stores the class instance here */
+	struct ReportList *reports;   /* errors and warnings storage */
+
+	void *customdata;
+	void (*customdata_free)(void *); /* for freeing customdata from above */
+	int flag;
+	int pad;
+} wmWidgetGroup;
+
+#endif /* __DNA_WIDGET_TYPES_H__ */
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 2cea871..21c9ddb 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -118,6 +118,7 @@ static const char *includefiles[] = {
 	"DNA_cloth_types.h",
 	"DNA_gpencil_types.h",
 	"DNA_windowmanager_types.h",
+	"DNA_widget_types.h",
 	"DNA_anim_types.h",
 	"DNA_boid_types.h",
 	"DNA_smoke_types.h",
@@ -1330,6 +1331,7 @@ int main(int argc, char **argv)
 #include "DNA_cloth_types.h"
 #include "DNA_gpencil_types.h"
 #include "DNA_windowmanager_types.h"
+#include "DNA_widget_types.h"
 #include "DNA_anim_types.h"
 #include "DNA_boid_types.h"
 #include "DNA_smoke_types.h"
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index b6245a8..4c343e4 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -25,6 +25,8 @@
 
 set(INC
 	.
+	widgets
+	widgets/intern
 	../blenfont
 	../blenkernel
 	../blenlib
@@ -68,6 +70,18 @@ set(SRC
 	intern/wm_subwindow.c
 	intern/wm_window.c
 	intern/wm_stereo.c
+	widgets/intern/wm_widget.c
+	widgets/intern/wm_widgetgroup.c
+	widgets/intern/wm_widgetmap.c
+	widgets/intern/widget_library/arrow_widget.c
+	widgets/intern/widget_library/arrow2d_widget.c
+	widgets/intern/widget_library/cage_widget.c
+	widgets/intern/widget_library/dial_widget.c
+	widgets/intern/widget_library/primitive_widget.c
+	widgets/intern/widget_library/geom_arrow_widget.c
+	widgets/intern/widget_library/geom_cube_widget
+	widgets/intern/widget_library/geom_dial_widget.c
+	widgets/intern/widget_library/widget_library_utils.c
 
 	WM_api.h
 	WM_keymap.h
@@ -80,6 +94,13 @@ set(SRC
 	wm_files.h
 	wm_subwindow.h
 	wm_window.h
+	widgets/WM_widget_api.h
+	widgets/WM_widget_types.h
+	widgets/WM_widget_library.h
+	widgets/wm_widget_wmapi.h
+	widgets/intern/wm_widget_intern.h
+	widgets/intern/widget_library/widget_geometry.h
+	widgets/intern/widget_library/widget_library_intern.h
 )
 
 if(WITH_AUDASPACE)
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 2b82f1b..6522d56 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -42,6 +42,10 @@
 #include "WM_keymap.h"
 #include "BLI_compiler_attrs.h"
 
+/* Include external widget API's */
+#include "widgets/WM_widget_api.h"
+#include "widgets/WM_widget_library.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -70,6 +74,8 @@ struct wmNDOFMotionData;
 #endif
 
 typedef struct wmJob wmJob;
+typedef struct wmWidget wmWidget;
+typedef struct wmWidgetMapType wmWidgetMapType;
 
 /* general API */
 void		WM_init_state_size_set		(int stax, int stay, int sizx, int sizy);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 0fe3e8a..f9ba73d 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -119,6 +119,7 @@ struct ImBuf;
 /* exported types for WM */
 #include "wm_cursors.h"
 #include "wm_event_types.h"
+#include "widgets/WM_widget_types.h"
 
 /* ************** wmOperatorType ************************ */
 
@@ -566,6 +567,9 @@ typedef struct wmOperatorType {
 	/* pointer to modal keymap, do not free! */
 	struct wmKeyMap *modalkeymap;
 
+	/* widget group that is accessible while operator runs */
+	wmWidgetGroupType *wgrouptype;
+
 	/* python needs the operator type as well */
 	int (*pyop_poll)(struct bContext *, struct wmOperatorType *ot) ATTR_WARN_UNUS

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list