Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2019-09-10 20:55:15 +0300
committerPablo Dobarro <pablodp606@gmail.com>2019-09-11 14:07:19 +0300
commit309cd047ef46fcbd21b26b2509b40c55c5dab61e (patch)
treeec1873a13b391026bffc0110d84aafc855b648df /source/blender/editors/transform/transform_convert_sculpt.c
parentef18b672f5a57d86d264af0f875a37c6a9c6677a (diff)
Sculpt: Transform tool
The sculpt mode transform tool applies the sculpt pivot transformation to all vertices, taking XYZ symmetry into account. This commit also includes an operator to set the pivot point initial position. Reviewed By: brecht Differential Revision: https://developer.blender.org/D5717
Diffstat (limited to 'source/blender/editors/transform/transform_convert_sculpt.c')
-rw-r--r--source/blender/editors/transform/transform_convert_sculpt.c101
1 files changed, 101 insertions, 0 deletions
diff --git a/source/blender/editors/transform/transform_convert_sculpt.c b/source/blender/editors/transform/transform_convert_sculpt.c
new file mode 100644
index 00000000000..b02ad71da07
--- /dev/null
+++ b/source/blender/editors/transform/transform_convert_sculpt.c
@@ -0,0 +1,101 @@
+/*
+ * 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.
+ */
+
+/** \file
+ * \ingroup edtransform
+ */
+
+#include "DNA_space_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math.h"
+
+#include "BKE_context.h"
+#include "BKE_report.h"
+#include "BKE_scene.h"
+#include "BKE_paint.h"
+
+#include "transform.h"
+#include "transform_convert.h"
+
+/* -------------------------------------------------------------------- */
+/** \name Sculpt Transform Creation
+ *
+ * \{ */
+
+void createTransSculpt(TransInfo *t)
+{
+ TransData *td;
+
+ Scene *scene = t->scene;
+ if (ID_IS_LINKED(scene)) {
+ BKE_report(t->reports, RPT_ERROR, "Linked data can't text-space transform");
+ return;
+ }
+
+ Object *ob = CTX_data_active_object(t->context);
+ SculptSession *ss = ob->sculpt;
+
+ {
+ BLI_assert(t->data_container_len == 1);
+ TransDataContainer *tc = t->data_container;
+ tc->data_len = 1;
+ tc->is_active = 1;
+ td = tc->data = MEM_callocN(sizeof(TransData), "TransTexspace");
+ td->ext = tc->data_ext = MEM_callocN(sizeof(TransDataExtension), "TransTexspace");
+ }
+
+ td->flag = TD_SELECTED;
+ copy_v3_v3(td->center, ss->pivot_pos);
+ td->ob = NULL;
+
+ float tquat[4];
+ normalize_qt_qt(tquat, ss->pivot_rot);
+ quat_to_mat3(td->axismtx, tquat);
+
+ td->loc = ss->pivot_pos;
+ copy_v3_v3(td->iloc, ss->pivot_pos);
+
+ if (is_zero_v4(ss->pivot_rot)) {
+ ss->pivot_rot[3] = 1.0f;
+ }
+
+ td->ext->rot = NULL;
+ td->ext->rotAxis = NULL;
+ td->ext->rotAngle = NULL;
+ td->ext->quat = ss->pivot_rot;
+
+ copy_qt_qt(td->ext->iquat, ss->pivot_rot);
+ td->ext->rotOrder = ROT_MODE_QUAT;
+
+ ss->pivot_scale[0] = 1.0f;
+ ss->pivot_scale[1] = 1.0f;
+ ss->pivot_scale[2] = 1.0f;
+ td->ext->size = ss->pivot_scale;
+ copy_v3_v3(td->ext->isize, ss->pivot_scale);
+
+ float obmat_inv[3][3];
+ copy_m3_m4(obmat_inv, ob->obmat);
+ invert_m3(obmat_inv);
+ copy_m3_m3(td->smtx, obmat_inv);
+ copy_m3_m4(td->mtx, ob->obmat);
+}
+
+/** \} */