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; }
// 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(); } }
// 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; }
// 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; } }
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; } } if ((LLDrawable::getCurrentFrame()+mViewerPartGroups[i]->mID)%visirate == 0) { if (vobj) { gPipeline.markRebuild(vobj->mDrawable, LLDrawable::REBUILD_ALL, TRUE); } mViewerPartGroups[i]->updateParticles(dt * visirate); mViewerPartGroups[i]->mSkippedTime=0.0f; if (!mViewerPartGroups[i]->getCount()) { delete mViewerPartGroups[i]; mViewerPartGroups.erase(mViewerPartGroups.begin() + i); i--; count--; } } else { mViewerPartGroups[i]->mSkippedTime+=dt; } } if (LLDrawable::getCurrentFrame()%16==0) { if (sParticleCount > sMaxParticleCount * 0.875f && sParticleAdaptiveRate < 2.0f) { sParticleAdaptiveRate *= PART_ADAPT_RATE_MULT; } else { if (sParticleCount < sMaxParticleCount * 0.5f && sParticleAdaptiveRate > 0.03125f) { sParticleAdaptiveRate *= PART_ADAPT_RATE_MULT_RECIP; } } } updatePartBurstRate() ; //llinfos << "Particles: " << sParticleCount << " Adaptive Rate: " << sParticleAdaptiveRate << llendl; }
virtual bool apply(LLViewerObject* objectp) { objectp->boostTexturePriority(); return true; }
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") + " "); if (nodep->mValid) { LLUUID owner; std::string name; if (!nodep->mPermissions->isGroupOwned()) { owner = nodep->mPermissions->getOwner(); if (LLUUID::null == owner) { line.append(LLTrans::getString("TooltipPublic")); } else if(gCacheName->getFullName(owner, name)) { // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { name = RlvStrings::getAnonym(name); } // [/RLVa:KB] line.append(name); } else { line.append(LLTrans::getString("RetrievingData")); } } else { std::string name; owner = nodep->mPermissions->getGroup(); if (gCacheName->getGroupName(owner, name)) { line.append(name); line.append(LLTrans::getString("TooltipIsGroup")); } else { line.append(LLTrans::getString("RetrievingData")); } } } else { line.append(LLTrans::getString("RetrievingData")); } mText.push_back(line); // Build a line describing any special properties of this object. LLViewerObject *object = hit_object; LLViewerObject *parent = (LLViewerObject *)object->getParent(); if (object && (object->usePhysics() || object->flagScripted() || object->flagHandleTouch() || (parent && parent->flagHandleTouch()) || object->flagTakesMoney() || (parent && parent->flagTakesMoney()) || object->flagAllowInventoryAdd() || object->flagTemporary() || object->flagPhantom()) ) { line.clear(); if (object->flagScripted()) { line.append(LLTrans::getString("TooltipFlagScript") + " "); } if (object->usePhysics()) { line.append(LLTrans::getString("TooltipFlagPhysics") + " "); } if (object->flagHandleTouch() || (parent && parent->flagHandleTouch()) ) { line.append(LLTrans::getString("TooltipFlagTouch") + " "); suppressObjectHoverDisplay = FALSE; // Show tip } if (object->flagTakesMoney() || (parent && parent->flagTakesMoney()) ) { line.append(LLTrans::getString("TooltipFlagL$") + " "); suppressObjectHoverDisplay = FALSE; // Show tip } if (object->flagAllowInventoryAdd()) { line.append(LLTrans::getString("TooltipFlagDropInventory") + " "); suppressObjectHoverDisplay = FALSE; // Show tip } if (object->flagPhantom()) { line.append(LLTrans::getString("TooltipFlagPhantom") + " "); } if (object->flagTemporary()) { line.append(LLTrans::getString("TooltipFlagTemporary") + " "); } if (object->usePhysics() || object->flagHandleTouch() || (parent && parent->flagHandleTouch()) ) { line.append(LLTrans::getString("TooltipFlagRightClickMenu") + " "); } mText.push_back(line); } // Free to copy / For Sale: L$ line.clear(); if (nodep->mValid) { BOOL for_copy = nodep->mPermissions->getMaskEveryone() & PERM_COPY && object->permCopy(); BOOL for_sale = nodep->mSaleInfo.isForSale() && nodep->mPermissions->getMaskOwner() & PERM_TRANSFER && (nodep->mPermissions->getMaskOwner() & PERM_COPY || nodep->mSaleInfo.getSaleType() != LLSaleInfo::FS_COPY); if (for_copy) { line.append(LLTrans::getString("TooltipFreeToCopy")); suppressObjectHoverDisplay = FALSE; // Show tip } else if (for_sale) { LLStringUtil::format_map_t args; args["[AMOUNT]"] = llformat("%d", nodep->mSaleInfo.getSalePrice()); line.append(LLTrans::getString("TooltipForSaleL$", args)); suppressObjectHoverDisplay = FALSE; // Show tip } else { // Nothing if not for sale // line.append("Not for sale"); } } else { LLStringUtil::format_map_t args; args["[MESSAGE]"] = LLTrans::getString("RetrievingData"); line.append(LLTrans::getString("TooltipForSaleMsg", args)); } mText.push_back(line); } line.clear(); S32 prim_count = LLSelectMgr::getInstance()->getHoverObjects()->getObjectCount(); line.append(llformat("Prims: %d", prim_count)); mText.push_back(line); line.clear(); line.append("Position: "); LLViewerRegion *region = gAgent.getRegion(); LLVector3 position = region->getPosRegionFromGlobal(hit_object->getPositionGlobal());//regionp->getOriginAgent(); LLVector3 mypos = region->getPosRegionFromGlobal(gAgent.getPositionGlobal()); LLVector3 delta = position - mypos; F32 distance = (F32)delta.magVec(); line.append(llformat("<%.02f,%.02f,%.02f>",position.mV[0],position.mV[1],position.mV[2])); mText.push_back(line); line.clear(); line.append(llformat("Distance: %.02fm",distance)); mText.push_back(line); // If the hover tip shouldn't be shown, delete all the object text if (suppressObjectHoverDisplay) { mText.clear(); } } } else if ( mHoverLandGlobal != LLVector3d::zero ) { // // Do not show hover for land unless prefs are set to allow it. // if (!gSavedSettings.getBOOL("ShowLandHoverTip")) return; // Didn't hit an object, but since we have a land point we // must be hovering over land. LLParcel* hover_parcel = LLViewerParcelMgr::getInstance()->getHoverParcel(); LLUUID owner; S32 width = 0; S32 height = 0; if ( hover_parcel ) { owner = hover_parcel->getOwnerID(); width = S32(LLViewerParcelMgr::getInstance()->getHoverParcelWidth()); height = S32(LLViewerParcelMgr::getInstance()->getHoverParcelHeight()); } // Line: "Land" line.clear(); line.append(LLTrans::getString("TooltipLand")); if (hover_parcel) { // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) | Added: RLVa-0.2.0b line.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? hover_parcel->getName() : RlvStrings::getString(RLV_STRING_HIDDEN_PARCEL) ); // [/RLVa:KB] //line.append(hover_parcel->getName()); } mText.push_back(line); // Line: "Owner: James Linden" line.clear(); line.append(LLTrans::getString("TooltipOwner") + " "); if ( hover_parcel ) { std::string name; if (LLUUID::null == owner) { line.append(LLTrans::getString("TooltipPublic")); } else if (hover_parcel->getIsGroupOwned()) { if (gCacheName->getGroupName(owner, name)) { line.append(name); line.append(LLTrans::getString("TooltipIsGroup")); } else { line.append(LLTrans::getString("RetrievingData")); } } else if(gCacheName->getFullName(owner, name)) { // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0b line.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? name : RlvStrings::getAnonym(name)); // [/RLVa:KB] //line.append(name); } else { line.append(LLTrans::getString("RetrievingData")); } } else { line.append(LLTrans::getString("RetrievingData")); } mText.push_back(line); // Line: "no fly, not safe, no build" // Don't display properties for your land. This is just // confusing, because you can do anything on your own land. if ( hover_parcel && owner != gAgent.getID() ) { S32 words = 0; line.clear(); // JC - Keep this in the same order as the checkboxes // on the land info panel if ( !hover_parcel->getAllowModify() ) { if ( hover_parcel->getAllowGroupModify() ) { line.append(LLTrans::getString("TooltipFlagGroupBuild")); } else { line.append(LLTrans::getString("TooltipFlagNoBuild")); } words++; } if ( !hover_parcel->getAllowTerraform() ) { if (words) line.append(", "); line.append(LLTrans::getString("TooltipFlagNoEdit")); words++; } if ( hover_parcel->getAllowDamage() ) { if (words) line.append(", "); line.append(LLTrans::getString("TooltipFlagNotSafe")); words++; } // Maybe we should reflect the estate's block fly bit here as well? DK 12/1/04 if ( !hover_parcel->getAllowFly() ) { if (words) line.append(", "); line.append(LLTrans::getString("TooltipFlagNoFly")); words++; } if ( !hover_parcel->getAllowOtherScripts() ) { if (words) line.append(", "); if ( hover_parcel->getAllowGroupScripts() ) { line.append(LLTrans::getString("TooltipFlagGroupScripts")); } else { line.append(LLTrans::getString("TooltipFlagNoScripts")); } words++; } if (words) { mText.push_back(line); } } // Line: "Size: 1x4" // Only show for non-public land /* if ( hover_parcel && LLUUID::null != owner) { line = llformat("Size: %dx%d", width, height ); mText.push_back(line); } */ if (hover_parcel && hover_parcel->getParcelFlag(PF_FOR_SALE)) { LLStringUtil::format_map_t args; args["[AMOUNT]"] = llformat("%d", hover_parcel->getSalePrice()); line = LLTrans::getString("TooltipForSaleL$", args); mText.push_back(line); } } }
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(); } LLSelectMgr::getInstance()->updateSelectionCenter(); // update selection beam // update point at LLViewerObject *edit_object = info.getObject(); if (edit_object && info.mPickType != LLPickInfo::PICK_FLORA) { LLVector3 local_edit_point = gAgent.getPosAgentFromGlobal(info.mPosGlobal); local_edit_point -= edit_object->getPositionAgent(); local_edit_point = local_edit_point * ~edit_object->getRenderRotation(); gAgentCamera.setPointAt(POINTAT_TARGET_GRAB, edit_object, local_edit_point ); gAgentCamera.setLookAt(LOOKAT_TARGET_SELECT, edit_object, local_edit_point ); } // on transient grabs (clicks on world objects), kill the grab immediately if (!gViewerWindow->getLeftMouseDown() && gGrabTransientTool && (mMode == GRAB_NONPHYSICAL || mMode == GRAB_LOCKED)) { gBasicToolset->selectTool( gGrabTransientTool ); gGrabTransientTool = NULL; } return TRUE; }
// 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 //------------------------------------------------------ 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)); // Send the message to the viewer. F32 dt = mGrabTimer.getElapsedTimeAndResetF32(); U32 dt_milliseconds = (U32) (1000.f * dt); // need to return offset from mGrabStartPoint LLVector3d grab_point_global; grab_point_global = gAgentCamera.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera; /* Snap to grid disabled for grab tool - very confusing // Handle snapping to grid, but only when the tool is formally selected. BOOL snap_on = gSavedSettings.getBOOL("SnapEnabled"); if (snap_on && !gGrabTransientTool) { F64 snap_size = gSavedSettings.getF32("GridResolution"); U8 snap_dimensions = (mVerticalDragging ? 3 : 2); for (U8 i = 0; i < snap_dimensions; i++) { grab_point_global.mdV[i] += snap_size / 2; grab_point_global.mdV[i] -= fmod(grab_point_global.mdV[i], snap_size); } } */ // Don't let object centers go underground. F32 land_height = LLWorld::getInstance()->resolveLandHeightGlobal(grab_point_global); if (grab_point_global.mdV[VZ] < land_height) { grab_point_global.mdV[VZ] = land_height; } // For safety, cap heights where objects can be dragged if (grab_point_global.mdV[VZ] > LLWorld::getInstance()->getRegionMaxHeight()) { grab_point_global.mdV[VZ] = LLWorld::getInstance()->getRegionMaxHeight(); } grab_point_global = LLWorld::getInstance()->clipToVisibleRegions(mDragStartPointGlobal, grab_point_global); // propagate constrained grab point back to grab offset mGrabHiddenOffsetFromCamera = grab_point_global - gAgentCamera.getCameraPositionGlobal(); // Handle auto-rotation at screen edge. LLVector3 grab_pos_agent = gAgent.getPosAgentFromGlobal( grab_point_global ); LLCoordGL grab_center_gl( gViewerWindow->getWorldViewWidthScaled() / 2, gViewerWindow->getWorldViewHeightScaled() / 2); LLViewerCamera::getInstance()->projectPosAgentToScreen(grab_pos_agent, grab_center_gl); const S32 ROTATE_H_MARGIN = gViewerWindow->getWorldViewWidthScaled() / 20; const F32 ROTATE_ANGLE_PER_SECOND = 30.f * DEG_TO_RAD; const F32 rotate_angle = ROTATE_ANGLE_PER_SECOND / gFPSClamped; // ...build mode moves camera about focus point if (grab_center_gl.mX < ROTATE_H_MARGIN) { if (gAgentCamera.getFocusOnAvatar()) { gAgent.yaw(rotate_angle); } else { gAgentCamera.cameraOrbitAround(rotate_angle); } } else if (grab_center_gl.mX > gViewerWindow->getWorldViewWidthScaled() - ROTATE_H_MARGIN) { if (gAgentCamera.getFocusOnAvatar()) { gAgent.yaw(-rotate_angle); } else { gAgentCamera.cameraOrbitAround(-rotate_angle); } } // Don't move above top of screen or below bottom if ((grab_center_gl.mY < gViewerWindow->getWorldViewHeightScaled() - 6) && (grab_center_gl.mY > 24)) { // Transmit update to simulator LLVector3 grab_pos_region = objectp->getRegion()->getPosRegionFromGlobal( grab_point_global ); LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectGrabUpdate); 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->addVector3Fast(_PREHASH_GrabOffsetInitial, mGrabOffsetFromCenterInitial ); msg->addVector3Fast(_PREHASH_GrabPosition, grab_pos_region ); msg->addU32Fast(_PREHASH_TimeSinceLast, dt_milliseconds ); msg->nextBlock("SurfaceInfo"); msg->addVector3("UVCoord", LLVector3(mGrabPick.mUVCoords)); msg->addVector3("STCoord", LLVector3(mGrabPick.mSTCoords)); msg->addS32Fast(_PREHASH_FaceIndex, mGrabPick.mObjectFace); msg->addVector3("Position", mGrabPick.mIntersection); msg->addVector3("Normal", mGrabPick.mNormal); msg->addVector3("Binormal", mGrabPick.mBinormal); msg->sendMessage( objectp->getRegion()->getHost() ); } } gViewerWindow->moveCursorToCenter(); LLSelectMgr::getInstance()->updateSelectionCenter(); } // once we've initiated a drag, lock the camera down if (mHasMoved) { if (!gAgentCamera.cameraMouselook() && !objectp->isHUDAttachment() && objectp->getRoot() == gAgentAvatarp->getRoot()) { // force focus to point in space where we were looking previously gAgentCamera.setFocusGlobal(gAgentCamera.calcFocusPositionTargetGlobal(), LLUUID::null); gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); } else { gAgentCamera.clearFocusObject(); } } // HACK to avoid assert: error checking system makes sure that the cursor is set during every handleHover. This is actually a no-op since the cursor is hidden. gViewerWindow->setCursor(UI_CURSOR_ARROW); lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGrab (active) [cursor hidden]" << llendl; }
// 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; } } // Switch to grab tool if physical or triggerable if (object && !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 ); gMenuHolder->setParcelSelection(selection); gPieLand->show(x, y, mPieMouseButtonDown); // VEFFECT: ShowPie LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); effectp->setPositionGlobal(mPick.mPosGlobal); effectp->setColor(LLColor4U(gAgent.getEffectColor())); effectp->setDuration(0.25f); } else if (mPick.mObjectID == gAgent.getID() ) { if(!gPieSelf) { //either at very early startup stage or at late quitting stage, //this event is ignored. return TRUE ; } gPieSelf->show(x, y, mPieMouseButtonDown); } else if (object) { gMenuHolder->setObjectSelection(LLSelectMgr::getInstance()->getSelection()); if (object->isAvatar() || (object->isAttachment() && !object->isHUDAttachment() && !object->permYouOwner())) { // Find the attachment's avatar while( object && object->isAttachment()) { object = (LLViewerObject*)object->getParent(); } // Object is an avatar, so check for mute by id. LLVOAvatar* avatar = (LLVOAvatar*)object; std::string name = avatar->getFullname(); if (LLMuteList::getInstance()->isMuted(avatar->getID(), name)) { gMenuHolder->childSetText("Avatar Mute", std::string("Unmute")); // *TODO:Translate //gMutePieMenu->setLabel("Unmute"); } else { gMenuHolder->childSetText("Avatar Mute", std::string("Mute")); // *TODO:Translate //gMutePieMenu->setLabel("Mute"); } gPieAvatar->show(x, y, mPieMouseButtonDown); } else if (object->isAttachment()) { gPieAttachment->show(x, y, mPieMouseButtonDown); } else { // BUG: What about chatting child objects? std::string name; LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node) { name = node->mName; } if (LLMuteList::getInstance()->isMuted(object->getID(), name)) { gMenuHolder->childSetText("Object Mute", std::string("Unmute")); // *TODO:Translate //gMuteObjectPieMenu->setLabel("Unmute"); } else { gMenuHolder->childSetText("Object Mute", std::string("Mute")); // *TODO:Translate //gMuteObjectPieMenu->setLabel("Mute"); } gPieObject->show(x, y, mPieMouseButtonDown); // VEFFECT: ShowPie object // Don't show when you click on someone else, it freaks them // out. LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); effectp->setPositionGlobal(mPick.mPosGlobal); effectp->setColor(LLColor4U(gAgent.getEffectColor())); effectp->setDuration(0.25f); } } if (always_show) { // ignore return value LLTool::handleRightMouseDown(x, y, mask); } else { // ignore return value LLTool::handleMouseDown(x, y, mask); } // We handled the event. return TRUE; }
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() ); } } } }
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; } }
// static void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) { LLSaveNotecardInfo* info = (LLSaveNotecardInfo*)user_data; if(info && (0 == status)) { if(info->mObjectUUID.isNull()) { LLViewerInventoryItem* item; item = (LLViewerInventoryItem*)gInventory.getItem(info->mItemUUID); if(item) { LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); new_item->setAssetUUID(asset_uuid); new_item->setTransactionID(info->mTransactionID); new_item->updateServer(FALSE); gInventory.updateItem(new_item); gInventory.notifyObservers(); } else { llwarns << "Inventory item for script " << info->mItemUUID << " is no longer in agent inventory." << llendl; } } else { LLViewerObject* object = gObjectList.findObject(info->mObjectUUID); LLViewerInventoryItem* item = NULL; if(object) { item = (LLViewerInventoryItem*)object->getInventoryObject(info->mItemUUID); } if(object && item) { item->setAssetUUID(asset_uuid); item->setTransactionID(info->mTransactionID); object->updateInventory(item, TASK_INVENTORY_ITEM_KEY, false); dialog_refresh_all(); } else { LLNotifications::instance().add("SaveNotecardFailObjectNotFound"); } } // Perform item copy to inventory if (info->mCopyItem.notNull()) { LLViewerTextEditor* editor = info->mSelf->getChild<LLViewerTextEditor>("Notecard Editor"); if (editor) { editor->copyInventory(info->mCopyItem); } } // Find our window and close it if requested. LLPreviewNotecard* previewp = (LLPreviewNotecard*)LLPreview::find(info->mItemUUID); if (previewp && previewp->mCloseAfterSave) { previewp->close(); } } else { llwarns << "Problem saving notecard: " << status << llendl; LLSD args; args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); LLNotifications::instance().add("SaveNotecardFailReason", args); } std::string uuid_string; asset_uuid.toString(uuid_string); std::string filename; filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string) + ".tmp"; LLFile::remove(filename); delete info; }
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); } }
void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, void **user_data, const EObjectUpdateType update_type, bool cached, bool compressed) { LLFastTimer t(LLFastTimer::FTM_PROCESS_OBJECTS); LLVector3d camera_global = gAgent.getCameraPositionGlobal(); LLViewerObject *objectp; S32 num_objects; U32 local_id; LLPCode pcode = 0; LLUUID fullid; S32 i; // figure out which simulator these are from and get it's index // Coordinates in simulators are region-local // Until we get region-locality working on viewer we // have to transform to absolute coordinates. num_objects = mesgsys->getNumberOfBlocksFast(_PREHASH_ObjectData); if (!cached && !compressed && update_type != OUT_FULL) { gTerseObjectUpdates += num_objects; S32 size; if (mesgsys->getReceiveCompressedSize()) { size = mesgsys->getReceiveCompressedSize(); } else { size = mesgsys->getReceiveSize(); } // llinfos << "Received terse " << num_objects << " in " << size << " byte (" << size/num_objects << ")" << llendl; } else { S32 size; if (mesgsys->getReceiveCompressedSize()) { size = mesgsys->getReceiveCompressedSize(); } else { size = mesgsys->getReceiveSize(); } // llinfos << "Received " << num_objects << " in " << size << " byte (" << size/num_objects << ")" << llendl; gFullObjectUpdates += num_objects; } U64 region_handle; mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle); if (!regionp) { llwarns << "Object update from unknown region!" << llendl; return; } U8 compressed_dpbuffer[2048]; LLDataPackerBinaryBuffer compressed_dp(compressed_dpbuffer, 2048); LLDataPacker *cached_dpp = NULL; for (i = 0; i < num_objects; i++) { LLTimer update_timer; BOOL justCreated = FALSE; if (cached) { U32 id; U32 crc; mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, id, i); mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_CRC, crc, i); // Lookup data packer and add this id to cache miss lists if necessary. cached_dpp = regionp->getDP(id, crc); if (cached_dpp) { cached_dpp->reset(); cached_dpp->unpackUUID(fullid, "ID"); cached_dpp->unpackU32(local_id, "LocalID"); cached_dpp->unpackU8(pcode, "PCode"); } else { continue; // no data packer, skip this object } } else if (compressed) { U8 compbuffer[2048]; S32 uncompressed_length = 2048; S32 compressed_length; compressed_dp.reset(); U32 flags = 0; if (update_type != OUT_TERSE_IMPROVED) { mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i); } if (flags & FLAGS_ZLIB_COMPRESSED) { compressed_length = mesgsys->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_Data); mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, compbuffer, 0, i); uncompressed_length = 2048; uncompress(compressed_dpbuffer, (unsigned long *)&uncompressed_length, compbuffer, compressed_length); compressed_dp.assignBuffer(compressed_dpbuffer, uncompressed_length); } else { uncompressed_length = mesgsys->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_Data); mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, compressed_dpbuffer, 0, i); compressed_dp.assignBuffer(compressed_dpbuffer, uncompressed_length); } if (update_type != OUT_TERSE_IMPROVED) { compressed_dp.unpackUUID(fullid, "ID"); compressed_dp.unpackU32(local_id, "LocalID"); compressed_dp.unpackU8(pcode, "PCode"); } else { compressed_dp.unpackU32(local_id, "LocalID"); getUUIDFromLocal(fullid, local_id, gMessageSystem->getSenderIP(), gMessageSystem->getSenderPort()); if (fullid.isNull()) { //llwarns << "update for unknown localid " << local_id << " host " << gMessageSystem->getSender() << llendl; mNumUnknownUpdates++; } } } else if (update_type != OUT_FULL) { mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i); getUUIDFromLocal(fullid, local_id, gMessageSystem->getSenderIP(), gMessageSystem->getSenderPort()); if (fullid.isNull()) { //llwarns << "update for unknown localid " << local_id << " host " << gMessageSystem->getSender() << llendl; mNumUnknownUpdates++; } } else { mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_FullID, fullid, i); mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i); // llinfos << "Full Update, obj " << local_id << ", global ID" << fullid << "from " << mesgsys->getSender() << llendl; } objectp = findObject(fullid); // This looks like it will break if the local_id of the object doesn't change // upon boundary crossing, but we check for region id matching later... if (objectp && (objectp->mLocalID != local_id)) { removeFromLocalIDTable(*objectp); setUUIDAndLocal(fullid, local_id, gMessageSystem->getSenderIP(), gMessageSystem->getSenderPort()); } 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++; } else { if (objectp->getRegion() != regionp) { // Object has changed region! Update lookup tables, set region pointer. removeFromLocalIDTable(*objectp); setUUIDAndLocal(fullid, local_id, gMessageSystem->getSenderIP(), gMessageSystem->getSenderPort()); objectp->setRegion(regionp); } objectp->updateRegion(regionp); // for LLVOAvatar } 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); } } LLVOAvatar::cullAvatarsByPixelArea(); }
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) || (pick.mSTCoords != mLastSTCoords) || (pick.mIntersection != mLastIntersection) || (pick.mNormal != mLastNormal) || (pick.mBinormal != mLastBinormal) || (grab_pos_region != mLastGrabPos)) { changed_since_last_update = TRUE; } if (changed_since_last_update) { LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectGrabUpdate); 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->addVector3Fast(_PREHASH_GrabOffsetInitial, mGrabOffsetFromCenterInitial ); msg->addVector3Fast(_PREHASH_GrabPosition, grab_pos_region ); msg->addU32Fast(_PREHASH_TimeSinceLast, dt_milliseconds ); msg->nextBlock("SurfaceInfo"); msg->addVector3("UVCoord", LLVector3(pick.mUVCoords)); msg->addVector3("STCoord", LLVector3(pick.mSTCoords)); msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace); msg->addVector3("Position", pick.mIntersection); msg->addVector3("Normal", pick.mNormal); msg->addVector3("Binormal", pick.mBinormal); msg->sendMessage( objectp->getRegion()->getHost() ); mLastUVCoords = pick.mUVCoords; mLastSTCoords = pick.mSTCoords; mLastFace = pick.mObjectFace; mLastIntersection = pick.mIntersection; mLastNormal= pick.mNormal; mLastBinormal= pick.mBinormal; mLastGrabPos = grab_pos_region; } // update point-at / look-at if (pick.mObjectFace != -1) // if the intersection was on the surface of the obejct { LLVector3 local_edit_point = pick.mIntersection; local_edit_point -= objectp->getPositionAgent(); local_edit_point = local_edit_point * ~objectp->getRenderRotation(); gAgentCamera.setPointAt(POINTAT_TARGET_GRAB, objectp, local_edit_point ); gAgentCamera.setLookAt(LOOKAT_TARGET_SELECT, objectp, local_edit_point ); } gViewerWindow->setCursor(UI_CURSOR_HAND); }
void LLViewerObjectList::updateApparentAngles(LLAgent &agent) { S32 i; S32 num_objects = 0; LLViewerObject *objectp; S32 num_updates, max_value; if (NUM_BINS - 1 == mCurBin) { num_updates = mObjects.count() - mCurLazyUpdateIndex; max_value = mObjects.count(); gImageList.setUpdateStats(TRUE); } else { num_updates = (mObjects.count() / NUM_BINS) + 1; max_value = llmin(mObjects.count(), mCurLazyUpdateIndex + num_updates); } if (!gNoRender) { // Slam priorities for textures that we care about (hovered, selected, and focused) // Hovered // Assumes only one level deep of parenting objectp = gHoverView->getLastHoverObject(); if (objectp) { objectp->boostTexturePriority(); } } // Focused objectp = gAgent.getFocusObject(); if (objectp) { objectp->boostTexturePriority(); } // Selected struct f : public LLSelectedObjectFunctor { virtual bool apply(LLViewerObject* objectp) { objectp->boostTexturePriority(); return true; } } func; LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func); // Iterate through some of the objects and lazy update their texture priorities for (i = mCurLazyUpdateIndex; i < max_value; i++) { objectp = mObjects[i]; if (!objectp->isDead()) { num_objects++; // Update distance & gpw objectp->setPixelAreaAndAngle(agent); // Also sets the approx. pixel area objectp->updateTextures(agent); // Update the image levels of textures for this object. } } mCurLazyUpdateIndex = max_value; if (mCurLazyUpdateIndex == mObjects.count()) { mCurLazyUpdateIndex = 0; } mCurBin = (++mCurBin) % NUM_BINS; LLVOAvatar::cullAvatarsByPixelArea(); }
// 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 ) { LLSelectMgr::getInstance()->selectObjectOnly(object, SELECT_ALL_TES); } else { LLSelectMgr::getInstance()->selectObjectAndFamily(object); } } } else { // Save the current zoom values because deselect resets them. F32 target_zoom; F32 current_zoom; LLSelectMgr::getInstance()->getAgentHUDZoom(target_zoom, current_zoom); // JC - Change behavior to make it easier to select children // of linked sets. 9/3/2002 if( !already_selected || ignore_group) { // ...lose current selection in favor of just this object LLSelectMgr::getInstance()->deselectAll(); } if ( ignore_group ) { LLSelectMgr::getInstance()->selectObjectOnly(object, SELECT_ALL_TES); } else { LLSelectMgr::getInstance()->selectObjectAndFamily(object); } // restore the zoom to the previously stored values. LLSelectMgr::getInstance()->setAgentHUDZoom(target_zoom, current_zoom); } if (!gAgentCamera.getFocusOnAvatar() && // if camera not glued to avatar LLVOAvatar::findAvatarFromAttachment(object) != gAgentAvatarp && // and it's not one of your attachments object != gAgentAvatarp) // and it's not you { // have avatar turn to face the selected object(s) LLVector3d selection_center = LLSelectMgr::getInstance()->getSelectionCenterGlobal(); selection_center = selection_center - gAgent.getPositionGlobal(); LLVector3 selection_dir; selection_dir.setVec(selection_center); selection_dir.mV[VZ] = 0.f; selection_dir.normVec(); if (!object->isAvatar() && gAgent.getAtAxis() * selection_dir < 0.6f) { LLQuaternion target_rot; target_rot.shortestArc(LLVector3::x_axis, selection_dir); gAgent.startAutoPilotGlobal(gAgent.getPositionGlobal(), "", &target_rot, NULL, NULL, 1.f, SELECTION_ROTATION_TRESHOLD); } } if (temp_select) { if (!already_selected) { LLViewerObject* root_object = (LLViewerObject*)object->getRootEdit(); LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); // this is just a temporary selection LLSelectNode* select_node = selection->findNode(root_object); if (select_node) { select_node->setTransient(TRUE); } LLViewerObject::const_child_list_t& child_list = root_object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); iter != child_list.end(); iter++) { LLViewerObject* child = *iter; select_node = selection->findNode(child); if (select_node) { select_node->setTransient(TRUE); } } } } //if(temp_select) } //if(!object) // Cleanup temp select settings above. if (temp_select || LLSelectMgr::getInstance()->mAllowSelectAvatar) { gSavedSettings.setBOOL("SelectOwnedOnly", select_owned); gSavedSettings.setBOOL("SelectMovableOnly", select_movable); LLSelectMgr::getInstance()->setForceSelection(FALSE); } return LLSelectMgr::getInstance()->getSelection(); }
void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) { LLMemType mt(LLMemType::MTYPE_OBJECT); // Update globals gVelocityInterpolate = gSavedSettings.getBOOL("VelocityInterpolate"); gPingInterpolate = gSavedSettings.getBOOL("PingInterpolate"); gAnimateTextures = gSavedSettings.getBOOL("AnimateTextures"); // update global timer F32 last_time = gFrameTimeSeconds; U64 time = totalTime(); // this will become the new gFrameTime when the update is done // Time _can_ go backwards, for example if the user changes the system clock. // It doesn't cause any fatal problems (just some oddness with stats), so we shouldn't assert here. // llassert(time > gFrameTime); F64 time_diff = U64_to_F64(time - gFrameTime)/(F64)SEC_TO_MICROSEC; gFrameTime = time; F64 time_since_start = U64_to_F64(gFrameTime - gStartTime)/(F64)SEC_TO_MICROSEC; gFrameTimeSeconds = (F32)time_since_start; gFrameIntervalSeconds = gFrameTimeSeconds - last_time; if (gFrameIntervalSeconds < 0.f) { gFrameIntervalSeconds = 0.f; } //clear avatar LOD change counter LLVOAvatar::sNumLODChangesThisFrame = 0; const F64 frame_time = LLFrameTimer::getElapsedSeconds(); std::vector<LLViewerObject*> kill_list; S32 num_active_objects = 0; LLViewerObject *objectp = NULL; // Make a copy of the list in case something in idleUpdate() messes with it std::vector<LLViewerObject*> idle_list; idle_list.reserve( mActiveObjects.size() ); for (std::set<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin(); active_iter != mActiveObjects.end(); active_iter++) { objectp = *active_iter; if (objectp) { idle_list.push_back( objectp ); } else { // There shouldn't be any NULL pointers in the list, but they have caused // crashes before. This may be idleUpdate() messing with the list. llwarns << "LLViewerObjectList::update has a NULL objectp" << llendl; } } if (gSavedSettings.getBOOL("FreezeTime")) { for (std::vector<LLViewerObject*>::iterator iter = idle_list.begin(); iter != idle_list.end(); iter++) { objectp = *iter; if (objectp->getPCode() == LLViewerObject::LL_VO_CLOUDS || objectp->isAvatar()) { objectp->idleUpdate(agent, world, frame_time); } } } else { for (std::vector<LLViewerObject*>::iterator idle_iter = idle_list.begin(); idle_iter != idle_list.end(); idle_iter++) { objectp = *idle_iter; if (!objectp->idleUpdate(agent, world, frame_time)) { // If Idle Update returns false, kill object! kill_list.push_back(objectp); } else { num_active_objects++; } } for (std::vector<LLViewerObject*>::iterator kill_iter = kill_list.begin(); kill_iter != kill_list.end(); kill_iter++) { objectp = *kill_iter; killObject(objectp); } } mNumSizeCulled = 0; mNumVisCulled = 0; // compute all sorts of time-based stats // don't factor frames that were paused into the stats if (! mWasPaused) { LLViewerStats::getInstance()->updateFrameStats(time_diff); } /* // Debugging code for viewing orphans, and orphaned parents LLUUID id; for (i = 0; i < mOrphanParents.count(); i++) { id = sIndexAndLocalIDToUUID[mOrphanParents[i]]; LLViewerObject *objectp = findObject(id); if (objectp) { std::string id_str; objectp->mID.toString(id_str); std::string tmpstr = std::string("Par: ") + id_str; addDebugBeacon(objectp->getPositionAgent(), tmpstr, LLColor4(1.f,0.f,0.f,1.f), LLColor4(1.f,1.f,1.f,1.f)); } } LLColor4 text_color; for (i = 0; i < mOrphanChildren.count(); i++) { OrphanInfo oi = mOrphanChildren[i]; LLViewerObject *objectp = findObject(oi.mChildInfo); if (objectp) { std::string id_str; objectp->mID.toString(id_str); std::string tmpstr; if (objectp->getParent()) { tmpstr = std::string("ChP: ") + id_str; text_color = LLColor4(0.f, 1.f, 0.f, 1.f); } else { tmpstr = std::string("ChNoP: ") + id_str; text_color = LLColor4(1.f, 0.f, 0.f, 1.f); } id = sIndexAndLocalIDToUUID[oi.mParentInfo]; addDebugBeacon(objectp->getPositionAgent() + LLVector3(0.f, 0.f, -0.25f), tmpstr, LLColor4(0.25f,0.25f,0.25f,1.f), text_color); } i++; } */ mNumObjectsStat.addValue(mObjects.count()); mNumActiveObjectsStat.addValue(num_active_objects); mNumSizeCulledStat.addValue(mNumSizeCulled); mNumVisCulledStat.addValue(mNumVisCulled); }
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); bool has_media = false; bool is_time_based_media = false; bool is_web_based_media = false; bool is_media_playing = false; bool is_media_displaying = false; // Does this face have media? const LLTextureEntry* tep = hit_object ? hit_object->getTE(mLastPickInfo.mObjectFace) : NULL; if(tep) { has_media = tep->hasMedia(); const LLMediaEntry* mep = has_media ? tep->getMediaData() : NULL; if (mep) { viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()); LLPluginClassMedia* media_plugin = NULL; if (media_impl.notNull() && (media_impl->hasMedia())) { is_media_displaying = true; //LLStringUtil::format_map_t args; media_plugin = media_impl->getMediaPlugin(); if(media_plugin) { if(media_plugin->pluginSupportsMediaTime()) { is_time_based_media = true; is_web_based_media = false; //args["[CurrentURL]"] = media_impl->getMediaURL(); is_media_playing = media_impl->isMediaPlaying(); } else { is_time_based_media = false; is_web_based_media = true; //args["[CurrentURL]"] = media_plugin->getLocation(); } //tooltip_msg.append(LLTrans::getString("CurrentURL", args)); } } } } // Avoid showing tip over media that's displaying unless it's for sale // also check the primary node since sometimes it can have an action even though // the root node doesn't if(!suppressObjectHoverDisplay || !is_media_displaying || for_sale) { 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") + " "); if (nodep->mValid) { LLUUID owner; std::string name; if (!nodep->mPermissions->isGroupOwned()) { owner = nodep->mPermissions->getOwner(); if (LLUUID::null == owner) { line.append(LLTrans::getString("TooltipPublic")); } else if (LLAvatarNameCache::getNSName(owner, name)) { // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { name = RlvStrings::getAnonym(name); } // [/RLVa:KB] line.append(name); } else { line.append(LLTrans::getString("RetrievingData")); retrieving_data = true; } } else { std::string name; owner = nodep->mPermissions->getGroup(); if (gCacheName->getGroupName(owner, name)) { line.append(name); line.append(LLTrans::getString("TooltipIsGroup")); } else { line.append(LLTrans::getString("RetrievingData")); retrieving_data = true; } } } else { line.append(LLTrans::getString("RetrievingData")); retrieving_data = true; } mText.push_back(line); // Build a line describing any special properties of this object. LLViewerObject *object = hit_object; LLViewerObject *parent = (LLViewerObject *)object->getParent(); if (object && (object->flagUsePhysics() || object->flagScripted() || object->flagHandleTouch() || (parent && parent->flagHandleTouch()) || object->flagTakesMoney() || (parent && parent->flagTakesMoney()) || object->flagAllowInventoryAdd() || object->flagTemporary() || object->flagPhantom()) ) { line.clear(); if (object->flagScripted()) { line.append(LLTrans::getString("TooltipFlagScript") + " "); } if (object->flagUsePhysics()) { line.append(LLTrans::getString("TooltipFlagPhysics") + " "); } if (object->flagHandleTouch() || (parent && parent->flagHandleTouch()) ) { line.append(LLTrans::getString("TooltipFlagTouch") + " "); suppressObjectHoverDisplay = FALSE; // Show tip } if (object->flagTakesMoney() || (parent && parent->flagTakesMoney()) ) { line.append(gHippoGridManager->getConnectedGrid()->getCurrencySymbol() + " "); suppressObjectHoverDisplay = FALSE; // Show tip } if (object->flagAllowInventoryAdd()) { line.append(LLTrans::getString("TooltipFlagDropInventory") + " "); suppressObjectHoverDisplay = FALSE; // Show tip } if (object->flagPhantom()) { line.append(LLTrans::getString("TooltipFlagPhantom") + " "); } if (object->flagTemporary()) { line.append(LLTrans::getString("TooltipFlagTemporary") + " "); } if (object->flagUsePhysics() || object->flagHandleTouch() || (parent && parent->flagHandleTouch()) ) { line.append(LLTrans::getString("TooltipFlagRightClickMenu") + " "); } mText.push_back(line); } // Free to copy / For Sale: L$ line.clear(); if (nodep->mValid) { if (for_copy) { line.append(LLTrans::getString("TooltipFreeToCopy")); suppressObjectHoverDisplay = FALSE; // Show tip } else if (for_sale) { LLStringUtil::format_map_t args; args["[AMOUNT]"] = llformat("%d", nodep->mSaleInfo.getSalePrice()); line.append(LLTrans::getString("TooltipForSaleL$", args)); suppressObjectHoverDisplay = FALSE; // Show tip } else { // Nothing if not for sale // line.append("Not for sale"); } } else { LLStringUtil::format_map_t args; args["[MESSAGE]"] = LLTrans::getString("RetrievingData"); retrieving_data = true; line.append(LLTrans::getString("TooltipForSaleMsg", args)); } mText.push_back(line); line.clear(); S32 prim_count = LLSelectMgr::getInstance()->getHoverObjects()->getObjectCount(); line.append(llformat("Prims: %d", prim_count)); mText.push_back(line); line.clear(); line.append("Position: "); LLViewerRegion *region = gAgent.getRegion(); LLVector3 position = region->getPosRegionFromGlobal(hit_object->getPositionGlobal());//regionp->getOriginAgent(); LLVector3 mypos = region->getPosRegionFromGlobal(gAgent.getPositionGlobal()); LLVector3 delta = position - mypos; F32 distance = (F32)delta.magVec(); line.append(llformat("<%.02f,%.02f,%.02f>",position.mV[0],position.mV[1],position.mV[2])); mText.push_back(line); line.clear(); line.append(llformat("Distance: %.02fm",distance)); mText.push_back(line); } else { suppressObjectHoverDisplay = TRUE; } // If the hover tip shouldn't be shown, delete all the object text if (suppressObjectHoverDisplay) { mText.clear(); } } } } else if ( mHoverLandGlobal != LLVector3d::zero ) { // // Do not show hover for land unless prefs are set to allow it. // if (!gSavedSettings.getBOOL("ShowLandHoverTip")) return; // Didn't hit an object, but since we have a land point we // must be hovering over land. LLParcel* hover_parcel = LLViewerParcelMgr::getInstance()->getHoverParcel(); LLUUID owner; if ( hover_parcel ) { owner = hover_parcel->getOwnerID(); } // Line: "Land" line.clear(); line.append(LLTrans::getString("TooltipLand")); if (hover_parcel) { // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) | Added: RLVa-0.2.0b line.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? hover_parcel->getName() : RlvStrings::getString(RLV_STRING_HIDDEN_PARCEL) ); // [/RLVa:KB] //line.append(hover_parcel->getName()); } mText.push_back(line); // Line: "Owner: James Linden" line.clear(); line.append(LLTrans::getString("TooltipOwner") + " "); if ( hover_parcel ) { std::string name; if (LLUUID::null == owner) { line.append(LLTrans::getString("TooltipPublic")); } else if (hover_parcel->getIsGroupOwned()) { if (gCacheName->getGroupName(owner, name)) { line.append(name); line.append(LLTrans::getString("TooltipIsGroup")); } else { line.append(LLTrans::getString("RetrievingData")); retrieving_data = true; } } else if(gCacheName->getFullName(owner, name)) { // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0b line.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? name : RlvStrings::getAnonym(name)); // [/RLVa:KB] //line.append(name); } else { line.append(LLTrans::getString("RetrievingData")); retrieving_data = true; } } else { line.append(LLTrans::getString("RetrievingData")); retrieving_data = true; } mText.push_back(line); // Line: "no fly, not safe, no build" // Don't display properties for your land. This is just // confusing, because you can do anything on your own land. if ( hover_parcel && owner != gAgent.getID() ) { S32 words = 0; line.clear(); // JC - Keep this in the same order as the checkboxes // on the land info panel if ( !hover_parcel->getAllowModify() ) { if ( hover_parcel->getAllowGroupModify() ) { line.append(LLTrans::getString("TooltipFlagGroupBuild")); } else { line.append(LLTrans::getString("TooltipFlagNoBuild")); } words++; } if ( !hover_parcel->getAllowTerraform() ) { if (words) line.append(", "); line.append(LLTrans::getString("TooltipFlagNoEdit")); words++; } if ( hover_parcel->getAllowDamage() ) { if (words) line.append(", "); line.append(LLTrans::getString("TooltipFlagNotSafe")); words++; } // Maybe we should reflect the estate's block fly bit here as well? DK 12/1/04 if ( !hover_parcel->getAllowFly() ) { if (words) line.append(", "); line.append(LLTrans::getString("TooltipFlagNoFly")); words++; } if ( !hover_parcel->getAllowOtherScripts() ) { if (words) line.append(", "); if ( hover_parcel->getAllowGroupScripts() ) { line.append(LLTrans::getString("TooltipFlagGroupScripts")); } else { line.append(LLTrans::getString("TooltipFlagNoScripts")); } words++; } if (words) { mText.push_back(line); } } if (hover_parcel && hover_parcel->getParcelFlag(PF_FOR_SALE)) { LLStringUtil::format_map_t args; args["[AMOUNT]"] = llformat("%d", hover_parcel->getSalePrice()); line = LLTrans::getString("TooltipForSaleL$", args); mText.push_back(line); } } //<singu> if (retrieving_data) { // Keep doing this twice per second, until all data was retrieved. mLastTextHoverObjectTimer.start(DELAY_BEFORE_REFRESH_TIP); } //</singu> }
// This is the callback for when each script arrives // static void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status) { llinfos << "LLFloaterCompileQueue::scriptArrived()" << llendl; LLScriptQueueData* data = (LLScriptQueueData*)user_data; if(!data) { return; } LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance<LLFloaterCompileQueue>("compile_queue", data->mQueueID); std::string buffer; if(queue && (0 == status)) { //llinfos << "ITEM NAME 3: " << data->mScriptName << llendl; // Dump this into a file on the local disk so we can compile it. std::string filename; LLVFile file(vfs, asset_id, type); std::string uuid_str; asset_id.toString(uuid_str); filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str) + llformat(".%s",LLAssetType::lookup(type)); const bool is_running = true; LLViewerObject* object = gObjectList.findObject(data->mTaskId); if (object) { std::string url = object->getRegion()->getCapability("UpdateScriptTask"); if(!url.empty()) { // Read script source in to buffer. U32 script_size = file.getSize(); U8* script_data = new U8[script_size]; file.read(script_data, script_size); queue->mUploadQueue->queue(filename, data->mTaskId, data->mItemId, is_running, queue->mMono, queue->getKey().asUUID(), script_data, script_size, data->mScriptName); } else { // It's now in the file, now compile it. buffer = LLTrans::getString("CompileQueueDownloadedCompiling") + (": ") + data->mScriptName; // Write script to local file for compilation. LLFILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ if (fp) { const S32 buf_size = 65536; U8 copy_buf[buf_size]; while (file.read(copy_buf, buf_size)) /*Flawfinder: ignore*/ { if (fwrite(copy_buf, file.getLastBytesRead(), 1, fp) < 1) { // return a bad file error if we can't write the whole thing status = LL_ERR_CANNOT_OPEN_FILE; } } fclose(fp); } else { llerrs << "Unable to find object to compile" << llendl; } // TODO: babbage: No compile if no cap. queue->compile(filename, data->mItemId); // Delete it after we're done compiling? LLFile::remove(filename); } } } else { LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ) { LLSD args; args["MESSAGE"] = LLTrans::getString("CompileQueueScriptNotFound"); LLNotificationsUtil::add("SystemMessage", args); buffer = LLTrans::getString("CompileQueueProblemDownloading") + (": ") + data->mScriptName; } else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status) { LLSD args; args["MESSAGE"] = LLTrans::getString("CompileQueueInsufficientPermDownload"); LLNotificationsUtil::add("SystemMessage", args); buffer = LLTrans::getString("CompileQueueInsufficientPermFor") + (": ") + data->mScriptName; } else { buffer = LLTrans::getString("CompileQueueUnknownFailure") + (" ") + data->mScriptName; } llwarns << "Problem downloading script asset." << llendl; if(queue) queue->removeItemByItemID(data->mItemId); } if(queue && (buffer.size() > 0)) { queue->getChild<LLScrollListCtrl>("queue output")->setCommentText(buffer); } delete data; }
void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) { LLColor4 above_water_color = gColors.getColor( "NetMapOtherOwnAboveWater" ); LLColor4 below_water_color = gColors.getColor( "NetMapOtherOwnBelowWater" ); LLColor4 you_own_above_water_color = gColors.getColor( "NetMapYouOwnAboveWater" ); LLColor4 you_own_below_water_color = gColors.getColor( "NetMapYouOwnBelowWater" ); LLColor4 group_own_above_water_color = gColors.getColor( "NetMapGroupOwnAboveWater" ); LLColor4 group_own_below_water_color = gColors.getColor( "NetMapGroupOwnBelowWater" ); F32 max_radius = gSavedSettings.getF32("MiniMapPrimMaxRadius"); for (S32 i = 0; i < mMapObjects.count(); i++) { LLViewerObject* objectp = mMapObjects[i]; if (!objectp->getRegion() || objectp->isOrphaned() || objectp->isAttachment()) { continue; } const LLVector3& scale = objectp->getScale(); const LLVector3d pos = objectp->getPositionGlobal(); const F64 water_height = F64( objectp->getRegion()->getWaterHeight() ); // LLWorld::getInstance()->getWaterHeight(); F32 approx_radius = (scale.mV[VX] + scale.mV[VY]) * 0.5f * 0.5f * 1.3f; // 1.3 is a fudge // Limit the size of megaprims so they don't blot out everything on the minimap. // Attempting to draw very large megaprims also causes client lag. // See DEV-17370 and SNOW-79 for details. approx_radius = llmin(approx_radius, max_radius); LLColor4U color = above_water_color; if( objectp->permYouOwner() ) { const F32 MIN_RADIUS_FOR_OWNED_OBJECTS = 2.f; if( approx_radius < MIN_RADIUS_FOR_OWNED_OBJECTS ) { approx_radius = MIN_RADIUS_FOR_OWNED_OBJECTS; } if( pos.mdV[VZ] >= water_height ) { if ( objectp->permGroupOwner() ) { color = group_own_above_water_color; } else { color = you_own_above_water_color; } } else { if ( objectp->permGroupOwner() ) { color = group_own_below_water_color; } else { color = you_own_below_water_color; } } } else if( pos.mdV[VZ] < water_height ) { color = below_water_color; } netmap.renderScaledPointGlobal( pos, color, approx_radius ); } }
void LLPanelPermissions::refresh() { LLButton* BtnDeedToGroup = getChild<LLButton>("button deed"); if(BtnDeedToGroup) { std::string deedText; if (gSavedSettings.getWarning("DeedObject")) { deedText = getString("text deed continued"); } else { deedText = getString("text deed"); } BtnDeedToGroup->setLabelSelected(deedText); BtnDeedToGroup->setLabelUnselected(deedText); } BOOL root_selected = TRUE; LLSelectNode* nodep = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); S32 object_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); if(!nodep || 0 == object_count) { nodep = LLSelectMgr::getInstance()->getSelection()->getFirstNode(); object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); root_selected = FALSE; } //BOOL attachment_selected = LLSelectMgr::getInstance()->getSelection()->isAttachment(); //attachment_selected = false; LLViewerObject* objectp = NULL; if(nodep) objectp = nodep->getObject(); if(!nodep || !objectp)// || attachment_selected) { // ...nothing selected childSetEnabled("perm_modify",false); childSetText("perm_modify",LLStringUtil::null); childSetEnabled("Creator:",false); childSetText("Creator Name",LLStringUtil::null); childSetEnabled("Creator Name",false); childSetEnabled("button creator profile",false); childSetEnabled("Owner:",false); childSetText("Owner Name",LLStringUtil::null); childSetEnabled("Owner Name",false); childSetEnabled("button owner profile",false); childSetEnabled("Group:",false); childSetText("Group Name",LLStringUtil::null); childSetEnabled("Group Name",false); childSetEnabled("button set group",false); childSetText("Object Name",LLStringUtil::null); childSetEnabled("Object Name",false); childSetEnabled("Name:",false); childSetText("Group Name",LLStringUtil::null); childSetEnabled("Group Name",false); childSetEnabled("Description:",false); childSetText("Object Description",LLStringUtil::null); childSetEnabled("Object Description",false); childSetEnabled("Permissions:",false); childSetValue("checkbox share with group",FALSE); childSetEnabled("checkbox share with group",false); childSetEnabled("button deed",false); childSetValue("checkbox allow everyone move",FALSE); childSetEnabled("checkbox allow everyone move",false); childSetValue("checkbox allow everyone copy",FALSE); childSetEnabled("checkbox allow everyone copy",false); //Next owner can: childSetEnabled("Next owner can:",false); childSetValue("checkbox next owner can modify",FALSE); childSetEnabled("checkbox next owner can modify",false); childSetValue("checkbox next owner can copy",FALSE); childSetEnabled("checkbox next owner can copy",false); childSetValue("checkbox next owner can transfer",FALSE); childSetEnabled("checkbox next owner can transfer",false); //checkbox for sale childSetValue("checkbox for sale",FALSE); childSetEnabled("checkbox for sale",false); //checkbox include in search childSetValue("search_check", FALSE); childSetEnabled("search_check", false); LLRadioGroup* RadioSaleType = getChild<LLRadioGroup>("sale type"); if(RadioSaleType) { RadioSaleType->setSelectedIndex(-1); RadioSaleType->setEnabled(FALSE); } childSetEnabled("Cost",false); childSetText("Cost",getString("Cost Default")); childSetText("Edit Cost",LLStringUtil::null); childSetEnabled("Edit Cost",false); childSetEnabled("label click action",false); LLComboBox* ComboClickAction = getChild<LLComboBox>("clickaction"); if(ComboClickAction) { ComboClickAction->setEnabled(FALSE); ComboClickAction->clear(); } childSetVisible("B:",false); childSetVisible("O:",false); childSetVisible("G:",false); childSetVisible("E:",false); childSetVisible("N:",false); childSetVisible("F:",false); return; } // figure out a few variables BOOL is_one_object = (object_count == 1); // BUG: fails if a root and non-root are both single-selected. BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsModify()) || LLSelectMgr::getInstance()->selectGetModify(); const LLFocusableElement* keyboard_focus_view = gFocusMgr.getKeyboardFocus(); S32 string_index = 0; std::string MODIFY_INFO_STRINGS[] = { getString("text modify info 1"), getString("text modify info 2"), getString("text modify info 3"), getString("text modify info 4") }; if(!is_perm_modify) { string_index += 2; } if(!is_one_object) { ++string_index; } childSetEnabled("perm_modify",true); childSetText("perm_modify",MODIFY_INFO_STRINGS[string_index]); childSetEnabled("Permissions:",true); // Update creator text field childSetEnabled("Creator:",true); BOOL creators_identical; std::string creator_name; creators_identical = LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, creator_name); childSetText("Creator Name",creator_name); childSetEnabled("Creator Name",TRUE); childSetEnabled("button creator profile", creators_identical && mCreatorID.notNull() ); // Update owner text field childSetEnabled("Owner:",true); BOOL owners_identical; std::string owner_name; owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_name); // llinfos << "owners_identical " << (owners_identical ? "TRUE": "FALSE") << llendl; if (mOwnerID.isNull()) { if(LLSelectMgr::getInstance()->selectIsGroupOwned()) { // Group owned already displayed by selectGetOwner } else { // Display last owner if public std::string last_owner_name; LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_name); // It should never happen that the last owner is null and the owner // is null, but it seems to be a bug in the simulator right now. JC if (!mLastOwnerID.isNull() && !last_owner_name.empty()) { owner_name.append(", last "); owner_name.append( last_owner_name ); } } } childSetText("Owner Name",owner_name); childSetEnabled("Owner Name",TRUE); childSetEnabled("button owner profile",owners_identical && (mOwnerID.notNull() || LLSelectMgr::getInstance()->selectIsGroupOwned())); // update group text field childSetEnabled("Group:",true); childSetText("Group Name",LLStringUtil::null); LLUUID group_id; BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); if (groups_identical) { if(mLabelGroupName) { mLabelGroupName->setNameID(group_id, TRUE); mLabelGroupName->setEnabled(TRUE); } } else { if(mLabelGroupName) { mLabelGroupName->setNameID(LLUUID::null, TRUE); mLabelGroupName->refresh(LLUUID::null, LLStringUtil::null, LLStringUtil::null, TRUE); mLabelGroupName->setEnabled(FALSE); } } childSetEnabled("button set group",owners_identical && (mOwnerID == gAgent.getID())); // figure out the contents of the name, description, & category BOOL edit_name_desc = FALSE; if(is_one_object && objectp->permModify()) { edit_name_desc = TRUE; } childSetEnabled("Name:",true); LLLineEditor* LineEditorObjectName = getChild<LLLineEditor>("Object Name"); childSetEnabled("Description:",true); LLLineEditor* LineEditorObjectDesc = getChild<LLLineEditor>("Object Description"); if(is_one_object) { if(keyboard_focus_view != LineEditorObjectName) { childSetText("Object Name",nodep->mName); } if(LineEditorObjectDesc) { if(keyboard_focus_view != LineEditorObjectDesc) { LineEditorObjectDesc->setText(nodep->mDescription); } } } else { childSetText("Object Name",LLStringUtil::null); LineEditorObjectDesc->setText(LLStringUtil::null); } if(edit_name_desc) { childSetEnabled("Object Name",true); childSetEnabled("Object Description",true); } else { childSetEnabled("Object Name",false); childSetEnabled("Object Description",false); } S32 total_sale_price = 0; S32 individual_sale_price = 0; BOOL is_for_sale_mixed = FALSE; BOOL is_sale_price_mixed = FALSE; U32 num_for_sale = FALSE; LLSelectMgr::getInstance()->selectGetAggregateSaleInfo(num_for_sale, is_for_sale_mixed, is_sale_price_mixed, total_sale_price, individual_sale_price); const BOOL self_owned = (gAgent.getID() == mOwnerID); const BOOL group_owned = LLSelectMgr::getInstance()->selectIsGroupOwned() ; const BOOL public_owned = (mOwnerID.isNull() && !LLSelectMgr::getInstance()->selectIsGroupOwned()); const BOOL can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer(); const BOOL can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy(); if(!owners_identical) { childSetEnabled("Cost",false); childSetText("Edit Cost",LLStringUtil::null); childSetEnabled("Edit Cost",false); } // You own these objects. else if(self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE))) { // If there are multiple items for sale then set text to PRICE PER UNIT. if (num_for_sale > 1) { childSetText("Cost",getString("Cost Per Unit")); } else { childSetText("Cost",getString("Cost Default")); } LLLineEditor *editPrice = getChild<LLLineEditor>("Edit Cost"); if(keyboard_focus_view != editPrice) { // If the sale price is mixed then set the cost to MIXED, otherwise // set to the actual cost. if (num_for_sale > 0 && is_for_sale_mixed) { childSetText("Edit Cost",getString("Sale Mixed")); } else if (num_for_sale > 0 && is_sale_price_mixed) { childSetText("Edit Cost",getString("Cost Mixed")); } else { childSetText("Edit Cost",llformat("%d",individual_sale_price)); } } // The edit fields are only enabled if you can sell this object // and the sale price is not mixed. bool enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : false; childSetEnabled("Cost",enable_edit); childSetEnabled("Edit Cost",enable_edit); } // Someone, not you, owns these objects. else if(!public_owned) { childSetEnabled("Cost",false); childSetEnabled("Edit Cost",false); // Don't show a price if none of the items are for sale. if (num_for_sale) childSetText("Edit Cost",llformat("%d",total_sale_price)); else childSetText("Edit Cost",LLStringUtil::null); // If multiple items are for sale, set text to TOTAL PRICE. if (num_for_sale > 1) childSetText("Cost",getString("Cost Total")); else childSetText("Cost",getString("Cost Default")); } // This is a public object. else { childSetEnabled("Cost",false); childSetText("Cost",getString("Cost Default")); childSetText("Edit Cost",LLStringUtil::null); childSetEnabled("Edit Cost",false); } // Enable and disable the permissions checkboxes // based on who owns the object. // TODO: Creator permissions BOOL valid_base_perms = FALSE; BOOL valid_owner_perms = FALSE; BOOL valid_group_perms = FALSE; BOOL valid_everyone_perms = FALSE; BOOL valid_next_perms = FALSE; U32 base_mask_on; U32 base_mask_off; U32 owner_mask_on; U32 owner_mask_off; U32 group_mask_on; U32 group_mask_off; U32 everyone_mask_on; U32 everyone_mask_off; U32 next_owner_mask_on = 0; U32 next_owner_mask_off = 0; valid_base_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_BASE, &base_mask_on, &base_mask_off); valid_owner_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER, &owner_mask_on, &owner_mask_off); valid_group_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_GROUP, &group_mask_on, &group_mask_off); valid_everyone_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_EVERYONE, &everyone_mask_on, &everyone_mask_off); valid_next_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_NEXT_OWNER, &next_owner_mask_on, &next_owner_mask_off); if( gSavedSettings.getBOOL("DebugPermissions") ) { std::string perm_string; if (valid_base_perms) { perm_string = "B: "; perm_string += mask_to_string(base_mask_on); childSetText("B:",perm_string); childSetVisible("B:",true); perm_string = "O: "; perm_string += mask_to_string(owner_mask_on); childSetText("O:",perm_string); childSetVisible("O:",true); perm_string = "G: "; perm_string += mask_to_string(group_mask_on); childSetText("G:",perm_string); childSetVisible("G:",true); perm_string = "E: "; perm_string += mask_to_string(everyone_mask_on); childSetText("E:",perm_string); childSetVisible("E:",true); perm_string = "N: "; perm_string += mask_to_string(next_owner_mask_on); childSetText("N:",perm_string); childSetVisible("N:",true); } perm_string = "F: "; U32 flag_mask = 0x0; if (objectp->permMove()) flag_mask |= PERM_MOVE; if (objectp->permModify()) flag_mask |= PERM_MODIFY; if (objectp->permCopy()) flag_mask |= PERM_COPY; if (objectp->permTransfer()) flag_mask |= PERM_TRANSFER; perm_string += mask_to_string(flag_mask); childSetText("F:",perm_string); childSetVisible("F:",true); } else { childSetVisible("B:",false); childSetVisible("O:",false); childSetVisible("G:",false); childSetVisible("E:",false); childSetVisible("N:",false); childSetVisible("F:",false); } bool has_change_perm_ability = false; bool has_change_sale_ability = false; if(valid_base_perms && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE)))) { has_change_perm_ability = true; } if(valid_base_perms && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE)))) { has_change_sale_ability = true; } if (!has_change_perm_ability && !has_change_sale_ability && !root_selected) { // ...must select root to choose permissions childSetValue("perm_modify", getString("text modify warning")); } if (has_change_perm_ability) { childSetEnabled("checkbox share with group",true); childSetEnabled("checkbox allow everyone move",owner_mask_on & PERM_MOVE); childSetEnabled("checkbox allow everyone copy",owner_mask_on & PERM_COPY && owner_mask_on & PERM_TRANSFER); } else { childSetEnabled("checkbox share with group", FALSE); childSetEnabled("checkbox allow everyone move", FALSE); childSetEnabled("checkbox allow everyone copy", FALSE); } if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER)) { childSetEnabled("checkbox for sale", can_transfer || (!can_transfer && num_for_sale)); // Set the checkbox to tentative if the prices of each object selected // are not the same. childSetTentative("checkbox for sale", is_for_sale_mixed); childSetEnabled("sale type",num_for_sale && can_transfer && !is_sale_price_mixed); childSetEnabled("Next owner can:", TRUE); childSetEnabled("checkbox next owner can modify",base_mask_on & PERM_MODIFY); childSetEnabled("checkbox next owner can copy",base_mask_on & PERM_COPY); childSetEnabled("checkbox next owner can transfer",next_owner_mask_on & PERM_COPY); } else { childSetEnabled("checkbox for sale",FALSE); childSetEnabled("sale type",FALSE); childSetEnabled("Next owner can:",FALSE); childSetEnabled("checkbox next owner can modify",FALSE); childSetEnabled("checkbox next owner can copy",FALSE); childSetEnabled("checkbox next owner can transfer",FALSE); } if(valid_group_perms) { if((group_mask_on & PERM_COPY) && (group_mask_on & PERM_MODIFY) && (group_mask_on & PERM_MOVE)) { childSetValue("checkbox share with group",TRUE); childSetTentative("checkbox share with group",FALSE); childSetEnabled("button deed",gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } else if((group_mask_off & PERM_COPY) && (group_mask_off & PERM_MODIFY) && (group_mask_off & PERM_MOVE)) { childSetValue("checkbox share with group",FALSE); childSetTentative("checkbox share with group",false); childSetEnabled("button deed",false); } else { childSetValue("checkbox share with group",TRUE); childSetTentative("checkbox share with group",true); childSetEnabled("button deed",gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } } if(valid_everyone_perms) { // Move if(everyone_mask_on & PERM_MOVE) { childSetValue("checkbox allow everyone move",TRUE); childSetTentative("checkbox allow everyone move",false); } else if(everyone_mask_off & PERM_MOVE) { childSetValue("checkbox allow everyone move",FALSE); childSetTentative("checkbox allow everyone move",false); } else { childSetValue("checkbox allow everyone move",TRUE); childSetTentative("checkbox allow everyone move",true); } // Copy == everyone can't copy if(everyone_mask_on & PERM_COPY) { childSetValue("checkbox allow everyone copy",TRUE); childSetTentative("checkbox allow everyone copy",!can_copy || !can_transfer); } else if(everyone_mask_off & PERM_COPY) { childSetValue("checkbox allow everyone copy",FALSE); childSetTentative("checkbox allow everyone copy",false); } else { childSetValue("checkbox allow everyone copy",TRUE); childSetTentative("checkbox allow everyone copy",true); } } if(valid_next_perms) { // Modify == next owner canot modify if(next_owner_mask_on & PERM_MODIFY) { childSetValue("checkbox next owner can modify",TRUE); childSetTentative("checkbox next owner can modify",false); } else if(next_owner_mask_off & PERM_MODIFY) { childSetValue("checkbox next owner can modify",FALSE); childSetTentative("checkbox next owner can modify",false); } else { childSetValue("checkbox next owner can modify",TRUE); childSetTentative("checkbox next owner can modify",true); } // Copy == next owner cannot copy if(next_owner_mask_on & PERM_COPY) { childSetValue("checkbox next owner can copy",TRUE); childSetTentative("checkbox next owner can copy",!can_copy); } else if(next_owner_mask_off & PERM_COPY) { childSetValue("checkbox next owner can copy",FALSE); childSetTentative("checkbox next owner can copy",FALSE); } else { childSetValue("checkbox next owner can copy",TRUE); childSetTentative("checkbox next owner can copy",TRUE); } // Transfer == next owner cannot transfer if(next_owner_mask_on & PERM_TRANSFER) { childSetValue("checkbox next owner can transfer",TRUE); childSetTentative("checkbox next owner can transfer",!can_transfer); } else if(next_owner_mask_off & PERM_TRANSFER) { childSetValue("checkbox next owner can transfer",FALSE); childSetTentative("checkbox next owner can transfer",FALSE); } else { childSetValue("checkbox next owner can transfer",TRUE); childSetTentative("checkbox next owner can transfer",TRUE); } } // reflect sale information LLSaleInfo sale_info; BOOL valid_sale_info = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info); LLSaleInfo::EForSale sale_type = sale_info.getSaleType(); LLRadioGroup* RadioSaleType = getChild<LLRadioGroup>("sale type"); if(RadioSaleType) { if (valid_sale_info) { RadioSaleType->setSelectedIndex((S32)sale_type - 1); RadioSaleType->setTentative(FALSE); // unfortunately this doesn't do anything at the moment. } else { // default option is sell copy, determined to be safest RadioSaleType->setSelectedIndex((S32)LLSaleInfo::FS_COPY - 1); RadioSaleType->setTentative(TRUE); // unfortunately this doesn't do anything at the moment. } } childSetValue("checkbox for sale", num_for_sale != 0); // HACK: There are some old objects in world that are set for sale, // but are no-transfer. We need to let users turn for-sale off, but only // if for-sale is set. bool cannot_actually_sell = !can_transfer || (!can_copy && sale_type == LLSaleInfo::FS_COPY); if (num_for_sale && has_change_sale_ability && cannot_actually_sell) { childSetEnabled("checkbox for sale", true); } // Check search status of objects BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); bool include_in_search; bool all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search); childSetEnabled("search_check", has_change_sale_ability && all_volume); childSetValue("search_check", include_in_search); childSetTentative("search_check", ! all_include_in_search); // Click action (touch, sit, buy) U8 click_action = 0; if (LLSelectMgr::getInstance()->selectionGetClickAction(&click_action)) { LLComboBox* ComboClickAction = getChild<LLComboBox>("clickaction"); if(ComboClickAction) { ComboClickAction->setCurrentByIndex((S32)click_action); } } childSetEnabled("label click action",is_perm_modify && all_volume); childSetEnabled("clickaction",is_perm_modify && all_volume); }
void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) { LLColor4 above_water_color = gColors.getColor( "NetMapOtherOwnAboveWater" ); LLColor4 below_water_color = gColors.getColor( "NetMapOtherOwnBelowWater" ); LLColor4 you_own_above_water_color = gColors.getColor( "NetMapYouOwnAboveWater" ); LLColor4 you_own_below_water_color = gColors.getColor( "NetMapYouOwnBelowWater" ); LLColor4 group_own_above_water_color = gColors.getColor( "NetMapGroupOwnAboveWater" ); LLColor4 group_own_below_water_color = gColors.getColor( "NetMapGroupOwnBelowWater" ); for (S32 i = 0; i < mMapObjects.count(); i++) { LLViewerObject* objectp = mMapObjects[i]; if (!objectp->getRegion() || objectp->isOrphaned() || objectp->isAttachment()) { continue; } const LLVector3& scale = objectp->getScale(); const LLVector3d pos = objectp->getPositionGlobal(); const F64 water_height = F64( objectp->getRegion()->getWaterHeight() ); // LLWorld::getInstance()->getWaterHeight(); F32 approx_radius = (scale.mV[VX] + scale.mV[VY]) * 0.5f * 0.5f * 1.3f; // 1.3 is a fudge LLColor4U color = above_water_color; if( objectp->permYouOwner() ) { const F32 MIN_RADIUS_FOR_OWNED_OBJECTS = 2.f; if( approx_radius < MIN_RADIUS_FOR_OWNED_OBJECTS ) { approx_radius = MIN_RADIUS_FOR_OWNED_OBJECTS; } if( pos.mdV[VZ] >= water_height ) { if ( objectp->permGroupOwner() ) { color = group_own_above_water_color; } else { color = you_own_above_water_color; } } else { if ( objectp->permGroupOwner() ) { color = group_own_below_water_color; } else { color = you_own_below_water_color; } } } else if( pos.mdV[VZ] < water_height ) { color = below_water_color; } netmap.renderScaledPointGlobal( pos, color, approx_radius ); } }
void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) { //////////////////////// // PERMISSIONS LOOKUP // //////////////////////// // do not enable the UI for incomplete items. LLViewerInventoryItem* i = (LLViewerInventoryItem*)item; BOOL is_complete = i->isFinished(); const BOOL cannot_restrict_permissions = LLInventoryType::cannotRestrictPermissions(i->getInventoryType()); const BOOL is_calling_card = (i->getInventoryType() == LLInventoryType::IT_CALLINGCARD); const LLPermissions& perm = item->getPermissions(); const BOOL can_agent_manipulate = gAgent.allowOperation(PERM_OWNER, perm, GP_OBJECT_MANIPULATE); const BOOL can_agent_sell = gAgent.allowOperation(PERM_OWNER, perm, GP_OBJECT_SET_SALE) && !cannot_restrict_permissions; const BOOL is_link = i->getIsLinkType(); // You need permission to modify the object to modify an inventory // item in it. LLViewerObject* object = NULL; if(!mObjectID.isNull()) object = gObjectList.findObject(mObjectID); BOOL is_obj_modify = TRUE; if(object) { is_obj_modify = object->permOwnerModify(); } ////////////////////// // ITEM NAME & DESC // ////////////////////// BOOL is_modifiable = gAgent.allowOperation(PERM_MODIFY, perm, GP_OBJECT_MANIPULATE) && is_obj_modify && is_complete; getChildView("LabelItemNameTitle")->setEnabled(TRUE); getChildView("LabelItemName")->setEnabled(is_modifiable && !is_calling_card); // for now, don't allow rename of calling cards getChild<LLUICtrl>("LabelItemName")->setValue(item->getName()); getChildView("LabelItemDescTitle")->setEnabled(TRUE); getChildView("LabelItemDesc")->setEnabled(is_modifiable); getChildView("IconLocked")->setVisible(!is_modifiable); getChild<LLUICtrl>("LabelItemDesc")->setValue(item->getDescription()); ////////////////// // CREATOR NAME // ////////////////// if(!gCacheName) return; if(!gAgent.getRegion()) return; if (item->getCreatorUUID().notNull()) { std::string name; gCacheName->getFullName(item->getCreatorUUID(), name); getChildView("BtnCreator")->setEnabled(TRUE); getChildView("LabelCreatorTitle")->setEnabled(TRUE); getChildView("LabelCreatorName")->setEnabled(TRUE); getChild<LLUICtrl>("LabelCreatorName")->setValue(name); } else { getChildView("BtnCreator")->setEnabled(FALSE); getChildView("LabelCreatorTitle")->setEnabled(FALSE); getChildView("LabelCreatorName")->setEnabled(FALSE); getChild<LLUICtrl>("LabelCreatorName")->setValue(getString("unknown")); } //////////////// // OWNER NAME // //////////////// if(perm.isOwned()) { std::string name; if (perm.isGroupOwned()) { gCacheName->getGroupName(perm.getGroup(), name); } else { gCacheName->getFullName(perm.getOwner(), name); } getChildView("BtnOwner")->setEnabled(TRUE); getChildView("LabelOwnerTitle")->setEnabled(TRUE); getChildView("LabelOwnerName")->setEnabled(TRUE); getChild<LLUICtrl>("LabelOwnerName")->setValue(name); } else { getChildView("BtnOwner")->setEnabled(FALSE); getChildView("LabelOwnerTitle")->setEnabled(FALSE); getChildView("LabelOwnerName")->setEnabled(FALSE); getChild<LLUICtrl>("LabelOwnerName")->setValue(getString("public")); } ////////////////// // ACQUIRE DATE // ////////////////// time_t time_utc = item->getCreationDate(); if (0 == time_utc) { getChild<LLUICtrl>("LabelAcquiredDate")->setValue(getString("unknown")); } else { std::string timeStr = getString("acquiredDate"); LLSD substitution; substitution["datetime"] = (S32) time_utc; LLStringUtil::format (timeStr, substitution); getChild<LLUICtrl>("LabelAcquiredDate")->setValue(timeStr); } /////////////////////// // OWNER PERMISSIONS // /////////////////////// if(can_agent_manipulate) { getChild<LLUICtrl>("OwnerLabel")->setValue(getString("you_can")); } else { getChild<LLUICtrl>("OwnerLabel")->setValue(getString("owner_can")); } U32 base_mask = perm.getMaskBase(); U32 owner_mask = perm.getMaskOwner(); U32 group_mask = perm.getMaskGroup(); U32 everyone_mask = perm.getMaskEveryone(); U32 next_owner_mask = perm.getMaskNextOwner(); getChildView("OwnerLabel")->setEnabled(TRUE); getChildView("CheckOwnerModify")->setEnabled(FALSE); getChild<LLUICtrl>("CheckOwnerModify")->setValue(LLSD((BOOL)(owner_mask & PERM_MODIFY))); getChildView("CheckOwnerCopy")->setEnabled(FALSE); getChild<LLUICtrl>("CheckOwnerCopy")->setValue(LLSD((BOOL)(owner_mask & PERM_COPY))); getChildView("CheckOwnerTransfer")->setEnabled(FALSE); getChild<LLUICtrl>("CheckOwnerTransfer")->setValue(LLSD((BOOL)(owner_mask & PERM_TRANSFER))); /////////////////////// // DEBUG PERMISSIONS // /////////////////////// if( gSavedSettings.getBOOL("DebugPermissions") ) { BOOL slam_perm = FALSE; BOOL overwrite_group = FALSE; BOOL overwrite_everyone = FALSE; if (item->getType() == LLAssetType::AT_OBJECT) { U32 flags = item->getFlags(); slam_perm = flags & LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM; overwrite_everyone = flags & LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE; overwrite_group = flags & LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; } std::string perm_string; perm_string = "B: "; perm_string += mask_to_string(base_mask); getChild<LLUICtrl>("BaseMaskDebug")->setValue(perm_string); getChildView("BaseMaskDebug")->setVisible(TRUE); perm_string = "O: "; perm_string += mask_to_string(owner_mask); getChild<LLUICtrl>("OwnerMaskDebug")->setValue(perm_string); getChildView("OwnerMaskDebug")->setVisible(TRUE); perm_string = "G"; perm_string += overwrite_group ? "*: " : ": "; perm_string += mask_to_string(group_mask); getChild<LLUICtrl>("GroupMaskDebug")->setValue(perm_string); getChildView("GroupMaskDebug")->setVisible(TRUE); perm_string = "E"; perm_string += overwrite_everyone ? "*: " : ": "; perm_string += mask_to_string(everyone_mask); getChild<LLUICtrl>("EveryoneMaskDebug")->setValue(perm_string); getChildView("EveryoneMaskDebug")->setVisible(TRUE); perm_string = "N"; perm_string += slam_perm ? "*: " : ": "; perm_string += mask_to_string(next_owner_mask); getChild<LLUICtrl>("NextMaskDebug")->setValue(perm_string); getChildView("NextMaskDebug")->setVisible(TRUE); } else { getChildView("BaseMaskDebug")->setVisible(FALSE); getChildView("OwnerMaskDebug")->setVisible(FALSE); getChildView("GroupMaskDebug")->setVisible(FALSE); getChildView("EveryoneMaskDebug")->setVisible(FALSE); getChildView("NextMaskDebug")->setVisible(FALSE); } ///////////// // SHARING // ///////////// // Check for ability to change values. if (is_link || cannot_restrict_permissions) { getChildView("CheckShareWithGroup")->setEnabled(FALSE); getChildView("CheckEveryoneCopy")->setEnabled(FALSE); } else if (is_obj_modify && can_agent_manipulate) { getChildView("CheckShareWithGroup")->setEnabled(TRUE); getChildView("CheckEveryoneCopy")->setEnabled((owner_mask & PERM_COPY) && (owner_mask & PERM_TRANSFER)); } else { getChildView("CheckShareWithGroup")->setEnabled(FALSE); getChildView("CheckEveryoneCopy")->setEnabled(FALSE); } // Set values. BOOL is_group_copy = (group_mask & PERM_COPY) ? TRUE : FALSE; BOOL is_group_modify = (group_mask & PERM_MODIFY) ? TRUE : FALSE; BOOL is_group_move = (group_mask & PERM_MOVE) ? TRUE : FALSE; if (is_group_copy && is_group_modify && is_group_move) { getChild<LLUICtrl>("CheckShareWithGroup")->setValue(LLSD((BOOL)TRUE)); LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); if(ctl) { ctl->setTentative(FALSE); } } else if (!is_group_copy && !is_group_modify && !is_group_move) { getChild<LLUICtrl>("CheckShareWithGroup")->setValue(LLSD((BOOL)FALSE)); LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); if(ctl) { ctl->setTentative(FALSE); } } else { LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); if(ctl) { ctl->setTentative(TRUE); ctl->set(TRUE); } } getChild<LLUICtrl>("CheckEveryoneCopy")->setValue(LLSD((BOOL)(everyone_mask & PERM_COPY))); /////////////// // SALE INFO // /////////////// const LLSaleInfo& sale_info = item->getSaleInfo(); BOOL is_for_sale = sale_info.isForSale(); // Check for ability to change values. if (is_obj_modify && can_agent_sell && gAgent.allowOperation(PERM_TRANSFER, perm, GP_OBJECT_MANIPULATE)) { getChildView("SaleLabel")->setEnabled(is_complete); getChildView("CheckPurchase")->setEnabled(is_complete); getChildView("NextOwnerLabel")->setEnabled(TRUE); getChildView("CheckNextOwnerModify")->setEnabled((base_mask & PERM_MODIFY) && !cannot_restrict_permissions); getChildView("CheckNextOwnerCopy")->setEnabled((base_mask & PERM_COPY) && !cannot_restrict_permissions); getChildView("CheckNextOwnerTransfer")->setEnabled((next_owner_mask & PERM_COPY) && !cannot_restrict_permissions); getChildView("RadioSaleType")->setEnabled(is_complete && is_for_sale); getChildView("TextPrice")->setEnabled(is_complete && is_for_sale); getChildView("Edit Cost")->setEnabled(is_complete && is_for_sale); } else { getChildView("SaleLabel")->setEnabled(FALSE); getChildView("CheckPurchase")->setEnabled(FALSE); getChildView("NextOwnerLabel")->setEnabled(FALSE); getChildView("CheckNextOwnerModify")->setEnabled(FALSE); getChildView("CheckNextOwnerCopy")->setEnabled(FALSE); getChildView("CheckNextOwnerTransfer")->setEnabled(FALSE); getChildView("RadioSaleType")->setEnabled(FALSE); getChildView("TextPrice")->setEnabled(FALSE); getChildView("Edit Cost")->setEnabled(FALSE); } // Set values. getChild<LLUICtrl>("CheckPurchase")->setValue(is_for_sale); getChildView("combobox sale copy")->setEnabled(is_for_sale); getChildView("Edit Cost")->setEnabled(is_for_sale); getChild<LLUICtrl>("CheckNextOwnerModify")->setValue(LLSD(BOOL(next_owner_mask & PERM_MODIFY))); getChild<LLUICtrl>("CheckNextOwnerCopy")->setValue(LLSD(BOOL(next_owner_mask & PERM_COPY))); getChild<LLUICtrl>("CheckNextOwnerTransfer")->setValue(LLSD(BOOL(next_owner_mask & PERM_TRANSFER))); LLRadioGroup* radioSaleType = getChild<LLRadioGroup>("RadioSaleType"); if (is_for_sale) { radioSaleType->setSelectedIndex((S32)sale_info.getSaleType() - 1); S32 numerical_price; numerical_price = sale_info.getSalePrice(); getChild<LLUICtrl>("Edit Cost")->setValue(llformat("%d",numerical_price)); } else { radioSaleType->setSelectedIndex(-1); getChild<LLUICtrl>("Edit Cost")->setValue(llformat("%d",0)); } }
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::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; std::set<LLViewerObject*>::iterator pick_it; i = 0; for (pick_it = mSelectPickList.begin(); pick_it != mSelectPickList.end();) { LLViewerObject* objp = (*pick_it); if (!objp || objp->isDead() || !objp->mbCanSelect) { mSelectPickList.erase(pick_it++); continue; } objp->mGLName = (i * step) + GL_NAME_INDEX_OFFSET; i++; ++pick_it; } LLHUDIcon::generatePickIDs(i * step, step); } }
void LLFloaterProperties::updateSaleInfo() { LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem(); if(!item) return; LLSaleInfo sale_info(item->getSaleInfo()); if(!gAgent.allowOperation(PERM_TRANSFER, item->getPermissions(), GP_OBJECT_SET_SALE)) { getChild<LLUICtrl>("CheckPurchase")->setValue(LLSD((BOOL)FALSE)); } if((BOOL)getChild<LLUICtrl>("CheckPurchase")->getValue()) { // turn on sale info LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_COPY; LLRadioGroup* RadioSaleType = getChild<LLRadioGroup>("RadioSaleType"); if(RadioSaleType) { switch (RadioSaleType->getSelectedIndex()) { case 0: sale_type = LLSaleInfo::FS_ORIGINAL; break; case 1: sale_type = LLSaleInfo::FS_COPY; break; case 2: sale_type = LLSaleInfo::FS_CONTENTS; break; default: sale_type = LLSaleInfo::FS_COPY; break; } } if (sale_type == LLSaleInfo::FS_COPY && !gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_SET_SALE)) { sale_type = LLSaleInfo::FS_ORIGINAL; } S32 price = -1; price = getChild<LLUICtrl>("Edit Cost")->getValue().asInteger();; // Invalid data - turn off the sale if (price < 0) { sale_type = LLSaleInfo::FS_NOT; price = 0; } sale_info.setSaleType(sale_type); sale_info.setSalePrice(price); } else { sale_info.setSaleType(LLSaleInfo::FS_NOT); } if(sale_info != item->getSaleInfo() && item->isFinished()) { LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); // Force an update on the sale price at rez if (item->getType() == LLAssetType::AT_OBJECT) { U32 flags = new_item->getFlags(); flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_SALE; new_item->setFlags(flags); } new_item->setSaleInfo(sale_info); if(mObjectID.isNull()) { // This is in the agent's inventory. new_item->updateServer(FALSE); gInventory.updateItem(new_item); gInventory.notifyObservers(); } else { // This is in an object's contents. 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(); } }
void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port) { if (gNoRender) { return; } if (objectp->isDead()) { llwarns << "Trying to find orphans for dead obj " << objectp->mID << ":" << objectp->getPCodeString() << llendl; return; } // See if we are a parent of an orphan. // Note: This code is fairly inefficient but it should happen very rarely. // It can be sped up if this is somehow a performance issue... if (0 == mOrphanParents.count()) { // no known orphan parents return; } if (-1 == mOrphanParents.find(getIndex(objectp->mLocalID, ip, port))) { // did not find objectp in OrphanParent list return; } S32 i; U64 parent_info = getIndex(objectp->mLocalID, ip, port); BOOL orphans_found = FALSE; // Iterate through the orphan list, and set parents of matching children. for (i = 0; i < mOrphanChildren.count(); i++) { if (mOrphanChildren[i].mParentInfo != parent_info) { continue; } LLViewerObject *childp = findObject(mOrphanChildren[i].mChildInfo); if (childp) { if (childp == objectp) { llwarns << objectp->mID << " has self as parent, skipping!" << llendl; continue; } #ifdef ORPHAN_SPAM llinfos << "Reunited parent " << objectp->mID << " with child " << childp->mID << llendl; llinfos << "Glob: " << objectp->getPositionGlobal() << llendl; llinfos << "Agent: " << objectp->getPositionAgent() << llendl; addDebugBeacon(objectp->getPositionAgent(),""); #endif gPipeline.markMoved(objectp->mDrawable); objectp->setChanged(LLXform::MOVED | LLXform::SILHOUETTE); // Flag the object as no longer orphaned childp->mOrphaned = FALSE; if (childp->mDrawable.notNull()) { // Make the drawable visible again and set the drawable parent childp->mDrawable->setState(LLDrawable::CLEAR_INVISIBLE); childp->setDrawableParent(objectp->mDrawable); // LLViewerObjectList::findOrphans() } // Make certain particles, icon and HUD aren't hidden childp->hideExtraDisplayItems( FALSE ); objectp->addChild(childp); orphans_found = TRUE; } else { llinfos << "Missing orphan child, removing from list" << llendl; mOrphanChildren.remove(i); i--; } } // Remove orphan parent and children from lists now that they've been found mOrphanParents.remove(mOrphanParents.find(parent_info)); i = 0; while (i < mOrphanChildren.count()) { if (mOrphanChildren[i].mParentInfo == parent_info) { mOrphanChildren.remove(i); mNumOrphans--; } else { i++; } } if (orphans_found && objectp->isSelected()) { LLSelectNode* nodep = LLSelectMgr::getInstance()->getSelection()->findNode(objectp); if (nodep && !nodep->mIndividualSelection) { // rebuild selection with orphans LLSelectMgr::getInstance()->deselectObjectAndFamily(objectp); LLSelectMgr::getInstance()->selectObjectAndFamily(objectp); } } }
void LLPreviewNotecard::loadAsset() { // request the asset. const LLInventoryItem* item = getItem(); LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); if (!editor) return; if(item) { if (gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE) || gAgent.isGodlike()) { mAssetID = item->getAssetUUID(); if(mAssetID.isNull()) { editor->setText(LLStringUtil::null); editor->makePristine(); editor->setEnabled(TRUE); mAssetStatus = PREVIEW_ASSET_LOADED; } else { LLHost source_sim = LLHost::invalid; if (mObjectUUID.notNull()) { LLViewerObject *objectp = gObjectList.findObject(mObjectUUID); if (objectp && objectp->getRegion()) { source_sim = objectp->getRegion()->getHost(); } else { // The object that we're trying to look at disappeared, bail. llwarns << "Can't find object " << mObjectUUID << " associated with notecard." << llendl; mAssetID.setNull(); editor->setText(getString("no_object")); editor->makePristine(); editor->setEnabled(FALSE); mAssetStatus = PREVIEW_ASSET_LOADED; return; } } gAssetStorage->getInvItemAsset(source_sim, gAgent.getID(), gAgent.getSessionID(), item->getPermissions().getOwner(), mObjectUUID, item->getUUID(), item->getAssetUUID(), item->getType(), &onLoadComplete, (void*)new LLUUID(mItemUUID), TRUE); mAssetStatus = PREVIEW_ASSET_LOADING; } } else { mAssetID.setNull(); editor->setText(getString("not_allowed")); editor->makePristine(); editor->setEnabled(FALSE); mAssetStatus = PREVIEW_ASSET_LOADED; } if(!gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE)) { editor->setEnabled(FALSE); getChildView("lock")->setVisible( TRUE); } } else { editor->setText(LLStringUtil::null); editor->makePristine(); editor->setEnabled(TRUE); // Don't set asset status here; we may not have set the item id yet // (e.g. when this gets called initially) //mAssetStatus = PREVIEW_ASSET_LOADED; } }
// 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; if (LLMuteList::getInstance()->isMuted(object->getID(), name)) { mute_msg = LLTrans::getString("UnmuteObject"); } else { mute_msg = LLTrans::getString("MuteObject2"); } gMenuHolder->getChild<LLUICtrl>("Object Mute")->setValue(mute_msg); gMenuObject->show(x, y); showVisualContextMenuEffect(); } } LLTool::handleRightMouseDown(x, y, mask); // We handled the event. return TRUE; }