aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-02 00:13:04 +0100
committerJustin Clark-Casey (justincc)2011-08-02 00:13:04 +0100
commitb6ac1c46cd473b129b70344f0001f1e8f97d8860 (patch)
tree46e5d02205b63d16f29b3aaf6a3ad910192aaeb6 /OpenSim/Framework
parentGet osNpcCreate appearance working with avatars that are currently in the scene. (diff)
downloadopensim-SC_OLD-b6ac1c46cd473b129b70344f0001f1e8f97d8860.zip
opensim-SC_OLD-b6ac1c46cd473b129b70344f0001f1e8f97d8860.tar.gz
opensim-SC_OLD-b6ac1c46cd473b129b70344f0001f1e8f97d8860.tar.bz2
opensim-SC_OLD-b6ac1c46cd473b129b70344f0001f1e8f97d8860.tar.xz
Get rid of AvatarAppearance.Owner to simplify the code.
This is not used for anything - appearances are always properties of objects with ids (ScenePresence, AgentCircuitData) and just has the potential to get out of sync when the appearance is cloned.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/AgentCircuitData.cs11
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs31
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs4
-rw-r--r--OpenSim/Framework/Tests/AgentCircuitDataTest.cs2
-rw-r--r--OpenSim/Framework/Tests/AgentCircuitManagerTests.cs4
5 files changed, 19 insertions, 33 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs
index 125910e..12c8ac0 100644
--- a/OpenSim/Framework/AgentCircuitData.cs
+++ b/OpenSim/Framework/AgentCircuitData.cs
@@ -296,11 +296,12 @@ namespace OpenSim.Framework
296 if (args["start_pos"] != null) 296 if (args["start_pos"] != null)
297 Vector3.TryParse(args["start_pos"].AsString(), out startpos); 297 Vector3.TryParse(args["start_pos"].AsString(), out startpos);
298 298
299 m_log.InfoFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString()); 299 m_log.InfoFormat("[AGENTCIRCUITDATA]: agentid={0}, child={1}, startpos={2}", AgentID, child, startpos);
300 300
301 try { 301 try
302 {
302 // Unpack various appearance elements 303 // Unpack various appearance elements
303 Appearance = new AvatarAppearance(AgentID); 304 Appearance = new AvatarAppearance();
304 305
305 // Eventually this code should be deprecated, use full appearance 306 // Eventually this code should be deprecated, use full appearance
306 // packing in packed_appearance 307 // packing in packed_appearance
@@ -313,7 +314,9 @@ namespace OpenSim.Framework
313 m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance"); 314 m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance");
314 } 315 }
315 else 316 else
316 m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance"); 317 {
318 m_log.Warn("[AGENTCIRCUITDATA]: failed to find a valid packed_appearance");
319 }
317 } 320 }
318 catch (Exception e) 321 catch (Exception e)
319 { 322 {
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 6b1f58a..73b068d 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -47,7 +47,6 @@ namespace OpenSim.Framework
47 public readonly static int TEXTURE_COUNT = 21; 47 public readonly static int TEXTURE_COUNT = 21;
48 public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; 48 public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
49 49
50 protected UUID m_owner;
51 protected int m_serial = 0; 50 protected int m_serial = 0;
52 protected byte[] m_visualparams; 51 protected byte[] m_visualparams;
53 protected Primitive.TextureEntry m_texture; 52 protected Primitive.TextureEntry m_texture;
@@ -56,12 +55,6 @@ namespace OpenSim.Framework
56 protected float m_avatarHeight = 0; 55 protected float m_avatarHeight = 0;
57 protected float m_hipOffset = 0; 56 protected float m_hipOffset = 0;
58 57
59 public virtual UUID Owner
60 {
61 get { return m_owner; }
62 set { m_owner = value; }
63 }
64
65 public virtual int Serial 58 public virtual int Serial
66 { 59 {
67 get { return m_serial; } 60 get { return m_serial; }
@@ -101,38 +94,31 @@ namespace OpenSim.Framework
101 get { return m_hipOffset; } 94 get { return m_hipOffset; }
102 } 95 }
103 96
104 public AvatarAppearance() : this(UUID.Zero) {} 97 public AvatarAppearance()
105
106 public AvatarAppearance(UUID owner)
107 { 98 {
108// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance for {0}",owner); 99// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance");
109 100
110 m_serial = 0; 101 m_serial = 0;
111 m_owner = owner;
112
113 SetDefaultWearables(); 102 SetDefaultWearables();
114 SetDefaultTexture(); 103 SetDefaultTexture();
115 SetDefaultParams(); 104 SetDefaultParams();
116 SetHeight(); 105 SetHeight();
117
118 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 106 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
119 } 107 }
120 108
121 public AvatarAppearance(UUID avatarID, OSDMap map) 109 public AvatarAppearance(OSDMap map)
122 { 110 {
123// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance for {0} from OSDMap",avatarID); 111// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap");
124 112
125 m_owner = avatarID;
126 Unpack(map); 113 Unpack(map);
127 SetHeight(); 114 SetHeight();
128 } 115 }
129 116
130 public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) 117 public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams)
131 { 118 {
132// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID); 119// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance");
133 120
134 m_serial = 0; 121 m_serial = 0;
135 m_owner = avatarID;
136 122
137 if (wearables != null) 123 if (wearables != null)
138 m_wearables = wearables; 124 m_wearables = wearables;
@@ -165,24 +151,21 @@ namespace OpenSim.Framework
165 if (appearance == null) 151 if (appearance == null)
166 { 152 {
167 m_serial = 0; 153 m_serial = 0;
168 m_owner = UUID.Zero;
169
170 SetDefaultWearables(); 154 SetDefaultWearables();
171 SetDefaultTexture(); 155 SetDefaultTexture();
172 SetDefaultParams(); 156 SetDefaultParams();
173 SetHeight(); 157 SetHeight();
174
175 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 158 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
176 159
177 return; 160 return;
178 } 161 }
179 162
180 m_serial = appearance.Serial; 163 m_serial = appearance.Serial;
181 m_owner = appearance.Owner;
182 164
183 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; 165 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
184 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 166 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
185 m_wearables[i] = new AvatarWearable(); 167 m_wearables[i] = new AvatarWearable();
168
186 if (copyWearables && (appearance.Wearables != null)) 169 if (copyWearables && (appearance.Wearables != null))
187 { 170 {
188 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 171 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 710a57d..613db1c 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -593,7 +593,7 @@ namespace OpenSim.Framework
593 // AgentTextures[i++] = o.AsUUID(); 593 // AgentTextures[i++] = o.AsUUID();
594 //} 594 //}
595 595
596 Appearance = new AvatarAppearance(AgentID); 596 Appearance = new AvatarAppearance();
597 597
598 // The code to unpack textures, visuals, wearables and attachments 598 // The code to unpack textures, visuals, wearables and attachments
599 // should be removed; packed appearance contains the full appearance 599 // should be removed; packed appearance contains the full appearance
@@ -635,7 +635,7 @@ namespace OpenSim.Framework
635 // end of code to remove 635 // end of code to remove
636 636
637 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) 637 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
638 Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]); 638 Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
639 else 639 else
640 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance"); 640 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");
641 641
diff --git a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs
index 05d8469..0dce414 100644
--- a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs
+++ b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Framework.Tests
64 SecureSessionId = UUID.Random(); 64 SecureSessionId = UUID.Random();
65 SessionId = UUID.Random(); 65 SessionId = UUID.Random();
66 66
67 AvAppearance = new AvatarAppearance(AgentId); 67 AvAppearance = new AvatarAppearance();
68 VisualParams = new byte[218]; 68 VisualParams = new byte[218];
69 69
70 //body 70 //body
diff --git a/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs b/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs
index 6c98897..9615f1b 100644
--- a/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs
+++ b/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Framework.Tests
68 68
69 m_agentCircuitData1 = new AgentCircuitData(); 69 m_agentCircuitData1 = new AgentCircuitData();
70 m_agentCircuitData1.AgentID = AgentId1; 70 m_agentCircuitData1.AgentID = AgentId1;
71 m_agentCircuitData1.Appearance = new AvatarAppearance(AgentId1); 71 m_agentCircuitData1.Appearance = new AvatarAppearance();
72 m_agentCircuitData1.BaseFolder = BaseFolder; 72 m_agentCircuitData1.BaseFolder = BaseFolder;
73 m_agentCircuitData1.CapsPath = CapsPath; 73 m_agentCircuitData1.CapsPath = CapsPath;
74 m_agentCircuitData1.child = false; 74 m_agentCircuitData1.child = false;
@@ -83,7 +83,7 @@ namespace OpenSim.Framework.Tests
83 83
84 m_agentCircuitData2 = new AgentCircuitData(); 84 m_agentCircuitData2 = new AgentCircuitData();
85 m_agentCircuitData2.AgentID = AgentId2; 85 m_agentCircuitData2.AgentID = AgentId2;
86 m_agentCircuitData2.Appearance = new AvatarAppearance(AgentId2); 86 m_agentCircuitData2.Appearance = new AvatarAppearance();
87 m_agentCircuitData2.BaseFolder = BaseFolder; 87 m_agentCircuitData2.BaseFolder = BaseFolder;
88 m_agentCircuitData2.CapsPath = CapsPath; 88 m_agentCircuitData2.CapsPath = CapsPath;
89 m_agentCircuitData2.child = false; 89 m_agentCircuitData2.child = false;