Pack() публичный Метод

public Pack ( ) : OSD
Результат OSD
Пример #1
0
        /// <summary>
        /// Create an OSDMap from the appearance data
        /// </summary>
        public OSDMap Pack(EntityTransferContext ctx)
        {
            OSDMap data = new OSDMap();

            data["serial"] = OSD.FromInteger(m_serial);
            data["height"] = OSD.FromReal(m_avatarHeight);

            // Wearables
            //
            // This will send as many or as few wearables as we have, unless a count
            // is given. Used for legacy (pre 0.4) versions.
            int count = ctx.WearablesCount;
            if (ctx.WearablesCount == -1)
                count = m_wearables.Length;
            OSDArray wears = new OSDArray(count);
            for (int i = 0; i < count; i++)
            {
                AvatarWearable dummyWearable = new AvatarWearable();

                if (i < m_wearables.Length)
                    wears.Add(m_wearables[i].Pack());
                else
                    wears.Add(dummyWearable.Pack());
            }
            data["wearables"] = wears;

            // Avatar Textures
            OSDArray textures = new OSDArray(AvatarAppearance.TEXTURE_COUNT);
            for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
            {
                if (m_texture.FaceTextures[i] != null)
                    textures.Add(OSD.FromUUID(m_texture.FaceTextures[i].TextureID));
                else
                    textures.Add(OSD.FromUUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE));
            }
            data["textures"] = textures;

            if (m_cacheitems != null)
            {
                OSDArray baked = WearableCacheItem.BakedToOSD(m_cacheitems);
                if (baked != null)
                    data["bakedcache"] = baked;
            }

            // Visual Parameters
            OSDBinary visualparams = new OSDBinary(m_visualparams);
            data["visualparams"] = visualparams;

            lock (m_attachments)
            {
                // Attachments
                OSDArray attachs = new OSDArray(m_attachments.Count);
                foreach (AvatarAttachment attach in GetAttachments())
                    attachs.Add(attach.Pack());
                data["attachments"] = attachs;
            }

            return data;
        }
Пример #2
0
        public void CacheWearableData(UUID principalID, AvatarWearable cachedWearable)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();
            //sendData["SCOPEID"] = scopeID.ToString();
            sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
            sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
            sendData["METHOD"] = "cachewearabledata";

            sendData["WEARABLES"] = OSDParser.SerializeJsonString(cachedWearable.Pack());

            string reqString = WebUtils.BuildQueryString(sendData);
            // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
            try
            {
                List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("AvatarServerURI");
                foreach (string m_ServerURI in serverURIs)
                {
                    AsynchronousRestObjectRequester.MakeRequest("POST",
                            m_ServerURI,
                            reqString);
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AVATAR CONNECTOR]: Exception when contacting avatar server: {0}", e.Message);
            }
        }