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

bmo_mesh_conv.c « operators « bmesh « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c4b988ae82d92820b2a3e70d1d445988c83ac819 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
 * ***** BEGIN GPL LICENSE BLOCK *****
 *
 * 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.
 *
 * Contributor(s): Joseph Eagar.
 *
 * ***** END GPL LICENSE BLOCK *****
 */

/** \file blender/bmesh/operators/bmo_mesh_conv.c
 *  \ingroup bmesh
 *
 * This file contains functions
 * for converting a Mesh
 * into a Bmesh, and back again.
 */

#include "MEM_guardedalloc.h"

#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_key_types.h"
#include "DNA_modifier_types.h"

#include "BKE_mesh.h"
#include "BLI_listbase.h"
#include "BKE_global.h"
#include "BKE_key.h"
#include "BKE_main.h"
#include "BKE_customdata.h"

#include "BLI_math.h"
#include "BLI_array.h"

#include "bmesh.h"
#include "intern/bmesh_private.h"

#include "intern/bmesh_operators_private.h" /* own include */

void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
{
	Object *ob = BMO_slot_ptr_get(op, "object");
	Mesh *me = BMO_slot_ptr_get(op, "mesh");
	int set_key = BMO_slot_bool_get(op, "set_shapekey");

	BM_mesh_bm_from_me(bm, me, set_key, 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, "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 notessellation=%b",
	             me, ob, TRUE);
}

void bmo_bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
{
	Mesh *me = BMO_slot_ptr_get(op, "mesh");
	/* Object *ob = BMO_slot_ptr_get(op, "object"); */
	int dotess = !BMO_slot_bool_get(op, "notessellation");

	BM_mesh_bm_to_me(bm, me, dotess);
}