Blender  V3.3
MOD_cast.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2005 Blender Foundation. All rights reserved. */
3 
8 #include "BLI_utildefines.h"
9 
10 #include "BLI_math.h"
11 
12 #include "BLT_translation.h"
13 
14 #include "DNA_defaults.h"
15 #include "DNA_mesh_types.h"
16 #include "DNA_meshdata_types.h"
17 #include "DNA_object_types.h"
18 #include "DNA_screen_types.h"
19 
20 #include "BKE_context.h"
21 #include "BKE_deform.h"
22 #include "BKE_editmesh.h"
23 #include "BKE_lib_id.h"
24 #include "BKE_lib_query.h"
25 #include "BKE_mesh.h"
26 #include "BKE_mesh_wrapper.h"
27 #include "BKE_modifier.h"
28 #include "BKE_screen.h"
29 
30 #include "UI_interface.h"
31 #include "UI_resources.h"
32 
33 #include "RNA_access.h"
34 #include "RNA_prototypes.h"
35 
36 #include "DEG_depsgraph_query.h"
37 
38 #include "MOD_ui_common.h"
39 #include "MOD_util.h"
40 
41 static void initData(ModifierData *md)
42 {
44 
46 
48 }
49 
50 static bool isDisabled(const struct Scene *UNUSED(scene),
51  ModifierData *md,
52  bool UNUSED(useRenderParams))
53 {
55  short flag;
56 
57  flag = cmd->flag & (MOD_CAST_X | MOD_CAST_Y | MOD_CAST_Z);
58 
59  if ((cmd->fac == 0.0f) || flag == 0) {
60  return true;
61  }
62 
63  return false;
64 }
65 
66 static void requiredDataMask(Object *UNUSED(ob),
67  ModifierData *md,
68  CustomData_MeshMasks *r_cddata_masks)
69 {
71 
72  /* ask for vertexgroups if we need them */
73  if (cmd->defgrp_name[0] != '\0') {
74  r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
75  }
76 }
77 
78 static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
79 {
81 
82  walk(userData, ob, (ID **)&cmd->object, IDWALK_CB_NOP);
83 }
84 
86 {
88  if (cmd->object != NULL) {
89  DEG_add_object_relation(ctx->node, cmd->object, DEG_OB_COMP_TRANSFORM, "Cast Modifier");
90  DEG_add_modifier_to_transform_relation(ctx->node, "Cast Modifier");
91  }
92 }
93 
94 static void sphere_do(CastModifierData *cmd,
95  const ModifierEvalContext *UNUSED(ctx),
96  Object *ob,
97  Mesh *mesh,
98  float (*vertexCos)[3],
99  int verts_num)
100 {
101  MDeformVert *dvert = NULL;
102  const bool invert_vgroup = (cmd->flag & MOD_CAST_INVERT_VGROUP) != 0;
103 
104  Object *ctrl_ob = NULL;
105 
106  int i, defgrp_index;
107  bool has_radius = false;
108  short flag, type;
109  float len = 0.0f;
110  float fac = cmd->fac;
111  float facm = 1.0f - fac;
112  const float fac_orig = fac;
113  float vec[3], center[3] = {0.0f, 0.0f, 0.0f};
114  float mat[4][4], imat[4][4];
115 
116  flag = cmd->flag;
117  type = cmd->type; /* projection type: sphere or cylinder */
118 
119  if (type == MOD_CAST_TYPE_CYLINDER) {
120  flag &= ~MOD_CAST_Z;
121  }
122 
123  ctrl_ob = cmd->object;
124 
125  /* spherify's center is {0, 0, 0} (the ob's own center in its local
126  * space), by default, but if the user defined a control object,
127  * we use its location, transformed to ob's local space */
128  if (ctrl_ob) {
129  if (flag & MOD_CAST_USE_OB_TRANSFORM) {
130  invert_m4_m4(imat, ctrl_ob->obmat);
131  mul_m4_m4m4(mat, imat, ob->obmat);
132  invert_m4_m4(imat, mat);
133  }
134 
135  invert_m4_m4(ob->imat, ob->obmat);
136  mul_v3_m4v3(center, ob->imat, ctrl_ob->obmat[3]);
137  }
138 
139  /* now we check which options the user wants */
140 
141  /* 1) (flag was checked in the "if (ctrl_ob)" block above) */
142  /* 2) cmd->radius > 0.0f: only the vertices within this radius from
143  * the center of the effect should be deformed */
144  if (cmd->radius > FLT_EPSILON) {
145  has_radius = 1;
146  }
147 
148  /* 3) if we were given a vertex group name,
149  * only those vertices should be affected */
150  if (cmd->defgrp_name[0] != '\0') {
151  MOD_get_vgroup(ob, mesh, cmd->defgrp_name, &dvert, &defgrp_index);
152  }
153 
154  if (flag & MOD_CAST_SIZE_FROM_RADIUS) {
155  len = cmd->radius;
156  }
157  else {
158  len = cmd->size;
159  }
160 
161  if (len <= 0) {
162  for (i = 0; i < verts_num; i++) {
163  len += len_v3v3(center, vertexCos[i]);
164  }
165  len /= verts_num;
166 
167  if (len == 0.0f) {
168  len = 10.0f;
169  }
170  }
171 
172  for (i = 0; i < verts_num; i++) {
173  float tmp_co[3];
174 
175  copy_v3_v3(tmp_co, vertexCos[i]);
176  if (ctrl_ob) {
177  if (flag & MOD_CAST_USE_OB_TRANSFORM) {
178  mul_m4_v3(mat, tmp_co);
179  }
180  else {
181  sub_v3_v3(tmp_co, center);
182  }
183  }
184 
185  copy_v3_v3(vec, tmp_co);
186 
187  if (type == MOD_CAST_TYPE_CYLINDER) {
188  vec[2] = 0.0f;
189  }
190 
191  if (has_radius) {
192  if (len_v3(vec) > cmd->radius) {
193  continue;
194  }
195  }
196 
197  if (dvert) {
198  const float weight = invert_vgroup ?
199  1.0f - BKE_defvert_find_weight(&dvert[i], defgrp_index) :
200  BKE_defvert_find_weight(&dvert[i], defgrp_index);
201 
202  if (weight == 0.0f) {
203  continue;
204  }
205 
206  fac = fac_orig * weight;
207  facm = 1.0f - fac;
208  }
209 
210  normalize_v3(vec);
211 
212  if (flag & MOD_CAST_X) {
213  tmp_co[0] = fac * vec[0] * len + facm * tmp_co[0];
214  }
215  if (flag & MOD_CAST_Y) {
216  tmp_co[1] = fac * vec[1] * len + facm * tmp_co[1];
217  }
218  if (flag & MOD_CAST_Z) {
219  tmp_co[2] = fac * vec[2] * len + facm * tmp_co[2];
220  }
221 
222  if (ctrl_ob) {
223  if (flag & MOD_CAST_USE_OB_TRANSFORM) {
224  mul_m4_v3(imat, tmp_co);
225  }
226  else {
227  add_v3_v3(tmp_co, center);
228  }
229  }
230 
231  copy_v3_v3(vertexCos[i], tmp_co);
232  }
233 }
234 
235 static void cuboid_do(CastModifierData *cmd,
236  const ModifierEvalContext *UNUSED(ctx),
237  Object *ob,
238  Mesh *mesh,
239  float (*vertexCos)[3],
240  int verts_num)
241 {
242  MDeformVert *dvert = NULL;
243  int defgrp_index;
244  const bool invert_vgroup = (cmd->flag & MOD_CAST_INVERT_VGROUP) != 0;
245 
246  Object *ctrl_ob = NULL;
247 
248  int i;
249  bool has_radius = false;
250  short flag;
251  float fac = cmd->fac;
252  float facm = 1.0f - fac;
253  const float fac_orig = fac;
254  float min[3], max[3], bb[8][3];
255  float center[3] = {0.0f, 0.0f, 0.0f};
256  float mat[4][4], imat[4][4];
257 
258  flag = cmd->flag;
259 
260  ctrl_ob = cmd->object;
261 
262  /* now we check which options the user wants */
263 
264  /* 1) (flag was checked in the "if (ctrl_ob)" block above) */
265  /* 2) cmd->radius > 0.0f: only the vertices within this radius from
266  * the center of the effect should be deformed */
267  if (cmd->radius > FLT_EPSILON) {
268  has_radius = 1;
269  }
270 
271  /* 3) if we were given a vertex group name,
272  * only those vertices should be affected */
273  if (cmd->defgrp_name[0] != '\0') {
274  MOD_get_vgroup(ob, mesh, cmd->defgrp_name, &dvert, &defgrp_index);
275  }
276 
277  if (ctrl_ob) {
278  if (flag & MOD_CAST_USE_OB_TRANSFORM) {
279  invert_m4_m4(imat, ctrl_ob->obmat);
280  mul_m4_m4m4(mat, imat, ob->obmat);
281  invert_m4_m4(imat, mat);
282  }
283 
284  invert_m4_m4(ob->imat, ob->obmat);
285  mul_v3_m4v3(center, ob->imat, ctrl_ob->obmat[3]);
286  }
287 
288  if ((flag & MOD_CAST_SIZE_FROM_RADIUS) && has_radius) {
289  for (i = 0; i < 3; i++) {
290  min[i] = -cmd->radius;
291  max[i] = cmd->radius;
292  }
293  }
294  else if (!(flag & MOD_CAST_SIZE_FROM_RADIUS) && cmd->size > 0) {
295  for (i = 0; i < 3; i++) {
296  min[i] = -cmd->size;
297  max[i] = cmd->size;
298  }
299  }
300  else {
301  /* get bound box */
302  /* We can't use the object's bound box because other modifiers
303  * may have changed the vertex data. */
304  INIT_MINMAX(min, max);
305 
306  /* Cast's center is the ob's own center in its local space,
307  * by default, but if the user defined a control object, we use
308  * its location, transformed to ob's local space. */
309  if (ctrl_ob) {
310  float vec[3];
311 
312  /* let the center of the ctrl_ob be part of the bound box: */
314 
315  for (i = 0; i < verts_num; i++) {
316  sub_v3_v3v3(vec, vertexCos[i], center);
317  minmax_v3v3_v3(min, max, vec);
318  }
319  }
320  else {
321  for (i = 0; i < verts_num; i++) {
322  minmax_v3v3_v3(min, max, vertexCos[i]);
323  }
324  }
325 
326  /* we want a symmetric bound box around the origin */
327  if (fabsf(min[0]) > fabsf(max[0])) {
328  max[0] = fabsf(min[0]);
329  }
330  if (fabsf(min[1]) > fabsf(max[1])) {
331  max[1] = fabsf(min[1]);
332  }
333  if (fabsf(min[2]) > fabsf(max[2])) {
334  max[2] = fabsf(min[2]);
335  }
336  min[0] = -max[0];
337  min[1] = -max[1];
338  min[2] = -max[2];
339  }
340 
341  /* building our custom bounding box */
342  bb[0][0] = bb[2][0] = bb[4][0] = bb[6][0] = min[0];
343  bb[1][0] = bb[3][0] = bb[5][0] = bb[7][0] = max[0];
344  bb[0][1] = bb[1][1] = bb[4][1] = bb[5][1] = min[1];
345  bb[2][1] = bb[3][1] = bb[6][1] = bb[7][1] = max[1];
346  bb[0][2] = bb[1][2] = bb[2][2] = bb[3][2] = min[2];
347  bb[4][2] = bb[5][2] = bb[6][2] = bb[7][2] = max[2];
348 
349  /* ready to apply the effect, one vertex at a time */
350  for (i = 0; i < verts_num; i++) {
351  int octant, coord;
352  float d[3], dmax, apex[3], fbb;
353  float tmp_co[3];
354 
355  copy_v3_v3(tmp_co, vertexCos[i]);
356  if (ctrl_ob) {
357  if (flag & MOD_CAST_USE_OB_TRANSFORM) {
358  mul_m4_v3(mat, tmp_co);
359  }
360  else {
361  sub_v3_v3(tmp_co, center);
362  }
363  }
364 
365  if (has_radius) {
366  if (fabsf(tmp_co[0]) > cmd->radius || fabsf(tmp_co[1]) > cmd->radius ||
367  fabsf(tmp_co[2]) > cmd->radius) {
368  continue;
369  }
370  }
371 
372  if (dvert) {
373  const float weight = invert_vgroup ?
374  1.0f - BKE_defvert_find_weight(&dvert[i], defgrp_index) :
375  BKE_defvert_find_weight(&dvert[i], defgrp_index);
376 
377  if (weight == 0.0f) {
378  continue;
379  }
380 
381  fac = fac_orig * weight;
382  facm = 1.0f - fac;
383  }
384 
385  /* The algorithm used to project the vertices to their
386  * bounding box (bb) is pretty simple:
387  * for each vertex v:
388  * 1) find in which octant v is in;
389  * 2) find which outer "wall" of that octant is closer to v;
390  * 3) calculate factor (var fbb) to project v to that wall;
391  * 4) project. */
392 
393  /* find in which octant this vertex is in */
394  octant = 0;
395  if (tmp_co[0] > 0.0f) {
396  octant += 1;
397  }
398  if (tmp_co[1] > 0.0f) {
399  octant += 2;
400  }
401  if (tmp_co[2] > 0.0f) {
402  octant += 4;
403  }
404 
405  /* apex is the bb's vertex at the chosen octant */
406  copy_v3_v3(apex, bb[octant]);
407 
408  /* find which bb plane is closest to this vertex ... */
409  d[0] = tmp_co[0] / apex[0];
410  d[1] = tmp_co[1] / apex[1];
411  d[2] = tmp_co[2] / apex[2];
412 
413  /* ... (the closest has the higher (closer to 1) d value) */
414  dmax = d[0];
415  coord = 0;
416  if (d[1] > dmax) {
417  dmax = d[1];
418  coord = 1;
419  }
420  if (d[2] > dmax) {
421  /* dmax = d[2]; */ /* commented, we don't need it */
422  coord = 2;
423  }
424 
425  /* ok, now we know which coordinate of the vertex to use */
426 
427  if (fabsf(tmp_co[coord]) < FLT_EPSILON) { /* avoid division by zero */
428  continue;
429  }
430 
431  /* finally, this is the factor we wanted, to project the vertex
432  * to its bounding box (bb) */
433  fbb = apex[coord] / tmp_co[coord];
434 
435  /* calculate the new vertex position */
436  if (flag & MOD_CAST_X) {
437  tmp_co[0] = facm * tmp_co[0] + fac * tmp_co[0] * fbb;
438  }
439  if (flag & MOD_CAST_Y) {
440  tmp_co[1] = facm * tmp_co[1] + fac * tmp_co[1] * fbb;
441  }
442  if (flag & MOD_CAST_Z) {
443  tmp_co[2] = facm * tmp_co[2] + fac * tmp_co[2] * fbb;
444  }
445 
446  if (ctrl_ob) {
447  if (flag & MOD_CAST_USE_OB_TRANSFORM) {
448  mul_m4_v3(imat, tmp_co);
449  }
450  else {
451  add_v3_v3(tmp_co, center);
452  }
453  }
454 
455  copy_v3_v3(vertexCos[i], tmp_co);
456  }
457 }
458 
459 static void deformVerts(ModifierData *md,
460  const ModifierEvalContext *ctx,
461  Mesh *mesh,
462  float (*vertexCos)[3],
463  int verts_num)
464 {
465  CastModifierData *cmd = (CastModifierData *)md;
466  Mesh *mesh_src = NULL;
467 
468  if (ctx->object->type == OB_MESH && cmd->defgrp_name[0] != '\0') {
469  /* mesh_src is only needed for vgroups. */
470  mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, verts_num, false, false);
471  }
472 
473  if (cmd->type == MOD_CAST_TYPE_CUBOID) {
474  cuboid_do(cmd, ctx, ctx->object, mesh_src, vertexCos, verts_num);
475  }
476  else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
477  sphere_do(cmd, ctx, ctx->object, mesh_src, vertexCos, verts_num);
478  }
479 
480  if (!ELEM(mesh_src, NULL, mesh)) {
481  BKE_id_free(NULL, mesh_src);
482  }
483 }
484 
485 static void deformVertsEM(ModifierData *md,
486  const ModifierEvalContext *ctx,
487  struct BMEditMesh *editData,
488  Mesh *mesh,
489  float (*vertexCos)[3],
490  int verts_num)
491 {
492  CastModifierData *cmd = (CastModifierData *)md;
493  Mesh *mesh_src = NULL;
494 
495  if (cmd->defgrp_name[0] != '\0') {
496  mesh_src = MOD_deform_mesh_eval_get(
497  ctx->object, editData, mesh, NULL, verts_num, false, false);
498  }
499 
501  BLI_assert(mesh->totvert == verts_num);
502  }
503 
504  /* TODO(Campbell): use edit-mode data only (remove this line). */
505  if (mesh_src != NULL) {
507  }
508 
509  if (cmd->type == MOD_CAST_TYPE_CUBOID) {
510  cuboid_do(cmd, ctx, ctx->object, mesh_src, vertexCos, verts_num);
511  }
512  else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
513  sphere_do(cmd, ctx, ctx->object, mesh_src, vertexCos, verts_num);
514  }
515 
516  if (!ELEM(mesh_src, NULL, mesh)) {
517  BKE_id_free(NULL, mesh_src);
518  }
519 }
520 
521 static void panel_draw(const bContext *UNUSED(C), Panel *panel)
522 {
523  uiLayout *row;
524  uiLayout *layout = panel->layout;
526 
527  PointerRNA ob_ptr;
529 
530  PointerRNA cast_object_ptr = RNA_pointer_get(ptr, "object");
531 
532  uiLayoutSetPropSep(layout, true);
533 
534  uiItemR(layout, ptr, "cast_type", 0, NULL, ICON_NONE);
535 
536  row = uiLayoutRowWithHeading(layout, true, IFACE_("Axis"));
537  uiItemR(row, ptr, "use_x", toggles_flag, NULL, ICON_NONE);
538  uiItemR(row, ptr, "use_y", toggles_flag, NULL, ICON_NONE);
539  uiItemR(row, ptr, "use_z", toggles_flag, NULL, ICON_NONE);
540 
541  uiItemR(layout, ptr, "factor", 0, NULL, ICON_NONE);
542  uiItemR(layout, ptr, "radius", 0, NULL, ICON_NONE);
543  uiItemR(layout, ptr, "size", 0, NULL, ICON_NONE);
544  uiItemR(layout, ptr, "use_radius_as_size", 0, NULL, ICON_NONE);
545 
546  modifier_vgroup_ui(layout, ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
547 
548  uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
549  if (!RNA_pointer_is_null(&cast_object_ptr)) {
550  uiItemR(layout, ptr, "use_transform", 0, NULL, ICON_NONE);
551  }
552 
553  modifier_panel_end(layout, ptr);
554 }
555 
556 static void panelRegister(ARegionType *region_type)
557 {
559 }
560 
562  /* name */ N_("Cast"),
563  /* structName */ "CastModifierData",
564  /* structSize */ sizeof(CastModifierData),
565  /* srna */ &RNA_CastModifier,
566  /* type */ eModifierTypeType_OnlyDeform,
569  /* icon */ ICON_MOD_CAST,
570 
571  /* copyData */ BKE_modifier_copydata_generic,
572 
573  /* deformVerts */ deformVerts,
574  /* deformMatrices */ NULL,
575  /* deformVertsEM */ deformVertsEM,
576  /* deformMatricesEM */ NULL,
577  /* modifyMesh */ NULL,
578  /* modifyGeometrySet */ NULL,
579 
580  /* initData */ initData,
581  /* requiredDataMask */ requiredDataMask,
582  /* freeData */ NULL,
583  /* isDisabled */ isDisabled,
584  /* updateDepsgraph */ updateDepsgraph,
585  /* dependsOnTime */ NULL,
586  /* dependsOnNormals */ NULL,
587  /* foreachIDLink */ foreachIDLink,
588  /* foreachTexLink */ NULL,
589  /* freeRuntimeData */ NULL,
590  /* panelRegister */ panelRegister,
591  /* blendWrite */ NULL,
592  /* blendRead */ NULL,
593 };
support for deformation groups and hooks.
float BKE_defvert_find_weight(const struct MDeformVert *dvert, int defgroup)
Definition: deform.c:704
void BKE_id_free(struct Main *bmain, void *idv)
@ IDWALK_CB_NOP
Definition: BKE_lib_query.h:33
void BKE_mesh_wrapper_ensure_mdata(struct Mesh *me)
Definition: mesh_wrapper.cc:94
void(* IDWalkFunc)(void *userData, struct Object *ob, struct ID **idpoin, int cb_flag)
Definition: BKE_modifier.h:107
@ eModifierTypeFlag_AcceptsCVs
Definition: BKE_modifier.h:67
@ eModifierTypeFlag_SupportsEditmode
Definition: BKE_modifier.h:69
@ eModifierTypeFlag_AcceptsVertexCosOnly
Definition: BKE_modifier.h:100
void BKE_modifier_copydata_generic(const struct ModifierData *md, struct ModifierData *md_dst, int flag)
@ eModifierTypeType_OnlyDeform
Definition: BKE_modifier.h:44
#define BLI_assert(a)
Definition: BLI_assert.h:46
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
Definition: math_matrix.c:259
bool invert_m4_m4(float R[4][4], const float A[4][4])
Definition: math_matrix.c:1287
void mul_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:729
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
Definition: math_matrix.c:739
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
Definition: math_vector.c:867
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
#define INIT_MINMAX(min, max)
#define UNUSED(x)
#define ELEM(...)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define IFACE_(msgid)
void DEG_add_object_relation(struct DepsNodeHandle *node_handle, struct Object *object, eDepsObjectComponentType component, const char *description)
void DEG_add_modifier_to_transform_relation(struct DepsNodeHandle *node_handle, const char *description)
@ DEG_OB_COMP_TRANSFORM
#define CD_MASK_MDEFORMVERT
#define DNA_struct_default_get(struct_name)
Definition: DNA_defaults.h:29
@ ME_WRAPPER_TYPE_MDATA
@ MOD_CAST_TYPE_CYLINDER
@ MOD_CAST_TYPE_CUBOID
@ MOD_CAST_USE_OB_TRANSFORM
@ MOD_CAST_INVERT_VGROUP
@ MOD_CAST_Y
@ MOD_CAST_X
@ MOD_CAST_Z
@ MOD_CAST_SIZE_FROM_RADIUS
struct CastModifierData CastModifierData
@ eModifierType_Cast
Object is a sort of wrapper for general info.
@ OB_MESH
NSNotificationCenter * center
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
static void cuboid_do(CastModifierData *cmd, const ModifierEvalContext *UNUSED(ctx), Object *ob, Mesh *mesh, float(*vertexCos)[3], int verts_num)
Definition: MOD_cast.c:235
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh, float(*vertexCos)[3], int verts_num)
Definition: MOD_cast.c:459
static void deformVertsEM(ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *editData, Mesh *mesh, float(*vertexCos)[3], int verts_num)
Definition: MOD_cast.c:485
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
Definition: MOD_cast.c:85
ModifierTypeInfo modifierType_Cast
Definition: MOD_cast.c:561
static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, bool UNUSED(useRenderParams))
Definition: MOD_cast.c:50
static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
Definition: MOD_cast.c:78
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
Definition: MOD_cast.c:521
static void initData(ModifierData *md)
Definition: MOD_cast.c:41
static void sphere_do(CastModifierData *cmd, const ModifierEvalContext *UNUSED(ctx), Object *ob, Mesh *mesh, float(*vertexCos)[3], int verts_num)
Definition: MOD_cast.c:94
static void panelRegister(ARegionType *region_type)
Definition: MOD_cast.c:556
static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
Definition: MOD_cast.c:66
PointerRNA * modifier_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
void modifier_panel_end(uiLayout *layout, PointerRNA *ptr)
Definition: MOD_ui_common.c:91
PanelType * modifier_panel_register(ARegionType *region_type, ModifierType type, PanelDrawFn draw)
void modifier_vgroup_ui(uiLayout *layout, PointerRNA *ptr, PointerRNA *ob_ptr, const char *vgroup_prop, const char *invert_vgroup_prop, const char *text)
Mesh * MOD_deform_mesh_eval_get(Object *ob, struct BMEditMesh *em, Mesh *mesh, const float(*vertexCos)[3], const int verts_num, const bool use_normals, const bool use_orco)
Definition: MOD_util.c:167
void MOD_get_vgroup(Object *ob, struct Mesh *mesh, const char *name, MDeformVert **dvert, int *defgrp_index)
Definition: MOD_util.c:235
#define C
Definition: RandGen.cpp:25
uiLayout * uiLayoutRowWithHeading(uiLayout *layout, bool align, const char *heading)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
@ UI_ITEM_R_TOGGLE
@ UI_ITEM_R_FORCE_BLANK_DECORATE
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
Scene scene
int len
Definition: draw_manager.c:108
#define fabsf(x)
Definition: metal/compat.h:219
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5167
bool RNA_pointer_is_null(const PointerRNA *ptr)
Definition: rna_access.c:164
#define min(a, b)
Definition: sort.c:35
struct Object * object
Definition: DNA_ID.h:368
int totvert
Mesh_Runtime runtime
struct Object * object
Definition: BKE_modifier.h:141
struct DepsNodeHandle * node
Definition: BKE_modifier.h:134
float imat[4][4]
float obmat[4][4]
struct uiLayout * layout
float max
#define N_(msgid)
PointerRNA * ptr
Definition: wm_files.c:3480