SL-92 WIP - added signal for simulator features received. Use to keep hover floater UI synced with region support for hover.

meow-7.2.2
Brad Payne (Vir Linden) 2015-01-13 17:18:15 -05:00
parent ee63c30ea7
commit d5ab47b1bc
7 changed files with 92 additions and 2 deletions

View File

@ -77,6 +77,13 @@ BOOL LLFloaterHoverHeight::postBuild()
LL_WARNS() << "Control not found for AvatarHoverOffsetZ" << LL_ENDL;
}
updateEditEnabled();
if (!mRegionBoundarySlot.connected())
{
mRegionBoundarySlot = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterHoverHeight::onRegionChanged,this));
}
return TRUE;
}
@ -98,4 +105,37 @@ void LLFloaterHoverHeight::onFinalCommit()
gSavedPerAccountSettings.setF32("AvatarHoverOffsetZ",value);
}
void LLFloaterHoverHeight::onRegionChanged()
{
LLViewerRegion *region = gAgent.getRegion();
if (region && region->simulatorFeaturesReceived())
{
updateEditEnabled();
}
else if (region)
{
region->setSimulatorFeaturesReceivedCallback(boost::bind(&LLFloaterHoverHeight::onSimulatorFeaturesReceived,this,_1));
}
}
void LLFloaterHoverHeight::onSimulatorFeaturesReceived(const LLUUID &region_id)
{
LLViewerRegion *region = gAgent.getRegion();
if (region && (region->getRegionID()==region_id))
{
updateEditEnabled();
}
}
void LLFloaterHoverHeight::updateEditEnabled()
{
bool enabled = gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled();
LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider");
sldrCtrl->setEnabled(enabled);
if (enabled)
{
syncFromPreferenceSetting(this);
}
}

View File

@ -40,6 +40,13 @@ public:
void onFinalCommit();
static void syncFromPreferenceSetting(void *user_data);
void onRegionChanged();
void onSimulatorFeaturesReceived(const LLUUID &region_id);
void updateEditEnabled();
boost::signals2::connection mRegionBoundarySlot;
};
#endif

View File

@ -3885,7 +3885,7 @@ class LLEnableHoverHeight : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
return true;
return gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled();
}
};

View File

@ -424,6 +424,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle,
mCacheDirty(FALSE),
mReleaseNotesRequested(FALSE),
mCapabilitiesReceived(false),
mSimulatorFeaturesReceived(false),
mBitsReceived(0.f),
mPacketsReceived(0.f),
mDead(FALSE),
@ -2027,6 +2028,26 @@ void LLViewerRegion::getInfo(LLSD& info)
info["Region"]["Handle"]["y"] = (LLSD::Integer)y;
}
boost::signals2::connection LLViewerRegion::setSimulatorFeaturesReceivedCallback(const caps_received_signal_t::slot_type& cb)
{
return mSimulatorFeaturesReceivedSignal.connect(cb);
}
void LLViewerRegion::setSimulatorFeaturesReceived(bool received)
{
mSimulatorFeaturesReceived = received;
if (received)
{
mSimulatorFeaturesReceivedSignal(getRegionID());
mSimulatorFeaturesReceivedSignal.disconnect_all_slots();
}
}
bool LLViewerRegion::simulatorFeaturesReceived() const
{
return mSimulatorFeaturesReceived;
}
void LLViewerRegion::getSimulatorFeatures(LLSD& sim_features) const
{
sim_features = mSimulatorFeatures;
@ -2040,6 +2061,9 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features)
LLSDSerialize::toPrettyXML(sim_features, str);
LL_INFOS() << str.str() << LL_ENDL;
mSimulatorFeatures = sim_features;
setSimulatorFeaturesReceived(true);
}
//this is called when the parent is not cacheable.
@ -3088,6 +3112,12 @@ bool LLViewerRegion::dynamicPathfindingEnabled() const
return ( mSimulatorFeatures.has("DynamicPathfindingEnabled") &&
mSimulatorFeatures["DynamicPathfindingEnabled"].asBoolean());
}
bool LLViewerRegion::avatarHoverHeightEnabled() const
{
return ( mSimulatorFeatures.has("AvatarHoverHeightEnabled") &&
mSimulatorFeatures["AvatarHoverHeightEnabled"].asBoolean());
}
/* Static Functions */
void log_capabilities(const CapabilityMap &capmap)

View File

@ -309,12 +309,19 @@ public:
bool meshRezEnabled() const;
bool meshUploadEnabled() const;
// has region received its simulator features list? Requires an additional query after caps received.
void setSimulatorFeaturesReceived(bool);
bool simulatorFeaturesReceived() const;
boost::signals2::connection setSimulatorFeaturesReceivedCallback(const caps_received_signal_t::slot_type& cb);
void getSimulatorFeatures(LLSD& info) const;
void setSimulatorFeatures(const LLSD& info);
bool dynamicPathfindingEnabled() const;
bool avatarHoverHeightEnabled() const;
typedef enum
{
CACHE_MISS_TYPE_FULL = 0,
@ -512,6 +519,7 @@ private:
BOOL mCacheDirty;
BOOL mAlive; // can become false if circuit disconnects
BOOL mCapabilitiesReceived;
BOOL mSimulatorFeaturesReceived;
BOOL mReleaseNotesRequested;
BOOL mDead; //if true, this region is in the process of deleting.
BOOL mPaused; //pause processing the objects in the region
@ -532,11 +540,13 @@ private:
CacheMissItem::cache_miss_list_t mCacheMissList;
caps_received_signal_t mCapabilitiesReceivedSignal;
caps_received_signal_t mSimulatorFeaturesReceivedSignal;
LLSD mSimulatorFeatures;
// the materials capability throttle
LLFrameTimer mMaterialsCapThrottleTimer;
LLFrameTimer mRenderInfoRequestTimer;
LLFrameTimer mRenderInfoRequestTimer;
};
inline BOOL LLViewerRegion::getRegionProtocol(U64 protocol) const

View File

@ -3220,6 +3220,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
debug_line += llformat(" - cof rcv:%d", last_received_cof_version);
}
debug_line += llformat(" bsz-z: %f avofs-z: %f", mBodySize[2], mAvatarOffset[2]);
bool hover_enabled = getRegion() && getRegion()->avatarHoverHeightEnabled();
debug_line += hover_enabled ? " H" : " h";
if (mHoverOffset[2] != 0.0)
{
debug_line += llformat(" hov_z: %f", mHoverOffset[2]);

View File

@ -18,6 +18,7 @@
title="SET HOVER HEIGHT"
width="515">
<slider
enabled="false"
control_name="HoverHeightSlider"
decimal_digits="3"
follows="top|left"