Blender V4.3
BKE_particle.h File Reference
#include <optional>
#include "BLI_buffer.h"
#include "BLI_compiler_attrs.h"
#include "BLI_map.hh"
#include "BLI_ordered_edge.hh"
#include "BLI_utildefines.h"
#include "DNA_particle_types.h"

Go to the source code of this file.

Classes

struct  ParticleSimulationData
 
struct  SPHData
 
struct  ParticleTexture
 
struct  ParticleSeam
 
struct  ParticleCacheKey
 
struct  ParticleThreadContext
 
struct  ParticleTask
 
struct  ParticleCollisionElement
 
struct  ParticleCollision
 
struct  ParticleDrawData
 

Macros

#define PARTICLE_COLLISION_MAX_COLLISIONS   10
 
#define PARTICLE_P
 
#define LOOP_PARTICLES   for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++)
 
#define LOOP_EXISTING_PARTICLES
 
#define LOOP_SHOWN_PARTICLES
 
#define LOOP_DYNAMIC_PARTICLES
 
#define PARTICLE_PSMD    ParticleSystemModifierData *psmd = sim->psmd ? sim->psmd : psys_get_modifier(sim->ob, sim->psys)
 
#define PARTICLE_DRAW_DATA_UPDATED   1
 
#define PSYS_FRAND_COUNT   1024
 
#define PSYS_RESET_ALL   1
 
#define PSYS_RESET_DEPSGRAPH   2
 
#define PSYS_RESET_CACHE_MISS   4
 
#define DMCACHE_NOTFOUND   -1
 
#define DMCACHE_ISCHILD   -2
 

Typedefs

typedef struct ParticleSimulationData ParticleSimulationData
 
typedef struct SPHData SPHData
 
typedef struct ParticleTexture ParticleTexture
 
typedef struct ParticleSeam ParticleSeam
 
typedef struct ParticleCacheKey ParticleCacheKey
 
typedef struct ParticleThreadContext ParticleThreadContext
 
typedef struct ParticleTask ParticleTask
 
typedef struct ParticleCollisionElement ParticleCollisionElement
 
typedef struct ParticleCollision ParticleCollision
 
typedef struct ParticleDrawData ParticleDrawData
 
typedef void(* ParticleSystemIDFunc) (struct ParticleSystem *psys, struct ID **idpoin, void *userdata, int cb_flag)
 

Enumerations

enum  { BKE_PARTICLE_BATCH_DIRTY_ALL = 0 }
 

Functions

void BKE_particle_init_rng (void)
 
BLI_INLINE float psys_frand (ParticleSystem *psys, unsigned int seed)
 
BLI_INLINE void psys_frand_vec (ParticleSystem *psys, unsigned int seed, float vec[3])
 
int count_particles (struct ParticleSystem *psys)
 
int count_particles_mod (struct ParticleSystem *psys, int totgr, int cur)
 
int psys_get_child_number (struct Scene *scene, struct ParticleSystem *psys, bool use_render_params)
 
int psys_get_tot_child (struct Scene *scene, struct ParticleSystem *psys, bool use_render_params)
 
struct ParticleSystempsys_get_current (struct Object *ob)
 
short psys_get_current_num (struct Object *ob)
 
void psys_set_current_num (struct Object *ob, int index)
 
void psys_sim_data_init (struct ParticleSimulationData *sim)
 
void psys_sim_data_free (struct ParticleSimulationData *sim)
 
struct ParticleSystempsys_orig_get (struct ParticleSystem *psys)
 
struct ParticleSystempsys_eval_get (struct Depsgraph *depsgraph, struct Object *object, struct ParticleSystem *psys)
 
bool psys_in_edit_mode (struct Depsgraph *depsgraph, const struct ParticleSystem *psys)
 
bool psys_check_enabled (struct Object *ob, struct ParticleSystem *psys, bool use_render_params)
 
bool psys_check_edited (struct ParticleSystem *psys)
 
void psys_find_group_weights (struct ParticleSettings *part)
 
void psys_check_group_weights (struct ParticleSettings *part)
 
int psys_uses_gravity (struct ParticleSimulationData *sim)
 
void BKE_particlesettings_fluid_default_settings (struct ParticleSettings *part)
 
void psys_free_path_cache (struct ParticleSystem *psys, struct PTCacheEdit *edit)
 
void psys_free (struct Object *ob, struct ParticleSystem *psys)
 
void psys_copy_particles (struct ParticleSystem *psys_dst, struct ParticleSystem *psys_src)
 
bool psys_render_simplify_params (struct ParticleSystem *psys, struct ChildParticle *cpa, float *params)
 
void psys_interpolate_uvs (const struct MTFace *tface, int quad, const float w[4], float uvco[2])
 
void psys_interpolate_mcol (const struct MCol *mcol, int quad, const float w[4], struct MCol *mc)
 
void copy_particle_key (struct ParticleKey *to, struct ParticleKey *from, int time)
 
void psys_emitter_customdata_mask (struct ParticleSystem *psys, struct CustomData_MeshMasks *r_cddata_masks)
 
void psys_particle_on_emitter (struct ParticleSystemModifierData *psmd, int from, int index, int index_dmcache, float fuv[4], float foffset, float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3])
 
struct ParticleSystemModifierDatapsys_get_modifier (struct Object *ob, struct ParticleSystem *psys)
 
struct ModifierDataobject_add_particle_system (struct Main *bmain, const struct Scene *scene, struct Object *ob, const char *name)
 
struct ModifierDataobject_copy_particle_system (struct Main *bmain, const struct Scene *scene, struct Object *ob, const struct ParticleSystem *psys_orig)
 
void object_remove_particle_system (struct Main *bmain, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys)
 
struct ParticleSettingsBKE_particlesettings_add (struct Main *bmain, const char *name)
 
void psys_reset (struct ParticleSystem *psys, int mode)
 
void psys_find_parents (struct ParticleSimulationData *sim, bool use_render_params)
 
void psys_unique_name (struct Object *object, struct ParticleSystem *psys, const char *defname) ATTR_NONNULL(1
 
void void psys_cache_paths (struct ParticleSimulationData *sim, float cfra, bool use_render_params)
 
void psys_cache_edit_paths (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct PTCacheEdit *edit, float cfra, bool use_render_params)
 
void psys_cache_child_paths (struct ParticleSimulationData *sim, float cfra, bool editupdate, bool use_render_params)
 
bool do_guides (struct Depsgraph *depsgraph, struct ParticleSettings *part, struct ListBase *effectors, ParticleKey *state, int index, float time)
 
void precalc_guides (struct ParticleSimulationData *sim, struct ListBase *effectors)
 
float psys_get_timestep (struct ParticleSimulationData *sim)
 
float psys_get_child_time (struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra, float *birthtime, float *dietime)
 
float psys_get_child_size (struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra, float *pa_time)
 
void psys_get_particle_on_path (struct ParticleSimulationData *sim, int pa_num, struct ParticleKey *state, bool vel)
 
bool psys_get_particle_state (struct ParticleSimulationData *sim, int p, struct ParticleKey *state, bool always)
 
void BKE_particlesettings_clump_curve_init (struct ParticleSettings *part)
 
void BKE_particlesettings_rough_curve_init (struct ParticleSettings *part)
 
void BKE_particlesettings_twist_curve_init (struct ParticleSettings *part)
 
void psys_apply_child_modifiers (struct ParticleThreadContext *ctx, struct ListBase *modifiers, struct ChildParticle *cpa, struct ParticleTexture *ptex, const float orco[3], float hairmat[4][4], struct ParticleCacheKey *keys, struct ParticleCacheKey *parent_keys, const float parent_orco[3])
 
void psys_sph_init (struct ParticleSimulationData *sim, struct SPHData *sphdata)
 
void psys_sph_finalize (struct SPHData *sphdata)
 
void psys_sph_density (struct BVHTree *tree, struct SPHData *data, float co[3], float vars[2])
 
void psys_get_dupli_texture (struct ParticleSystem *psys, struct ParticleSettings *part, struct ParticleSystemModifierData *psmd, struct ParticleData *pa, struct ChildParticle *cpa, float uv[2], float orco[3])
 
void psys_get_dupli_path_transform (struct ParticleSimulationData *sim, struct ParticleData *pa, struct ChildParticle *cpa, struct ParticleCacheKey *cache, float mat[4][4], float *scale)
 
void psys_thread_context_init (struct ParticleThreadContext *ctx, struct ParticleSimulationData *sim)
 
void psys_thread_context_free (struct ParticleThreadContext *ctx)
 
void psys_tasks_create (struct ParticleThreadContext *ctx, int startpart, int endpart, struct ParticleTask **r_tasks, int *r_numtasks)
 
void psys_tasks_free (struct ParticleTask *tasks, int numtasks)
 
void psys_apply_hair_lattice (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys)
 
struct ParticleSystempsys_get_target_system (struct Object *ob, struct ParticleTarget *pt)
 
void psys_count_keyed_targets (struct ParticleSimulationData *sim)
 
void psys_update_particle_tree (struct ParticleSystem *psys, float cfra)
 
void psys_changed_type (struct Object *ob, struct ParticleSystem *psys)
 
void psys_make_temp_pointcache (struct Object *ob, struct ParticleSystem *psys)
 
void psys_get_pointcache_start_end (struct Scene *scene, ParticleSystem *psys, int *sfra, int *efra)
 
void psys_check_boid_data (struct ParticleSystem *psys)
 
void psys_get_birth_coords (struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, float dtime, float cfra)
 
void particle_system_update (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys, bool use_render_params)
 
void BKE_particlesystem_id_loop (struct ParticleSystem *psys, ParticleSystemIDFunc func, void *userdata)
 
void BKE_particlesystem_reset_all (struct Object *object)
 
void psys_disable_all (struct Object *ob)
 
void psys_enable_all (struct Object *ob)
 
void free_hair (struct Object *ob, struct ParticleSystem *psys, int dynamics)
 
void free_keyed_keys (struct ParticleSystem *psys)
 
void psys_free_particles (struct ParticleSystem *psys)
 
void psys_free_children (struct ParticleSystem *psys)
 
void psys_interpolate_particle (short type, struct ParticleKey keys[4], float dt, struct ParticleKey *result, bool velocity)
 
void psys_vec_rot_to_face (struct Mesh *mesh, struct ParticleData *pa, float vec[3])
 
void psys_mat_hair_to_object (struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
 
void psys_mat_hair_to_global (struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
 
void psys_mat_hair_to_orco (struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
 
float psys_get_dietime_from_cache (struct PointCache *cache, int index)
 
void psys_free_pdd (struct ParticleSystem *psys)
 
floatpsys_cache_vgroup (struct Mesh *mesh, struct ParticleSystem *psys, int vgroup)
 
void psys_get_texture (struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleTexture *ptex, int event, float cfra)
 
void psys_interpolate_face (struct Mesh *mesh, const float(*vert_positions)[3], const float(*vert_normals)[3], const struct MFace *mface, struct MTFace *tface, const float(*orcodata)[3], float w[4], float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3])
 
float psys_particle_value_from_verts (struct Mesh *mesh, short from, struct ParticleData *pa, float *values)
 
void psys_get_from_key (struct ParticleKey *key, float loc[3], float vel[3], float rot[4], float *time)
 
void BKE_psys_collision_neartest_cb (void *userdata, int index, const struct BVHTreeRay *ray, struct BVHTreeRayHit *hit)
 
void psys_particle_on_dm (struct Mesh *mesh_final, int from, int index, int index_dmcache, const float fw[4], float foffset, float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3])
 
void distribute_particles (struct ParticleSimulationData *sim, int from)
 
void init_particle (struct ParticleSimulationData *sim, struct ParticleData *pa)
 
void psys_calc_dmcache (struct Object *ob, struct Mesh *mesh_final, struct Mesh *mesh_original, struct ParticleSystem *psys)
 
int psys_particle_dm_face_lookup (struct Mesh *mesh_final, struct Mesh *mesh_original, int findex_orig, const float fw[4], struct LinkNode **poly_nodes)
 
void reset_particle (struct ParticleSimulationData *sim, struct ParticleData *pa, float dtime, float cfra)
 
float psys_get_current_display_percentage (struct ParticleSystem *psys, bool use_render_params)
 
void BKE_particle_settings_eval_reset (struct Depsgraph *depsgraph, struct ParticleSettings *particle_settings)
 
void BKE_particle_system_eval_init (struct Depsgraph *depsgraph, struct Object *object)
 
void BKE_particle_batch_cache_dirty_tag (struct ParticleSystem *psys, int mode)
 
void BKE_particle_batch_cache_free (struct ParticleSystem *psys)
 
void BKE_particle_partdeflect_blend_read_data (struct BlendDataReader *reader, struct PartDeflect *pd)
 
void BKE_particle_system_blend_write (struct BlendWriter *writer, struct ListBase *particles)
 
void BKE_particle_system_blend_read_data (struct BlendDataReader *reader, struct ListBase *particles)
 
void BKE_particle_system_blend_read_after_liblink (struct BlendLibReader *reader, struct Object *ob, struct ID *id, struct ListBase *particles)
 

Variables

unsigned int PSYS_FRAND_SEED_OFFSET [PSYS_FRAND_COUNT]
 
unsigned int PSYS_FRAND_SEED_MULTIPLIER [PSYS_FRAND_COUNT]
 
float PSYS_FRAND_BASE [PSYS_FRAND_COUNT]
 
void(* BKE_particle_batch_cache_dirty_tag_cb )(struct ParticleSystem *psys, int mode)
 
void(* BKE_particle_batch_cache_free_cb )(struct ParticleSystem *psys)
 

Macro Definition Documentation

◆ DMCACHE_ISCHILD

◆ DMCACHE_NOTFOUND

◆ LOOP_DYNAMIC_PARTICLES

#define LOOP_DYNAMIC_PARTICLES
Value:
for (p = 0; p < psys->totpart; p++) \
if ((pa = psys->particles + p)->state.time > 0.0f)

Definition at line 62 of file BKE_particle.h.

Referenced by dynamics_step().

◆ LOOP_EXISTING_PARTICLES

#define LOOP_EXISTING_PARTICLES
Value:
for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) \
if (!(pa->flag & PARS_UNEXIST))
@ PARS_UNEXIST

Definition at line 55 of file BKE_particle.h.

Referenced by dynamics_step(), and particle_system_update().

◆ LOOP_PARTICLES

◆ LOOP_SHOWN_PARTICLES

#define LOOP_SHOWN_PARTICLES
Value:
for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) \
if (!(pa->flag & (PARS_UNEXIST | PARS_NO_DISP)))
@ PARS_NO_DISP

Definition at line 58 of file BKE_particle.h.

Referenced by count_particles(), count_particles_mod(), dynamics_step(), psys_update_particle_bvhtree(), and psys_update_particle_tree().

◆ PARTICLE_COLLISION_MAX_COLLISIONS

#define PARTICLE_COLLISION_MAX_COLLISIONS   10

Definition at line 49 of file BKE_particle.h.

Referenced by collision_check().

◆ PARTICLE_DRAW_DATA_UPDATED

#define PARTICLE_DRAW_DATA_UPDATED   1

Definition at line 244 of file BKE_particle.h.

◆ PARTICLE_P

◆ PARTICLE_PSMD

#define PARTICLE_PSMD    ParticleSystemModifierData *psmd = sim->psmd ? sim->psmd : psys_get_modifier(sim->ob, sim->psys)

◆ PSYS_FRAND_COUNT

#define PSYS_FRAND_COUNT   1024

Definition at line 246 of file BKE_particle.h.

Referenced by BKE_particle_init_rng(), psys_frand(), and psys_frand_vec().

◆ PSYS_RESET_ALL

#define PSYS_RESET_ALL   1

◆ PSYS_RESET_CACHE_MISS

#define PSYS_RESET_CACHE_MISS   4

Definition at line 675 of file BKE_particle.h.

Referenced by psys_reset(), and system_step().

◆ PSYS_RESET_DEPSGRAPH

#define PSYS_RESET_DEPSGRAPH   2

Definition at line 673 of file BKE_particle.h.

Referenced by BKE_ptcache_id_reset(), clear_edited_exec(), and psys_reset().

Typedef Documentation

◆ ParticleCacheKey

typedef struct ParticleCacheKey ParticleCacheKey

◆ ParticleCollision

typedef struct ParticleCollision ParticleCollision

Container for moving data between deflet_particle and particle_intersect_face.

◆ ParticleCollisionElement

typedef struct ParticleCollisionElement ParticleCollisionElement

◆ ParticleDrawData

typedef struct ParticleDrawData ParticleDrawData

◆ ParticleSeam

typedef struct ParticleSeam ParticleSeam

◆ ParticleSimulationData

typedef struct ParticleSimulationData ParticleSimulationData

◆ ParticleSystemIDFunc

typedef void(* ParticleSystemIDFunc) (struct ParticleSystem *psys, struct ID **idpoin, void *userdata, int cb_flag)

Callback format for performing operations on ID-pointers for particle systems.

Definition at line 533 of file BKE_particle.h.

◆ ParticleTask

typedef struct ParticleTask ParticleTask

◆ ParticleTexture

typedef struct ParticleTexture ParticleTexture

◆ ParticleThreadContext

typedef struct ParticleThreadContext ParticleThreadContext

◆ SPHData

typedef struct SPHData SPHData

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
BKE_PARTICLE_BATCH_DIRTY_ALL 

Definition at line 691 of file BKE_particle.h.

Function Documentation

◆ BKE_particle_batch_cache_dirty_tag()

◆ BKE_particle_batch_cache_free()

void BKE_particle_batch_cache_free ( struct ParticleSystem * psys)

Definition at line 5301 of file particle.cc.

References ParticleSystem::batch_cache, and BKE_particle_batch_cache_free_cb.

Referenced by psys_free().

◆ BKE_particle_init_rng()

void BKE_particle_init_rng ( void )

◆ BKE_particle_partdeflect_blend_read_data()

void BKE_particle_partdeflect_blend_read_data ( struct BlendDataReader * reader,
struct PartDeflect * pd )

Definition at line 316 of file particle.cc.

Referenced by object_blend_read_data(), and particle_settings_blend_read_data().

◆ BKE_particle_settings_eval_reset()

void BKE_particle_settings_eval_reset ( struct Depsgraph * depsgraph,
struct ParticleSettings * particle_settings )

◆ BKE_particle_system_blend_read_after_liblink()

◆ BKE_particle_system_blend_read_data()

◆ BKE_particle_system_blend_write()

◆ BKE_particle_system_eval_init()

void BKE_particle_system_eval_init ( struct Depsgraph * depsgraph,
struct Object * object )

◆ BKE_particlesettings_add()

struct ParticleSettings * BKE_particlesettings_add ( struct Main * bmain,
const char * name )

◆ BKE_particlesettings_clump_curve_init()

void BKE_particlesettings_clump_curve_init ( struct ParticleSettings * part)

◆ BKE_particlesettings_fluid_default_settings()

◆ BKE_particlesettings_rough_curve_init()

void BKE_particlesettings_rough_curve_init ( struct ParticleSettings * part)

◆ BKE_particlesettings_twist_curve_init()

void BKE_particlesettings_twist_curve_init ( struct ParticleSettings * part)

◆ BKE_particlesystem_id_loop()

◆ BKE_particlesystem_reset_all()

void BKE_particlesystem_reset_all ( struct Object * object)

◆ BKE_psys_collision_neartest_cb()

void BKE_psys_collision_neartest_cb ( void * userdata,
int index,
const struct BVHTreeRay * ray,
struct BVHTreeRayHit * hit )

Callback for BVHTree near test.

Referenced by boid_find_ground(), and rule_avoid_collision().

◆ copy_particle_key()

◆ count_particles()

int count_particles ( struct ParticleSystem * psys)

◆ count_particles_mod()

int count_particles_mod ( struct ParticleSystem * psys,
int totgr,
int cur )

◆ distribute_particles()

◆ do_guides()

◆ free_hair()

◆ free_keyed_keys()

◆ init_particle()

void init_particle ( struct ParticleSimulationData * sim,
struct ParticleData * pa )

Set particle parameters that don't change during particle's life.

Definition at line 576 of file particle_system.cc.

References ParticleData::flag, float, ParticleData::hair_index, ParticleSystem::part, ParticleSystem::particles, ParticleSimulationData::psys, ParticleData::time, and ParticleSystem::totpart.

Referenced by brush_add(), and initialize_all_particles().

◆ object_add_particle_system()

struct ModifierData * object_add_particle_system ( struct Main * bmain,
const struct Scene * scene,
struct Object * ob,
const char * name )

◆ object_copy_particle_system()

struct ModifierData * object_copy_particle_system ( struct Main * bmain,
const struct Scene * scene,
struct Object * ob,
const struct ParticleSystem * psys_orig )

◆ object_remove_particle_system()

◆ particle_system_update()

void particle_system_update ( struct Depsgraph * depsgraph,
struct Scene * scene,
struct Object * ob,
struct ParticleSystem * psys,
bool use_render_params )

Main particle update call, checks that things are ok on the large scale and then advances in to actual particle calculations depending on particle type.

Definition at line 4792 of file particle_system.cc.

References ParticleSettings::adt, ADT_RECALC_ANIM, BKE_animsys_eval_context_construct(), BKE_animsys_evaluate_animdata(), BKE_mesh_tessface_ensure(), BKE_particle_batch_cache_dirty_tag(), BKE_PARTICLE_BATCH_DIRTY_ALL, ParticleSystem::cfra, DEG_get_ctime(), DEG_is_active(), depsgraph, ParticleSimulationData::depsgraph, distribute_particles(), ParticleSystem::edit, emit_particles(), eParticleSystemFlag_Pars, eParticleSystemFlag_psys_updated, evaluate_emitter_anim(), ParticleData::flag, ParticleDrawData::flag, ParticleSystem::flag, ParticleSystemModifierData::flag, PTCacheEdit::flags, float, ParticleSystem::free_edit, free_hair(), free_keyed_keys(), free_unexisting_particles(), hair_needs_recalc(), hair_step(), ParticleSettings::hair_step, ParticleSettings::id, ID_RECALC_PSYS_RESET, ParticleSystem::imat, initialize_all_particles(), invert_m4_m4(), LOOP_EXISTING_PARTICLES, ParticleSystemModifierData::mesh_final, ParticleSimulationData::ob, PAMAP_SIZE, PARS_NO_DISP, ParticleSystem::part, PART_FROM_VERT, PART_HAIR, PART_HAIR_REGROW, PART_PHYS_KEYED, PART_PHYS_NO, PARTICLE_P, particle_settings_free_local(), particle_settings_localize(), particles_fluid_step(), particles_has_bubble(), particles_has_flip(), particles_has_foam(), particles_has_spray(), particles_has_tracer(), ParticleSystem::pdd, ParticleSimulationData::psmd, PTCacheEdit::psmd_eval, ParticleSimulationData::psys, PTCacheEdit::psys, psys_check_enabled(), psys_count_keyed_targets(), PSYS_EDITED, PTCacheEdit::psys_eval, psys_frand(), psys_free_path_cache(), psys_get_current_display_percentage(), psys_get_modifier(), psys_get_texture(), PSYS_HAIR_DONE, PSYS_OB_ANIM_RESTORE, psys_orig_get(), psys_prepare_physics(), psys_reset(), PSYS_RESET_ALL, psys_update_path_cache(), PT_CACHE_EDIT_UPDATE_PARTICLE_FROM_EVAL, ParticleSystem::recalc, reset_particle(), save_hair(), ParticleSimulationData::scene, scene, set_keyed_keys(), ParticleData::size, ParticleTexture::size, system_step(), ParticleSettings::totpart, ParticleSystem::totpart, and ParticleSystem::totunexist.

Referenced by BKE_object_handle_data_update(), and deform_verts().

◆ precalc_guides()

◆ psys_apply_child_modifiers()

◆ psys_apply_hair_lattice()

◆ psys_cache_child_paths()

◆ psys_cache_edit_paths()

◆ psys_cache_paths()

void void psys_cache_paths ( struct ParticleSimulationData * sim,
float cfra,
bool use_render_params )

Calculates paths ready for drawing/rendering

  • Useful for making use of opengl vertex arrays for super fast strand drawing.
  • Makes child strands possible and creates them too into the cache.
  • Cached path data is also used to determine cut position for the edit-mode tool.

Definition at line 3256 of file particle.cc.

References ParticleInterpolationData::birthtime, BKE_lattice_deform_data_eval_co(), BKE_mesh_tessface_ensure(), BKE_object_material_get(), ParticleInterpolationData::bspline, ParticleInterpolationData::cache, cache_key_incremental_rotation(), HairKey::co, ParticleCacheKey::co, col, ParticleCacheKey::col, copy_qt_qt(), copy_v3_v3(), ParticleSimulationData::depsgraph, ParticleInterpolationData::dietime, do_guides(), do_particle_interpolation(), do_path_effectors(), ParticleSettings::draw_col, ParticleSystem::edit, ParticleSystem::effectors, ParticleInterpolationData::epoint, ListBase::first, ParticleEditSettings::flag, ParticleSettings::flag, ParticleSystem::flag, float, ParticleSettings::from, ParticleSystem::hair_out_mesh, init_particle_interpolation(), int, ParticleInterpolationData::keyed, ParticleSystem::lattice_deform_data, ParticleSystem::lattice_strength, len_v3(), length(), ParticleTexture::length, LOOP_PARTICLES, mat3_to_quat_legacy(), PointCache::mem_cache, MEM_freeN(), ParticleInterpolationData::mesh, mul_m4_v3(), mul_v3_m4v3(), ParticleSimulationData::ob, ParticleSettings::omat, PAMAP_LENGTH, ParticleSystem::part, PART_ABS_PATH_TIME, PART_CHILD_EFFECT, PART_DRAW_COL_MAT, PART_FROM_VERT, PART_HAIR, PART_HAIR_BSPLINE, ToolSettings::particle, PARTICLE_P, PARTICLE_PSMD, ParticleSystem::pathcache, ParticleSystem::pathcachebufs, PE_DRAW_PART, ParticleSystem::pointcache, pow(), ParticleSimulationData::psys, psys_alloc_path_cache_buffers(), psys_cache_vgroup(), psys_frand(), psys_free_path_cache(), psys_get_texture(), PSYS_GLOBAL_HAIR, PSYS_HAIR_DONE, PSYS_HAIR_DYNAMICS, psys_in_edit_mode(), PSYS_KEYED, psys_mat_hair_to_global(), psys_particle_value_from_verts(), psys_sim_data_free(), psys_sim_data_init(), PSYS_VG_EFFECTOR, PSYS_VG_LENGTH, Material::r, result, ParticleCacheKey::rot, rot, ParticleSimulationData::scene, ParticleSystem::seed, ParticleCacheKey::segments, sub_v3_v3v3(), ParticleCacheKey::time, Scene::toolsettings, ParticleSystem::totcached, ParticleSystem::totchild, ParticleSystem::totpart, ParticleSettings::type, ParticleCacheKey::vel, and HairKey::world_co.

Referenced by psys_update_path_cache().

◆ psys_cache_vgroup()

float * psys_cache_vgroup ( struct Mesh * mesh,
struct ParticleSystem * psys,
int vgroup )

◆ psys_calc_dmcache()

◆ psys_changed_type()

◆ psys_check_boid_data()

◆ psys_check_edited()

◆ psys_check_enabled()

◆ psys_check_group_weights()

◆ psys_copy_particles()

◆ psys_count_keyed_targets()

◆ psys_disable_all()

void psys_disable_all ( struct Object * ob)

◆ psys_emitter_customdata_mask()

◆ psys_enable_all()

void psys_enable_all ( struct Object * ob)

◆ psys_eval_get()

struct ParticleSystem * psys_eval_get ( struct Depsgraph * depsgraph,
struct Object * object,
struct ParticleSystem * psys )

For a given original object and its particle system, get evaluated particle system within a given dependency graph.

Definition at line 664 of file particle.cc.

References DEG_get_evaluated_object(), depsgraph, ListBase::first, ParticleSystem::next, ParticleSystem::orig_psys, and Object::particlesystem.

Referenced by BKE_ptcache_bake(), blender::ed::object::convert_psys_to_mesh(), disconnect_hair(), PE_create_particle_edit(), and remap_hair_emitter().

◆ psys_find_group_weights()

void psys_find_group_weights ( struct ParticleSettings * part)

◆ psys_find_parents()

◆ psys_frand()

◆ psys_frand_vec()

BLI_INLINE void psys_frand_vec ( ParticleSystem * psys,
unsigned int seed,
float vec[3] )

◆ psys_free()

◆ psys_free_children()

void psys_free_children ( struct ParticleSystem * psys)

◆ psys_free_particles()

◆ psys_free_path_cache()

◆ psys_free_pdd()

◆ psys_get_birth_coords()

◆ psys_get_child_number()

int psys_get_child_number ( struct Scene * scene,
struct ParticleSystem * psys,
bool use_render_params )

◆ psys_get_child_size()

◆ psys_get_child_time()

◆ psys_get_current()

◆ psys_get_current_display_percentage()

float psys_get_current_display_percentage ( struct ParticleSystem * psys,
bool use_render_params )

◆ psys_get_current_num()

short psys_get_current_num ( struct Object * ob)

◆ psys_get_dietime_from_cache()

float psys_get_dietime_from_cache ( struct PointCache * cache,
int index )

◆ psys_get_dupli_path_transform()

◆ psys_get_dupli_texture()

◆ psys_get_from_key()

void psys_get_from_key ( struct ParticleKey * key,
float loc[3],
float vel[3],
float rot[4],
float * time )

◆ psys_get_modifier()

◆ psys_get_particle_on_path()

void psys_get_particle_on_path ( struct ParticleSimulationData * sim,
int pa_num,
struct ParticleKey * state,
bool vel )

Gets hair (or keyed) particles state at the "path time" specified in state->time.

Definition at line 4599 of file particle.cc.

References BKE_lattice_deform_data_eval_co(), BKE_object_material_get(), ParticleInterpolationData::bspline, ParticleInterpolationData::cache, ParticleSystem::child, ParticleSystem::childcache, CLAMP, ParticleKey::co, copy_particle_key(), copy_qt_qt(), copy_v3_v3(), ParticleChildModifierContext::cpa, ParticleSimulationData::depsgraph, DMCACHE_ISCHILD, do_child_modifiers(), do_guides(), do_particle_interpolation(), ParticleSystem::effectors, ParticleInterpolationData::epoint, ParticleData::flag, ParticleSettings::flag, ParticleSystem::flag, ChildParticle::foffset, ParticleData::foffset, ParticleSettings::from, ChildParticle::fuv, ParticleData::fuv, get_child_modifier_parameters(), ParticleSystem::hair_out_mesh, init_particle_interpolation(), interpolate_pathcache(), ParticleInterpolationData::keyed, ParticleSystem::lattice_deform_data, ParticleSystem::lattice_strength, len_v3(), ParticleThreadContext::ma, ParticleInterpolationData::mesh, ParticleThreadContext::mesh, ParticleSystemModifierData::mesh_final, mul_m4_v3(), mul_mat3_m4_v3(), mul_v3_fl(), normalize_v3(), ChildParticle::num, ParticleData::num, ParticleData::num_dmcache, ParticleSimulationData::ob, offset_child(), ParticleChildModifierContext::orco, ChildParticle::pa, ParticleChildModifierContext::par_co, ParticleChildModifierContext::par_orco, ParticleChildModifierContext::par_rot, ParticleChildModifierContext::par_vel, ChildParticle::parent, ParticleChildModifierContext::parent_keys, PARS_REKEY, ParticleSystem::part, PART_CHILD_FACES, PART_CHILD_GUIDE, PART_FROM_FACE, PART_HAIR, PART_HAIR_BSPLINE, PART_PHYS_KEYED, PARTICLE_PSMD, ParticleSystem::particles, ParticleSystem::pathcache, ParticleSystem::pointcache, ParticleSimulationData::psmd, ParticleSimulationData::psys, psys_get_child_time(), psys_get_particle_on_path(), PSYS_GLOBAL_HAIR, psys_in_edit_mode(), PSYS_KEYED, psys_mat_hair_to_global(), psys_particle_on_emitter(), ParticleChildModifierContext::ptex, result, ParticleKey::rot, ParticleChildModifierContext::sim, ParticleThreadContext::sim, state, sub_v3_v3v3(), ParticleChildModifierContext::thread_ctx, ParticleData::time, ParticleKey::time, ParticleSystem::totchild, ParticleSystem::totpart, unit_m4(), ParticleKey::vel, ChildParticle::w, and w().

Referenced by brush_add(), modify_mesh(), psys_get_particle_on_path(), psys_get_particle_state(), rekey_particle(), rekey_particle_to_time(), and subdivide_particle().

◆ psys_get_particle_state()

bool psys_get_particle_state ( struct ParticleSimulationData * sim,
int p,
struct ParticleKey * state,
bool always )

Gets particle's state at a time. Must call psys_sim_data_init before this.

Returns
true if particle exists and can be seen and false if not.

Definition at line 4886 of file particle.cc.

References ParticleKey::ave, BKE_lattice_deform_data_eval_co(), ParticleSystem::child, ParticleSystem::childcache, CLAMP, ParticleKey::co, copy_particle_key(), ParticleChildModifierContext::cpa, DEG_get_ctime(), ParticleSimulationData::depsgraph, ParticleData::dietime, do_child_modifiers(), ELEM, ParticleSystem::flag, RenderData::frs_sec, ChildParticle::fuv, interp_qt_qtqt(), interp_v3_v3v3(), ParticleSystem::lattice_deform_data, ParticleSystem::lattice_strength, ParticleData::lifetime, madd_v3_v3v3fl(), mul_v3_fl(), offset_child(), ParticleChildModifierContext::orco, ParticleChildModifierContext::par_co, ParticleChildModifierContext::par_orco, ParticleChildModifierContext::par_rot, ParticleChildModifierContext::par_vel, ChildParticle::parent, ParticleChildModifierContext::parent_keys, ParticleSystem::part, PART_CHILD_FACES, PART_DIED, PART_PHYS_KEYED, PART_PHYS_NO, PART_UNBORN, ParticleSystem::particles, ParticleData::prev_state, ParticleSimulationData::psys, psys_frand(), psys_get_child_time(), psys_get_particle_on_path(), psys_get_timestep(), psys_interpolate_particle(), PSYS_KEYED, ParticleChildModifierContext::ptex, Scene::r, ParticleKey::rot, ParticleSimulationData::scene, ParticleChildModifierContext::sim, ParticleData::state, state, ParticleChildModifierContext::thread_ctx, ParticleData::time, ParticleKey::time, ParticleSystem::totchild, ParticleSystem::totpart, unit_m4(), and ParticleKey::vel.

Referenced by blender::io::alembic::ABCPointsWriter::do_write(), explodeMesh(), get_effector_data(), make_duplis_particle_system(), modify_mesh(), blender::draw::particle_batch_cache_ensure_pos(), particle_system_minmax(), pointdensity_cache_psys(), and set_keyed_keys().

◆ psys_get_pointcache_start_end()

void psys_get_pointcache_start_end ( struct Scene * scene,
ParticleSystem * psys,
int * sfra,
int * efra )

Definition at line 1306 of file particle_system.cc.

References max_ii(), min_ii(), and ParticleSystem::part.

Referenced by BKE_ptcache_bake(), and system_step().

◆ psys_get_target_system()

◆ psys_get_texture()

void psys_get_texture ( struct ParticleSimulationData * sim,
struct ParticleData * pa,
struct ParticleTexture * ptex,
int event,
float cfra )

Definition at line 4338 of file particle.cc.

References ATTR_FALLTHROUGH, BKE_mesh_texspace_ensure(), blend, MTex::blendtype, CLAMP_PARTICLE_TEXTURE_POS, CLAMP_PARTICLE_TEXTURE_POSNEG, CLAMP_WARP_PARTICLE_TEXTURE_POS, ParticleTexture::clump, ParticleKey::co, copy_v3_v3(), ParticleTexture::damp, MTex::dampfac, Object::data, MTex::def_var, ParticleData::dietime, ParticleTexture::effector, ELEM, ParticleTexture::exist, fabsf, ParticleTexture::field, MTex::fieldfac, float, ParticleData::foffset, ParticleSettings::from, ParticleData::fuv, get_particle_uv(), ParticleTexture::gravity, MTex::gravityfac, ParticleTexture::ivel, MTex::ivelfac, ParticleTexture::kink_amp, ParticleTexture::kink_freq, ParticleTexture::length, MTex::lengthfac, ParticleTexture::life, MTex::lifefac, MTex::mapto, MAX_MTEX, ParticleSystemModifierData::mesh_final, mul_m4_v3(), ParticleData::num, ParticleData::num_dmcache, ParticleSimulationData::ob, MTex::object, MTex::padensfac, PAMAP_DAMP, PAMAP_DENS, PAMAP_FIELD, PAMAP_GRAVITY, PAMAP_IVEL, PAMAP_LENGTH, PAMAP_LIFE, PAMAP_SIZE, PAMAP_TIME, PAMAP_TWIST, ParticleSystem::part, PART_DISTR_GRID, PART_FROM_FACE, PART_FROM_VERT, PART_FROM_VOLUME, ParticleSystem::particles, ParticleSimulationData::psmd, ParticleSimulationData::psys, psys_particle_on_emitter(), RE_texture_evaluate(), ParticleTexture::rough1, ParticleTexture::rough2, ParticleTexture::roughe, SET_PARTICLE_TEXTURE, ParticleTexture::size, MTex::sizefac, ParticleData::state, sub_v3_v3(), MTex::tex, MTex::texco, TEXCO_GLOB, TEXCO_OBJECT, TEXCO_ORCO, TEXCO_PARTICLE, TEXCO_UV, texture_value_blend(), ParticleData::time, ParticleTexture::time, MTex::timefac, ParticleSystem::totpart, ParticleTexture::twist, MTex::twistfac, and MTex::uvname.

Referenced by basic_integrate(), cached_step(), dynamics_step(), init_particle_texture(), particle_system_update(), psys_cache_paths(), psys_get_birth_coords(), and reset_particle().

◆ psys_get_timestep()

◆ psys_get_tot_child()

int psys_get_tot_child ( struct Scene * scene,
struct ParticleSystem * psys,
bool use_render_params )

◆ psys_in_edit_mode()

◆ psys_interpolate_face()

void psys_interpolate_face ( struct Mesh * mesh,
const float(*) vert_positions[3],
const float(*) vert_normals[3],
const struct MFace * mface,
struct MTFace * tface,
const float(*) orcodata[3],
float w[4],
float vec[3],
float nor[3],
float utan[3],
float vtan[3],
float orco[3] )

Interpolate a location on a face based on face coordinates.

Referenced by distribute_from_volume_exec().

◆ psys_interpolate_mcol()

void psys_interpolate_mcol ( const struct MCol * mcol,
int quad,
const float w[4],
struct MCol * mc )

◆ psys_interpolate_particle()

◆ psys_interpolate_uvs()

void psys_interpolate_uvs ( const struct MTFace * tface,
int quad,
const float w[4],
float uvco[2] )

◆ psys_make_temp_pointcache()

◆ psys_mat_hair_to_global()

◆ psys_mat_hair_to_object()

◆ psys_mat_hair_to_orco()

void psys_mat_hair_to_orco ( struct Object * ob,
struct Mesh * mesh,
short from,
struct ParticleData * pa,
float hairmat[4][4] )

◆ psys_orig_get()

struct ParticleSystem * psys_orig_get ( struct ParticleSystem * psys)

For a given evaluated particle system get its original.

If this input is an original particle system already, the return value is the same as the input.

Definition at line 656 of file particle.cc.

References ParticleSystem::orig_psys.

Referenced by blender::draw::drw_particle_get_hair_source(), particle_system_update(), and psys_in_edit_mode().

◆ psys_particle_dm_face_lookup()

int psys_particle_dm_face_lookup ( struct Mesh * mesh_final,
struct Mesh * mesh_original,
int findex_orig,
const float fw[4],
struct LinkNode ** poly_nodes )

Find the final derived mesh tessface for a particle, from its original tessface index. This is slow and can be optimized but only for many lookups.

Parameters
mesh_finalFinal mesh, it may not have the same topology as original mesh.
mesh_originalOriginal mesh, use for accessing poly to MFace mapping.
findex_origThe input tessface index.
fwFace weights (position of the particle inside the findex_orig tessface).
poly_nodesMay be NULL, otherwise an array of linked list, one for each final mesh_final face, containing all its tessfaces indices.
Returns
The mesh_final tessface index.

Definition at line 1830 of file particle.cc.

References BKE_mesh_origindex_mface_mpoly(), BLI_assert, CD_MFACE, CD_ORIGINDEX, CD_ORIGSPACE, CustomData_get_layer(), CustomData_get_layer_for_write(), DMCACHE_NOTFOUND, ELEM, Mesh::face_data, Mesh::fdata_legacy, float, isect_point_quad_v2(), isect_point_tri_v2(), LinkNode::link, LinkNode::next, POINTER_AS_INT, printf, psys_w_to_origspace(), Mesh::runtime, Mesh::totface_legacy, and OrigSpaceFace::uv.

Referenced by brush_add_count_iter(), PE_mirror_x(), psys_calc_dmcache(), and remap_hair_emitter().

◆ psys_particle_on_dm()

◆ psys_particle_on_emitter()

◆ psys_particle_value_from_verts()

float psys_particle_value_from_verts ( struct Mesh * mesh,
short from,
struct ParticleData * pa,
float * values )

◆ psys_render_simplify_params()

bool psys_render_simplify_params ( struct ParticleSystem * psys,
struct ChildParticle * cpa,
float * params )

◆ psys_reset()

◆ psys_set_current_num()

void psys_set_current_num ( struct Object * ob,
int index )

◆ psys_sim_data_free()

◆ psys_sim_data_init()

◆ psys_sph_density()

◆ psys_sph_finalize()

void psys_sph_finalize ( struct SPHData * sphdata)

Definition at line 2172 of file particle_system.cc.

References psys_sph_flush_springs().

Referenced by dynamics_step().

◆ psys_sph_init()

◆ psys_tasks_create()

void psys_tasks_create ( struct ParticleThreadContext * ctx,
int startpart,
int endpart,
struct ParticleTask ** r_tasks,
int * r_numtasks )

◆ psys_tasks_free()

void psys_tasks_free ( struct ParticleTask * tasks,
int numtasks )

Definition at line 478 of file particle_system.cc.

References BLI_rng_free(), and MEM_freeN().

Referenced by distribute_particles_on_dm(), and psys_cache_child_paths().

◆ psys_thread_context_free()

◆ psys_thread_context_init()

◆ psys_unique_name()

void psys_unique_name ( struct Object * object,
struct ParticleSystem * psys,
const char * defname )

◆ psys_update_particle_tree()

void psys_update_particle_tree ( struct ParticleSystem * psys,
float cfra )

◆ psys_uses_gravity()

◆ psys_vec_rot_to_face()

void psys_vec_rot_to_face ( struct Mesh * mesh,
struct ParticleData * pa,
float vec[3] )

Definition at line 3898 of file particle.cc.

References mul_mat3_m4_v3(), psys_face_mat(), and transpose_m4().

Referenced by save_hair().

◆ reset_particle()

Variable Documentation

◆ BKE_particle_batch_cache_dirty_tag_cb

void(* BKE_particle_batch_cache_dirty_tag_cb) (struct ParticleSystem *psys, int mode) ( struct ParticleSystem * psys,
int mode )
extern

Definition at line 5292 of file particle.cc.

Referenced by BKE_particle_batch_cache_dirty_tag(), and DRW_engines_register().

◆ BKE_particle_batch_cache_free_cb

void(* BKE_particle_batch_cache_free_cb) (struct ParticleSystem *psys) ( struct ParticleSystem * psys)
extern

Definition at line 5293 of file particle.cc.

Referenced by BKE_particle_batch_cache_free(), and DRW_engines_register().

◆ PSYS_FRAND_BASE

float PSYS_FRAND_BASE[PSYS_FRAND_COUNT]
extern

Definition at line 413 of file particle.cc.

Referenced by BKE_particle_init_rng(), psys_frand(), and psys_frand_vec().

◆ PSYS_FRAND_SEED_MULTIPLIER

unsigned int PSYS_FRAND_SEED_MULTIPLIER[PSYS_FRAND_COUNT]
extern

Definition at line 412 of file particle.cc.

Referenced by BKE_particle_init_rng(), psys_frand(), and psys_frand_vec().

◆ PSYS_FRAND_SEED_OFFSET

unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT]
extern

Definition at line 411 of file particle.cc.

Referenced by BKE_particle_init_rng(), psys_frand(), and psys_frand_vec().