Cleanup: Remove unused data transfer code

Shape key interpolation was never implemented. Nowadays it's
probably better to implement similar features in different ways
rather than extending this system. Also some layer mapping
generation was unused. The motivation for this is easing some
cleanups to make this modifier less directly reliant on CustomData.

Pull Request: https://projects.blender.org/blender/blender/pulls/142131
This commit is contained in:
Hans Goudey
2025-07-16 22:53:21 +02:00
committed by Hans Goudey
parent d669f28e05
commit e3c5070dfe
5 changed files with 13 additions and 119 deletions

View File

@@ -185,8 +185,6 @@ int BKE_object_data_transfer_dttype_to_cdtype(const int dtdata_type)
switch (dtdata_type) {
case DT_TYPE_MDEFORMVERT:
return CD_FAKE_MDEFORMVERT;
case DT_TYPE_SHAPEKEY:
return CD_FAKE_SHAPEKEY;
case DT_TYPE_SKIN:
return CD_MVERT_SKIN;
case DT_TYPE_BWEIGHT_VERT:
@@ -228,8 +226,6 @@ int BKE_object_data_transfer_dttype_to_srcdst_index(const int dtdata_type)
switch (dtdata_type) {
case DT_TYPE_MDEFORMVERT:
return DT_MULTILAYER_INDEX_MDEFORMVERT;
case DT_TYPE_SHAPEKEY:
return DT_MULTILAYER_INDEX_SHAPEKEY;
case DT_TYPE_UV:
return DT_MULTILAYER_INDEX_UV;
case DT_TYPE_MPROPCOL_VERT:
@@ -902,11 +898,6 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
fromlayers,
tolayers);
}
if (cddata_type == CD_FAKE_SHAPEKEY) {
/* TODO: leaving shape-keys aside for now, quite specific case,
* since we can't access them from mesh vertices :/ */
return false;
}
if (r_map && cddata_type == CD_FAKE_BWEIGHT) {
if (!CustomData_get_layer_named(&me_dst->vert_data, CD_PROP_FLOAT, "bevel_weight_vert")) {
CustomData_add_layer_named(&me_dst->vert_data,
@@ -930,27 +921,6 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
}
}
else if (elem_type == ME_EDGE) {
if (!(cddata_type & CD_FAKE)) { /* Unused for edges, currently... */
if (!data_transfer_layersmapping_cdlayers(r_map,
eCustomDataType(cddata_type),
mix_mode,
mix_factor,
mix_weights,
num_elem_dst,
use_create,
use_delete,
me_src->edge_data,
me_dst->edge_data,
fromlayers,
tolayers,
interp,
interp_data))
{
/* We handle specific source selection cases here. */
return false;
}
return true;
}
if (r_map && cddata_type == CD_FAKE_SEAM) {
if (!CustomData_has_layer_named(&me_dst->edge_data, CD_PROP_BOOL, "uv_seam")) {
CustomData_add_layer_named(
@@ -1103,31 +1073,6 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
return false;
}
else if (elem_type == ME_POLY) {
if (cddata_type == CD_FAKE_UV) {
cddata_type = CD_PROP_FLOAT2;
}
if (!(cddata_type & CD_FAKE)) {
if (!data_transfer_layersmapping_cdlayers(r_map,
eCustomDataType(cddata_type),
mix_mode,
mix_factor,
mix_weights,
num_elem_dst,
use_create,
use_delete,
me_src->face_data,
me_dst->face_data,
fromlayers,
tolayers,
interp,
interp_data))
{
/* We handle specific source selection cases here. */
return false;
}
return true;
}
if (r_map && cddata_type == CD_FAKE_SHARP) {
if (!CustomData_has_layer_named(&me_dst->face_data, CD_PROP_BOOL, "sharp_face")) {
CustomData_add_layer_named(

View File

@@ -25,8 +25,6 @@ enum {
/* Vertices. */
CD_FAKE_MDEFORMVERT = CD_FAKE | CD_MDEFORMVERT, /* *sigh* due to how vgroups are stored :(. */
CD_FAKE_SHAPEKEY = CD_FAKE |
CD_SHAPEKEY, /* Not available as real CD layer in non-bmesh context. */
/* Edges. */
CD_FAKE_SEAM = CD_FAKE | 100, /* UV seam flag for edges. */

View File

@@ -52,14 +52,6 @@ static const EnumPropertyItem DT_layer_items[] = {
0,
"Vertex Group(s)",
"Transfer active or all vertex groups"},
#if 0 /* XXX For now, would like to finish/merge work from 2014 GSOC first. */
{DT_TYPE_SHAPEKEY, "SHAPEKEYS", 0, "Shapekey(s)", "Transfer active or all shape keys"},
#endif
/* XXX When SkinModifier is enabled,
* it seems to erase its own CD_MVERT_SKIN layer from final DM :( */
#if 0
{DT_TYPE_SKIN, "SKIN", 0, "Skin Weight", "Transfer skin weights"},
#endif
{DT_TYPE_BWEIGHT_VERT, "BEVEL_WEIGHT_VERT", 0, "Bevel Weight", "Transfer bevel weights"},
{DT_TYPE_MPROPCOL_VERT | DT_TYPE_MLOOPCOL_VERT,
"COLOR_VERTEX",
@@ -176,9 +168,6 @@ static const EnumPropertyItem *dt_layers_select_src_itemf(bContext *C,
RNA_enum_item_add(&item, &totitem, &tmp_item);
}
}
else if (data_type == DT_TYPE_SHAPEKEY) {
/* TODO */
}
else if (data_type == DT_TYPE_UV) {
const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
const Object *ob_src_eval = DEG_get_evaluated(depsgraph, ob_src);

View File

@@ -123,7 +123,6 @@ enum {
enum {
DT_TYPE_MDEFORMVERT = 1 << 0,
DT_TYPE_SHAPEKEY = 1 << 1,
DT_TYPE_SKIN = 1 << 2,
DT_TYPE_BWEIGHT_VERT = 1 << 3,
@@ -145,7 +144,7 @@ enum {
DT_TYPE_VCOL_ALL = (1 << 16) | (1 << 27) | (1 << 28) | (1 << 29),
#define DT_TYPE_MAX 30
DT_TYPE_VERT_ALL = DT_TYPE_MDEFORMVERT | DT_TYPE_SHAPEKEY | DT_TYPE_SKIN | DT_TYPE_BWEIGHT_VERT |
DT_TYPE_VERT_ALL = DT_TYPE_MDEFORMVERT | DT_TYPE_SKIN | DT_TYPE_BWEIGHT_VERT |
DT_TYPE_MPROPCOL_VERT | DT_TYPE_MLOOPCOL_VERT,
DT_TYPE_EDGE_ALL = DT_TYPE_SHARP_EDGE | DT_TYPE_SEAM | DT_TYPE_CREASE | DT_TYPE_BWEIGHT_EDGE |
DT_TYPE_FREESTYLE_EDGE,
@@ -156,7 +155,6 @@ enum {
#define DT_DATATYPE_IS_VERT(_dt) \
ELEM(_dt, \
DT_TYPE_MDEFORMVERT, \
DT_TYPE_SHAPEKEY, \
DT_TYPE_SKIN, \
DT_TYPE_BWEIGHT_VERT, \
DT_TYPE_MLOOPCOL_VERT, \
@@ -175,7 +173,6 @@ enum {
#define DT_DATATYPE_IS_MULTILAYERS(_dt) \
ELEM(_dt, \
DT_TYPE_MDEFORMVERT, \
DT_TYPE_SHAPEKEY, \
DT_TYPE_MPROPCOL_VERT, \
DT_TYPE_MLOOPCOL_VERT, \
DT_TYPE_MPROPCOL_VERT | DT_TYPE_MLOOPCOL_VERT, \
@@ -187,7 +184,6 @@ enum {
enum {
DT_MULTILAYER_INDEX_INVALID = -1,
DT_MULTILAYER_INDEX_MDEFORMVERT = 0,
DT_MULTILAYER_INDEX_SHAPEKEY = 1,
DT_MULTILAYER_INDEX_VCOL_LOOP = 2,
DT_MULTILAYER_INDEX_UV = 3,
DT_MULTILAYER_INDEX_VCOL_VERT = 4,

View File

@@ -7191,26 +7191,18 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna)
PropertyRNA *prop;
static const EnumPropertyItem DT_layer_vert_items[] = {
{DT_TYPE_MDEFORMVERT,
"VGROUP_WEIGHTS",
0,
"Vertex Groups",
"Transfer active or all vertex groups"},
# if 0 /* TODO */
{DT_TYPE_SHAPEKEY, "SHAPEKEYS", 0, "Shapekey(s)", "Transfer active or all shape keys"},
# endif
/* XXX When SkinModifier is enabled,
* it seems to erase its own CD_MVERT_SKIN layer from final DM :( */
# if 0
{DT_TYPE_SKIN, "SKIN", 0, "Skin Weight", "Transfer skin weights"},
# endif
{DT_TYPE_BWEIGHT_VERT, "BEVEL_WEIGHT_VERT", 0, "Bevel Weight", "Transfer bevel weights"},
{DT_TYPE_MPROPCOL_VERT | DT_TYPE_MLOOPCOL_VERT,
"COLOR_VERTEX",
0,
"Colors",
"Transfer color attributes"},
{0, nullptr, 0, nullptr, nullptr},
{DT_TYPE_MDEFORMVERT,
"VGROUP_WEIGHTS",
0,
"Vertex Groups",
"Transfer active or all vertex groups"},
{DT_TYPE_BWEIGHT_VERT, "BEVEL_WEIGHT_VERT", 0, "Bevel Weight", "Transfer bevel weights"},
{DT_TYPE_MPROPCOL_VERT | DT_TYPE_MLOOPCOL_VERT,
"COLOR_VERTEX",
0,
"Colors",
"Transfer color attributes"},
{0, nullptr, 0, nullptr, nullptr},
};
static const EnumPropertyItem DT_layer_edge_items[] = {
@@ -7436,19 +7428,6 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna)
prop, nullptr, nullptr, "rna_DataTransferModifier_layers_select_src_itemf");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
# if 0
prop = RNA_def_enum(srna,
"layers_shapekey_select_src",
rna_enum_dt_layers_select_src_items,
DT_LAYERS_ALL_SRC,
"Source Layers Selection",
"Which layers to transfer, in case of multi-layers types");
RNA_def_property_enum_sdna(prop, nullptr, "layers_select_src[DT_MULTILAYER_INDEX_SHAPEKEY]");
RNA_def_property_enum_funcs(
prop, nullptr, nullptr, "rna_DataTransferModifier_layers_select_src_itemf");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
# endif
prop = RNA_def_enum(srna,
"layers_vcol_vert_select_src",
rna_enum_dt_layers_select_src_items,
@@ -7493,19 +7472,6 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna)
prop, nullptr, nullptr, "rna_DataTransferModifier_layers_select_dst_itemf");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
# if 0
prop = RNA_def_enum(srna,
"layers_shapekey_select_dst",
rna_enum_dt_layers_select_dst_items,
DT_LAYERS_NAME_DST,
"Destination Layers Matching",
"How to match source and destination layers");
RNA_def_property_enum_sdna(prop, nullptr, "layers_select_dst[DT_MULTILAYER_INDEX_SHAPEKEY]");
RNA_def_property_enum_funcs(
prop, nullptr, nullptr, "rna_DataTransferModifier_layers_select_dst_itemf");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
# endif
prop = RNA_def_enum(srna,
"layers_vcol_vert_select_dst",
rna_enum_dt_layers_select_dst_items,