diff options
author | Dalien Talbot | 2007-11-11 22:23:34 +0000 |
---|---|---|
committer | Dalien Talbot | 2007-11-11 22:23:34 +0000 |
commit | 8039c31e88fff3fb5edb57ebaa164d3d20e4b939 (patch) | |
tree | 43112538aa9f1873a4b294a1854b55c1c675af20 /OpenSim/Region | |
parent | Fixing null pointer exception from Mathias Soeken: (diff) | |
download | opensim-SC-8039c31e88fff3fb5edb57ebaa164d3d20e4b939.zip opensim-SC-8039c31e88fff3fb5edb57ebaa164d3d20e4b939.tar.gz opensim-SC-8039c31e88fff3fb5edb57ebaa164d3d20e4b939.tar.bz2 opensim-SC-8039c31e88fff3fb5edb57ebaa164d3d20e4b939.tar.xz |
Patch from Mathias Soeken (thanks Mathias!) to take care of the color
and alpha argument of the llSetText command.
Diffstat (limited to 'OpenSim/Region')
4 files changed, 39 insertions, 3 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index c8213fc..b52a834 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs | |||
@@ -1023,7 +1023,7 @@ namespace OpenSim.Region.ClientStack | |||
1023 | public void SendPrimitiveToClient( | 1023 | public void SendPrimitiveToClient( |
1024 | ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, | 1024 | ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, |
1025 | uint flags, | 1025 | uint flags, |
1026 | LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation) | 1026 | LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, LLQuaternion rotation) |
1027 | { | 1027 | { |
1028 | ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); | 1028 | ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); |
1029 | outPacket.RegionData.RegionHandle = regionHandle; | 1029 | outPacket.RegionData.RegionHandle = regionHandle; |
@@ -1036,6 +1036,10 @@ namespace OpenSim.Region.ClientStack | |||
1036 | outPacket.ObjectData[0].FullID = objectID; | 1036 | outPacket.ObjectData[0].FullID = objectID; |
1037 | outPacket.ObjectData[0].OwnerID = ownerID; | 1037 | outPacket.ObjectData[0].OwnerID = ownerID; |
1038 | outPacket.ObjectData[0].Text = Helpers.StringToField(text); | 1038 | outPacket.ObjectData[0].Text = Helpers.StringToField(text); |
1039 | outPacket.ObjectData[0].TextColor[0] = color[0]; | ||
1040 | outPacket.ObjectData[0].TextColor[1] = color[1]; | ||
1041 | outPacket.ObjectData[0].TextColor[2] = color[2]; | ||
1042 | outPacket.ObjectData[0].TextColor[3] = color[3]; | ||
1039 | outPacket.ObjectData[0].ParentID = parentID; | 1043 | outPacket.ObjectData[0].ParentID = parentID; |
1040 | outPacket.ObjectData[0].PSBlock = particleSystem; | 1044 | outPacket.ObjectData[0].PSBlock = particleSystem; |
1041 | outPacket.ObjectData[0].ClickAction = 0; | 1045 | outPacket.ObjectData[0].ClickAction = 0; |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index b00d465..e2415b9 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -37,6 +37,7 @@ using libsecondlife.Packets; | |||
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Region.Environment.Interfaces; | 38 | using OpenSim.Region.Environment.Interfaces; |
39 | using OpenSim.Region.Physics.Manager; | 39 | using OpenSim.Region.Physics.Manager; |
40 | using System.Drawing; | ||
40 | 41 | ||
41 | namespace OpenSim.Region.Environment.Scenes | 42 | namespace OpenSim.Region.Environment.Scenes |
42 | { | 43 | { |
@@ -166,6 +167,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
166 | get { return m_rootPart.OwnerID; } | 167 | get { return m_rootPart.OwnerID; } |
167 | } | 168 | } |
168 | 169 | ||
170 | public Color Color | ||
171 | { | ||
172 | get { return m_rootPart.Color; } | ||
173 | set { m_rootPart.Color = value; } | ||
174 | } | ||
175 | |||
169 | public string Text | 176 | public string Text |
170 | { | 177 | { |
171 | get { return m_rootPart.Text; } | 178 | get { return m_rootPart.Text; } |
@@ -1417,6 +1424,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1417 | 1424 | ||
1418 | public override void SetText(string text, Vector3 color, double alpha) | 1425 | public override void SetText(string text, Vector3 color, double alpha) |
1419 | { | 1426 | { |
1427 | Color = Color.FromArgb (0xff - (int)(alpha * 0xff), | ||
1428 | (int)(color.x * 0xff), | ||
1429 | (int)(color.y * 0xff), | ||
1430 | (int)(color.z * 0xff)); | ||
1420 | Text = text; | 1431 | Text = text; |
1421 | } | 1432 | } |
1422 | } | 1433 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 1604dad..52bea40 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -37,6 +37,7 @@ using OpenSim.Framework; | |||
37 | using OpenSim.Region.Environment.Interfaces; | 37 | using OpenSim.Region.Environment.Interfaces; |
38 | using OpenSim.Region.Environment.Scenes.Scripting; | 38 | using OpenSim.Region.Environment.Scenes.Scripting; |
39 | using OpenSim.Region.Physics.Manager; | 39 | using OpenSim.Region.Physics.Manager; |
40 | using System.Drawing; | ||
40 | 41 | ||
41 | namespace OpenSim.Region.Environment.Scenes | 42 | namespace OpenSim.Region.Environment.Scenes |
42 | { | 43 | { |
@@ -303,6 +304,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
303 | set { m_description = value; } | 304 | set { m_description = value; } |
304 | } | 305 | } |
305 | 306 | ||
307 | private Color m_color = Color.Black; | ||
308 | |||
309 | public Color Color | ||
310 | { | ||
311 | get { return m_color; } | ||
312 | set | ||
313 | { | ||
314 | m_color = value; | ||
315 | /* ScheduleFullUpdate() need not be called b/c after | ||
316 | * setting the color, the text will be set, so then | ||
317 | * ScheduleFullUpdate() will be called. */ | ||
318 | //ScheduleFullUpdate(); | ||
319 | } | ||
320 | } | ||
321 | |||
306 | private string m_text = ""; | 322 | private string m_text = ""; |
307 | 323 | ||
308 | public string Text | 324 | public string Text |
@@ -1003,9 +1019,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1003 | } | 1019 | } |
1004 | } | 1020 | } |
1005 | 1021 | ||
1022 | byte[] color = new byte[] { m_color.R, m_color.G, m_color.B, m_color.A }; | ||
1006 | remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, clientFlags, m_uuid, | 1023 | remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, clientFlags, m_uuid, |
1007 | OwnerID, | 1024 | OwnerID, |
1008 | m_text, ParentID, m_particleSystem, lRot); | 1025 | m_text, color, ParentID, m_particleSystem, lRot); |
1009 | } | 1026 | } |
1010 | 1027 | ||
1011 | /// Terse updates | 1028 | /// Terse updates |
@@ -1092,6 +1109,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1092 | 1109 | ||
1093 | public void SetText(string text, Vector3 color, double alpha) | 1110 | public void SetText(string text, Vector3 color, double alpha) |
1094 | { | 1111 | { |
1112 | Color = Color.FromArgb (0xff - (int)(alpha * 0xff), | ||
1113 | (int)(color.x * 0xff), | ||
1114 | (int)(color.y * 0xff), | ||
1115 | (int)(color.z * 0xff)); | ||
1095 | Text = text; | 1116 | Text = text; |
1096 | } | 1117 | } |
1097 | 1118 | ||
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 75b3f04..717b6c0 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -272,7 +272,7 @@ namespace SimpleApp | |||
272 | 272 | ||
273 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, | 273 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, |
274 | PrimitiveBaseShape primShape, LLVector3 pos, uint flags, | 274 | PrimitiveBaseShape primShape, LLVector3 pos, uint flags, |
275 | LLUUID objectID, LLUUID ownerID, string text, uint parentID, | 275 | LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, |
276 | byte[] particleSystem, LLQuaternion rotation) | 276 | byte[] particleSystem, LLQuaternion rotation) |
277 | { | 277 | { |
278 | } | 278 | } |