38 #include "RNA_prototypes.h"
92 if (psmd->
psys == psys) {
95 if (useRenderParams) {
136 int totpart, randp, minp, maxp;
171 randp = (int)(
psys_frand(psys, 3578 + p) * totpart) % totpart;
177 return randp < minp || randp >= maxp;
180 return randp < minp && randp >= maxp;
191 vcol->
r = vcol->
g = vcol->
b = value;
203 MPoly *mpoly, *orig_mpoly;
204 MLoop *mloop, *orig_mloop;
205 MVert *mvert, *orig_mvert;
206 int totvert, totpoly, totloop, totedge;
207 int maxvert, maxpoly, maxloop, maxedge, part_end = 0, part_start;
210 float max_co = 0.0, min_co = 0.0, temp_co[3];
212 float spacemat[4][4];
234 part_start = use_parents ? 0 : psys->
totpart;
260 for (p = 0, pa = psys->
particles; p < psys->totpart; p++, pa++, si++) {
268 for (p = 0; p < psys->
totchild; p++, cpa++, si++) {
274 switch (pimd->
space) {
300 for (p = part_start; p < part_end; p++) {
334 int *vert_part_index =
NULL;
335 float *vert_part_value =
NULL;
336 if (mloopcols_index !=
NULL) {
337 vert_part_index =
MEM_calloc_arrayN(maxvert,
sizeof(
int),
"vertex part index array");
339 if (mloopcols_value) {
340 vert_part_value =
MEM_calloc_arrayN(maxvert,
sizeof(
float),
"vertex part value array");
343 for (p = part_start, p_skip = 0; p < part_end; p++) {
346 float p_random =
psys_frand(psys, 77091 + 283 * p);
354 for (k = 0; k < totvert; k++) {
357 int vindex = p_skip * totvert + k;
360 inMV = orig_mvert + k;
364 if (vert_part_index !=
NULL) {
365 vert_part_index[vindex] = p;
367 if (vert_part_value !=
NULL) {
368 vert_part_value[vindex] = p_random;
373 mv->co[axis] = temp_co[track];
374 mv->co[(axis + 1) % 3] = temp_co[(track + 1) % 3];
375 mv->co[(axis + 2) % 3] = temp_co[(track + 2) % 3];
389 state.time = (
mv->co[axis] - min_co) / (max_co - min_co) * pimd->
position * (1.0f - ran);
407 if (p < psys->totpart) {
423 const float eul[3] = {0.0f, 0.0f,
angle};
449 if (
state.vel[axis] < -0.9999f ||
state.vel[axis] > 0.9999f) {
454 float temp[3] = {0.0f, 0.0f, 0.0f};
481 for (k = 0; k < totedge; k++, me++) {
482 me->
v1 += p_skip * totvert;
483 me->
v2 += p_skip * totvert;
487 for (k = 0; k < totpoly; k++) {
489 MPoly *inMP = orig_mpoly + k;
490 MPoly *mp = mpoly + p_skip * totpoly + k;
502 for (; j; j--, ml++, inML++) {
503 ml->
v = inML->
v + (p_skip * totvert);
504 ml->
e = inML->
e + (p_skip * totedge);
505 const int ml_index = (ml - mloop);
506 if (mloopcols_index !=
NULL) {
507 const int part_index = vert_part_index[ml->
v];
509 (
float)part_index / (
float)(psys->
totpart - 1));
511 if (mloopcols_value !=
NULL) {
512 const float part_value = vert_part_value[ml->
v];
553 IFACE_(
"Particle System"),
557 uiItemR(layout,
ptr,
"particle_system_index", 0,
IFACE_(
"Particle System"), ICON_NONE);
590 uiItemR(layout,
ptr,
"use_path", 0,
IFACE_(
"Create Along Paths"), ICON_NONE);
629 col,
ptr,
"index_layer_name", &obj_data_ptr,
"vertex_colors",
IFACE_(
"Index"), ICON_NONE);
631 col,
ptr,
"value_layer_name", &obj_data_ptr,
"vertex_colors",
IFACE_(
"Value"), ICON_NONE);
644 N_(
"ParticleInstance"),
645 "ParticleInstanceModifierData",
647 &RNA_ParticleInstanceModifier,
651 ICON_MOD_PARTICLE_INSTANCE,
void * CustomData_get_layer_named(const struct CustomData *data, int type, const char *name)
void CustomData_copy_data(const struct CustomData *source, struct CustomData *dest, int source_index, int dest_index, int count)
struct Mesh * BKE_mesh_new_nomain_from_template(const struct Mesh *me_src, int verts_len, int edges_len, int tessface_len, int loops_len, int polys_len)
bool BKE_mesh_minmax(const struct Mesh *me, float r_min[3], float r_max[3])
bool BKE_modifier_is_enabled(const struct Scene *scene, struct ModifierData *md, int required_mode)
void(* IDWalkFunc)(void *userData, struct Object *ob, struct ID **idpoin, int cb_flag)
@ eModifierTypeFlag_SupportsMapping
@ eModifierTypeFlag_EnableInEditmode
@ eModifierTypeFlag_SupportsEditmode
@ eModifierTypeFlag_AcceptsMesh
void BKE_modifier_copydata_generic(const struct ModifierData *md, struct ModifierData *md_dst, int flag)
@ eModifierTypeType_Constructive
void psys_get_particle_on_path(struct ParticleSimulationData *sim, int pa_num, struct ParticleKey *state, bool vel)
void psys_mat_hair_to_global(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
void psys_sim_data_free(struct ParticleSimulationData *sim)
struct ParticleSystemModifierData * psys_get_modifier(struct Object *ob, struct ParticleSystem *psys)
float psys_get_child_size(struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra, float *pa_time)
void psys_sim_data_init(struct ParticleSimulationData *sim)
BLI_INLINE float psys_frand(ParticleSystem *psys, unsigned int seed)
bool psys_get_particle_state(struct ParticleSimulationData *sim, int p, struct ParticleKey *state, bool always)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float saacos(float fac)
void copy_m3_m4(float m1[3][3], const float m2[4][4])
void unit_m4(float m[4][4])
bool invert_m4_m4(float R[4][4], const float A[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2[3])
void axis_angle_to_quat(float r[4], const float axis[3], float angle)
void mat3_to_quat(float q[4], const float mat[3][3])
void mul_qt_v3(const float q[4], float r[3])
void eul_to_quat(float quat[4], const float eul[3])
void mul_qt_qtqt(float q[4], const float a[4], const float b[4])
void copy_qt_qt(float q[4], const float a[4])
MINLINE float normalize_v3(float r[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
float BLI_hash_frand(unsigned int seed) ATTR_WARN_UNUSED_RESULT
#define INIT_MINMAX(min, max)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
void DEG_add_object_relation(struct DepsNodeHandle *node_handle, struct Object *object, eDepsObjectComponentType component, const char *description)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
#define CD_MASK_PROP_BYTE_COLOR
#define DNA_struct_default_get(struct_name)
@ eParticleInstanceFlag_Parents
@ eParticleInstanceFlag_Alive
@ eParticleInstanceFlag_Dead
@ eParticleInstanceFlag_Children
@ eParticleInstanceFlag_Unborn
@ eParticleInstanceFlag_Path
@ eParticleInstanceFlag_UseSize
@ eParticleInstanceFlag_KeepShape
struct ParticleInstanceModifierData ParticleInstanceModifierData
@ eModifierType_ParticleSystem
@ eModifierType_ParticleInstance
@ eParticleInstanceSpace_World
@ eParticleInstanceSpace_Local
Read Guarded memory(de)allocation.
ModifierTypeInfo modifierType_ParticleInstance
static Mesh * modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
static bool isDisabled(const struct Scene *scene, ModifierData *md, bool useRenderParams)
static bool particle_skip(ParticleInstanceModifierData *pimd, ParticleSystem *psys, int p)
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
static void store_float_in_vcol(MLoopCol *vcol, float float_value)
static void path_panel_draw_header(const bContext *UNUSED(C), Panel *panel)
static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void initData(ModifierData *md)
static void path_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panelRegister(ARegionType *region_type)
static void layers_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
PointerRNA * modifier_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
void modifier_panel_end(uiLayout *layout, PointerRNA *ptr)
PanelType * modifier_panel_register(ARegionType *region_type, ModifierType type, PanelDrawFn draw)
PanelType * modifier_subpanel_register(ARegionType *region_type, const char *name, const char *label, PanelDrawFn draw_header, PanelDrawFn draw, PanelType *parent)
uiLayout * uiLayoutRowWithHeading(uiLayout *layout, bool align, const char *heading)
void uiLayoutSetActive(uiLayout *layout, bool active)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemS(uiLayout *layout)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
@ UI_ITEM_R_FORCE_BLANK_DECORATE
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *searchptr, const char *searchpropname, const char *name, int icon)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
void(* MEM_freeN)(void *vmemh)
void *(* MEM_calloc_arrayN)(size_t len, size_t size, const char *str)
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
vec_base< T, 3 > cross(const vec_base< T, 3 > &a, const vec_base< T, 3 > &b)
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
bool RNA_pointer_is_null(const PointerRNA *ptr)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
struct ModifierData * next
struct Depsgraph * depsgraph
struct DepsNodeHandle * node
char value_layer_name[64]
char index_layer_name[64]
struct Depsgraph * depsgraph
struct ParticleSystemModifierData * psmd
struct ParticleSystem * psys
struct ParticleSystem * psys
struct PointCache * pointcache