diff options
Diffstat (limited to 'indra/newview/lltoolmgr.cpp')
-rw-r--r-- | indra/newview/lltoolmgr.cpp | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index 51c0e2eeed..ac01316462 100644 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -81,7 +81,7 @@ LLToolMgr::LLToolMgr() // Not a panel, register these callbacks globally. LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Active", boost::bind(&LLToolMgr::inEdit, this)); LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Enabled", boost::bind(&LLToolMgr::canEdit, this)); - LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Build.Toggle", boost::bind(&LLToolMgr::toggleBuildMode, this)); + LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Build.Toggle", boost::bind(&LLToolMgr::toggleBuildMode, this, _2)); gToolNull = new LLTool(LLStringUtil::null); // Does nothing setCurrentTool(gToolNull); @@ -245,26 +245,19 @@ bool LLToolMgr::canEdit() return LLViewerParcelMgr::getInstance()->allowAgentBuild(); } -void LLToolMgr::toggleBuildMode() +void LLToolMgr::toggleBuildMode(const LLSD& sdname) { - if (inBuildMode()) + const std::string& param = sdname.asString(); + + if (param == "build" && !canEdit()) { - if (gSavedSettings.getBOOL("EditCameraMovement")) - { - // just reset the view, will pull us out of edit mode - handle_reset_view(); - } - else - { - // manually disable edit mode, but do not affect the camera - gAgentCamera.resetView(false); - LLFloaterReg::hideInstance("build"); - gViewerWindow->showCursor(); - } - // avoid spurious avatar movements pulling out of edit mode - LLViewerJoystick::getInstance()->setNeedsReset(); + return; } - else + + LLFloaterReg::toggleInstanceOrBringToFront("build"); + + bool build_visible = LLFloaterReg::instanceVisible("build"); + if (build_visible) { ECameraMode camMode = gAgentCamera.getCameraMode(); if (CAMERA_MODE_MOUSELOOK == camMode || CAMERA_MODE_CUSTOMIZE_AVATAR == camMode) @@ -291,7 +284,7 @@ void LLToolMgr::toggleBuildMode() } } - + setCurrentToolset(gBasicToolset); getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() ); @@ -304,6 +297,24 @@ void LLToolMgr::toggleBuildMode() LLViewerJoystick::getInstance()->setNeedsReset(); } + else + { + if (gSavedSettings.getBOOL("EditCameraMovement")) + { + // just reset the view, will pull us out of edit mode + handle_reset_view(); + } + else + { + // manually disable edit mode, but do not affect the camera + gAgentCamera.resetView(false); + LLFloaterReg::hideInstance("build"); + gViewerWindow->showCursor(); + } + // avoid spurious avatar movements pulling out of edit mode + LLViewerJoystick::getInstance()->setNeedsReset(); + } + } bool LLToolMgr::inBuildMode() |