diff options
author | Justin Clark-Casey (justincc) | 2011-07-11 03:35:29 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-07-11 03:35:29 +0100 |
commit | 0badf3718d98f579e0942e7c888986820d1250a7 (patch) | |
tree | 248c333e201b77d494c8ebc2325e854841e765cc /OpenSim/Region | |
parent | When a sculpt/mesh texture is received by a part on a callback request, don't... (diff) | |
download | opensim-SC-0badf3718d98f579e0942e7c888986820d1250a7.zip opensim-SC-0badf3718d98f579e0942e7c888986820d1250a7.tar.gz opensim-SC-0badf3718d98f579e0942e7c888986820d1250a7.tar.bz2 opensim-SC-0badf3718d98f579e0942e7c888986820d1250a7.tar.xz |
refactor: push the part of SceneObjectGroup.CheckSculptAndLoad() that actually deals with the part into a SceneObjectPart.CheckSculptAndLoad() method
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 32 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 34 |
2 files changed, 49 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a184445..fa23fcd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -3288,7 +3288,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3288 | 3288 | ||
3289 | return retmass; | 3289 | return retmass; |
3290 | } | 3290 | } |
3291 | 3291 | ||
3292 | /// <summary> | ||
3293 | /// If the object is a sculpt/mesh, retrieve the mesh data for each part and reinsert it into each shape so that | ||
3294 | /// the physics engine can use it. | ||
3295 | /// </summary> | ||
3296 | /// <remarks> | ||
3297 | /// When the physics engine has finished with it, the sculpt data is discarded to save memory. | ||
3298 | /// </remarks> | ||
3292 | public void CheckSculptAndLoad() | 3299 | public void CheckSculptAndLoad() |
3293 | { | 3300 | { |
3294 | if (IsDeleted) | 3301 | if (IsDeleted) |
@@ -3302,24 +3309,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3302 | SceneObjectPart[] parts = m_parts.GetArray(); | 3309 | SceneObjectPart[] parts = m_parts.GetArray(); |
3303 | 3310 | ||
3304 | for (int i = 0; i < parts.Length; i++) | 3311 | for (int i = 0; i < parts.Length; i++) |
3305 | { | 3312 | parts[i].CheckSculptAndLoad(); |
3306 | SceneObjectPart part = parts[i]; | ||
3307 | if (part.Shape.SculptEntry && part.Shape.SculptTexture != UUID.Zero) | ||
3308 | { | ||
3309 | // check if a previously decoded sculpt map has been cached | ||
3310 | if (File.Exists(System.IO.Path.Combine("j2kDecodeCache", "smap_" + part.Shape.SculptTexture.ToString()))) | ||
3311 | { | ||
3312 | part.SculptTextureCallback(part.Shape.SculptTexture, null); | ||
3313 | } | ||
3314 | else | ||
3315 | { | ||
3316 | m_scene.AssetService.Get( | ||
3317 | part.Shape.SculptTexture.ToString(), part, AssetReceived); | ||
3318 | } | ||
3319 | } | ||
3320 | } | ||
3321 | } | 3313 | } |
3322 | 3314 | ||
3315 | /// <summary> | ||
3316 | /// Handle an asset received asynchronously from the asset service. | ||
3317 | /// </summary> | ||
3318 | /// <param name="id"></param> | ||
3319 | /// <param name="sender"></param> | ||
3320 | /// <param name="asset"></param> | ||
3323 | protected void AssetReceived(string id, Object sender, AssetBase asset) | 3321 | protected void AssetReceived(string id, Object sender, AssetBase asset) |
3324 | { | 3322 | { |
3325 | SceneObjectPart sop = (SceneObjectPart)sender; | 3323 | SceneObjectPart sop = (SceneObjectPart)sender; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5b203e9..ce7c53a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Drawing; | 30 | using System.Drawing; |
31 | using System.IO; | ||
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using System.Runtime.Serialization; | 33 | using System.Runtime.Serialization; |
33 | using System.Security.Permissions; | 34 | using System.Security.Permissions; |
@@ -4563,6 +4564,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4563 | m_shape.PathTaperY = shapeBlock.PathTaperY; | 4564 | m_shape.PathTaperY = shapeBlock.PathTaperY; |
4564 | m_shape.PathTwist = shapeBlock.PathTwist; | 4565 | m_shape.PathTwist = shapeBlock.PathTwist; |
4565 | m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; | 4566 | m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; |
4567 | |||
4566 | if (PhysActor != null) | 4568 | if (PhysActor != null) |
4567 | { | 4569 | { |
4568 | PhysActor.Shape = m_shape; | 4570 | PhysActor.Shape = m_shape; |
@@ -4584,6 +4586,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
4584 | } | 4586 | } |
4585 | 4587 | ||
4586 | /// <summary> | 4588 | /// <summary> |
4589 | /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics | ||
4590 | /// engine can use it. | ||
4591 | /// </summary> | ||
4592 | /// <remarks> | ||
4593 | /// When the physics engine has finished with it, the sculpt data is discarded to save memory. | ||
4594 | /// </remarks> | ||
4595 | public void CheckSculptAndLoad() | ||
4596 | { | ||
4597 | // m_log.Debug("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId); | ||
4598 | |||
4599 | if (ParentGroup.IsDeleted) | ||
4600 | return; | ||
4601 | |||
4602 | if ((ParentGroup.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0) | ||
4603 | return; | ||
4604 | |||
4605 | if (Shape.SculptEntry && Shape.SculptTexture != UUID.Zero) | ||
4606 | { | ||
4607 | // check if a previously decoded sculpt map has been cached | ||
4608 | if (File.Exists(System.IO.Path.Combine("j2kDecodeCache", "smap_" + Shape.SculptTexture.ToString()))) | ||
4609 | { | ||
4610 | SculptTextureCallback(Shape.SculptTexture, null); | ||
4611 | } | ||
4612 | else | ||
4613 | { | ||
4614 | ParentGroup.Scene.AssetService.Get(Shape.SculptTexture.ToString(), this, AssetReceived); | ||
4615 | } | ||
4616 | } | ||
4617 | } | ||
4618 | |||
4619 | /// <summary> | ||
4587 | /// Update the textures on the part. | 4620 | /// Update the textures on the part. |
4588 | /// </summary> | 4621 | /// </summary> |
4589 | /// Added to handle bug in libsecondlife's TextureEntry.ToBytes() | 4622 | /// Added to handle bug in libsecondlife's TextureEntry.ToBytes() |
@@ -4819,6 +4852,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4819 | 4852 | ||
4820 | Inventory.ApplyNextOwnerPermissions(); | 4853 | Inventory.ApplyNextOwnerPermissions(); |
4821 | } | 4854 | } |
4855 | |||
4822 | public void UpdateLookAt() | 4856 | public void UpdateLookAt() |
4823 | { | 4857 | { |
4824 | try | 4858 | try |