Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_data_transfer.c
| Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | #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"}, | {DT_TYPE_SHAPEKEY, "SHAPEKEYS", 0, "Shapekey(s)", "Transfer active or all shape keys"}, | ||||
| #endif | #endif | ||||
| /* XXX When SkinModifier is enabled, | /* XXX When SkinModifier is enabled, | ||||
| * it seems to erase its own CD_MVERT_SKIN layer from final DM :( */ | * it seems to erase its own CD_MVERT_SKIN layer from final DM :( */ | ||||
| #if 0 | #if 0 | ||||
| {DT_TYPE_SKIN, "SKIN", 0, "Skin Weight", "Transfer skin weights"}, | {DT_TYPE_SKIN, "SKIN", 0, "Skin Weight", "Transfer skin weights"}, | ||||
| #endif | #endif | ||||
| {DT_TYPE_BWEIGHT_VERT, "BEVEL_WEIGHT_VERT", 0, "Bevel Weight", "Transfer bevel weights"}, | {DT_TYPE_BWEIGHT_VERT, "BEVEL_WEIGHT_VERT", 0, "Bevel Weight", "Transfer bevel weights"}, | ||||
| {DT_TYPE_MPROPCOL_VERT | DT_TYPE_MLOOPCOL_VERT, | |||||
HooglyBoogly: Is there a reason to use `VCOL` here? What about `COLOR_ATTRIBUTES`? | |||||
Not Done Inline ActionsHm. COLOR_ATTRIBUTES_VERT / COLOR_ATTRIBUTES_FACE_CORNER (see case below) would be good I think. This would break existing scripts though (this is what you use when calling bpy.ops.object.datalayout_transfer(data_type='VCOL')) lichtwerk: Hm.
`COLOR_ATTRIBUTES_VERT` / `COLOR_ATTRIBUTES_FACE_CORNER` (see case below) would be good I… | |||||
Not Done Inline ActionsOkay, for the data transfer modifier it's probably better to prefer backwards compatibility with scripts, since it's being replaced by geometry nodes for new development anyway. HooglyBoogly: Okay, for the data transfer modifier it's probably better to prefer backwards compatibility… | |||||
| "COLOR_VERTEX", | |||||
| 0, | |||||
| "Colors", | |||||
| "Color Attributes"}, | |||||
| RNA_ENUM_ITEM_HEADING(N_("Edge Data"), NULL), | RNA_ENUM_ITEM_HEADING(N_("Edge Data"), NULL), | ||||
| {DT_TYPE_SHARP_EDGE, "SHARP_EDGE", 0, "Sharp", "Transfer sharp mark"}, | {DT_TYPE_SHARP_EDGE, "SHARP_EDGE", 0, "Sharp", "Transfer sharp mark"}, | ||||
| {DT_TYPE_SEAM, "SEAM", 0, "UV Seam", "Transfer UV seam mark"}, | {DT_TYPE_SEAM, "SEAM", 0, "UV Seam", "Transfer UV seam mark"}, | ||||
| {DT_TYPE_CREASE, "CREASE", 0, "Subdivision Crease", "Transfer crease values"}, | {DT_TYPE_CREASE, "CREASE", 0, "Subdivision Crease", "Transfer crease values"}, | ||||
| {DT_TYPE_BWEIGHT_EDGE, "BEVEL_WEIGHT_EDGE", 0, "Bevel Weight", "Transfer bevel weights"}, | {DT_TYPE_BWEIGHT_EDGE, "BEVEL_WEIGHT_EDGE", 0, "Bevel Weight", "Transfer bevel weights"}, | ||||
| {DT_TYPE_FREESTYLE_EDGE, | {DT_TYPE_FREESTYLE_EDGE, | ||||
| "FREESTYLE_EDGE", | "FREESTYLE_EDGE", | ||||
| 0, | 0, | ||||
| "Freestyle Mark", | "Freestyle Mark", | ||||
| "Transfer Freestyle edge mark"}, | "Transfer Freestyle edge mark"}, | ||||
| RNA_ENUM_ITEM_HEADING(N_("Face Corner Data"), NULL), | RNA_ENUM_ITEM_HEADING(N_("Face Corner Data"), NULL), | ||||
| {DT_TYPE_LNOR, "CUSTOM_NORMAL", 0, "Custom Normals", "Transfer custom normals"}, | {DT_TYPE_LNOR, "CUSTOM_NORMAL", 0, "Custom Normals", "Transfer custom normals"}, | ||||
| {DT_TYPE_MPROPCOL_LOOP | DT_TYPE_MLOOPCOL_LOOP, "VCOL", 0, "Colors", "Color Attributes"}, | {DT_TYPE_MPROPCOL_LOOP | DT_TYPE_MLOOPCOL_LOOP, | ||||
| "COLOR_CORNER", | |||||
| 0, | |||||
| "Colors", | |||||
| "Color Attributes"}, | |||||
| {DT_TYPE_UV, "UV", 0, "UVs", "Transfer UV layers"}, | {DT_TYPE_UV, "UV", 0, "UVs", "Transfer UV layers"}, | ||||
| RNA_ENUM_ITEM_HEADING(N_("Face Data"), NULL), | RNA_ENUM_ITEM_HEADING(N_("Face Data"), NULL), | ||||
| {DT_TYPE_SHARP_FACE, "SMOOTH", 0, "Smooth", "Transfer flat/smooth mark"}, | {DT_TYPE_SHARP_FACE, "SMOOTH", 0, "Smooth", "Transfer flat/smooth mark"}, | ||||
| {DT_TYPE_FREESTYLE_FACE, | {DT_TYPE_FREESTYLE_FACE, | ||||
| "FREESTYLE_FACE", | "FREESTYLE_FACE", | ||||
| 0, | 0, | ||||
| "Freestyle Mark", | "Freestyle Mark", | ||||
| "Transfer Freestyle face mark"}, | "Transfer Freestyle face mark"}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| static void dt_add_vcol_layers(CustomData *cdata, | static void dt_add_vcol_layers(CustomData *cdata, | ||||
| eCustomDataMask mask, | eCustomDataMask mask, | ||||
| EnumPropertyItem **r_item, | EnumPropertyItem **r_item, | ||||
| int *r_totitem) | int *r_totitem) | ||||
| { | { | ||||
| int types[2] = {CD_PROP_COLOR, CD_PROP_BYTE_COLOR}; | int types[2] = {CD_PROP_COLOR, CD_PROP_BYTE_COLOR}; | ||||
| int idx = 0; | |||||
Not Done Inline ActionsWhat about color_attribute_index? HooglyBoogly: What about `color_attribute_index`? | |||||
| for (int i = 0; i < 2; i++) { | for (int i = 0; i < 2; i++) { | ||||
| eCustomDataType type = types[i]; | eCustomDataType type = types[i]; | ||||
| if (!(mask & CD_TYPE_AS_MASK(type))) { | if (!(mask & CD_TYPE_AS_MASK(type))) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| int num_data = CustomData_number_of_layers(cdata, type); | int num_data = CustomData_number_of_layers(cdata, type); | ||||
| RNA_enum_item_add_separator(r_item, r_totitem); | RNA_enum_item_add_separator(r_item, r_totitem); | ||||
| for (int j = 0; j < num_data; j++) { | for (int j = 0; j < num_data; j++) { | ||||
| EnumPropertyItem tmp_item; | EnumPropertyItem tmp_item = {0}; | ||||
| tmp_item.value = idx++; | |||||
| tmp_item.value = j; | |||||
| tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(cdata, type, j); | tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(cdata, type, j); | ||||
| RNA_enum_item_add(r_item, r_totitem, &tmp_item); | RNA_enum_item_add(r_item, r_totitem, &tmp_item); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* NOTE: #rna_enum_dt_layers_select_src_items enum is from rna_modifier.c. */ | /* NOTE: #rna_enum_dt_layers_select_src_items enum is from rna_modifier.c. */ | ||||
| static const EnumPropertyItem *dt_layers_select_src_itemf(bContext *C, | static const EnumPropertyItem *dt_layers_select_src_itemf(bContext *C, | ||||
| PointerRNA *ptr, | PointerRNA *ptr, | ||||
| ▲ Show 20 Lines • Show All 837 Lines • Show Last 20 Lines | |||||
Is there a reason to use VCOL here? What about COLOR_ATTRIBUTES?