diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-01-17 19:38:31 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-01-17 19:42:45 +0300 |
commit | 119ff676e1b348a66e33cd857089e78a5195a3c5 (patch) | |
tree | fe05c17658c76f32fbabd07023ab22d30cddedcb | |
parent | c9e5d9226b8c89f0081f8191f868c23e595b0c3f (diff) |
Fix T43283: Crash on undo/redo/ and save/reload after (new) weight transfer.
Mesh stores its dvert in a specific pointer too, in addition of regular CD layer...
That whole vgroup handling is really breaking apart the 'universality' of CD system. :(
Also added some DAG and WM updates in operators...
-rw-r--r-- | source/blender/blenkernel/intern/data_transfer.c | 14 | ||||
-rw-r--r-- | source/blender/editors/object/object_data_transfer.c | 11 |
2 files changed, 21 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c index d41c74770f1..c8a5da930d0 100644 --- a/source/blender/blenkernel/intern/data_transfer.c +++ b/source/blender/blenkernel/intern/data_transfer.c @@ -690,13 +690,19 @@ static bool data_transfer_layersmapping_generate( return true; } else if (cddata_type == CD_FAKE_MDEFORMVERT) { + bool ret; + cd_src = dm_src->getVertDataLayout(dm_src); cd_dst = dm_dst ? dm_dst->getVertDataLayout(dm_dst) : &me_dst->vdata; - return data_transfer_layersmapping_vgroups(r_map, mix_mode, mix_factor, mix_weights, - num_elem_dst, use_create, use_delete, - ob_src, ob_dst, cd_src, cd_dst, dm_dst != NULL, - fromlayers, tolayers); + ret = data_transfer_layersmapping_vgroups(r_map, mix_mode, mix_factor, mix_weights, + num_elem_dst, use_create, use_delete, + ob_src, ob_dst, cd_src, cd_dst, dm_dst != NULL, + fromlayers, tolayers); + + /* Mesh stores its dvert in a specific pointer too. :( */ + me_dst->dvert = CustomData_get_layer(&me_dst->vdata, CD_MDEFORMVERT); + return ret; } else if (cddata_type == CD_FAKE_SHAPEKEY) { /* TODO: leaving shapekeys asside for now, quite specific case, since we can't access them from MVert :/ */ diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c index f6cf0312e2d..ec3ae92adc4 100644 --- a/source/blender/editors/object/object_data_transfer.c +++ b/source/blender/editors/object/object_data_transfer.c @@ -42,6 +42,7 @@ #include "BKE_context.h" #include "BKE_data_transfer.h" +#include "BKE_depsgraph.h" #include "BKE_DerivedMesh.h" #include "BKE_mesh_mapping.h" #include "BKE_mesh_remap.h" @@ -393,6 +394,8 @@ static int data_transfer_exec(bContext *C, wmOperator *op) } } + DAG_id_tag_update(&ob_dst->id, OB_RECALC_DATA); + if (reverse_transfer) { SWAP(Object *, ob_src, ob_dst); } @@ -400,6 +403,8 @@ static int data_transfer_exec(bContext *C, wmOperator *op) BLI_freelistN(&ctx_objects); + WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL); + #if 0 /* TODO */ /* Note: issue with that is that if canceled, operator cannot be redone... Nasty in our case. */ return changed ? OPERATOR_FINISHED : OPERATOR_CANCELLED; @@ -592,6 +597,8 @@ static int datalayout_transfer_exec(bContext *C, wmOperator *op) BKE_object_data_transfer_layout(scene, ob_src, ob_dst, dtmd->data_types, use_delete, dtmd->layers_select_src, dtmd->layers_select_dst); + + DAG_id_tag_update(&ob_dst->id, OB_RECALC_DATA); } else { Object *ob_src = ob_act; @@ -621,11 +628,15 @@ static int datalayout_transfer_exec(bContext *C, wmOperator *op) BKE_object_data_transfer_layout(scene, ob_src, ob_dst, data_type, use_delete, layers_select_src, layers_select_dst); } + + DAG_id_tag_update(&ob_dst->id, OB_RECALC_DATA); } BLI_freelistN(&ctx_objects); } + WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL); + return OPERATOR_FINISHED; } |