aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs21
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs263
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs76
4 files changed, 318 insertions, 44 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
index 6bed95f..eca576d 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
@@ -190,8 +190,15 @@ namespace OpenSim.Region.ClientStack.Linden
190 { 190 {
191 if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) 191 if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
192 { 192 {
193 cacheItems[i].TextureID = 193 Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex];
194 textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID; 194 if (face == null)
195 {
196 textureEntry.CreateFace(cacheItems[i].TextureIndex);
197 textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID =
198 AppearanceManager.DEFAULT_AVATAR_TEXTURE;
199 continue;
200 }
201 cacheItems[i].TextureID =face.TextureID;
195 if (m_scene.AssetService != null) 202 if (m_scene.AssetService != null)
196 cacheItems[i].TextureAsset = 203 cacheItems[i].TextureAsset =
197 m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); 204 m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString());
@@ -213,8 +220,16 @@ namespace OpenSim.Region.ClientStack.Linden
213 { 220 {
214 if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) 221 if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
215 { 222 {
223 Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex];
224 if (face == null)
225 {
226 textureEntry.CreateFace(cacheItems[i].TextureIndex);
227 textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID =
228 AppearanceManager.DEFAULT_AVATAR_TEXTURE;
229 continue;
230 }
216 cacheItems[i].TextureID = 231 cacheItems[i].TextureID =
217 textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID; 232 face.TextureID;
218 } 233 }
219 else 234 else
220 { 235 {
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index a070ff8..691326c 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -677,20 +677,53 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
677 private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance) 677 private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance)
678 { 678 {
679 IInventoryService invService = m_scene.InventoryService; 679 IInventoryService invService = m_scene.InventoryService;
680 680 bool resetwearable = false;
681 if (invService.GetRootFolder(userID) != null) 681 if (invService.GetRootFolder(userID) != null)
682 { 682 {
683 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 683 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
684 { 684 {
685 for (int j = 0; j < appearance.Wearables[i].Count; j++) 685 for (int j = 0; j < appearance.Wearables[i].Count; j++)
686 { 686 {
687 // Check if the default wearables are not set
687 if (appearance.Wearables[i][j].ItemID == UUID.Zero) 688 if (appearance.Wearables[i][j].ItemID == UUID.Zero)
689 {
690 switch ((WearableType) i)
691 {
692 case WearableType.Eyes:
693 case WearableType.Hair:
694 case WearableType.Shape:
695 case WearableType.Skin:
696 //case WearableType.Underpants:
697 TryAndRepair((WearableType)i, invService, userID, appearance);
698 resetwearable = true;
699 m_log.Warn("[AVFACTORY]: UUID.Zero Wearables, passing fake values.");
700 resetwearable = true;
701 break;
702
703 }
688 continue; 704 continue;
705 }
689 706
690 // Ignore ruth's assets 707 // Ignore ruth's assets except for the body parts! missing body parts fail avatar appearance on V1
691 if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID) 708 if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID)
709 {
710 switch ((WearableType)i)
711 {
712 case WearableType.Eyes:
713 case WearableType.Hair:
714 case WearableType.Shape:
715 case WearableType.Skin:
716 //case WearableType.Underpants:
717 TryAndRepair((WearableType)i, invService, userID, appearance);
718
719 m_log.WarnFormat("[AVFACTORY]: {0} Default Wearables, passing existing values.", (WearableType)i);
720 resetwearable = true;
721 break;
722
723 }
692 continue; 724 continue;
693 725 }
726
694 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); 727 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID);
695 baseItem = invService.GetItem(baseItem); 728 baseItem = invService.GetItem(baseItem);
696 729
@@ -704,17 +737,239 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
704 "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default", 737 "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default",
705 appearance.Wearables[i][j].ItemID, (WearableType)i); 738 appearance.Wearables[i][j].ItemID, (WearableType)i);
706 739
707 appearance.Wearables[i].RemoveItem(appearance.Wearables[i][j].ItemID); 740 TryAndRepair((WearableType)i, invService, userID, appearance);
741 resetwearable = true;
742
708 } 743 }
709 } 744 }
710 } 745 }
746
747 // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
748 if (appearance.Wearables[(int) WearableType.Eyes] == null)
749 {
750 m_log.WarnFormat("[AVFACTORY]: {0} Eyes are Null, passing existing values.", (WearableType.Eyes));
751
752 TryAndRepair(WearableType.Eyes, invService, userID, appearance);
753 resetwearable = true;
754 }
755 else
756 {
757 if (appearance.Wearables[(int) WearableType.Eyes][0].ItemID == UUID.Zero)
758 {
759 m_log.WarnFormat("[AVFACTORY]: Eyes are UUID.Zero are broken, {0} {1}",
760 appearance.Wearables[(int) WearableType.Eyes][0].ItemID,
761 appearance.Wearables[(int) WearableType.Eyes][0].AssetID);
762 TryAndRepair(WearableType.Eyes, invService, userID, appearance);
763 resetwearable = true;
764
765 }
766
767 }
768 // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
769 if (appearance.Wearables[(int)WearableType.Shape] == null)
770 {
771 m_log.WarnFormat("[AVFACTORY]: {0} shape is Null, passing existing values.", (WearableType.Shape));
772
773 TryAndRepair(WearableType.Shape, invService, userID, appearance);
774 resetwearable = true;
775 }
776 else
777 {
778 if (appearance.Wearables[(int)WearableType.Shape][0].ItemID == UUID.Zero)
779 {
780 m_log.WarnFormat("[AVFACTORY]: Shape is UUID.Zero and broken, {0} {1}",
781 appearance.Wearables[(int)WearableType.Shape][0].ItemID,
782 appearance.Wearables[(int)WearableType.Shape][0].AssetID);
783 TryAndRepair(WearableType.Shape, invService, userID, appearance);
784 resetwearable = true;
785
786 }
787
788 }
789 // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
790 if (appearance.Wearables[(int)WearableType.Hair] == null)
791 {
792 m_log.WarnFormat("[AVFACTORY]: {0} Hair is Null, passing existing values.", (WearableType.Hair));
793
794 TryAndRepair(WearableType.Hair, invService, userID, appearance);
795 resetwearable = true;
796 }
797 else
798 {
799 if (appearance.Wearables[(int)WearableType.Hair][0].ItemID == UUID.Zero)
800 {
801 m_log.WarnFormat("[AVFACTORY]: Hair is UUID.Zero and broken, {0} {1}",
802 appearance.Wearables[(int)WearableType.Hair][0].ItemID,
803 appearance.Wearables[(int)WearableType.Hair][0].AssetID);
804 TryAndRepair(WearableType.Hair, invService, userID, appearance);
805 resetwearable = true;
806
807 }
808
809 }
810 // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
811 if (appearance.Wearables[(int)WearableType.Skin] == null)
812 {
813 m_log.WarnFormat("[AVFACTORY]: {0} Skin is Null, passing existing values.", (WearableType.Skin));
814
815 TryAndRepair(WearableType.Skin, invService, userID, appearance);
816 resetwearable = true;
817 }
818 else
819 {
820 if (appearance.Wearables[(int)WearableType.Skin][0].ItemID == UUID.Zero)
821 {
822 m_log.WarnFormat("[AVFACTORY]: Skin is UUID.Zero and broken, {0} {1}",
823 appearance.Wearables[(int)WearableType.Skin][0].ItemID,
824 appearance.Wearables[(int)WearableType.Skin][0].AssetID);
825 TryAndRepair(WearableType.Skin, invService, userID, appearance);
826 resetwearable = true;
827
828 }
829
830 }
831 if (resetwearable)
832 {
833 ScenePresence presence = null;
834 if (m_scene.TryGetScenePresence(userID, out presence))
835 {
836 presence.ControllingClient.SendWearables(presence.Appearance.Wearables,
837 presence.Appearance.Serial++);
838 }
839 }
840
711 } 841 }
712 else 842 else
713 { 843 {
714 m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID); 844 m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID);
715 } 845 }
716 } 846 }
847 private void TryAndRepair(WearableType type, IInventoryService invService, UUID userID,AvatarAppearance appearance)
848 {
849 UUID defaultwearable = GetDefaultItem(type);
850 if (defaultwearable != UUID.Zero)
851 {
852 UUID newInvItem = UUID.Random();
853 InventoryItemBase itembase = new InventoryItemBase(newInvItem, userID)
854 {
855 AssetID =
856 defaultwearable,
857 AssetType
858 =
859 (int)
860 AssetType
861 .Bodypart,
862 CreatorId
863 =
864 userID
865 .ToString
866 (),
867 //InvType = (int)InventoryType.Wearable,
868
869 Description
870 =
871 "Failed Wearable Replacement",
872 Folder =
873 invService
874 .GetFolderForType
875 (userID,
876 AssetType
877 .Bodypart)
878 .ID,
879 Flags = (uint) type,
880 Name = Enum.GetName(typeof (WearableType), type),
881 BasePermissions = (uint) PermissionMask.Copy,
882 CurrentPermissions = (uint) PermissionMask.Copy,
883 EveryOnePermissions = (uint) PermissionMask.Copy,
884 GroupPermissions = (uint) PermissionMask.Copy,
885 NextPermissions = (uint) PermissionMask.Copy
886 };
887 invService.AddItem(itembase);
888 UUID LinkInvItem = UUID.Random();
889 itembase = new InventoryItemBase(LinkInvItem, userID)
890 {
891 AssetID =
892 newInvItem,
893 AssetType
894 =
895 (int)
896 AssetType
897 .Link,
898 CreatorId
899 =
900 userID
901 .ToString
902 (),
903 InvType = (int) InventoryType.Wearable,
904
905 Description
906 =
907 "Failed Wearable Replacement",
908 Folder =
909 invService
910 .GetFolderForType
911 (userID,
912 AssetType
913 .CurrentOutfitFolder)
914 .ID,
915 Flags = (uint) type,
916 Name = Enum.GetName(typeof (WearableType), type),
917 BasePermissions = (uint) PermissionMask.Copy,
918 CurrentPermissions = (uint) PermissionMask.Copy,
919 EveryOnePermissions = (uint) PermissionMask.Copy,
920 GroupPermissions = (uint) PermissionMask.Copy,
921 NextPermissions = (uint) PermissionMask.Copy
922 };
923 invService.AddItem(itembase);
924 appearance.Wearables[(int)type] = new AvatarWearable(newInvItem, GetDefaultItem(type));
925 ScenePresence presence = null;
926 if (m_scene.TryGetScenePresence(userID, out presence))
927 {
928 m_scene.SendInventoryUpdate(presence.ControllingClient,
929 invService.GetFolderForType(userID,
930 AssetType
931 .CurrentOutfitFolder),
932 false, true);
933 }
934 }
935 }
936 private UUID GetDefaultItem(WearableType wearable)
937 {
938 // These are Urban male.. but it doesn't matter as long as the assets exist.
939 UUID ret = UUID.Zero;
940 switch (wearable)
941 {
942 case WearableType.Eyes:
943 ret = new UUID("46d7f979-c060-0ad6-5d3c-8de38c941c8d");
944 break;
945 case WearableType.Hair:
946 ret = new UUID("21ae002d-57af-441a-81ff-86f5f674b9b9");
947 break;
948 case WearableType.Pants:
949 ret = new UUID("e3440698-48fd-41ac-af9b-f680547cbef2");
950 break;
951 case WearableType.Shape:
952 ret = new UUID("7c1f1354-2aba-4e55-8357-1545c2c003ce");
953 break;
954 case WearableType.Shirt:
955 ret = new UUID("f8fefa00-b019-4072-9c04-ff79c65348b9");
956 break;
957 case WearableType.Shoes:
958 ret = new UUID("6455d2cf-0ee1-4c9a-9812-da03371bf719");
959 break;
960 case WearableType.Skin:
961 ret = new UUID("29c99e80-cf59-4fa0-9f8e-e4a1ccaf2fa3");
962 break;
963 case WearableType.Socks:
964 ret = new UUID("96472ac3-1e18-49e5-b2e4-17c03791ea96");
965 break;
966 case WearableType.Underpants:
967 ret = new UUID("d6c7b174-8a2d-473f-a80f-3b7d7b7b3a96");
968 break;
969 }
717 970
971 return ret;
972 }
718 #endregion 973 #endregion
719 974
720 #region Client Event Handlers 975 #region Client Event Handlers
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 9cdcd96..0bed66e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5109,7 +5109,7 @@ namespace OpenSim.Region.Framework.Scenes
5109 { 5109 {
5110 if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) 5110 if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)
5111 { 5111 {
5112 if (grp.RootPart.Expires <= DateTime.Now) 5112 if (grp.GetSittingAvatarsCount() == 0 && grp.RootPart.Expires <= DateTime.Now)
5113 DeleteSceneObject(grp, false); 5113 DeleteSceneObject(grp, false);
5114 } 5114 }
5115 } 5115 }
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 510cbe9..754bc86 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -995,63 +995,67 @@ namespace OpenSim.Region.Physics.OdePlugin
995 995
996 996
997 d.ContactGeom maxContact = curContact; 997 d.ContactGeom maxContact = curContact;
998// if (IgnoreNegSides && curContact.side1 < 0) 998 // if (IgnoreNegSides && curContact.side1 < 0)
999// maxContact.depth = float.MinValue; 999 // maxContact.depth = float.MinValue;
1000 1000
1001 d.ContactGeom minContact = curContact; 1001 d.ContactGeom minContact = curContact;
1002// if (IgnoreNegSides && curContact.side1 < 0) 1002 // if (IgnoreNegSides && curContact.side1 < 0)
1003// minContact.depth = float.MaxValue; 1003 // minContact.depth = float.MaxValue;
1004 1004
1005 IntPtr Joint; 1005 IntPtr Joint;
1006 bool FeetCollision = false; 1006 bool FeetCollision = false;
1007 int ncontacts = 0; 1007 int ncontacts = 0;
1008 1008
1009 1009
1010 int i = 0; 1010 int i = 0;
1011 1011
1012 while (true) 1012 while (true)
1013 { 1013 {
1014 if (m_global_contactcount >= maxContactsbeforedeath)
1015 break;
1016 1014
1017// if (!(IgnoreNegSides && curContact.side1 < 0)) 1015// if (!(IgnoreNegSides && curContact.side1 < 0))
1016 {
1017 bool noskip = true;
1018 if (dop1ava)
1018 { 1019 {
1019 bool noskip = true; 1020 if (!(((OdeCharacter)p1).Collide(g1, false, ref curContact, ref FeetCollision)))
1020 if (dop1ava)
1021 {
1022 if (!(((OdeCharacter)p1).Collide(g1,false, ref curContact, ref FeetCollision)))
1023 1021
1024 noskip = false; 1022 noskip = false;
1025 } 1023 }
1026 else if (dop2ava) 1024 else if (dop2ava)
1027 { 1025 {
1028 if (!(((OdeCharacter)p2).Collide(g2,true, ref curContact, ref FeetCollision))) 1026 if (!(((OdeCharacter)p2).Collide(g2, true, ref curContact, ref FeetCollision)))
1029 noskip = false; 1027 noskip = false;
1030 } 1028 }
1031 1029
1032 if (noskip) 1030 if (noskip)
1033 { 1031 {
1034 m_global_contactcount++; 1032 m_global_contactcount++;
1035 ncontacts++; 1033 if (m_global_contactcount >= maxContactsbeforedeath)
1034 break;
1036 1035
1037 Joint = CreateContacJoint(ref curContact, mu, bounce, cfm, erpscale, dscale); 1036 ncontacts++;
1038 d.JointAttach(Joint, b1, b2);
1039 1037
1040 if (curContact.depth > maxContact.depth) 1038 Joint = CreateContacJoint(ref curContact, mu, bounce, cfm, erpscale, dscale);
1041 maxContact = curContact; 1039 if (Joint == IntPtr.Zero)
1040 break;
1042 1041
1043 if (curContact.depth < minContact.depth) 1042 d.JointAttach(Joint, b1, b2);
1044 minContact = curContact;
1045 }
1046 }
1047 1043
1048 if (++i >= count) 1044 if (curContact.depth > maxContact.depth)
1049 break; 1045 maxContact = curContact;
1050 1046
1051 if (!GetCurContactGeom(i, ref curContact)) 1047 if (curContact.depth < minContact.depth)
1052 break; 1048 minContact = curContact;
1049 }
1053 } 1050 }
1054 1051
1052 if (++i >= count)
1053 break;
1054
1055 if (!GetCurContactGeom(i, ref curContact))
1056 break;
1057 }
1058
1055 if (ncontacts > 0) 1059 if (ncontacts > 0)
1056 { 1060 {
1057 ContactPoint maxDepthContact = new ContactPoint( 1061 ContactPoint maxDepthContact = new ContactPoint(