forked from bartvdbraak/blender
Bugfixes:
* Restored Center View to 3D Cursor. For now, I've mapped this to QKEY since all other nice combinations of CKEY have been taken now. * Fixed bug introduced in commit last night where parenting lattice to armatures with deforms would no longer work.
This commit is contained in:
parent
d83b251486
commit
c4a71795f5
@ -266,6 +266,7 @@ class VIEW3D_MT_view_align(bpy.types.Menu):
|
||||
layout.item_booleanO("view3d.view_all", "center", True, text="Center Cursor and View All")
|
||||
layout.itemO("view3d.camera_to_view", text="Align Active Camera to View")
|
||||
layout.itemO("view3d.view_center")
|
||||
layout.itemO("view3d.view_center_cursor")
|
||||
|
||||
|
||||
class VIEW3D_MT_view_align_selected(bpy.types.Menu):
|
||||
|
@ -653,8 +653,8 @@ static int parent_set_exec(bContext *C, wmOperator *op)
|
||||
//ob->partype= PARSKEL; /* note, dna define, not operator property */
|
||||
|
||||
/* BUT, to keep the deforms, we need a modifier, and then we need to set the object that it uses */
|
||||
// XXX currently this should only happen for meshes, curves and surfaces - this stuff isn't available for metas yet
|
||||
if (ELEM4(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT))
|
||||
// XXX currently this should only happen for meshes, curves, surfaces, and lattices - this stuff isn't available for metas yet
|
||||
if (ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE))
|
||||
{
|
||||
switch (partype)
|
||||
{
|
||||
|
@ -1232,6 +1232,52 @@ void VIEW3D_OT_view_center(wmOperatorType *ot)
|
||||
ot->flag= 0;
|
||||
}
|
||||
|
||||
static int viewcenter_cursor_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
RegionView3D *rv3d= CTX_wm_region_view3d(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
|
||||
if (rv3d) {
|
||||
if (rv3d->persp==RV3D_CAMOB) {
|
||||
/* center the camera offset */
|
||||
rv3d->camdx= rv3d->camdy= 0.0;
|
||||
}
|
||||
else {
|
||||
/* non camera center */
|
||||
float *curs= give_cursor(scene, v3d);
|
||||
float new_ofs[3];
|
||||
|
||||
new_ofs[0]= -curs[0];
|
||||
new_ofs[1]= -curs[1];
|
||||
new_ofs[2]= -curs[2];
|
||||
|
||||
smooth_view(C, NULL, NULL, new_ofs, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
if (rv3d->viewlock & RV3D_BOXVIEW)
|
||||
view3d_boxview_copy(CTX_wm_area(C), ar);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void VIEW3D_OT_view_center_cursor(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Center View to Cursor";
|
||||
ot->description= "Centers 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= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
|
||||
}
|
||||
|
||||
/* ********************* Set render border operator ****************** */
|
||||
|
||||
static int render_border_exec(bContext *C, wmOperator *op)
|
||||
|
@ -71,6 +71,7 @@ void VIEW3D_OT_rotate(struct wmOperatorType *ot);
|
||||
void VIEW3D_OT_view_all(struct wmOperatorType *ot);
|
||||
void VIEW3D_OT_viewnumpad(struct wmOperatorType *ot);
|
||||
void VIEW3D_OT_view_center(struct wmOperatorType *ot);
|
||||
void VIEW3D_OT_view_center_cursor(struct wmOperatorType *ot);
|
||||
void VIEW3D_OT_view_pan(struct wmOperatorType *ot);
|
||||
void VIEW3D_OT_view_persportho(struct wmOperatorType *ot);
|
||||
void VIEW3D_OT_view_orbit(struct wmOperatorType *ot);
|
||||
|
@ -71,6 +71,7 @@ void view3d_operatortypes(void)
|
||||
WM_operatortype_append(VIEW3D_OT_view_pan);
|
||||
WM_operatortype_append(VIEW3D_OT_view_persportho);
|
||||
WM_operatortype_append(VIEW3D_OT_view_center);
|
||||
WM_operatortype_append(VIEW3D_OT_view_center_cursor);
|
||||
WM_operatortype_append(VIEW3D_OT_select);
|
||||
WM_operatortype_append(VIEW3D_OT_select_border);
|
||||
WM_operatortype_append(VIEW3D_OT_clip_border);
|
||||
@ -127,6 +128,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
|
||||
WM_keymap_verify_item(keymap, "VIEW3D_OT_move", MIDDLEMOUSE, KM_PRESS, KM_SHIFT, 0);
|
||||
WM_keymap_verify_item(keymap, "VIEW3D_OT_zoom", MIDDLEMOUSE, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_verify_item(keymap, "VIEW3D_OT_view_center", PADPERIOD, KM_PRESS, 0, 0);
|
||||
WM_keymap_verify_item(keymap, "VIEW3D_OT_view_center_cursor", QKEY, KM_PRESS, 0, 0);
|
||||
|
||||
WM_keymap_verify_item(keymap, "VIEW3D_OT_fly", FKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
|
||||
|
@ -190,6 +190,7 @@ static void view_settings_from_ob(Object *ob, float *ofs, float *quat, float *di
|
||||
|
||||
|
||||
/* ****************** smooth view operator ****************** */
|
||||
/* This operator is one of the 'timer refresh' ones like animation playback */
|
||||
|
||||
struct SmoothViewStore {
|
||||
float orig_dist, new_dist;
|
||||
@ -386,6 +387,8 @@ void VIEW3D_OT_smoothview(wmOperatorType *ot)
|
||||
ot->poll= ED_operator_view3d_active;
|
||||
}
|
||||
|
||||
/* ****************** change view operators ****************** */
|
||||
|
||||
static void setcameratoview3d(View3D *v3d, RegionView3D *rv3d, Object *ob)
|
||||
{
|
||||
float dvec[3];
|
||||
@ -445,6 +448,7 @@ void VIEW3D_OT_setcameratoview(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
|
||||
static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
@ -479,6 +483,7 @@ void VIEW3D_OT_setobjectascamera(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* ********************************** */
|
||||
|
||||
/* create intersection coordinates in view Z direction at mouse coordinates */
|
||||
|
Loading…
Reference in New Issue
Block a user