[Bf-blender-cvs] [fee102e] wiggly-widgets: Bring back the old manipulator code, it works better with the transform system for now. Backup the old code in a new file
Antony Riakiotakis
noreply at git.blender.org
Wed Nov 19 16:13:26 CET 2014
Commit: fee102e818785b2501854a55b23e6d18b39b5f9f
Author: Antony Riakiotakis
Date: Wed Nov 19 16:07:56 2014 +0100
Branches: wiggly-widgets
https://developer.blender.org/rBfee102e818785b2501854a55b23e6d18b39b5f9f
Bring back the old manipulator code, it works better with the transform
system for now. Backup the old code in a new file
===================================================================
M source/blender/editors/include/ED_transform.h
M source/blender/editors/space_view3d/space_view3d.c
M source/blender/editors/space_view3d/view3d_draw.c
M source/blender/editors/space_view3d/view3d_edit.c
M source/blender/editors/space_view3d/view3d_ops.c
A source/blender/editors/transform/manipulator_widget.c
M source/blender/editors/transform/transform_manipulator.c
===================================================================
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index d36472e..eda1794 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -155,6 +155,7 @@ void Transform_Properties(struct wmOperatorType *ot, int flags);
/* view3d manipulators */
+/*
typedef struct ManipulatorGroup {
struct wmWidget *translate_x;
struct wmWidget *translate_y;
@@ -176,7 +177,10 @@ bool WIDGETGROUP_manipulator_poll(struct wmWidgetGroup *wgroup, const struct bCo
void WIDGETGROUP_manipulator_update(struct wmWidgetGroup *wgroup, const struct bContext *C);
void WIDGETGROUP_manipulator_free(struct wmWidgetGroup *wgroup);
void WIDGETGROUP_manipulator_create(struct wmWidgetGroup *wgroup);
+*/
+void BIF_draw_manipulator(const struct bContext *C);
+int BIF_do_manipulator(struct bContext *C, const struct wmEvent *event, struct wmOperator *op);
/* Snapping */
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 1be83b5..ab3a808 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -751,10 +751,12 @@ static void WIDGETGROUP_camera_create(struct wmWidgetGroup *wgroup)
static void view3d_widgets(void)
{
struct wmWidgetMapType *wmaptype = WM_widgetmaptype_find("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW, true);
+ /*
struct wmWidgetGroupType *wgroup_manipulator = WM_widgetgrouptype_new(WIDGETGROUP_manipulator_create,
WIDGETGROUP_manipulator_poll,
WIDGETGROUP_manipulator_update,
WIDGETGROUP_manipulator_free);
+ */
struct wmWidgetGroupType *wgroup_light = WM_widgetgrouptype_new(WIDGETGROUP_lamp_create,
WIDGETGROUP_lamp_poll,
WIDGETGROUP_lamp_update,
@@ -765,7 +767,7 @@ static void view3d_widgets(void)
WIDGETGROUP_camera_update,
WIDGETGROUP_camera_free);
- WM_widgetgrouptype_register(wmaptype, wgroup_manipulator);
+ //WM_widgetgrouptype_register(wmaptype, wgroup_manipulator);
WM_widgetgrouptype_register(wmaptype, wgroup_light);
WM_widgetgrouptype_register(wmaptype, wgroup_camera);
}
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 99ab628..22779ca 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -3553,6 +3553,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
view3d_main_area_setup_view(scene, v3d, ar, NULL, NULL);
glClear(GL_DEPTH_BUFFER_BIT);
WM_widgets_draw(C, ar);
+ BIF_draw_manipulator(C);
ED_region_pixelspace(ar);
view3d_main_area_draw_info(C, scene, ar, v3d, grid_unit, render_border);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 1d433b7..e504050 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -863,7 +863,7 @@ void viewrotate_modal_keymap(wmKeyConfig *keyconf)
{VIEWROT_MODAL_AXIS_SNAP_ENABLE, "AXIS_SNAP_ENABLE", 0, "Enable Axis Snap", ""},
{VIEWROT_MODAL_AXIS_SNAP_DISABLE, "AXIS_SNAP_DISABLE", 0, "Disable Axis Snap", ""},
-
+
{VIEWROT_MODAL_SWITCH_ZOOM, "SWITCH_TO_ZOOM", 0, "Switch to Zoom"},
{VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
@@ -890,7 +890,7 @@ void viewrotate_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ZOOM);
WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_MOVE);
#endif
-
+
/* assign map to operators */
WM_modalkeymap_assign(keymap, "VIEW3D_OT_rotate");
@@ -1227,20 +1227,20 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
viewrotate_apply(vod, 2 * event->x - event->prevx, 2 * event->y - event->prevy);
else
viewrotate_apply(vod, event->prevx, event->prevy);
-
+
ED_view3d_depth_tag_update(vod->rv3d);
-
+
viewops_data_free(C, op);
-
+
return OPERATOR_FINISHED;
}
else if (event->type == MOUSEROTATE) {
/* MOUSEROTATE performs orbital rotation, so y axis delta is set to 0 */
viewrotate_apply(vod, event->prevx, event->y);
ED_view3d_depth_tag_update(vod->rv3d);
-
+
viewops_data_free(C, op);
-
+
return OPERATOR_FINISHED;
}
else {
@@ -1613,7 +1613,7 @@ void view3d_ndof_fly(
*/
static int ndof_orbit_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
-
+
if (event->type != NDOF_MOTION) {
return OPERATOR_CANCELLED;
}
@@ -1679,7 +1679,7 @@ void VIEW3D_OT_ndof_orbit(struct wmOperatorType *ot)
static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
-
+
if (event->type != NDOF_MOTION) {
return OPERATOR_CANCELLED;
}
@@ -1875,7 +1875,7 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
{
static EnumPropertyItem modal_items[] = {
{VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
-
+
{VIEWROT_MODAL_SWITCH_ZOOM, "SWITCH_TO_ZOOM", 0, "Switch to Zoom"},
{VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
@@ -1899,7 +1899,7 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ZOOM);
WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
#endif
-
+
/* assign map to operators */
WM_modalkeymap_assign(keymap, "VIEW3D_OT_move");
}
@@ -1998,9 +1998,9 @@ static int viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* invert it, trackpad scroll follows same principle as 2d windows this way */
viewmove_apply(vod, 2 * event->x - event->prevx, 2 * event->y - event->prevy);
ED_view3d_depth_tag_update(vod->rv3d);
-
+
viewops_data_free(C, op);
-
+
return OPERATOR_FINISHED;
}
else {
@@ -2042,7 +2042,7 @@ void viewzoom_modal_keymap(wmKeyConfig *keyconf)
{
static EnumPropertyItem modal_items[] = {
{VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
-
+
{VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
{VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
@@ -2066,7 +2066,7 @@ void viewzoom_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_MOVE);
#endif
-
+
/* assign map to operators */
WM_modalkeymap_assign(keymap, "VIEW3D_OT_zoom");
}
@@ -2162,7 +2162,7 @@ static void viewzoom_apply(ViewOpsData *vod, const int xy[2], const short viewzo
}
else { /* USER_ZOOM_DOLLY */
float len1, len2;
-
+
if (U.uiflag & USER_ZOOM_HORIZ) {
len1 = (vod->ar->winrct.xmax - xy[0]) + 5;
len2 = (vod->ar->winrct.xmax - vod->origx) + 5;
@@ -2174,7 +2174,7 @@ static void viewzoom_apply(ViewOpsData *vod, const int xy[2], const short viewzo
if (zoom_invert) {
SWAP(float, len1, len2);
}
-
+
if (use_cam_zoom) {
/* zfac is ignored in this case, see below */
#if 0
@@ -2353,7 +2353,7 @@ void viewdolly_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_MOVE);
#endif
-
+
/* assign map to operators */
WM_modalkeymap_assign(keymap, "VIEW3D_OT_dolly");
}
@@ -2390,7 +2390,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
viewzoom_apply(vod, &event->prevx, USER_ZOOM_DOLLY, (U.uiflag & USER_ZOOM_INVERT) != 0);
}
ED_view3d_depth_tag_update(vod->rv3d);
-
+
viewops_data_free(C, op);
return OPERATOR_FINISHED;
}
@@ -3073,7 +3073,7 @@ static int viewcenter_cursor_exec(bContext *C, wmOperator *op)
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
Scene *scene = CTX_data_scene(C);
-
+
if (rv3d) {
ARegion *ar = CTX_wm_region(C);
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
@@ -3084,10 +3084,10 @@ static int viewcenter_cursor_exec(bContext *C, wmOperator *op)
ED_view3d_smooth_view(C, v3d, ar, NULL, NULL,
new_ofs, NULL, NULL, NULL,
smooth_viewtx);
-
+
/* smooth view does viewlock RV3D_BOXVIEW copy */
}
-
+
return OPERATOR_FINISHED;
}
@@ -3097,11 +3097,11 @@ void VIEW3D_OT_view_center_cursor(wmOperatorType *ot)
ot->name = "Center View to Cursor";
ot->description = "Center the view so that the cursor is in the middle of the view";
ot->idname = "VIEW3D_OT_view_center_cursor";
-
+
/* api callbacks */
ot->exec = viewcenter_cursor_exec;
ot->poll = ED_operator_view3d_active;
-
+
/* flags */
ot->flag = 0;
}
@@ -3412,17 +3412,17 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
/* Get Z Depths, needed for perspective, nice for ortho */
bgl_get_mats(&mats);
ED_view3d_draw_depth(scene, ar, v3d, true);
-
+
{
/* avoid allocating the whole depth buffer */
ViewDepths depth_temp = {0};
/* avoid view3d_update_depths() for speed. */
view3d_update_depths_rect(ar, &depth_temp, &rect);
-
+
/* find the closest Z pixel */
depth_close = view3d_depth_near(&depth_temp);
-
+
MEM_SAFE_FREE(depth_temp.depths);
}
@@ -3562,7 +3562,7 @@ static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar, View3D *v3d)
RegionView3D *rv3d = ar->regiondata;
float size[2];
int im_width = (scene->r.size * scene->r.xsch) / 100;
-
+
ED_view3d_calc_camera_border_size(scene, ar, v3d, r
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list