Added View > Camera > Go To [0,0,0] button

This commit is contained in:
Marco Cawthorne 2021-06-04 11:39:39 +02:00
parent 6c9bcf04af
commit d05f867562
2 changed files with 18 additions and 0 deletions

View file

@ -1973,6 +1973,21 @@ void CamWnd_LookThroughCamera(CamWnd &camwnd)
}
}
void GlobalCamera_GoToZero(void)
{
CamWnd &camwnd = *g_camwnd;
Vector3 zero;
zero[0] = 0;
zero[1] = 0;
zero[2] = 0;
Camera_setAngles(camwnd, zero);
Camera_setOrigin(camwnd, zero);
Camera_updateModelview(camwnd.getCamera());
Camera_updateProjection(camwnd.getCamera());
CamWnd_Update(camwnd);
}
inline CameraModel *Instance_getCameraModel(scene::Instance &instance)
{
return InstanceTypeCast<CameraModel>::cast(instance);
@ -2118,6 +2133,7 @@ void CameraSpeed_decrease()
void CamWnd_Construct()
{
GlobalCommands_insert("CenterView", makeCallbackF(GlobalCamera_ResetAngles), Accelerator(GDK_KEY_End));
GlobalCommands_insert("GoToZero", makeCallbackF(GlobalCamera_GoToZero));
GlobalToggles_insert("ToggleCubicClip", makeCallbackF(Camera_ToggleFarClip),
ToggleItem::AddCallbackCaller(g_getfarclip_item),

View file

@ -2328,6 +2328,8 @@ ui::MenuItem create_view_menu()
menu_separator(camera_menu);
create_menu_item_with_mnemonic(camera_menu, "Look Through Selected", "LookThroughSelected");
create_menu_item_with_mnemonic(camera_menu, "Look Through Camera", "LookThroughCamera");
menu_separator(camera_menu);
create_menu_item_with_mnemonic(camera_menu, "Move to [0,0,0]", "GoToZero");
}
{