diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs index afb788b..e95889d 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs | |||
@@ -50,7 +50,7 @@ using Ionic.Zlib; | |||
50 | // specify its assembly. Otherwise, the region modules in the assembly will not be picked up when OpenSimulator scans | 50 | // specify its assembly. Otherwise, the region modules in the assembly will not be picked up when OpenSimulator scans |
51 | // the available DLLs | 51 | // the available DLLs |
52 | //[assembly: Addin("MaterialsModule", "1.0")] | 52 | //[assembly: Addin("MaterialsModule", "1.0")] |
53 | //[assembly: AddinDependency("OpenSim", "0.5")] | 53 | //[assembly: AddinDependency("OpenSim", "0.8.1")] |
54 | 54 | ||
55 | namespace OpenSim.Region.OptionalModules.Materials | 55 | namespace OpenSim.Region.OptionalModules.Materials |
56 | { | 56 | { |
@@ -65,20 +65,23 @@ namespace OpenSim.Region.OptionalModules.Materials | |||
65 | 65 | ||
66 | private Scene m_scene = null; | 66 | private Scene m_scene = null; |
67 | private bool m_enabled = false; | 67 | private bool m_enabled = false; |
68 | private int m_maxMaterialsPerTransaction = 50; | ||
68 | 69 | ||
69 | public Dictionary<UUID, OSDMap> m_regionMaterials = new Dictionary<UUID, OSDMap>(); | 70 | public Dictionary<UUID, OSDMap> m_regionMaterials = new Dictionary<UUID, OSDMap>(); |
70 | 71 | ||
71 | public void Initialise(IConfigSource source) | 72 | public void Initialise(IConfigSource source) |
72 | { | 73 | { |
73 | IConfig config = source.Configs["Materials"]; | 74 | m_enabled = true; // default is enabled |
74 | if (config == null) | ||
75 | return; | ||
76 | 75 | ||
77 | m_enabled = config.GetBoolean("enable_materials", true); | 76 | IConfig config = source.Configs["Materials"]; |
78 | if (!m_enabled) | 77 | if (config != null) |
79 | return; | 78 | { |
79 | m_enabled = config.GetBoolean("enable_materials", m_enabled); | ||
80 | m_maxMaterialsPerTransaction = config.GetInt("MaxMaterialsPerTransaction", m_maxMaterialsPerTransaction); | ||
81 | } | ||
80 | 82 | ||
81 | m_log.DebugFormat("[Materials]: Initialized"); | 83 | if (m_enabled) |
84 | m_log.DebugFormat("[Materials]: Initialized"); | ||
82 | } | 85 | } |
83 | 86 | ||
84 | public void Close() | 87 | public void Close() |
@@ -146,6 +149,16 @@ namespace OpenSim.Region.OptionalModules.Materials | |||
146 | 149 | ||
147 | public void RegionLoaded(Scene scene) | 150 | public void RegionLoaded(Scene scene) |
148 | { | 151 | { |
152 | if (!m_enabled) return; | ||
153 | |||
154 | ISimulatorFeaturesModule featuresModule = scene.RequestModuleInterface<ISimulatorFeaturesModule>(); | ||
155 | if (featuresModule != null) | ||
156 | featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest; | ||
157 | } | ||
158 | |||
159 | private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) | ||
160 | { | ||
161 | features["MaxMaterialsPerTransaction"] = m_maxMaterialsPerTransaction; | ||
149 | } | 162 | } |
150 | 163 | ||
151 | /// <summary> | 164 | /// <summary> |
@@ -216,7 +229,12 @@ namespace OpenSim.Region.OptionalModules.Materials | |||
216 | 229 | ||
217 | GetLegacyStoredMaterialsInPart(part); | 230 | GetLegacyStoredMaterialsInPart(part); |
218 | 231 | ||
219 | GetStoredMaterialInFace(part, te.DefaultTexture); | 232 | if (te.DefaultTexture != null) |
233 | GetStoredMaterialInFace(part, te.DefaultTexture); | ||
234 | else | ||
235 | m_log.WarnFormat( | ||
236 | "[Materials]: Default texture for part {0} (part of object {1}) in {2} unexpectedly null. Ignoring.", | ||
237 | part.Name, part.ParentGroup.Name, m_scene.Name); | ||
220 | 238 | ||
221 | foreach (Primitive.TextureEntryFace face in te.FaceTextures) | 239 | foreach (Primitive.TextureEntryFace face in te.FaceTextures) |
222 | { | 240 | { |