60 {0,
"", 0,
"Vertex Data",
""},
65 "Transfer active or all vertex groups"},
67 {
DT_TYPE_SHAPEKEY,
"SHAPEKEYS", 0,
"Shapekey(s)",
"Transfer active or all shape keys"},
72 {
DT_TYPE_SKIN,
"SKIN", 0,
"Skin Weight",
"Transfer skin weights"},
75 {0,
"", 0,
"Edge Data",
""},
77 {
DT_TYPE_SEAM,
"SEAM", 0,
"UV Seam",
"Transfer UV seam mark"},
78 {
DT_TYPE_CREASE,
"CREASE", 0,
"Subdivision Crease",
"Transfer crease values"},
84 "Transfer Freestyle edge mark"},
85 {0,
"", 0,
"Face Corner Data",
""},
86 {
DT_TYPE_LNOR,
"CUSTOM_NORMAL", 0,
"Custom Normals",
"Transfer custom normals"},
87 {
DT_TYPE_VCOL,
"VCOL", 0,
"Vertex Colors",
"Vertex (face corners) colors"},
88 {
DT_TYPE_UV,
"UV", 0,
"UVs",
"Transfer UV layers"},
89 {0,
"", 0,
"Face Data",
""},
95 "Transfer Freestyle face mark"},
115 const int layers_select_dst = reverse_transfer ?
RNA_enum_get(
ptr,
"layers_select_src") :
143 tmp_item.identifier = tmp_item.name = dg->
name;
166 for (
int i = 0; i < num_data; i++) {
189 for (
int i = 0; i < num_data; i++) {
219 const int layers_select_src = reverse_transfer ?
RNA_enum_get(
ptr,
"layers_select_dst") :
247 if (reverse_transfer) {
252 if (reverse_transfer) {
268 bool support_advanced_mixing, support_threshold;
277 dtdata_type, &support_advanced_mixing, &support_threshold);
279 if (support_threshold) {
286 if (support_advanced_mixing) {
302 const int layers_select_src =
RNA_enum_get(op->
ptr,
"layers_select_src");
321 const bool reverse_transfer)
326 if (reverse_transfer) {
330 for (ctx_ob = ctx_objects->
first; ctx_ob; ctx_ob = ctx_ob->
next) {
342 "Skipping object '%s', linked data '%s' cannot be modified",
357 const bool reverse_transfer)
364 if (reverse_transfer) {
379 "Skipping object '%s', data '%s' has already been processed with a previous object",
395 bool changed =
false;
412 const float max_distance = use_max_distance ?
RNA_float_get(op->
ptr,
"max_distance") : FLT_MAX;
414 const float islands_precision =
RNA_float_get(op->
ptr,
"islands_precision");
426 SpaceTransform *space_transform = (use_object_transform && !use_auto_transform) ?
427 &space_transform_data :
434 "Operator is frozen, changes to its settings won't take effect until you unfreeze it");
443 if (reverse_transfer) {
444 SWAP(
int, layers_src, layers_dst);
448 layers_select_src[fromto_idx] = layers_src;
449 layers_select_dst[fromto_idx] = layers_dst;
454 for (ctx_ob_dst = ctx_objects.
first; ctx_ob_dst; ctx_ob_dst = ctx_ob_dst->
next) {
457 if (reverse_transfer) {
464 if (space_transform) {
501 if (reverse_transfer) {
541 bool use_auto_transform =
false;
542 bool use_max_distance =
false;
543 bool use_modifier =
false;
555 if (
STREQ(prop_id,
"modifier")) {
564 if (
STREQ(prop_id,
"use_object_transform")) {
565 if (use_auto_transform) {
569 else if (
STREQ(prop_id,
"max_distance")) {
570 if (!use_max_distance) {
574 else if (
STREQ(prop_id,
"islands_precision")) {
579 else if (
STREQ(prop_id,
"vert_mapping")) {
584 else if (
STREQ(prop_id,
"edge_mapping")) {
589 else if (
STREQ(prop_id,
"loop_mapping")) {
594 else if (
STREQ(prop_id,
"poly_mapping")) {
599 else if (
STR_ELEM(prop_id,
"layers_select_src",
"layers_select_dst")) {
615 ot->
name =
"Transfer Mesh Data";
616 ot->
idname =
"OBJECT_OT_data_transfer";
618 "Transfer data layer(s) (weights, edge sharp, etc.) from active to selected meshes";
632 "use_reverse_transfer",
635 "Transfer from selected objects to active one");
642 "Prevent changes to settings to re-run the operator, "
643 "handy to change several things at once with heavy geometry");
652 "Add data layers on destination meshes if needed");
660 "Method used to map source vertices to destination ones");
666 "Method used to map source edges to destination ones");
671 "Face Corner Mapping",
672 "Method used to map source faces' corners to destination ones");
678 "Method used to map source faces to destination ones");
683 "use_auto_transform",
686 "Automatically compute transformation to get the best possible match between source and "
687 "destination meshes.\n"
688 "Warning: Results will never be as good as manual matching of objects");
690 "use_object_transform",
693 "Evaluate source and destination meshes in global space");
697 "Only Neighbor Geometry",
698 "Source elements must be closer than given distance from destination one");
706 "Maximum allowed distance between source and destination element, for non-topology mappings",
717 "'Width' of rays (especially useful when raycasting against vertices or edges)",
728 "Factor controlling precision of islands handling (the higher, the better the results)",
738 "Source Layers Selection",
739 "Which layers to transfer, in case of multi-layers types");
746 "Destination Layers Matching",
747 "How to match source and destination layers");
755 "How to affect destination elements with source values");
764 "Factor to use when applying data to destination (exact behavior depends on mix mode)",
796 const bool use_delete =
false;
831 layers_select_src[fromto_idx] = layers_src;
832 layers_select_dst[fromto_idx] = layers_dst;
839 for (ctx_ob_dst = ctx_objects.
first; ctx_ob_dst; ctx_ob_dst = ctx_ob_dst->
next) {
876 ot->
name =
"Transfer Mesh Data Layout";
877 ot->
description =
"Transfer layout of data layer(s) from active to selected meshes";
878 ot->
idname =
"OBJECT_OT_datalayout_transfer";
899 "Also delete some data layers from destination if necessary, so that it matches "
907 "Source Layers Selection",
908 "Which layers to transfer, in case of multi-layers types");
915 "Destination Layers Matching",
916 "How to match source and destination layers");
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct Object * CTX_data_active_object(const bContext *C)
int CTX_data_selected_editable_objects(const bContext *C, ListBase *list)
struct Main * CTX_data_main(const bContext *C)
const char * CustomData_get_layer_name(const struct CustomData *data, int type, int n)
int CustomData_number_of_layers(const struct CustomData *data, int type)
@ CDT_MIX_REPLACE_BELOW_THRESHOLD
@ CDT_MIX_REPLACE_ABOVE_THRESHOLD
const CustomData_MeshMasks CD_MASK_BAREMESH
@ DT_LAYERS_VGROUP_SRC_BONE_SELECT
@ DT_LAYERS_VGROUP_SRC_BONE_DEFORM
#define DT_DATATYPE_IS_POLY(_dt)
#define DT_DATATYPE_IS_MULTILAYERS(_dt)
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])
#define DT_DATATYPE_IS_LOOP(_dt)
bool BKE_object_data_transfer_get_dttypes_capacity(const int dtdata_types, bool *r_advanced_mixing, bool *r_threshold)
#define DT_DATATYPE_IS_EDGE(_dt)
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)
@ DT_MULTILAYER_INDEX_MAX
@ DT_MULTILAYER_INDEX_INVALID
#define DT_DATATYPE_IS_VERT(_dt)
@ MREMAP_MODE_VERT_NEAREST
@ MREMAP_MODE_LOOP_NEAREST_POLYNOR
@ MREMAP_MODE_EDGE_NEAREST
@ MREMAP_MODE_POLY_NEAREST
struct Mesh * mesh_get_eval_final(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, const struct CustomData_MeshMasks *dataMask)
General operations, lookup, etc. for blender objects.
struct Object * BKE_object_pose_armature_get(struct Object *ob)
void BKE_report(ReportList *reports, ReportType type, const char *message)
void BKE_reportf(ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
#define BLI_SPACE_TRANSFORM_SETUP(data, local, target)
struct Depsgraph Depsgraph
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
#define ID_IS_LINKED(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
@ eModifierType_DataTransfer
Object is a sort of wrapper for general info.
struct Object * ED_object_active_context(const struct bContext *C)
StructRNA RNA_DataTransferModifier
return(oflags[bm->toolflag_index].f &oflag) !=0
const Depsgraph * depsgraph
static const EnumPropertyItem DT_layer_items[]
static const EnumPropertyItem * dt_layers_select_src_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
static int datalayout_transfer_exec(bContext *C, wmOperator *op)
static int datalayout_transfer_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static bool data_transfer_poll_property(const bContext *UNUSED(C), wmOperator *op, const PropertyRNA *prop)
void OBJECT_OT_datalayout_transfer(wmOperatorType *ot)
static const EnumPropertyItem * dt_layers_select_dst_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
static bool data_transfer_check(bContext *UNUSED(C), wmOperator *op)
static bool data_transfer_exec_is_object_valid(wmOperator *op, Object *ob_src, Object *ob_dst, const bool reverse_transfer)
static const EnumPropertyItem * dt_layers_select_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
void OBJECT_OT_data_transfer(wmOperatorType *ot)
static void data_transfer_exec_preprocess_objects(bContext *C, wmOperator *op, Object *ob_src, ListBase *ctx_objects, const bool reverse_transfer)
static bool datalayout_transfer_poll(bContext *C)
static int data_transfer_exec(bContext *C, wmOperator *op)
static bool data_transfer_poll(bContext *C)
static const EnumPropertyItem * dt_mix_mode_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
bool edit_modifier_invoke_properties(struct bContext *C, struct wmOperator *op)
bool edit_modifier_poll_generic(struct bContext *C, struct StructRNA *rna_type, int obtype_flag, const bool is_editmode_allowed, const bool is_liboverride_allowed)
struct ModifierData * edit_modifier_property_get(struct wmOperator *op, struct Object *ob, int type)
void edit_modifier_properties(struct wmOperatorType *ot)
const char * RNA_property_identifier(const PropertyRNA *prop)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
float RNA_float_get(PointerRNA *ptr, const char *name)
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_enum_funcs_runtime(PropertyRNA *prop, EnumPropertyGetFunc getfunc, EnumPropertySetFunc setfunc, EnumPropertyItemFunc itemfunc)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_enum_item_add_separator(EnumPropertyItem **items, int *totitem)
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item, int value)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
const EnumPropertyItem rna_enum_dt_method_loop_items[]
const EnumPropertyItem rna_enum_dt_method_edge_items[]
const EnumPropertyItem rna_enum_dt_method_poly_items[]
const EnumPropertyItem rna_enum_dt_mix_mode_items[]
const EnumPropertyItem rna_enum_dt_layers_select_src_items[]
const EnumPropertyItem rna_enum_dt_method_vertex_items[]
const EnumPropertyItem rna_enum_dt_layers_select_dst_items[]
struct CollectionPointerLink * next
struct Object * ob_source
struct CustomData pdata ldata
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
bool(* poll_property)(const struct bContext *C, struct wmOperator *op, const PropertyRNA *prop) ATTR_WARN_UNUSED_RESULT
bool(* check)(struct bContext *, struct wmOperator *)
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))