Annotation of /branches/taiga-0.1/ModularRex/RexParts/AddUrlsToROP.cs
Parent Directory
|
Revision Log
Revision 347 -
(view)
(download)
Original Path: branches/os-0.6.9-post-fixes/ModularRex/RexParts/AddUrlsToROP.cs
| 1 : | mikkopa | 347 | using System; |
| 2 : | using System.Collections.Generic; | ||
| 3 : | using System.Text; | ||
| 4 : | using OpenSim.Region.Framework.Interfaces; | ||
| 5 : | using OpenSim.Region.Framework.Scenes; | ||
| 6 : | using ModularRex.RexFramework; | ||
| 7 : | using OpenMetaverse; | ||
| 8 : | |||
| 9 : | namespace ModularRex.RexParts | ||
| 10 : | { | ||
| 11 : | public class AddUrlsToROP : IRegionModule | ||
| 12 : | { | ||
| 13 : | private Scene m_scene; | ||
| 14 : | private IModrexObjectsProvider m_modrexObjects; | ||
| 15 : | private string m_httpbaseurl = String.Empty; | ||
| 16 : | |||
| 17 : | #region IRegionModule Members | ||
| 18 : | |||
| 19 : | public void Close() | ||
| 20 : | { | ||
| 21 : | } | ||
| 22 : | |||
| 23 : | public void Initialise(Scene scene, Nini.Config.IConfigSource source) | ||
| 24 : | { | ||
| 25 : | m_scene = scene; | ||
| 26 : | m_scene.AddCommand(this, "addurls", "addurls", "Adds urls to all Rex Object Properties. The url is for this simulator. This removes all existing urls.", HandleAddUrls); | ||
| 27 : | m_httpbaseurl = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort + "/assets/"; | ||
| 28 : | } | ||
| 29 : | |||
| 30 : | public bool IsSharedModule | ||
| 31 : | { | ||
| 32 : | get { return false; } | ||
| 33 : | } | ||
| 34 : | |||
| 35 : | public string Name | ||
| 36 : | { | ||
| 37 : | get { return "AddUrlsToROP module"; } | ||
| 38 : | } | ||
| 39 : | |||
| 40 : | public void PostInitialise() | ||
| 41 : | { | ||
| 42 : | m_modrexObjects = m_scene.RequestModuleInterface<IModrexObjectsProvider>(); | ||
| 43 : | } | ||
| 44 : | |||
| 45 : | #endregion | ||
| 46 : | |||
| 47 : | private void HandleAddUrls(string module, string[] cmd) | ||
| 48 : | { | ||
| 49 : | foreach (EntityBase ent in m_scene.Entities) | ||
| 50 : | { | ||
| 51 : | if (ent is SceneObjectGroup) | ||
| 52 : | { | ||
| 53 : | foreach (SceneObjectPart part in ((SceneObjectGroup)ent).GetParts()) | ||
| 54 : | { | ||
| 55 : | AddUrlsToRexObject(part.UUID); | ||
| 56 : | } | ||
| 57 : | } | ||
| 58 : | } | ||
| 59 : | } | ||
| 60 : | |||
| 61 : | private void AddUrlsToRexObject(UUID rexObjectId) | ||
| 62 : | { | ||
| 63 : | RexObjectProperties rop = m_modrexObjects.GetObject(rexObjectId); | ||
| 64 : | if (rop.RexAnimationPackageUUID != UUID.Zero) | ||
| 65 : | { | ||
| 66 : | rop.RexAnimationPackageURI = m_httpbaseurl + rop.RexAnimationPackageUUID.ToString() + "/data"; | ||
| 67 : | } | ||
| 68 : | |||
| 69 : | if (rop.RexCollisionMeshUUID != UUID.Zero) | ||
| 70 : | { | ||
| 71 : | rop.RexCollisionMeshURI = m_httpbaseurl + rop.RexCollisionMeshUUID.ToString() + "/data"; | ||
| 72 : | } | ||
| 73 : | |||
| 74 : | if (rop.RexMeshUUID != UUID.Zero) | ||
| 75 : | { | ||
| 76 : | rop.RexMeshURI = m_httpbaseurl + rop.RexMeshUUID.ToString() + "/data"; | ||
| 77 : | } | ||
| 78 : | |||
| 79 : | if (rop.RexParticleScriptUUID != UUID.Zero) | ||
| 80 : | { | ||
| 81 : | rop.RexParticleScriptURI = m_httpbaseurl + rop.RexParticleScriptUUID.ToString() + "/data"; | ||
| 82 : | } | ||
| 83 : | |||
| 84 : | if (rop.RexSoundUUID != UUID.Zero) | ||
| 85 : | { | ||
| 86 : | rop.RexSoundURI = m_httpbaseurl + rop.RexSoundUUID.ToString() + "/data"; | ||
| 87 : | } | ||
| 88 : | |||
| 89 : | foreach (KeyValuePair<uint, RexMaterialsDictionaryItem> item in rop.GetRexMaterials()) | ||
| 90 : | { | ||
| 91 : | string materialUrl = m_httpbaseurl + item.Value.AssetID + "/data"; | ||
| 92 : | rop.RexMaterials.AddMaterial(item.Key, item.Value.AssetID, materialUrl); | ||
| 93 : | |||
| 94 : | } | ||
| 95 : | } | ||
| 96 : | } | ||
| 97 : | } |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

