Blender  V3.3
MOD_simpledeform.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_math.h"
9 #include "BLI_task.h"
10 #include "BLI_utildefines.h"
11 #include "BLT_translation.h"
12 
13 #include "DNA_defaults.h"
14 #include "DNA_mesh_types.h"
15 #include "DNA_meshdata_types.h"
16 #include "DNA_object_types.h"
17 #include "DNA_screen_types.h"
18 
19 #include "BKE_context.h"
20 #include "BKE_deform.h"
21 #include "BKE_editmesh.h"
22 #include "BKE_lib_id.h"
23 #include "BKE_lib_query.h"
24 #include "BKE_mesh.h"
25 #include "BKE_mesh_wrapper.h"
26 #include "BKE_modifier.h"
27 #include "BKE_screen.h"
28 
29 #include "UI_interface.h"
30 #include "UI_resources.h"
31 
32 #include "RNA_access.h"
33 #include "RNA_prototypes.h"
34 
35 #include "DEG_depsgraph_query.h"
36 
37 #include "MOD_ui_common.h"
38 #include "MOD_util.h"
39 
40 #include "bmesh.h"
41 
42 #define BEND_EPS 0.000001f
43 
46  char mode;
48  int lock_axis;
49  int vgroup;
51  float weight;
52  float smd_factor;
53  float smd_limit[2];
57 };
58 
59 /* Re-maps the indices for X Y Z by shifting them up and wrapping, such that
60  * X = Y, Y = Z, Z = X (for X axis), and X = Z, Y = X, Z = Y (for Y axis). This
61  * exists because the deformations (excluding bend) are based on the Z axis.
62  * Having this helps avoid long, drawn out switches. */
63 static const uint axis_map_table[3][3] = {
64  {1, 2, 0},
65  {2, 0, 1},
66  {0, 1, 2},
67 };
68 
69 BLI_INLINE void copy_v3_v3_map(float a[3], const float b[3], const uint map[3])
70 {
71  a[0] = b[map[0]];
72  a[1] = b[map[1]];
73  a[2] = b[map[2]];
74 }
75 
76 BLI_INLINE void copy_v3_v3_unmap(float a[3], const float b[3], const uint map[3])
77 {
78  a[map[0]] = b[0];
79  a[map[1]] = b[1];
80  a[map[2]] = b[2];
81 }
82 
83 /* Clamps/Limits the given coordinate to: limits[0] <= co[axis] <= limits[1]
84  * The amount of clamp is saved on dcut */
85 static void axis_limit(const int axis, const float limits[2], float co[3], float dcut[3])
86 {
87  float val = co[axis];
88  if (limits[0] > val) {
89  val = limits[0];
90  }
91  if (limits[1] < val) {
92  val = limits[1];
93  }
94 
95  dcut[axis] = co[axis] - val;
96  co[axis] = val;
97 }
98 
99 static void simpleDeform_taper(const float factor,
100  const int UNUSED(axis),
101  const float dcut[3],
102  float r_co[3])
103 {
104  float x = r_co[0], y = r_co[1], z = r_co[2];
105  float scale = z * factor;
106 
107  r_co[0] = x + x * scale;
108  r_co[1] = y + y * scale;
109  r_co[2] = z;
110 
111  add_v3_v3(r_co, dcut);
112 }
113 
114 static void simpleDeform_stretch(const float factor,
115  const int UNUSED(axis),
116  const float dcut[3],
117  float r_co[3])
118 {
119  float x = r_co[0], y = r_co[1], z = r_co[2];
120  float scale;
121 
122  scale = (z * z * factor - factor + 1.0f);
123 
124  r_co[0] = x * scale;
125  r_co[1] = y * scale;
126  r_co[2] = z * (1.0f + factor);
127 
128  add_v3_v3(r_co, dcut);
129 }
130 
131 static void simpleDeform_twist(const float factor,
132  const int UNUSED(axis),
133  const float *dcut,
134  float r_co[3])
135 {
136  float x = r_co[0], y = r_co[1], z = r_co[2];
137  float theta, sint, cost;
138 
139  theta = z * factor;
140  sint = sinf(theta);
141  cost = cosf(theta);
142 
143  r_co[0] = x * cost - y * sint;
144  r_co[1] = x * sint + y * cost;
145  r_co[2] = z;
146 
147  add_v3_v3(r_co, dcut);
148 }
149 
150 static void simpleDeform_bend(const float factor,
151  const int axis,
152  const float dcut[3],
153  float r_co[3])
154 {
155  float x = r_co[0], y = r_co[1], z = r_co[2];
156  float theta, sint, cost;
157 
158  BLI_assert(!(fabsf(factor) < BEND_EPS));
159 
160  switch (axis) {
161  case 0:
163  case 1:
164  theta = z * factor;
165  break;
166  default:
167  theta = x * factor;
168  }
169  sint = sinf(theta);
170  cost = cosf(theta);
171 
172  /* NOTE: the operations below a susceptible to float precision errors
173  * regarding the order of operations, take care when changing, see: T85470 */
174  switch (axis) {
175  case 0:
176  r_co[0] = x;
177  r_co[1] = y * cost + (1.0f - cost) / factor;
178  r_co[2] = -(y - 1.0f / factor) * sint;
179  {
180  r_co[0] += dcut[0];
181  r_co[1] += sint * dcut[2];
182  r_co[2] += cost * dcut[2];
183  }
184  break;
185  case 1:
186  r_co[0] = x * cost + (1.0f - cost) / factor;
187  r_co[1] = y;
188  r_co[2] = -(x - 1.0f / factor) * sint;
189  {
190  r_co[0] += sint * dcut[2];
191  r_co[1] += dcut[1];
192  r_co[2] += cost * dcut[2];
193  }
194  break;
195  default:
196  r_co[0] = -(y - 1.0f / factor) * sint;
197  r_co[1] = y * cost + (1.0f - cost) / factor;
198  r_co[2] = z;
199  {
200  r_co[0] += cost * dcut[0];
201  r_co[1] += sint * dcut[0];
202  r_co[2] += dcut[2];
203  }
204  }
205 }
206 
207 static void simple_helper(void *__restrict userdata,
208  const int iter,
209  const TaskParallelTLS *__restrict UNUSED(tls))
210 {
211  const struct DeformUserData *curr_deform_data = userdata;
213  curr_deform_data->dvert, iter, curr_deform_data->vgroup);
214  const uint *axis_map = axis_map_table[(curr_deform_data->mode != MOD_SIMPLEDEFORM_MODE_BEND) ?
215  curr_deform_data->deform_axis :
216  2];
217  const float base_limit[2] = {0.0f, 0.0f};
218 
219  if (curr_deform_data->invert_vgroup) {
220  weight = 1.0f - weight;
221  }
222 
223  if (weight != 0.0f) {
224  float co[3], dcut[3] = {0.0f, 0.0f, 0.0f};
225 
226  if (curr_deform_data->transf) {
227  BLI_space_transform_apply(curr_deform_data->transf, curr_deform_data->vertexCos[iter]);
228  }
229 
230  copy_v3_v3(co, curr_deform_data->vertexCos[iter]);
231 
232  /* Apply axis limits, and axis mappings */
233  if (curr_deform_data->lock_axis & MOD_SIMPLEDEFORM_LOCK_AXIS_X) {
234  axis_limit(0, base_limit, co, dcut);
235  }
236  if (curr_deform_data->lock_axis & MOD_SIMPLEDEFORM_LOCK_AXIS_Y) {
237  axis_limit(1, base_limit, co, dcut);
238  }
239  if (curr_deform_data->lock_axis & MOD_SIMPLEDEFORM_LOCK_AXIS_Z) {
240  axis_limit(2, base_limit, co, dcut);
241  }
242  axis_limit(curr_deform_data->limit_axis, curr_deform_data->smd_limit, co, dcut);
243 
244  /* apply the deform to a mapped copy of the vertex, and then re-map it back. */
245  float co_remap[3];
246  float dcut_remap[3];
247  copy_v3_v3_map(co_remap, co, axis_map);
248  copy_v3_v3_map(dcut_remap, dcut, axis_map);
249  switch (curr_deform_data->mode) {
251  /* Apply deform. */
253  curr_deform_data->smd_factor, curr_deform_data->deform_axis, dcut_remap, co_remap);
254  break;
256  /* Apply deform. */
258  curr_deform_data->smd_factor, curr_deform_data->deform_axis, dcut_remap, co_remap);
259  break;
261  /* Apply deform. */
263  curr_deform_data->smd_factor, curr_deform_data->deform_axis, dcut_remap, co_remap);
264  break;
266  /* Apply deform. */
268  curr_deform_data->smd_factor, curr_deform_data->deform_axis, dcut_remap, co_remap);
269  break;
270  default:
271  return; /* No simple-deform mode? */
272  }
273  copy_v3_v3_unmap(co, co_remap, axis_map);
274 
275  /* Use vertex weight has coef of linear interpolation */
277  curr_deform_data->vertexCos[iter], curr_deform_data->vertexCos[iter], co, weight);
278 
279  if (curr_deform_data->transf) {
280  BLI_space_transform_invert(curr_deform_data->transf, curr_deform_data->vertexCos[iter]);
281  }
282  }
283 }
284 
285 /* simple deform modifier */
287  const ModifierEvalContext *UNUSED(ctx),
288  struct Object *ob,
289  struct Mesh *mesh,
290  float (*vertexCos)[3],
291  int verts_num)
292 {
293  int i;
294  float smd_limit[2], smd_factor;
295  SpaceTransform *transf = NULL, tmp_transf;
296  int vgroup;
298 
299  /* This is historically the lock axis, _not_ the deform axis as the name would imply */
300  const int deform_axis = smd->deform_axis;
301  int lock_axis = smd->axis;
302  if (smd->mode == MOD_SIMPLEDEFORM_MODE_BEND) { /* Bend mode shouldn't have any lock axis */
303  lock_axis = 0;
304  }
305  else {
306  /* Don't lock axis if it is the chosen deform axis, as this flattens
307  * the geometry */
308  if (deform_axis == 0) {
310  }
311  if (deform_axis == 1) {
313  }
314  if (deform_axis == 2) {
316  }
317  }
318 
319  /* Safe-check */
320  if (smd->origin == ob) {
321  smd->origin = NULL; /* No self references */
322  }
323 
324  if (smd->limit[0] < 0.0f) {
325  smd->limit[0] = 0.0f;
326  }
327  if (smd->limit[0] > 1.0f) {
328  smd->limit[0] = 1.0f;
329  }
330 
331  smd->limit[0] = min_ff(smd->limit[0], smd->limit[1]); /* Upper limit >= than lower limit */
332 
333  /* Calculate matrix to convert between coordinate spaces. */
334  if (smd->origin != NULL) {
335  transf = &tmp_transf;
337  }
338 
339  /* Update limits if needed */
340  int limit_axis = deform_axis;
341  if (smd->mode == MOD_SIMPLEDEFORM_MODE_BEND) {
342  /* Bend is a special case. */
343  switch (deform_axis) {
344  case 0:
346  case 1:
347  limit_axis = 2;
348  break;
349  default:
350  limit_axis = 0;
351  }
352  }
353 
354  {
355  float lower = FLT_MAX;
356  float upper = -FLT_MAX;
357 
358  for (i = 0; i < verts_num; i++) {
359  float tmp[3];
360  copy_v3_v3(tmp, vertexCos[i]);
361 
362  if (transf) {
364  }
365 
366  lower = min_ff(lower, tmp[limit_axis]);
367  upper = max_ff(upper, tmp[limit_axis]);
368  }
369 
370  /* SMD values are normalized to the BV, calculate the absolute values */
371  smd_limit[1] = lower + (upper - lower) * smd->limit[1];
372  smd_limit[0] = lower + (upper - lower) * smd->limit[0];
373 
374  smd_factor = smd->factor / max_ff(FLT_EPSILON, smd_limit[1] - smd_limit[0]);
375  }
376 
377  if (smd->mode == MOD_SIMPLEDEFORM_MODE_BEND) {
378  if (fabsf(smd_factor) < BEND_EPS) {
379  return;
380  }
381  }
382 
383  MOD_get_vgroup(ob, mesh, smd->vgroup_name, &dvert, &vgroup);
384  const bool invert_vgroup = (smd->flag & MOD_SIMPLEDEFORM_FLAG_INVERT_VGROUP) != 0;
385 
386  /* Build our data. */
387  const struct DeformUserData deform_pool_data = {
388  .mode = smd->mode,
389  .smd_factor = smd_factor,
390  .deform_axis = deform_axis,
391  .transf = transf,
392  .vertexCos = vertexCos,
393  .invert_vgroup = invert_vgroup,
394  .lock_axis = lock_axis,
395  .vgroup = vgroup,
396  .smd_limit[0] = smd_limit[0],
397  .smd_limit[1] = smd_limit[1],
398  .dvert = dvert,
399  .limit_axis = limit_axis,
400  };
401  /* Do deformation. */
402  TaskParallelSettings settings;
404  BLI_task_parallel_range(0, verts_num, (void *)&deform_pool_data, simple_helper, &settings);
405 }
406 
407 /* SimpleDeform */
408 static void initData(ModifierData *md)
409 {
411 
412  BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(smd, modifier));
413 
415 }
416 
417 static void requiredDataMask(Object *UNUSED(ob),
418  ModifierData *md,
419  CustomData_MeshMasks *r_cddata_masks)
420 {
422 
423  /* ask for vertexgroups if we need them */
424  if (smd->vgroup_name[0] != '\0') {
425  r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
426  }
427 }
428 
429 static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
430 {
432  walk(userData, ob, (ID **)&smd->origin, IDWALK_CB_NOP);
433 }
434 
436 {
438  if (smd->origin != NULL) {
440  ctx->node, smd->origin, DEG_OB_COMP_TRANSFORM, "SimpleDeform Modifier");
441  DEG_add_modifier_to_transform_relation(ctx->node, "SimpleDeform Modifier");
442  }
443 }
444 
445 static void deformVerts(ModifierData *md,
446  const ModifierEvalContext *ctx,
447  struct Mesh *mesh,
448  float (*vertexCos)[3],
449  int verts_num)
450 {
452  Mesh *mesh_src = NULL;
453 
454  if (ctx->object->type == OB_MESH && sdmd->vgroup_name[0] != '\0') {
455  /* mesh_src is only needed for vgroups. */
456  mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, verts_num, false, false);
457  }
458 
459  SimpleDeformModifier_do(sdmd, ctx, ctx->object, mesh_src, vertexCos, verts_num);
460 
461  if (!ELEM(mesh_src, NULL, mesh)) {
462  BKE_id_free(NULL, mesh_src);
463  }
464 }
465 
466 static void deformVertsEM(ModifierData *md,
467  const ModifierEvalContext *ctx,
468  struct BMEditMesh *editData,
469  struct Mesh *mesh,
470  float (*vertexCos)[3],
471  int verts_num)
472 {
474  Mesh *mesh_src = NULL;
475 
476  if (ctx->object->type == OB_MESH && sdmd->vgroup_name[0] != '\0') {
477  /* mesh_src is only needed for vgroups. */
478  mesh_src = MOD_deform_mesh_eval_get(
479  ctx->object, editData, mesh, NULL, verts_num, false, false);
480  }
481 
482  /* TODO(Campbell): use edit-mode data only (remove this line). */
483  if (mesh_src != NULL) {
485  }
486 
487  SimpleDeformModifier_do(sdmd, ctx, ctx->object, mesh_src, vertexCos, verts_num);
488 
489  if (!ELEM(mesh_src, NULL, mesh)) {
490  BKE_id_free(NULL, mesh_src);
491  }
492 }
493 
494 static void panel_draw(const bContext *UNUSED(C), Panel *panel)
495 {
496  uiLayout *row;
497  uiLayout *layout = panel->layout;
498 
499  PointerRNA ob_ptr;
501 
502  int deform_method = RNA_enum_get(ptr, "deform_method");
503 
504  row = uiLayoutRow(layout, false);
505  uiItemR(row, ptr, "deform_method", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
506 
507  uiLayoutSetPropSep(layout, true);
508 
510  uiItemR(layout, ptr, "factor", 0, NULL, ICON_NONE);
511  }
512  else {
513  uiItemR(layout, ptr, "angle", 0, NULL, ICON_NONE);
514  }
515 
516  uiItemR(layout, ptr, "origin", 0, NULL, ICON_NONE);
517  uiItemR(layout, ptr, "deform_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
518 
519  modifier_panel_end(layout, ptr);
520 }
521 
522 static void restrictions_panel_draw(const bContext *UNUSED(C), Panel *panel)
523 {
524  uiLayout *row;
525  uiLayout *layout = panel->layout;
527 
528  PointerRNA ob_ptr;
530 
531  int deform_method = RNA_enum_get(ptr, "deform_method");
532 
533  uiLayoutSetPropSep(layout, true);
534 
535  uiItemR(layout, ptr, "limits", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
536 
537  if (ELEM(deform_method,
541  int deform_axis = RNA_enum_get(ptr, "deform_axis");
542 
543  row = uiLayoutRowWithHeading(layout, true, IFACE_("Lock"));
544  if (deform_axis != 0) {
545  uiItemR(row, ptr, "lock_x", toggles_flag, NULL, ICON_NONE);
546  }
547  if (deform_axis != 1) {
548  uiItemR(row, ptr, "lock_y", toggles_flag, NULL, ICON_NONE);
549  }
550  if (deform_axis != 2) {
551  uiItemR(row, ptr, "lock_z", toggles_flag, NULL, ICON_NONE);
552  }
553  }
554 
555  modifier_vgroup_ui(layout, ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
556 }
557 
558 static void panelRegister(ARegionType *region_type)
559 {
560  PanelType *panel_type = modifier_panel_register(
561  region_type, eModifierType_SimpleDeform, panel_draw);
563  region_type, "restrictions", "Restrictions", NULL, restrictions_panel_draw, panel_type);
564 }
565 
567  /* name */ N_("SimpleDeform"),
568  /* structName */ "SimpleDeformModifierData",
569  /* structSize */ sizeof(SimpleDeformModifierData),
570  /* srna */ &RNA_SimpleDeformModifier,
571  /* type */ eModifierTypeType_OnlyDeform,
572 
576  /* icon */ ICON_MOD_SIMPLEDEFORM,
577 
578  /* copyData */ BKE_modifier_copydata_generic,
579 
580  /* deformVerts */ deformVerts,
581  /* deformMatrices */ NULL,
582  /* deformVertsEM */ deformVertsEM,
583  /* deformMatricesEM */ NULL,
584  /* modifyMesh */ NULL,
585  /* modifyGeometrySet */ NULL,
586 
587  /* initData */ initData,
588  /* requiredDataMask */ requiredDataMask,
589  /* freeData */ NULL,
590  /* isDisabled */ NULL,
591  /* updateDepsgraph */ updateDepsgraph,
592  /* dependsOnTime */ NULL,
593  /* dependsOnNormals */ NULL,
594  /* foreachIDLink */ foreachIDLink,
595  /* foreachTexLink */ NULL,
596  /* freeRuntimeData */ NULL,
597  /* panelRegister */ panelRegister,
598  /* blendWrite */ NULL,
599  /* blendRead */ NULL,
600 };
typedef float(TangentPoint)[2]
support for deformation groups and hooks.
float BKE_defvert_array_find_weight_safe(const struct MDeformVert *dvert, int index, int defgroup)
Definition: deform.c:710
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_EnableInEditmode
Definition: BKE_modifier.h:78
@ eModifierTypeFlag_SupportsEditmode
Definition: BKE_modifier.h:69
@ eModifierTypeFlag_AcceptsVertexCosOnly
Definition: BKE_modifier.h:100
@ eModifierTypeFlag_AcceptsMesh
Definition: BKE_modifier.h:66
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
#define ALIGN_STRUCT
#define ATTR_FALLTHROUGH
#define BLI_INLINE
MINLINE float max_ff(float a, float b)
MINLINE float min_ff(float a, float b)
void BLI_space_transform_apply(const struct SpaceTransform *data, float co[3])
void BLI_space_transform_invert(const struct SpaceTransform *data, float co[3])
#define BLI_SPACE_TRANSFORM_SETUP(data, local, target)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
Definition: math_vector.c:29
MINLINE void add_v3_v3(float r[3], const float a[3])
unsigned int uint
Definition: BLI_sys_types.h:67
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
Definition: task_range.cc:94
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
Definition: BLI_task.h:293
#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
struct SimpleDeformModifierData SimpleDeformModifierData
@ MOD_SIMPLEDEFORM_MODE_TAPER
@ MOD_SIMPLEDEFORM_MODE_STRETCH
@ MOD_SIMPLEDEFORM_MODE_BEND
@ MOD_SIMPLEDEFORM_MODE_TWIST
@ eModifierType_SimpleDeform
@ MOD_SIMPLEDEFORM_FLAG_INVERT_VGROUP
@ MOD_SIMPLEDEFORM_LOCK_AXIS_Z
@ MOD_SIMPLEDEFORM_LOCK_AXIS_X
@ MOD_SIMPLEDEFORM_LOCK_AXIS_Y
Object is a sort of wrapper for general info.
@ OB_MESH
_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 const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble z
_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 const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
BLI_INLINE void copy_v3_v3_map(float a[3], const float b[3], const uint map[3])
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
ModifierTypeInfo modifierType_SimpleDeform
static void simpleDeform_taper(const float factor, const int UNUSED(axis), const float dcut[3], float r_co[3])
static const uint axis_map_table[3][3]
BLI_INLINE void copy_v3_v3_unmap(float a[3], const float b[3], const uint map[3])
static void simpleDeform_bend(const float factor, const int axis, const float dcut[3], float r_co[3])
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx, struct Mesh *mesh, float(*vertexCos)[3], int verts_num)
#define BEND_EPS
static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
static void axis_limit(const int axis, const float limits[2], float co[3], float dcut[3])
static void deformVertsEM(ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *editData, struct Mesh *mesh, float(*vertexCos)[3], int verts_num)
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void simple_helper(void *__restrict userdata, const int iter, const TaskParallelTLS *__restrict UNUSED(tls))
static void initData(ModifierData *md)
static void panelRegister(ARegionType *region_type)
static void simpleDeform_twist(const float factor, const int UNUSED(axis), const float *dcut, float r_co[3])
static void restrictions_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void simpleDeform_stretch(const float factor, const int UNUSED(axis), const float dcut[3], float r_co[3])
static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, const ModifierEvalContext *UNUSED(ctx), struct Object *ob, struct Mesh *mesh, float(*vertexCos)[3], int verts_num)
static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
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)
PanelType * modifier_subpanel_register(ARegionType *region_type, const char *name, const char *label, PanelDrawFn draw_header, PanelDrawFn draw, PanelType *parent)
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)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
@ UI_ITEM_R_TOGGLE
@ UI_ITEM_R_FORCE_BLANK_DECORATE
@ UI_ITEM_R_EXPAND
@ UI_ITEM_R_SLIDER
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
#define sinf(x)
Definition: cuda/compat.h:102
#define cosf(x)
Definition: cuda/compat.h:101
#define fabsf(x)
Definition: metal/compat.h:219
static unsigned a[3]
Definition: RandGen.cpp:78
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
SocketIndexByIdentifierMap * map
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
const MDeformVert * dvert
const SpaceTransform * transf
float(* vertexCos)[3]
Definition: DNA_ID.h:368
struct Object * object
Definition: BKE_modifier.h:141
struct DepsNodeHandle * node
Definition: BKE_modifier.h:134
struct uiLayout * layout
#define N_(msgid)
PointerRNA * ptr
Definition: wm_files.c:3480