Blender V5.3
DNA_particle_types.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2007 by Janne Karhu. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "BLI_enum_flags.hh"
12
13#include "DNA_ID.h"
14#include "DNA_boid_types.h"
15#include "DNA_defs.h"
16
17namespace blender {
18
19template<typename CoordT> struct KDTree;
20template<typename T, int Size> struct VecBase;
22
23struct AnimData;
24
25namespace draw {
27};
28
40
41
46
48 PART_DRAW_VEL = (1 << 0),
50 PART_DRAW_SIZE = (1 << 2),
53 PART_DRAW_EMITTER = (1 << 3), /* DEPRECATED */
54#endif
55 PART_DRAW_HEALTH = (1 << 4),
58 /* PART_DRAW_BB_LOCK = (1 << 7), */ /* DEPRECATED */
59 /* used with billboards */ /* DEPRECATED */
60 PART_DRAW_ROTATE_OB = (1 << 7), /* used with instance object/collection */
61 PART_DRAW_PARENT = (1 << 8),
62 PART_DRAW_NUM = (1 << 9),
63 PART_DRAW_RAND_GR = (1 << 10),
66 PART_DRAW_MAT_COL = (1 << 13), /* deprecated, but used in do_versions */
67 PART_DRAW_WHOLE_GR = (1 << 14),
69 PART_DRAW_NO_SCALE_OB = (1 << 16), /* used with instance object/collection */
72};
74
75
80enum eParticleType : short {
82 /* REACTOR type currently unused */
83 /* PART_REACTOR = 1, */
85 PART_FLUID = 3, /* Deprecated (belonged to ELBEEM). */
95};
96
99 /* PARTICLE_TYPE_NONE = (0 << 0), */ /* UNUSED */
100 /* PARTICLE_TYPE_NEW = (1 << 0), */ /* UNUSED */
106 /* PARTICLE_TYPE_INVALID = (1 << 30), */ /* UNUSED */
107};
109
110
111enum eParticleFlag : int {
114
115 // PART_LOOP = 1 << 2, /* not used anymore */
116
117 /* For dope-sheet. */
119
122
124 PART_UNBORN = 1 << 5,
126 PART_DIED = 1 << 6,
127
128 PART_TRAND = 1 << 7,
130 PART_EDISTR = 1 << 8,
131
137 PART_SIZE_DEFL = 1 << 13,
139 PART_ROT_DYN = 1 << 14,
140
142
143 PART_SIZEMASS = 1 << 16,
144
145 // PART_ABS_TIME = 1 << 17,
146 // PART_GLOB_TIME = 1 << 18,
147
148 PART_BOIDS_2D = 1 << 19,
149
150 // PART_BRANCHING = 1 << 20,
151 // PART_ANIM_BRANCHING = 1 << 21,
153
156
159 // PART_CHILD_RENDER = 1 << 29, /* UNUSED */
160 PART_CHILD_GUIDE = int(1u << 30),
161
162};
164
165
166enum eParticleFrom : short {
170 // PART_FROM_PARTICLE = 3, /* Deprecated. */
172};
173
180
189
199
208
209
210enum eParticleShapeFlag : short {
212};
214
215
222
224enum eParticleTimeFlag : short {
227};
229
230
245
253
266
277
284
290
293 PSYS_CURRENT = 1 << 0,
297 // PSYS_ENABLED = 1 << 4, /* Deprecated. */
300 // PSYS_DRAWING = 1 << 6, /* Deprecated. */
301 // PSYS_USE_IMAT = 1 << 7, /* Deprecated. */
303 PSYS_DELETE = 1 << 8,
305 PSYS_KEYED = 1 << 10,
306 PSYS_EDITED = 1 << 11,
307 // PSYS_PROTECT_CACHE = 1 << 12, /* Deprecated. */
308 PSYS_DISABLED = 1 << 13,
312};
314
315
316enum eParticle_Flag : short {
317 PARS_UNEXIST = 1 << 0,
318 PARS_NO_DISP = 1 << 1,
319 // PARS_STICKY = 1 << 2, /* deprecated */
320 PARS_REKEY = 1 << 3,
321};
323
324
326 PARS_KILLED = 0, /* Deprecated. */
331};
332
338
339
357
364
365
371
374 /* init */
375 PAMAP_TIME = (1 << 0), /* emission time */
376 PAMAP_LIFE = (1 << 1), /* life time */
377 PAMAP_DENS = (1 << 2), /* density */
378 PAMAP_SIZE = (1 << 3), /* physical size */
380 /* reset */
381 PAMAP_IVEL = (1 << 5), /* initial velocity */
382 /* physics */
383 PAMAP_FIELD = (1 << 6), /* force fields */
384 PAMAP_GRAVITY = (1 << 10),
385 PAMAP_DAMP = (1 << 11),
387 /* children */
388 PAMAP_CLUMP = (1 << 7),
389 PAMAP_KINK_FREQ = (1 << 8),
390 PAMAP_KINK_AMP = (1 << 12),
391 PAMAP_ROUGH = (1 << 9),
392 PAMAP_LENGTH = (1 << 4),
393 PAMAP_TWIST = (1 << 13),
396};
398
399struct HairKey {
401 float co[3];
403 float time;
405 float weight;
407 short editflag;
408 char _pad[2];
409 float world_co[3];
410};
411
412struct ParticleKey { /* when changed update size of struct to copy_particleKey()!! */
414 float co[3];
416 float vel[3];
418 float rot[4];
420 float ave[3];
422 float time;
423};
424
426 struct Object *ground = nullptr;
428 float gravity[3] = {};
429 float wander[3] = {};
430 char _pad0[4] = {};
431};
432
435 unsigned int particle_index[2], delete_flag;
436};
437
441 int num;
444 int pa[4];
446 float w[4];
448 float fuv[4], foffset;
449 char _pad0[4];
450};
451
453 struct ParticleTarget *next = nullptr, *prev = nullptr;
454 struct Object *ob = nullptr;
455 int psys = 0;
458 float time = 0, duration = 0;
459};
460
462 struct ParticleDupliWeight *next = nullptr, *prev = nullptr;
463 struct Object *ob = nullptr;
464 short count = 0;
467 short index = 0;
468 char _pad0[2] = {};
469};
470
474
477
479 HairKey *hair = nullptr;
480
482 ParticleKey *keys = nullptr;
483
485 BoidParticle *boid = nullptr;
486
488 int totkey = 0;
489
491 float time = 0, lifetime = 0;
498 float dietime = 0;
499
505 int num = 0;
510 int num_dmcache = 0;
511
513 float fuv[4] = {}, foffset = 0;
514 /* face normal for volume emission. */
515
517 float size = 0;
518
520 float sphdensity = 0;
521 char _pad[4] = {};
522
523 int hair_index = 0;
527};
528
530 /* Particle Fluid. */
531 float radius = 0, spring_k = 0, rest_length = 0;
536 float buoyancy = 0;
540 char _pad[6] = {};
541};
542
544#ifdef __cplusplus
546 static constexpr ID_Type id_type = ID_PA;
547#endif
548
550 struct AnimData *adt = nullptr;
551
552 struct BoidSettings *boids = nullptr;
553 struct SPHFluidSettings *fluid = nullptr;
554
556 struct Collection *collision_group = nullptr;
557
559 char _pad1[4] = {};
563 short texact = 0;
564 /* physics modes */
570 float draw_size = 0.1f;
573 char _pad2[4] = {};
575 short subframes = 0;
577 /* number of path segments, power of 2 except */
578 short draw_step = 2, ren_step = 3;
579 short hair_step = 5, keys_step = 5;
580
581 /* adaptive path rendering */
582 short adapt_angle = 5, adapt_pix = 3;
583
584 short disp = 100, omat = 1, interpolation = 0;
588 short kink_axis = 2;
589
590 /* billboards */
592 DNA_DEPRECATED float bb_tilt = 0, bb_rand_tilt = 0, bb_offset[2] = {}, bb_size[2] = {1.0f, 1.0f};
595
596 /* draw color */
597 float color_vec_max = 1.0f;
598
599 /* time and emission */
600 float sta = 1.0f, end = 200.0f, lifetime = 50.0f, randlife = 0;
601 float timetweak = 1.0f, courant_target = 0.2f;
602 float jitfac = 1.0f, eff_hair = 0, grid_rand = 0, ps_offset[1] = {};
603 int totpart = 1000, userjit = 0, grid_res = 10, effector_amount = 0;
605 char _pad0[6] = {};
606
607 /* initial velocity factors */
608 float normfac = 1.0f, obfac = 0, randfac = 0, partfac = 0, tanfac = 0, tanphase = 0,
610 float ob_vel[3] = {};
611 float avefac = 0, phasefac = 0, randrotfac = 0, randphasefac = 0;
612 /* physical properties */
613 float mass = 1.0f, size = 0.05f, randsize = 0;
614 /* global physical properties */
615 float acc[3] = {}, dragfac = 0, brownfac = 0, dampfac = 0;
616 /* length */
617 float randlength = 0;
618 /* children */
620 char _pad3[4] = {};
622 float parents = 0, childsize = 1.0f, childrandsize = 0;
623 float childrad = 0.2f, childflat = 0.0f;
624 /* clumping */
625 float clumpfac = 0, clumppow = 0.0f;
626 /* kink */
627 float kink_amp = 0.2f, kink_freq = 2.0f, kink_shape = 0, kink_flat = 0;
628 float kink_amp_clump = 1.0f;
630 char _pad4[4] = {};
632 /* rough */
633 float rough1 = 0, rough1_size = 1.0f;
634 float rough2 = 0, rough2_size = 1.0f, rough2_thres = 0;
635 float rough_end = 0, rough_end_shape = 1.0f;
636 /* length */
637 float clength = 1.0f, clength_thres = 0.0f;
638 /* parting */
639 float parting_fac = 0;
640 float parting_min = 0, parting_max = 0;
641 /* branching */
642 float branch_thres = 0;
643 /* drawing stuff */
644 float draw_line[2] = {
645 0.5f,
646 };
647 float path_start = 0.0f, path_end = 1.0f;
648 int trail_count = 0;
649 /* keyed particles */
650 int keyed_loops = 1;
651 struct CurveMapping *clumpcurve = nullptr;
652 struct CurveMapping *roughcurve = nullptr;
653 float clump_noise_size = 1.0f;
654
655 /* hair dynamics */
656 float bending_random = 0;
657
658 struct MTex *mtex[/*MAX_MTEX*/ 18] = {};
659
661 ListBaseT<ParticleDupliWeight> instance_weights = {nullptr, nullptr};
662 DNA_DEPRECATED struct Collection *force_group = nullptr; /* deprecated */
663 struct Object *instance_object = nullptr;
664 struct Object *bb_ob = nullptr;
665 struct PartDeflect *pd = nullptr;
666 struct PartDeflect *pd2 = nullptr;
667
668 /* Evaluated mesh support. */
669 short use_modifier_stack = false;
670 char _pad5[2] = {};
671
672 /* hair shape */
674 char _pad6[2] = {};
675
676 float twist = 0;
677 char _pad8[4] = {};
678
679 /* hair thickness shape */
680 float shape = 0.0f;
681 float rad_root = 1.0f, rad_tip = 0.0f, rad_scale = 0.01f;
682
683 struct CurveMapping *twistcurve = nullptr;
684};
685
688
689 /* note1: make sure all (run-time) are NULL's in `copy_particlesystem` XXX,
690 * this function is no more! - need to investigate. */
691
692 /* note2: make sure any uses of this struct in DNA are
693 * accounted for in #BKE_object_copy_particlesystems. */
694
695 struct ParticleSystem *next = nullptr, *prev = nullptr;
696
699
704
706 struct PTCacheEdit *edit = nullptr;
708 void (*free_edit)(struct PTCacheEdit *edit) = nullptr;
709
711 struct ParticleCacheKey **pathcache = nullptr;
713 struct ParticleCacheKey **childcache = nullptr;
716
718 struct ClothModifierData *clmd = nullptr;
720 struct Mesh *hair_in_mesh = nullptr, *hair_out_mesh = nullptr;
721
722 struct Object *target_ob = nullptr;
723
726
728 struct Object *parent = nullptr;
729
731 ListBaseT<ParticleTarget> targets = {nullptr, nullptr};
732
734 char name[/*MAX_NAME*/ 64] = "";
735
737 float imat[4][4] = {};
738 float cfra = 0, tree_frame = 0, bvhtree_frame = 0;
739 int seed = 0, child_seed = 0;
741 int totpart = 0, totunexist = 0, totchild = 0, totcached = 0, totchildcache = 0;
742 /* NOTE: Recalc is one of ID_RECALC_PSYS_ALL flags.
743 *
744 * TODO(sergey): Use #ParticleSettings.id.recalc instead of this duplicated flag somehow. */
745 int recalc = 0;
746 short target_psys = 0, totkeyed = 0, bakespace = 0;
747 char _pad1[6] = {};
748
750 DNA_DEPRECATED char bb_uvname[3][/*MAX_CUSTOMDATA_LAYER_NAME*/ 68];
751
752 char _pad2[4] = {};
753 /* if you change these remember to update array lengths to PSYS_TOT_VG! */
755 short vgroup[/*PSYS_TOT_VG*/ 13] = {};
756 short vg_neg = 0, rt3 = 0;
757 char _pad3[6] = {};
758
759 /* point cache */
760 struct PointCache *pointcache = nullptr;
761 ListBaseT<PointCache> ptcaches = {nullptr, nullptr};
762
763 struct ListBaseT<struct EffectorCache> *effectors = nullptr;
764
767
769 KDTree3d *tree = nullptr;
771 struct BVHTree *bvhtree = nullptr;
772
773 struct ParticleDrawData *pdd = nullptr;
774
776 float dt_frac = 0;
779
781
790 struct ParticleSystem *orig_psys = nullptr;
791};
792
793} // namespace blender
#define ENUM_OPERATORS(_enum_type)
ID and Library types, which are fundamental for SDNA.
#define DNA_DEFINE_CXX_METHODS(class_name)
Definition DNA_defs.h:104
#define DNA_DEPRECATED
Definition DNA_defs.h:21
BMesh Iterators.
@ PART_FLUID_SPRAYFOAMBUBBLE
KDTree< VecBase< float, 3 > > KDTree3d
eParticle_AliveState alive
struct ParticleDupliWeight * prev
struct ParticleDupliWeight * next
eParticleDupliWeight_Flag flag
DNA_DEPRECATED float bb_vel_head
ListBaseT< ParticleDupliWeight > instance_weights
struct Collection * collision_group
DNA_DEPRECATED float bb_size[2]
DNA_DEPRECATED float bb_rand_tilt
DNA_DEPRECATED struct Collection * force_group
struct BoidSettings * boids
struct SPHFluidSettings * fluid
DNA_DEPRECATED float bb_tilt
eParticleDistribution distr
eParticleRotationMode rotmode
DNA_DEPRECATED float bb_vel_tail
eParticleReactEvent reactevent
eParticlePhysicsType phystype
DNA_DEPRECATED short bb_uv_split
struct CurveMapping * twistcurve
DNA_DEPRECATED short bb_anim
eParticleAngularVelocityMode avemode
struct CurveMapping * clumpcurve
DNA_DEPRECATED short rotfrom
struct Collection * instance_collection
DNA_DEPRECATED float bb_offset[2]
DNA_DEPRECATED short bb_align
DNA_DEPRECATED short bb_split_offset
struct CurveMapping * roughcurve
struct EffectorWeights * effector_weights
eParticleIntegrator integrator
ListBaseT< LinkData > pathcachebufs
struct ParticleDrawData * pdd
struct ParticleSystem * prev
ListBaseT< LinkData > childcachebufs
draw::ParticleBatchCache * batch_cache
struct ClothModifierData * clmd
struct ParticleSystem * next
struct ParticleSystem * orig_psys
struct LatticeDeformData * lattice_deform_data
struct PTCacheEdit * edit
ListBaseT< ParticleTarget > targets
void(*) free_edit(struct PTCacheEdit *edit)
struct ListBaseT< struct EffectorCache > * effectors
ListBaseT< PointCache > ptcaches
struct ParticleCacheKey ** childcache
struct ParticleCacheKey ** pathcache
eParticleSystem_Flag flag
DNA_DEPRECATED char bb_uvname[3][68]
struct PointCache * pointcache
struct ParticleTarget * prev
eParticleTarget_Mode mode
eParticleTarget_Flag flag
struct ParticleTarget * next
#define DNA_DEPRECATED_ALLOW
Definition versioning.cc:11