[Bf-blender-cvs] [31f8d054326] blender2.8: Merge branch 'master' into blender2.8
Campbell Barton
noreply at git.blender.org
Thu May 3 08:32:24 CEST 2018
Commit: 31f8d0543267d5c220dee769cd3b8c685a42aef6
Author: Campbell Barton
Date: Thu May 3 08:22:00 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB31f8d0543267d5c220dee769cd3b8c685a42aef6
Merge branch 'master' into blender2.8
===================================================================
===================================================================
diff --cc source/blender/editors/mesh/editmesh_extrude.c
index ce42723071e,9467c545bbf..950dc92d87c
--- a/source/blender/editors/mesh/editmesh_extrude.c
+++ b/source/blender/editors/mesh/editmesh_extrude.c
@@@ -35,9 -35,7 +35,8 @@@
#include "BLI_math.h"
#include "BLI_listbase.h"
+#include "BKE_layer.h"
#include "BKE_context.h"
- #include "BKE_object.h"
#include "BKE_report.h"
#include "BKE_editmesh.h"
@@@ -52,19 -49,8 +50,16 @@@
#include "ED_transform.h"
#include "ED_view3d.h"
- #include "UI_resources.h"
+
+#include "MEM_guardedalloc.h"
+
#include "mesh_intern.h" /* own include */
+#define USE_MANIPULATOR
+
+#ifdef USE_MANIPULATOR
- #include "ED_manipulator_library.h"
- #include "ED_undo.h"
+#endif
+
/* -------------------------------------------------------------------- */
/** \name Extrude Internal Utilities
* \{ */
@@@ -775,627 -723,4 +770,3 @@@ void MESH_OT_dupli_extrude_cursor(wmOpe
}
/** \} */
-
- /* -------------------------------------------------------------------- */
- /** \name Spin Operator
- * \{ */
-
- static int edbm_spin_exec(bContext *C, wmOperator *op)
- {
- Object *obedit = CTX_data_edit_object(C);
- BMEditMesh *em = BKE_editmesh_from_object(obedit);
- BMesh *bm = em->bm;
- BMOperator spinop;
- float cent[3], axis[3];
- float d[3] = {0.0f, 0.0f, 0.0f};
- int steps, dupli;
- float angle;
-
- RNA_float_get_array(op->ptr, "center", cent);
- RNA_float_get_array(op->ptr, "axis", axis);
- steps = RNA_int_get(op->ptr, "steps");
- angle = RNA_float_get(op->ptr, "angle");
- //if (ts->editbutflag & B_CLOCKWISE)
- angle = -angle;
- dupli = RNA_boolean_get(op->ptr, "dupli");
-
- if (is_zero_v3(axis)) {
- BKE_report(op->reports, RPT_ERROR, "Invalid/unset axis");
- return OPERATOR_CANCELLED;
- }
-
- /* keep the values in worldspace since we're passing the obmat */
- if (!EDBM_op_init(em, &spinop, op,
- "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f space=%m4 use_duplicate=%b",
- BM_ELEM_SELECT, cent, axis, d, steps, angle, obedit->obmat, dupli))
- {
- return OPERATOR_CANCELLED;
- }
- BMO_op_exec(bm, &spinop);
- EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "geom_last.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, true);
- if (!EDBM_op_finish(em, &spinop, op, true)) {
- return OPERATOR_CANCELLED;
- }
-
- EDBM_update_generic(em, true, true);
-
- return OPERATOR_FINISHED;
- }
-
- /* get center and axis, in global coords */
- static int edbm_spin_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
- {
- Scene *scene = CTX_data_scene(C);
- View3D *v3d = CTX_wm_view3d(C);
- RegionView3D *rv3d = ED_view3d_context_rv3d(C);
-
- PropertyRNA *prop;
- prop = RNA_struct_find_property(op->ptr, "center");
- if (!RNA_property_is_set(op->ptr, prop)) {
- RNA_property_float_set_array(op->ptr, prop, ED_view3d_cursor3d_get(scene, v3d));
- }
- if (rv3d) {
- prop = RNA_struct_find_property(op->ptr, "axis");
- if (!RNA_property_is_set(op->ptr, prop)) {
- RNA_property_float_set_array(op->ptr, prop, rv3d->viewinv[2]);
- }
- }
-
- int ret = edbm_spin_exec(C, op);
-
- #ifdef USE_MANIPULATOR
- if (ret & OPERATOR_FINISHED) {
- /* Setup manipulators */
- if (v3d && (v3d->twflag & V3D_MANIPULATOR_DRAW)) {
- WM_manipulator_group_type_ensure("MESH_WGT_spin");
- }
- }
- #endif
-
- return ret;
-
- }
-
- #ifdef USE_MANIPULATOR
- static void MESH_WGT_spin(struct wmManipulatorGroupType *wgt);
- #endif
-
- void MESH_OT_spin(wmOperatorType *ot)
- {
- PropertyRNA *prop;
-
- /* identifiers */
- ot->name = "Spin";
- ot->description = "Extrude selected vertices in a circle around the cursor in indicated viewport";
- ot->idname = "MESH_OT_spin";
-
- /* api callbacks */
- ot->invoke = edbm_spin_invoke;
- ot->exec = edbm_spin_exec;
- ot->poll = ED_operator_editmesh;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
- /* props */
- RNA_def_int(ot->srna, "steps", 9, 0, 1000000, "Steps", "Steps", 0, 1000);
- RNA_def_boolean(ot->srna, "dupli", 0, "Dupli", "Make Duplicates");
- prop = RNA_def_float(ot->srna, "angle", DEG2RADF(90.0f), -1e12f, 1e12f, "Angle", "Rotation for each step",
- DEG2RADF(-360.0f), DEG2RADF(360.0f));
- RNA_def_property_subtype(prop, PROP_ANGLE);
-
- RNA_def_float_vector(ot->srna, "center", 3, NULL, -1e12f, 1e12f,
- "Center", "Center in global view space", -1e4f, 1e4f);
- RNA_def_float_vector(ot->srna, "axis", 3, NULL, -1.0f, 1.0f, "Axis", "Axis in global view space", -1.0f, 1.0f);
-
- #ifdef USE_MANIPULATOR
- WM_manipulatorgrouptype_append(MESH_WGT_spin);
- #endif
- }
-
-
- #ifdef USE_MANIPULATOR
-
- /* -------------------------------------------------------------------- */
- /** \name Screw Operator
- * \{ */
-
- typedef struct ManipulatorSpinGroup {
- /* Arrow to change plane depth. */
- struct wmManipulator *translate_z;
- /* Translate XYZ */
- struct wmManipulator *translate_c;
- /* For grabbing the manipulator and moving freely. */
- struct wmManipulator *rotate_c;
- /* Spin angle */
- struct wmManipulator *angle_z;
-
- /* We could store more vars here! */
- struct {
- bContext *context;
- wmOperator *op;
- PropertyRNA *prop_axis_co;
- PropertyRNA *prop_axis_no;
- PropertyRNA *prop_angle;
-
- float rotate_axis[3];
- float rotate_up[3];
- } data;
- } ManipulatorSpinGroup;
-
- /**
- * XXX. calling redo from property updates is not great.
- * This is needed because changing the RNA doesn't cause a redo
- * and we're not using operator UI which does just this.
- */
- static void manipulator_spin_exec(ManipulatorSpinGroup *man)
- {
- wmOperator *op = man->data.op;
- if (op == WM_operator_last_redo((bContext *)man->data.context)) {
- ED_undo_operator_repeat((bContext *)man->data.context, op);
- }
- }
-
- static void manipulator_mesh_spin_update_from_op(ManipulatorSpinGroup *man)
- {
- wmOperator *op = man->data.op;
-
- float plane_co[3], plane_no[3];
-
- RNA_property_float_get_array(op->ptr, man->data.prop_axis_co, plane_co);
- RNA_property_float_get_array(op->ptr, man->data.prop_axis_no, plane_no);
-
- WM_manipulator_set_matrix_location(man->translate_z, plane_co);
- WM_manipulator_set_matrix_location(man->rotate_c, plane_co);
- WM_manipulator_set_matrix_location(man->angle_z, plane_co);
- /* translate_c location comes from the property. */
-
- WM_manipulator_set_matrix_rotation_from_z_axis(man->translate_z, plane_no);
- WM_manipulator_set_matrix_rotation_from_z_axis(man->angle_z, plane_no);
-
- WM_manipulator_set_scale(man->translate_c, 0.2);
-
- RegionView3D *rv3d = ED_view3d_context_rv3d(man->data.context);
- if (rv3d) {
- normalize_v3_v3(man->data.rotate_axis, rv3d->viewinv[2]);
- normalize_v3_v3(man->data.rotate_up, rv3d->viewinv[1]);
-
- /* ensure its orthogonal */
- project_plane_normalized_v3_v3v3(man->data.rotate_up, man->data.rotate_up, man->data.rotate_axis);
- normalize_v3(man->data.rotate_up);
-
- WM_manipulator_set_matrix_rotation_from_z_axis(man->translate_c, plane_no);
- WM_manipulator_set_matrix_rotation_from_yz_axis(man->rotate_c, plane_no, man->data.rotate_axis);
-
- /* show the axis instead of mouse cursor */
- RNA_enum_set(man->rotate_c->ptr, "draw_options",
- ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_MIRROR |
- ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_START_Y);
-
- }
- }
-
- /* depth callbacks */
- static void manipulator_spin_prop_depth_get(
- const wmManipulator *mpr, wmManipulatorProperty *mpr_prop,
- void *value_p)
- {
- ManipulatorSpinGroup *man = mpr->parent_mgroup->customdata;
- wmOperator *op = man->data.op;
- float *value = value_p;
-
- BLI_assert(mpr_prop->type->array_length == 1);
- UNUSED_VARS_NDEBUG(mpr_prop);
-
- float plane_co[3], plane_no[3];
- RNA_property_float_get_array(op->ptr, man->data.prop_axis_co, plane_co);
- RNA_property_float_get_array(op->ptr, man->data.prop_axis_no, plane_no);
-
- value[0] = dot_v3v3(plane_no, plane_co) - dot_v3v3(plane_no, mpr->matrix_basis[3]);
- }
-
- static void manipulator_spin_prop_depth_set(
- const wmManipulator *mpr, wmManipulatorProperty *mpr_prop,
- const void *value_p)
- {
- ManipulatorSpinGroup *man = mpr->parent_mgroup->customdata;
- wmOperator *op = man->data.op;
- const float *value = value_p;
-
- BLI_assert(mpr_prop->type->array_length == 1);
- UNUSED_VARS_NDEBUG(mpr_prop);
-
- float plane_co[3], plane[4];
- RNA_property_float_get_array(op->ptr, man->data.prop_axis_co, plane_co);
- RNA_property_float_get_array(op->ptr, man->data.prop_axis_no, plane);
- normalize_v3(plane);
-
- plane[3] = -value[0] - dot_v3v3(plane, mpr->matrix_basis[3]);
-
- /* Keep our location, may be offset simply to be inside the viewport. */
- closest_to_plane_normalized_v3(plane_co, plane, plane_co);
-
- RNA_property_float_set_array(op->ptr, man->data.prop_axis_co, plane_co);
-
- manipulator_spin_exec(man);
- }
-
- /* translate callbacks */
- static void manipulator_spin_prop_translate_get(
- const wmManipulator *mpr, wmManipulatorProperty *mpr_prop,
- void *value_p)
- {
- ManipulatorSpinGroup *man = mpr->parent_mgroup->customdata;
- wmOperator *op = man->data.op;
- float *value = value_p;
-
- BLI_assert(mpr_prop->type->array_length == 3);
- UNUSED_VARS_NDEBUG(mpr_prop);
-
- RNA_property_float_get_array(op->ptr, man->data.prop_axis_co, value);
- }
-
- static void manipulator_spin_prop_translate_set(
- const wmManipulator *mpr, wmManipulatorProperty *mpr_prop,
- const void *value)
- {
- ManipulatorSpinGroup *man = mpr->parent_mgroup->customdata;
- wmOperator *op = man->data.op;
-
- BLI_assert(mpr_prop->type->array_length == 3);
- UNUSED_VARS_NDEBUG(mpr_prop);
-
- RNA_property_float_set_array(op->ptr, man->data.prop_axis_co, value);
-
- manipulator_spin_exec(man);
- }
-
- /* angle callbacks */
- static void manipulator_spin_prop_axis_angle_get(
- const wmManipulator *mpr, wmManipulatorProperty *mpr_prop,
- void *value_p)
- {
- ManipulatorSpinGroup *man = mpr->parent
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list