Compare commits

...

12 Commits

Author SHA1 Message Date
Liru Færs
a02693e4dd [Animesh] Hook up more missing parts of LLControlAvatar, maybe fix stuff? 2020-01-05 00:08:26 -05:00
Liru Færs
24118e8e67 [Animesh] Hook up isImposter override for control avatars 2020-01-05 00:07:36 -05:00
Liru Færs
19ad64cc96 AlchSync: Change dynamic_casts to LLVOVolume to asVolume() 2020-01-04 23:31:15 -05:00
Liru Færs
e81affce51 Harmless Alchemy sync
CachedControls, autos, cleaner loops, remove overkill dynamic cast,
and override and final
2020-01-04 23:25:29 -05:00
Liru Færs
dec0bff972 Fix Crash C: mRootVolp wasn't being set null on mark for death 2020-01-04 21:36:47 -05:00
Liru Færs
5daf4aa777 Fix a shutdown crash (Crash B) 2020-01-04 19:46:17 -05:00
Liru Færs
2f24a53a01 Clean up some code 2020-01-04 12:15:00 -05:00
Liru Færs
28af96229b Cleaner port of Ansariel's fix for Attachment loss on TP/Crossing 2020-01-04 12:07:59 -05:00
Liru Færs
6d776632a9 Fix incorrect Link number in build floater. 2020-01-04 09:39:11 -05:00
Liru Færs
1853500e10 Fix Crash A: mFolders was being used without a null check 2020-01-04 02:57:40 -05:00
Liru Færs
8e01fcb7f0 Merge branch 'master' of https://github.com/RouterGray/SingularityViewer 2020-01-02 01:55:02 -05:00
Router Gray
af8f0e1155 Fix gcc error 'extra qualification on member'. 2020-01-01 06:53:08 -06:00
23 changed files with 209 additions and 159 deletions

View File

@@ -549,7 +549,7 @@ public:
const item_list_t& getItems() const { return mItems; }
// number of menu items
item_list_t::size_type LLMenuGL::getItemCount() const { return mItems.size(); }
item_list_t::size_type getItemCount() const { return mItems.size(); }
void setItemLastSelected(LLMenuItemGL* item); // must be in menu
LLMenuItemGL* getItem(S32 number); // 0 = first item

View File

@@ -381,6 +381,7 @@ LLAgent::LLAgent() :
mAgentAccess(new LLAgentAccess(gSavedSettings)),
mGodLevelChangeSignal(),
mIsCrossingRegion(false),
mCanEditParcel(false),
mTeleportSourceSLURL(new LLSLURL),
mTeleportRequest(),
@@ -4431,6 +4432,7 @@ void LLAgent::setTeleportState(ETeleportState state)
{
case TELEPORT_NONE:
mbTeleportKeepsLookAt = false;
mIsCrossingRegion = false; // Attachments getting lost on TP; finished TP
break;
case TELEPORT_MOVING:

View File

@@ -739,6 +739,13 @@ private:
** **
*******************************************************************************/
// Attachments getting lost on TP
public:
void setIsCrossingRegion(bool is_crossing) { mIsCrossingRegion = is_crossing; }
bool isCrossingRegion() const { return mIsCrossingRegion; }
private:
bool mIsCrossingRegion;
// Build
public:
bool canEditParcel() const { return mCanEditParcel; }

View File

@@ -2841,6 +2841,12 @@ void LLAppearanceMgr::wearInventoryCategory(LLInventoryCategory* category, bool
{
if(!category) return;
// Attachments getting lost on TP:
// We'll be sending the outfit change request to our current region,
// so we'll learn them if they've been sending bad kills.
// We don't take kindly to that sorta behaviour round these parts.
gAgent.setIsCrossingRegion(false);
selfClearPhases();
selfStartPhase("wear_inventory_category");

View File

@@ -47,8 +47,8 @@ LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewer
LLVOAvatar(id, pcode, regionp),
mPlaying(false),
mGlobalScale(1.0f),
mRootVolp(NULL),
mMarkedForDeath(false),
mRootVolp(NULL),
mScaleConstraintFixup(1.0),
mRegionChanged(false)
{
@@ -60,6 +60,8 @@ LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewer
// virtual
LLControlAvatar::~LLControlAvatar()
{
// Should already have been unlinked before destruction
llassert(!mRootVolp);
}
// virtual
@@ -82,18 +84,12 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_
{
F32 max_legal_offset = MAX_LEGAL_OFFSET;
if (gSavedSettings.getControl("AnimatedObjectsMaxLegalOffset"))
{
max_legal_offset = gSavedSettings.getF32("AnimatedObjectsMaxLegalOffset");
}
max_legal_offset = llmax(max_legal_offset,0.f);
static LLCachedControl<F32> animated_object_max_legal_offset(gSavedSettings, "AnimatedObjectsMaxLegalOffset");
max_legal_offset = llmax(animated_object_max_legal_offset(),0.f);
F32 max_legal_size = MAX_LEGAL_SIZE;
if (gSavedSettings.getControl("AnimatedObjectsMaxLegalSize"))
{
max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize");
}
max_legal_size = llmax(max_legal_size, 1.f);
static LLCachedControl<F32> animated_object_max_legal_size(gSavedSettings, "AnimatedObjectsMaxLegalSize");
max_legal_size = llmax(animated_object_max_legal_size(), 1.f);
new_pos_fixup = LLVector3();
new_scale_fixup = 1.0f;
@@ -113,7 +109,7 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_
unshift_extents[0] = extents[0] - mPositionConstraintFixup;
unshift_extents[1] = extents[1] - mPositionConstraintFixup;
LLVector3 box_dims = extents[1]-extents[0];
//F32 box_size = llmax(box_dims[0],box_dims[1],box_dims[2]);
F32 box_size = llmax(box_dims[0],box_dims[1],box_dims[2]);
if (!mRootVolp->isAttachment())
{
@@ -124,23 +120,23 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_
F32 target_dist = (offset_dist - max_legal_offset);
new_pos_fixup = (target_dist/offset_dist)*pos_box_offset;
}
if (new_pos_fixup != mPositionConstraintFixup)
{
LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup "
<< new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL;
LL_DEBUGS("ConstraintFix") << "vol_pos " << vol_pos << LL_ENDL;
LL_DEBUGS("ConstraintFix") << "extents " << extents[0] << " " << extents[1] << LL_ENDL;
LL_DEBUGS("ConstraintFix") << "unshift_extents " << unshift_extents[0] << " " << unshift_extents[1] << LL_ENDL;
}
//if (new_pos_fixup != mPositionConstraintFixup)
//{
// LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup "
// << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL;
// LL_DEBUGS("ConstraintFix") << "vol_pos " << vol_pos << LL_ENDL;
// LL_DEBUGS("ConstraintFix") << "extents " << extents[0] << " " << extents[1] << LL_ENDL;
// LL_DEBUGS("ConstraintFix") << "unshift_extents " << unshift_extents[0] << " " << unshift_extents[1] << LL_ENDL;
//
//}
}
/*if (box_size/mScaleConstraintFixup > max_legal_size)
if (box_size/mScaleConstraintFixup > max_legal_size)
{
new_scale_fixup = mScaleConstraintFixup*max_legal_size/box_size;
LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, box_size " << box_size << " fixup "
<< mScaleConstraintFixup << " max legal " << max_legal_size
<< " -> new scale " << new_scale_fixup << LL_ENDL;
}*/
//LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, box_size " << box_size << " fixup "
// << mScaleConstraintFixup << " max legal " << max_legal_size
// << " -> new scale " << new_scale_fixup << LL_ENDL;
}
}
}
@@ -163,6 +159,8 @@ void LLControlAvatar::matchVolumeTransform()
mPositionConstraintFixup = new_pos_fixup;
mScaleConstraintFixup = new_scale_fixup;
static LLCachedControl<F32> global_scale(gSavedSettings, "AnimatedObjectsGlobalScale", 1.f);
if (mRootVolp->isAttachment())
{
LLVOAvatar *attached_av = mRootVolp->getAvatarAncestor();
@@ -174,13 +172,12 @@ void LLControlAvatar::matchVolumeTransform()
LLVector3 joint_pos = attach->getWorldPosition();
LLQuaternion joint_rot = attach->getWorldRotation();
LLVector3 obj_pos = mRootVolp->mDrawable->getPosition();
LLQuaternion obj_rot = mRootVolp->mDrawable->getRotation();
const LLQuaternion& obj_rot = mRootVolp->mDrawable->getRotation();
obj_pos.rotVec(joint_rot);
mRoot->setWorldPosition(obj_pos + joint_pos);
mRoot->setWorldRotation(obj_rot * joint_rot);
setRotation(mRoot->getRotation());
F32 global_scale = gSavedSettings.getF32("AnimatedObjectsGlobalScale");
setGlobalScale(global_scale * mScaleConstraintFixup);
}
else
@@ -200,17 +197,7 @@ void LLControlAvatar::matchVolumeTransform()
// complexity info and such line up better. Should defer
// this until avatars also get fixed.
LLQuaternion obj_rot;
if (mRootVolp->mDrawable)
{
obj_rot = mRootVolp->mDrawable->getRotation();
}
else
{
obj_rot = mRootVolp->getRotation();
}
LLMatrix3 bind_mat;
const LLQuaternion& obj_rot = mRootVolp->mDrawable ? mRootVolp->mDrawable->getRotation() : mRootVolp->getRotation();
LLQuaternion bind_rot;
#define MATCH_BIND_SHAPE
@@ -219,7 +206,7 @@ void LLControlAvatar::matchVolumeTransform()
const LLMeshSkinInfo* skin_info = mRootVolp->getSkinInfo();
if (skin_info)
{
LL_DEBUGS("BindShape") << getFullname() << " bind shape " << skin_info->mBindShapeMatrix << LL_ENDL;
//LL_DEBUGS("BindShape") << getFullname() << " bind shape " << skin_info->mBindShapeMatrix << LL_ENDL;
bind_rot = LLSkinningUtil::getUnscaledQuaternion(skin_info->mBindShapeMatrix);
}
#endif
@@ -228,7 +215,6 @@ void LLControlAvatar::matchVolumeTransform()
setPositionAgent(vol_pos);
mRoot->setPosition(vol_pos + mPositionConstraintFixup);
F32 global_scale = gSavedSettings.getF32("AnimatedObjectsGlobalScale");
setGlobalScale(global_scale * mScaleConstraintFixup);
}
}
@@ -236,7 +222,7 @@ void LLControlAvatar::matchVolumeTransform()
void LLControlAvatar::setGlobalScale(F32 scale)
{
if (scale <= 0.0)
if (scale <= 0.0f)
{
LL_WARNS() << "invalid global scale " << scale << LL_ENDL;
return;
@@ -255,10 +241,8 @@ void LLControlAvatar::recursiveScaleJoint(LLJoint* joint, F32 factor)
{
joint->setScale(factor * joint->getScale());
for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin();
iter != joint->mChildren.end(); ++iter)
for (auto child : joint->mChildren)
{
LLJoint* child = *iter;
recursiveScaleJoint(child, factor);
}
}
@@ -278,10 +262,9 @@ void LLControlAvatar::updateVolumeGeom()
mRootVolp->mDrawable->setState(LLDrawable::USE_BACKLIGHT);
LLViewerObject::const_child_list_t& child_list = mRootVolp->getChildren();
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); ++iter)
for (const auto& iter : child_list)
{
LLViewerObject* childp = *iter;
LLViewerObject* childp = iter;
if (childp && childp->mDrawable.notNull())
{
childp->mDrawable->setState(LLDrawable::USE_BACKLIGHT);
@@ -339,6 +322,7 @@ LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj)
void LLControlAvatar::markForDeath()
{
mMarkedForDeath = true;
mRootVolp = NULL;
}
void LLControlAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
@@ -362,7 +346,8 @@ BOOL LLControlAvatar::updateCharacter(LLAgent &agent)
//virtual
void LLControlAvatar::updateDebugText()
{
/*if (gSavedSettings.getBOOL("DebugAnimatedObjects"))
/*static LLCachedControl<bool> debug_animated_objects(gSavedSettings, "DebugAnimatedObjects");
if (debug_animated_objects)
{
S32 total_linkset_count = 0;
if (mRootVolp)
@@ -385,10 +370,8 @@ void LLControlAvatar::updateDebugText()
S32 cam_dist_count = 0;
F32 lod_radius = mRootVolp->mLODRadius;
for (std::vector<LLVOVolume*>::iterator it = volumes.begin();
it != volumes.end(); ++it)
for (auto volp : volumes)
{
LLVOVolume *volp = *it;
S32 verts = 0;
total_tris += volp->getTriangleCount(&verts);
total_verts += verts;
@@ -491,11 +474,10 @@ void LLControlAvatar::getAnimatedVolumes(std::vector<LLVOVolume*>& volumes)
volumes.push_back(mRootVolp);
LLViewerObject::const_child_list_t& child_list = mRootVolp->getChildren();
for (LLViewerObject::const_child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); ++iter)
for (const auto& iter : child_list)
{
LLViewerObject* childp = *iter;
LLVOVolume *child_volp = dynamic_cast<LLVOVolume*>(childp);
LLViewerObject* childp = iter;
LLVOVolume *child_volp = childp ? childp->asVolume() : nullptr;
if (child_volp && child_volp->isAnimatedObject())
{
volumes.push_back(child_volp);
@@ -519,16 +501,16 @@ void LLControlAvatar::updateAnimations()
// Rebuild mSignaledAnimations from the associated volumes.
std::map<LLUUID, S32> anims;
for (std::vector<LLVOVolume*>::iterator vol_it = volumes.begin(); vol_it != volumes.end(); ++vol_it)
for (auto vol_it = volumes.begin(); vol_it != volumes.end(); ++vol_it)
{
LLVOVolume *volp = *vol_it;
//LL_INFOS("AnimatedObjects") << "updating anim for vol " << volp->getID() << " root " << mRootVolp->getID() << LL_ENDL;
signaled_animation_map_t& signaled_animations = LLObjectSignaledAnimationMap::instance().getMap()[volp->getID()];
for (std::map<LLUUID,S32>::iterator anim_it = signaled_animations.begin();
for (auto anim_it = signaled_animations.begin();
anim_it != signaled_animations.end();
++anim_it)
{
std::map<LLUUID,S32>::iterator found_anim_it = anims.find(anim_it->first);
auto found_anim_it = anims.find(anim_it->first);
if (found_anim_it != anims.end())
{
// Animation already present, use the larger sequence id
@@ -539,7 +521,9 @@ void LLControlAvatar::updateAnimations()
// Animation not already present, use this sequence id.
anims[anim_it->first] = anim_it->second;
}
#if LL_DEBUG
LL_DEBUGS("AnimatedObjectsNotify") << "found anim for vol " << volp->getID() << " anim " << anim_it->first << " root " << mRootVolp->getID() << LL_ENDL;
#endif
}
}
if (!mPlaying)
@@ -567,24 +551,45 @@ LLViewerObject* LLControlAvatar::lineSegmentIntersectRiggedAttachments(const LLV
LLVector4a* normal,
LLVector4a* tangent)
{
if (!mRootVolp)
{
return NULL;
}
LLViewerObject* hit = NULL;
if (lineSegmentBoundingBox(start, end))
{
LLVector4a local_end = end;
LLVector4a local_intersection;
if (mRootVolp &&
mRootVolp->lineSegmentIntersect(start, local_end, face, pick_transparent, pick_rigged, face_hit, &local_intersection, tex_coord, normal, tangent))
if (mRootVolp->lineSegmentIntersect(start, local_end, face, pick_transparent, pick_rigged, face_hit, &local_intersection, tex_coord, normal, tangent))
{
local_end = local_intersection;
if (intersection)
{
*intersection = local_intersection;
}
hit = mRootVolp;
}
else
{
std::vector<LLVOVolume*> volumes;
getAnimatedVolumes(volumes);
for (auto volp : volumes)
{
if (mRootVolp != volp && volp->lineSegmentIntersect(start, local_end, face, pick_transparent, pick_rigged, face_hit, &local_intersection, tex_coord, normal, tangent))
{
local_end = local_intersection;
if (intersection)
{
*intersection = local_intersection;
}
hit = volp;
break;
}
}
}
}
return hit;
@@ -618,7 +623,7 @@ bool LLControlAvatar::shouldRenderRigged() const
}
// virtual
BOOL LLControlAvatar::isImpostor()
BOOL LLControlAvatar::isImpostor() const
{
if (mRootVolp && mRootVolp->isAttachment())
{
@@ -638,8 +643,11 @@ void LLControlAvatar::onRegionChanged()
std::vector<LLCharacter*>::iterator it = LLCharacter::sInstances.begin();
for ( ; it != LLCharacter::sInstances.end(); ++it)
{
LLControlAvatar* cav = dynamic_cast<LLControlAvatar*>(*it);
if (!cav) continue;
cav->mRegionChanged = true;
auto avatar = static_cast<LLVOAvatar*>(*it);
if (!avatar->isDead() && avatar->isControlAvatar())
{
LLControlAvatar* cav = static_cast<LLControlAvatar*>(avatar);
cav->mRegionChanged = true;
}
}
}

View File

@@ -30,16 +30,16 @@
#include "llvoavatar.h"
#include "llvovolume.h"
class LLControlAvatar:
class LLControlAvatar final:
public LLVOAvatar
{
LOG_CLASS(LLControlAvatar);
public:
LLControlAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
virtual void initInstance(); // Called after construction to initialize the class.
void initInstance() override; // Called after construction to initialize the class.
virtual ~LLControlAvatar();
virtual LLControlAvatar* asControlAvatar() { return this; }
LLControlAvatar* asControlAvatar() override { return this; }
void getNewConstraintFixups(LLVector3& new_pos_constraint, F32& new_scale_constraint) const;
void matchVolumeTransform();
@@ -53,13 +53,13 @@ public:
// markDead() inside other graphics pipeline operations.
void markForDeath();
virtual void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
virtual BOOL updateCharacter(LLAgent &agent);
void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) override;
BOOL updateCharacter(LLAgent &agent) override;
void getAnimatedVolumes(std::vector<LLVOVolume*>& volumes);
void updateAnimations();
virtual LLViewerObject* lineSegmentIntersectRiggedAttachments(
LLViewerObject* lineSegmentIntersectRiggedAttachments(
const LLVector4a& start, const LLVector4a& end,
S32 face = -1, // which face to check, -1 = ALL_SIDES
BOOL pick_transparent = FALSE,
@@ -68,15 +68,15 @@ public:
LLVector4a* intersection = NULL, // return the intersection point
LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
LLVector4a* normal = NULL, // return the surface normal at the intersection point
LLVector4a* tangent = NULL); // return the surface tangent at the intersection point
LLVector4a* tangent = NULL) override; // return the surface tangent at the intersection point
virtual void updateDebugText();
void updateDebugText() override;
virtual std::string getFullname() const;
std::string getFullname() const override;
virtual bool shouldRenderRigged() const;
bool shouldRenderRigged() const override;
virtual BOOL isImpostor();
BOOL isImpostor() const override;
bool mPlaying;
@@ -101,7 +101,7 @@ typedef std::map<LLUUID, S32> signaled_animation_map_t;
typedef std::map<LLUUID, signaled_animation_map_t> object_signaled_animation_map_t;
// Stores information about previously requested animations, by object id.
class LLObjectSignaledAnimationMap: public LLSingleton<LLObjectSignaledAnimationMap>
class LLObjectSignaledAnimationMap final : public LLSingleton<LLObjectSignaledAnimationMap>
{
public:
LLObjectSignaledAnimationMap() {}

View File

@@ -600,12 +600,12 @@ void LLFloaterTools::refresh()
S32 index = 1;
for (const auto& child : children)
{
++index;
if (child->isSelected())
{
LLResMgr::getInstance()->getIntegerString(value_string, index);
break;
}
++index;
}
}
}
@@ -1383,8 +1383,8 @@ void LLFloaterTools::getMediaState()
for ( ; iter != end; ++iter)
{
LLSelectNode* node = *iter;
LLVOVolume* object = dynamic_cast<LLVOVolume*>(node->getObject());
if (NULL != object)
LLVOVolume* object = node ? node->getObject()->asVolume() : nullptr;
if (nullptr != object)
{
if (!object->permModify())
{

View File

@@ -266,8 +266,8 @@ LLPanelLogin::LLPanelLogin(const LLRect& rect)
location_combo->setFocusLostCallback( boost::bind(&LLPanelLogin::onLocationSLURL, this) );
LLComboBox* server_choice_combo = getChild<LLComboBox>("grids_combo");
server_choice_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectGrid, _1));
server_choice_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onSelectGrid, server_choice_combo));
server_choice_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectGrid, this, _1));
server_choice_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onSelectGrid, this, server_choice_combo));
// Load all of the grids, sorted, and then add a bar and the current grid at the top
updateGridCombo();
@@ -1111,7 +1111,7 @@ void LLPanelLogin::onSelectGrid(LLUICtrl *ctrl)
}
gHippoGridManager->setCurrentGrid(grid);
ctrl->setValue(grid);
sInstance->addFavoritesToStartLocation();
addFavoritesToStartLocation();
/*
* Determine whether or not the value in the start_location_combo makes sense
@@ -1123,7 +1123,7 @@ void LLPanelLogin::onSelectGrid(LLUICtrl *ctrl)
* https://grid.example.com/region/Party%20Town/20/30/5 specify a particular
* grid; in those cases we want to clear the location.
*/
auto location_combo = sInstance->getChild<LLComboBox>("start_location_combo");
auto location_combo = getChild<LLComboBox>("start_location_combo");
S32 index = location_combo->getCurrentIndex();
switch (index)
{

View File

@@ -114,7 +114,7 @@ private:
static void onClickNewAccount();
static bool newAccountAlertCallback(const LLSD& notification, const LLSD& response);
static void onClickGrids();
static void onSelectGrid(LLUICtrl *ctrl);
void onSelectGrid(LLUICtrl *ctrl);
static void onClickForgotPassword();
static void onPassKey();
static void onSelectLoginEntry(const LLSD& selected_entry);

View File

@@ -1712,7 +1712,7 @@ void LLPanelObjectInventory::updateInventory()
// We're still interested in this task's inventory.
uuid_set_t selected_items;
BOOL inventory_has_focus = FALSE;
if (mHaveInventory)
if (mHaveInventory && mFolders)
{
selected_items = mFolders->getSelectionList();
inventory_has_focus = gFocusMgr.childHasKeyboardFocus(mFolders);

View File

@@ -320,7 +320,7 @@ void LLPanelPrimMediaControls::updateShape()
{
bool mini_controls = false;
LLMediaEntry *media_data = objectp->getTE(mTargetObjectFace)->getMediaData();
LLVOVolume *vol = dynamic_cast<LLVOVolume*>(objectp);
LLVOVolume *vol = objectp ? objectp->asVolume() : nullptr;
if (media_data && vol)
{
// Don't show the media controls if we do not have permissions

View File

@@ -1998,7 +1998,7 @@ void LLSelectMgr::selectionSetMedia(U8 media_type, const LLSD &media_data)
else {
// Add/update media
object->setTEMediaFlags(te, mMediaFlags);
LLVOVolume *vo = dynamic_cast<LLVOVolume*>(object);
LLVOVolume *vo = object->asVolume();
llassert(NULL != vo);
if (NULL != vo)
{
@@ -2024,7 +2024,7 @@ void LLSelectMgr::selectionSetMedia(U8 media_type, const LLSD &media_data)
if (object->permModify())
{
object->sendTEUpdate();
LLVOVolume *vo = dynamic_cast<LLVOVolume*>(object);
LLVOVolume *vo = object->asVolume();
llassert(NULL != vo);
// It's okay to skip this object if hasMedia() is false...
// the sendTEUpdate() above would remove all media data if it were
@@ -7434,7 +7434,7 @@ S32 LLObjectSelection::getSelectedObjectRenderCost()
++child_iter)
{
LLViewerObject* child_obj = *child_iter;
LLVOVolume *child = dynamic_cast<LLVOVolume*>( child_obj );
LLVOVolume *child = child_obj ? child_obj->asVolume() : nullptr;
if (child)
{
cost += child->getRenderCost(textures);

View File

@@ -1787,7 +1787,7 @@ void renderComplexityDisplay(LLDrawable* drawablep)
return;
}
LLVOVolume *voVol = dynamic_cast<LLVOVolume*>(vobj);
LLVOVolume *voVol = vobj->asVolume();;
if (!voVol)
{

View File

@@ -8564,6 +8564,7 @@ void handle_rebake_textures(void*)
{
LLAppearanceMgr::instance().requestServerAppearanceUpdate();
}
gAgent.setIsCrossingRegion(false); // Attachments getting lost on TP
}
void toggle_visibility(void* user_data)

View File

@@ -4904,6 +4904,8 @@ void process_crossed_region(LLMessageSystem* msg, void**)
}
LL_INFOS("Messaging") << "process_crossed_region()" << LL_ENDL;
gAgentAvatarp->resetRegionCrossingTimer();
gAgent.setIsCrossingRegion(false); // Attachments getting lost on TP, region crossing hook
U32 sim_ip;
msg->getIPAddrFast(_PREHASH_RegionData, _PREHASH_SimIP, sim_ip);
@@ -5300,10 +5302,23 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data)
LLViewerObject *objectp = gObjectList.findObject(id);
if (objectp)
{
if (different_region && gAgentAvatarp == objectp->getAvatar())
if (gAgentAvatarp == objectp->getAvatar())
{
LL_WARNS() << "Region other than our own killing our attachments!!" << LL_ENDL;
continue;
if (different_region)
{
LL_WARNS() << "Region other than our own killing our attachments!!" << LL_ENDL;
continue;
}
else if (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE)
{
LL_WARNS() << "Region killing our attachments during teleport!!" << LL_ENDL;
continue;
}
else if (gAgent.isCrossingRegion())
{
LL_WARNS() << "Region killing our attachments during region cross!!" << LL_ENDL;
continue;
}
}
// Display green bubble on kill
if ( gShowObjectUpdates )
@@ -5938,7 +5953,7 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data)
return;
}
LLVOVolume *volp = dynamic_cast<LLVOVolume*>(objp);
LLVOVolume *volp = objp->asVolume();
if (!volp)
{
LL_DEBUGS("AnimatedObjectsNotify") << "Received animation state for non-volume object " << uuid << LL_ENDL;
@@ -6804,7 +6819,6 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem)
std::string llsdRaw;
LLSD llsdBlock;
msgsystem->getStringFast(_PREHASH_AlertInfo, _PREHASH_Message, notificationID);
msgsystem->getStringFast(_PREHASH_AlertInfo, _PREHASH_ExtraParams, llsdRaw);
if (llsdRaw.length())
{
@@ -6851,6 +6865,11 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem)
return true;
}
}
else if (notificationID == "expired_region_handoff" || notificationID == "invalid_region_handoff") // borked region handoff
{
gAgent.setIsCrossingRegion(false); // Attachments getting lost on TP
}
else
// HACK -- handle callbacks for specific alerts.
if (notificationID == "HomePositionSet")
{

View File

@@ -1620,7 +1620,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
retval |= checkMediaURL(media_url);
//
// Unpack particle system data
// Unpack particle system data (legacy)
//
if (value & 0x8)
{
@@ -2188,23 +2188,22 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
mStatic = FALSE;
}
// BUG: This code leads to problems during group rotate and any scale operation.
// Small discepencies between the simulator and viewer representations cause the
// selection center to creep, leading to objects moving around the wrong center.
//
// Removing this, however, means that if someone else drags an object you have
// selected, your selection center and dialog boxes will be wrong. It also means
// that higher precision information on selected objects will be ignored.
//
// I believe the group rotation problem is fixed. JNC 1.21.2002
//
// BUG: This code leads to problems during group rotate and any scale operation.
// Small discepencies between the simulator and viewer representations cause the
// selection center to creep, leading to objects moving around the wrong center.
//
// Removing this, however, means that if someone else drags an object you have
// selected, your selection center and dialog boxes will be wrong. It also means
// that higher precision information on selected objects will be ignored.
//
// I believe the group rotation problem is fixed. JNC 1.21.2002
//
// Additionally, if any child is selected, need to update the dialogs and selection
// center.
BOOL needs_refresh = mUserSelected;
for (child_list_t::iterator iter = mChildList.begin();
iter != mChildList.end(); iter++)
for (auto& iter : mChildList)
{
LLViewerObject* child = *iter;
LLViewerObject* child = iter;
needs_refresh = needs_refresh || child->mUserSelected;
}
@@ -2952,10 +2951,9 @@ void LLViewerObject::updateControlAvatar()
{
bool any_rigged_mesh = root->isRiggedMesh();
LLViewerObject::const_child_list_t& child_list = root->getChildren();
for (LLViewerObject::const_child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); ++iter)
for (const auto& iter : child_list)
{
const LLViewerObject* child = *iter;
const LLViewerObject* child = iter;
any_rigged_mesh = any_rigged_mesh || child->isRiggedMesh();
}
should_have_control_avatar = is_animated_object && any_rigged_mesh;
@@ -3093,7 +3091,7 @@ void LLViewerObject::linkControlAvatar()
{
if (!getControlAvatar() && isRootEdit())
{
LLVOVolume *volp = dynamic_cast<LLVOVolume*>(this);
LLVOVolume *volp = asVolume();
if (!volp)
{
LL_WARNS() << "called with null or non-volume object" << LL_ENDL;
@@ -3136,6 +3134,7 @@ void LLViewerObject::unlinkControlAvatar()
if (mControlAvatar)
{
mControlAvatar->markForDeath();
mControlAvatar->mRootVolp = NULL;
mControlAvatar = NULL;
}
}
@@ -3269,7 +3268,7 @@ void LLViewerObject::processTaskInvFile(void** user_data, S32 error_code, LLExtS
LLInventoryObject::object_list_t::iterator end = object->mInventory->end();
std::list<LLUUID>& pending_lst = object->mPendingInventoryItemsIDs;
for (; it != end && pending_lst.size(); ++it)
for (; it != end && !pending_lst.empty(); ++it)
{
LLViewerInventoryItem* item = dynamic_cast<LLViewerInventoryItem*>(it->get());
if(item && item->getType() != LLAssetType::AT_CATEGORY)
@@ -3292,7 +3291,7 @@ void LLViewerObject::processTaskInvFile(void** user_data, S32 error_code, LLExtS
}
else
{
// This Occurs When to requests were made, and the first one
// This Occurs When two requests were made, and the first one
// has already handled it.
LL_DEBUGS() << "Problem loading task inventory. Return code: "
<< error_code << LL_ENDL;
@@ -3412,11 +3411,6 @@ void LLViewerObject::removeInventory(const LLUUID& item_id)
msg->sendReliable(mRegionp->getHost());
deleteInventoryItem(item_id);
++mInventorySerialNum;
// The viewer object should not refresh UI since this is a utility
// function. The UI functionality that called this method should
// refresh the views if necessary.
//gBuildView->refresh();
}
bool LLViewerObject::isTextureInInventory(LLViewerInventoryItem* item)
@@ -3531,7 +3525,7 @@ void LLViewerObject::getInventoryContents(LLInventoryObject::object_list_t& obje
LLInventoryObject* LLViewerObject::getInventoryRoot()
{
if (!mInventory || !mInventory->size())
if (!mInventory || mInventory->empty())
{
return NULL;
}
@@ -3587,8 +3581,8 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent)
return;
}
LLVector3 viewer_pos_agent = gAgentCamera.getCameraPositionAgent();
LLVector3 pos_agent = getRenderPosition();
const LLVector3& viewer_pos_agent = gAgentCamera.getCameraPositionAgent();
const LLVector3& pos_agent = getRenderPosition();
F32 dx = viewer_pos_agent.mV[VX] - pos_agent.mV[VX];
F32 dy = viewer_pos_agent.mV[VY] - pos_agent.mV[VY];
@@ -3602,7 +3596,7 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent)
// to try to get a min distance from face, subtract min_scale/2 from the range.
// This means we'll load too much detail sometimes, but that's better than not enough
// I don't think there's a better way to do this without calculating distance per-poly
F32 range = sqrt(dx*dx + dy*dy + dz*dz) - min_scale/2;
F32 range = sqrt(dx*dx + dy*dy + dz*dz) - min_scale/2.f;
LLViewerCamera* camera = LLViewerCamera::getInstance();
if (range < 0.001f || isHUDAttachment()) // range == zero
@@ -3781,10 +3775,9 @@ F32 LLViewerObject::getLinksetPhysicsCost()
F32 LLViewerObject::recursiveGetEstTrianglesMax() const
{
F32 est_tris = getEstTrianglesMax();
for (child_list_t::const_iterator iter = mChildList.begin();
iter != mChildList.end(); iter++)
for (const auto& iter : mChildList)
{
const LLViewerObject* child = *iter;
const LLViewerObject* child = iter;
if (!child->isAvatar())
{
est_tris += child->recursiveGetEstTrianglesMax();
@@ -3852,10 +3845,9 @@ U32 LLViewerObject::recursiveGetTriangleCount(S32* vcount) const
{
S32 total_tris = getTriangleCount(vcount);
LLViewerObject::const_child_list_t& child_list = getChildren();
for (LLViewerObject::const_child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); ++iter)
for (const auto& iter : child_list)
{
LLViewerObject* childp = *iter;
LLViewerObject* childp = iter;
if (childp)
{
total_tris += childp->getTriangleCount(vcount);
@@ -3882,13 +3874,11 @@ F32 LLViewerObject::recursiveGetScaledSurfaceArea() const
const LLVector3& scale = volume->getScale();
area += volume->getVolume()->getSurfaceArea() * llmax(llmax(scale.mV[0], scale.mV[1]), scale.mV[2]);
}
LLViewerObject::const_child_list_t children = volume->getChildren();
for (LLViewerObject::const_child_list_t::const_iterator child_iter = children.begin();
child_iter != children.end();
++child_iter)
LLViewerObject::const_child_list_t const& children = volume->getChildren();
for (const auto& child_iter : children)
{
LLViewerObject* child_obj = *child_iter;
LLVOVolume *child = dynamic_cast<LLVOVolume*>( child_obj );
LLViewerObject* child_obj = child_iter;
LLVOVolume *child = child_obj ? child_obj->asVolume() : nullptr;
if (child && child->getVolume())
{
const LLVector3& scale = child->getScale();
@@ -3899,6 +3889,7 @@ F32 LLViewerObject::recursiveGetScaledSurfaceArea() const
}
return area;
}
void LLViewerObject::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax)
{
if(mDrawable.isNull())
@@ -5592,6 +5583,12 @@ LLVOAvatar* LLViewerObject::asAvatar()
return NULL;
}
// virtual
LLVOVolume* LLViewerObject::asVolume()
{
return nullptr;
}
// If this object is directly or indirectly parented by an avatar,
// return it. Normally getAvatar() is the correct function to call;
// it will give the avatar used for skinning. The exception is with

View File

@@ -69,6 +69,7 @@ class LLPrimitive;
class LLTextureEntry;
class LLVOAvatar;
class LLVOInventoryListener;
class LLVOVolume;
class LLViewerInventoryItem;
class LLViewerObject;
class LLViewerObjectMedia;
@@ -157,6 +158,7 @@ public:
BOOL isParticleSource() const;
virtual LLVOAvatar* asAvatar();
virtual LLVOVolume* asVolume();
LLVOAvatar* getAvatarAncestor();

View File

@@ -1116,7 +1116,8 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
LL_DEBUGS() << "Object: picked at " << pos.mX << ", " << pos.mY << " - face = " << object_face << " - URL = " << url << LL_ENDL;
LLVOVolume *obj = dynamic_cast<LLVOVolume*>(static_cast<LLViewerObject*>(pick_info.getObject()));
LLViewerObject* vobjp = static_cast<LLViewerObject*>(pick_info.getObject());
LLVOVolume *obj = vobjp ? vobjp->asVolume() : nullptr;
if (obj && !obj->getRegion()->getCapability("ObjectMedia").empty())
{

View File

@@ -6923,7 +6923,7 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, uuid_set_t*
}
}
LLVOVolume *vobj = dynamic_cast<LLVOVolume*>(vo);
LLVOVolume *vobj = vo->asVolume();
if (vobj && vobj->isRiggedMesh() &&
vobj->getVolume() && vobj->getVolume()->isMeshAssetLoaded() && gMeshRepo.meshRezEnabled())
{
@@ -10567,7 +10567,7 @@ void LLVOAvatar::getAssociatedVolumes(std::vector<LLVOVolume*>& volumes)
{{
LLViewerObject* attached_object = iter.first;
#endif
LLVOVolume *volume = dynamic_cast<LLVOVolume*>(attached_object);
LLVOVolume *volume = attached_object->asVolume();
if (volume)
{
volumes.push_back(volume);
@@ -10580,11 +10580,12 @@ void LLVOAvatar::getAssociatedVolumes(std::vector<LLVOVolume*>& volumes)
}
}
LLViewerObject::const_child_list_t& children = attached_object->getChildren();
for (LLViewerObject::const_child_list_t::const_iterator it = children.begin();
it != children.end(); ++it)
for (LLViewerObject* childp : children)
{
LLViewerObject *childp = *it;
LLVOVolume *volume = dynamic_cast<LLVOVolume*>(childp);
if (!childp)
continue;
LLVOVolume *volume = childp->asVolume();
if (volume)
{
volumes.push_back(volume);
@@ -10601,11 +10602,9 @@ void LLVOAvatar::getAssociatedVolumes(std::vector<LLVOVolume*>& volumes)
{
volumes.push_back(volp);
LLViewerObject::const_child_list_t& children = volp->getChildren();
for (LLViewerObject::const_child_list_t::const_iterator it = children.begin();
it != children.end(); ++it)
for (LLViewerObject* childp : children)
{
LLViewerObject *childp = *it;
LLVOVolume *volume = dynamic_cast<LLVOVolume*>(childp);
LLVOVolume *volume = childp ? childp->asVolume() : nullptr;
if (volume)
{
volumes.push_back(volume);
@@ -10950,7 +10949,7 @@ void LLVOAvatar::accountRenderComplexityForObject(
++child_iter)
{
LLViewerObject* child_obj = *child_iter;
LLVOVolume *child = dynamic_cast<LLVOVolume*>(child_obj);
LLVOVolume *child = child_obj ? child_obj->asVolume() : nullptr;
if (child)
{
attachment_children_cost += child->getRenderCost(textures);
@@ -11007,7 +11006,7 @@ void LLVOAvatar::accountRenderComplexityForObject(
iter != child_list.end(); ++iter)
{
LLViewerObject* childp = *iter;
const LLVOVolume* chld_volume = dynamic_cast<LLVOVolume*>(childp);
const LLVOVolume* chld_volume = childp ? childp->asVolume() : nullptr;
if (chld_volume)
{
// get cost and individual textures

View File

@@ -555,7 +555,7 @@ private:
// Impostors
//--------------------------------------------------------------------
public:
BOOL isImpostor() const;
virtual BOOL isImpostor() const;
BOOL shouldImpostor(const U32 rank_factor = 1) const;
BOOL needsImpostorUpdate() const;
const LLVector3& getImpostorOffset() const;
@@ -570,6 +570,7 @@ public:
F32SecondsImplicit mLastImpostorUpdateFrameTime;
const LLVector3* getLastAnimExtents() const { return mLastAnimExtents; }
void setNeedsExtentUpdate(bool val) { mNeedsExtentUpdate = val; }
private:
LLVector3 mImpostorOffset;
LLVector2 mImpostorDim;

View File

@@ -869,6 +869,7 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp)
}
mRegionCrossingTimer.reset();
LLViewerObject::updateRegion(regionp);
gAgent.setIsCrossingRegion(false); // Attachments getting lost on TP
}
//--------------------------------------------------------------------

View File

@@ -265,6 +265,11 @@ LLVOVolume::~LLVOVolume()
}
}
LLVOVolume* LLVOVolume::asVolume()
{
return this;
}
void LLVOVolume::markDead()
{
if (!mDead)
@@ -3496,8 +3501,6 @@ bool LLVOVolume::isAnimatedObject() const
// virtual
void LLVOVolume::onReparent(LLViewerObject *old_parent, LLViewerObject *new_parent)
{
LLVOVolume *old_volp = dynamic_cast<LLVOVolume*>(old_parent);
if (new_parent && !new_parent->isAvatar())
{
if (mControlAvatar.notNull())
@@ -3509,6 +3512,7 @@ void LLVOVolume::onReparent(LLViewerObject *old_parent, LLViewerObject *new_pare
av->markForDeath();
}
}
LLVOVolume *old_volp = old_parent ? old_parent->asVolume() : nullptr;
if (old_volp && old_volp->isAnimatedObject())
{
if (old_volp->getControlAvatar())
@@ -5247,7 +5251,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
if (bridge)
{
vobj = bridge->mDrawable->getVObj();
vol_obj = dynamic_cast<LLVOVolume*>(vobj);
vol_obj = vobj ? vobj->asVolume() : nullptr;
}
if (vol_obj)
{

View File

@@ -94,7 +94,7 @@ public:
};
// Class which embodies all Volume objects (with pcode LL_PCODE_VOLUME)
class LLVOVolume : public LLViewerObject
class LLVOVolume final : public LLViewerObject
{
LOG_CLASS(LLVOVolume);
protected:
@@ -126,7 +126,9 @@ public:
public:
LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
/*virtual*/ void markDead(); // Override (and call through to parent) to clean up media references
LLVOVolume* asVolume() final;
/*virtual*/ void markDead() override; // Override (and call through to parent) to clean up media references
/*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);