Blender V5.3
mesh_legacy_convert.cc File Reference
#include "MEM_guardedalloc.h"
#include "DNA_customdata_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "BLI_array_utils.hh"
#include "BLI_listbase.hh"
#include "BLI_map.hh"
#include "BLI_math_geom_c.hh"
#include "BLI_math_matrix_c.hh"
#include "BLI_math_rotation_c.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_memarena.hh"
#include "BLI_multi_value_map.hh"
#include "BLI_ordered_edge.hh"
#include "BLI_polyfill_2d.hh"
#include "BLI_resource_scope.hh"
#include "BLI_string.hh"
#include "BLI_string_utf8.hh"
#include "BLI_task.hh"
#include "BLI_utildefines.hh"
#include "BKE_attribute.h"
#include "BKE_attribute.hh"
#include "BKE_attribute_legacy_convert.hh"
#include "BKE_customdata.hh"
#include "BKE_global.hh"
#include "BKE_idprop.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_main_namemap.hh"
#include "BKE_mesh.hh"
#include "BKE_mesh_legacy_convert.hh"
#include "BKE_modifier.hh"
#include "BKE_multires.hh"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.hh"
#include "NOD_geometry_nodes_srna.hh"
#include "BLT_translation.hh"

Go to the source code of this file.

Classes

struct  blender::EdgeSort

Namespaces

namespace  blender
 BMesh Iterators.
namespace  blender::bke

Macros

#define DNA_DEPRECATED_ALLOW
#define ML(v1, v2)
#define LAYER_CMP(l_a, t_a, l_b, t_b)
#define USE_TESSFACE_SPEEDUP
#define USE_TESSFACE_QUADS
#define TESSFACE_IS_QUAD   1
#define ML_TO_MF(i1, i2, i3)
#define ML_TO_MF_QUAD()

Functions

static bNodeTree * blender::bke::add_auto_smooth_node_tree (Main &bmain, Library *owner_library)
static VectorSet< const bNodeSocket * > blender::bke::build_socket_indices (const Span< const bNode * > nodes)
static bool blender::bke::is_auto_smooth_node_tree (const bNodeTree &group)
static ModifierData * blender::bke::create_auto_smooth_modifier (Object &object, const FunctionRef< bNodeTree *(Library *owner_library)> get_node_group, const float angle)
void blender::bke::mesh_sculpt_mask_to_generic (Mesh &mesh)
void blender::bke::mesh_freestyle_marks_to_generic (Mesh &mesh)
void blender::bke::mesh_skin_to_generic (Mesh &mesh)
void blender::bke::mesh_skin_to_legacy (AttributeStorage::BlendWriteData &attr_write_data, CustomData &vert_data, Vector< CustomDataLayer, 16 > &vert_layers, int verts_num)
void blender::bke::mesh_custom_normals_to_generic (Mesh &mesh)
void blender::bke::mesh_uv_select_to_single_attribute (Mesh &mesh)
void blender::BKE_mesh_calc_edges_tessface (Mesh *mesh)
Legacy Edge Calculation
static void blender::to_edgesort (EdgeSort *ed, uint v1, uint v2, char is_loose, short is_draw)
static int blender::vergedgesort (const void *v1, const void *v2)
static void blender::mesh_calc_edges_mdata (const MVert *, const MFace *allface, MLoop *allloop, const MPoly *allpoly, int, int totface, int, int faces_num, MEdge **r_medge, int *r_totedge)
void blender::BKE_mesh_calc_edges_legacy (Mesh *mesh)
void blender::BKE_mesh_strip_loose_faces (Mesh *mesh)
CD Flag Initialization
void blender::BKE_mesh_do_versions_cd_flag_init (Mesh *mesh)
Sharp Edge Conversion
void blender::BKE_mesh_legacy_sharp_faces_from_flags (Mesh *mesh)
void blender::BKE_mesh_legacy_sharp_edges_from_flags (Mesh *mesh)
Face Set Conversion
void blender::BKE_mesh_legacy_face_set_to_generic (Mesh *mesh)
Face Map Conversion
static void blender::move_face_map_data_to_attributes (Mesh *mesh)
void blender::BKE_mesh_legacy_face_map_to_generic (Main *bmain)
Bevel Weight Conversion
void blender::BKE_mesh_legacy_bevel_weight_to_layers (Mesh *mesh)
static void blender::replace_custom_data_layer_with_named (CustomData &custom_data, const eCustomDataType old_type, const eCustomDataType new_type, const int elems_num, const char *new_name)
void blender::BKE_mesh_legacy_bevel_weight_to_generic (Mesh *mesh)
Crease Conversion
void blender::BKE_mesh_legacy_edge_crease_to_layers (Mesh *mesh)
void blender::BKE_mesh_legacy_crease_to_generic (Mesh *mesh)
UV Seam Conversion
void blender::BKE_mesh_legacy_uv_seam_from_flags (Mesh *mesh)
Hide Attribute and Legacy Flag Conversion
void blender::BKE_mesh_legacy_convert_flags_to_hide_layers (Mesh *mesh)
Material Index Conversion
void blender::BKE_mesh_legacy_convert_mpoly_to_material_indices (Mesh *mesh)
Generic UV Map Conversion
void blender::BKE_mesh_legacy_convert_uvs_to_generic (Mesh *mesh)
Selection Attribute and Legacy Flag Conversion
void blender::BKE_mesh_legacy_convert_flags_to_selection_layers (Mesh *mesh)
Vertex and Position Conversion
void blender::BKE_mesh_legacy_convert_verts_to_positions (Mesh *mesh)
MEdge and int2 conversion
void blender::BKE_mesh_legacy_convert_edges_to_generic (Mesh *mesh)
Attribute Active Flag to String Conversion
void blender::BKE_mesh_legacy_attribute_flags_to_strings (Mesh *mesh)
Face Corner Conversion
void blender::BKE_mesh_legacy_convert_loops_to_corners (Mesh *mesh)
Poly Offset Conversion
static bool blender::poly_loops_orders_match (const Span< MPoly > polys)
void blender::BKE_mesh_legacy_convert_polys_to_offsets (Mesh *mesh)
Auto Smooth Conversion
void blender::BKE_main_mesh_legacy_convert_auto_smooth (Main &bmain)

NGon Tessellation (NGon to MFace Conversion)

#define MESH_MLOOPCOL_FROM_MCOL(_mloopcol, _mcol)
static void blender::bm_corners_to_loops_ex (ID *id, CustomData *fdata_legacy, const int totface, CustomData *ldata, MFace *mface, int totloop, int findex, int loopstart, int numTex, int numCol)
static void blender::CustomData_to_bmeshpoly (CustomData *fdata_legacy, CustomData *ldata, int totloop)
static void blender::convert_mfaces_to_mpolys (ID *id, CustomData *fdata_legacy, CustomData *ldata, CustomData *pdata, int totedge_i, int totface_i, int, int, int2 *edges, MFace *mface, int *r_totloop, int *r_faces_num)
static void blender::update_active_fdata_layers (Mesh &mesh, CustomData *fdata_legacy, CustomData *ldata)
static bool blender::check_matching_legacy_layer_counts (CustomData *fdata_legacy, CustomData *ldata, bool fallback)
static VectorSet< StringRefNull > blender::get_mloopcol_names (const Mesh &mesh)
static void blender::add_mface_layers (Mesh &mesh, CustomData *fdata_legacy, CustomData *ldata, int total)
static void blender::mesh_ensure_tessellation_customdata (Mesh *mesh)
void blender::BKE_mesh_convert_mfaces_to_mpolys (Mesh *mesh)
static void blender::CustomData_bmesh_do_versions_update_active_layers (CustomData *fdata_legacy, CustomData *corner_data)
void blender::BKE_mesh_do_versions_convert_mfaces_to_mpolys (Mesh *mesh)

MFace Tessellation

#MFace is a legacy data-structure that should be avoided, use #Mesh::corner_tris() instead.

#define MESH_MLOOPCOL_TO_MCOL(_mloopcol, _mcol)
static void blender::mesh_loops_to_tessdata (Mesh &mesh, CustomData *fdata_legacy, CustomData *corner_data, MFace *mface, uint(*loopindices)[4], const int num_faces)
int blender::BKE_mesh_mface_index_validate (MFace *mface, CustomData *fdata_legacy, int mfindex, int nr)
static void blender::mesh_tessface_calc (Mesh &mesh)
void blender::BKE_mesh_tessface_calc (Mesh *mesh)
void blender::BKE_mesh_tessface_ensure (Mesh *mesh)

Detailed Description

Functions to convert mesh data to and from legacy formats like #MFace.

Definition in file mesh_legacy_convert.cc.

Macro Definition Documentation

◆ DNA_DEPRECATED_ALLOW

#define DNA_DEPRECATED_ALLOW

Definition at line 11 of file mesh_legacy_convert.cc.

◆ LAYER_CMP

#define LAYER_CMP ( l_a,
t_a,
l_b,
t_b )
Value:
((a_num += CustomData_number_of_layers(l_a, t_a)) == \
(b_num += CustomData_number_of_layers(l_b, t_b)))

Referenced by blender::check_matching_legacy_layer_counts().

◆ MESH_MLOOPCOL_FROM_MCOL

#define MESH_MLOOPCOL_FROM_MCOL ( _mloopcol,
_mcol )
Value:
{ \
MLoopCol *mloopcol__tmp = _mloopcol; \
const MCol *mcol__tmp = _mcol; \
mloopcol__tmp->r = mcol__tmp->b; \
mloopcol__tmp->g = mcol__tmp->g; \
mloopcol__tmp->b = mcol__tmp->r; \
mloopcol__tmp->a = mcol__tmp->a; \
} \
(void)0

Definition at line 330 of file mesh_legacy_convert.cc.

Referenced by blender::bm_corners_to_loops_ex().

◆ MESH_MLOOPCOL_TO_MCOL

#define MESH_MLOOPCOL_TO_MCOL ( _mloopcol,
_mcol )
Value:
{ \
const MLoopCol *mloopcol__tmp = _mloopcol; \
MCol *mcol__tmp = _mcol; \
mcol__tmp->b = mloopcol__tmp->r; \
mcol__tmp->g = mloopcol__tmp->g; \
mcol__tmp->r = mloopcol__tmp->b; \
mcol__tmp->a = mloopcol__tmp->a; \
} \
(void)0

Definition at line 829 of file mesh_legacy_convert.cc.

Referenced by blender::mesh_loops_to_tessdata().

◆ ML

#define ML ( v1,
v2 )
Value:
{ \
ml->v = mf->v1; \
ml->e = eh.lookup({mf->v1, mf->v2}); \
ml++; \
j++; \
} \
(void)0

Referenced by blender::convert_mfaces_to_mpolys().

◆ ML_TO_MF

#define ML_TO_MF ( i1,
i2,
i3 )
Value:
mface_to_poly_map[mface_index] = poly_index; \
mf = &mface[mface_index]; \
lidx = lindices[mface_index]; \
\
l1 = mp_loopstart + i1; \
l2 = mp_loopstart + i2; \
l3 = mp_loopstart + i3; \
mf->v1 = corner_verts[l1]; \
mf->v2 = corner_verts[l2]; \
mf->v3 = corner_verts[l3]; \
mf->v4 = 0; \
lidx[0] = l1; \
lidx[1] = l2; \
lidx[2] = l3; \
lidx[3] = 0; \
mf->mat_nr = material_indices[poly_index]; \
mf->flag = sharp_faces[poly_index] ? 0 : ME_SMOOTH; \
mf->edcode = eMFace_EdgeCode{}; \
(void)0

Referenced by blender::mesh_tessface_calc().

◆ ML_TO_MF_QUAD

#define ML_TO_MF_QUAD ( )
Value:
mface_to_poly_map[mface_index] = poly_index; \
mf = &mface[mface_index]; \
lidx = lindices[mface_index]; \
\
l1 = mp_loopstart + 0; \
l2 = mp_loopstart + 1; \
l3 = mp_loopstart + 2; \
l4 = mp_loopstart + 3; \
mf->v1 = corner_verts[l1]; \
mf->v2 = corner_verts[l2]; \
mf->v3 = corner_verts[l3]; \
mf->v4 = corner_verts[l4]; \
lidx[0] = l1; \
lidx[1] = l2; \
lidx[2] = l3; \
lidx[3] = l4; \
mf->mat_nr = material_indices[poly_index]; \
mf->flag = sharp_faces[poly_index] ? 0 : ME_SMOOTH; \
mf->edcode = eMFace_EdgeCode(TESSFACE_IS_QUAD); \
(void)0
#define TESSFACE_IS_QUAD

Referenced by blender::mesh_tessface_calc().

◆ TESSFACE_IS_QUAD

#define TESSFACE_IS_QUAD   1

◆ USE_TESSFACE_QUADS

#define USE_TESSFACE_QUADS

◆ USE_TESSFACE_SPEEDUP

#define USE_TESSFACE_SPEEDUP