diff options
author | Justin Clark-Casey (justincc) | 2011-07-16 04:22:57 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-07-16 04:22:57 +0100 |
commit | 2b68ac4ba31205a55f53f1b69629dd9ebbd66ef6 (patch) | |
tree | 36c44de8244635be032a95d3a2a67f48e68a9b05 /OpenSim/Region | |
parent | add test for resizing one part in a group (diff) | |
download | opensim-SC-2b68ac4ba31205a55f53f1b69629dd9ebbd66ef6.zip opensim-SC-2b68ac4ba31205a55f53f1b69629dd9ebbd66ef6.tar.gz opensim-SC-2b68ac4ba31205a55f53f1b69629dd9ebbd66ef6.tar.bz2 opensim-SC-2b68ac4ba31205a55f53f1b69629dd9ebbd66ef6.tar.xz |
refactor: Push all part resize code down into SceneObjectPart.Resize()
Diffstat (limited to 'OpenSim/Region')
4 files changed, 32 insertions, 56 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index df6908a..00d25c2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1217,12 +1217,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1217 | /// <param name="remoteClient"></param> | 1217 | /// <param name="remoteClient"></param> |
1218 | protected internal void UpdatePrimScale(uint localID, Vector3 scale, IClientAPI remoteClient) | 1218 | protected internal void UpdatePrimScale(uint localID, Vector3 scale, IClientAPI remoteClient) |
1219 | { | 1219 | { |
1220 | SceneObjectGroup group = GetGroupByPrim(localID); | 1220 | SceneObjectPart part = GetSceneObjectPart(localID); |
1221 | if (group != null) | 1221 | |
1222 | if (part != null) | ||
1222 | { | 1223 | { |
1223 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1224 | if (m_parentScene.Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId)) |
1224 | { | 1225 | { |
1225 | group.Resize(scale, localID); | 1226 | part.Resize(scale); |
1226 | } | 1227 | } |
1227 | } | 1228 | } |
1228 | } | 1229 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7aa7831..477b3e3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2612,56 +2612,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2612 | #region Resize | 2612 | #region Resize |
2613 | 2613 | ||
2614 | /// <summary> | 2614 | /// <summary> |
2615 | /// Resize the given part | ||
2616 | /// </summary> | ||
2617 | /// <param name="scale"></param> | ||
2618 | /// <param name="localID"></param> | ||
2619 | public void Resize(Vector3 scale, uint localID) | ||
2620 | { | ||
2621 | if (scale.X > m_scene.m_maxNonphys) | ||
2622 | scale.X = m_scene.m_maxNonphys; | ||
2623 | if (scale.Y > m_scene.m_maxNonphys) | ||
2624 | scale.Y = m_scene.m_maxNonphys; | ||
2625 | if (scale.Z > m_scene.m_maxNonphys) | ||
2626 | scale.Z = m_scene.m_maxNonphys; | ||
2627 | |||
2628 | SceneObjectPart part = GetChildPart(localID); | ||
2629 | if (part != null) | ||
2630 | { | ||
2631 | part.Resize(scale); | ||
2632 | if (part.PhysActor != null) | ||
2633 | { | ||
2634 | if (part.PhysActor.IsPhysical) | ||
2635 | { | ||
2636 | if (scale.X > m_scene.m_maxPhys) | ||
2637 | scale.X = m_scene.m_maxPhys; | ||
2638 | if (scale.Y > m_scene.m_maxPhys) | ||
2639 | scale.Y = m_scene.m_maxPhys; | ||
2640 | if (scale.Z > m_scene.m_maxPhys) | ||
2641 | scale.Z = m_scene.m_maxPhys; | ||
2642 | } | ||
2643 | part.PhysActor.Size = scale; | ||
2644 | m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); | ||
2645 | } | ||
2646 | //if (part.UUID != m_rootPart.UUID) | ||
2647 | |||
2648 | HasGroupChanged = true; | ||
2649 | part.TriggerScriptChangedEvent(Changed.SCALE); | ||
2650 | ScheduleGroupForFullUpdate(); | ||
2651 | |||
2652 | //if (part.UUID == m_rootPart.UUID) | ||
2653 | //{ | ||
2654 | //if (m_rootPart.PhysActor != null) | ||
2655 | //{ | ||
2656 | //m_rootPart.PhysActor.Size = | ||
2657 | //new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z); | ||
2658 | //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); | ||
2659 | //} | ||
2660 | //} | ||
2661 | } | ||
2662 | } | ||
2663 | |||
2664 | /// <summary> | ||
2665 | /// Resize the entire group of prims. | 2615 | /// Resize the entire group of prims. |
2666 | /// </summary> | 2616 | /// </summary> |
2667 | /// <param name="scale"></param> | 2617 | /// <param name="scale"></param> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5035317..ffde68e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2846,6 +2846,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2846 | /// <param name="scale"></param> | 2846 | /// <param name="scale"></param> |
2847 | public void Resize(Vector3 scale) | 2847 | public void Resize(Vector3 scale) |
2848 | { | 2848 | { |
2849 | if (scale.X > ParentGroup.Scene.m_maxNonphys) | ||
2850 | scale.X = ParentGroup.Scene.m_maxNonphys; | ||
2851 | if (scale.Y > ParentGroup.Scene.m_maxNonphys) | ||
2852 | scale.Y = ParentGroup.Scene.m_maxNonphys; | ||
2853 | if (scale.Z > ParentGroup.Scene.m_maxNonphys) | ||
2854 | scale.Z = ParentGroup.Scene.m_maxNonphys; | ||
2855 | |||
2849 | // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); | 2856 | // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); |
2850 | 2857 | ||
2851 | StoreUndoState(); | 2858 | StoreUndoState(); |
@@ -2855,9 +2862,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2855 | // need to reinsert the sculpt data into the shape, since the physics engine deletes it when done to | 2862 | // need to reinsert the sculpt data into the shape, since the physics engine deletes it when done to |
2856 | // save memory | 2863 | // save memory |
2857 | if (PhysActor != null) | 2864 | if (PhysActor != null) |
2858 | CheckSculptAndLoad(); | 2865 | { |
2866 | if (PhysActor.IsPhysical) | ||
2867 | { | ||
2868 | if (scale.X > ParentGroup.Scene.m_maxPhys) | ||
2869 | scale.X = ParentGroup.Scene.m_maxPhys; | ||
2870 | if (scale.Y > ParentGroup.Scene.m_maxPhys) | ||
2871 | scale.Y = ParentGroup.Scene.m_maxPhys; | ||
2872 | if (scale.Z > ParentGroup.Scene.m_maxPhys) | ||
2873 | scale.Z = ParentGroup.Scene.m_maxPhys; | ||
2874 | } | ||
2875 | |||
2876 | PhysActor.Size = scale; | ||
2877 | |||
2878 | if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh) | ||
2879 | CheckSculptAndLoad(); | ||
2880 | else | ||
2881 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | ||
2882 | } | ||
2859 | 2883 | ||
2860 | ParentGroup.HasGroupChanged = true; | 2884 | ParentGroup.HasGroupChanged = true; |
2885 | TriggerScriptChangedEvent(Changed.SCALE); | ||
2861 | ScheduleFullUpdate(); | 2886 | ScheduleFullUpdate(); |
2862 | } | 2887 | } |
2863 | 2888 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index 95ecfc6..7ec36b8 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs | |||
@@ -83,7 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
83 | 83 | ||
84 | SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID); | 84 | SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID); |
85 | 85 | ||
86 | g1Post.Resize(new Vector3(8, 9, 10), g1Post.Parts[1].LocalId); | 86 | g1Post.Parts[1].Resize(new Vector3(8, 9, 10)); |
87 | 87 | ||
88 | SceneObjectGroup g1PostPost = scene.GetSceneObjectGroup(g1.UUID); | 88 | SceneObjectGroup g1PostPost = scene.GetSceneObjectGroup(g1.UUID); |
89 | 89 | ||