Blender V4.3
MOD_explode.cc File Reference
#include "BLI_utildefines.h"
#include "BLI_kdtree.h"
#include "BLI_map.hh"
#include "BLI_math_matrix.h"
#include "BLI_math_rotation.h"
#include "BLI_math_vector.h"
#include "BLI_rand.h"
#include "BLT_translation.hh"
#include "DNA_defaults.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "BKE_customdata.hh"
#include "BKE_deform.hh"
#include "BKE_lib_id.hh"
#include "BKE_mesh.hh"
#include "BKE_mesh_legacy_convert.hh"
#include "BKE_modifier.hh"
#include "BKE_particle.h"
#include "BKE_scene.hh"
#include "UI_interface.hh"
#include "UI_resources.hh"
#include "RNA_access.hh"
#include "RNA_prototypes.hh"
#include "DEG_depsgraph_query.hh"
#include "MEM_guardedalloc.h"
#include "MOD_ui_common.hh"

Go to the source code of this file.

Macros

#define DNA_DEPRECATED_ALLOW   /* For #ME_FACE_SEL. */
 
#define SET_VERTS(a, b, c, d)
 
#define GET_ES(v1, v2)   edgecut_get(eh, v1, v2)
 
#define INT_UV(uvf, c0, c1)   mid_v2_v2v2(uvf, mf->uv[c0], mf->uv[c1])
 

Functions

static void init_data (ModifierData *md)
 
static void free_data (ModifierData *md)
 
static void copy_data (const ModifierData *md, ModifierData *target, const int flag)
 
static bool depends_on_time (Scene *, ModifierData *)
 
static void required_data_mask (ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
 
static void createFacepa (ExplodeModifierData *emd, ParticleSystemModifierData *psmd, Mesh *mesh)
 
static int edgecut_get (const blender::Map< blender::OrderedEdge, int > &edgehash, uint v1, uint v2)
 
static MFaceget_dface (Mesh *mesh, Mesh *split, int cur, int i, MFace *mf)
 
static void remap_faces_3_6_9_12 (Mesh *mesh, Mesh *split, MFace *mf, int *facepa, const int *vertpa, int i, const blender::Map< blender::OrderedEdge, int > &eh, int cur, int v1, int v2, int v3, int v4)
 
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_faces_5_10 (Mesh *mesh, Mesh *split, MFace *mf, int *facepa, const int *vertpa, int i, const blender::Map< blender::OrderedEdge, int > &eh, int cur, int v1, int v2, int v3, int v4)
 
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_15 (Mesh *mesh, Mesh *split, MFace *mf, int *facepa, const int *vertpa, int i, const blender::Map< blender::OrderedEdge, int > &eh, int cur, int v1, int v2, int v3, int v4)
 
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 remap_faces_7_11_13_14 (Mesh *mesh, Mesh *split, MFace *mf, int *facepa, const int *vertpa, int i, const blender::Map< blender::OrderedEdge, int > &eh, int cur, int v1, int v2, int v3, int v4)
 
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 void remap_faces_19_21_22 (Mesh *mesh, Mesh *split, MFace *mf, int *facepa, const int *vertpa, int i, const blender::Map< blender::OrderedEdge, int > &eh, int cur, int v1, int v2, int v3)
 
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 remap_faces_23 (Mesh *mesh, Mesh *split, MFace *mf, int *facepa, const int *vertpa, int i, const blender::Map< blender::OrderedEdge, int > &eh, int cur, int v1, int v2, int v3)
 
static void remap_uvs_23 (Mesh *mesh, Mesh *split, int layers_num, int i, int cur, int c0, int c1, int c2)
 
static MeshcutEdges (ExplodeModifierData *emd, Mesh *mesh)
 
static MeshexplodeMesh (ExplodeModifierData *emd, ParticleSystemModifierData *psmd, const ModifierEvalContext *ctx, Scene *scene, Mesh *to_explode)
 
static ParticleSystemModifierDatafindPrecedingParticlesystem (Object *ob, ModifierData *emd)
 
static Meshmodify_mesh (ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
 
static void panel_draw (const bContext *, Panel *panel)
 
static void panel_register (ARegionType *region_type)
 
static void blend_read (BlendDataReader *, ModifierData *md)
 

Variables

static const short add_faces [24]
 
ModifierTypeInfo modifierType_Explode
 

Macro Definition Documentation

◆ DNA_DEPRECATED_ALLOW

#define DNA_DEPRECATED_ALLOW   /* For #ME_FACE_SEL. */

Definition at line 9 of file MOD_explode.cc.

◆ GET_ES

◆ INT_UV

#define INT_UV ( uvf,
c0,
c1 )   mid_v2_v2v2(uvf, mf->uv[c0], mf->uv[c1])

◆ SET_VERTS

#define SET_VERTS ( a,
b,
c,
d )
Value:
{ \
v[0] = mf->v##a; \
uv[0] = a - 1; \
v[1] = mf->v##b; \
uv[1] = b - 1; \
v[2] = mf->v##c; \
uv[2] = c - 1; \
v[3] = mf->v##d; \
uv[3] = d - 1; \
} \
(void)0
ATTR_WARN_UNUSED_RESULT const BMVert * v
local_group_size(16, 16) .push_constant(Type b

Definition at line 224 of file MOD_explode.cc.

Referenced by cutEdges().

Function Documentation

◆ blend_read()

static void blend_read ( BlendDataReader * ,
ModifierData * md )
static

Definition at line 1205 of file MOD_explode.cc.

References ExplodeModifierData::facepa.

◆ copy_data()

static void copy_data ( const ModifierData * md,
ModifierData * target,
const int flag )
static

Definition at line 63 of file MOD_explode.cc.

References BKE_modifier_copydata_generic(), ExplodeModifierData::facepa, and flag.

◆ createFacepa()

◆ cutEdges()

◆ depends_on_time()

static bool depends_on_time ( Scene * ,
ModifierData *  )
static

Definition at line 74 of file MOD_explode.cc.

◆ edgecut_get()

static int edgecut_get ( const blender::Map< blender::OrderedEdge, int > & edgehash,
uint v1,
uint v2 )
static

◆ explodeMesh()

static Mesh * explodeMesh ( ExplodeModifierData * emd,
ParticleSystemModifierData * psmd,
const ModifierEvalContext * ctx,
Scene * scene,
Mesh * to_explode )
static

Definition at line 893 of file MOD_explode.cc.

References add_v3_v3(), ParticleData::alive, BKE_mesh_calc_edges_tessface(), BKE_mesh_convert_mfaces_to_mpolys(), BKE_mesh_legacy_convert_polys_to_offsets(), BKE_mesh_mface_index_validate(), BKE_mesh_new_nomain_from_template_ex(), BKE_scene_ctime_get(), CD_MASK_EVERYTHING, CD_MFACE, CD_MTFACE, CLAMP, ParticleKey::co, copy_v3_v3(), CustomData_copy_data(), CustomData_get_layer_for_write(), CustomData_get_layer_named_for_write(), ModifierEvalContext::depsgraph, ParticleSimulationData::depsgraph, edgecut_get(), eExplodeFlag_Alive, eExplodeFlag_Dead, eExplodeFlag_PaSize, eExplodeFlag_Unborn, ExplodeModifierData::facepa, Mesh::fdata_legacy, ExplodeModifierData::flag, invert_m4_m4(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::items(), ParticleData::lifetime, blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_or_add_cb(), mul_m4_v3(), mul_qt_v3(), mul_v3_fl(), ParticleSimulationData::ob, ModifierEvalContext::object, PARS_ALIVE, PARS_DEAD, PARS_UNBORN, ParticleSystem::particles, ParticleSimulationData::psmd, ParticleSimulationData::psys, ParticleSystemModifierData::psys, psys_get_birth_coords(), psys_get_particle_state(), psys_sim_data_free(), psys_sim_data_init(), ParticleKey::rot, rot, ParticleSimulationData::scene, scene, ParticleData::size, state, sub_qt_qtqt(), sub_v3_v3(), ParticleData::time, Mesh::totface_legacy, ParticleSystem::totpart, MTFace::uv, ExplodeModifierData::uvname, v, MFace::v1, MFace::v2, MFace::v3, MFace::v4, and Mesh::vert_data.

Referenced by modify_mesh().

◆ findPrecedingParticlesystem()

static ParticleSystemModifierData * findPrecedingParticlesystem ( Object * ob,
ModifierData * emd )
static

◆ free_data()

static void free_data ( ModifierData * md)
static

Definition at line 57 of file MOD_explode.cc.

References ExplodeModifierData::facepa, and MEM_SAFE_FREE.

◆ get_dface()

◆ init_data()

static void init_data ( ModifierData * md)
static

◆ modify_mesh()

◆ panel_draw()

◆ panel_register()

static void panel_register ( ARegionType * region_type)
static

Definition at line 1200 of file MOD_explode.cc.

References eModifierType_Explode, modifier_panel_register(), and panel_draw().

◆ remap_faces_15()

static void remap_faces_15 ( Mesh * mesh,
Mesh * split,
MFace * mf,
int * facepa,
const int * vertpa,
int i,
const blender::Map< blender::OrderedEdge, int > & eh,
int cur,
int v1,
int v2,
int v3,
int v4 )
static

Definition at line 368 of file MOD_explode.cc.

References MFace::flag, get_dface(), GET_ES, MFace::v1, MFace::v2, v2, MFace::v3, and MFace::v4.

Referenced by cutEdges().

◆ remap_faces_19_21_22()

static void remap_faces_19_21_22 ( Mesh * mesh,
Mesh * split,
MFace * mf,
int * facepa,
const int * vertpa,
int i,
const blender::Map< blender::OrderedEdge, int > & eh,
int cur,
int v1,
int v2,
int v3 )
static

Definition at line 525 of file MOD_explode.cc.

References MFace::flag, get_dface(), GET_ES, MFace::v1, MFace::v2, v2, MFace::v3, and MFace::v4.

Referenced by cutEdges().

◆ remap_faces_23()

static void remap_faces_23 ( Mesh * mesh,
Mesh * split,
MFace * mf,
int * facepa,
const int * vertpa,
int i,
const blender::Map< blender::OrderedEdge, int > & eh,
int cur,
int v1,
int v2,
int v3 )
static

Definition at line 581 of file MOD_explode.cc.

References MFace::flag, get_dface(), GET_ES, MFace::v1, MFace::v2, v2, MFace::v3, and MFace::v4.

Referenced by cutEdges().

◆ remap_faces_3_6_9_12()

static void remap_faces_3_6_9_12 ( Mesh * mesh,
Mesh * split,
MFace * mf,
int * facepa,
const int * vertpa,
int i,
const blender::Map< blender::OrderedEdge, int > & eh,
int cur,
int v1,
int v2,
int v3,
int v4 )
static

Definition at line 240 of file MOD_explode.cc.

References MFace::flag, get_dface(), GET_ES, MFace::v1, MFace::v2, v2, MFace::v3, and MFace::v4.

Referenced by cutEdges().

◆ remap_faces_5_10()

static void remap_faces_5_10 ( Mesh * mesh,
Mesh * split,
MFace * mf,
int * facepa,
const int * vertpa,
int i,
const blender::Map< blender::OrderedEdge, int > & eh,
int cur,
int v1,
int v2,
int v3,
int v4 )
static

Definition at line 310 of file MOD_explode.cc.

References MFace::flag, get_dface(), GET_ES, MFace::v1, MFace::v2, v2, MFace::v3, and MFace::v4.

Referenced by cutEdges().

◆ remap_faces_7_11_13_14()

static void remap_faces_7_11_13_14 ( Mesh * mesh,
Mesh * split,
MFace * mf,
int * facepa,
const int * vertpa,
int i,
const blender::Map< blender::OrderedEdge, int > & eh,
int cur,
int v1,
int v2,
int v3,
int v4 )
static

Definition at line 454 of file MOD_explode.cc.

References MFace::flag, get_dface(), GET_ES, MFace::v1, MFace::v2, v2, MFace::v3, and MFace::v4.

Referenced by cutEdges().

◆ remap_uvs_15()

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

Definition at line 415 of file MOD_explode.cc.

References CD_MTFACE, copy_v2_v2(), CustomData_get_layer_n_for_write(), INT_UV, l, and MTFace::uv.

Referenced by cutEdges().

◆ remap_uvs_19_21_22()

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

Definition at line 555 of file MOD_explode.cc.

References CD_MTFACE, copy_v2_v2(), CustomData_get_layer_n_for_write(), INT_UV, l, and MTFace::uv.

Referenced by cutEdges().

◆ remap_uvs_23()

static void remap_uvs_23 ( Mesh * mesh,
Mesh * split,
int layers_num,
int i,
int cur,
int c0,
int c1,
int c2 )
static

Definition at line 619 of file MOD_explode.cc.

References CD_MTFACE, copy_v2_v2(), CustomData_get_layer_n_for_write(), INT_UV, l, and MTFace::uv.

Referenced by cutEdges().

◆ remap_uvs_3_6_9_12()

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

Definition at line 279 of file MOD_explode.cc.

References CD_MTFACE, copy_v2_v2(), CustomData_get_layer_n_for_write(), INT_UV, l, and MTFace::uv.

Referenced by cutEdges().

◆ remap_uvs_5_10()

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

Definition at line 341 of file MOD_explode.cc.

References CD_MTFACE, copy_v2_v2(), CustomData_get_layer_n_for_write(), INT_UV, l, and MTFace::uv.

Referenced by cutEdges().

◆ remap_uvs_7_11_13_14()

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

Definition at line 493 of file MOD_explode.cc.

References CD_MTFACE, copy_v2_v2(), CustomData_get_layer_n_for_write(), INT_UV, l, and MTFace::uv.

Referenced by cutEdges().

◆ required_data_mask()

static void required_data_mask ( ModifierData * md,
CustomData_MeshMasks * r_cddata_masks )
static

Variable Documentation

◆ add_faces

const short add_faces[24]
static
Initial value:
= {
0, 0, 0, 2, 0, 1, 2, 2, 0, 2, 1, 2, 2, 2, 2, 3, 0, 0, 0, 1, 0, 1, 1, 2,
}

Definition at line 210 of file MOD_explode.cc.

Referenced by cutEdges().

◆ modifierType_Explode

ModifierTypeInfo modifierType_Explode

Definition at line 1212 of file MOD_explode.cc.