SL-16098 Unable to sit on an object using the 'Object inspector' floater

The same should probably be done for onClickTouch
meow-7.2.2
Andrey Kleshchev 2021-09-28 19:43:24 +03:00
parent 454b029d9c
commit b96348a2f9
3 changed files with 60 additions and 18 deletions

View File

@ -28,16 +28,17 @@
#include "llinspectobject.h"
// Viewer
#include "llagent.h" // To standup
#include "llfloatersidepanelcontainer.h"
#include "llinspect.h"
#include "llmediaentry.h"
#include "llnotificationsutil.h" // *TODO: Eliminate, add LLNotificationsUtil wrapper
#include "llselectmgr.h"
#include "llslurl.h"
#include "llviewermenu.h" // handle_object_touch(), handle_buy()
#include "llviewermedia.h"
#include "llviewermediafocus.h"
#include "llviewerobjectlist.h" // to select the requested object
#include "llvoavatarself.h"
// Linden libraries
#include "llbutton.h" // setLabel(), not virtual!
@ -635,7 +636,31 @@ void LLInspectObject::onClickTouch()
void LLInspectObject::onClickSit()
{
handle_object_sit_or_stand();
bool is_sitting = false;
if (mObjectSelection)
{
LLSelectNode* node = mObjectSelection->getFirstRootNode();
if (node && node->mValid)
{
LLViewerObject* root_object = node->getObject();
if (root_object
&& isAgentAvatarValid()
&& gAgentAvatarp->isSitting()
&& gAgentAvatarp->getRoot() == root_object)
{
is_sitting = true;
}
}
}
if (is_sitting)
{
gAgent.standUp();
}
else
{
handle_object_sit(mObjectID);
}
closeFloater();
}

View File

@ -4125,23 +4125,9 @@ bool is_object_sittable()
}
}
// only works on pie menu
void handle_object_sit_or_stand()
void handle_object_sit(LLViewerObject *object, const LLVector3 &offset)
{
LLPickInfo pick = LLToolPie::getInstance()->getPick();
LLViewerObject *object = pick.getObject();;
if (!object || pick.mPickType == LLPickInfo::PICK_FLORA)
{
return;
}
if (sitting_on_selection())
{
gAgent.standUp();
return;
}
// get object selection offset
if (object && object->getPCode() == LL_PCODE_VOLUME)
@ -4153,12 +4139,42 @@ void handle_object_sit_or_stand()
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
gMessageSystem->nextBlockFast(_PREHASH_TargetObject);
gMessageSystem->addUUIDFast(_PREHASH_TargetID, object->mID);
gMessageSystem->addVector3Fast(_PREHASH_Offset, pick.mObjectOffset);
gMessageSystem->addVector3Fast(_PREHASH_Offset, offset);
object->getRegion()->sendReliableMessage();
}
}
void handle_object_sit_or_stand()
{
LLPickInfo pick = LLToolPie::getInstance()->getPick();
LLViewerObject *object = pick.getObject();
if (!object || pick.mPickType == LLPickInfo::PICK_FLORA)
{
return;
}
if (sitting_on_selection())
{
gAgent.standUp();
return;
}
handle_object_sit(object, pick.mObjectOffset);
}
void handle_object_sit(const LLUUID& object_id)
{
LLViewerObject* obj = gObjectList.findObject(object_id);
if (!obj)
{
return;
}
LLVector3 offset(0, 0, 0);
handle_object_sit(obj, offset);
}
void near_sit_down_point(BOOL success, void *)
{
if (success)

View File

@ -135,6 +135,7 @@ void handle_save_snapshot(void *);
void handle_toggle_flycam();
void handle_object_sit_or_stand();
void handle_object_sit(const LLUUID& object_id);
void handle_give_money_dialog();
bool enable_pay_object();
bool enable_buy_object();