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

Campbell Barton noreply at git.blender.org
Sun Feb 18 12:30:49 CET 2018


Commit: 2bc952fdb6e1474e9e568224a37bcf5cff874aaf
Author: Campbell Barton
Date:   Sun Feb 18 22:33:05 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB2bc952fdb6e1474e9e568224a37bcf5cff874aaf

Merge branch 'master' into blender2.8

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



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

diff --cc source/blender/blenlib/CMakeLists.txt
index 9e7b4ed8b6f,d137de58e17..ef36b5ac6bd
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@@ -157,11 -157,10 +158,11 @@@ set(SR
  	BLI_hash_md5.h
  	BLI_hash_mm2a.h
  	BLI_heap.h
 +	BLI_iterator.h
- 	BLI_jitter.h
+ 	BLI_jitter_2d.h
  	BLI_kdopbvh.h
  	BLI_kdtree.h
- 	BLI_lasso.h
+ 	BLI_lasso_2d.h
  	BLI_link_utils.h
  	BLI_linklist.h
  	BLI_linklist_stack.h
diff --cc source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c
index 0299a33d0fe,00000000000..23c6030f091
mode 100644,000000..100644
--- a/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c
@@@ -1,1109 -1,0 +1,1109 @@@
 +/*
 + * ***** 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.
 + *
 + * The Original Code is Copyright (C) 2014 Blender Foundation.
 + * All rights reserved.
 + *
 + * Contributor(s): Blender Foundation
 + *
 + * ***** END GPL LICENSE BLOCK *****
 + */
 +
 +/** \file cage2d_manipulator.c
 + *  \ingroup wm
 + *
 + * \name Cage Manipulator
 + *
 + * 2D Manipulator
 + *
 + * \brief Rectangular manipulator acting as a 'cage' around its content.
 + * Interacting scales or translates the manipulator.
 + */
 +
 +#include "MEM_guardedalloc.h"
 +
 +#include "BLI_math.h"
- #include "BLI_dial.h"
++#include "BLI_dial_2d.h"
 +#include "BLI_rect.h"
 +
 +#include "BKE_context.h"
 +
 +#include "BIF_gl.h"
 +
 +#include "GPU_matrix.h"
 +#include "GPU_shader.h"
 +#include "GPU_immediate.h"
 +#include "GPU_immediate_util.h"
 +#include "GPU_select.h"
 +
 +#include "RNA_access.h"
 +#include "RNA_define.h"
 +
 +#include "WM_api.h"
 +#include "WM_types.h"
 +
 +#include "ED_screen.h"
 +#include "ED_view3d.h"
 +#include "ED_manipulator_library.h"
 +
 +/* own includes */
 +#include "../manipulator_library_intern.h"
 +
 +#define MANIPULATOR_RESIZER_SIZE 10.0f
 +#define MANIPULATOR_MARGIN_OFFSET_SCALE 1.5f
 +
 +static void manipulator_calc_matrix_final_no_offset(
 +        const wmManipulator *mpr, float orig_matrix_final_no_offset[4][4])
 +{
 +	float mat_identity[4][4];
 +	struct WM_ManipulatorMatrixParams params = {NULL};
 +	unit_m4(mat_identity);
 +	params.matrix_offset = mat_identity;
 +	WM_manipulator_calc_matrix_final_params(mpr, &params, orig_matrix_final_no_offset);
 +}
 +
 +static void manipulator_calc_rect_view_scale(
 +        const wmManipulator *mpr, const float dims[2], float scale[2])
 +{
 +	float matrix_final_no_offset[4][4];
 +	float asp[2] = {1.0f, 1.0f};
 +	if (dims[0] > dims[1]) {
 +		asp[0] = dims[1] / dims[0];
 +	}
 +	else {
 +		asp[1] = dims[0] / dims[1];
 +	}
 +	float x_axis[3], y_axis[3];
 +	manipulator_calc_matrix_final_no_offset(mpr, matrix_final_no_offset);
 +	mul_v3_mat3_m4v3(x_axis, matrix_final_no_offset, mpr->matrix_offset[0]);
 +	mul_v3_mat3_m4v3(y_axis, matrix_final_no_offset, mpr->matrix_offset[1]);
 +
 +	mul_v2_v2(x_axis, asp);
 +	mul_v2_v2(y_axis, asp);
 +
 +	scale[0] = 1.0f / len_v3(x_axis);
 +	scale[1] = 1.0f / len_v3(y_axis);
 +}
 +
 +static void manipulator_calc_rect_view_margin(
 +        const wmManipulator *mpr, const float dims[2], float margin[2])
 +{
 +	float handle_size;
 +	if (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) {
 +		handle_size = 0.15f;
 +	}
 +	else {
 +		handle_size = MANIPULATOR_RESIZER_SIZE;
 +	}
 +	handle_size *= mpr->scale_final;
 +	float scale_xy[2];
 +	manipulator_calc_rect_view_scale(mpr, dims, scale_xy);
 +	margin[0] = ((handle_size * scale_xy[0]));
 +	margin[1] = ((handle_size * scale_xy[1]));
 +}
 +
 +/* -------------------------------------------------------------------- */
 +
 +static void manipulator_rect_pivot_from_scale_part(int part, float r_pt[2], bool r_constrain_axis[2])
 +{
 +	bool x = true, y = true;
 +	switch (part) {
 +		case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X: { ARRAY_SET_ITEMS(r_pt,  0.5,  0.0); x = false; break; }
 +		case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X: { ARRAY_SET_ITEMS(r_pt, -0.5,  0.0); x = false; break; }
 +		case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_Y: { ARRAY_SET_ITEMS(r_pt,  0.0,  0.5); y = false; break; }
 +		case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_Y: { ARRAY_SET_ITEMS(r_pt,  0.0, -0.5); y = false; break; }
 +		case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MIN_Y: { ARRAY_SET_ITEMS(r_pt,  0.5,  0.5); x = y = false; break; }
 +		case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MAX_Y: { ARRAY_SET_ITEMS(r_pt,  0.5, -0.5); x = y = false; break; }
 +		case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MIN_Y: { ARRAY_SET_ITEMS(r_pt, -0.5,  0.5); x = y = false; break; }
 +		case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MAX_Y: { ARRAY_SET_ITEMS(r_pt, -0.5, -0.5); x = y = false; break; }
 +		default: BLI_assert(0);
 +	}
 +	r_constrain_axis[0] = x;
 +	r_constrain_axis[1] = y;
 +}
 +
 +/* -------------------------------------------------------------------- */
 +/** \name Box Draw Style
 + *
 + * Useful for 3D views, see: #ED_MANIPULATOR_CAGE2D_STYLE_BOX
 + * \{ */
 +
 +static void cage2d_draw_box_corners(
 +        const rctf *r, const float margin[2], const float color[3])
 +{
 +	uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
 +
 +	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
 +	immUniformColor3fv(color);
 +
 +	immBegin(GWN_PRIM_LINES, 16);
 +
 +	immVertex2f(pos, r->xmin, r->ymin + margin[1]);
 +	immVertex2f(pos, r->xmin, r->ymin);
 +	immVertex2f(pos, r->xmin, r->ymin);
 +	immVertex2f(pos, r->xmin + margin[0], r->ymin);
 +
 +	immVertex2f(pos, r->xmax, r->ymin + margin[1]);
 +	immVertex2f(pos, r->xmax, r->ymin);
 +	immVertex2f(pos, r->xmax, r->ymin);
 +	immVertex2f(pos, r->xmax - margin[0], r->ymin);
 +
 +	immVertex2f(pos, r->xmax, r->ymax - margin[1]);
 +	immVertex2f(pos, r->xmax, r->ymax);
 +	immVertex2f(pos, r->xmax, r->ymax);
 +	immVertex2f(pos, r->xmax - margin[0], r->ymax);
 +
 +	immVertex2f(pos, r->xmin, r->ymax - margin[1]);
 +	immVertex2f(pos, r->xmin, r->ymax);
 +	immVertex2f(pos, r->xmin, r->ymax);
 +	immVertex2f(pos, r->xmin + margin[0], r->ymax);
 +
 +	immEnd();
 +
 +	immUnbindProgram();
 +}
 +
 +static void cage2d_draw_box_interaction(
 +        const float color[4], const int highlighted,
 +        const float size[2], const float margin[2],
 +        const float line_width, const bool is_solid, const int draw_options)
 +{
 +	/* 4 verts for translate, otherwise only 3 are used. */
 +	float verts[4][2];
 +	uint verts_len = 0;
 +	Gwn_PrimType prim_type = GWN_PRIM_NONE;
 +
 +	switch (highlighted) {
 +		case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X:
 +		{
 +			rctf r = {
 +				.xmin = -size[0], .xmax = -size[0] + margin[0],
 +				.ymin = -size[1] + margin[1], .ymax = size[1] - margin[1],
 +			};
 +			ARRAY_SET_ITEMS(verts[0], r.xmin, r.ymin);
 +			ARRAY_SET_ITEMS(verts[1], r.xmin, r.ymax);
 +			verts_len = 2;
 +			if (is_solid) {
 +				ARRAY_SET_ITEMS(verts[2], r.xmax, r.ymax);
 +				ARRAY_SET_ITEMS(verts[3], r.xmax, r.ymin);
 +				verts_len += 2;
 +				prim_type = GWN_PRIM_TRI_FAN;
 +			}
 +			else {
 +				prim_type = GWN_PRIM_LINE_STRIP;
 +			}
 +			break;
 +		}
 +		case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X:
 +		{
 +			rctf r = {
 +				.xmin = size[0] - margin[0], .xmax = size[0],
 +				.ymin = -size[1] + margin[1], .ymax = size[1] - margin[1],
 +			};
 +			ARRAY_SET_ITEMS(verts[0], r.xmax, r.ymin);
 +			ARRAY_SET_ITEMS(verts[1], r.xmax, r.ymax);
 +			verts_len = 2;
 +			if (is_solid) {
 +				ARRAY_SET_ITEMS(verts[2], r.xmin, r.ymax);
 +				ARRAY_SET_ITEMS(verts[3], r.xmin, r.ymin);
 +				verts_len += 2;
 +				prim_type = GWN_PRIM_TRI_FAN;
 +			}
 +			else {
 +				prim_type = GWN_PRIM_LINE_STRIP;
 +			}
 +			break;
 +		}
 +		case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_Y:
 +		{
 +			rctf r = {
 +				.xmin = -size[0] + margin[0], .xmax = size[0] - margin[0],
 +				.ymin = -size[1], .ymax = -size[1] + margin[1],
 +			};
 +			ARRAY_SET_ITEMS(verts[0], r.xmin, r.ymin);
 +			ARRAY_SET_ITEMS(verts[1], r.xmax, r.ymin);
 +			verts_len = 2;
 +			if (is_solid) {
 +				ARRAY_SET_ITEMS(verts[2], r.xmax, r.ymax);
 +				ARRAY_SET_ITEMS(verts[3], r.xmin, r.ymax);
 +				verts_len += 2;
 +				prim_type = GWN_PRIM_TRI_FAN;
 +			}
 +			else {
 +				prim_type = GWN_PRIM_LINE_STRIP;
 +			}
 +			break;
 +		}
 +		case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_Y:
 +		{
 +			rctf r = {
 +				.xmin = -size[0] + margin[0], .xmax = size[0] - margin[0],
 +				.ymin = size[1] - margin[1], .ymax = size[1],
 +			};
 +			ARRAY_SET_ITEMS(verts[0], r.xmin, r.ymax);
 +			ARRAY_SET_ITEMS(verts[1], r.xmax, r.ymax);
 +			verts_len = 2;
 +			if (is_solid) {
 +				ARRAY_SET_ITEMS(verts[2], r.xmax, r.ymin);
 +				ARRAY_SET_ITEMS(verts[3], r.xmin, r.ymin);
 +				verts_len += 2;
 +				prim_type = GWN_PRIM_TRI_FAN;
 +			}
 +			else {
 +				prim_type = GWN_PRIM_LINE_STRIP;
 +			}
 +			break;
 +		}
 +		case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MIN_Y:
 +		{
 +			rctf r = {
 +				.xmin = -size[0], .xmax = -size[0] + margin[0],
 +				.ymin = -size[1], .ymax = -size[1] + margin[1],
 +			};
 +			ARRAY_SET_ITEMS(verts[0], r.xmax, r.ymin);
 +			ARRAY_SET_ITEMS(verts[1], r.xmax, r.ymax);
 +			ARRAY_SET_ITEMS(verts[2], r.xmin, r.ymax);
 +			verts_len = 3;
 +			if (is_solid) {
 +				ARRAY_SET_ITEMS(verts[3], r.xmin, r.ymin);
 +				verts_len += 1;
 +				prim_type = GWN_PRIM_TRI_FAN;
 +			}
 +			else {
 +				prim_type = GWN_PRIM_LINE_STRIP;
 +			}
 +			break;
 +		}
 +		case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MAX_Y:
 +		{
 +			rctf r = {
 +				.xmin 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list