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

Campbell Barton noreply at git.blender.org
Fri Jan 19 07:27:44 CET 2018


Commit: 4444ea42f29c9b006fd20c9fb6de5787ad98f30f
Author: Campbell Barton
Date:   Fri Jan 19 17:31:10 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB4444ea42f29c9b006fd20c9fb6de5787ad98f30f

Merge branch 'master' into blender2.8

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



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

diff --cc source/blender/editors/include/ED_screen.h
index 89a6828a59d,755aedf946d..942292788fc
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@@ -125,14 -98,17 +125,16 @@@ int     ED_area_headersize(void)
  
  /* screens */
  void    ED_screens_initialize(struct wmWindowManager *wm);
- void    ED_screen_draw(struct wmWindow *win);
+ void    ED_screen_draw_edges(struct wmWindow *win);
+ void    ED_screen_draw_join_shape(struct ScrArea *sa1, struct ScrArea *sa2);
+ void    ED_screen_draw_split_preview(struct ScrArea *sa, const int dir, const float fac);
  void    ED_screen_refresh(struct wmWindowManager *wm, struct wmWindow *win);
  void    ED_screen_do_listen(struct bContext *C, struct wmNotifier *note);
 -bScreen *ED_screen_duplicate(struct wmWindow *win, struct bScreen *sc);
 -bScreen *ED_screen_add(struct wmWindow *win, struct Scene *scene, const char *name);
 -bool    ED_screen_set(struct bContext *C, struct bScreen *sc);
 -bool    ED_screen_delete(struct bContext *C, struct bScreen *sc);
 -void    ED_screen_set_scene(struct bContext *C, struct bScreen *screen, struct Scene *scene);
 -bool    ED_screen_delete_scene(struct bContext *C, struct Scene *scene);
 +bool    ED_screen_change(struct bContext *C, struct bScreen *sc);
 +void    ED_screen_update_after_scene_change(
 +        const struct bScreen *screen,
 +        struct Scene *scene_new,
 +        struct ViewLayer *view_layer);
  void    ED_screen_set_subwinactive(struct bContext *C, const struct wmEvent *event);
  void    ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen);
  void    ED_screen_animation_timer(struct bContext *C, int redraws, int refresh, int sync, int enable);
diff --cc source/blender/editors/screen/screen_draw.c
index 91b2be27d84,00000000000..58dba662967
mode 100644,000000..100644
--- a/source/blender/editors/screen/screen_draw.c
+++ b/source/blender/editors/screen/screen_draw.c
@@@ -1,496 -1,0 +1,509 @@@
 +/*
 + * ***** BEGIN GPL LICENSE BLOCK *****
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
 + * as published by the Free Software Foundation; either version 2
 + * of the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software Foundation,
 + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 + *
 + * ***** END GPL LICENSE BLOCK *****
 + */
 +
 +/** \file blender/editors/screen/screen_draw.c
 + *  \ingroup edscr
 + */
 +
 +#include "ED_screen.h"
 +
 +#include "GPU_framebuffer.h"
 +#include "GPU_immediate.h"
 +#include "GPU_matrix.h"
 +
 +#include "WM_api.h"
 +#include "WM_types.h"
 +
 +#include "screen_intern.h"
 +
 +
 +/**
 + * Draw horizontal shape visualizing future joining (left as well right direction of future joining).
 + */
 +static void draw_horizontal_join_shape(ScrArea *sa, char dir, unsigned int pos)
 +{
 +	vec2f points[10];
 +	short i;
 +	float w, h;
 +	float width = sa->v3->vec.x - sa->v1->vec.x;
 +	float height = sa->v3->vec.y - sa->v1->vec.y;
 +
 +	if (height < width) {
 +		h = height / 8;
 +		w = height / 4;
 +	}
 +	else {
 +		h = width / 8;
 +		w = width / 4;
 +	}
 +
 +	points[0].x = sa->v1->vec.x;
 +	points[0].y = sa->v1->vec.y + height / 2;
 +
 +	points[1].x = sa->v1->vec.x;
 +	points[1].y = sa->v1->vec.y;
 +
 +	points[2].x = sa->v4->vec.x - w;
 +	points[2].y = sa->v4->vec.y;
 +
 +	points[3].x = sa->v4->vec.x - w;
 +	points[3].y = sa->v4->vec.y + height / 2 - 2 * h;
 +
 +	points[4].x = sa->v4->vec.x - 2 * w;
 +	points[4].y = sa->v4->vec.y + height / 2;
 +
 +	points[5].x = sa->v4->vec.x - w;
 +	points[5].y = sa->v4->vec.y + height / 2 + 2 * h;
 +
 +	points[6].x = sa->v3->vec.x - w;
 +	points[6].y = sa->v3->vec.y;
 +
 +	points[7].x = sa->v2->vec.x;
 +	points[7].y = sa->v2->vec.y;
 +
 +	points[8].x = sa->v4->vec.x;
 +	points[8].y = sa->v4->vec.y + height / 2 - h;
 +
 +	points[9].x = sa->v4->vec.x;
 +	points[9].y = sa->v4->vec.y + height / 2 + h;
 +
 +	if (dir == 'l') {
 +		/* when direction is left, then we flip direction of arrow */
 +		float cx = sa->v1->vec.x + width;
 +		for (i = 0; i < 10; i++) {
 +			points[i].x -= cx;
 +			points[i].x = -points[i].x;
 +			points[i].x += sa->v1->vec.x;
 +		}
 +	}
 +
 +	immBegin(GWN_PRIM_TRI_FAN, 5);
 +
 +	for (i = 0; i < 5; i++) {
 +		immVertex2f(pos, points[i].x, points[i].y);
 +	}
 +
 +	immEnd();
 +
 +	immBegin(GWN_PRIM_TRI_FAN, 5);
 +
 +	for (i = 4; i < 8; i++) {
 +		immVertex2f(pos, points[i].x, points[i].y);
 +	}
 +
 +	immVertex2f(pos, points[0].x, points[0].y);
 +	immEnd();
 +
 +	immRectf(pos, points[2].x, points[2].y, points[8].x, points[8].y);
 +	immRectf(pos, points[6].x, points[6].y, points[9].x, points[9].y);
 +}
 +
 +/**
 + * Draw vertical shape visualizing future joining (up/down direction).
 + */
 +static void draw_vertical_join_shape(ScrArea *sa, char dir, unsigned int pos)
 +{
 +	vec2f points[10];
 +	short i;
 +	float w, h;
 +	float width = sa->v3->vec.x - sa->v1->vec.x;
 +	float height = sa->v3->vec.y - sa->v1->vec.y;
 +
 +	if (height < width) {
 +		h = height / 4;
 +		w = height / 8;
 +	}
 +	else {
 +		h = width / 4;
 +		w = width / 8;
 +	}
 +
 +	points[0].x = sa->v1->vec.x + width / 2;
 +	points[0].y = sa->v3->vec.y;
 +
 +	points[1].x = sa->v2->vec.x;
 +	points[1].y = sa->v2->vec.y;
 +
 +	points[2].x = sa->v1->vec.x;
 +	points[2].y = sa->v1->vec.y + h;
 +
 +	points[3].x = sa->v1->vec.x + width / 2 - 2 * w;
 +	points[3].y = sa->v1->vec.y + h;
 +
 +	points[4].x = sa->v1->vec.x + width / 2;
 +	points[4].y = sa->v1->vec.y + 2 * h;
 +
 +	points[5].x = sa->v1->vec.x + width / 2 + 2 * w;
 +	points[5].y = sa->v1->vec.y + h;
 +
 +	points[6].x = sa->v4->vec.x;
 +	points[6].y = sa->v4->vec.y + h;
 +
 +	points[7].x = sa->v3->vec.x;
 +	points[7].y = sa->v3->vec.y;
 +
 +	points[8].x = sa->v1->vec.x + width / 2 - w;
 +	points[8].y = sa->v1->vec.y;
 +
 +	points[9].x = sa->v1->vec.x + width / 2 + w;
 +	points[9].y = sa->v1->vec.y;
 +
 +	if (dir == 'u') {
 +		/* when direction is up, then we flip direction of arrow */
 +		float cy = sa->v1->vec.y + height;
 +		for (i = 0; i < 10; i++) {
 +			points[i].y -= cy;
 +			points[i].y = -points[i].y;
 +			points[i].y += sa->v1->vec.y;
 +		}
 +	}
 +
 +	immBegin(GWN_PRIM_TRI_FAN, 5);
 +
 +	for (i = 0; i < 5; i++) {
 +		immVertex2f(pos, points[i].x, points[i].y);
 +	}
 +
 +	immEnd();
 +
 +	immBegin(GWN_PRIM_TRI_FAN, 5);
 +
 +	for (i = 4; i < 8; i++) {
 +		immVertex2f(pos, points[i].x, points[i].y);
 +	}
 +
 +	immVertex2f(pos, points[0].x, points[0].y);
 +	immEnd();
 +
 +	immRectf(pos, points[2].x, points[2].y, points[8].x, points[8].y);
 +	immRectf(pos, points[6].x, points[6].y, points[9].x, points[9].y);
 +}
 +
 +/**
 + * Draw join shape due to direction of joining.
 + */
 +static void draw_join_shape(ScrArea *sa, char dir, unsigned int pos)
 +{
 +	if (dir == 'u' || dir == 'd') {
 +		draw_vertical_join_shape(sa, dir, pos);
 +	}
 +	else {
 +		draw_horizontal_join_shape(sa, dir, pos);
 +	}
 +}
 +
 +/**
 + * Draw screen area darker with arrow (visualization of future joining).
 + */
 +static void scrarea_draw_shape_dark(ScrArea *sa, char dir, unsigned int pos)
 +{
 +	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 +	immUniformColor4ub(0, 0, 0, 50);
 +
 +	draw_join_shape(sa, dir, pos);
 +}
 +
 +/**
 + * Draw screen area ligher with arrow shape ("eraser" of previous dark shape).
 + */
 +static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir), unsigned int pos)
 +{
 +	glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA);
 +	/* value 181 was hardly computed: 181~105 */
 +	immUniformColor4ub(255, 255, 255, 50);
 +	/* draw_join_shape(sa, dir); */
 +
 +	immRectf(pos, sa->v1->vec.x, sa->v1->vec.y, sa->v3->vec.x, sa->v3->vec.y);
 +}
 +
 +static void drawscredge_area_draw(int sizex, int sizey, short x1, short y1, short x2, short y2, unsigned int pos)
 +{
 +	int count = 0;
 +
 +	if (x2 < sizex - 1) count += 2;
 +	if (x1 > 0) count += 2;
 +	if (y2 < sizey - 1) count += 2;
 +	if (y1 > 0) count += 2;
 +
 +	if (count == 0) {
 +		return;
 +	}
 +
 +	immBegin(GWN_PRIM_LINES, count);
 +
 +	/* right border area */
 +	if (x2 < sizex - 1) {
 +		immVertex2f(pos, x2, y1);
 +		immVertex2f(pos, x2, y2);
 +	}
 +
 +	/* left border area */
 +	if (x1 > 0) { /* otherwise it draws the emboss of window over */
 +		immVertex2f(pos, x1, y1);
 +		immVertex2f(pos, x1, y2);
 +	}
 +
 +	/* top border area */
 +	if (y2 < sizey - 1) {
 +		immVertex2f(pos, x1, y2);
 +		immVertex2f(pos, x2, y2);
 +	}
 +
 +	/* bottom border area */
 +	if (y1 > 0) {
 +		immVertex2f(pos, x1, y1);
 +		immVertex2f(pos, x2, y1);
 +	}
 +
 +	immEnd();
 +}
 +
 +/**
 + * \brief Screen edges drawing.
 + */
 +static void drawscredge_area(ScrArea *sa, int sizex, int sizey, unsigned int pos)
 +{
 +	short x1 = sa->v1->vec.x;
 +	short y1 = sa->v1->vec.y;
 +	short x2 = sa->v3->vec.x;
 +	short y2 = sa->v3->vec.y;
 +
 +	drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, pos);
 +}
 +
 +/**
 + * Only for edge lines between areas, and the blended join arrows.
 + */
- void ED_screen_draw(wmWindow *win)
++void ED_screen_draw_edges(wmWindow *win)
 +{
 +	bScreen *screen = WM_window_get_active_screen(win);
 +	const int winsize_x = WM_window_pixels_x(win);
 +	const int winsize_y = WM_window_pixels_y(win);
 +
 +	ScrArea *sa;
- 	ScrArea *sa1 = NULL;
- 	ScrArea *sa2 = NULL;
- 	ScrArea *sa3 = NULL;
 +
 +	wmSubWindowSet(win, screen->mainwin);
 +
 +	unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
 +	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
 +
 +	/* Note: first loop only draws if U.pixelsize > 1, skip otherwise */
 +	if (U.pixelsize > 1.0f) {
 +		/* FIXME: doesn't our glLineWidth already scale by U.pixelsize? */
 +		glLineWidth((2.0f * U.pixelsize) - 1);
 +		immUniformColor3ub(0x50, 0x50, 0x50);
 +
 +		for (sa = screen->ar

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list