aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs38
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs43
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs169
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs2
6 files changed, 86 insertions, 177 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
deleted file mode 100644
index c967f30..0000000
--- a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using OpenSim.Framework;
30
31namespace OpenSim.Region.Framework.Interfaces
32{
33 public interface IAvatarFactory
34 {
35 bool TryGetAvatarAppearance(UUID avatarId, out AvatarAppearance appearance);
36 void UpdateDatabase(UUID userID, AvatarAppearance avatAppearance);
37 }
38}
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 4feb3fc..c321a15 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -296,7 +296,7 @@ namespace OpenSim.Region.Framework.Scenes
296 /// ChatToClientsEvent is triggered via ChatModule (or 296 /// ChatToClientsEvent is triggered via ChatModule (or
297 /// substitutes thereof) when a chat message is actually sent to clients. Clients will only be sent a 297 /// substitutes thereof) when a chat message is actually sent to clients. Clients will only be sent a
298 /// received chat message if they satisfy various conditions (within audible range, etc.) 298 /// received chat message if they satisfy various conditions (within audible range, etc.)
299 /// </summary> 299 /// </summary>
300 public delegate void ChatToClientsEvent( 300 public delegate void ChatToClientsEvent(
301 UUID senderID, HashSet<UUID> receiverIDs, 301 UUID senderID, HashSet<UUID> receiverIDs,
302 string message, ChatTypeEnum type, Vector3 fromPos, string fromName, 302 string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
@@ -1636,8 +1636,8 @@ namespace OpenSim.Region.Framework.Scenes
1636 e.Message, e.StackTrace); 1636 e.Message, e.StackTrace);
1637 } 1637 }
1638 } 1638 }
1639 } 1639 }
1640 } 1640 }
1641 1641
1642 public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) 1642 public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
1643 { 1643 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4878b3e..f77fb2c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -119,7 +119,6 @@ namespace OpenSim.Region.Framework.Scenes
119 119
120 protected IXMLRPC m_xmlrpcModule; 120 protected IXMLRPC m_xmlrpcModule;
121 protected IWorldComm m_worldCommModule; 121 protected IWorldComm m_worldCommModule;
122 protected IAvatarFactory m_AvatarFactory;
123 protected IConfigSource m_config; 122 protected IConfigSource m_config;
124 protected IRegionSerialiserModule m_serialiser; 123 protected IRegionSerialiserModule m_serialiser;
125 protected IDialogModule m_dialogModule; 124 protected IDialogModule m_dialogModule;
@@ -399,11 +398,6 @@ namespace OpenSim.Region.Framework.Scenes
399 398
400 public IAttachmentsModule AttachmentsModule { get; set; } 399 public IAttachmentsModule AttachmentsModule { get; set; }
401 400
402 public IAvatarFactory AvatarFactory
403 {
404 get { return m_AvatarFactory; }
405 }
406
407 public ICapabilitiesModule CapsModule 401 public ICapabilitiesModule CapsModule
408 { 402 {
409 get { return m_capsModule; } 403 get { return m_capsModule; }
@@ -1159,7 +1153,6 @@ namespace OpenSim.Region.Framework.Scenes
1159 m_xmlrpcModule = RequestModuleInterface<IXMLRPC>(); 1153 m_xmlrpcModule = RequestModuleInterface<IXMLRPC>();
1160 m_worldCommModule = RequestModuleInterface<IWorldComm>(); 1154 m_worldCommModule = RequestModuleInterface<IWorldComm>();
1161 XferManager = RequestModuleInterface<IXfer>(); 1155 XferManager = RequestModuleInterface<IXfer>();
1162 m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
1163 AttachmentsModule = RequestModuleInterface<IAttachmentsModule>(); 1156 AttachmentsModule = RequestModuleInterface<IAttachmentsModule>();
1164 m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); 1157 m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
1165 m_dialogModule = RequestModuleInterface<IDialogModule>(); 1158 m_dialogModule = RequestModuleInterface<IDialogModule>();
@@ -3278,7 +3271,6 @@ namespace OpenSim.Region.Framework.Scenes
3278 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName); 3271 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName);
3279 } 3272 }
3280 3273
3281
3282 /// <summary> 3274 /// <summary>
3283 /// Do the work necessary to initiate a new user connection for a particular scene. 3275 /// Do the work necessary to initiate a new user connection for a particular scene.
3284 /// At the moment, this consists of setting up the caps infrastructure 3276 /// At the moment, this consists of setting up the caps infrastructure
@@ -3291,6 +3283,23 @@ namespace OpenSim.Region.Framework.Scenes
3291 /// also return a reason.</returns> 3283 /// also return a reason.</returns>
3292 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) 3284 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason)
3293 { 3285 {
3286 return NewUserConnection(agent, teleportFlags, out reason, true);
3287 }
3288
3289 /// <summary>
3290 /// Do the work necessary to initiate a new user connection for a particular scene.
3291 /// At the moment, this consists of setting up the caps infrastructure
3292 /// The return bool should allow for connections to be refused, but as not all calling paths
3293 /// take proper notice of it let, we allowed banned users in still.
3294 /// </summary>
3295 /// <param name="agent">CircuitData of the agent who is connecting</param>
3296 /// <param name="reason">Outputs the reason for the false response on this string</param>
3297 /// <param name="requirePresenceLookup">True for normal presence. False for NPC
3298 /// or other applications where a full grid/Hypergrid presence may not be required.</param>
3299 /// <returns>True if the region accepts this agent. False if it does not. False will
3300 /// also return a reason.</returns>
3301 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup)
3302 {
3294 bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 || 3303 bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 ||
3295 (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0); 3304 (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0);
3296 reason = String.Empty; 3305 reason = String.Empty;
@@ -3339,16 +3348,18 @@ namespace OpenSim.Region.Framework.Scenes
3339 3348
3340 if (sp == null) // We don't have an [child] agent here already 3349 if (sp == null) // We don't have an [child] agent here already
3341 { 3350 {
3342 3351 if (requirePresenceLookup)
3343 try
3344 { 3352 {
3345 if (!VerifyUserPresence(agent, out reason)) 3353 try
3354 {
3355 if (!VerifyUserPresence(agent, out reason))
3356 return false;
3357 }
3358 catch (Exception e)
3359 {
3360 m_log.ErrorFormat("[CONNECTION BEGIN]: Exception verifying presence " + e.ToString());
3346 return false; 3361 return false;
3347 } 3362 }
3348 catch (Exception e)
3349 {
3350 m_log.ErrorFormat("[CONNECTION BEGIN]: Exception verifying presence " + e.ToString());
3351 return false;
3352 } 3363 }
3353 3364
3354 try 3365 try
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index f81c551..24d7334 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -406,11 +406,14 @@ namespace OpenSim.Region.Framework.Scenes
406 public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) 406 public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked)
407 { 407 {
408 EntityBase entity; 408 EntityBase entity;
409 if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup) 409 if (!Entities.TryGetValue(uuid, out entity) || (!(entity is SceneObjectGroup)))
410 return false; 410 return false;
411 411
412 SceneObjectGroup grp = (SceneObjectGroup)entity; 412 SceneObjectGroup grp = (SceneObjectGroup)entity;
413 413
414 if (entity == null)
415 return false;
416
414 if (!resultOfObjectLinked) 417 if (!resultOfObjectLinked)
415 { 418 {
416 m_numPrim -= grp.PrimCount; 419 m_numPrim -= grp.PrimCount;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 68ac178..1abd134 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -75,7 +75,6 @@ namespace OpenSim.Region.Framework.Scenes
75 75
76 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 76 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
77 77
78 private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
79// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); 78// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes();
80 private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); 79 private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags));
81 private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); 80 private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f);
@@ -137,8 +136,6 @@ namespace OpenSim.Region.Framework.Scenes
137 136
138 private SendCourseLocationsMethod m_sendCourseLocationsMethod; 137 private SendCourseLocationsMethod m_sendCourseLocationsMethod;
139 138
140 private bool m_startAnimationSet;
141
142 //private Vector3 m_requestedSitOffset = new Vector3(); 139 //private Vector3 m_requestedSitOffset = new Vector3();
143 140
144 private Vector3 m_LastFinitePos; 141 private Vector3 m_LastFinitePos;
@@ -713,13 +710,14 @@ namespace OpenSim.Region.Framework.Scenes
713 SetDirectionVectors(); 710 SetDirectionVectors();
714 } 711 }
715 712
713/*
716 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, 714 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams,
717 AvatarWearable[] wearables) 715 AvatarWearable[] wearables)
718 : this(client, world, reginfo) 716 : this(client, world, reginfo)
719 { 717 {
720 m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams); 718 m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams);
721 } 719 }
722 720*/
723 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) 721 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance)
724 : this(client, world, reginfo) 722 : this(client, world, reginfo)
725 { 723 {
@@ -733,8 +731,6 @@ namespace OpenSim.Region.Framework.Scenes
733 731
734 public void RegisterToEvents() 732 public void RegisterToEvents()
735 { 733 {
736 m_controllingClient.OnRequestWearables += SendWearables;
737 m_controllingClient.OnSetAppearance += SetAppearance;
738 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; 734 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement;
739 //m_controllingClient.OnCompleteMovementToRegion += SendInitialData; 735 //m_controllingClient.OnCompleteMovementToRegion += SendInitialData;
740 m_controllingClient.OnAgentUpdate += HandleAgentUpdate; 736 m_controllingClient.OnAgentUpdate += HandleAgentUpdate;
@@ -1068,7 +1064,7 @@ namespace OpenSim.Region.Framework.Scenes
1068 /// <summary> 1064 /// <summary>
1069 /// Sets avatar height in the phyiscs plugin 1065 /// Sets avatar height in the phyiscs plugin
1070 /// </summary> 1066 /// </summary>
1071 internal void SetHeight(float height) 1067 public void SetHeight(float height)
1072 { 1068 {
1073 m_avHeight = height; 1069 m_avHeight = height;
1074 if (PhysicsActor != null && !IsChildAgent) 1070 if (PhysicsActor != null && !IsChildAgent)
@@ -1133,7 +1129,6 @@ namespace OpenSim.Region.Framework.Scenes
1133 if (friendsModule != null) 1129 if (friendsModule != null)
1134 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); 1130 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
1135 } 1131 }
1136
1137 } 1132 }
1138 1133
1139 /// <summary> 1134 /// <summary>
@@ -2392,9 +2387,12 @@ namespace OpenSim.Region.Framework.Scenes
2392 if (m_appearance.Texture == null) 2387 if (m_appearance.Texture == null)
2393 return; 2388 return;
2394 2389
2395 Vector3 pos = m_pos; 2390 if (IsChildAgent)
2396 pos.Z += m_appearance.HipOffset; 2391 {
2397 2392 m_log.WarnFormat("[SCENEPRESENCE] A child agent is attempting to send out avatar data");
2393 return;
2394 }
2395
2398 remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this); 2396 remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this);
2399 m_scene.StatsReporter.AddAgentUpdates(1); 2397 m_scene.StatsReporter.AddAgentUpdates(1);
2400 } 2398 }
@@ -2437,6 +2435,12 @@ namespace OpenSim.Region.Framework.Scenes
2437 m_perfMonMS = Util.EnvironmentTickCount(); 2435 m_perfMonMS = Util.EnvironmentTickCount();
2438 2436
2439 // only send update from root agents to other clients; children are only "listening posts" 2437 // only send update from root agents to other clients; children are only "listening posts"
2438 if (IsChildAgent)
2439 {
2440 m_log.Warn("[SCENEPRESENCE] attempt to send update from a childagent");
2441 return;
2442 }
2443
2440 int count = 0; 2444 int count = 0;
2441 m_scene.ForEachScenePresence(delegate(ScenePresence sp) 2445 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
2442 { 2446 {
@@ -2460,29 +2464,20 @@ namespace OpenSim.Region.Framework.Scenes
2460 // the inventory arrives 2464 // the inventory arrives
2461 // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); 2465 // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
2462 2466
2463 Vector3 pos = m_pos;
2464 pos.Z += m_appearance.HipOffset;
2465
2466 m_controllingClient.SendAvatarDataImmediate(this); 2467 m_controllingClient.SendAvatarDataImmediate(this);
2468 m_controllingClient.SendAppearance(m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes());
2467 2469
2468 SendInitialFullUpdateToAllClients(); 2470 SendInitialFullUpdateToAllClients();
2469 } 2471 }
2470 2472
2471 /// <summary> 2473 /// <summary>
2472 /// Tell the client for this scene presence what items it should be wearing now
2473 /// </summary>
2474 public void SendWearables()
2475 {
2476 m_log.DebugFormat("[SCENE]: Received request for wearables of {0}", Name);
2477
2478 ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
2479 }
2480
2481 /// <summary>
2482 /// 2474 ///
2483 /// </summary> 2475 /// </summary>
2484 public void SendAppearanceToAllOtherAgents() 2476 public void SendAppearanceToAllOtherAgents()
2485 { 2477 {
2478// DEBUG ON
2479 m_log.WarnFormat("[SP] Send appearance from {0} to all other agents",m_uuid);
2480// DEBUG OFF
2486 m_perfMonMS = Util.EnvironmentTickCount(); 2481 m_perfMonMS = Util.EnvironmentTickCount();
2487 2482
2488 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2483 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
@@ -2502,87 +2497,13 @@ namespace OpenSim.Region.Framework.Scenes
2502 /// <param name="avatar"></param> 2497 /// <param name="avatar"></param>
2503 public void SendAppearanceToOtherAgent(ScenePresence avatar) 2498 public void SendAppearanceToOtherAgent(ScenePresence avatar)
2504 { 2499 {
2500// DEBUG ON
2501 m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
2502// DEBUG OFF
2505 avatar.ControllingClient.SendAppearance( 2503 avatar.ControllingClient.SendAppearance(
2506 m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); 2504 m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes());
2507 } 2505 }
2508 2506
2509 /// <summary>
2510 /// Set appearance data (textureentry and slider settings) received from the client
2511 /// </summary>
2512 /// <param name="texture"></param>
2513 /// <param name="visualParam"></param>
2514 public void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams)
2515 {
2516 if (m_physicsActor != null)
2517 {
2518 if (!IsChildAgent)
2519 {
2520 // This may seem like it's redundant, remove the avatar from the physics scene
2521 // just to add it back again, but it saves us from having to update
2522 // 3 variables 10 times a second.
2523 bool flyingTemp = m_physicsActor.Flying;
2524 RemoveFromPhysicalScene();
2525 //m_scene.PhysicsScene.RemoveAvatar(m_physicsActor);
2526
2527 //PhysicsActor = null;
2528
2529 AddToPhysicalScene(flyingTemp);
2530 }
2531 }
2532
2533 #region Bake Cache Check
2534
2535 if (textureEntry != null)
2536 {
2537 for (int i = 0; i < BAKE_INDICES.Length; i++)
2538 {
2539 int j = BAKE_INDICES[i];
2540 Primitive.TextureEntryFace face = textureEntry.FaceTextures[j];
2541
2542 if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE)
2543 {
2544 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
2545 {
2546 m_log.Warn("[APPEARANCE]: Missing baked texture " + face.TextureID + " (" + j + ") for avatar " + this.Name);
2547 this.ControllingClient.SendRebakeAvatarTextures(face.TextureID);
2548 }
2549 }
2550 }
2551
2552 }
2553
2554
2555 #endregion Bake Cache Check
2556
2557 m_appearance.SetAppearance(textureEntry, visualParams);
2558 if (m_appearance.AvatarHeight > 0)
2559 SetHeight(m_appearance.AvatarHeight);
2560
2561 // This is not needed, because only the transient data changed
2562 //AvatarData adata = new AvatarData(m_appearance);
2563 //m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata);
2564
2565 SendAppearanceToAllOtherAgents();
2566 if (!m_startAnimationSet)
2567 {
2568 Animator.UpdateMovementAnimations();
2569 m_startAnimationSet = true;
2570 }
2571
2572 Vector3 pos = m_pos;
2573 pos.Z += m_appearance.HipOffset;
2574
2575 m_controllingClient.SendAvatarDataImmediate(this);
2576 }
2577
2578 public void SetWearable(int wearableId, AvatarWearable wearable)
2579 {
2580 m_appearance.SetWearable(wearableId, wearable);
2581 AvatarData adata = new AvatarData(m_appearance);
2582 m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata);
2583 m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
2584 }
2585
2586 // Because appearance setting is in a module, we actually need 2507 // Because appearance setting is in a module, we actually need
2587 // to give it access to our appearance directly, otherwise we 2508 // to give it access to our appearance directly, otherwise we
2588 // get a synchronization issue. 2509 // get a synchronization issue.
@@ -3017,6 +2938,9 @@ namespace OpenSim.Region.Framework.Scenes
3017 2938
3018 cAgent.AlwaysRun = m_setAlwaysRun; 2939 cAgent.AlwaysRun = m_setAlwaysRun;
3019 2940
2941 cAgent.Appearance = new AvatarAppearance(m_appearance);
2942
2943/*
3020 try 2944 try
3021 { 2945 {
3022 // We might not pass the Wearables in all cases... 2946 // We might not pass the Wearables in all cases...
@@ -3056,14 +2980,14 @@ namespace OpenSim.Region.Framework.Scenes
3056 { 2980 {
3057 //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count); 2981 //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count);
3058 int i = 0; 2982 int i = 0;
3059 AttachmentData[] attachs = new AttachmentData[attPoints.Count]; 2983 AvatarAttachment[] attachs = new AvatarAttachment[attPoints.Count];
3060 foreach (int point in attPoints) 2984 foreach (int point in attPoints)
3061 { 2985 {
3062 attachs[i++] = new AttachmentData(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point)); 2986 attachs[i++] = new AvatarAttachment(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point));
3063 } 2987 }
3064 cAgent.Attachments = attachs; 2988 cAgent.Attachments = attachs;
3065 } 2989 }
3066 2990*/
3067 lock (scriptedcontrols) 2991 lock (scriptedcontrols)
3068 { 2992 {
3069 ControllerData[] controls = new ControllerData[scriptedcontrols.Count]; 2993 ControllerData[] controls = new ControllerData[scriptedcontrols.Count];
@@ -3090,6 +3014,9 @@ namespace OpenSim.Region.Framework.Scenes
3090 3014
3091 public void CopyFrom(AgentData cAgent) 3015 public void CopyFrom(AgentData cAgent)
3092 { 3016 {
3017// DEBUG ON
3018 m_log.ErrorFormat("[SCENEPRESENCE] CALLING COPYFROM");
3019// DEBUG OFF
3093 m_originRegionID = cAgent.RegionID; 3020 m_originRegionID = cAgent.RegionID;
3094 3021
3095 m_callbackURI = cAgent.CallbackURI; 3022 m_callbackURI = cAgent.CallbackURI;
@@ -3115,6 +3042,9 @@ namespace OpenSim.Region.Framework.Scenes
3115 m_godLevel = cAgent.GodLevel; 3042 m_godLevel = cAgent.GodLevel;
3116 m_setAlwaysRun = cAgent.AlwaysRun; 3043 m_setAlwaysRun = cAgent.AlwaysRun;
3117 3044
3045 m_appearance = new AvatarAppearance(cAgent.Appearance);
3046
3047/*
3118 uint i = 0; 3048 uint i = 0;
3119 try 3049 try
3120 { 3050 {
@@ -3127,15 +3057,17 @@ namespace OpenSim.Region.Framework.Scenes
3127 UUID assetId = cAgent.Wearables[n + 1]; 3057 UUID assetId = cAgent.Wearables[n + 1];
3128 wears[i++] = new AvatarWearable(itemId, assetId); 3058 wears[i++] = new AvatarWearable(itemId, assetId);
3129 } 3059 }
3130 m_appearance.Wearables = wears; 3060 // m_appearance.Wearables = wears;
3131 Primitive.TextureEntry te; 3061 Primitive.TextureEntry textures = null;
3132 if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1) 3062 if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1)
3133 te = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length); 3063 textures = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length);
3134 else 3064
3135 te = AvatarAppearance.GetDefaultTexture(); 3065 byte[] visuals = null;
3136 if ((cAgent.VisualParams == null) || (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT)) 3066
3137 cAgent.VisualParams = AvatarAppearance.GetDefaultVisualParams(); 3067 if ((cAgent.VisualParams != null) && (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT))
3138 m_appearance.SetAppearance(te, (byte[])cAgent.VisualParams.Clone()); 3068 visuals = (byte[])cAgent.VisualParams.Clone();
3069
3070 m_appearance = new AvatarAppearance(cAgent.AgentID,wears,textures,visuals);
3139 } 3071 }
3140 catch (Exception e) 3072 catch (Exception e)
3141 { 3073 {
@@ -3148,14 +3080,14 @@ namespace OpenSim.Region.Framework.Scenes
3148 if (cAgent.Attachments != null) 3080 if (cAgent.Attachments != null)
3149 { 3081 {
3150 m_appearance.ClearAttachments(); 3082 m_appearance.ClearAttachments();
3151 foreach (AttachmentData att in cAgent.Attachments) 3083 foreach (AvatarAttachment att in cAgent.Attachments)
3152 { 3084 {
3153 m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID); 3085 m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID);
3154 } 3086 }
3155 } 3087 }
3156 } 3088 }
3157 catch { } 3089 catch { }
3158 3090*/
3159 try 3091 try
3160 { 3092 {
3161 lock (scriptedcontrols) 3093 lock (scriptedcontrols)
@@ -3724,15 +3656,16 @@ namespace OpenSim.Region.Framework.Scenes
3724 return; 3656 return;
3725 } 3657 }
3726 3658
3727 List<int> attPoints = m_appearance.GetAttachedPoints(); 3659 List<AvatarAttachment> attachments = m_appearance.GetAttachments();
3728 foreach (int p in attPoints) 3660 foreach (AvatarAttachment attach in attachments)
3729 { 3661 {
3730 if (m_isDeleted) 3662 if (m_isDeleted)
3731 return; 3663 return;
3732 3664
3733 UUID itemID = m_appearance.GetAttachedItem(p); 3665 int p = attach.AttachPoint;
3666 UUID itemID = attach.ItemID;
3734 3667
3735 //UUID assetID = m_appearance.GetAttachedAsset(p); 3668 //UUID assetID = attach.AssetID;
3736 // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down 3669 // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down
3737 // But they're not used anyway, the item is being looked up for now, so let's proceed. 3670 // But they're not used anyway, the item is being looked up for now, so let's proceed.
3738 //if (UUID.Zero == assetID) 3671 //if (UUID.Zero == assetID)
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 95908fc..e661ca9 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -804,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
804 private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlTextReader reader) 804 private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlTextReader reader)
805 { 805 {
806 byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry")); 806 byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry"));
807 shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length); 807 shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length);
808 } 808 }
809 809
810 private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlTextReader reader) 810 private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlTextReader reader)