58 #define BEND_EPS 0.000001f
86 static void axis_limit(
const int axis,
const float limits[2],
float co[3],
float dcut[3])
89 if (limits[0] > val) {
92 if (limits[1] < val) {
96 dcut[axis] = co[axis] - val;
105 float x = r_co[0],
y = r_co[1],
z = r_co[2];
106 float scale =
z * factor;
108 r_co[0] =
x +
x * scale;
109 r_co[1] =
y +
y * scale;
120 float x = r_co[0],
y = r_co[1],
z = r_co[2];
123 scale = (
z *
z * factor - factor + 1.0f);
127 r_co[2] =
z * (1.0f + factor);
137 float x = r_co[0],
y = r_co[1],
z = r_co[2];
138 float theta, sint, cost;
144 r_co[0] =
x * cost -
y * sint;
145 r_co[1] =
x * sint +
y * cost;
156 float x = r_co[0],
y = r_co[1],
z = r_co[2];
157 float theta, sint, cost;
178 r_co[1] =
y * cost + (1.0f - cost) / factor;
179 r_co[2] = -(
y - 1.0f / factor) * sint;
182 r_co[1] += sint * dcut[2];
183 r_co[2] += cost * dcut[2];
187 r_co[0] =
x * cost + (1.0f - cost) / factor;
189 r_co[2] = -(
x - 1.0f / factor) * sint;
191 r_co[0] += sint * dcut[2];
193 r_co[2] += cost * dcut[2];
197 r_co[0] = -(
y - 1.0f / factor) * sint;
198 r_co[1] =
y * cost + (1.0f - cost) / factor;
201 r_co[0] += cost * dcut[0];
202 r_co[1] += sint * dcut[0];
213 float (*vertexCos)[3],
216 const float base_limit[2] = {0.0f, 0.0f};
218 float smd_limit[2], smd_factor;
220 void (*simpleDeform_callback)(
const float factor,
229 int lock_axis = smd->
axis;
236 if (deform_axis == 0) {
239 if (deform_axis == 1) {
242 if (deform_axis == 2) {
252 if (smd->
limit[0] < 0.0f) {
253 smd->
limit[0] = 0.0f;
255 if (smd->
limit[0] > 1.0f) {
256 smd->
limit[0] = 1.0f;
263 transf = &tmp_transf;
268 int limit_axis = deform_axis;
271 switch (deform_axis) {
283 float lower = FLT_MAX;
284 float upper = -FLT_MAX;
286 for (i = 0; i < numVerts; i++) {
294 lower =
min_ff(lower, tmp[limit_axis]);
295 upper =
max_ff(upper, tmp[limit_axis]);
299 smd_limit[1] = lower + (upper - lower) * smd->
limit[1];
300 smd_limit[0] = lower + (upper - lower) * smd->
limit[0];
302 smd_factor = smd->
factor /
max_ff(FLT_EPSILON, smd_limit[1] - smd_limit[0]);
330 const uint *axis_map =
333 for (i = 0; i < numVerts; i++) {
337 weight = 1.0f - weight;
340 if (weight != 0.0f) {
341 float co[3], dcut[3] = {0.0f, 0.0f, 0.0f};
366 simpleDeform_callback(smd_factor, deform_axis, dcut_remap, co_remap);
420 float (*vertexCos)[3],
442 float (*vertexCos)[3],
454 if (mesh_src !=
NULL) {
508 if (
ELEM(deform_method,
515 if (deform_axis != 0) {
518 if (deform_axis != 1) {
521 if (deform_axis != 2) {
539 "SimpleDeformModifierData",
547 ICON_MOD_SIMPLEDEFORM,
void BKE_id_free(struct Main *bmain, void *idv)
void BKE_mesh_wrapper_ensure_mdata(struct Mesh *me)
void(* IDWalkFunc)(void *userData, struct Object *ob, struct ID **idpoin, int cb_flag)
@ eModifierTypeFlag_AcceptsCVs
@ eModifierTypeFlag_EnableInEditmode
@ eModifierTypeFlag_SupportsEditmode
@ eModifierTypeFlag_AcceptsVertexCosOnly
@ eModifierTypeFlag_AcceptsMesh
void BKE_modifier_copydata_generic(const struct ModifierData *md, struct ModifierData *md_dst, const int flag)
@ eModifierTypeType_OnlyDeform
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)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
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)
#define CD_MASK_MDEFORMVERT
#define DNA_struct_default_get(struct_name)
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.
_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
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)
void MOD_get_vgroup(Object *ob, struct Mesh *mesh, const char *name, MDeformVert **dvert, int *defgrp_index)
StructRNA RNA_SimpleDeformModifier
uiLayout * uiLayoutRowWithHeading(uiLayout *layout, bool align, const char *heading)
@ UI_ITEM_R_FORCE_BLANK_DECORATE
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)
int RNA_enum_get(PointerRNA *ptr, const char *name)
struct DepsNodeHandle * node