Blender  V2.93
bmo_mesh_convert.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
25 #include "DNA_key_types.h"
26 #include "DNA_mesh_types.h"
27 #include "DNA_object_types.h"
28 
29 #include "BLI_math.h"
30 
31 #include "bmesh.h"
33 
34 #include "BKE_global.h"
35 
37 {
38  Object *ob = BMO_slot_ptr_get(op->slots_in, "object");
39  Mesh *me = BMO_slot_ptr_get(op->slots_in, "mesh");
40  bool set_key = BMO_slot_bool_get(op->slots_in, "use_shapekey");
41 
43  me,
44  (&(struct BMeshFromMeshParams){
45  .use_shapekey = set_key,
46  .active_shapekey = ob->shapenr,
47  }));
48 
49  if (me->key && ob->shapenr > me->key->totkey) {
50  ob->shapenr = me->key->totkey - 1;
51  }
52 }
53 
55 {
56  Object *ob = BMO_slot_ptr_get(op->slots_in, "object");
57  /* Scene *scene = BMO_slot_ptr_get(op, "scene"); */
58  Mesh *me = ob->data;
59 
60  BMO_op_callf(bm, op->flag, "bmesh_to_mesh mesh=%p object=%p", me, ob);
61 }
62 
64 {
65  Mesh *me = BMO_slot_ptr_get(op->slots_in, "mesh");
66  /* Object *ob = BMO_slot_ptr_get(op, "object"); */
67 
68  BM_mesh_bm_to_me(G.main,
69  bm,
70  me,
71  (&(struct BMeshToMeshParams){
72  .calc_object_remap = true,
73  }));
74 }
Object is a sort of wrapper for general info.
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshParams *params)
Mesh -> BMesh.
void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMeshParams *params)
void * BMO_slot_ptr_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
bool BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
bool BMO_op_callf(BMesh *bm, const int flag, const char *fmt,...)
void bmo_bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
void bmo_object_load_bmesh_exec(BMesh *bm, BMOperator *op)
void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]
int totkey
struct Key * key
short shapenr
void * data
#define G(x, y, z)