Blender  V2.93
MOD_warp.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 
21 #include <string.h>
22 
23 #include "MEM_guardedalloc.h"
24 
25 #include "BLI_utildefines.h"
26 
27 #include "BLI_math.h"
28 
29 #include "BLT_translation.h"
30 
31 #include "DNA_defaults.h"
32 #include "DNA_mesh_types.h"
33 #include "DNA_meshdata_types.h"
34 #include "DNA_object_types.h"
35 #include "DNA_screen_types.h"
36 
37 #include "BKE_action.h" /* BKE_pose_channel_find_name */
38 #include "BKE_colortools.h"
39 #include "BKE_context.h"
40 #include "BKE_deform.h"
41 #include "BKE_editmesh.h"
42 #include "BKE_lib_id.h"
43 #include "BKE_lib_query.h"
44 #include "BKE_mesh.h"
45 #include "BKE_mesh_wrapper.h"
46 #include "BKE_modifier.h"
47 #include "BKE_screen.h"
48 #include "BKE_texture.h"
49 
50 #include "UI_interface.h"
51 #include "UI_resources.h"
52 
53 #include "BLO_read_write.h"
54 
55 #include "RNA_access.h"
56 
57 #include "DEG_depsgraph.h"
58 #include "DEG_depsgraph_query.h"
59 
60 #include "RE_texture.h"
61 
62 #include "MOD_ui_common.h"
63 #include "MOD_util.h"
64 
65 static void initData(ModifierData *md)
66 {
68 
70 
72 
73  wmd->curfalloff = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
74 }
75 
76 static void copyData(const ModifierData *md, ModifierData *target, const int flag)
77 {
78  const WarpModifierData *wmd = (const WarpModifierData *)md;
79  WarpModifierData *twmd = (WarpModifierData *)target;
80 
81  BKE_modifier_copydata_generic(md, target, flag);
82 
84 }
85 
86 static void requiredDataMask(Object *UNUSED(ob),
87  ModifierData *md,
88  CustomData_MeshMasks *r_cddata_masks)
89 {
91 
92  /* ask for vertexgroups if we need them */
93  if (wmd->defgrp_name[0] != '\0') {
94  r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
95  }
96 
97  /* ask for UV coordinates if we need them */
98  if (wmd->texmapping == MOD_DISP_MAP_UV) {
99  r_cddata_masks->fmask |= CD_MASK_MTFACE;
100  }
101 }
102 
103 static void matrix_from_obj_pchan(float mat[4][4],
104  const float obinv[4][4],
105  Object *ob,
106  const char *bonename)
107 {
108  bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, bonename);
109  if (pchan) {
110  float mat_bone_world[4][4];
111  mul_m4_m4m4(mat_bone_world, ob->obmat, pchan->pose_mat);
112  mul_m4_m4m4(mat, obinv, mat_bone_world);
113  }
114  else {
115  mul_m4_m4m4(mat, obinv, ob->obmat);
116  }
117 }
118 
119 static bool dependsOnTime(ModifierData *md)
120 {
121  WarpModifierData *wmd = (WarpModifierData *)md;
122 
123  if (wmd->texture) {
124  return BKE_texture_dependsOnTime(wmd->texture);
125  }
126 
127  return false;
128 }
129 
130 static void freeData(ModifierData *md)
131 {
132  WarpModifierData *wmd = (WarpModifierData *)md;
134 }
135 
136 static bool isDisabled(const struct Scene *UNUSED(scene),
137  ModifierData *md,
138  bool UNUSED(userRenderParams))
139 {
140  WarpModifierData *wmd = (WarpModifierData *)md;
141 
142  return !(wmd->object_from && wmd->object_to);
143 }
144 
145 static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
146 {
147  WarpModifierData *wmd = (WarpModifierData *)md;
148 
149  walk(userData, ob, (ID **)&wmd->texture, IDWALK_CB_USER);
150  walk(userData, ob, (ID **)&wmd->object_from, IDWALK_CB_NOP);
151  walk(userData, ob, (ID **)&wmd->object_to, IDWALK_CB_NOP);
152  walk(userData, ob, (ID **)&wmd->map_object, IDWALK_CB_NOP);
153 }
154 
155 static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void *userData)
156 {
157  walk(userData, ob, md, "texture");
158 }
159 
161 {
162  WarpModifierData *wmd = (WarpModifierData *)md;
163  bool need_transform_relation = false;
164 
165  if (wmd->object_from != NULL && wmd->object_to != NULL) {
167  ctx->node, wmd->object_from, wmd->bone_from, "Warp Modifier");
169  ctx->node, wmd->object_to, wmd->bone_to, "Warp Modifier");
170  need_transform_relation = true;
171  }
172 
173  if (wmd->texture != NULL) {
174  DEG_add_generic_id_relation(ctx->node, &wmd->texture->id, "Warp Modifier");
175 
176  if ((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object != NULL) {
178  ctx->node, wmd->map_object, wmd->map_bone, "Warp Modifier");
179  need_transform_relation = true;
180  }
181  else if (wmd->texmapping == MOD_DISP_MAP_GLOBAL) {
182  need_transform_relation = true;
183  }
184  }
185 
186  if (need_transform_relation) {
187  DEG_add_modifier_to_transform_relation(ctx->node, "Warp Modifier");
188  }
189 }
190 
192  const ModifierEvalContext *ctx,
193  Mesh *mesh,
194  float (*vertexCos)[3],
195  int numVerts)
196 {
197  Object *ob = ctx->object;
198  float obinv[4][4];
199  float mat_from[4][4];
200  float mat_from_inv[4][4];
201  float mat_to[4][4];
202  float mat_unit[4][4];
203  float mat_final[4][4];
204 
205  float tmat[4][4];
206 
207  const float falloff_radius_sq = square_f(wmd->falloff_radius);
208  float strength = wmd->strength;
209  float fac = 1.0f, weight;
210  int i;
211  int defgrp_index;
212  MDeformVert *dvert, *dv = NULL;
213  const bool invert_vgroup = (wmd->flag & MOD_WARP_INVERT_VGROUP) != 0;
214  float(*tex_co)[3] = NULL;
215 
216  if (!(wmd->object_from && wmd->object_to)) {
217  return;
218  }
219 
220  MOD_get_vgroup(ob, mesh, wmd->defgrp_name, &dvert, &defgrp_index);
221  if (dvert == NULL) {
222  defgrp_index = -1;
223  }
224 
225  if (wmd->curfalloff == NULL) { /* should never happen, but bad lib linking could cause it */
226  wmd->curfalloff = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
227  }
228 
229  if (wmd->curfalloff) {
231  }
232 
233  invert_m4_m4(obinv, ob->obmat);
234 
235  /* Checks that the objects/bones are available. */
236  matrix_from_obj_pchan(mat_from, obinv, wmd->object_from, wmd->bone_from);
237  matrix_from_obj_pchan(mat_to, obinv, wmd->object_to, wmd->bone_to);
238 
239  invert_m4_m4(tmat, mat_from); // swap?
240  mul_m4_m4m4(mat_final, tmat, mat_to);
241 
242  invert_m4_m4(mat_from_inv, mat_from);
243 
244  unit_m4(mat_unit);
245 
246  if (strength < 0.0f) {
247  float loc[3];
248  strength = -strength;
249 
250  /* inverted location is not useful, just use the negative */
251  copy_v3_v3(loc, mat_final[3]);
252  invert_m4(mat_final);
253  negate_v3_v3(mat_final[3], loc);
254  }
255  weight = strength;
256 
257  Tex *tex_target = wmd->texture;
258  if (mesh != NULL && tex_target != NULL) {
259  tex_co = MEM_malloc_arrayN(numVerts, sizeof(*tex_co), "warpModifier_do tex_co");
260  MOD_get_texture_coords((MappingInfoModifierData *)wmd, ctx, ob, mesh, vertexCos, tex_co);
261 
263  }
264 
265  for (i = 0; i < numVerts; i++) {
266  float *co = vertexCos[i];
267 
268  if (wmd->falloff_type == eWarp_Falloff_None ||
269  ((fac = len_squared_v3v3(co, mat_from[3])) < falloff_radius_sq &&
270  (fac = (wmd->falloff_radius - sqrtf(fac)) / wmd->falloff_radius))) {
271  /* skip if no vert group found */
272  if (defgrp_index != -1) {
273  dv = &dvert[i];
274  weight = (invert_vgroup ? (1.0f - BKE_defvert_find_weight(dv, defgrp_index)) :
275  BKE_defvert_find_weight(dv, defgrp_index)) *
276  strength;
277  if (weight <= 0.0f) {
278  continue;
279  }
280  }
281 
282  /* closely match PROP_SMOOTH and similar */
283  switch (wmd->falloff_type) {
284  case eWarp_Falloff_None:
285  fac = 1.0f;
286  break;
287  case eWarp_Falloff_Curve:
288  fac = BKE_curvemapping_evaluateF(wmd->curfalloff, 0, fac);
289  break;
290  case eWarp_Falloff_Sharp:
291  fac = fac * fac;
292  break;
294  fac = 3.0f * fac * fac - 2.0f * fac * fac * fac;
295  break;
296  case eWarp_Falloff_Root:
297  fac = sqrtf(fac);
298  break;
300  /* pass */
301  break;
302  case eWarp_Falloff_Const:
303  fac = 1.0f;
304  break;
306  fac = sqrtf(2 * fac - fac * fac);
307  break;
309  fac = fac * (2.0f - fac);
310  break;
311  }
312 
313  fac *= weight;
314 
315  if (tex_co) {
317  TexResult texres;
318  texres.nor = NULL;
319  BKE_texture_get_value(scene, tex_target, tex_co[i], &texres, false);
320  fac *= texres.tin;
321  }
322 
323  if (fac != 0.0f) {
324  /* into the 'from' objects space */
325  mul_m4_v3(mat_from_inv, co);
326 
327  if (fac == 1.0f) {
328  mul_m4_v3(mat_final, co);
329  }
330  else {
331  if (wmd->flag & MOD_WARP_VOLUME_PRESERVE) {
332  /* interpolate the matrix for nicer locations */
333  blend_m4_m4m4(tmat, mat_unit, mat_final, fac);
334  mul_m4_v3(tmat, co);
335  }
336  else {
337  float tvec[3];
338  mul_v3_m4v3(tvec, mat_final, co);
339  interp_v3_v3v3(co, co, tvec, fac);
340  }
341  }
342 
343  /* out of the 'from' objects space */
344  mul_m4_v3(mat_from, co);
345  }
346  }
347  }
348 
349  if (tex_co) {
350  MEM_freeN(tex_co);
351  }
352 }
353 
354 static void deformVerts(ModifierData *md,
355  const ModifierEvalContext *ctx,
356  Mesh *mesh,
357  float (*vertexCos)[3],
358  int numVerts)
359 {
360  WarpModifierData *wmd = (WarpModifierData *)md;
361  Mesh *mesh_src = NULL;
362 
363  if (wmd->defgrp_name[0] != '\0' || wmd->texture != NULL) {
364  /* mesh_src is only needed for vgroups and textures. */
365  mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false);
366  }
367 
368  warpModifier_do(wmd, ctx, mesh_src, vertexCos, numVerts);
369 
370  if (!ELEM(mesh_src, NULL, mesh)) {
371  BKE_id_free(NULL, mesh_src);
372  }
373 }
374 
375 static void deformVertsEM(ModifierData *md,
376  const ModifierEvalContext *ctx,
377  struct BMEditMesh *em,
378  Mesh *mesh,
379  float (*vertexCos)[3],
380  int numVerts)
381 {
382  WarpModifierData *wmd = (WarpModifierData *)md;
383  Mesh *mesh_src = NULL;
384 
385  if (wmd->defgrp_name[0] != '\0' || wmd->texture != NULL) {
386  /* mesh_src is only needed for vgroups and textures. */
387  mesh_src = MOD_deform_mesh_eval_get(ctx->object, em, mesh, NULL, numVerts, false, false);
388  }
389 
390  /* TODO(Campbell): use edit-mode data only (remove this line). */
391  if (mesh_src != NULL) {
393  }
394 
395  warpModifier_do(wmd, ctx, mesh_src, vertexCos, numVerts);
396 
397  if (!ELEM(mesh_src, NULL, mesh)) {
398  BKE_id_free(NULL, mesh_src);
399  }
400 }
401 
402 static void panel_draw(const bContext *UNUSED(C), Panel *panel)
403 {
404  uiLayout *col;
405  uiLayout *layout = panel->layout;
406 
407  PointerRNA ob_ptr;
409 
410  uiLayoutSetPropSep(layout, true);
411 
412  col = uiLayoutColumn(layout, true);
413  uiItemR(col, ptr, "object_from", 0, NULL, ICON_NONE);
414  PointerRNA from_obj_ptr = RNA_pointer_get(ptr, "object_from");
415  if (!RNA_pointer_is_null(&from_obj_ptr) && RNA_enum_get(&from_obj_ptr, "type") == OB_ARMATURE) {
416 
417  PointerRNA from_obj_data_ptr = RNA_pointer_get(&from_obj_ptr, "data");
418  uiItemPointerR(col, ptr, "bone_from", &from_obj_data_ptr, "bones", IFACE_("Bone"), ICON_NONE);
419  }
420 
421  col = uiLayoutColumn(layout, true);
422  uiItemR(col, ptr, "object_to", 0, NULL, ICON_NONE);
423  PointerRNA to_obj_ptr = RNA_pointer_get(ptr, "object_to");
424  if (!RNA_pointer_is_null(&to_obj_ptr) && RNA_enum_get(&to_obj_ptr, "type") == OB_ARMATURE) {
425  PointerRNA to_obj_data_ptr = RNA_pointer_get(&to_obj_ptr, "data");
426  uiItemPointerR(col, ptr, "bone_to", &to_obj_data_ptr, "bones", IFACE_("Bone"), ICON_NONE);
427  }
428 
429  uiItemR(layout, ptr, "use_volume_preserve", 0, NULL, ICON_NONE);
430 
431  uiItemR(layout, ptr, "strength", 0, NULL, ICON_NONE);
432 
433  modifier_vgroup_ui(layout, ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
434 
435  modifier_panel_end(layout, ptr);
436 }
437 
438 static void falloff_panel_draw(const bContext *UNUSED(C), Panel *panel)
439 {
440  uiLayout *layout = panel->layout;
441 
443 
444  bool use_falloff = (RNA_enum_get(ptr, "falloff_type") != eWarp_Falloff_None);
445 
446  uiLayoutSetPropSep(layout, true);
447 
448  uiItemR(layout, ptr, "falloff_type", 0, NULL, ICON_NONE);
449 
450  if (use_falloff) {
451  uiItemR(layout, ptr, "falloff_radius", 0, NULL, ICON_NONE);
452  }
453 
454  if (use_falloff && RNA_enum_get(ptr, "falloff_type") == eWarp_Falloff_Curve) {
455  uiTemplateCurveMapping(layout, ptr, "falloff_curve", 0, false, false, false, false);
456  }
457 }
458 
459 static void texture_panel_draw(const bContext *C, Panel *panel)
460 {
461  uiLayout *col;
462  uiLayout *layout = panel->layout;
463 
464  PointerRNA ob_ptr;
466 
467  int texture_coords = RNA_enum_get(ptr, "texture_coords");
468 
469  uiTemplateID(layout, C, ptr, "texture", "texture.new", NULL, NULL, 0, ICON_NONE, NULL);
470 
471  uiLayoutSetPropSep(layout, true);
472 
473  col = uiLayoutColumn(layout, false);
474  uiItemR(col, ptr, "texture_coords", 0, IFACE_("Coordinates"), ICON_NONE);
475  if (texture_coords == MOD_DISP_MAP_OBJECT) {
476  uiItemR(col, ptr, "texture_coords_object", 0, IFACE_("Object"), ICON_NONE);
477  PointerRNA texture_coords_obj_ptr = RNA_pointer_get(ptr, "texture_coords_object");
478  if (!RNA_pointer_is_null(&texture_coords_obj_ptr) &&
479  (RNA_enum_get(&texture_coords_obj_ptr, "type") == OB_ARMATURE)) {
480  PointerRNA texture_coords_obj_data_ptr = RNA_pointer_get(&texture_coords_obj_ptr, "data");
482  ptr,
483  "texture_coords_bone",
484  &texture_coords_obj_data_ptr,
485  "bones",
486  IFACE_("Bone"),
487  ICON_NONE);
488  }
489  }
490  else if (texture_coords == MOD_DISP_MAP_UV && RNA_enum_get(&ob_ptr, "type") == OB_MESH) {
491  PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data");
492  uiItemPointerR(col, ptr, "uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE);
493  }
494 }
495 
496 static void panelRegister(ARegionType *region_type)
497 {
498  PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Warp, panel_draw);
500  region_type, "falloff", "Falloff", NULL, falloff_panel_draw, panel_type);
502  region_type, "texture", "Texture", NULL, texture_panel_draw, panel_type);
503 }
504 
505 static void blendWrite(BlendWriter *writer, const ModifierData *md)
506 {
507  const WarpModifierData *tmd = (const WarpModifierData *)md;
508 
509  if (tmd->curfalloff) {
511  }
512 }
513 
514 static void blendRead(BlendDataReader *reader, ModifierData *md)
515 {
516  WarpModifierData *tmd = (WarpModifierData *)md;
517 
518  BLO_read_data_address(reader, &tmd->curfalloff);
519  if (tmd->curfalloff) {
521  }
522 }
523 
525  /* name */ "Warp",
526  /* structName */ "WarpModifierData",
527  /* structSize */ sizeof(WarpModifierData),
528  /* srna */ &RNA_WarpModifier,
529  /* type */ eModifierTypeType_OnlyDeform,
532  /* icon */ ICON_MOD_WARP,
533  /* copyData */ copyData,
534 
535  /* deformVerts */ deformVerts,
536  /* deformMatrices */ NULL,
537  /* deformVertsEM */ deformVertsEM,
538  /* deformMatricesEM */ NULL,
539  /* modifyMesh */ NULL,
540  /* modifyHair */ NULL,
541  /* modifyGeometrySet */ NULL,
542  /* modifyVolume */ NULL,
543 
544  /* initData */ initData,
545  /* requiredDataMask */ requiredDataMask,
546  /* freeData */ freeData,
547  /* isDisabled */ isDisabled,
548  /* updateDepsgraph */ updateDepsgraph,
549  /* dependsOnTime */ dependsOnTime,
550  /* dependsOnNormals */ NULL,
551  /* foreachIDLink */ foreachIDLink,
552  /* foreachTexLink */ foreachTexLink,
553  /* freeRuntimeData */ NULL,
554  /* panelRegister */ panelRegister,
555  /* blendWrite */ blendWrite,
556  /* blendRead */ blendRead,
557 };
typedef float(TangentPoint)[2]
Blender kernel action and pose functionality.
struct bPoseChannel * BKE_pose_channel_find_name(const struct bPose *pose, const char *name)
void BKE_curvemapping_init(struct CurveMapping *cumap)
Definition: colortools.c:1200
struct CurveMapping * BKE_curvemapping_copy(const struct CurveMapping *cumap)
float BKE_curvemapping_evaluateF(const struct CurveMapping *cumap, int cur, float value)
void BKE_curvemapping_blend_read(struct BlendDataReader *reader, struct CurveMapping *cumap)
Definition: colortools.c:1252
void BKE_curvemapping_blend_write(struct BlendWriter *writer, const struct CurveMapping *cumap)
void BKE_curvemapping_free(struct CurveMapping *cumap)
Definition: colortools.c:119
struct CurveMapping * BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
Definition: colortools.c:88
support for deformation groups and hooks.
float BKE_defvert_find_weight(const struct MDeformVert *dvert, const int defgroup)
Definition: deform.c:632
void BKE_id_free(struct Main *bmain, void *idv)
@ IDWALK_CB_USER
Definition: BKE_lib_query.h:87
@ 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_SupportsEditmode
Definition: BKE_modifier.h:83
@ eModifierTypeFlag_AcceptsVertexCosOnly
Definition: BKE_modifier.h:114
void(* TexWalkFunc)(void *userData, struct Object *ob, struct ModifierData *md, const char *propname)
Definition: BKE_modifier.h:121
void BKE_modifier_copydata_generic(const struct ModifierData *md, struct ModifierData *md_dst, const int flag)
@ eModifierTypeType_OnlyDeform
Definition: BKE_modifier.h:58
bool BKE_texture_dependsOnTime(const struct Tex *texture)
Definition: texture.c:697
void BKE_texture_get_value(const struct Scene *scene, struct Tex *texture, const float *tex_co, struct TexResult *texres, bool use_color_management)
#define BLI_assert(a)
Definition: BLI_assert.h:58
MINLINE float square_f(float a)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
Definition: math_matrix.c:262
bool invert_m4(float R[4][4])
Definition: math_matrix.c:1187
void unit_m4(float m[4][4])
Definition: rct.c:1140
bool invert_m4_m4(float R[4][4], const float A[4][4])
Definition: math_matrix.c:1278
void mul_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:732
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
Definition: math_matrix.c:742
void blend_m4_m4m4(float out[4][4], const float dst[4][4], const float src[4][4], const float srcweight)
Definition: math_matrix.c:2465
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t)
Definition: math_vector.c:49
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
#define UNUSED(x)
#define ELEM(...)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define BLO_read_data_address(reader, ptr_p)
#define IFACE_(msgid)
void DEG_add_modifier_to_transform_relation(struct DepsNodeHandle *node_handle, const char *description)
void DEG_add_generic_id_relation(struct DepsNodeHandle *node_handle, struct ID *id, const char *description)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
#define CD_MASK_MDEFORMVERT
#define CD_MASK_MTFACE
#define DNA_struct_default_get(struct_name)
Definition: DNA_defaults.h:44
@ MOD_DISP_MAP_OBJECT
@ MOD_DISP_MAP_GLOBAL
@ MOD_DISP_MAP_UV
@ eWarp_Falloff_Linear
@ eWarp_Falloff_Curve
@ eWarp_Falloff_Sharp
@ eWarp_Falloff_Const
@ eWarp_Falloff_InvSquare
@ eWarp_Falloff_Smooth
@ eWarp_Falloff_None
@ eWarp_Falloff_Sphere
@ eWarp_Falloff_Root
@ eModifierType_Warp
@ MOD_WARP_VOLUME_PRESERVE
@ MOD_WARP_INVERT_VGROUP
struct WarpModifierData WarpModifierData
Object is a sort of wrapper for general info.
@ OB_ARMATURE
@ OB_MESH
Read Guarded memory(de)allocation.
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_init_texture(MappingInfoModifierData *dmd, const ModifierEvalContext *ctx)
Definition: MOD_util.c:61
void MOD_depsgraph_update_object_bone_relation(struct DepsNodeHandle *node, Object *object, const char *bonename, const char *description)
Definition: MOD_util.c:270
void MOD_get_texture_coords(MappingInfoModifierData *dmd, const ModifierEvalContext *UNUSED(ctx), Object *ob, Mesh *mesh, float(*cos)[3], float(*r_texco)[3])
Definition: MOD_util.c:76
void MOD_get_vgroup(Object *ob, struct Mesh *mesh, const char *name, MDeformVert **dvert, int *defgrp_index)
Definition: MOD_util.c:254
static void copyData(const ModifierData *md, ModifierData *target, const int flag)
Definition: MOD_warp.c:76
static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, bool UNUSED(userRenderParams))
Definition: MOD_warp.c:136
static void falloff_panel_draw(const bContext *UNUSED(C), Panel *panel)
Definition: MOD_warp.c:438
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
Definition: MOD_warp.c:160
ModifierTypeInfo modifierType_Warp
Definition: MOD_warp.c:524
static void texture_panel_draw(const bContext *C, Panel *panel)
Definition: MOD_warp.c:459
static void blendWrite(BlendWriter *writer, const ModifierData *md)
Definition: MOD_warp.c:505
static void deformVertsEM(ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *em, Mesh *mesh, float(*vertexCos)[3], int numVerts)
Definition: MOD_warp.c:375
static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh, float(*vertexCos)[3], int numVerts)
Definition: MOD_warp.c:354
static void blendRead(BlendDataReader *reader, ModifierData *md)
Definition: MOD_warp.c:514
static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
Definition: MOD_warp.c:145
static void matrix_from_obj_pchan(float mat[4][4], const float obinv[4][4], Object *ob, const char *bonename)
Definition: MOD_warp.c:103
static void warpModifier_do(WarpModifierData *wmd, const ModifierEvalContext *ctx, Mesh *mesh, float(*vertexCos)[3], int numVerts)
Definition: MOD_warp.c:191
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
Definition: MOD_warp.c:402
static void initData(ModifierData *md)
Definition: MOD_warp.c:65
static void panelRegister(ARegionType *region_type)
Definition: MOD_warp.c:496
static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void *userData)
Definition: MOD_warp.c:155
static bool dependsOnTime(ModifierData *md)
Definition: MOD_warp.c:119
static void freeData(ModifierData *md)
Definition: MOD_warp.c:130
static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
Definition: MOD_warp.c:86
StructRNA RNA_WarpModifier
#define C
Definition: RandGen.cpp:39
void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int type, bool levels, bool brush, bool neg_slope, bool tone)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiTemplateID(uiLayout *layout, const struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int filter, const bool live_icon, const char *text)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *searchptr, const char *searchpropname, const char *name, int icon)
Scene scene
uint col
#define sqrtf(x)
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
Definition: mallocn.c:48
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6562
bool RNA_pointer_is_null(const PointerRNA *ptr)
Definition: rna_access.c:174
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6402
Definition: DNA_ID.h:273
struct Depsgraph * depsgraph
Definition: BKE_modifier.h:153
struct Object * object
Definition: BKE_modifier.h:154
struct DepsNodeHandle * node
Definition: BKE_modifier.h:147
struct bPose * pose
float obmat[4][4]
struct uiLayout * layout
float * nor
Definition: RE_texture.h:86
float tin
Definition: RE_texture.h:84
struct Object * map_object
struct CurveMapping * curfalloff
struct Object * object_to
struct Object * object_from
float pose_mat[4][4]
PointerRNA * ptr
Definition: wm_files.c:3157