SimChat() public method

public SimChat ( byte message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, UUID fromID, bool fromAgent ) : void
message byte
type ChatTypeEnum
channel int
fromPos Vector3
fromName string
fromID UUID
fromAgent bool
return void
Ejemplo n.º 1
0
            /// <summary>
            /// Called once new texture data has been received for this updater.
            /// </summary>
            public void DataReceived(byte[] data, Scene scene)
            {
                SceneObjectPart part = scene.GetSceneObjectPart(PrimID);

                if (part == null || data == null || data.Length <= 1)
                {
                    string msg = 
                        String.Format("DynamicTextureModule: Error preparing image using URL {0}", Url);
                    scene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Say,
                                  0, part.ParentGroup.RootPart.AbsolutePosition, part.Name, part.UUID, false);
                    return;
                }

                byte[] assetData = null;
                AssetBase oldAsset = null;
                
                if (BlendWithOldTexture)
                {
                    Primitive.TextureEntryFace defaultFace = part.Shape.Textures.DefaultTexture;
                    if (defaultFace != null)
                    {
                        oldAsset = scene.AssetService.Get(defaultFace.TextureID.ToString());

                        if (oldAsset != null)
                            assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha);
                    }
                }

                if (assetData == null)
                {
                    assetData = new byte[data.Length];
                    Array.Copy(data, assetData, data.Length);
                }

                // Create a new asset for user
                AssetBase asset
                    = new AssetBase(
                        UUID.Random(), "DynamicImage" + Util.RandomClass.Next(1, 10000), (sbyte)AssetType.Texture,
                        scene.RegionInfo.RegionID.ToString());
                asset.Data = assetData;
                asset.Description = String.Format("URL image : {0}", Url);
                asset.Local = false;
                asset.Temporary = ((Disp & DISP_TEMP) != 0);
                scene.AssetService.Store(asset);

                IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>();
                if (cacheLayerDecode != null)
                {
                    cacheLayerDecode.Decode(asset.FullID, asset.Data);
                    cacheLayerDecode = null;
                }

                UUID oldID = UUID.Zero;

                lock (part)
                {
                    // mostly keep the values from before
                    Primitive.TextureEntry tmptex = part.Shape.Textures;

                    // remove the old asset from the cache
                    oldID = tmptex.DefaultTexture.TextureID;
                    
                    if (Face == ALL_SIDES)
                    {
                        tmptex.DefaultTexture.TextureID = asset.FullID;
                    }
                    else
                    {
                        try
                        {
                            Primitive.TextureEntryFace texface = tmptex.CreateFace((uint)Face);
                            texface.TextureID = asset.FullID;
                            tmptex.FaceTextures[Face] = texface;
                        }
                        catch (Exception)
                        {
                            tmptex.DefaultTexture.TextureID = asset.FullID;
                        }
                    }

                    // I'm pretty sure we always want to force this to true
                    // I'm pretty sure noone whats to set fullbright true if it wasn't true before.
                    // tmptex.DefaultTexture.Fullbright = true;

                    part.UpdateTexture(tmptex);
                }

                if (oldID != UUID.Zero && ((Disp & DISP_EXPIRE) != 0))
                {
                    if (oldAsset == null) oldAsset = scene.AssetService.Get(oldID.ToString());
                    if (oldAsset != null)
                    {
                        if (oldAsset.Temporary == true)
                        {
                            scene.AssetService.Delete(oldID.ToString());
                        }
                    }
                }
            }
Ejemplo n.º 2
0
 public void SendSimChatMessage(Scene scene, string message)
 {
     scene.SimChat(Utils.StringToBytes(message),
                   ChatTypeEnum.Broadcast, 0, new Vector3(0,0,0), "Content Manager", UUID.Zero, false);
 }
Ejemplo n.º 3
0
            /// <summary>
            /// Called once new texture data has been received for this updater.
            /// </summary>
            public void DataReceived(byte[] data, Scene scene)
            {

                SceneObjectPart part = scene.GetSceneObjectPart(PrimID);

                if (data == null)
                {
                    string msg = 
                        String.Format("DynamicTextureModule: Error preparing image using URL {0}", Url);
                    scene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Say,
                                  0, part.ParentGroup.RootPart.AbsolutePosition, part.Name, part.UUID, false);
                    return;
                }

                byte[] assetData;
                AssetBase oldAsset = null;
                
                if (BlendWithOldTexture)
                {
                    UUID lastTextureID = part.Shape.Textures.DefaultTexture.TextureID;
                    oldAsset = scene.CommsManager.AssetCache.GetAsset(lastTextureID, AssetRequestInfo.InternalRequest());
                    if (oldAsset != null)
                    {
                        assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha);
                    }
                    else
                    {
                        assetData = new byte[data.Length];
                        Array.Copy(data, assetData, data.Length);
                    }
                }
                else
                {
                    assetData = new byte[data.Length];
                    Array.Copy(data, assetData, data.Length);
                }

                // Create a new asset for user
                AssetBase asset = new AssetBase();
                asset.FullID = UUID.Random();
                asset.Data = assetData;
                asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000);
                asset.Type = 0;
                asset.Description = "dynamic image";
                asset.Local = false;
                asset.Temporary = true;
                scene.CommsManager.AssetCache.AddAsset(asset, AssetRequestInfo.InternalRequest());

                LastAssetID = asset.FullID;

                IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>();
                if (cacheLayerDecode != null)
                {
                    cacheLayerDecode.Decode(asset.FullID, asset.Data);
                }
                cacheLayerDecode = null;

                // mostly keep the values from before
                Primitive.TextureEntry tmptex = part.Shape.Textures;

                // remove the old asset from the cache
                UUID oldID = tmptex.DefaultTexture.TextureID;
                
                tmptex.DefaultTexture.TextureID = asset.FullID;
                // I'm pretty sure we always want to force this to true
                // I'm pretty sure noone whats to set fullbright true if it wasn't true before.
                // tmptex.DefaultTexture.Fullbright = true;

                part.Shape.Textures = tmptex;
                part.ScheduleFullUpdate();
            }