Blender  V2.93
Macros | Enumerations | Functions
BKE_data_transfer.h File Reference
#include "BKE_customdata.h"

Go to the source code of this file.

Macros

#define DT_TYPE_MAX   27
 
#define DT_DATATYPE_IS_VERT(_dt)    ELEM(_dt, DT_TYPE_MDEFORMVERT, DT_TYPE_SHAPEKEY, DT_TYPE_SKIN, DT_TYPE_BWEIGHT_VERT)
 
#define DT_DATATYPE_IS_EDGE(_dt)
 
#define DT_DATATYPE_IS_LOOP(_dt)   ELEM(_dt, DT_TYPE_UV, DT_TYPE_VCOL, DT_TYPE_LNOR)
 
#define DT_DATATYPE_IS_POLY(_dt)   ELEM(_dt, DT_TYPE_UV, DT_TYPE_SHARP_FACE, DT_TYPE_FREESTYLE_FACE)
 
#define DT_DATATYPE_IS_MULTILAYERS(_dt)    ELEM(_dt, DT_TYPE_MDEFORMVERT, DT_TYPE_SHAPEKEY, DT_TYPE_VCOL, DT_TYPE_UV)
 

Enumerations

enum  {
  DT_TYPE_MDEFORMVERT = 1 << 0 , DT_TYPE_SHAPEKEY = 1 << 1 , DT_TYPE_SKIN = 1 << 2 , DT_TYPE_BWEIGHT_VERT = 1 << 3 ,
  DT_TYPE_SHARP_EDGE = 1 << 8 , DT_TYPE_SEAM = 1 << 9 , DT_TYPE_CREASE = 1 << 10 , DT_TYPE_BWEIGHT_EDGE = 1 << 11 ,
  DT_TYPE_FREESTYLE_EDGE = 1 << 12 , DT_TYPE_VCOL = 1 << 16 , DT_TYPE_LNOR = 1 << 17 , DT_TYPE_UV = 1 << 24 ,
  DT_TYPE_SHARP_FACE = 1 << 25 , DT_TYPE_FREESTYLE_FACE = 1 << 26 , DT_TYPE_VERT_ALL = DT_TYPE_MDEFORMVERT | DT_TYPE_SHAPEKEY | DT_TYPE_SKIN | DT_TYPE_BWEIGHT_VERT , DT_TYPE_EDGE_ALL ,
  DT_TYPE_LOOP_ALL = DT_TYPE_VCOL | DT_TYPE_LNOR | DT_TYPE_UV , DT_TYPE_POLY_ALL = DT_TYPE_UV | DT_TYPE_SHARP_FACE | DT_TYPE_FREESTYLE_FACE
}
 
enum  {
  DT_MULTILAYER_INDEX_INVALID = -1 , DT_MULTILAYER_INDEX_MDEFORMVERT = 0 , DT_MULTILAYER_INDEX_SHAPEKEY = 1 , DT_MULTILAYER_INDEX_VCOL = 2 ,
  DT_MULTILAYER_INDEX_UV = 3 , DT_MULTILAYER_INDEX_MAX = 4
}
 
enum  {
  DT_LAYERS_ACTIVE_SRC = -1 , DT_LAYERS_ALL_SRC = -2 , DT_LAYERS_VGROUP_SRC = 1 << 8 , DT_LAYERS_VGROUP_SRC_BONE_SELECT = -(DT_LAYERS_VGROUP_SRC | 1) ,
  DT_LAYERS_VGROUP_SRC_BONE_DEFORM = -(DT_LAYERS_VGROUP_SRC | 2)
}
 
enum  { DT_LAYERS_ACTIVE_DST = -1 , DT_LAYERS_NAME_DST = -2 , DT_LAYERS_INDEX_DST = -3 }
 

Functions

void BKE_object_data_transfer_dttypes_to_cdmask (const int dtdata_types, struct CustomData_MeshMasks *r_data_masks)
 
bool BKE_object_data_transfer_get_dttypes_capacity (const int dtdata_types, bool *r_advanced_mixing, bool *r_threshold)
 
int BKE_object_data_transfer_get_dttypes_item_types (const int dtdata_types)
 
int BKE_object_data_transfer_dttype_to_cdtype (const int dtdata_type)
 
int BKE_object_data_transfer_dttype_to_srcdst_index (const int dtdata_type)
 
void BKE_object_data_transfer_layout (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, const int data_types, const bool use_delete, const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX])
 
bool BKE_object_data_transfer_mesh (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, const int data_types, const bool use_create, const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode, struct SpaceTransform *space_transform, const bool auto_transform, const float max_distance, const float ray_radius, const float islands_handling_precision, const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX], const int mix_mode, const float mix_factor, const char *vgroup_name, const bool invert_vgroup, struct ReportList *reports)
 
bool BKE_object_data_transfer_ex (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, struct Mesh *me_dst, const int data_types, bool use_create, const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode, struct SpaceTransform *space_transform, const bool auto_transform, const float max_distance, const float ray_radius, const float islands_handling_precision, const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX], const int mix_mode, const float mix_factor, const char *vgroup_name, const bool invert_vgroup, struct ReportList *reports)
 

Macro Definition Documentation

◆ DT_DATATYPE_IS_EDGE

#define DT_DATATYPE_IS_EDGE (   _dt)
Value:
ELEM(_dt, \
@ DT_TYPE_CREASE
@ DT_TYPE_SEAM
@ DT_TYPE_BWEIGHT_EDGE
@ DT_TYPE_FREESTYLE_EDGE
@ DT_TYPE_SHARP_EDGE
#define ELEM(...)

Definition at line 78 of file BKE_data_transfer.h.

◆ DT_DATATYPE_IS_LOOP

#define DT_DATATYPE_IS_LOOP (   _dt)    ELEM(_dt, DT_TYPE_UV, DT_TYPE_VCOL, DT_TYPE_LNOR)

Definition at line 85 of file BKE_data_transfer.h.

◆ DT_DATATYPE_IS_MULTILAYERS

#define DT_DATATYPE_IS_MULTILAYERS (   _dt)     ELEM(_dt, DT_TYPE_MDEFORMVERT, DT_TYPE_SHAPEKEY, DT_TYPE_VCOL, DT_TYPE_UV)

Definition at line 88 of file BKE_data_transfer.h.

◆ DT_DATATYPE_IS_POLY

#define DT_DATATYPE_IS_POLY (   _dt)    ELEM(_dt, DT_TYPE_UV, DT_TYPE_SHARP_FACE, DT_TYPE_FREESTYLE_FACE)

Definition at line 86 of file BKE_data_transfer.h.

◆ DT_DATATYPE_IS_VERT

#define DT_DATATYPE_IS_VERT (   _dt)     ELEM(_dt, DT_TYPE_MDEFORMVERT, DT_TYPE_SHAPEKEY, DT_TYPE_SKIN, DT_TYPE_BWEIGHT_VERT)

Definition at line 76 of file BKE_data_transfer.h.

◆ DT_TYPE_MAX

#define DT_TYPE_MAX   27

Definition at line 57 of file BKE_data_transfer.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DT_TYPE_MDEFORMVERT 
DT_TYPE_SHAPEKEY 
DT_TYPE_SKIN 
DT_TYPE_BWEIGHT_VERT 
DT_TYPE_SHARP_EDGE 
DT_TYPE_SEAM 
DT_TYPE_CREASE 
DT_TYPE_BWEIGHT_EDGE 
DT_TYPE_FREESTYLE_EDGE 
DT_TYPE_VCOL 
DT_TYPE_LNOR 
DT_TYPE_UV 
DT_TYPE_SHARP_FACE 
DT_TYPE_FREESTYLE_FACE 
DT_TYPE_VERT_ALL 
DT_TYPE_EDGE_ALL 
DT_TYPE_LOOP_ALL 
DT_TYPE_POLY_ALL 

Definition at line 39 of file BKE_data_transfer.h.

◆ anonymous enum

anonymous enum
Enumerator
DT_MULTILAYER_INDEX_INVALID 
DT_MULTILAYER_INDEX_MDEFORMVERT 
DT_MULTILAYER_INDEX_SHAPEKEY 
DT_MULTILAYER_INDEX_VCOL 
DT_MULTILAYER_INDEX_UV 
DT_MULTILAYER_INDEX_MAX 

Definition at line 91 of file BKE_data_transfer.h.

◆ anonymous enum

anonymous enum
Enumerator
DT_LAYERS_ACTIVE_SRC 
DT_LAYERS_ALL_SRC 
DT_LAYERS_VGROUP_SRC 
DT_LAYERS_VGROUP_SRC_BONE_SELECT 
DT_LAYERS_VGROUP_SRC_BONE_DEFORM 

Definition at line 104 of file BKE_data_transfer.h.

◆ anonymous enum

anonymous enum
Enumerator
DT_LAYERS_ACTIVE_DST 
DT_LAYERS_NAME_DST 
DT_LAYERS_INDEX_DST 

Definition at line 116 of file BKE_data_transfer.h.

Function Documentation

◆ BKE_object_data_transfer_dttype_to_cdtype()

int BKE_object_data_transfer_dttype_to_cdtype ( const int  dtdata_type)

◆ BKE_object_data_transfer_dttype_to_srcdst_index()

int BKE_object_data_transfer_dttype_to_srcdst_index ( const int  dtdata_type)

◆ BKE_object_data_transfer_dttypes_to_cdmask()

void BKE_object_data_transfer_dttypes_to_cdmask ( const int  dtdata_types,
struct CustomData_MeshMasks r_data_masks 
)

◆ BKE_object_data_transfer_ex()

bool BKE_object_data_transfer_ex ( struct Depsgraph depsgraph,
struct Scene scene,
struct Object ob_src,
struct Object ob_dst,
struct Mesh me_dst,
const int  data_types,
bool  use_create,
const int  map_vert_mode,
const int  map_edge_mode,
const int  map_loop_mode,
const int  map_poly_mode,
struct SpaceTransform space_transform,
const bool  auto_transform,
const float  max_distance,
const float  ray_radius,
const float  islands_handling_precision,
const int  fromlayers_select[DT_MULTILAYER_INDEX_MAX],
const int  tolayers_select[DT_MULTILAYER_INDEX_MAX],
const int  mix_mode,
const float  mix_factor,
const char *  vgroup_name,
const bool  invert_vgroup,
struct ReportList reports 
)

Definition at line 1374 of file data_transfer.c.

References BKE_defvert_extract_vgroup_to_edgeweights(), BKE_defvert_extract_vgroup_to_loopweights(), BKE_defvert_extract_vgroup_to_polyweights(), BKE_defvert_extract_vgroup_to_vertweights(), BKE_mesh_remap_calc_edges_from_mesh(), BKE_mesh_remap_calc_loops_from_mesh(), BKE_mesh_remap_calc_polys_from_mesh(), BKE_mesh_remap_calc_source_cddata_masks_from_map_modes(), BKE_mesh_remap_calc_verts_from_mesh(), BKE_mesh_remap_find_best_match_from_mesh(), BKE_mesh_remap_free(), BKE_mesh_wrapper_ensure_mdata(), BKE_modifier_get_evaluated_mesh_from_evaluated_object(), BKE_object_data_transfer_dttype_to_cdtype(), BKE_object_data_transfer_dttype_to_srcdst_index(), BKE_object_data_transfer_dttypes_to_cdmask(), BKE_object_defgroup_name_index(), BKE_report(), BLI_assert, BLI_freelistN(), Mesh_Runtime::cd_dirty_vert, CD_MASK_BAREMESH, CD_MDEFORMVERT, CD_NORMAL, CLOG_WARN, CustomData_data_transfer(), CustomData_get_layer(), CustomData_MeshMasks_are_matching(), Object::data, data_transfer_dtdata_type_postprocess(), data_transfer_dtdata_type_preprocess(), data_transfer_get_loop_islands_generator(), data_transfer_layersmapping_generate(), DATAMAX, depsgraph, DT_DATATYPE_IS_EDGE, DT_DATATYPE_IS_LOOP, DT_DATATYPE_IS_POLY, DT_DATATYPE_IS_VERT, DT_MULTILAYER_INDEX_INVALID, DT_TYPE_MAX, EDATA, ELEM, ListBase::first, Mesh::flag, Object_Runtime::last_data_mask, LDATA, Mesh::ldata, LOG, ME_AUTOSMOOTH, ME_EDGE, ME_LOOP, ME_POLY, ME_VERT, Mesh::medge, MEM_mallocN, MEM_SAFE_FREE, mesh_get_eval_final(), Mesh::mloop, Mesh::mpoly, MREMAP_MODE_TOPOLOGY, MREMAP_USE_EDGE, MREMAP_USE_POLY, Mesh::mvert, CustomDataTransferLayerMap::next, NULL, OB_MESH, PDATA, RPT_ERROR, Mesh::runtime, Object::runtime, scene, Mesh::smoothresh, Mesh::totedge, Mesh::totloop, Mesh::totpoly, Mesh::totvert, Object::type, and VDATA.

Referenced by BKE_object_data_transfer_mesh(), and modifyMesh().

◆ BKE_object_data_transfer_get_dttypes_capacity()

bool BKE_object_data_transfer_get_dttypes_capacity ( const int  dtdata_types,
bool *  r_advanced_mixing,
bool *  r_threshold 
)

Check what can do each layer type (if it is actually handled by transfer-data, if it supports advanced mixing.

Definition at line 100 of file data_transfer.c.

References DT_TYPE_BWEIGHT_EDGE, DT_TYPE_BWEIGHT_VERT, DT_TYPE_CREASE, DT_TYPE_FREESTYLE_EDGE, DT_TYPE_FREESTYLE_FACE, DT_TYPE_LNOR, DT_TYPE_MAX, DT_TYPE_MDEFORMVERT, DT_TYPE_SEAM, DT_TYPE_SHARP_EDGE, DT_TYPE_SHARP_FACE, DT_TYPE_SKIN, DT_TYPE_UV, DT_TYPE_VCOL, and ret.

Referenced by dt_mix_mode_itemf().

◆ BKE_object_data_transfer_get_dttypes_item_types()

int BKE_object_data_transfer_get_dttypes_item_types ( const int  dtdata_types)

◆ BKE_object_data_transfer_layout()

void BKE_object_data_transfer_layout ( struct Depsgraph depsgraph,
Scene scene,
Object ob_src,
Object ob_dst,
const int  data_types,
const bool  use_delete,
const int  fromlayers_select[DT_MULTILAYER_INDEX_MAX],
const int  tolayers_select[DT_MULTILAYER_INDEX_MAX] 
)

Transfer data layout of selected types from source to destination object. By default, it only creates new data layers if needed on ob_dst. If use_delete is true, it will also delete data layers on ob_dst that do not match those from ob_src, to get (as much as possible) exact copy of source data layout.

Definition at line 1243 of file data_transfer.c.

References BKE_object_data_transfer_dttype_to_cdtype(), BKE_object_data_transfer_dttype_to_srcdst_index(), BKE_object_data_transfer_dttypes_to_cdmask(), BLI_assert, CD_MASK_BAREMESH, Object::data, data_transfer_layersmapping_generate(), depsgraph, DT_DATATYPE_IS_EDGE, DT_DATATYPE_IS_LOOP, DT_DATATYPE_IS_POLY, DT_DATATYPE_IS_VERT, DT_MULTILAYER_INDEX_INVALID, DT_TYPE_MAX, ME_EDGE, ME_LOOP, ME_POLY, ME_VERT, mesh_get_eval_final(), NULL, OB_MESH, scene, Mesh::totedge, Mesh::totloop, Mesh::totpoly, Mesh::totvert, and Object::type.

Referenced by datalayout_transfer_exec().

◆ BKE_object_data_transfer_mesh()

bool BKE_object_data_transfer_mesh ( struct Depsgraph depsgraph,
struct Scene scene,
struct Object ob_src,
struct Object ob_dst,
const int  data_types,
const bool  use_create,
const int  map_vert_mode,
const int  map_edge_mode,
const int  map_loop_mode,
const int  map_poly_mode,
struct SpaceTransform space_transform,
const bool  auto_transform,
const float  max_distance,
const float  ray_radius,
const float  islands_handling_precision,
const int  fromlayers_select[DT_MULTILAYER_INDEX_MAX],
const int  tolayers_select[DT_MULTILAYER_INDEX_MAX],
const int  mix_mode,
const float  mix_factor,
const char *  vgroup_name,
const bool  invert_vgroup,
struct ReportList reports 
)

Definition at line 1862 of file data_transfer.c.

References BKE_object_data_transfer_ex(), depsgraph, NULL, and scene.

Referenced by data_transfer_exec().