113 int *facepa =
NULL, *vertpa =
NULL, totvert = 0, totface = 0, totpart = 0;
114 int i, p,
v1,
v2, v3, v4 = 0;
133 for (i = 0; i < totface; i++) {
136 for (i = 0; i < totvert; i++) {
144 const int defgrp_index = emd->
vgroup - 1;
145 for (i = 0; i < totvert; i++, dvert++) {
158 tree = BLI_kdtree_3d_new(totpart);
159 for (p = 0, pa = psys->
particles; p < totpart; p++, pa++) {
171 BLI_kdtree_3d_insert(
tree, p, co);
173 BLI_kdtree_3d_balance(
tree);
176 for (i = 0, fa = mface; i < totface; i++, fa++) {
196 if (
v1 >= 0 &&
v2 >= 0 && v3 >= 0 && (fa->
v4 == 0 || v4 >= 0)) {
209 if (fa->
v4 && v4 >= 0) {
217 BLI_kdtree_3d_free(
tree);
228 0, 0, 0, 2, 0, 1, 2, 2, 0, 2, 1, 2, 2, 2, 2, 3, 0, 0, 0, 1, 0, 1, 1, 2,
239 #define SET_VERTS(a, b, c, d) \
252 #define GET_ES(v1, v2) edgecut_get(eh, v1, v2)
253 #define INT_UV(uvf, c0, c1) mid_v2_v2v2(uvf, mf->uv[c0], mf->uv[c1])
272 facepa[cur] = vertpa[
v1];
279 facepa[cur + 1] = vertpa[
v2];
286 facepa[cur + 2] = vertpa[
v1];
295 Mesh *
mesh,
Mesh *
split,
int numlayer,
int i,
int cur,
int c0,
int c1,
int c2,
int c3)
297 MTFace *mf, *df1, *df2, *df3;
300 for (
l = 0;
l < numlayer;
l++) {
339 facepa[cur] = vertpa[
v1];
346 facepa[cur + 1] = vertpa[v3];
355 Mesh *
mesh,
Mesh *
split,
int numlayer,
int i,
int cur,
int c0,
int c1,
int c2,
int c3)
360 for (
l = 0;
l < numlayer;
l++) {
397 facepa[cur] = vertpa[
v1];
404 facepa[cur + 1] = vertpa[
v2];
411 facepa[cur + 2] = vertpa[v3];
418 facepa[cur + 3] = vertpa[v4];
427 Mesh *
mesh,
Mesh *
split,
int numlayer,
int i,
int cur,
int c0,
int c1,
int c2,
int c3)
429 MTFace *mf, *df1, *df2, *df3, *df4;
432 for (
l = 0;
l < numlayer;
l++) {
480 facepa[cur] = vertpa[
v1];
487 facepa[cur + 1] = vertpa[
v2];
494 facepa[cur + 2] = vertpa[v4];
503 Mesh *
mesh,
Mesh *
split,
int numlayer,
int i,
int cur,
int c0,
int c1,
int c2,
int c3)
505 MTFace *mf, *df1, *df2, *df3;
508 for (
l = 0;
l < numlayer;
l++) {
547 facepa[cur] = vertpa[
v1];
554 facepa[cur + 1] = vertpa[
v2];
568 for (
l = 0;
l < numlayer;
l++) {
602 facepa[cur] = vertpa[
v1];
609 facepa[cur + 1] = vertpa[
v2];
616 facepa[cur + 2] = vertpa[v3];
630 for (
l = 0;
l < numlayer;
l++) {
665 int *facepa = emd->
facepa;
666 int *fs, totesplit = 0, totfsplit = 0, curdupface = 0;
667 int i,
v1,
v2, v3, v4, esplit,
v[4] = {0, 0, 0, 0},
668 uv[4] = {0, 0, 0, 0};
675 for (i = 0, mf = mface; i < totface; i++, mf++) {
676 vertpa[mf->
v1] = facepa[i];
677 vertpa[mf->
v2] = facepa[i];
678 vertpa[mf->
v3] = facepa[i];
680 vertpa[mf->
v4] = facepa[i];
685 for (i = 0, mf = mface, fs = facesplit; i < totface; i++, mf++, fs++) {
738 for (i = 0, fs = facesplit; i < totface; i++, fs++) {
747 for (i = 0; i < totvert; i++) {
751 dest = &split_m->
mvert[i];
763 facepa =
MEM_calloc_arrayN((totface + (totfsplit * 2)),
sizeof(
int),
"explode_facepa");
773 dupve = &split_m->
mvert[esplit];
788 for (i = 0, fs = facesplit; i < totface; i++, fs++) {
829 mesh, split_m, mf, facepa, vertpa, i, edgehash, curdupface,
v[0],
v[1],
v[2],
v[3]);
837 mesh, split_m, mf, facepa, vertpa, i, edgehash, curdupface,
v[0],
v[1],
v[2],
v[3]);
844 mesh, split_m, mf, facepa, vertpa, i, edgehash, curdupface,
v[0],
v[1],
v[2],
v[3]);
846 remap_uvs_15(
mesh, split_m, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]);
854 mesh, split_m, mf, facepa, vertpa, i, edgehash, curdupface,
v[0],
v[1],
v[2],
v[3]);
863 mesh, split_m, mf, facepa, vertpa, i, edgehash, curdupface,
v[0],
v[1],
v[2]);
870 mesh, split_m, mf, facepa, vertpa, i, edgehash, curdupface,
v[0],
v[1],
v[2]);
878 facepa[curdupface] = vertpa[mf->
v1];
892 for (i = 0; i < curdupface; i++) {
893 mf = &split_m->
mface[i];
920 float *vertco =
NULL, imat[4][4];
924 const int *facepa = emd->
facepa;
925 int totdup = 0, totvert = 0, totface = 0, totpart = 0, delface = 0;
927 uint ed_v1, ed_v2, mindex = 0;
948 for (i = 0; i < totface; i++) {
949 if (facepa[i] != totpart) {
950 pa = pars + facepa[i];
965 if (pa ==
NULL || cfra < pa->
time) {
966 mindex = totvert + totpart;
969 mindex = totvert + facepa[i];
1013 dest = &explode->
mvert[
v];
1019 if (ed_v2 != totpart) {
1052 for (i = 0, u = 0; i < totface; i++) {
1056 if (facepa[i] != totpart) {
1057 pa = pars + facepa[i];
1074 mf = &explode->
mface[u];
1076 orig_v4 = source.
v4;
1079 if (pa ==
NULL || cfra < pa->
time) {
1080 mindex = totvert + totpart;
1083 mindex = totvert + facepa[i];
1101 CLAMP(age, 0.001f, 0.999f);
1105 mtf->
uv[0][0] = mtf->uv[1][0] = mtf->uv[2][0] = mtf->uv[3][0] = age;
1106 mtf->uv[0][1] = mtf->uv[1][1] = mtf->uv[2][1] = mtf->uv[3][1] = 0.5f;
1176 int *facepa = emd->
facepa;
1224 uiItemO(layout,
IFACE_(
"Refresh"), ICON_NONE,
"OBJECT_OT_explode_refresh");
1243 "ExplodeModifierData",
int CustomData_number_of_layers(const struct CustomData *data, int type)
void * CustomData_get_layer_named(const struct CustomData *data, int type, const char *name)
void * CustomData_get_layer_n(const struct CustomData *data, int type, int n)
void * CustomData_get_layer(const struct CustomData *data, int type)
void CustomData_copy_data(const struct CustomData *source, struct CustomData *dest, int source_index, int dest_index, int count)
void BKE_lattice_deform_data_destroy(struct LatticeDeformData *lattice_deform_data)
void BKE_id_free(struct Main *bmain, void *idv)
void BKE_mesh_calc_edges_tessface(struct Mesh *mesh)
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)
void BKE_mesh_tessface_ensure(struct Mesh *mesh)
int test_index_face(struct MFace *mface, struct CustomData *mfdata, int mfindex, int nr)
void BKE_mesh_convert_mfaces_to_mpolys(struct Mesh *mesh)
@ eModifierTypeFlag_AcceptsMesh
void BKE_modifier_copydata_generic(const struct ModifierData *md, struct ModifierData *md_dst, const int flag)
@ eModifierTypeType_Constructive
struct LatticeDeformData * psys_create_lattice_deform_data(struct ParticleSimulationData *sim)
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])
int psys_get_particle_state(struct ParticleSimulationData *sim, int p, struct ParticleKey *state, int always)
void psys_get_birth_coords(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, float dtime, float cfra)
float BKE_scene_frame_get(const struct Scene *scene)
void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP free_value)
BLI_INLINE void BLI_edgehashIterator_getKey(EdgeHashIterator *ehi, unsigned int *r_v0, unsigned int *r_v1)
BLI_INLINE bool BLI_edgehashIterator_isDone(EdgeHashIterator *ehi)
bool BLI_edgehash_reinsert(EdgeHash *eh, unsigned int v0, unsigned int v1, void *val)
EdgeHashIterator * BLI_edgehashIterator_new(EdgeHash *eh) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
EdgeHash * BLI_edgehash_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
BLI_INLINE void BLI_edgehashIterator_step(EdgeHashIterator *ehi)
void BLI_edgehashIterator_free(EdgeHashIterator *ehi)
BLI_INLINE void * BLI_edgehashIterator_getValue(EdgeHashIterator *ehi)
void * BLI_edgehash_lookup(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT
BLI_INLINE void BLI_edgehashIterator_setValue(EdgeHashIterator *ehi, void *val)
A kd-tree for nearest neighbor search.
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 sub_qt_qtqt(float q[4], const float a[4], const float b[4])
void mul_qt_v3(const float q[4], float r[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
void mid_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])
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1)
struct RNG * BLI_rng_new_srandom(unsigned int seed)
float BLI_rng_get_float(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
#define CD_MASK_MDEFORMVERT
#define DNA_struct_default_get(struct_name)
@ eParticleSystemFlag_Pars
@ eModifierType_ParticleSystem
struct ExplodeModifierData ExplodeModifierData
@ eExplodeFlag_INVERT_VGROUP
Object is a sort of wrapper for general info.
NSNotificationCenter * center
_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 const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Read Guarded memory(de)allocation.
static MFace * get_dface(Mesh *mesh, Mesh *split, int cur, int i, MFace *mf)
static void blendRead(BlendDataReader *UNUSED(reader), ModifierData *md)
static void remap_uvs_3_6_9_12(Mesh *mesh, Mesh *split, int numlayer, int i, int cur, int c0, int c1, int c2, int c3)
static void copyData(const ModifierData *md, ModifierData *target, const int flag)
static Mesh * modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
static void remap_uvs_7_11_13_14(Mesh *mesh, Mesh *split, int numlayer, int i, int cur, int c0, int c1, int c2, int c3)
static void remap_faces_23(Mesh *mesh, Mesh *split, MFace *mf, int *facepa, const int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3)
static int edgecut_get(EdgeHash *edgehash, uint v1, uint v2)
static ParticleSystemModifierData * findPrecedingParticlesystem(Object *ob, ModifierData *emd)
static void createFacepa(ExplodeModifierData *emd, ParticleSystemModifierData *psmd, Mesh *mesh)
static void remap_faces_3_6_9_12(Mesh *mesh, Mesh *split, MFace *mf, int *facepa, const int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3, int v4)
#define SET_VERTS(a, b, c, d)
static const short add_faces[24]
static void remap_uvs_23(Mesh *mesh, Mesh *split, int numlayer, int i, int cur, int c0, int c1, int c2)
static Mesh * cutEdges(ExplodeModifierData *emd, Mesh *mesh)
ModifierTypeInfo modifierType_Explode
#define INT_UV(uvf, c0, c1)
static void remap_uvs_5_10(Mesh *mesh, Mesh *split, int numlayer, int i, int cur, int c0, int c1, int c2, int c3)
static bool dependsOnTime(ModifierData *UNUSED(md))
static void remap_uvs_19_21_22(Mesh *mesh, Mesh *split, int numlayer, int i, int cur, int c0, int c1, int c2)
static void remap_faces_15(Mesh *mesh, Mesh *split, MFace *mf, int *facepa, const int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3, int v4)
static void remap_faces_7_11_13_14(Mesh *mesh, Mesh *split, MFace *mf, int *facepa, const int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3, int v4)
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void initData(ModifierData *md)
static void panelRegister(ARegionType *region_type)
static void remap_faces_5_10(Mesh *mesh, Mesh *split, MFace *mf, int *facepa, const int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3, int v4)
static Mesh * explodeMesh(ExplodeModifierData *emd, ParticleSystemModifierData *psmd, const ModifierEvalContext *ctx, Scene *scene, Mesh *to_explode)
static void remap_faces_19_21_22(Mesh *mesh, Mesh *split, MFace *mf, int *facepa, const int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3)
static void freeData(ModifierData *md)
static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
static void remap_uvs_15(Mesh *mesh, Mesh *split, int numlayer, int i, int cur, int c0, int c1, int c2, int c3)
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)
void modifier_vgroup_ui(uiLayout *layout, PointerRNA *ptr, PointerRNA *ob_ptr, const char *vgroup_prop, const char *invert_vgroup_prop, const char *text)
Group RGB to Bright Vector Camera CLAMP
StructRNA RNA_ExplodeModifier
uiLayout * uiLayoutRowWithHeading(uiLayout *layout, bool align, const char *heading)
void uiLayoutSetActive(uiLayout *layout, bool active)
@ UI_ITEM_R_FORCE_BLANK_DECORATE
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname)
void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *searchptr, const char *searchpropname, const char *name, int icon)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert * v
void(* MEM_freeN)(void *vmemh)
void *(* MEM_calloc_arrayN)(size_t len, size_t size, const char *str)
size_t(* MEM_allocN_len)(const void *vmemh)
void split(const std::string &s, const char delim, std::vector< std::string > &tokens)
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
int RNA_string_length(PointerRNA *ptr, const char *name)
struct CustomData vdata edata fdata
struct ModifierData * next
struct Depsgraph * depsgraph
struct Depsgraph * depsgraph
struct ParticleSystemModifierData * psmd
struct ParticleSystem * psys
struct ParticleSystem * psys
struct LatticeDeformData * lattice_deform_data