From 4caf151c5ad1e07f819bc8e5ab8eda584f41420b Mon Sep 17 00:00:00 2001 From: prep linden Date: Wed, 22 Jun 2011 13:36:21 -0400 Subject: WIP for SH-1791 --- indra/newview/llviewerobject.cpp | 84 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 80 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index be9ff872c0..3185625094 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -104,6 +104,7 @@ #include "llaccountingquota.h" //#define DEBUG_UPDATE_TYPE +//#define EXTENDED_ENCROACHMENT_CHECK //temp: BOOL LLViewerObject::sVelocityInterpolate = TRUE; BOOL LLViewerObject::sPingInterpolate = TRUE; @@ -519,7 +520,6 @@ void LLViewerObject::setNameValueList(const std::string& name_value_list) } } - // This method returns true if the object is over land owned by the // agent. bool LLViewerObject::isReturnable() @@ -534,11 +534,87 @@ bool LLViewerObject::isReturnable() iter != mChildList.end(); iter++) { LLViewerObject* child = *iter; - boxes.push_back(LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned()); + boxes.push_back( LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned()); + } + + bool result = (mRegionp && mRegionp->objectIsReturnable(getPositionRegion(), boxes)) ? 1 : 0; +#ifdef EXTENDED_ENCROACHMENT_CHECK + //Get list of neighboring regions + std::vector uniqueRegions; + //Store this vo's region + uniqueRegions.push_back( mRegionp ); + //Build list of neighboring regions realtive to this vo's region + mRegionp->getNeighboringRegions( uniqueRegions ); + + //Build aabb's - for root and all children + std::vector returnables; + if ( !result ) + { + //Current region + PotentialReturnableObject returnableObj; + returnableObj.box = LLBBox( getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned() ; + returnableObj.pRegion = getRegion(); + + for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) + { + LLViewerObject* pChild = *iter; + buildReturnablesForChildrenVO( returnables, pChild ); + } + } + + //TBD# Should probably create a region -> box map + typedef std::vector::iterator ReturnablesIt; + ReturnablesIt retCurrentIt = returnables.begin(); + ReturnablesIt retEndIt = returnables.end(); + + for ( ; retCurrentIt !=retEndIt; ++retCurrentIt ) + { + boxes.clear(); + LLViewerRegion* pRegion = (*retCurrentIt).pRegion; + boxes.push_back( (*retCurrentIt).box ); + //LLVector3 boxPos = (*retCurrentIt).box.getPositionAgent(); + //TBD# Should we just use pRegion->objectIsReturnable, instead? + //As it does various other checks, childrenObjectReturnable does not. + bool retResult = (mRegionp && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0; + if ( retResult ) + { + result = true; + break; + } + } +#endif + return result; +} + +void LLViewerObject::buildReturnablesForChildrenVO( std::vector& returnables, LLViewerObject* pChild ) +{ + if ( !pChild ) + { + llerrs<<"child viewerobject is NULL "<mChildList.begin(); iter != pChild->mChildList.end(); iter++) + { + LLViewerObject* pChildofChild = *iter; + buildReturnablesForChildrenVO( returnables, pChildofChild ); + } +} - return mRegionp - && mRegionp->objectIsReturnable(getPositionRegion(), boxes); +void LLViewerObject::constructAndAddReturnable( std::vector& returnables, LLViewerObject* pChild ) +{ + PotentialReturnableObject returnableObj; + LLViewerRegion* pRegion = pChild->getRegion(); + + LLVector3d posGlobal = pRegion->getPosGlobalFromRegion( pChild->getPositionRegion() ); + LLVector3 targetRegionPos = pRegion->getPosRegionFromGlobal( posGlobal ); + + returnableObj.box = LLBBox( targetRegionPos, pChild->getRotationRegion(), pChild->getScale() * -0.5f, + pChild->getScale() * 0.5f).getAxisAligned(); + returnableObj.pRegion = pRegion; + returnables.push_back( returnableObj ); } BOOL LLViewerObject::setParent(LLViewerObject* parent) -- cgit v1.3 From 0961c3baaa6f5be42d4c3996c0563f905a8df053 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 22 Jun 2011 15:54:16 -0400 Subject: WIP SH-1791 - constructAndAddReturnable() now accepts target region --- indra/newview/llviewerobject.cpp | 95 ++++++++++++++++++++-------------------- indra/newview/llviewerobject.h | 4 +- 2 files changed, 50 insertions(+), 49 deletions(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 3185625094..a3a6ef1888 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -104,7 +104,7 @@ #include "llaccountingquota.h" //#define DEBUG_UPDATE_TYPE -//#define EXTENDED_ENCROACHMENT_CHECK //temp: +#define EXTENDED_ENCROACHMENT_CHECK //temp: BOOL LLViewerObject::sVelocityInterpolate = TRUE; BOOL LLViewerObject::sPingInterpolate = TRUE; @@ -538,82 +538,83 @@ bool LLViewerObject::isReturnable() } bool result = (mRegionp && mRegionp->objectIsReturnable(getPositionRegion(), boxes)) ? 1 : 0; + #ifdef EXTENDED_ENCROACHMENT_CHECK - //Get list of neighboring regions - std::vector uniqueRegions; - //Store this vo's region - uniqueRegions.push_back( mRegionp ); - //Build list of neighboring regions realtive to this vo's region - mRegionp->getNeighboringRegions( uniqueRegions ); - //Build aabb's - for root and all children - std::vector returnables; if ( !result ) - { - //Current region - PotentialReturnableObject returnableObj; - returnableObj.box = LLBBox( getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned() ; - returnableObj.pRegion = getRegion(); - - for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) - { - LLViewerObject* pChild = *iter; - buildReturnablesForChildrenVO( returnables, pChild ); - } - } + { + std::vector uniqueRegions; + //Get list of neighboring regions relative to this vo's region + mRegionp->getNeighboringRegions( uniqueRegions ); + + //Build aabb's - for root and all children + std::vector returnables; + typedef std::vector::iterator RegionIt; + RegionIt regionStart = uniqueRegions.begin(); + RegionIt regionEnd = uniqueRegions.end(); + for (; regionStart != regionEnd; ++regionStart ) + { + LLViewerRegion* pTargetRegion = *regionStart; + for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) + { + LLViewerObject* pChild = *iter; + buildReturnablesForChildrenVO( returnables, pChild, pTargetRegion ); + } + } - //TBD# Should probably create a region -> box map - typedef std::vector::iterator ReturnablesIt; - ReturnablesIt retCurrentIt = returnables.begin(); - ReturnablesIt retEndIt = returnables.end(); + //TBD# Should probably create a region -> box list map + typedef std::vector::iterator ReturnablesIt; + ReturnablesIt retCurrentIt = returnables.begin(); + ReturnablesIt retEndIt = returnables.end(); - for ( ; retCurrentIt !=retEndIt; ++retCurrentIt ) - { - boxes.clear(); - LLViewerRegion* pRegion = (*retCurrentIt).pRegion; - boxes.push_back( (*retCurrentIt).box ); - //LLVector3 boxPos = (*retCurrentIt).box.getPositionAgent(); - //TBD# Should we just use pRegion->objectIsReturnable, instead? - //As it does various other checks, childrenObjectReturnable does not. - bool retResult = (mRegionp && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0; - if ( retResult ) - { - result = true; - break; + for ( ; retCurrentIt !=retEndIt; ++retCurrentIt ) + { + boxes.clear(); + LLViewerRegion* pRegion = (*retCurrentIt).pRegion; + boxes.push_back( (*retCurrentIt).box ); + //LLVector3 boxPos = (*retCurrentIt).box.getPositionAgent(); + //TBD# Should we just use pRegion->objectIsReturnable, instead? + //As it does various other checks, childrenObjectReturnable does not. + bool retResult = (mRegionp && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0; + if ( retResult ) + { + result = true; + break; + } } } #endif return result; } -void LLViewerObject::buildReturnablesForChildrenVO( std::vector& returnables, LLViewerObject* pChild ) +void LLViewerObject::buildReturnablesForChildrenVO( std::vector& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion ) { if ( !pChild ) { llerrs<<"child viewerobject is NULL "<mChildList.begin(); iter != pChild->mChildList.end(); iter++) { LLViewerObject* pChildofChild = *iter; - buildReturnablesForChildrenVO( returnables, pChildofChild ); + buildReturnablesForChildrenVO( returnables, pChildofChild, pTargetRegion ); } } -void LLViewerObject::constructAndAddReturnable( std::vector& returnables, LLViewerObject* pChild ) +void LLViewerObject::constructAndAddReturnable( std::vector& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion ) { PotentialReturnableObject returnableObj; - LLViewerRegion* pRegion = pChild->getRegion(); - + + LLViewerRegion* pRegion = pChild->getRegion(); LLVector3d posGlobal = pRegion->getPosGlobalFromRegion( pChild->getPositionRegion() ); - LLVector3 targetRegionPos = pRegion->getPosRegionFromGlobal( posGlobal ); + LLVector3 targetRegionPos = pTargetRegion->getPosRegionFromGlobal( posGlobal ); returnableObj.box = LLBBox( targetRegionPos, pChild->getRotationRegion(), pChild->getScale() * -0.5f, pChild->getScale() * 0.5f).getAxisAligned(); - returnableObj.pRegion = pRegion; + returnableObj.pRegion = pTargetRegion; returnables.push_back( returnableObj ); } diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index a7d0933dc3..f75a3d996d 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -240,8 +240,8 @@ public: // anti-encroachment is enabled bool isReturnable(); - void buildReturnablesForChildrenVO( std::vector& returnables, LLViewerObject* pChild ); - void constructAndAddReturnable( std::vector& returnables, LLViewerObject* pChild ); + void buildReturnablesForChildrenVO( std::vector& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion ); + void constructAndAddReturnable( std::vector& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion ); /* // This method will scan through this object, and then query the -- cgit v1.3 From e7c5913c0541c9c5ebcab93ec5fe4e8b1102eb23 Mon Sep 17 00:00:00 2001 From: prep linden Date: Fri, 24 Jun 2011 15:21:50 -0400 Subject: Bug fixes for SH-1791 --- indra/newview/llviewerobject.cpp | 47 ++++++++++++++++++++------------- indra/newview/llviewerparceloverlay.cpp | 27 +++++++++++++++++++ indra/newview/llviewerparceloverlay.h | 1 + indra/newview/llviewerregion.cpp | 3 +-- 4 files changed, 58 insertions(+), 20 deletions(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index a3a6ef1888..c3a7d345f5 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -104,7 +104,6 @@ #include "llaccountingquota.h" //#define DEBUG_UPDATE_TYPE -#define EXTENDED_ENCROACHMENT_CHECK //temp: BOOL LLViewerObject::sVelocityInterpolate = TRUE; BOOL LLViewerObject::sPingInterpolate = TRUE; @@ -528,6 +527,7 @@ bool LLViewerObject::isReturnable() { return false; } + std::vector boxes; boxes.push_back(LLBBox(getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned()); for (child_list_t::iterator iter = mChildList.begin(); @@ -538,13 +538,11 @@ bool LLViewerObject::isReturnable() } bool result = (mRegionp && mRegionp->objectIsReturnable(getPositionRegion(), boxes)) ? 1 : 0; - -#ifdef EXTENDED_ENCROACHMENT_CHECK if ( !result ) { - std::vector uniqueRegions; //Get list of neighboring regions relative to this vo's region + std::vector uniqueRegions; mRegionp->getNeighboringRegions( uniqueRegions ); //Build aabb's - for root and all children @@ -552,9 +550,14 @@ bool LLViewerObject::isReturnable() typedef std::vector::iterator RegionIt; RegionIt regionStart = uniqueRegions.begin(); RegionIt regionEnd = uniqueRegions.end(); + for (; regionStart != regionEnd; ++regionStart ) { LLViewerRegion* pTargetRegion = *regionStart; + //Add the root vo as there may be no children and we still want + //to test for any edge overlap + buildReturnablesForChildrenVO( returnables, this, pTargetRegion ); + //Add it's children for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) { LLViewerObject* pChild = *iter; @@ -562,7 +565,7 @@ bool LLViewerObject::isReturnable() } } - //TBD# Should probably create a region -> box list map + //TBD#Eventually create a region -> box list map typedef std::vector::iterator ReturnablesIt; ReturnablesIt retCurrentIt = returnables.begin(); ReturnablesIt retEndIt = returnables.end(); @@ -572,10 +575,7 @@ bool LLViewerObject::isReturnable() boxes.clear(); LLViewerRegion* pRegion = (*retCurrentIt).pRegion; boxes.push_back( (*retCurrentIt).box ); - //LLVector3 boxPos = (*retCurrentIt).box.getPositionAgent(); - //TBD# Should we just use pRegion->objectIsReturnable, instead? - //As it does various other checks, childrenObjectReturnable does not. - bool retResult = (mRegionp && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0; + bool retResult = (pRegion && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0; if ( retResult ) { result = true; @@ -583,7 +583,6 @@ bool LLViewerObject::isReturnable() } } } -#endif return result; } @@ -606,16 +605,28 @@ void LLViewerObject::buildReturnablesForChildrenVO( std::vector& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion ) { - PotentialReturnableObject returnableObj; - - LLViewerRegion* pRegion = pChild->getRegion(); - LLVector3d posGlobal = pRegion->getPosGlobalFromRegion( pChild->getPositionRegion() ); - LLVector3 targetRegionPos = pTargetRegion->getPosRegionFromGlobal( posGlobal ); - returnableObj.box = LLBBox( targetRegionPos, pChild->getRotationRegion(), pChild->getScale() * -0.5f, + LLVector3 targetRegionPos; + targetRegionPos.setVec( pChild->getPositionGlobal() ); + + LLBBox childBBox = LLBBox( targetRegionPos, pChild->getRotationRegion(), pChild->getScale() * -0.5f, pChild->getScale() * 0.5f).getAxisAligned(); - returnableObj.pRegion = pTargetRegion; - returnables.push_back( returnableObj ); + + LLVector3 edgeA = targetRegionPos + childBBox.getMinLocal(); + LLVector3 edgeB = targetRegionPos + childBBox.getMaxLocal(); + + LLVector3d edgeAd, edgeBd; + edgeAd.setVec(edgeA); + edgeBd.setVec(edgeB); + + //Only add the box when either of the extents are in a neighboring region + if ( pTargetRegion->pointInRegionGlobal( edgeAd ) || pTargetRegion->pointInRegionGlobal( edgeBd ) ) + { + PotentialReturnableObject returnableObj; + returnableObj.box = childBBox; + returnableObj.pRegion = pTargetRegion; + returnables.push_back( returnableObj ); + } } BOOL LLViewerObject::setParent(LLViewerObject* parent) diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 26765bdd01..eff16b6a6e 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -173,6 +173,33 @@ bool LLViewerParcelOverlay::encroachesOwned(const std::vector& boxes) co } return false; } +bool LLViewerParcelOverlay::encroachesOnUnowned(const std::vector& boxes) const +{ + // boxes are expected to already be axis aligned + for (U32 i = 0; i < boxes.size(); ++i) + { + LLVector3 min = boxes[i].getMinAgent(); + LLVector3 max = boxes[i].getMaxAgent(); + + S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); + S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); + S32 top = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); + S32 bottom = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); + + for (S32 row = top; row <= bottom; row++) + { + for (S32 column = left; column <= right; column++) + { + U8 type = ownership(row, column); + if ((PARCEL_SELF != type)) + { + return true; + } + } + } + } + return false; +} BOOL LLViewerParcelOverlay::isSoundLocal(const LLVector3& pos) const { diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index c80baedda6..3c6794e7d0 100644 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -60,6 +60,7 @@ public: // might be in another parcel. for now, we simply test axis aligned // bounding boxes which isn't perfect, but is close bool encroachesOwned(const std::vector& boxes) const; + bool encroachesOnUnowned(const std::vector& boxes) const; BOOL isSoundLocal(const LLVector3& pos) const; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0df97d6050..85b4b60bf7 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1702,8 +1702,7 @@ bool LLViewerRegion::objectIsReturnable(const LLVector3& pos, const std::vector< bool LLViewerRegion::childrenObjectReturnable( const std::vector& boxes ) const { bool result = false; - //TBD# Do we need similar checks to objectIsReturnable? if so just use objectisreturnable - result = ( mParcelOverlay && mParcelOverlay->encroachesOwned( boxes ) ) ? 1 : 0; + result = ( mParcelOverlay && mParcelOverlay->encroachesOnUnowned( boxes ) ) ? 1 : 0; return result; } -- cgit v1.3 From 74c5c0a0d7761d0762bb0e7775259e0556fd392a Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 6 Jul 2011 20:05:38 +0300 Subject: SH-1945 FIXED Added a check for Estate Managership when checking whether an object encroaching on the region can be returned. --- indra/newview/llviewerobject.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index c3a7d345f5..fdf1e4a89b 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -575,7 +575,9 @@ bool LLViewerObject::isReturnable() boxes.clear(); LLViewerRegion* pRegion = (*retCurrentIt).pRegion; boxes.push_back( (*retCurrentIt).box ); - bool retResult = (pRegion && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0; + bool retResult = pRegion + && pRegion->childrenObjectReturnable( boxes ) + && pRegion->canManageEstate(); if ( retResult ) { result = true; -- cgit v1.3 From 8b7e33ad36bc33c2356300f8eabc8ddae578070e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 19 Jul 2011 15:19:07 -0400 Subject: Cherry pick of https://bitbucket.org/lindenlab/mesh-development/changeset/9cea44ebea3b by don, to fix old viewer crashes in mesh regions --- indra/llprimitive/llprimitive.h | 1 + indra/newview/llviewerobject.cpp | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index 76faa1b8c5..8903d8e049 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -103,6 +103,7 @@ public: PARAMS_LIGHT = 0x20, PARAMS_SCULPT = 0x30, PARAMS_LIGHT_IMAGE = 0x40, + PARAMS_MESH = 0x50, }; public: diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index bbe929b7f7..b5fdca632b 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4877,6 +4877,10 @@ void LLViewerObject::adjustAudioGain(const F32 gain) bool LLViewerObject::unpackParameterEntry(U16 param_type, LLDataPacker *dp) { + if (LLNetworkData::PARAMS_MESH == param_type) + { + param_type = LLNetworkData::PARAMS_SCULPT; + } ExtraParameter* param = getExtraParameterEntryCreate(param_type); if (param) { -- cgit v1.3 From 9bef7e95d064e1e82467e57df6673b149b77839f Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 29 Jul 2011 05:20:54 +0300 Subject: STORM-1436 FIXED Broken localization of "Contents" and "New Script" items in the Contents tab of Build Tools. The bug happened when the translations contained non-ASCII characters. Reason: Names of inventory items are limited to ASCII characters. Fix: Leave names in English, localize them when displaying (on the fly). The fix only affects object's inventory (i.e. not agent inventory). --- indra/newview/llpanelcontents.cpp | 2 +- indra/newview/llpanelobjectinventory.cpp | 56 ++++++++++++++++++++++---------- indra/newview/llviewerobject.cpp | 4 +-- 3 files changed, 42 insertions(+), 20 deletions(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index bf3bf38863..a64b4ec94d 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -172,7 +172,7 @@ void LLPanelContents::onClickNewScript(void *userdata) LLUUID::null, LLAssetType::AT_LSL_TEXT, LLInventoryType::IT_LSL, - LLTrans::getString("PanelContentsNewScript"), + "New Script", desc, LLSaleInfo::DEFAULT, LLInventoryItemFlags::II_FLAGS_NONE, diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index e3b61f695a..83ba8afbfc 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -83,6 +83,7 @@ protected: LLAssetType::EType mAssetType; LLInventoryType::EType mInventoryType; + LLInventoryObject* findInvObject() const; LLInventoryItem* findItem() const; public: @@ -162,16 +163,22 @@ LLTaskInvFVBridge::LLTaskInvFVBridge( } } -LLInventoryItem* LLTaskInvFVBridge::findItem() const +LLInventoryObject* LLTaskInvFVBridge::findInvObject() const { LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); - if(object) + if (object) { - return dynamic_cast(object->getInventoryObject(mUUID)); + return object->getInventoryObject(mUUID); } return NULL; } + +LLInventoryItem* LLTaskInvFVBridge::findItem() const +{ + return dynamic_cast(findInvObject()); +} + void LLTaskInvFVBridge::showProperties() { show_task_item_profile(mUUID, mPanel->getTaskUUID()); @@ -295,21 +302,15 @@ const std::string& LLTaskInvFVBridge::getDisplayName() const if(item) { - if(item->getParentUUID().isNull()) - { - if(item->getName() == "Contents") - { - mDisplayName.assign(LLTrans::getString("ViewerObjectContents")); - } - else - { - mDisplayName.assign(item->getName()); - } - } - else + mDisplayName.assign(item->getName()); + + // Localize "New Script", "New Script 1", "New Script 2", etc. + if (item->getType() == LLAssetType::AT_LSL_TEXT && + LLStringUtil::startsWith(item->getName(), "New Script")) { - mDisplayName.assign(item->getName()); + LLStringUtil::replaceString(mDisplayName, "New Script", LLTrans::getString("PanelContentsNewScript")); } + const LLPermissions& perm(item->getPermissions()); BOOL copy = gAgent.allowOperation(PERM_COPY, perm, GP_OBJECT_MANIPULATE); BOOL mod = gAgent.allowOperation(PERM_MODIFY, perm, GP_OBJECT_MANIPULATE); @@ -700,7 +701,7 @@ public: const std::string& name); virtual LLUIImagePtr getIcon() const; - virtual const std::string& getDisplayName() const { return getName(); } + virtual const std::string& getDisplayName() const; virtual BOOL isItemRenameable() const; // virtual BOOL isItemCopyable() const { return FALSE; } virtual BOOL renameItem(const std::string& new_name); @@ -728,6 +729,27 @@ LLUIImagePtr LLTaskCategoryBridge::getIcon() const return LLUI::getUIImage("Inv_FolderClosed"); } +// virtual +const std::string& LLTaskCategoryBridge::getDisplayName() const +{ + LLInventoryObject* cat = findInvObject(); + + if (cat) + { + // Localize "Contents" folder. + if (cat->getParentUUID().isNull() && cat->getName() == "Contents") + { + mDisplayName.assign(LLTrans::getString("ViewerObjectContents")); + } + else + { + mDisplayName.assign(cat->getName()); + } + } + + return mDisplayName; +} + BOOL LLTaskCategoryBridge::isItemRenameable() const { return FALSE; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 972993202a..b187fdca6f 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2660,7 +2660,7 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data) LLPointer obj; obj = new LLInventoryObject(object->mID, LLUUID::null, LLAssetType::AT_CATEGORY, - LLTrans::getString("ViewerObjectContents").c_str()); + "Contents"); object->mInventory->push_front(obj); object->doInventoryCallback(); delete ft; @@ -2727,7 +2727,7 @@ void LLViewerObject::loadTaskInvFile(const std::string& filename) { LLPointer inv = new LLInventoryObject; inv->importLegacyStream(ifs); - inv->rename(LLTrans::getString("ViewerObjectContents").c_str()); + inv->rename("Contents"); mInventory->push_front(inv); } else -- cgit v1.3