aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorAdam Frisby2008-04-27 23:54:16 +0000
committerAdam Frisby2008-04-27 23:54:16 +0000
commit7693a7dac9e6b4c8ed6d4028e210c611ad9d01ce (patch)
tree05e4de1f05ce98a74e85519b6c252b49193519c7 /OpenSim
parent* Patch from XenReborn to make remove-region work properly without needing to... (diff)
downloadopensim-SC_OLD-7693a7dac9e6b4c8ed6d4028e210c611ad9d01ce.zip
opensim-SC_OLD-7693a7dac9e6b4c8ed6d4028e210c611ad9d01ce.tar.gz
opensim-SC_OLD-7693a7dac9e6b4c8ed6d4028e210c611ad9d01ce.tar.bz2
opensim-SC_OLD-7693a7dac9e6b4c8ed6d4028e210c611ad9d01ce.tar.xz
* Added String(FileExtension) property to ITerrainLoader to allow us to determine which file extension this loader is capable of handling.
* Added ITerrainLoader import capability to Terrain Plugins module - this allows you to write new terrain format plugins without modifying the terrain module directly.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/FileLoaders/GenericSystemDrawing.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/FileLoaders/LLRAW.cs6
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/ITerrainLoader.cs1
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/TerrainException.cs6
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs19
8 files changed, 46 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/GenericSystemDrawing.cs
index 47e0e4cb..b05c1cd 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/GenericSystemDrawing.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/GenericSystemDrawing.cs
@@ -42,6 +42,11 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders
42 { 42 {
43 #region ITerrainLoader Members 43 #region ITerrainLoader Members
44 44
45 public string FileExtension
46 {
47 get { return ".gsd"; }
48 }
49
45 /// <summary> 50 /// <summary>
46 /// Loads a file from a specified filename on the disk, 51 /// Loads a file from a specified filename on the disk,
47 /// parses the image using the System.Drawing parsers 52 /// parses the image using the System.Drawing parsers
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs
index f25b29b..c2ac9d0 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs
@@ -36,6 +36,11 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders
36 { 36 {
37 #region ITerrainLoader Members 37 #region ITerrainLoader Members
38 38
39 public string FileExtension
40 {
41 get { return ".jpg"; }
42 }
43
39 public ITerrainChannel LoadFile(string filename) 44 public ITerrainChannel LoadFile(string filename)
40 { 45 {
41 throw new NotImplementedException(); 46 throw new NotImplementedException();
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/LLRAW.cs
index fda46f0..6ed7340 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/LLRAW.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/LLRAW.cs
@@ -132,6 +132,12 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders
132 s.Close(); 132 s.Close();
133 } 133 }
134 134
135
136 public string FileExtension
137 {
138 get { return ".raw"; }
139 }
140
135 #endregion 141 #endregion
136 142
137 public override string ToString() 143 public override string ToString()
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs
index d496069..edc379b 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs
@@ -34,6 +34,11 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders
34 { 34 {
35 #region ITerrainLoader Members 35 #region ITerrainLoader Members
36 36
37 public string FileExtension
38 {
39 get { return ".r32"; }
40 }
41
37 public ITerrainChannel LoadFile(string filename) 42 public ITerrainChannel LoadFile(string filename)
38 { 43 {
39 TerrainChannel retval = new TerrainChannel(); 44 TerrainChannel retval = new TerrainChannel();
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs
index 9f9edbc..2a4a8f8 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs
@@ -107,6 +107,11 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders
107 throw new NotImplementedException(); 107 throw new NotImplementedException();
108 } 108 }
109 109
110 public string FileExtension
111 {
112 get { return ".ter"; }
113 }
114
110 public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h) 115 public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h)
111 { 116 {
112 throw new NotImplementedException(); 117 throw new NotImplementedException();
diff --git a/OpenSim/Region/Environment/Modules/Terrain/ITerrainLoader.cs b/OpenSim/Region/Environment/Modules/Terrain/ITerrainLoader.cs
index 992ed1e..c718a32 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/ITerrainLoader.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/ITerrainLoader.cs
@@ -31,6 +31,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain
31{ 31{
32 public interface ITerrainLoader 32 public interface ITerrainLoader
33 { 33 {
34 string FileExtension { get; }
34 ITerrainChannel LoadFile(string filename); 35 ITerrainChannel LoadFile(string filename);
35 ITerrainChannel LoadFile(string filename, int fileStartX, int fileStartY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight); 36 ITerrainChannel LoadFile(string filename, int fileStartX, int fileStartY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight);
36 void SaveFile(string filename, ITerrainChannel map); 37 void SaveFile(string filename, ITerrainChannel map);
diff --git a/OpenSim/Region/Environment/Modules/Terrain/TerrainException.cs b/OpenSim/Region/Environment/Modules/Terrain/TerrainException.cs
index 307553b..d357063 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/TerrainException.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/TerrainException.cs
@@ -31,15 +31,15 @@ namespace OpenSim.Region.Environment.Modules.Terrain
31{ 31{
32 public class TerrainException : Exception 32 public class TerrainException : Exception
33 { 33 {
34 public TerrainException(): base() 34 public TerrainException() : base()
35 { 35 {
36 } 36 }
37 37
38 public TerrainException(string msg): base(msg) 38 public TerrainException(string msg) : base(msg)
39 { 39 {
40 } 40 }
41 41
42 public TerrainException(string msg, Exception e): base(msg, e) 42 public TerrainException(string msg, Exception e) : base(msg, e)
43 { 43 {
44 } 44 }
45 } 45 }
diff --git a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs
index dc8a023..67acef7 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs
@@ -185,7 +185,8 @@ namespace OpenSim.Region.Environment.Modules.Terrain
185 { 185 {
186 m_log.Error( 186 m_log.Error(
187 "[TERRAIN]: Unable to load heightmap, file not found. (A directory permissions error may also cause this)"); 187 "[TERRAIN]: Unable to load heightmap, file not found. (A directory permissions error may also cause this)");
188 throw new TerrainException(String.Format("unable to load heightmap: file {0} not found (or permissions do not allow access", filename)); 188 throw new TerrainException(
189 String.Format("unable to load heightmap: file {0} not found (or permissions do not allow access", filename));
189 } 190 }
190 } 191 }
191 CheckForTerrainUpdates(); 192 CheckForTerrainUpdates();
@@ -244,8 +245,20 @@ namespace OpenSim.Region.Environment.Modules.Terrain
244 if (pluginType.GetInterface("ITerrainEffect", false) != null) 245 if (pluginType.GetInterface("ITerrainEffect", false) != null)
245 { 246 {
246 ITerrainEffect terEffect = (ITerrainEffect) Activator.CreateInstance(library.GetType(pluginType.ToString())); 247 ITerrainEffect terEffect = (ITerrainEffect) Activator.CreateInstance(library.GetType(pluginType.ToString()));
247 m_plugineffects.Add(pluginType.Name, terEffect); 248 if (!m_plugineffects.ContainsKey(pluginType.Name))
248 m_log.Info("... " + pluginType.Name); 249 {
250 m_plugineffects.Add(pluginType.Name, terEffect);
251 m_log.Info("E ... " + pluginType.Name);
252 } else
253 {
254 m_log.Warn("E ... " + pluginType.Name + " (Already added)");
255 }
256 }
257 else if (pluginType.GetInterface("ITerrainLoader", false) != null)
258 {
259 ITerrainLoader terLoader = (ITerrainLoader) Activator.CreateInstance(library.GetType(pluginType.ToString()));
260 m_loaders[terLoader.FileExtension] = terLoader;
261 m_log.Info("L ... " + pluginType.Name);
249 } 262 }
250 } 263 }
251 catch (AmbiguousMatchException) 264 catch (AmbiguousMatchException)