From 9301e36fbc545b0bbdb14e1651e1ff1f4ca7c04f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 1 Jul 2010 00:47:12 +0100
Subject: have a stab at sending the correct number of media entries to shapes

actually, this is probably wrong anyway if there's a default texture
it's going to be easier just to gather the object media updates and retain those in-memory now
but what the hell
---
 .../Region/CoreModules/World/Media/Moap/MoapModule.cs    | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

(limited to 'OpenSim')

diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index b6fa53f..30507a4 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -128,8 +128,20 @@ namespace OpenSim.Region.CoreModules.Media.Moap
         protected string HandleObjectMediaRequestGet(
             string path, Hashtable osdParams, OSHttpRequest httpRequest, OSHttpResponse httpResponse)        
         {
-            // Yeah, only for cubes right now.  I know it's dumb.
-            int faces = 6;
+            UUID primId = (UUID)osdParams["object_id"];
+            
+            SceneObjectPart part = m_scene.GetSceneObjectPart(primId);
+            
+            if (null == part)
+            {
+                m_log.WarnFormat(
+                    "[MOAP]: Received a GET ObjectMediaRequest for prim {0} but this doesn't exist in the scene", 
+                    primId);
+                return string.Empty;
+            }
+                        
+            int faces = part.GetNumberOfSides();
+            m_log.DebugFormat("[MOAP]: Faces [{0}] for [{1}]", faces, primId);
             
             MediaEntry[] media = new MediaEntry[faces];
             for (int i = 0; i < faces; i++)
-- 
cgit v1.1