Patch from Mathias Soeken (thanks Mathias!) to take care of the color

and alpha argument of the llSetText command.
afrisby
Dalien Talbot 2007-11-11 22:23:34 +00:00
parent aeb7b8cc18
commit 8039c31e88
5 changed files with 40 additions and 4 deletions

View File

@ -403,7 +403,7 @@ namespace OpenSim.Framework
void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint); void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint);
void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, 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); uint parentID, byte[] particleSystem, LLQuaternion rotation);
void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,

View File

@ -1023,7 +1023,7 @@ namespace OpenSim.Region.ClientStack
public void SendPrimitiveToClient( public void SendPrimitiveToClient(
ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos,
uint flags, 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(); ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
outPacket.RegionData.RegionHandle = regionHandle; outPacket.RegionData.RegionHandle = regionHandle;
@ -1036,6 +1036,10 @@ namespace OpenSim.Region.ClientStack
outPacket.ObjectData[0].FullID = objectID; outPacket.ObjectData[0].FullID = objectID;
outPacket.ObjectData[0].OwnerID = ownerID; outPacket.ObjectData[0].OwnerID = ownerID;
outPacket.ObjectData[0].Text = Helpers.StringToField(text); 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].ParentID = parentID;
outPacket.ObjectData[0].PSBlock = particleSystem; outPacket.ObjectData[0].PSBlock = particleSystem;
outPacket.ObjectData[0].ClickAction = 0; outPacket.ObjectData[0].ClickAction = 0;

View File

@ -37,6 +37,7 @@ using libsecondlife.Packets;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
using System.Drawing;
namespace OpenSim.Region.Environment.Scenes namespace OpenSim.Region.Environment.Scenes
{ {
@ -166,6 +167,12 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_rootPart.OwnerID; } get { return m_rootPart.OwnerID; }
} }
public Color Color
{
get { return m_rootPart.Color; }
set { m_rootPart.Color = value; }
}
public string Text public string Text
{ {
get { return m_rootPart.Text; } get { return m_rootPart.Text; }
@ -1417,6 +1424,10 @@ namespace OpenSim.Region.Environment.Scenes
public override void SetText(string text, Vector3 color, double alpha) 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; Text = text;
} }
} }

View File

@ -37,6 +37,7 @@ using OpenSim.Framework;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes.Scripting; using OpenSim.Region.Environment.Scenes.Scripting;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
using System.Drawing;
namespace OpenSim.Region.Environment.Scenes namespace OpenSim.Region.Environment.Scenes
{ {
@ -303,6 +304,21 @@ namespace OpenSim.Region.Environment.Scenes
set { m_description = value; } 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 = ""; private string m_text = "";
public string Text public string Text
@ -1003,9 +1019,10 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
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, remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, clientFlags, m_uuid,
OwnerID, OwnerID,
m_text, ParentID, m_particleSystem, lRot); m_text, color, ParentID, m_particleSystem, lRot);
} }
/// Terse updates /// Terse updates
@ -1092,6 +1109,10 @@ namespace OpenSim.Region.Environment.Scenes
public void SetText(string text, Vector3 color, double alpha) 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; Text = text;
} }

View File

@ -272,7 +272,7 @@ namespace SimpleApp
public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
PrimitiveBaseShape primShape, LLVector3 pos, uint flags, 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) byte[] particleSystem, LLQuaternion rotation)
{ {
} }