Blender  V2.93
Classes | Macros | Typedefs
MOD_weld.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
#include "BLI_alloca.h"
#include "BLI_bitmap.h"
#include "BLI_kdtree.h"
#include "BLI_math.h"
#include "BLT_translation.h"
#include "DNA_defaults.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_screen.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "RNA_access.h"
#include "DEG_depsgraph.h"
#include "MOD_modifiertypes.h"
#include "MOD_ui_common.h"

Go to the source code of this file.

Classes

struct  WeldGroup
 
struct  WeldGroupEdge
 
struct  WeldVert
 
struct  WeldEdge
 
struct  WeldLoop
 
struct  WeldPoly
 
struct  WeldMesh
 
struct  WeldLoopOfPolyIter
 
struct  WeldVertexCluster
 

Macros

#define OUT_OF_CONTEXT   (uint)(-1)
 
#define ELEM_COLLAPSED   (uint)(-2)
 
#define ELEM_MERGED   (uint)(-2)
 

Typedefs

typedef struct WeldVert WeldVert
 
typedef struct WeldEdge WeldEdge
 
typedef struct WeldLoop WeldLoop
 
typedef struct WeldPoly WeldPoly
 
typedef struct WeldMesh WeldMesh
 
typedef struct WeldLoopOfPolyIter WeldLoopOfPolyIter
 

Functions

Weld Vert API
static void weld_vert_ctx_alloc_and_setup (const uint mvert_len, uint *r_vert_dest_map, WeldVert **r_wvert, uint *r_wvert_len)
 
static void weld_vert_groups_setup (const uint mvert_len, const uint wvert_len, const WeldVert *wvert, const uint *vert_dest_map, uint *r_vert_groups_map, uint **r_vert_groups_buffer, struct WeldGroup **r_vert_groups)
 
Weld Edge API
static void weld_edge_ctx_setup (const uint mvert_len, const uint wedge_len, struct WeldGroup *r_vlinks, uint *r_edge_dest_map, WeldEdge *r_wedge, uint *r_edge_kiil_len)
 
static void weld_edge_ctx_alloc (const MEdge *medge, const uint medge_len, const uint *vert_dest_map, uint *r_edge_dest_map, uint **r_edge_ctx_map, WeldEdge **r_wedge, uint *r_wedge_len)
 
static void weld_edge_groups_setup (const uint medge_len, const uint edge_kill_len, const uint wedge_len, WeldEdge *wedge, const uint *wedge_map, uint *r_edge_groups_map, uint **r_edge_groups_buffer, struct WeldGroupEdge **r_edge_groups)
 
Weld Poly and Loop API
static bool weld_iter_loop_of_poly_begin (WeldLoopOfPolyIter *iter, const WeldPoly *wp, const WeldLoop *wloop, const MLoop *mloop, const uint *loop_map, uint *group_buffer)
 
static bool weld_iter_loop_of_poly_next (WeldLoopOfPolyIter *iter)
 
static void weld_poly_loop_ctx_alloc (const MPoly *mpoly, const uint mpoly_len, const MLoop *mloop, const uint mloop_len, const uint *vert_dest_map, const uint *edge_dest_map, WeldMesh *r_weld_mesh)
 
static void weld_poly_split_recursive (const uint *vert_dest_map, uint ctx_verts_len, WeldPoly *r_wp, WeldMesh *r_weld_mesh, uint *r_poly_kill, uint *r_loop_kill)
 
static void weld_poly_loop_ctx_setup (const MLoop *mloop, const uint mvert_len, const uint *vert_dest_map, const uint remain_edge_ctx_len, struct WeldGroup *r_vlinks, WeldMesh *r_weld_mesh)
 
Weld Mesh API
static void weld_mesh_context_create (const Mesh *mesh, uint *vert_dest_map, const uint vert_kill_len, WeldMesh *r_weld_mesh)
 
static void weld_mesh_context_free (WeldMesh *weld_mesh)
 
Weld CustomData
static void customdata_weld (const CustomData *source, CustomData *dest, const uint *src_indices, int count, int dest_index)
 

Weld Modifier Main

ModifierTypeInfo modifierType_Weld
 
static MeshweldModifier_doWeld (WeldModifierData *wmd, const ModifierEvalContext *ctx, Mesh *mesh)
 
static MeshmodifyMesh (ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
 
static void initData (ModifierData *md)
 
static void requiredDataMask (Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
 
static void panel_draw (const bContext *UNUSED(C), Panel *panel)
 
static void panelRegister (ARegionType *region_type)
 

Detailed Description

Weld modifier: Remove doubles.

Definition in file MOD_weld.c.

Macro Definition Documentation

◆ ELEM_COLLAPSED

#define ELEM_COLLAPSED   (uint)(-2)

Definition at line 75 of file MOD_weld.c.

◆ ELEM_MERGED

#define ELEM_MERGED   (uint)(-2)

Definition at line 77 of file MOD_weld.c.

◆ OUT_OF_CONTEXT

#define OUT_OF_CONTEXT   (uint)(-1)

Definition at line 73 of file MOD_weld.c.

Typedef Documentation

◆ WeldEdge

typedef struct WeldEdge WeldEdge

◆ WeldLoop

typedef struct WeldLoop WeldLoop

◆ WeldLoopOfPolyIter

◆ WeldMesh

typedef struct WeldMesh WeldMesh

◆ WeldPoly

typedef struct WeldPoly WeldPoly

◆ WeldVert

typedef struct WeldVert WeldVert

Function Documentation

◆ customdata_weld()

static void customdata_weld ( const CustomData source,
CustomData dest,
const uint src_indices,
int  count,
int  dest_index 
)
static

◆ initData()

static void initData ( ModifierData md)
static

◆ modifyMesh()

static Mesh* modifyMesh ( ModifierData md,
const ModifierEvalContext ctx,
Mesh mesh 
)
static

Definition at line 1988 of file MOD_weld.c.

References mesh, and weldModifier_doWeld().

◆ panel_draw()

static void panel_draw ( const bContext UNUSEDC,
Panel panel 
)
static

◆ panelRegister()

static void panelRegister ( ARegionType region_type)
static

Definition at line 2031 of file MOD_weld.c.

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

◆ requiredDataMask()

static void requiredDataMask ( Object UNUSEDob,
ModifierData md,
CustomData_MeshMasks r_cddata_masks 
)
static

◆ weld_edge_ctx_alloc()

static void weld_edge_ctx_alloc ( const MEdge medge,
const uint  medge_len,
const uint vert_dest_map,
uint r_edge_dest_map,
uint **  r_edge_ctx_map,
WeldEdge **  r_wedge,
uint r_wedge_len 
)
static

◆ weld_edge_ctx_setup()

static void weld_edge_ctx_setup ( const uint  mvert_len,
const uint  wedge_len,
struct WeldGroup r_vlinks,
uint r_edge_dest_map,
WeldEdge r_wedge,
uint r_edge_kiil_len 
)
static

◆ weld_edge_groups_setup()

static void weld_edge_groups_setup ( const uint  medge_len,
const uint  edge_kill_len,
const uint  wedge_len,
WeldEdge wedge,
const uint wedge_map,
uint r_edge_groups_map,
uint **  r_edge_groups_buffer,
struct WeldGroupEdge **  r_edge_groups 
)
static

◆ weld_iter_loop_of_poly_begin()

static bool weld_iter_loop_of_poly_begin ( WeldLoopOfPolyIter iter,
const WeldPoly wp,
const WeldLoop wloop,
const MLoop mloop,
const uint loop_map,
uint group_buffer 
)
static

◆ weld_iter_loop_of_poly_next()

static bool weld_iter_loop_of_poly_next ( WeldLoopOfPolyIter iter)
static

◆ weld_mesh_context_create()

static void weld_mesh_context_create ( const Mesh mesh,
uint vert_dest_map,
const uint  vert_kill_len,
WeldMesh r_weld_mesh 
)
static

◆ weld_mesh_context_free()

static void weld_mesh_context_free ( WeldMesh weld_mesh)
static

◆ weld_poly_loop_ctx_alloc()

static void weld_poly_loop_ctx_alloc ( const MPoly mpoly,
const uint  mpoly_len,
const MLoop mloop,
const uint  mloop_len,
const uint vert_dest_map,
const uint edge_dest_map,
WeldMesh r_weld_mesh 
)
static

◆ weld_poly_loop_ctx_setup()

static void weld_poly_loop_ctx_setup ( const MLoop mloop,
const uint  mvert_len,
const uint vert_dest_map,
const uint  remain_edge_ctx_len,
struct WeldGroup r_vlinks,
WeldMesh r_weld_mesh 
)
static

◆ weld_poly_split_recursive()

static void weld_poly_split_recursive ( const uint vert_dest_map,
uint  ctx_verts_len,
WeldPoly r_wp,
WeldMesh r_weld_mesh,
uint r_poly_kill,
uint r_loop_kill 
)
static

◆ weld_vert_ctx_alloc_and_setup()

static void weld_vert_ctx_alloc_and_setup ( const uint  mvert_len,
uint r_vert_dest_map,
WeldVert **  r_wvert,
uint r_wvert_len 
)
static

◆ weld_vert_groups_setup()

static void weld_vert_groups_setup ( const uint  mvert_len,
const uint  wvert_len,
const WeldVert wvert,
const uint vert_dest_map,
uint r_vert_groups_map,
uint **  r_vert_groups_buffer,
struct WeldGroup **  r_vert_groups 
)
static

◆ weldModifier_doWeld()

static Mesh* weldModifier_doWeld ( WeldModifierData wmd,
const ModifierEvalContext ctx,
Mesh mesh 
)
static

Definition at line 1576 of file MOD_weld.c.

References BKE_defvert_find_weight(), BKE_mesh_new_nomain_from_template(), BKE_object_defgroup_name_index(), BLI_array_alloca, BLI_assert, BLI_BITMAP_ENABLE, BLI_BITMAP_NEW, BLI_BITMAP_TEST, BLI_bvhtree_overlap_ex(), BVH_OVERLAP_RETURN_PAIRS, bvhtree_from_mesh_verts_ex(), CD_MASK_NORMAL, CD_MDEFORMVERT, MVert::co, WeldVertexCluster::co, copy_v3_v3(), count, CustomData_copy_data(), CustomData_get_layer(), customdata_weld(), data, WeldModifierData::defgrp_name, e, MLoop::e, WeldLoopOfPolyIter::e, WeldMesh::edge_groups, WeldMesh::edge_groups_buffer, WeldMesh::edge_groups_map, WeldMesh::edge_kill_len, ELEM_MERGED, MEdge::flag, WeldModifierData::flag, free_bvhtree_from_mesh(), WeldGroupEdge::group, WeldLoopOfPolyIter::group_len, BVHTreeOverlap::indexA, BVHTreeOverlap::indexB, Mesh::ldata, WeldGroup::len, len_squared_v3(), WeldMesh::loop_kill_len, WeldMesh::loop_map, MPoly::loopstart, madd_v3_v3fl(), WeldMesh::max_poly_len, ME_LOOSEEDGE, Mesh::medge, MEM_freeN, MEM_malloc_arrayN, WeldModifierData::merge_dist, WeldVertexCluster::merged_verts, mesh, Mesh::mloop, MOD_WELD_INVERT_VGROUP, MOD_WELD_MODE_ALL, MOD_WELD_MODE_CONNECTED, WeldModifierData::mode, Mesh::mpoly, Mesh::mvert, NULL, ModifierEvalContext::object, WeldGroup::ofs, OUT_OF_CONTEXT, WeldPoly::poly_dst, WeldMesh::poly_kill_len, WeldMesh::poly_map, range_vn_u(), result, square_f(), sub_v3_v3v3(), SWAP, Mesh::totedge, Mesh::totloop, MPoly::totloop, Mesh::totpoly, Mesh::totvert, tree, WeldLoopOfPolyIter::type, v, MLoop::v, WeldLoopOfPolyIter::v, v1, MEdge::v1, WeldGroupEdge::v1, v2, MEdge::v2, WeldGroupEdge::v2, WeldMesh::vert_groups, WeldMesh::vert_groups_buffer, WeldMesh::vert_kill_len, weld_iter_loop_of_poly_begin(), weld_iter_loop_of_poly_next(), weld_mesh_context_create(), weld_mesh_context_free(), WeldMesh::wloop, WeldMesh::wpoly, WeldMesh::wpoly_new, and WeldMesh::wpoly_new_len.

Referenced by modifyMesh().

Variable Documentation

◆ modifierType_Weld

ModifierTypeInfo modifierType_Weld

Definition at line 2036 of file MOD_weld.c.