Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-07-24 08:28:14 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-07-24 10:26:02 +0300
commit4fd3582b32c56692a74c2719b2f064847418491a (patch)
treef006bef5e84745660f5591c2f37456f96fd08dac /source/blender
parentd53028b4501250d8d686c1b0e7d405b0ef6d1690 (diff)
Manipulator: view-selected support
Only applies to selected manipulators (currently not used for regular manipulators).
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c8
-rw-r--r--source/blender/windowmanager/manipulators/WM_manipulator_api.h3
-rw-r--r--source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c21
3 files changed, 30 insertions, 2 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 067f5781392..8d507ac86c2 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -3069,6 +3069,8 @@ static int viewselected_exec(bContext *C, wmOperator *op)
SceneLayer *sl = CTX_data_scene_layer(C);
bGPdata *gpd = CTX_data_gpencil_data(C);
const bool is_gp_edit = ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE));
+ const bool is_face_map = ((is_gp_edit == false) && ar->manipulator_map &&
+ WM_manipulatormap_is_any_selected(ar->manipulator_map));
Object *ob = OBACT_NEW;
Object *obedit = CTX_data_edit_object(C);
float min[3], max[3];
@@ -3080,8 +3082,7 @@ static int viewselected_exec(bContext *C, wmOperator *op)
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
INIT_MINMAX(min, max);
-
- if (is_gp_edit) {
+ if (is_gp_edit || is_face_map) {
ob = NULL;
}
@@ -3113,6 +3114,9 @@ static int viewselected_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
}
+ else if (is_face_map) {
+ ok = WM_manipulatormap_minmax(ar->manipulator_map, true, true, min, max);
+ }
else if (obedit) {
ok = ED_view3d_minmax_verts(obedit, min, max); /* only selected */
}
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_api.h b/source/blender/windowmanager/manipulators/WM_manipulator_api.h
index f6b430d5f45..fbc4791ecd4 100644
--- a/source/blender/windowmanager/manipulators/WM_manipulator_api.h
+++ b/source/blender/windowmanager/manipulators/WM_manipulator_api.h
@@ -207,6 +207,9 @@ void WM_manipulatormap_add_handlers(struct ARegion *ar, struct wmManipulatorMap
bool WM_manipulatormap_select_all(struct bContext *C, struct wmManipulatorMap *mmap, const int action);
bool WM_manipulatormap_cursor_set(const struct wmManipulatorMap *mmap, struct wmWindow *win);
bool WM_manipulatormap_is_any_selected(const struct wmManipulatorMap *mmap);
+bool WM_manipulatormap_minmax(
+ const struct wmManipulatorMap *mmap, bool use_hidden, bool use_select,
+ float r_min[3], float r_max[3]);
/* -------------------------------------------------------------------- */
/* wmManipulatorMapType */
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
index 7eb48c1c726..aea989d2cac 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
@@ -141,6 +141,27 @@ bool WM_manipulatormap_is_any_selected(const wmManipulatorMap *mmap)
}
/**
+ * \note We could use a callback to define bounds, for now just use matrix location.
+ */
+bool WM_manipulatormap_minmax(
+ const wmManipulatorMap *mmap, bool UNUSED(use_hidden), bool use_select,
+ float r_min[3], float r_max[3])
+{
+ if (use_select) {
+ int i;
+ for (i = 0; i < mmap->mmap_context.selected_len; i++) {
+ minmax_v3v3_v3(r_min, r_max, mmap->mmap_context.selected[i]->matrix_basis[3]);
+ }
+ return i != 0;
+ }
+ else {
+ bool ok = false;
+ BLI_assert(!"TODO");
+ return ok;
+ }
+}
+
+/**
* Creates and returns idname hash table for (visible) manipulators in \a mmap
*
* \param poll Polling function for excluding manipulators.