diff options
author | Melanie | 2012-08-04 03:00:20 +0100 |
---|---|---|
committer | Melanie | 2012-08-04 03:00:20 +0100 |
commit | b9c4a637b46d0c47d5348181dd75c4cc3d44f43d (patch) | |
tree | 7cf26233b2aaea5556f9842d7a44e35860098a95 /OpenSim | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Strip experimental tag from --publish option of "save oar" region console com... (diff) | |
download | opensim-SC_OLD-b9c4a637b46d0c47d5348181dd75c4cc3d44f43d.zip opensim-SC_OLD-b9c4a637b46d0c47d5348181dd75c4cc3d44f43d.tar.gz opensim-SC_OLD-b9c4a637b46d0c47d5348181dd75c4cc3d44f43d.tar.bz2 opensim-SC_OLD-b9c4a637b46d0c47d5348181dd75c4cc3d44f43d.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim')
13 files changed, 193 insertions, 93 deletions
diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index a64f01c..709b516 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs | |||
@@ -93,6 +93,8 @@ namespace OpenSim.Framework.Serialization.External | |||
93 | "MediaURL", (ld, xtr) => ld.MediaURL = xtr.ReadElementString("MediaURL")); | 93 | "MediaURL", (ld, xtr) => ld.MediaURL = xtr.ReadElementString("MediaURL")); |
94 | m_ldProcessors.Add( | 94 | m_ldProcessors.Add( |
95 | "MusicURL", (ld, xtr) => ld.MusicURL = xtr.ReadElementString("MusicURL")); | 95 | "MusicURL", (ld, xtr) => ld.MusicURL = xtr.ReadElementString("MusicURL")); |
96 | m_ldProcessors.Add( | ||
97 | "OwnerID", (ld, xtr) => ld.OwnerID = UUID.Parse(xtr.ReadElementString("OwnerID"))); | ||
96 | 98 | ||
97 | m_ldProcessors.Add( | 99 | m_ldProcessors.Add( |
98 | "ParcelAccessList", ProcessParcelAccessList); | 100 | "ParcelAccessList", ProcessParcelAccessList); |
@@ -186,7 +188,16 @@ namespace OpenSim.Framework.Serialization.External | |||
186 | return landData; | 188 | return landData; |
187 | } | 189 | } |
188 | 190 | ||
189 | public static string Serialize(LandData landData) | 191 | /// <summary> |
192 | /// Serialize land data | ||
193 | /// </summary> | ||
194 | /// <param name='landData'></param> | ||
195 | /// <param name='options'> | ||
196 | /// Serialization options. | ||
197 | /// Can be null if there are no options. | ||
198 | /// "wipe-owners" will write UUID.Zero rather than the ownerID so that a later reload loads all parcels with the estate owner as the owner | ||
199 | /// </param> | ||
200 | public static string Serialize(LandData landData, Dictionary<string, object> options) | ||
190 | { | 201 | { |
191 | StringWriter sw = new StringWriter(); | 202 | StringWriter sw = new StringWriter(); |
192 | XmlTextWriter xtw = new XmlTextWriter(sw); | 203 | XmlTextWriter xtw = new XmlTextWriter(sw); |
@@ -215,7 +226,14 @@ namespace OpenSim.Framework.Serialization.External | |||
215 | xtw.WriteElementString("MediaID", landData.MediaID.ToString()); | 226 | xtw.WriteElementString("MediaID", landData.MediaID.ToString()); |
216 | xtw.WriteElementString("MediaURL", landData.MediaURL); | 227 | xtw.WriteElementString("MediaURL", landData.MediaURL); |
217 | xtw.WriteElementString("MusicURL", landData.MusicURL); | 228 | xtw.WriteElementString("MusicURL", landData.MusicURL); |
218 | xtw.WriteElementString("OwnerID", landData.OwnerID.ToString()); | 229 | |
230 | UUID ownerIdToWrite; | ||
231 | if (options != null && options.ContainsKey("wipe-owners")) | ||
232 | ownerIdToWrite = UUID.Zero; | ||
233 | else | ||
234 | ownerIdToWrite = landData.OwnerID; | ||
235 | |||
236 | xtw.WriteElementString("OwnerID", ownerIdToWrite.ToString()); | ||
219 | 237 | ||
220 | xtw.WriteStartElement("ParcelAccessList"); | 238 | xtw.WriteStartElement("ParcelAccessList"); |
221 | foreach (LandAccessEntry pal in landData.ParcelAccessList) | 239 | foreach (LandAccessEntry pal in landData.ParcelAccessList) |
diff --git a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs index b8ed9e1..8b9756b 100644 --- a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs +++ b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs | |||
@@ -42,22 +42,23 @@ namespace OpenSim.Framework.Serialization.Tests | |||
42 | private LandData land; | 42 | private LandData land; |
43 | private LandData landWithParcelAccessList; | 43 | private LandData landWithParcelAccessList; |
44 | 44 | ||
45 | private static string preSerialized = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList />\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>"; | 45 | // private static string preSerialized = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList />\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>"; |
46 | private static string preSerializedWithParcelAccessList = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList>\n <ParcelAccessEntry>\n <AgentID>62d65d45-c91a-4f77-862c-46557d978b6c</AgentID>\n <Time>0</Time>\n <AccessList>2</AccessList>\n </ParcelAccessEntry>\n <ParcelAccessEntry>\n <AgentID>ec2a8d18-2378-4fe0-8b68-2a31b57c481e</AgentID>\n <Time>0</Time>\n <AccessList>1</AccessList>\n </ParcelAccessEntry>\n </ParcelAccessList>\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>"; | 46 | private static string preSerializedWithParcelAccessList |
47 | = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList>\n <ParcelAccessEntry>\n <AgentID>62d65d45-c91a-4f77-862c-46557d978b6c</AgentID>\n <Time>0</Time>\n <AccessList>2</AccessList>\n </ParcelAccessEntry>\n <ParcelAccessEntry>\n <AgentID>ec2a8d18-2378-4fe0-8b68-2a31b57c481e</AgentID>\n <Time>0</Time>\n <AccessList>1</AccessList>\n </ParcelAccessEntry>\n </ParcelAccessList>\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>"; | ||
47 | 48 | ||
48 | [SetUp] | 49 | [SetUp] |
49 | public void setup() | 50 | public void setup() |
50 | { | 51 | { |
51 | // setup LandData object | 52 | // setup LandData object |
52 | this.land = new LandData(); | 53 | this.land = new LandData(); |
53 | this.land.AABBMax = new Vector3(0, 0, 0); | 54 | this.land.AABBMax = new Vector3(1, 2, 3); |
54 | this.land.AABBMin = new Vector3(128, 128, 128); | 55 | this.land.AABBMin = new Vector3(129, 130, 131); |
55 | this.land.Area = 128; | 56 | this.land.Area = 128; |
56 | this.land.AuctionID = 0; | 57 | this.land.AuctionID = 4; |
57 | this.land.AuthBuyerID = new UUID(); | 58 | this.land.AuthBuyerID = new UUID("7176df0c-6c50-45db-8a37-5e78be56a0cd"); |
58 | this.land.Category = ParcelCategory.Residential; | 59 | this.land.Category = ParcelCategory.Residential; |
59 | this.land.ClaimDate = 0; | 60 | this.land.ClaimDate = 1; |
60 | this.land.ClaimPrice = 0; | 61 | this.land.ClaimPrice = 2; |
61 | this.land.GlobalID = new UUID("54ff9641-dd40-4a2c-b1f1-47dd3af24e50"); | 62 | this.land.GlobalID = new UUID("54ff9641-dd40-4a2c-b1f1-47dd3af24e50"); |
62 | this.land.GroupID = new UUID("d740204e-bbbf-44aa-949d-02c7d739f6a5"); | 63 | this.land.GroupID = new UUID("d740204e-bbbf-44aa-949d-02c7d739f6a5"); |
63 | this.land.Description = "land data to test LandDataSerializer"; | 64 | this.land.Description = "land data to test LandDataSerializer"; |
@@ -65,7 +66,7 @@ namespace OpenSim.Framework.Serialization.Tests | |||
65 | this.land.LandingType = (byte)LandingType.Direct; | 66 | this.land.LandingType = (byte)LandingType.Direct; |
66 | this.land.Name = "LandDataSerializerTest Land"; | 67 | this.land.Name = "LandDataSerializerTest Land"; |
67 | this.land.Status = ParcelStatus.Leased; | 68 | this.land.Status = ParcelStatus.Leased; |
68 | this.land.LocalID = 0; | 69 | this.land.LocalID = 1; |
69 | this.land.MediaAutoScale = (byte)0x01; | 70 | this.land.MediaAutoScale = (byte)0x01; |
70 | this.land.MediaID = new UUID("d4452578-2f25-4b97-a81b-819af559cfd7"); | 71 | this.land.MediaID = new UUID("d4452578-2f25-4b97-a81b-819af559cfd7"); |
71 | this.land.MediaURL = "http://videos.opensimulator.org/bumblebee.mp4"; | 72 | this.land.MediaURL = "http://videos.opensimulator.org/bumblebee.mp4"; |
@@ -90,26 +91,26 @@ namespace OpenSim.Framework.Serialization.Tests | |||
90 | /// <summary> | 91 | /// <summary> |
91 | /// Test the LandDataSerializer.Serialize() method | 92 | /// Test the LandDataSerializer.Serialize() method |
92 | /// </summary> | 93 | /// </summary> |
93 | [Test] | 94 | // [Test] |
94 | public void LandDataSerializerSerializeTest() | 95 | // public void LandDataSerializerSerializeTest() |
95 | { | 96 | // { |
96 | TestHelpers.InMethod(); | 97 | // TestHelpers.InMethod(); |
97 | 98 | // | |
98 | string serialized = LandDataSerializer.Serialize(this.land).Replace("\r\n", "\n"); | 99 | // string serialized = LandDataSerializer.Serialize(this.land).Replace("\r\n", "\n"); |
99 | Assert.That(serialized.Length > 0, "Serialize(LandData) returned empty string"); | 100 | // Assert.That(serialized.Length > 0, "Serialize(LandData) returned empty string"); |
100 | 101 | // | |
101 | // adding a simple boolean variable because resharper nUnit integration doesn't like this | 102 | // // adding a simple boolean variable because resharper nUnit integration doesn't like this |
102 | // XML data in the Assert.That statement. Not sure why. | 103 | // // XML data in the Assert.That statement. Not sure why. |
103 | bool result = (serialized == preSerialized); | 104 | // bool result = (serialized == preSerialized); |
104 | Assert.That(result, "result of Serialize LandData does not match expected result"); | 105 | // Assert.That(result, "result of Serialize LandData does not match expected result"); |
105 | 106 | // | |
106 | string serializedWithParcelAccessList = LandDataSerializer.Serialize(this.landWithParcelAccessList).Replace("\r\n", "\n"); | 107 | // string serializedWithParcelAccessList = LandDataSerializer.Serialize(this.landWithParcelAccessList).Replace("\r\n", "\n"); |
107 | Assert.That(serializedWithParcelAccessList.Length > 0, | 108 | // Assert.That(serializedWithParcelAccessList.Length > 0, |
108 | "Serialize(LandData) returned empty string for LandData object with ParcelAccessList"); | 109 | // "Serialize(LandData) returned empty string for LandData object with ParcelAccessList"); |
109 | result = (serializedWithParcelAccessList == preSerializedWithParcelAccessList); | 110 | // result = (serializedWithParcelAccessList == preSerializedWithParcelAccessList); |
110 | Assert.That(result, | 111 | // Assert.That(result, |
111 | "result of Serialize(LandData) does not match expected result (pre-serialized with parcel access list"); | 112 | // "result of Serialize(LandData) does not match expected result (pre-serialized with parcel access list"); |
112 | } | 113 | // } |
113 | 114 | ||
114 | /// <summary> | 115 | /// <summary> |
115 | /// Test the LandDataSerializer.Deserialize() method | 116 | /// Test the LandDataSerializer.Deserialize() method |
@@ -120,10 +121,28 @@ namespace OpenSim.Framework.Serialization.Tests | |||
120 | TestHelpers.InMethod(); | 121 | TestHelpers.InMethod(); |
121 | // log4net.Config.XmlConfigurator.Configure(); | 122 | // log4net.Config.XmlConfigurator.Configure(); |
122 | 123 | ||
123 | LandData ld = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerialized); | 124 | LandData ld = LandDataSerializer.Deserialize(LandDataSerializer.Serialize(this.land, null)); |
124 | Assert.That(ld != null, "Deserialize(string) returned null"); | 125 | Assert.That(ld, Is.Not.Null, "Deserialize(string) returned null"); |
125 | Assert.That(ld.GlobalID == this.land.GlobalID, "Reified LandData.GlobalID != original LandData.GlobalID"); | 126 | // Assert.That(ld.AABBMax, Is.EqualTo(land.AABBMax)); |
126 | Assert.That(ld.Name == this.land.Name, "Reified LandData.Name != original LandData.Name"); | 127 | // Assert.That(ld.AABBMin, Is.EqualTo(land.AABBMin)); |
128 | Assert.That(ld.Area, Is.EqualTo(land.Area)); | ||
129 | Assert.That(ld.AuctionID, Is.EqualTo(land.AuctionID)); | ||
130 | Assert.That(ld.AuthBuyerID, Is.EqualTo(land.AuthBuyerID)); | ||
131 | Assert.That(ld.Category, Is.EqualTo(land.Category)); | ||
132 | Assert.That(ld.ClaimDate, Is.EqualTo(land.ClaimDate)); | ||
133 | Assert.That(ld.ClaimPrice, Is.EqualTo(land.ClaimPrice)); | ||
134 | Assert.That(ld.GlobalID, Is.EqualTo(land.GlobalID), "Reified LandData.GlobalID != original LandData.GlobalID"); | ||
135 | Assert.That(ld.GroupID, Is.EqualTo(land.GroupID)); | ||
136 | Assert.That(ld.Description, Is.EqualTo(land.Description)); | ||
137 | Assert.That(ld.Flags, Is.EqualTo(land.Flags)); | ||
138 | Assert.That(ld.LandingType, Is.EqualTo(land.LandingType)); | ||
139 | Assert.That(ld.Name, Is.EqualTo(land.Name), "Reified LandData.Name != original LandData.Name"); | ||
140 | Assert.That(ld.Status, Is.EqualTo(land.Status)); | ||
141 | Assert.That(ld.LocalID, Is.EqualTo(land.LocalID)); | ||
142 | Assert.That(ld.MediaAutoScale, Is.EqualTo(land.MediaAutoScale)); | ||
143 | Assert.That(ld.MediaID, Is.EqualTo(land.MediaID)); | ||
144 | Assert.That(ld.MediaURL, Is.EqualTo(land.MediaURL)); | ||
145 | Assert.That(ld.OwnerID, Is.EqualTo(land.OwnerID)); | ||
127 | } | 146 | } |
128 | 147 | ||
129 | [Test] | 148 | [Test] |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index ba8aa9f..6255515 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -294,14 +294,13 @@ namespace OpenSim | |||
294 | "save oar [-h|--home=<url>] [--noassets] [--publish] [--perm=<permissions>] [<OAR path>]", | 294 | "save oar [-h|--home=<url>] [--noassets] [--publish] [--perm=<permissions>] [<OAR path>]", |
295 | "Save a region's data to an OAR archive.", | 295 | "Save a region's data to an OAR archive.", |
296 | // "-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine | 296 | // "-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine |
297 | "-h|--home=<url> adds the url of the profile service to the saved user information." + Environment.NewLine | 297 | "-h|--home=<url> adds the url of the profile service to the saved user information.\n" |
298 | + "--noassets stops assets being saved to the OAR." + Environment.NewLine | 298 | + "--noassets stops assets being saved to the OAR.\n" |
299 | + "--publish saves an OAR stripped of owner and last owner information." + Environment.NewLine | 299 | + "--publish saves an OAR stripped of owner and last owner information.\n" |
300 | + " on reload, the estate owner will be the owner of all objects" + Environment.NewLine | 300 | + " on reload, the estate owner will be the owner of all objects\n" |
301 | + " this is useful if you're making oars generally available that might be reloaded to the same grid from which you published" + Environment.NewLine | 301 | + " this is useful if you're making oars generally available that might be reloaded to the same grid from which you published\n" |
302 | + " this option is EXPERIMENTAL" + Environment.NewLine | 302 | + "--perm=<permissions> stops objects with insufficient permissions from being saved to the OAR.\n" |
303 | + "--perm=<permissions> stops objects with insufficient permissions from being saved to the OAR." + Environment.NewLine | 303 | + " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer\n" |
304 | + " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer" + Environment.NewLine | ||
305 | + "The OAR path must be a filesystem path." | 304 | + "The OAR path must be a filesystem path." |
306 | + " If this is not given then the oar is saved to region.oar in the current directory.", | 305 | + " If this is not given then the oar is saved to region.oar in the current directory.", |
307 | SaveOar); | 306 | SaveOar); |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index d397893..88c4d7f 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -126,9 +126,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
126 | IConfig sconfig = config.Configs["Startup"]; | 126 | IConfig sconfig = config.Configs["Startup"]; |
127 | if (sconfig != null) | 127 | if (sconfig != null) |
128 | { | 128 | { |
129 | m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); | ||
130 | m_levelUpload = sconfig.GetInt("LevelUpload", 0); | 129 | m_levelUpload = sconfig.GetInt("LevelUpload", 0); |
131 | } | 130 | } |
131 | |||
132 | IConfig appearanceConfig = config.Configs["Appearance"]; | ||
133 | if (appearanceConfig != null) | ||
134 | { | ||
135 | m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); | ||
136 | } | ||
132 | } | 137 | } |
133 | 138 | ||
134 | m_assetService = m_Scene.AssetService; | 139 | m_assetService = m_Scene.AssetService; |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index b3d61a8..6aac591 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs | |||
@@ -66,9 +66,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
66 | 66 | ||
67 | public void Initialise(IConfigSource source) | 67 | public void Initialise(IConfigSource source) |
68 | { | 68 | { |
69 | IConfig sconfig = source.Configs["Startup"]; | 69 | IConfig appearanceConfig = source.Configs["Appearance"]; |
70 | if (sconfig != null) | 70 | if (appearanceConfig != null) |
71 | m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); | 71 | m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); |
72 | } | 72 | } |
73 | 73 | ||
74 | public void AddRegion(Scene s) | 74 | public void AddRegion(Scene s) |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 89cc4f6..bd7bd82 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -66,11 +66,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
66 | scene.RegisterModuleInterface<IAvatarFactoryModule>(this); | 66 | scene.RegisterModuleInterface<IAvatarFactoryModule>(this); |
67 | scene.EventManager.OnNewClient += SubscribeToClientEvents; | 67 | scene.EventManager.OnNewClient += SubscribeToClientEvents; |
68 | 68 | ||
69 | IConfig sconfig = config.Configs["Startup"]; | 69 | IConfig appearanceConfig = config.Configs["Appearance"]; |
70 | if (sconfig != null) | 70 | if (appearanceConfig != null) |
71 | { | 71 | { |
72 | m_savetime = Convert.ToInt32(sconfig.GetString("DelayBeforeAppearanceSave",Convert.ToString(m_savetime))); | 72 | m_savetime = Convert.ToInt32(appearanceConfig.GetString("DelayBeforeAppearanceSave",Convert.ToString(m_savetime))); |
73 | m_sendtime = Convert.ToInt32(sconfig.GetString("DelayBeforeAppearanceSend",Convert.ToString(m_sendtime))); | 73 | m_sendtime = Convert.ToInt32(appearanceConfig.GetString("DelayBeforeAppearanceSend",Convert.ToString(m_sendtime))); |
74 | // m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime); | 74 | // m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime); |
75 | } | 75 | } |
76 | 76 | ||
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index d039111..ca320e1 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -596,9 +596,14 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
596 | } | 596 | } |
597 | break; | 597 | break; |
598 | case "R": | 598 | case "R": |
599 | Font newFont = new Font(myFont, FontStyle.Regular); | 599 | // We need to place this newFont inside its own context so that the .NET compiler |
600 | myFont.Dispose(); | 600 | // doesn't complain about a redefinition of an existing newFont, even though there is none |
601 | myFont = newFont; | 601 | // The mono compiler doesn't produce this error. |
602 | { | ||
603 | Font newFont = new Font(myFont, FontStyle.Regular); | ||
604 | myFont.Dispose(); | ||
605 | myFont = newFont; | ||
606 | } | ||
602 | break; | 607 | break; |
603 | } | 608 | } |
604 | } | 609 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs index c179a34..0780d86 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs | |||
@@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
124 | LandData landData = lo.LandData; | 124 | LandData landData = lo.LandData; |
125 | string landDataPath = String.Format("{0}{1}.xml", ArchiveConstants.LANDDATA_PATH, | 125 | string landDataPath = String.Format("{0}{1}.xml", ArchiveConstants.LANDDATA_PATH, |
126 | landData.GlobalID.ToString()); | 126 | landData.GlobalID.ToString()); |
127 | m_archiveWriter.WriteFile(landDataPath, LandDataSerializer.Serialize(landData)); | 127 | m_archiveWriter.WriteFile(landDataPath, LandDataSerializer.Serialize(landData, m_options)); |
128 | } | 128 | } |
129 | 129 | ||
130 | m_log.InfoFormat("[ARCHIVER]: Adding terrain information to archive."); | 130 | m_log.InfoFormat("[ARCHIVER]: Adding terrain information to archive."); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 3a28d42..a8594e4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -842,7 +842,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
842 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | 842 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); |
843 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | 843 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); |
844 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); | 844 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); |
845 | SendPeriodicAppearanceUpdates = startupConfig.GetBoolean("SendPeriodicAppearanceUpdates", SendPeriodicAppearanceUpdates); | ||
846 | } | 845 | } |
847 | } | 846 | } |
848 | catch (Exception e) | 847 | catch (Exception e) |
@@ -850,6 +849,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
850 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); | 849 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); |
851 | } | 850 | } |
852 | 851 | ||
852 | // FIXME: Ultimately this should be in a module. | ||
853 | IConfig appearanceConfig = m_config.Configs["Appearance"]; | ||
854 | if (appearanceConfig != null) | ||
855 | { | ||
856 | SendPeriodicAppearanceUpdates | ||
857 | = appearanceConfig.GetBoolean("ResendAppearanceUpdates", SendPeriodicAppearanceUpdates); | ||
858 | } | ||
859 | |||
853 | #endregion Region Config | 860 | #endregion Region Config |
854 | 861 | ||
855 | #region Interest Management | 862 | #region Interest Management |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index d51281d..d837adb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -951,7 +951,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
951 | /// its existing localID and UUID. | 951 | /// its existing localID and UUID. |
952 | /// </summary> | 952 | /// </summary> |
953 | /// <param name='part'>Root part for this scene object.</param> | 953 | /// <param name='part'>Root part for this scene object.</param> |
954 | public SceneObjectGroup(SceneObjectPart part) | 954 | public SceneObjectGroup(SceneObjectPart part) : this() |
955 | { | 955 | { |
956 | SetRootPart(part); | 956 | SetRootPart(part); |
957 | } | 957 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 09e1f0c..494f5a6 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -40,6 +40,7 @@ public class BSCharacter : PhysicsActor | |||
40 | private static readonly string LogHeader = "[BULLETS CHAR]"; | 40 | private static readonly string LogHeader = "[BULLETS CHAR]"; |
41 | 41 | ||
42 | private BSScene _scene; | 42 | private BSScene _scene; |
43 | public BSScene Scene { get { return _scene; } } | ||
43 | private String _avName; | 44 | private String _avName; |
44 | // private bool _stopped; | 45 | // private bool _stopped; |
45 | private Vector3 _size; | 46 | private Vector3 _size; |
@@ -73,6 +74,12 @@ public class BSCharacter : PhysicsActor | |||
73 | private bool _kinematic; | 74 | private bool _kinematic; |
74 | private float _buoyancy; | 75 | private float _buoyancy; |
75 | 76 | ||
77 | private BulletBody m_body; | ||
78 | public BulletBody Body { | ||
79 | get { return m_body; } | ||
80 | set { m_body = value; } | ||
81 | } | ||
82 | |||
76 | private int _subscribedEventsMs = 0; | 83 | private int _subscribedEventsMs = 0; |
77 | private int _nextCollisionOkTime = 0; | 84 | private int _nextCollisionOkTime = 0; |
78 | 85 | ||
@@ -116,6 +123,10 @@ public class BSCharacter : PhysicsActor | |||
116 | _scene.TaintedObject(delegate() | 123 | _scene.TaintedObject(delegate() |
117 | { | 124 | { |
118 | BulletSimAPI.CreateObject(parent_scene.WorldID, shapeData); | 125 | BulletSimAPI.CreateObject(parent_scene.WorldID, shapeData); |
126 | |||
127 | m_body = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID)); | ||
128 | // avatars get all collisions no matter what | ||
129 | BulletSimAPI.AddToCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | ||
119 | }); | 130 | }); |
120 | 131 | ||
121 | return; | 132 | return; |
@@ -124,6 +135,7 @@ public class BSCharacter : PhysicsActor | |||
124 | // called when this character is being destroyed and the resources should be released | 135 | // called when this character is being destroyed and the resources should be released |
125 | public void Destroy() | 136 | public void Destroy() |
126 | { | 137 | { |
138 | // DetailLog("{0},Destroy", LocalID); | ||
127 | _scene.TaintedObject(delegate() | 139 | _scene.TaintedObject(delegate() |
128 | { | 140 | { |
129 | BulletSimAPI.DestroyObject(_scene.WorldID, _localID); | 141 | BulletSimAPI.DestroyObject(_scene.WorldID, _localID); |
@@ -174,6 +186,7 @@ public class BSCharacter : PhysicsActor | |||
174 | _position = value; | 186 | _position = value; |
175 | _scene.TaintedObject(delegate() | 187 | _scene.TaintedObject(delegate() |
176 | { | 188 | { |
189 | DetailLog("{0},SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); | ||
177 | BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); | 190 | BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); |
178 | }); | 191 | }); |
179 | } | 192 | } |
@@ -188,9 +201,10 @@ public class BSCharacter : PhysicsActor | |||
188 | set { | 201 | set { |
189 | _force = value; | 202 | _force = value; |
190 | // m_log.DebugFormat("{0}: Force = {1}", LogHeader, _force); | 203 | // m_log.DebugFormat("{0}: Force = {1}", LogHeader, _force); |
191 | _scene.TaintedObject(delegate() | 204 | Scene.TaintedObject(delegate() |
192 | { | 205 | { |
193 | BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force); | 206 | DetailLog("{0},setForce,taint,force={1}", LocalID, _force); |
207 | BulletSimAPI.SetObjectForce(Scene.WorldID, LocalID, _force); | ||
194 | }); | 208 | }); |
195 | } | 209 | } |
196 | } | 210 | } |
@@ -216,6 +230,7 @@ public class BSCharacter : PhysicsActor | |||
216 | // m_log.DebugFormat("{0}: set velocity = {1}", LogHeader, _velocity); | 230 | // m_log.DebugFormat("{0}: set velocity = {1}", LogHeader, _velocity); |
217 | _scene.TaintedObject(delegate() | 231 | _scene.TaintedObject(delegate() |
218 | { | 232 | { |
233 | DetailLog("{0},setVelocity,taint,vel={1}", LocalID, _velocity); | ||
219 | BulletSimAPI.SetObjectVelocity(_scene.WorldID, _localID, _velocity); | 234 | BulletSimAPI.SetObjectVelocity(_scene.WorldID, _localID, _velocity); |
220 | }); | 235 | }); |
221 | } | 236 | } |
@@ -305,6 +320,7 @@ public class BSCharacter : PhysicsActor | |||
305 | set { _buoyancy = value; | 320 | set { _buoyancy = value; |
306 | _scene.TaintedObject(delegate() | 321 | _scene.TaintedObject(delegate() |
307 | { | 322 | { |
323 | DetailLog("{0},setBuoyancy,taint,buoy={1}", LocalID, _buoyancy); | ||
308 | BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, LocalID, _buoyancy); | 324 | BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, LocalID, _buoyancy); |
309 | }); | 325 | }); |
310 | } | 326 | } |
@@ -351,7 +367,8 @@ public class BSCharacter : PhysicsActor | |||
351 | // m_log.DebugFormat("{0}: AddForce. adding={1}, newForce={2}", LogHeader, force, _force); | 367 | // m_log.DebugFormat("{0}: AddForce. adding={1}, newForce={2}", LogHeader, force, _force); |
352 | _scene.TaintedObject(delegate() | 368 | _scene.TaintedObject(delegate() |
353 | { | 369 | { |
354 | BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force); | 370 | DetailLog("{0},setAddForce,taint,addedForce={1}", LocalID, _force); |
371 | BulletSimAPI.AddObjectForce2(Body.Ptr, _force); | ||
355 | }); | 372 | }); |
356 | } | 373 | } |
357 | else | 374 | else |
@@ -369,11 +386,25 @@ public class BSCharacter : PhysicsActor | |||
369 | // Turn on collision events at a rate no faster than one every the given milliseconds | 386 | // Turn on collision events at a rate no faster than one every the given milliseconds |
370 | public override void SubscribeEvents(int ms) { | 387 | public override void SubscribeEvents(int ms) { |
371 | _subscribedEventsMs = ms; | 388 | _subscribedEventsMs = ms; |
372 | _nextCollisionOkTime = Util.EnvironmentTickCount() - _subscribedEventsMs; // make first collision happen | 389 | if (ms > 0) |
390 | { | ||
391 | // make sure first collision happens | ||
392 | _nextCollisionOkTime = Util.EnvironmentTickCount() - _subscribedEventsMs; | ||
393 | |||
394 | Scene.TaintedObject(delegate() | ||
395 | { | ||
396 | BulletSimAPI.AddToCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | ||
397 | }); | ||
398 | } | ||
373 | } | 399 | } |
374 | // Stop collision events | 400 | // Stop collision events |
375 | public override void UnSubscribeEvents() { | 401 | public override void UnSubscribeEvents() { |
376 | _subscribedEventsMs = 0; | 402 | _subscribedEventsMs = 0; |
403 | // Avatars get all their collision events | ||
404 | // Scene.TaintedObject(delegate() | ||
405 | // { | ||
406 | // BulletSimAPI.RemoveFromCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | ||
407 | // }); | ||
377 | } | 408 | } |
378 | // Return 'true' if someone has subscribed to events | 409 | // Return 'true' if someone has subscribed to events |
379 | public override bool SubscribedEvents() { | 410 | public override bool SubscribedEvents() { |
@@ -480,5 +511,10 @@ public class BSCharacter : PhysicsActor | |||
480 | // End kludge | 511 | // End kludge |
481 | } | 512 | } |
482 | 513 | ||
514 | // Invoke the detailed logger and output something if it's enabled. | ||
515 | private void DetailLog(string msg, params Object[] args) | ||
516 | { | ||
517 | Scene.PhysicsLogging.Write(msg, args); | ||
518 | } | ||
483 | } | 519 | } |
484 | } | 520 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index ebfd85b..8e6685b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -187,7 +187,7 @@ public sealed class BSPrim : PhysicsActor | |||
187 | { | 187 | { |
188 | _mass = CalculateMass(); // changing size changes the mass | 188 | _mass = CalculateMass(); // changing size changes the mass |
189 | BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical); | 189 | BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical); |
190 | DetailLog("{0}: setSize: size={1}, mass={2}, physical={3}", LocalID, _size, _mass, IsPhysical); | 190 | // DetailLog("{0}: setSize: size={1}, mass={2}, physical={3}", LocalID, _size, _mass, IsPhysical); |
191 | RecreateGeomAndObject(); | 191 | RecreateGeomAndObject(); |
192 | }); | 192 | }); |
193 | } | 193 | } |
@@ -318,7 +318,7 @@ public sealed class BSPrim : PhysicsActor | |||
318 | _force = value; | 318 | _force = value; |
319 | _scene.TaintedObject(delegate() | 319 | _scene.TaintedObject(delegate() |
320 | { | 320 | { |
321 | DetailLog("{0},SetForce,taint,force={1}", LocalID, _force); | 321 | DetailLog("{0},setForce,taint,force={1}", LocalID, _force); |
322 | // BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force); | 322 | // BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force); |
323 | BulletSimAPI.SetObjectForce2(Body.Ptr, _force); | 323 | BulletSimAPI.SetObjectForce2(Body.Ptr, _force); |
324 | }); | 324 | }); |
@@ -443,7 +443,7 @@ public sealed class BSPrim : PhysicsActor | |||
443 | _scene.TaintedObject(delegate() | 443 | _scene.TaintedObject(delegate() |
444 | { | 444 | { |
445 | // _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID); | 445 | // _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID); |
446 | DetailLog("{0},SetOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 446 | DetailLog("{0},setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
447 | BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); | 447 | BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); |
448 | }); | 448 | }); |
449 | } | 449 | } |
@@ -487,10 +487,8 @@ public sealed class BSPrim : PhysicsActor | |||
487 | // Maybe a VerifyCorrectPhysicalShape() routine? | 487 | // Maybe a VerifyCorrectPhysicalShape() routine? |
488 | // RecreateGeomAndObject(); | 488 | // RecreateGeomAndObject(); |
489 | 489 | ||
490 | float mass = _mass; | 490 | // Bullet wants static objects to have a mass of zero |
491 | // Bullet wants static objects have a mass of zero | 491 | float mass = IsStatic ? 0f : _mass; |
492 | if (IsStatic) | ||
493 | mass = 0f; | ||
494 | 492 | ||
495 | DetailLog("{0},SetObjectDynamic,taint,static={1},solid={2},mass={3}", LocalID, IsStatic, IsSolid, mass); | 493 | DetailLog("{0},SetObjectDynamic,taint,static={1},solid={2},mass={3}", LocalID, IsStatic, IsSolid, mass); |
496 | BulletSimAPI.SetObjectProperties(_scene.WorldID, LocalID, IsStatic, IsSolid, SubscribedEvents(), mass); | 494 | BulletSimAPI.SetObjectProperties(_scene.WorldID, LocalID, IsStatic, IsSolid, SubscribedEvents(), mass); |
@@ -607,6 +605,7 @@ public sealed class BSPrim : PhysicsActor | |||
607 | 605 | ||
608 | private List<OMV.Vector3> m_accumulatedForces = new List<OMV.Vector3>(); | 606 | private List<OMV.Vector3> m_accumulatedForces = new List<OMV.Vector3>(); |
609 | public override void AddForce(OMV.Vector3 force, bool pushforce) { | 607 | public override void AddForce(OMV.Vector3 force, bool pushforce) { |
608 | // for an object, doesn't matter if force is a pushforce or not | ||
610 | if (force.IsFinite()) | 609 | if (force.IsFinite()) |
611 | { | 610 | { |
612 | // _force += force; | 611 | // _force += force; |
@@ -620,21 +619,17 @@ public sealed class BSPrim : PhysicsActor | |||
620 | } | 619 | } |
621 | _scene.TaintedObject(delegate() | 620 | _scene.TaintedObject(delegate() |
622 | { | 621 | { |
622 | OMV.Vector3 fSum = OMV.Vector3.Zero; | ||
623 | lock (m_accumulatedForces) | 623 | lock (m_accumulatedForces) |
624 | { | 624 | { |
625 | if (m_accumulatedForces.Count > 0) | 625 | foreach (OMV.Vector3 v in m_accumulatedForces) |
626 | { | 626 | { |
627 | OMV.Vector3 fSum = OMV.Vector3.Zero; | 627 | fSum += v; |
628 | foreach (OMV.Vector3 v in m_accumulatedForces) | ||
629 | { | ||
630 | fSum += v; | ||
631 | } | ||
632 | m_accumulatedForces.Clear(); | ||
633 | |||
634 | DetailLog("{0},SetObjectForce,taint,force={1}", LocalID, fSum); | ||
635 | BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, fSum); | ||
636 | } | 628 | } |
629 | m_accumulatedForces.Clear(); | ||
637 | } | 630 | } |
631 | DetailLog("{0},AddObjectForce,taint,force={1}", LocalID, _force); | ||
632 | BulletSimAPI.AddObjectForce2(Body.Ptr, fSum); | ||
638 | }); | 633 | }); |
639 | } | 634 | } |
640 | 635 | ||
@@ -647,11 +642,23 @@ public sealed class BSPrim : PhysicsActor | |||
647 | } | 642 | } |
648 | public override void SubscribeEvents(int ms) { | 643 | public override void SubscribeEvents(int ms) { |
649 | _subscribedEventsMs = ms; | 644 | _subscribedEventsMs = ms; |
650 | // make sure first collision happens | 645 | if (ms > 0) |
651 | _nextCollisionOkTime = Util.EnvironmentTickCount() - _subscribedEventsMs; | 646 | { |
647 | // make sure first collision happens | ||
648 | _nextCollisionOkTime = Util.EnvironmentTickCount() - _subscribedEventsMs; | ||
649 | |||
650 | Scene.TaintedObject(delegate() | ||
651 | { | ||
652 | BulletSimAPI.AddToCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | ||
653 | }); | ||
654 | } | ||
652 | } | 655 | } |
653 | public override void UnSubscribeEvents() { | 656 | public override void UnSubscribeEvents() { |
654 | _subscribedEventsMs = 0; | 657 | _subscribedEventsMs = 0; |
658 | Scene.TaintedObject(delegate() | ||
659 | { | ||
660 | BulletSimAPI.RemoveFromCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | ||
661 | }); | ||
655 | } | 662 | } |
656 | public override bool SubscribedEvents() { | 663 | public override bool SubscribedEvents() { |
657 | return (_subscribedEventsMs > 0); | 664 | return (_subscribedEventsMs > 0); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index 0ffbc94..4e05df6 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | |||
@@ -179,17 +179,18 @@ public struct ConfigurationParameters | |||
179 | // Values used by Bullet and BulletSim to control collisions | 179 | // Values used by Bullet and BulletSim to control collisions |
180 | public enum CollisionFlags : uint | 180 | public enum CollisionFlags : uint |
181 | { | 181 | { |
182 | STATIC_OBJECT = 1 << 0, | 182 | CF_STATIC_OBJECT = 1 << 0, |
183 | KINEMATIC_OBJECT = 1 << 1, | 183 | CF_KINEMATIC_OBJECT = 1 << 1, |
184 | NO_CONTACT_RESPONSE = 1 << 2, | 184 | CF_NO_CONTACT_RESPONSE = 1 << 2, |
185 | CUSTOM_MATERIAL_CALLBACK = 1 << 3, | 185 | CF_CUSTOM_MATERIAL_CALLBACK = 1 << 3, |
186 | CHARACTER_OBJECT = 1 << 4, | 186 | CF_CHARACTER_OBJECT = 1 << 4, |
187 | DISABLE_VISUALIZE_OBJECT = 1 << 5, | 187 | CF_DISABLE_VISUALIZE_OBJECT = 1 << 5, |
188 | DISABLE_SPU_COLLISION_PROCESS = 1 << 6, | 188 | CF_DISABLE_SPU_COLLISION_PROCESS = 1 << 6, |
189 | // Following used by BulletSim to control collisions | 189 | // Following used by BulletSim to control collisions |
190 | VOLUME_DETECT_OBJECT = 1 << 10, | 190 | BS_SUBSCRIBE_COLLISION_EVENTS = 1 << 10, |
191 | PHANTOM_OBJECT = 1 << 11, | 191 | BS_VOLUME_DETECT_OBJECT = 1 << 11, |
192 | PHYSICAL_OBJECT = 1 << 12, | 192 | BS_PHANTOM_OBJECT = 1 << 12, |
193 | BS_PHYSICAL_OBJECT = 1 << 13, | ||
193 | }; | 194 | }; |
194 | 195 | ||
195 | // CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 | 196 | // CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 |
@@ -448,6 +449,9 @@ public static extern bool SetAngularVelocity2(IntPtr obj, Vector3 angularVelocit | |||
448 | public static extern bool SetObjectForce2(IntPtr obj, Vector3 force); | 449 | public static extern bool SetObjectForce2(IntPtr obj, Vector3 force); |
449 | 450 | ||
450 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 451 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
452 | public static extern bool AddObjectForce2(IntPtr obj, Vector3 force); | ||
453 | |||
454 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
451 | public static extern bool SetCcdMotionThreshold2(IntPtr obj, float val); | 455 | public static extern bool SetCcdMotionThreshold2(IntPtr obj, float val); |
452 | 456 | ||
453 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 457 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
@@ -478,13 +482,13 @@ public static extern bool SetLinearVelocity2(IntPtr obj, Vector3 val); | |||
478 | public static extern bool SetInterpolation2(IntPtr obj, Vector3 lin, Vector3 ang); | 482 | public static extern bool SetInterpolation2(IntPtr obj, Vector3 lin, Vector3 ang); |
479 | 483 | ||
480 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 484 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
481 | public static extern IntPtr SetCollisionFlags2(IntPtr obj, uint flags); | 485 | public static extern IntPtr SetCollisionFlags2(IntPtr obj, CollisionFlags flags); |
482 | 486 | ||
483 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 487 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
484 | public static extern IntPtr AddToCollisionFlags2(IntPtr obj, uint flags); | 488 | public static extern IntPtr AddToCollisionFlags2(IntPtr obj, CollisionFlags flags); |
485 | 489 | ||
486 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 490 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
487 | public static extern IntPtr RemoveFromCollisionFlags2(IntPtr obj, uint flags); | 491 | public static extern IntPtr RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags); |
488 | 492 | ||
489 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 493 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
490 | public static extern bool SetMassProps2(IntPtr obj, float mass, Vector3 inertia); | 494 | public static extern bool SetMassProps2(IntPtr obj, float mass, Vector3 inertia); |