From 53386b6f1f6fe02f3b6e544ce5d50bdf2cc6e7ec Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 23 Dec 2009 23:09:41 +0000 Subject: Add saving assets from gestures to IAR --- OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 42 ++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 930af81..7e3c192 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -91,6 +91,10 @@ namespace OpenSim.Region.Framework.Scenes { GetWearableAssetUuids(assetUuid, assetUuids); } + else if (AssetType.Gesture == assetType) + { + GetGestureAssetUuids(assetUuid, assetUuids); + } else if (AssetType.LSLText == assetType) { GetScriptAssetUuids(assetUuid, assetUuids); @@ -278,5 +282,41 @@ namespace OpenSim.Region.Framework.Scenes GatherAssetUuids(sog, assetUuids); } } + + protected void GetGestureAssetUuids(UUID gestureUuid, IDictionary assetUuids) + { + AssetBase assetBase = GetAsset(gestureUuid); + + MemoryStream ms = new MemoryStream(assetBase.Data); + StreamReader sr = new StreamReader(ms); + + sr.ReadLine(); // Unknown (Version?) + sr.ReadLine(); // Unknown + sr.ReadLine(); // Unknown + sr.ReadLine(); // Name + sr.ReadLine(); // Comment ? + int count = Convert.ToInt32(sr.ReadLine()); // Item count + + for (int i = 0 ; i < count ; i++) + { + string type = sr.ReadLine(); + if (type == null) + break; + string name = sr.ReadLine(); + if (name == null) + break; + string id = sr.ReadLine(); + if (id == null) + break; + string unknown = sr.ReadLine(); + if (unknown == null) + break; + + // If it can be parsed as a UUID, it is an asset ID + UUID uuid; + if (UUID.Parse(id, out uuid)) + assetUuids[uuid] = 1; + } + } } -} \ No newline at end of file +} -- cgit v1.1 From 908992a105280780cbdc8955ee1926e535176875 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 23 Dec 2009 17:10:37 -0800 Subject: Fixes the broken build of the previous commit. --- OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 7e3c192..3edb677 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; +using System.IO; using System.Reflection; using System.Text.RegularExpressions; using System.Threading; @@ -314,7 +315,7 @@ namespace OpenSim.Region.Framework.Scenes // If it can be parsed as a UUID, it is an asset ID UUID uuid; - if (UUID.Parse(id, out uuid)) + if (UUID.TryParse(id, out uuid)) assetUuids[uuid] = 1; } } -- cgit v1.1 From e7439efc74a1cc0daedc51eb25ae66cd03db70b5 Mon Sep 17 00:00:00 2001 From: Kitto Flora Date: Thu, 24 Dec 2009 19:19:44 -0500 Subject: Recover out-of-region objects during db load. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index b0fb8b3..998d598 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -222,6 +222,30 @@ namespace OpenSim.Region.Framework.Scenes protected internal bool AddRestoredSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) { + // KF: Check for out-of-region, move inside and make static. + Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X, + sceneObject.RootPart.GroupPosition.Y, + sceneObject.RootPart.GroupPosition.Z); + if (npos.X < 0.0 || npos.Y < 0.0 || npos.Z < 0.0 || + npos.X > Constants.RegionSize || + npos.Y > Constants.RegionSize) + { + if (npos.X < 0.0) npos.X = 1.0f; + if (npos.Y < 0.0) npos.Y = 1.0f; + if (npos.Z < 0.0) npos.Z = 0.0f; + if (npos.X > Constants.RegionSize) npos.X = Constants.RegionSize - 1.0f; + if (npos.Y > Constants.RegionSize) npos.Y = Constants.RegionSize - 1.0f; + + foreach (SceneObjectPart part in sceneObject.Children.Values) + { + part.GroupPosition = npos; + } + sceneObject.RootPart.Velocity = Vector3.Zero; + sceneObject.RootPart.AngularVelocity = Vector3.Zero; + sceneObject.RootPart.Acceleration = Vector3.Zero; + sceneObject.RootPart.Velocity = Vector3.Zero; + } + if (!alreadyPersisted) { sceneObject.ForceInventoryPersistence(); -- cgit v1.1