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:
authorCampbell Barton <ideasman42@gmail.com>2020-06-05 11:27:38 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-06-05 11:27:38 +0300
commit191edd224ab08a8faafb76d51d8298de56c6149f (patch)
treeda6a85099cd482cb91183a686878f0f931e4e2a0 /source/blender/bmesh/operators/bmo_mesh_convert.c
parentf2d5c539660c2c817b0dba3012ba6f31c8251f0a (diff)
Cleanup: rename suffix 'conv' to 'convert'
Diffstat (limited to 'source/blender/bmesh/operators/bmo_mesh_convert.c')
-rw-r--r--source/blender/bmesh/operators/bmo_mesh_convert.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/source/blender/bmesh/operators/bmo_mesh_convert.c b/source/blender/bmesh/operators/bmo_mesh_convert.c
new file mode 100644
index 00000000000..e480db64f9d
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_mesh_convert.c
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+/** \file
+ * \ingroup bmesh
+ *
+ * This file contains functions
+ * for converting a Mesh
+ * into a Bmesh, and back again.
+ */
+
+#include "DNA_key_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_object_types.h"
+
+#include "BLI_math.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_operators_private.h"
+
+#include "BKE_global.h"
+
+void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
+{
+ Object *ob = BMO_slot_ptr_get(op->slots_in, "object");
+ Mesh *me = BMO_slot_ptr_get(op->slots_in, "mesh");
+ bool set_key = BMO_slot_bool_get(op->slots_in, "use_shapekey");
+
+ BM_mesh_bm_from_me(bm,
+ me,
+ (&(struct BMeshFromMeshParams){
+ .use_shapekey = set_key,
+ .active_shapekey = ob->shapenr,
+ }));
+
+ if (me->key && ob->shapenr > me->key->totkey) {
+ ob->shapenr = me->key->totkey - 1;
+ }
+}
+
+void bmo_object_load_bmesh_exec(BMesh *bm, BMOperator *op)
+{
+ Object *ob = BMO_slot_ptr_get(op->slots_in, "object");
+ /* Scene *scene = BMO_slot_ptr_get(op, "scene"); */
+ Mesh *me = ob->data;
+
+ BMO_op_callf(bm, op->flag, "bmesh_to_mesh mesh=%p object=%p", me, ob);
+}
+
+void bmo_bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
+{
+ Mesh *me = BMO_slot_ptr_get(op->slots_in, "mesh");
+ /* Object *ob = BMO_slot_ptr_get(op, "object"); */
+
+ BM_mesh_bm_to_me(G.main,
+ bm,
+ me,
+ (&(struct BMeshToMeshParams){
+ .calc_object_remap = true,
+ }));
+}