Blender  V3.3
Classes | Macros | Typedefs | Functions | Variables
particle.c File Reference
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "DNA_defaults.h"
#include "DNA_cloth_types.h"
#include "DNA_collection_types.h"
#include "DNA_curve_types.h"
#include "DNA_dynamicpaint_types.h"
#include "DNA_fluid_types.h"
#include "DNA_key_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_force_types.h"
#include "DNA_particle_types.h"
#include "DNA_scene_types.h"
#include "BLI_blenlib.h"
#include "BLI_kdopbvh.h"
#include "BLI_kdtree.h"
#include "BLI_linklist.h"
#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_task.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BKE_anim_data.h"
#include "BKE_anim_path.h"
#include "BKE_boids.h"
#include "BKE_cloth.h"
#include "BKE_collection.h"
#include "BKE_colortools.h"
#include "BKE_deform.h"
#include "BKE_displist.h"
#include "BKE_effect.h"
#include "BKE_idtype.h"
#include "BKE_key.h"
#include "BKE_lattice.h"
#include "BKE_lib_id.h"
#include "BKE_lib_query.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
#include "BKE_mesh_legacy_convert.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_scene.h"
#include "BKE_texture.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "DEG_depsgraph_query.h"
#include "RE_texture.h"
#include "BLO_read_write.h"
#include "particle_private.h"

Go to the source code of this file.

Classes

struct  ParticleInterpolationData
 
struct  CacheEditrPathsIterData
 

Macros

#define DNA_DEPRECATED_ALLOW
 
#define PATH_CACHE_BUF_SIZE   1024
 
#define SET_PARTICLE_TEXTURE(type, pvalue, texfac)
 
#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue)
 
#define CLAMP_WARP_PARTICLE_TEXTURE_POS(type, pvalue)
 
#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue)
 

Typedefs

typedef struct ParticleInterpolationData ParticleInterpolationData
 
typedef struct CacheEditrPathsIterData CacheEditrPathsIterData
 

Functions

static void fluid_free_settings (SPHFluidSettings *fluid)
 
static void particle_settings_init (ID *id)
 
static void particle_settings_copy_data (Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int UNUSED(flag))
 
static void particle_settings_free_data (ID *id)
 
static void particle_settings_foreach_id (ID *id, LibraryForeachIDData *data)
 
static void write_boid_state (BlendWriter *writer, BoidState *state)
 
static void particle_settings_blend_write (BlendWriter *writer, ID *id, const void *id_address)
 
void BKE_particle_partdeflect_blend_read_data (BlendDataReader *UNUSED(reader), PartDeflect *pd)
 
static void particle_settings_blend_read_data (BlendDataReader *reader, ID *id)
 
void BKE_particle_partdeflect_blend_read_lib (BlendLibReader *reader, ID *id, PartDeflect *pd)
 
static void particle_settings_blend_read_lib (BlendLibReader *reader, ID *id)
 
static void particle_settings_blend_read_expand (BlendExpander *expander, ID *id)
 
void BKE_particle_init_rng (void)
 
static void get_child_modifier_parameters (ParticleSettings *part, ParticleThreadContext *ctx, ChildParticle *cpa, short cpa_from, int cpa_num, float *cpa_fuv, float *orco, ParticleTexture *ptex)
 
static void get_cpa_texture (Mesh *mesh, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, const float fw[4], float *orco, ParticleTexture *ptex, int event, float cfra)
 
int count_particles (ParticleSystem *psys)
 
int count_particles_mod (ParticleSystem *psys, int totgr, int cur)
 
static ParticleCacheKeypcache_key_segment_endpoint_safe (ParticleCacheKey *key)
 
static ParticleCacheKey ** psys_alloc_path_cache_buffers (ListBase *bufs, int tot, int totkeys)
 
static void psys_free_path_cache_buffers (ParticleCacheKey **cache, ListBase *bufs)
 
ParticleSystempsys_get_current (Object *ob)
 
short psys_get_current_num (Object *ob)
 
void psys_set_current_num (Object *ob, int index)
 
void psys_sim_data_init (ParticleSimulationData *sim)
 
void psys_sim_data_free (ParticleSimulationData *sim)
 
void psys_disable_all (Object *ob)
 
void psys_enable_all (Object *ob)
 
ParticleSystempsys_orig_get (ParticleSystem *psys)
 
struct ParticleSystempsys_eval_get (Depsgraph *depsgraph, Object *object, ParticleSystem *psys)
 
static PTCacheEditpsys_orig_edit_get (ParticleSystem *psys)
 
bool psys_in_edit_mode (Depsgraph *depsgraph, const ParticleSystem *psys)
 
bool psys_check_enabled (Object *ob, ParticleSystem *psys, const bool use_render_params)
 
bool psys_check_edited (ParticleSystem *psys)
 
void psys_find_group_weights (ParticleSettings *part)
 
void psys_check_group_weights (ParticleSettings *part)
 
int psys_uses_gravity (ParticleSimulationData *sim)
 
void free_hair (Object *object, ParticleSystem *psys, int dynamics)
 
void free_keyed_keys (ParticleSystem *psys)
 
static void free_child_path_cache (ParticleSystem *psys)
 
void psys_free_path_cache (ParticleSystem *psys, PTCacheEdit *edit)
 
void psys_free_children (ParticleSystem *psys)
 
void psys_free_particles (ParticleSystem *psys)
 
void psys_free_pdd (ParticleSystem *psys)
 
void psys_free (Object *ob, ParticleSystem *psys)
 
void psys_copy_particles (ParticleSystem *psys_dst, ParticleSystem *psys_src)
 
static float interpolate_particle_value (float v1, float v2, float v3, float v4, const float w[4], int four)
 
void psys_interpolate_particle (short type, ParticleKey keys[4], float dt, ParticleKey *result, bool velocity)
 
static void get_pointcache_keys_for_time (Object *UNUSED(ob), PointCache *cache, PTCacheMem **cur, int index, float t, ParticleKey *key1, ParticleKey *key2)
 
static int get_pointcache_times_for_particle (PointCache *cache, int index, float *r_start, float *r_dietime)
 
float psys_get_dietime_from_cache (PointCache *cache, int index)
 
static void init_particle_interpolation (Object *ob, ParticleSystem *psys, ParticleData *pa, ParticleInterpolationData *pind)
 
static void edit_to_particle (ParticleKey *key, PTCacheEditKey *ekey)
 
static void hair_to_particle (ParticleKey *key, HairKey *hkey)
 
static void mvert_to_particle (ParticleKey *key, MVert *mvert, HairKey *hkey)
 
static void do_particle_interpolation (ParticleSystem *psys, int p, ParticleData *pa, float t, ParticleInterpolationData *pind, ParticleKey *result)
 
static void interpolate_pathcache (ParticleCacheKey *first, float t, ParticleCacheKey *result)
 
void psys_interpolate_face (Mesh *mesh, MVert *mvert, const float(*vert_normals)[3], MFace *mface, MTFace *tface, const float(*orcodata)[3], float w[4], float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3])
 
void psys_interpolate_uvs (const MTFace *tface, int quad, const float w[4], float uvco[2])
 
void psys_interpolate_mcol (const MCol *mcol, int quad, const float w[4], MCol *mc)
 
static float psys_interpolate_value_from_verts (Mesh *mesh, short from, int index, const float fw[4], const float *values)
 
static void psys_w_to_origspace (const float w[4], float uv[2])
 
static void psys_origspace_to_w (OrigSpaceFace *osface, int quad, const float w[4], float neww[4])
 
int psys_particle_dm_face_lookup (Mesh *mesh_final, Mesh *mesh_original, int findex_orig, const float fw[4], struct LinkNode **poly_nodes)
 
static int psys_map_index_on_dm (Mesh *mesh, int from, int index, int index_dmcache, const float fw[4], float UNUSED(foffset), int *mapindex, float mapfw[4])
 
void psys_particle_on_dm (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])
 
float psys_particle_value_from_verts (Mesh *mesh, short from, ParticleData *pa, float *values)
 
ParticleSystemModifierDatapsys_get_modifier (Object *ob, ParticleSystem *psys)
 
static void psys_particle_on_shape (int UNUSED(distr), int UNUSED(index), float *UNUSED(fuv), float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3])
 
void psys_emitter_customdata_mask (ParticleSystem *psys, CustomData_MeshMasks *r_cddata_masks)
 
void psys_particle_on_emitter (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])
 
void precalc_guides (ParticleSimulationData *sim, ListBase *effectors)
 
bool do_guides (Depsgraph *depsgraph, ParticleSettings *part, ListBase *effectors, ParticleKey *state, int index, float time)
 
static void do_path_effectors (ParticleSimulationData *sim, int i, ParticleCacheKey *ca, int k, int steps, float *UNUSED(rootco), float effector, float UNUSED(dfra), float UNUSED(cfra), float *length, float *vec)
 
static void offset_child (ChildParticle *cpa, ParticleKey *par, float *par_rot, ParticleKey *child, float flat, float radius)
 
floatpsys_cache_vgroup (Mesh *mesh, ParticleSystem *psys, int vgroup)
 
void psys_find_parents (ParticleSimulationData *sim, const bool use_render_params)
 
static bool psys_thread_context_init_path (ParticleThreadContext *ctx, ParticleSimulationData *sim, Scene *scene, float cfra, const bool editupdate, const bool use_render_params)
 
static void psys_task_init_path (ParticleTask *task, ParticleSimulationData *sim)
 
static void psys_thread_create_path (ParticleTask *task, struct ChildParticle *cpa, ParticleCacheKey *child_keys, int i)
 
static void exec_child_path_cache (TaskPool *__restrict UNUSED(pool), void *taskdata)
 
void psys_cache_child_paths (ParticleSimulationData *sim, float cfra, const bool editupdate, const bool use_render_params)
 
static void cache_key_incremental_rotation (ParticleCacheKey *key0, ParticleCacheKey *key1, ParticleCacheKey *key2, float *prev_tangent, int i)
 
void psys_cache_paths (ParticleSimulationData *sim, float cfra, const bool use_render_params)
 
static void psys_cache_edit_paths_iter (void *__restrict iter_data_v, const int iter, const TaskParallelTLS *__restrict UNUSED(tls))
 
void psys_cache_edit_paths (Depsgraph *depsgraph, Scene *scene, Object *ob, PTCacheEdit *edit, float cfra, const bool use_render_params)
 
void copy_particle_key (ParticleKey *to, ParticleKey *from, int time)
 
void psys_get_from_key (ParticleKey *key, float loc[3], float vel[3], float rot[4], float *time)
 
static void triatomat (float *v1, float *v2, float *v3, const float(*uv)[2], float mat[4][4])
 
static void psys_face_mat (Object *ob, Mesh *mesh, ParticleData *pa, float mat[4][4], int orco)
 
void psys_mat_hair_to_object (Object *UNUSED(ob), Mesh *mesh, short from, ParticleData *pa, float hairmat[4][4])
 
void psys_mat_hair_to_orco (Object *ob, Mesh *mesh, short from, ParticleData *pa, float hairmat[4][4])
 
void psys_vec_rot_to_face (Mesh *mesh, ParticleData *pa, float vec[3])
 
void psys_mat_hair_to_global (Object *ob, Mesh *mesh, short from, ParticleData *pa, float hairmat[4][4])
 
static ModifierDataobject_add_or_copy_particle_system (Main *bmain, Scene *scene, Object *ob, const char *name, const ParticleSystem *psys_orig)
 
ModifierDataobject_add_particle_system (Main *bmain, Scene *scene, Object *ob, const char *name)
 
ModifierDataobject_copy_particle_system (Main *bmain, Scene *scene, Object *ob, const ParticleSystem *psys_orig)
 
void object_remove_particle_system (Main *bmain, Scene *UNUSED(scene), Object *ob, ParticleSystem *psys)
 
ParticleSettingsBKE_particlesettings_add (Main *bmain, const char *name)
 
void BKE_particlesettings_clump_curve_init (ParticleSettings *part)
 
void BKE_particlesettings_rough_curve_init (ParticleSettings *part)
 
void BKE_particlesettings_twist_curve_init (ParticleSettings *part)
 
static int get_particle_uv (Mesh *mesh, ParticleData *pa, int index, const float fuv[4], char *name, float *texco, bool from_vert)
 
void psys_get_texture (ParticleSimulationData *sim, ParticleData *pa, ParticleTexture *ptex, int event, float cfra)
 
float psys_get_timestep (ParticleSimulationData *sim)
 
float psys_get_child_time (ParticleSystem *psys, ChildParticle *cpa, float cfra, float *birthtime, float *dietime)
 
float psys_get_child_size (ParticleSystem *psys, ChildParticle *cpa, float UNUSED(cfra), float *UNUSED(pa_time))
 
void psys_get_particle_on_path (ParticleSimulationData *sim, int p, ParticleKey *state, const bool vel)
 
bool psys_get_particle_state (ParticleSimulationData *sim, int p, ParticleKey *state, const bool always)
 
void psys_get_dupli_texture (ParticleSystem *psys, ParticleSettings *part, ParticleSystemModifierData *psmd, ParticleData *pa, ChildParticle *cpa, float uv[2], float orco[3])
 
void psys_get_dupli_path_transform (ParticleSimulationData *sim, ParticleData *pa, ChildParticle *cpa, ParticleCacheKey *cache, float mat[4][4], float *scale)
 
void psys_apply_hair_lattice (Depsgraph *depsgraph, Scene *scene, Object *ob, ParticleSystem *psys)
 
void BKE_particle_batch_cache_dirty_tag (ParticleSystem *psys, int mode)
 
void BKE_particle_batch_cache_free (ParticleSystem *psys)
 
void BKE_particle_system_blend_write (BlendWriter *writer, ListBase *particles)
 
void BKE_particle_system_blend_read_data (BlendDataReader *reader, ListBase *particles)
 
void BKE_particle_system_blend_read_lib (BlendLibReader *reader, Object *ob, ID *id, ListBase *particles)
 

Variables

IDTypeInfo IDType_ID_PA
 
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 )(ParticleSystem *psys, int mode) = NULL
 
void(* BKE_particle_batch_cache_free_cb )(ParticleSystem *psys) = NULL
 

Macro Definition Documentation

◆ CLAMP_PARTICLE_TEXTURE_POS

#define CLAMP_PARTICLE_TEXTURE_POS (   type,
  pvalue 
)
Value:
if (event & type) { \
CLAMP(pvalue, 0.0f, 1.0f); \
} \
(void)0
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
SyclQueue void void size_t num_bytes void

Definition at line 4241 of file particle.c.

◆ CLAMP_PARTICLE_TEXTURE_POSNEG

#define CLAMP_PARTICLE_TEXTURE_POSNEG (   type,
  pvalue 
)
Value:
if (event & type) { \
CLAMP(pvalue, -1.0f, 1.0f); \
} \
(void)0

Definition at line 4256 of file particle.c.

◆ CLAMP_WARP_PARTICLE_TEXTURE_POS

#define CLAMP_WARP_PARTICLE_TEXTURE_POS (   type,
  pvalue 
)
Value:
if (event & type) { \
if (pvalue < 0.0f) { \
pvalue = 1.0f + pvalue; \
} \
CLAMP(pvalue, 0.0f, 1.0f); \
} \
(void)0

Definition at line 4247 of file particle.c.

◆ DNA_DEPRECATED_ALLOW

#define DNA_DEPRECATED_ALLOW

Definition at line 9 of file particle.c.

◆ PATH_CACHE_BUF_SIZE

#define PATH_CACHE_BUF_SIZE   1024

Definition at line 583 of file particle.c.

◆ SET_PARTICLE_TEXTURE

#define SET_PARTICLE_TEXTURE (   type,
  pvalue,
  texfac 
)
Value:
if ((event & mtex->mapto) & type) { \
pvalue = texture_value_blend(def, pvalue, value, texfac, blend); \
} \
(void)0
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)
float texture_value_blend(float tex, float out, float fact, float facg, int blendtype)

Definition at line 4235 of file particle.c.

Typedef Documentation

◆ CacheEditrPathsIterData

◆ ParticleInterpolationData

Function Documentation

◆ BKE_particle_batch_cache_dirty_tag()

void BKE_particle_batch_cache_dirty_tag ( ParticleSystem psys,
int  mode 
)

◆ BKE_particle_batch_cache_free()

void BKE_particle_batch_cache_free ( ParticleSystem psys)

Definition at line 5280 of file particle.c.

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 ( BlendDataReader UNUSEDreader,
PartDeflect pd 
)

Definition at line 301 of file particle.c.

References NULL, and PartDeflect::rng.

Referenced by particle_settings_blend_read_data().

◆ BKE_particle_partdeflect_blend_read_lib()

void BKE_particle_partdeflect_blend_read_lib ( BlendLibReader reader,
ID id,
PartDeflect pd 
)

◆ BKE_particle_system_blend_read_data()

void BKE_particle_system_blend_read_data ( BlendDataReader reader,
ListBase particles 
)

◆ BKE_particle_system_blend_read_lib()

void BKE_particle_system_blend_read_lib ( BlendLibReader reader,
Object ob,
ID id,
ListBase particles 
)

◆ BKE_particle_system_blend_write()

void BKE_particle_system_blend_write ( BlendWriter writer,
ListBase particles 
)

◆ BKE_particlesettings_add()

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

◆ BKE_particlesettings_clump_curve_init()

void BKE_particlesettings_clump_curve_init ( ParticleSettings part)

◆ BKE_particlesettings_rough_curve_init()

void BKE_particlesettings_rough_curve_init ( ParticleSettings part)

◆ BKE_particlesettings_twist_curve_init()

void BKE_particlesettings_twist_curve_init ( ParticleSettings part)

◆ cache_key_incremental_rotation()

static void cache_key_incremental_rotation ( ParticleCacheKey key0,
ParticleCacheKey key1,
ParticleCacheKey key2,
float prev_tangent,
int  i 
)
static

◆ copy_particle_key()

void copy_particle_key ( ParticleKey to,
ParticleKey from,
int  time 
)

◆ count_particles()

int count_particles ( ParticleSystem psys)

◆ count_particles_mod()

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

◆ do_guides()

bool do_guides ( Depsgraph depsgraph,
ParticleSettings part,
ListBase effectors,
ParticleKey state,
int  index,
float  time 
)

◆ do_particle_interpolation()

static void do_particle_interpolation ( ParticleSystem psys,
int  p,
ParticleData pa,
float  t,
ParticleInterpolationData pind,
ParticleKey result 
)
static

◆ do_path_effectors()

static void do_path_effectors ( ParticleSimulationData sim,
int  i,
ParticleCacheKey ca,
int  k,
int  steps,
float UNUSEDrootco,
float  effector,
float   UNUSEDdfra,
float   UNUSEDcfra,
float length,
float vec 
)
static

◆ edit_to_particle()

static void edit_to_particle ( ParticleKey key,
PTCacheEditKey ekey 
)
static

◆ exec_child_path_cache()

static void exec_child_path_cache ( TaskPool *__restrict   UNUSEDpool,
void taskdata 
)
static

◆ fluid_free_settings()

static void fluid_free_settings ( SPHFluidSettings fluid)
static

Definition at line 929 of file particle.c.

References MEM_freeN.

Referenced by particle_settings_free_data().

◆ free_child_path_cache()

static void free_child_path_cache ( ParticleSystem psys)
static

◆ free_hair()

void free_hair ( Object object,
ParticleSystem psys,
int  dynamics 
)

◆ free_keyed_keys()

void free_keyed_keys ( ParticleSystem psys)

◆ get_child_modifier_parameters()

static void get_child_modifier_parameters ( ParticleSettings part,
ParticleThreadContext ctx,
ChildParticle cpa,
short  cpa_from,
int  cpa_num,
float cpa_fuv,
float orco,
ParticleTexture ptex 
)
static

◆ get_cpa_texture()

static void get_cpa_texture ( Mesh mesh,
ParticleSystem psys,
ParticleSettings part,
ParticleData par,
int  child_index,
int  face_index,
const float  fw[4],
float orco,
ParticleTexture ptex,
int  event,
float  cfra 
)
static

Definition at line 4262 of file particle.c.

References ATTR_FALLTHROUGH, blend(), MTex::blendtype, CLAMP_PARTICLE_TEXTURE_POS, CLAMP_WARP_PARTICLE_TEXTURE_POS, ParticleSettings::clength, ParticleSettings::clength_thres, ParticleTexture::clump, MTex::clumpfac, ParticleKey::co, copy_v3_v3(), ParticleTexture::damp, MTex::def_var, ParticleData::dietime, ParticleSettings::distr, ParticleTexture::effector, ELEM, ParticleTexture::exist, ParticleTexture::field, ParticleSettings::from, get_particle_uv(), ParticleTexture::gravity, Object::imat, ParticleTexture::ivel, ParticleTexture::kink_amp, ParticleTexture::kink_freq, MTex::kinkampfac, MTex::kinkfac, ParticleTexture::length, MTex::lengthfac, ParticleTexture::life, MTex::mapto, MAX_MTEX, mesh, ParticleSettings::mtex, mul_m4_v3(), NULL, MTex::object, MTex::padensfac, PAMAP_CLUMP, PAMAP_DENS, PAMAP_KINK_AMP, PAMAP_KINK_FREQ, PAMAP_LENGTH, PAMAP_ROUGH, PAMAP_TWIST, PART_DISTR_GRID, PART_FROM_FACE, PART_FROM_VERT, PART_FROM_VOLUME, psys_frand(), ParticleSettings::randlength, RE_texture_evaluate(), usdtokens::rgba(), ParticleTexture::rough1, ParticleTexture::rough2, ParticleTexture::roughe, MTex::roughfac, SET_PARTICLE_TEXTURE, ParticleTexture::size, ParticleData::state, MTex::tex, MTex::texco, TEXCO_GLOB, TEXCO_OBJECT, TEXCO_ORCO, TEXCO_PARTICLE, TEXCO_UV, texture_value_blend(), ParticleTexture::time, ParticleData::time, ParticleTexture::twist, MTex::twistfac, and MTex::uvname.

Referenced by get_child_modifier_parameters(), and psys_find_parents().

◆ get_particle_uv()

static int get_particle_uv ( Mesh mesh,
ParticleData pa,
int  index,
const float  fuv[4],
char *  name,
float texco,
bool  from_vert 
)
static

◆ get_pointcache_keys_for_time()

static void get_pointcache_keys_for_time ( Object UNUSEDob,
PointCache cache,
PTCacheMem **  cur,
int  index,
float  t,
ParticleKey key1,
ParticleKey key2 
)
static

Assumes pointcache->mem_cache exists, so for disk cached particles call psys_make_temp_pointcache() before use. It uses ParticleInterpolationData.pm to store the current memory cache frame so it's thread safe.

Definition at line 1287 of file particle.c.

References BKE_ptcache_make_particle_key(), BKE_ptcache_mem_index_find(), copy_particle_key(), PTCacheMem::data, ListBase::first, PTCacheMem::frame, PointCache::mem_cache, PTCacheMem::next, NULL, PTCacheMem::prev, and t.

Referenced by do_particle_interpolation(), and init_particle_interpolation().

◆ get_pointcache_times_for_particle()

static int get_pointcache_times_for_particle ( PointCache cache,
int  index,
float r_start,
float r_dietime 
)
static

◆ hair_to_particle()

static void hair_to_particle ( ParticleKey key,
HairKey hkey 
)
static

◆ init_particle_interpolation()

static void init_particle_interpolation ( Object ob,
ParticleSystem psys,
ParticleData pa,
ParticleInterpolationData pind 
)
static

◆ interpolate_particle_value()

static float interpolate_particle_value ( float  v1,
float  v2,
float  v3,
float  v4,
const float  w[4],
int  four 
)
static

Definition at line 1216 of file particle.c.

References CLAMP, v1, v2, and w().

Referenced by psys_interpolate_value_from_verts().

◆ interpolate_pathcache()

static void interpolate_pathcache ( ParticleCacheKey first,
float  t,
ParticleCacheKey result 
)
static

◆ mvert_to_particle()

static void mvert_to_particle ( ParticleKey key,
MVert mvert,
HairKey hkey 
)
static

Definition at line 1444 of file particle.c.

References MVert::co, ParticleKey::co, copy_v3_v3(), HairKey::time, and ParticleKey::time.

Referenced by do_particle_interpolation().

◆ object_add_or_copy_particle_system()

static ModifierData* object_add_or_copy_particle_system ( Main bmain,
Scene scene,
Object ob,
const char *  name,
const ParticleSystem psys_orig 
)
static

◆ object_add_particle_system()

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

◆ object_copy_particle_system()

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

Definition at line 4007 of file particle.c.

References NULL, object_add_or_copy_particle_system(), and scene.

◆ object_remove_particle_system()

void object_remove_particle_system ( Main bmain,
Scene UNUSEDscene,
Object ob,
ParticleSystem psys 
)

◆ offset_child()

static void offset_child ( ChildParticle cpa,
ParticleKey par,
float par_rot,
ParticleKey child,
float  flat,
float  radius 
)
static

◆ particle_settings_blend_read_data()

static void particle_settings_blend_read_data ( BlendDataReader reader,
ID id 
)
static

◆ particle_settings_blend_read_expand()

static void particle_settings_blend_read_expand ( BlendExpander expander,
ID id 
)
static

◆ particle_settings_blend_read_lib()

static void particle_settings_blend_read_lib ( BlendLibReader reader,
ID id 
)
static

◆ particle_settings_blend_write()

static void particle_settings_blend_write ( BlendWriter writer,
ID id,
const void id_address 
)
static

◆ particle_settings_copy_data()

static void particle_settings_copy_data ( Main UNUSEDbmain,
ID id_dst,
const ID id_src,
const int   UNUSEDflag 
)
static

◆ particle_settings_foreach_id()

static void particle_settings_foreach_id ( ID id,
LibraryForeachIDData data 
)
static

◆ particle_settings_free_data()

static void particle_settings_free_data ( ID id)
static

◆ particle_settings_init()

static void particle_settings_init ( ID id)
static

◆ pcache_key_segment_endpoint_safe()

static ParticleCacheKey* pcache_key_segment_endpoint_safe ( ParticleCacheKey key)
static

Definition at line 585 of file particle.c.

References ParticleCacheKey::segments.

Referenced by psys_thread_create_path().

◆ precalc_guides()

void precalc_guides ( ParticleSimulationData sim,
ListBase effectors 
)

◆ psys_alloc_path_cache_buffers()

static ParticleCacheKey** psys_alloc_path_cache_buffers ( ListBase bufs,
int  tot,
int  totkeys 
)
static

◆ psys_apply_hair_lattice()

void psys_apply_hair_lattice ( Depsgraph depsgraph,
Scene scene,
Object ob,
ParticleSystem psys 
)

◆ psys_cache_child_paths()

void psys_cache_child_paths ( ParticleSimulationData sim,
float  cfra,
const bool  editupdate,
const bool  use_render_params 
)

◆ psys_cache_edit_paths()

void psys_cache_edit_paths ( Depsgraph depsgraph,
Scene scene,
Object ob,
PTCacheEdit edit,
float  cfra,
const bool  use_render_params 
)

◆ psys_cache_edit_paths_iter()

static void psys_cache_edit_paths_iter ( void *__restrict  iter_data_v,
const int  iter,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ psys_cache_paths()

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 3306 of file particle.c.

References col, ParticleSystem::flag, ParticleSystem::hair_out_mesh, NULL, ParticleSystem::part, PART_HAIR, ToolSettings::particle, PARTICLE_P, PARTICLE_PSMD, ParticleSimulationData::psys, PSYS_HAIR_DYNAMICS, result, ParticleSimulationData::scene, t, time, Scene::toolsettings, and ParticleSettings::type.

Referenced by psys_update_path_cache().

◆ psys_cache_vgroup()

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

◆ psys_check_edited()

bool psys_check_edited ( ParticleSystem psys)

◆ psys_check_enabled()

bool psys_check_enabled ( Object ob,
ParticleSystem psys,
const bool  use_render_params 
)

◆ psys_check_group_weights()

void psys_check_group_weights ( ParticleSettings part)

◆ psys_copy_particles()

void psys_copy_particles ( struct ParticleSystem psys_dst,
struct ParticleSystem psys_src 
)

◆ psys_disable_all()

void psys_disable_all ( Object ob)

◆ psys_emitter_customdata_mask()

void psys_emitter_customdata_mask ( ParticleSystem psys,
CustomData_MeshMasks r_cddata_masks 
)

◆ psys_enable_all()

void psys_enable_all ( 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 761 of file particle.c.

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

Referenced by BKE_ptcache_bake(), disconnect_hair(), ED_object_modifier_convert_psys_to_mesh(), PE_create_particle_edit(), and remap_hair_emitter().

◆ psys_face_mat()

static void psys_face_mat ( Object ob,
Mesh mesh,
ParticleData pa,
float  mat[4][4],
int  orco 
)
static

◆ psys_find_group_weights()

void psys_find_group_weights ( ParticleSettings part)

◆ psys_find_parents()

void psys_find_parents ( ParticleSimulationData sim,
const bool  use_render_params 
)

◆ psys_free()

void psys_free ( struct Object ob,
struct ParticleSystem psys 
)

◆ psys_free_children()

void psys_free_children ( ParticleSystem psys)

◆ psys_free_particles()

void psys_free_particles ( ParticleSystem psys)

◆ psys_free_path_cache()

void psys_free_path_cache ( struct ParticleSystem psys,
struct PTCacheEdit edit 
)

◆ psys_free_path_cache_buffers()

static void psys_free_path_cache_buffers ( ParticleCacheKey **  cache,
ListBase bufs 
)
static

◆ psys_free_pdd()

void psys_free_pdd ( ParticleSystem psys)

◆ psys_get_child_size()

float psys_get_child_size ( ParticleSystem psys,
ChildParticle cpa,
float   UNUSEDcfra,
float UNUSEDpa_time 
)

◆ psys_get_child_time()

float psys_get_child_time ( ParticleSystem psys,
ChildParticle cpa,
float  cfra,
float birthtime,
float dietime 
)

◆ psys_get_current()

ParticleSystem* psys_get_current ( struct Object ob)

◆ psys_get_current_num()

short psys_get_current_num ( Object ob)

◆ psys_get_dietime_from_cache()

float psys_get_dietime_from_cache ( PointCache cache,
int  index 
)

◆ psys_get_dupli_path_transform()

void psys_get_dupli_path_transform ( ParticleSimulationData sim,
ParticleData pa,
ChildParticle cpa,
ParticleCacheKey cache,
float  mat[4][4],
float scale 
)

◆ psys_get_dupli_texture()

void psys_get_dupli_texture ( ParticleSystem psys,
ParticleSettings part,
ParticleSystemModifierData psmd,
ParticleData pa,
ChildParticle cpa,
float  uv[2],
float  orco[3] 
)

◆ psys_get_from_key()

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

◆ psys_get_modifier()

ParticleSystemModifierData* psys_get_modifier ( Object ob,
ParticleSystem psys 
)

◆ 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 4615 of file particle.c.

References BKE_lattice_deform_data_eval_co(), BKE_object_material_get(), ParticleInterpolationData::bspline, ParticleInterpolationData::cache, ParticleSystem::child, ParticleSystem::childcache, ParticleSettings::childflat, ParticleSettings::childrad, ParticleSettings::childtype, 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(), blender::math::length(), ParticleThreadContext::ma, ParticleThreadContext::mesh, ParticleInterpolationData::mesh, ParticleSystemModifierData::mesh_final, mul_m4_v3(), mul_mat3_m4_v3(), mul_v3_fl(), normalize_v3(), NULL, ChildParticle::num, ParticleData::num, ParticleData::num_dmcache, ParticleSimulationData::ob, Object::obmat, offset_child(), ParticleSettings::omat, 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, ParticleSettings::phystype, 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, ParticleThreadContext::sim, ParticleChildModifierContext::sim, state, sub_v3_v3v3(), t, ParticleChildModifierContext::thread_ctx, ParticleKey::time, ParticleData::time, ParticleSystem::totchild, ParticleSystem::totpart, ParticleSettings::type, unit_m4(), ParticleKey::vel, w(), and ChildParticle::w.

Referenced by brush_add(), modifyMesh(), 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 4884 of file particle.c.

References BKE_lattice_deform_data_eval_co(), ParticleSystem::child, ParticleSystem::childcache, ParticleSettings::childflat, ParticleSettings::childrad, ParticleSettings::childtype, CLAMP, ParticleChildModifierContext::cpa, DEG_get_ctime(), ParticleSimulationData::depsgraph, ParticleData::dietime, do_child_modifiers(), ParticleSettings::end, ParticleSettings::flag, ParticleSystem::flag, ChildParticle::fuv, ParticleSystem::lattice_deform_data, ParticleSystem::lattice_strength, ParticleData::lifetime, ParticleSettings::lifetime, MIN2, NULL, 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_UNBORN, ParticleSystem::particles, ParticleSimulationData::psys, psys_frand(), psys_get_child_time(), psys_get_particle_on_path(), psys_get_timestep(), PSYS_KEYED, ParticleChildModifierContext::ptex, ParticleChildModifierContext::sim, ParticleSettings::sta, state, ParticleData::state, t, ParticleChildModifierContext::thread_ctx, time, ParticleData::time, ParticleSystem::totchild, ParticleSystem::totpart, and unit_m4().

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

◆ psys_get_texture()

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

Definition at line 4355 of file particle.c.

References ATTR_FALLTHROUGH, BKE_mesh_texspace_ensure(), blend(), CLAMP_PARTICLE_TEXTURE_POS, CLAMP_PARTICLE_TEXTURE_POSNEG, CLAMP_WARP_PARTICLE_TEXTURE_POS, ParticleTexture::clump, ParticleKey::co, copy_v3_v3(), ParticleTexture::damp, Object::data, ParticleData::dietime, ParticleTexture::effector, ELEM, ParticleTexture::exist, fabsf, ParticleTexture::field, float(), ParticleData::foffset, ParticleSettings::from, ParticleData::fuv, get_particle_uv(), ParticleTexture::gravity, ParticleTexture::ivel, ParticleTexture::kink_amp, ParticleTexture::kink_freq, ParticleTexture::length, ParticleTexture::life, Mesh::loc, MAX_MTEX, ParticleSystemModifierData::mesh_final, mul_m4_v3(), NULL, ParticleData::num, ParticleData::num_dmcache, ParticleSimulationData::ob, 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(), usdtokens::rgba(), ParticleTexture::rough1, ParticleTexture::rough2, ParticleTexture::roughe, SET_PARTICLE_TEXTURE, ParticleTexture::size, Mesh::size, ParticleData::state, sub_v3_v3(), TEXCO_GLOB, TEXCO_OBJECT, TEXCO_ORCO, TEXCO_PARTICLE, TEXCO_UV, texture_value_blend(), ParticleTexture::time, ParticleData::time, ParticleSystem::totpart, and ParticleTexture::twist.

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

◆ psys_get_timestep()

float psys_get_timestep ( ParticleSimulationData sim)

◆ psys_in_edit_mode()

bool psys_in_edit_mode ( Depsgraph depsgraph,
const ParticleSystem psys 
)

◆ psys_interpolate_face()

void psys_interpolate_face ( struct Mesh mesh,
struct MVert mvert,
const float(*)  vert_normals[3],
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] 
)

◆ psys_interpolate_mcol()

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

Definition at line 1840 of file particle.c.

References quad, and w().

◆ psys_interpolate_particle()

void psys_interpolate_particle ( short  type,
ParticleKey  keys[4],
float  dt,
ParticleKey result,
bool  velocity 
)

◆ psys_interpolate_uvs()

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

Definition at line 1817 of file particle.c.

References quad, MTFace::uv, and w().

Referenced by get_particle_uv(), and psys_get_dupli_texture().

◆ psys_interpolate_value_from_verts()

static float psys_interpolate_value_from_verts ( Mesh mesh,
short  from,
int  index,
const float  fw[4],
const float values 
)
static

◆ psys_map_index_on_dm()

static int psys_map_index_on_dm ( Mesh mesh,
int  from,
int  index,
int  index_dmcache,
const float  fw[4],
float   UNUSEDfoffset,
int *  mapindex,
float  mapfw[4] 
)
static

◆ psys_mat_hair_to_global()

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

◆ psys_mat_hair_to_object()

void psys_mat_hair_to_object ( Object UNUSEDob,
Mesh mesh,
short  from,
ParticleData pa,
float  hairmat[4][4] 
)

◆ psys_mat_hair_to_orco()

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

◆ psys_orig_edit_get()

static PTCacheEdit* psys_orig_edit_get ( ParticleSystem psys)
static

◆ psys_orig_get()

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 753 of file particle.c.

References NULL, and ParticleSystem::orig_psys.

Referenced by drw_particle_get_hair_source(), particle_system_update(), and psys_in_edit_mode().

◆ psys_origspace_to_w()

static void psys_origspace_to_w ( OrigSpaceFace osface,
int  quad,
const float  w[4],
float  neww[4] 
)
static

Definition at line 1894 of file particle.c.

References interp_weights_poly_v3(), psys_w_to_origspace(), quad, OrigSpaceFace::uv, v, and w().

Referenced by psys_map_index_on_dm().

◆ 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 MPoly 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 polygon, containing all its tessfaces indices.
Returns
The mesh_final tessface index.

Definition at line 1923 of file particle.c.

References BKE_mesh_origindex_mface_mpoly(), BLI_assert, CD_ORIGINDEX, CD_ORIGSPACE, CustomData_get_layer(), Mesh_Runtime::deformed_only, DMCACHE_NOTFOUND, ELEM, Mesh::fdata, float(), isect_point_quad_v2(), isect_point_tri_v2(), LinkNode::link, Mesh::mface, LinkNode::next, NULL, Mesh::pdata, POINTER_AS_INT, psys_w_to_origspace(), Mesh::runtime, Mesh::totface, and OrigSpaceFace::uv.

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

◆ psys_particle_on_dm()

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] 
)

◆ psys_particle_on_emitter()

void psys_particle_on_emitter ( 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] 
)

◆ psys_particle_on_shape()

static void psys_particle_on_shape ( int   UNUSEDdistr,
int   UNUSEDindex,
float UNUSEDfuv,
float  vec[3],
float  nor[3],
float  utan[3],
float  vtan[3],
float  orco[3] 
)
static

Definition at line 2251 of file particle.c.

References copy_v3_v3(), and nor.

Referenced by psys_particle_on_emitter().

◆ psys_particle_value_from_verts()

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

◆ psys_set_current_num()

void psys_set_current_num ( Object ob,
int  index 
)

◆ psys_sim_data_free()

void psys_sim_data_free ( ParticleSimulationData sim)

◆ psys_sim_data_init()

void psys_sim_data_init ( struct ParticleSimulationData sim)

◆ psys_task_init_path()

static void psys_task_init_path ( ParticleTask task,
ParticleSimulationData sim 
)
static

◆ psys_thread_context_init_path()

static bool psys_thread_context_init_path ( ParticleThreadContext ctx,
ParticleSimulationData sim,
Scene scene,
float  cfra,
const bool  editupdate,
const bool  use_render_params 
)
static

Definition at line 2735 of file particle.c.

References ParticleThreadContext::between, BKE_curvemapping_changed_all(), BKE_curvemapping_copy(), ParticleThreadContext::cfra, ParticleSettings::child_flag, ParticleSettings::child_percent, ParticleSettings::child_render_percent, ParticleSettings::childtype, ParticleThreadContext::clumpcurve, ParticleSettings::clumpcurve, ParticleSimulationData::depsgraph, ParticleSettings::disp, ParticleSettings::draw_step, ParticleEditSettings::draw_step, ParticleThreadContext::editupdate, ELEM, ParticleThreadContext::extra_segments, ParticleSettings::flag, ParticleEditSettings::flag, float(), ParticleSettings::kink, ParticleSettings::kink_extra_steps, max_ii(), ParticleThreadContext::mesh, MIN2, NULL, ParticleThreadContext::parent_pass, ParticleSettings::parents, ParticleSystem::part, PART_CHILD_EFFECT, PART_CHILD_FACES, PART_CHILD_USE_CLUMP_CURVE, PART_CHILD_USE_ROUGH_CURVE, PART_CHILD_USE_TWIST_CURVE, PART_KINK_SPIRAL, ToolSettings::particle, PE_DRAW_PART, ParticleSimulationData::psys, psys_cache_vgroup(), psys_in_edit_mode(), psys_orig_edit_get(), psys_sim_data_init(), psys_thread_context_init(), PSYS_VG_CLUMP, PSYS_VG_EFFECTOR, PSYS_VG_KINK, PSYS_VG_LENGTH, PSYS_VG_ROUGH1, PSYS_VG_ROUGH2, PSYS_VG_ROUGHE, PSYS_VG_TWIST, ParticleSettings::ren_step, ParticleThreadContext::roughcurve, ParticleSettings::roughcurve, scene, ParticleThreadContext::segments, ParticleThreadContext::sim, Scene::toolsettings, ParticleThreadContext::totchild, ParticleSystem::totchild, ParticleThreadContext::totparent, ParticleThreadContext::twistcurve, ParticleSettings::twistcurve, ParticleThreadContext::vg_clump, ParticleThreadContext::vg_effector, ParticleThreadContext::vg_kink, ParticleThreadContext::vg_length, ParticleThreadContext::vg_rough1, ParticleThreadContext::vg_rough2, ParticleThreadContext::vg_roughe, and ParticleThreadContext::vg_twist.

Referenced by psys_cache_child_paths().

◆ psys_thread_create_path()

static void psys_thread_create_path ( ParticleTask task,
struct ChildParticle cpa,
ParticleCacheKey child_keys,
int  i 
)
static

Definition at line 2850 of file particle.c.

References add_v3_v3(), ParticleThreadContext::between, BLI_assert, BLI_listbase_clear(), ParticleThreadContext::cfra, ParticleSystem::childcache, ParticleSettings::childflat, ParticleSettings::childrad, CLAMP, ParticleCacheKey::co, copy_qt_qt(), copy_v3_v3(), ParticleSimulationData::depsgraph, DMCACHE_ISCHILD, DMCACHE_NOTFOUND, do_path_effectors(), dot_v3v3(), ParticleThreadContext::editupdate, ParticleTexture::effector, ELEM, ParticleTexture::exist, PTCacheEditPoint::flag, ParticleData::flag, ParticleSettings::flag, float(), ChildParticle::foffset, ParticleData::foffset, ParticleSettings::from, ChildParticle::fuv, ParticleData::fuv, get_child_modifier_parameters(), if(), interp_v3_v3v3v3v3(), interp_v4_v4v4(), len_v3(), len_v3v3(), madd_v3_v3fl(), ParticleSystemModifierData::mesh_final, mul_m4_v3(), mul_qt_qtqt(), mul_qt_v3(), normalize_v3(), NULL, ChildParticle::num, ParticleData::num, ParticleData::num_dmcache, ParticleSimulationData::ob, Object::obmat, offset_child(), ChildParticle::pa, ChildParticle::parent, ParticleSettings::parents, PARS_UNEXIST, ParticleSystem::part, PART_CHILD_EFFECT, PART_CHILD_LONG_HAIR, PART_FROM_FACE, ParticleSystem::particles, ParticleSettings::parting_fac, ParticleSettings::parting_max, ParticleSettings::parting_min, PTCacheEdit::pathcache, ParticleSystem::pathcache, pcache_key_segment_endpoint_safe(), PEP_EDIT_RECALC, PTCacheEdit::points, project_v3_v3v3(), ParticleSimulationData::psmd, ParticleSimulationData::psys, psys_apply_child_modifiers(), psys_frand(), psys_in_edit_mode(), psys_mat_hair_to_global(), psys_orig_edit_get(), psys_particle_on_emitter(), RAD2DEGF, rot, ParticleCacheKey::rot, saacos(), ParticleCacheKey::segments, ParticleThreadContext::segments, ParticleThreadContext::sim, sub_v3_v3v3(), blender::compositor::task, ParticleCacheKey::time, ParticleSystem::totchildcache, Mesh::totface, ParticleThreadContext::totparent, unit_qt(), v1, v2, ParticleCacheKey::vel, w(), ChildParticle::w, and zero_v3().

Referenced by exec_child_path_cache().

◆ psys_uses_gravity()

int psys_uses_gravity ( ParticleSimulationData sim)

◆ psys_vec_rot_to_face()

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

Definition at line 3926 of file particle.c.

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

Referenced by save_hair().

◆ psys_w_to_origspace()

static void psys_w_to_origspace ( const float  w[4],
float  uv[2] 
)
static

Definition at line 1887 of file particle.c.

References w().

Referenced by psys_origspace_to_w(), and psys_particle_dm_face_lookup().

◆ triatomat()

static void triatomat ( float v1,
float v2,
float v3,
const float(*)  uv[2],
float  mat[4][4] 
)
static

Definition at line 3817 of file particle.c.

References cross_v3_v3v3(), normal_tri_v3(), normalize_v3(), sub_v3_v3v3(), v1, and v2.

Referenced by psys_face_mat().

◆ write_boid_state()

static void write_boid_state ( BlendWriter writer,
BoidState state 
)
static

Variable Documentation

◆ BKE_particle_batch_cache_dirty_tag_cb

void(* BKE_particle_batch_cache_dirty_tag_cb) (ParticleSystem *psys, int mode) ( ParticleSystem psys,
int  mode 
) = NULL

Definition at line 5271 of file particle.c.

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) (ParticleSystem *psys) ( ParticleSystem psys) = NULL

Definition at line 5272 of file particle.c.

Referenced by BKE_particle_batch_cache_free(), and DRW_engines_register().

◆ IDType_ID_PA

IDTypeInfo IDType_ID_PA
Initial value:
= {
.id_code = ID_PA,
.id_filter = FILTER_ID_PA,
.main_listbase_index = INDEX_ID_PA,
.struct_size = sizeof(ParticleSettings),
.name = "ParticleSettings",
.name_plural = "particles",
.translation_context = BLT_I18NCONTEXT_ID_PARTICLESETTINGS,
.flags = 0,
.asset_type_info = NULL,
.make_local = NULL,
.foreach_cache = NULL,
.foreach_path = NULL,
.owner_get = NULL,
.blend_read_undo_preserve = NULL,
.lib_override_apply_post = NULL,
}
#define BLT_I18NCONTEXT_ID_PARTICLESETTINGS
@ INDEX_ID_PA
Definition: DNA_ID.h:1019
#define FILTER_ID_PA
Definition: DNA_ID.h:926
@ ID_PA
Definition: DNA_ID_enums.h:70
struct ParticleSettings ParticleSettings
static void init_data(ModifierData *md)
static void particle_settings_blend_read_data(BlendDataReader *reader, ID *id)
Definition: particle.c:308
static void particle_settings_init(ID *id)
Definition: particle.c:81
static void particle_settings_blend_read_expand(BlendExpander *expander, ID *id)
Definition: particle.c:430
static void particle_settings_blend_read_lib(BlendLibReader *reader, ID *id)
Definition: particle.c:369
static void particle_settings_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int UNUSED(flag))
Definition: particle.c:93
static void particle_settings_free_data(ID *id)
Definition: particle.c:129
static void particle_settings_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition: particle.c:241
static void particle_settings_foreach_id(ID *id, LibraryForeachIDData *data)
Definition: particle.c:158

Definition at line 479 of file particle.c.

◆ PSYS_FRAND_BASE

float PSYS_FRAND_BASE[PSYS_FRAND_COUNT]

Definition at line 511 of file particle.c.

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]

Definition at line 510 of file particle.c.

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]

Definition at line 509 of file particle.c.

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