void RegionTextureControl::notifyChangePosition() { mCoordValue = mAreaSelectorControl->getCoord(); // снапим к гриду if (!MyGUI::InputManager::getInstance().isShiftPressed()) { MyGUI::IntCoord coord = mCoordValue; MyGUI::IntCoord actionScale = mAreaSelectorControl->getActionScale(); if (actionScale.left != 0 && actionScale.width != 0) { int right = coord.right(); coord.left = Grid::getInstance().toGrid(coord.left); coord.width = right - coord.left; } else if (actionScale.width != 0) { int right = Grid::getInstance().toGrid(coord.right()); coord.width = right - coord.left; } else if (actionScale.left != 0) { coord.left = Grid::getInstance().toGrid(coord.left); } if (actionScale.top != 0 && actionScale.height != 0) { int bottom = coord.bottom(); coord.top = Grid::getInstance().toGrid(coord.top); coord.height = bottom - coord.top; } else if (actionScale.height != 0) { int bottom = Grid::getInstance().toGrid(coord.bottom()); coord.height = bottom - coord.top; } else if (actionScale.top != 0) { coord.top = Grid::getInstance().toGrid(coord.top); } if (coord != mCoordValue) { mCoordValue = coord; mAreaSelectorControl->setCoord(mCoordValue); } } if (getCurrentRegion() != nullptr) getCurrentRegion()->getPropertySet()->setPropertyValue("Position", mCoordValue.print(), mTypeName); }
void RegionTextureControl::updatePosition() { MyGUI::UString value; if (getCurrentRegion() != nullptr) value = getCurrentRegion()->getPropertySet()->getPropertyValue("Position"); MyGUI::IntCoord coord; if (MyGUI::utility::parseComplex(value, coord.left, coord.top, coord.width, coord.height)) { mCoordValue = coord; mAreaSelectorControl->setCoord(mCoordValue); mPositionSelectorControl->setCoord(coord); } }
void RegionTextureControl::updateFromCoordValue() { mAreaSelectorControl->setCoord(mCoordValue); if (getCurrentRegion() != nullptr) { if (getCurrentRegion()->getPropertySet()->getPropertyValue("Visible") == "True") { if (getCurrentRegion()->getPropertySet()->getPropertyValue("Enabled") == "True") { if (!getCurrentRegion()->getPropertySet()->getPropertyReadOnly("Position")) getCurrentRegion()->getPropertySet()->setPropertyValue("Position", mCoordValue.print(), mTypeName); } } } }
void LLPathfindingManager::requestGetAgentState() { LLViewerRegion *currentRegion = getCurrentRegion(); if (currentRegion == NULL) { mAgentStateSignal(FALSE); } else { if (!currentRegion->capabilitiesReceived()) { currentRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetAgentStateForRegion, this, _1)); } else if (!isPathfindingEnabledForRegion(currentRegion)) { mAgentStateSignal(FALSE); } else { std::string agentStateURL = getAgentStateURLForRegion(currentRegion); llassert(!agentStateURL.empty()); LLHTTPClient::ResponderPtr responder = new AgentStateResponder(agentStateURL); LLHTTPClient::get(agentStateURL, responder); } } }
void LLPathfindingManager::requestGetCharacters(request_id_t pRequestId, object_request_callback_t pCharactersCallback) const { LLPathfindingObjectListPtr emptyCharacterListPtr; LLViewerRegion *currentRegion = getCurrentRegion(); if (currentRegion == NULL) { pCharactersCallback(pRequestId, kRequestNotEnabled, emptyCharacterListPtr); } else if (!currentRegion->capabilitiesReceived()) { pCharactersCallback(pRequestId, kRequestStarted, emptyCharacterListPtr); currentRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetCharactersForRegion, this, _1, pRequestId, pCharactersCallback)); } else { std::string charactersURL = getCharactersURLForCurrentRegion(); if (charactersURL.empty()) { pCharactersCallback(pRequestId, kRequestNotEnabled, emptyCharacterListPtr); } else { pCharactersCallback(pRequestId, kRequestStarted, emptyCharacterListPtr); LLHTTPClient::ResponderPtr charactersResponder = new CharactersResponder(charactersURL, pRequestId, pCharactersCallback); LLHTTPClient::get(charactersURL, charactersResponder); } } }
void LLPathfindingManager::handleDeferredGetCharactersForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pCharactersCallback) const { LLViewerRegion *currentRegion = getCurrentRegion(); if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID)) { requestGetCharacters(pRequestId, pCharactersCallback); } }
void LLPathfindingManager::handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID, bool pIsGetStatusOnly) { LLViewerRegion *currentRegion = getCurrentRegion(); if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID)) { requestGetNavMeshForRegion(currentRegion, pIsGetStatusOnly); } }
void LLPathfindingManager::handleDeferredGetAgentStateForRegion(const LLUUID &pRegionUUID) { LLViewerRegion *currentRegion = getCurrentRegion(); if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID)) { requestGetAgentState(); } }
void RegionTextureControl::updateVisible() { mAreaSelectorControl->setVisible(false); mPositionSelectorControl->setVisible(false); if (getCurrentRegion() != nullptr) { if (getCurrentRegion()->getPropertySet()->getPropertyValue("Visible") == "True") { if (getCurrentRegion()->getPropertySet()->getPropertyValue("Enabled") == "True") { if (!getCurrentRegion()->getPropertySet()->getPropertyReadOnly("Position")) mAreaSelectorControl->setVisible(true); else mPositionSelectorControl->setVisible(true); } } } }
void LLPathfindingManager::requestGetLinksets(request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const { LLPathfindingObjectListPtr emptyLinksetListPtr; LLViewerRegion *currentRegion = getCurrentRegion(); if (currentRegion == NULL) { pLinksetsCallback(pRequestId, kRequestNotEnabled, emptyLinksetListPtr); } else if (!currentRegion->capabilitiesReceived()) { pLinksetsCallback(pRequestId, kRequestStarted, emptyLinksetListPtr); currentRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetLinksetsForRegion, this, _1, pRequestId, pLinksetsCallback)); } else { std::string objectLinksetsURL = getObjectLinksetsURLForCurrentRegion(); std::string terrainLinksetsURL = getTerrainLinksetsURLForCurrentRegion(); if (objectLinksetsURL.empty() || terrainLinksetsURL.empty()) { pLinksetsCallback(pRequestId, kRequestNotEnabled, emptyLinksetListPtr); } else { pLinksetsCallback(pRequestId, kRequestStarted, emptyLinksetListPtr); bool doRequestTerrain = isAllowViewTerrainProperties(); LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, true, doRequestTerrain)); LLHTTPClient::ResponderPtr objectLinksetsResponder = new ObjectLinksetsResponder(objectLinksetsURL, linksetsResponderPtr); LLHTTPClient::get(objectLinksetsURL, objectLinksetsResponder); if (doRequestTerrain) { LLHTTPClient::ResponderPtr terrainLinksetsResponder = new TerrainLinksetsResponder(terrainLinksetsURL, linksetsResponderPtr); LLHTTPClient::get(terrainLinksetsURL, terrainLinksetsResponder); } } } }
void LLPathfindingManager::requestRebakeNavMesh(rebake_navmesh_callback_t pRebakeNavMeshCallback) { LLViewerRegion *currentRegion = getCurrentRegion(); if (currentRegion == NULL) { pRebakeNavMeshCallback(false); } else if (!isPathfindingEnabledForRegion(currentRegion)) { pRebakeNavMeshCallback(false); } else { std::string navMeshStatusURL = getNavMeshStatusURLForCurrentRegion(); llassert(!navMeshStatusURL.empty()); LLSD postData; postData["command"] = "rebuild"; LLHTTPClient::ResponderPtr responder = new NavMeshRebakeResponder(navMeshStatusURL, pRebakeNavMeshCallback); LLHTTPClient::post(navMeshStatusURL, postData, responder); } }
std::string LLPathfindingManager::getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const { return getCapabilityURLForRegion(getCurrentRegion(), pCapabilityName); }
std::string LLPathfindingManager::getNavMeshStatusURLForCurrentRegion() const { return getNavMeshStatusURLForRegion(getCurrentRegion()); }
bool LLPathfindingManager::isAllowViewTerrainProperties() const { LLViewerRegion* region = getCurrentRegion(); return (gAgent.isGodlike() || ((region != NULL) && region->canManageEstate())); }
bool LLPathfindingManager::isPathfindingEnabledForCurrentRegion() const { return isPathfindingEnabledForRegion(getCurrentRegion()); }