diff options
author | Justin Clark-Casey (justincc) | 2014-02-20 18:40:21 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-02-20 18:40:21 +0000 |
commit | 4d1426e77d62e2552b371a75d9bc8d190829b554 (patch) | |
tree | bdfc959d4dc27d80e88f25d982fb59c1260f938a /OpenSim/Region/CoreModules/Avatar/AvatarFactory | |
parent | add newRegion parameter to CrossAgentToNewRegion event and trigger the event ... (diff) | |
download | opensim-SC_OLD-4d1426e77d62e2552b371a75d9bc8d190829b554.zip opensim-SC_OLD-4d1426e77d62e2552b371a75d9bc8d190829b554.tar.gz opensim-SC_OLD-4d1426e77d62e2552b371a75d9bc8d190829b554.tar.bz2 opensim-SC_OLD-4d1426e77d62e2552b371a75d9bc8d190829b554.tar.xz |
For now, do not replacing missing wearables with default wearables if itme details cannot be found.
This is causing many issues on OSGrid, possibly due to teleporting timing differences with simulators hosted in different places or HG teleports
Added a bit more logging for debug purposes.
See http://opensimulator.org/mantis/view.php?id=6939
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/AvatarFactory')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 334 |
1 files changed, 190 insertions, 144 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 09cc998..7edfc61 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -690,184 +690,229 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
690 | private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance) | 690 | private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance) |
691 | { | 691 | { |
692 | IInventoryService invService = m_scene.InventoryService; | 692 | IInventoryService invService = m_scene.InventoryService; |
693 | bool resetwearable = false; | 693 | |
694 | if (invService.GetRootFolder(userID) != null) | 694 | if (invService.GetRootFolder(userID) != null) |
695 | { | 695 | { |
696 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) | 696 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) |
697 | { | 697 | { |
698 | for (int j = 0; j < appearance.Wearables[i].Count; j++) | 698 | for (int j = 0; j < appearance.Wearables[i].Count; j++) |
699 | { | 699 | { |
700 | // Check if the default wearables are not set | ||
701 | if (appearance.Wearables[i][j].ItemID == UUID.Zero) | 700 | if (appearance.Wearables[i][j].ItemID == UUID.Zero) |
702 | { | 701 | { |
703 | switch ((WearableType) i) | 702 | m_log.WarnFormat( |
704 | { | 703 | "[AVFACTORY]: Wearable item {0}:{1} for user {2} unexpectedly UUID.Zero. Ignoring.", |
705 | case WearableType.Eyes: | 704 | i, j, userID); |
706 | case WearableType.Hair: | 705 | |
707 | case WearableType.Shape: | ||
708 | case WearableType.Skin: | ||
709 | //case WearableType.Underpants: | ||
710 | TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance); | ||
711 | resetwearable = true; | ||
712 | m_log.Warn("[AVFACTORY]: UUID.Zero Wearables, passing fake values."); | ||
713 | resetwearable = true; | ||
714 | break; | ||
715 | |||
716 | } | ||
717 | continue; | 706 | continue; |
718 | } | 707 | } |
719 | 708 | ||
720 | // Ignore ruth's assets except for the body parts! missing body parts fail avatar appearance on V1 | 709 | // Ignore ruth's assets |
721 | if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID) | 710 | if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID) |
722 | { | ||
723 | switch ((WearableType)i) | ||
724 | { | ||
725 | case WearableType.Eyes: | ||
726 | case WearableType.Hair: | ||
727 | case WearableType.Shape: | ||
728 | case WearableType.Skin: | ||
729 | //case WearableType.Underpants: | ||
730 | TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance); | ||
731 | |||
732 | m_log.WarnFormat("[AVFACTORY]: {0} Default Wearables, passing existing values.", (WearableType)i); | ||
733 | resetwearable = true; | ||
734 | break; | ||
735 | |||
736 | } | ||
737 | continue; | 711 | continue; |
738 | } | 712 | |
739 | |||
740 | InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); | 713 | InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); |
741 | baseItem = invService.GetItem(baseItem); | 714 | baseItem = invService.GetItem(baseItem); |
742 | 715 | ||
743 | if (baseItem != null) | 716 | if (baseItem != null) |
744 | { | 717 | { |
745 | appearance.Wearables[i].Add(appearance.Wearables[i][j].ItemID, baseItem.AssetID); | 718 | appearance.Wearables[i].Add(appearance.Wearables[i][j].ItemID, baseItem.AssetID); |
746 | int unmodifiedWearableIndexForClosure = i; | ||
747 | m_scene.AssetService.Get(baseItem.AssetID.ToString(), this, | ||
748 | delegate(string x, object y, AssetBase z) | ||
749 | { | ||
750 | if (z == null) | ||
751 | { | ||
752 | TryAndRepairBrokenWearable( | ||
753 | (WearableType)unmodifiedWearableIndexForClosure, invService, | ||
754 | userID, appearance); | ||
755 | } | ||
756 | }); | ||
757 | } | 719 | } |
758 | else | 720 | else |
759 | { | 721 | { |
760 | m_log.ErrorFormat( | 722 | m_log.WarnFormat( |
761 | "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default", | 723 | "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default", |
762 | appearance.Wearables[i][j].ItemID, (WearableType)i); | 724 | appearance.Wearables[i][j].ItemID, (WearableType)i); |
763 | 725 | ||
764 | TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance); | 726 | appearance.Wearables[i].RemoveItem(appearance.Wearables[i][j].ItemID); |
765 | resetwearable = true; | ||
766 | |||
767 | } | 727 | } |
768 | } | 728 | } |
769 | } | 729 | } |
770 | |||
771 | // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason.... | ||
772 | if (appearance.Wearables[(int) WearableType.Eyes] == null) | ||
773 | { | ||
774 | m_log.WarnFormat("[AVFACTORY]: {0} Eyes are Null, passing existing values.", (WearableType.Eyes)); | ||
775 | |||
776 | TryAndRepairBrokenWearable(WearableType.Eyes, invService, userID, appearance); | ||
777 | resetwearable = true; | ||
778 | } | ||
779 | else | ||
780 | { | ||
781 | if (appearance.Wearables[(int) WearableType.Eyes][0].ItemID == UUID.Zero) | ||
782 | { | ||
783 | m_log.WarnFormat("[AVFACTORY]: Eyes are UUID.Zero are broken, {0} {1}", | ||
784 | appearance.Wearables[(int) WearableType.Eyes][0].ItemID, | ||
785 | appearance.Wearables[(int) WearableType.Eyes][0].AssetID); | ||
786 | TryAndRepairBrokenWearable(WearableType.Eyes, invService, userID, appearance); | ||
787 | resetwearable = true; | ||
788 | |||
789 | } | ||
790 | |||
791 | } | ||
792 | // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason.... | ||
793 | if (appearance.Wearables[(int)WearableType.Shape] == null) | ||
794 | { | ||
795 | m_log.WarnFormat("[AVFACTORY]: {0} shape is Null, passing existing values.", (WearableType.Shape)); | ||
796 | |||
797 | TryAndRepairBrokenWearable(WearableType.Shape, invService, userID, appearance); | ||
798 | resetwearable = true; | ||
799 | } | ||
800 | else | ||
801 | { | ||
802 | if (appearance.Wearables[(int)WearableType.Shape][0].ItemID == UUID.Zero) | ||
803 | { | ||
804 | m_log.WarnFormat("[AVFACTORY]: Shape is UUID.Zero and broken, {0} {1}", | ||
805 | appearance.Wearables[(int)WearableType.Shape][0].ItemID, | ||
806 | appearance.Wearables[(int)WearableType.Shape][0].AssetID); | ||
807 | TryAndRepairBrokenWearable(WearableType.Shape, invService, userID, appearance); | ||
808 | resetwearable = true; | ||
809 | |||
810 | } | ||
811 | |||
812 | } | ||
813 | // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason.... | ||
814 | if (appearance.Wearables[(int)WearableType.Hair] == null) | ||
815 | { | ||
816 | m_log.WarnFormat("[AVFACTORY]: {0} Hair is Null, passing existing values.", (WearableType.Hair)); | ||
817 | |||
818 | TryAndRepairBrokenWearable(WearableType.Hair, invService, userID, appearance); | ||
819 | resetwearable = true; | ||
820 | } | ||
821 | else | ||
822 | { | ||
823 | if (appearance.Wearables[(int)WearableType.Hair][0].ItemID == UUID.Zero) | ||
824 | { | ||
825 | m_log.WarnFormat("[AVFACTORY]: Hair is UUID.Zero and broken, {0} {1}", | ||
826 | appearance.Wearables[(int)WearableType.Hair][0].ItemID, | ||
827 | appearance.Wearables[(int)WearableType.Hair][0].AssetID); | ||
828 | TryAndRepairBrokenWearable(WearableType.Hair, invService, userID, appearance); | ||
829 | resetwearable = true; | ||
830 | |||
831 | } | ||
832 | |||
833 | } | ||
834 | // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason.... | ||
835 | if (appearance.Wearables[(int)WearableType.Skin] == null) | ||
836 | { | ||
837 | m_log.WarnFormat("[AVFACTORY]: {0} Skin is Null, passing existing values.", (WearableType.Skin)); | ||
838 | |||
839 | TryAndRepairBrokenWearable(WearableType.Skin, invService, userID, appearance); | ||
840 | resetwearable = true; | ||
841 | } | ||
842 | else | ||
843 | { | ||
844 | if (appearance.Wearables[(int)WearableType.Skin][0].ItemID == UUID.Zero) | ||
845 | { | ||
846 | m_log.WarnFormat("[AVFACTORY]: Skin is UUID.Zero and broken, {0} {1}", | ||
847 | appearance.Wearables[(int)WearableType.Skin][0].ItemID, | ||
848 | appearance.Wearables[(int)WearableType.Skin][0].AssetID); | ||
849 | TryAndRepairBrokenWearable(WearableType.Skin, invService, userID, appearance); | ||
850 | resetwearable = true; | ||
851 | |||
852 | } | ||
853 | |||
854 | } | ||
855 | if (resetwearable) | ||
856 | { | ||
857 | ScenePresence presence = null; | ||
858 | if (m_scene.TryGetScenePresence(userID, out presence)) | ||
859 | { | ||
860 | presence.ControllingClient.SendWearables(presence.Appearance.Wearables, | ||
861 | presence.Appearance.Serial++); | ||
862 | } | ||
863 | } | ||
864 | |||
865 | } | 730 | } |
866 | else | 731 | else |
867 | { | 732 | { |
868 | m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID); | 733 | m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID); |
869 | } | 734 | } |
735 | |||
736 | // IInventoryService invService = m_scene.InventoryService; | ||
737 | // bool resetwearable = false; | ||
738 | // if (invService.GetRootFolder(userID) != null) | ||
739 | // { | ||
740 | // for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) | ||
741 | // { | ||
742 | // for (int j = 0; j < appearance.Wearables[i].Count; j++) | ||
743 | // { | ||
744 | // // Check if the default wearables are not set | ||
745 | // if (appearance.Wearables[i][j].ItemID == UUID.Zero) | ||
746 | // { | ||
747 | // switch ((WearableType) i) | ||
748 | // { | ||
749 | // case WearableType.Eyes: | ||
750 | // case WearableType.Hair: | ||
751 | // case WearableType.Shape: | ||
752 | // case WearableType.Skin: | ||
753 | // //case WearableType.Underpants: | ||
754 | // TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance); | ||
755 | // resetwearable = true; | ||
756 | // m_log.Warn("[AVFACTORY]: UUID.Zero Wearables, passing fake values."); | ||
757 | // resetwearable = true; | ||
758 | // break; | ||
759 | // | ||
760 | // } | ||
761 | // continue; | ||
762 | // } | ||
763 | // | ||
764 | // // Ignore ruth's assets except for the body parts! missing body parts fail avatar appearance on V1 | ||
765 | // if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID) | ||
766 | // { | ||
767 | // switch ((WearableType)i) | ||
768 | // { | ||
769 | // case WearableType.Eyes: | ||
770 | // case WearableType.Hair: | ||
771 | // case WearableType.Shape: | ||
772 | // case WearableType.Skin: | ||
773 | // //case WearableType.Underpants: | ||
774 | // TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance); | ||
775 | // | ||
776 | // m_log.WarnFormat("[AVFACTORY]: {0} Default Wearables, passing existing values.", (WearableType)i); | ||
777 | // resetwearable = true; | ||
778 | // break; | ||
779 | // | ||
780 | // } | ||
781 | // continue; | ||
782 | // } | ||
783 | // | ||
784 | // InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); | ||
785 | // baseItem = invService.GetItem(baseItem); | ||
786 | // | ||
787 | // if (baseItem != null) | ||
788 | // { | ||
789 | // appearance.Wearables[i].Add(appearance.Wearables[i][j].ItemID, baseItem.AssetID); | ||
790 | // int unmodifiedWearableIndexForClosure = i; | ||
791 | // m_scene.AssetService.Get(baseItem.AssetID.ToString(), this, | ||
792 | // delegate(string x, object y, AssetBase z) | ||
793 | // { | ||
794 | // if (z == null) | ||
795 | // { | ||
796 | // TryAndRepairBrokenWearable( | ||
797 | // (WearableType)unmodifiedWearableIndexForClosure, invService, | ||
798 | // userID, appearance); | ||
799 | // } | ||
800 | // }); | ||
801 | // } | ||
802 | // else | ||
803 | // { | ||
804 | // m_log.ErrorFormat( | ||
805 | // "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default", | ||
806 | // appearance.Wearables[i][j].ItemID, (WearableType)i); | ||
807 | // | ||
808 | // TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance); | ||
809 | // resetwearable = true; | ||
810 | // | ||
811 | // } | ||
812 | // } | ||
813 | // } | ||
814 | // | ||
815 | // // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason.... | ||
816 | // if (appearance.Wearables[(int) WearableType.Eyes] == null) | ||
817 | // { | ||
818 | // m_log.WarnFormat("[AVFACTORY]: {0} Eyes are Null, passing existing values.", (WearableType.Eyes)); | ||
819 | // | ||
820 | // TryAndRepairBrokenWearable(WearableType.Eyes, invService, userID, appearance); | ||
821 | // resetwearable = true; | ||
822 | // } | ||
823 | // else | ||
824 | // { | ||
825 | // if (appearance.Wearables[(int) WearableType.Eyes][0].ItemID == UUID.Zero) | ||
826 | // { | ||
827 | // m_log.WarnFormat("[AVFACTORY]: Eyes are UUID.Zero are broken, {0} {1}", | ||
828 | // appearance.Wearables[(int) WearableType.Eyes][0].ItemID, | ||
829 | // appearance.Wearables[(int) WearableType.Eyes][0].AssetID); | ||
830 | // TryAndRepairBrokenWearable(WearableType.Eyes, invService, userID, appearance); | ||
831 | // resetwearable = true; | ||
832 | // | ||
833 | // } | ||
834 | // | ||
835 | // } | ||
836 | // // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason.... | ||
837 | // if (appearance.Wearables[(int)WearableType.Shape] == null) | ||
838 | // { | ||
839 | // m_log.WarnFormat("[AVFACTORY]: {0} shape is Null, passing existing values.", (WearableType.Shape)); | ||
840 | // | ||
841 | // TryAndRepairBrokenWearable(WearableType.Shape, invService, userID, appearance); | ||
842 | // resetwearable = true; | ||
843 | // } | ||
844 | // else | ||
845 | // { | ||
846 | // if (appearance.Wearables[(int)WearableType.Shape][0].ItemID == UUID.Zero) | ||
847 | // { | ||
848 | // m_log.WarnFormat("[AVFACTORY]: Shape is UUID.Zero and broken, {0} {1}", | ||
849 | // appearance.Wearables[(int)WearableType.Shape][0].ItemID, | ||
850 | // appearance.Wearables[(int)WearableType.Shape][0].AssetID); | ||
851 | // TryAndRepairBrokenWearable(WearableType.Shape, invService, userID, appearance); | ||
852 | // resetwearable = true; | ||
853 | // | ||
854 | // } | ||
855 | // | ||
856 | // } | ||
857 | // // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason.... | ||
858 | // if (appearance.Wearables[(int)WearableType.Hair] == null) | ||
859 | // { | ||
860 | // m_log.WarnFormat("[AVFACTORY]: {0} Hair is Null, passing existing values.", (WearableType.Hair)); | ||
861 | // | ||
862 | // TryAndRepairBrokenWearable(WearableType.Hair, invService, userID, appearance); | ||
863 | // resetwearable = true; | ||
864 | // } | ||
865 | // else | ||
866 | // { | ||
867 | // if (appearance.Wearables[(int)WearableType.Hair][0].ItemID == UUID.Zero) | ||
868 | // { | ||
869 | // m_log.WarnFormat("[AVFACTORY]: Hair is UUID.Zero and broken, {0} {1}", | ||
870 | // appearance.Wearables[(int)WearableType.Hair][0].ItemID, | ||
871 | // appearance.Wearables[(int)WearableType.Hair][0].AssetID); | ||
872 | // TryAndRepairBrokenWearable(WearableType.Hair, invService, userID, appearance); | ||
873 | // resetwearable = true; | ||
874 | // | ||
875 | // } | ||
876 | // | ||
877 | // } | ||
878 | // // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason.... | ||
879 | // if (appearance.Wearables[(int)WearableType.Skin] == null) | ||
880 | // { | ||
881 | // m_log.WarnFormat("[AVFACTORY]: {0} Skin is Null, passing existing values.", (WearableType.Skin)); | ||
882 | // | ||
883 | // TryAndRepairBrokenWearable(WearableType.Skin, invService, userID, appearance); | ||
884 | // resetwearable = true; | ||
885 | // } | ||
886 | // else | ||
887 | // { | ||
888 | // if (appearance.Wearables[(int)WearableType.Skin][0].ItemID == UUID.Zero) | ||
889 | // { | ||
890 | // m_log.WarnFormat("[AVFACTORY]: Skin is UUID.Zero and broken, {0} {1}", | ||
891 | // appearance.Wearables[(int)WearableType.Skin][0].ItemID, | ||
892 | // appearance.Wearables[(int)WearableType.Skin][0].AssetID); | ||
893 | // TryAndRepairBrokenWearable(WearableType.Skin, invService, userID, appearance); | ||
894 | // resetwearable = true; | ||
895 | // | ||
896 | // } | ||
897 | // | ||
898 | // } | ||
899 | // if (resetwearable) | ||
900 | // { | ||
901 | // ScenePresence presence = null; | ||
902 | // if (m_scene.TryGetScenePresence(userID, out presence)) | ||
903 | // { | ||
904 | // presence.ControllingClient.SendWearables(presence.Appearance.Wearables, | ||
905 | // presence.Appearance.Serial++); | ||
906 | // } | ||
907 | // } | ||
908 | // | ||
909 | // } | ||
910 | // else | ||
911 | // { | ||
912 | // m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID); | ||
913 | // } | ||
870 | } | 914 | } |
915 | |||
871 | private void TryAndRepairBrokenWearable(WearableType type, IInventoryService invService, UUID userID,AvatarAppearance appearance) | 916 | private void TryAndRepairBrokenWearable(WearableType type, IInventoryService invService, UUID userID,AvatarAppearance appearance) |
872 | { | 917 | { |
873 | UUID defaultwearable = GetDefaultItem(type); | 918 | UUID defaultwearable = GetDefaultItem(type); |
@@ -957,6 +1002,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
957 | } | 1002 | } |
958 | } | 1003 | } |
959 | } | 1004 | } |
1005 | |||
960 | private UUID GetDefaultItem(WearableType wearable) | 1006 | private UUID GetDefaultItem(WearableType wearable) |
961 | { | 1007 | { |
962 | // These are ruth | 1008 | // These are ruth |