[Bf-blender-cvs] [38dafd5f44a] blender2.8: Merge branch 'master' into blender2.8

Campbell Barton noreply at git.blender.org
Thu Jan 25 06:35:08 CET 2018


Commit: 38dafd5f44a07b4937ca53cf67cce4093d5797f7
Author: Campbell Barton
Date:   Thu Jan 25 16:28:06 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB38dafd5f44a07b4937ca53cf67cce4093d5797f7

Merge branch 'master' into blender2.8

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



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

diff --cc source/blender/blenkernel/intern/screen.c
index 6bd88099792,78caf1fe1f3..754f59d2e33
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@@ -428,7 -382,8 +428,10 @@@ void BKE_screen_free(bScreen *sc
  	BLI_freelistN(&sc->edgebase);
  	BLI_freelistN(&sc->areabase);
  
 +	BKE_previewimg_free(&sc->preview);
++	
+ 	/* Region and timer are freed by the window manager. */
+ 	MEM_SAFE_FREE(sc->tool_tip);
  }
  
  /* for depsgraph */
diff --cc source/blender/blenloader/intern/readfile.c
index 2cb799d39b9,4c1beb78bbf..236b14af8b0
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -6663,10 -6402,15 +6663,11 @@@ static void lib_link_screen(FileData *f
  			IDP_LibLinkProperty(sc->id.properties, fd);
  			id_us_ensure_real(&sc->id);
  
 +			/* deprecated, but needed for versioning (will be NULL'ed then) */
  			sc->scene = newlibadr(fd, sc->id.lib, sc->scene);
  
 -			/* this should not happen, but apparently it does somehow. Until we figure out the cause,
 -			 * just assign first available scene */
 -			if (!sc->scene)
 -				sc->scene = main->scene.first;
 -
  			sc->animtimer = NULL; /* saved in rare cases */
+ 			sc->tool_tip = NULL;
  			sc->scrubbing = false;
  			
  			for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
diff --cc source/blender/editors/include/UI_interface.h
index 5d7a45a7e48,d6c6f0a2eb6..6e09318314d
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@@ -1105,19 -1081,19 +1105,21 @@@ void UI_context_active_but_prop_get_tem
          struct bContext *C,
          struct PointerRNA *r_ptr, struct PropertyRNA **r_prop);
  
+ uiBut *UI_region_active_but_get(struct ARegion *ar);
+ 
  /* Styled text draw */
  void UI_fontstyle_set(const struct uiFontStyle *fs);
 -void UI_fontstyle_draw_ex(
 -        const struct uiFontStyle *fs, const struct rcti *rect, const char *str,
 -        size_t len, float *r_xofs, float *r_yofs);
 -void UI_fontstyle_draw(const struct uiFontStyle *fs, const struct rcti *rect, const char *str);
 -void UI_fontstyle_draw_rotated(const struct uiFontStyle *fs, const struct rcti *rect, const char *str);
 -void UI_fontstyle_draw_simple(const struct uiFontStyle *fs, float x, float y, const char *str);
 +void UI_fontstyle_draw_ex(const struct uiFontStyle *fs, const struct rcti *rect, const char *str,
 +                          const unsigned char col[4], size_t len, float *r_xofs, float *r_yofs);
 +void UI_fontstyle_draw(const struct uiFontStyle *fs, const struct rcti *rect, const char *str,
 +                       const unsigned char col[4]);
 +void UI_fontstyle_draw_rotated(const struct uiFontStyle *fs, const struct rcti *rect, const char *str,
 +                               const unsigned char col[4]);
 +void UI_fontstyle_draw_simple(const struct uiFontStyle *fs, float x, float y, const char *str,
 +                              const unsigned char col[4]);
  void UI_fontstyle_draw_simple_backdrop(
          const struct uiFontStyle *fs, float x, float y, const char *str,
 -        const unsigned char fg[4], const unsigned char bg[4]);
 +        const float col_fg[4], const float col_bg[4]);
  
  int UI_fontstyle_string_width(const struct uiFontStyle *fs, const char *str);
  int UI_fontstyle_height_max(const struct uiFontStyle *fs);
@@@ -1150,8 -1126,7 +1152,8 @@@ void UI_butstore_unregister(uiButStore 
  
  /* ui_interface_region_tooltip.c */
  struct ARegion *UI_tooltip_create_from_button(struct bContext *C, struct ARegion *butregion, uiBut *but);
 +struct ARegion *UI_tooltip_create_from_manipulator(struct bContext *C, struct wmManipulator *mpr);
- void UI_tooltip_free(struct bContext *C, struct ARegion *ar);
+ void UI_tooltip_free(struct bContext *C, struct bScreen *sc, struct ARegion *ar);
  
  /* How long before a tool-tip shows. */
  #define UI_TOOLTIP_DELAY 0.5
diff --cc source/blender/editors/interface/interface_handlers.c
index 9c1cee915e4,2f7359da308..1e31837f088
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@@ -7701,12 -7650,12 +7699,12 @@@ static bool button_modal_state(uiHandle
   */
  void UI_but_tooltip_refresh(bContext *C, uiBut *but)
  {
- 	uiHandleButtonData *data;
- 
- 	data = but->active;
- 	if (data && data->tooltip) {
- 		UI_tooltip_free(C, data->tooltip);
- 		data->tooltip = UI_tooltip_create_from_button(C, data->region, but);
+ 	uiHandleButtonData *data = but->active;
+ 	if (data) {
 -		bScreen *sc = data->window->screen;
++		bScreen *sc = WM_window_get_active_screen(data->window);
+ 		if (sc->tool_tip && sc->tool_tip->region) {
+ 			WM_tooltip_refresh(C, data->window);
+ 		}
  	}
  }
  
diff --cc source/blender/editors/interface/interface_region_tooltip.c
index 9a818efebee,1eec3737215..07fbefa42e1
--- a/source/blender/editors/interface/interface_region_tooltip.c
+++ b/source/blender/editors/interface/interface_region_tooltip.c
@@@ -936,26 -756,9 +936,26 @@@ ARegion *UI_tooltip_create_from_button(
  	return ui_tooltip_create_with_data(C, data, init_position, aspect);
  }
  
 +ARegion *UI_tooltip_create_from_manipulator(bContext *C, wmManipulator *mpr)
 +{
 +	wmWindow *win = CTX_wm_window(C);
 +	const float aspect = 1.0f;
 +	float init_position[2];
 +
 +	uiTooltipData *data = ui_tooltip_data_from_manipulator(C, mpr);
 +	if (data == NULL) {
 +		return NULL;
 +	}
 +
 +	init_position[0] = win->eventstate->x;
 +	init_position[1] = win->eventstate->y;
 +
 +	return ui_tooltip_create_with_data(C, data, init_position, aspect);
 +}
 +
- void UI_tooltip_free(bContext *C, ARegion *ar)
+ void UI_tooltip_free(bContext *C, bScreen *sc, ARegion *ar)
  {
- 	ui_region_temp_remove(C, CTX_wm_screen(C), ar);
+ 	ui_region_temp_remove(C, sc, ar);
  }
  
  /** \} */
diff --cc source/blender/makesdna/DNA_screen_types.h
index dd716014f66,a7718883438..375641d1115
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@@ -45,7 -44,8 +45,9 @@@ struct PanelType
  struct Scene;
  struct uiLayout;
  struct wmTimer;
+ struct wmTooltipState;
+ 
 +
  typedef struct bScreen {
  	ID id;
  	
@@@ -77,7 -78,7 +79,9 @@@
  	struct wmTimer *animtimer;			/* if set, screen has timer handler added in window */
  	void *context;						/* context callback */
  
+ 	struct wmTooltipState *tool_tip;	/* runtime */
++
 +	PreviewImage *preview;
  } bScreen;
  
  typedef struct ScrVert {
diff --cc source/blender/windowmanager/CMakeLists.txt
index b5784fe543c,c9278822b9a..059055daea9
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@@ -70,18 -67,9 +70,19 @@@ set(SR
  	intern/wm_operator_props.c
  	intern/wm_operators.c
  	intern/wm_subwindow.c
 -	intern/wm_tooltip.c
  	intern/wm_window.c
  	intern/wm_stereo.c
 +	intern/wm_toolsystem.c
++	intern/wm_tooltip.c
 +	manipulators/intern/wm_manipulator.c
 +	manipulators/intern/wm_manipulator_group.c
 +	manipulators/intern/wm_manipulator_group_type.c
 +	manipulators/intern/wm_manipulator_map.c
 +	manipulators/intern/wm_manipulator_target_props.c
 +	manipulators/intern/wm_manipulator_type.c
 +	message_bus/intern/wm_message_bus.c
 +	message_bus/intern/wm_message_bus_rna.c
 +	message_bus/intern/wm_message_bus_static.c
  
  	WM_api.h
  	WM_keymap.h
diff --cc source/blender/windowmanager/WM_api.h
index 85f94721d40,965eb2b258a..7a66cc04014
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@@ -569,13 -536,17 +569,24 @@@ bool        WM_event_is_tablet(const st
  bool        WM_event_is_ime_switch(const struct wmEvent *event);
  #endif
  
 +/* wm_toolsystem.c  */
 +void WM_toolsystem_unlink(struct bContext *C, struct WorkSpace *workspace);
 +void WM_toolsystem_link(struct bContext *C, struct WorkSpace *workspace);
 +
 +void WM_toolsystem_set(struct bContext *C, const struct bToolDef *tool);
 +void WM_toolsystem_init(struct bContext *C);
 +
+ /* wm_tooltip.c */
+ typedef struct ARegion *(*wmTooltipInitFn)(struct bContext *, struct ARegion *, bool *);
+ 
+ void WM_tooltip_timer_init(
+         struct bContext *C, struct wmWindow *win, struct ARegion *ar,
+         wmTooltipInitFn init);
+ void WM_tooltip_timer_clear(struct bContext *C, struct wmWindow *win);
+ void WM_tooltip_clear(struct bContext *C, struct wmWindow *win);
+ void WM_tooltip_init(struct bContext *C, struct wmWindow *win);
+ void WM_tooltip_refresh(struct bContext *C, struct wmWindow *win);
+ 
  #ifdef __cplusplus
  }
  #endif
diff --cc source/blender/windowmanager/intern/wm_event_system.c
index 6e559ef7157,d36702b4df7..133ac6564f8
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@@ -2262,156 -2164,6 +2262,139 @@@ static int wm_handlers_do_intern(bConte
  					}
  				}
  			}
 +			else if (handler->manipulator_map) {
 +				ScrArea *area = CTX_wm_area(C);
 +				ARegion *region = CTX_wm_region(C);
 +				wmManipulatorMap *mmap = handler->manipulator_map;
 +				wmManipulator *mpr = wm_manipulatormap_highlight_get(mmap);
 +
 +				if (region->manipulator_map != handler->manipulator_map) {
 +					WM_manipulatormap_tag_refresh(handler->manipulator_map);
 +				}
 +
 +				wm_manipulatormap_handler_context(C, handler);
 +				wm_region_mouse_co(C, event);
 +
- 				if (event->type == MOUSEMOVE) {
- 					WM_manipulatormap_tooltip_clear(C, mmap);
- 				}
- 
 +				/* handle manipulator highlighting */
 +				if (event->type == MOUSEMOVE && !wm_manipulatormap_modal_get(mmap)) {
 +					int part;
 +					mpr = wm_manipulatormap_highlight_find(mmap, C, event, &part);
 +					wm_manipulatormap_highlight_set(mmap, C, mpr, part);
 +					if (mpr != NULL) {
- 						WM_manipulatormap_tooltip_timer_init(C, mmap);
- 					}
- 				}
- 				/* handle user configurable manipulator-map keymap */
- 				else if ((event->type == TIMER) &&
- 				         (event->customdata == WM_manipulatormap_tooltip_timer_get(mmap)))
- 				{
- 					if (mpr) {
- 						if (mpr->state & WM_MANIPULATOR_STATE_MODAL) {
- 							WM_manipulatormap_tooltip_clear(C, mmap);
- 						}
- 						else {
- 							WM_manipulatormap_tooltip_create(C, mmap);
- 						}
++						WM_too

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list