[Bf-blender-cvs] [11d90f0f3b6] blender2.8: Manipulator Update/Refactor

Campbell Barton noreply at git.blender.org
Sat Jun 10 02:48:37 CEST 2017


Commit: 11d90f0f3b65abb6689ca66731ab54f2f38e905f
Author: Campbell Barton
Date:   Sat Jun 10 10:42:35 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB11d90f0f3b65abb6689ca66731ab54f2f38e905f

Manipulator Update/Refactor

Sync with custom-manipulators branch

- Use identifiers for properties.
- Property array index access.
- Remove operator from manipulators
  (wasn't used and will likely add in a different way).

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

M	source/blender/editors/include/ED_manipulator_library.h
M	source/blender/editors/include/ED_view3d.h
M	source/blender/editors/manipulator_library/CMakeLists.txt
M	source/blender/editors/manipulator_library/arrow2d_manipulator.c
M	source/blender/editors/manipulator_library/arrow3d_manipulator.c
M	source/blender/editors/manipulator_library/cage2d_manipulator.c
M	source/blender/editors/manipulator_library/dial3d_manipulator.c
M	source/blender/editors/manipulator_library/manipulator_geometry.h
M	source/blender/editors/manipulator_library/manipulator_library_intern.h
M	source/blender/editors/manipulator_library/manipulator_library_utils.c
M	source/blender/editors/manipulator_library/primitive3d_manipulator.c
M	source/blender/editors/space_node/node_widgets.c
M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/editors/space_view3d/view3d_manipulators.c
M	source/blender/editors/transform/transform_manipulator.c
M	source/blender/windowmanager/CMakeLists.txt
M	source/blender/windowmanager/WM_types.h
M	source/blender/windowmanager/intern/wm_event_system.c
M	source/blender/windowmanager/intern/wm_init_exit.c
M	source/blender/windowmanager/intern/wm_operators.c
M	source/blender/windowmanager/manipulators/WM_manipulator_api.h
M	source/blender/windowmanager/manipulators/WM_manipulator_types.h
M	source/blender/windowmanager/manipulators/intern/wm_manipulator.c
M	source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
M	source/blender/windowmanager/manipulators/intern/wm_manipulatorgroup.c
M	source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c
M	source/blender/windowmanager/manipulators/wm_manipulator_fn.h
M	source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h
M	source/blenderplayer/bad_level_call_stubs/stubs.c

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

diff --git a/source/blender/editors/include/ED_manipulator_library.h b/source/blender/editors/include/ED_manipulator_library.h
index a9c04c8e004..1c3cbcf3294 100644
--- a/source/blender/editors/include/ED_manipulator_library.h
+++ b/source/blender/editors/include/ED_manipulator_library.h
@@ -38,8 +38,27 @@ void ED_manipulatortypes_dial_3d(void);
 void ED_manipulatortypes_facemap_3d(void);
 void ED_manipulatortypes_primitive_3d(void);
 
+struct wmManipulator;
 struct wmManipulatorGroup;
 
+
+/* -------------------------------------------------------------------- */
+/* Shape Presets
+ *
+ * Intended to be called by custom draw functions.
+ */
+
+/* manipulator_library_presets.c */
+void ED_manipulator_draw_preset_box(
+        const struct wmManipulator *mpr, float mat[4][4], int select_id);
+void ED_manipulator_draw_preset_arrow(
+        const struct wmManipulator *mpr, float mat[4][4], int axis, int select_id);
+void ED_manipulator_draw_preset_circle(
+        const struct wmManipulator *mpr, float mat[4][4], int axis, int select_id);
+void ED_manipulator_draw_preset_facemap(
+        const struct wmManipulator *mpr, struct Scene *scene, struct Object *ob,  const int facemap, int select_id);
+
+
 /* -------------------------------------------------------------------- */
 /* 3D Arrow Manipulator */
 
@@ -56,27 +75,22 @@ enum {
 	ED_MANIPULATOR_ARROW_STYLE_CONE          = (1 << 6),
 };
 
-/* slots for properties */
-enum {
-	ED_MANIPULATOR_ARROW_SLOT_OFS_WORLD_SPACE = 0
-};
-
 struct wmManipulator *ED_manipulator_arrow3d_new(
         struct wmManipulatorGroup *mgroup, const char *name, const int style);
-void ED_manipulator_arrow3d_set_direction(struct wmManipulator *manipulator, const float direction[3]);
-void ED_manipulator_arrow3d_set_up_vector(struct wmManipulator *manipulator, const float direction[3]);
-void ED_manipulator_arrow3d_set_line_len(struct wmManipulator *manipulator, const float len);
-void ED_manipulator_arrow3d_set_ui_range(struct wmManipulator *manipulator, const float min, const float max);
-void ED_manipulator_arrow3d_set_range_fac(struct wmManipulator *manipulator, const float range_fac);
-void ED_manipulator_arrow3d_cone_set_aspect(struct wmManipulator *manipulator, const float aspect[2]);
+void ED_manipulator_arrow3d_set_direction(struct wmManipulator *mpr, const float direction[3]);
+void ED_manipulator_arrow3d_set_up_vector(struct wmManipulator *mpr, const float direction[3]);
+void ED_manipulator_arrow3d_set_line_len(struct wmManipulator *mpr, const float len);
+void ED_manipulator_arrow3d_set_ui_range(struct wmManipulator *mpr, const float min, const float max);
+void ED_manipulator_arrow3d_set_range_fac(struct wmManipulator *mpr, const float range_fac);
+void ED_manipulator_arrow3d_cone_set_aspect(struct wmManipulator *mpr, const float aspect[2]);
 
 
 /* -------------------------------------------------------------------- */
 /* 2D Arrow Manipulator */
 
 struct wmManipulator *ED_manipulator_arrow2d_new(struct wmManipulatorGroup *mgroup, const char *name);
-void ED_manipulator_arrow2d_set_angle(struct wmManipulator *manipulator, const float rot_fac);
-void ED_manipulator_arrow2d_set_line_len(struct wmManipulator *manipulator, const float len);
+void ED_manipulator_arrow2d_set_angle(struct wmManipulator *mpr, const float rot_fac);
+void ED_manipulator_arrow2d_set_line_len(struct wmManipulator *mpr, const float len);
 
 
 /* -------------------------------------------------------------------- */
@@ -89,15 +103,10 @@ enum {
 	ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM   = (1 << 3), /* Manipulator scales uniformly */
 };
 
-enum {
-	ED_MANIPULATOR_RECT_TX_SLOT_OFFSET = 0,
-	ED_MANIPULATOR_RECT_TX_SLOT_SCALE = 1
-};
-
 struct wmManipulator *ED_manipulator_rect_transform_new(
         struct wmManipulatorGroup *mgroup, const char *name, const int style);
 void ED_manipulator_rect_transform_set_dimensions(
-        struct wmManipulator *manipulator, const float width, const float height);
+        struct wmManipulator *mpr, const float width, const float height);
 
 
 /* -------------------------------------------------------------------- */
@@ -112,7 +121,7 @@ enum {
 struct wmManipulator *ED_manipulator_dial3d_new(
         struct wmManipulatorGroup *mgroup, const char *name, const int style);
 void ED_manipulator_dial3d_set_up_vector(
-        struct wmManipulator *manipulator, const float direction[3]);
+        struct wmManipulator *mpr, const float direction[3]);
 
 
 /* -------------------------------------------------------------------- */
@@ -121,7 +130,7 @@ void ED_manipulator_dial3d_set_up_vector(
 struct wmManipulator *ED_manipulator_facemap_new(
         struct wmManipulatorGroup *mgroup, const char *name, const int style,
         struct Object *ob, const int facemap);
-struct bFaceMap *ED_manipulator_facemap_get_fmap(struct wmManipulator *manipulator);
+struct bFaceMap *ED_manipulator_facemap_get_fmap(struct wmManipulator *mpr);
 
 
 /* -------------------------------------------------------------------- */
@@ -133,7 +142,7 @@ enum {
 
 struct wmManipulator *ED_manipulator_primitive3d_new(
         struct wmManipulatorGroup *mgroup, const char *name, const int style);
-void ED_manipulator_primitive3d_set_direction(struct wmManipulator *manipulator, const float direction[3]);
-void ED_manipulator_primitive3d_set_up_vector(struct wmManipulator *manipulator, const float direction[3]);
+void ED_manipulator_primitive3d_set_direction(struct wmManipulator *mpr, const float direction[3]);
+void ED_manipulator_primitive3d_set_up_vector(struct wmManipulator *mpr, const float direction[3]);
 
 #endif  /* __ED_MANIPULATOR_LIBRARY_H__ */
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 667ca099305..69d27e30b1f 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -355,6 +355,8 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active);
 struct RV3DMatrixStore *ED_view3d_mats_rv3d_backup(struct RegionView3D *rv3d);
 void                    ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat);
 
+void  ED_draw_object_facemap(struct Scene *scene, struct Object *ob, const float col[4], const int facemap);
+
 bool ED_view3d_context_activate(struct bContext *C);
 void ED_view3d_draw_offscreen_init(struct Scene *scene, struct SceneLayer *sl, struct View3D *v3d);
 void ED_view3d_draw_offscreen(
diff --git a/source/blender/editors/manipulator_library/CMakeLists.txt b/source/blender/editors/manipulator_library/CMakeLists.txt
index bcb814e963f..1d1dcf8b725 100644
--- a/source/blender/editors/manipulator_library/CMakeLists.txt
+++ b/source/blender/editors/manipulator_library/CMakeLists.txt
@@ -44,6 +44,7 @@ set(SRC
 	geom_arrow_manipulator.c
 	geom_cube_manipulator.c
 	manipulator_draw_utils.c
+	manipulator_library_presets.c
 	manipulator_library_utils.c
 	primitive3d_manipulator.c
 
diff --git a/source/blender/editors/manipulator_library/arrow2d_manipulator.c b/source/blender/editors/manipulator_library/arrow2d_manipulator.c
index 61827723752..1273710ff69 100644
--- a/source/blender/editors/manipulator_library/arrow2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/arrow2d_manipulator.c
@@ -105,19 +105,19 @@ static void arrow2d_draw_geom(ArrowManipulator2D *arrow, const float origin[2],
 	gpuPopMatrix();
 }
 
-static void manipulator_arrow2d_draw(const bContext *UNUSED(C), struct wmManipulator *manipulator)
+static void manipulator_arrow2d_draw(const bContext *UNUSED(C), struct wmManipulator *mpr)
 {
-	ArrowManipulator2D *arrow = (ArrowManipulator2D *)manipulator;
+	ArrowManipulator2D *arrow = (ArrowManipulator2D *)mpr;
 	float col[4];
 
-	manipulator_color_get(manipulator, manipulator->state & WM_MANIPULATOR_STATE_HIGHLIGHT, col);
+	manipulator_color_get(mpr, mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT, col);
 
-	glLineWidth(manipulator->line_width);
+	glLineWidth(mpr->line_width);
 	glEnable(GL_BLEND);
-	arrow2d_draw_geom(arrow, manipulator->origin, col);
+	arrow2d_draw_geom(arrow, mpr->origin, col);
 	glDisable(GL_BLEND);
 
-	if (arrow->manipulator.interaction_data) {
+	if (mpr->interaction_data) {
 		ManipulatorInteraction *inter = arrow->manipulator.interaction_data;
 
 		glEnable(GL_BLEND);
@@ -127,24 +127,24 @@ static void manipulator_arrow2d_draw(const bContext *UNUSED(C), struct wmManipul
 }
 
 static void manipulator_arrow2d_invoke(
-        bContext *UNUSED(C), struct wmManipulator *manipulator, const wmEvent *UNUSED(event))
+        bContext *UNUSED(C), struct wmManipulator *mpr, const wmEvent *UNUSED(event))
 {
 	ManipulatorInteraction *inter = MEM_callocN(sizeof(ManipulatorInteraction), __func__);
 
-	copy_v2_v2(inter->init_origin, manipulator->origin);
-	manipulator->interaction_data = inter;
+	copy_v2_v2(inter->init_origin, mpr->origin);
+	mpr->interaction_data = inter;
 }
 
-static int manipulator_arrow2d_intersect(
-        bContext *UNUSED(C), struct wmManipulator *manipulator, const wmEvent *event)
+static int manipulator_arrow2d_test_select(
+        bContext *UNUSED(C), struct wmManipulator *mpr, const wmEvent *event)
 {
-	ArrowManipulator2D *arrow = (ArrowManipulator2D *)manipulator;
+	ArrowManipulator2D *arrow = (ArrowManipulator2D *)mpr;
 	const float mval[2] = {event->mval[0], event->mval[1]};
-	const float line_len = arrow->line_len * manipulator->scale;
+	const float line_len = arrow->line_len * mpr->scale;
 	float mval_local[2];
 
 	copy_v2_v2(mval_local, mval);
-	sub_v2_v2(mval_local, manipulator->origin);
+	sub_v2_v2(mval_local, mpr->origin);
 
 	float line[2][2];
 	line[0][0] = line[0][1] = line[1][0] = 0.0f;
@@ -160,7 +160,7 @@ static int manipulator_arrow2d_intersect(
 	/* arrow line intersection check */
 	float isect_1[2], isect_2[2];
 	const int isect = isect_line_sphere_v2(
-	        line[0], line[1], mval_local, MANIPULATOR_HOTSPOT + manipulator->line_width * 0.5f,
+	        line[0], line[1], mval_local, MANIPULATOR_HOTSPOT + mpr->line_width * 0.5f,
 	        isect_1, isect_2);
 
 	if (isect > 0) {
@@ -190,8 +190,8 @@ static int manipulator_arrow2d_intersect(
 
 struct wmManipulator *ED_manipulator_arrow2d_ne

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list