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:
Beeks
2010-09-22 06:48:48 -04:00
parent 3d4fee4614
commit ec55705bdd
48 changed files with 8559 additions and 7177 deletions

View File

@@ -2208,7 +2208,7 @@ class LLSelfEnableRemoveAllAttachments : public view_listener_t
{
LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachment = curiter->second;
if (attachment->getObject())
if (attachment->getNumObjects() > 0)
{
new_value = true;
break;
@@ -6636,35 +6636,46 @@ class LLAttachmentDrop : public view_listener_t
// called from avatar pie menu
void handle_detach_from_avatar(void* user_data)
{
LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data;
LLViewerJointAttachment *attachment = (LLViewerJointAttachment*)user_data;
LLViewerObject* attached_object = attachment->getObject();
if (attached_object)
if (attachment->getNumObjects() > 0)
{
gMessageSystem->newMessage("ObjectDetach");
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, attached_object->getLocalID());
for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator iter = attachment->mAttachedObjects.begin();
iter != attachment->mAttachedObjects.end();
iter++)
{
LLViewerObject *attached_object = (*iter);
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, attached_object->getLocalID());
}
gMessageSystem->sendReliable( gAgent.getRegionHost() );
}
}
void attach_label(std::string& label, void* user_data)
{
LLViewerJointAttachment* attachmentp = (LLViewerJointAttachment*)user_data;
if (attachmentp)
LLViewerJointAttachment *attachment = (LLViewerJointAttachment*)user_data;
if (attachment)
{
label = attachmentp->getName();
if (attachmentp->getObject())
label = attachment->getName();
for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator attachment_iter = attachment->mAttachedObjects.begin();
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerInventoryItem* itemp = gInventory.getItem(attachmentp->getItemID());
if (itemp)
const LLViewerObject* attached_object = (*attachment_iter);
if (attached_object)
{
label += std::string(" (") + itemp->getName() + std::string(")");
LLViewerInventoryItem* itemp = gInventory.getItem(attached_object->getAttachmentItemID());
if (itemp)
{
label += std::string(" (") + itemp->getName() + std::string(")");
break;
}
}
}
}
@@ -6672,16 +6683,23 @@ void attach_label(std::string& label, void* user_data)
void detach_label(std::string& label, void* user_data)
{
LLViewerJointAttachment* attachmentp = (LLViewerJointAttachment*)user_data;
if (attachmentp)
LLViewerJointAttachment *attachment = (LLViewerJointAttachment*)user_data;
if (attachment)
{
label = attachmentp->getName();
if (attachmentp->getObject())
label = attachment->getName();
for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator attachment_iter = attachment->mAttachedObjects.begin();
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerInventoryItem* itemp = gInventory.getItem(attachmentp->getItemID());
if (itemp)
const LLViewerObject* attached_object = (*attachment_iter);
if (attached_object)
{
label += std::string(" (") + itemp->getName() + std::string(")");
LLViewerInventoryItem* itemp = gInventory.getItem(attached_object->getAttachmentItemID());
if (itemp)
{
label += std::string(" (") + itemp->getName() + std::string(")");
break;
}
}
}
}
@@ -6784,23 +6802,27 @@ class LLAttachmentEnableDrop : public view_listener_t
if ( attachment_pt )
{
// make sure item is in your inventory (it could be a delayed attach message being sent from the sim)
// so check to see if the item is in the inventory already
item = gInventory.getItem(attachment_pt->getItemID());
if ( !item )
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment_pt->mAttachedObjects.begin();
attachment_iter != attachment_pt->mAttachedObjects.end();
++attachment_iter)
{
// Item does not exist, make an observer to enable the pie menu
// when the item finishes fetching worst case scenario
// if a fetch is already out there (being sent from a slow sim)
// we refetch and there are 2 fetches
LLWornItemFetchedObserver* wornItemFetched = new LLWornItemFetchedObserver();
LLInventoryFetchObserver::item_ref_t items; //add item to the inventory item to be fetched
// make sure item is in your inventory (it could be a delayed attach message being sent from the sim)
// so check to see if the item is in the inventory already
item = gInventory.getItem((*attachment_iter)->getAttachmentItemID());
if (!item)
{
// Item does not exist, make an observer to enable the pie menu
// when the item finishes fetching worst case scenario
// if a fetch is already out there (being sent from a slow sim)
// we refetch and there are 2 fetches
LLWornItemFetchedObserver* wornItemFetched = new LLWornItemFetchedObserver();
LLInventoryFetchObserver::item_ref_t items; //add item to the inventory item to be fetched
items.push_back(attachment_pt->getItemID());
wornItemFetched->fetchItems(items);
gInventory.addObserver(wornItemFetched);
items.push_back((*attachment_iter)->getAttachmentItemID());
wornItemFetched->fetchItems(items);
gInventory.addObserver(wornItemFetched);
}
}
}
}
@@ -6919,7 +6941,7 @@ BOOL object_attached(void *user_data)
{
LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data;
return attachment->getObject() != NULL;
return attachment->getNumObjects() > 0;
}
class LLAvatarSendIM : public view_listener_t
@@ -7187,17 +7209,23 @@ void handle_dump_attachments(void*)
LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachment = curiter->second;
S32 key = curiter->first;
BOOL visible = (attachment->getObject() != NULL &&
attachment->getObject()->mDrawable.notNull() &&
!attachment->getObject()->mDrawable->isRenderType(0));
LLVector3 pos;
if (visible) pos = attachment->getObject()->mDrawable->getPosition();
llinfos << "ATTACHMENT " << key << ": item_id=" << attachment->getItemID()
<< (attachment->getObject() ? " present " : " absent ")
<< (visible ? "visible " : "invisible ")
<< " at " << pos
<< " and " << (visible ? attachment->getObject()->getPosition() : LLVector3::zero)
<< llendl;
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerObject *attached_object = (*attachment_iter);
BOOL visible = (attached_object != NULL &&
attached_object->mDrawable.notNull() &&
!attached_object->mDrawable->isRenderType(0));
LLVector3 pos;
if (visible) pos = attached_object->mDrawable->getPosition();
llinfos << "ATTACHMENT " << key << ": item_id=" << attached_object->getAttachmentItemID()
<< (attached_object ? " present " : " absent ")
<< (visible ? "visible " : "invisible ")
<< " at " << pos
<< " and " << (visible ? attached_object->getPosition() : LLVector3::zero)
<< llendl;
}
}
}