aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs171
2 files changed, 48 insertions, 130 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c3edeb3..f0f8d55 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -120,7 +120,6 @@ namespace OpenSim.Region.Framework.Scenes
120 120
121 protected IXMLRPC m_xmlrpcModule; 121 protected IXMLRPC m_xmlrpcModule;
122 protected IWorldComm m_worldCommModule; 122 protected IWorldComm m_worldCommModule;
123 protected IAvatarFactory m_AvatarFactory;
124 protected IConfigSource m_config; 123 protected IConfigSource m_config;
125 protected IRegionSerialiserModule m_serialiser; 124 protected IRegionSerialiserModule m_serialiser;
126 protected IDialogModule m_dialogModule; 125 protected IDialogModule m_dialogModule;
@@ -415,11 +414,6 @@ namespace OpenSim.Region.Framework.Scenes
415 414
416 public IAttachmentsModule AttachmentsModule { get; set; } 415 public IAttachmentsModule AttachmentsModule { get; set; }
417 416
418 public IAvatarFactory AvatarFactory
419 {
420 get { return m_AvatarFactory; }
421 }
422
423 public ICapabilitiesModule CapsModule 417 public ICapabilitiesModule CapsModule
424 { 418 {
425 get { return m_capsModule; } 419 get { return m_capsModule; }
@@ -1193,7 +1187,6 @@ namespace OpenSim.Region.Framework.Scenes
1193 m_xmlrpcModule = RequestModuleInterface<IXMLRPC>(); 1187 m_xmlrpcModule = RequestModuleInterface<IXMLRPC>();
1194 m_worldCommModule = RequestModuleInterface<IWorldComm>(); 1188 m_worldCommModule = RequestModuleInterface<IWorldComm>();
1195 XferManager = RequestModuleInterface<IXfer>(); 1189 XferManager = RequestModuleInterface<IXfer>();
1196 m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
1197 AttachmentsModule = RequestModuleInterface<IAttachmentsModule>(); 1190 AttachmentsModule = RequestModuleInterface<IAttachmentsModule>();
1198 m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); 1191 m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
1199 m_dialogModule = RequestModuleInterface<IDialogModule>(); 1192 m_dialogModule = RequestModuleInterface<IDialogModule>();
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 7bf0a99..8cbf4dc 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -76,7 +76,6 @@ namespace OpenSim.Region.Framework.Scenes
76 76
77 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 77 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
78 78
79 private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
80// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); 79// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes();
81 private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); 80 private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags));
82 private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); 81 private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f);
@@ -143,8 +142,6 @@ namespace OpenSim.Region.Framework.Scenes
143 142
144 private SendCourseLocationsMethod m_sendCourseLocationsMethod; 143 private SendCourseLocationsMethod m_sendCourseLocationsMethod;
145 144
146 private bool m_startAnimationSet;
147
148 //private Vector3 m_requestedSitOffset = new Vector3(); 145 //private Vector3 m_requestedSitOffset = new Vector3();
149 146
150 private Vector3 m_LastFinitePos; 147 private Vector3 m_LastFinitePos;
@@ -778,13 +775,14 @@ namespace OpenSim.Region.Framework.Scenes
778 SetDirectionVectors(); 775 SetDirectionVectors();
779 } 776 }
780 777
778/*
781 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, 779 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams,
782 AvatarWearable[] wearables) 780 AvatarWearable[] wearables)
783 : this(client, world, reginfo) 781 : this(client, world, reginfo)
784 { 782 {
785 m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams); 783 m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams);
786 } 784 }
787 785*/
788 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) 786 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance)
789 : this(client, world, reginfo) 787 : this(client, world, reginfo)
790 { 788 {
@@ -798,8 +796,6 @@ namespace OpenSim.Region.Framework.Scenes
798 796
799 public void RegisterToEvents() 797 public void RegisterToEvents()
800 { 798 {
801 m_controllingClient.OnRequestWearables += SendWearables;
802 m_controllingClient.OnSetAppearance += SetAppearance;
803 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; 799 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement;
804 //m_controllingClient.OnCompleteMovementToRegion += SendInitialData; 800 //m_controllingClient.OnCompleteMovementToRegion += SendInitialData;
805 m_controllingClient.OnAgentUpdate += HandleAgentUpdate; 801 m_controllingClient.OnAgentUpdate += HandleAgentUpdate;
@@ -1208,7 +1204,7 @@ namespace OpenSim.Region.Framework.Scenes
1208 /// <summary> 1204 /// <summary>
1209 /// Sets avatar height in the phyiscs plugin 1205 /// Sets avatar height in the phyiscs plugin
1210 /// </summary> 1206 /// </summary>
1211 internal void SetHeight(float height) 1207 public void SetHeight(float height)
1212 { 1208 {
1213 m_avHeight = height; 1209 m_avHeight = height;
1214 if (PhysicsActor != null && !IsChildAgent) 1210 if (PhysicsActor != null && !IsChildAgent)
@@ -1272,7 +1268,6 @@ namespace OpenSim.Region.Framework.Scenes
1272 if (friendsModule != null) 1268 if (friendsModule != null)
1273 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); 1269 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
1274 } 1270 }
1275
1276 } 1271 }
1277 1272
1278 /// <summary> 1273 /// <summary>
@@ -2742,9 +2737,12 @@ namespace OpenSim.Region.Framework.Scenes
2742 if (m_appearance.Texture == null) 2737 if (m_appearance.Texture == null)
2743 return; 2738 return;
2744 2739
2745 Vector3 pos = m_pos; 2740 if (IsChildAgent)
2746 pos.Z += m_appearance.HipOffset; 2741 {
2747 2742 m_log.WarnFormat("[SCENEPRESENCE] A child agent is attempting to send out avatar data");
2743 return;
2744 }
2745
2748 remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this); 2746 remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this);
2749 m_scene.StatsReporter.AddAgentUpdates(1); 2747 m_scene.StatsReporter.AddAgentUpdates(1);
2750 } 2748 }
@@ -2787,6 +2785,12 @@ namespace OpenSim.Region.Framework.Scenes
2787 m_perfMonMS = Util.EnvironmentTickCount(); 2785 m_perfMonMS = Util.EnvironmentTickCount();
2788 2786
2789 // only send update from root agents to other clients; children are only "listening posts" 2787 // only send update from root agents to other clients; children are only "listening posts"
2788 if (IsChildAgent)
2789 {
2790 m_log.Warn("[SCENEPRESENCE] attempt to send update from a childagent");
2791 return;
2792 }
2793
2790 int count = 0; 2794 int count = 0;
2791 m_scene.ForEachScenePresence(delegate(ScenePresence sp) 2795 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
2792 { 2796 {
@@ -2810,29 +2814,20 @@ namespace OpenSim.Region.Framework.Scenes
2810 // the inventory arrives 2814 // the inventory arrives
2811 // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); 2815 // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
2812 2816
2813 Vector3 pos = m_pos;
2814 pos.Z += m_appearance.HipOffset;
2815
2816 m_controllingClient.SendAvatarDataImmediate(this); 2817 m_controllingClient.SendAvatarDataImmediate(this);
2818 m_controllingClient.SendAppearance(m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes());
2817 2819
2818 SendInitialFullUpdateToAllClients(); 2820 SendInitialFullUpdateToAllClients();
2819 } 2821 }
2820 2822
2821 /// <summary> 2823 /// <summary>
2822 /// Tell the client for this scene presence what items it should be wearing now
2823 /// </summary>
2824 public void SendWearables()
2825 {
2826 m_log.DebugFormat("[SCENE]: Received request for wearables of {0}", Name);
2827
2828 ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
2829 }
2830
2831 /// <summary>
2832 /// 2824 ///
2833 /// </summary> 2825 /// </summary>
2834 public void SendAppearanceToAllOtherAgents() 2826 public void SendAppearanceToAllOtherAgents()
2835 { 2827 {
2828// DEBUG ON
2829 m_log.WarnFormat("[SP] Send appearance from {0} to all other agents",m_uuid);
2830// DEBUG OFF
2836 m_perfMonMS = Util.EnvironmentTickCount(); 2831 m_perfMonMS = Util.EnvironmentTickCount();
2837 2832
2838 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2833 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
@@ -2852,96 +2847,13 @@ namespace OpenSim.Region.Framework.Scenes
2852 /// <param name="avatar"></param> 2847 /// <param name="avatar"></param>
2853 public void SendAppearanceToOtherAgent(ScenePresence avatar) 2848 public void SendAppearanceToOtherAgent(ScenePresence avatar)
2854 { 2849 {
2850// DEBUG ON
2851 m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
2852// DEBUG OFF
2855 avatar.ControllingClient.SendAppearance( 2853 avatar.ControllingClient.SendAppearance(
2856 m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); 2854 m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes());
2857 } 2855 }
2858 2856
2859 /// <summary>
2860 /// Set appearance data (textureentry and slider settings) received from the client
2861 /// </summary>
2862 /// <param name="texture"></param>
2863 /// <param name="visualParam"></param>
2864 public void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams)
2865 {
2866 lock (m_syncRoot)
2867 {
2868// MT: Commented this because it's no longer needed.
2869// It used to be that the avatar height was calculated from the visual
2870// params, so any call to this method could change the physical actor's
2871// height. Now the height is supplied in the agent circuit data and never
2872// changes here. So, we can leave physics alone.
2873//
2874// if (m_physicsActor != null)
2875// {
2876// if (!IsChildAgent)
2877// {
2878// // This may seem like it's redundant, remove the avatar from the physics scene
2879// // just to add it back again, but it saves us from having to update
2880// // 3 variables 10 times a second.
2881// bool flyingTemp = m_physicsActor.Flying;
2882// RemoveFromPhysicalScene();
2883// //m_scene.PhysicsScene.RemoveAvatar(m_physicsActor);
2884//
2885// //PhysicsActor = null;
2886//
2887// AddToPhysicalScene(flyingTemp);
2888// }
2889// }
2890
2891 #region Bake Cache Check
2892
2893 if (textureEntry != null)
2894 {
2895 for (int i = 0; i < BAKE_INDICES.Length; i++)
2896 {
2897 int j = BAKE_INDICES[i];
2898 Primitive.TextureEntryFace face = textureEntry.FaceTextures[j];
2899
2900 if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE)
2901 {
2902 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
2903 {
2904 m_log.Warn("[APPEARANCE]: Missing baked texture " + face.TextureID + " (" + j + ") for avatar " + this.Name);
2905 this.ControllingClient.SendRebakeAvatarTextures(face.TextureID);
2906 }
2907 }
2908 }
2909
2910 }
2911
2912
2913 #endregion Bake Cache Check
2914
2915 m_appearance.SetAppearance(textureEntry, visualParams);
2916 if (m_appearance.AvatarHeight > 0)
2917 SetHeight(m_appearance.AvatarHeight);
2918
2919 // This is not needed, because only the transient data changed
2920 //AvatarData adata = new AvatarData(m_appearance);
2921 //m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata);
2922
2923 SendAppearanceToAllOtherAgents();
2924 if (!m_startAnimationSet)
2925 {
2926 Animator.UpdateMovementAnimations();
2927 m_startAnimationSet = true;
2928 }
2929
2930 Vector3 pos = m_pos;
2931 pos.Z += m_appearance.HipOffset;
2932
2933 m_controllingClient.SendAvatarDataImmediate(this);
2934 }
2935 }
2936
2937 public void SetWearable(int wearableId, AvatarWearable wearable)
2938 {
2939 m_appearance.SetWearable(wearableId, wearable);
2940 AvatarData adata = new AvatarData(m_appearance);
2941 m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata);
2942 m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
2943 }
2944
2945 // Because appearance setting is in a module, we actually need 2857 // Because appearance setting is in a module, we actually need
2946 // to give it access to our appearance directly, otherwise we 2858 // to give it access to our appearance directly, otherwise we
2947 // get a synchronization issue. 2859 // get a synchronization issue.
@@ -3335,6 +3247,8 @@ namespace OpenSim.Region.Framework.Scenes
3335 3247
3336 public void CopyTo(AgentData cAgent) 3248 public void CopyTo(AgentData cAgent)
3337 { 3249 {
3250 cAgent.CallbackURI = m_callbackURI;
3251
3338 cAgent.AgentID = UUID; 3252 cAgent.AgentID = UUID;
3339 cAgent.RegionID = Scene.RegionInfo.RegionID; 3253 cAgent.RegionID = Scene.RegionInfo.RegionID;
3340 3254
@@ -3374,6 +3288,9 @@ namespace OpenSim.Region.Framework.Scenes
3374 3288
3375 cAgent.AlwaysRun = m_setAlwaysRun; 3289 cAgent.AlwaysRun = m_setAlwaysRun;
3376 3290
3291 cAgent.Appearance = new AvatarAppearance(m_appearance);
3292
3293/*
3377 try 3294 try
3378 { 3295 {
3379 // We might not pass the Wearables in all cases... 3296 // We might not pass the Wearables in all cases...
@@ -3413,14 +3330,14 @@ namespace OpenSim.Region.Framework.Scenes
3413 { 3330 {
3414 //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count); 3331 //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count);
3415 int i = 0; 3332 int i = 0;
3416 AttachmentData[] attachs = new AttachmentData[attPoints.Count]; 3333 AvatarAttachment[] attachs = new AvatarAttachment[attPoints.Count];
3417 foreach (int point in attPoints) 3334 foreach (int point in attPoints)
3418 { 3335 {
3419 attachs[i++] = new AttachmentData(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point)); 3336 attachs[i++] = new AvatarAttachment(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point));
3420 } 3337 }
3421 cAgent.Attachments = attachs; 3338 cAgent.Attachments = attachs;
3422 } 3339 }
3423 3340*/
3424 lock (scriptedcontrols) 3341 lock (scriptedcontrols)
3425 { 3342 {
3426 ControllerData[] controls = new ControllerData[scriptedcontrols.Count]; 3343 ControllerData[] controls = new ControllerData[scriptedcontrols.Count];
@@ -3447,6 +3364,9 @@ namespace OpenSim.Region.Framework.Scenes
3447 3364
3448 public void CopyFrom(AgentData cAgent) 3365 public void CopyFrom(AgentData cAgent)
3449 { 3366 {
3367// DEBUG ON
3368 m_log.ErrorFormat("[SCENEPRESENCE] CALLING COPYFROM");
3369// DEBUG OFF
3450 m_originRegionID = cAgent.RegionID; 3370 m_originRegionID = cAgent.RegionID;
3451 3371
3452 m_callbackURI = cAgent.CallbackURI; 3372 m_callbackURI = cAgent.CallbackURI;
@@ -3473,6 +3393,9 @@ namespace OpenSim.Region.Framework.Scenes
3473 m_godLevel = cAgent.GodLevel; 3393 m_godLevel = cAgent.GodLevel;
3474 m_setAlwaysRun = cAgent.AlwaysRun; 3394 m_setAlwaysRun = cAgent.AlwaysRun;
3475 3395
3396 m_appearance = new AvatarAppearance(cAgent.Appearance);
3397
3398/*
3476 uint i = 0; 3399 uint i = 0;
3477 try 3400 try
3478 { 3401 {
@@ -3485,15 +3408,17 @@ namespace OpenSim.Region.Framework.Scenes
3485 UUID assetId = cAgent.Wearables[n + 1]; 3408 UUID assetId = cAgent.Wearables[n + 1];
3486 wears[i++] = new AvatarWearable(itemId, assetId); 3409 wears[i++] = new AvatarWearable(itemId, assetId);
3487 } 3410 }
3488 m_appearance.Wearables = wears; 3411 // m_appearance.Wearables = wears;
3489 Primitive.TextureEntry te; 3412 Primitive.TextureEntry textures = null;
3490 if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1) 3413 if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1)
3491 te = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length); 3414 textures = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length);
3492 else 3415
3493 te = AvatarAppearance.GetDefaultTexture(); 3416 byte[] visuals = null;
3494 if ((cAgent.VisualParams == null) || (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT)) 3417
3495 cAgent.VisualParams = AvatarAppearance.GetDefaultVisualParams(); 3418 if ((cAgent.VisualParams != null) && (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT))
3496 m_appearance.SetAppearance(te, (byte[])cAgent.VisualParams.Clone()); 3419 visuals = (byte[])cAgent.VisualParams.Clone();
3420
3421 m_appearance = new AvatarAppearance(cAgent.AgentID,wears,textures,visuals);
3497 } 3422 }
3498 catch (Exception e) 3423 catch (Exception e)
3499 { 3424 {
@@ -3506,14 +3431,14 @@ namespace OpenSim.Region.Framework.Scenes
3506 if (cAgent.Attachments != null) 3431 if (cAgent.Attachments != null)
3507 { 3432 {
3508 m_appearance.ClearAttachments(); 3433 m_appearance.ClearAttachments();
3509 foreach (AttachmentData att in cAgent.Attachments) 3434 foreach (AvatarAttachment att in cAgent.Attachments)
3510 { 3435 {
3511 m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID); 3436 m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID);
3512 } 3437 }
3513 } 3438 }
3514 } 3439 }
3515 catch { } 3440 catch { }
3516 3441*/
3517 try 3442 try
3518 { 3443 {
3519 lock (scriptedcontrols) 3444 lock (scriptedcontrols)