本文整理汇总了C++中LLViewerJointAttachment类的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerJointAttachment类的具体用法?C++ LLViewerJointAttachment怎么用?C++ LLViewerJointAttachment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLViewerJointAttachment类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleEvent
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLInventoryPanel *panel = mPtr;
LLFolderView* folder = panel->getRootFolder();
if(!folder) return true;
std::set<LLUUID> selected_items;
folder->getSelectionList(selected_items);
LLUUID id = *selected_items.begin();
std::string joint_name = userdata.asString();
LLVOAvatar *avatarp = gAgent.getAvatarObject();
LLViewerJointAttachment* attachmentp = NULL;
for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
iter != avatarp->mAttachmentPoints.end(); )
{
LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachment = curiter->second;
if (attachment->getName() == joint_name)
{
attachmentp = attachment;
break;
}
}
if (attachmentp == NULL)
{
return true;
}
LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(id);
if(item && gInventory.isObjectDescendentOf(id, gAgent.getInventoryRootID()))
{
rez_attachment(item, attachmentp);
}
else if(item && item->isComplete())
{
// must be in library. copy it to our inventory and put it on.
LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(attachmentp);
copy_inventory_item(
gAgent.getID(),
item->getPermissions().getOwner(),
item->getUUID(),
LLUUID::null,
std::string(),
cb);
}
gFocusMgr.setKeyboardFocus(NULL);
return true;
}
示例2: populateMenus
// static
void LLViewerAttachMenu::populateMenus(const std::string& attach_to_menu_name, const std::string& attach_to_hud_menu_name)
{
// *TODO: share this code with other similar menus
// (inventory panel context menu, in-world object menu).
if (attach_to_menu_name.empty() || attach_to_hud_menu_name.empty() || !isAgentAvatarValid()) return;
LLContextMenu* attach_menu = gMenuHolder->getChild<LLContextMenu>(attach_to_menu_name);
LLContextMenu* attach_hud_menu = gMenuHolder->getChild<LLContextMenu>(attach_to_hud_menu_name);
if (!attach_menu || attach_menu->getChildCount() != 0 ||
!attach_hud_menu || attach_hud_menu->getChildCount() != 0)
{
return;
}
// Populate "Attach to..." / "Attach to HUD..." submenus.
for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
iter != gAgentAvatarp->mAttachmentPoints.end(); )
{
LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachment = curiter->second;
LLMenuItemCallGL::Params p;
std::string submenu_name = attachment->getName();
std::string translated_submenu_name;
if (LLTrans::findString(translated_submenu_name, submenu_name))
{
p.name = (" ") + translated_submenu_name + " ";
}
else
{
p.name = submenu_name;
}
LLSD cbparams;
cbparams["index"] = curiter->first;
cbparams["label"] = p.name;
p.on_click.function_name = "Object.Attach";
p.on_click.parameter = LLSD(attachment->getName());
p.on_enable.function_name = "Attachment.Label";
p.on_enable.parameter = cbparams;
LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(p);
LLView* parent_menu = attachment->getIsHUDAttachment() ? attach_hud_menu : attach_menu;
parent_menu->addChild(item);
}
}
示例3: attachObjects
// static
void LLViewerAttachMenu::attachObjects(const uuid_vec_t& items, const std::string& joint_name)
{
LLViewerJointAttachment* attachmentp = NULL;
for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
iter != gAgentAvatarp->mAttachmentPoints.end(); )
{
LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachment = curiter->second;
if (attachment->getName() == joint_name)
{
attachmentp = attachment;
break;
}
}
if (attachmentp == NULL)
{
return;
}
for (uuid_vec_t::const_iterator it = items.begin(); it != items.end(); ++it)
{
const LLUUID &id = *it;
LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getLinkedItem(id);
if(item && gInventory.isObjectDescendentOf(id, gInventory.getRootFolderID()))
{
rez_attachment(item, attachmentp); // don't replace if called from an "Attach To..." menu
}
else if(item && item->isFinished())
{
// must be in library. copy it to our inventory and put it on.
LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(attachmentp);
copy_inventory_item(gAgent.getID(),
item->getPermissions().getOwner(),
item->getUUID(),
LLUUID::null,
std::string(),
cb);
}
}
}
示例4: renderObjectsForSelect
U32 LLViewerObjectList::renderObjectsForSelect(LLCamera &camera, BOOL pick_parcel_wall, BOOL keep_pick_list)
{
gRenderForSelect = TRUE;
// LLTimer pick_timer;
if (!keep_pick_list)
{
LLViewerObject *objectp;
S32 i;
// Reset all of the GL names to zero.
for (i = 0; i < mObjects.count(); i++)
{
objectp = mObjects[i];
objectp->mGLName = 0;
}
mSelectPickList.clear();
std::vector<LLDrawable*> pick_drawables;
for (i = 0; i < LLPipeline::NUM_PARTITIONS-1; i++)
{
LLSpatialPartition* part = gPipeline.getSpatialPartition(i);
if (part)
{
part->cull(camera, &pick_drawables, TRUE);
}
}
for (std::vector<LLDrawable*>::iterator iter = pick_drawables.begin();
iter != pick_drawables.end(); iter++)
{
LLDrawable* drawablep = *iter;
if( !drawablep )
continue;
LLViewerObject* last_objectp = NULL;
for (S32 face_num = 0; face_num < drawablep->getNumFaces(); face_num++)
{
LLViewerObject* objectp = drawablep->getFace(face_num)->getViewerObject();
if (objectp && objectp != last_objectp)
{
mSelectPickList.insert(objectp);
last_objectp = objectp;
}
}
}
LLHUDText::addPickable(mSelectPickList);
for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
iter != LLCharacter::sInstances.end(); ++iter)
{
objectp = (LLVOAvatar*) *iter;
if (!objectp->isDead())
{
if (objectp->mDrawable.notNull() && objectp->mDrawable->isVisible())
{
mSelectPickList.insert(objectp);
}
}
}
// add all hud objects to pick list
LLVOAvatar* avatarp = gAgent.getAvatarObject();
if (avatarp)
{
LLViewerJointAttachment* attachmentp;
for (attachmentp = avatarp->mAttachmentPoints.getFirstData();
attachmentp;
attachmentp = avatarp->mAttachmentPoints.getNextData())
{
if (attachmentp->getIsHUDAttachment())
{
LLViewerObject* objectp = attachmentp->getObject();
if (objectp)
{
mSelectPickList.insert(objectp);
for (U32 i = 0; i < objectp->mChildList.size(); i++)
{
LLViewerObject* childp = objectp->mChildList[i];
if (childp)
{
mSelectPickList.insert(childp);
}
}
}
}
}
}
S32 num_pickables = (S32)mSelectPickList.size() + LLHUDIcon::getNumInstances();
if (num_pickables != 0)
{
S32 step = (0x000fffff - GL_NAME_INDEX_OFFSET) / num_pickables;
std::set<LLViewerObject*>::iterator pick_it;
i = 0;
//.........这里部分代码省略.........
示例5: generatePickList
void LLViewerObjectList::generatePickList(LLCamera &camera)
{
LLViewerObject *objectp;
S32 i;
// Reset all of the GL names to zero.
for (i = 0; i < mObjects.count(); i++)
{
objectp = mObjects[i];
objectp->mGLName = 0;
}
mSelectPickList.clear();
std::vector<LLDrawable*> pick_drawables;
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
LLViewerRegion* region = *iter;
for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
{
LLSpatialPartition* part = region->getSpatialPartition(i);
if (part)
{
part->cull(camera, &pick_drawables, TRUE);
}
}
}
for (std::vector<LLDrawable*>::iterator iter = pick_drawables.begin();
iter != pick_drawables.end(); iter++)
{
LLDrawable* drawablep = *iter;
if( !drawablep )
continue;
LLViewerObject* last_objectp = NULL;
for (S32 face_num = 0; face_num < drawablep->getNumFaces(); face_num++)
{
LLViewerObject* objectp = drawablep->getFace(face_num)->getViewerObject();
if (objectp && objectp != last_objectp)
{
mSelectPickList.insert(objectp);
last_objectp = objectp;
}
}
}
LLHUDText::addPickable(mSelectPickList);
for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
iter != LLCharacter::sInstances.end(); ++iter)
{
objectp = (LLVOAvatar*) *iter;
if (!objectp->isDead())
{
if (objectp->mDrawable.notNull() && objectp->mDrawable->isVisible())
{
mSelectPickList.insert(objectp);
}
}
}
// add all hud objects to pick list
LLVOAvatar* avatarp = gAgent.getAvatarObject();
if (avatarp)
{
for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
iter != avatarp->mAttachmentPoints.end(); )
{
LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachmentp = curiter->second;
if (attachmentp->getIsHUDAttachment())
{
LLViewerObject* objectp = attachmentp->getObject();
if (objectp)
{
mSelectPickList.insert(objectp);
LLViewerObject::const_child_list_t& child_list = objectp->getChildren();
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); iter++)
{
LLViewerObject* childp = *iter;
if (childp)
{
mSelectPickList.insert(childp);
}
}
}
}
}
}
S32 num_pickables = (S32)mSelectPickList.size() + LLHUDIcon::getNumInstances();
if (num_pickables != 0)
{
S32 step = (0x000fffff - GL_NAME_INDEX_OFFSET) / num_pickables;
//.........这里部分代码省略.........
示例6: childGetListInterface
void RlvFloaterBehaviour::refreshAll()
{
LLVOAvatar* pAvatar = gAgent.getAvatarObject();
LLCtrlListInterface* pList = childGetListInterface("behaviour_list");
const rlv_object_map_t* pRlvObjects = gRlvHandler.getObjectMap();
if ( (!pAvatar) || (!pList) || (!pRlvObjects) )
return;
pList->operateOnAll(LLCtrlListInterface::OP_DELETE);
for (rlv_object_map_t::const_iterator itObj = pRlvObjects->begin(), endObj = pRlvObjects->end(); itObj != endObj; ++itObj)
{
std::string strName = itObj->first.asString();
LLViewerInventoryItem* pItem = NULL;
LLViewerObject* pObj = gObjectList.findObject(itObj->first);
if (pObj)
{
LLViewerJointAttachment* pAttachPt =
get_if_there(pAvatar->mAttachmentPoints, gRlvHandler.getAttachPointIndex(pObj), (LLViewerJointAttachment*)NULL);
if (pAttachPt)
{
pItem = gInventory.getItem(pAttachPt->getItemID());
}
}
if (pItem)
strName = pItem->getName();
const rlv_command_list_t* pCommands = itObj->second.getCommandList();
for (rlv_command_list_t::const_iterator itCmd = pCommands->begin(), endCmd = pCommands->end(); itCmd != endCmd; ++itCmd)
{
std::string strBhvr = itCmd->asString(); LLUUID uuid(itCmd->getOption());
if (uuid.notNull())
{
std::string strLookup;
if ( (gCacheName->getFullName(uuid, strLookup)) || (gCacheName->getGroupName(uuid, strLookup)) )
{
if (strLookup.find("???") == std::string::npos)
strBhvr.assign(itCmd->getBehaviour()).append(":").append(strLookup);
}
else if (m_PendingLookup.end() == std::find(m_PendingLookup.begin(), m_PendingLookup.end(), uuid))
{
gCacheName->get(uuid, FALSE, onAvatarNameLookup, this);
m_PendingLookup.push_back(uuid);
}
}
LLSD element;
// Restriction column
element["columns"][0]["column"] = "behaviour";
element["columns"][0]["value"] = strBhvr;
element["columns"][0]["font"] = "SANSSERIF";
element["columns"][0]["font-style"] = "NORMAL";
// Object Name column
element["columns"][1]["column"] = "name";
element["columns"][1]["value"] = strName;
element["columns"][1]["font"] = "SANSSERIF";
element["columns"][1]["font-style"] = "NORMAL";
pList->addElement(element, ADD_BOTTOM);
}
}
}
示例7: serializeSelection
void ScriptCounter::serializeSelection(bool delScript)
{
LLDynamicArray<LLViewerObject*> catfayse;
foo=LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
sstr.str("");
invqueries=0;
doDelete=false;
scriptcount=0;
objIDS.clear();
delUUIDS.clear();
objectCount=0;
countingDone=false;
reqObjectID.setNull();
if(foo)
{
if(foo->isAvatar())
{
LLVOAvatar* av=find_avatar_from_object(foo);
if(av)
{
for (LLVOAvatar::attachment_map_t::iterator iter = av->mAttachmentPoints.begin();
iter != av->mAttachmentPoints.end();
++iter)
{
LLViewerJointAttachment* attachment = iter->second;
if (!attachment->getValid())
continue ;
LLViewerObject* object = attachment->getObject();
if(object)
{
catfayse.put(object);
objectCount++;
}
}
}
}
else
{
for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin();
iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++)
{
LLSelectNode* selectNode = *iter;
LLViewerObject* object = selectNode->getObject();
if(object)
{
catfayse.put(object);
objectCount++;
}
}
doDelete=delScript;
}
F32 throttle = gSavedSettings.getF32("OutBandwidth");
if((throttle == 0.f) || (throttle > 128000.f))
{
gMessageSystem->mPacketRing.setOutBandwidth(128000);
gMessageSystem->mPacketRing.setUseOutThrottle(TRUE);
}
cmdline_printchat("Counting scripts. Please wait.");
if((objectCount == 1) && !(foo->isAvatar()))
{
LLViewerObject *reqObject=((LLViewerObject*)foo->getRoot());
if(reqObject->isAvatar())
{
for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin();
iter != LLSelectMgr::getInstance()->getSelection()->end(); iter++ )
{
LLSelectNode *nodep = *iter;
LLViewerObject* objectp = nodep->getObject();
if (objectp->isRootEdit())
{
reqObjectID=objectp->getID();
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectSelect);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID());
msg->sendReliable(gAgent.getRegionHost());
break;
}
}
}
else
{
reqObjectID=reqObject->getID();
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_RequestFlags, 0 );
msg->addUUIDFast(_PREHASH_ObjectID, reqObjectID);
gAgent.sendReliableMessage();
}
}
serialize(catfayse);
}
}