Blender  V2.93
MOD_simpledeform.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 by the Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include "BLI_utildefines.h"
25 
26 #include "BLI_math.h"
27 
28 #include "BLT_translation.h"
29 
30 #include "DNA_defaults.h"
31 #include "DNA_mesh_types.h"
32 #include "DNA_meshdata_types.h"
33 #include "DNA_object_types.h"
34 #include "DNA_screen_types.h"
35 
36 #include "BKE_context.h"
37 #include "BKE_deform.h"
38 #include "BKE_editmesh.h"
39 #include "BKE_lib_id.h"
40 #include "BKE_lib_query.h"
41 #include "BKE_mesh.h"
42 #include "BKE_mesh_wrapper.h"
43 #include "BKE_modifier.h"
44 #include "BKE_screen.h"
45 
46 #include "UI_interface.h"
47 #include "UI_resources.h"
48 
49 #include "RNA_access.h"
50 
51 #include "DEG_depsgraph_query.h"
52 
53 #include "MOD_ui_common.h"
54 #include "MOD_util.h"
55 
56 #include "bmesh.h"
57 
58 #define BEND_EPS 0.000001f
59 
60 /* Re-maps the indices for X Y Z by shifting them up and wrapping, such that
61  * X = Y, Y = Z, Z = X (for X axis), and X = Z, Y = X, Z = Y (for Y axis). This
62  * exists because the deformations (excluding bend) are based on the Z axis.
63  * Having this helps avoid long, drawn out switches. */
64 static const uint axis_map_table[3][3] = {
65  {1, 2, 0},
66  {2, 0, 1},
67  {0, 1, 2},
68 };
69 
70 BLI_INLINE void copy_v3_v3_map(float a[3], const float b[3], const uint map[3])
71 {
72  a[0] = b[map[0]];
73  a[1] = b[map[1]];
74  a[2] = b[map[2]];
75 }
76 
77 BLI_INLINE void copy_v3_v3_unmap(float a[3], const float b[3], const uint map[3])
78 {
79  a[map[0]] = b[0];
80  a[map[1]] = b[1];
81  a[map[2]] = b[2];
82 }
83 
84 /* Clamps/Limits the given coordinate to: limits[0] <= co[axis] <= limits[1]
85  * The amount of clamp is saved on dcut */
86 static void axis_limit(const int axis, const float limits[2], float co[3], float dcut[3])
87 {
88  float val = co[axis];
89  if (limits[0] > val) {
90  val = limits[0];
91  }
92  if (limits[1] < val) {
93  val = limits[1];
94  }
95 
96  dcut[axis] = co[axis] - val;
97  co[axis] = val;
98 }
99 
100 static void simpleDeform_taper(const float factor,
101  const int UNUSED(axis),
102  const float dcut[3],
103  float r_co[3])
104 {
105  float x = r_co[0], y = r_co[1], z = r_co[2];
106  float scale = z * factor;
107 
108  r_co[0] = x + x * scale;
109  r_co[1] = y + y * scale;
110  r_co[2] = z;
111 
112  add_v3_v3(r_co, dcut);
113 }
114 
115 static void simpleDeform_stretch(const float factor,
116  const int UNUSED(axis),
117  const float dcut[3],
118  float r_co[3])
119 {
120  float x = r_co[0], y = r_co[1], z = r_co[2];
121  float scale;
122 
123  scale = (z * z * factor - factor + 1.0f);
124 
125  r_co[0] = x * scale;
126  r_co[1] = y * scale;
127  r_co[2] = z * (1.0f + factor);
128 
129  add_v3_v3(r_co, dcut);
130 }
131 
132 static void simpleDeform_twist(const float factor,
133  const int UNUSED(axis),
134  const float *dcut,
135  float r_co[3])
136 {
137  float x = r_co[0], y = r_co[1], z = r_co[2];
138  float theta, sint, cost;
139 
140  theta = z * factor;
141  sint = sinf(theta);
142  cost = cosf(theta);
143 
144  r_co[0] = x * cost - y * sint;
145  r_co[1] = x * sint + y * cost;
146  r_co[2] = z;
147 
148  add_v3_v3(r_co, dcut);
149 }
150 
151 static void simpleDeform_bend(const float factor,
152  const int axis,
153  const float dcut[3],
154  float r_co[3])
155 {
156  float x = r_co[0], y = r_co[1], z = r_co[2];
157  float theta, sint, cost;
158 
159  BLI_assert(!(fabsf(factor) < BEND_EPS));
160 
161  switch (axis) {
162  case 0:
164  case 1:
165  theta = z * factor;
166  break;
167  default:
168  theta = x * factor;
169  }
170  sint = sinf(theta);
171  cost = cosf(theta);
172 
173  /* NOTE: the operations below a susceptible to float precision errors
174  * regarding the order of operations, take care when changing, see: T85470 */
175  switch (axis) {
176  case 0:
177  r_co[0] = x;
178  r_co[1] = y * cost + (1.0f - cost) / factor;
179  r_co[2] = -(y - 1.0f / factor) * sint;
180  {
181  r_co[0] += dcut[0];
182  r_co[1] += sint * dcut[2];
183  r_co[2] += cost * dcut[2];
184  }
185  break;
186  case 1:
187  r_co[0] = x * cost + (1.0f - cost) / factor;
188  r_co[1] = y;
189  r_co[2] = -(x - 1.0f / factor) * sint;
190  {
191  r_co[0] += sint * dcut[2];
192  r_co[1] += dcut[1];
193  r_co[2] += cost * dcut[2];
194  }
195  break;
196  default:
197  r_co[0] = -(y - 1.0f / factor) * sint;
198  r_co[1] = y * cost + (1.0f - cost) / factor;
199  r_co[2] = z;
200  {
201  r_co[0] += cost * dcut[0];
202  r_co[1] += sint * dcut[0];
203  r_co[2] += dcut[2];
204  }
205  }
206 }
207 
208 /* simple deform modifier */
210  const ModifierEvalContext *UNUSED(ctx),
211  struct Object *ob,
212  struct Mesh *mesh,
213  float (*vertexCos)[3],
214  int numVerts)
215 {
216  const float base_limit[2] = {0.0f, 0.0f};
217  int i;
218  float smd_limit[2], smd_factor;
219  SpaceTransform *transf = NULL, tmp_transf;
220  void (*simpleDeform_callback)(const float factor,
221  const int axis,
222  const float dcut[3],
223  float co[3]) = NULL; /* Mode callback */
224  int vgroup;
225  MDeformVert *dvert;
226 
227  /* This is historically the lock axis, _not_ the deform axis as the name would imply */
228  const int deform_axis = smd->deform_axis;
229  int lock_axis = smd->axis;
230  if (smd->mode == MOD_SIMPLEDEFORM_MODE_BEND) { /* Bend mode shouldn't have any lock axis */
231  lock_axis = 0;
232  }
233  else {
234  /* Don't lock axis if it is the chosen deform axis, as this flattens
235  * the geometry */
236  if (deform_axis == 0) {
237  lock_axis &= ~MOD_SIMPLEDEFORM_LOCK_AXIS_X;
238  }
239  if (deform_axis == 1) {
240  lock_axis &= ~MOD_SIMPLEDEFORM_LOCK_AXIS_Y;
241  }
242  if (deform_axis == 2) {
243  lock_axis &= ~MOD_SIMPLEDEFORM_LOCK_AXIS_Z;
244  }
245  }
246 
247  /* Safe-check */
248  if (smd->origin == ob) {
249  smd->origin = NULL; /* No self references */
250  }
251 
252  if (smd->limit[0] < 0.0f) {
253  smd->limit[0] = 0.0f;
254  }
255  if (smd->limit[0] > 1.0f) {
256  smd->limit[0] = 1.0f;
257  }
258 
259  smd->limit[0] = min_ff(smd->limit[0], smd->limit[1]); /* Upper limit >= than lower limit */
260 
261  /* Calculate matrix to convert between coordinate spaces. */
262  if (smd->origin != NULL) {
263  transf = &tmp_transf;
264  BLI_SPACE_TRANSFORM_SETUP(transf, ob, smd->origin);
265  }
266 
267  /* Update limits if needed */
268  int limit_axis = deform_axis;
269  if (smd->mode == MOD_SIMPLEDEFORM_MODE_BEND) {
270  /* Bend is a special case. */
271  switch (deform_axis) {
272  case 0:
274  case 1:
275  limit_axis = 2;
276  break;
277  default:
278  limit_axis = 0;
279  }
280  }
281 
282  {
283  float lower = FLT_MAX;
284  float upper = -FLT_MAX;
285 
286  for (i = 0; i < numVerts; i++) {
287  float tmp[3];
288  copy_v3_v3(tmp, vertexCos[i]);
289 
290  if (transf) {
291  BLI_space_transform_apply(transf, tmp);
292  }
293 
294  lower = min_ff(lower, tmp[limit_axis]);
295  upper = max_ff(upper, tmp[limit_axis]);
296  }
297 
298  /* SMD values are normalized to the BV, calculate the absolute values */
299  smd_limit[1] = lower + (upper - lower) * smd->limit[1];
300  smd_limit[0] = lower + (upper - lower) * smd->limit[0];
301 
302  smd_factor = smd->factor / max_ff(FLT_EPSILON, smd_limit[1] - smd_limit[0]);
303  }
304 
305  switch (smd->mode) {
307  simpleDeform_callback = simpleDeform_twist;
308  break;
310  simpleDeform_callback = simpleDeform_bend;
311  break;
313  simpleDeform_callback = simpleDeform_taper;
314  break;
316  simpleDeform_callback = simpleDeform_stretch;
317  break;
318  default:
319  return; /* No simple-deform mode? */
320  }
321 
322  if (smd->mode == MOD_SIMPLEDEFORM_MODE_BEND) {
323  if (fabsf(smd_factor) < BEND_EPS) {
324  return;
325  }
326  }
327 
328  MOD_get_vgroup(ob, mesh, smd->vgroup_name, &dvert, &vgroup);
329  const bool invert_vgroup = (smd->flag & MOD_SIMPLEDEFORM_FLAG_INVERT_VGROUP) != 0;
330  const uint *axis_map =
331  axis_map_table[(smd->mode != MOD_SIMPLEDEFORM_MODE_BEND) ? deform_axis : 2];
332 
333  for (i = 0; i < numVerts; i++) {
334  float weight = BKE_defvert_array_find_weight_safe(dvert, i, vgroup);
335 
336  if (invert_vgroup) {
337  weight = 1.0f - weight;
338  }
339 
340  if (weight != 0.0f) {
341  float co[3], dcut[3] = {0.0f, 0.0f, 0.0f};
342 
343  if (transf) {
344  BLI_space_transform_apply(transf, vertexCos[i]);
345  }
346 
347  copy_v3_v3(co, vertexCos[i]);
348 
349  /* Apply axis limits, and axis mappings */
350  if (lock_axis & MOD_SIMPLEDEFORM_LOCK_AXIS_X) {
351  axis_limit(0, base_limit, co, dcut);
352  }
353  if (lock_axis & MOD_SIMPLEDEFORM_LOCK_AXIS_Y) {
354  axis_limit(1, base_limit, co, dcut);
355  }
356  if (lock_axis & MOD_SIMPLEDEFORM_LOCK_AXIS_Z) {
357  axis_limit(2, base_limit, co, dcut);
358  }
359  axis_limit(limit_axis, smd_limit, co, dcut);
360 
361  /* apply the deform to a mapped copy of the vertex, and then re-map it back. */
362  float co_remap[3];
363  float dcut_remap[3];
364  copy_v3_v3_map(co_remap, co, axis_map);
365  copy_v3_v3_map(dcut_remap, dcut, axis_map);
366  simpleDeform_callback(smd_factor, deform_axis, dcut_remap, co_remap); /* apply deform */
367  copy_v3_v3_unmap(co, co_remap, axis_map);
368 
369  /* Use vertex weight has coef of linear interpolation */
370  interp_v3_v3v3(vertexCos[i], vertexCos[i], co, weight);
371 
372  if (transf) {
373  BLI_space_transform_invert(transf, vertexCos[i]);
374  }
375  }
376  }
377 }
378 
379 /* SimpleDeform */
380 static void initData(ModifierData *md)
381 {
383 
384  BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(smd, modifier));
385 
387 }
388 
389 static void requiredDataMask(Object *UNUSED(ob),
390  ModifierData *md,
391  CustomData_MeshMasks *r_cddata_masks)
392 {
394 
395  /* ask for vertexgroups if we need them */
396  if (smd->vgroup_name[0] != '\0') {
397  r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
398  }
399 }
400 
401 static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
402 {
404  walk(userData, ob, (ID **)&smd->origin, IDWALK_CB_NOP);
405 }
406 
408 {
410  if (smd->origin != NULL) {
412  ctx->node, smd->origin, DEG_OB_COMP_TRANSFORM, "SimpleDeform Modifier");
413  DEG_add_modifier_to_transform_relation(ctx->node, "SimpleDeform Modifier");
414  }
415 }
416 
417 static void deformVerts(ModifierData *md,
418  const ModifierEvalContext *ctx,
419  struct Mesh *mesh,
420  float (*vertexCos)[3],
421  int numVerts)
422 {
424  Mesh *mesh_src = NULL;
425 
426  if (ctx->object->type == OB_MESH && sdmd->vgroup_name[0] != '\0') {
427  /* mesh_src is only needed for vgroups. */
428  mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false);
429  }
430 
431  SimpleDeformModifier_do(sdmd, ctx, ctx->object, mesh_src, vertexCos, numVerts);
432 
433  if (!ELEM(mesh_src, NULL, mesh)) {
434  BKE_id_free(NULL, mesh_src);
435  }
436 }
437 
438 static void deformVertsEM(ModifierData *md,
439  const ModifierEvalContext *ctx,
440  struct BMEditMesh *editData,
441  struct Mesh *mesh,
442  float (*vertexCos)[3],
443  int numVerts)
444 {
446  Mesh *mesh_src = NULL;
447 
448  if (ctx->object->type == OB_MESH && sdmd->vgroup_name[0] != '\0') {
449  /* mesh_src is only needed for vgroups. */
450  mesh_src = MOD_deform_mesh_eval_get(ctx->object, editData, mesh, NULL, numVerts, false, false);
451  }
452 
453  /* TODO(Campbell): use edit-mode data only (remove this line). */
454  if (mesh_src != NULL) {
456  }
457 
458  SimpleDeformModifier_do(sdmd, ctx, ctx->object, mesh_src, vertexCos, numVerts);
459 
460  if (!ELEM(mesh_src, NULL, mesh)) {
461  BKE_id_free(NULL, mesh_src);
462  }
463 }
464 
465 static void panel_draw(const bContext *UNUSED(C), Panel *panel)
466 {
467  uiLayout *row;
468  uiLayout *layout = panel->layout;
469 
470  PointerRNA ob_ptr;
472 
473  int deform_method = RNA_enum_get(ptr, "deform_method");
474 
475  row = uiLayoutRow(layout, false);
476  uiItemR(row, ptr, "deform_method", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
477 
478  uiLayoutSetPropSep(layout, true);
479 
481  uiItemR(layout, ptr, "factor", 0, NULL, ICON_NONE);
482  }
483  else {
484  uiItemR(layout, ptr, "angle", 0, NULL, ICON_NONE);
485  }
486 
487  uiItemR(layout, ptr, "origin", 0, NULL, ICON_NONE);
488  uiItemR(layout, ptr, "deform_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
489 
490  modifier_panel_end(layout, ptr);
491 }
492 
493 static void restrictions_panel_draw(const bContext *UNUSED(C), Panel *panel)
494 {
495  uiLayout *row;
496  uiLayout *layout = panel->layout;
498 
499  PointerRNA ob_ptr;
501 
502  int deform_method = RNA_enum_get(ptr, "deform_method");
503 
504  uiLayoutSetPropSep(layout, true);
505 
506  uiItemR(layout, ptr, "limits", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
507 
508  if (ELEM(deform_method,
512  int deform_axis = RNA_enum_get(ptr, "deform_axis");
513 
514  row = uiLayoutRowWithHeading(layout, true, IFACE_("Lock"));
515  if (deform_axis != 0) {
516  uiItemR(row, ptr, "lock_x", toggles_flag, NULL, ICON_NONE);
517  }
518  if (deform_axis != 1) {
519  uiItemR(row, ptr, "lock_y", toggles_flag, NULL, ICON_NONE);
520  }
521  if (deform_axis != 2) {
522  uiItemR(row, ptr, "lock_z", toggles_flag, NULL, ICON_NONE);
523  }
524  }
525 
526  modifier_vgroup_ui(layout, ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
527 }
528 
529 static void panelRegister(ARegionType *region_type)
530 {
531  PanelType *panel_type = modifier_panel_register(
532  region_type, eModifierType_SimpleDeform, panel_draw);
534  region_type, "restrictions", "Restrictions", NULL, restrictions_panel_draw, panel_type);
535 }
536 
538  /* name */ "SimpleDeform",
539  /* structName */ "SimpleDeformModifierData",
540  /* structSize */ sizeof(SimpleDeformModifierData),
541  /* srna */ &RNA_SimpleDeformModifier,
542  /* type */ eModifierTypeType_OnlyDeform,
543 
547  /* icon */ ICON_MOD_SIMPLEDEFORM,
548 
549  /* copyData */ BKE_modifier_copydata_generic,
550 
551  /* deformVerts */ deformVerts,
552  /* deformMatrices */ NULL,
553  /* deformVertsEM */ deformVertsEM,
554  /* deformMatricesEM */ NULL,
555  /* modifyMesh */ NULL,
556  /* modifyHair */ NULL,
557  /* modifyGeometrySet */ NULL,
558  /* modifyVolume */ NULL,
559 
560  /* initData */ initData,
561  /* requiredDataMask */ requiredDataMask,
562  /* freeData */ NULL,
563  /* isDisabled */ NULL,
564  /* updateDepsgraph */ updateDepsgraph,
565  /* dependsOnTime */ NULL,
566  /* dependsOnNormals */ NULL,
567  /* foreachIDLink */ foreachIDLink,
568  /* foreachTexLink */ NULL,
569  /* freeRuntimeData */ NULL,
570  /* panelRegister */ panelRegister,
571  /* blendWrite */ NULL,
572  /* blendRead */ NULL,
573 };
support for deformation groups and hooks.
float BKE_defvert_array_find_weight_safe(const struct MDeformVert *dvert, const int index, const int defgroup)
Definition: deform.c:645
void BKE_id_free(struct Main *bmain, void *idv)
@ IDWALK_CB_NOP
Definition: BKE_lib_query.h:47
void BKE_mesh_wrapper_ensure_mdata(struct Mesh *me)
Definition: mesh_wrapper.c:98
void(* IDWalkFunc)(void *userData, struct Object *ob, struct ID **idpoin, int cb_flag)
Definition: BKE_modifier.h:120
@ eModifierTypeFlag_AcceptsCVs
Definition: BKE_modifier.h:81
@ eModifierTypeFlag_EnableInEditmode
Definition: BKE_modifier.h:92
@ eModifierTypeFlag_SupportsEditmode
Definition: BKE_modifier.h:83
@ eModifierTypeFlag_AcceptsVertexCosOnly
Definition: BKE_modifier.h:114
@ eModifierTypeFlag_AcceptsMesh
Definition: BKE_modifier.h:80
void BKE_modifier_copydata_generic(const struct ModifierData *md, struct ModifierData *md_dst, const int flag)
@ eModifierTypeType_OnlyDeform
Definition: BKE_modifier.h:58
#define BLI_assert(a)
Definition: BLI_assert.h:58
#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)
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t)
Definition: math_vector.c:49
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
unsigned int uint
Definition: BLI_sys_types.h:83
#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:44
struct SimpleDeformModifierData SimpleDeformModifierData
@ MOD_SIMPLEDEFORM_LOCK_AXIS_Z
@ MOD_SIMPLEDEFORM_LOCK_AXIS_X
@ MOD_SIMPLEDEFORM_LOCK_AXIS_Y
@ eModifierType_SimpleDeform
@ MOD_SIMPLEDEFORM_MODE_TAPER
@ MOD_SIMPLEDEFORM_MODE_STRETCH
@ MOD_SIMPLEDEFORM_MODE_BEND
@ MOD_SIMPLEDEFORM_MODE_TWIST
@ MOD_SIMPLEDEFORM_FLAG_INVERT_VGROUP
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
static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, const ModifierEvalContext *UNUSED(ctx), struct Object *ob, struct Mesh *mesh, float(*vertexCos)[3], int numVerts)
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)
static void deformVertsEM(ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *editData, struct Mesh *mesh, float(*vertexCos)[3], int numVerts)
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])
#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 panel_draw(const bContext *UNUSED(C), Panel *panel)
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 deformVerts(ModifierData *md, const ModifierEvalContext *ctx, struct Mesh *mesh, float(*vertexCos)[3], int numVerts)
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)
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 num_verts, const bool use_normals, const bool use_orco)
Definition: MOD_util.c:186
void MOD_get_vgroup(Object *ob, struct Mesh *mesh, const char *name, MDeformVert **dvert, int *defgrp_index)
Definition: MOD_util.c:254
StructRNA RNA_SimpleDeformModifier
#define C
Definition: RandGen.cpp:39
uiLayout * uiLayoutRowWithHeading(uiLayout *layout, bool align, const char *heading)
@ UI_ITEM_R_TOGGLE
@ UI_ITEM_R_FORCE_BLANK_DECORATE
@ UI_ITEM_R_EXPAND
@ UI_ITEM_R_SLIDER
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
#define sinf(x)
#define cosf(x)
#define fabsf(x)
static unsigned a[3]
Definition: RandGen.cpp:92
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6402
Definition: DNA_ID.h:273
struct Object * object
Definition: BKE_modifier.h:154
struct DepsNodeHandle * node
Definition: BKE_modifier.h:147
struct uiLayout * layout
PointerRNA * ptr
Definition: wm_files.c:3157