41 #include "RNA_prototypes.h"
99 int *facepa =
NULL, *vertpa =
NULL, totvert = 0, totface = 0, totpart = 0;
100 int i, p,
v1,
v2, v3, v4 = 0;
119 for (i = 0; i < totface; i++) {
122 for (i = 0; i < totvert; i++) {
130 const int defgrp_index = emd->
vgroup - 1;
131 for (i = 0; i < totvert; i++, dvert++) {
144 tree = BLI_kdtree_3d_new(totpart);
145 for (p = 0, pa = psys->
particles; p < totpart; p++, pa++) {
157 BLI_kdtree_3d_insert(
tree, p, co);
159 BLI_kdtree_3d_balance(
tree);
162 for (i = 0, fa = mface; i < totface; i++, fa++) {
182 if (
v1 >= 0 &&
v2 >= 0 && v3 >= 0 && (fa->
v4 == 0 || v4 >= 0)) {
195 if (fa->
v4 && v4 >= 0) {
203 BLI_kdtree_3d_free(
tree);
214 0, 0, 0, 2, 0, 1, 2, 2, 0, 2, 1, 2, 2, 2, 2, 3, 0, 0, 0, 1, 0, 1, 1, 2,
225 #define SET_VERTS(a, b, c, d) \
238 #define GET_ES(v1, v2) edgecut_get(eh, v1, v2)
239 #define INT_UV(uvf, c0, c1) mid_v2_v2v2(uvf, mf->uv[c0], mf->uv[c1])
258 facepa[cur] = vertpa[
v1];
265 facepa[cur + 1] = vertpa[
v2];
272 facepa[cur + 2] = vertpa[
v1];
281 Mesh *
mesh,
Mesh *
split,
int layers_num,
int i,
int cur,
int c0,
int c1,
int c2,
int c3)
283 MTFace *mf, *df1, *df2, *df3;
286 for (
l = 0;
l < layers_num;
l++) {
325 facepa[cur] = vertpa[
v1];
332 facepa[cur + 1] = vertpa[v3];
341 Mesh *
mesh,
Mesh *
split,
int layers_num,
int i,
int cur,
int c0,
int c1,
int c2,
int c3)
346 for (
l = 0;
l < layers_num;
l++) {
383 facepa[cur] = vertpa[
v1];
390 facepa[cur + 1] = vertpa[
v2];
397 facepa[cur + 2] = vertpa[v3];
404 facepa[cur + 3] = vertpa[v4];
413 Mesh *
mesh,
Mesh *
split,
int layers_num,
int i,
int cur,
int c0,
int c1,
int c2,
int c3)
415 MTFace *mf, *df1, *df2, *df3, *df4;
418 for (
l = 0;
l < layers_num;
l++) {
466 facepa[cur] = vertpa[
v1];
473 facepa[cur + 1] = vertpa[
v2];
480 facepa[cur + 2] = vertpa[v4];
489 Mesh *
mesh,
Mesh *
split,
int layers_num,
int i,
int cur,
int c0,
int c1,
int c2,
int c3)
491 MTFace *mf, *df1, *df2, *df3;
494 for (
l = 0;
l < layers_num;
l++) {
533 facepa[cur] = vertpa[
v1];
540 facepa[cur + 1] = vertpa[
v2];
554 for (
l = 0;
l < layers_num;
l++) {
588 facepa[cur] = vertpa[
v1];
595 facepa[cur + 1] = vertpa[
v2];
602 facepa[cur + 2] = vertpa[v3];
616 for (
l = 0;
l < layers_num;
l++) {
651 int *facepa = emd->
facepa;
652 int *fs, totesplit = 0, totfsplit = 0, curdupface = 0;
653 int i,
v1,
v2, v3, v4, esplit,
v[4] = {0, 0, 0, 0},
654 uv[4] = {0, 0, 0, 0};
661 for (i = 0, mf = mface; i < totface; i++, mf++) {
662 vertpa[mf->
v1] = facepa[i];
663 vertpa[mf->
v2] = facepa[i];
664 vertpa[mf->
v3] = facepa[i];
666 vertpa[mf->
v4] = facepa[i];
671 for (i = 0, mf = mface, fs = facesplit; i < totface; i++, mf++, fs++) {
724 for (i = 0, fs = facesplit; i < totface; i++, fs++) {
733 for (i = 0; i < totvert; i++) {
749 facepa =
MEM_calloc_arrayN((totface + (totfsplit * 2)),
sizeof(
int),
"explode_facepa");
759 dupve = &split_m->
mvert[esplit];
774 for (i = 0, fs = facesplit; i < totface; i++, fs++) {
815 mesh, split_m, mf, facepa, vertpa, i, edgehash, curdupface,
v[0],
v[1],
v[2],
v[3]);
823 mesh, split_m, mf, facepa, vertpa, i, edgehash, curdupface,
v[0],
v[1],
v[2],
v[3]);
830 mesh, split_m, mf, facepa, vertpa, i, edgehash, curdupface,
v[0],
v[1],
v[2],
v[3]);
832 remap_uvs_15(
mesh, split_m, layers_num, i, curdupface, uv[0], uv[1], uv[2], uv[3]);
840 mesh, split_m, mf, facepa, vertpa, i, edgehash, curdupface,
v[0],
v[1],
v[2],
v[3]);
843 mesh, split_m, layers_num, i, curdupface, uv[0], uv[1], uv[2], uv[3]);
850 mesh, split_m, mf, facepa, vertpa, i, edgehash, curdupface,
v[0],
v[1],
v[2]);
857 mesh, split_m, mf, facepa, vertpa, i, edgehash, curdupface,
v[0],
v[1],
v[2]);
859 remap_uvs_23(
mesh, split_m, layers_num, i, curdupface, uv[0], uv[1], uv[2]);
865 facepa[curdupface] = vertpa[mf->
v1];
879 for (i = 0; i < curdupface; i++) {
880 mf = &split_m->
mface[i];
907 float *vertco =
NULL, imat[4][4];
911 const int *facepa = emd->
facepa;
912 int totdup = 0, totvert = 0, totface = 0, totpart = 0, delface = 0;
914 uint ed_v1, ed_v2, mindex = 0;
934 for (i = 0; i < totface; i++) {
935 if (facepa[i] != totpart) {
936 pa = pars + facepa[i];
951 if (pa ==
NULL || ctime < pa->
time) {
952 mindex = totvert + totpart;
955 mindex = totvert + facepa[i];
1005 if (ed_v2 != totpart) {
1038 for (i = 0, u = 0; i < totface; i++) {
1042 if (facepa[i] != totpart) {
1043 pa = pars + facepa[i];
1060 mf = &explode->
mface[u];
1062 orig_v4 = source.
v4;
1065 if (pa ==
NULL || ctime < pa->
time) {
1066 mindex = totvert + totpart;
1069 mindex = totvert + facepa[i];
1087 CLAMP(age, 0.001f, 0.999f);
1089 MTFace *mtf = mtface + u;
1091 mtf->
uv[0][0] = mtf->
uv[1][0] = mtf->
uv[2][0] = mtf->
uv[3][0] = age;
1092 mtf->
uv[0][1] = mtf->
uv[1][1] = mtf->
uv[2][1] = mtf->
uv[3][1] = 0.5f;
1158 int *facepa = emd->
facepa;
1206 uiItemO(layout,
IFACE_(
"Refresh"), ICON_NONE,
"OBJECT_OT_explode_refresh");
1225 "ExplodeModifierData",
1227 &RNA_ExplodeModifier,
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_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)
void BKE_mesh_convert_mfaces_to_mpolys(struct Mesh *mesh)
int BKE_mesh_mface_index_validate(struct MFace *mface, struct CustomData *mfdata, int mfindex, int nr)
@ eModifierTypeFlag_AcceptsMesh
void BKE_modifier_copydata_generic(const struct ModifierData *md, struct ModifierData *md_dst, int flag)
@ eModifierTypeType_Constructive
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])
void psys_sim_data_free(struct ParticleSimulationData *sim)
void psys_sim_data_init(struct ParticleSimulationData *sim)
void psys_get_birth_coords(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, float dtime, float cfra)
bool psys_get_particle_state(struct ParticleSimulationData *sim, int p, struct ParticleKey *state, bool always)
float BKE_scene_ctime_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)
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)
BLI_INLINE bool BLI_edgehashIterator_isDone(const EdgeHashIterator *ehi)
void * BLI_edgehash_lookup(const 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 bool dependsOnTime(struct Scene *UNUSED(scene), ModifierData *UNUSED(md))
static MFace * get_dface(Mesh *mesh, Mesh *split, int cur, int i, MFace *mf)
static void blendRead(BlendDataReader *UNUSED(reader), ModifierData *md)
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_3_6_9_12(Mesh *mesh, Mesh *split, int layers_num, int i, int cur, int c0, int c1, int c2, int c3)
static void remap_uvs_5_10(Mesh *mesh, Mesh *split, int layers_num, 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)
static void remap_uvs_23(Mesh *mesh, Mesh *split, int layers_num, int i, int cur, int c0, int c1, int c2)
#define SET_VERTS(a, b, c, d)
static const short add_faces[24]
static void remap_uvs_7_11_13_14(Mesh *mesh, Mesh *split, int layers_num, int i, int cur, int c0, int c1, int c2, int c3)
static Mesh * cutEdges(ExplodeModifierData *emd, Mesh *mesh)
ModifierTypeInfo modifierType_Explode
#define INT_UV(uvf, c0, c1)
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 remap_uvs_19_21_22(Mesh *mesh, Mesh *split, int layers_num, int i, int cur, int c0, int c1, int c2)
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 remap_uvs_15(Mesh *mesh, Mesh *split, int layers_num, int i, int cur, int c0, int c1, int c2, int c3)
static void freeData(ModifierData *md)
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)
void modifier_vgroup_ui(uiLayout *layout, PointerRNA *ptr, PointerRNA *ob_ptr, const char *vgroup_prop, const char *invert_vgroup_prop, const char *text)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
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)
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 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 ModifierData * next
struct Depsgraph * depsgraph
struct Depsgraph * depsgraph
struct ParticleSystemModifierData * psmd
struct ParticleSystem * psys
struct ParticleSystem * psys