diff options
-rw-r--r-- | source/blender/editors/object/object_data_transfer.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c index 3e32770c9a8..52b60793585 100644 --- a/source/blender/editors/object/object_data_transfer.c +++ b/source/blender/editors/object/object_data_transfer.c @@ -88,19 +88,28 @@ static const EnumPropertyItem DT_layer_items[] = { static const EnumPropertyItem *dt_layers_select_src_itemf( bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { - EnumPropertyItem *item = NULL, tmp_item = {0}; - int totitem = 0; - const int data_type = RNA_enum_get(ptr, "data_type"); - if (!C) { /* needed for docs and i18n tools */ return rna_enum_dt_layers_select_src_items; } + EnumPropertyItem *item = NULL, tmp_item = {0}; + int totitem = 0; + const int data_type = RNA_enum_get(ptr, "data_type"); + Depsgraph *depsgraph = CTX_data_depsgraph(C); - RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_ACTIVE_SRC); + PropertyRNA *prop = RNA_struct_find_property(ptr, "use_reverse_transfer"); + const bool reverse_transfer = prop != NULL && RNA_property_boolean_get(ptr, prop); + const int layers_select_dst = reverse_transfer ? RNA_enum_get(ptr, "layers_select_src") : + RNA_enum_get(ptr, "layers_select_dst"); + + if (!reverse_transfer || layers_select_dst == DT_LAYERS_ACTIVE_DST || layers_select_dst >= 0) { + RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_ACTIVE_SRC); + } RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_ALL_SRC); + + if (data_type == DT_TYPE_MDEFORMVERT) { Object *ob_src = CTX_data_active_object(C); @@ -184,16 +193,19 @@ static const EnumPropertyItem *dt_layers_select_src_itemf( static const EnumPropertyItem *dt_layers_select_dst_itemf( bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { - EnumPropertyItem *item = NULL; - int totitem = 0; - - const int layers_select_src = RNA_enum_get(ptr, "layers_select_src"); - if (!C) { /* needed for docs and i18n tools */ return rna_enum_dt_layers_select_dst_items; } - if (layers_select_src == DT_LAYERS_ACTIVE_SRC || layers_select_src >= 0) { + EnumPropertyItem *item = NULL; + int totitem = 0; + + PropertyRNA *prop = RNA_struct_find_property(ptr, "use_reverse_transfer"); + const bool reverse_transfer = prop != NULL && RNA_property_boolean_get(ptr, prop); + const int layers_select_src = reverse_transfer ? RNA_enum_get(ptr, "layers_select_dst") : + RNA_enum_get(ptr, "layers_select_src"); + + if (reverse_transfer || layers_select_src == DT_LAYERS_ACTIVE_SRC || layers_select_src >= 0) { RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_dst_items, DT_LAYERS_ACTIVE_DST); } RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_dst_items, DT_LAYERS_NAME_DST); |