Blender  V3.3
DNA_particle_types.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2007 by Janne Karhu. All rights reserved. */
3 
8 #pragma once
9 
10 #include "DNA_ID.h"
11 #include "DNA_boid_types.h"
12 #include "DNA_defs.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 struct AnimData;
19 
20 typedef struct HairKey {
22  float co[3];
24  float time;
26  float weight;
28  short editflag;
29  char _pad[2];
30  float world_co[3];
32 
33 typedef struct ParticleKey { /* when changed update size of struct to copy_particleKey()!! */
35  float co[3];
37  float vel[3];
39  float rot[4];
41  float ave[3];
43  float time;
45 
46 typedef struct BoidParticle {
47  struct Object *ground;
48  struct BoidData data;
49  float gravity[3];
50  float wander[3];
51  char _pad0[4];
53 
54 typedef struct ParticleSpring {
55  float rest_length;
56  unsigned int particle_index[2], delete_flag;
58 
60 typedef struct ChildParticle {
62  int num;
63  int parent;
65  int pa[4];
67  float w[4];
69  float fuv[4], foffset;
70  char _pad0[4];
72 
73 typedef struct ParticleTarget {
75  struct Object *ob;
76  int psys;
77  short flag, mode;
78  float time, duration;
80 
81 typedef struct ParticleDupliWeight {
83  struct Object *ob;
84  short count;
85  short flag;
87  short index;
88  char _pad0[2];
90 
91 typedef struct ParticleData {
94 
97 
100 
103 
106 
108  int totkey;
109 
111  float time, lifetime;
118  float dietime;
119 
125  int num;
131 
133  float fuv[4], foffset;
134  /* face normal for volume emission. */
135 
137  float size;
138 
140  float sphdensity;
141  char _pad[4];
142 
144  short flag;
146  short alive;
148 
149 typedef struct SPHFluidSettings {
150  /* Particle Fluid. */
156  float buoyancy;
158  short solver;
159  char _pad[6];
161 
162 /* fluid->flag */
163 #define SPH_VISCOELASTIC_SPRINGS 1
164 #define SPH_CURRENT_REST_LENGTH 2
165 #define SPH_FAC_REPULSION 4
166 #define SPH_FAC_DENSITY 8
167 #define SPH_FAC_RADIUS 16
168 #define SPH_FAC_VISCOSITY 32
169 #define SPH_FAC_REST_LENGTH 64
170 
171 /* fluid->solver (numerical ID field, not bitfield) */
172 #define SPH_SOLVER_DDR 0
173 #define SPH_SOLVER_CLASSICAL 1
174 
175 typedef struct ParticleSettings {
177  struct AnimData *adt;
178 
181 
184 
185  int flag;
186  char _pad1[4];
187  short type, from, distr, texact;
188  /* physics modes */
190  int draw;
191  float draw_size;
193  char _pad2[4];
195  /* number of path segments, power of 2 except */
198 
199  /* adaptive path rendering */
201 
203  short rotfrom DNA_DEPRECATED;
204  short kink, kink_axis;
205 
206  /* billboards */
207  short bb_align, bb_uv_split, bb_anim, bb_split_offset DNA_DEPRECATED;
209 
210  /* draw color */
212 
213  /* time and emission */
218  short time_flag;
219  char _pad0[6];
220 
221  /* initial velocity factors */
223  float ob_vel[3];
225  /* physical properties */
226  float mass, size, randsize;
227  /* global physical properties */
229  /* length */
230  float randlength;
231  /* children */
233  char _pad3[4];
237  /* clumping */
239  /* kink */
243  char _pad4[4];
245  /* rough */
249  /* length */
251  /* parting */
252  float parting_fac;
254  /* branching */
256  /* drawing stuff */
257  float draw_line[2];
260  /* keyed particles */
265 
266  /* hair dynamics */
268 
270  struct MTex *mtex[18];
271 
273  struct ListBase instance_weights;
274  struct Collection *force_group DNA_DEPRECATED; /* deprecated */
276  struct Object *bb_ob;
278  struct Ipo *ipo DNA_DEPRECATED;
279  struct PartDeflect *pd;
280  struct PartDeflect *pd2;
281 
282  /* modified dm support */
284  char _pad5[2];
285 
286  /* hair shape */
287  short shape_flag;
288  char _pad6[2];
289 
290  float twist;
291  char _pad8[4];
292 
293  /* hair thickness shape */
294  float shape;
296 
298  void *_pad7;
300 
301 typedef struct ParticleSystem {
302  /* note1: make sure all (run-time) are NULL's in 'copy_particlesystem' XXX,
303  * this function is no more! - need to investigate. */
304 
305  /* note2: make sure any uses of this struct in DNA are
306  * accounted for in 'BKE_object_copy_particlesystems'. */
307 
309 
312 
317 
319  struct PTCacheEdit *edit;
322 
329 
334 
335  struct Object *target_ob;
336 
339 
341  struct Object *parent;
342 
344  struct ListBase targets;
345 
347  char name[64];
348 
350  float imat[4][4];
354  /* NOTE: Recalc is one of ID_RECALC_PSYS_ALL flags.
355  *
356  * TODO(sergey): Use #ParticleSettings.id.recalc instead of this duplicated flag somehow. */
357  int recalc;
359  char _pad1[6];
360 
362  char bb_uvname[3][64] DNA_DEPRECATED;
363 
364  /* if you change these remember to update array lengths to PSYS_TOT_VG! */
366  short vgroup[13], vg_neg, rt3;
367  char _pad[6];
368 
369  /* point cache */
371  struct ListBase ptcaches;
372 
374 
377 
379  struct KDTree_3d *tree;
381  struct BVHTree *bvhtree;
382 
384 
386  float dt_frac;
389 
390  void *batch_cache;
391 
392  /* Set by dependency graph's copy-on-write, allows to quickly go
393  * from evaluated particle system to original one.
394  *
395  * Original system will have this set to NULL.
396  *
397  * Use psys_orig_get() function to access,
398  */
401 
402 typedef enum eParticleDrawFlag {
403  PART_DRAW_VEL = (1 << 0),
405  PART_DRAW_SIZE = (1 << 2),
408  PART_DRAW_EMITTER = (1 << 3), /* DEPRECATED */
409 #endif
410  PART_DRAW_HEALTH = (1 << 4),
411  PART_ABS_PATH_TIME = (1 << 5),
412  PART_DRAW_COUNT_GR = (1 << 6),
413  /* PART_DRAW_BB_LOCK = (1 << 7), */ /* DEPRECATED */
414  /* used with billboards */ /* DEPRECATED */
415  PART_DRAW_ROTATE_OB = (1 << 7), /* used with instance object/collection */
416  PART_DRAW_PARENT = (1 << 8),
417  PART_DRAW_NUM = (1 << 9),
418  PART_DRAW_RAND_GR = (1 << 10),
419  PART_DRAW_REN_ADAPT = (1 << 11),
420  PART_DRAW_VEL_LENGTH = (1 << 12),
421  PART_DRAW_MAT_COL = (1 << 13), /* deprecated, but used in do_versions */
422  PART_DRAW_WHOLE_GR = (1 << 14),
423  PART_DRAW_REN_STRAND = (1 << 15),
424  PART_DRAW_NO_SCALE_OB = (1 << 16), /* used with instance object/collection */
426  PART_DRAW_HAIR_GRID = (1 << 18),
428 
434 enum {
436  /* REACTOR type currently unused */
437  /* PART_REACTOR = 1, */
439  PART_FLUID = 3, /* deprecated (belonged to elbeem) */
449 };
450 
452 enum {
453  /* PARTICLE_TYPE_NONE = (0 << 0), */ /* UNUSED */
454  /* PARTICLE_TYPE_NEW = (1 << 0), */ /* UNUSED */
457  PARTICLE_TYPE_FOAM = (1 << 3),
459  PARTICLE_TYPE_DELETE = (1 << 10),
460  /* PARTICLE_TYPE_INVALID = (1 << 30), */ /* UNUSED */
461 };
462 
464 #define PART_REACT_STA_END 1
465 #define PART_REACT_MULTIPLE 2
466 
467 //#define PART_LOOP 4 /* not used anymore */
468 /* for dopesheet */
469 #define PART_DS_EXPAND 8
470 
471 #define PART_HAIR_REGROW 16 /* regrow hair for each frame */
472 
473 #define PART_UNBORN 32 /* Show unborn particles. */
474 #define PART_DIED 64 /* Show died particles. */
475 
476 #define PART_TRAND 128
477 #define PART_EDISTR 256 /* particle/face from face areas */
478 
479 #define PART_ROTATIONS 512 /* calculate particle rotations (and store them in pointcache) */
480 #define PART_DIE_ON_COL (1 << 12)
481 #define PART_SIZE_DEFL (1 << 13) /* swept sphere deflections */
482 #define PART_ROT_DYN (1 << 14) /* dynamic rotation */
483 #define PART_SIZEMASS (1 << 16)
484 
485 #define PART_HIDE_ADVANCED_HAIR (1 << 15)
486 
487 //#define PART_ABS_TIME (1 << 17)
488 //#define PART_GLOB_TIME (1 << 18)
489 
490 #define PART_BOIDS_2D (1 << 19)
491 
492 //#define PART_BRANCHING (1 << 20)
493 //#define PART_ANIM_BRANCHING (1 << 21)
494 
495 #define PART_HAIR_BSPLINE 1024
496 
497 #define PART_GRID_HEXAGONAL (1 << 24)
498 #define PART_GRID_INVERT (1 << 26)
499 
500 #define PART_CHILD_EFFECT (1 << 27)
501 #define PART_CHILD_LONG_HAIR (1 << 28)
502 // #define PART_CHILD_RENDER (1 << 29) /* UNUSED */
503 #define PART_CHILD_GUIDE (1 << 30)
504 
505 #define PART_SELF_EFFECT (1 << 22)
506 
508 #define PART_FROM_VERT 0
509 #define PART_FROM_FACE 1
510 #define PART_FROM_VOLUME 2
511 /* #define PART_FROM_PARTICLE 3 deprecated! */
512 #define PART_FROM_CHILD 4
513 
515 #define PART_DISTR_JIT 0
516 #define PART_DISTR_RAND 1
517 #define PART_DISTR_GRID 2
518 
520 #define PART_PHYS_NO 0
521 #define PART_PHYS_NEWTON 1
522 #define PART_PHYS_KEYED 2
523 #define PART_PHYS_BOIDS 3
524 #define PART_PHYS_FLUID 4
525 
527 typedef enum eParticleKink {
535 
537 typedef enum eParticleChildFlag {
543 
545 typedef enum eParticleShapeFlag {
548 
549 /* #ParticleSettings.draw_col */
550 #define PART_DRAW_COL_NONE 0
551 #define PART_DRAW_COL_MAT 1
552 #define PART_DRAW_COL_VEL 2
553 #define PART_DRAW_COL_ACC 3
554 
555 /* #ParticleSettings.time_flag */
556 #define PART_TIME_AUTOSF 1 /* Automatic subframes */
557 
558 /* #ParticleSettings.draw_as */
559 /* #ParticleSettings.ren_as */
560 #define PART_DRAW_NOT 0
561 #define PART_DRAW_DOT 1
562 #define PART_DRAW_HALO 1
563 #define PART_DRAW_CIRC 2
564 #define PART_DRAW_CROSS 3
565 #define PART_DRAW_AXIS 4
566 #define PART_DRAW_LINE 5
567 #define PART_DRAW_PATH 6
568 #define PART_DRAW_OB 7
569 #define PART_DRAW_GR 8
570 #define PART_DRAW_BB 9 /* deprecated */
571 #define PART_DRAW_REND 10
572 
573 /* #ParticleSettings.integrator */
574 #define PART_INT_EULER 0
575 #define PART_INT_MIDPOINT 1
576 #define PART_INT_RK4 2
577 #define PART_INT_VERLET 3
578 
579 /* #ParticleSettings.rotmode */
580 #define PART_ROT_NOR 1
581 #define PART_ROT_VEL 2
582 #define PART_ROT_GLOB_X 3
583 #define PART_ROT_GLOB_Y 4
584 #define PART_ROT_GLOB_Z 5
585 #define PART_ROT_OB_X 6
586 #define PART_ROT_OB_Y 7
587 #define PART_ROT_OB_Z 8
588 #define PART_ROT_NOR_TAN 9
589 
590 /* #ParticleSettings.avemode */
591 #define PART_AVE_VELOCITY 1
592 #define PART_AVE_RAND 2
593 #define PART_AVE_HORIZONTAL 3
594 #define PART_AVE_VERTICAL 4
595 #define PART_AVE_GLOBAL_X 5
596 #define PART_AVE_GLOBAL_Y 6
597 #define PART_AVE_GLOBAL_Z 7
598 
599 /* #ParticleSettings.reactevent */
600 #define PART_EVENT_DEATH 0
601 #define PART_EVENT_COLLIDE 1
602 #define PART_EVENT_NEAR 2
603 
604 /* #ParticleSettings.childtype */
605 #define PART_CHILD_PARTICLES 1
606 #define PART_CHILD_FACES 2
607 
608 /* psys->flag */
609 #define PSYS_CURRENT 1
610 #define PSYS_GLOBAL_HAIR 2
611 #define PSYS_HAIR_DYNAMICS 4
612 #define PSYS_KEYED_TIMING 8
613 //#define PSYS_ENABLED 16 /* deprecated */
614 #define PSYS_HAIR_UPDATED 32 /* signal for updating hair particle mode */
615 /* #define PSYS_DRAWING 64 */ /* deprecated */
616 /* #define PSYS_USE_IMAT 128 */ /* deprecated */
617 #define PSYS_DELETE 256 /* remove particlesystem as soon as possible */
618 #define PSYS_HAIR_DONE 512
619 #define PSYS_KEYED 1024
620 #define PSYS_EDITED 2048
621 //#define PSYS_PROTECT_CACHE 4096 /* deprecated */
622 #define PSYS_DISABLED 8192
623 #define PSYS_OB_ANIM_RESTORE 16384 /* runtime flag */
624 #define PSYS_SHARED_CACHES 32768
625 
626 /* pars->flag */
627 #define PARS_UNEXIST 1
628 #define PARS_NO_DISP 2
629 //#define PARS_STICKY 4 /* deprecated */
630 #define PARS_REKEY 8
631 
632 /* pars->alive */
633 //#define PARS_KILLED 0 /* deprecated */
634 #define PARS_DEAD 1
635 #define PARS_UNBORN 2
636 #define PARS_ALIVE 3
637 #define PARS_DYING 4
638 
639 /* ParticleDupliWeight->flag */
640 #define PART_DUPLIW_CURRENT 1
641 
642 /* psys->vg */
643 #define PSYS_TOT_VG 13
644 
645 #define PSYS_VG_DENSITY 0
646 #define PSYS_VG_VEL 1
647 #define PSYS_VG_LENGTH 2
648 #define PSYS_VG_CLUMP 3
649 #define PSYS_VG_KINK 4
650 #define PSYS_VG_ROUGH1 5
651 #define PSYS_VG_ROUGH2 6
652 #define PSYS_VG_ROUGHE 7
653 #define PSYS_VG_SIZE 8
654 #define PSYS_VG_TAN 9
655 #define PSYS_VG_ROT 10
656 #define PSYS_VG_EFFECTOR 11
657 #define PSYS_VG_TWIST 12
658 
659 /* ParticleTarget->flag */
660 #define PTARGET_CURRENT 1
661 #define PTARGET_VALID 2
662 
663 /* ParticleTarget->mode */
664 #define PTARGET_MODE_NEUTRAL 0
665 #define PTARGET_MODE_FRIEND 1
666 #define PTARGET_MODE_ENEMY 2
667 
670  /* init */
671  PAMAP_TIME = (1 << 0), /* emission time */
672  PAMAP_LIFE = (1 << 1), /* life time */
673  PAMAP_DENS = (1 << 2), /* density */
674  PAMAP_SIZE = (1 << 3), /* physical size */
676  /* reset */
677  PAMAP_IVEL = (1 << 5), /* initial velocity */
678  /* physics */
679  PAMAP_FIELD = (1 << 6), /* force fields */
680  PAMAP_GRAVITY = (1 << 10),
681  PAMAP_DAMP = (1 << 11),
683  /* children */
684  PAMAP_CLUMP = (1 << 7),
685  PAMAP_KINK_FREQ = (1 << 8),
686  PAMAP_KINK_AMP = (1 << 12),
687  PAMAP_ROUGH = (1 << 9),
688  PAMAP_LENGTH = (1 << 4),
689  PAMAP_TWIST = (1 << 13),
693 
694 #ifdef __cplusplus
695 }
696 #endif
ID and Library types, which are fundamental for sdna.
eParticleShapeFlag
@ PART_SHAPE_CLOSE_TIP
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
@ 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
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
@ PARTICLE_TYPE_BUBBLE
@ PARTICLE_TYPE_DELETE
@ PARTICLE_TYPE_TRACER
@ PARTICLE_TYPE_FOAM
@ PARTICLE_TYPE_SPRAY
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
#define DNA_DEPRECATED_ALLOW
Definition: action.c:16
SyclQueue void void size_t num_bytes void
struct Object * ground
struct BoidData data
float co[3]
char _pad[2]
float world_co[3]
Definition: DNA_ID.h:368
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