Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-12-13 20:19:10 +00:00
commit d2ff4ebf2d
10 changed files with 101 additions and 81 deletions

View File

@ -3264,13 +3264,6 @@ namespace OpenSim.Region.Framework.Scenes
//} //}
} }
public void SetAvatarOnSitTarget(UUID avatarID)
{
m_sitTargetAvatar = avatarID;
if (ParentGroup != null)
ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
}
public void SetAxisRotation(int axis, int rotate) public void SetAxisRotation(int axis, int rotate)
{ {
if (m_parentGroup != null) if (m_parentGroup != null)

View File

@ -1836,7 +1836,10 @@ namespace OpenSim.Region.Framework.Scenes
part.TaskInventory.LockItemsForRead(false); part.TaskInventory.LockItemsForRead(false);
// Reset sit target. // Reset sit target.
if (part.GetAvatarOnSitTarget() == UUID) if (part.GetAvatarOnSitTarget() == UUID)
part.SetAvatarOnSitTarget(UUID.Zero); part.SitTargetAvatar = UUID.Zero;
if (part.ParentGroup != null)
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
m_parentPosition = part.GetWorldPosition(); m_parentPosition = part.GetWorldPosition();
ControllingClient.SendClearFollowCamProperties(part.ParentUUID); ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
} }
@ -1986,7 +1989,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!part.IsOccupied) if (!part.IsOccupied)
{ {
//Console.WriteLine("Scripted, unoccupied"); //Console.WriteLine("Scripted, unoccupied");
part.SetAvatarOnSitTarget(UUID); // set that Av will be on it part.SitTargetAvatar = UUID; // set that Av will be on it
offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); // change ofset to the scripted one offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); // change ofset to the scripted one
Quaternion nrot = avSitOrientation; Quaternion nrot = avSitOrientation;

View File

@ -29,6 +29,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using OpenSim.Framework; using OpenSim.Framework;
@ -48,7 +49,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013"); private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013");
private IAssetService m_AssetService; private IAssetService m_AssetService;
@ -143,24 +144,25 @@ namespace OpenSim.Services.Connectors.Hypergrid
return true; return true;
} }
UUID m_MissingTexture = new UUID("5748decc-f629-461c-9a36-a35a221fe21f"); public UUID GetMapImage(UUID regionID, string imageURL, string storagePath)
public UUID GetMapImage(UUID regionID, string imageURL)
{ {
if (m_AssetService == null) if (m_AssetService == null)
return m_MissingTexture; return m_HGMapImage;
UUID mapTile = m_HGMapImage;
string filename = string.Empty;
Bitmap bitmap = null;
try try
{ {
WebClient c = new WebClient(); WebClient c = new WebClient();
//m_log.Debug("JPEG: " + imageURL); //m_log.Debug("JPEG: " + imageURL);
string filename = regionID.ToString(); string name = regionID.ToString();
c.DownloadFile(imageURL, filename + ".jpg"); filename = Path.Combine(storagePath, name + ".jpg");
Bitmap m = new Bitmap(filename + ".jpg"); c.DownloadFile(imageURL, filename);
bitmap = new Bitmap(filename);
//m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
byte[] imageData = OpenJPEG.EncodeFromImage(m, true); byte[] imageData = OpenJPEG.EncodeFromImage(bitmap, true);
AssetBase ass = new AssetBase(UUID.Random(), "region " + filename, (sbyte)AssetType.Texture, regionID.ToString()); AssetBase ass = new AssetBase(UUID.Random(), "region " + name, (sbyte)AssetType.Texture, regionID.ToString());
// !!! for now // !!! for now
//info.RegionSettings.TerrainImageID = ass.FullID; //info.RegionSettings.TerrainImageID = ass.FullID;
@ -172,14 +174,13 @@ namespace OpenSim.Services.Connectors.Hypergrid
m_AssetService.Store(ass); m_AssetService.Store(ass);
// finally // finally
return ass.FullID; mapTile = ass.FullID;
} }
catch // LEGIT: Catching problems caused by OpenJPEG p/invoke catch // LEGIT: Catching problems caused by OpenJPEG p/invoke
{ {
m_log.Warn("[GATEKEEPER SERVICE CONNECTOR]: Failed getting/storing map image, because it is probably already in the cache"); m_log.Info("[GATEKEEPER SERVICE CONNECTOR]: Failed getting/storing map image, because it is probably already in the cache");
} }
return UUID.Zero; return mapTile;
} }
public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID) public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID)

View File

@ -28,6 +28,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
@ -52,8 +53,6 @@ namespace OpenSim.Services.GridService
LogManager.GetLogger( LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013");
private static uint m_autoMappingX = 0; private static uint m_autoMappingX = 0;
private static uint m_autoMappingY = 0; private static uint m_autoMappingY = 0;
private static bool m_enableAutoMapping = false; private static bool m_enableAutoMapping = false;
@ -65,6 +64,7 @@ namespace OpenSim.Services.GridService
protected UUID m_ScopeID = UUID.Zero; protected UUID m_ScopeID = UUID.Zero;
protected bool m_Check4096 = true; protected bool m_Check4096 = true;
protected string m_MapTileDirectory = string.Empty;
// Hyperlink regions are hyperlinks on the map // Hyperlink regions are hyperlinks on the map
public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>(); public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>();
@ -121,9 +121,24 @@ namespace OpenSim.Services.GridService
m_Check4096 = gridConfig.GetBoolean("Check4096", true); m_Check4096 = gridConfig.GetBoolean("Check4096", true);
m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", string.Empty);
m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);
m_log.DebugFormat("[HYPERGRID LINKER]: Loaded all services..."); m_log.Debug("[HYPERGRID LINKER]: Loaded all services...");
}
if (!string.IsNullOrEmpty(m_MapTileDirectory))
{
try
{
Directory.CreateDirectory(m_MapTileDirectory);
}
catch (Exception e)
{
m_log.WarnFormat("[HYPERGRID LINKER]: Could not create map tile storage directory {0}: {1}", m_MapTileDirectory, e);
m_MapTileDirectory = string.Empty;
}
} }
if (MainConsole.Instance != null) if (MainConsole.Instance != null)
@ -271,8 +286,13 @@ namespace OpenSim.Services.GridService
if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out externalName, out imageURL, out reason)) if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out externalName, out imageURL, out reason))
return false; return false;
if (regionID != UUID.Zero) if (regionID == UUID.Zero)
{ {
m_log.Warn("[HYPERGRID LINKER]: Unable to link region");
reason = "Remote region could not be found";
return false;
}
region = m_GridService.GetRegionByUUID(scopeID, regionID); region = m_GridService.GetRegionByUUID(scopeID, regionID);
if (region != null) if (region != null)
{ {
@ -282,31 +302,6 @@ namespace OpenSim.Services.GridService
return true; return true;
} }
regInfo.RegionID = regionID;
if ( externalName == string.Empty )
regInfo.RegionName = regInfo.ServerURI;
else
regInfo.RegionName = externalName;
m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName);
// Try get the map image
//regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL);
// I need a texture that works for this... the one I tried doesn't seem to be working
regInfo.TerrainImage = m_HGMapImage;
AddHyperlinkRegion(regInfo, handle);
m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID);
}
else
{
m_log.Warn("[HYPERGRID LINKER]: Unable to link region");
reason = "Remote region could not be found";
return false;
}
uint x, y; uint x, y;
if (m_Check4096 && !Check4096(handle, out x, out y)) if (m_Check4096 && !Check4096(handle, out x, out y))
{ {
@ -316,7 +311,20 @@ namespace OpenSim.Services.GridService
return false; return false;
} }
m_log.Debug("[HYPERGRID LINKER]: link region succeeded"); regInfo.RegionID = regionID;
if ( externalName == string.Empty )
regInfo.RegionName = regInfo.ServerURI;
else
regInfo.RegionName = externalName;
m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName);
// Get the map image
regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory);
AddHyperlinkRegion(regInfo, handle);
m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID);
return true; return true;
} }

View File

@ -123,42 +123,39 @@ namespace OpenSim.Services.HypergridService
externalName = m_ExternalName + ((regionName != string.Empty) ? " " + regionName : ""); externalName = m_ExternalName + ((regionName != string.Empty) ? " " + regionName : "");
imageURL = string.Empty; imageURL = string.Empty;
reason = string.Empty; reason = string.Empty;
GridRegion region = null;
m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", (regionName == string.Empty)? "default region" : regionName); m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", (regionName == string.Empty)? "default region" : regionName);
if (!m_AllowTeleportsToAnyRegion || regionName == string.Empty) if (!m_AllowTeleportsToAnyRegion || regionName == string.Empty)
{ {
List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID); List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID);
if (defs != null && defs.Count > 0) if (defs != null && defs.Count > 0)
m_DefaultGatewayRegion = defs[0];
try
{ {
regionID = m_DefaultGatewayRegion.RegionID; region = defs[0];
regionHandle = m_DefaultGatewayRegion.RegionHandle; m_DefaultGatewayRegion = region;
} }
catch else
{ {
reason = "Grid setup problem. Try specifying a particular region here."; reason = "Grid setup problem. Try specifying a particular region here.";
m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to send information. Please specify a default region for this grid!"); m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to send information. Please specify a default region for this grid!");
return false; return false;
} }
return true;
} }
else
GridRegion region = m_GridService.GetRegionByName(m_ScopeID, regionName); {
region = m_GridService.GetRegionByName(m_ScopeID, regionName);
if (region == null) if (region == null)
{ {
reason = "Region not found"; reason = "Region not found";
return false; return false;
} }
}
regionID = region.RegionID; regionID = region.RegionID;
regionHandle = region.RegionHandle; regionHandle = region.RegionHandle;
string regionimage = "regionImage" + region.RegionID.ToString();
regionimage = regionimage.Replace("-", "");
string regionimage = "regionImage" + regionID.ToString();
regionimage = regionimage.Replace("-", "");
imageURL = region.ServerURI + "index.php?method=" + regionimage; imageURL = region.ServerURI + "index.php?method=" + regionimage;
return true; return true;

View File

@ -68,6 +68,12 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
;; Perform distance check for the creation of a linked region ;; Perform distance check for the creation of a linked region
; Check4096 = "True" ; Check4096 = "True"
;; Needed to display non-default map tile images for linked regions
AssetService = "OpenSim.Services.AssetService.dll:AssetService"
;; Directory for map tile images of linked regions
; MapTileDirectory = "./"
;; Next, we can specify properties of regions, including default and fallback regions ;; Next, we can specify properties of regions, including default and fallback regions
;; The syntax is: Region_<RegionName> = "<flags>" ;; The syntax is: Region_<RegionName> = "<flags>"
;; or: Region_<RegionID> = "<flags>" ;; or: Region_<RegionID> = "<flags>"

View File

@ -42,6 +42,9 @@
GridServerURI = "http://mygridserver.com:8003" GridServerURI = "http://mygridserver.com:8003"
;AllowHypergridMapSearch = true ;AllowHypergridMapSearch = true
;; Directory for map tile images of linked regions
; MapTileDirectory = "./"
[AvatarService] [AvatarService]
; ;
; change this to your grid-wide grid server ; change this to your grid-wide grid server

View File

@ -49,6 +49,9 @@
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
; Needed to display non-default map tile images for linked regions
AssetService = "OpenSim.Services.Connectors.dll:AssetServicesConnector"
AllowHypergridMapSearch = true AllowHypergridMapSearch = true
[LibraryService] [LibraryService]

View File

@ -65,6 +65,9 @@
;; With hypergrid, perform distance check for the creation of a linked region ;; With hypergrid, perform distance check for the creation of a linked region
; Check4096 = true ; Check4096 = true
;; Directory for map tile images of remote regions
; MapTileDirectory = "./"
;; Next, we can specify properties of regions, including default and fallback regions ;; Next, we can specify properties of regions, including default and fallback regions
;; The syntax is: Region_<RegioName> = "<flags>" ;; The syntax is: Region_<RegioName> = "<flags>"
;; where <flags> can be DefaultRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut ;; where <flags> can be DefaultRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut

View File

@ -70,6 +70,9 @@
Realm = "regions" Realm = "regions"
StorageProvider = "OpenSim.Data.Null.dll" StorageProvider = "OpenSim.Data.Null.dll"
; Needed to display non-default map tile images for remote regions
AssetService = "OpenSim.Services.AssetService.dll:AssetService"
AllowHypergridMapSearch = true AllowHypergridMapSearch = true
[PresenceService] [PresenceService]