Ansariel 2024-08-05 17:27:27 +02:00
commit 2bce31ded5
9 changed files with 182 additions and 6 deletions

View File

@ -1659,6 +1659,80 @@ bool FSPanelAreaSearchList::onContextMenuItemEnable(const LLSD& userdata)
}
}
bool FSPanelAreaSearchList::onContextMenuItemVisibleRLV(const LLSD& userdata)
{
if (!RlvActions::isRlvEnabled())
{
return true;
}
if (RlvActions::hasBehaviour(RLV_BHVR_INTERACT))
{
return false;
}
const std::string& parameter = userdata.asStringRef();
std::vector<std::string> behavs;
LLStringUtil::getTokens(parameter, behavs, "|");
if (std::find(behavs.begin(), behavs.end(), "delete") != behavs.end())
{
if (!rlvCanDeleteOrReturn())
{
return false;
}
}
std::vector<LLScrollListItem*> selected = mResultList->getAllSelected();
for (const auto item : selected)
{
const LLUUID& object_id = item->getUUID();
LLViewerObject* objectp = gObjectList.findObject(object_id);
if (!objectp)
{
return false;
}
if (
std::find(behavs.begin(), behavs.end(), "touch") != behavs.end()
&& !RlvActions::canTouch(objectp)
)
{
return false;
}
else if (
std::find(behavs.begin(), behavs.end(), "edit") != behavs.end()
&& !RlvActions::canEdit(objectp)
)
{
return false;
}
else if (
std::find(behavs.begin(), behavs.end(), "sit") != behavs.end()
&& !RlvActions::canSit(objectp)
)
{
return false;
}
else if (
std::find(behavs.begin(), behavs.end(), "buy") != behavs.end()
&& !RlvActions::canBuyObject(object_id)
)
{
return false;
}
else if (
std::find(behavs.begin(), behavs.end(), "teleport") != behavs.end()
&& !RlvActions::canTeleportToLocal(objectp->getPositionGlobal())
)
{
return false;
}
}
return true;
}
bool FSPanelAreaSearchList::onContextMenuItemClick(const LLSD& userdata)
{
const std::string& action = userdata.asStringRef();
@ -1942,6 +2016,10 @@ bool FSPanelAreaSearchList::onContextMenuItemClick(const LLSD& userdata)
handle_object_delete();
break;
case 'r': // return
if (RlvActions::isRlvEnabled() && !rlvCanDeleteOrReturn())
{
break;
}
handle_object_return();
break;
default:

View File

@ -305,6 +305,7 @@ private:
bool onContextMenuItemClick(const LLSD& userdata);
bool onContextMenuItemEnable(const LLSD& userdata);
bool onContextMenuItemVisibleRLV(const LLSD& userdata);
void onColumnVisibilityChecked(const LLSD& userdata);
bool onEnableColumnVisibilityChecked(const LLSD& userdata);

View File

@ -41,6 +41,7 @@ LLContextMenu* FSAreaSearchMenu::createMenu()
registrar.add("AreaSearch.Action", boost::bind(&FSAreaSearchMenu::onContextMenuItemClick, this, _2));
enable_registrar.add("AreaSearch.Enable", boost::bind(&FSAreaSearchMenu::onContextMenuItemEnable, this, _2));
enable_registrar.add("AreaSearch.RLV", boost::bind(&FSAreaSearchMenu::onContextMenuItemVisibleRLV, this, _2));
return createFromFile("menu_fs_area_search.xml");
}
@ -63,3 +64,13 @@ bool FSAreaSearchMenu::onContextMenuItemEnable(const LLSD& userdata)
}
return false;
}
bool FSAreaSearchMenu::onContextMenuItemVisibleRLV(const LLSD& userdata)
{
FSAreaSearch* search = LLFloaterReg::findTypedInstance<FSAreaSearch>("area_search");
if (search && search->getPanelList())
{
return search->getPanelList()->onContextMenuItemVisibleRLV(userdata);
}
return false;
}

View File

@ -37,6 +37,7 @@ public:
private:
void onContextMenuItemClick(const LLSD& userdata);
bool onContextMenuItemEnable(const LLSD& userdata);
bool onContextMenuItemVisibleRLV(const LLSD& userdata);
};
extern FSAreaSearchMenu gFSAreaSearchMenu;

View File

@ -54,6 +54,9 @@
#include "v3math.h"
#include "v4color.h"
#include "rlvactions.h" // <FS:Zi> Respect RLVa restrictions
#include "rlvcommon.h" // <FS:Zi> Respect RLVa restrictions
#define XUI_LINKSET_USE_NONE 0
#define XUI_LINKSET_USE_WALKABLE 1
#define XUI_LINKSET_USE_STATIC_OBSTACLE 2
@ -556,6 +559,29 @@ void LLFloaterPathfindingLinksets::updateStateOnEditFields()
int numSelectedItems = getNumSelectedObjects();
bool isEditEnabled = (numSelectedItems > 0);
// <FS:Zi> Respect RLVa restrictions
if (RlvActions::isRlvEnabled())
{
if (
!rlvCanDeleteOrReturn()
|| RlvActions::hasBehaviour(RLV_BHVR_FARTOUCH)
|| RlvActions::hasBehaviour(RLV_BHVR_TOUCHALL)
|| RlvActions::hasBehaviour(RLV_BHVR_TOUCHWORLD)
|| RlvActions::hasBehaviour(RLV_BHVR_TOUCHME)
|| RlvActions::hasBehaviour(RLV_BHVR_TOUCHTHIS)
|| RlvActions::hasBehaviour(RLV_BHVR_INTERACT)
)
{
isEditEnabled = false;
}
if (RlvActions::hasBehaviour(RLV_BHVR_TPLOCAL))
{
numSelectedItems = 0;
}
}
// </FS:Zi>
mEditLinksetUse->setEnabled(isEditEnabled);
mLabelWalkabilityCoefficients->setEnabled(isEditEnabled);

View File

@ -64,6 +64,9 @@
#include "v3math.h"
#include "v4color.h"
#include "rlvactions.h" // <FS:Zi> Respect RLVa restrictions
#include "rlvcommon.h" // <FS:Zi> Respect RLVa restrictions
#define DEFAULT_BEACON_WIDTH 6
//---------------------------------------------------------------------------
@ -819,6 +822,29 @@ void LLFloaterPathfindingObjects::updateStateOnActionControls()
int numSelectedItems = mObjectsScrollList->getNumSelected();
bool isEditEnabled = (numSelectedItems > 0);
// <FS:Zi> Respect RLVa restrictions
if (RlvActions::isRlvEnabled())
{
if (
!rlvCanDeleteOrReturn()
|| RlvActions::hasBehaviour(RLV_BHVR_FARTOUCH)
|| RlvActions::hasBehaviour(RLV_BHVR_TOUCHALL)
|| RlvActions::hasBehaviour(RLV_BHVR_TOUCHWORLD)
|| RlvActions::hasBehaviour(RLV_BHVR_TOUCHME)
|| RlvActions::hasBehaviour(RLV_BHVR_TOUCHTHIS)
|| RlvActions::hasBehaviour(RLV_BHVR_INTERACT)
)
{
isEditEnabled = false;
}
if (RlvActions::hasBehaviour(RLV_BHVR_TPLOCAL))
{
numSelectedItems = 0;
}
}
// </FS:Zi>
mShowBeaconCheckBox->setEnabled(isEditEnabled);
mTakeButton->setEnabled(isEditEnabled && visible_take_object());
mTakeCopyButton->setEnabled(isEditEnabled && enable_object_take_copy());

View File

@ -987,7 +987,7 @@ LLTerrainPartition::LLTerrainPartition(LLViewerRegion* regionp)
}
// Do not add vertices; honor strict vertex count specified by strider_vertex_count
void gen_terrain_tangents(U16 strider_vertex_count,
void gen_terrain_tangents(U32 strider_vertex_count, // <FS/> [FIRE-34363] Fix implicit cast from U32->U16 that can cause a crash
U32 strider_index_count,
LLStrider<LLVector3> &verticesp,
LLStrider<LLVector3> &normalsp,
@ -1003,7 +1003,7 @@ void gen_terrain_tangents(U16 strider_vertex_count,
std::vector<LLVector2> texcoords(strider_vertex_count);
std::vector<U16> indices(strider_index_count);
for (U16 v = 0; v < strider_vertex_count; ++v)
for (U32 v = 0; v < strider_vertex_count; ++v) // <FS/> [FIRE-34363] Fix implicit cast from U32->U16 that can cause a crash
{
F32 *vert = verticesp[v].mV;
vertices[v] = LLVector4a(vert[0], vert[1], vert[2], 1.f);
@ -1019,7 +1019,7 @@ void gen_terrain_tangents(U16 strider_vertex_count,
LLCalculateTangentArray(strider_vertex_count, vertices, normals, texcoords.data(), strider_index_count / 3, indices.data(), tangents);
for (U16 v = 0; v < strider_vertex_count; ++v)
for (U32 v = 0; v < strider_vertex_count; ++v) // <FS/> [FIRE-34363] Fix implicit cast from U32->U16 that can cause a crash
{
tangentsp[v] = tangents[v];
}

View File

@ -787,16 +787,16 @@ bool rlvMenuEnableIfNot(const LLSD& sdParam)
// Checked: 2011-05-28 (RLVa-1.4.6) | Modified: RLVa-1.4.0
bool rlvCanDeleteOrReturn(const LLViewerObject* pObj)
{
// Block if: @rez=n restricted and owned by us or a group *or* @unsit=n restricted and being sat on by us
// Block if: @rez=n or @edit=n restricted and owned/editable by us or a group *or* @unsit=n restricted and being sat on by us
return
( (!gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) || ((!pObj->permYouOwner()) && (!pObj->permGroupOwner())) ) &&
( (!gRlvHandler.hasBehaviour(RLV_BHVR_EDIT) && !gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) || ((!pObj->permYouOwner()) && (!pObj->permModify()) && (!pObj->permGroupOwner())) ) &&
( (!gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (!isAgentAvatarValid()) || (!pObj->getRootEdit()->isChild(gAgentAvatarp)) );
}
// Checked: 2011-05-28 (RLVa-1.4.6) | Modified: RLVa-1.4.0
bool rlvCanDeleteOrReturn()
{
if ( (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) || (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) )
if ( (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) || (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) )
{
struct RlvCanDeleteOrReturn : public LLSelectedObjectFunctor
{

View File

@ -12,6 +12,9 @@
<menu_item_call.on_enable
function="AreaSearch.Enable"
parameter="script"/>
<menu_item_call.on_visible
function="AreaSearch.RLV"
parameter="edit"/>
</menu_item_call>
<menu_item_call
label="Touch"
@ -20,6 +23,9 @@
<menu_item_call.on_click
function="AreaSearch.Action"
parameter="touch"/>
<menu_item_call.on_visible
function="AreaSearch.RLV"
parameter="touch"/>
</menu_item_call>
<menu_item_call
label="Sit"
@ -28,6 +34,12 @@
<menu_item_call.on_click
function="AreaSearch.Action"
parameter="u_sit_on_object"/>
<menu_item_call.on_enable
function="AreaSearch.Enable"
parameter="one"/>
<menu_item_call.on_visible
function="AreaSearch.RLV"
parameter="sit"/>
</menu_item_call>
<menu_item_call
label="Teleport to"
@ -39,6 +51,9 @@
<menu_item_call.on_enable
function="AreaSearch.Enable"
parameter="one"/>
<menu_item_call.on_visible
function="AreaSearch.RLV"
parameter="teleport"/>
</menu_item_call>
<menu_item_call
label="Zoom"
@ -61,6 +76,9 @@
<menu_item_call.on_click
function="AreaSearch.Action"
parameter="inspect"/>
<menu_item_call.on_visible
function="AreaSearch.RLV"
parameter="edit"/>
</menu_item_call>
<menu_item_call
label="Edit"
@ -69,6 +87,9 @@
<menu_item_call.on_click
function="AreaSearch.Action"
parameter="edit"/>
<menu_item_call.on_visible
function="AreaSearch.RLV"
parameter="edit"/>
</menu_item_call>
<menu_item_call
label="Return"
@ -77,6 +98,9 @@
<menu_item_call.on_click
function="AreaSearch.Action"
parameter="return"/>
<menu_item_call.on_visible
function="AreaSearch.RLV"
parameter="delete|touch"/>
</menu_item_call>
<menu_item_call
label="Delete"
@ -85,6 +109,9 @@
<menu_item_call.on_click
function="AreaSearch.Action"
parameter="delete"/>
<menu_item_call.on_visible
function="AreaSearch.RLV"
parameter="delete|touch"/>
</menu_item_call>
<menu_item_call
label="Blacklist"
@ -93,6 +120,9 @@
<menu_item_call.on_click
function="AreaSearch.Action"
parameter="l_blacklist"/>
<menu_item_call.on_visible
function="AreaSearch.RLV"
parameter="delete"/>
</menu_item_call>
<!-- <menu_item_separator
layout="topleft"/> -->
@ -106,6 +136,9 @@
<menu_item_call.on_enable
function="AreaSearch.Enable"
parameter="one"/>
<menu_item_call.on_visible
function="AreaSearch.RLV"
parameter="edit|buy|touch"/>
</menu_item_call>
<menu_item_separator
layout="topleft"/>