diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloaterpathfindinglinksets.cpp | 56 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindinglinksets.h | 7 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 27 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml | 4 |
4 files changed, 61 insertions, 33 deletions
diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index 0fe0e151fb..1e46d7a402 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -98,7 +98,11 @@ LLFloaterPathfindingLinksets::LLFloaterPathfindingLinksets(const LLSD& pSeed) mLabelSuggestedUseD(NULL), mEditD(NULL), mApplyEditsButton(NULL), - mBeaconColor() + mBeaconColor(), + mPreviousValueA(LLPathfindingLinkset::MAX_WALKABILITY_VALUE), + mPreviousValueB(LLPathfindingLinkset::MAX_WALKABILITY_VALUE), + mPreviousValueC(LLPathfindingLinkset::MAX_WALKABILITY_VALUE), + mPreviousValueD(LLPathfindingLinkset::MAX_WALKABILITY_VALUE) { } @@ -168,7 +172,7 @@ BOOL LLFloaterPathfindingLinksets::postBuild() mEditA = findChild<LLLineEditor>("edit_a_value"); llassert(mEditA != NULL); mEditA->setPrevalidate(LLTextValidate::validateNonNegativeS32); - mEditA->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1)); + mEditA->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1, mPreviousValueA)); mLabelEditB = findChild<LLTextBase>("edit_b_label"); llassert(mLabelEditB != NULL); @@ -179,7 +183,7 @@ BOOL LLFloaterPathfindingLinksets::postBuild() mEditB = findChild<LLLineEditor>("edit_b_value"); llassert(mEditB != NULL); mEditB->setPrevalidate(LLTextValidate::validateNonNegativeS32); - mEditB->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1)); + mEditB->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1, mPreviousValueB)); mLabelEditC = findChild<LLTextBase>("edit_c_label"); llassert(mLabelEditC != NULL); @@ -190,7 +194,7 @@ BOOL LLFloaterPathfindingLinksets::postBuild() mEditC = findChild<LLLineEditor>("edit_c_value"); llassert(mEditC != NULL); mEditC->setPrevalidate(LLTextValidate::validateNonNegativeS32); - mEditC->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1)); + mEditC->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1, mPreviousValueC)); mLabelEditD = findChild<LLTextBase>("edit_d_label"); llassert(mLabelEditD != NULL); @@ -201,7 +205,7 @@ BOOL LLFloaterPathfindingLinksets::postBuild() mEditD = findChild<LLLineEditor>("edit_d_value"); llassert(mEditD != NULL); mEditD->setPrevalidate(LLTextValidate::validateNonNegativeS32); - mEditD->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1)); + mEditD->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1, mPreviousValueD)); mApplyEditsButton = findChild<LLButton>("apply_edit_values"); llassert(mApplyEditsButton != NULL); @@ -323,26 +327,38 @@ void LLFloaterPathfindingLinksets::onClearFiltersClicked() rebuildObjectsScrollList(); } -void LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered(LLUICtrl *pUICtrl) +void LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered(LLUICtrl *pUICtrl, LLSD &pPreviousValue) { LLLineEditor *pLineEditor = static_cast<LLLineEditor *>(pUICtrl); llassert(pLineEditor != NULL); const std::string &valueString = pLineEditor->getText(); - S32 value; - if (LLStringUtil::convertToS32(valueString, value)) + S32 intValue; + LLSD value; + bool doResetValue = false; + + if (valueString.empty()) { - if ((value < LLPathfindingLinkset::MIN_WALKABILITY_VALUE) || (value > LLPathfindingLinkset::MAX_WALKABILITY_VALUE)) - { - value = llclamp(value, LLPathfindingLinkset::MIN_WALKABILITY_VALUE, LLPathfindingLinkset::MAX_WALKABILITY_VALUE); - pLineEditor->setValue(LLSD(value)); - } + value = pPreviousValue; + doResetValue = true; + } + else if (LLStringUtil::convertToS32(valueString, intValue)) + { + doResetValue = ((intValue < LLPathfindingLinkset::MIN_WALKABILITY_VALUE) || (intValue > LLPathfindingLinkset::MAX_WALKABILITY_VALUE)); + value = LLSD(llclamp(intValue, LLPathfindingLinkset::MIN_WALKABILITY_VALUE, LLPathfindingLinkset::MAX_WALKABILITY_VALUE)); } else { - pLineEditor->setValue(LLSD(LLPathfindingLinkset::MAX_WALKABILITY_VALUE)); + value = LLSD(LLPathfindingLinkset::MAX_WALKABILITY_VALUE); + doResetValue = true; + } + + if (doResetValue) + { + pLineEditor->setValue(value); } + pPreviousValue = value; } void LLFloaterPathfindingLinksets::onApplyChangesClicked() @@ -376,10 +392,14 @@ void LLFloaterPathfindingLinksets::updateEditFieldValues() const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(firstSelectedObjectPtr.get()); setEditLinksetUse(linkset->getLinksetUse()); - mEditA->setValue(LLSD(linkset->getWalkabilityCoefficientA())); - mEditB->setValue(LLSD(linkset->getWalkabilityCoefficientB())); - mEditC->setValue(LLSD(linkset->getWalkabilityCoefficientC())); - mEditD->setValue(LLSD(linkset->getWalkabilityCoefficientD())); + mPreviousValueA = LLSD(linkset->getWalkabilityCoefficientA()); + mPreviousValueB = LLSD(linkset->getWalkabilityCoefficientB()); + mPreviousValueC = LLSD(linkset->getWalkabilityCoefficientC()); + mPreviousValueD = LLSD(linkset->getWalkabilityCoefficientD()); + mEditA->setValue(mPreviousValueA); + mEditB->setValue(mPreviousValueB); + mEditC->setValue(mPreviousValueC); + mEditD->setValue(mPreviousValueD); } } diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h index 6538308122..7149da9215 100644 --- a/indra/newview/llfloaterpathfindinglinksets.h +++ b/indra/newview/llfloaterpathfindinglinksets.h @@ -74,7 +74,7 @@ private: void onApplyAllFilters(); void onClearFiltersClicked(); - void onWalkabilityCoefficientEntered(LLUICtrl *pUICtrl); + void onWalkabilityCoefficientEntered(LLUICtrl *pUICtrl, LLSD &pPreviousValue); void onApplyChangesClicked(); void clearFilters(); @@ -132,6 +132,11 @@ private: LLButton *mApplyEditsButton; LLColor4 mBeaconColor; + + LLSD mPreviousValueA; + LLSD mPreviousValueB; + LLSD mPreviousValueC; + LLSD mPreviousValueD; }; #endif // LL_LLFLOATERPATHFINDINGLINKSETS_H diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 572003d2ce..0a6c51b378 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -1433,9 +1433,10 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, #else val = (U16 *) &data[count]; #endif - setAngularVelocity( U16_to_F32(val[VX], -size, size), - U16_to_F32(val[VY], -size, size), - U16_to_F32(val[VZ], -size, size)); + new_angv.set(U16_to_F32(val[VX], -size, size), + U16_to_F32(val[VY], -size, size), + U16_to_F32(val[VZ], -size, size)); + setAngularVelocity(new_angv); break; case 16: @@ -1459,9 +1460,10 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, new_rot.mQ[VZ] = U8_to_F32(data[11], -1.f, 1.f); new_rot.mQ[VW] = U8_to_F32(data[12], -1.f, 1.f); - setAngularVelocity( U8_to_F32(data[13], -size, size), - U8_to_F32(data[14], -size, size), - U8_to_F32(data[15], -size, size) ); + new_angv.set(U8_to_F32(data[13], -size, size), + U8_to_F32(data[14], -size, size), + U8_to_F32(data[15], -size, size)); + setAngularVelocity(new_angv); break; } @@ -1533,9 +1535,10 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, dp->unpackU16(val[VX], "AccX"); dp->unpackU16(val[VY], "AccY"); dp->unpackU16(val[VZ], "AccZ"); - setAngularVelocity( U16_to_F32(val[VX], -64.f, 64.f), - U16_to_F32(val[VY], -64.f, 64.f), - U16_to_F32(val[VZ], -64.f, 64.f)); + new_angv.set(U16_to_F32(val[VX], -64.f, 64.f), + U16_to_F32(val[VY], -64.f, 64.f), + U16_to_F32(val[VZ], -64.f, 64.f)); + setAngularVelocity(new_angv); } break; case OUT_FULL_COMPRESSED: @@ -1579,8 +1582,8 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (value & 0x80) { - dp->unpackVector3(vec, "Omega"); - setAngularVelocity(vec); + dp->unpackVector3(new_angv, "Omega"); + setAngularVelocity(new_angv); } if (value & 0x20) @@ -2074,7 +2077,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, { if (new_angv != old_angv) { - if (flagUsePhysics()) + if (flagUsePhysics() || new_angv.isExactlyZero()) { resetRot(); } diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml index 9bc5c7d5a4..4a457fb929 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml @@ -6,7 +6,7 @@ height="395" width="1075" min_height="395" - min_width="1075" + min_width="990" layout="topleft" name="floater_pathfinding_linksets" help_topic="floater_pathfinding_linksets" @@ -524,7 +524,7 @@ tool_tip="Walkability for characters of type D. Example character type is other." width="45" /> <button - follows="right|bottom" + follows="left|bottom" height="21" label="Apply changes" layout="topleft" |