aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorMW2007-08-16 16:31:32 +0000
committerMW2007-08-16 16:31:32 +0000
commit531f64a53bbd084dd8d0b33ae6c49821c74d718a (patch)
tree6e515f4d52a974b72a229f1fbc39253a7ba2a8a0 /OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
parentI will get it right, honestly! (diff)
downloadopensim-SC_OLD-531f64a53bbd084dd8d0b33ae6c49821c74d718a.zip
opensim-SC_OLD-531f64a53bbd084dd8d0b33ae6c49821c74d718a.tar.gz
opensim-SC_OLD-531f64a53bbd084dd8d0b33ae6c49821c74d718a.tar.bz2
opensim-SC_OLD-531f64a53bbd084dd8d0b33ae6c49821c74d718a.tar.xz
Taking Prims (SceneObjectGroups) in and out of inventory should now work and if left in inventory will still be there after restarts. (as with the rest of inventory it will only fully work in standalone mode with account authentication turned on).
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs104
1 files changed, 84 insertions, 20 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 77d936d..73f199e 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Region.Environment.Scenes
39 { 39 {
40 get { return m_rootPart.RotationOffset; } 40 get { return m_rootPart.RotationOffset; }
41 } 41 }
42 42
43 43
44 /// <summary> 44 /// <summary>
45 /// 45 ///
@@ -108,6 +108,12 @@ namespace OpenSim.Region.Environment.Scenes
108 get { return m_rootPart.OwnerID; } 108 get { return m_rootPart.OwnerID; }
109 } 109 }
110 110
111 public string Text
112 {
113 get { return m_rootPart.Text; }
114 set { m_rootPart.Text = value; }
115 }
116
111 /// <summary> 117 /// <summary>
112 /// Added because the Parcel code seems to use it 118 /// Added because the Parcel code seems to use it
113 /// but not sure a object should have this 119 /// but not sure a object should have this
@@ -143,19 +149,40 @@ namespace OpenSim.Region.Environment.Scenes
143 149
144 StringReader sr = new StringReader(xmlData); 150 StringReader sr = new StringReader(xmlData);
145 XmlTextReader reader = new XmlTextReader(sr); 151 XmlTextReader reader = new XmlTextReader(sr);
152 reader.Read();
146 reader.ReadStartElement("SceneObjectGroup"); 153 reader.ReadStartElement("SceneObjectGroup");
147 reader.ReadStartElement("RootPart"); 154 reader.ReadStartElement("RootPart");
148 this.m_rootPart = SceneObjectPart.FromXml(reader); 155 this.m_rootPart = SceneObjectPart.FromXml(reader);
149 reader.ReadEndElement(); 156 reader.ReadEndElement();
150 //TODO: read and create rest of the parts 157
151 reader.ReadEndElement(); 158 while (reader.Read())
159 {
160 switch (reader.NodeType)
161 {
162 case XmlNodeType.Element:
163 if (reader.Name == "Part")
164 {
165 reader.Read();
166 SceneObjectPart Part = SceneObjectPart.FromXml(reader);
167 Part.LocalID = m_scene.PrimIDAllocate();
168 this.AddPart(Part);
169 Part.RegionHandle = m_regionHandle;
170 }
171 break;
172 case XmlNodeType.EndElement:
173 break;
174 }
175 }
152 reader.Close(); 176 reader.Close();
153 sr.Close(); 177 sr.Close();
154 178 this.m_rootPart.SetParent(this);
155 this.m_parts.Add(m_rootPart.UUID, m_rootPart); 179 this.m_parts.Add(m_rootPart.UUID, m_rootPart);
156 this.m_rootPart.LocalID = m_scene.PrimIDAllocate(); 180 this.m_rootPart.LocalID = m_scene.PrimIDAllocate();
181 this.m_rootPart.ParentID = 0;
157 this.m_rootPart.RegionHandle = m_regionHandle; 182 this.m_rootPart.RegionHandle = m_regionHandle;
183 this.UpdateParentIDs();
158 m_scene.EventManager.OnBackup += this.ProcessBackup; 184 m_scene.EventManager.OnBackup += this.ProcessBackup;
185 this.ScheduleGroupForFullUpdate();
159 } 186 }
160 187
161 /// <summary> 188 /// <summary>
@@ -192,6 +219,17 @@ namespace OpenSim.Region.Environment.Scenes
192 writer.WriteStartElement(String.Empty, "RootPart", String.Empty); 219 writer.WriteStartElement(String.Empty, "RootPart", String.Empty);
193 m_rootPart.ToXml(writer); 220 m_rootPart.ToXml(writer);
194 writer.WriteEndElement(); 221 writer.WriteEndElement();
222 writer.WriteStartElement(String.Empty, "OtherParts", String.Empty);
223 foreach (SceneObjectPart part in this.m_parts.Values)
224 {
225 if (part.UUID != this.m_rootPart.UUID)
226 {
227 writer.WriteStartElement(String.Empty, "Part", String.Empty);
228 part.ToXml(writer);
229 writer.WriteEndElement();
230 }
231 }
232 writer.WriteEndElement();
195 writer.WriteEndElement(); 233 writer.WriteEndElement();
196 writer.Close(); 234 writer.Close();
197 // System.Console.WriteLine("prim: " + sw.ToString()); 235 // System.Console.WriteLine("prim: " + sw.ToString());
@@ -215,11 +253,11 @@ namespace OpenSim.Region.Environment.Scenes
215 dupe.m_regionHandle = this.m_regionHandle; 253 dupe.m_regionHandle = this.m_regionHandle;
216 254
217 dupe.CopyRootPart(this.m_rootPart); 255 dupe.CopyRootPart(this.m_rootPart);
218 256
219 List<SceneObjectPart> partList = new List<SceneObjectPart>(this.m_parts.Values); 257 List<SceneObjectPart> partList = new List<SceneObjectPart>(this.m_parts.Values);
220 foreach (SceneObjectPart part in partList) 258 foreach (SceneObjectPart part in partList)
221 { 259 {
222 if (part.UUID != this.m_rootPart.UUID) 260 if (part.UUID != this.m_rootPart.UUID)
223 { 261 {
224 dupe.CopyPart(part); 262 dupe.CopyPart(part);
225 } 263 }
@@ -477,13 +515,6 @@ namespace OpenSim.Region.Environment.Scenes
477 } 515 }
478 } 516 }
479 517
480 public string Text
481 {
482 get { return m_rootPart.Text; }
483 set { m_rootPart.Text = value; }
484 }
485
486
487 public void SetPartText(string text, uint localID) 518 public void SetPartText(string text, uint localID)
488 { 519 {
489 SceneObjectPart part = this.GetChildPrim(localID); 520 SceneObjectPart part = this.GetChildPrim(localID);
@@ -502,6 +533,26 @@ namespace OpenSim.Region.Environment.Scenes
502 } 533 }
503 } 534 }
504 535
536 public string GetPartName(uint localID)
537 {
538 SceneObjectPart part = this.GetChildPrim(localID);
539 if (part != null)
540 {
541 return part.PartName;
542 }
543 return "";
544 }
545
546 public string GetPartDescription(uint localID)
547 {
548 SceneObjectPart part = this.GetChildPrim(localID);
549 if (part != null)
550 {
551 return part.Description;
552 }
553 return "";
554 }
555
505 /// <summary> 556 /// <summary>
506 /// 557 ///
507 /// </summary> 558 /// </summary>
@@ -598,7 +649,7 @@ namespace OpenSim.Region.Environment.Scenes
598 SceneObjectPart part = this.GetChildPrim(localID); 649 SceneObjectPart part = this.GetChildPrim(localID);
599 if (part != null) 650 if (part != null)
600 { 651 {
601 if (part.UUID== this.m_rootPart.UUID) 652 if (part.UUID == this.m_rootPart.UUID)
602 { 653 {
603 this.UpdateRootPosition(pos); 654 this.UpdateRootPosition(pos);
604 } 655 }
@@ -805,14 +856,14 @@ namespace OpenSim.Region.Environment.Scenes
805 856
806 public override void UpdateMovement() 857 public override void UpdateMovement()
807 { 858 {
808 foreach( SceneObjectPart part in m_parts.Values ) 859 foreach (SceneObjectPart part in m_parts.Values)
809 { 860 {
810 part.UpdateMovement(); 861 part.UpdateMovement();
811 } 862 }
812 863
813 base.UpdateMovement(); 864 base.UpdateMovement();
814 } 865 }
815 866
816 /// <summary> 867 /// <summary>
817 /// Added as a way for the storage provider to reset the scene, 868 /// Added as a way for the storage provider to reset the scene,
818 /// most likely a better way to do this sort of thing but for now... 869 /// most likely a better way to do this sort of thing but for now...
@@ -857,8 +908,8 @@ namespace OpenSim.Region.Environment.Scenes
857 } 908 }
858 return null; 909 return null;
859 } 910 }
860 911
861 public void UpdateText( string text ) 912 public void UpdateText(string text)
862 { 913 {
863 m_rootPart.Text = text; 914 m_rootPart.Text = text;
864 m_rootPart.ScheduleTerseUpdate(); 915 m_rootPart.ScheduleTerseUpdate();
@@ -866,7 +917,7 @@ namespace OpenSim.Region.Environment.Scenes
866 917
867 public void ObjectGrabHandler(uint localId, LLVector3 offsetPos, IClientAPI remoteClient) 918 public void ObjectGrabHandler(uint localId, LLVector3 offsetPos, IClientAPI remoteClient)
868 { 919 {
869 if( m_rootPart.LocalID == localId ) 920 if (m_rootPart.LocalID == localId)
870 { 921 {
871 OnGrabGroup(offsetPos, remoteClient); 922 OnGrabGroup(offsetPos, remoteClient);
872 } 923 }
@@ -886,5 +937,18 @@ namespace OpenSim.Region.Environment.Scenes
886 { 937 {
887 938
888 } 939 }
940
941 public void DeleteGroup()
942 {
943 m_scene.EventManager.OnBackup -= this.ProcessBackup;
944 foreach (SceneObjectPart part in this.m_parts.Values)
945 {
946 List<ScenePresence> avatars = this.RequestSceneAvatars();
947 for (int i = 0; i < avatars.Count; i++)
948 {
949 avatars[i].ControllingClient.SendKillObject(this.m_regionHandle, part.LocalID);
950 }
951 }
952 }
889 } 953 }
890} 954}