本文整理汇总了C++中LLVOAvatar::getWornAttachment方法的典型用法代码示例。如果您正苦于以下问题:C++ LLVOAvatar::getWornAttachment方法的具体用法?C++ LLVOAvatar::getWornAttachment怎么用?C++ LLVOAvatar::getWornAttachment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLVOAvatar
的用法示例。
在下文中一共展示了LLVOAvatar::getWornAttachment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onCommit
// Sub-classes should override this function if they allow editing
void LLPreview::onCommit()
{
const LLViewerInventoryItem *item = getItem();
if(item)
{
if (!item->isComplete())
{
// We are attempting to save an item that was never loaded
llwarns << "LLPreview::onCommit() called with mIsComplete == FALSE"
<< " Type: " << item->getType()
<< " ID: " << item->getUUID()
<< llendl;
return;
}
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
new_item->setDescription(childGetText("desc"));
if(mObjectUUID.notNull())
{
// must be in an object
LLViewerObject* object = gObjectList.findObject(mObjectUUID);
if(object)
{
object->updateInventory(
new_item,
TASK_INVENTORY_ITEM_KEY,
false);
}
}
else if(item->getPermissions().getOwner() == gAgent.getID())
{
new_item->updateServer(FALSE);
gInventory.updateItem(new_item);
gInventory.notifyObservers();
// If the item is an attachment that is currently being worn,
// update the object itself.
if( item->getType() == LLAssetType::AT_OBJECT )
{
LLVOAvatar* avatar = gAgent.getAvatarObject();
if( avatar )
{
LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() );
if( obj )
{
LLSelectMgr::getInstance()->deselectAll();
LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, FALSE );
LLSelectMgr::getInstance()->selectionSetObjectDescription( childGetText("desc") );
LLSelectMgr::getInstance()->deselectAll();
}
}
}
}
}
}
示例2: forceFolder
// Checked: 2010-03-21 (RLVa-1.1.3a) | Modified: RLVa-1.2.0a
void RlvForceWear::forceFolder(const LLViewerInventoryCategory* pFolder, EWearAction eAction, EWearFlags eFlags)
{
// [See LLWearableBridge::wearOnAvatar(): don't wear anything until initial wearables are loaded, can destroy clothing items]
if (!gAgent.areWearablesLoaded())
{
LLNotifications::instance().add("CanNotChangeAppearanceUntilLoaded");
return;
}
LLVOAvatar* pAvatar = gAgent.getAvatarObject();
if (!pAvatar)
return;
// Grab a list of all the items we'll be wearing/attaching
LLInventoryModel::cat_array_t folders; LLInventoryModel::item_array_t items;
RlvWearableItemCollector f(pFolder, eAction, eFlags);
gInventory.collectDescendentsIf(pFolder->getUUID(), folders, items, FALSE, f, TRUE);
EWearAction eCurAction = eAction;
for (S32 idxItem = 0, cntItem = items.count(); idxItem < cntItem; idxItem++)
{
LLViewerInventoryItem* pRlvItem = items.get(idxItem);
LLViewerInventoryItem* pItem = (LLAssetType::AT_LINK == pRlvItem->getActualType()) ? pRlvItem->getLinkedItem() : pRlvItem;
// If it's wearable it should be worn on detach
// if ( (ACTION_DETACH == eAction) && (isWearableItem(pItem)) && (!isWearingItem(pItem)) )
// continue;
// Each folder can specify its own EWearAction override
if (isWearAction(eAction))
eCurAction = f.getWearAction(pRlvItem->getParentUUID());
// NOTES: * if there are composite items then RlvWearableItemCollector made sure they can be worn (or taken off depending)
// * some scripts issue @remattach=force,attach:worn-items=force so we need to attach items even if they're currently worn
switch (pItem->getType())
{
case LLAssetType::AT_BODYPART:
RLV_ASSERT(isWearAction(eAction)); // RlvWearableItemCollector shouldn't be supplying us with body parts on detach
case LLAssetType::AT_CLOTHING:
if (isWearAction(eAction))
{
ERlvWearMask eWearMask = gRlvWearableLocks.canWear(pRlvItem);
if ( ((ACTION_WEAR_REPLACE == eCurAction) && (eWearMask & RLV_WEAR_REPLACE)) ||
((ACTION_WEAR_ADD == eCurAction) && (eWearMask & RLV_WEAR_ADD)) )
{
// The check for whether we're replacing a currently worn composite item happens in onWearableArrived()
if (!isAddWearable(pItem))
addWearable(pRlvItem, eCurAction);
}
}
else
{
const LLWearable* pWearable = gAgent.getWearableFromWearableItem(pItem->getUUID());
if ( (pWearable) && (isForceRemovable(pWearable, false)) )
remWearable(pWearable);
}
break;
case LLAssetType::AT_OBJECT:
if (isWearAction(eAction))
{
ERlvWearMask eWearMask = gRlvAttachmentLocks.canAttach(pRlvItem);
if ( ((ACTION_WEAR_REPLACE == eCurAction) && (eWearMask & RLV_WEAR_REPLACE)) ||
((ACTION_WEAR_ADD == eCurAction) && (eWearMask & RLV_WEAR_ADD)) )
{
if (!isAddAttachment(pRlvItem))
{
#ifdef RLV_EXPERIMENTAL_COMPOSITEFOLDERS
// We still need to check whether we're about to replace a currently worn composite item
// (which we're not if we're just reattaching an attachment we're already wearing)
LLViewerInventoryCategory* pCompositeFolder = NULL;
if ( (pAttachPt->getObject()) && (RlvSettings::getEnableComposites()) &&
(pAttachPt->getItemID() != pItem->getUUID()) &&
(gRlvHandler.getCompositeInfo(pAttachPt->getItemID(), NULL, &pCompositeFolder)) )
{
// If we can't take off the composite folder this item would replace then don't allow it to get attached
if (gRlvHandler.canTakeOffComposite(pCompositeFolder))
{
forceFolder(pCompositeFolder, ACTION_DETACH, FLAG_DEFAULT);
addAttachment(pRlvItem);
}
}
else
#endif // RLV_EXPERIMENTAL_COMPOSITEFOLDERS
{
addAttachment(pRlvItem, eCurAction);
}
}
}
}
else
{
const LLViewerObject* pAttachObj = pAvatar->getWornAttachment(pItem->getUUID());
if ( (pAttachObj) && (isForceDetachable(pAttachObj, false)) )
remAttachment(pAttachObj);
}
break;
#ifdef RLV_EXTENSION_FORCEWEAR_GESTURES
case LLAssetType::AT_GESTURE:
//.........这里部分代码省略.........