[Bf-blender-cvs] [e2b79f8] temp_manipulators_core: Resolve some XXX'es and TODO's

Julian Eisel noreply at git.blender.org
Tue Sep 13 00:45:34 CEST 2016


Commit: e2b79f87566acb4e06c7a306de0766a1cdfc1cd5
Author: Julian Eisel
Date:   Tue Sep 13 00:42:32 2016 +0200
Branches: temp_manipulators_core
https://developer.blender.org/rBe2b79f87566acb4e06c7a306de0766a1cdfc1cd5

Resolve some XXX'es and TODO's

And some cleanup.

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

M	source/blender/blenkernel/BKE_screen.h
M	source/blender/blenkernel/intern/screen.c
M	source/blender/windowmanager/intern/wm_event_system.c
M	source/blender/windowmanager/intern/wm_init_exit.c
M	source/blender/windowmanager/manipulators/WM_manipulator_types.h
M	source/blender/windowmanager/manipulators/intern/manipulator_library/arrow2d_manipulator.c
M	source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c
M	source/blender/windowmanager/manipulators/intern/manipulator_library/dial_manipulator.c
M	source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_intern.h
M	source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_utils.c
M	source/blender/windowmanager/manipulators/intern/manipulator_library/primitive_manipulator.c
M	source/blender/windowmanager/manipulators/intern/wm_manipulatorgroup.c
M	source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c

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

diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 1dfef5c..cd8b520 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -285,7 +285,7 @@ struct ARegion *BKE_area_region_copy(struct SpaceType *st, struct ARegion *ar);
 void            BKE_area_region_free(struct SpaceType *st, struct ARegion *ar);
 void            BKE_screen_area_free(struct ScrArea *sa);
 /* Manipulator-maps of a region need to be freed with the region. Uses callback to avoid low-level call. */
-void BKE_region_free_callback_manipulatormaps_set(void (*callback)(ListBase *list));
+void BKE_region_callback_free_manipulatormaps_set(void (*callback)(ListBase *list));
 
 struct ARegion *BKE_area_find_region_type(struct ScrArea *sa, int type);
 struct ARegion *BKE_area_find_region_active_win(struct ScrArea *sa);
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 45622c6..ac59f2e 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -295,7 +295,7 @@ void BKE_spacedata_id_unref(struct ScrArea *sa, struct SpaceLink *sl, struct ID
  */
 static void (*region_free_manipulatormaps_callback)(ListBase *) = NULL;
 
-void BKE_region_free_callback_manipulatormaps_set(void (*callback)(ListBase *list))
+void BKE_region_callback_free_manipulatormaps_set(void (*callback)(ListBase *list))
 {
 	region_free_manipulatormaps_callback = callback;
 }
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index b0f0a2d..29251e2 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2126,13 +2126,17 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
 					/* get user customized keymap from default one */
 					const wmKeyMap *keymap = WM_keymap_active(wm, mmap->mmap_context.activegroup->type->keymap);
 					wmKeyMapItem *kmi;
-					/* TODO should probably add some PRINT calls here */
+
+					PRINT("%s:   checking '%s' ...", __func__, keymap->idname);
 
 					if (!keymap->poll || keymap->poll(C)) {
+						PRINT("pass\n");
 						for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
 							if (wm_eventmatch(event, kmi)) {
 								wmOperator *op = handler->op;
 
+								PRINT("%s:     item matched '%s'\n", __func__, kmi->idname);
+
 								/* weak, but allows interactive callback to not use rawkey */
 								event->keymap_idname = kmi->idname;
 
@@ -2142,11 +2146,20 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
 								handler->op = op;
 
 								if (action & WM_HANDLER_BREAK) {
-									break;
+									if (action & WM_HANDLER_HANDLED) {
+										if (G.debug & (G_DEBUG_EVENTS | G_DEBUG_HANDLERS))
+											printf("%s:       handled - and pass on! '%s'\n", __func__, kmi->idname);
+									}
+									else {
+										PRINT("%s:       un-handled '%s'\n", __func__, kmi->idname);
+									}
 								}
 							}
 						}
 					}
+					else {
+						PRINT("fail\n");
+					}
 				}
 
 				/* restore the area */
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index ffb6724..57f7fde 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -169,9 +169,9 @@ void WM_init(bContext *C, int argc, const char **argv)
 
 	BKE_library_callback_free_window_manager_set(wm_close_and_free);   /* library.c */
 	BKE_library_callback_free_notifier_reference_set(WM_main_remove_notifier_reference);   /* library.c */
+	BKE_region_callback_free_manipulatormaps_set(wm_manipulatormap_delete_list); /* screen.c */
 	BKE_library_callback_remap_editor_id_reference_set(WM_main_remap_editor_id_reference);   /* library.c */
 	BKE_blender_callback_test_break_set(wm_window_testbreak); /* blender.c */
-	BKE_region_free_callback_manipulatormaps_set(wm_manipulatormap_delete_list);
 	BKE_spacedata_callback_id_remap_set(ED_spacedata_id_remap); /* screen.c */
 	DAG_editors_update_cb(ED_render_id_flush_update,
 	                      ED_render_scene_update,
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_types.h b/source/blender/windowmanager/manipulators/WM_manipulator_types.h
index 0eca5a9..25ff546 100644
--- a/source/blender/windowmanager/manipulators/WM_manipulator_types.h
+++ b/source/blender/windowmanager/manipulators/WM_manipulator_types.h
@@ -42,7 +42,7 @@ struct wmManipulatorGroupType;
 struct wmManipulatorGroup;
 struct wmKeyConfig;
 
-typedef int  (*wmManipulatorGroupPollFunc)(const struct bContext *, struct wmManipulatorGroupType *) ATTR_WARN_UNUSED_RESULT; /* TODO use bool */
+typedef bool (*wmManipulatorGroupPollFunc)(const struct bContext *, struct wmManipulatorGroupType *) ATTR_WARN_UNUSED_RESULT;
 typedef void (*wmManipulatorGroupInitFunc)(const struct bContext *, struct wmManipulatorGroup *);
 typedef void (*wmManipulatorGroupRefreshFunc)(const struct bContext *, struct wmManipulatorGroup *);
 typedef void (*wmManipulatorGroupDrawPrepareFunc)(const struct bContext *, struct wmManipulatorGroup *);
diff --git a/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow2d_manipulator.c b/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow2d_manipulator.c
index 7c9f6e4..d8e5d39 100644
--- a/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow2d_manipulator.c
+++ b/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow2d_manipulator.c
@@ -97,7 +97,9 @@ static void arrow2d_draw_geom(ArrowManipulator2D *arrow, const float origin[2])
 static void manipulator_arrow2d_draw(const bContext *UNUSED(C), wmManipulator *manipulator)
 {
 	ArrowManipulator2D *arrow = (ArrowManipulator2D *)manipulator;
-	const float *col = manipulator_color_get(manipulator, manipulator->flag & WM_MANIPULATOR_HIGHLIGHT);
+	float col[4];
+
+	manipulator_color_get(manipulator, manipulator->flag & WM_MANIPULATOR_HIGHLIGHT, col);
 
 	glColor4fv(col);
 	glLineWidth(manipulator->line_width);
diff --git a/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c b/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c
index 43d2eb8..d80c36a 100644
--- a/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c
+++ b/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c
@@ -196,10 +196,12 @@ static void arrow_draw_geom(const ArrowManipulator *arrow, const bool select)
 static void arrow_draw_intern(ArrowManipulator *arrow, const bool select, const bool highlight)
 {
 	const float up[3] = {0.0f, 0.0f, 1.0f};
+	float col[4];
 	float rot[3][3];
 	float mat[4][4];
 	float final_pos[3];
 
+	manipulator_color_get(&arrow->manipulator, highlight, col);
 	manipulator_arrow_get_final_pos(&arrow->manipulator, final_pos);
 
 	if (arrow->flag & ARROW_UP_VECTOR_SET) {
@@ -217,13 +219,7 @@ static void arrow_draw_intern(ArrowManipulator *arrow, const bool select, const
 	glPushMatrix();
 	glMultMatrixf(mat);
 
-	if (highlight && !(arrow->manipulator.flag & WM_MANIPULATOR_DRAW_HOVER)) {
-		glColor4fv(arrow->manipulator.col_hi);
-	}
-	else {
-		glColor4fv(arrow->manipulator.col);
-	}
-
+	glColor4fv(col);
 	glEnable(GL_BLEND);
 	glTranslate3fv(arrow->manipulator.offset);
 	arrow_draw_geom(arrow, select);
diff --git a/source/blender/windowmanager/manipulators/intern/manipulator_library/dial_manipulator.c b/source/blender/windowmanager/manipulators/intern/manipulator_library/dial_manipulator.c
index d98ad3b..50f452b 100644
--- a/source/blender/windowmanager/manipulators/intern/manipulator_library/dial_manipulator.c
+++ b/source/blender/windowmanager/manipulators/intern/manipulator_library/dial_manipulator.c
@@ -190,10 +190,12 @@ static void dial_draw_intern(const bContext *C, DialManipulator *dial, const boo
 	float rot[3][3];
 	float mat[4][4];
 	const float up[3] = {0.0f, 0.0f, 1.0f};
-	const float *col = manipulator_color_get(&dial->manipulator, highlight);
+	float col[4];
 
 	BLI_assert(CTX_wm_area(C)->spacetype == SPACE_VIEW3D);
 
+	manipulator_color_get(&dial->manipulator, highlight, col);
+
 	rotation_between_vecs_to_mat3(rot, up, dial->direction);
 	copy_m4_m3(mat, rot);
 	copy_v3_v3(mat[3], dial->manipulator.origin);
diff --git a/source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_intern.h b/source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_intern.h
index 2c635af..66598fa 100644
--- a/source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_intern.h
+++ b/source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_intern.h
@@ -32,7 +32,7 @@
 #define __MANIPULATOR_LIBRARY_INTERN_H__
 
 /* distance around which manipulators respond to input (and get highlighted) */
-#define MANIPULATOR_HOTSPOT 14.0f /* TODO use everywhere */
+#define MANIPULATOR_HOTSPOT 14.0f
 
 /**
  * Data for common interactions. Used in manipulator_library_utils.c functions.
@@ -92,7 +92,9 @@ void  manipulator_property_value_reset(
 
 /* -------------------------------------------------------------------- */
 
-float *manipulator_color_get(wmManipulator *manipulator, const bool highlight);
+void manipulator_color_get(
+        const wmManipulator *manipulator, const bool highlight,
+        float r_col[]);
 
 #endif  /* __MANIPULATOR_LIBRARY_INTERN_H__ */
 
diff --git a/source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_utils.c b/source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_utils.c
index 0066981..a521db0 100644
--- a/source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_utils.c
+++ b/source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_utils.c
@@ -33,6 +33,8 @@
 
 #include "BKE_context.h"
 
+#include "BLI_math.h"
+
 #include "RNA_access.h"
 
 #include "W

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list