diff options
author | Justin Clark-Casey (justincc) | 2010-07-12 19:46:23 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-07-26 23:34:19 +0100 |
commit | a5ad792e6c90eb9412325e636c6e4eafc4a8a91d (patch) | |
tree | f1acb8a3b4bcd249d4d913e5ea15f5ba45d234de /OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | |
parent | Implement llGetPrimMediaParams() (diff) | |
download | opensim-SC_OLD-a5ad792e6c90eb9412325e636c6e4eafc4a8a91d.zip opensim-SC_OLD-a5ad792e6c90eb9412325e636c6e4eafc4a8a91d.tar.gz opensim-SC_OLD-a5ad792e6c90eb9412325e636c6e4eafc4a8a91d.tar.bz2 opensim-SC_OLD-a5ad792e6c90eb9412325e636c6e4eafc4a8a91d.tar.xz |
implement llSetPrimMediaParams()
Untested
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 9f74367..064047d 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | |||
@@ -102,16 +102,54 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
102 | public MediaEntry GetMediaEntry(SceneObjectPart part, int face) | 102 | public MediaEntry GetMediaEntry(SceneObjectPart part, int face) |
103 | { | 103 | { |
104 | if (face < 0) | 104 | if (face < 0) |
105 | throw new ArgumentException("Face cannot be less than zero"); | 105 | throw new ArgumentException("Face cannot be less than zero"); |
106 | |||
107 | int maxFaces = part.GetNumberOfSides() - 1; | ||
108 | if (face > maxFaces) | ||
109 | throw new ArgumentException( | ||
110 | string.Format("Face argument was {0} but max is {1}", face, maxFaces)); | ||
106 | 111 | ||
107 | List<MediaEntry> media = part.Shape.Media; | 112 | List<MediaEntry> media = part.Shape.Media; |
108 | 113 | ||
109 | if (face > media.Count - 1) | 114 | if (null == media) |
115 | { | ||
116 | return null; | ||
117 | } | ||
118 | else | ||
119 | { | ||
120 | // TODO: Really need a proper copy constructor down in libopenmetaverse | ||
121 | return MediaEntry.FromOSD(media[face].GetOSD()); | ||
122 | } | ||
123 | } | ||
124 | |||
125 | public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me) | ||
126 | { | ||
127 | if (face < 0) | ||
128 | throw new ArgumentException("Face cannot be less than zero"); | ||
129 | |||
130 | int maxFaces = part.GetNumberOfSides() - 1; | ||
131 | if (face > maxFaces) | ||
110 | throw new ArgumentException( | 132 | throw new ArgumentException( |
111 | string.Format("Face argument was {0} but max is {1}", face, media.Count - 1)); | 133 | string.Format("Face argument was {0} but max is {1}", face, maxFaces)); |
112 | 134 | ||
113 | // TODO: Really need a proper copy constructor down in libopenmetaverse | 135 | if (null == part.Shape.Media) |
114 | return MediaEntry.FromOSD(media[face].GetOSD()); | 136 | part.Shape.Media = new List<MediaEntry>(maxFaces); |
137 | |||
138 | part.Shape.Media[face] = me; | ||
139 | |||
140 | if (null == part.MediaUrl) | ||
141 | { | ||
142 | // TODO: We can't set the last changer until we start tracking which cap we give to which agent id | ||
143 | part.MediaUrl = "x-mv:0000000000/" + UUID.Zero; | ||
144 | } | ||
145 | else | ||
146 | { | ||
147 | string rawVersion = part.MediaUrl.Substring(5, 10); | ||
148 | int version = int.Parse(rawVersion); | ||
149 | part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, UUID.Zero); | ||
150 | } | ||
151 | |||
152 | part.ScheduleFullUpdate(); | ||
115 | } | 153 | } |
116 | 154 | ||
117 | /// <summary> | 155 | /// <summary> |
@@ -140,7 +178,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
140 | throw new Exception( | 178 | throw new Exception( |
141 | string.Format( | 179 | string.Format( |
142 | "[MOAP]: ObjectMediaMessage has unrecognized ObjectMediaBlock of {0}", | 180 | "[MOAP]: ObjectMediaMessage has unrecognized ObjectMediaBlock of {0}", |
143 | omm.Request.GetType())); | 181 | omm.Request.GetType())); |
144 | } | 182 | } |
145 | 183 | ||
146 | /// <summary> | 184 | /// <summary> |
@@ -233,7 +271,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
233 | 271 | ||
234 | m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID); | 272 | m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID); |
235 | 273 | ||
236 | // Arguably we don't need to send a full update to the avatar that just changed the texture. | 274 | // Arguably, we could avoid sending a full update to the avatar that just changed the texture. |
237 | part.ScheduleFullUpdate(); | 275 | part.ScheduleFullUpdate(); |
238 | 276 | ||
239 | return string.Empty; | 277 | return string.Empty; |