[Bf-blender-cvs] [075bf33] custom-manipulators temp_manipulators_core: Regions now use a single manipulator-map again

Julian Eisel noreply at git.blender.org
Thu Sep 29 00:59:53 CEST 2016


Commit: 075bf33e0f5494cc55ffde7428e9a6983d1fec75
Author: Julian Eisel
Date:   Thu Sep 29 00:07:58 2016 +0200
Branches: custom-manipulators temp_manipulators_core
https://developer.blender.org/rB075bf33e0f5494cc55ffde7428e9a6983d1fec75

Regions now use a single manipulator-map again

Instead of having multiple manipulator-maps for 2D and 3D manipulators, manipulator-group-types should be tagged as being either 2D or 3D. When it comes to drawing these can be drawn separately.
Note that more work needs to be done here (added some todo marks), but there are probably going to be quite a few issues when merging into custom_manipulators, so will handle these first.

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

M	source/blender/blenkernel/BKE_screen.h
M	source/blender/blenkernel/intern/screen.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/editors/screen/screen_edit.c
M	source/blender/makesdna/DNA_screen_types.h
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_api.h
M	source/blender/windowmanager/manipulators/WM_manipulator_types.h
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_wmapi.h

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

diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 3768074..2e42cfc 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -49,6 +49,7 @@ struct bScreen;
 struct uiLayout;
 struct uiList;
 struct wmKeyConfig;
+struct wmManipulatorMap;
 struct wmNotifier;
 struct wmWindow;
 struct wmWindowManager;
@@ -288,7 +289,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_callback_free_manipulatormaps_set(void (*callback)(ListBase *list));
+void BKE_region_callback_free_manipulatormap_set(void (*callback)(struct wmManipulatorMap *));
 
 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 ac59f2e..1482056 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -179,8 +179,8 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
 	BLI_listbase_clear(&newar->panels_category);
 	BLI_listbase_clear(&newar->panels_category_active);
 	BLI_listbase_clear(&newar->ui_lists);
-	BLI_listbase_clear(&newar->manipulator_maps);
 	newar->swinid = 0;
+	newar->manipulator_map = NULL;
 	newar->regiontimer = NULL;
 	
 	/* use optional regiondata callback */
@@ -293,11 +293,11 @@ void BKE_spacedata_id_unref(struct ScrArea *sa, struct SpaceLink *sl, struct ID
 /**
  * Avoid bad-level calls to #WM_manipulatormap_delete.
  */
-static void (*region_free_manipulatormaps_callback)(ListBase *) = NULL;
+static void (*region_free_manipulatormap_callback)(struct wmManipulatorMap *) = NULL;
 
-void BKE_region_callback_free_manipulatormaps_set(void (*callback)(ListBase *list))
+void BKE_region_callback_free_manipulatormap_set(void (*callback)(struct wmManipulatorMap *))
 {
-	region_free_manipulatormaps_callback = callback;
+	region_free_manipulatormap_callback = callback;
 }
 
 /* not region itself */
@@ -350,7 +350,7 @@ void BKE_area_region_free(SpaceType *st, ARegion *ar)
 		}
 	}
 
-	region_free_manipulatormaps_callback(&ar->manipulator_maps);
+	region_free_manipulatormap_callback(ar->manipulator_map);
 	BLI_freelistN(&ar->ui_lists);
 	BLI_freelistN(&ar->ui_previews);
 	BLI_freelistN(&ar->panels_category);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 4a6d0b0..1c814d3 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6904,12 +6904,12 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
 	BLI_listbase_clear(&ar->panels_category);
 	BLI_listbase_clear(&ar->handlers);
 	BLI_listbase_clear(&ar->uiblocks);
-	BLI_listbase_clear(&ar->manipulator_maps);
 	ar->headerstr = NULL;
 	ar->swinid = 0;
 	ar->type = NULL;
 	ar->swap = 0;
 	ar->do_draw = 0;
+	ar->manipulator_map = NULL;
 	ar->regiontimer = NULL;
 	memset(&ar->drawrct, 0, sizeof(ar->drawrct));
 }
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index cfee92e..3d30f2b 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1069,7 +1069,7 @@ static void region_cursor_set(wmWindow *win, int swinid, int swin_changed)
 		for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
 			if (ar->swinid == swinid) {
 				if (swin_changed || (ar->type && ar->type->event_cursor)) {
-					if (WM_manipulatormap_cursor_set(ar->manipulator_maps.first, win)) {
+					if (WM_manipulatormap_cursor_set(ar->manipulator_map, win)) {
 						return;
 					}
 					ED_region_cursor_set(win, sa, ar);
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 3d04899..9ac1852 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -264,11 +264,11 @@ typedef struct ARegion {
 	ListBase ui_lists;			/* uiList */
 	ListBase ui_previews;		/* uiPreview */
 	ListBase handlers;			/* wmEventHandler */
-	ListBase manipulator_maps;	/* wmManipulatorMap */
 	ListBase panels_category;	/* Panel categories runtime */
-	
+
+	struct wmManipulatorMap *manipulator_map; /* manipulator map of this region */
 	struct wmTimer *regiontimer; /* blend in/out */
-	
+
 	char *headerstr;			/* use this string to draw info */
 	void *regiondata;			/* XXX 2.50, need spacedata equivalent? */
 } ARegion;
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index d9cdb07..03a18fa 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2113,14 +2113,11 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
 
 				/* handle manipulator highlighting */
 				if (event->type == MOUSEMOVE && !wm_manipulatormap_get_active_manipulator(mmap)) {
-					if (wm_manipulatormap_is_3d(mmap)) {
-						manipulator = wm_manipulatormap_find_highlighted_3D(mmap, C, event, &part);
-						wm_manipulatormap_set_highlighted_manipulator(mmap, C, manipulator, part);
-					}
-					else {
-						manipulator = wm_manipulatormap_find_highlighted_manipulator(mmap, C, event, &part);
-						wm_manipulatormap_set_highlighted_manipulator(mmap, C, manipulator, part);
-					}
+					/* TODO should check for both, 2D and 3D manipulators and choose the one closest to cursor */
+					manipulator = wm_manipulatormap_find_highlighted_3D(mmap, C, event, &part);
+					wm_manipulatormap_set_highlighted_manipulator(mmap, C, manipulator, part);
+					manipulator = wm_manipulatormap_find_highlighted_manipulator(mmap, C, event, &part);
+					wm_manipulatormap_set_highlighted_manipulator(mmap, C, manipulator, part);
 				}
 				/* handle user configurable manipulator-map keymap */
 				else if (manipulator) {
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index c5a31d4..fbbde2a 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -169,7 +169,7 @@ 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_region_callback_free_manipulatormap_set(wm_manipulatormap_delete); /* 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_spacedata_callback_id_remap_set(ED_spacedata_id_remap); /* screen.c */
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_api.h b/source/blender/windowmanager/manipulators/WM_manipulator_api.h
index f9d3a5b..4769b6c 100644
--- a/source/blender/windowmanager/manipulators/WM_manipulator_api.h
+++ b/source/blender/windowmanager/manipulators/WM_manipulator_api.h
@@ -99,8 +99,6 @@ struct wmManipulatorMapType *WM_manipulatormaptype_ensure(
         const struct wmManipulatorMapType_Params *mmap_params);
 struct wmManipulatorMap *WM_manipulatormap_new_from_type(
         const struct wmManipulatorMapType_Params *mmap_params);
-struct wmManipulatorMap *WM_manipulatormap_find(
-        const struct ARegion *ar, const struct wmManipulatorMapType_Params *mmap_params);
 
 void WM_manipulatormap_tag_refresh(struct wmManipulatorMap *mmap);
 void WM_manipulatormap_update(const struct bContext *C, struct wmManipulatorMap *mmap);
@@ -108,7 +106,7 @@ void WM_manipulatormap_draw(
         const struct bContext *C, const struct wmManipulatorMap *mmap,
         const bool in_scene, const bool free_drawmanipulators);
 
-void WM_manipulatormaps_add_handlers(struct ARegion *ar);
+void WM_manipulatormaps_add_handlers(struct ARegion *ar, struct wmManipulatorMap *mmap);
 
 bool WM_manipulatormap_select_all(struct bContext *C, struct wmManipulatorMap *mmap, const int action);
 
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_types.h b/source/blender/windowmanager/manipulators/WM_manipulator_types.h
index f97e46d..2a3be7d 100644
--- a/source/blender/windowmanager/manipulators/WM_manipulator_types.h
+++ b/source/blender/windowmanager/manipulators/WM_manipulator_types.h
@@ -121,15 +121,5 @@ enum eManipulatorFlag {
 	WM_MANIPULATOR_SELECTABLE  = (1 << 9),
 };
 
-/* wmManipulatorMapType->flag */
-enum eManipulatorMapTypeFlag {
-	/**
-	 * Check if manipulator-map does 3D drawing
-	 * (uses a different kind of interaction),
-	 * - 3d: use glSelect buffer.
-	 * - 2d: use simple cursor position intersection test. */
-	WM_MANIPULATORMAPTYPE_3D           = (1 << 0),
-};
-
 #endif  /* __WM_MANIPULATOR_TYPES_H__ */
 
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h b/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
index d5c0462..fd44b43 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
@@ -186,8 +186,6 @@ typedef struct wmManipulatorMapType {
 	struct wmManipulatorMapType *next, *prev;
 	char idname[64];
 	short spaceid, regionid;
-	/* eManipulatorMapTypeFlag */
-	int flag;
 	/* types of manipulator-groups for this manipulator-map type */
 	ListBase manipulator_grouptypes;
 } wmManipulatorMapType;
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulatorgroup.c b/source/blender/windowmanager/manipulators/intern/wm_manipulatorgroup.c
index 8aa07e6..f7a8895 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list