aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2013-01-26 18:00:43 +0100
committerMelanie2013-01-26 18:00:43 +0100
commitac1d09bb0ceb2ab08a56f574563d6f08485138bd (patch)
treed07b4cae822e136d9f0126352668f4c953805c21 /OpenSim/Region
parentbug fix: crash when too many collisions on a ode step (diff)
parent* This update is ugly as sin, but it 'fills in the blanks' of your appearance... (diff)
downloadopensim-SC_OLD-ac1d09bb0ceb2ab08a56f574563d6f08485138bd.zip
opensim-SC_OLD-ac1d09bb0ceb2ab08a56f574563d6f08485138bd.tar.gz
opensim-SC_OLD-ac1d09bb0ceb2ab08a56f574563d6f08485138bd.tar.bz2
opensim-SC_OLD-ac1d09bb0ceb2ab08a56f574563d6f08485138bd.tar.xz
Merge branch 'teravuswork' into avination
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs21
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs263
2 files changed, 277 insertions, 7 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 7ec2860..fd442dc 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -674,20 +674,53 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
674 private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance) 674 private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance)
675 { 675 {
676 IInventoryService invService = m_scene.InventoryService; 676 IInventoryService invService = m_scene.InventoryService;
677 677 bool resetwearable = false;
678 if (invService.GetRootFolder(userID) != null) 678 if (invService.GetRootFolder(userID) != null)
679 { 679 {
680 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 680 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
681 { 681 {
682 for (int j = 0; j < appearance.Wearables[i].Count; j++) 682 for (int j = 0; j < appearance.Wearables[i].Count; j++)
683 { 683 {
684 // Check if the default wearables are not set
684 if (appearance.Wearables[i][j].ItemID == UUID.Zero) 685 if (appearance.Wearables[i][j].ItemID == UUID.Zero)
686 {
687 switch ((WearableType) i)
688 {
689 case WearableType.Eyes:
690 case WearableType.Hair:
691 case WearableType.Shape:
692 case WearableType.Skin:
693 //case WearableType.Underpants:
694 TryAndRepair((WearableType)i, invService, userID, appearance);
695 resetwearable = true;
696 m_log.Warn("[AVFACTORY]: UUID.Zero Wearables, passing fake values.");
697 resetwearable = true;
698 break;
699
700 }
685 continue; 701 continue;
702 }
686 703
687 // Ignore ruth's assets 704 // Ignore ruth's assets except for the body parts! missing body parts fail avatar appearance on V1
688 if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID) 705 if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID)
706 {
707 switch ((WearableType)i)
708 {
709 case WearableType.Eyes:
710 case WearableType.Hair:
711 case WearableType.Shape:
712 case WearableType.Skin:
713 //case WearableType.Underpants:
714 TryAndRepair((WearableType)i, invService, userID, appearance);
715
716 m_log.WarnFormat("[AVFACTORY]: {0} Default Wearables, passing existing values.", (WearableType)i);
717 resetwearable = true;
718 break;
719
720 }
689 continue; 721 continue;
690 722 }
723
691 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); 724 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID);
692 baseItem = invService.GetItem(baseItem); 725 baseItem = invService.GetItem(baseItem);
693 726
@@ -701,17 +734,239 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
701 "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default", 734 "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default",
702 appearance.Wearables[i][j].ItemID, (WearableType)i); 735 appearance.Wearables[i][j].ItemID, (WearableType)i);
703 736
704 appearance.Wearables[i].RemoveItem(appearance.Wearables[i][j].ItemID); 737 TryAndRepair((WearableType)i, invService, userID, appearance);
738 resetwearable = true;
739
705 } 740 }
706 } 741 }
707 } 742 }
743
744 // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
745 if (appearance.Wearables[(int) WearableType.Eyes] == null)
746 {
747 m_log.WarnFormat("[AVFACTORY]: {0} Eyes are Null, passing existing values.", (WearableType.Eyes));
748
749 TryAndRepair(WearableType.Eyes, invService, userID, appearance);
750 resetwearable = true;
751 }
752 else
753 {
754 if (appearance.Wearables[(int) WearableType.Eyes][0].ItemID == UUID.Zero)
755 {
756 m_log.WarnFormat("[AVFACTORY]: Eyes are UUID.Zero are broken, {0} {1}",
757 appearance.Wearables[(int) WearableType.Eyes][0].ItemID,
758 appearance.Wearables[(int) WearableType.Eyes][0].AssetID);
759 TryAndRepair(WearableType.Eyes, invService, userID, appearance);
760 resetwearable = true;
761
762 }
763
764 }
765 // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
766 if (appearance.Wearables[(int)WearableType.Shape] == null)
767 {
768 m_log.WarnFormat("[AVFACTORY]: {0} shape is Null, passing existing values.", (WearableType.Shape));
769
770 TryAndRepair(WearableType.Shape, invService, userID, appearance);
771 resetwearable = true;
772 }
773 else
774 {
775 if (appearance.Wearables[(int)WearableType.Shape][0].ItemID == UUID.Zero)
776 {
777 m_log.WarnFormat("[AVFACTORY]: Shape is UUID.Zero and broken, {0} {1}",
778 appearance.Wearables[(int)WearableType.Shape][0].ItemID,
779 appearance.Wearables[(int)WearableType.Shape][0].AssetID);
780 TryAndRepair(WearableType.Shape, invService, userID, appearance);
781 resetwearable = true;
782
783 }
784
785 }
786 // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
787 if (appearance.Wearables[(int)WearableType.Hair] == null)
788 {
789 m_log.WarnFormat("[AVFACTORY]: {0} Hair is Null, passing existing values.", (WearableType.Hair));
790
791 TryAndRepair(WearableType.Hair, invService, userID, appearance);
792 resetwearable = true;
793 }
794 else
795 {
796 if (appearance.Wearables[(int)WearableType.Hair][0].ItemID == UUID.Zero)
797 {
798 m_log.WarnFormat("[AVFACTORY]: Hair is UUID.Zero and broken, {0} {1}",
799 appearance.Wearables[(int)WearableType.Hair][0].ItemID,
800 appearance.Wearables[(int)WearableType.Hair][0].AssetID);
801 TryAndRepair(WearableType.Hair, invService, userID, appearance);
802 resetwearable = true;
803
804 }
805
806 }
807 // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
808 if (appearance.Wearables[(int)WearableType.Skin] == null)
809 {
810 m_log.WarnFormat("[AVFACTORY]: {0} Skin is Null, passing existing values.", (WearableType.Skin));
811
812 TryAndRepair(WearableType.Skin, invService, userID, appearance);
813 resetwearable = true;
814 }
815 else
816 {
817 if (appearance.Wearables[(int)WearableType.Skin][0].ItemID == UUID.Zero)
818 {
819 m_log.WarnFormat("[AVFACTORY]: Skin is UUID.Zero and broken, {0} {1}",
820 appearance.Wearables[(int)WearableType.Skin][0].ItemID,
821 appearance.Wearables[(int)WearableType.Skin][0].AssetID);
822 TryAndRepair(WearableType.Skin, invService, userID, appearance);
823 resetwearable = true;
824
825 }
826
827 }
828 if (resetwearable)
829 {
830 ScenePresence presence = null;
831 if (m_scene.TryGetScenePresence(userID, out presence))
832 {
833 presence.ControllingClient.SendWearables(presence.Appearance.Wearables,
834 presence.Appearance.Serial++);
835 }
836 }
837
708 } 838 }
709 else 839 else
710 { 840 {
711 m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID); 841 m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID);
712 } 842 }
713 } 843 }
844 private void TryAndRepair(WearableType type, IInventoryService invService, UUID userID,AvatarAppearance appearance)
845 {
846 UUID defaultwearable = GetDefaultItem(type);
847 if (defaultwearable != UUID.Zero)
848 {
849 UUID newInvItem = UUID.Random();
850 InventoryItemBase itembase = new InventoryItemBase(newInvItem, userID)
851 {
852 AssetID =
853 defaultwearable,
854 AssetType
855 =
856 (int)
857 AssetType
858 .Bodypart,
859 CreatorId
860 =
861 userID
862 .ToString
863 (),
864 //InvType = (int)InventoryType.Wearable,
865
866 Description
867 =
868 "Failed Wearable Replacement",
869 Folder =
870 invService
871 .GetFolderForType
872 (userID,
873 AssetType
874 .Bodypart)
875 .ID,
876 Flags = (uint) type,
877 Name = Enum.GetName(typeof (WearableType), type),
878 BasePermissions = (uint) PermissionMask.Copy,
879 CurrentPermissions = (uint) PermissionMask.Copy,
880 EveryOnePermissions = (uint) PermissionMask.Copy,
881 GroupPermissions = (uint) PermissionMask.Copy,
882 NextPermissions = (uint) PermissionMask.Copy
883 };
884 invService.AddItem(itembase);
885 UUID LinkInvItem = UUID.Random();
886 itembase = new InventoryItemBase(LinkInvItem, userID)
887 {
888 AssetID =
889 newInvItem,
890 AssetType
891 =
892 (int)
893 AssetType
894 .Link,
895 CreatorId
896 =
897 userID
898 .ToString
899 (),
900 InvType = (int) InventoryType.Wearable,
901
902 Description
903 =
904 "Failed Wearable Replacement",
905 Folder =
906 invService
907 .GetFolderForType
908 (userID,
909 AssetType
910 .CurrentOutfitFolder)
911 .ID,
912 Flags = (uint) type,
913 Name = Enum.GetName(typeof (WearableType), type),
914 BasePermissions = (uint) PermissionMask.Copy,
915 CurrentPermissions = (uint) PermissionMask.Copy,
916 EveryOnePermissions = (uint) PermissionMask.Copy,
917 GroupPermissions = (uint) PermissionMask.Copy,
918 NextPermissions = (uint) PermissionMask.Copy
919 };
920 invService.AddItem(itembase);
921 appearance.Wearables[(int)type] = new AvatarWearable(newInvItem, GetDefaultItem(type));
922 ScenePresence presence = null;
923 if (m_scene.TryGetScenePresence(userID, out presence))
924 {
925 m_scene.SendInventoryUpdate(presence.ControllingClient,
926 invService.GetFolderForType(userID,
927 AssetType
928 .CurrentOutfitFolder),
929 false, true);
930 }
931 }
932 }
933 private UUID GetDefaultItem(WearableType wearable)
934 {
935 // These are Urban male.. but it doesn't matter as long as the assets exist.
936 UUID ret = UUID.Zero;
937 switch (wearable)
938 {
939 case WearableType.Eyes:
940 ret = new UUID("46d7f979-c060-0ad6-5d3c-8de38c941c8d");
941 break;
942 case WearableType.Hair:
943 ret = new UUID("21ae002d-57af-441a-81ff-86f5f674b9b9");
944 break;
945 case WearableType.Pants:
946 ret = new UUID("e3440698-48fd-41ac-af9b-f680547cbef2");
947 break;
948 case WearableType.Shape:
949 ret = new UUID("7c1f1354-2aba-4e55-8357-1545c2c003ce");
950 break;
951 case WearableType.Shirt:
952 ret = new UUID("f8fefa00-b019-4072-9c04-ff79c65348b9");
953 break;
954 case WearableType.Shoes:
955 ret = new UUID("6455d2cf-0ee1-4c9a-9812-da03371bf719");
956 break;
957 case WearableType.Skin:
958 ret = new UUID("29c99e80-cf59-4fa0-9f8e-e4a1ccaf2fa3");
959 break;
960 case WearableType.Socks:
961 ret = new UUID("96472ac3-1e18-49e5-b2e4-17c03791ea96");
962 break;
963 case WearableType.Underpants:
964 ret = new UUID("d6c7b174-8a2d-473f-a80f-3b7d7b7b3a96");
965 break;
966 }
714 967
968 return ret;
969 }
715 #endregion 970 #endregion
716 971
717 #region Client Event Handlers 972 #region Client Event Handlers