diff options
Diffstat (limited to 'source/blender/makesdna/DNA_object_force_types.h')
-rw-r--r-- | source/blender/makesdna/DNA_object_force_types.h | 379 |
1 files changed, 221 insertions, 158 deletions
diff --git a/source/blender/makesdna/DNA_object_force_types.h b/source/blender/makesdna/DNA_object_force_types.h index a30aa03e28c..5bc9850b206 100644 --- a/source/blender/makesdna/DNA_object_force_types.h +++ b/source/blender/makesdna/DNA_object_force_types.h @@ -37,6 +37,7 @@ extern "C" { #endif #include "DNA_listBase.h" +#include "DNA_defs.h" /* pd->forcefield: Effector Fields types */ typedef enum ePFieldType { @@ -73,66 +74,115 @@ typedef enum ePFieldType { } ePFieldType; typedef struct PartDeflect { - int flag; /* general settings flag */ - short deflect; /* Deflection flag - does mesh deflect particles */ - short forcefield; /* Force field type, do the vertices attract / repel particles? */ - short falloff; /* fall-off type */ - short shape; /* point, plane or surface */ - short tex_mode; /* texture effector */ - short kink, kink_axis; /* for curve guide */ + /** General settings flag. */ + int flag; + /** Deflection flag - does mesh deflect particles. */ + short deflect; + /** Force field type, do the vertices attract / repel particles? */ + short forcefield; + /** Fall-off type. */ + short falloff; + /** Point, plane or surface. */ + short shape; + /** Texture effector. */ + short tex_mode; + /** For curve guide. */ + short kink, kink_axis; short zdir; /* Main effector values */ - float f_strength; /* The strength of the force (+ or - ) */ - float f_damp; /* Damping ratio of the harmonic effector. */ - float f_flow; /* How much force is converted into "air flow", i.e. */ - /* force used as the velocity of surrounding medium. */ - - float f_size; /* Noise size for noise effector, restlength for harmonic effector */ + /** The strength of the force (+ or - ). */ + float f_strength; + /** Damping ratio of the harmonic effector. */ + float f_damp; + /** + * How much force is converted into "air flow", i.e. + * force used as the velocity of surrounding medium. */ + float f_flow; + + /** Noise size for noise effector, restlength for harmonic effector. */ + float f_size; /* fall-off */ - float f_power; /* The power law - real gravitation is 2 (square) */ - float maxdist; /* if indicated, use this maximum */ - float mindist; /* if indicated, use this minimum */ - float f_power_r; /* radial fall-off power */ - float maxrad; /* radial versions of above */ + /** The power law - real gravitation is 2 (square). */ + float f_power; + /** If indicated, use this maximum. */ + float maxdist; + /** If indicated, use this minimum. */ + float mindist; + /** Radial fall-off power. */ + float f_power_r; + /** Radial versions of above. */ + float maxrad; float minrad; /* particle collisions */ - float pdef_damp; /* Damping factor for particle deflection */ - float pdef_rdamp; /* Random element of damping for deflection */ - float pdef_perm; /* Chance of particle passing through mesh */ - float pdef_frict; /* Friction factor for particle deflection */ - float pdef_rfrict; /* Random element of friction for deflection */ - float pdef_stickness;/* surface particle stickiness */ - - float absorption; /* used for forces */ + /** Damping factor for particle deflection. */ + float pdef_damp; + /** Random element of damping for deflection. */ + float pdef_rdamp; + /** Chance of particle passing through mesh. */ + float pdef_perm; + /** Friction factor for particle deflection. */ + float pdef_frict; + /** Random element of friction for deflection. */ + float pdef_rfrict; + /** Surface particle stickiness. */ + float pdef_stickness; + + /** Used for forces. */ + float absorption; /* softbody collisions */ - float pdef_sbdamp; /* Damping factor for softbody deflection */ - float pdef_sbift; /* inner face thickness for softbody deflection */ - float pdef_sboft; /* outer face thickness for softbody deflection */ + /** Damping factor for softbody deflection. */ + float pdef_sbdamp; + /** Inner face thickness for softbody deflection. */ + float pdef_sbift; + /** Outer face thickness for softbody deflection. */ + float pdef_sboft; /* guide curve, same as for particle child effects */ float clump_fac, clump_pow; float kink_freq, kink_shape, kink_amp, free_end; /* texture effector */ - float tex_nabla; /* Used for calculating partial derivatives */ - struct Tex *tex; /* Texture of the texture effector */ + /** Used for calculating partial derivatives. */ + float tex_nabla; + /** Texture of the texture effector. */ + struct Tex *tex; /* effector noise */ - struct RNG *rng; /* random noise generator for e.g. wind */ - float f_noise; /* noise of force */ - int seed; /* noise random seed */ - - struct Object *f_source; /* force source object */ + /** Random noise generator for e.g. wind. */ + struct RNG *rng; + /** Noise of force. */ + float f_noise; + /** Noise random seed. */ + int seed; + + /* Display Size */ + /** Runtime only : start of the curve or draw scale. */ + float drawvec1[4]; + /** Runtime only : end of the curve. */ + float drawvec2[4]; + /** Runtime only. */ + float drawvec_falloff_min[3], pad1; + /** Runtime only. */ + float drawvec_falloff_max[3], pad2; + + /** Force source object. */ + struct Object *f_source; + + /** Friction of cloth collisions. */ + float pdef_cfrict; + float pad; } PartDeflect; typedef struct EffectorWeights { - struct Group *group; /* only use effectors from this group of objects */ + /** Only use effectors from this group of objects. */ + struct Collection *group; - float weight[14]; /* effector type specific weights */ + /** Effector type specific weights. */ + float weight[14]; float global_gravity; short flag, rt[3]; int pad; @@ -175,115 +225,91 @@ typedef struct PTCacheMem { unsigned int frame, totpoint; unsigned int data_types, flag; - void *data[8]; /* BPHYS_TOT_DATA */ - void *cur[8]; /* BPHYS_TOT_DATA */ + /** BPHYS_TOT_DATA. */ + void *data[8]; + /** BPHYS_TOT_DATA. */ + void *cur[8]; struct ListBase extradata; } PTCacheMem; typedef struct PointCache { struct PointCache *next, *prev; - int flag; /* generic flag */ - - int step; /* The number of frames between cached frames. - * This should probably be an upper bound for a per point adaptive step in the future, - * buf for now it's the same for all points. Without adaptivity this can effect the perceived - * simulation quite a bit though. If for example particles are colliding with a horizontal - * plane (with high damping) they quickly come to a stop on the plane, however there are still - * forces acting on the particle (gravity and collisions), so the particle velocity isn't necessarily - * zero for the whole duration of the frame even if the particle seems stationary. If all simulation - * frames aren't cached (step > 1) these velocities are interpolated into movement for the non-cached - * frames. The result will look like the point is oscillating around the collision location. So for - * now cache step should be set to 1 for accurate reproduction of collisions. - */ - - int simframe; /* current frame of simulation (only if SIMULATION_VALID) */ - int startframe; /* simulation start frame */ - int endframe; /* simulation end frame */ - int editframe; /* frame being edited (runtime only) */ - int last_exact; /* last exact frame that's cached */ - int last_valid; /* used for editing cache - what is the last baked frame */ + /** Generic flag. */ + int flag; + + /** + * The number of frames between cached frames. + * This should probably be an upper bound for a per point adaptive step in the future, + * buf for now it's the same for all points. Without adaptivity this can effect the perceived + * simulation quite a bit though. If for example particles are colliding with a horizontal + * plane (with high damping) they quickly come to a stop on the plane, however there are still + * forces acting on the particle (gravity and collisions), so the particle velocity isn't necessarily + * zero for the whole duration of the frame even if the particle seems stationary. If all simulation + * frames aren't cached (step > 1) these velocities are interpolated into movement for the non-cached + * frames. The result will look like the point is oscillating around the collision location. So for + * now cache step should be set to 1 for accurate reproduction of collisions. + */ + int step; + + /** Current frame of simulation (only if SIMULATION_VALID). */ + int simframe; + /** Simulation start frame. */ + int startframe; + /** Simulation end frame. */ + int endframe; + /** Frame being edited (runtime only). */ + int editframe; + /** Last exact frame that's cached. */ + int last_exact; + /** Used for editing cache - what is the last baked frame. */ + int last_valid; int pad; /* for external cache files */ - int totpoint; /* number of cached points */ - int index; /* modifier stack index */ + /** Number of cached points. */ + int totpoint; + /** Modifier stack index. */ + int index; short compression, rt; char name[64]; char prev_name[64]; char info[64]; - char path[1024]; /* file path, 1024 = FILE_MAX */ - char *cached_frames; /* array of length endframe-startframe+1 with flags to indicate cached frames */ - /* can be later used for other per frame flags too if needed */ + /** File path, 1024 = FILE_MAX. */ + char path[1024]; + /** + * Array of length endframe-startframe+1 with flags to indicate cached frames. + * Can be later used for other per frame flags too if needed. + */ + char *cached_frames; struct ListBase mem_cache; struct PTCacheEdit *edit; - void (*free_edit)(struct PTCacheEdit *edit); /* free callback */ + /** Free callback. */ + void (*free_edit)(struct PTCacheEdit *edit); } PointCache; typedef struct SBVertex { float vec[4]; } SBVertex; -typedef struct BulletSoftBody { - int flag; /* various boolean options */ - float linStiff; /* linear stiffness 0..1 */ - float angStiff; /* angular stiffness 0..1 */ - float volume; /* volume preservation 0..1 */ - - int viterations; /* Velocities solver iterations */ - int piterations; /* Positions solver iterations */ - int diterations; /* Drift solver iterations */ - int citerations; /* Cluster solver iterations */ - - float kSRHR_CL; /* Soft vs rigid hardness [0,1] (cluster only) */ - float kSKHR_CL; /* Soft vs kinetic hardness [0,1] (cluster only) */ - float kSSHR_CL; /* Soft vs soft hardness [0,1] (cluster only) */ - float kSR_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - - float kSK_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - float kSS_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - float kVCF; /* Velocities correction factor (Baumgarte) */ - float kDP; /* Damping coefficient [0,1] */ - - float kDG; /* Drag coefficient [0,+inf] */ - float kLF; /* Lift coefficient [0,+inf] */ - float kPR; /* Pressure coefficient [-inf,+inf] */ - float kVC; /* Volume conversation coefficient [0,+inf] */ - - float kDF; /* Dynamic friction coefficient [0,1] */ - float kMT; /* Pose matching coefficient [0,1] */ - float kCHR; /* Rigid contacts hardness [0,1] */ - float kKHR; /* Kinetic contacts hardness [0,1] */ - - float kSHR; /* Soft contacts hardness [0,1] */ - float kAHR; /* Anchors hardness [0,1] */ - int collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */ - int numclusteriterations; /* number of iterations to refine collision clusters*/ - float welding; /* welding limit to remove duplicate/nearby vertices, 0.0..0.01 */ - float margin; /* margin specific to softbody */ -} BulletSoftBody; - -/* BulletSoftBody.flag */ -#define OB_BSB_SHAPE_MATCHING 2 -// #define OB_BSB_UNUSED 4 -#define OB_BSB_BENDING_CONSTRAINTS 8 -#define OB_BSB_AERO_VPOINT 16 /* aero model, Vertex normals are oriented toward velocity*/ -// #define OB_BSB_AERO_VTWOSIDE 32 /* aero model, Vertex normals are flipped to match velocity */ - -/* BulletSoftBody.collisionflags */ -#define OB_BSB_COL_SDF_RS 2 /* SDF based rigid vs soft */ -#define OB_BSB_COL_CL_RS 4 /* Cluster based rigid vs soft */ -#define OB_BSB_COL_CL_SS 8 /* Cluster based soft vs soft */ -#define OB_BSB_COL_VF_SS 16 /* Vertex/Face based soft vs soft */ - +/* Container for data that is shared among CoW copies. + * + * This is placed in a separate struct so that values can be changed + * without having to update all CoW copies. */ +typedef struct SoftBody_Shared { + struct PointCache *pointcache; + struct ListBase ptcaches; +} SoftBody_Shared; typedef struct SoftBody { /* dynamic data */ int totpoint, totspring; - struct BodyPoint *bpoint; /* not saved in file */ - struct BodySpring *bspring; /* not saved in file */ + /** Not saved in file. */ + struct BodyPoint *bpoint; + /** Not saved in file. */ + struct BodySpring *bspring; char pad; char msg_lock; short msg_value; @@ -291,52 +317,77 @@ typedef struct SoftBody { /* part of UI: */ /* general options */ - float nodemass; /* softbody mass of *vertex* */ - char namedVG_Mass[64]; /* MAX_VGROUP_NAME */ - /* along with it introduce mass painting - * starting to fix old bug .. nastiness that VG are indexes - * rather find them by name tag to find it -> jow20090613 */ - float grav; /* softbody amount of gravitaion to apply */ - float mediafrict; /* friction to env */ - float rklimit; /* error limit for ODE solver */ - float physics_speed;/* user control over simulation speed */ + /** Softbody mass of *vertex*. */ + float nodemass; + /** + * Along with it introduce mass painting + * starting to fix old bug .. nastiness that VG are indexes + * rather find them by name tag to find it -> jow20090613. + * MAX_VGROUP_NAME */ + char namedVG_Mass[64]; + /** Softbody amount of gravitaion to apply. */ + float grav; + /** Friction to env. */ + float mediafrict; + /** Error limit for ODE solver. */ + float rklimit; + /** User control over simulation speed. */ + float physics_speed; /* goal */ - float goalspring; /* softbody goal springs */ - float goalfrict; /* softbody goal springs friction */ - float mingoal; /* quick limits for goal */ + /** Softbody goal springs. */ + float goalspring; + /** Softbody goal springs friction. */ + float goalfrict; + /** Quick limits for goal. */ + float mingoal; float maxgoal; - float defgoal; /* default goal for vertices without vgroup */ - short vertgroup; /* index starting at 1 */ - char namedVG_Softgoal[64]; /* MAX_VGROUP_NAME */ - /* starting to fix old bug .. nastiness that VG are indexes - * rather find them by name tag to find it -> jow20090613 */ - - short fuzzyness; /* */ + /** Default goal for vertices without vgroup. */ + float defgoal; + /** Index starting at 1. */ + short vertgroup; + /** + * Starting to fix old bug .. nastiness that VG are indexes + * rather find them by name tag to find it -> jow20090613. + * MAX_VGROUP_NAME */ + char namedVG_Softgoal[64]; + + short fuzzyness; /* springs */ - float inspring; /* softbody inner springs */ - float infrict; /* softbody inner springs friction */ - char namedVG_Spring_K[64]; /* MAX_VGROUP_NAME */ - /* along with it introduce Spring_K painting - * starting to fix old bug .. nastiness that VG are indexes - * rather find them by name tag to find it -> jow20090613 */ + /** Softbody inner springs. */ + float inspring; + /** Softbody inner springs friction. */ + float infrict; + /** + * Along with it introduce Spring_K painting + * starting to fix old bug .. nastiness that VG are indexes + * rather find them by name tag to find it -> jow20090613. + * MAX_VGROUP_NAME + */ + char namedVG_Spring_K[64]; /* baking */ int sfra, efra; int interval; - short local, solverflags; /* local==1: use local coords for baking */ + /** Local==1: use local coords for baking. */ + short local, solverflags; /* -- these must be kept for backwards compatibility -- */ - SBVertex **keys; /* array of size totpointkey */ - int totpointkey, totkey; /* if totpointkey != totpoint or totkey!- (efra-sfra)/interval -> free keys */ + /** Array of size totpointkey. */ + SBVertex **keys; + /** If totpointkey != totpoint or totkey!- (efra-sfra)/interval -> free keys. */ + int totpointkey, totkey; /* ---------------------------------------------------- */ float secondspring; /* self collision*/ - float colball; /* fixed collision ball size if > 0 */ - float balldamp; /* cooling down collision response */ - float ballstiff; /* pressure the ball is loaded with */ + /** Fixed collision ball size if > 0. */ + float colball; + /** Cooling down collision response . */ + float balldamp; + /** Pressure the ball is loaded with . */ + float ballstiff; short sbc_mode; short aeroedge, minloops, @@ -346,14 +397,18 @@ typedef struct SoftBody { plastic, springpreload ; - struct SBScratch *scratch; /* scratch pad/cache on live time not saved in file */ + /** Scratch pad/cache on live time not saved in file. */ + struct SBScratch *scratch; float shearstiff; float inpush; - struct PointCache *pointcache; - struct ListBase ptcaches; + struct SoftBody_Shared *shared; + /** Moved to SoftBody_Shared. */ + struct PointCache *pointcache DNA_DEPRECATED; + /** Moved to SoftBody_Shared. */ + struct ListBase ptcaches DNA_DEPRECATED; - struct Group *collision_group; + struct Collection *collision_group; struct EffectorWeights *effector_weights; /* reverse esimated obmatrix .. no need to store in blend file .. how ever who cares */ @@ -390,9 +445,16 @@ typedef struct SoftBody { #define PFIELD_VISIBILITY (1 << 13) #define PFIELD_DO_LOCATION (1 << 14) #define PFIELD_DO_ROTATION (1 << 15) -#define PFIELD_GUIDE_PATH_WEIGHT (1 << 16) /* apply curve weights */ -#define PFIELD_SMOKE_DENSITY (1 << 17) /* multiply smoke force by density */ -#define PFIELD_GRAVITATION (1 << 18) /* used for (simple) force */ +/** apply curve weights */ +#define PFIELD_GUIDE_PATH_WEIGHT (1 << 16) +/** multiply smoke force by density */ +#define PFIELD_SMOKE_DENSITY (1 << 17) +/** used for (simple) force */ +#define PFIELD_GRAVITATION (1 << 18) +/** Enable cloth collision side detection based on normal. */ +#define PFIELD_CLOTH_USE_CULLING (1<< 19) +/** Replace collision direction with collider normal. */ +#define PFIELD_CLOTH_USE_NORMAL (1 << 20) /* pd->falloff */ #define PFIELD_FALL_SPHERE 0 @@ -404,6 +466,7 @@ typedef struct SoftBody { #define PFIELD_SHAPE_PLANE 1 #define PFIELD_SHAPE_SURFACE 2 #define PFIELD_SHAPE_POINTS 3 +#define PFIELD_SHAPE_LINE 4 /* pd->tex_mode */ #define PFIELD_TEX_RGB 0 |