THE BIGGIE.
Holy hell, this was an interesting one to implement. I wish I understood it better. Unfortunately I think this marks the end of trying to re-implement the Local Inventory for Temp and Local textures. It's just not feasible now that the entire inventory system has been whipped into a code shitstorm. Signed-off-by: Beeks <HgDelirium@gmail.com>
This commit is contained in:
@@ -1635,27 +1635,32 @@ void LLVOAvatar::getSpatialExtents(LLVector3& newMin, LLVector3& newMax)
|
||||
continue ;
|
||||
}
|
||||
|
||||
LLViewerObject* object = attachment->getObject();
|
||||
if (object && !object->isHUDAttachment())
|
||||
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
|
||||
attachment_iter != attachment->mAttachedObjects.end();
|
||||
++attachment_iter)
|
||||
{
|
||||
LLDrawable* drawable = object->mDrawable;
|
||||
if (drawable)
|
||||
const LLViewerObject* attached_object = (*attachment_iter);
|
||||
if (attached_object && !attached_object->isHUDAttachment())
|
||||
{
|
||||
LLSpatialBridge* bridge = drawable->getSpatialBridge();
|
||||
if (bridge)
|
||||
LLDrawable* drawable = attached_object->mDrawable;
|
||||
if (drawable)
|
||||
{
|
||||
const LLVector3* ext = bridge->getSpatialExtents();
|
||||
LLVector3 distance = (ext[1] - ext[0]);
|
||||
|
||||
// Only add the prim to spatial extents calculations if it isn't a megaprim.
|
||||
// max_attachment_span calculated at the start of the function
|
||||
// (currently 5 times our max prim size)
|
||||
if (distance.mV[0] < max_attachment_span
|
||||
&& distance.mV[1] < max_attachment_span
|
||||
&& distance.mV[2] < max_attachment_span)
|
||||
LLSpatialBridge* bridge = drawable->getSpatialBridge();
|
||||
if (bridge)
|
||||
{
|
||||
update_min_max(newMin,newMax,ext[0]);
|
||||
update_min_max(newMin,newMax,ext[1]);
|
||||
const LLVector3* ext = bridge->getSpatialExtents();
|
||||
LLVector3 distance = (ext[1] - ext[0]);
|
||||
|
||||
// Only add the prim to spatial extents calculations if it isn't a megaprim.
|
||||
// max_attachment_span calculated at the start of the function
|
||||
// (currently 5 times our max prim size)
|
||||
if (distance.mV[0] < max_attachment_span
|
||||
&& distance.mV[1] < max_attachment_span
|
||||
&& distance.mV[2] < max_attachment_span)
|
||||
{
|
||||
update_min_max(newMin,newMax,ext[0]);
|
||||
update_min_max(newMin,newMax,ext[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2867,30 +2872,32 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
|
||||
{
|
||||
attachment_map_t::iterator curiter = iter++;
|
||||
LLViewerJointAttachment* attachment = curiter->second;
|
||||
LLViewerObject *attached_object = attachment->getObject();
|
||||
|
||||
BOOL visibleAttachment = visible || (attached_object &&
|
||||
!(attached_object->mDrawable->getSpatialBridge() &&
|
||||
attached_object->mDrawable->getSpatialBridge()->getRadius() < 2.0));
|
||||
|
||||
if (visibleAttachment && attached_object && !attached_object->isDead() && attachment->getValid())
|
||||
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
|
||||
attachment_iter != attachment->mAttachedObjects.end();
|
||||
++attachment_iter)
|
||||
{
|
||||
// if selecting any attachments, update all of them as non-damped
|
||||
if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() && LLSelectMgr::getInstance()->getSelection()->isAttachment())
|
||||
{
|
||||
gPipeline.updateMoveNormalAsync(attached_object->mDrawable);
|
||||
LLViewerObject* attached_object = (*attachment_iter);
|
||||
BOOL visibleAttachment = visible || (attached_object &&
|
||||
!(attached_object->mDrawable->getSpatialBridge() &&
|
||||
attached_object->mDrawable->getSpatialBridge()->getRadius() < 2.0));
|
||||
if (visibleAttachment && attached_object && !attached_object->isDead() && attachment->getValid())
|
||||
{
|
||||
// if selecting any attachments, update all of them as non-damped
|
||||
if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() && LLSelectMgr::getInstance()->getSelection()->isAttachment())
|
||||
{
|
||||
gPipeline.updateMoveNormalAsync(attached_object->mDrawable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gPipeline.updateMoveDampedAsync(attached_object->mDrawable);
|
||||
}
|
||||
LLSpatialBridge* bridge = attached_object->mDrawable->getSpatialBridge();
|
||||
if (bridge)
|
||||
{
|
||||
gPipeline.updateMoveNormalAsync(bridge);
|
||||
}
|
||||
attached_object->updateText();
|
||||
}
|
||||
else
|
||||
{
|
||||
gPipeline.updateMoveDampedAsync(attached_object->mDrawable);
|
||||
}
|
||||
|
||||
LLSpatialBridge* bridge = attached_object->mDrawable->getSpatialBridge();
|
||||
if (bridge)
|
||||
{
|
||||
gPipeline.updateMoveNormalAsync(bridge);
|
||||
}
|
||||
attached_object->updateText();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4727,19 +4734,24 @@ void LLVOAvatar::updateVisibility()
|
||||
/*llinfos << "SPA: " << sel_pos_agent << llendl;
|
||||
llinfos << "WPA: " << wrist_right_pos_agent << llendl;*/
|
||||
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
|
||||
iter != mAttachmentPoints.end(); )
|
||||
iter != mAttachmentPoints.end(); iter++)
|
||||
{
|
||||
attachment_map_t::iterator curiter = iter++;
|
||||
LLViewerJointAttachment* attachment = curiter->second;
|
||||
if (attachment->getObject())
|
||||
LLViewerJointAttachment* attachment = iter->second;
|
||||
|
||||
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
|
||||
attachment_iter != attachment->mAttachedObjects.end();
|
||||
++attachment_iter)
|
||||
{
|
||||
if(attachment->getObject()->mDrawable->isVisible())
|
||||
if (LLViewerObject *attached_object = (*attachment_iter))
|
||||
{
|
||||
llinfos << attachment->getName() << " visible" << llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
llinfos << attachment->getName() << " not visible at " << mDrawable->getWorldPosition() << " and radius " << mDrawable->getRadius() << llendl;
|
||||
if (attached_object->mDrawable->isVisible())
|
||||
{
|
||||
llinfos << attachment->getName() << " visible" << llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
llinfos << attachment->getName() << " not visible at " << mDrawable->getWorldPosition() << " and radius " << mDrawable->getRadius() << llendl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6882,12 +6894,13 @@ void LLVOAvatar::requestLayerSetUpdate(ETextureIndex index )
|
||||
}
|
||||
}
|
||||
|
||||
void LLVOAvatar::setParent(LLViewerObject* parent)
|
||||
BOOL LLVOAvatar::setParent(LLViewerObject* parent)
|
||||
{
|
||||
BOOL ret ;
|
||||
if (parent == NULL)
|
||||
{
|
||||
getOffObject();
|
||||
LLViewerObject::setParent(parent);
|
||||
ret = LLViewerObject::setParent(parent);
|
||||
if (isSelf())
|
||||
{
|
||||
gAgent.resetCamera();
|
||||
@@ -6895,13 +6908,18 @@ void LLVOAvatar::setParent(LLViewerObject* parent)
|
||||
}
|
||||
else
|
||||
{
|
||||
LLViewerObject::setParent(parent);
|
||||
sitOnObject(parent);
|
||||
}
|
||||
ret = LLViewerObject::setParent(parent);
|
||||
if (ret)
|
||||
{
|
||||
sitOnObject(parent);
|
||||
}
|
||||
}
|
||||
return ret ;
|
||||
}
|
||||
|
||||
void LLVOAvatar::addChild(LLViewerObject *childp)
|
||||
{
|
||||
childp->extractAttachmentItemID(); // find the inventory item this object is associated with.
|
||||
LLViewerObject::addChild(childp);
|
||||
if (childp->mDrawable)
|
||||
{
|
||||
@@ -6923,11 +6941,20 @@ LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* vi
|
||||
{
|
||||
S32 attachmentID = ATTACHMENT_ID_FROM_STATE(viewer_object->getState());
|
||||
|
||||
// This should never happen unless the server didn't process the attachment point
|
||||
// correctly, but putting this check in here to be safe.
|
||||
if (attachmentID & ATTACHMENT_ADD)
|
||||
{
|
||||
llwarns << "Got an attachment with ATTACHMENT_ADD mask, removing ( attach pt:" << attachmentID << " )" << llendl;
|
||||
attachmentID &= ~ATTACHMENT_ADD;
|
||||
}
|
||||
|
||||
LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
|
||||
|
||||
if (!attachment)
|
||||
{
|
||||
llwarns << "Object attachment point invalid: " << attachmentID << llendl;
|
||||
attachment = get_if_there(mAttachmentPoints, 1, (LLViewerJointAttachment*)NULL); // Arbitrary using 1 (chest)
|
||||
}
|
||||
|
||||
return attachment;
|
||||
@@ -6966,7 +6993,7 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object)
|
||||
updateAttachmentVisibility(gAgent.getCameraMode());
|
||||
|
||||
// Then make sure the inventory is in sync with the avatar.
|
||||
gInventory.addChangedMask( LLInventoryObserver::LABEL, item_id );
|
||||
gInventory.addChangedMask(LLInventoryObserver::LABEL, viewer_object->getAttachmentItemID());
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
}
|
||||
@@ -6990,13 +7017,34 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object)
|
||||
updateAttachmentVisibility(gAgent.getCameraMode());
|
||||
|
||||
// Then make sure the inventory is in sync with the avatar.
|
||||
gInventory.addChangedMask( LLInventoryObserver::LABEL, attachment->getItemID() );
|
||||
gInventory.addChangedMask(LLInventoryObserver::LABEL, viewer_object->getAttachmentItemID());
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
U32 LLVOAvatar::getNumAttachments() const
|
||||
{
|
||||
U32 num_attachments = 0;
|
||||
for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
|
||||
iter != mAttachmentPoints.end();
|
||||
++iter)
|
||||
{
|
||||
LLViewerJointAttachment *attachment_pt = (*iter).second;
|
||||
num_attachments += attachment_pt->getNumObjects();
|
||||
}
|
||||
return num_attachments;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// canAttachMoreObjects()
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL LLVOAvatar::canAttachMoreObjects() const
|
||||
{
|
||||
return (getNumAttachments() < MAX_AGENT_ATTACHMENTS);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// lazyAttach()
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -7022,16 +7070,20 @@ void LLVOAvatar::lazyAttach()
|
||||
void LLVOAvatar::resetHUDAttachments()
|
||||
{
|
||||
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
|
||||
iter != mAttachmentPoints.end(); )
|
||||
iter != mAttachmentPoints.end(); iter++)
|
||||
{
|
||||
attachment_map_t::iterator curiter = iter++;
|
||||
LLViewerJointAttachment* attachment = curiter->second;
|
||||
LLViewerJointAttachment* attachment = iter->second;
|
||||
if (attachment->getIsHUDAttachment())
|
||||
{
|
||||
LLViewerObject* obj = attachment->getObject();
|
||||
if (obj && obj->mDrawable.notNull())
|
||||
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
|
||||
attachment_iter != attachment->mAttachedObjects.end();
|
||||
++attachment_iter)
|
||||
{
|
||||
gPipeline.markMoved(obj->mDrawable);
|
||||
const LLViewerObject* attached_object = (*attachment_iter);
|
||||
if (attached_object && attached_object->mDrawable.notNull())
|
||||
{
|
||||
gPipeline.markMoved(attached_object->mDrawable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7048,9 +7100,9 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object)
|
||||
attachment_map_t::iterator curiter = iter++;
|
||||
LLViewerJointAttachment* attachment = curiter->second;
|
||||
// only one object per attachment point for now
|
||||
if (attachment->getObject() == viewer_object)
|
||||
if (attachment->isObjectAttached(viewer_object))
|
||||
{
|
||||
LLUUID item_id = attachment->getItemID();
|
||||
LLUUID item_id = viewer_object->getAttachmentItemID();
|
||||
attachment->removeObject(viewer_object);
|
||||
if (mIsSelf)
|
||||
{
|
||||
@@ -7315,14 +7367,15 @@ LLVOAvatar* LLVOAvatar::findAvatarFromAttachment( LLViewerObject* obj )
|
||||
//-----------------------------------------------------------------------------
|
||||
// isWearingAttachment()
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL LLVOAvatar::isWearingAttachment( const LLUUID& inv_item_id )
|
||||
BOOL LLVOAvatar::isWearingAttachment(const LLUUID& inv_item_id)
|
||||
{
|
||||
const LLUUID& base_inv_item_id = gInventory.getLinkedItemID(inv_item_id);
|
||||
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
|
||||
iter != mAttachmentPoints.end(); )
|
||||
{
|
||||
attachment_map_t::iterator curiter = iter++;
|
||||
LLViewerJointAttachment* attachment = curiter->second;
|
||||
if( attachment->getItemID() == inv_item_id )
|
||||
if(attachment->getAttachedObject(base_inv_item_id))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -7346,16 +7399,17 @@ BOOL LLVOAvatar::isWearingUnsupportedAttachment( const LLUUID& inv_item_id )
|
||||
//-----------------------------------------------------------------------------
|
||||
// getWornAttachment()
|
||||
//-----------------------------------------------------------------------------
|
||||
LLViewerObject* LLVOAvatar::getWornAttachment( const LLUUID& inv_item_id )
|
||||
LLViewerObject* LLVOAvatar::getWornAttachment(const LLUUID& inv_item_id)
|
||||
{
|
||||
const LLUUID& base_inv_item_id = gInventory.getLinkedItemID(inv_item_id);
|
||||
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
|
||||
iter != mAttachmentPoints.end(); )
|
||||
{
|
||||
attachment_map_t::iterator curiter = iter++;
|
||||
LLViewerJointAttachment* attachment = curiter->second;
|
||||
if( attachment->getItemID() == inv_item_id )
|
||||
if (LLViewerObject *attached_object = attachment->getAttachedObject(base_inv_item_id))
|
||||
{
|
||||
return attachment->getObject();
|
||||
return attached_object;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@@ -7363,12 +7417,13 @@ LLViewerObject* LLVOAvatar::getWornAttachment( const LLUUID& inv_item_id )
|
||||
|
||||
const std::string LLVOAvatar::getAttachedPointName(const LLUUID& inv_item_id)
|
||||
{
|
||||
const LLUUID& base_inv_item_id = gInventory.getLinkedItemID(inv_item_id);
|
||||
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
|
||||
iter != mAttachmentPoints.end(); )
|
||||
{
|
||||
attachment_map_t::iterator curiter = iter++;
|
||||
LLViewerJointAttachment* attachment = curiter->second;
|
||||
if( attachment->getItemID() == inv_item_id )
|
||||
if (attachment->getAttachedObject(base_inv_item_id))
|
||||
{
|
||||
return attachment->getName();
|
||||
}
|
||||
@@ -8901,11 +8956,10 @@ void LLVOAvatar::clampAttachmentPositions()
|
||||
BOOL LLVOAvatar::hasHUDAttachment() const
|
||||
{
|
||||
for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
|
||||
iter != mAttachmentPoints.end(); )
|
||||
iter != mAttachmentPoints.end(); ++iter)
|
||||
{
|
||||
attachment_map_t::const_iterator curiter = iter++;
|
||||
LLViewerJointAttachment* attachment = curiter->second;
|
||||
if (attachment->getIsHUDAttachment() && attachment->getObject())
|
||||
LLViewerJointAttachment* attachment = iter->second;
|
||||
if (attachment->getIsHUDAttachment() && attachment->getNumObjects() > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -8917,24 +8971,33 @@ LLBBox LLVOAvatar::getHUDBBox() const
|
||||
{
|
||||
LLBBox bbox;
|
||||
for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
|
||||
iter != mAttachmentPoints.end(); )
|
||||
iter != mAttachmentPoints.end(); ++iter)
|
||||
{
|
||||
attachment_map_t::const_iterator curiter = iter++;
|
||||
LLViewerJointAttachment* attachment = curiter->second;
|
||||
if (attachment->getIsHUDAttachment() && attachment->getObject())
|
||||
LLViewerJointAttachment* attachment = iter->second;
|
||||
if (attachment->getIsHUDAttachment())
|
||||
{
|
||||
LLViewerObject* hud_object = attachment->getObject();
|
||||
|
||||
// initialize bounding box to contain identity orientation and center point for attached object
|
||||
bbox.addPointLocal(hud_object->getPosition());
|
||||
// add rotated bounding box for attached object
|
||||
bbox.addBBoxAgent(hud_object->getBoundingBoxAgent());
|
||||
LLViewerObject::const_child_list_t& child_list = hud_object->getChildren();
|
||||
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
|
||||
iter != child_list.end(); iter++)
|
||||
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
|
||||
attachment_iter != attachment->mAttachedObjects.end();
|
||||
++attachment_iter)
|
||||
{
|
||||
LLViewerObject* child_objectp = *iter;
|
||||
bbox.addBBoxAgent(child_objectp->getBoundingBoxAgent());
|
||||
const LLViewerObject* attached_object = (*attachment_iter);
|
||||
if (attached_object == NULL)
|
||||
{
|
||||
llwarns << "HUD attached object is NULL!" << llendl;
|
||||
continue;
|
||||
}
|
||||
// initialize bounding box to contain identity orientation and center point for attached object
|
||||
bbox.addPointLocal(attached_object->getPosition());
|
||||
// add rotated bounding box for attached object
|
||||
bbox.addBBoxAgent(attached_object->getBoundingBoxAgent());
|
||||
LLViewerObject::const_child_list_t& child_list = attached_object->getChildren();
|
||||
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
|
||||
iter != child_list.end();
|
||||
++iter)
|
||||
{
|
||||
const LLViewerObject* child_objectp = *iter;
|
||||
bbox.addBBoxAgent(child_objectp->getBoundingBoxAgent());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10367,20 +10430,25 @@ void LLVOAvatar::idleUpdateRenderCost()
|
||||
++iter)
|
||||
{
|
||||
LLViewerJointAttachment* attachment = iter->second;
|
||||
LLViewerObject* object = attachment->getObject();
|
||||
if (object && !object->isHUDAttachment())
|
||||
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
|
||||
attachment_iter != attachment->mAttachedObjects.end();
|
||||
++attachment_iter)
|
||||
{
|
||||
LLDrawable* drawable = object->mDrawable;
|
||||
if (drawable)
|
||||
const LLViewerObject* attached_object = (*attachment_iter);
|
||||
if (attached_object && !attached_object->isHUDAttachment())
|
||||
{
|
||||
shame += 10;
|
||||
LLVOVolume* volume = drawable->getVOVolume();
|
||||
if (volume)
|
||||
const LLDrawable* drawable = attached_object->mDrawable;
|
||||
if (drawable)
|
||||
{
|
||||
shame += calc_shame(volume, textures);
|
||||
}
|
||||
}
|
||||
}
|
||||
shame += 10;
|
||||
LLVOVolume* volume = drawable->getVOVolume();
|
||||
if (volume)
|
||||
{
|
||||
shame += calc_shame(volume, textures);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(sDoProperArc)
|
||||
|
||||
Reference in New Issue
Block a user