Blender  V2.93
crazyspace.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  * The Original Code is Copyright (C) 2005 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include "MEM_guardedalloc.h"
25 
26 #include "DNA_mesh_types.h"
27 #include "DNA_meshdata_types.h"
28 #include "DNA_modifier_types.h"
29 #include "DNA_object_types.h"
30 #include "DNA_scene_types.h"
31 
32 #include "BLI_linklist.h"
33 #include "BLI_math.h"
34 #include "BLI_utildefines.h"
35 
36 #include "BKE_DerivedMesh.h"
37 #include "BKE_crazyspace.h"
38 #include "BKE_editmesh.h"
39 #include "BKE_lib_id.h"
40 #include "BKE_mesh.h"
41 #include "BKE_mesh_wrapper.h"
42 #include "BKE_modifier.h"
43 #include "BKE_multires.h"
44 
45 #include "DEG_depsgraph_query.h"
46 
47 BLI_INLINE void tan_calc_quat_v3(float r_quat[4],
48  const float co_1[3],
49  const float co_2[3],
50  const float co_3[3])
51 {
52  float vec_u[3], vec_v[3];
53  float nor[3];
54 
55  sub_v3_v3v3(vec_u, co_1, co_2);
56  sub_v3_v3v3(vec_v, co_1, co_3);
57 
58  cross_v3_v3v3(nor, vec_u, vec_v);
59 
60  if (normalize_v3(nor) > FLT_EPSILON) {
61  const float zero_vec[3] = {0.0f};
62  tri_to_quat_ex(r_quat, zero_vec, vec_u, vec_v, nor);
63  }
64  else {
65  unit_qt(r_quat);
66  }
67 }
68 
69 static void set_crazy_vertex_quat(float r_quat[4],
70  const float co_1[3],
71  const float co_2[3],
72  const float co_3[3],
73  const float vd_1[3],
74  const float vd_2[3],
75  const float vd_3[3])
76 {
77  float q1[4], q2[4];
78 
79  tan_calc_quat_v3(q1, co_1, co_2, co_3);
80  tan_calc_quat_v3(q2, vd_1, vd_2, vd_3);
81 
82  sub_qt_qtqt(r_quat, q2, q1);
83 }
84 
86 {
87  bool disabled = false;
88  int cageIndex = BKE_modifiers_get_cage_index(scene, ob, NULL, 1);
89 
90  ModifierData *md = ob->modifiers.first;
91  for (int i = 0; md && i <= cageIndex; i++, md = md->next) {
92  if (md->type == eModifierType_Subsurf) {
94  disabled = true;
95  }
96  }
97 
98  return disabled;
99 }
100 
101 /* disable subsurf temporal, get mapped cos, and enable it */
103 {
105  Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
106  Object *obedit_eval = DEG_get_evaluated_object(depsgraph, obedit);
107  Mesh *mesh_eval = obedit_eval->data;
108  BMEditMesh *editmesh_eval = mesh_eval->edit_mesh;
109 
110  /* disable subsurf temporal, get mapped cos, and enable it */
111  if (modifiers_disable_subsurf_temporary(scene_eval, obedit_eval)) {
112  /* need to make new derivemesh */
113  makeDerivedMesh(depsgraph, scene_eval, obedit_eval, editmesh_eval, &CD_MASK_BAREMESH);
114  }
115 
116  /* now get the cage */
117  Mesh *mesh_eval_cage = editbmesh_get_eval_cage_from_orig(
118  depsgraph, scene, obedit, &CD_MASK_BAREMESH);
119 
120  const int nverts = editmesh_eval->bm->totvert;
121  float(*vertexcos)[3] = MEM_mallocN(sizeof(*vertexcos) * nverts, "vertexcos map");
122  mesh_get_mapped_verts_coords(mesh_eval_cage, vertexcos, nverts);
123 
124  /* set back the flag, no new cage needs to be built, transform does it */
125  modifiers_disable_subsurf_temporary(scene_eval, obedit_eval);
126 
127  return vertexcos;
128 }
129 
131  float (*origcos)[3],
132  float (*mappedcos)[3],
133  float (*quats)[4],
134  const bool use_select)
135 {
136  BMFace *f;
137  BMIter iter;
138  int index;
139 
140  {
141  BMVert *v;
142  BM_ITER_MESH_INDEX (v, &iter, em->bm, BM_VERTS_OF_MESH, index) {
144  BM_elem_index_set(v, index); /* set_inline */
145  }
146  em->bm->elem_index_dirty &= ~BM_VERT;
147  }
148 
149  BM_ITER_MESH (f, &iter, em->bm, BM_FACES_OF_MESH) {
150  BMLoop *l_iter, *l_first;
151 
152  l_iter = l_first = BM_FACE_FIRST_LOOP(f);
153  do {
154  if (BM_elem_flag_test(l_iter->v, BM_ELEM_HIDDEN) ||
155  BM_elem_flag_test(l_iter->v, BM_ELEM_TAG) ||
156  (use_select && !BM_elem_flag_test(l_iter->v, BM_ELEM_SELECT))) {
157  continue;
158  }
159 
160  if (!BM_elem_flag_test(l_iter->v, BM_ELEM_TAG)) {
161  const float *co_prev, *co_curr, *co_next; /* orig */
162  const float *vd_prev, *vd_curr, *vd_next; /* deform */
163 
164  const int i_prev = BM_elem_index_get(l_iter->prev->v);
165  const int i_curr = BM_elem_index_get(l_iter->v);
166  const int i_next = BM_elem_index_get(l_iter->next->v);
167 
168  /* retrieve mapped coordinates */
169  vd_prev = mappedcos[i_prev];
170  vd_curr = mappedcos[i_curr];
171  vd_next = mappedcos[i_next];
172 
173  if (origcos) {
174  co_prev = origcos[i_prev];
175  co_curr = origcos[i_curr];
176  co_next = origcos[i_next];
177  }
178  else {
179  co_prev = l_iter->prev->v->co;
180  co_curr = l_iter->v->co;
181  co_next = l_iter->next->v->co;
182  }
183 
184  set_crazy_vertex_quat(quats[i_curr], co_curr, co_next, co_prev, vd_curr, vd_next, vd_prev);
185 
187  }
188  } while ((l_iter = l_iter->next) != l_first);
189  }
190 }
191 
193  float (*origcos)[3],
194  float (*mappedcos)[3],
195  float (*quats)[4])
196 {
197  MVert *mvert = me->mvert;
198  for (int i = 0; i < me->totvert; i++, mvert++) {
199  mvert->flag &= ~ME_VERT_TMP_TAG;
200  }
201 
202  /* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */
203  mvert = me->mvert;
204  MPoly *mp = me->mpoly;
205  MLoop *mloop = me->mloop;
206 
207  for (int i = 0; i < me->totpoly; i++, mp++) {
208  MLoop *ml_next = &mloop[mp->loopstart];
209  MLoop *ml_curr = &ml_next[mp->totloop - 1];
210  MLoop *ml_prev = &ml_next[mp->totloop - 2];
211 
212  for (int j = 0; j < mp->totloop; j++) {
213  if ((mvert[ml_curr->v].flag & ME_VERT_TMP_TAG) == 0) {
214  const float *co_prev, *co_curr, *co_next; /* orig */
215  const float *vd_prev, *vd_curr, *vd_next; /* deform */
216 
217  /* retrieve mapped coordinates */
218  vd_prev = mappedcos[ml_prev->v];
219  vd_curr = mappedcos[ml_curr->v];
220  vd_next = mappedcos[ml_next->v];
221 
222  if (origcos) {
223  co_prev = origcos[ml_prev->v];
224  co_curr = origcos[ml_curr->v];
225  co_next = origcos[ml_next->v];
226  }
227  else {
228  co_prev = mvert[ml_prev->v].co;
229  co_curr = mvert[ml_curr->v].co;
230  co_next = mvert[ml_next->v].co;
231  }
232 
234  quats[ml_curr->v], co_curr, co_next, co_prev, vd_curr, vd_next, vd_prev);
235 
236  mvert[ml_curr->v].flag |= ME_VERT_TMP_TAG;
237  }
238 
239  ml_prev = ml_curr;
240  ml_curr = ml_next;
241  ml_next++;
242  }
243  }
244 }
245 
251  Scene *scene,
252  Object *ob,
253  BMEditMesh *em,
254  float (**deformmats)[3][3],
255  float (**deformcos)[3])
256 {
257  ModifierData *md;
258  Mesh *me_input = ob->data;
259  Mesh *me = NULL;
260  int i, a, numleft = 0, numVerts = 0;
261  int cageIndex = BKE_modifiers_get_cage_index(scene, ob, NULL, 1);
262  float(*defmats)[3][3] = NULL, (*deformedVerts)[3] = NULL;
263  VirtualModifierData virtualModifierData;
264  ModifierEvalContext mectx = {depsgraph, ob, 0};
265 
267 
268  md = BKE_modifiers_get_virtual_modifierlist(ob, &virtualModifierData);
269 
270  /* compute the deformation matrices and coordinates for the first
271  * modifiers with on cage editing that are enabled and support computing
272  * deform matrices */
273  for (i = 0; md && i <= cageIndex; i++, md = md->next) {
274  const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type);
275 
276  if (!editbmesh_modifier_is_enabled(scene, ob, md, me != NULL)) {
277  continue;
278  }
279 
280  if (mti->type == eModifierTypeType_OnlyDeform && mti->deformMatricesEM) {
281  if (!defmats) {
282  const int required_mode = eModifierMode_Realtime | eModifierMode_Editmode;
283  CustomData_MeshMasks cd_mask_extra = CD_MASK_BAREMESH;
285  scene, ob, md, &cd_mask_extra, required_mode, NULL, NULL);
286  cd_mask_extra = datamasks->mask;
287  BLI_linklist_free((LinkNode *)datamasks, NULL);
288 
289  me = BKE_mesh_wrapper_from_editmesh_with_coords(em, &cd_mask_extra, NULL, me_input);
290  deformedVerts = editbmesh_vert_coords_alloc(em, &numVerts);
291  defmats = MEM_mallocN(sizeof(*defmats) * numVerts, "defmats");
292 
293  for (a = 0; a < numVerts; a++) {
294  unit_m3(defmats[a]);
295  }
296  }
297  mti->deformMatricesEM(md, &mectx, em, me, deformedVerts, defmats, numVerts);
298  }
299  else {
300  break;
301  }
302  }
303 
304  for (; md && i <= cageIndex; md = md->next, i++) {
305  if (editbmesh_modifier_is_enabled(scene, ob, md, me != NULL) &&
307  numleft++;
308  }
309  }
310 
311  if (me) {
312  BKE_id_free(NULL, me);
313  }
314 
315  *deformmats = defmats;
316  *deformcos = deformedVerts;
317 
318  return numleft;
319 }
320 
329  Object *object,
330  Object *object_crazy)
331 {
332  Object *object_eval = DEG_get_evaluated_object(depsgraph, object);
333  *object_crazy = *object_eval;
334  if (object_crazy->runtime.data_orig != NULL) {
335  object_crazy->data = object_crazy->runtime.data_orig;
336  }
337 }
338 
340  float (**deformmats)[3][3],
341  float (**deformcos)[3])
342 {
343  int num_verts;
344  *deformcos = BKE_mesh_vert_coords_alloc(mesh, &num_verts);
345  *deformmats = MEM_callocN(sizeof(**deformmats) * num_verts, "defmats");
346  for (int a = 0; a < num_verts; a++) {
347  unit_m3((*deformmats)[a]);
348  }
349  BLI_assert(num_verts == mesh->totvert);
350 }
351 
353 {
355  return true;
356  }
357  const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type);
358  return (mti->type == eModifierTypeType_OnlyDeform);
359 }
360 
362 {
363  const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type);
364  return (mti->type == eModifierTypeType_OnlyDeform);
365 }
366 
368  Scene *scene,
369  Object *object,
370  float (**deformmats)[3][3],
371  float (**deformcos)[3])
372 {
373  ModifierData *md;
374  Mesh *me_eval = NULL;
375  float(*defmats)[3][3] = NULL, (*deformedVerts)[3] = NULL;
376  int numleft = 0;
377  VirtualModifierData virtualModifierData;
378  Object object_eval;
379  crazyspace_init_object_for_eval(depsgraph, object, &object_eval);
380  MultiresModifierData *mmd = get_multires_modifier(scene, &object_eval, 0);
381  const bool is_sculpt_mode = (object->mode & OB_MODE_SCULPT) != 0;
382  const bool has_multires = mmd != NULL && mmd->sculptlvl > 0;
383  const ModifierEvalContext mectx = {depsgraph, &object_eval, 0};
384 
385  if (is_sculpt_mode && has_multires) {
386  *deformmats = NULL;
387  *deformcos = NULL;
388  return numleft;
389  }
390 
391  md = BKE_modifiers_get_virtual_modifierlist(&object_eval, &virtualModifierData);
392 
393  for (; md; md = md->next) {
395  continue;
396  }
397 
399  const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type);
400  if (defmats == NULL) {
401  /* NOTE: Evaluated object si re-set to its original undeformed
402  * state. */
403  Mesh *me = object_eval.data;
404  me_eval = BKE_mesh_copy_for_eval(me, true);
405  crazyspace_init_verts_and_matrices(me_eval, &defmats, &deformedVerts);
406  }
407 
408  if (mti->deformMatrices) {
409  mti->deformMatrices(md, &mectx, me_eval, deformedVerts, defmats, me_eval->totvert);
410  }
411  else {
412  /* More complex handling will continue in BKE_crazyspace_build_sculpt.
413  * Exiting the loop on a non-deform modifier causes issues - T71213. */
415  break;
416  }
417  }
418  }
419 
420  for (; md; md = md->next) {
422  continue;
423  }
424 
426  numleft++;
427  }
428  }
429 
430  if (me_eval != NULL) {
431  BKE_id_free(NULL, me_eval);
432  }
433 
434  *deformmats = defmats;
435  *deformcos = deformedVerts;
436 
437  return numleft;
438 }
439 
441  Scene *scene,
442  Object *object,
443  float (**deformmats)[3][3],
444  float (**deformcos)[3])
445 {
447  depsgraph, scene, object, deformmats, deformcos);
448 
449  if (totleft) {
450  /* There are deformation modifier which doesn't support deformation matrices calculation.
451  * Need additional crazy-space correction. */
452 
453  Mesh *mesh = (Mesh *)object->data;
454  Mesh *mesh_eval = NULL;
455 
456  if (*deformcos == NULL) {
457  crazyspace_init_verts_and_matrices(mesh, deformmats, deformcos);
458  }
459 
460  float(*deformedVerts)[3] = *deformcos;
461  float(*origVerts)[3] = MEM_dupallocN(deformedVerts);
462  float(*quats)[4];
463  int i, deformed = 0;
464  VirtualModifierData virtualModifierData;
465  Object object_eval;
466  crazyspace_init_object_for_eval(depsgraph, object, &object_eval);
467  ModifierData *md = BKE_modifiers_get_virtual_modifierlist(&object_eval, &virtualModifierData);
468  const ModifierEvalContext mectx = {depsgraph, &object_eval, 0};
469 
470  for (; md; md = md->next) {
472  continue;
473  }
474 
476  const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type);
477 
478  /* skip leading modifiers which have been already
479  * handled in sculpt_get_first_deform_matrices */
480  if (mti->deformMatrices && !deformed) {
481  continue;
482  }
483 
484  if (mesh_eval == NULL) {
485  mesh_eval = BKE_mesh_copy_for_eval(mesh, true);
486  }
487 
488  mti->deformVerts(md, &mectx, mesh_eval, deformedVerts, mesh_eval->totvert);
489  deformed = 1;
490  }
491  }
492 
493  quats = MEM_mallocN(mesh->totvert * sizeof(*quats), "crazy quats");
494 
495  BKE_crazyspace_set_quats_mesh(mesh, origVerts, deformedVerts, quats);
496 
497  for (i = 0; i < mesh->totvert; i++) {
498  float qmat[3][3], tmat[3][3];
499 
500  quat_to_mat3(qmat, quats[i]);
501  mul_m3_m3m3(tmat, qmat, (*deformmats)[i]);
502  copy_m3_m3((*deformmats)[i], tmat);
503  }
504 
505  MEM_freeN(origVerts);
506  MEM_freeN(quats);
507 
508  if (mesh_eval != NULL) {
509  BKE_id_free(NULL, mesh_eval);
510  }
511  }
512 
513  if (*deformmats == NULL) {
514  int a, numVerts;
515  Mesh *mesh = (Mesh *)object->data;
516 
517  *deformcos = BKE_mesh_vert_coords_alloc(mesh, &numVerts);
518  *deformmats = MEM_callocN(sizeof(*(*deformmats)) * numVerts, "defmats");
519 
520  for (a = 0; a < numVerts; a++) {
521  unit_m3((*deformmats)[a]);
522  }
523  }
524 }
typedef float(TangentPoint)[2]
void makeDerivedMesh(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct BMEditMesh *em, const struct CustomData_MeshMasks *dataMask)
struct Mesh * editbmesh_get_eval_cage_from_orig(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *obedit, const struct CustomData_MeshMasks *dataMask)
bool editbmesh_modifier_is_enabled(struct Scene *scene, const struct Object *ob, struct ModifierData *md, bool has_prev_mesh)
void mesh_get_mapped_verts_coords(struct Mesh *me_eval, float(*r_cos)[3], const int totcos)
float(* editbmesh_vert_coords_alloc(struct BMEditMesh *em, int *r_vert_len))[3]
const CustomData_MeshMasks CD_MASK_BAREMESH
Definition: customdata.c:1919
void BKE_id_free(struct Main *bmain, void *idv)
struct Mesh * BKE_mesh_copy_for_eval(struct Mesh *source, bool reference)
Definition: mesh.c:995
float(* BKE_mesh_vert_coords_alloc(const struct Mesh *mesh, int *r_vert_len))[3]
struct Mesh * BKE_mesh_wrapper_from_editmesh_with_coords(struct BMEditMesh *em, const struct CustomData_MeshMasks *cd_mask_extra, const float(*vert_coords)[3], const struct Mesh *me_settings)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
bool BKE_modifier_is_enabled(const struct Scene *scene, struct ModifierData *md, int required_mode)
struct ModifierData * BKE_modifiers_get_virtual_modifierlist(const struct Object *ob, struct VirtualModifierData *data)
@ eModifierTypeType_OnlyDeform
Definition: BKE_modifier.h:58
bool BKE_modifier_is_correctable_deformed(struct ModifierData *md)
void BKE_modifiers_clear_errors(struct Object *ob)
struct CDMaskLink * BKE_modifier_calc_data_masks(const struct Scene *scene, struct Object *ob, struct ModifierData *md, struct CustomData_MeshMasks *final_datamask, int required_mode, ModifierData *previewmd, const struct CustomData_MeshMasks *previewmask)
int BKE_modifiers_get_cage_index(const struct Scene *scene, struct Object *ob, int *r_lastPossibleCageIndex, bool is_virtual)
struct MultiresModifierData * get_multires_modifier(struct Scene *scene, struct Object *ob, bool use_first)
Definition: multires.c:336
#define BLI_assert(a)
Definition: BLI_assert.h:58
#define BLI_INLINE
void copy_m3_m3(float m1[3][3], const float m2[3][3])
Definition: math_matrix.c:89
void unit_m3(float m[3][3])
Definition: math_matrix.c:58
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
Definition: math_matrix.c:391
void sub_qt_qtqt(float q[4], const float a[4], const float b[4])
void unit_qt(float q[4])
Definition: math_rotation.c:46
void tri_to_quat_ex(float quat[4], const float v1[3], const float v2[3], const float v3[3], const float no_orig[3])
void quat_to_mat3(float mat[3][3], const float q[4])
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
#define ELEM(...)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
struct Scene * DEG_get_input_scene(const Depsgraph *graph)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
@ ME_VERT_TMP_TAG
@ eModifierMode_Editmode
@ eModifierMode_DisableTemporary
@ eModifierMode_Realtime
@ eModifierType_Subsurf
@ eModifierType_Multires
@ OB_MODE_SCULPT
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
@ BM_VERT
Definition: bmesh_class.h:383
@ BM_ELEM_HIDDEN
Definition: bmesh_class.h:472
@ BM_ELEM_SELECT
Definition: bmesh_class.h:471
@ BM_ELEM_TAG
Definition: bmesh_class.h:484
#define BM_FACE_FIRST_LOOP(p)
Definition: bmesh_class.h:553
#define BM_elem_index_get(ele)
Definition: bmesh_inline.h:124
#define BM_elem_flag_disable(ele, hflag)
Definition: bmesh_inline.h:29
#define BM_elem_index_set(ele, index)
Definition: bmesh_inline.h:125
#define BM_elem_flag_test(ele, hflag)
Definition: bmesh_inline.h:26
#define BM_elem_flag_enable(ele, hflag)
Definition: bmesh_inline.h:28
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
@ BM_VERTS_OF_MESH
@ BM_FACES_OF_MESH
ATTR_WARN_UNUSED_RESULT const BMVert * v
int BKE_crazyspace_get_first_deform_matrices_editbmesh(struct Depsgraph *depsgraph, Scene *scene, Object *ob, BMEditMesh *em, float(**deformmats)[3][3], float(**deformcos)[3])
Definition: crazyspace.c:250
static bool modifiers_disable_subsurf_temporary(struct Scene *scene, Object *ob)
Definition: crazyspace.c:85
int BKE_sculpt_get_first_deform_matrices(struct Depsgraph *depsgraph, Scene *scene, Object *object, float(**deformmats)[3][3], float(**deformcos)[3])
Definition: crazyspace.c:367
BLI_INLINE void tan_calc_quat_v3(float r_quat[4], const float co_1[3], const float co_2[3], const float co_3[3])
Definition: crazyspace.c:47
float(* BKE_crazyspace_get_mapped_editverts(struct Depsgraph *depsgraph, Object *obedit))[3]
Definition: crazyspace.c:102
static void set_crazy_vertex_quat(float r_quat[4], const float co_1[3], const float co_2[3], const float co_3[3], const float vd_1[3], const float vd_2[3], const float vd_3[3])
Definition: crazyspace.c:69
void BKE_crazyspace_build_sculpt(struct Depsgraph *depsgraph, Scene *scene, Object *object, float(**deformmats)[3][3], float(**deformcos)[3])
Definition: crazyspace.c:440
static bool crazyspace_modifier_supports_deform(ModifierData *md)
Definition: crazyspace.c:361
void BKE_crazyspace_set_quats_mesh(Mesh *me, float(*origcos)[3], float(*mappedcos)[3], float(*quats)[4])
Definition: crazyspace.c:192
void BKE_crazyspace_set_quats_editmesh(BMEditMesh *em, float(*origcos)[3], float(*mappedcos)[3], float(*quats)[4], const bool use_select)
Definition: crazyspace.c:130
static void crazyspace_init_verts_and_matrices(const Mesh *mesh, float(**deformmats)[3][3], float(**deformcos)[3])
Definition: crazyspace.c:339
static void crazyspace_init_object_for_eval(struct Depsgraph *depsgraph, Object *object, Object *object_crazy)
Definition: crazyspace.c:328
static bool crazyspace_modifier_supports_deform_matrices(ModifierData *md)
Definition: crazyspace.c:352
Scene scene
const Depsgraph * depsgraph
uint nor
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_dupallocN)(const void *vmemh)
Definition: mallocn.c:42
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
static unsigned a[3]
Definition: RandGen.cpp:92
struct BMesh * bm
Definition: BKE_editmesh.h:52
struct BMVert * v
Definition: bmesh_class.h:165
struct BMLoop * prev
Definition: bmesh_class.h:245
struct BMLoop * next
Definition: bmesh_class.h:245
float co[3]
Definition: bmesh_class.h:99
int totvert
Definition: bmesh_class.h:297
char elem_index_dirty
Definition: bmesh_class.h:305
void * first
Definition: DNA_listBase.h:47
unsigned int v
float co[3]
struct BMEditMesh * edit_mesh
struct MVert * mvert
int totvert
struct MLoop * mloop
int totpoly
struct MPoly * mpoly
struct ModifierData * next
ModifierTypeType type
Definition: BKE_modifier.h:173
void(* deformVerts)(struct ModifierData *md, const struct ModifierEvalContext *ctx, struct Mesh *mesh, float(*vertexCos)[3], int numVerts)
Definition: BKE_modifier.h:197
void(* deformMatrices)(struct ModifierData *md, const struct ModifierEvalContext *ctx, struct Mesh *mesh, float(*vertexCos)[3], float(*defMats)[3][3], int numVerts)
Definition: BKE_modifier.h:206
void(* deformMatricesEM)(struct ModifierData *md, const struct ModifierEvalContext *ctx, struct BMEditMesh *editData, struct Mesh *mesh, float(*vertexCos)[3], float(*defMats)[3][3], int numVerts)
Definition: BKE_modifier.h:223
struct ID * data_orig
ListBase modifiers
Object_Runtime runtime
void * data