diff options
4 files changed, 37 insertions, 7 deletions
diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c index c9f083e2089..ca84de74b3d 100644 --- a/source/blender/editors/mesh/editmesh_bisect.c +++ b/source/blender/editors/mesh/editmesh_bisect.c @@ -200,7 +200,7 @@ static int mesh_bisect_modal(bContext *C, wmOperator *op, const wmEvent *event) { View3D *v3d = CTX_wm_view3d(C); if (v3d && (v3d->twtype & V3D_MANIPULATOR_DRAW)) { - WM_manipulator_group_type_add("MESH_WGT_bisect"); + WM_manipulator_group_type_ensure("MESH_WGT_bisect"); } } #endif @@ -675,6 +675,9 @@ static void manipulator_mesh_bisect_draw_prepare( const bContext *UNUSED(C), wmManipulatorGroup *mgroup) { ManipulatorGroup *man = mgroup->customdata; + if (man->data.op->next) { + man->data.op = WM_operator_last_redo((bContext *)man->data.context); + } manipulator_mesh_bisect_update_from_op(man); } diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index 9b6c7c08b13..f6db7a48108 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -765,7 +765,7 @@ static int edbm_spin_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e if (ret & OPERATOR_FINISHED) { /* Setup manipulators */ if (v3d && (v3d->twtype & V3D_MANIPULATOR_DRAW)) { - WM_manipulator_group_type_add("MESH_WGT_spin"); + WM_manipulator_group_type_ensure("MESH_WGT_spin"); } } #endif @@ -1159,6 +1159,9 @@ static void manipulator_mesh_spin_draw_prepare( const bContext *UNUSED(C), wmManipulatorGroup *mgroup) { ManipulatorSpinGroup *man = mgroup->customdata; + if (man->data.op->next) { + man->data.op = WM_operator_last_redo((bContext *)man->data.context); + } manipulator_mesh_spin_update_from_op(man); } diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_api.h b/source/blender/windowmanager/manipulators/WM_manipulator_api.h index 726e560a061..14cc5e9f137 100644 --- a/source/blender/windowmanager/manipulators/WM_manipulator_api.h +++ b/source/blender/windowmanager/manipulators/WM_manipulator_api.h @@ -274,7 +274,7 @@ void WM_manipulatormaptype_group_free(struct wmManipulatorGroupTypeRef *wgt); /* -------------------------------------------------------------------- */ /* ManipulatorGroup */ -/* Add/Remove (High level API) */ +/* Add/Ensure/Remove (High level API) */ void WM_manipulator_group_type_add_ptr_ex( struct wmManipulatorGroupType *wgt, @@ -283,6 +283,13 @@ void WM_manipulator_group_type_add_ptr( struct wmManipulatorGroupType *wgt); void WM_manipulator_group_type_add(const char *idname); +void WM_manipulator_group_type_ensure_ptr_ex( + struct wmManipulatorGroupType *wgt, + struct wmManipulatorMapType *mmap_type); +void WM_manipulator_group_type_ensure_ptr( + struct wmManipulatorGroupType *wgt); +void WM_manipulator_group_type_ensure(const char *idname); + void WM_manipulator_group_type_remove_ptr_ex( struct Main *bmain, struct wmManipulatorGroupType *wgt, struct wmManipulatorMapType *mmap_type); diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c index 1675be861d6..cc902f2acdb 100644 --- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c +++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c @@ -700,14 +700,12 @@ void WM_manipulator_group_type_add_ptr_ex( WM_manipulatorconfig_update_tag_init(mmap_type, wgt); } - void WM_manipulator_group_type_add_ptr( wmManipulatorGroupType *wgt) { wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure(&wgt->mmap_params); WM_manipulator_group_type_add_ptr_ex(wgt, mmap_type); } - void WM_manipulator_group_type_add(const char *idname) { wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(idname, false); @@ -715,6 +713,27 @@ void WM_manipulator_group_type_add(const char *idname) WM_manipulator_group_type_add_ptr(wgt); } +void WM_manipulator_group_type_ensure_ptr_ex( + wmManipulatorGroupType *wgt, + wmManipulatorMapType *mmap_type) +{ + wmManipulatorGroupTypeRef *wgt_ref = WM_manipulatormaptype_group_find_ptr(mmap_type, wgt); + if (wgt_ref == NULL) { + WM_manipulator_group_type_add_ptr_ex(wgt, mmap_type); + } +} +void WM_manipulator_group_type_ensure_ptr( + wmManipulatorGroupType *wgt) +{ + wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure(&wgt->mmap_params); + WM_manipulator_group_type_ensure_ptr_ex(wgt, mmap_type); +} +void WM_manipulator_group_type_ensure(const char *idname) +{ + wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(idname, false); + BLI_assert(wgt != NULL); + WM_manipulator_group_type_ensure_ptr(wgt); +} void WM_manipulator_group_type_remove_ptr_ex( struct Main *bmain, wmManipulatorGroupType *wgt, @@ -723,14 +742,12 @@ void WM_manipulator_group_type_remove_ptr_ex( WM_manipulatormaptype_group_unlink(NULL, bmain, mmap_type, wgt); WM_manipulatorgrouptype_free_ptr(wgt); } - void WM_manipulator_group_type_remove_ptr( struct Main *bmain, wmManipulatorGroupType *wgt) { wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure(&wgt->mmap_params); WM_manipulator_group_type_remove_ptr_ex(bmain, wgt, mmap_type); } - void WM_manipulator_group_type_remove(struct Main *bmain, const char *idname) { wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(idname, false); |