[Bf-blender-cvs] [fa1198b104a] custom-manipulators: Merge branch 'blender2.8' into custom-manipulators

Campbell Barton noreply at git.blender.org
Fri Mar 31 07:49:08 CEST 2017


Commit: fa1198b104a1a29f26a96d2c014926be84b7aba0
Author: Campbell Barton
Date:   Fri Mar 31 16:49:38 2017 +1100
Branches: custom-manipulators
https://developer.blender.org/rBfa1198b104a1a29f26a96d2c014926be84b7aba0

Merge branch 'blender2.8' into custom-manipulators

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



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

diff --cc source/blender/editors/space_sequencer/sequencer_draw.c
index aa7835177af,cd2bdbd2891..94285e52003
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@@ -1305,9 -1289,15 +1290,15 @@@ void draw_image_seq(const bContext *C, 
  		}
  	}
  
- 	glColor4f(1.0, 1.0, 1.0, 1.0);
 -	if (draw_backdrop) {
 -		glMatrixMode(GL_PROJECTION);
 -		glPushMatrix();
 -		glLoadIdentity();
 -		glMatrixMode(GL_MODELVIEW);
 -		glPushMatrix();
 -		glLoadIdentity();
 -	}
++//	if (draw_backdrop) {
++//		glMatrixMode(GL_PROJECTION);
++//		glPushMatrix();
++//		glLoadIdentity();
++//		glMatrixMode(GL_MODELVIEW);
++//		glPushMatrix();
++//		glLoadIdentity();
++//	}
  
- 	GPU_basic_shader_bind(GPU_SHADER_TEXTURE_2D | GPU_SHADER_USE_COLOR);
  	glGenTextures(1, (GLuint *)&texid);
  
  	glBindTexture(GL_TEXTURE_2D, texid);
@@@ -1320,10 -1310,15 +1311,19 @@@
  	else
  		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, format, type, display_buffer);
  
 +	if (draw_overdrop) {
 +		UI_view2d_view_restore(C);
 +	}
- 	glBegin(GL_QUADS);
++
+ 	VertexFormat *imm_format = immVertexFormat();
+ 	unsigned int pos = add_attrib(imm_format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
+ 	unsigned int texCoord = add_attrib(imm_format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT);
+ 
+ 	immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
+ 	immUniform4f("color", 1.0f, 1.0f, 1.0f, 1.0f);
+ 	immUniform1i("image", GL_TEXTURE0);
+ 
+ 	immBegin(GL_QUADS, 4);
  
  	if (draw_overlay) {
  		if (sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) {
@@@ -1333,28 -1328,59 +1333,59 @@@
  			tot_clip.xmax = v2d->tot.xmin + (fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmax);
  			tot_clip.ymax = v2d->tot.ymin + (fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymax);
  
- 			glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmin, tot_clip.ymin);
- 			glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmin, tot_clip.ymax);
- 			glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmax, tot_clip.ymax);
- 			glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmax, tot_clip.ymin);
+ 			immAttrib2f(texCoord, scene->ed->over_border.xmin, scene->ed->over_border.ymin);
+ 			immVertex2f(pos, tot_clip.xmin, tot_clip.ymin);
+ 
+ 			immAttrib2f(texCoord, scene->ed->over_border.xmin, scene->ed->over_border.ymax);
+ 			immVertex2f(pos, tot_clip.xmin, tot_clip.ymax);
+ 
+ 			immAttrib2f(texCoord, scene->ed->over_border.xmax, scene->ed->over_border.ymax);
+ 			immVertex2f(pos, tot_clip.xmax, tot_clip.ymax);
+ 
+ 			immAttrib2f(texCoord, scene->ed->over_border.xmax, scene->ed->over_border.ymin);
+ 			immVertex2f(pos, tot_clip.xmax, tot_clip.ymin);
  		}
  		else if (sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE) {
- 			glTexCoord2f(0.0f, 0.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymin);
- 			glTexCoord2f(0.0f, 1.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymax);
- 			glTexCoord2f(1.0f, 1.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymax);
- 			glTexCoord2f(1.0f, 0.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymin);
+ 			immAttrib2f(texCoord, 0.0f, 0.0f);
+ 			immVertex2f(pos, v2d->tot.xmin, v2d->tot.ymin);
+ 
+ 			immAttrib2f(texCoord, 0.0f, 1.0f);
+ 			immVertex2f(pos, v2d->tot.xmin, v2d->tot.ymax);
+ 
+ 			immAttrib2f(texCoord, 1.0f, 1.0f);
+ 			immVertex2f(pos, v2d->tot.xmax, v2d->tot.ymax);
+ 
+ 			immAttrib2f(texCoord, 1.0f, 0.0f);
+ 			immVertex2f(pos, v2d->tot.xmax, v2d->tot.ymin);
  		}
  	}
 -	else if (draw_backdrop) {
 +	else if (draw_overdrop) {
- 		float imagex = (scene->r.size * scene->r.xsch) / 200.0f * sseq->overdrop_zoom;
- 		float imagey = (scene->r.size * scene->r.ysch) / 200.0f * sseq->overdrop_zoom;
- 		float xofs = BLI_rcti_size_x(&ar->winrct) / 2.0f + sseq->overdrop_offset[0];
- 		float yofs = BLI_rcti_size_y(&ar->winrct) / 2.0f + sseq->overdrop_offset[1];
+ 		float aspect;
+ 		float image_aspect = viewrect[0] / viewrect[1];
+ 		float imagex, imagey;
  
- 		glTexCoord2f(0.0f, 0.0f); glVertex2f(-imagex + xofs, -imagey + yofs);
- 		glTexCoord2f(0.0f, 1.0f); glVertex2f(-imagex + xofs, imagey + yofs);
- 		glTexCoord2f(1.0f, 1.0f); glVertex2f(imagex + xofs, imagey + yofs);
- 		glTexCoord2f(1.0f, 0.0f); glVertex2f(imagex + xofs, -imagey + yofs);
+ 		aspect = BLI_rcti_size_x(&ar->winrct) / (float)BLI_rcti_size_y(&ar->winrct);
+ 
+ 		if (aspect >= image_aspect) {
+ 			imagex = image_aspect / aspect;
+ 			imagey = 1.0f;
+ 		}
+ 		else {
+ 			imagex = 1.0f;
+ 			imagey = aspect / image_aspect;
+ 		}
+ 
+ 		immAttrib2f(texCoord, 0.0f, 0.0f);
+ 		immVertex2f(pos, -imagex, -imagey);
+ 
+ 		immAttrib2f(texCoord, 0.0f, 1.0f);
+ 		immVertex2f(pos, -imagex, imagey);
+ 
+ 		immAttrib2f(texCoord, 1.0f, 1.0f);
+ 		immVertex2f(pos, imagex, imagey);
+ 
+ 		immAttrib2f(texCoord, 1.0f, 0.0f);
+ 		immVertex2f(pos, imagex, -imagey);
  	}
  	else {
  		draw_metadata = ((sseq->flag & SEQ_SHOW_METADATA) != 0);
@@@ -1661,22 -1726,20 +1733,26 @@@ void draw_timeline_seq(const bContext *
  	/* overlap playhead */
  	if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) {
  		int cfra_over = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? scene->ed->over_cfra : scene->r.cfra + scene->ed->over_ofs;
- 		glColor3f(0.2, 0.2, 0.2);
- 		// glRectf(cfra_over, v2d->cur.ymin, scene->ed->over_ofs + scene->r.cfra + 1, v2d->cur.ymax);
  
- 		glBegin(GL_LINES);
- 		glVertex2f(cfra_over, v2d->cur.ymin);
- 		glVertex2f(cfra_over, v2d->cur.ymax);
- 		glEnd();
+ 		unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT);
+ 		immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+ 
+ 		immUniformColor3f(0.2, 0.2, 0.2);
+ 
+ 		immBegin(GL_LINES, 2);
+ 		immVertex2f(pos, cfra_over, v2d->cur.ymin);
+ 		immVertex2f(pos, cfra_over, v2d->cur.ymax);
+ 		immEnd();
  
+ 		immUnbindProgram();
  	}
  
 +	if (sseq->draw_flag & SEQ_DRAW_OVERDROP) {
 +		draw_image_seq(C, scene, ar, sseq, scene->r.cfra, 0, false, true);
 +		UI_SetTheme(SPACE_SEQ, RGN_TYPE_WINDOW);
 +		UI_view2d_view_ortho(v2d);
 +	}
 +	
  	/* callback */
  	ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
  
diff --cc source/blender/editors/space_sequencer/sequencer_intern.h
index 6d125ad0ec6,7ce2f73cbef..6a766386465
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@@ -54,11 -54,8 +54,9 @@@ struct ARegion *sequencer_has_buttons_r
  
  /* sequencer_draw.c */
  void draw_timeline_seq(const struct bContext *C, struct ARegion *ar);
 -void draw_image_seq(const struct bContext *C, struct Scene *scene, struct  ARegion *ar, struct SpaceSeq *sseq, int cfra, int offset, bool draw_overlay, bool draw_backdrop);
 +void draw_image_seq(const struct bContext *C, struct Scene *scene, struct  ARegion *ar, struct SpaceSeq *sseq, int cfra, int offset, bool draw_overlay, bool draw_overdrop);
  void color3ubv_from_seq(struct Scene *curscene, struct Sequence *seq, unsigned char col[3]);
- void draw_shadedstrip(struct Sequence *seq, unsigned char col[3], float x1, float y1, float x2, float y2);
- void draw_sequence_extensions(struct Scene *scene, struct ARegion *ar, struct Sequence *seq);
 +void sequencer_display_size(struct Scene *scene, struct SpaceSeq *sseq, float r_viewrect[2]);
  
  void sequencer_special_update_set(Sequence *seq);




More information about the Bf-blender-cvs mailing list