5 #ifndef DNA_MODIFIER_TYPES_H
6 #define DNA_MODIFIER_TYPES_H
8 #define MODSTACK_DEBUG 1
10 /* WARNING ALERT! TYPEDEF VALUES ARE WRITTEN IN FILES! SO DO NOT CHANGE! */
12 typedef enum ModifierType {
13 eModifierType_None = 0,
14 eModifierType_Subsurf,
15 eModifierType_Lattice,
19 eModifierType_Decimate,
21 eModifierType_Armature,
23 eModifierType_Softbody,
24 eModifierType_Boolean,
26 eModifierType_EdgeSplit,
27 eModifierType_Displace,
28 eModifierType_UVProject,
31 eModifierType_MeshDeform,
32 eModifierType_ParticleSystem,
33 eModifierType_ParticleInstance,
34 eModifierType_Explode,
36 eModifierType_Collision,
38 eModifierType_Shrinkwrap,
39 eModifierType_Fluidsim,
41 eModifierType_SimpleDeform,
42 eModifierType_Multires,
43 eModifierType_Surface,
45 eModifierType_SmokeHR,
49 typedef enum ModifierMode {
50 eModifierMode_Realtime = (1<<0),
51 eModifierMode_Render = (1<<1),
52 eModifierMode_Editmode = (1<<2),
53 eModifierMode_OnCage = (1<<3),
54 eModifierMode_Expanded = (1<<4),
55 eModifierMode_Virtual = (1<<5),
56 eModifierMode_DisableTemporary = (1 << 31)
59 typedef struct ModifierData {
60 struct ModifierData *next, *prev;
65 /* XXX for timing info set by caller... solve later? (ton) */
72 eSubsurfModifierFlag_Incremental = (1<<0),
73 eSubsurfModifierFlag_DebugIncr = (1<<1),
74 eSubsurfModifierFlag_ControlEdges = (1<<2),
75 eSubsurfModifierFlag_SubsurfUv = (1<<3)
76 } SubsurfModifierFlag;
78 typedef struct SubsurfModifierData {
79 ModifierData modifier;
81 short subdivType, levels, renderLevels, flags;
83 void *emCache, *mCache;
84 } SubsurfModifierData;
86 typedef struct LatticeModifierData {
87 ModifierData modifier;
89 struct Object *object;
90 char name[32]; /* optional vertexgroup name */
91 } LatticeModifierData;
93 typedef struct CurveModifierData {
94 ModifierData modifier;
96 struct Object *object;
97 char name[32]; /* optional vertexgroup name */
98 short defaxis; /* axis along which curve deforms */
102 /* CurveModifierData->defaxis */
103 #define MOD_CURVE_POSX 1
104 #define MOD_CURVE_POSY 2
105 #define MOD_CURVE_POSZ 3
106 #define MOD_CURVE_NEGX 4
107 #define MOD_CURVE_NEGY 5
108 #define MOD_CURVE_NEGZ 6
110 typedef struct BuildModifierData {
111 ModifierData modifier;
118 typedef struct MaskModifierData {
119 ModifierData modifier;
121 struct Object *ob_arm; /* armature to use to in place of hardcoded vgroup */
122 char vgroup[32]; /* name of vertex group to use to mask */
124 int mode; /* using armature or hardcoded vgroup */
125 int flag; /* flags for various things */
128 /* Mask Modifier -> mode */
129 #define MOD_MASK_MODE_VGROUP 0
130 #define MOD_MASK_MODE_ARM 1
132 /* Mask Modifier -> flag */
133 #define MOD_MASK_INV (1<<0)
135 typedef struct ArrayModifierData {
136 ModifierData modifier;
138 /* the object with which to cap the start of the array */
139 struct Object *start_cap;
140 /* the object with which to cap the end of the array */
141 struct Object *end_cap;
142 /* the curve object to use for MOD_ARR_FITCURVE */
143 struct Object *curve_ob;
144 /* the object to use for object offset */
145 struct Object *offset_ob;
146 /* a constant duplicate offset;
147 1 means the duplicates are 1 unit apart
150 /* a scaled factor for duplicate offsets;
151 1 means the duplicates are 1 object-width apart
154 /* the length over which to distribute the duplicates */
156 /* the limit below which to merge vertices in adjacent duplicates */
158 /* determines how duplicate count is calculated; one of:
159 MOD_ARR_FIXEDCOUNT -> fixed
160 MOD_ARR_FITLENGTH -> calculated to fit a set length
161 MOD_ARR_FITCURVE -> calculated to fit the length of a Curve object
164 /* flags specifying how total offset is calculated; binary OR of:
165 MOD_ARR_OFF_CONST -> total offset += offset
166 MOD_ARR_OFF_RELATIVE -> total offset += relative * object width
167 MOD_ARR_OFF_OBJ -> total offset += offset_ob's matrix
168 total offset is the sum of the individual enabled offsets
172 MOD_ARR_MERGE -> merge vertices in adjacent duplicates
175 /* the number of duplicates to generate for MOD_ARR_FIXEDCOUNT */
179 /* ArrayModifierData->fit_type */
180 #define MOD_ARR_FIXEDCOUNT 0
181 #define MOD_ARR_FITLENGTH 1
182 #define MOD_ARR_FITCURVE 2
184 /* ArrayModifierData->offset_type */
185 #define MOD_ARR_OFF_CONST 1<<0
186 #define MOD_ARR_OFF_RELATIVE 1<<1
187 #define MOD_ARR_OFF_OBJ 1<<2
189 /* ArrayModifierData->flags */
190 #define MOD_ARR_MERGE 1<<0
191 #define MOD_ARR_MERGEFINAL 1<<1
193 typedef struct MirrorModifierData {
194 ModifierData modifier;
198 struct Object *mirror_ob;
199 } MirrorModifierData;
201 /* MirrorModifierData->flag */
202 #define MOD_MIR_CLIPPING 1<<0
203 #define MOD_MIR_MIRROR_U 1<<1
204 #define MOD_MIR_MIRROR_V 1<<2
205 #define MOD_MIR_AXIS_X 1<<3
206 #define MOD_MIR_AXIS_Y 1<<4
207 #define MOD_MIR_AXIS_Z 1<<5
208 #define MOD_MIR_VGROUP 1<<6
210 typedef struct EdgeSplitModifierData {
211 ModifierData modifier;
213 float split_angle; /* angle above which edges should be split */
215 } EdgeSplitModifierData;
217 /* EdgeSplitModifierData->flags */
218 #define MOD_EDGESPLIT_FROMANGLE 1<<1
219 #define MOD_EDGESPLIT_FROMFLAG 1<<2
221 typedef struct BevelModifierData {
222 ModifierData modifier;
224 float value; /* the "raw" bevel value (distance/amount to bevel) */
225 int res; /* the resolution (as originally coded, it is the number of recursive bevels) */
227 short flags; /* general option flags */
228 short val_flags; /* flags used to interpret the bevel value */
229 short lim_flags; /* flags to tell the tool how to limit the bevel */
230 short e_flags; /* flags to direct how edge weights are applied to verts */
231 float bevel_angle; /* if the BME_BEVEL_ANGLE is set, this will be how "sharp" an edge must be before it gets beveled */
232 char defgrp_name[32]; /* if the BME_BEVEL_VWEIGHT option is set, this will be the name of the vert group */
235 typedef struct BMeshModifierData {
236 ModifierData modifier;
243 /* Smoke modifier flags */
244 #define MOD_SMOKE_TYPE_DOMAIN (1 << 0)
245 #define MOD_SMOKE_TYPE_FLOW (1 << 1)
246 #define MOD_SMOKE_TYPE_COLL (1 << 2)
248 typedef struct SmokeModifierData {
249 ModifierData modifier;
251 struct SmokeDomainSettings *domain;
252 struct SmokeFlowSettings *flow; /* inflow, outflow, smoke objects */
253 struct SmokeCollSettings *coll; /* collision objects */
255 int type; /* domain, inflow, outflow, ... */
260 #define MOD_SMOKE_NOISEWAVE (1<<0)
261 #define MOD_SMOKE_NOISEFFT (1<<1)
262 #define MOD_SMOKE_NOISECURL (1<<2)
265 #define MOD_SMOKE_SHOWHIGHRES (1<<0) /* show high resolution */
267 typedef struct SmokeHRModifierData {
268 ModifierData modifier;
270 struct WTURBULENCE *wt; // WTURBULENCE object, if active
271 struct PointCache *point_cache; /* definition is in DNA_object_force.h */
272 struct ListBase ptcaches;
273 struct GPUTexture *tex;
274 float *view3d; /* voxel data for display */
275 unsigned int v3dnum; /* number of frame in view3d buffer */
280 short noise; /* noise type: wave, curl, anisotropic */
284 } SmokeHRModifierData;
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];
322 struct Image *image; /* the image to project */
325 float aspectx, aspecty;
326 char uvlayer_name[32];
327 int uvlayer_tmp, pad;
328 } UVProjectModifierData;
330 #define MOD_UVPROJECT_MAXPROJECTORS 10
332 /* UVProjectModifierData->flags */
333 #define MOD_UVPROJECT_OVERRIDEIMAGE 1<<0
335 typedef struct DecimateModifierData {
336 ModifierData modifier;
340 } DecimateModifierData;
342 /* Smooth modifier flags */
343 #define MOD_SMOOTH_X (1<<1)
344 #define MOD_SMOOTH_Y (1<<2)
345 #define MOD_SMOOTH_Z (1<<3)
347 typedef struct SmoothModifierData {
348 ModifierData modifier;
350 char defgrp_name[32];
353 } SmoothModifierData;
355 /* Cast modifier flags */
356 #define MOD_CAST_X (1<<1)
357 #define MOD_CAST_Y (1<<2)
358 #define MOD_CAST_Z (1<<3)
359 #define MOD_CAST_USE_OB_TRANSFORM (1<<4)
360 #define MOD_CAST_SIZE_FROM_RADIUS (1<<5)
362 /* Cast modifier projection types */
363 #define MOD_CAST_TYPE_SPHERE 0
364 #define MOD_CAST_TYPE_CYLINDER 1
365 #define MOD_CAST_TYPE_CUBOID 2
367 typedef struct CastModifierData {
368 ModifierData modifier;
370 struct Object *object;
374 char defgrp_name[32];
385 /* WaveModifierData.flag */
386 #define MOD_WAVE_X 1<<1
387 #define MOD_WAVE_Y 1<<2
388 #define MOD_WAVE_CYCL 1<<3
389 #define MOD_WAVE_NORM 1<<4
390 #define MOD_WAVE_NORM_X 1<<5
391 #define MOD_WAVE_NORM_Y 1<<6
392 #define MOD_WAVE_NORM_Z 1<<7
394 typedef struct WaveModifierData {
395 ModifierData modifier;
397 struct Object *objectcenter;
398 char defgrp_name[32];
400 struct Object *map_object;
404 float startx, starty, height, width;
405 float narrow, speed, damp, falloff;
407 int texmapping, uvlayer_tmp;
409 char uvlayer_name[32];
411 float timeoffs, lifetime;
415 typedef struct ArmatureModifierData {
416 ModifierData modifier;
418 short deformflag, multi; /* deformflag replaces armature->deformflag */
420 struct Object *object;
421 float *prevCos; /* stored input of previous modifier, for vertexgroup blending */
422 char defgrp_name[32];
423 } ArmatureModifierData;
425 typedef struct HookModifierData {
426 ModifierData modifier;
428 struct Object *object;
429 float parentinv[4][4]; /* matrix making current transform unmodified */
430 float cent[3]; /* visualization of hook */
431 float falloff; /* if not zero, falloff is distance where influence zero */
433 int *indexar; /* if NULL, it's using vertexgroup */
436 char name[32]; /* optional vertexgroup name */
439 typedef struct SoftbodyModifierData {
440 ModifierData modifier;
441 } SoftbodyModifierData;
443 typedef struct ClothModifierData {
444 ModifierData modifier;
446 struct Scene *scene; /* the context, time etc is here */
447 struct Cloth *clothObject; /* The internal data structure for cloth. */
448 struct ClothSimSettings *sim_parms; /* definition is in DNA_cloth_types.h */
449 struct ClothCollSettings *coll_parms; /* definition is in DNA_cloth_types.h */
450 struct PointCache *point_cache; /* definition is in DNA_object_force.h */
451 struct ListBase ptcaches;
454 typedef struct CollisionModifierData {
455 ModifierData modifier;
457 struct MVert *x; /* position at the beginning of the frame */
458 struct MVert *xnew; /* position at the end of the frame */
459 struct MVert *xold; /* unsued atm, but was discussed during sprint */
460 struct MVert *current_xnew; /* new position at the actual inter-frame step */
461 struct MVert *current_x; /* position at the actual inter-frame step */
462 struct MVert *current_v; /* (xnew - x) at the actual inter-frame step */
464 struct MFace *mfaces; /* object face data */
466 unsigned int numverts;
467 unsigned int numfaces;
468 short absorption; /* used for forces, in % */
470 float time; /* cfra time of modifier */
471 struct BVHTree *bvhtree; /* bounding volume hierarchy for this cloth object */
472 } CollisionModifierData;
474 typedef struct SurfaceModifierData {
475 ModifierData modifier;
477 struct MVert *x; /* old position */
478 struct MVert *v; /* velocity */
480 struct DerivedMesh *dm;
482 struct BVHTreeFromMesh *bvhtree; /* bounding volume hierarchy of the mesh faces */
485 } SurfaceModifierData;
488 eBooleanModifierOp_Intersect,
489 eBooleanModifierOp_Union,
490 eBooleanModifierOp_Difference,
492 typedef struct BooleanModifierData {
493 ModifierData modifier;
495 struct Object *object;
497 } BooleanModifierData;
499 #define MOD_MDEF_INVERT_VGROUP (1<<0)
500 #define MOD_MDEF_DYNAMIC_BIND (1<<1)
502 typedef struct MDefInfluence {
507 typedef struct MDefCell {
512 typedef struct MeshDeformModifierData {
513 ModifierData modifier;
515 struct Object *object; /* mesh object */
516 char defgrp_name[32]; /* optional vertexgroup name */
518 short gridsize, needbind;
521 /* variables filled in when bound */
522 float *bindweights, *bindcos; /* computed binding weights */
523 int totvert, totcagevert; /* total vertices in mesh and cage */
524 MDefCell *dyngrid; /* grid with dynamic binding cell points */
525 MDefInfluence *dyninfluences; /* dynamic binding vertex influences */
526 int *dynverts, *pad2; /* is this vertex bound or not? */
527 int dyngridsize; /* size of the dynamic bind grid */
528 int totinfluence; /* total number of vertex influences */
529 float dyncellmin[3]; /* offset of the dynamic bind grid */
530 float dyncellwidth; /* width of dynamic bind cell */
531 float bindmat[4][4]; /* matrix of cage at binding time */
532 } MeshDeformModifierData;
535 eParticleSystemFlag_Loaded = (1<<0),
536 eParticleSystemFlag_Pars = (1<<1),
537 eParticleSystemFlag_FromCurve = (1<<2),
538 eParticleSystemFlag_DM_changed = (1<<3),
539 eParticleSystemFlag_Disabled = (1<<4),
540 eParticleSystemFlag_psys_updated = (1<<5),
541 } ParticleSystemModifierFlag;
543 typedef struct ParticleSystemModifierData {
544 ModifierData modifier;
545 struct ParticleSystem *psys;
546 struct DerivedMesh *dm;
547 int totdmvert, totdmedge, totdmface;
549 } ParticleSystemModifierData;
552 eParticleInstanceFlag_Parents = (1<<0),
553 eParticleInstanceFlag_Children = (1<<1),
554 eParticleInstanceFlag_Path = (1<<2),
555 eParticleInstanceFlag_Unborn = (1<<3),
556 eParticleInstanceFlag_Alive = (1<<4),
557 eParticleInstanceFlag_Dead = (1<<5),
558 eParticleInstanceFlag_KeepShape = (1<<6),
559 eParticleInstanceFlag_UseSize = (1<<7),
560 } ParticleInstanceModifierFlag;
562 typedef struct ParticleInstanceModifierData {
563 ModifierData modifier;
565 short psys, flag, axis, rt;
566 float position, random_position;
567 } ParticleInstanceModifierData;
570 eExplodeFlag_CalcFaces = (1<<0),
571 //eExplodeFlag_PaSize = (1<<1),
572 eExplodeFlag_EdgeSplit = (1<<2),
573 eExplodeFlag_Unborn = (1<<3),
574 eExplodeFlag_Alive = (1<<4),
575 eExplodeFlag_Dead = (1<<5),
576 } ExplodeModifierFlag;
578 typedef struct ExplodeModifierData {
579 ModifierData modifier;
583 } ExplodeModifierData;
585 typedef struct MultiresModifierData {
586 ModifierData modifier;
588 struct MVert *undo_verts; /* Store DerivedMesh vertices for multires undo */
589 int undo_verts_tot; /* Length of undo_verts array */
590 char undo_signal; /* If true, signals to replace verts with undo verts */
594 } MultiresModifierData;
596 typedef struct FluidsimModifierData {
597 ModifierData modifier;
599 struct FluidsimSettings *fss; /* definition is is DNA_object_fluidsim.h */
600 struct PointCache *point_cache; /* definition is in DNA_object_force.h */
601 } FluidsimModifierData;
603 typedef struct ShrinkwrapModifierData {
604 ModifierData modifier;
606 struct Object *target; /* shrink target */
607 struct Object *auxTarget; /* additional shrink target */
608 char vgroup_name[32]; /* optional vertexgroup name */
609 float keepDist; /* distance offset to keep from mesh/projection point */
610 short shrinkType; /* shrink type projection */
611 short shrinkOpts; /* shrink options */
612 char projAxis; /* axis to project over */
615 * if using projection over vertex normal this controls the
616 * the level of subsurface that must be done before getting the
617 * vertex coordinates and normal
623 } ShrinkwrapModifierData;
625 /* Shrinkwrap->shrinkType */
626 #define MOD_SHRINKWRAP_NEAREST_SURFACE 0
627 #define MOD_SHRINKWRAP_PROJECT 1
628 #define MOD_SHRINKWRAP_NEAREST_VERTEX 2
630 /* Shrinkwrap->shrinkOpts */
631 #define MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR (1<<0) /* allow shrinkwrap to move the vertex in the positive direction of axis */
632 #define MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR (1<<1) /* allow shrinkwrap to move the vertex in the negative direction of axis */
634 #define MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE (1<<3) /* ignore vertex moves if a vertex ends projected on a front face of the target */
635 #define MOD_SHRINKWRAP_CULL_TARGET_BACKFACE (1<<4) /* ignore vertex moves if a vertex ends projected on a back face of the target */
637 #define MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE (1<<5) /* distance is measure to the front face of the target */
639 #define MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS (1<<0)
640 #define MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS (1<<1)
641 #define MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS (1<<2)
642 #define MOD_SHRINKWRAP_PROJECT_OVER_NORMAL 0 /* projection over normal is used if no axis is selected */
645 typedef struct SimpleDeformModifierData {
646 ModifierData modifier;
648 struct Object *origin; /* object to control the origin of modifier space coordinates */
649 char vgroup_name[32]; /* optional vertexgroup name */
650 float factor; /* factors to control simple deforms */
651 float limit[2]; /* lower and upper limit */
653 char mode; /* deform function */
654 char axis; /* lock axis (for taper and strech) */
655 char originOpts; /* originOptions */
658 } SimpleDeformModifierData;
660 #define MOD_SIMPLEDEFORM_MODE_TWIST 1
661 #define MOD_SIMPLEDEFORM_MODE_BEND 2
662 #define MOD_SIMPLEDEFORM_MODE_TAPER 3
663 #define MOD_SIMPLEDEFORM_MODE_STRETCH 4
665 #define MOD_SIMPLEDEFORM_LOCK_AXIS_X (1<<0)
666 #define MOD_SIMPLEDEFORM_LOCK_AXIS_Y (1<<1)
668 /* indicates whether simple deform should use the local
669 coordinates or global coordinates of origin */
670 #define MOD_SIMPLEDEFORM_ORIGIN_LOCAL (1<<0)