diff options
author | Oren Hurvitz | 2014-07-01 15:26:22 +0300 |
---|---|---|
committer | Oren Hurvitz | 2014-07-21 09:12:16 +0100 |
commit | 46c1d4e3191842b6a2ac3a91e027a7b6a2c8c44e (patch) | |
tree | ac86b1abf9e20225099cf4e75d9ab73077c4fd07 /OpenSim/Tools/pCampBot/Bot.cs | |
parent | Write some pCampBot messages to the log (diff) | |
download | opensim-SC-46c1d4e3191842b6a2ac3a91e027a7b6a2c8c44e.zip opensim-SC-46c1d4e3191842b6a2ac3a91e027a7b6a2c8c44e.tar.gz opensim-SC-46c1d4e3191842b6a2ac3a91e027a7b6a2c8c44e.tar.bz2 opensim-SC-46c1d4e3191842b6a2ac3a91e027a7b6a2c8c44e.tar.xz |
pCamBot: download Meshes
The "Sculpt" field in prims is used for both Sculpties (where the assets are Textures), and real meshes. Meshes require a different download URL than textures.
Diffstat (limited to 'OpenSim/Tools/pCampBot/Bot.cs')
-rw-r--r-- | OpenSim/Tools/pCampBot/Bot.cs | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs index c743568..bd5eb81 100644 --- a/OpenSim/Tools/pCampBot/Bot.cs +++ b/OpenSim/Tools/pCampBot/Bot.cs | |||
@@ -635,7 +635,7 @@ namespace pCampBot | |||
635 | { | 635 | { |
636 | if (prim.Textures.DefaultTexture.TextureID != UUID.Zero) | 636 | if (prim.Textures.DefaultTexture.TextureID != UUID.Zero) |
637 | { | 637 | { |
638 | GetTexture(prim.Textures.DefaultTexture.TextureID); | 638 | GetTextureOrMesh(prim.Textures.DefaultTexture.TextureID, true); |
639 | } | 639 | } |
640 | 640 | ||
641 | for (int i = 0; i < prim.Textures.FaceTextures.Length; i++) | 641 | for (int i = 0; i < prim.Textures.FaceTextures.Length; i++) |
@@ -647,32 +647,56 @@ namespace pCampBot | |||
647 | UUID textureID = prim.Textures.FaceTextures[i].TextureID; | 647 | UUID textureID = prim.Textures.FaceTextures[i].TextureID; |
648 | 648 | ||
649 | if (textureID != UUID.Zero) | 649 | if (textureID != UUID.Zero) |
650 | GetTexture(textureID); | 650 | GetTextureOrMesh(textureID, true); |
651 | } | 651 | } |
652 | } | 652 | } |
653 | } | 653 | } |
654 | 654 | ||
655 | if (prim.Sculpt != null && prim.Sculpt.SculptTexture != UUID.Zero) | 655 | if (prim.Sculpt != null && prim.Sculpt.SculptTexture != UUID.Zero) |
656 | GetTexture(prim.Sculpt.SculptTexture); | 656 | { |
657 | bool mesh = (prim.Sculpt.Type == SculptType.Mesh); | ||
658 | GetTextureOrMesh(prim.Sculpt.SculptTexture, !mesh); | ||
659 | } | ||
657 | } | 660 | } |
658 | } | 661 | } |
659 | 662 | ||
660 | private void GetTexture(UUID textureID) | 663 | private void GetTextureOrMesh(UUID assetID, bool texture) |
661 | { | 664 | { |
662 | lock (Manager.AssetsReceived) | 665 | lock (Manager.AssetsReceived) |
663 | { | 666 | { |
664 | // Don't request assets more than once. | 667 | // Don't request assets more than once. |
665 | if (Manager.AssetsReceived.ContainsKey(textureID)) | 668 | if (Manager.AssetsReceived.ContainsKey(assetID)) |
666 | return; | 669 | return; |
667 | 670 | ||
668 | Manager.AssetsReceived[textureID] = false; | 671 | Manager.AssetsReceived[assetID] = false; |
669 | Client.Assets.RequestImage(textureID, ImageType.Normal, Asset_TextureCallback_Texture); | 672 | } |
673 | |||
674 | try | ||
675 | { | ||
676 | if (texture) | ||
677 | Client.Assets.RequestImage(assetID, ImageType.Normal, Asset_TextureCallback_Texture); | ||
678 | else | ||
679 | Client.Assets.RequestMesh(assetID, Asset_MeshCallback); | ||
680 | } | ||
681 | catch (Exception e) | ||
682 | { | ||
683 | m_log.Warn(string.Format("Error requesting {0} {1}", texture ? "texture" : "mesh", assetID), e); | ||
670 | } | 684 | } |
671 | } | 685 | } |
672 | 686 | ||
673 | public void Asset_TextureCallback_Texture(TextureRequestState state, AssetTexture assetTexture) | 687 | public void Asset_TextureCallback_Texture(TextureRequestState state, AssetTexture assetTexture) |
674 | { | 688 | { |
675 | //TODO: Implement texture saving and applying | 689 | if (state == TextureRequestState.Finished) |
690 | { | ||
691 | lock (Manager.AssetsReceived) | ||
692 | Manager.AssetsReceived[assetTexture.AssetID] = true; | ||
693 | } | ||
694 | } | ||
695 | |||
696 | private void Asset_MeshCallback(bool success, AssetMesh assetMesh) | ||
697 | { | ||
698 | lock (Manager.AssetsReceived) | ||
699 | Manager.AssetsReceived[assetMesh.AssetID] = success; | ||
676 | } | 700 | } |
677 | 701 | ||
678 | public void Asset_ReceivedCallback(AssetDownload transfer, Asset asset) | 702 | public void Asset_ReceivedCallback(AssetDownload transfer, Asset asset) |