[Opensim-dev] [Patch] llSetText with color and alpha argument

Dalien Talbot dalienta at gmail.com
Sun Nov 11 22:24:32 UTC 2007


I've applied both (sorry for the bad wording in the null ptr exception one :-)

/d

On Nov 10, 2007 5:03 PM, Mathias Soeken
<msoeken at informatik.uni-bremen.de> wrote:
> Hi,
>
> This is a patch which takes care of the color and alpha argument of the
> llSetText command.
>
> Best regards,
> Mathias
>
>
> Index: OpenSim/Framework/IClientAPI.cs
> ===================================================================
> --- OpenSim/Framework/IClientAPI.cs     (revision 2322)
> +++ OpenSim/Framework/IClientAPI.cs     (working copy)
> @@ -403,7 +403,7 @@
>          void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint);
>
>          void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape,
> -                                   LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text,
> +                                   LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color,
>                                     uint parentID, byte[] particleSystem, LLQuaternion rotation);
>
>          void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
> Index: OpenSim/Region/ClientStack/ClientView.API.cs
> ===================================================================
> --- OpenSim/Region/ClientStack/ClientView.API.cs        (revision 2322)
> +++ OpenSim/Region/ClientStack/ClientView.API.cs        (working copy)
> @@ -1023,7 +1023,7 @@
>          public void SendPrimitiveToClient(
>              ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos,
>              uint flags,
> -            LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation)
> +            LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, LLQuaternion rotation)
>          {
>              ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
>              outPacket.RegionData.RegionHandle = regionHandle;
> @@ -1036,6 +1036,10 @@
>              outPacket.ObjectData[0].FullID = objectID;
>              outPacket.ObjectData[0].OwnerID = ownerID;
>              outPacket.ObjectData[0].Text = Helpers.StringToField(text);
> +            outPacket.ObjectData[0].TextColor[0] = color[0];
> +            outPacket.ObjectData[0].TextColor[1] = color[1];
> +            outPacket.ObjectData[0].TextColor[2] = color[2];
> +            outPacket.ObjectData[0].TextColor[3] = color[3];
>              outPacket.ObjectData[0].ParentID = parentID;
>              outPacket.ObjectData[0].PSBlock = particleSystem;
>              outPacket.ObjectData[0].ClickAction = 0;
> Index: OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
> ===================================================================
> --- OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs       (revision 2322)
> +++ OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs       (working copy)
> @@ -37,6 +37,7 @@
>  using OpenSim.Framework;
>  using OpenSim.Region.Environment.Interfaces;
>  using OpenSim.Region.Physics.Manager;
> +using System.Drawing;
>
>  namespace OpenSim.Region.Environment.Scenes
>  {
> @@ -166,6 +167,12 @@
>              get { return m_rootPart.OwnerID; }
>          }
>
> +        public Color Color
> +        {
> +            get { return m_rootPart.Color; }
> +            set { m_rootPart.Color = value; }
> +        }
> +
>          public string Text
>          {
>              get { return m_rootPart.Text; }
> @@ -1417,6 +1424,10 @@
>
>          public override void SetText(string text, Vector3 color, double alpha)
>          {
> +            Color = Color.FromArgb (0xff - (int)(alpha * 0xff),
> +                                    (int)(color.x * 0xff),
> +                                    (int)(color.y * 0xff),
> +                                    (int)(color.z * 0xff));
>              Text = text;
>          }
>      }
> Index: OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
> ===================================================================
> --- OpenSim/Region/Environment/Scenes/SceneObjectPart.cs        (revision 2322)
> +++ OpenSim/Region/Environment/Scenes/SceneObjectPart.cs        (working copy)
> @@ -37,6 +37,7 @@
>  using OpenSim.Region.Environment.Interfaces;
>  using OpenSim.Region.Environment.Scenes.Scripting;
>  using OpenSim.Region.Physics.Manager;
> +using System.Drawing;
>
>  namespace OpenSim.Region.Environment.Scenes
>  {
> @@ -303,6 +304,21 @@
>              set { m_description = value; }
>          }
>
> +        private Color m_color = Color.Black;
> +
> +        public Color Color
> +        {
> +            get { return m_color; }
> +            set
> +            {
> +                m_color = value;
> +                /* ScheduleFullUpdate() need not be called b/c after
> +                 * setting the color, the text will be set, so then
> +                 * ScheduleFullUpdate() will be called. */
> +                //ScheduleFullUpdate();
> +            }
> +        }
> +
>          private string m_text = "";
>
>          public string Text
> @@ -1000,9 +1016,10 @@
>                  }
>              }
>
> +            byte[] color = new byte[] { m_color.R, m_color.G, m_color.B, m_color.A };
>              remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, clientFlags, m_uuid,
>                                                 OwnerID,
> -                                               m_text, ParentID, m_particleSystem, lRot);
> +                                               m_text, color, ParentID, m_particleSystem, lRot);
>          }
>
>          /// Terse updates
> @@ -1089,6 +1106,10 @@
>
>          public void SetText(string text, Vector3 color, double alpha)
>          {
> +            Color = Color.FromArgb (0xff - (int)(alpha * 0xff),
> +                                    (int)(color.x * 0xff),
> +                                    (int)(color.y * 0xff),
> +                                    (int)(color.z * 0xff));
>              Text = text;
>          }
>
> Index: OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
> ===================================================================
> --- OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs (revision 2322)
> +++ OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs (working copy)
> @@ -272,7 +272,7 @@
>
>          public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
>                                                    PrimitiveBaseShape primShape, LLVector3 pos, uint flags,
> -                                                  LLUUID objectID, LLUUID ownerID, string text, uint parentID,
> +                                                  LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID,
>                                                    byte[] particleSystem, LLQuaternion rotation)
>          {
>          }
>
> _______________________________________________
> Opensim-dev mailing list
> Opensim-dev at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/opensim-dev
>
>



More information about the Opensim-dev mailing list