本文整理汇总了C++中LLViewerObject::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerObject::getParent方法的具体用法?C++ LLViewerObject::getParent怎么用?C++ LLViewerObject::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLViewerObject
的用法示例。
在下文中一共展示了LLViewerObject::getParent方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: needs_tooltip
static bool needs_tooltip(LLSelectNode* nodep)
{
if (!nodep)
return false;
LLViewerObject* object = nodep->getObject();
LLViewerObject *parent = (LLViewerObject *)object->getParent();
if (object->flagHandleTouch()
|| (parent && parent->flagHandleTouch())
|| object->flagTakesMoney()
|| (parent && parent->flagTakesMoney())
|| object->flagAllowInventoryAdd()
)
{
return true;
}
U8 click_action = final_click_action(object);
if (click_action != 0)
{
return true;
}
if (nodep->mValid)
{
bool anyone_copy = anyone_copy_selection(nodep);
bool for_sale = for_sale_selection(nodep);
if (anyone_copy || for_sale)
{
return true;
}
}
return false;
}
示例2: updateButtons
// Choose the "most relevant" operation for this object, and show a button for
// that operation as the left-most button in the inspector.
void LLInspectObject::updateButtons(LLSelectNode* nodep)
{
// We'll start with everyone hidden and show the ones we need
hideButtons();
LLViewerObject* object = nodep->getObject();
LLViewerObject *parent = (LLViewerObject*)object->getParent();
bool for_copy = anyone_copy_selection(nodep);
bool for_sale = enable_buy_object();
S32 price = nodep->mSaleInfo.getSalePrice();
U8 click_action = final_click_action(object);
if (for_copy
|| (for_sale && price == 0))
{
// Free copies have priority over other operations
getChild<LLUICtrl>("take_free_copy_btn")->setVisible(true);
}
else if (for_sale)
{
getChild<LLUICtrl>("buy_btn")->setVisible(true);
}
else if ( enable_pay_object() )
{
getChild<LLUICtrl>("pay_btn")->setVisible(true);
}
else if (click_action == CLICK_ACTION_SIT)
{
// Click-action sit must come before "open" because many objects on
// which you can sit have scripts, and hence can be opened
getChild<LLUICtrl>("sit_btn")->setVisible(true);
updateSitLabel(nodep);
}
else if (object->flagHandleTouch()
|| (parent && parent->flagHandleTouch()))
{
getChild<LLUICtrl>("touch_btn")->setVisible(true);
updateTouchLabel(nodep);
}
else if ( enable_object_open() )
{
// Open is last because anything with a script in it can be opened
getChild<LLUICtrl>("open_btn")->setVisible(true);
}
else
{
// By default, we can sit on anything
getChild<LLUICtrl>("sit_btn")->setVisible(true);
updateSitLabel(nodep);
}
// No flash
focusFirstItem(FALSE, FALSE);
}
示例3: find_avatar
static LLVOAvatar* find_avatar(const LLUUID& id)
{
LLViewerObject *obj = gObjectList.findObject(id);
while (obj && obj->isAttachment())
{
obj = (LLViewerObject *)obj->getParent();
}
if (obj && obj->isAvatar())
{
return (LLVOAvatar*)obj;
}
else
{
return NULL;
}
}
示例4: pickAndShowMenu
//.........这里部分代码省略.........
return LLTool::handleMouseDown(x, y, mask);
}
// [/RLVa:KB]
gGrabTransientTool = this;
LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() );
return LLToolGrab::getInstance()->handleObjectHit( mPick );
}
LLHUDIcon* last_hit_hud_icon = mPick.mHUDIcon;
if (!object && last_hit_hud_icon && last_hit_hud_icon->getSourceObject())
{
LLFloaterScriptDebug::show(last_hit_hud_icon->getSourceObject()->getID());
}
// If left-click never selects or spawns a menu
// Eat the event.
if (!gSavedSettings.getBOOL("LeftClickShowMenu")
&& !always_show)
{
// mouse already released
if (!mGrabMouseButtonDown)
{
return TRUE;
}
while( object && object->isAttachment() && !object->flagHandleTouch())
{
// don't pick avatar through hud attachment
if (object->isHUDAttachment())
{
break;
}
object = (LLViewerObject*)object->getParent();
}
if (object && object == gAgent.getAvatarObject())
{
// we left clicked on avatar, switch to focus mode
LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance());
gViewerWindow->hideCursor();
LLToolCamera::getInstance()->setMouseCapture(TRUE);
LLToolCamera::getInstance()->pickCallback(mPick);
if(gSavedSettings.getBOOL("ResetFocusOnSelfClick"))
{
gAgent.setFocusOnAvatar(TRUE, TRUE);
}
return TRUE;
}
// Could be first left-click on nothing
LLFirstUse::useLeftClickNoHit();
// Eat the event
return LLTool::handleMouseDown(x, y, mask);
}
if (!always_show && gAgent.leftButtonGrabbed())
{
// if the left button is grabbed, don't put up the pie menu
return LLTool::handleMouseDown(x, y, mask);
}
// Can't ignore children here.
LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE);
// Spawn pie menu
示例5: pickRightMouseDownCallback
// True if we handled the event.
BOOL LLToolPie::pickRightMouseDownCallback()
{
S32 x = mPick.mMousePt.mX;
S32 y = mPick.mMousePt.mY;
MASK mask = mPick.mKeyMask;
if (mPick.mPickType != LLPickInfo::PICK_LAND)
{
LLViewerParcelMgr::getInstance()->deselectLand();
}
// didn't click in any UI object, so must have clicked in the world
LLViewerObject *object = mPick.getObject();
LLViewerObject *parent = NULL;
if(object)
parent = object->getRootEdit();
// Can't ignore children here.
LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE);
// Spawn pie menu
if (mPick.mPickType == LLPickInfo::PICK_LAND)
{
LLParcelSelectionHandle selection = LLViewerParcelMgr::getInstance()->selectParcelAt( mPick.mPosGlobal );
gMenuHolder->setParcelSelection(selection);
gMenuLand->show(x, y);
showVisualContextMenuEffect();
}
else if (mPick.mObjectID == gAgent.getID() )
{
if(!gMenuAvatarSelf)
{
//either at very early startup stage or at late quitting stage,
//this event is ignored.
return TRUE ;
}
gMenuAvatarSelf->show(x, y);
}
else if (object)
{
gMenuHolder->setObjectSelection(LLSelectMgr::getInstance()->getSelection());
bool is_other_attachment = (object->isAttachment() && !object->isHUDAttachment() && !object->permYouOwner());
if (object->isAvatar()
|| is_other_attachment)
{
// Find the attachment's avatar
while( object && object->isAttachment())
{
object = (LLViewerObject*)object->getParent();
llassert(object);
}
if (!object)
{
return TRUE; // unexpected, but escape
}
// Object is an avatar, so check for mute by id.
LLVOAvatar* avatar = (LLVOAvatar*)object;
std::string name = avatar->getFullname();
std::string mute_msg;
if (LLMuteList::getInstance()->isMuted(avatar->getID(), avatar->getFullname()))
{
mute_msg = LLTrans::getString("UnmuteAvatar");
}
else
{
mute_msg = LLTrans::getString("MuteAvatar");
}
if (is_other_attachment)
{
gMenuAttachmentOther->getChild<LLUICtrl>("Avatar Mute")->setValue(mute_msg);
gMenuAttachmentOther->show(x, y);
}
else
{
gMenuAvatarOther->getChild<LLUICtrl>("Avatar Mute")->setValue(mute_msg);
gMenuAvatarOther->show(x, y);
}
}
else if (object->isAttachment())
{
gMenuAttachmentSelf->show(x, y);
}
else
{
// BUG: What about chatting child objects?
std::string name;
LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
if (node)
{
name = node->mName;
}
std::string mute_msg;
//.........这里部分代码省略.........
示例6: pickLeftMouseDownCallback
//.........这里部分代码省略.........
if (object)
{
gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
LLBBox bbox = object->getBoundingBoxAgent() ;
F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView());
F32 distance = bbox.getExtentLocal().magVec() * PADDING_FACTOR / atan(angle_of_view);
LLVector3 obj_to_cam = LLViewerCamera::getInstance()->getOrigin() - bbox.getCenterAgent();
obj_to_cam.normVec();
LLVector3d object_center_global = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent());
gAgentCamera.setCameraPosAndFocusGlobal(object_center_global + LLVector3d(obj_to_cam * distance),
object_center_global,
mPick.mObjectID );
}
}
return TRUE;
default:
// nothing
break;
}
}
// put focus back "in world"
gFocusMgr.setKeyboardFocus(NULL);
BOOL touchable = (object && object->flagHandleTouch())
|| (parent && parent->flagHandleTouch());
// Switch to grab tool if physical or triggerable
if (object &&
!object->isAvatar() &&
((object->usePhysics() || (parent && !parent->isAvatar() && parent->usePhysics())) || touchable)
)
{
gGrabTransientTool = this;
LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() );
return LLToolGrab::getInstance()->handleObjectHit( mPick );
}
LLHUDIcon* last_hit_hud_icon = mPick.mHUDIcon;
if (!object && last_hit_hud_icon && last_hit_hud_icon->getSourceObject())
{
LLFloaterScriptDebug::show(last_hit_hud_icon->getSourceObject()->getID());
}
// If left-click never selects or spawns a menu
// Eat the event.
if (!gSavedSettings.getBOOL("LeftClickShowMenu"))
{
// mouse already released
if (!mGrabMouseButtonDown)
{
return TRUE;
}
while( object && object->isAttachment() && !object->flagHandleTouch())
{
// don't pick avatar through hud attachment
if (object->isHUDAttachment())
{
break;
}
object = (LLViewerObject*)object->getParent();
}
if (object && object == gAgentAvatarp)
{
// we left clicked on avatar, switch to focus mode
LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance());
gViewerWindow->hideCursor();
LLToolCamera::getInstance()->setMouseCapture(TRUE);
LLToolCamera::getInstance()->pickCallback(mPick);
gAgentCamera.setFocusOnAvatar(TRUE, TRUE);
return TRUE;
}
//////////
// // Could be first left-click on nothing
// LLFirstUse::useLeftClickNoHit();
/////////
// Eat the event
return LLTool::handleMouseDown(x, y, mask);
}
if (gAgent.leftButtonGrabbed())
{
// if the left button is grabbed, don't put up the pie menu
return LLTool::handleMouseDown(x, y, mask);
}
// Can't ignore children here.
LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE);
// Spawn pie menu
LLTool::handleRightMouseDown(x, y, mask);
return TRUE;
}
示例7: updateText
void LLHoverView::updateText()
{
LLViewerObject* hit_object = getLastHoverObject();
std::string line;
mText.clear();
if ( hit_object )
{
if ( hit_object->isHUDAttachment() )
{
// no hover tips for HUD elements, since they can obscure
// what the HUD is displaying
return;
}
if ( hit_object->isAttachment() )
{
// get root of attachment then parent, which is avatar
LLViewerObject* root_edit = hit_object->getRootEdit();
if (!root_edit)
{
// Strange parenting issue, don't show any text
return;
}
hit_object = (LLViewerObject*)root_edit->getParent();
if (!hit_object)
{
// another strange parenting issue, bail out
return;
}
}
line.clear();
if (hit_object->isAvatar())
{
LLNameValue* title = hit_object->getNVPair("Title");
LLNameValue* firstname = hit_object->getNVPair("FirstName");
LLNameValue* lastname = hit_object->getNVPair("LastName");
if (firstname && lastname)
{
// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e)
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
{
line = RlvStrings::getAnonym(line.append(firstname->getString()).append(1, ' ').append(lastname->getString()));
}
else
{
// [/RLVa:KB]
if (title)
{
line.append(title->getString());
line.append(1, ' ');
}
line.append(firstname->getString());
line.append(1, ' ');
line.append(lastname->getString());
// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e)
}
// [/RLVa:KB]
}
else
{
line.append(LLTrans::getString("TooltipPerson"));
}
mText.push_back(line);
}
else
{
//
// We have hit a regular object (not an avatar or attachment)
//
//
// Default prefs will suppress display unless the object is interactive
//
BOOL suppressObjectHoverDisplay = !gSavedSettings.getBOOL("ShowAllObjectHoverTip");
LLSelectNode *nodep = LLSelectMgr::getInstance()->getHoverNode();;
if (nodep)
{
line.clear();
if (nodep->mName.empty())
{
line.append(LLTrans::getString("TooltipNoName"));
}
else
{
line.append( nodep->mName );
}
mText.push_back(line);
if (!nodep->mDescription.empty()
&& nodep->mDescription != DEFAULT_DESC)
{
mText.push_back( nodep->mDescription );
}
// Line: "Owner: James Linden"
line.clear();
line.append(LLTrans::getString("TooltipOwner") + " ");
//.........这里部分代码省略.........
示例8: updateText
void LLHoverView::updateText()
{
LLViewerObject* hit_object = getLastHoverObject();
std::string line;
//<singu>
if (hit_object == mLastTextHoverObject &&
!(mLastTextHoverObjectTimer.getStarted() && mLastTextHoverObjectTimer.hasExpired()))
{
// mText is already up to date.
return;
}
mLastTextHoverObject = hit_object;
mLastTextHoverObjectTimer.stop();
bool retrieving_data = false;
//</singu>
mText.clear();
if ( hit_object )
{
if ( hit_object->isHUDAttachment() )
{
// no hover tips for HUD elements, since they can obscure
// what the HUD is displaying
return;
}
if ( hit_object->isAttachment() )
{
// get root of attachment then parent, which is avatar
LLViewerObject* root_edit = hit_object->getRootEdit();
if (!root_edit)
{
// Strange parenting issue, don't show any text
return;
}
hit_object = (LLViewerObject*)root_edit->getParent();
if (!hit_object)
{
// another strange parenting issue, bail out
return;
}
}
line.clear();
if (hit_object->isAvatar())
{
LLNameValue* title = hit_object->getNVPair("Title");
LLNameValue* firstname = hit_object->getNVPair("FirstName");
LLNameValue* lastname = hit_object->getNVPair("LastName");
if (firstname && lastname)
{
// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e)
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
{
line = RlvStrings::getAnonym(line.append(firstname->getString()).append(1, ' ').append(lastname->getString()));
}
else
{
// [/RLVa:KB]
std::string complete_name;
if (!LLAvatarNameCache::getNSName(hit_object->getID(), complete_name))
complete_name = firstname->getString() + std::string(" ") + lastname->getString();
if (title)
{
line.append(title->getString());
line.append(1, ' ');
}
line += complete_name;
// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e)
}
// [/RLVa:KB]
}
else
{
line.append(LLTrans::getString("TooltipPerson"));
}
mText.push_back(line);
}
else
{
//
// We have hit a regular object (not an avatar or attachment)
//
//
// Default prefs will suppress display unless the object is interactive
//
BOOL suppressObjectHoverDisplay = !gSavedSettings.getBOOL("ShowAllObjectHoverTip");
LLSelectNode *nodep = LLSelectMgr::getInstance()->getHoverNode();
if (nodep)
{
line.clear();
bool for_copy = nodep->mValid && nodep->mPermissions->getMaskEveryone() & PERM_COPY && hit_object && hit_object->permCopy();
bool for_sale = nodep->mValid && for_sale_selection(nodep);
//.........这里部分代码省略.........
示例9: updateGain
void LLAudioSourceVO::updateGain()
{
if (!mObjectp)
{
return;
}
BOOL mute = FALSE;
LLVector3d pos_global;
if (mObjectp->isAttachment())
{
LLViewerObject* parent = mObjectp;
while (parent && !parent->isAvatar())
{
parent = (LLViewerObject*)parent->getParent();
}
if (parent)
{
pos_global = parent->getPositionGlobal();
}
}
else
{
pos_global = mObjectp->getPositionGlobal();
}
if (!LLViewerParcelMgr::getInstance()->canHearSound(pos_global))
{
mute = TRUE;
}
if (!mute)
{
if (LLMuteList::getInstance()->isMuted(mObjectp->getID()))
{
mute = TRUE;
}
else if (LLMuteList::getInstance()->isMuted(mOwnerID, LLMute::flagObjectSounds))
{
mute = TRUE;
}
else if (mObjectp->isAttachment())
{
LLViewerObject* parent = mObjectp;
while (parent && !parent->isAvatar())
{
parent = (LLViewerObject*)parent->getParent();
}
if (parent
&& LLMuteList::getInstance()->isMuted(parent->getID()))
{
mute = TRUE;
}
}
}
if (!mute)
{
mGain = mActualGain;
}
else
{
mGain = 0.f;
}
}
示例10: processObjectUpdate
//.........这里部分代码省略.........
}
if (!objectp)
{
if (compressed)
{
if (update_type == OUT_TERSE_IMPROVED)
{
// llinfos << "terse update for an unknown object:" << fullid << llendl;
continue;
}
}
else if (cached)
{
}
else
{
if (update_type != OUT_FULL)
{
// llinfos << "terse update for an unknown object:" << fullid << llendl;
continue;
}
mesgsys->getU8Fast(_PREHASH_ObjectData, _PREHASH_PCode, pcode, i);
}
#ifdef IGNORE_DEAD
if (mDeadObjects.find(fullid) != mDeadObjects.end())
{
mNumDeadObjectUpdates++;
// llinfos << "update for a dead object:" << fullid << llendl;
continue;
}
#endif
objectp = createObject(pcode, regionp, fullid, local_id, gMessageSystem->getSender());
if (!objectp)
{
continue;
}
justCreated = TRUE;
mNumNewObjects++;
}
if (objectp->isDead())
{
llwarns << "Dead object " << objectp->mID << " in UUID map 1!" << llendl;
}
if (compressed)
{
if (update_type != OUT_TERSE_IMPROVED)
{
objectp->mLocalID = local_id;
}
processUpdateCore(objectp, user_data, i, update_type, &compressed_dp, justCreated);
if (update_type != OUT_TERSE_IMPROVED)
{
objectp->mRegionp->cacheFullUpdate(objectp, compressed_dp);
}
}
else if (cached)
{
objectp->mLocalID = local_id;
processUpdateCore(objectp, user_data, i, update_type, cached_dpp, justCreated);
}
else
{
if (update_type == OUT_FULL)
{
objectp->mLocalID = local_id;
}
processUpdateCore(objectp, user_data, i, update_type, NULL, justCreated);
}
// <edit>
if(justCreated && LLXmlImport::sImportInProgress)
{
if(objectp)
{
LLViewerObject* parent = (LLViewerObject*)objectp->getParent();
if(parent)
{
if(parent->getID() == gAgent.getID())
{
LLXmlImport::onNewAttachment(objectp);
}
}
else if( objectp->permYouOwner()
&& (objectp->getPCode() == LLXmlImport::sSupplyParams->getPCode())
&& (objectp->getScale() == LLXmlImport::sSupplyParams->getScale()))
{
LLXmlImport::onNewPrim(objectp);
}
}
}
// </edit>
}
LLVOAvatar::cullAvatarsByPixelArea();
}
示例11: updateMute
void LLAudioSourceVO::updateMute()
{
if (!mObjectp || mObjectp->isDead())
{
mSourceMuted = true;
return;
}
bool mute = false;
LLVector3d pos_global;
if (mObjectp->isAttachment())
{
LLViewerObject* parent = mObjectp;
while (parent && !parent->isAvatar())
{
parent = (LLViewerObject*)parent->getParent();
}
if (parent)
{
pos_global = parent->getPositionGlobal();
}
}
else
{
pos_global = mObjectp->getPositionGlobal();
}
if (!LLViewerParcelMgr::getInstance()->canHearSound(pos_global))
{
mute = true;
}
if (!mute)
{
if (LLMuteList::getInstance()->isMuted(mObjectp->getID()))
{
mute = true;
}
else if (LLMuteList::getInstance()->isMuted(mOwnerID, LLMute::flagObjectSounds))
{
mute = true;
}
else if (mObjectp->isAttachment())
{
LLViewerObject* parent = mObjectp;
while (parent && !parent->isAvatar())
{
parent = (LLViewerObject*)parent->getParent();
}
if (parent
&& LLMuteList::getInstance()->isMuted(parent->getID()))
{
mute = true;
}
}
}
if (mute != mSourceMuted)
{
mSourceMuted = mute;
if (mSourceMuted)
{
// Stop the sound.
this->play(LLUUID::null);
}
else
{
// Muted sounds keep there data at all times, because
// it's the place where the audio UUID is stored.
// However, it's possible that mCurrentDatap is
// NULL when this source did only preload sounds.
if (mCurrentDatap)
{
// Restart the sound.
this->play(mCurrentDatap->getID());
}
}
}
}
示例12: pickAndShowMenu
//.........这里部分代码省略.........
!object->isAvatar() &&
((object->usePhysics() || (parent && !parent->isAvatar() && parent->usePhysics())) || touchable) &&
!always_show)
{
gGrabTransientTool = this;
LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() );
return LLToolGrab::getInstance()->handleObjectHit( mPick );
}
LLHUDIcon* last_hit_hud_icon = mPick.mHUDIcon;
if (!object && last_hit_hud_icon && last_hit_hud_icon->getSourceObject())
{
LLFloaterScriptDebug::show(last_hit_hud_icon->getSourceObject()->getID());
}
// If left-click never selects or spawns a menu
// Eat the event.
if (!gSavedSettings.getBOOL("LeftClickShowMenu")
&& !always_show)
{
// mouse already released
if (!mGrabMouseButtonDown)
{
return TRUE;
}
while( object && object->isAttachment() && !object->flagHandleTouch())
{
// don't pick avatar through hud attachment
if (object->isHUDAttachment())
{
break;
}
object = (LLViewerObject*)object->getParent();
}
if (object && object == gAgent.getAvatarObject())
{
// we left clicked on avatar, switch to focus mode
LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance());
gViewerWindow->hideCursor();
LLToolCamera::getInstance()->setMouseCapture(TRUE);
LLToolCamera::getInstance()->pickCallback(mPick);
gAgent.setFocusOnAvatar(TRUE, TRUE);
return TRUE;
}
// Could be first left-click on nothing
LLFirstUse::useLeftClickNoHit();
// Eat the event
return LLTool::handleMouseDown(x, y, mask);
}
if (!always_show && gAgent.leftButtonGrabbed())
{
// if the left button is grabbed, don't put up the pie menu
return LLTool::handleMouseDown(x, y, mask);
}
// Can't ignore children here.
LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE);
// Spawn pie menu
if (mPick.mPickType == LLPickInfo::PICK_LAND)
{
LLParcelSelectionHandle selection = LLViewerParcelMgr::getInstance()->selectParcelAt( mPick.mPosGlobal );