5 * ***** BEGIN GPL LICENSE BLOCK *****
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * ***** END GPL LICENSE BLOCK *****
24 #include "DNA_listBase.h"
26 #ifndef DNA_MODIFIER_TYPES_H
27 #define DNA_MODIFIER_TYPES_H
29 #define MODSTACK_DEBUG 1
31 /* WARNING ALERT! TYPEDEF VALUES ARE WRITTEN IN FILES! SO DO NOT CHANGE! */
33 typedef enum ModifierType {
34 eModifierType_None = 0,
35 eModifierType_Subsurf,
36 eModifierType_Lattice,
40 eModifierType_Decimate,
42 eModifierType_Armature,
44 eModifierType_Softbody,
45 eModifierType_Boolean,
47 eModifierType_EdgeSplit,
48 eModifierType_Displace,
49 eModifierType_UVProject,
52 eModifierType_MeshDeform,
53 eModifierType_ParticleSystem,
54 eModifierType_ParticleInstance,
55 eModifierType_Explode,
57 eModifierType_Collision,
59 eModifierType_Shrinkwrap,
60 eModifierType_Fluidsim,
62 eModifierType_SimpleDeform,
63 eModifierType_Multires,
64 eModifierType_Surface,
66 eModifierType_ShapeKey,
67 eModifierType_Solidify,
69 /* placeholder, keep this so durian files load in
70 * trunk with the correct modifier once its merged */
75 typedef enum ModifierMode {
76 eModifierMode_Realtime = (1<<0),
77 eModifierMode_Render = (1<<1),
78 eModifierMode_Editmode = (1<<2),
79 eModifierMode_OnCage = (1<<3),
80 eModifierMode_Expanded = (1<<4),
81 eModifierMode_Virtual = (1<<5),
82 eModifierMode_DisableTemporary = (1 << 31)
85 typedef struct ModifierData {
86 struct ModifierData *next, *prev;
92 /* XXX for timing info set by caller... solve later? (ton) */
99 eSubsurfModifierFlag_Incremental = (1<<0),
100 eSubsurfModifierFlag_DebugIncr = (1<<1),
101 eSubsurfModifierFlag_ControlEdges = (1<<2),
102 eSubsurfModifierFlag_SubsurfUv = (1<<3)
103 } SubsurfModifierFlag;
105 typedef struct SubsurfModifierData {
106 ModifierData modifier;
108 short subdivType, levels, renderLevels, flags;
110 void *emCache, *mCache;
111 } SubsurfModifierData;
113 typedef struct LatticeModifierData {
114 ModifierData modifier;
116 struct Object *object;
117 char name[32]; /* optional vertexgroup name */
118 } LatticeModifierData;
120 typedef struct CurveModifierData {
121 ModifierData modifier;
123 struct Object *object;
124 char name[32]; /* optional vertexgroup name */
125 short defaxis; /* axis along which curve deforms */
129 /* CurveModifierData->defaxis */
130 #define MOD_CURVE_POSX 1
131 #define MOD_CURVE_POSY 2
132 #define MOD_CURVE_POSZ 3
133 #define MOD_CURVE_NEGX 4
134 #define MOD_CURVE_NEGY 5
135 #define MOD_CURVE_NEGZ 6
137 typedef struct BuildModifierData {
138 ModifierData modifier;
145 typedef struct MaskModifierData {
146 ModifierData modifier;
148 struct Object *ob_arm; /* armature to use to in place of hardcoded vgroup */
149 char vgroup[32]; /* name of vertex group to use to mask */
151 int mode; /* using armature or hardcoded vgroup */
152 int flag; /* flags for various things */
155 /* Mask Modifier -> mode */
156 #define MOD_MASK_MODE_VGROUP 0
157 #define MOD_MASK_MODE_ARM 1
159 /* Mask Modifier -> flag */
160 #define MOD_MASK_INV (1<<0)
162 typedef struct ArrayModifierData {
163 ModifierData modifier;
165 /* the object with which to cap the start of the array */
166 struct Object *start_cap;
167 /* the object with which to cap the end of the array */
168 struct Object *end_cap;
169 /* the curve object to use for MOD_ARR_FITCURVE */
170 struct Object *curve_ob;
171 /* the object to use for object offset */
172 struct Object *offset_ob;
173 /* a constant duplicate offset;
174 1 means the duplicates are 1 unit apart
177 /* a scaled factor for duplicate offsets;
178 1 means the duplicates are 1 object-width apart
181 /* the length over which to distribute the duplicates */
183 /* the limit below which to merge vertices in adjacent duplicates */
185 /* determines how duplicate count is calculated; one of:
186 MOD_ARR_FIXEDCOUNT -> fixed
187 MOD_ARR_FITLENGTH -> calculated to fit a set length
188 MOD_ARR_FITCURVE -> calculated to fit the length of a Curve object
191 /* flags specifying how total offset is calculated; binary OR of:
192 MOD_ARR_OFF_CONST -> total offset += offset
193 MOD_ARR_OFF_RELATIVE -> total offset += relative * object width
194 MOD_ARR_OFF_OBJ -> total offset += offset_ob's matrix
195 total offset is the sum of the individual enabled offsets
199 MOD_ARR_MERGE -> merge vertices in adjacent duplicates
202 /* the number of duplicates to generate for MOD_ARR_FIXEDCOUNT */
206 /* ArrayModifierData->fit_type */
207 #define MOD_ARR_FIXEDCOUNT 0
208 #define MOD_ARR_FITLENGTH 1
209 #define MOD_ARR_FITCURVE 2
211 /* ArrayModifierData->offset_type */
212 #define MOD_ARR_OFF_CONST (1<<0)
213 #define MOD_ARR_OFF_RELATIVE (1<<1)
214 #define MOD_ARR_OFF_OBJ (1<<2)
216 /* ArrayModifierData->flags */
217 #define MOD_ARR_MERGE (1<<0)
218 #define MOD_ARR_MERGEFINAL (1<<1)
220 typedef struct MirrorModifierData {
221 ModifierData modifier;
223 short axis; /* deprecated, use flag instead */
226 struct Object *mirror_ob;
227 } MirrorModifierData;
229 /* MirrorModifierData->flag */
230 #define MOD_MIR_CLIPPING (1<<0)
231 #define MOD_MIR_MIRROR_U (1<<1)
232 #define MOD_MIR_MIRROR_V (1<<2)
233 #define MOD_MIR_AXIS_X (1<<3)
234 #define MOD_MIR_AXIS_Y (1<<4)
235 #define MOD_MIR_AXIS_Z (1<<5)
236 #define MOD_MIR_VGROUP (1<<6)
238 typedef struct EdgeSplitModifierData {
239 ModifierData modifier;
241 float split_angle; /* angle above which edges should be split */
243 } EdgeSplitModifierData;
245 /* EdgeSplitModifierData->flags */
246 #define MOD_EDGESPLIT_FROMANGLE (1<<1)
247 #define MOD_EDGESPLIT_FROMFLAG (1<<2)
249 typedef struct BevelModifierData {
250 ModifierData modifier;
252 float value; /* the "raw" bevel value (distance/amount to bevel) */
253 int res; /* the resolution (as originally coded, it is the number of recursive bevels) */
255 short flags; /* general option flags */
256 short val_flags; /* flags used to interpret the bevel value */
257 short lim_flags; /* flags to tell the tool how to limit the bevel */
258 short e_flags; /* flags to direct how edge weights are applied to verts */
259 float bevel_angle; /* if the BME_BEVEL_ANGLE is set, this will be how "sharp" an edge must be before it gets beveled */
260 char defgrp_name[32]; /* if the BME_BEVEL_VWEIGHT option is set, this will be the name of the vert group */
263 typedef struct BMeshModifierData {
264 ModifierData modifier;
271 /* Smoke modifier flags */
272 #define MOD_SMOKE_TYPE_DOMAIN (1 << 0)
273 #define MOD_SMOKE_TYPE_FLOW (1 << 1)
274 #define MOD_SMOKE_TYPE_COLL (1 << 2)
276 typedef struct SmokeModifierData {
277 ModifierData modifier;
279 struct SmokeDomainSettings *domain;
280 struct SmokeFlowSettings *flow; /* inflow, outflow, smoke objects */
281 struct SmokeCollSettings *coll; /* collision objects */
283 int type; /* domain, inflow, outflow, ... */
286 typedef struct DisplaceModifierData {
287 ModifierData modifier;
292 char defgrp_name[32];
295 struct Object *map_object;
296 char uvlayer_name[32];
297 int uvlayer_tmp, pad;
298 } DisplaceModifierData;
300 /* DisplaceModifierData->direction */
306 MOD_DISP_DIR_RGB_XYZ,
309 /* DisplaceModifierData->texmapping */
317 typedef struct UVProjectModifierData {
318 ModifierData modifier;
320 /* the objects which do the projecting */
321 struct Object *projectors[10]; /* MOD_UVPROJECT_MAX */
322 struct Image *image; /* the image to project */
325 float aspectx, aspecty;
326 float scalex, scaley;
327 char uvlayer_name[32];
328 int uvlayer_tmp, pad;
329 } UVProjectModifierData;
331 #define MOD_UVPROJECT_MAXPROJECTORS 10
333 /* UVProjectModifierData->flags */
334 #define MOD_UVPROJECT_OVERRIDEIMAGE (1<<0)
336 typedef struct DecimateModifierData {
337 ModifierData modifier;
341 } DecimateModifierData;
343 /* Smooth modifier flags */
344 #define MOD_SMOOTH_X (1<<1)
345 #define MOD_SMOOTH_Y (1<<2)
346 #define MOD_SMOOTH_Z (1<<3)
348 typedef struct SmoothModifierData {
349 ModifierData modifier;
351 char defgrp_name[32];
354 } SmoothModifierData;
356 /* Cast modifier flags */
357 #define MOD_CAST_X (1<<1)
358 #define MOD_CAST_Y (1<<2)
359 #define MOD_CAST_Z (1<<3)
360 #define MOD_CAST_USE_OB_TRANSFORM (1<<4)
361 #define MOD_CAST_SIZE_FROM_RADIUS (1<<5)
363 /* Cast modifier projection types */
364 #define MOD_CAST_TYPE_SPHERE 0
365 #define MOD_CAST_TYPE_CYLINDER 1
366 #define MOD_CAST_TYPE_CUBOID 2
368 typedef struct CastModifierData {
369 ModifierData modifier;
371 struct Object *object;
375 char defgrp_name[32];
386 /* WaveModifierData.flag */
387 #define MOD_WAVE_X (1<<1)
388 #define MOD_WAVE_Y (1<<2)
389 #define MOD_WAVE_CYCL (1<<3)
390 #define MOD_WAVE_NORM (1<<4)
391 #define MOD_WAVE_NORM_X (1<<5)
392 #define MOD_WAVE_NORM_Y (1<<6)
393 #define MOD_WAVE_NORM_Z (1<<7)
395 typedef struct WaveModifierData {
396 ModifierData modifier;
398 struct Object *objectcenter;
399 char defgrp_name[32];
401 struct Object *map_object;
405 float startx, starty, height, width;
406 float narrow, speed, damp, falloff;
408 int texmapping, uvlayer_tmp;
410 char uvlayer_name[32];
412 float timeoffs, lifetime;
416 typedef struct ArmatureModifierData {
417 ModifierData modifier;
419 short deformflag, multi; /* deformflag replaces armature->deformflag */
421 struct Object *object;
422 float *prevCos; /* stored input of previous modifier, for vertexgroup blending */
423 char defgrp_name[32];
424 } ArmatureModifierData;
426 typedef struct HookModifierData {
427 ModifierData modifier;
429 struct Object *object;
430 char subtarget[32]; /* optional name of bone target */
432 float parentinv[4][4]; /* matrix making current transform unmodified */
433 float cent[3]; /* visualization of hook */
434 float falloff; /* if not zero, falloff is distance where influence zero */
436 int *indexar; /* if NULL, it's using vertexgroup */
439 char name[32]; /* optional vertexgroup name */
442 typedef struct SoftbodyModifierData {
443 ModifierData modifier;
444 } SoftbodyModifierData;
446 typedef struct ClothModifierData {
447 ModifierData modifier;
449 struct Scene *scene; /* the context, time etc is here */
450 struct Cloth *clothObject; /* The internal data structure for cloth. */
451 struct ClothSimSettings *sim_parms; /* definition is in DNA_cloth_types.h */
452 struct ClothCollSettings *coll_parms; /* definition is in DNA_cloth_types.h */
453 struct PointCache *point_cache; /* definition is in DNA_object_force.h */
454 struct ListBase ptcaches;
457 typedef struct CollisionModifierData {
458 ModifierData modifier;
460 struct MVert *x; /* position at the beginning of the frame */
461 struct MVert *xnew; /* position at the end of the frame */
462 struct MVert *xold; /* unsued atm, but was discussed during sprint */
463 struct MVert *current_xnew; /* new position at the actual inter-frame step */
464 struct MVert *current_x; /* position at the actual inter-frame step */
465 struct MVert *current_v; /* (xnew - x) at the actual inter-frame step */
467 struct MFace *mfaces; /* object face data */
469 unsigned int numverts;
470 unsigned int numfaces;
471 float time, pad; /* cfra time of modifier */
472 struct BVHTree *bvhtree; /* bounding volume hierarchy for this cloth object */
473 } CollisionModifierData;
475 typedef struct SurfaceModifierData {
476 ModifierData modifier;
478 struct MVert *x; /* old position */
479 struct MVert *v; /* velocity */
481 struct DerivedMesh *dm;
483 struct BVHTreeFromMesh *bvhtree; /* bounding volume hierarchy of the mesh faces */
486 } SurfaceModifierData;
489 eBooleanModifierOp_Intersect,
490 eBooleanModifierOp_Union,
491 eBooleanModifierOp_Difference,
493 typedef struct BooleanModifierData {
494 ModifierData modifier;
496 struct Object *object;
498 } BooleanModifierData;
500 #define MOD_MDEF_INVERT_VGROUP (1<<0)
501 #define MOD_MDEF_DYNAMIC_BIND (1<<1)
503 #define MOD_MDEF_VOLUME 0
504 #define MOD_MDEF_SURFACE 1
506 typedef struct MDefInfluence {
511 typedef struct MDefCell {
516 typedef struct MeshDeformModifierData {
517 ModifierData modifier;
519 struct Object *object; /* mesh object */
520 char defgrp_name[32]; /* optional vertexgroup name */
522 short gridsize, flag, mode, pad;
524 /* result of static binding */
525 MDefInfluence *bindinfluences; /* influences */
526 int *bindoffsets; /* offsets into influences array */
527 float *bindcagecos; /* coordinates that cage was bound with */
528 int totvert, totcagevert; /* total vertices in mesh and cage */
530 /* result of dynamic binding */
531 MDefCell *dyngrid; /* grid with dynamic binding cell points */
532 MDefInfluence *dyninfluences; /* dynamic binding vertex influences */
533 int *dynverts, *pad2; /* is this vertex bound or not? */
534 int dyngridsize; /* size of the dynamic bind grid */
535 int totinfluence; /* total number of vertex influences */
536 float dyncellmin[3]; /* offset of the dynamic bind grid */
537 float dyncellwidth; /* width of dynamic bind cell */
538 float bindmat[4][4]; /* matrix of cage at binding time */
540 /* deprecated storage */
541 float *bindweights; /* deprecated inefficient storage */
542 float *bindcos; /* deprecated storage of cage coords */
545 void (*bindfunc)(struct Scene *scene,
546 struct MeshDeformModifierData *mmd,
547 float *vertexcos, int totvert, float cagemat[][4]);
548 } MeshDeformModifierData;
551 eParticleSystemFlag_Pars = (1<<0),
552 eParticleSystemFlag_psys_updated = (1<<1),
553 } ParticleSystemModifierFlag;
555 typedef struct ParticleSystemModifierData {
556 ModifierData modifier;
557 struct ParticleSystem *psys;
558 struct DerivedMesh *dm;
559 int totdmvert, totdmedge, totdmface;
561 } ParticleSystemModifierData;
564 eParticleInstanceFlag_Parents = (1<<0),
565 eParticleInstanceFlag_Children = (1<<1),
566 eParticleInstanceFlag_Path = (1<<2),
567 eParticleInstanceFlag_Unborn = (1<<3),
568 eParticleInstanceFlag_Alive = (1<<4),
569 eParticleInstanceFlag_Dead = (1<<5),
570 eParticleInstanceFlag_KeepShape = (1<<6),
571 eParticleInstanceFlag_UseSize = (1<<7),
572 } ParticleInstanceModifierFlag;
574 typedef struct ParticleInstanceModifierData {
575 ModifierData modifier;
577 short psys, flag, axis, rt;
578 float position, random_position;
579 } ParticleInstanceModifierData;
582 eExplodeFlag_CalcFaces = (1<<0),
583 eExplodeFlag_PaSize = (1<<1),
584 eExplodeFlag_EdgeSplit = (1<<2),
585 eExplodeFlag_Unborn = (1<<3),
586 eExplodeFlag_Alive = (1<<4),
587 eExplodeFlag_Dead = (1<<5),
588 } ExplodeModifierFlag;
590 typedef struct ExplodeModifierData {
591 ModifierData modifier;
595 } ExplodeModifierData;
597 typedef struct MultiresModifierData {
598 ModifierData modifier;
600 char lvl, sculptlvl, renderlvl, totlvl;
601 char simple, flags, pad[2];
602 } MultiresModifierData;
605 eMultiresModifierFlag_ControlEdges = (1<<0),
606 } MultiresModifierFlag;
608 typedef struct FluidsimModifierData {
609 ModifierData modifier;
611 struct FluidsimSettings *fss; /* definition is in DNA_object_fluidsim.h */
612 struct PointCache *point_cache; /* definition is in DNA_object_force.h */
613 } FluidsimModifierData;
615 typedef struct ShrinkwrapModifierData {
616 ModifierData modifier;
618 struct Object *target; /* shrink target */
619 struct Object *auxTarget; /* additional shrink target */
620 char vgroup_name[32]; /* optional vertexgroup name */
621 float keepDist; /* distance offset to keep from mesh/projection point */
622 short shrinkType; /* shrink type projection */
623 short shrinkOpts; /* shrink options */
624 char projAxis; /* axis to project over */
627 * if using projection over vertex normal this controls the
628 * the level of subsurface that must be done before getting the
629 * vertex coordinates and normal
635 } ShrinkwrapModifierData;
637 /* Shrinkwrap->shrinkType */
638 #define MOD_SHRINKWRAP_NEAREST_SURFACE 0
639 #define MOD_SHRINKWRAP_PROJECT 1
640 #define MOD_SHRINKWRAP_NEAREST_VERTEX 2
642 /* Shrinkwrap->shrinkOpts */
643 #define MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR (1<<0) /* allow shrinkwrap to move the vertex in the positive direction of axis */
644 #define MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR (1<<1) /* allow shrinkwrap to move the vertex in the negative direction of axis */
646 #define MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE (1<<3) /* ignore vertex moves if a vertex ends projected on a front face of the target */
647 #define MOD_SHRINKWRAP_CULL_TARGET_BACKFACE (1<<4) /* ignore vertex moves if a vertex ends projected on a back face of the target */
649 #define MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE (1<<5) /* distance is measure to the front face of the target */
651 #define MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS (1<<0)
652 #define MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS (1<<1)
653 #define MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS (1<<2)
654 #define MOD_SHRINKWRAP_PROJECT_OVER_NORMAL 0 /* projection over normal is used if no axis is selected */
657 typedef struct SimpleDeformModifierData {
658 ModifierData modifier;
660 struct Object *origin; /* object to control the origin of modifier space coordinates */
661 char vgroup_name[32]; /* optional vertexgroup name */
662 float factor; /* factors to control simple deforms */
663 float limit[2]; /* lower and upper limit */
665 char mode; /* deform function */
666 char axis; /* lock axis (for taper and strech) */
667 char originOpts; /* originOptions */
670 } SimpleDeformModifierData;
672 #define MOD_SIMPLEDEFORM_MODE_TWIST 1
673 #define MOD_SIMPLEDEFORM_MODE_BEND 2
674 #define MOD_SIMPLEDEFORM_MODE_TAPER 3
675 #define MOD_SIMPLEDEFORM_MODE_STRETCH 4
677 #define MOD_SIMPLEDEFORM_LOCK_AXIS_X (1<<0)
678 #define MOD_SIMPLEDEFORM_LOCK_AXIS_Y (1<<1)
680 /* indicates whether simple deform should use the local
681 coordinates or global coordinates of origin */
682 #define MOD_SIMPLEDEFORM_ORIGIN_LOCAL (1<<0)
684 #define MOD_UVPROJECT_MAX 10
686 typedef struct ShapeKeyModifierData {
687 ModifierData modifier;
688 } ShapeKeyModifierData;
690 typedef struct SolidifyModifierData {
691 ModifierData modifier;
693 char defgrp_name[32]; /* name of vertex group to use */
694 float offset; /* new surface offset level*/
695 float offset_fac; /* midpoint of the offset */
700 } SolidifyModifierData;
702 #define MOD_SOLIDIFY_RIM (1<<0)
703 #define MOD_SOLIDIFY_EVEN (1<<1)
704 #define MOD_SOLIDIFY_NORMAL_CALC (1<<2)
705 #define MOD_SOLIDIFY_VGROUP_INV (1<<3)
706 #define MOD_SOLIDIFY_RIM_MATERIAL (1<<4)
708 typedef struct ScrewModifierData {
709 ModifierData modifier;
710 struct Object *ob_axis;
720 #define MOD_SCREW_NORMAL_FLIP (1<<0)
721 #define MOD_SCREW_NORMAL_CALC (1<<1)
722 #define MOD_SCREW_OBJECT_OFFSET (1<<2)
723 // #define MOD_SCREW_OBJECT_ANGLE (1<<4)