Blender V4.3
data_transfer.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 "DNA_scene_types.h"
#include "BLI_blenlib.h"
#include "BLI_math_matrix.h"
#include "BLI_utildefines.h"
#include "BKE_attribute.hh"
#include "BKE_customdata.hh"
#include "BKE_data_transfer.h"
#include "BKE_deform.hh"
#include "BKE_mesh.hh"
#include "BKE_mesh_mapping.hh"
#include "BKE_mesh_remap.hh"
#include "BKE_mesh_runtime.hh"
#include "BKE_mesh_wrapper.hh"
#include "BKE_modifier.hh"
#include "BKE_object.hh"
#include "BKE_object_deform.h"
#include "BKE_report.hh"
#include "DEG_depsgraph_query.hh"
#include "data_transfer_intern.h"

Go to the source code of this file.

Macros

#define VDATA   0
 
#define EDATA   1
 
#define LDATA   2
 
#define PDATA   3
 
#define DATAMAX   4
 

Functions

void BKE_object_data_transfer_dttypes_to_cdmask (const int dtdata_types, 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)
 
static void data_transfer_mesh_attributes_transfer_active_color_string (Mesh *mesh_dst, const Mesh *mesh_src, const AttrDomainMask mask_domain, const int data_type)
 
static void data_transfer_mesh_attributes_transfer_default_color_string (Mesh *mesh_dst, const Mesh *mesh_src, const AttrDomainMask mask_domain, const int data_type)
 
static void data_transfer_dtdata_type_postprocess (Mesh *me_dst, const int dtdata_type, const bool changed)
 
static MeshRemapIslandsCalc data_transfer_get_loop_islands_generator (const int cddata_type)
 
float data_transfer_interp_float_do (const int mix_mode, const float val_dst, const float val_src, const float mix_factor)
 
void data_transfer_layersmapping_add_item (ListBase *r_map, const int cddata_type, const int mix_mode, const float mix_factor, const float *mix_weights, const void *data_src, void *data_dst, const int data_src_n, const int data_dst_n, const size_t elem_size, const size_t data_size, const size_t data_offset, const uint64_t data_flag, cd_datatransfer_interp interp, void *interp_data)
 
static void data_transfer_layersmapping_add_item_cd (ListBase *r_map, const int cddata_type, const int mix_mode, const float mix_factor, const float *mix_weights, const void *data_src, void *data_dst, cd_datatransfer_interp interp, void *interp_data)
 
static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst (ListBase *r_map, const eCustomDataType cddata_type, const int mix_mode, const float mix_factor, const float *mix_weights, const int num_elem_dst, const bool use_create, const bool use_delete, const CustomData *cd_src, CustomData *cd_dst, const int tolayers, const bool *use_layers_src, const int num_layers_src, cd_datatransfer_interp interp, void *interp_data)
 
static bool data_transfer_layersmapping_cdlayers (ListBase *r_map, const eCustomDataType cddata_type, const int mix_mode, const float mix_factor, const float *mix_weights, const int num_elem_dst, const bool use_create, const bool use_delete, const CustomData *cd_src, CustomData *cd_dst, const int fromlayers, const int tolayers, cd_datatransfer_interp interp, void *interp_data)
 
static bool data_transfer_layersmapping_generate (ListBase *r_map, Object *ob_src, Object *ob_dst, const Mesh *me_src, Mesh *me_dst, const int elem_type, int cddata_type, int mix_mode, float mix_factor, const float *mix_weights, const int num_elem_dst, const bool use_create, const bool use_delete, const int fromlayers, const int tolayers, SpaceTransform *space_transform)
 
void BKE_object_data_transfer_layout (Depsgraph *depsgraph, 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])
 
bool BKE_object_data_transfer_ex (Depsgraph *depsgraph, Object *ob_src, Object *ob_dst, 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_face_mode, 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, ReportList *reports)
 
bool BKE_object_data_transfer_mesh (Depsgraph *depsgraph, Object *ob_src, 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_face_mode, 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, ReportList *reports)
 

Macro Definition Documentation

◆ DATAMAX

#define DATAMAX   4

◆ EDATA

#define EDATA   1

◆ LDATA

#define LDATA   2

◆ PDATA

#define PDATA   3

◆ VDATA

#define VDATA   0

Function Documentation

◆ BKE_object_data_transfer_dttype_to_cdtype()

◆ BKE_object_data_transfer_dttype_to_srcdst_index()

◆ BKE_object_data_transfer_dttypes_to_cdmask()

◆ BKE_object_data_transfer_ex()

bool BKE_object_data_transfer_ex ( Depsgraph * depsgraph,
Object * ob_src,
Object * ob_dst,
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_face_mode,
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,
ReportList * reports )

Definition at line 1306 of file data_transfer.cc.

References BKE_defvert_extract_vgroup_to_edgeweights(), BKE_defvert_extract_vgroup_to_faceweights(), BKE_defvert_extract_vgroup_to_loopweights(), BKE_defvert_extract_vgroup_to_vertweights(), BKE_id_defgroup_name_index(), BKE_mesh_remap_calc_edges_from_mesh(), BKE_mesh_remap_calc_faces_from_mesh(), BKE_mesh_remap_calc_loops_from_mesh(), 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_get_evaluated_mesh(), BKE_report(), BLI_assert, BLI_freelistN(), CD_MDEFORMVERT, Mesh::corners_num, CustomData_data_transfer(), CustomData_get_layer(), blender::MutableSpan< T >::data(), blender::Span< T >::data(), Object::data, data_transfer_dtdata_type_postprocess(), data_transfer_get_loop_islands_generator(), data_transfer_layersmapping_generate(), DATAMAX, DEG_get_evaluated_object(), depsgraph, DT_DATATYPE_IS_EDGE, DT_DATATYPE_IS_FACE, DT_DATATYPE_IS_LOOP, DT_DATATYPE_IS_VERT, DT_MULTILAYER_INDEX_INVALID, DT_TYPE_MAX, EDATA, Mesh::edges_num, ELEM, Mesh::faces_num, ListBase::first, Mesh::id, LDATA, LISTBASE_FOREACH, ME_EDGE, ME_LOOP, ME_POLY, ME_VERT, MEM_mallocN, MEM_SAFE_FREE, MREMAP_MODE_TOPOLOGY, MREMAP_USE_EDGE, MREMAP_USE_POLY, OB_MESH, PDATA, RPT_ERROR, blender::offset_indices::OffsetIndices< T >::size(), blender::Span< T >::size(), Object::type, VDATA, Mesh::vert_data, and Mesh::verts_num.

Referenced by BKE_object_data_transfer_mesh(), and modify_mesh().

◆ BKE_object_data_transfer_get_dttypes_capacity()

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

◆ 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,
struct Object * ob_src,
struct Object * ob_dst,
int data_types,
bool use_delete,
const int fromlayers_select[DT_MULTILAYER_INDEX_MAX],
const int tolayers_select[DT_MULTILAYER_INDEX_MAX] )

◆ BKE_object_data_transfer_mesh()

bool BKE_object_data_transfer_mesh ( Depsgraph * depsgraph,
Object * ob_src,
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_face_mode,
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,
ReportList * reports )

Definition at line 1777 of file data_transfer.cc.

References BKE_object_data_transfer_ex(), and depsgraph.

Referenced by blender::ed::object::data_transfer_exec().

◆ data_transfer_dtdata_type_postprocess()

◆ data_transfer_get_loop_islands_generator()

static MeshRemapIslandsCalc data_transfer_get_loop_islands_generator ( const int cddata_type)
static

◆ data_transfer_interp_float_do()

float data_transfer_interp_float_do ( const int mix_mode,
const float val_dst,
const float val_src,
const float mix_factor )

◆ data_transfer_layersmapping_add_item()

◆ data_transfer_layersmapping_add_item_cd()

static void data_transfer_layersmapping_add_item_cd ( ListBase * r_map,
const int cddata_type,
const int mix_mode,
const float mix_factor,
const float * mix_weights,
const void * data_src,
void * data_dst,
cd_datatransfer_interp interp,
void * interp_data )
static

◆ data_transfer_layersmapping_cdlayers()

◆ data_transfer_layersmapping_cdlayers_multisrc_to_dst()

static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst ( ListBase * r_map,
const eCustomDataType cddata_type,
const int mix_mode,
const float mix_factor,
const float * mix_weights,
const int num_elem_dst,
const bool use_create,
const bool use_delete,
const CustomData * cd_src,
CustomData * cd_dst,
const int tolayers,
const bool * use_layers_src,
const int num_layers_src,
cd_datatransfer_interp interp,
void * interp_data )
static
Note
All those layer mapping handlers return false only if they were given invalid parameters. This means that even if they do nothing, they will return true if all given parameters were OK. Also, r_map may be nullptr, in which case they will 'only' create/delete destination layers according to given parameters.

Definition at line 535 of file data_transfer.cc.

References CD_SET_DEFAULT, CustomData_add_layer(), CustomData_add_layer_named(), CustomData_free_layer(), CustomData_get_layer_n(), CustomData_get_layer_n_for_write(), CustomData_get_layer_name(), CustomData_get_named_layer(), CustomData_number_of_layers(), data_transfer_layersmapping_add_item_cd(), DT_LAYERS_INDEX_DST, DT_LAYERS_NAME_DST, interp(), MEM_freeN(), and MEM_mallocN.

Referenced by data_transfer_layersmapping_cdlayers().

◆ data_transfer_layersmapping_generate()

◆ data_transfer_mesh_attributes_transfer_active_color_string()

static void data_transfer_mesh_attributes_transfer_active_color_string ( Mesh * mesh_dst,
const Mesh * mesh_src,
const AttrDomainMask mask_domain,
const int data_type )
static

When transferring color attributes, also transfer the active color attribute string. If a match can't be found, use the first color layer that can be found (to ensure a valid string is set).

Definition at line 256 of file data_transfer.cc.

References Mesh::active_color_attribute, ATTR_DOMAIN_MASK_COLOR, BKE_attribute_from_index(), BKE_attribute_search(), BKE_id_attributes_active_color_name(), BLI_strdup(), CD_MASK_COLOR_ALL, CD_MASK_PROP_BYTE_COLOR, CD_MASK_PROP_COLOR, CD_PROP_BYTE_COLOR, CD_PROP_COLOR, AttributeOwner::from_id(), Mesh::id, and CustomDataLayer::name.

Referenced by BKE_object_data_transfer_layout().

◆ data_transfer_mesh_attributes_transfer_default_color_string()

static void data_transfer_mesh_attributes_transfer_default_color_string ( Mesh * mesh_dst,
const Mesh * mesh_src,
const AttrDomainMask mask_domain,
const int data_type )
static

When transferring color attributes, also transfer the default color attribute string. If a match cant be found, use the first color layer that can be found (to ensure a valid string is set).

Definition at line 307 of file data_transfer.cc.

References ATTR_DOMAIN_MASK_COLOR, BKE_attribute_from_index(), BKE_attribute_search(), BKE_id_attributes_default_color_name(), BLI_strdup(), CD_MASK_COLOR_ALL, CD_MASK_PROP_BYTE_COLOR, CD_MASK_PROP_COLOR, CD_PROP_BYTE_COLOR, CD_PROP_COLOR, Mesh::default_color_attribute, AttributeOwner::from_id(), Mesh::id, and CustomDataLayer::name.

Referenced by BKE_object_data_transfer_layout().