[Bf-blender-cvs] [79078e58631] temp-transform-conversions-split: Transform: Move Lattice conversion to its own file
mano-wii
noreply at git.blender.org
Wed Sep 4 23:52:36 CEST 2019
Commit: 79078e5863157cd4a989d80521b23e78b737280f
Author: mano-wii
Date: Wed Sep 4 16:08:44 2019 -0300
Branches: temp-transform-conversions-split
https://developer.blender.org/rB79078e5863157cd4a989d80521b23e78b737280f
Transform: Move Lattice conversion to its own file
===================================================================
M source/blender/editors/transform/CMakeLists.txt
M source/blender/editors/transform/transform_conversions.c
M source/blender/editors/transform/transform_conversions.h
A source/blender/editors/transform/transform_conversions_lattice.c
===================================================================
diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt
index 186e700705e..590a5768a36 100644
--- a/source/blender/editors/transform/CMakeLists.txt
+++ b/source/blender/editors/transform/CMakeLists.txt
@@ -44,6 +44,7 @@ set(SRC
transform_conversions_armature.c
transform_conversions_cursor.c
transform_conversions_curve.c
+ transform_conversions_lattice.c
transform_conversions_mball.c
transform_conversions_mesh.c
transform_generics.c
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index dd225d497c0..99d932e3036 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -28,7 +28,6 @@
#include "DNA_anim_types.h"
#include "DNA_brush_types.h"
#include "DNA_armature_types.h"
-#include "DNA_lattice_types.h"
#include "DNA_mesh_types.h"
#include "DNA_node_types.h"
#include "DNA_screen_types.h"
@@ -877,79 +876,6 @@ TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTr
return hdata;
}
-/* ********************* lattice *************** */
-
-static void createTransLatticeVerts(TransInfo *t)
-{
- FOREACH_TRANS_DATA_CONTAINER (t, tc) {
-
- Lattice *latt = ((Lattice *)tc->obedit->data)->editlatt->latt;
- TransData *td = NULL;
- BPoint *bp;
- float mtx[3][3], smtx[3][3];
- int a;
- int count = 0, countsel = 0;
- const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
-
- bp = latt->def;
- a = latt->pntsu * latt->pntsv * latt->pntsw;
- while (a--) {
- if (bp->hide == 0) {
- if (bp->f1 & SELECT) {
- countsel++;
- }
- if (is_prop_edit) {
- count++;
- }
- }
- bp++;
- }
-
- /* note: in prop mode we need at least 1 selected */
- if (countsel == 0) {
- return;
- }
-
- if (is_prop_edit) {
- tc->data_len = count;
- }
- else {
- tc->data_len = countsel;
- }
- tc->data = MEM_callocN(tc->data_len * sizeof(TransData), "TransObData(Lattice EditMode)");
-
- copy_m3_m4(mtx, tc->obedit->obmat);
- pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON);
-
- td = tc->data;
- bp = latt->def;
- a = latt->pntsu * latt->pntsv * latt->pntsw;
- while (a--) {
- if (is_prop_edit || (bp->f1 & SELECT)) {
- if (bp->hide == 0) {
- copy_v3_v3(td->iloc, bp->vec);
- td->loc = bp->vec;
- copy_v3_v3(td->center, td->loc);
- if (bp->f1 & SELECT) {
- td->flag = TD_SELECTED;
- }
- else {
- td->flag = 0;
- }
- copy_m3_m3(td->smtx, smtx);
- copy_m3_m3(td->mtx, mtx);
-
- td->ext = NULL;
- td->val = NULL;
-
- td++;
- }
- }
- bp++;
- }
- }
-}
-
/* ******************* particle edit **************** */
static void createTransParticleVerts(bContext *C, TransInfo *t)
{
diff --git a/source/blender/editors/transform/transform_conversions.h b/source/blender/editors/transform/transform_conversions.h
index 1e33f2aa18b..769f2358ba5 100644
--- a/source/blender/editors/transform/transform_conversions.h
+++ b/source/blender/editors/transform/transform_conversions.h
@@ -66,6 +66,9 @@ void createTransCursor_view3d(TransInfo *t);
/* transform_conversions_curve.c */
void createTransCurveVerts(TransInfo *t);
+/* transform_conversions_lattice.c */
+void createTransLatticeVerts(TransInfo *t);
+
/* transform_conversions_mball.c */
void createTransMBallVerts(TransInfo *t);
diff --git a/source/blender/editors/transform/transform_conversions_lattice.c b/source/blender/editors/transform/transform_conversions_lattice.c
new file mode 100644
index 00000000000..3c065ec0a03
--- /dev/null
+++ b/source/blender/editors/transform/transform_conversions_lattice.c
@@ -0,0 +1,113 @@
+/*
+ * 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_curve_types.h"
+#include "DNA_lattice_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math.h"
+
+#include "BKE_context.h"
+#include "BKE_report.h"
+
+#include "transform.h"
+#include "transform_conversions.h"
+
+/* -------------------------------------------------------------------- */
+/** \name Curve/Surfaces Transform Creation
+ *
+ * \{ */
+
+void createTransLatticeVerts(TransInfo *t)
+{
+ FOREACH_TRANS_DATA_CONTAINER (t, tc) {
+
+ Lattice *latt = ((Lattice *)tc->obedit->data)->editlatt->latt;
+ TransData *td = NULL;
+ BPoint *bp;
+ float mtx[3][3], smtx[3][3];
+ int a;
+ int count = 0, countsel = 0;
+ const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
+
+ bp = latt->def;
+ a = latt->pntsu * latt->pntsv * latt->pntsw;
+ while (a--) {
+ if (bp->hide == 0) {
+ if (bp->f1 & SELECT) {
+ countsel++;
+ }
+ if (is_prop_edit) {
+ count++;
+ }
+ }
+ bp++;
+ }
+
+ /* note: in prop mode we need at least 1 selected */
+ if (countsel == 0) {
+ return;
+ }
+
+ if (is_prop_edit) {
+ tc->data_len = count;
+ }
+ else {
+ tc->data_len = countsel;
+ }
+ tc->data = MEM_callocN(tc->data_len * sizeof(TransData), "TransObData(Lattice EditMode)");
+
+ copy_m3_m4(mtx, tc->obedit->obmat);
+ pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON);
+
+ td = tc->data;
+ bp = latt->def;
+ a = latt->pntsu * latt->pntsv * latt->pntsw;
+ while (a--) {
+ if (is_prop_edit || (bp->f1 & SELECT)) {
+ if (bp->hide == 0) {
+ copy_v3_v3(td->iloc, bp->vec);
+ td->loc = bp->vec;
+ copy_v3_v3(td->center, td->loc);
+ if (bp->f1 & SELECT) {
+ td->flag = TD_SELECTED;
+ }
+ else {
+ td->flag = 0;
+ }
+ copy_m3_m3(td->smtx, smtx);
+ copy_m3_m3(td->mtx, mtx);
+
+ td->ext = NULL;
+ td->val = NULL;
+
+ td++;
+ }
+ }
+ bp++;
+ }
+ }
+}
+
+/** \} */
More information about the Bf-blender-cvs
mailing list