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

Campbell Barton noreply at git.blender.org
Wed May 23 10:51:52 CEST 2018


Commit: e92baab34893f5a5b3d6f59238fdb7855b72d7fe
Author: Campbell Barton
Date:   Wed May 23 10:50:35 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBe92baab34893f5a5b3d6f59238fdb7855b72d7fe

Merge branch 'master' into blender2.8

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



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

diff --cc source/blender/editors/interface/interface.c
index be0c84f7d80,882d7de9af9..e4b298fecf0
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@@ -365,18 -337,18 +365,18 @@@ static void ui_block_bounds_calc_center
  	ymax = WM_window_pixels_y(window);
  
  	ui_block_bounds_calc(block);
- 	
+ 
  	width  = BLI_rctf_size_x(&block->rect);
  	height = BLI_rctf_size_y(&block->rect);
- 	
+ 
  	startx = (xmax * 0.5f) - (width * 0.5f);
  	starty = (ymax * 0.5f) - (height * 0.5f);
- 	
+ 
 -	ui_block_translate(block, startx - block->rect.xmin, starty - block->rect.ymin);
 +	UI_block_translate(block, startx - block->rect.xmin, starty - block->rect.ymin);
- 	
+ 
  	/* now recompute bounds and safety */
  	ui_block_bounds_calc(block);
- 	
+ 
  }
  
  static void ui_block_bounds_calc_centered_pie(uiBlock *block)
@@@ -1222,10 -1291,10 +1222,10 @@@ void UI_block_end_ex(const bContext *C
  		ui_menu_block_set_keyaccels(block); /* could use a different flag to check */
  	}
  
 -	if (block->flag & UI_BLOCK_LOOP) {
 +	if (block->flag & (UI_BLOCK_LOOP | UI_BLOCK_SHOW_SHORTCUT_ALWAYS)) {
  		ui_menu_block_set_keymaps(C, block);
  	}
- 	
+ 
  	/* after keymaps! */
  	switch (block->bounds_type) {
  		case UI_BLOCK_BOUNDS_NONE:
@@@ -1303,7 -1372,8 +1303,7 @@@ void UI_block_draw(const bContext *C, u
  	ARegion *ar;
  	uiBut *but;
  	rcti rect;
- 	
 -	int multisample_enabled;
+ 
  	/* get menu region or area region */
  	ar = CTX_wm_menu(C);
  	if (!ar)
@@@ -1312,25 -1382,32 +1312,25 @@@
  	if (!block->endblock)
  		UI_block_end(C, block);
  
 -	/* disable AA, makes widgets too blurry */
 -	multisample_enabled = glIsEnabled(GL_MULTISAMPLE);
 -	if (multisample_enabled)
 -		glDisable(GL_MULTISAMPLE);
 -
  	/* we set this only once */
 -	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 +	glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- 	
+ 
  	/* scale fonts */
  	ui_fontscale(&style.paneltitle.points, block->aspect);
  	ui_fontscale(&style.grouplabel.points, block->aspect);
  	ui_fontscale(&style.widgetlabel.points, block->aspect);
  	ui_fontscale(&style.widget.points, block->aspect);
- 	
+ 
  	/* scale block min/max to rect */
  	ui_but_to_pixelrect(&rect, ar, block, NULL);
- 	
+ 
  	/* pixel space for AA widgets */
 -	glMatrixMode(GL_PROJECTION);
 -	glPushMatrix();
 -	glMatrixMode(GL_MODELVIEW);
 -	glPushMatrix();
 -	glLoadIdentity();
 +	gpuPushProjectionMatrix();
 +	gpuPushMatrix();
 +	gpuLoadIdentity();
  
  	wmOrtho2_region_pixelspace(ar);
- 	
+ 
  	/* back */
  	if (block->flag & UI_BLOCK_RADIAL)
  		ui_draw_pie_center(block);
@@@ -1357,47 -1428,16 +1357,47 @@@
  		}
  	}
  
 -	/* restore matrix */
 -	glMatrixMode(GL_PROJECTION);
 -	glPopMatrix();
 -	glMatrixMode(GL_MODELVIEW);
 -	glPopMatrix();
 +	UI_widgetbase_draw_cache_end();
 +	UI_icon_draw_cache_end();
 +	BLF_batch_draw_end();
- 	
+ 
 -	if (multisample_enabled)
 -		glEnable(GL_MULTISAMPLE);
 +	/* restore matrix */
 +	gpuPopProjectionMatrix();
 +	gpuPopMatrix();
 +}
 +
 +static void ui_block_message_subscribe(ARegion *ar, struct wmMsgBus *mbus, uiBlock *block)
 +{
 +	uiBut *but_prev = NULL;
 +	/* possibly we should keep the region this block is contained in? */
 +	for (uiBut *but = block->buttons.first; but; but = but->next) {
 +		if (but->rnapoin.type && but->rnaprop) {
 +			/* quick check to avoid adding buttons representing a vector, multiple times. */
 +			if ((but_prev &&
 +			    (but_prev->rnaprop == but->rnaprop) &&
 +			    (but_prev->rnapoin.type == but->rnapoin.type) &&
 +			    (but_prev->rnapoin.data == but->rnapoin.data) &&
 +			    (but_prev->rnapoin.id.data == but->rnapoin.id.data)) == false)
 +			{
 +				/* TODO: could make this into utility function. */
 +				WM_msg_subscribe_rna(
 +				        mbus, &but->rnapoin, but->rnaprop,
 +				        &(const wmMsgSubscribeValue){
 +				            .owner = ar,
 +				            .user_data = ar,
 +				            .notify = ED_region_do_msg_notify_tag_redraw,
 +				        }, __func__);
 +				but_prev = but;
 +			}
 +		}
 +	}
 +}
  
 -	ui_draw_links(block);
 +void UI_region_message_subscribe(ARegion *ar, struct wmMsgBus *mbus)
 +{
 +	for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
 +		ui_block_message_subscribe(ar, mbus, block);
 +	}
  }
  
  /* ************* EVENTS ************* */
diff --cc source/blender/editors/interface/interface_anim.c
index 95a0f8704fa,5ed2713e5a7..ea1b58107bd
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@@ -240,11 -238,10 +240,11 @@@ void ui_but_anim_autokey(bContext *C, u
  	if (special) {
  		/* NLA Strip property */
  		if (IS_AUTOKEY_ON(scene)) {
 +			Depsgraph *depsgraph = CTX_data_depsgraph(C);
  			ReportList *reports = CTX_wm_reports(C);
  			ToolSettings *ts = scene->toolsettings;
- 			
+ 
 -			insert_keyframe_direct(reports, but->rnapoin, but->rnaprop, fcu, cfra, ts->keyframe_type, 0);
 +			insert_keyframe_direct(depsgraph, reports, but->rnapoin, but->rnaprop, fcu, cfra, ts->keyframe_type, 0);
  			WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
  		}
  	}
@@@ -253,20 -250,18 +253,20 @@@
  		 * making it easier to set up corrective drivers
  		 */
  		if (IS_AUTOKEY_ON(scene)) {
 +			Depsgraph *depsgraph = CTX_data_depsgraph(C);
  			ReportList *reports = CTX_wm_reports(C);
  			ToolSettings *ts = scene->toolsettings;
- 			
+ 
 -			insert_keyframe_direct(reports, but->rnapoin, but->rnaprop, fcu, cfra, ts->keyframe_type, INSERTKEY_DRIVER);
 +			insert_keyframe_direct(depsgraph, reports, but->rnapoin, but->rnaprop, fcu, cfra, ts->keyframe_type, INSERTKEY_DRIVER);
  			WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
  		}
  	}
  	else {
  		id = but->rnapoin.id.data;
- 		
+ 
  		/* TODO: this should probably respect the keyingset only option for anim */
  		if (autokeyframe_cfra_can_key(scene, id)) {
 +			Depsgraph *depsgraph = CTX_data_depsgraph(C);
  			ReportList *reports = CTX_wm_reports(C);
  			ToolSettings *ts = scene->toolsettings;
  			short flag = ANIM_get_keyframing_flags(scene, 1);
@@@ -277,10 -272,9 +277,10 @@@
  			 *       because a button may control all items of an array at once.
  			 *       E.g., color wheels (see T42567). */
  			BLI_assert((fcu->array_index == but->rnaindex) || (but->rnaindex == -1));
 -			insert_keyframe(reports, id, action, ((fcu->grp) ? (fcu->grp->name) : (NULL)),
 +			insert_keyframe(depsgraph, reports, id, action,
 +			                ((fcu->grp) ? (fcu->grp->name) : (NULL)),
  			                fcu->rna_path, but->rnaindex, cfra, ts->keyframe_type, flag);
- 			
+ 
  			WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
  		}
  	}
diff --cc source/blender/editors/interface/interface_draw.c
index ce22dac9e91,17dc9710756..f093f47519c
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@@ -163,101 -90,68 +163,101 @@@ void UI_draw_roundbox_4fv(bool filled, 
  		mul_v2_fl(vec[a], rad);
  	}
  
 -	glBegin(mode);
 +	unsigned int vert_ct = 0;
 +	vert_ct += (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 9 : 1;
 +	vert_ct += (roundboxtype & UI_CNR_TOP_RIGHT) ? 9 : 1;
 +	vert_ct += (roundboxtype & UI_CNR_TOP_LEFT) ? 9 : 1;
 +	vert_ct += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 9 : 1;
 +
 +	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
 +	immUniformColor4fv(col);
  
 +	immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, vert_ct);
  	/* start with corner right-bottom */
  	if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
 -		glVertex2f(maxx - rad, miny);
 +		immVertex2f(pos, maxx - rad, miny);
  		for (a = 0; a < 7; a++) {
 -			glVertex2f(maxx - rad + vec[a][0], miny + vec[a][1]);
 +			immVertex2f(pos, maxx - rad + vec[a][0], miny + vec[a][1]);
  		}
 -		glVertex2f(maxx, miny + rad);
 +		immVertex2f(pos, maxx, miny + rad);
  	}
  	else {
 -		glVertex2f(maxx, miny);
 +		immVertex2f(pos, maxx, miny);
  	}
- 	
+ 
  	/* corner right-top */
  	if (roundboxtype & UI_CNR_TOP_RIGHT) {
 -		glVertex2f(maxx, maxy - rad);
 +		immVertex2f(pos, maxx, maxy - rad);
  		for (a = 0; a < 7; a++) {
 -			glVertex2f(maxx - vec[a][1], maxy - rad + vec[a][0]);
 +			immVertex2f(pos, maxx - vec[a][1], maxy - rad + vec[a][0]);
  		}
 -		glVertex2f(maxx - rad, maxy);
 +		immVertex2f(pos, maxx - rad, maxy);
  	}
  	else {
 -		glVertex2f(maxx, maxy);
 +		immVertex2f(pos, maxx, maxy);
  	}
- 	
+ 
  	/* corner left-top */
  	if (roundboxtype & UI_CNR_TOP_LEFT) {
 -		glVertex2f(minx + rad, maxy);
 +		immVertex2f(pos, minx + rad, maxy);
  		for (a = 0; a < 7; a++) {
 -			glVertex2f(minx + rad - vec[a][0], maxy - vec[a][1]);
 +			immVertex2f(pos, minx + rad - vec[a][0], maxy - vec[a][1]);
  		}
 -		glVertex2f(minx, maxy - rad);
 +		immVertex2f(pos, minx, maxy - rad);
  	}
  	else {
 -		glVertex2f(minx, maxy);
 +		immVertex2f(pos, minx, maxy);
  	}
- 	
+ 
  	/* corner left-bottom */
  	if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
 -		glVertex2f(minx, miny + rad);
 +		immVertex2f(pos, minx, miny + rad);
  		for (a = 0; a < 7; a++) {
 -			glVertex2f(minx + vec[a][1], miny + rad - vec[a][0]);
 +			immVertex2f(pos, minx + vec[a][1], miny + rad - vec[a][0]);
  		}
 -		glVertex2f(minx + rad, miny);
 +		immVertex2f(pos, minx + rad, miny);
  	}
  	else {
 -		glVertex2f(minx, miny);
 +		immVertex2f(pos, minx, miny);
  	}
- 	
+ 
 -	glEnd();
 +	immEnd();
 +	immUnbindProgram();
 +#endif
 +
 +	uiWidgetBaseParameters widget_params = {
 +		.recti.xmin = minx, .recti.ymin = miny,
 +		.recti.xmax = maxx, .recti.ymax = maxy,
 +		.radi = rad,
 +		.round_corners[0] = (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 1.0f : 0.0f,
 +		.round_corners[1] = (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 1.0f : 0.0f,
 +		.round_corners[2] = (roundboxtype & UI_CNR_TOP_RIGHT) ? 1.0f : 0.0f,
 +		.round_corners[3] = (roundboxtype & UI_CNR_TOP_LEFT) ? 1.0f : 0.0f,
 +		.color_inner1[0] = col[0], .color_inner2[0] = col[0],
 +		.color_inner1[1] = col[1], .color_inner2[1] = col[1],
 +		.color_inner1[2] = col[2], .color_inner2[2] = col[2],
 +		.color_inner1[3] = col[3], .color_inner2[3] = col[3],
 +		.alpha_discard = 1.0f,
 +	};
 +
 +	Gwn_Batch *batch = ui_batch_roundbox

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list