diff options
author | Melanie | 2013-02-07 01:40:11 +0000 |
---|---|---|
committer | Melanie | 2013-02-07 01:40:11 +0000 |
commit | 375114bea37a017af553595d3a6f9d269acac1c5 (patch) | |
tree | 41cdd67221bc0b1af5e6bd886338a0e90d2c856e | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-375114bea37a017af553595d3a6f9d269acac1c5.zip opensim-SC_OLD-375114bea37a017af553595d3a6f9d269acac1c5.tar.gz opensim-SC_OLD-375114bea37a017af553595d3a6f9d269acac1c5.tar.bz2 opensim-SC_OLD-375114bea37a017af553595d3a6f9d269acac1c5.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
10 files changed, 151 insertions, 28 deletions
diff --git a/OpenSim/Framework/DAMap.cs b/OpenSim/Framework/DAMap.cs index 291c8b8..64cea77 100644 --- a/OpenSim/Framework/DAMap.cs +++ b/OpenSim/Framework/DAMap.cs | |||
@@ -73,6 +73,14 @@ namespace OpenSim.Framework | |||
73 | m_map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml); | 73 | m_map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml); |
74 | } | 74 | } |
75 | 75 | ||
76 | // WARNING: this is temporary for experimentation only, it will be removed!!!! | ||
77 | public OSDMap TopLevelMap | ||
78 | { | ||
79 | get { return m_map; } | ||
80 | set { m_map = value; } | ||
81 | } | ||
82 | |||
83 | |||
76 | public void ReadXml(XmlReader reader) | 84 | public void ReadXml(XmlReader reader) |
77 | { | 85 | { |
78 | ReadXml(reader.ReadInnerXml()); | 86 | ReadXml(reader.ReadInnerXml()); |
@@ -168,6 +176,10 @@ namespace OpenSim.Framework | |||
168 | } | 176 | } |
169 | } | 177 | } |
170 | 178 | ||
179 | /// <summary> | ||
180 | /// Validate the key used for storing separate data stores. | ||
181 | /// </summary> | ||
182 | /// <param name='key'></param> | ||
171 | private static void ValidateKey(string key) | 183 | private static void ValidateKey(string key) |
172 | { | 184 | { |
173 | if (key.Length < MIN_STORE_NAME_LENGTH) | 185 | if (key.Length < MIN_STORE_NAME_LENGTH) |
@@ -188,7 +200,8 @@ namespace OpenSim.Framework | |||
188 | } | 200 | } |
189 | 201 | ||
190 | public void Add(KeyValuePair<string, OSDMap> kvp) | 202 | public void Add(KeyValuePair<string, OSDMap> kvp) |
191 | { | 203 | { |
204 | ValidateKey(kvp.Key); | ||
192 | lock (this) | 205 | lock (this) |
193 | m_map.Add(kvp.Key, kvp.Value); | 206 | m_map.Add(kvp.Key, kvp.Value); |
194 | } | 207 | } |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index e0d4d74..8e325d7 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -45,6 +45,7 @@ using System.Text.RegularExpressions; | |||
45 | using System.Xml; | 45 | using System.Xml; |
46 | using System.Threading; | 46 | using System.Threading; |
47 | using log4net; | 47 | using log4net; |
48 | using log4net.Appender; | ||
48 | using Nini.Config; | 49 | using Nini.Config; |
49 | using Nwc.XmlRpc; | 50 | using Nwc.XmlRpc; |
50 | using OpenMetaverse; | 51 | using OpenMetaverse; |
@@ -828,9 +829,22 @@ namespace OpenSim.Framework | |||
828 | return "."; | 829 | return "."; |
829 | } | 830 | } |
830 | 831 | ||
832 | public static string logFile() | ||
833 | { | ||
834 | foreach (IAppender appender in LogManager.GetRepository().GetAppenders()) | ||
835 | { | ||
836 | if (appender is FileAppender) | ||
837 | { | ||
838 | return ((FileAppender)appender).File; | ||
839 | } | ||
840 | } | ||
841 | |||
842 | return "./OpenSim.log"; | ||
843 | } | ||
844 | |||
831 | public static string logDir() | 845 | public static string logDir() |
832 | { | 846 | { |
833 | return "."; | 847 | return Path.GetDirectoryName(logFile()); |
834 | } | 848 | } |
835 | 849 | ||
836 | // From: http://coercedcode.blogspot.com/2008/03/c-generate-unique-filenames-within.html | 850 | // From: http://coercedcode.blogspot.com/2008/03/c-generate-unique-filenames-within.html |
diff --git a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs index 0bb4567..cc7885a 100644 --- a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs | |||
@@ -35,6 +35,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
35 | 35 | ||
36 | public interface IJsonStoreModule | 36 | public interface IJsonStoreModule |
37 | { | 37 | { |
38 | bool AttachObjectStore(UUID objectID); | ||
38 | bool CreateStore(string value, ref UUID result); | 39 | bool CreateStore(string value, ref UUID result); |
39 | bool DestroyStore(UUID storeID); | 40 | bool DestroyStore(UUID storeID); |
40 | bool TestStore(UUID storeID); | 41 | bool TestStore(UUID storeID); |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs index 0b7b31b..751e463 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs | |||
@@ -49,7 +49,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
49 | private static readonly ILog m_log = | 49 | private static readonly ILog m_log = |
50 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 51 | ||
52 | private OSD m_ValueStore; | 52 | protected virtual OSD ValueStore { get; set; } |
53 | 53 | ||
54 | protected class TakeValueCallbackClass | 54 | protected class TakeValueCallbackClass |
55 | { | 55 | { |
@@ -108,17 +108,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
108 | /// | 108 | /// |
109 | /// </summary> | 109 | /// </summary> |
110 | // ----------------------------------------------------------------- | 110 | // ----------------------------------------------------------------- |
111 | public JsonStore() : this("") {} | 111 | public JsonStore() |
112 | |||
113 | public JsonStore(string value) | ||
114 | { | 112 | { |
115 | m_TakeStore = new List<TakeValueCallbackClass>(); | 113 | m_TakeStore = new List<TakeValueCallbackClass>(); |
116 | m_ReadStore = new List<TakeValueCallbackClass>(); | 114 | m_ReadStore = new List<TakeValueCallbackClass>(); |
117 | 115 | } | |
116 | |||
117 | public JsonStore(string value) | ||
118 | { | ||
118 | if (String.IsNullOrEmpty(value)) | 119 | if (String.IsNullOrEmpty(value)) |
119 | m_ValueStore = new OSDMap(); | 120 | ValueStore = new OSDMap(); |
120 | else | 121 | else |
121 | m_ValueStore = OSDParser.DeserializeJson(value); | 122 | ValueStore = OSDParser.DeserializeJson(value); |
122 | } | 123 | } |
123 | 124 | ||
124 | // ----------------------------------------------------------------- | 125 | // ----------------------------------------------------------------- |
@@ -129,7 +130,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
129 | public bool TestPath(string expr, bool useJson) | 130 | public bool TestPath(string expr, bool useJson) |
130 | { | 131 | { |
131 | Stack<string> path = ParsePathExpression(expr); | 132 | Stack<string> path = ParsePathExpression(expr); |
132 | OSD result = ProcessPathExpression(m_ValueStore,path); | 133 | OSD result = ProcessPathExpression(ValueStore,path); |
133 | 134 | ||
134 | if (result == null) | 135 | if (result == null) |
135 | return false; | 136 | return false; |
@@ -148,7 +149,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
148 | public bool GetValue(string expr, out string value, bool useJson) | 149 | public bool GetValue(string expr, out string value, bool useJson) |
149 | { | 150 | { |
150 | Stack<string> path = ParsePathExpression(expr); | 151 | Stack<string> path = ParsePathExpression(expr); |
151 | OSD result = ProcessPathExpression(m_ValueStore,path); | 152 | OSD result = ProcessPathExpression(ValueStore,path); |
152 | return ConvertOutputValue(result,out value,useJson); | 153 | return ConvertOutputValue(result,out value,useJson); |
153 | } | 154 | } |
154 | 155 | ||
@@ -184,7 +185,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
184 | Stack<string> path = ParsePathExpression(expr); | 185 | Stack<string> path = ParsePathExpression(expr); |
185 | string pexpr = PathExpressionToKey(path); | 186 | string pexpr = PathExpressionToKey(path); |
186 | 187 | ||
187 | OSD result = ProcessPathExpression(m_ValueStore,path); | 188 | OSD result = ProcessPathExpression(ValueStore,path); |
188 | if (result == null) | 189 | if (result == null) |
189 | { | 190 | { |
190 | m_TakeStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback)); | 191 | m_TakeStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback)); |
@@ -215,7 +216,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
215 | Stack<string> path = ParsePathExpression(expr); | 216 | Stack<string> path = ParsePathExpression(expr); |
216 | string pexpr = PathExpressionToKey(path); | 217 | string pexpr = PathExpressionToKey(path); |
217 | 218 | ||
218 | OSD result = ProcessPathExpression(m_ValueStore,path); | 219 | OSD result = ProcessPathExpression(ValueStore,path); |
219 | if (result == null) | 220 | if (result == null) |
220 | { | 221 | { |
221 | m_ReadStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback)); | 222 | m_ReadStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback)); |
@@ -245,7 +246,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
245 | Stack<string> path = ParsePathExpression(expr); | 246 | Stack<string> path = ParsePathExpression(expr); |
246 | if (path.Count == 0) | 247 | if (path.Count == 0) |
247 | { | 248 | { |
248 | m_ValueStore = ovalue; | 249 | ValueStore = ovalue; |
249 | return true; | 250 | return true; |
250 | } | 251 | } |
251 | 252 | ||
@@ -254,7 +255,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
254 | if (pexpr != "") | 255 | if (pexpr != "") |
255 | pexpr += "."; | 256 | pexpr += "."; |
256 | 257 | ||
257 | OSD result = ProcessPathExpression(m_ValueStore,path); | 258 | OSD result = ProcessPathExpression(ValueStore,path); |
258 | if (result == null) | 259 | if (result == null) |
259 | return false; | 260 | return false; |
260 | 261 | ||
@@ -522,4 +523,41 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
522 | return pkey; | 523 | return pkey; |
523 | } | 524 | } |
524 | } | 525 | } |
526 | |||
527 | public class JsonObjectStore : JsonStore | ||
528 | { | ||
529 | private static readonly ILog m_log = | ||
530 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
531 | |||
532 | private Scene m_scene; | ||
533 | private UUID m_objectID; | ||
534 | |||
535 | protected override OSD ValueStore | ||
536 | { | ||
537 | get | ||
538 | { | ||
539 | SceneObjectPart sop = m_scene.GetSceneObjectPart(m_objectID); | ||
540 | if (sop == null) | ||
541 | { | ||
542 | // This is bad | ||
543 | return null; | ||
544 | } | ||
545 | |||
546 | return sop.DynAttrs.TopLevelMap; | ||
547 | } | ||
548 | |||
549 | // cannot set the top level | ||
550 | set | ||
551 | { | ||
552 | m_log.InfoFormat("[JsonStore] cannot set top level value in object store"); | ||
553 | } | ||
554 | } | ||
555 | |||
556 | public JsonObjectStore(Scene scene, UUID oid) : base() | ||
557 | { | ||
558 | m_scene = scene; | ||
559 | m_objectID = oid; | ||
560 | } | ||
561 | } | ||
562 | |||
525 | } | 563 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs index b9b3ebc..a36ef42 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs | |||
@@ -175,6 +175,34 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
175 | /// | 175 | /// |
176 | /// </summary> | 176 | /// </summary> |
177 | // ----------------------------------------------------------------- | 177 | // ----------------------------------------------------------------- |
178 | public bool AttachObjectStore(UUID objectID) | ||
179 | { | ||
180 | if (! m_enabled) return false; | ||
181 | |||
182 | SceneObjectPart sop = m_scene.GetSceneObjectPart(objectID); | ||
183 | if (sop == null) | ||
184 | { | ||
185 | m_log.InfoFormat("[JsonStore] unable to attach to unknown object; {0}",objectID); | ||
186 | return false; | ||
187 | } | ||
188 | |||
189 | lock (m_JsonValueStore) | ||
190 | { | ||
191 | if (m_JsonValueStore.ContainsKey(objectID)) | ||
192 | return true; | ||
193 | |||
194 | JsonStore map = new JsonObjectStore(m_scene,objectID); | ||
195 | m_JsonValueStore.Add(objectID,map); | ||
196 | } | ||
197 | |||
198 | return true; | ||
199 | } | ||
200 | |||
201 | // ----------------------------------------------------------------- | ||
202 | /// <summary> | ||
203 | /// | ||
204 | /// </summary> | ||
205 | // ----------------------------------------------------------------- | ||
178 | public bool CreateStore(string value, ref UUID result) | 206 | public bool CreateStore(string value, ref UUID result) |
179 | { | 207 | { |
180 | if (result == UUID.Zero) | 208 | if (result == UUID.Zero) |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs index ec880a7..48b4a9f 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs | |||
@@ -169,6 +169,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
169 | m_comms.RegisterScriptInvocations(this); | 169 | m_comms.RegisterScriptInvocations(this); |
170 | 170 | ||
171 | // m_comms.RegisterScriptInvocation(this, "JsonCreateStore"); | 171 | // m_comms.RegisterScriptInvocation(this, "JsonCreateStore"); |
172 | // m_comms.RegisterScriptInvocation(this, "JsonAttachObjectStore"); | ||
172 | // m_comms.RegisterScriptInvocation(this, "JsonDestroyStore"); | 173 | // m_comms.RegisterScriptInvocation(this, "JsonDestroyStore"); |
173 | // m_comms.RegisterScriptInvocation(this, "JsonTestStore"); | 174 | // m_comms.RegisterScriptInvocation(this, "JsonTestStore"); |
174 | 175 | ||
@@ -220,6 +221,21 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
220 | /// </summary> | 221 | /// </summary> |
221 | // ----------------------------------------------------------------- | 222 | // ----------------------------------------------------------------- |
222 | [ScriptInvocation] | 223 | [ScriptInvocation] |
224 | public UUID JsonAttachObjectStore(UUID hostID, UUID scriptID) | ||
225 | { | ||
226 | UUID uuid = UUID.Zero; | ||
227 | if (! m_store.AttachObjectStore(hostID)) | ||
228 | GenerateRuntimeError("Failed to create Json store"); | ||
229 | |||
230 | return hostID; | ||
231 | } | ||
232 | |||
233 | // ----------------------------------------------------------------- | ||
234 | /// <summary> | ||
235 | /// | ||
236 | /// </summary> | ||
237 | // ----------------------------------------------------------------- | ||
238 | [ScriptInvocation] | ||
223 | public UUID JsonCreateStore(UUID hostID, UUID scriptID, string value) | 239 | public UUID JsonCreateStore(UUID hostID, UUID scriptID, string value) |
224 | { | 240 | { |
225 | UUID uuid = UUID.Zero; | 241 | UUID uuid = UUID.Zero; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 306928a..965c382 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -220,7 +220,7 @@ public static class BSParam | |||
220 | (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, | 220 | (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, |
221 | (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), | 221 | (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), |
222 | new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes", | 222 | new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes", |
223 | ConfigurationParameters.numericFalse, | 223 | ConfigurationParameters.numericTrue, |
224 | (s,cf,p,v) => { ShouldRemoveZeroWidthTriangles = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, | 224 | (s,cf,p,v) => { ShouldRemoveZeroWidthTriangles = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, |
225 | (s) => { return BSParam.NumericBool(ShouldRemoveZeroWidthTriangles); }, | 225 | (s) => { return BSParam.NumericBool(ShouldRemoveZeroWidthTriangles); }, |
226 | (s,p,l,v) => { ShouldRemoveZeroWidthTriangles = BSParam.BoolNumeric(v); } ), | 226 | (s,p,l,v) => { ShouldRemoveZeroWidthTriangles = BSParam.BoolNumeric(v); } ), |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index 823402b..ec25aa9 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -75,6 +75,7 @@ public abstract class BSPhysObject : PhysicsActor | |||
75 | PhysicsScene = parentScene; | 75 | PhysicsScene = parentScene; |
76 | LocalID = localID; | 76 | LocalID = localID; |
77 | PhysObjectName = name; | 77 | PhysObjectName = name; |
78 | Name = name; // PhysicsActor also has the name of the object. Someday consolidate. | ||
78 | TypeName = typeName; | 79 | TypeName = typeName; |
79 | 80 | ||
80 | // We don't have any physical representation yet. | 81 | // We don't have any physical representation yet. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 07e34ab..096b300 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -608,7 +608,7 @@ public sealed class BSShapeCollection : IDisposable | |||
608 | // Since we're recreating new, get rid of the reference to the previous shape | 608 | // Since we're recreating new, get rid of the reference to the previous shape |
609 | DereferenceShape(prim.PhysShape, shapeCallback); | 609 | DereferenceShape(prim.PhysShape, shapeCallback); |
610 | 610 | ||
611 | newShape = CreatePhysicalMesh(prim.PhysObjectName, newMeshKey, prim.BaseShape, prim.Size, lod); | 611 | newShape = CreatePhysicalMesh(prim, newMeshKey, prim.BaseShape, prim.Size, lod); |
612 | // Take evasive action if the mesh was not constructed. | 612 | // Take evasive action if the mesh was not constructed. |
613 | newShape = VerifyMeshCreated(newShape, prim); | 613 | newShape = VerifyMeshCreated(newShape, prim); |
614 | 614 | ||
@@ -619,7 +619,7 @@ public sealed class BSShapeCollection : IDisposable | |||
619 | return true; // 'true' means a new shape has been added to this prim | 619 | return true; // 'true' means a new shape has been added to this prim |
620 | } | 620 | } |
621 | 621 | ||
622 | private BulletShape CreatePhysicalMesh(string objName, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) | 622 | private BulletShape CreatePhysicalMesh(BSPhysObject prim, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) |
623 | { | 623 | { |
624 | BulletShape newShape = new BulletShape(); | 624 | BulletShape newShape = new BulletShape(); |
625 | 625 | ||
@@ -631,7 +631,7 @@ public sealed class BSShapeCollection : IDisposable | |||
631 | } | 631 | } |
632 | else | 632 | else |
633 | { | 633 | { |
634 | IMesh meshData = PhysicsScene.mesher.CreateMesh(objName, pbs, size, lod, | 634 | IMesh meshData = PhysicsScene.mesher.CreateMesh(prim.PhysObjectName, pbs, size, lod, |
635 | true, | 635 | true, |
636 | false, // say it is not physical so a bounding box is not built | 636 | false, // say it is not physical so a bounding box is not built |
637 | false, // do not cache the mesh and do not use previously built versions | 637 | false, // do not cache the mesh and do not use previously built versions |
@@ -653,18 +653,20 @@ public sealed class BSShapeCollection : IDisposable | |||
653 | realIndicesIndex = 0; | 653 | realIndicesIndex = 0; |
654 | for (int tri = 0; tri < indices.Length; tri += 3) | 654 | for (int tri = 0; tri < indices.Length; tri += 3) |
655 | { | 655 | { |
656 | // Compute displacements into vertex array for each vertex of the triangle | ||
656 | int v1 = indices[tri + 0] * 3; | 657 | int v1 = indices[tri + 0] * 3; |
657 | int v2 = indices[tri + 1] * 3; | 658 | int v2 = indices[tri + 1] * 3; |
658 | int v3 = indices[tri + 2] * 3; | 659 | int v3 = indices[tri + 2] * 3; |
659 | if (!((verticesAsFloats[v1 + 0] == verticesAsFloats[v2 + 0] | 660 | // Check to see if any two of the vertices are the same |
661 | if (!( ( verticesAsFloats[v1 + 0] == verticesAsFloats[v2 + 0] | ||
660 | && verticesAsFloats[v1 + 1] == verticesAsFloats[v2 + 1] | 662 | && verticesAsFloats[v1 + 1] == verticesAsFloats[v2 + 1] |
661 | && verticesAsFloats[v1 + 2] == verticesAsFloats[v2 + 2]) | 663 | && verticesAsFloats[v1 + 2] == verticesAsFloats[v2 + 2]) |
662 | || (verticesAsFloats[v2 + 0] == verticesAsFloats[v3 + 0] | 664 | || ( verticesAsFloats[v2 + 0] == verticesAsFloats[v3 + 0] |
663 | && verticesAsFloats[v2 + 1] == verticesAsFloats[v3 + 1] | 665 | && verticesAsFloats[v2 + 1] == verticesAsFloats[v3 + 1] |
664 | && verticesAsFloats[v2 + 2] == verticesAsFloats[v3 + 2]) | 666 | && verticesAsFloats[v2 + 2] == verticesAsFloats[v3 + 2]) |
665 | || (verticesAsFloats[v1 + 0] == verticesAsFloats[v3 + 0] | 667 | || ( verticesAsFloats[v1 + 0] == verticesAsFloats[v3 + 0] |
666 | && verticesAsFloats[v1 + 1] == verticesAsFloats[v3 + 1] | 668 | && verticesAsFloats[v1 + 1] == verticesAsFloats[v3 + 1] |
667 | && verticesAsFloats[v1 + 2] == verticesAsFloats[v3 + 2])) | 669 | && verticesAsFloats[v1 + 2] == verticesAsFloats[v3 + 2]) ) |
668 | ) | 670 | ) |
669 | { | 671 | { |
670 | // None of the vertices of the triangles are the same. This is a good triangle; | 672 | // None of the vertices of the triangles are the same. This is a good triangle; |
@@ -678,8 +680,16 @@ public sealed class BSShapeCollection : IDisposable | |||
678 | DetailLog("{0},BSShapeCollection.CreatePhysicalMesh,origTri={1},realTri={2},numVerts={3}", | 680 | DetailLog("{0},BSShapeCollection.CreatePhysicalMesh,origTri={1},realTri={2},numVerts={3}", |
679 | BSScene.DetailLogZero, indices.Length / 3, realIndicesIndex / 3, verticesAsFloats.Length / 3); | 681 | BSScene.DetailLogZero, indices.Length / 3, realIndicesIndex / 3, verticesAsFloats.Length / 3); |
680 | 682 | ||
681 | newShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World, | 683 | if (realIndicesIndex != 0) |
682 | realIndicesIndex, indices, verticesAsFloats.Length/3, verticesAsFloats); | 684 | { |
685 | newShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World, | ||
686 | realIndicesIndex, indices, verticesAsFloats.Length / 3, verticesAsFloats); | ||
687 | } | ||
688 | else | ||
689 | { | ||
690 | PhysicsScene.Logger.ErrorFormat("{0} All mesh triangles degenerate. Prim {1} at {2} in {3}", | ||
691 | LogHeader, prim.PhysObjectName, prim.RawPosition, PhysicsScene.Name); | ||
692 | } | ||
683 | } | 693 | } |
684 | } | 694 | } |
685 | newShape.shapeKey = newMeshKey; | 695 | newShape.shapeKey = newMeshKey; |
@@ -897,9 +907,11 @@ public sealed class BSShapeCollection : IDisposable | |||
897 | // If this mesh has an underlying asset and we have not failed getting it before, fetch the asset | 907 | // If this mesh has an underlying asset and we have not failed getting it before, fetch the asset |
898 | if (prim.BaseShape.SculptEntry && !prim.LastAssetBuildFailed && prim.BaseShape.SculptTexture != OMV.UUID.Zero) | 908 | if (prim.BaseShape.SculptEntry && !prim.LastAssetBuildFailed && prim.BaseShape.SculptTexture != OMV.UUID.Zero) |
899 | { | 909 | { |
910 | DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset,lastFailed={1}", prim.LocalID, prim.LastAssetBuildFailed); | ||
911 | // This will prevent looping through this code as we keep trying to get the failed shape | ||
900 | prim.LastAssetBuildFailed = true; | 912 | prim.LastAssetBuildFailed = true; |
913 | |||
901 | BSPhysObject xprim = prim; | 914 | BSPhysObject xprim = prim; |
902 | DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset,lastFailed={1}", prim.LocalID, prim.LastAssetBuildFailed); | ||
903 | Util.FireAndForget(delegate | 915 | Util.FireAndForget(delegate |
904 | { | 916 | { |
905 | RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod; | 917 | RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod; |
@@ -910,7 +922,7 @@ public sealed class BSShapeCollection : IDisposable | |||
910 | { | 922 | { |
911 | bool assetFound = false; // DEBUG DEBUG | 923 | bool assetFound = false; // DEBUG DEBUG |
912 | string mismatchIDs = String.Empty; // DEBUG DEBUG | 924 | string mismatchIDs = String.Empty; // DEBUG DEBUG |
913 | if (yprim.BaseShape.SculptEntry) | 925 | if (asset != null && yprim.BaseShape.SculptEntry) |
914 | { | 926 | { |
915 | if (yprim.BaseShape.SculptTexture.ToString() == asset.ID) | 927 | if (yprim.BaseShape.SculptTexture.ToString() == asset.ID) |
916 | { | 928 | { |
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index 438ef48..b98b762 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs | |||
@@ -420,7 +420,7 @@ namespace OpenSim.Region.UserStatistics | |||
420 | Encoding encoding = Encoding.ASCII; | 420 | Encoding encoding = Encoding.ASCII; |
421 | int sizeOfChar = encoding.GetByteCount("\n"); | 421 | int sizeOfChar = encoding.GetByteCount("\n"); |
422 | byte[] buffer = encoding.GetBytes("\n"); | 422 | byte[] buffer = encoding.GetBytes("\n"); |
423 | string logfile = Util.logDir() + "/" + "OpenSim.log"; | 423 | string logfile = Util.logFile(); |
424 | FileStream fs = new FileStream(logfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); | 424 | FileStream fs = new FileStream(logfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); |
425 | Int64 tokenCount = 0; | 425 | Int64 tokenCount = 0; |
426 | Int64 endPosition = fs.Length / sizeOfChar; | 426 | Int64 endPosition = fs.Length / sizeOfChar; |