void ScriptCounter::subserialize(LLViewerObject* linkset) { LLViewerObject* object = linkset; LLDynamicArray<LLViewerObject*> count_objects; count_objects.put(object); LLViewerObject::child_list_t child_list = object->getChildren(); for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i) { LLViewerObject* child = *i; if(!child->isAvatar()) count_objects.put(child); } S32 object_index = 0; while ((object_index < count_objects.count())) { object = count_objects.get(object_index++); LLUUID id = object->getID(); objIDS.insert(id.asString()); llinfos << "Counting scripts in prim " << object->getID().asString() << llendl; object->registerInventoryListener(sInstance,NULL); object->dirtyInventory(); object->requestInventory(); invqueries += 1; } }
void LLToolGrab::stopSpin() { mSpinGrabbing = FALSE; LLViewerObject* objectp = mGrabPick.getObject(); if (!objectp) { return; } LLMessageSystem *msg = gMessageSystem; switch(mMode) { case GRAB_ACTIVE_CENTER: case GRAB_NONPHYSICAL: case GRAB_LOCKED: msg->newMessageFast(_PREHASH_ObjectSpinStop); 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->sendMessage( objectp->getRegion()->getHost() ); break; case GRAB_NOOBJECT: case GRAB_INACTIVE: default: // do nothing break; } }
BOOL LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject &object) { if(object.getRegion()) { U32 local_id = object.mLocalID; LLHost region_host = object.getRegion()->getHost(); U32 ip = region_host.getAddress(); U32 port = region_host.getPort(); U64 ipport = (((U64)ip) << 32) | (U64)port; U32 index = sIPAndPortToIndex[ipport]; U64 indexid = (((U64)index) << 32) | (U64)local_id; std::map<U64, LLUUID>::iterator iter = sIndexAndLocalIDToUUID.find(indexid); if (iter == sIndexAndLocalIDToUUID.end()) { return FALSE; } // Found existing entry if (iter->second == object.getID()) { // Full UUIDs match, so remove the entry sIndexAndLocalIDToUUID.erase(iter); return TRUE; } // UUIDs did not match - this would zap a valid entry, so don't erase it //llinfos << "Tried to erase entry where id in table (" // << iter->second << ") did not match object " << object.getID() << llendl; } return FALSE; }
void LLPanelGroupInvite::addUsers(std::vector<LLUUID>& agent_ids) { std::vector<std::string> names; for (S32 i = 0; i < (S32)agent_ids.size(); i++) { LLUUID agent_id = agent_ids[i]; LLViewerObject* dest = gObjectList.findObject(agent_id); if(dest && dest->isAvatar()) { std::string fullname; LLStringUtil::format_map_t args; LLNameValue* nvfirst = dest->getNVPair("FirstName"); LLNameValue* nvlast = dest->getNVPair("LastName"); if(nvfirst && nvlast) { args["[FIRST]"] = nvfirst->getString(); args["[LAST]"] = nvlast->getString(); fullname = nvfirst->getString(); fullname += " "; fullname += nvlast->getString(); } if (!fullname.empty()) { names.push_back(fullname); } else { llwarns << "llPanelGroupInvite: Selected avatar has no name: " << dest->getID() << llendl; names.push_back("(Unknown)"); } } } mImplementation->addUsers(names, agent_ids); }
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()); 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 LLPanelGroupBulk::addUsers(uuid_vec_t& agent_ids) { std::vector<std::string> names; for (S32 i = 0; i < (S32)agent_ids.size(); i++) { std::string fullname; LLUUID agent_id = agent_ids[i]; LLViewerObject* dest = gObjectList.findObject(agent_id); if(dest && dest->isAvatar()) { LLNameValue* nvfirst = dest->getNVPair("FirstName"); LLNameValue* nvlast = dest->getNVPair("LastName"); if(nvfirst && nvlast) { fullname = LLCacheName::buildFullName( nvfirst->getString(), nvlast->getString()); } if (!fullname.empty()) { names.push_back(fullname); } else { llwarns << "llPanelGroupBulk: Selected avatar has no name: " << dest->getID() << llendl; names.push_back("(Unknown)"); } } else { //looks like user try to invite offline friend //for offline avatar_id gObjectList.findObject() will return null //so we need to do this additional search in avatar tracker, see EXT-4732 //if (LLAvatarTracker::instance().isBuddy(agent_id)) // Singu Note: We may be using this from another avatar list like group profile, disregard friendship status. { LLAvatarName av_name; if (!LLAvatarNameCache::get(agent_id, &av_name)) { // actually it should happen, just in case LLAvatarNameCache::get(LLUUID(agent_id), boost::bind(&LLPanelGroupBulk::addUserCallback, this, _1, _2)); // for this special case! //when there is no cached name we should remove resident from agent_ids list to avoid breaking of sequence // removed id will be added in callback agent_ids.erase(agent_ids.begin() + i); } else { std::string name; LLAvatarNameCache::getPNSName(av_name, name); names.push_back(name); } } } } mImplementation->mListFullNotificationSent = false; mImplementation->addUsers(names, agent_ids); }
void LLPanelGroupInvite::addUsers(std::vector<LLUUID>& agent_ids) { std::vector<std::string> names; for (S32 i = 0; i < (S32)agent_ids.size(); i++) { LLUUID agent_id = agent_ids[i]; LLViewerObject* dest = gObjectList.findObject(agent_id); std::string fullname; if(dest && dest->isAvatar()) { LLNameValue* nvfirst = dest->getNVPair("FirstName"); LLNameValue* nvlast = dest->getNVPair("LastName"); if(nvfirst && nvlast) { fullname = std::string(nvfirst->getString()) + " " + std::string(nvlast->getString()); } if (!fullname.empty()) { names.push_back(fullname); } else { llwarns << "llPanelGroupInvite: Selected avatar has no name: " << dest->getID() << llendl; names.push_back("(Unknown)"); } } else { //looks like user try to invite offline friend //for offline avatar_id gObjectList.findObject() will return null //so we need to do this additional search in avatar tracker, see EXT-4732 if (LLAvatarTracker::instance().isBuddy(agent_id)) { if (!gCacheName->getFullName(agent_id, fullname)) { // actually it should happen, just in case gCacheName->get(LLUUID(agent_id), false, boost::bind( &LLPanelGroupInvite::addUserCallback, this, _1, _2, _3)); // for this special case! //when there is no cached name we should remove resident from agent_ids list to avoid breaking of sequence // removed id will be added in callback agent_ids.erase(agent_ids.begin() + i); } else { names.push_back(fullname); } } } } mImplementation->addUsers(names, agent_ids); }
LLSD FSFloaterObjectExport::getLinkSet(LLSelectNode* node) { LLSD linkset; LLViewerObject* object = node->getObject(); LLUUID object_id = object->getID(); // root prim linkset.append(object_id); addPrim(object, true); // child prims LLViewerObject::const_child_list_t& child_list = object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); iter != child_list.end(); ++iter) { LLViewerObject* child = *iter; linkset.append(child->getID()); addPrim(child, false); } return linkset; }
BOOL LLFloaterAttachments::postBuild(void) { if(!mSelection) return TRUE; if(mSelection->getRootObjectCount() < 1) return TRUE; childSetCommitCallback("attachment_list", onCommitAttachmentList, this); childSetAction("inventory_btn", onClickInventory, this); childSetAction("textures_btn", onClickTextures, this); childSetAction("view_children_btn", onClickViewChildren, this); LLViewerObject* avatar = NULL; for (LLObjectSelection::valid_root_iterator iter = mSelection->valid_root_begin(); iter != mSelection->valid_root_end(); iter++) { LLSelectNode* nodep = *iter; LLViewerObject* objectp = nodep->getObject(); LLViewerObject* parentp = objectp->getSubParent(); if(parentp) { if(parentp->isAvatar()) { // parent is an avatar avatar = parentp; break; } } if(objectp->isAvatar()) { avatar = objectp; break; } } if(avatar) { std::string av_name; gCacheName->getFullName(avatar->getID(), av_name); if(!av_name.empty()) setTitle(av_name + " HUDs"); selectAgentHudPrims(avatar); } return TRUE; }
void LLFloaterOpenObject::moveToInventory(bool wear) { if (mObjectSelection->getRootObjectCount() != 1) { gViewerWindow->alertXml("OnlyCopyContentsOfSingleItem"); return; } LLSelectNode* node = mObjectSelection->getFirstRootNode(); if (!node) return; LLViewerObject* object = node->getObject(); if (!object) return; LLUUID object_id = object->getID(); std::string name = node->mName; // Either create a sub-folder of clothing, or of the root folder. LLUUID parent_category_id; if (wear) { parent_category_id = gInventory.findCategoryUUIDForType( LLAssetType::AT_CLOTHING); } else { parent_category_id = gAgent.getInventoryRootID(); } LLUUID category_id = gInventory.createNewCategory(parent_category_id, LLAssetType::AT_NONE, name); LLCatAndWear* data = new LLCatAndWear; data->mCatID = category_id; data->mWear = wear; // Copy and/or move the items into the newly created folder. // Ignore any "you're going to break this item" messages. BOOL success = move_inv_category_world_to_agent(object_id, category_id, TRUE, callbackMoveInventory, (void*)data); if (!success) { delete data; data = NULL; gViewerWindow->alertXml("OpenObjectCannotCopy"); } }
LLUUID LLVOPartGroup::getPartSource(S32 idx) { LLUUID ret = LLUUID::null; if (idx < (S32) mViewerPartGroupp->mParticles.size()) { LLViewerPart* part = mViewerPartGroupp->mParticles[idx]; if (part && part->mPartSourcep.notNull() && part->mPartSourcep->mSourceObjectp.notNull()) { LLViewerObject* source = part->mPartSourcep->mSourceObjectp; ret = source->getID(); } } return ret; }
void LLFloaterOpenObject::moveToInventory(bool wear) { if (mObjectSelection->getRootObjectCount() != 1) { LLNotificationsUtil::add("OnlyCopyContentsOfSingleItem"); return; } LLSelectNode* node = mObjectSelection->getFirstRootNode(); if (!node) return; LLViewerObject* object = node->getObject(); if (!object) return; LLUUID object_id = object->getID(); std::string name = node->mName; // Either create a sub-folder of clothing, or of the root folder. LLUUID parent_category_id; if (wear) { parent_category_id = gInventory.findCategoryUUIDForType( LLFolderType::FT_CLOTHING); } else { parent_category_id = gInventory.getRootFolderID(); } LLCategoryCreate* cat_data = new LLCategoryCreate(object_id, wear); LLUUID category_id = gInventory.createNewCategory(parent_category_id, LLFolderType::FT_NONE, name, callbackCreateInventoryCategory, (void*)cat_data); //If we get a null category ID, we are using a capability in createNewCategory and we will //handle the following in the callbackCreateInventoryCategory routine. if ( category_id.notNull() ) { LLSD result; result["folder_id"] = category_id; //Reduce redundant code by just calling the callback. Dur. callbackCreateInventoryCategory(result,cat_data); } }
void LLPanelPermissions::onClickCopyObjKey(void* data) { //NAMESHORT - Was requested on the forums, was going to integrate a textbox with the ID, but due to lack of room on the floater, //We now have a copy button :> //Madgeek - Hacked together method to copy more than one key, separated by comma. std::string output; std::string separator = gSavedSettings.getString("PhoenixCopyObjKeySeparator"); for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) { LLSelectNode* selectNode = *iter; LLViewerObject* object = selectNode->getObject(); if (object) { if (!output.empty()) output.append(separator); output.append(object->getID().asString()); } } if (!output.empty()) gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(output)); }
std::string gather_keys(iterator iter, iterator end) { //NAMESHORT - Was requested on the forums, was going to integrate a textbox with the ID, but due to lack of room on the floater, //We now have a copy button :> //Madgeek - Hacked together method to copy more than one key, separated by comma. //At some point the separator was changed to read from the xml settings - I'll probably try to make this openly changable from settings. -HgB //Lirusaito - Tweaked to copy selected prim(s) when EditLinkedParts, main functionality moved into gather_keys std::string output; std::string separator = gSavedSettings.getString("AscentDataSeparator"); for (; iter != end; ++iter) { LLSelectNode* selectNode = *iter; LLViewerObject* object = selectNode->getObject(); if (object) { if (!output.empty()) output.append(separator); output.append(object->getID().asString()); } } return output; }
// static void LLFloaterPay::payViaObject(money_callback callback, LLSafeHandle<LLObjectSelection> selection) { // Object that lead to the selection, may be child LLViewerObject* object = selection->getPrimaryObject(); if (!object) return; LLFloaterPay *floater = LLFloaterReg::showTypedInstance<LLFloaterPay>("pay_object", LLSD(object->getID())); if (!floater) return; floater->setCallback(callback); // Hold onto the selection until we close floater->mObjectSelection = selection; LLSelectNode* node = selection->getFirstRootNode(); if (!node) { //FIXME: notify user object no longer exists floater->closeFloater(); return; } LLHost target_region = object->getRegion()->getHost(); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_RequestPayPrice); msg->nextBlockFast(_PREHASH_ObjectData); msg->addUUIDFast(_PREHASH_ObjectID, object->getID()); msg->sendReliable(target_region); msg->setHandlerFuncFast(_PREHASH_PayPriceReply, processPayPriceReply,(void **)floater); LLUUID owner_id; BOOL is_group = FALSE; node->mPermissions->getOwnership(owner_id, is_group); floater->childSetText("object_name_text",node->mName); floater->finishPayUI(owner_id, is_group); }
void FSLSLBridgeScriptCallback::fire(const LLUUID& inv_item) { if (inv_item.isNull() || !FSLSLBridge::instance().getBridgeCreating()) return; LLViewerInventoryItem* item = gInventory.getItem(inv_item); if (!item) { return; } gInventory.updateItem(item); gInventory.notifyObservers(); LLViewerObject* obj = gAgentAvatarp->getWornAttachment(FSLSLBridge::instance().getBridge()->getUUID()); //caps import std::string url = gAgent.getRegion()->getCapability("UpdateScriptAgent"); std::string isMono = "lsl2"; //could also be "mono" if (!url.empty() && obj != NULL) { const std::string fName = prepUploadFile(); LLLiveLSLEditor::uploadAssetViaCapsStatic(url, fName, obj->getID(), inv_item, isMono, true); llinfos << "updating script ID for bridge" << llendl; FSLSLBridge::instance().mScriptItemID = inv_item; } else { //can't complete bridge creation - detach and remove object, remove script //try to clean up and go away. Fail. LLVOAvatarSelf::detachAttachmentIntoInventory(FSLSLBridge::instance().getBridge()->getUUID()); FSLSLBridge::instance().cleanUpBridge(); //also clean up script remains gInventory.purgeObject(item->getUUID()); gInventory.notifyObservers(); return; } }
void LLFloaterPathfindingObjects::showFloaterWithSelectionObjects() { mObjectsToBeSelected.clear(); LLObjectSelectionHandle selectedObjectsHandle = LLSelectMgr::getInstance()->getSelection(); if (selectedObjectsHandle.notNull()) { LLObjectSelection *selectedObjects = selectedObjectsHandle.get(); if (!selectedObjects->isEmpty()) { for (LLObjectSelection::valid_iterator objectIter = selectedObjects->valid_begin(); objectIter != selectedObjects->valid_end(); ++objectIter) { LLSelectNode *object = *objectIter; LLViewerObject *viewerObject = object->getObject(); mObjectsToBeSelected.push_back(viewerObject->getID()); } } } mHasObjectsToBeSelected = true; if (!getVisible()) { open(); setVisibleAndFrontmost(); } else { rebuildObjectsScrollList(); if (isMinimized()) { setMinimized(FALSE); } setVisibleAndFrontmost(); } setFocus(TRUE); }
//LLScrollListCtrl::getSelectedIDs(); void JCFloaterAnimList::refresh() { LLDynamicArray<LLUUID> selected = mAnimList->getSelectedIDs(); S32 scrollpos = mAnimList->getScrollPos(); mAnimList->deleteAllItems(); LLVOAvatar* avatarp = gAgent.getAvatarObject(); if (avatarp) { LLVOAvatar::AnimSourceIterator ai; for(ai = avatarp->mAnimationSources.begin(); ai != avatarp->mAnimationSources.end(); ++ai) { LLSD element; const LLUUID &aifirst = ai->first; LLViewerInventoryItem* item = gInventory.getItem(findItemID(ai->second,0)); // *NOTE: conceal id to prevent bugs, use // item->getColumn(LIST_ANIMATION_UUID)->getValue().asUUID() // instead element["id"] = LLUUID::null.combine(ai->second); element["columns"][LIST_ANIMATION_NAME]["column"] = "Anim Name"; element["columns"][LIST_ANIMATION_NAME]["type"] = "text"; element["columns"][LIST_ANIMATION_NAME]["color"] = gColors.getColor("DefaultListText").getValue(); if(item) { element["columns"][LIST_ANIMATION_NAME]["value"] = item->getName();//ai->second//"avatar_icon"; }else { element["columns"][LIST_ANIMATION_NAME]["value"] = "Not in Inventory"; } element["columns"][LIST_ANIMATION_UUID]["column"] = "Animation UUID"; element["columns"][LIST_ANIMATION_UUID]["type"] = "text"; element["columns"][LIST_ANIMATION_UUID]["color"] = gColors.getColor("DefaultListText").getValue(); element["columns"][LIST_ANIMATION_UUID]["value"] = ai->second; element["columns"][LIST_OBJECT_UUID]["column"] = "Source Object UUID"; element["columns"][LIST_OBJECT_UUID]["type"] = "text"; element["columns"][LIST_OBJECT_UUID]["color"] = gColors.getColor("DefaultListText").getValue(); element["columns"][LIST_OBJECT_UUID]["value"] = aifirst; element["columns"][LIST_OBJECT_OWNER]["column"] = "Source Owner"; element["columns"][LIST_OBJECT_OWNER]["type"] = "text"; element["columns"][LIST_OBJECT_OWNER]["color"] = gColors.getColor("DefaultListText").getValue(); std::string name("?"); LLViewerObject *object = gObjectList.findObject(aifirst); bool is_first = ( mObjectOwners.count( aifirst ) == 0 ); bool just_shown = false; LLUUID owner_id(LLUUID::null); if( !is_first ) { name = mObjectOwners[aifirst].owner_name; owner_id = mObjectOwners[aifirst].owner_id; } if( object ) { if( object->permYouOwner() ) { owner_id = gAgent.getID(); gAgent.getName(name); } else { object = (LLViewerObject *) object->getRoot(); if( object->isAvatar() ) { owner_id = object->getID(); name = ((LLVOAvatar *)object)->getFullname(); } } } { AObjectData &data = mObjectOwners[aifirst]; if( object ) { if( !data.in_object_list ) { just_shown = true; data.in_object_list = true; } data.root_id = ( (LLViewerObject*)object->getRoot() )->getID(); } data.owner_name = name; data.owner_id = owner_id; } if( is_first || just_shown ) { if( name == "?" && !aifirst.isNull()) { 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 ); if( object ) { LL_INFOS("Avatar List") << "Sending RequestObjectPropertiesFamily packet for id( " << aifirst.asString() << " ) on object( " << object->getID().asString() << " )" << LL_ENDL; msg->addUUIDFast(_PREHASH_ObjectID, object->getID()); } else { LL_INFOS("Avatar List") << "Sending RequestObjectPropertiesFamily packet for id( " << aifirst.asString() << " )" << LL_ENDL; msg->addUUIDFast(_PREHASH_ObjectID, aifirst); } gAgent.sendReliableMessage(); } } element["columns"][LIST_OBJECT_OWNER]["value"] = name; mAnimList->addElement(element, ADD_BOTTOM); //LLViewerObject* objectp = gObjectList.findObject(ai->first); //if(objectp) //{ // //objectp-> //} //object_ids.insert(ai->first); //animation_ids.insert(ai->second); } } mAnimList->sortItems(); mAnimList->selectMultiple(selected); mAnimList->setScrollPos(scrollpos); }
// 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(); } } gFocusMgr.setKeyboardFocus(NULL); 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) { if (!LLFloaterLand::isOpen()) { 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)) { // [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l // Block left-click special actions when fartouch restricted if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && (!gRlvHandler.canTouch(object, mPick.mObjectOffset)) ) { return TRUE; } // [/RLVa:KB] mClickAction = 0; if (object && object->getClickAction()) { mClickAction = object->getClickAction(); } else if (parent && parent->getClickAction()) { mClickAction = parent->getClickAction(); } switch(mClickAction) { case CLICK_ACTION_TOUCH: // touch behavior down below... break; case CLICK_ACTION_SIT: if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->mIsSitting) && !gSavedSettings.getBOOL("EmeraldBlockClickSit")) // agent not already sitting { handle_sit_or_stand(); // put focus in world when sitting on an object gFocusMgr.setKeyboardFocus(NULL); 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); if (LLSelectMgr::getInstance()->selectGetAllValid()) { // call this right away, since we have all the info we need to continue the action selectionPropertiesReceived(); } return TRUE; } break; case CLICK_ACTION_BUY: mClickActionObject = parent; mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE); if (LLSelectMgr::getInstance()->selectGetAllValid()) { // call this right away, since we have all the info we need to continue the action selectionPropertiesReceived(); } return TRUE; case CLICK_ACTION_OPEN: if (parent && parent->allowOpen()) { mClickActionObject = parent; mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE); if (LLSelectMgr::getInstance()->selectGetAllValid()) { // call this right away, since we have all the info we need to continue the action selectionPropertiesReceived(); } } 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; default: // nothing break; } } if (!always_show && handle_media_click(mPick)) { return FALSE; } // put focus back "in world" gFocusMgr.setKeyboardFocus(NULL); // Switch to grab tool if physical or triggerable if (object && !object->isAvatar() && ((object->usePhysics() || (parent && !parent->isAvatar() && parent->usePhysics())) || touchable) && !always_show) { // [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l // Triggered by left-clicking on a touchable object if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canTouch(object, mPick.mObjectOffset)) ) { return LLTool::handleMouseDown(x, y, mask); } // [/RLVa:KB] gGrabTransientTool = this; LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() ); return LLToolGrab::getInstance()->handleObjectHit( mPick ); } LLHUDIcon* last_hit_hud_icon = mPick.mHUDIcon; if (!object && last_hit_hud_icon && last_hit_hud_icon->getSourceObject()) { LLFloaterScriptDebug::show(last_hit_hud_icon->getSourceObject()->getID()); } // If left-click never selects or spawns a menu // Eat the event. if (!gSavedSettings.getBOOL("LeftClickShowMenu") && !always_show) { // mouse already released if (!mGrabMouseButtonDown) { return TRUE; } while( object && object->isAttachment() && !object->flagHandleTouch()) { // don't pick avatar through hud attachment if (object->isHUDAttachment()) { break; } object = (LLViewerObject*)object->getParent(); } if (object && object == gAgent.getAvatarObject()) { // we left clicked on avatar, switch to focus mode LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance()); gViewerWindow->hideCursor(); LLToolCamera::getInstance()->setMouseCapture(TRUE); LLToolCamera::getInstance()->pickCallback(mPick); if(gSavedSettings.getBOOL("ResetFocusOnSelfClick")) { gAgent.setFocusOnAvatar(TRUE, TRUE); } return TRUE; } // Could be first left-click on nothing LLFirstUse::useLeftClickNoHit(); // Eat the event return LLTool::handleMouseDown(x, y, mask); } if (!always_show && gAgent.leftButtonGrabbed()) { // if the left button is grabbed, don't put up the pie menu return LLTool::handleMouseDown(x, y, mask); } // Can't ignore children here. LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE); // Spawn pie menu 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); // [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l // Don't show the pie menu on empty selection when fartouch/interaction restricted [see LLToolSelect::handleObjectSelection()] if ( (!rlv_handler_t::isEnabled()) || (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) || (!gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) ) { gPieAvatar->show(x, y, mPieMouseButtonDown); } else { make_ui_sound("UISndInvalidOp"); } // [/RLVa:KB] } else if (object->isAttachment()) { //gPieAttachment->show(x, y, mPieMouseButtonDown); // [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l // Don't show the pie menu on empty selection when fartouch/interaction restricted [see LLToolSelect::handleObjectSelection()] if ( (!rlv_handler_t::isEnabled()) || (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) || (!gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) ) { gPieAttachment->show(x, y, mPieMouseButtonDown); } else { make_ui_sound("UISndInvalidOp"); } // [/RLVa:KB] } 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"); } // [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l // Don't show the pie menu on empty selection when fartouch/interaction restricted // (not entirely accurate in case of Tools / Select Only XXX [see LLToolSelect::handleObjectSelection()] if ( (!rlv_handler_t::isEnabled()) || (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) || (!gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) ) { // [/RLVa:KB] 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); // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-0.2.0f } else { make_ui_sound("UISndInvalidOp"); } // [/RLVa:KB] } } 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; }
// static void JCFloaterAreaSearch::results() { if (!sInstance) return; if (!(sInstance->getVisible())) return; if (sRequested > 0 && sInstance->mLastUpdateTimer.getElapsedTimeF32() < min_refresh_interval) return; //llinfos << "results()" << llendl; uuid_vec_t selected = sInstance->mResultList->getSelectedIDs(); S32 scrollpos = sInstance->mResultList->getScrollPos(); sInstance->mResultList->deleteAllItems(); S32 i; S32 total = gObjectList.getNumObjects(); LLViewerRegion* our_region = gAgent.getRegion(); for (i = 0; i < total; i++) { LLViewerObject *objectp = gObjectList.getObject(i); if (objectp) { if (objectp->getRegion() == our_region && !objectp->isAvatar() && objectp->isRoot() && !objectp->flagTemporary() && !objectp->flagTemporaryOnRez()) { LLUUID object_id = objectp->getID(); if (sObjectDetails.count(object_id) == 0) { //llinfos << "not all entries are \"\"" << llendl; requestIfNeeded(objectp); } else { //llinfos << "all entries are \"\" or we have data" << llendl; AObjectDetails* details = &sObjectDetails[object_id]; std::string object_name = details->name; std::string object_desc = details->desc; std::string object_owner; std::string object_group; gCacheName->getFullName(details->owner_id, object_owner); gCacheName->getGroupName(details->group_id, object_group); if (object_name != request_string) { //llinfos << "both names are loaded or aren't needed" << llendl; std::string onU = object_owner; std::string cnU = object_group; LLStringUtil::toLower(object_name); LLStringUtil::toLower(object_desc); LLStringUtil::toLower(object_owner); LLStringUtil::toLower(object_group); if ((sSearchedName == "" || object_name.find(sSearchedName) != -1) && (sSearchedDesc == "" || object_desc.find(sSearchedDesc) != -1) && (sSearchedOwner == "" || object_owner.find(sSearchedOwner) != -1) && (sSearchedGroup == "" || object_group.find(sSearchedGroup) != -1)) { //llinfos << "pass" << llendl; LLSD element; element["id"] = object_id; element["columns"][LIST_OBJECT_NAME]["column"] = "Name"; element["columns"][LIST_OBJECT_NAME]["type"] = "text"; element["columns"][LIST_OBJECT_NAME]["value"] = details->name; //item->getName();//ai->second//"avatar_icon"; element["columns"][LIST_OBJECT_DESC]["column"] = "Description"; element["columns"][LIST_OBJECT_DESC]["type"] = "text"; element["columns"][LIST_OBJECT_DESC]["value"] = details->desc; //ai->second; element["columns"][LIST_OBJECT_OWNER]["column"] = "Owner"; element["columns"][LIST_OBJECT_OWNER]["type"] = "text"; element["columns"][LIST_OBJECT_OWNER]["value"] = onU; //ai->first; element["columns"][LIST_OBJECT_GROUP]["column"] = "Group"; element["columns"][LIST_OBJECT_GROUP]["type"] = "text"; element["columns"][LIST_OBJECT_GROUP]["value"] = cnU; //ai->second; sInstance->mResultList->addElement(element, ADD_BOTTOM); } } } } } } sInstance->mResultList->updateSort(); sInstance->mResultList->selectMultiple(selected); sInstance->mResultList->setScrollPos(scrollpos); sInstance->mCounterText->setText(llformat("%d listed/%d pending/%d total", sInstance->mResultList->getItemCount(), sRequested, sObjectDetails.size())); sInstance->mLastUpdateTimer.reset(); }
// 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->childSetText("Object Mute", mute_msg); gMenuObject->show(x, y); showVisualContextMenuEffect(); } } LLTool::handleRightMouseDown(x, y, mask); // We handled the event. return TRUE; }
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 = gAgent.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera; 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(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() ); // 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(); gAgent.setPointAt(POINTAT_TARGET_GRAB, objectp, local_edit_point ); gAgent.setLookAt(LOOKAT_TARGET_SELECT, objectp, local_edit_point ); } gViewerWindow->setCursor(UI_CURSOR_HAND); }
// 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 - gAgent.getCameraPositionGlobal(); } else if (!mVerticalDragging && (mask == MASK_VERTICAL) ) { // ...switch to vertical dragging mVerticalDragging = TRUE; mDragStartPointGlobal = gViewerWindow->clickPointInWorldGlobal(x, y, objectp); mDragStartFromCamera = mDragStartPointGlobal - gAgent.getCameraPositionGlobal(); } const F32 RADIANS_PER_PIXEL_X = 0.01f; const F32 RADIANS_PER_PIXEL_Y = 0.01f; S32 dx = x - (gViewerWindow->getWindowWidth() / 2); S32 dy = y - (gViewerWindow->getWindowHeight() / 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 = gAgent.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] > MAX_OBJECT_Z) { grab_point_global.mdV[VZ] = MAX_OBJECT_Z; } grab_point_global = LLWorld::getInstance()->clipToVisibleRegions(mDragStartPointGlobal, grab_point_global); // propagate constrained grab point back to grab offset mGrabHiddenOffsetFromCamera = grab_point_global - gAgent.getCameraPositionGlobal(); // Handle auto-rotation at screen edge. LLVector3 grab_pos_agent = gAgent.getPosAgentFromGlobal( grab_point_global ); LLCoordGL grab_center_gl( gViewerWindow->getWindowWidth() / 2, gViewerWindow->getWindowHeight() / 2); LLViewerCamera::getInstance()->projectPosAgentToScreen(grab_pos_agent, grab_center_gl); const S32 ROTATE_H_MARGIN = gViewerWindow->getWindowWidth() / 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 (gAgent.getFocusOnAvatar()) { gAgent.yaw(rotate_angle); } else { gAgent.cameraOrbitAround(rotate_angle); } } else if (grab_center_gl.mX > gViewerWindow->getWindowWidth() - ROTATE_H_MARGIN) { if (gAgent.getFocusOnAvatar()) { gAgent.yaw(-rotate_angle); } else { gAgent.cameraOrbitAround(-rotate_angle); } } // Don't move above top of screen or below bottom if ((grab_center_gl.mY < gViewerWindow->getWindowHeight() - 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 (!gAgent.cameraMouselook() && !objectp->isHUDAttachment() && objectp->getRoot() == gAgent.getAvatarObject()->getRoot()) { // force focus to point in space where we were looking previously gAgent.setFocusGlobal(gAgent.calcFocusPositionTargetGlobal(), LLUUID::null); gAgent.setFocusOnAvatar(FALSE, ANIMATE); } else { gAgent.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; }
LLSD LLObjectBackup::primsToLLSD(LLViewerObject::child_list_t child_list, bool is_attachment) { LLViewerObject* object; LLSD llsd; char localid[16]; for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i) { object = (*i); LLUUID id = object->getID(); LL_INFOS("ObjectBackup") << "Exporting prim " << object->getID().asString() << LL_ENDL; // Create an LLSD object that represents this prim. It will be injected in to the overall LLSD // tree structure LLSD prim_llsd; if (!object->isRoot()) { // Parent id snprintf(localid, sizeof(localid), "%u", object->getSubParent()->getLocalID()); prim_llsd["parent"] = localid; } // Name and description LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->findNode(object); if (node) { prim_llsd["name"] = node->mName; prim_llsd["description"] = node->mDescription; } // Transforms if (is_attachment) { prim_llsd["position"] = object->getPositionEdit().getValue(); prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotationEdit()); } else { prim_llsd["position"] = object->getPosition().getValue(); prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotation()); } prim_llsd["scale"] = object->getScale().getValue(); // Flags prim_llsd["shadows"] = FALSE; prim_llsd["phantom"] = object->flagPhantom(); prim_llsd["physical"] = object->flagUsePhysics(); // Volume params LLVolumeParams params = object->getVolume()->getParams(); prim_llsd["volume"] = params.asLLSD(); // Extra paramsb6fab961-af18-77f8-cf08-f021377a7244 if (object->isFlexible()) { // Flexible LLFlexibleObjectData* flex = (LLFlexibleObjectData*)object->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); prim_llsd["flexible"] = flex->asLLSD(); } if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT)) { // Light LLLightParams* light = (LLLightParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT); prim_llsd["light"] = light->asLLSD(); } if (object->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) { // Sculpt LLSculptParams* sculpt = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT); prim_llsd["sculpt"] = sculpt->asLLSD(); LLUUID sculpt_texture = sculpt->getSculptTexture(); if (sculpt_texture == validateTextureID(sculpt_texture)) { bool alreadyseen = false; std::list<LLUUID>::iterator iter; for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++) { if ((*iter) == sculpt_texture) alreadyseen = true; } if (alreadyseen == false) { LL_INFOS("ObjectBackup") << "Found a sculpt texture, adding to list " << sculpt_texture << LL_ENDL; mTexturesList.push_back(sculpt_texture); } } else { LL_WARNS("ObjectBackup") << "Incorrect permission to export a sculpt texture." << LL_ENDL; LLObjectBackup::getInstance()->mExportState = EXPORT_FAILED; } } // Textures LLSD te_llsd; LLSD this_te_llsd; LLUUID t_id; U8 te_count = object->getNumTEs(); for (U8 i = 0; i < te_count; i++) { bool alreadyseen = false; t_id = validateTextureID(object->getTE(i)->getID()); this_te_llsd = object->getTE(i)->asLLSD(); this_te_llsd["imageid"] = t_id; te_llsd.append(this_te_llsd); // Do not export Linden textures even though they don't taint creation. if (t_id != LL_TEXTURE_PLYWOOD && t_id != LL_TEXTURE_BLANK && t_id != LL_TEXTURE_TRANSPARENT && t_id != LL_TEXTURE_INVISIBLE && t_id != LL_TEXTURE_MEDIA) { std::list<LLUUID>::iterator iter; for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++) { if ((*iter) == t_id) alreadyseen = true; } if (alreadyseen == false) mTexturesList.push_back(t_id); } } prim_llsd["textures"] = te_llsd; // The keys in the primitive maps do not have to be localids, they can be any // string. We simply use localids because they are a unique identifier snprintf(localid, sizeof(localid), "%u", object->getLocalID()); llsd[(const char*)localid] = prim_llsd; } updateExportNumbers(); return llsd; }
void JCFloaterAreaSearch::results() { if (!getVisible()) return; if (mPendingObjects.size() > 0 && mLastUpdateTimer.getElapsedTimeF32() < min_refresh_interval) return; //llinfos << "results()" << llendl; uuid_vec_t selected = mResultList->getSelectedIDs(); S32 scrollpos = mResultList->getScrollPos(); mResultList->deleteAllItems(); S32 i; S32 total = gObjectList.getNumObjects(); LLViewerRegion* our_region = gAgent.getRegion(); for (i = 0; i < total; i++) { LLViewerObject *objectp = gObjectList.getObject(i); if (objectp) { if (objectp->getRegion() == our_region && !objectp->isAvatar() && objectp->isRoot() && !objectp->flagTemporary() && !objectp->flagTemporaryOnRez()) { LLUUID object_id = objectp->getID(); if(!requestIfNeeded(object_id)) { std::map<LLUUID,ObjectData>::iterator it = mCachedObjects.find(object_id); if(it != mCachedObjects.end()) { //llinfos << "all entries are \"\" or we have data" << llendl; std::string object_name = it->second.name; std::string object_desc = it->second.desc; std::string object_owner; std::string object_group; gCacheName->getFullName(it->second.owner_id, object_owner); gCacheName->getGroupName(it->second.group_id, object_group); //llinfos << "both names are loaded or aren't needed" << llendl; std::string onU = object_owner; std::string cnU = object_group; LLStringUtil::toLower(object_name); LLStringUtil::toLower(object_desc); LLStringUtil::toLower(object_owner); LLStringUtil::toLower(object_group); if ((mFilterStrings[LIST_OBJECT_NAME].empty() || object_name.find(mFilterStrings[LIST_OBJECT_NAME]) != -1) && (mFilterStrings[LIST_OBJECT_DESC].empty() || object_desc.find(mFilterStrings[LIST_OBJECT_DESC]) != -1) && (mFilterStrings[LIST_OBJECT_OWNER].empty() || object_owner.find(mFilterStrings[LIST_OBJECT_OWNER]) != -1) && (mFilterStrings[LIST_OBJECT_GROUP].empty() || object_group.find(mFilterStrings[LIST_OBJECT_GROUP]) != -1)) { //llinfos << "pass" << llendl; LLSD element; element["id"] = object_id; element["columns"][LIST_OBJECT_NAME]["column"] = "Name"; element["columns"][LIST_OBJECT_NAME]["type"] = "text"; element["columns"][LIST_OBJECT_NAME]["value"] = it->second.name; element["columns"][LIST_OBJECT_DESC]["column"] = "Description"; element["columns"][LIST_OBJECT_DESC]["type"] = "text"; element["columns"][LIST_OBJECT_DESC]["value"] = it->second.desc; element["columns"][LIST_OBJECT_OWNER]["column"] = "Owner"; element["columns"][LIST_OBJECT_OWNER]["type"] = "text"; element["columns"][LIST_OBJECT_OWNER]["value"] = onU; element["columns"][LIST_OBJECT_GROUP]["column"] = "Group"; element["columns"][LIST_OBJECT_GROUP]["type"] = "text"; element["columns"][LIST_OBJECT_GROUP]["value"] = cnU; //ai->second; mResultList->addElement(element, ADD_BOTTOM); } } } } } } mResultList->updateSort(); mResultList->selectMultiple(selected); mResultList->setScrollPos(scrollpos); mCounterText->setText(llformat("%d listed/%d pending/%d total", mResultList->getItemCount(), mPendingObjects.size(), mPendingObjects.size()+mCachedObjects.size())); mLastUpdateTimer.reset(); }
void FSAreaSearch::results() { if (!getVisible()) return; if (mRequested > 0 && mLastUpdateTimer.getElapsedTimeF32() < min_refresh_interval) return; const LLUUID selected = mResultList->getCurrentID(); const S32 scrollpos = mResultList->getScrollPos(); mResultList->deleteAllItems(); S32 i; S32 total = gObjectList.getNumObjects(); LLViewerRegion* our_region = gAgent.getRegion(); for (i = 0; i < total; i++) { LLViewerObject *objectp = gObjectList.getObject(i); if (objectp) { if (objectp->getRegion() == our_region && !objectp->isAvatar() && objectp->isRoot() && !objectp->flagTemporary() && !objectp->flagTemporaryOnRez()) { LLUUID object_id = objectp->getID(); if (mObjectDetails.count(object_id) == 0) { requestIfNeeded(objectp); } else { AObjectDetails* details = &mObjectDetails[object_id]; std::string object_name = details->name; std::string object_desc = details->desc; std::string object_owner; std::string object_group; gCacheName->getFullName(details->owner_id, object_owner); gCacheName->getGroupName(details->group_id, object_group); if (object_name != request_string) { if ((mSearchedName == "" || boost::ifind_first(object_name, mSearchedName)) && (mSearchedDesc == "" || boost::ifind_first(object_desc, mSearchedDesc)) && (mSearchedOwner == "" || boost::ifind_first(object_owner, mSearchedOwner)) && (mSearchedGroup == "" || boost::ifind_first(object_group, mSearchedGroup))) { LLSD element; element["id"] = object_id; element["columns"][LIST_OBJECT_NAME]["column"] = "Name"; element["columns"][LIST_OBJECT_NAME]["type"] = "text"; element["columns"][LIST_OBJECT_NAME]["value"] = details->name; element["columns"][LIST_OBJECT_DESC]["column"] = "Description"; element["columns"][LIST_OBJECT_DESC]["type"] = "text"; element["columns"][LIST_OBJECT_DESC]["value"] = details->desc; element["columns"][LIST_OBJECT_OWNER]["column"] = "Owner"; element["columns"][LIST_OBJECT_OWNER]["type"] = "text"; element["columns"][LIST_OBJECT_OWNER]["value"] = object_owner; element["columns"][LIST_OBJECT_GROUP]["column"] = "Group"; element["columns"][LIST_OBJECT_GROUP]["type"] = "text"; element["columns"][LIST_OBJECT_GROUP]["value"] = object_group; mResultList->addElement(element, ADD_BOTTOM); } } } } } } mResultList->updateSort(); mResultList->selectByID(selected); mResultList->setScrollPos(scrollpos); mCounterText->setText(llformat("%d listed/%d pending/%d total", mResultList->getItemCount(), mRequested, mObjectDetails.size())); mLastUpdateTimer.reset(); }
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; } }
LLSD JCExportTracker::subserialize(LLViewerObject* linkset) { //Chalice - Changed to support exporting linkset groups. LLViewerObject* object = linkset; //if(!linkset)return LLSD(); // Create an LLSD object that will hold the entire tree structure that can be serialized to a file LLSD llsd; //if (!node) // return llsd; //object = root_object = node->getObject(); if (!object) return llsd; if(!(!object->isAvatar() && object->permYouOwner() && object->permModify() && object->permCopy() && object->permTransfer() && !gAgent.getGodLevel())) return llsd; // Build a list of everything that we'll actually be exporting LLDynamicArray<LLViewerObject*> export_objects; // Add the root object to the export list export_objects.put(object); // Iterate over all of this objects children LLViewerObject::child_list_t child_list = object->getChildren(); for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i) { LLViewerObject* child = *i; if(!child->isAvatar()) { // Put the child objects on the export list export_objects.put(child); } } S32 object_index = 0; while ((object_index < export_objects.count())) { object = export_objects.get(object_index++); LLUUID id = object->getID(); llinfos << "Exporting prim " << object->getID().asString() << llendl; // Create an LLSD object that represents this prim. It will be injected in to the overall LLSD // tree structure LLSD prim_llsd; if (object_index == 1) { LLVOAvatar* avatar = find_avatar_from_object(object); if (avatar) { LLViewerJointAttachment* attachment = avatar->getTargetAttachmentPoint(object); U8 attachment_id = 0; if (attachment) { for (LLVOAvatar::attachment_map_t::iterator iter = avatar->mAttachmentPoints.begin(); iter != avatar->mAttachmentPoints.end(); ++iter) { if (iter->second == attachment) { attachment_id = iter->first; break; } } } else { // interpret 0 as "default location" attachment_id = 0; } prim_llsd["Attachment"] = attachment_id; prim_llsd["attachpos"] = object->getPosition().getValue(); prim_llsd["attachrot"] = ll_sd_from_quaternion(object->getRotation()); } prim_llsd["position"] = LLVector3(0, 0, 0).getValue(); prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotation()); } else { prim_llsd["position"] = object->getPosition().getValue(); prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotation()); } //prim_llsd["name"] = "";//node->mName; //prim_llsd["description"] = "";//node->mDescription; // Transforms prim_llsd["scale"] = object->getScale().getValue(); // Flags prim_llsd["shadows"] = object->flagCastShadows(); prim_llsd["phantom"] = object->flagPhantom(); prim_llsd["physical"] = (BOOL)(object->mFlags & FLAGS_USE_PHYSICS); LLVolumeParams params = object->getVolume()->getParams(); prim_llsd["volume"] = params.asLLSD(); if (object->isFlexible()) { LLFlexibleObjectData* flex = (LLFlexibleObjectData*)object->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); prim_llsd["flexible"] = flex->asLLSD(); } if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT)) { LLLightParams* light = (LLLightParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT); prim_llsd["light"] = light->asLLSD(); } if (object->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) { LLSculptParams* sculpt = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT); prim_llsd["sculpt"] = sculpt->asLLSD(); } // Textures LLSD te_llsd; U8 te_count = object->getNumTEs(); for (U8 i = 0; i < te_count; i++) { te_llsd.append(object->getTE(i)->asLLSD()); } if(export_textures) { std::string path = asset_dir + gDirUtilp->getDirDelimiter(); for (U8 i = 0; i < te_count; i++) { LLUUID asset_id = object->getTE(i)->getID(); JCAssetInfo* info = new JCAssetInfo; info->path = path + asset_id.asString() + ".j2c"; info->name = "Prim Texture"; //gAssetStorage->getAssetData(asset_id, LLAssetType::AT_TEXTURE, JCAssetExportCallback, info,1); if(requested_textures.count(asset_id) == 0) { requested_textures.insert(asset_id); LLViewerImage* img = gImageList.getImage(asset_id, MIPMAP_TRUE, FALSE); img->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAX_LEVEL); img->setLoadedCallback( JCExportTracker::onFileLoadedForSave, 0, TRUE, FALSE, info ); llinfos << "Requesting texture " << asset_id.asString() << llendl; } } } //JCExportTracker::mirror(asset, obj, asset_dir, asset->getUUID().asString()); prim_llsd["textures"] = te_llsd; prim_llsd["id"] = object->getID().asString(); if(export_properties) { ////cmdline_printchat(llformat("yes %d",export_properties)); propertyqueries += 1; gMessageSystem->newMessageFast(_PREHASH_ObjectSelect); gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); gMessageSystem->nextBlockFast(_PREHASH_ObjectData); gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID()); gMessageSystem->sendReliable(gAgent.getRegionHost()); if(export_inventory) { object->registerInventoryListener(sInstance,NULL); object->dirtyInventory(); object->requestInventory(); invqueries += 1; } }//else //cmdline_printchat(llformat("no %d",export_properties)); totalprims += 1; // Changed to use link numbers zero-indexed. llsd[object_index - 1] = prim_llsd; } return llsd; }
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! " << region_handle << 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() << ":" << gMessageSystem->getSenderPort() << 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... // Reset object local id and region pointer if things have changed if (objectp && ((objectp->mLocalID != local_id) || (objectp->getRegion() != regionp))) { //if (objectp->getRegion()) //{ // llinfos << "Local ID change: Removing object from table, local ID " << objectp->mLocalID // << ", id from message " << local_id << ", from " // << LLHost(objectp->getRegion()->getHost().getAddress(), objectp->getRegion()->getHost().getPort()) // << ", full id " << fullid // << ", objects id " << objectp->getID() // << ", regionp " << (U32) regionp << ", object region " << (U32) objectp->getRegion() // << llendl; //} removeFromLocalIDTable(*objectp); setUUIDAndLocal(fullid, local_id, gMessageSystem->getSenderIP(), gMessageSystem->getSenderPort()); if (objectp->mLocalID != local_id) { // Update local ID in object with the one sent from the region objectp->mLocalID = local_id; } if (objectp->getRegion() != regionp) { // Object changed region, so update it objectp->setRegion(regionp); objectp->updateRegion(regionp); // for LLVOAvatar } } if (!objectp) { if (compressed) { if (update_type == OUT_TERSE_IMPROVED) { // llinfos << "terse update for an unknown object:" << fullid << llendl; continue; } } else if (cached) { } else { if (update_type != OUT_FULL) { // llinfos << "terse update for an unknown object:" << fullid << llendl; continue; } mesgsys->getU8Fast(_PREHASH_ObjectData, _PREHASH_PCode, pcode, i); } #ifdef IGNORE_DEAD if (mDeadObjects.find(fullid) != mDeadObjects.end()) { mNumDeadObjectUpdates++; // llinfos << "update for a dead object:" << fullid << llendl; continue; } #endif objectp = createObject(pcode, regionp, fullid, local_id, gMessageSystem->getSender()); if (!objectp) { continue; } justCreated = TRUE; mNumNewObjects++; } if (objectp->isDead()) { llwarns << "Dead object " << objectp->mID << " in UUID map 1!" << llendl; } if (compressed) { if (update_type != OUT_TERSE_IMPROVED) { objectp->mLocalID = local_id; } processUpdateCore(objectp, user_data, i, update_type, &compressed_dp, justCreated); if (update_type != OUT_TERSE_IMPROVED) { objectp->mRegionp->cacheFullUpdate(objectp, compressed_dp); } } else if (cached) { objectp->mLocalID = local_id; processUpdateCore(objectp, user_data, i, update_type, cached_dpp, justCreated); } else { if (update_type == OUT_FULL) { objectp->mLocalID = local_id; } processUpdateCore(objectp, user_data, i, update_type, NULL, justCreated); } // <edit> if(justCreated && LLXmlImport::sImportInProgress) { if(objectp) { LLViewerObject* parent = (LLViewerObject*)objectp->getParent(); if(parent) { if(parent->getID() == gAgent.getID()) { LLXmlImport::onNewAttachment(objectp); } } else if( objectp->permYouOwner() && (objectp->getPCode() == LLXmlImport::sSupplyParams->getPCode()) && (objectp->getScale() == LLXmlImport::sSupplyParams->getScale())) { LLXmlImport::onNewPrim(objectp); } } } // </edit> } LLVOAvatar::cullAvatarsByPixelArea(); }