void LLFloaterGodTools::sendGodUpdateRegionInfo() { LLViewerRegion *regionp = gAgent.getRegion(); if (gAgent.isGodlike() && sGodTools->mPanelRegionTools && regionp && gAgent.getRegionHost() == mCurrentHost) { LLMessageSystem *msg = gMessageSystem; LLPanelRegionTools *rtool = sGodTools->mPanelRegionTools; msg->newMessage("GodUpdateRegionInfo"); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_RegionInfo); msg->addStringFast(_PREHASH_SimName, rtool->getSimName().c_str()); msg->addU32Fast(_PREHASH_EstateID, rtool->getEstateID()); msg->addU32Fast(_PREHASH_ParentEstateID, rtool->getParentEstateID()); msg->addU32Fast(_PREHASH_RegionFlags, computeRegionFlags()); msg->addF32Fast(_PREHASH_BillableFactor, rtool->getBillableFactor()); msg->addS32Fast(_PREHASH_PricePerMeter, rtool->getPricePerMeter()); msg->addS32Fast(_PREHASH_RedirectGridX, rtool->getRedirectGridX()); msg->addS32Fast(_PREHASH_RedirectGridY, rtool->getRedirectGridY()); gAgent.sendReliableMessage(); } }
void LLFloaterGodTools::sendGodUpdateRegionInfo() { LLFloaterGodTools* god_tools = LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools"); if (!god_tools) return; LLViewerRegion *regionp = gAgent.getRegion(); if (gAgent.isGodlike() && god_tools->mPanelRegionTools && regionp && gAgent.getRegionHost() == mCurrentHost) { LLMessageSystem *msg = gMessageSystem; LLPanelRegionTools *rtool = god_tools->mPanelRegionTools; U64 region_flags = computeRegionFlags(); msg->newMessage("GodUpdateRegionInfo"); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_RegionInfo); msg->addStringFast(_PREHASH_SimName, rtool->getSimName()); msg->addU32Fast(_PREHASH_EstateID, rtool->getEstateID()); msg->addU32Fast(_PREHASH_ParentEstateID, rtool->getParentEstateID()); // Legacy flags msg->addU32Fast(_PREHASH_RegionFlags, U32(region_flags)); msg->addF32Fast(_PREHASH_BillableFactor, rtool->getBillableFactor()); msg->addS32Fast(_PREHASH_PricePerMeter, rtool->getPricePerMeter()); msg->addS32Fast(_PREHASH_RedirectGridX, rtool->getRedirectGridX()); msg->addS32Fast(_PREHASH_RedirectGridY, rtool->getRedirectGridY()); msg->nextBlockFast(_PREHASH_RegionInfo2); msg->addU64Fast(_PREHASH_RegionFlagsExtended, region_flags); gAgent.sendReliableMessage(); } }
void LLFloaterAuction::clearParcelAccessList(LLParcel* parcel, LLViewerRegion* region, U32 list) { if (!region || !parcel) return; LLUUID transactionUUID; transactionUUID.generate(); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ParcelAccessListUpdate); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() ); msg->nextBlockFast(_PREHASH_Data); msg->addU32Fast(_PREHASH_Flags, list); msg->addS32(_PREHASH_LocalID, parcel->getLocalID() ); msg->addUUIDFast(_PREHASH_TransactionID, transactionUUID); msg->addS32Fast(_PREHASH_SequenceID, 1); // sequence_id msg->addS32Fast(_PREHASH_Sections, 0); // num_sections // pack an empty block since there will be no data msg->nextBlockFast(_PREHASH_List); msg->addUUIDFast(_PREHASH_ID, LLUUID::null ); msg->addS32Fast(_PREHASH_Time, 0 ); msg->addU32Fast(_PREHASH_Flags, 0 ); msg->sendReliable( region->getHost() ); }
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 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(); }
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 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 LLPanelDirPlaces::queryCore(const std::string& name, S32 category, U32 flags) { setupNewSearch(); // JC: Sorting by dwell severely impacts the performance of the query. // Instead of sorting on the dataserver, we sort locally once the results // are received. // IW: Re-enabled dwell sort based on new 3-character minimum description // Hopefully we'll move to next-gen Find before this becomes a big problem flags |= DFQ_DWELL_SORT; LLMessageSystem* msg = gMessageSystem; msg->newMessage("DirPlacesQuery"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("QueryData"); msg->addUUID("QueryID", getSearchID()); msg->addString("QueryText", name); msg->addU32("QueryFlags", flags); msg->addS8("Category", (S8)category); // No longer support queries by region name, too many regions // for combobox, no easy way to do autocomplete. JC msg->addString("SimName", ""); msg->addS32Fast(_PREHASH_QueryStart,mSearchStart); gAgent.sendReliableMessage(); }
void LuaTouch(const LLUUID& id) { LLViewerObject* object = gObjectList.findObject(id); if(!object) { LuaError("No Object Found"); 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, LLVector3::zero ); msg->nextBlock("SurfaceInfo"); msg->addVector3("UVCoord", LLVector3::zero); msg->addVector3("STCoord", LLVector3::zero); msg->addS32Fast(_PREHASH_FaceIndex, 0); msg->addVector3("Position", LLVector3::zero); msg->addVector3("Normal", LLVector3::zero); msg->addVector3("Binormal", LLVector3::zero); msg->sendMessage( object->getRegion()->getHost()); // *NOTE: Hope the packets arrive safely and in order or else // there will be some problems. // *TODO: Just fix this bad assumption. 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::zero); msg->addVector3("STCoord", LLVector3::zero); msg->addS32Fast(_PREHASH_FaceIndex, 0); msg->addVector3("Position", LLVector3::zero); msg->addVector3("Normal", LLVector3::zero); msg->addVector3("Binormal", LLVector3::zero); msg->sendMessage(object->getRegion()->getHost()); }
void LLPanelScriptLimitsRegionMemory::returnObjectsFromParcel(S32 local_id) { LLMessageSystem *msg = gMessageSystem; LLViewerRegion* region = gAgent.getRegion(); if (!region) return; LLCtrlListInterface *list = childGetListInterface("scripts_list"); if (!list || list->getItemCount() == 0) return; std::vector<LLSD>::iterator id_itor; bool start_message = true; for (id_itor = mObjectListItems.begin(); id_itor != mObjectListItems.end(); ++id_itor) { LLSD element = *id_itor; if (!list->isSelected(element["id"].asUUID())) { // Selected only continue; } if(element["local_id"].asInteger() != local_id) { // Not the parcel we are looking for continue; } if (start_message) { msg->newMessageFast(_PREHASH_ParcelReturnObjects); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ParcelData); msg->addS32Fast(_PREHASH_LocalID, element["local_id"].asInteger()); msg->addU32Fast(_PREHASH_ReturnType, RT_LIST); start_message = false; } msg->nextBlockFast(_PREHASH_TaskIDs); msg->addUUIDFast(_PREHASH_TaskID, element["id"].asUUID()); if (msg->isSendFullFast(_PREHASH_TaskIDs)) { msg->sendReliable(region->getHost()); start_message = true; } } if (!start_message) { 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 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(); }
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()); }
void LLPanelDirClassified::performQuery() { lldebugs << "LLPanelDirClassified::performQuery()" << llendl; BOOL inc_pg = childGetValue("incpg").asBoolean(); BOOL inc_mature = childGetValue("incmature").asBoolean(); BOOL inc_adult = childGetValue("incadult").asBoolean(); if (!(inc_pg || inc_mature || inc_adult)) { LLNotificationsUtil::add("NoContentToSearch"); return; } // 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_auto_renew = FALSE; U32 query_flags = pack_classified_flags_request(filter_auto_renew, inc_pg, inc_mature, inc_adult); //if (gAgent.isTeen()) query_flags |= DFQ_PG_SIMS_ONLY; if (childGetValue("filter_gaming")) query_flags |= DFQ_FILTER_GAMING; 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(); }
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 buffer = llformat("%d/%d", 1 + internal_time->tm_mon, // Jan = 0 internal_time->tm_mday); // 2001 = 101 childSetValue("date_text", buffer); // Record the relative day so back and forward buttons // offset from this day. mDay = relative_day; mDoneQuery = TRUE; setupNewSearch(); U32 scope = DFQ_DATE_EVENTS; if ( !childGetValue("incmature").asBoolean() ) scope |= DFQ_PG_EVENTS_ONLY; 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 LLPanelGroupVoting::impl::sendStartGroupProposal() { if ( !gAgent.hasPowerInGroup(mGroupID, GP_PROPOSAL_START) ) return; F32 majority = 0.f; S32 duration_seconds = (S32)mDuration->get()*24*60*60; // duration days * 24hours/day * 60min/hr * 60sec/min switch (mMajority->getSelectedIndex()) { case 0: // Simple Majority majority = 0.f; break; case 1: // 2/3 Majority majority = 2.f/3.f; break; case 2: // Unanimous majority = 1.0f; break; } S32 quorum = llfloor(mQuorum->get()); //*************************************Conversion to capability LLSD body; std::string url = gAgent.getRegion()->getCapability("StartGroupProposal"); if (!url.empty()) { body["agent-id"] = gAgent.getID(); body["session-id"] = gAgent.getSessionID(); body["group-id"] = mGroupID; body["majority"] = majority; body["quorum"] = quorum; body["duration"] = duration_seconds; body["proposal-text"] = mProposalText->getText(); LLHTTPClient::post( url, body, new LLStartGroupVoteResponder(mGroupID), 300); } else { //DEPRECATED!!!!!!! This is a fallback just in case our backend cap is not there. Delete this block ASAP! LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_StartGroupProposal); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() ); msg->nextBlockFast(_PREHASH_ProposalData); msg->addUUIDFast(_PREHASH_GroupID, mGroupID); msg->addF32Fast(_PREHASH_Majority, majority ); msg->addS32Fast(_PREHASH_Quorum, quorum ); msg->addS32Fast(_PREHASH_Duration, duration_seconds ); msg->addStringFast(_PREHASH_ProposalText, mProposalText->getText()); gAgent.sendReliableMessage(); //This code was moved from the callers to here as part of deprecation. sendGroupProposalsRequest(mGroupID); setEnableListProposals(); } }
void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result) // StoreAssetData callback (fixed) { LLResourceData* data = (LLResourceData*)user_data; //LLAssetType::EType pref_loc = data->mPreferredLocation; BOOL is_balance_sufficient = TRUE; if(result >= 0) { LLAssetType::EType dest_loc = (data->mPreferredLocation == LLAssetType::AT_NONE) ? 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(); S32 upload_cost = gGlobalEconomy->getPriceUpload(); if(!(can_afford_transaction(upload_cost))) { LLFloaterBuyCurrency::buyCurrency( llformat("Uploading %s costs", data->mAssetInfo.getName().c_str()), upload_cost); is_balance_sufficient = FALSE; } else if(region) { // Charge user for upload gStatusBar->debitBalance(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); msg->addS32Fast(_PREHASH_Amount, 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; LLUUID folder_id(gInventory.findCategoryUUIDForType(dest_loc)); if(folder_id.notNull()) { U32 next_owner_perm = data->mNextOwnerPerm; if(PERM_NONE == next_owner_perm) { next_owner_perm = 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_perm, LLPointer<LLInventoryCallback>(NULL)); } else { llwarns << "Can't find a folder to put it in" << llendl; } } } else // if(result >= 0) { LLStringBase<char>::format_map_t args; args["[FILE]"] = LLInventoryType::lookupHumanReadable(data->mInventoryType); args["[REASON]"] = LLString(LLAssetStorage::getErrorString(result)); gViewerWindow->alertXml("CannotUploadReason", args); } LLUploadDialog::modalUploadFinished(); delete data; // *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 char* next_file = LLFilePicker::instance().getNextFile(); if(is_balance_sufficient && next_file) { const char* name = LLFilePicker::instance().getDirname(); LLString asset_name = name; LLString::replaceNonstandardASCII( asset_name, '?' ); LLString::replaceChar(asset_name, '|', '?'); LLString::stripNonprintable(asset_name); LLString::trim(asset_name); char* asset_name_str = (char*)asset_name.c_str(); char* end_p = strrchr(asset_name_str, '.'); // strip extension if exists if( !end_p ) { end_p = asset_name_str + strlen( asset_name_str ); /* Flawfinder: ignore */ } S32 len = llmin( (S32) (DB_INV_ITEM_NAME_STR_LEN), (S32) (end_p - asset_name_str) ); asset_name = asset_name.substr( 0, len ); upload_new_resource(next_file, asset_name, asset_name, // file 0, LLAssetType::AT_NONE, LLInventoryType::IT_NONE); } }
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; if (childGetValue("filter_gaming").asBoolean()) scope |= DFQ_FILTER_GAMING; // 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 LLPanelDirLand::performQuery() { BOOL inc_pg = childGetValue("incpg").asBoolean(); BOOL inc_mature = childGetValue("incmature").asBoolean(); BOOL inc_adult = childGetValue("incadult").asBoolean(); if (!(inc_pg || inc_mature || inc_adult)) { LLNotifyBox::showXml("NoContentToSearch"); return; } LLMessageSystem* msg = gMessageSystem; setupNewSearch(); // We could change the UI to allow arbitrary combinations of these options U32 search_type = ST_ALL; const std::string& type = childGetValue("type").asString(); if(!type.empty()) { if (FIND_AUCTION == type) search_type = ST_AUCTION; else if(FIND_MAINLANDSALES == type) search_type = ST_MAINLAND; else if(FIND_ESTATESALES == type) search_type = ST_ESTATE; } U32 query_flags = 0x0; if (gAgent.wantsPGOnly()) query_flags |= DFQ_PG_SIMS_ONLY; bool adult_enabled = gAgent.canAccessAdult(); bool mature_enabled = gAgent.canAccessMature(); if (inc_pg) { query_flags |= DFQ_INC_PG; } if (inc_mature && mature_enabled) { query_flags |= DFQ_INC_MATURE; } if (inc_adult && adult_enabled) { query_flags |= DFQ_INC_ADULT; } // Add old flags in case we are talking to an old dataserver if (inc_pg && !inc_mature) { query_flags |= DFQ_PG_SIMS_ONLY; } if (!inc_pg && inc_mature) { query_flags |= DFQ_MATURE_SIMS_ONLY; } LLScrollListCtrl* list = getChild<LLScrollListCtrl>("results"); if (list) { std::string sort_name = list->getSortColumnName(); BOOL sort_asc = list->getSortAscending(); if (sort_name == "name") { query_flags |= DFQ_NAME_SORT; } else if (sort_name == "price") { query_flags |= DFQ_PRICE_SORT; } else if (sort_name == "per_meter") { query_flags |= DFQ_PER_METER_SORT; } else if (sort_name == "area") { query_flags |= DFQ_AREA_SORT; } if (sort_asc) { query_flags |= DFQ_SORT_ASC; } } if (childGetValue("pricecheck").asBoolean()) { query_flags |= DFQ_LIMIT_BY_PRICE; } if (childGetValue("areacheck").asBoolean()) { query_flags |= DFQ_LIMIT_BY_AREA; } msg->newMessage("DirLandQuery"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("QueryData"); msg->addUUID("QueryID", getSearchID()); msg->addU32("QueryFlags", query_flags); msg->addU32("SearchType", search_type); msg->addS32("Price", childGetValue("priceedit").asInteger()); msg->addS32("Area", childGetValue("areaedit").asInteger()); msg->addS32Fast(_PREHASH_QueryStart,mSearchStart); gAgent.sendReliableMessage(); }
// 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; }
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(result >= 0) { LLAssetType::EType dest_loc = (data->mPreferredLocation == LLAssetType::AT_NONE) ? 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))) { LLFloaterBuyCurrency::buyCurrency( llformat("Uploading %s costs", data->mAssetInfo.getName().c_str()), // *TODO: Translate 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; 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)); LLNotifications::instance().add("CannotUploadReason", args); } LLUploadDialog::modalUploadFinished(); delete data; // *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, LLAssetType::AT_NONE, LLInventoryType::IT_NONE, PERM_NONE, PERM_NONE, PERM_NONE, 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); } }
void LLPanelDirLand::performQuery() { LLMessageSystem* msg = gMessageSystem; setupNewSearch(); // We could change the UI to allow arbitrary combinations of these options U32 search_type = ST_ALL; const std::string& type = childGetValue("type").asString(); if(!type.empty()) { if (FIND_AUCTION == type) search_type = ST_AUCTION; else if(FIND_MAINLANDSALES == type) search_type = ST_MAINLAND; else if(FIND_ESTATESALES == type) search_type = ST_ESTATE; } U32 query_flags = 0x0; if (gAgent.mAccess <= SIM_ACCESS_PG) query_flags |= DFQ_PG_SIMS_ONLY; const std::string& rating = childGetValue("rating").asString(); if (rating == PG_ONLY) { query_flags |= DFQ_PG_SIMS_ONLY; } else if (rating == MATURE_ONLY) { query_flags |= DFQ_MATURE_SIMS_ONLY; } LLScrollListCtrl* list = (LLScrollListCtrl*)getChildByName("results"); if (list) { std::string sort_name = list->getSortColumnName(); BOOL sort_asc = list->getSortAscending(); if (sort_name == "name") { query_flags |= DFQ_NAME_SORT; } else if (sort_name == "price") { query_flags |= DFQ_PRICE_SORT; } else if (sort_name == "per_meter") { query_flags |= DFQ_PER_METER_SORT; } else if (sort_name == "area") { query_flags |= DFQ_AREA_SORT; } if (sort_asc) { query_flags |= DFQ_SORT_ASC; } } if (childGetValue("pricecheck").asBoolean()) { query_flags |= DFQ_LIMIT_BY_PRICE; } if (childGetValue("areacheck").asBoolean()) { query_flags |= DFQ_LIMIT_BY_AREA; } msg->newMessage("DirLandQuery"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("QueryData"); msg->addUUID("QueryID", getSearchID()); msg->addU32("QueryFlags", query_flags); msg->addU32("SearchType", search_type); msg->addS32("Price", childGetValue("priceedit").asInteger()); msg->addS32("Area", childGetValue("areaedit").asInteger()); msg->addS32Fast(_PREHASH_QueryStart,mSearchStart); gAgent.sendReliableMessage(); }
void LLToolBrushLand::modifyLandInSelectionGlobal() { if (LLViewerParcelMgr::getInstance()->selectionEmpty()) { return; } if (LLToolMgr::getInstance()->getCurrentTool() == LLToolSelectLand::getInstance()) { // selecting land, don't do anything return; } LLVector3d min; LLVector3d max; LLViewerParcelMgr::getInstance()->getSelection(min, max); S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction"); mLastAffectedRegions.clear(); determineAffectedRegions(mLastAffectedRegions, LLVector3d(min.mdV[VX], min.mdV[VY], 0)); determineAffectedRegions(mLastAffectedRegions, LLVector3d(min.mdV[VX], max.mdV[VY], 0)); determineAffectedRegions(mLastAffectedRegions, LLVector3d(max.mdV[VX], min.mdV[VY], 0)); determineAffectedRegions(mLastAffectedRegions, LLVector3d(max.mdV[VX], max.mdV[VY], 0)); LLRegionPosition mid_point_region((min + max) * 0.5); LLViewerRegion* center_region = mid_point_region.getRegion(); if (center_region) { LLVector3 pos_region = mid_point_region.getPositionRegion(); U32 grids = center_region->getLand().mGridsPerEdge; S32 i = llclamp( (S32)pos_region.mV[VX], 0, (S32)grids ); S32 j = llclamp( (S32)pos_region.mV[VY], 0, (S32)grids ); mStartingZ = center_region->getLand().getZ(i+j*grids); } else { mStartingZ = 0.f; } // Stop if our selection include a no-terraform region for(region_list_t::iterator iter = mLastAffectedRegions.begin(); iter != mLastAffectedRegions.end(); ++iter) { LLViewerRegion* regionp = *iter; if (!canTerraform(regionp)) { alertNoTerraform(regionp); return; } } for(region_list_t::iterator iter = mLastAffectedRegions.begin(); iter != mLastAffectedRegions.end(); ++iter) { LLViewerRegion* regionp = *iter; //BOOL is_changed = FALSE; LLVector3 min_region = regionp->getPosRegionFromGlobal(min); LLVector3 max_region = regionp->getPosRegionFromGlobal(max); min_region.clamp(0.f, regionp->getWidth()); max_region.clamp(0.f, regionp->getWidth()); F32 seconds = gSavedSettings.getF32("LandBrushForce"); LLSurface &land = regionp->getLand(); char action = E_LAND_LEVEL; switch (radioAction) { case 0: // // average toward mStartingZ action = E_LAND_LEVEL; seconds *= 0.25f; break; case 1: action = E_LAND_RAISE; seconds *= 0.25f; break; case 2: action = E_LAND_LOWER; seconds *= 0.25f; break; case 3: action = E_LAND_SMOOTH; seconds *= 5.0f; break; case 4: action = E_LAND_NOISE; seconds *= 0.5f; break; case 5: action = E_LAND_REVERT; seconds = 0.5f; break; default: //action = E_LAND_INVALID; //seconds = 0.0f; return; break; } // Don't send a message to the region if nothing changed. //if(!is_changed) continue; // Now to update the patch information so it will redraw correctly. LLSurfacePatch *patchp= land.resolvePatchRegion(min_region); if (patchp) { patchp->dirtyZ(); } // Also force the property lines to update, normals to recompute, etc. regionp->forceUpdate(); // tell the simulator what we've done LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ModifyLand); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ModifyBlock); msg->addU8Fast(_PREHASH_Action, (U8)action); msg->addU8Fast(_PREHASH_BrushSize, getBrushIndex()); msg->addF32Fast(_PREHASH_Seconds, seconds); msg->addF32Fast(_PREHASH_Height, mStartingZ); BOOL parcel_selected = LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected(); LLParcel* selected_parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); if (parcel_selected && selected_parcel) { msg->nextBlockFast(_PREHASH_ParcelData); msg->addS32Fast(_PREHASH_LocalID, selected_parcel->getLocalID()); msg->addF32Fast(_PREHASH_West, min_region.mV[VX] ); msg->addF32Fast(_PREHASH_South, min_region.mV[VY] ); msg->addF32Fast(_PREHASH_East, max_region.mV[VX] ); msg->addF32Fast(_PREHASH_North, max_region.mV[VY] ); } else { msg->nextBlockFast(_PREHASH_ParcelData); msg->addS32Fast(_PREHASH_LocalID, -1); msg->addF32Fast(_PREHASH_West, min_region.mV[VX] ); msg->addF32Fast(_PREHASH_South, min_region.mV[VY] ); msg->addF32Fast(_PREHASH_East, max_region.mV[VX] ); msg->addF32Fast(_PREHASH_North, max_region.mV[VY] ); } msg->nextBlock("ModifyBlockExtended"); msg->addF32("BrushSize", mBrushSize); msg->sendMessage(regionp->getHost()); } }
void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global, MASK mask) { S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction"); mLastAffectedRegions.clear(); determineAffectedRegions(mLastAffectedRegions, pos_global); for(region_list_t::iterator iter = mLastAffectedRegions.begin(); iter != mLastAffectedRegions.end(); ++iter) { LLViewerRegion* regionp = *iter; //BOOL is_changed = FALSE; LLVector3 pos_region = regionp->getPosRegionFromGlobal(pos_global); LLSurface &land = regionp->getLand(); char action = E_LAND_LEVEL; switch (radioAction) { case 0: // // average toward mStartingZ action = E_LAND_LEVEL; break; case 1: action = E_LAND_RAISE; break; case 2: action = E_LAND_LOWER; break; case 3: action = E_LAND_SMOOTH; break; case 4: action = E_LAND_NOISE; break; case 5: action = E_LAND_REVERT; break; default: action = E_LAND_INVALID; break; } // Don't send a message to the region if nothing changed. //if(!is_changed) continue; // Now to update the patch information so it will redraw correctly. LLSurfacePatch *patchp= land.resolvePatchRegion(pos_region); if (patchp) { patchp->dirtyZ(); } // Also force the property lines to update, normals to recompute, etc. regionp->forceUpdate(); // tell the simulator what we've done F32 seconds = (1.0f / gFPSClamped) * gSavedSettings.getF32("LandBrushForce"); F32 x_pos = (F32)pos_region.mV[VX]; F32 y_pos = (F32)pos_region.mV[VY]; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ModifyLand); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ModifyBlock); msg->addU8Fast(_PREHASH_Action, (U8)action); msg->addU8Fast(_PREHASH_BrushSize, getBrushIndex()); msg->addF32Fast(_PREHASH_Seconds, seconds); msg->addF32Fast(_PREHASH_Height, mStartingZ); msg->nextBlockFast(_PREHASH_ParcelData); msg->addS32Fast(_PREHASH_LocalID, -1); msg->addF32Fast(_PREHASH_West, x_pos ); msg->addF32Fast(_PREHASH_South, y_pos ); msg->addF32Fast(_PREHASH_East, x_pos ); msg->addF32Fast(_PREHASH_North, y_pos ); msg->nextBlock("ModifyBlockExtended"); msg->addF32("BrushSize", mBrushSize); msg->sendMessage(regionp->getHost()); } }
// <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; }
// Reset all the values for the parcel in preparation for a sale void LLFloaterAuction::doResetParcel() { LLParcel* parcelp = mParcelp->getParcel(); LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if (parcelp && region && !mParcelUpdateCapUrl.empty()) { LLSD body; std::string empty; // request new properties update from simulator U32 message_flags = 0x01; body["flags"] = ll_sd_from_U32(message_flags); // Set all the default parcel properties for auction body["local_id"] = parcelp->getLocalID(); U32 parcel_flags = PF_ALLOW_LANDMARK | PF_ALLOW_FLY | PF_CREATE_GROUP_OBJECTS | PF_ALLOW_ALL_OBJECT_ENTRY | PF_ALLOW_GROUP_OBJECT_ENTRY | PF_ALLOW_GROUP_SCRIPTS | PF_RESTRICT_PUSHOBJECT | PF_SOUND_LOCAL | PF_ALLOW_VOICE_CHAT | PF_USE_ESTATE_VOICE_CHAN; body["parcel_flags"] = ll_sd_from_U32(parcel_flags); // Build a parcel name like "Ahern (128,128) PG 4032m" std::ostringstream parcel_name; LLVector3 center_point( parcelp->getCenterpoint() ); center_point.snap(0); // Get rid of fractions parcel_name << region->getName() << " (" << (S32) center_point.mV[VX] << "," << (S32) center_point.mV[VY] << ") " << region->getSimAccessString() << " " << parcelp->getArea() << "m"; std::string new_name(parcel_name.str().c_str()); body["name"] = new_name; getChild<LLUICtrl>("parcel_text")->setValue(new_name); // Set name in dialog as well, since it won't get updated otherwise body["sale_price"] = (S32) 0; body["description"] = empty; body["music_url"] = empty; body["media_url"] = empty; body["media_desc"] = empty; body["media_type"] = LLMIMETypes::getDefaultMimeType(); body["media_width"] = (S32) 0; body["media_height"] = (S32) 0; body["auto_scale"] = (S32) 0; body["media_loop"] = (S32) 0; body["obscure_media"] = (S32) 0; // OBSOLETE - no longer used body["obscure_music"] = (S32) 0; // OBSOLETE - no longer used body["media_id"] = LLUUID::null; body["group_id"] = MAINTENANCE_GROUP_ID; // Use maintenance group body["pass_price"] = (S32) 10; // Defaults to $10 body["pass_hours"] = 0.0f; body["category"] = (U8) LLParcel::C_NONE; body["auth_buyer_id"] = LLUUID::null; body["snapshot_id"] = LLUUID::null; body["user_location"] = ll_sd_from_vector3( LLVector3::zero ); body["user_look_at"] = ll_sd_from_vector3( LLVector3::zero ); body["landing_type"] = (U8) LLParcel::L_DIRECT; llinfos << "Sending parcel update to reset for auction via capability to: " << mParcelUpdateCapUrl << llendl; LLHTTPClient::post(mParcelUpdateCapUrl, body, new LLHTTPClient::Responder()); // Send a message to clear the object return time LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_ParcelSetOtherCleanTime); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ParcelData); msg->addS32Fast(_PREHASH_LocalID, parcelp->getLocalID()); msg->addS32Fast(_PREHASH_OtherCleanTime, 5); // 5 minute object auto-return msg->sendReliable(region->getHost()); // Clear the access lists clearParcelAccessLists(parcelp, region); } }
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); }