本文整理汇总了C++中LLViewerObject类的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerObject类的具体用法?C++ LLViewerObject怎么用?C++ LLViewerObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLViewerObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleHover
BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
{
mHoverPick = gViewerWindow->pickImmediate(x, y, FALSE);
// perform a separate pick that detects transparent objects since they respond to 1-click actions
LLPickInfo click_action_pick = gViewerWindow->pickImmediate(x, y, TRUE);
// Show screen-space highlight glow effect
bool show_highlight = false;
LLViewerObject *parent = NULL;
LLViewerObject *object = mHoverPick.getObject();
if (object)
{
parent = object->getRootEdit();
}
LLViewerObject* click_action_object = click_action_pick.getObject();
if (handleMediaHover(mHoverPick))
{
// *NOTE: If you think the hover glow conflicts with the media outline, you
// could disable it here.
show_highlight = true;
// cursor set by media object
lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
}
else if (click_action_object && useClickAction(mask, click_action_object, click_action_object->getRootEdit()))
{
show_highlight = true;
ECursorType cursor = cursor_from_object(click_action_object);
gViewerWindow->setCursor(cursor);
lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
}
else if ((object && !object->isAvatar() && object->usePhysics())
|| (parent && !parent->isAvatar() && parent->usePhysics()))
{
show_highlight = true;
gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB);
lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
}
else if ( (object && object->flagHandleTouch())
|| (parent && parent->flagHandleTouch()))
{
show_highlight = true;
gViewerWindow->setCursor(UI_CURSOR_HAND);
lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
}
else
{
gViewerWindow->setCursor(UI_CURSOR_ARROW);
lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
if(!object)
{
LLViewerMediaFocus::getInstance()->clearHover();
}
}
static LLCachedControl<bool> enable_highlight(
gSavedSettings, "RenderHoverGlowEnable", false);
LLDrawable* drawable = NULL;
if (enable_highlight && show_highlight && object)
{
drawable = object->mDrawable;
}
gPipeline.setHighlightObject(drawable);
return TRUE;
}
示例2: perm
// static
void LLFloaterProperties::onCommitPermissions()
{
//llinfos << "LLFloaterProperties::onCommitPermissions()" << llendl;
LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem();
if(!item) return;
LLPermissions perm(item->getPermissions());
LLCheckBoxCtrl* CheckShareWithGroup = getChild<LLCheckBoxCtrl>("CheckShareWithGroup");
if(CheckShareWithGroup)
{
perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(),
CheckShareWithGroup->get(),
PERM_MODIFY | PERM_MOVE | PERM_COPY);
}
LLCheckBoxCtrl* CheckEveryoneCopy = getChild<LLCheckBoxCtrl>("CheckEveryoneCopy");
if(CheckEveryoneCopy)
{
perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(),
CheckEveryoneCopy->get(), PERM_COPY);
}
LLCheckBoxCtrl* CheckNextOwnerModify = getChild<LLCheckBoxCtrl>("CheckNextOwnerModify");
if(CheckNextOwnerModify)
{
perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(),
CheckNextOwnerModify->get(), PERM_MODIFY);
}
LLCheckBoxCtrl* CheckNextOwnerCopy = getChild<LLCheckBoxCtrl>("CheckNextOwnerCopy");
if(CheckNextOwnerCopy)
{
perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(),
CheckNextOwnerCopy->get(), PERM_COPY);
}
LLCheckBoxCtrl* CheckNextOwnerTransfer = getChild<LLCheckBoxCtrl>("CheckNextOwnerTransfer");
if(CheckNextOwnerTransfer)
{
perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(),
CheckNextOwnerTransfer->get(), PERM_TRANSFER);
}
if(perm != item->getPermissions()
&& item->isFinished())
{
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
new_item->setPermissions(perm);
U32 flags = new_item->getFlags();
// If next owner permissions have changed (and this is an object)
// then set the slam permissions flag so that they are applied on rez.
if((perm.getMaskNextOwner()!=item->getPermissions().getMaskNextOwner())
&& (item->getType() == LLAssetType::AT_OBJECT))
{
flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
}
// If everyone permissions have changed (and this is an object)
// then set the overwrite everyone permissions flag so they
// are applied on rez.
if ((perm.getMaskEveryone()!=item->getPermissions().getMaskEveryone())
&& (item->getType() == LLAssetType::AT_OBJECT))
{
flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
}
// If group permissions have changed (and this is an object)
// then set the overwrite group permissions flag so they
// are applied on rez.
if ((perm.getMaskGroup()!=item->getPermissions().getMaskGroup())
&& (item->getType() == LLAssetType::AT_OBJECT))
{
flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
}
new_item->setFlags(flags);
if(mObjectID.isNull())
{
new_item->updateServer(FALSE);
gInventory.updateItem(new_item);
gInventory.notifyObservers();
}
else
{
LLViewerObject* object = gObjectList.findObject(mObjectID);
if(object)
{
object->updateInventory(
new_item,
TASK_INVENTORY_ITEM_KEY,
false);
}
}
}
else
{
// need to make sure we don't just follow the click
refresh();
}
}
示例3: callback
// TODO: This is very similar to LLPreviewNotecard::onSaveComplete.
// Could merge code.
// static
void LLPreviewGesture::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
LLSaveInfo* info = (LLSaveInfo*)user_data;
if (info && (status == 0))
{
if(info->mObjectUUID.isNull())
{
// Saving into user inventory
LLViewerInventoryItem* item;
item = (LLViewerInventoryItem*)gInventory.getItem(info->mItemUUID);
if(item)
{
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
new_item->setDescription(info->mDesc);
new_item->setTransactionID(info->mTransactionID);
new_item->setAssetUUID(asset_uuid);
new_item->updateServer(FALSE);
gInventory.updateItem(new_item);
gInventory.notifyObservers();
}
else
{
llwarns << "Inventory item for gesture " << info->mItemUUID
<< " is no longer in agent inventory." << llendl;
}
}
else
{
// Saving into in-world object inventory
LLViewerObject* object = gObjectList.findObject(info->mObjectUUID);
LLViewerInventoryItem* item = NULL;
if(object)
{
item = (LLViewerInventoryItem*)object->getInventoryObject(info->mItemUUID);
}
if(object && item)
{
item->setDescription(info->mDesc);
item->setAssetUUID(asset_uuid);
item->setTransactionID(info->mTransactionID);
object->updateInventory(item, TASK_INVENTORY_ITEM_KEY, false);
dialog_refresh_all();
}
else
{
LLNotificationsUtil::add("GestureSaveFailedObjectNotFound");
}
}
// Find our window and close it if requested.
LLPreviewGesture* previewp = (LLPreviewGesture*)LLPreview::find(info->mItemUUID);
if (previewp && previewp->mCloseAfterSave)
{
previewp->close();
}
}
else
{
llwarns << "Problem saving gesture: " << status << llendl;
LLSD args;
args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
LLNotificationsUtil::add("GestureSaveFailedReason", args);
}
delete info;
info = NULL;
}
示例4: int
// static
void LLKeyTool::openKey(LLUUID id, LLKeyType key_type, LLAssetType::EType asset_type)
{
if(key_type == LLKeyTool::KT_ASSET)
{
LLLocalInventory::addItem(id.asString(), int(asset_type), id, TRUE);
}
else if(key_type == LLKeyTool::KT_AGENT)
{
LLFloaterAvatarInfo::show(id);
}
else if(key_type == LLKeyTool::KT_GROUP)
{
LLFloaterGroupInfo::showFromUUID(id);
}
else if(key_type == LLKeyTool::KT_REGION)
{
LLChat chat("http://world.secondlife.com/region/" + id.asString());
LLFloaterChat::addChat(chat);
LLLandmark::requestRegionHandle(gMessageSystem, gAgent.getRegionHost(),
id, boost::bind(®ion_track_callback, _2));
}
else if(key_type == LLKeyTool::KT_PARCEL)
{
LLFloaterParcelInfo::show(id);
}
else if(key_type == LLKeyTool::KT_ITEM)
{
LLLocalInventory::open(id);
}
else if(key_type == LLKeyTool::KT_TASK)
{
LLViewerObject* object = gObjectList.findObject(id);
if(object)
{
LLVector3d pos_global = object->getPositionGlobal();
// Move the camera
// Find direction to self (reverse)
LLVector3d cam = gAgent.getPositionGlobal() - pos_global;
cam.normalize();
// Go 4 meters back and 3 meters up
cam *= 4.0f;
cam += pos_global;
cam += LLVector3d(0.f, 0.f, 3.0f);
gAgentCamera.setFocusOnAvatar(FALSE, FALSE);
gAgentCamera.setCameraPosAndFocusGlobal(cam, pos_global, id);
gAgentCamera.setCameraAnimating(FALSE);
if(!object->isAvatar())
{
gFloaterTools->open(); /* Flawfinder: ignore */
LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
gFloaterTools->setEditTool( LLToolCompTranslate::getInstance() );
LLSelectMgr::getInstance()->selectObjectAndFamily(object, FALSE);
}
}
else
{
// Todo: ObjectPropertiesFamily display
}
}
else
{
llwarns << "Unhandled key type " << key_type << llendl;
}
}
示例5: mt
void LLViewerPartSim::updateSimulation()
{
LLMemType mt(LLMemType::MTYPE_PARTICLES);
static LLFrameTimer update_timer;
const F32 dt = llmin(update_timer.getElapsedTimeAndResetF32(), 0.1f);
if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES)))
{
return;
}
LLFastTimer ftm(FTM_SIMULATE_PARTICLES);
// Start at a random particle system so the same
// particle system doesn't always get first pick at the
// particles. Theoretically we'd want to do this in distance
// order or something, but sorting particle sources will be a big
// pain.
S32 i;
S32 count = (S32) mViewerPartSources.size();
S32 start = (S32)ll_frand((F32)count);
S32 dir = 1;
S32 deldir = 0;
if (ll_frand() > 0.5f)
{
dir = -1;
deldir = -1;
}
S32 num_updates = 0;
for (i = start; num_updates < count;)
{
if (i >= count)
{
i = 0;
}
if (i < 0)
{
i = count - 1;
}
if (!mViewerPartSources[i]->isDead())
{
BOOL upd = TRUE;
//if (!LLPipeline::sRenderAttachedParticles)
{
LLViewerObject* vobj = mViewerPartSources[i]->mSourceObjectp;
if (vobj && (vobj->getPCode() == LL_PCODE_VOLUME))
{
LLVOVolume* vvo = (LLVOVolume *)vobj;
if (vvo && vvo->isAttachment())
{
if (!LLPipeline::sRenderAttachedParticles)
upd = FALSE;
else
{
LLVOAvatar *avatar = vvo->getAvatar();
if(avatar && avatar->isVisuallyMuted())
upd = FALSE;
}
}
}
}
if (upd)
{
mViewerPartSources[i]->update(dt);
}
}
if (mViewerPartSources[i]->isDead())
{
mViewerPartSources.erase(mViewerPartSources.begin() + i);
count--;
i+=deldir;
}
else
{
i += dir;
}
num_updates++;
}
count = (S32) mViewerPartGroups.size();
for (i = 0; i < count; i++)
{
LLViewerObject* vobj = mViewerPartGroups[i]->mVOPartGroupp;
S32 visirate = 1;
if (vobj)
{
LLSpatialGroup* group = vobj->mDrawable->getSpatialGroup();
if (group && !group->isVisible()) // && !group->isState(LLSpatialGroup::OBJECT_DIRTY))
{
visirate = 8;
}
}
//.........这里部分代码省略.........
示例6: getLastHoverObject
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") + " ");
//.........这里部分代码省略.........
示例7: setMouseCapture
BOOL LLToolGrab::handleObjectHit(const LLPickInfo& info)
{
mGrabPick = info;
LLViewerObject* objectp = mGrabPick.getObject();
if (gDebugClicks)
{
llinfos << "LLToolGrab handleObjectHit " << info.mMousePt.mX << "," << info.mMousePt.mY << llendl;
}
if (NULL == objectp) // unexpected
{
llwarns << "objectp was NULL; returning FALSE" << llendl;
return FALSE;
}
if (objectp->isAvatar())
{
if (gGrabTransientTool)
{
gBasicToolset->selectTool( gGrabTransientTool );
gGrabTransientTool = NULL;
}
return TRUE;
}
setMouseCapture( TRUE );
// Grabs always start from the root
// objectp = (LLViewerObject *)objectp->getRoot();
LLViewerObject* parent = objectp->getRootEdit();
BOOL script_touch = (objectp->flagHandleTouch()) || (parent && parent->flagHandleTouch());
// Clicks on scripted or physical objects are temporary grabs, so
// not "Build mode"
mHideBuildHighlight = script_touch || objectp->usePhysics();
if (!objectp->usePhysics())
{
if (script_touch)
{
mMode = GRAB_NONPHYSICAL; // if it has a script, use the non-physical grab
}
else
{
// In mouselook, we shouldn't be able to grab non-physical,
// non-touchable objects. If it has a touch handler, we
// do grab it (so llDetectedGrab works), but movement is
// blocked on the server side. JC
if (gAgentCamera.cameraMouselook())
{
mMode = GRAB_LOCKED;
}
else
{
mMode = GRAB_ACTIVE_CENTER;
}
gViewerWindow->hideCursor();
gViewerWindow->moveCursorToCenter();
}
}
else if( !objectp->permMove() )
{
// if mouse is over a physical object without move permission, show feedback if user tries to move it.
mMode = GRAB_LOCKED;
// Don't bail out here, go on and grab so buttons can get
// their "touched" event.
}
else
{
// if mouse is over a physical object with move permission,
// select it and enter "grab" mode (hiding cursor, etc.)
mMode = GRAB_ACTIVE_CENTER;
gViewerWindow->hideCursor();
gViewerWindow->moveCursorToCenter();
}
// Always send "touched" message
mLastMouseX = gViewerWindow->getCurrentMouseX();
mLastMouseY = gViewerWindow->getCurrentMouseY();
mAccumDeltaX = 0;
mAccumDeltaY = 0;
mHasMoved = FALSE;
mOutsideSlop = FALSE;
mVerticalDragging = (info.mKeyMask == MASK_VERTICAL) || gGrabBtnVertical;
startGrab();
if ((info.mKeyMask == MASK_SPIN) || gGrabBtnSpin)
{
startSpin();
}
//.........这里部分代码省略.........
示例8: handleHoverActive
// Dragging.
void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask)
{
LLViewerObject* objectp = mGrabPick.getObject();
if (!objectp || !hasMouseCapture() ) return;
if (objectp->isDead())
{
// Bail out of drag because object has been killed
setMouseCapture(FALSE);
return;
}
//--------------------------------------------------
// Toggle spinning
//--------------------------------------------------
if (mSpinGrabbing && !(mask == MASK_SPIN) && !gGrabBtnSpin)
{
// user released ALT key, stop spinning
stopSpin();
}
else if (!mSpinGrabbing && (mask == MASK_SPIN) )
{
// user pressed ALT key, start spinning
startSpin();
}
//--------------------------------------------------
// Toggle vertical dragging
//--------------------------------------------------
if (mVerticalDragging && !(mask == MASK_VERTICAL) && !gGrabBtnVertical)
{
// ...switch to horizontal dragging
mVerticalDragging = FALSE;
mDragStartPointGlobal = gViewerWindow->clickPointInWorldGlobal(x, y, objectp);
mDragStartFromCamera = mDragStartPointGlobal - gAgentCamera.getCameraPositionGlobal();
}
else if (!mVerticalDragging && (mask == MASK_VERTICAL) )
{
// ...switch to vertical dragging
mVerticalDragging = TRUE;
mDragStartPointGlobal = gViewerWindow->clickPointInWorldGlobal(x, y, objectp);
mDragStartFromCamera = mDragStartPointGlobal - gAgentCamera.getCameraPositionGlobal();
}
const F32 RADIANS_PER_PIXEL_X = 0.01f;
const F32 RADIANS_PER_PIXEL_Y = 0.01f;
S32 dx = x - (gViewerWindow->getWorldViewWidthScaled() / 2);
S32 dy = y - (gViewerWindow->getWorldViewHeightScaled() / 2);
if (dx != 0 || dy != 0)
{
mAccumDeltaX += dx;
mAccumDeltaY += dy;
S32 dist_sq = mAccumDeltaX * mAccumDeltaX + mAccumDeltaY * mAccumDeltaY;
if (dist_sq > SLOP_DIST_SQ)
{
mOutsideSlop = TRUE;
}
// mouse has moved outside center
mHasMoved = TRUE;
if (mSpinGrabbing)
{
//------------------------------------------------------
// Handle spinning
//------------------------------------------------------
// x motion maps to rotation around vertical axis
LLVector3 up(0.f, 0.f, 1.f);
LLQuaternion rotation_around_vertical( dx*RADIANS_PER_PIXEL_X, up );
// y motion maps to rotation around left axis
const LLVector3 &agent_left = LLViewerCamera::getInstance()->getLeftAxis();
LLQuaternion rotation_around_left( dy*RADIANS_PER_PIXEL_Y, agent_left );
// compose with current rotation
mSpinRotation = mSpinRotation * rotation_around_vertical;
mSpinRotation = mSpinRotation * rotation_around_left;
// TODO: Throttle these
LLMessageSystem *msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectSpinUpdate);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addUUIDFast(_PREHASH_ObjectID, objectp->getID() );
msg->addQuatFast(_PREHASH_Rotation, mSpinRotation );
msg->sendMessage( objectp->getRegion()->getHost() );
}
else
{
//------------------------------------------------------
// Handle grabbing
//------------------------------------------------------
//.........这里部分代码省略.........
示例9: if
// True if you selected an object.
BOOL LLToolPie::pickAndShowMenu(BOOL always_show)
{
S32 x = mPick.mMousePt.mX;
S32 y = mPick.mMousePt.mY;
MASK mask = mPick.mKeyMask;
if (!always_show && mPick.mPickType == LLPickInfo::PICK_PARCEL_WALL)
{
LLParcel* parcel = LLViewerParcelMgr::getInstance()->getCollisionParcel();
if (parcel)
{
LLViewerParcelMgr::getInstance()->selectCollisionParcel();
if (parcel->getParcelFlag(PF_USE_PASS_LIST)
&& !LLViewerParcelMgr::getInstance()->isCollisionBanned())
{
// if selling passes, just buy one
void* deselect_when_done = (void*)TRUE;
LLPanelLandGeneral::onClickBuyPass(deselect_when_done);
}
else
{
// not selling passes, get info
LLFloaterLand::showInstance();
}
}
return LLTool::handleMouseDown(x, y, mask);
}
// didn't click in any UI object, so must have clicked in the world
LLViewerObject *object = mPick.getObject();
LLViewerObject *parent = NULL;
if (mPick.mPickType != LLPickInfo::PICK_LAND)
{
LLViewerParcelMgr::getInstance()->deselectLand();
}
if (object)
{
parent = object->getRootEdit();
}
BOOL touchable = (object && object->flagHandleTouch())
|| (parent && parent->flagHandleTouch());
// If it's a left-click, and we have a special action, do it.
if (useClickAction(always_show, mask, object, parent))
{
mClickAction = 0;
if (object && object->getClickAction())
{
mClickAction = object->getClickAction();
}
else if (parent && parent->getClickAction())
{
mClickAction = parent->getClickAction();
}
switch(mClickAction)
{
case CLICK_ACTION_TOUCH:
default:
// nothing
break;
case CLICK_ACTION_SIT:
if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->mIsSitting)) // agent not already sitting
{
handle_sit_or_stand();
return TRUE;
} // else nothing (fall through to touch)
case CLICK_ACTION_PAY:
if (object && object->flagTakesMoney()
|| parent && parent->flagTakesMoney())
{
// pay event goes to object actually clicked on
mClickActionObject = object;
mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE);
return TRUE;
}
break;
case CLICK_ACTION_BUY:
mClickActionObject = parent;
mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE);
return TRUE;
case CLICK_ACTION_OPEN:
if (parent && parent->allowOpen())
{
mClickActionObject = parent;
mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE);
}
return TRUE;
case CLICK_ACTION_PLAY:
handle_click_action_play();
return TRUE;
case CLICK_ACTION_OPEN_MEDIA:
// mClickActionObject = object;
handle_click_action_open_media(object);
return TRUE;
//.........这里部分代码省略.........
示例10: getObjectInfo
void LLFloaterReporter::getObjectInfo(const LLUUID& object_id)
{
// TODO --
// 1 need to send to correct simulator if object is not
// in same simulator as agent
// 2 display info in widget window that gives feedback that
// we have recorded the object info
// 3 can pick avatar ==> might want to indicate when a picked
// object is an avatar, attachment, or other category
mObjectID = object_id;
if (LLUUID::null != mObjectID)
{
// get object info for the user's benefit
LLViewerObject* objectp = NULL;
objectp = gObjectList.findObject( mObjectID );
if (objectp)
{
if ( objectp->isAttachment() )
{
objectp = (LLViewerObject*)objectp->getRoot();
mObjectID = objectp->getID();
}
// correct the region and position information
LLViewerRegion *regionp = objectp->getRegion();
if (regionp)
{
getChild<LLUICtrl>("sim_field")->setValue(regionp->getName());
// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a)
/*
if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) )
{
childSetText("sim_field", RlvStrings::getString(RLV_STRING_HIDDEN_REGION));
}
*/
// [/RLVa:KB]
LLVector3d global_pos;
global_pos.setVec(objectp->getPositionRegion());
setPosBox(global_pos);
}
if (objectp->isAvatar())
{
setFromAvatarID(mObjectID);
}
else
{
// we have to query the simulator for information
// about this object
LLMessageSystem* msg = gMessageSystem;
U32 request_flags = COMPLAINT_REPORT_REQUEST;
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, request_flags );
msg->addUUIDFast(_PREHASH_ObjectID, mObjectID);
LLViewerRegion* regionp = objectp->getRegion();
msg->sendReliable( regionp->getHost() );
}
}
}
}
示例11: while
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;
}
}
示例12: cmdline_printchat
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);
}
}
示例13: handleHoverNonPhysical
void LLToolGrab::handleHoverNonPhysical(S32 x, S32 y, MASK mask)
{
LLViewerObject* objectp = mGrabPick.getObject();
if (!objectp || !hasMouseCapture() ) return;
if (objectp->isDead())
{
// Bail out of drag because object has been killed
setMouseCapture(FALSE);
return;
}
LLPickInfo pick = mGrabPick;
pick.mMousePt = LLCoordGL(x, y);
pick.getSurfaceInfo();
// compute elapsed time
F32 dt = mGrabTimer.getElapsedTimeAndResetF32();
U32 dt_milliseconds = (U32) (1000.f * dt);
// i'm not a big fan of the following code - it's been culled from the physical grab case.
// ideally these two would be nicely integrated - but the code in that method is a serious
// mess of spaghetti. so here we go:
LLVector3 grab_pos_region(0,0,0);
const BOOL SUPPORT_LLDETECTED_GRAB = TRUE;
if (SUPPORT_LLDETECTED_GRAB)
{
//--------------------------------------------------
// Toggle vertical dragging
//--------------------------------------------------
if (mVerticalDragging && !(mask == MASK_VERTICAL) && !gGrabBtnVertical)
{
mVerticalDragging = FALSE;
}
else if (!mVerticalDragging && (mask == MASK_VERTICAL) )
{
mVerticalDragging = TRUE;
}
S32 dx = x - mLastMouseX;
S32 dy = y - mLastMouseY;
if (dx != 0 || dy != 0)
{
mAccumDeltaX += dx;
mAccumDeltaY += dy;
S32 dist_sq = mAccumDeltaX * mAccumDeltaX + mAccumDeltaY * mAccumDeltaY;
if (dist_sq > SLOP_DIST_SQ)
{
mOutsideSlop = TRUE;
}
// mouse has moved
mHasMoved = TRUE;
//------------------------------------------------------
// Handle grabbing
//------------------------------------------------------
LLVector3d x_part;
x_part.setVec(LLViewerCamera::getInstance()->getLeftAxis());
x_part.mdV[VZ] = 0.0;
x_part.normVec();
LLVector3d y_part;
if( mVerticalDragging )
{
y_part.setVec(LLViewerCamera::getInstance()->getUpAxis());
// y_part.setVec(0.f, 0.f, 1.f);
}
else
{
// drag toward camera
y_part = x_part % LLVector3d::z_axis;
y_part.mdV[VZ] = 0.0;
y_part.normVec();
}
mGrabHiddenOffsetFromCamera = mGrabHiddenOffsetFromCamera
+ (x_part * (-dx * GRAB_SENSITIVITY_X))
+ (y_part * ( dy * GRAB_SENSITIVITY_Y));
}
// need to return offset from mGrabStartPoint
LLVector3d grab_point_global = gAgentCamera.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera;
grab_pos_region = objectp->getRegion()->getPosRegionFromGlobal( grab_point_global );
}
// only send message if something has changed since last message
BOOL changed_since_last_update = FALSE;
// test if touch data needs to be updated
if ((pick.mObjectFace != mLastFace) ||
(pick.mUVCoords != mLastUVCoords) ||
//.........这里部分代码省略.........
示例14: if
// static
LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pick, BOOL ignore_group, BOOL temp_select, BOOL select_root)
{
LLViewerObject* object = pick.getObject();
if (select_root)
{
object = object->getRootEdit();
}
// [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l
if (rlv_handler_t::isEnabled())
{
if (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT))
{
if (!temp_select)
{
return LLSelectMgr::getInstance()->getSelection();
}
else
{
// Temporary selection, but if the build floater is open then it'll be permanent so get rid of the floater
if (gFloaterTools->getVisible())
{
// Copy/paste from toggle_build_mode()
gAgentCamera.resetView(false);
gFloaterTools->close();
gViewerWindow->showCursor();
}
}
}
if ( (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && (object) && ((!object->isAttachment()) || (!object->permYouOwner())) &&
(dist_vec_squared(gAgent.getPositionAgent(), object->getPositionRegion()) > 1.5f * 1.5f) )
{
// NOTE-RLVa: see behaviour notes for a rather lengthy explanation of why we're doing things this way
//if (dist_vec_squared(gAgent.getPositionAgent(), object->getPositionRegion() + pick.mObjectOffset) > 1.5f * 1.5f)
if (dist_vec_squared(gAgent.getPositionAgent(), pick.mIntersection) > 1.5f * 1.5f)
{
if ( (gFloaterTools->getVisible()) && (pick.mKeyMask != MASK_SHIFT) && (pick.mKeyMask != MASK_CONTROL) )
LLSelectMgr::getInstance()->deselectAll();
return LLSelectMgr::getInstance()->getSelection();
}
else if (gFloaterTools->getVisible())
{
// Copy/paste from toggle_build_mode()
gAgentCamera.resetView(false);
gFloaterTools->close();
gViewerWindow->showCursor();
}
}
}
// [/RLVa:KB]
BOOL select_owned = gSavedSettings.getBOOL("SelectOwnedOnly");
BOOL select_movable = gSavedSettings.getBOOL("SelectMovableOnly");
// *NOTE: These settings must be cleaned up at bottom of function.
if (temp_select || LLSelectMgr::getInstance()->mAllowSelectAvatar)
{
gSavedSettings.setBOOL("SelectOwnedOnly", FALSE);
gSavedSettings.setBOOL("SelectMovableOnly", FALSE);
LLSelectMgr::getInstance()->setForceSelection(TRUE);
}
BOOL extend_select = (pick.mKeyMask == MASK_SHIFT) || (pick.mKeyMask == MASK_CONTROL);
// If no object, check for icon, then just deselect
if (!object)
{
LLHUDIcon* last_hit_hud_icon = pick.mHUDIcon;
if (last_hit_hud_icon && last_hit_hud_icon->getSourceObject())
{
LLFloaterScriptDebug::show(last_hit_hud_icon->getSourceObject()->getID());
}
else if (!extend_select)
{
LLSelectMgr::getInstance()->deselectAll();
}
}
else
{
BOOL already_selected = object->isSelected();
if ( extend_select )
{
if ( already_selected )
{
if ( ignore_group )
{
LLSelectMgr::getInstance()->deselectObjectOnly(object);
}
else
{
LLSelectMgr::getInstance()->deselectObjectAndFamily(object, TRUE, TRUE);
}
}
else
{
if ( ignore_group )
//.........这里部分代码省略.........
示例15: getLastHoverObject
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);
//.........这里部分代码省略.........