[Bf-blender-cvs] [58adc586612] blender2.8: Merge branch 'master' into blender2.8
Brecht Van Lommel
noreply at git.blender.org
Thu Sep 27 15:51:02 CEST 2018
Commit: 58adc586612e695d04033f2029362f279a9c05a4
Author: Brecht Van Lommel
Date: Thu Sep 27 15:49:59 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB58adc586612e695d04033f2029362f279a9c05a4
Merge branch 'master' into blender2.8
===================================================================
===================================================================
diff --cc source/blender/editors/armature/pose_edit.c
index 876159c6167,f04106dac3a..5e5988bd69b
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@@ -193,37 -168,9 +193,37 @@@ static bool pose_has_protected_selected
*
* To be called from various tools that do incremental updates
*/
-void ED_pose_recalculate_paths(Main *bmain, Scene *scene, Object *ob)
+void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob, bool current_frame_only)
{
- /* Transform doesn't always have context avaialble to do update. */
++ /* Transform doesn't always have context available to do update. */
+ if (C == NULL) {
+ return;
+ }
+
+ Main *bmain = CTX_data_main(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
ListBase targets = {NULL, NULL};
+ bool free_depsgraph = false;
+
+ /* Override depsgraph with a filtered, simpler copy */
+ if (!current_frame_only && G.debug_value != -1) {
+ TIMEIT_START(filter_pose_depsgraph);
+ DEG_FilterQuery query = {0};
+
+ DEG_FilterTarget *dft_ob = MEM_callocN(sizeof(DEG_FilterTarget), "DEG_FilterTarget");
+ dft_ob->id = &ob->id;
+ BLI_addtail(&query.targets, dft_ob);
+
+ depsgraph = DEG_graph_filter(depsgraph, bmain, &query);
+ free_depsgraph = true;
+
+ MEM_freeN(dft_ob);
+ TIMEIT_END(filter_pose_depsgraph);
+
+ TIMEIT_START(filter_pose_update);
+ BKE_scene_graph_update_tagged(depsgraph, bmain);
+ TIMEIT_END(filter_pose_update);
+ }
/* set flag to force recalc, then grab the relevant bones to target */
ob->pose->avs.recalc |= ANIMVIZ_RECALC_PATHS;
diff --cc source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
index 1cff5b82484,00000000000..0646d689812
mode 100644,000000..100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
@@@ -1,1103 -1,0 +1,1103 @@@
+/*
+ * ***** 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_gizmo.c
+ * \ingroup edgizmolib
+ *
+ * \name Cage Gizmo
+ *
+ * 2D Gizmo
+ *
+ * \brief Rectangular gizmo acting as a 'cage' around its content.
+ * Interacting scales or translates the gizmo.
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math.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 "GPU_state.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_gizmo_library.h"
+
+/* own includes */
+#include "../gizmo_library_intern.h"
+
+#define GIZMO_RESIZER_SIZE 10.0f
+#define GIZMO_MARGIN_OFFSET_SCALE 1.5f
+
+static void gizmo_calc_rect_view_scale(
+ const wmGizmo *gz, 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];
+ WM_gizmo_calc_matrix_final_no_offset(gz, matrix_final_no_offset);
+ mul_v3_mat3_m4v3(x_axis, matrix_final_no_offset, gz->matrix_offset[0]);
+ mul_v3_mat3_m4v3(y_axis, matrix_final_no_offset, gz->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 gizmo_calc_rect_view_margin(
+ const wmGizmo *gz, const float dims[2], float margin[2])
+{
+ float handle_size;
+ if (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) {
+ handle_size = 0.15f;
+ }
+ else {
+ handle_size = GIZMO_RESIZER_SIZE;
+ }
+ handle_size *= gz->scale_final;
+ float scale_xy[2];
+ gizmo_calc_rect_view_scale(gz, dims, scale_xy);
+ margin[0] = ((handle_size * scale_xy[0]));
+ margin[1] = ((handle_size * scale_xy[1]));
+}
+
+/* -------------------------------------------------------------------- */
+
+static void gizmo_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_GIZMO_CAGE2D_PART_SCALE_MIN_X: { ARRAY_SET_ITEMS(r_pt, 0.5, 0.0); x = false; break; }
+ case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X: { ARRAY_SET_ITEMS(r_pt, -0.5, 0.0); x = false; break; }
+ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y: { ARRAY_SET_ITEMS(r_pt, 0.0, 0.5); y = false; break; }
+ case ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y: { ARRAY_SET_ITEMS(r_pt, 0.0, -0.5); y = false; break; }
+ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y: { ARRAY_SET_ITEMS(r_pt, 0.5, 0.5); x = y = false; break; }
+ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y: { ARRAY_SET_ITEMS(r_pt, 0.5, -0.5); x = y = false; break; }
+ case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y: { ARRAY_SET_ITEMS(r_pt, -0.5, 0.5); x = y = false; break; }
+ case ED_GIZMO_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_GIZMO_CAGE2D_STYLE_BOX
+ * \{ */
+
+static void cage2d_draw_box_corners(
+ const rctf *r, const float margin[2], const float color[3])
+{
+ uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+
+ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+ immUniformColor3fv(color);
+
+ immBegin(GPU_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;
+ GPUPrimType prim_type = GPU_PRIM_NONE;
+
+ switch (highlighted) {
+ case ED_GIZMO_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 = GPU_PRIM_TRI_FAN;
+ }
+ else {
+ prim_type = GPU_PRIM_LINE_STRIP;
+ }
+ break;
+ }
+ case ED_GIZMO_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 = GPU_PRIM_TRI_FAN;
+ }
+ else {
+ prim_type = GPU_PRIM_LINE_STRIP;
+ }
+ break;
+ }
+ case ED_GIZMO_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 = GPU_PRIM_TRI_FAN;
+ }
+ else {
+ prim_type = GPU_PRIM_LINE_STRIP;
+ }
+ break;
+ }
+ case ED_GIZMO_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 = GPU_PRIM_TRI_FAN;
+ }
+ else {
+ prim_type = GPU_PRIM_LINE_STRIP;
+ }
+ break;
+ }
+ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y:
+ {
+ rctf r = {
+ .xmin = -size[0], .xmax = -siz
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list