[Bf-blender-cvs] [5e81d993afa] blender2.8: Merge branch 'master' into blender2.8
Campbell Barton
noreply at git.blender.org
Mon Mar 19 18:14:28 CET 2018
Commit: 5e81d993afadc6b5d37410e91998395caf1d1281
Author: Campbell Barton
Date: Mon Mar 19 18:06:27 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB5e81d993afadc6b5d37410e91998395caf1d1281
Merge branch 'master' into blender2.8
===================================================================
===================================================================
diff --cc source/blender/blenkernel/CMakeLists.txt
index 3f6bb5b9954,231810aee31..f36a9e99a64
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@@ -103,9 -101,10 +103,10 @@@ set(SR
intern/displist.c
intern/dynamicpaint.c
intern/editderivedmesh.c
+ intern/editlattice.c
intern/editmesh.c
intern/editmesh_bvh.c
+ intern/editmesh_tangent.c
intern/effect.c
intern/fcurve.c
intern/fluidsim.c
@@@ -236,11 -228,12 +237,12 @@@
BKE_customdata_file.h
BKE_data_transfer.h
BKE_deform.h
- BKE_depsgraph.h
BKE_displist.h
BKE_dynamicpaint.h
+ BKE_editlattice.h
BKE_editmesh.h
BKE_editmesh_bvh.h
+ BKE_editmesh_tangent.h
BKE_effect.h
BKE_fcurve.h
BKE_fluidsim.h
diff --cc source/blender/editors/CMakeLists.txt
index 757fca0a1b2,be8829b0418..c7ce4b44803
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@@ -29,7 -29,7 +29,8 @@@ if(WITH_BLENDER
add_subdirectory(gpencil)
add_subdirectory(interface)
add_subdirectory(io)
+ add_subdirectory(lattice)
+ add_subdirectory(manipulator_library)
add_subdirectory(mask)
add_subdirectory(mesh)
add_subdirectory(metaball)
diff --cc source/blender/editors/include/ED_object.h
index bf29aba34f8,5b2fdf29dd5..a116cf5e5d0
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@@ -203,40 -192,11 +203,32 @@@ void ED_object_constraint_dependency_up
void ED_object_constraint_tag_update(struct Object *ob, struct bConstraint *con);
void ED_object_constraint_dependency_tag_update(struct Main *bmain, struct Object *ob, struct bConstraint *con);
- /* object_lattice.c */
- bool ED_lattice_select_pick(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
- void undo_push_lattice(struct bContext *C, const char *name);
-
- /* object_lattice.c */
-
- void ED_lattice_flags_set(struct Object *obedit, int flag);
-
/* object_modes.c */
bool ED_object_mode_compat_test(const struct Object *ob, eObjectMode mode);
-bool ED_object_mode_compat_set(struct bContext *C, struct Object *ob, eObjectMode mode, struct ReportList *reports);
+bool ED_object_mode_compat_set(struct bContext *C, struct WorkSpace *workspace, eObjectMode mode, struct ReportList *reports);
void ED_object_mode_toggle(struct bContext *C, eObjectMode mode);
+bool ED_object_mode_generic_enter(
+ struct bContext *C,
+ eObjectMode object_mode);
+void ED_object_mode_generic_exit(
+ const struct EvaluationContext *eval_ctx,
+ struct WorkSpace *workspace, struct Scene *scene, struct Object *ob);
+bool ED_object_mode_generic_has_data(
+ const struct EvaluationContext *eval_ctx,
+ struct Object *ob);
+
+bool ED_object_mode_generic_enter_or_other_window(
+ struct bContext *C, const struct wmWindow *win_compare,
+ eObjectMode object_mode);
+void ED_object_mode_generic_exit_or_other_window(
+ const struct EvaluationContext *eval_ctx, struct wmWindowManager *wm,
+ struct WorkSpace *workspace, struct Scene *scene, struct Object *ob);
+
+bool ED_object_mode_generic_exists(
+ struct wmWindowManager *wm, struct Object *ob,
+ eObjectMode object_mode);
+
/* object_modifier.c */
enum {
MODIFIER_APPLY_DATA = 1,
diff --cc source/blender/editors/lattice/editlattice_tools.c
index 00000000000,c39ba44c1dc..bf60c1e7da6
mode 000000,100644..100644
--- a/source/blender/editors/lattice/editlattice_tools.c
+++ b/source/blender/editors/lattice/editlattice_tools.c
@@@ -1,0 -1,340 +1,341 @@@
+ /*
+ * ***** 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) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+ /** \file blender/editors/lattice/editlattice_tools.c
+ * \ingroup edlattice
+ */
+
+ #include "BLI_math.h"
+ #include "BLI_utildefines.h"
+
+ #include "DNA_curve_types.h"
+ #include "DNA_lattice_types.h"
+ #include "DNA_object_types.h"
+ #include "DNA_scene_types.h"
+
+ #include "RNA_access.h"
+ #include "RNA_define.h"
+
+ #include "BKE_context.h"
-#include "BKE_depsgraph.h"
+ #include "BKE_lattice.h"
+
++#include "DEG_depsgraph.h"
++
+ #include "ED_screen.h"
+
+ #include "WM_api.h"
+ #include "WM_types.h"
+
+ #include "lattice_intern.h"
+
+ /** \} */
+
+ /* -------------------------------------------------------------------- */
+ /** \name Make Regular Operator
+ * \{ */
+
+ static int make_regular_poll(bContext *C)
+ {
+ Object *ob;
+
+ if (ED_operator_editlattice(C)) return 1;
+
+ ob = CTX_data_active_object(C);
+ return (ob && ob->type == OB_LATTICE);
+ }
+
+ static int make_regular_exec(bContext *C, wmOperator *UNUSED(op))
+ {
+ Object *ob = CTX_data_edit_object(C);
+ Lattice *lt;
+
+ if (ob) {
+ lt = ob->data;
+ BKE_lattice_resize(lt->editlatt->latt, lt->pntsu, lt->pntsv, lt->pntsw, NULL);
+ }
+ else {
+ ob = CTX_data_active_object(C);
+ lt = ob->data;
+ BKE_lattice_resize(lt, lt->pntsu, lt->pntsv, lt->pntsw, NULL);
+ }
+
- DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
++ DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
+
+ return OPERATOR_FINISHED;
+ }
+
+ void LATTICE_OT_make_regular(wmOperatorType *ot)
+ {
+ /* identifiers */
+ ot->name = "Make Regular";
+ ot->description = "Set UVW control points a uniform distance apart";
+ ot->idname = "LATTICE_OT_make_regular";
+
+ /* api callbacks */
+ ot->exec = make_regular_exec;
+ ot->poll = make_regular_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ }
+
+ /** \} */
+
+ /* -------------------------------------------------------------------- */
+ /** \name Flip Verts Operator
+ * \{ */
+
+ /* flipping options */
+ typedef enum eLattice_FlipAxes {
+ LATTICE_FLIP_U = 0,
+ LATTICE_FLIP_V = 1,
+ LATTICE_FLIP_W = 2
+ } eLattice_FlipAxes;
+
+ /**
+ * Flip midpoint value so that relative distances between midpoint and neighbor-pair is maintained
+ * ! Assumes that uvw <=> xyz (i.e. axis-aligned index-axes with coordinate-axes)
+ * - Helper for lattice_flip_exec()
+ */
+ static void lattice_flip_point_value(Lattice *lt, int u, int v, int w, float mid, eLattice_FlipAxes axis)
+ {
+ BPoint *bp;
+ float diff;
+
+ /* just the point in the middle (unpaired) */
+ bp = <->def[BKE_lattice_index_from_uvw(lt, u, v, w)];
+
+ /* flip over axis */
+ diff = mid - bp->vec[axis];
+ bp->vec[axis] = mid + diff;
+ }
+
+ /**
+ * Swap pairs of lattice points along a specified axis
+ * - Helper for lattice_flip_exec()
+ */
+ static void lattice_swap_point_pairs(Lattice *lt, int u, int v, int w, float mid, eLattice_FlipAxes axis)
+ {
+ BPoint *bpA, *bpB;
+
+ int numU = lt->pntsu;
+ int numV = lt->pntsv;
+ int numW = lt->pntsw;
+
+ int u0 = u, u1 = u;
+ int v0 = v, v1 = v;
+ int w0 = w, w1 = w;
+
+ /* get pair index by just overriding the relevant pair-value
+ * - "-1" else buffer overflow
+ */
+ switch (axis) {
+ case LATTICE_FLIP_U:
+ u1 = numU - u - 1;
+ break;
+ case LATTICE_FLIP_V:
+ v1 = numV - v - 1;
+ break;
+ case LATTICE_FLIP_W:
+ w1 = numW - w - 1;
+ break;
+ }
+
+ /* get points to operate on */
+ bpA = <->def[BKE_lattice_index_from_uvw(lt, u0, v0, w0)];
+ bpB = <->def[BKE_lattice_index_from_uvw(lt, u1, v1, w1)];
+
+ /* Swap all coordinates, so that flipped coordinates belong to
+ * the indices on the correct side of the lattice.
+ *
+ * Coords: (-2 4) |0| (3 4) --> (3 4) |0| (-2 4)
+ * Indices: (0,L) (1,R) --> (0,L) (1,R)
+ */
+ swap_v3_v3(bpA->vec, bpB->vec);
+
+ /* However, we need to mirror the coordinate values on the axis we're dealing with,
+ * otherwise we'd have effectively only rotated the points around. If we don't do this,
+ * we'd just be reimplementing the naive mirroring algorithm, which causes unwanted deforms
+ * such as flipped normals, etc.
+ *
+ * Coords: (3 4) |0| (-2 4) --\
+ * \-> (-3 4) |0| (2 4)
+ * Indices: (0,L) (1,R) --> (0,L) (1,R)
+ */
+ lattice_flip_point_value(lt, u0, v0, w0, mid, axis);
+ lattice_flip_point_value(lt, u1, v1, w1, mid, axis);
+ }
+
+ static int lattice_flip_exec(bContext *C, wmOperator *op)
+ {
+ Object *obedit = CTX_data_edit_object(C);
+ Lattice *lt;
+
+ eLattice_FlipAxes axis = RNA_enum_get(op->ptr, "axis");
+ int numU, numV, numW;
+ int totP;
+
+ float mid = 0.0f;
+ short isOdd = 0;
+
+ /* get lattice - we need the "edit lattice" from the lattice... confusing... */
+ lt = (Lattice *)obedit->data;
+ lt = lt->editlatt->latt;
+
+ numU = lt->pntsu;
+ numV = lt->pntsv;
+ numW = lt->pntsw;
+ totP = numU * numV * numW;
+
+ /* First Pass: determine midpoint - used for flipping center verts if there are odd number of points on axis */
+ switch (axis) {
+ case LATTICE_FLIP_U:
+ isOdd = numU & 1;
+ break;
+ case LATTICE_FLIP_V:
+ isOdd = numV & 1;
+ break;
+ case LATTICE_FLIP_W:
+ isOdd = numW & 1;
+ break;
+
+ default:
+ printf("lattice_flip(): Unknown flipping axis (%u)\n", axis);
+ return OPERATOR_CANCELLED;
+ }
+
+ if (isOdd) {
+ BPoint *bp;
+ float avgInv = 1.0f / (float)totP;
+ int i;
+
+ /* midpoint calculation - assuming that u/v/w are axis-aligned */
+ for (i = 0, bp
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list