// public void LLWorldMap::sendMapLayerRequest() { if (!gAgent.getRegion()) return; LLSD body; body["Flags"] = mCurrentMap; std::string url = gAgent.getRegion()->getCapability( gAgent.isGodlike() ? "MapLayerGod" : "MapLayer"); if (!url.empty()) { llinfos << "LLWorldMap::sendMapLayerRequest via capability" << llendl; LLHTTPClient::post(url, body, new LLMapLayerResponder()); } else { llinfos << "LLWorldMap::sendMapLayerRequest via message system" << llendl; LLMessageSystem* msg = gMessageSystem; S32 layer = mCurrentMap; // Request for layer msg->newMessageFast(_PREHASH_MapLayerRequest); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addU32Fast(_PREHASH_Flags, layer); msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim gAgent.sendReliableMessage(); if (mRequestLandForSale) { msg->newMessageFast(_PREHASH_MapLayerRequest); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addU32Fast(_PREHASH_Flags, 2); msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim gAgent.sendReliableMessage(); } } }
void LLWorldMapMessage::sendItemRequest(U32 type, U64 handle) { //LL_INFOS("World Map") << "Send item request : type = " << type << LL_ENDL; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_MapItemRequest); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addU32Fast(_PREHASH_Flags, LAYER_FLAG); msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim msg->nextBlockFast(_PREHASH_RequestData); msg->addU32Fast(_PREHASH_ItemType, type); msg->addU64Fast(_PREHASH_RegionHandle, handle); // If zero, filled in on sim gAgent.sendReliableMessage(); }
void ImportTracker::get_update(S32 newid, BOOL justCreated, BOOL createSelected) { switch (state) { //lgg crap case WAND: if(justCreated && createSelected) { numberExpected--; if(numberExpected<=0) state=IDLE; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectImage); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid); msg->addStringFast(_PREHASH_MediaURL, NULL); LLPrimitive obj; obj.setNumTEs(U8(10)); S32 shinnyLevel = 0; if(gSavedSettings.getString("EmeraldBuildPrefs_Shiny")== "None") shinnyLevel = 0; if(gSavedSettings.getString("EmeraldBuildPrefs_Shiny")== "Low") shinnyLevel = 1; if(gSavedSettings.getString("EmeraldBuildPrefs_Shiny")== "Medium") shinnyLevel = 2; if(gSavedSettings.getString("EmeraldBuildPrefs_Shiny")== "High") shinnyLevel = 3; for (int i = 0; i < 10; i++) { LLTextureEntry tex = LLTextureEntry(LLUUID(gSavedSettings.getString("EmeraldBuildPrefs_Texture"))); tex.setColor(gSavedSettings.getColor4("EmeraldBuildPrefs_Color")); tex.setAlpha(1.0 - ((gSavedSettings.getF32("EmeraldBuildPrefs_Alpha")) / 100.0)); tex.setGlow(gSavedSettings.getF32("EmeraldBuildPrefs_Glow")); if(gSavedSettings.getBOOL("EmeraldBuildPrefs_FullBright")) { tex.setFullbright(TEM_FULLBRIGHT_MASK); } tex.setShiny((U8) shinnyLevel & TEM_SHINY_MASK); obj.setTE(U8(i), tex); } obj.packTEMessage(gMessageSystem); msg->sendReliable(gAgent.getRegion()->getHost()); msg->newMessage("ObjectFlagUpdate"); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid ); msg->addBOOLFast(_PREHASH_UsePhysics, gSavedSettings.getBOOL("EmeraldBuildPrefs_Physical")); msg->addBOOL("IsTemporary", gSavedSettings.getBOOL("EmeraldBuildPrefs_Temporary")); msg->addBOOL("IsPhantom", gSavedSettings.getBOOL("EmeraldBuildPrefs_Phantom") ); msg->addBOOL("CastsShadows", true ); msg->sendReliable(gAgent.getRegion()->getHost()); if(gSavedSettings.getBOOL("EmeraldBuildPrefs_EmbedItem")) { LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem((LLUUID)gSavedSettings.getString("EmeraldBuildPrefs_Item")); LLViewerObject* objectp = find((U32)newid); if(objectp) if(item) { if(item->getType()==LLAssetType::AT_LSL_TEXT) { LLToolDragAndDrop::dropScript(objectp, item, TRUE, LLToolDragAndDrop::SOURCE_AGENT, gAgent.getID()); }else { LLToolDragAndDrop::dropInventory(objectp,item,LLToolDragAndDrop::SOURCE_AGENT,gAgent.getID()); } } } msg->newMessageFast(_PREHASH_ObjectPermissions); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_HeaderData); msg->addBOOLFast(_PREHASH_Override, FALSE); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid); msg->addU8Fast(_PREHASH_Field, PERM_NEXT_OWNER); msg->addBOOLFast(_PREHASH_Set, PERM_ITEM_UNRESTRICTED); U32 flags = 0; if ( gSavedSettings.getBOOL("NextOwnerCopy") ) { flags |= PERM_COPY; } if ( gSavedSettings.getBOOL("NextOwnerModify") ) { flags |= PERM_MODIFY; } if ( gSavedSettings.getBOOL("NextOwnerTransfer") ) { flags |= PERM_TRANSFER; } msg->addU32Fast(_PREHASH_Mask, flags); msg->sendReliable(gAgent.getRegion()->getHost()); //llinfos << "LGG SENDING CUBE TEXTURE.." << llendl; } break; case BUILDING: if (justCreated && (int)localids.size() < linkset.size()) { localids.push_back(newid); localids.sort(); localids.unique(); linkset[localids.size() -1]["LocalID"] = newid; LLSD prim = linkset[localids.size() -1]; //MAKERIGHT if (!(prim).has("Updated")) { ++updated; send_shape(prim); send_image(prim); send_extras(prim); send_namedesc(prim); send_vectors(prim,updated); send_properties(prim, updated); send_inventory(prim); (prim)["Updated"] = true; } if ((int)localids.size() < linkset.size()) { plywood_above_head(); return; } else { if (updated >= linkset.size()) { updated=0; llinfos << "FINISHED BUILDING, LINKING.." << llendl; state = LINKING; link(); } } } break; case LINKING: link(); break; } }
void LLGestureManager::activateGestures(LLViewerInventoryItem::item_array_t& items) { // Load up the assets S32 count = 0; LLViewerInventoryItem::item_array_t::const_iterator it; for (it = items.begin(); it != items.end(); ++it) { LLViewerInventoryItem* item = *it; if (isGestureActive(item->getUUID())) { continue; } else { // Make gesture active and persistent through login sessions. -spatters 07-12-06 activateGesture(item->getUUID()); } count++; } mLoadingCount = count; mDeactivateSimilarNames.clear(); for (it = items.begin(); it != items.end(); ++it) { LLViewerInventoryItem* item = *it; if (isGestureActive(item->getUUID())) { continue; } // Don't inform server, we'll do that in bulk const BOOL no_inform_server = FALSE; const BOOL deactivate_similar = TRUE; activateGestureWithAsset(item->getUUID(), item->getAssetUUID(), no_inform_server, deactivate_similar); } // Inform the database of this change LLMessageSystem* msg = gMessageSystem; BOOL start_message = TRUE; for (it = items.begin(); it != items.end(); ++it) { LLViewerInventoryItem* item = *it; if (isGestureActive(item->getUUID())) { continue; } if (start_message) { msg->newMessage("ActivateGestures"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->addU32("Flags", 0x0); start_message = FALSE; } msg->nextBlock("Data"); msg->addUUID("ItemID", item->getUUID()); msg->addUUID("AssetID", item->getAssetUUID()); msg->addU32("GestureFlags", 0x0); if (msg->getCurrentSendTotal() > MTUBYTES) { gAgent.sendReliableMessage(); start_message = TRUE; } } if (!start_message) { gAgent.sendReliableMessage(); } }
// static void LLGestureManager::onLoadComplete(LLVFS *vfs, const LLUUID& asset_uuid, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status) { LLLoadInfo* info = (LLLoadInfo*)user_data; LLUUID item_id = info->mItemID; BOOL inform_server = info->mInformServer; BOOL deactivate_similar = info->mDeactivateSimilar; delete info; info = NULL; LLGestureManager& self = LLGestureManager::instance(); self.mLoadingCount--; if (0 == status) { LLVFile file(vfs, asset_uuid, type, LLVFile::READ); S32 size = file.getSize(); std::vector<char> buffer(size+1); file.read((U8*)&buffer[0], size); // ensure there's a trailing NULL so strlen will work. buffer[size] = '\0'; LLMultiGesture* gesture = new LLMultiGesture(); LLDataPackerAsciiBuffer dp(&buffer[0], size+1); BOOL ok = gesture->deserialize(dp); if (ok) { if (deactivate_similar) { self.deactivateSimilarGestures(gesture, item_id); // Display deactivation message if this was the last of the bunch. if (self.mLoadingCount == 0 && self.mDeactivateSimilarNames.length() > 0) { // we're done with this set of deactivations LLSD args; args["NAMES"] = self.mDeactivateSimilarNames; LLNotificationsUtil::add("DeactivatedGesturesTrigger", args); } } LLViewerInventoryItem* item = gInventory.getItem(item_id); if(item) { gesture->mName = item->getName(); } else { // Watch this item and set gesture name when item exists in inventory item_ref_t ids; ids.push_back(item_id); self.fetchItems(ids); } self.mActive[item_id] = gesture; // Everything has been successful. Add to the active list. gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); if (inform_server) { // Inform the database of this change LLMessageSystem* msg = gMessageSystem; msg->newMessage("ActivateGestures"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->addU32("Flags", 0x0); msg->nextBlock("Data"); msg->addUUID("ItemID", item_id); msg->addUUID("AssetID", asset_uuid); msg->addU32("GestureFlags", 0x0); gAgent.sendReliableMessage(); } callback_map_t::iterator i_cb = self.mCallbackMap.find(item_id); if(i_cb != self.mCallbackMap.end()) { i_cb->second(gesture); self.mCallbackMap.erase(i_cb); } self.notifyObservers(); } else { llwarns << "Unable to load gesture" << llendl; self.mActive.erase(item_id); delete gesture; gesture = NULL; } } else { LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) { LLDelayedGestureError::gestureMissing( item_id ); } else { LLDelayedGestureError::gestureFailedToLoad( item_id ); } llwarns << "Problem loading gesture: " << status << llendl; LLGestureManager::instance().mActive.erase(item_id); } }
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 ); } // 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(); gAgent.setPointAt(POINTAT_TARGET_GRAB, objectp, local_edit_point ); gAgent.setLookAt(LOOKAT_TARGET_SELECT, objectp, local_edit_point ); } gViewerWindow->setCursor(UI_CURSOR_HAND); }
void LLFloaterReporter::sendReportViaLegacy(const LLSD & report) { LLViewerRegion *regionp = gAgent.getRegion(); if (!regionp) return; LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_UserReport); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ReportData); msg->addU8Fast(_PREHASH_ReportType, report["report-type"].asInteger()); msg->addU8(_PREHASH_Category, report["category"].asInteger()); msg->addVector3Fast(_PREHASH_Position, LLVector3(report["position"])); msg->addU8Fast(_PREHASH_CheckFlags, report["check-flags"].asInteger()); msg->addUUIDFast(_PREHASH_ScreenshotID, report["screenshot-id"].asUUID()); msg->addUUIDFast(_PREHASH_ObjectID, report["object-id"].asUUID()); msg->addUUID("AbuserID", report["abuser-id"].asUUID()); msg->addString("AbuseRegionName", report["abuse-region-name"].asString()); msg->addUUID("AbuseRegionID", report["abuse-region-id"].asUUID()); msg->addStringFast(_PREHASH_Summary, report["summary"].asString()); msg->addString("VersionString", report["version-string"]); msg->addStringFast(_PREHASH_Details, report["details"] ); msg->sendReliable(regionp->getHost()); }
// static void LLPanelDirFindAllOld::onClickSearch(void *userdata) { LLPanelDirFindAllOld *self = (LLPanelDirFindAllOld *)userdata; if (self->childGetValue("name").asString().length() < self->mMinSearchChars) { return; }; BOOL inc_pg = self->childGetValue("incpg").asBoolean(); BOOL inc_mature = self->childGetValue("incmature").asBoolean(); BOOL inc_adult = self->childGetValue("incadult").asBoolean(); if (!(inc_pg || inc_mature || inc_adult)) { LLNotificationsUtil::add("NoContentToSearch"); return; } self->setupNewSearch(); // Figure out scope U32 scope = 0x0; scope |= DFQ_PEOPLE; // people (not just online = 0x01 | 0x02) // places handled below scope |= DFQ_EVENTS; // events scope |= DFQ_GROUPS; // groups if (inc_pg) { scope |= DFQ_INC_PG; } if (inc_mature) { scope |= DFQ_INC_MATURE; } if (inc_adult) { scope |= DFQ_INC_ADULT; } if (self->hasChild("filter_gaming") && self->childGetValue("filter_gaming").asBoolean()) { scope |= DFQ_FILTER_GAMING; } // send the message LLMessageSystem *msg = gMessageSystem; S32 start_row = 0; sendDirFindQuery(msg, self->mSearchID, self->childGetValue("name").asString(), scope, start_row); // Also look up classified ads. JC 12/2005 BOOL filter_auto_renew = FALSE; U32 classified_flags = pack_classified_flags_request(filter_auto_renew, inc_pg, inc_mature, inc_adult); msg->newMessage("DirClassifiedQuery"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("QueryData"); msg->addUUID("QueryID", self->mSearchID); msg->addString("QueryText", self->childGetValue("name").asString()); msg->addU32("QueryFlags", classified_flags); msg->addU32("Category", 0); // all categories msg->addS32("QueryStart", 0); gAgent.sendReliableMessage(); // Need to use separate find places query because places are // sent using the more compact DirPlacesReply message. U32 query_flags = DFQ_DWELL_SORT; if (inc_pg) { query_flags |= DFQ_INC_PG; } if (inc_mature) { query_flags |= DFQ_INC_MATURE; } if (inc_adult) { query_flags |= DFQ_INC_ADULT; } msg->newMessage("DirPlacesQuery"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID() ); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("QueryData"); msg->addUUID("QueryID", self->mSearchID ); msg->addString("QueryText", self->childGetValue("name").asString()); msg->addU32("QueryFlags", query_flags ); msg->addS32("QueryStart", 0 ); // Always get the first 100 when using find ALL msg->addS8("Category", LLParcel::C_ANY); msg->addString("SimName", NULL); gAgent.sendReliableMessage(); }
void send_generic_message(const std::string& method, const std::vector<std::string>& strings, const LLUUID& invoice) { LLMessageSystem* msg = gMessageSystem; msg->newMessage("GenericMessage"); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used msg->nextBlock("MethodData"); msg->addString("Method", method); msg->addUUID("Invoice", invoice); if(strings.empty()) { msg->nextBlock("ParamList"); msg->addString("Parameter", NULL); } else { std::vector<std::string>::const_iterator it = strings.begin(); std::vector<std::string>::const_iterator end = strings.end(); for(; it != end; ++it) { msg->nextBlock("ParamList"); msg->addString("Parameter", *it); } } gAgent.sendReliableMessage(); }
void send_ObjectGrab_message(LLViewerObject* object, const LLPickInfo & pick, const LLVector3 &grab_offset) { if (!object) return; LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectGrab); msg->nextBlockFast( _PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast( _PREHASH_ObjectData); msg->addU32Fast( _PREHASH_LocalID, object->mLocalID); msg->addVector3Fast(_PREHASH_GrabOffset, grab_offset); 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( object->getRegion()->getHost()); /* Diagnostic code llinfos << "mUVCoords: " << pick.mUVCoords << ", mSTCoords: " << pick.mSTCoords << ", mObjectFace: " << pick.mObjectFace << ", mIntersection: " << pick.mIntersection << ", mNormal: " << pick.mNormal << ", mBinormal: " << pick.mBinormal << llendl; llinfos << "Avatar pos: " << gAgent.getPositionAgent() << llendl; llinfos << "Object pos: " << object->getPosition() << llendl; */ }
void send_ObjectDeGrab_message(LLViewerObject* object, const LLPickInfo & pick) { if (!object) return; LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectDeGrab); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_LocalID, object->mLocalID); 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(object->getRegion()->getHost()); }
// static void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed) { LLFloaterPostcard *self = (LLFloaterPostcard *)user_data; LLUploadDialog::modalUploadFinished(); if (result) { LLSD args; args["REASON"] = std::string(LLAssetStorage::getErrorString(result)); LLNotifications::instance().add("ErrorUploadingPostcard", args); } else { // only create the postcard once the upload succeeds // request the postcard LLMessageSystem* msg = gMessageSystem; msg->newMessage("SendPostcard"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->addUUID("AssetID", self->mAssetID); msg->addVector3d("PosGlobal", self->mPosTakenGlobal); msg->addString("To", self->childGetValue("to_form").asString()); msg->addString("From", self->childGetValue("from_form").asString()); msg->addString("Name", self->childGetValue("name_form").asString()); msg->addString("Subject", self->childGetValue("subject_form").asString()); msg->addString("Msg", self->childGetValue("msg_form").asString()); msg->addBOOL("AllowPublish", FALSE); msg->addBOOL("MaturePublish", FALSE); gAgent.sendReliableMessage(); } self->close(); }
void LLPanelDirClassified::performQuery() { lldebugs << "LLPanelDirClassified::performQuery()" << llendl; // This sets mSearchID and clears the list of results setupNewSearch(); // send the message LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_DirClassifiedQuery); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); BOOL filter_mature = !childGetValue("incmature").asBoolean(); BOOL filter_auto_renew = FALSE; U32 query_flags = pack_classified_flags(filter_mature, filter_auto_renew); //if (gAgent.isTeen()) query_flags |= DFQ_PG_SIMS_ONLY; U32 category = childGetValue("Category").asInteger(); msg->nextBlockFast(_PREHASH_QueryData); msg->addUUIDFast(_PREHASH_QueryID, mSearchID ); msg->addStringFast(_PREHASH_QueryText, childGetValue("name").asString()); msg->addU32Fast(_PREHASH_QueryFlags, query_flags); msg->addU32Fast(_PREHASH_Category, category); msg->addS32Fast(_PREHASH_QueryStart,mSearchStart); gAgent.sendReliableMessage(); }
// public void LLWorldMap::sendMapBlockRequest(U16 min_x, U16 min_y, U16 max_x, U16 max_y, bool return_nonexistent) { S32 layer = mCurrentMap; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_MapBlockRequest); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); U32 flags = layer; flags |= (return_nonexistent ? 0x10000 : 0); msg->addU32Fast(_PREHASH_Flags, flags); msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim msg->nextBlockFast(_PREHASH_PositionData); msg->addU16Fast(_PREHASH_MinX, min_x); msg->addU16Fast(_PREHASH_MinY, min_y); msg->addU16Fast(_PREHASH_MaxX, max_x); msg->addU16Fast(_PREHASH_MaxY, max_y); gAgent.sendReliableMessage(); if (mRequestLandForSale) { msg->newMessageFast(_PREHASH_MapBlockRequest); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addU32Fast(_PREHASH_Flags, 2); msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim msg->nextBlockFast(_PREHASH_PositionData); msg->addU16Fast(_PREHASH_MinX, min_x); msg->addU16Fast(_PREHASH_MinY, min_y); msg->addU16Fast(_PREHASH_MaxX, max_x); msg->addU16Fast(_PREHASH_MaxY, max_y); gAgent.sendReliableMessage(); } }
void LLToolGrab::startGrab() { // Compute grab_offset in the OBJECT's root's coordinate frame // (sometimes root == object) LLViewerObject* objectp = mGrabPick.getObject(); if (!objectp) { return; } LLViewerObject *root = (LLViewerObject *)objectp->getRoot(); // drag from center LLVector3d grab_start_global = root->getPositionGlobal(); // Where the grab starts, relative to the center of the root object of the set. // JC - This code looks wonky, but I believe it does the right thing. // Otherwise, when you grab a linked object set, it "pops" on the start // of the drag. LLVector3d grab_offsetd = root->getPositionGlobal() - objectp->getPositionGlobal(); LLVector3 grab_offset; grab_offset.setVec(grab_offsetd); LLQuaternion rotation = root->getRotation(); rotation.conjQuat(); grab_offset = grab_offset * rotation; // This planar drag starts at the grab point mDragStartPointGlobal = grab_start_global; mDragStartFromCamera = grab_start_global - gAgent.getCameraPositionGlobal(); LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectGrab); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_LocalID, objectp->mLocalID); msg->addVector3Fast(_PREHASH_GrabOffset, grab_offset ); 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()); mGrabOffsetFromCenterInitial = grab_offset; mGrabHiddenOffsetFromCamera = mDragStartFromCamera; mGrabTimer.reset(); mLastUVCoords = mGrabPick.mUVCoords; mLastSTCoords = mGrabPick.mSTCoords; mLastFace = mGrabPick.mObjectFace; mLastIntersection = mGrabPick.mIntersection; mLastNormal = mGrabPick.mNormal; mLastBinormal = mGrabPick.mBinormal; mLastGrabPos = LLVector3(-1.f, -1.f, -1.f); }
void upload_done_callback( const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed) { LLResourceData* data = (LLResourceData*)user_data; S32 expected_upload_cost = data ? data->mExpectedUploadCost : 0; //LLAssetType::EType pref_loc = data->mPreferredLocation; BOOL is_balance_sufficient = TRUE; if(data) { if (result >= 0) { LLFolderType::EType dest_loc = (data->mPreferredLocation == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(data->mAssetInfo.mType) : data->mPreferredLocation; if (LLAssetType::AT_SOUND == data->mAssetInfo.mType || LLAssetType::AT_TEXTURE == data->mAssetInfo.mType || LLAssetType::AT_ANIMATION == data->mAssetInfo.mType) { // Charge the user for the upload. LLViewerRegion* region = gAgent.getRegion(); if(!(can_afford_transaction(expected_upload_cost))) { LLStringUtil::format_map_t args; args["NAME"] = data->mAssetInfo.getName(); args["AMOUNT"] = llformat("%d", expected_upload_cost); LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("UploadingCosts", args), expected_upload_cost ); is_balance_sufficient = FALSE; } else if(region) { // Charge user for upload gStatusBar->debitBalance(expected_upload_cost); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_MoneyTransferRequest); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_MoneyData); msg->addUUIDFast(_PREHASH_SourceID, gAgent.getID()); msg->addUUIDFast(_PREHASH_DestID, LLUUID::null); msg->addU8("Flags", 0); // we tell the sim how much we were expecting to pay so it // can respond to any discrepancy msg->addS32Fast(_PREHASH_Amount, expected_upload_cost); msg->addU8Fast(_PREHASH_AggregatePermNextOwner, (U8)LLAggregatePermissions::AP_EMPTY); msg->addU8Fast(_PREHASH_AggregatePermInventory, (U8)LLAggregatePermissions::AP_EMPTY); msg->addS32Fast(_PREHASH_TransactionType, TRANS_UPLOAD_CHARGE); msg->addStringFast(_PREHASH_Description, NULL); msg->sendReliable(region->getHost()); } } if(is_balance_sufficient) { // Actually add the upload to inventory LL_INFOS() << "Adding " << uuid << " to inventory." << LL_ENDL; const LLUUID folder_id = gInventory.findCategoryUUIDForType(dest_loc); if(folder_id.notNull()) { U32 next_owner_perms = data->mNextOwnerPerm; if(PERM_NONE == next_owner_perms) { next_owner_perms = PERM_MOVE | PERM_TRANSFER; } create_inventory_item(gAgent.getID(), gAgent.getSessionID(), folder_id, data->mAssetInfo.mTransactionID, data->mAssetInfo.getName(), data->mAssetInfo.getDescription(), data->mAssetInfo.mType, data->mInventoryType, NOT_WEARABLE, next_owner_perms, LLPointer<LLInventoryCallback>(NULL)); } else { LL_WARNS() << "Can't find a folder to put it in" << LL_ENDL; } } } else // if(result >= 0) { LLSD args; args["FILE"] = LLInventoryType::lookupHumanReadable(data->mInventoryType); args["REASON"] = std::string(LLAssetStorage::getErrorString(result)); LLNotificationsUtil::add("CannotUploadReason", args); } delete data; data = NULL; } LLUploadDialog::modalUploadFinished(); // *NOTE: This is a pretty big hack. What this does is check the // file picker if there are any more pending uploads. If so, // upload that file. const std::string& next_file = LLFilePicker::instance().getNextFile(); if(is_balance_sufficient && !next_file.empty()) { std::string asset_name = gDirUtilp->getBaseFileName(next_file, true); LLStringUtil::replaceNonstandardASCII( asset_name, '?' ); LLStringUtil::replaceChar(asset_name, '|', '?'); LLStringUtil::stripNonprintable(asset_name); LLStringUtil::trim(asset_name); std::string display_name = LLStringUtil::null; LLAssetStorage::LLStoreAssetCallback callback = NULL; void *userdata = NULL; upload_new_resource( next_file, asset_name, asset_name, // file 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), display_name, callback, expected_upload_cost, // assuming next in a group of uploads is of roughly the same type, i.e. same upload cost userdata); } }
// 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; }
static void send_estate_message( const char* request, const LLUUID &target) { LLMessageSystem* msg = gMessageSystem; LLUUID invoice; // This seems to provide an ID so that the sim can say which request it's // replying to. I think this can be ignored for now. invoice.generate(); llinfos << "Sending estate request '" << request << "'" << llendl; msg->newMessage("EstateOwnerMessage"); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used msg->nextBlock("MethodData"); msg->addString("Method", request); msg->addUUID("Invoice", invoice); // Agent id msg->nextBlock("ParamList"); msg->addString("Parameter", gAgent.getID().asString().c_str()); // Target msg->nextBlock("ParamList"); msg->addString("Parameter", target.asString().c_str()); msg->sendReliable(gAgent.getRegion()->getHost()); }
// virtual BOOL LLFloaterReporter::postBuild() { LLSLURL slurl; LLAgentUI::buildSLURL(slurl); getChild<LLUICtrl>("abuse_location_edit")->setValue(slurl.getSLURLString()); enableControls(TRUE); // convert the position to a string LLVector3d pos = gAgent.getPositionGlobal(); LLViewerRegion *regionp = gAgent.getRegion(); if (regionp) { getChild<LLUICtrl>("sim_field")->setValue(regionp->getName()); pos -= regionp->getOriginGlobal(); } setPosBox(pos); // Take a screenshot, but don't draw this floater. setVisible(FALSE); takeScreenshot(); setVisible(TRUE); // Default text to be blank getChild<LLUICtrl>("object_name")->setValue(LLStringUtil::null); getChild<LLUICtrl>("owner_name")->setValue(LLStringUtil::null); mOwnerName = LLStringUtil::null; getChild<LLUICtrl>("summary_edit")->setFocus(TRUE); mDefaultSummary = getChild<LLUICtrl>("details_edit")->getValue().asString(); // send a message and ask for information about this region - // result comes back in processRegionInfo(..) LLMessageSystem* msg = gMessageSystem; msg->newMessage("RequestRegionInfo"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); gAgent.sendReliableMessage(); // abuser name is selected from a list LLUICtrl* le = getChild<LLUICtrl>("abuser_name_edit"); le->setEnabled( false ); setPosBox((LLVector3d)mPosition.getValue()); LLButton* pick_btn = getChild<LLButton>("pick_btn"); pick_btn->setImages(std::string("tool_face.tga"), std::string("tool_face_active.tga") ); childSetAction("pick_btn", onClickObjPicker, this); childSetAction("select_abuser", boost::bind(&LLFloaterReporter::onClickSelectAbuser, this)); childSetAction("send_btn", onClickSend, this); childSetAction("cancel_btn", onClickCancel, this); // grab the user's name std::string reporter = LLSLURL("agent", gAgent.getID(), "inspect").getSLURLString(); getChild<LLUICtrl>("reporter_field")->setValue(reporter); center(); return TRUE; }
// <edit> void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed) { LLResourceData* data = (LLResourceData*)user_data; S32 expected_upload_cost = data ? data->mExpectedUploadCost : 0; //LLAssetType::EType pref_loc = data->mPreferredLocation; BOOL is_balance_sufficient = TRUE; if(!data) { LLUploadDialog::modalUploadFinished(); return; } if(result >= 0) { LLFolderType::EType dest_loc = (data->mPreferredLocation == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(data->mAssetInfo.mType) : data->mPreferredLocation; if (LLAssetType::AT_SOUND == data->mAssetInfo.mType || LLAssetType::AT_TEXTURE == data->mAssetInfo.mType || LLAssetType::AT_ANIMATION == data->mAssetInfo.mType) { // Charge the user for the upload. LLViewerRegion* region = gAgent.getRegion(); if(!(can_afford_transaction(expected_upload_cost))) { LLStringUtil::format_map_t args; args["[NAME]"] = data->mAssetInfo.getName(); args["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol(); args["[AMOUNT]"] = llformat("%d", expected_upload_cost); LLFloaterBuyCurrency::buyCurrency( LLTrans::getString("UploadingCosts", args), expected_upload_cost ); is_balance_sufficient = FALSE; } else if(region) { // Charge user for upload gStatusBar->debitBalance(expected_upload_cost); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_MoneyTransferRequest); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_MoneyData); msg->addUUIDFast(_PREHASH_SourceID, gAgent.getID()); msg->addUUIDFast(_PREHASH_DestID, LLUUID::null); msg->addU8("Flags", 0); // we tell the sim how much we were expecting to pay so it // can respond to any discrepancy msg->addS32Fast(_PREHASH_Amount, expected_upload_cost); msg->addU8Fast(_PREHASH_AggregatePermNextOwner, (U8)LLAggregatePermissions::AP_EMPTY); msg->addU8Fast(_PREHASH_AggregatePermInventory, (U8)LLAggregatePermissions::AP_EMPTY); msg->addS32Fast(_PREHASH_TransactionType, TRANS_UPLOAD_CHARGE); msg->addStringFast(_PREHASH_Description, NULL); msg->sendReliable(region->getHost()); } } if(is_balance_sufficient) { // Actually add the upload to inventory llinfos << "Adding " << uuid << " to inventory." << llendl; const LLUUID folder_id = gInventory.findCategoryUUIDForType(dest_loc); if(folder_id.notNull()) { U32 next_owner_perms = data->mNextOwnerPerm; if(PERM_NONE == next_owner_perms) { next_owner_perms = PERM_MOVE | PERM_TRANSFER; } create_inventory_item(gAgent.getID(), gAgent.getSessionID(), folder_id, data->mAssetInfo.mTransactionID, data->mAssetInfo.getName(), data->mAssetInfo.getDescription(), data->mAssetInfo.mType, data->mInventoryType, NOT_WEARABLE, next_owner_perms, LLPointer<LLInventoryCallback>(NULL)); } else { llwarns << "Can't find a folder to put it in" << llendl; } } } else // if(result >= 0) { LLSD args; args["FILE"] = LLInventoryType::lookupHumanReadable(data->mInventoryType); args["REASON"] = std::string(LLAssetStorage::getErrorString(result)); LLNotificationsUtil::add("CannotUploadReason", args); } LLUploadDialog::modalUploadFinished(); delete data; data = NULL; }
void LLPanelDirEvents::performQueryOrDelete(U32 event_id) { S32 relative_day = mDay; // Update the date field to show the date IN THE SERVER'S // TIME ZONE, as that is what will be displayed in each event // Get time UTC time_t utc_time = time_corrected(); // Correct for offset utc_time += relative_day * 24 * 60 * 60; // There's only one internal tm buffer. struct tm* internal_time; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string date; timeStructToFormattedString(internal_time, "%m-%d", date); childSetValue("date_text", date); // Record the relative day so back and forward buttons // offset from this day. mDay = relative_day; mDoneQuery = TRUE; U32 scope = DFQ_DATE_EVENTS; if ( gAgent.wantsPGOnly()) scope |= DFQ_PG_SIMS_ONLY; if ( childGetValue("incpg").asBoolean() ) scope |= DFQ_INC_PG; if ( childGetValue("incmature").asBoolean() ) scope |= DFQ_INC_MATURE; if ( childGetValue("incadult").asBoolean() ) scope |= DFQ_INC_ADULT; // Add old query flags in case we are talking to an old server if ( childGetValue("incpg").asBoolean() && !childGetValue("incmature").asBoolean()) { scope |= DFQ_PG_EVENTS_ONLY; } if ( !( scope & (DFQ_INC_PG | DFQ_INC_MATURE | DFQ_INC_ADULT ))) { LLNotificationsUtil::add("NoContentToSearch"); return; } setupNewSearch(); std::ostringstream params; // Date mode for the search if ("current" == childGetValue("date_mode").asString()) { params << "u|"; } else { params << mDay << "|"; } // Categories are stored in the database in table indra.event_category // XML must match. U32 cat_id = childGetValue("category combo").asInteger(); params << cat_id << "|"; params << childGetValue("event_search_text").asString(); // send the message if (0 == event_id) { sendDirFindQuery(gMessageSystem, mSearchID, params.str(), scope, mSearchStart); } else { // This delete will also perform a query. LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_EventGodDelete); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_EventData); msg->addU32Fast(_PREHASH_EventID, event_id); msg->nextBlockFast(_PREHASH_QueryData); msg->addUUIDFast(_PREHASH_QueryID, mSearchID); msg->addStringFast(_PREHASH_QueryText, params.str()); msg->addU32Fast(_PREHASH_QueryFlags, scope); msg->addS32Fast(_PREHASH_QueryStart, mSearchStart); gAgent.sendReliableMessage(); } }
void LLFloaterTopObjects::doToObjects(int action, bool all) { LLMessageSystem *msg = gMessageSystem; LLViewerRegion* region = gAgent.getRegion(); if (!region) return; LLCtrlListInterface *list = getChild<LLUICtrl>("objects_list")->getListInterface(); if (!list || list->getItemCount() == 0) return; uuid_vec_t::iterator id_itor; bool start_message = true; for (id_itor = mObjectListIDs.begin(); id_itor != mObjectListIDs.end(); ++id_itor) { LLUUID task_id = *id_itor; if (!all && !list->isSelected(task_id)) { // Selected only continue; } if (start_message) { if (action == ACTION_RETURN) { msg->newMessageFast(_PREHASH_ParcelReturnObjects); } else { msg->newMessageFast(_PREHASH_ParcelDisableObjects); } msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ParcelData); msg->addS32Fast(_PREHASH_LocalID, -1); // Whole region msg->addS32Fast(_PREHASH_ReturnType, RT_NONE); start_message = false; } msg->nextBlockFast(_PREHASH_TaskIDs); msg->addUUIDFast(_PREHASH_TaskID, task_id); if (msg->isSendFullFast(_PREHASH_TaskIDs)) { msg->sendReliable(region->getHost()); start_message = true; } } if (!start_message) { msg->sendReliable(region->getHost()); } }
void LLGestureManager::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& in_item_id) { const LLUUID& base_in_item_id = get_linked_uuid(in_item_id); std::vector<LLUUID> gest_item_ids; // Deactivate all gestures that match item_map_t::iterator it; for (it = mActive.begin(); it != mActive.end(); ) { const LLUUID& item_id = (*it).first; LLMultiGesture* gest = (*it).second; // Don't deactivate the gesture we are looking for duplicates of // (for replaceGesture) if (!gest || item_id == base_in_item_id) { // legal, can have null pointers in list ++it; } else if ((!gest->mTrigger.empty() && gest->mTrigger == in->mTrigger) || (gest->mKey != KEY_NONE && gest->mKey == in->mKey && gest->mMask == in->mMask)) { gest_item_ids.push_back(item_id); stopGesture(gest); delete gest; gest = NULL; mActive.erase(it++); gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); } else { ++it; } } // Inform database of the change LLMessageSystem* msg = gMessageSystem; BOOL start_message = TRUE; std::vector<LLUUID>::const_iterator vit = gest_item_ids.begin(); while (vit != gest_item_ids.end()) { if (start_message) { msg->newMessage("DeactivateGestures"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->addU32("Flags", 0x0); start_message = FALSE; } msg->nextBlock("Data"); msg->addUUID("ItemID", *vit); msg->addU32("GestureFlags", 0x0); if (msg->getCurrentSendTotal() > MTUBYTES) { gAgent.sendReliableMessage(); start_message = TRUE; } ++vit; } if (!start_message) { gAgent.sendReliableMessage(); } // Add to the list of names for the user. for (vit = gest_item_ids.begin(); vit != gest_item_ids.end(); ++vit) { LLViewerInventoryItem* item = gInventory.getItem(*vit); if (!item) continue; mDeactivateSimilarNames.append(item->getName()); mDeactivateSimilarNames.append("\n"); } notifyObservers(); }
void LLFloaterTopObjects::onRefresh() { U32 mode = STAT_REPORT_TOP_SCRIPTS; U32 flags = 0; std::string filter = ""; mode = mCurrentMode; flags = mFlags; filter = mFilter; clearList(); LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_LandStatRequest); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() ); msg->nextBlockFast(_PREHASH_RequestData); msg->addU32Fast(_PREHASH_ReportType, mode); msg->addU32Fast(_PREHASH_RequestFlags, flags); msg->addStringFast(_PREHASH_Filter, filter); msg->addS32Fast(_PREHASH_ParcelLocalID, 0); msg->sendReliable(gAgent.getRegionHost()); mFilter.clear(); mFlags = 0; }
void LLWorldMapMessage::sendMapBlockRequest(U16 min_x, U16 min_y, U16 max_x, U16 max_y, bool return_nonexistent) { //LL_INFOS("World Map") << "LLWorldMap::sendMapBlockRequest()" << ", min = (" << min_x << ", " << min_y << "), max = (" << max_x << ", " << max_y << "), nonexistent = " << return_nonexistent << LL_ENDL; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_MapBlockRequest); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); U32 flags = LAYER_FLAG; flags |= (return_nonexistent ? 0x10000 : 0); msg->addU32Fast(_PREHASH_Flags, flags); msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim msg->nextBlockFast(_PREHASH_PositionData); msg->addU16Fast(_PREHASH_MinX, min_x); msg->addU16Fast(_PREHASH_MinY, min_y); msg->addU16Fast(_PREHASH_MaxX, max_x); msg->addU16Fast(_PREHASH_MaxY, max_y); gAgent.sendReliableMessage(); }
void LLPanelPick::sendPickInfoUpdate() { // If we don't have a pick id yet, we'll need to generate one, // otherwise we'll keep overwriting pick_id 00000 in the database. if (mPickID.isNull()) { mPickID.generate(); } LLMessageSystem* msg = gMessageSystem; msg->newMessage("PickInfoUpdate"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("Data"); msg->addUUID("PickID", mPickID); msg->addUUID("CreatorID", mCreatorID); msg->addBOOL("TopPick", mTopPick); // fills in on simulator if null msg->addUUID("ParcelID", mParcelID); msg->addString("Name", mNameEditor->getText()); msg->addString("Desc", mDescEditor->getText()); msg->addUUID("SnapshotID", mSnapshotCtrl->getImageAssetID()); msg->addVector3d("PosGlobal", mPosGlobal); // Only top picks have a sort order S32 sort_order; if (mTopPick) { sort_order = atoi(mSortOrderEditor->getText().c_str()); } else { sort_order = 0; } msg->addS32("SortOrder", sort_order); msg->addBOOL("Enabled", mEnabledCheck->get()); gAgent.sendReliableMessage(); }
void ImportTracker::plywood_above_head() { LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectAdd); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU8Fast(_PREHASH_Material, 3); msg->addU32Fast(_PREHASH_AddFlags, FLAGS_CREATE_SELECTED); LLVolumeParams volume_params; volume_params.setType(0x01, 0x10); volume_params.setBeginAndEndS(0.f, 1.f); volume_params.setBeginAndEndT(0.f, 1.f); volume_params.setRatio(1, 1); volume_params.setShear(0, 0); LLVolumeMessage::packVolumeParams(&volume_params, msg); msg->addU8Fast(_PREHASH_PCode, 9); msg->addVector3Fast(_PREHASH_Scale, LLVector3(0.52345f, 0.52346f, 0.52347f)); LLQuaternion rot; msg->addQuatFast(_PREHASH_Rotation, rot); LLViewerRegion *region = gAgent.getRegion(); if (!localids.size()) root = (initialPos + linksetoffset); msg->addVector3Fast(_PREHASH_RayStart, root); msg->addVector3Fast(_PREHASH_RayEnd, root); msg->addU8Fast(_PREHASH_BypassRaycast, (U8)TRUE ); msg->addU8Fast(_PREHASH_RayEndIsIntersection, (U8)FALSE ); msg->addU8Fast(_PREHASH_State, (U8)0); msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null); msg->sendReliable(region->getHost()); }
void LLToolGrab::stopGrab() { LLViewerObject* objectp = mGrabPick.getObject(); if (!objectp) { return; } LLPickInfo pick = mGrabPick; if (mMode == GRAB_NONPHYSICAL) { // for non-physical (touch) grabs, // gather surface info for this degrab (mouse-up) S32 x = gViewerWindow->getCurrentMouseX(); S32 y = gViewerWindow->getCurrentMouseY(); pick.mMousePt = LLCoordGL(x, y); pick.getSurfaceInfo(); } // Next, send messages to simulator LLMessageSystem *msg = gMessageSystem; switch(mMode) { case GRAB_ACTIVE_CENTER: case GRAB_NONPHYSICAL: case GRAB_LOCKED: msg->newMessageFast(_PREHASH_ObjectDeGrab); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_LocalID, objectp->mLocalID); 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()); mVerticalDragging = FALSE; break; case GRAB_NOOBJECT: case GRAB_INACTIVE: default: // do nothing break; } mHideBuildHighlight = FALSE; }
void ImportTracker::send_properties(LLSD& prim, int counter) { if(prim.has("properties")) { if(counter == 1)//root only shit { //prim["LocalID"] LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectPermissions); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_HeaderData); msg->addBOOLFast(_PREHASH_Override, FALSE); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger()); msg->addU8Fast(_PREHASH_Field, PERM_NEXT_OWNER); msg->addBOOLFast(_PREHASH_Set, PERM_ITEM_UNRESTRICTED); msg->addU32Fast(_PREHASH_Mask, U32(atoi(prim["next_owner_mask"].asString().c_str()))); /*msg->sendReliable(gAgent.getRegion()->getHost()); //LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectPermissions); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_HeaderData); msg->addBOOLFast(_PREHASH_Override, data->mOverride);*/ msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger()); msg->addU8Fast(_PREHASH_Field, PERM_GROUP); msg->addBOOLFast(_PREHASH_Set, PERM_ITEM_UNRESTRICTED); msg->addU32Fast(_PREHASH_Mask, U32(atoi(prim["group_mask"].asString().c_str()))); /*msg->sendReliable(gAgent.getRegion()->getHost()); //LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectPermissions); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_HeaderData); msg->addBOOLFast(_PREHASH_Override, data->mOverride);*/ msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger()); msg->addU8Fast(_PREHASH_Field, PERM_EVERYONE); msg->addBOOLFast(_PREHASH_Set, PERM_ITEM_UNRESTRICTED); msg->addU32Fast(_PREHASH_Mask, U32(atoi(prim["everyone_mask"].asString().c_str()))); msg->sendReliable(gAgent.getRegion()->getHost()); msg->newMessageFast(_PREHASH_ObjectSaleInfo); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_LocalID, prim["LocalID"].asInteger()); LLSaleInfo sale_info; BOOL a; U32 b; sale_info.fromLLSD(prim["sale_info"],a,b); sale_info.packMessage(msg); msg->sendReliable(gAgent.getRegion()->getHost()); //no facilities exist to send any other information at this time. } } }
void LLWorldMap::sendItemRequest(U32 type, U64 handle) { LLMessageSystem* msg = gMessageSystem; S32 layer = mCurrentMap; msg->newMessageFast(_PREHASH_MapItemRequest); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addU32Fast(_PREHASH_Flags, layer); msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim msg->nextBlockFast(_PREHASH_RequestData); msg->addU32Fast(_PREHASH_ItemType, type); msg->addU64Fast(_PREHASH_RegionHandle, handle); // If zero, filled in on sim gAgent.sendReliableMessage(); }