From 93ec53881adecd47db65f5a7b316edd453c1c1c2 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Mon, 6 Feb 2023 23:05:20 -0500 Subject: [PATCH] Fix findChild spam in world map floater and fix bug in teleport coord rlv display --- indra/newview/llfloaterworldmap.cpp | 39 ++++++++++--------- indra/newview/llfloaterworldmap.h | 6 +++ .../default/xui/en/floater_world_map.xml | 4 +- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 58103cf483f..63a6c22293e 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -315,6 +315,11 @@ BOOL LLFloaterWorldMap::postBuild() mZoomSlider = getChild<LLSliderCtrl>("zoom slider"); + mLocationsLabel = getChild<LLUICtrl>("locations_label"); + mTeleportCoordSpinX = getChild<LLUICtrl>("teleport_coordinate_x"); + mTeleportCoordSpinY = getChild<LLUICtrl>("teleport_coordinate_y"); + mTeleportCoordSpinZ = getChild<LLUICtrl>("teleport_coordinate_z"); + LLComboBox *avatar_combo = getChild<LLComboBox>("friend combo"); avatar_combo->selectFirstItem(); avatar_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboPrearrange, this) ); @@ -577,7 +582,7 @@ void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const std::string& // convenience. if(gAgent.isGodlike()) { - getChild<LLUICtrl>("teleport_coordinate_z")->setValue(LLSD(200.f)); + mTeleportCoordSpinZ->setValue(LLSD(200.f)); } // Don't re-request info if we already have it or we won't have it in time to teleport if (mTrackedStatus != LLTracker::TRACKING_AVATAR || avatar_id != mTrackedAvatarID) @@ -718,20 +723,16 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) void LLFloaterWorldMap::enableTeleportCoordsDisplay( bool enabled ) { // [RLVa:KB] - Checked: 2012-02-08 (RLVa-1.4.5) | Added: RLVa-1.4.5 - LLUICtrl* pCtrl = getChild<LLUICtrl>("events_label"); - pCtrl->setVisible(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); + mLocationsLabel->setVisible(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); - pCtrl = getChild<LLUICtrl>("teleport_coordinate_x"); - pCtrl->setVisible(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); - pCtrl->setEnabled(enabled); + mTeleportCoordSpinX->setVisible(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); + mTeleportCoordSpinX->setEnabled(enabled); - pCtrl = getChild<LLUICtrl>("teleport_coordinate_y"); - pCtrl->setVisible(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); - pCtrl->setEnabled(enabled); + mTeleportCoordSpinY->setVisible(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); + mTeleportCoordSpinY->setEnabled(enabled); - pCtrl = getChild<LLUICtrl>("teleport_coordinate_z"); - pCtrl->setVisible(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); - pCtrl->setEnabled(enabled); + mTeleportCoordSpinZ->setVisible(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); + mTeleportCoordSpinZ->setEnabled(enabled); // [/RLVa:KB] // childSetEnabled("teleport_coordinate_x", enabled ); // childSetEnabled("teleport_coordinate_y", enabled ); @@ -765,9 +766,9 @@ void LLFloaterWorldMap::updateTeleportCoordsDisplay( const LLVector3d& pos ) } // write in the values - childSetValue("teleport_coordinate_x", region_local_x); - childSetValue("teleport_coordinate_y", region_local_y); - childSetValue("teleport_coordinate_z", region_local_z); + mTeleportCoordSpinX->setValue(region_local_x); + mTeleportCoordSpinY->setValue(region_local_y); + mTeleportCoordSpinZ->setValue(region_local_z); } void LLFloaterWorldMap::updateLocation() @@ -1350,9 +1351,9 @@ void LLFloaterWorldMap::onCoordinatesCommit() return; } - S32 x_coord = (S32)childGetValue("teleport_coordinate_x").asReal(); - S32 y_coord = (S32)childGetValue("teleport_coordinate_y").asReal(); - S32 z_coord = (S32)childGetValue("teleport_coordinate_z").asReal(); + S32 x_coord = (S32)mTeleportCoordSpinX->getValue().asReal(); + S32 y_coord = (S32)mTeleportCoordSpinY->getValue().asReal(); + S32 z_coord = (S32)mTeleportCoordSpinZ->getValue().asReal(); const std::string region_name = childGetValue("location").asString(); @@ -1504,7 +1505,7 @@ void LLFloaterWorldMap::teleport() && av_tracker.haveTrackingInfo() ) { pos_global = av_tracker.getGlobalPos(); - pos_global.mdV[VZ] = getChild<LLUICtrl>("teleport_coordinate_z")->getValue(); + pos_global.mdV[VZ] = mTeleportCoordSpinZ->getValue(); } else if ( LLTracker::TRACKING_LANDMARK == tracking_status) { diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index a702ab5145b..5ebf931044f 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -48,6 +48,7 @@ class LLWorldMapView; class LLButton; class LLCheckBoxCtrl; class LLSliderCtrl; +class LLSpinCtrl; class LLFloaterWorldMap final : public LLFloater { @@ -217,6 +218,11 @@ class LLFloaterWorldMap final : public LLFloater LLUICtrl* mLandmarkIcon = nullptr; LLUICtrl* mLocationIcon = nullptr; + LLUICtrl* mLocationsLabel = nullptr; + LLUICtrl* mTeleportCoordSpinX = nullptr; + LLUICtrl* mTeleportCoordSpinY = nullptr; + LLUICtrl* mTeleportCoordSpinZ = nullptr; + LLSliderCtrl* mZoomSlider = nullptr; boost::signals2::connection mTeleportFinishConnection; diff --git a/indra/newview/skins/default/xui/en/floater_world_map.xml b/indra/newview/skins/default/xui/en/floater_world_map.xml index 4347f862492..b5dd467fdd5 100644 --- a/indra/newview/skins/default/xui/en/floater_world_map.xml +++ b/indra/newview/skins/default/xui/en/floater_world_map.xml @@ -79,7 +79,7 @@ height="16" layout="topleft" left="15" - name="events_label" + name="legends_label" top="2" width="215"> Legend @@ -588,7 +588,7 @@ height="16" layout="topleft" left="15" - name="events_label" + name="locations_label" top_pad="16" width="70"> Location: -- GitLab