Merging r59130 through r59135 from trunk into soc-2013-depsgraph_mt
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 14 Aug 2013 10:42:18 +0000 (10:42 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 14 Aug 2013 10:42:18 +0000 (10:42 +0000)
source/blender/blenkernel/intern/armature.c
source/blender/bmesh/intern/bmesh_marking.c
source/blender/bmesh/intern/bmesh_marking.h
source/blender/bmesh/intern/bmesh_queries.c
source/blender/bmesh/tools/bmesh_edgesplit.c
source/blender/editors/include/ED_transform.h
source/blender/editors/mesh/editmesh_rip.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c

index 6e712c7572f018747cfe9c6e728572298ae65192..6b2b782717dce626177381b74748aac227ff402e 100644 (file)
@@ -1600,7 +1600,10 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
                        pchanw.next = pchan->next;
                        pchanw.parent = pchan->parent;
                        pchanw.child = pchan->child;
-                       
+
+                       pchanw.mpath = pchan->mpath;
+                       pchan->mpath = NULL;
+
                        /* this is freed so copy a copy, else undo crashes */
                        if (pchanw.prop) {
                                pchanw.prop = IDP_CopyProperty(pchanw.prop);
index bec301acaa91d82d8d9f1521b5ae161da048ed27..0a6c0f4b2934d89961fd8e791f1188b35c71c4cf 100644 (file)
@@ -816,6 +816,13 @@ void BM_editselection_plane(BMEditSelection *ese, float r_plane[3])
        }
 }
 
+static BMEditSelection *bm_select_history_create(BMHeader *ele)
+{
+       BMEditSelection *ese = (BMEditSelection *) MEM_callocN(sizeof(BMEditSelection), "BMEdit Selection");
+       ese->htype = ele->htype;
+       ese->ele = (BMElem *)ele;
+       return ese;
+}
 
 /* --- macro wrapped funcs --- */
 bool _bm_select_history_check(BMesh *bm, const BMHeader *ele)
@@ -837,9 +844,7 @@ bool _bm_select_history_remove(BMesh *bm, BMHeader *ele)
 
 void _bm_select_history_store_notest(BMesh *bm, BMHeader *ele)
 {
-       BMEditSelection *ese = (BMEditSelection *) MEM_callocN(sizeof(BMEditSelection), "BMEdit Selection");
-       ese->htype = ele->htype;
-       ese->ele = (BMElem *)ele;
+       BMEditSelection *ese = bm_select_history_create(ele);
        BLI_addtail(&(bm->selected), ese);
 }
 
@@ -849,6 +854,20 @@ void _bm_select_history_store(BMesh *bm, BMHeader *ele)
                BM_select_history_store_notest(bm, (BMElem *)ele);
        }
 }
+
+
+void _bm_select_history_store_after_notest(BMesh *bm, BMEditSelection *ese_ref, BMHeader *ele)
+{
+       BMEditSelection *ese = bm_select_history_create(ele);
+       BLI_insertlinkafter(&(bm->selected), ese_ref, ese);
+}
+
+void _bm_select_history_store_after(BMesh *bm, BMEditSelection *ese_ref, BMHeader *ele)
+{
+       if (!BM_select_history_check(bm, (BMElem *)ele)) {
+               BM_select_history_store_after_notest(bm, ese_ref, (BMElem *)ele);
+       }
+}
 /* --- end macro wrapped funcs --- */
 
 
@@ -861,16 +880,13 @@ void BM_select_history_clear(BMesh *bm)
 
 void BM_select_history_validate(BMesh *bm)
 {
-       BMEditSelection *ese, *nextese;
-
-       ese = bm->selected.first;
+       BMEditSelection *ese, *ese_next;
 
-       while (ese) {
-               nextese = ese->next;
+       for (ese = bm->selected.first; ese; ese = ese_next) {
+               ese_next = ese->next;
                if (!BM_elem_flag_test(ese->ele, BM_ELEM_SELECT)) {
                        BLI_freelinkN(&(bm->selected), ese);
                }
-               ese = nextese;
        }
 }
 
index 062de4f69e1fafe2b16fceb6b2ba8637ed10c8ea..f23eac61278f1b8c81385e14c2e2e371a11a6ca9 100644 (file)
@@ -87,11 +87,15 @@ void    BM_editselection_plane(BMEditSelection *ese,  float r_plane[3]);
 #define BM_select_history_remove(bm, ele)       _bm_select_history_remove(bm,       &(ele)->head)
 #define BM_select_history_store_notest(bm, ele) _bm_select_history_store_notest(bm, &(ele)->head)
 #define BM_select_history_store(bm, ele)        _bm_select_history_store(bm,        &(ele)->head)
+#define BM_select_history_store_after_notest(bm, ese_ref, ele) _bm_select_history_store_after_notest(bm, ese_ref, &(ele)->head)
+#define BM_select_history_store_after(bm, ese, ese_ref)        _bm_select_history_store_after(bm,        ese_ref, &(ele)->head)
 
 bool _bm_select_history_check(BMesh *bm,  const BMHeader *ele);
 bool _bm_select_history_remove(BMesh *bm,       BMHeader *ele);
 void _bm_select_history_store_notest(BMesh *bm, BMHeader *ele);
 void _bm_select_history_store(BMesh *bm,        BMHeader *ele);
+void _bm_select_history_store_after(BMesh *bm,  BMEditSelection *ese_ref, BMHeader *ele);
+void _bm_select_history_store_after_notest(BMesh *bm,  BMEditSelection *ese_ref, BMHeader *ele);
 
 void BM_select_history_validate(BMesh *bm);
 void BM_select_history_clear(BMesh *em);
index 0eb3b0a6443b5bc91983921a20c16d9258c2df37..6eab3c625fa0ba4da47b27a75f956c05679fb186 100644 (file)
@@ -1986,7 +1986,7 @@ int BM_mesh_calc_edge_groups(BMesh *bm, int *r_groups_array, int (**r_group_inde
 
                BM_elem_index_set(e, i); /* set_inline */
        }
-       bm->elem_index_dirty &= ~BM_FACE;
+       bm->elem_index_dirty &= ~BM_EDGE;
 
        /* detect groups */
        stack = MEM_mallocN(sizeof(*stack) * tot_edges, __func__);
index adcf325b51c8db3c20dd5bc9850fba0187fcba77..aad600d13fa9e527afba68a97feb3a07c9f48f5c 100644 (file)
@@ -103,6 +103,21 @@ void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, const bool tag_only, con
        BMIter iter;
        BMEdge *e;
 
+       bool use_ese = false;
+       GHash *ese_gh = NULL;
+
+       if (copy_select && bm->selected.first) {
+               BMEditSelection *ese;
+
+               ese_gh = BLI_ghash_ptr_new(__func__);
+               for (ese = bm->selected.first; ese; ese = ese->next) {
+                       if (ese->htype != BM_FACE) {
+                               BLI_ghash_insert(ese_gh, ese->ele, ese);
+                       }
+               }
+
+               use_ese = true;
+       }
 
        if (tag_only == false) {
                BM_mesh_elem_hflag_enable_all(bm, BM_EDGE | (use_verts ? BM_VERT : 0), BM_ELEM_TAG, false);
@@ -135,9 +150,18 @@ void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, const bool tag_only, con
                        BM_elem_flag_enable(e, BM_ELEM_INTERNAL_TAG);
 
                        /* keep splitting until each loop has its own edge */
-                       do {
-                               bmesh_edge_separate(bm, e, e->l, copy_select);
-                       } while (!BM_edge_is_boundary(e));
+                       while (!BM_edge_is_boundary(e)) {
+                               BMLoop *l_sep = e->l;
+                               bmesh_edge_separate(bm, e, l_sep, copy_select);
+                               BLI_assert(l_sep->e != e);
+
+                               if (use_ese) {
+                                       BMEditSelection *ese = BLI_ghash_lookup(ese_gh, e);
+                                       if (UNLIKELY(ese)) {
+                                               BM_select_history_store_after_notest(bm, ese, l_sep->e);
+                                       }
+                               }
+                       }
 
                        BM_elem_flag_enable(e->v1, BM_ELEM_TAG);
                        BM_elem_flag_enable(e->v2, BM_ELEM_TAG);
@@ -157,14 +181,39 @@ void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, const bool tag_only, con
 
        BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
                if (BM_elem_flag_test(e, BM_ELEM_TAG)) {
-                       if (BM_elem_flag_test(e->v1, BM_ELEM_TAG)) {
-                               BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
-                               bmesh_vert_separate(bm, e->v1, NULL, NULL, copy_select);
-                       }
-                       if (BM_elem_flag_test(e->v2, BM_ELEM_TAG)) {
-                               BM_elem_flag_disable(e->v2, BM_ELEM_TAG);
-                               bmesh_vert_separate(bm, e->v2, NULL, NULL, copy_select);
+                       unsigned int i;
+                       for (i = 0; i < 2; i++) {
+                               BMVert *v = ((&e->v1)[i]);
+                               if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
+                                       BM_elem_flag_disable(v, BM_ELEM_TAG);
+
+                                       if (use_ese) {
+                                               BMVert **vtar;
+                                               int vtar_len;
+
+                                               bmesh_vert_separate(bm, v, &vtar, &vtar_len, copy_select);
+
+                                               if (vtar_len) {
+                                                       BMEditSelection *ese = BLI_ghash_lookup(ese_gh, v);
+                                                       if (UNLIKELY(ese)) {
+                                                               int j;
+                                                               for (j = 0; j < vtar_len; j++) {
+                                                                       BLI_assert(v != vtar[j]);
+                                                                       BM_select_history_store_after_notest(bm, ese, vtar[j]);
+                                                               }
+                                                       }
+                                               }
+                                               MEM_freeN(vtar);
+                                       }
+                                       else {
+                                               bmesh_vert_separate(bm, v, NULL, NULL, copy_select);
+                                       }
+                               }
                        }
                }
        }
+
+       if (use_ese) {
+               BLI_ghash_free(ese_gh, NULL, NULL);
+       }
 }
index 423613fb78093d6eb094f9f9ecc312c113621a6b..81308dd84f211efdcff00589b39ea2dbfff8e17f 100644 (file)
@@ -90,16 +90,14 @@ enum TfmMode {
 
 /* TRANSFORM CONTEXTS */
 #define CTX_NONE            0
-#define CTX_TEXTURE         1
-#define CTX_EDGE            2
-#define CTX_NO_PET          4
-#define CTX_TWEAK           8
-#define CTX_NO_MIRROR       16
-#define CTX_AUTOCONFIRM     32
-#define CTX_BMESH           64
-#define CTX_NDOF            128
-#define CTX_MOVIECLIP       256
-#define CTX_MASK            512
+#define CTX_TEXTURE         (1 << 0)
+#define CTX_EDGE            (1 << 1)
+#define CTX_NO_PET          (1 << 2)
+#define CTX_NO_MIRROR       (1 << 3)
+#define CTX_AUTOCONFIRM     (1 << 4)
+#define CTX_NDOF            (1 << 5)
+#define CTX_MOVIECLIP       (1 << 6)
+#define CTX_MASK            (1 << 7)
 
 /* Standalone call to get the transformation center corresponding to the current situation
  * returns 1 if successful, 0 otherwise (usually means there's no selection)
index 59fe2a6705784c73d2638ef3f3129fc6d937a8c9..1360a180b2d02a136a962486fb94f6c69888dac2 100644 (file)
@@ -952,6 +952,8 @@ static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, const wmEvent *eve
                return OPERATOR_CANCELLED;
        }
 
+       BM_select_history_validate(bm);
+
        return OPERATOR_FINISHED;
 }
 
index ed466186d6323b5b6408a33f91a48f0f06dd1d07..d5a9d0f9f932a1106d739e6eab5dbb9ddc1ffdf6 100644 (file)
@@ -1324,12 +1324,6 @@ int transformEvent(TransInfo *t, const wmEvent *event)
                                        t->redraw |= TREDRAW_HARD;
                                }
                                break;
-//             case LEFTMOUSE:
-//             case RIGHTMOUSE:
-//                     if (WM_modal_tweak_exit(event, t->event_type))
-////                   if (t->options & CTX_TWEAK)
-//                             t->state = TRANS_CONFIRM;
-//                     break;
                        case LEFTALTKEY:
                        case RIGHTALTKEY:
                                if (ELEM(t->spacetype, SPACE_SEQ, SPACE_VIEW3D)) {
@@ -1374,7 +1368,7 @@ int calculateTransformCenter(bContext *C, int centerMode, float cent3d[3], int c
        t->state = TRANS_RUNNING;
 
        /* avoid calculating PET */
-       t->options = CTX_NONE | CTX_NO_PET;
+       t->options = CTX_NO_PET;
 
        t->mode = TFM_DUMMY;
 
index cb2cb801b5022d1e5944006515dd682ad3fd4faf..95ec20a0c2bbbba55f661abba249c86eec4aece4 100644 (file)
@@ -6668,10 +6668,6 @@ void createTransData(bContext *C, TransInfo *t)
                        sort_trans_data_dist(t);
                }
        }
-       else if (t->options == CTX_BMESH) {
-               // TRANSFORM_FIX_ME
-               //createTransBMeshVerts(t, G.editBMesh->bm, G.editBMesh->td);
-       }
        else if (t->spacetype == SPACE_IMAGE) {
                t->flag |= T_POINTS | T_2D_EDIT;
                if (t->options & CTX_MASK) {