Blender  V2.93
DNA_particle_types.h
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  * The Original Code is Copyright (C) 2007 by Janne Karhu.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include "DNA_ID.h"
27 #include "DNA_boid_types.h"
28 #include "DNA_defs.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 struct AnimData;
35 
36 typedef struct HairKey {
38  float co[3];
40  float time;
42  float weight;
44  short editflag;
45  char _pad[2];
46  float world_co[3];
48 
49 typedef struct ParticleKey { /* when changed update size of struct to copy_particleKey()!! */
51  float co[3];
53  float vel[3];
55  float rot[4];
57  float ave[3];
59  float time;
61 
62 typedef struct BoidParticle {
63  struct Object *ground;
64  struct BoidData data;
65  float gravity[3];
66  float wander[3];
67  float rt;
69 
70 typedef struct ParticleSpring {
71  float rest_length;
72  unsigned int particle_index[2], delete_flag;
74 
75 /* Child particles are created around or between parent particles */
76 typedef struct ChildParticle {
78  int num, parent;
80  int pa[4];
82  float w[4];
84  float fuv[4], foffset;
85  float rt;
87 
88 typedef struct ParticleTarget {
90  struct Object *ob;
91  int psys;
92  short flag, mode;
93  float time, duration;
95 
96 typedef struct ParticleDupliWeight {
98  struct Object *ob;
99  short count;
100  short flag;
102  short index, rt;
104 
105 typedef struct ParticleData {
108 
111 
114 
117 
120 
122  int totkey;
123 
125  float time, lifetime;
132  float dietime;
133 
139  int num;
145 
147  float fuv[4], foffset;
148  /* face normal for volume emission. */
149 
151  float size;
152 
154  float sphdensity;
155  char _pad[4];
156 
158  short flag;
160  short alive;
162 
163 typedef struct SPHFluidSettings {
164  /*Particle Fluid*/
170  float buoyancy;
172  short solver;
173  char _pad[6];
175 
176 /* fluid->flag */
177 #define SPH_VISCOELASTIC_SPRINGS 1
178 #define SPH_CURRENT_REST_LENGTH 2
179 #define SPH_FAC_REPULSION 4
180 #define SPH_FAC_DENSITY 8
181 #define SPH_FAC_RADIUS 16
182 #define SPH_FAC_VISCOSITY 32
183 #define SPH_FAC_REST_LENGTH 64
184 
185 /* fluid->solver (numerical ID field, not bitfield) */
186 #define SPH_SOLVER_DDR 0
187 #define SPH_SOLVER_CLASSICAL 1
188 
189 typedef struct ParticleSettings {
191  struct AnimData *adt;
192 
195 
198 
199  int flag, rt;
200  short type, from, distr, texact;
201  /* physics modes */
203  int draw;
204  float draw_size;
206  char _pad2[4];
208  /* number of path segments, power of 2 except */
211 
212  /* adaptive path rendering */
214 
216  short rotfrom DNA_DEPRECATED;
217  short kink, kink_axis;
218 
219  /* billboards */
220  short bb_align, bb_uv_split, bb_anim, bb_split_offset DNA_DEPRECATED;
222 
223  /* draw color */
225 
226  /* time and emission */
231  short time_flag;
232  char _pad0[6];
233 
234  /* initial velocity factors */
236  float ob_vel[3];
238  /* physical properties */
239  float mass, size, randsize;
240  /* global physical properties */
242  /* length */
243  float randlength;
244  /* children */
246  char _pad3[4];
250  /* clumping */
252  /* kink */
256  char _pad4[4];
258  /* rough */
262  /* length */
264  /* parting */
265  float parting_fac;
267  /* branching */
269  /* drawing stuff */
270  float draw_line[2];
273  /* keyed particles */
278 
279  /* hair dynamics */
281 
283  struct MTex *mtex[18];
284 
286  struct ListBase instance_weights;
287  struct Collection *force_group DNA_DEPRECATED; /* deprecated */
289  struct Object *bb_ob;
291  struct Ipo *ipo DNA_DEPRECATED;
292  struct PartDeflect *pd;
293  struct PartDeflect *pd2;
294 
295  /* modified dm support */
297  char _pad5[2];
298 
299  /* hair shape */
300  short shape_flag;
301  char _pad6[2];
302 
303  float twist;
304  char _pad8[4];
305 
306  /* hair thickness shape */
307  float shape;
309 
311  void *_pad7;
313 
314 typedef struct ParticleSystem {
315  /* note1: make sure all (run-time) are NULL's in 'copy_particlesystem' XXX,
316  * this function is no more! - need to investigate. */
317 
318  /* note2: make sure any uses of this struct in DNA are
319  * accounted for in 'BKE_object_copy_particlesystems'. */
320 
322 
325 
330 
332  struct PTCacheEdit *edit;
334  void (*free_edit)(struct PTCacheEdit *edit);
335 
342 
347 
348  struct Object *target_ob;
349 
352 
354  struct Object *parent;
355 
357  struct ListBase targets;
358 
360  char name[64];
361 
363  float imat[4][4];
367  /* NOTE: Recalc is one of ID_RECALC_PSYS_ALL flags.
368  *
369  * TODO(sergey): Use part->id.recalc instead of this duplicated flag
370  * somehow. */
371  int recalc;
373  char _pad1[6];
374 
376  char bb_uvname[3][64] DNA_DEPRECATED;
377 
378  /* if you change these remember to update array lengths to PSYS_TOT_VG! */
380  short vgroup[13], vg_neg, rt3;
381  char _pad[6];
382 
383  /* point cache */
385  struct ListBase ptcaches;
386 
388 
391 
393  struct KDTree_3d *tree;
395  struct BVHTree *bvhtree;
396 
398 
400  float dt_frac;
403 
404  void *batch_cache;
405 
406  /* Set by dependency graph's copy-on-write, allows to quickly go
407  * from evaluated particle system to original one.
408  *
409  * Original system will have this set to NULL.
410  *
411  * Use psys_orig_get() function to access,
412  */
415 
416 typedef enum eParticleDrawFlag {
417  PART_DRAW_VEL = (1 << 0),
419  PART_DRAW_SIZE = (1 << 2),
422  PART_DRAW_EMITTER = (1 << 3), /* DEPRECATED */
423 #endif
424  PART_DRAW_HEALTH = (1 << 4),
425  PART_ABS_PATH_TIME = (1 << 5),
426  PART_DRAW_COUNT_GR = (1 << 6),
427  /* PART_DRAW_BB_LOCK = (1 << 7), */ /* DEPRECATED */
428  /* used with billboards */ /* DEPRECATED */
429  PART_DRAW_ROTATE_OB = (1 << 7), /* used with instance object/collection */
430  PART_DRAW_PARENT = (1 << 8),
431  PART_DRAW_NUM = (1 << 9),
432  PART_DRAW_RAND_GR = (1 << 10),
433  PART_DRAW_REN_ADAPT = (1 << 11),
434  PART_DRAW_VEL_LENGTH = (1 << 12),
435  PART_DRAW_MAT_COL = (1 << 13), /* deprecated, but used in do_versions */
436  PART_DRAW_WHOLE_GR = (1 << 14),
437  PART_DRAW_REN_STRAND = (1 << 15),
438  PART_DRAW_NO_SCALE_OB = (1 << 16), /* used with instance object/collection */
440  PART_DRAW_HAIR_GRID = (1 << 18),
442 
443 /* part->type
444  * Hair is always baked static in object/geometry space.
445  * Other types (normal particles) are in global space and not static baked. */
446 enum {
448  /* REACTOR type currently unused */
449  /* PART_REACTOR = 1, */
451  PART_FLUID = 3, /* deprecated (belonged to elbeem) */
461 };
462 
463 /* Mirroring Mantaflow particle types from particle.h (Mantaflow header). */
464 enum {
465  /* PARTICLE_TYPE_NONE = (0 << 0), */ /* UNUSED */
466  /* PARTICLE_TYPE_NEW = (1 << 0), */ /* UNUSED */
469  PARTICLE_TYPE_FOAM = (1 << 3),
471  PARTICLE_TYPE_DELETE = (1 << 10),
472  /* PARTICLE_TYPE_INVALID = (1 << 30), */ /* UNUSED */
473 };
474 
475 /* part->flag */
476 #define PART_REACT_STA_END 1
477 #define PART_REACT_MULTIPLE 2
478 
479 //#define PART_LOOP 4 /* not used anymore */
480 /* for dopesheet */
481 #define PART_DS_EXPAND 8
482 
483 #define PART_HAIR_REGROW 16 /* regrow hair for each frame */
484 
485 #define PART_UNBORN 32 /*show unborn particles*/
486 #define PART_DIED 64 /*show died particles*/
487 
488 #define PART_TRAND 128
489 #define PART_EDISTR 256 /* particle/face from face areas */
490 
491 #define PART_ROTATIONS 512 /* calculate particle rotations (and store them in pointcache) */
492 #define PART_DIE_ON_COL (1 << 12)
493 #define PART_SIZE_DEFL (1 << 13) /* swept sphere deflections */
494 #define PART_ROT_DYN (1 << 14) /* dynamic rotation */
495 #define PART_SIZEMASS (1 << 16)
496 
497 #define PART_HIDE_ADVANCED_HAIR (1 << 15)
498 
499 //#define PART_ABS_TIME (1 << 17)
500 //#define PART_GLOB_TIME (1 << 18)
501 
502 #define PART_BOIDS_2D (1 << 19)
503 
504 //#define PART_BRANCHING (1 << 20)
505 //#define PART_ANIM_BRANCHING (1 << 21)
506 
507 #define PART_HAIR_BSPLINE 1024
508 
509 #define PART_GRID_HEXAGONAL (1 << 24)
510 #define PART_GRID_INVERT (1 << 26)
511 
512 #define PART_CHILD_EFFECT (1 << 27)
513 #define PART_CHILD_LONG_HAIR (1 << 28)
514 /* #define PART_CHILD_RENDER (1 << 29) */ /*UNUSED*/
515 #define PART_CHILD_GUIDE (1 << 30)
516 
517 #define PART_SELF_EFFECT (1 << 22)
518 
519 /* part->from */
520 #define PART_FROM_VERT 0
521 #define PART_FROM_FACE 1
522 #define PART_FROM_VOLUME 2
523 /* #define PART_FROM_PARTICLE 3 deprecated! */
524 #define PART_FROM_CHILD 4
525 
526 /* part->distr */
527 #define PART_DISTR_JIT 0
528 #define PART_DISTR_RAND 1
529 #define PART_DISTR_GRID 2
530 
531 /* part->phystype */
532 #define PART_PHYS_NO 0
533 #define PART_PHYS_NEWTON 1
534 #define PART_PHYS_KEYED 2
535 #define PART_PHYS_BOIDS 3
536 #define PART_PHYS_FLUID 4
537 
538 /* part->kink */
539 typedef enum eParticleKink {
547 
548 /* part->child_flag */
549 typedef enum eParticleChildFlag {
555 
556 /* part->shape_flag */
557 typedef enum eParticleShapeFlag {
560 
561 /* part->draw_col */
562 #define PART_DRAW_COL_NONE 0
563 #define PART_DRAW_COL_MAT 1
564 #define PART_DRAW_COL_VEL 2
565 #define PART_DRAW_COL_ACC 3
566 
567 /* part->time_flag */
568 #define PART_TIME_AUTOSF 1 /* Automatic subframes */
569 
570 /* part->draw_as */
571 /* part->ren_as*/
572 #define PART_DRAW_NOT 0
573 #define PART_DRAW_DOT 1
574 #define PART_DRAW_HALO 1
575 #define PART_DRAW_CIRC 2
576 #define PART_DRAW_CROSS 3
577 #define PART_DRAW_AXIS 4
578 #define PART_DRAW_LINE 5
579 #define PART_DRAW_PATH 6
580 #define PART_DRAW_OB 7
581 #define PART_DRAW_GR 8
582 #define PART_DRAW_BB 9 /* deprecated */
583 #define PART_DRAW_REND 10
584 
585 /* part->integrator */
586 #define PART_INT_EULER 0
587 #define PART_INT_MIDPOINT 1
588 #define PART_INT_RK4 2
589 #define PART_INT_VERLET 3
590 
591 /* part->rotmode */
592 #define PART_ROT_NOR 1
593 #define PART_ROT_VEL 2
594 #define PART_ROT_GLOB_X 3
595 #define PART_ROT_GLOB_Y 4
596 #define PART_ROT_GLOB_Z 5
597 #define PART_ROT_OB_X 6
598 #define PART_ROT_OB_Y 7
599 #define PART_ROT_OB_Z 8
600 #define PART_ROT_NOR_TAN 9
601 
602 /* part->avemode */
603 #define PART_AVE_VELOCITY 1
604 #define PART_AVE_RAND 2
605 #define PART_AVE_HORIZONTAL 3
606 #define PART_AVE_VERTICAL 4
607 #define PART_AVE_GLOBAL_X 5
608 #define PART_AVE_GLOBAL_Y 6
609 #define PART_AVE_GLOBAL_Z 7
610 
611 /* part->reactevent */
612 #define PART_EVENT_DEATH 0
613 #define PART_EVENT_COLLIDE 1
614 #define PART_EVENT_NEAR 2
615 
616 /* part->childtype */
617 #define PART_CHILD_PARTICLES 1
618 #define PART_CHILD_FACES 2
619 
620 /* psys->flag */
621 #define PSYS_CURRENT 1
622 #define PSYS_GLOBAL_HAIR 2
623 #define PSYS_HAIR_DYNAMICS 4
624 #define PSYS_KEYED_TIMING 8
625 //#define PSYS_ENABLED 16 /* deprecated */
626 #define PSYS_HAIR_UPDATED 32 /* signal for updating hair particle mode */
627 /* #define PSYS_DRAWING 64 */ /* deprecated */
628 /* #define PSYS_USE_IMAT 128 */ /* deprecated */
629 #define PSYS_DELETE 256 /* remove particlesystem as soon as possible */
630 #define PSYS_HAIR_DONE 512
631 #define PSYS_KEYED 1024
632 #define PSYS_EDITED 2048
633 //#define PSYS_PROTECT_CACHE 4096 /* deprecated */
634 #define PSYS_DISABLED 8192
635 #define PSYS_OB_ANIM_RESTORE 16384 /* runtime flag */
636 #define PSYS_SHARED_CACHES 32768
637 
638 /* pars->flag */
639 #define PARS_UNEXIST 1
640 #define PARS_NO_DISP 2
641 //#define PARS_STICKY 4 /* deprecated */
642 #define PARS_REKEY 8
643 
644 /* pars->alive */
645 //#define PARS_KILLED 0 /* deprecated */
646 #define PARS_DEAD 1
647 #define PARS_UNBORN 2
648 #define PARS_ALIVE 3
649 #define PARS_DYING 4
650 
651 /* ParticleDupliWeight->flag */
652 #define PART_DUPLIW_CURRENT 1
653 
654 /* psys->vg */
655 #define PSYS_TOT_VG 13
656 
657 #define PSYS_VG_DENSITY 0
658 #define PSYS_VG_VEL 1
659 #define PSYS_VG_LENGTH 2
660 #define PSYS_VG_CLUMP 3
661 #define PSYS_VG_KINK 4
662 #define PSYS_VG_ROUGH1 5
663 #define PSYS_VG_ROUGH2 6
664 #define PSYS_VG_ROUGHE 7
665 #define PSYS_VG_SIZE 8
666 #define PSYS_VG_TAN 9
667 #define PSYS_VG_ROT 10
668 #define PSYS_VG_EFFECTOR 11
669 #define PSYS_VG_TWIST 12
670 
671 /* ParticleTarget->flag */
672 #define PTARGET_CURRENT 1
673 #define PTARGET_VALID 2
674 
675 /* ParticleTarget->mode */
676 #define PTARGET_MODE_NEUTRAL 0
677 #define PTARGET_MODE_FRIEND 1
678 #define PTARGET_MODE_ENEMY 2
679 
680 /* mapto */
682  /* init */
683  PAMAP_TIME = (1 << 0), /* emission time */
684  PAMAP_LIFE = (1 << 1), /* life time */
685  PAMAP_DENS = (1 << 2), /* density */
686  PAMAP_SIZE = (1 << 3), /* physical size */
688  /* reset */
689  PAMAP_IVEL = (1 << 5), /* initial velocity */
690  /* physics */
691  PAMAP_FIELD = (1 << 6), /* force fields */
692  PAMAP_GRAVITY = (1 << 10),
693  PAMAP_DAMP = (1 << 11),
695  /* children */
696  PAMAP_CLUMP = (1 << 7),
697  PAMAP_KINK_FREQ = (1 << 8),
698  PAMAP_KINK_AMP = (1 << 12),
699  PAMAP_ROUGH = (1 << 9),
700  PAMAP_LENGTH = (1 << 4),
701  PAMAP_TWIST = (1 << 13),
705 
706 #ifdef __cplusplus
707 }
708 #endif
ID and Library types, which are fundamental for sdna.
eParticleShapeFlag
@ PART_SHAPE_CLOSE_TIP
@ PARTICLE_TYPE_BUBBLE
@ PARTICLE_TYPE_DELETE
@ PARTICLE_TYPE_TRACER
@ PARTICLE_TYPE_FOAM
@ PARTICLE_TYPE_SPRAY
struct ParticleSettings ParticleSettings
struct SPHFluidSettings SPHFluidSettings
eParticleDrawFlag
@ PART_DRAW_WHOLE_GR
@ PART_DRAW_REN_STRAND
@ PART_DRAW_SIZE
@ PART_DRAW_VEL
@ PART_DRAW_GLOBAL_OB
@ PART_DRAW_PARENT
@ PART_DRAW_NUM
@ PART_DRAW_NO_SCALE_OB
@ PART_DRAW_COUNT_GR
@ PART_DRAW_MAT_COL
@ PART_DRAW_HAIR_GRID
@ PART_ABS_PATH_TIME
@ PART_DRAW_REN_ADAPT
@ PART_DRAW_HEALTH
@ PART_DRAW_RAND_GR
@ PART_DRAW_VEL_LENGTH
@ PART_DRAW_GUIDE_HAIRS
@ PART_DRAW_ROTATE_OB
struct ParticleTarget ParticleTarget
struct ParticleKey ParticleKey
struct ParticleData ParticleData
eParticleTextureInfluence
@ PAMAP_DENS
@ PAMAP_FIELD
@ PAMAP_CHILD
@ PAMAP_KINK_FREQ
@ PAMAP_PHYSICS
@ PAMAP_TWIST
@ PAMAP_DAMP
@ PAMAP_SIZE
@ PAMAP_IVEL
@ PAMAP_INIT
@ PAMAP_GRAVITY
@ PAMAP_LIFE
@ PAMAP_KINK_AMP
@ PAMAP_TIME
@ PAMAP_CLUMP
@ PAMAP_LENGTH
@ PAMAP_ROUGH
struct BoidParticle BoidParticle
eParticleKink
@ PART_KINK_BRAID
@ PART_KINK_WAVE
@ PART_KINK_SPIRAL
@ PART_KINK_RADIAL
@ PART_KINK_CURL
@ PART_KINK_NO
struct ParticleDupliWeight ParticleDupliWeight
struct ParticleSystem ParticleSystem
struct ChildParticle ChildParticle
struct ParticleSpring ParticleSpring
struct HairKey HairKey
eParticleChildFlag
@ PART_CHILD_USE_TWIST_CURVE
@ PART_CHILD_USE_CLUMP_CURVE
@ PART_CHILD_USE_CLUMP_NOISE
@ PART_CHILD_USE_ROUGH_CURVE
@ PART_FLUID_FLIP
@ PART_EMITTER
@ PART_FLUID_BUBBLE
@ PART_FLUID_SPRAYBUBBLE
@ PART_FLUID_TRACER
@ PART_FLUID
@ PART_FLUID_FOAM
@ PART_FLUID_SPRAYFOAMBUBBLE
@ PART_FLUID_SPRAYFOAM
@ PART_HAIR
@ PART_FLUID_SPRAY
@ PART_FLUID_FOAMBUBBLE
#define DNA_DEPRECATED_ALLOW
Definition: action.c:32
struct Object * ground
struct BoidData data
float co[3]
char _pad[2]
float world_co[3]
Definition: DNA_ID.h:273
BoidParticle * boid
ParticleKey state
ParticleKey prev_state
ParticleKey * keys
struct ParticleDupliWeight * prev
struct ParticleDupliWeight * next
struct CurveMapping * clumpcurve
struct PartDeflect * pd2
struct Collection * collision_group
struct Collection * instance_collection
struct AnimData * adt
struct Object * bb_ob
struct CurveMapping * roughcurve
struct CurveMapping * twistcurve
struct Ipo *ipo DNA_DEPRECATED
struct BoidSettings * boids
struct EffectorWeights * effector_weights
struct MTex * mtex[18]
struct PartDeflect * pd
struct ListBase instance_weights
struct Collection *force_group DNA_DEPRECATED
short rotfrom DNA_DEPRECATED
struct Object * instance_object
struct SPHFluidSettings * fluid
unsigned int delete_flag
unsigned int particle_index[2]
char bb_uvname[3][64] DNA_DEPRECATED
ParticleSpring * fluid_springs
ChildParticle * child
struct PTCacheEdit * edit
struct ListBase ptcaches
ParticleData * particles
struct ListBase targets
ParticleSettings * part
struct ListBase * effectors
struct ParticleSystem * next
struct PointCache * pointcache
struct BVHTree * bvhtree
struct ClothModifierData * clmd
struct Object * target_ob
struct ParticleSystem * prev
struct LatticeDeformData * lattice_deform_data
struct ParticleCacheKey ** childcache
struct Mesh * hair_in_mesh
struct KDTree_3d * tree
struct Object * parent
struct ParticleSystem * orig_psys
struct Mesh * hair_out_mesh
struct ParticleDrawData * pdd
struct ParticleCacheKey ** pathcache
void(* free_edit)(struct PTCacheEdit *edit)
struct Object * ob
struct ParticleTarget * prev
struct ParticleTarget * next