diff options
author | lbsa71 | 2008-01-08 14:54:20 +0000 |
---|---|---|
committer | lbsa71 | 2008-01-08 14:54:20 +0000 |
commit | 3ebd0430d963b49012cd261cea32d11be39a5532 (patch) | |
tree | 06ced35704bde1c2f3a1bd5ffe43220667b035cd /OpenSim/Region | |
parent | * Added the files for work units for the purpose of sending out updates to re... (diff) | |
download | opensim-SC-3ebd0430d963b49012cd261cea32d11be39a5532.zip opensim-SC-3ebd0430d963b49012cd261cea32d11be39a5532.tar.gz opensim-SC-3ebd0430d963b49012cd261cea32d11be39a5532.tar.bz2 opensim-SC-3ebd0430d963b49012cd261cea32d11be39a5532.tar.xz |
* Heavy refactoring of MultipleObjUpdate flow for readability
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 223 |
1 files changed, 106 insertions, 117 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 6148fc5..24157ae 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -2039,130 +2039,119 @@ namespace OpenSim.Region.ClientStack | |||
2039 | 2039 | ||
2040 | for (int i = 0; i < multipleupdate.ObjectData.Length; i++) | 2040 | for (int i = 0; i < multipleupdate.ObjectData.Length; i++) |
2041 | { | 2041 | { |
2042 | MultipleObjectUpdatePacket.ObjectDataBlock block = multipleupdate.ObjectData[i]; | ||
2043 | |||
2042 | // Can't act on Null Data | 2044 | // Can't act on Null Data |
2043 | if (multipleupdate.ObjectData[i].Data != null) | 2045 | if (block.Data != null) |
2044 | { | 2046 | { |
2045 | LLUUID editobj = tScene.GetSceneObjectPart(multipleupdate.ObjectData[i].ObjectLocalID).UUID; | 2047 | uint localId = block.ObjectLocalID; |
2046 | if (editobj != null) | 2048 | SceneObjectPart part = tScene.GetSceneObjectPart(localId); |
2047 | { | ||
2048 | if (tScene.PermissionsMngr.CanEditObjectPosition(simClient.AgentId, editobj)) | ||
2049 | { | ||
2050 | #region position | ||
2051 | 2049 | ||
2052 | if (multipleupdate.ObjectData[i].Type == 9) //change position | 2050 | if (part == null) |
2053 | { | 2051 | { |
2054 | if (OnUpdatePrimGroupPosition != null) | 2052 | // It's a ghost! tell the client to delete it from view. |
2055 | { | 2053 | simClient.SendKillObject(Scene.RegionInfo.RegionHandle, |
2056 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | 2054 | localId); |
2057 | OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); | 2055 | } |
2058 | } | 2056 | else |
2059 | } | 2057 | { |
2060 | else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position | 2058 | LLUUID partId = part.UUID; |
2061 | { | ||
2062 | if (OnUpdatePrimSinglePosition != null) | ||
2063 | { | ||
2064 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | ||
2065 | // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | ||
2066 | OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); | ||
2067 | } | ||
2068 | } | ||
2069 | #endregion position | ||
2070 | #region rotation | ||
2071 | |||
2072 | else if (multipleupdate.ObjectData[i].Type == 2) // single item of group rotation from tab | ||
2073 | { | ||
2074 | if (OnUpdatePrimSingleRotation != null) | ||
2075 | { | ||
2076 | LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); | ||
2077 | //System.Console.WriteLine("new tab rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | ||
2078 | OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); | ||
2079 | } | ||
2080 | } | ||
2081 | else if (multipleupdate.ObjectData[i].Type == 3) // single item of group rotation from mouse | ||
2082 | { | ||
2083 | if (OnUpdatePrimSingleRotation != null) | ||
2084 | { | ||
2085 | LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); | ||
2086 | //System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | ||
2087 | OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); | ||
2088 | } | ||
2089 | } | ||
2090 | else if (multipleupdate.ObjectData[i].Type == 10) //group rotation from object tab | ||
2091 | { | ||
2092 | if (OnUpdatePrimGroupRotation != null) | ||
2093 | { | ||
2094 | LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); | ||
2095 | // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | ||
2096 | OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); | ||
2097 | } | ||
2098 | } | ||
2099 | else if (multipleupdate.ObjectData[i].Type == 11) //group rotation from mouse | ||
2100 | { | ||
2101 | if (OnUpdatePrimGroupMouseRotation != null) | ||
2102 | { | ||
2103 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | ||
2104 | LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); | ||
2105 | //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | ||
2106 | // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | ||
2107 | OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, | ||
2108 | this); | ||
2109 | } | ||
2110 | } | ||
2111 | #endregion | ||
2112 | #region scale | ||
2113 | 2059 | ||
2114 | else if (multipleupdate.ObjectData[i].Type == 13) //group scale from object tab | 2060 | if (tScene.PermissionsMngr.CanEditObjectPosition(simClient.AgentId, partId)) |
2115 | { | 2061 | { |
2116 | if (OnUpdatePrimScale != null) | 2062 | switch (block.Type) |
2117 | { | ||
2118 | LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); | ||
2119 | //Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
2120 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | ||
2121 | |||
2122 | // Change the position based on scale (for bug number 246) | ||
2123 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | ||
2124 | // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | ||
2125 | OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); | ||
2126 | } | ||
2127 | } | ||
2128 | else if (multipleupdate.ObjectData[i].Type == 29) //group scale from mouse | ||
2129 | { | ||
2130 | if (OnUpdatePrimScale != null) | ||
2131 | { | ||
2132 | LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); | ||
2133 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); | ||
2134 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | ||
2135 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | ||
2136 | OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); | ||
2137 | } | ||
2138 | } | ||
2139 | else if (multipleupdate.ObjectData[i].Type == 5) //single prim scale from object tab | ||
2140 | { | ||
2141 | if (OnUpdatePrimScale != null) | ||
2142 | { | ||
2143 | LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); | ||
2144 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
2145 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | ||
2146 | } | ||
2147 | } | ||
2148 | else if (multipleupdate.ObjectData[i].Type == 21) //single prim scale from mouse | ||
2149 | { | 2063 | { |
2150 | if (OnUpdatePrimScale != null) | 2064 | case 1: |
2151 | { | 2065 | if (OnUpdatePrimSinglePosition != null) |
2152 | LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); | 2066 | { |
2153 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | 2067 | LLVector3 pos = new LLVector3(block.Data, 0); |
2154 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | 2068 | // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); |
2155 | } | 2069 | OnUpdatePrimSinglePosition(localId, pos, this); |
2070 | } | ||
2071 | break; | ||
2072 | case 2: | ||
2073 | if (OnUpdatePrimSingleRotation != null) | ||
2074 | { | ||
2075 | LLQuaternion rot = new LLQuaternion(block.Data, 0, true); | ||
2076 | //System.Console.WriteLine("new tab rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | ||
2077 | OnUpdatePrimSingleRotation(localId, rot, this); | ||
2078 | } | ||
2079 | break; | ||
2080 | case 3: | ||
2081 | if (OnUpdatePrimSingleRotation != null) | ||
2082 | { | ||
2083 | LLQuaternion rot = new LLQuaternion(block.Data, 12, true); | ||
2084 | //System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | ||
2085 | OnUpdatePrimSingleRotation(localId, rot, this); | ||
2086 | } | ||
2087 | break; | ||
2088 | case 5: | ||
2089 | if (OnUpdatePrimScale != null) | ||
2090 | { | ||
2091 | LLVector3 scale = new LLVector3(block.Data, 12); | ||
2092 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
2093 | OnUpdatePrimScale(localId, scale, this); | ||
2094 | } | ||
2095 | break; | ||
2096 | case 9: | ||
2097 | if (OnUpdatePrimGroupPosition != null) | ||
2098 | { | ||
2099 | LLVector3 pos = new LLVector3(block.Data, 0); | ||
2100 | OnUpdatePrimGroupPosition(localId, pos, this); | ||
2101 | } | ||
2102 | break; | ||
2103 | case 10: | ||
2104 | if (OnUpdatePrimGroupRotation != null) | ||
2105 | { | ||
2106 | LLQuaternion rot = new LLQuaternion(block.Data, 0, true); | ||
2107 | // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | ||
2108 | OnUpdatePrimGroupRotation(localId, rot, this); | ||
2109 | } | ||
2110 | break; | ||
2111 | case 11: | ||
2112 | if (OnUpdatePrimGroupMouseRotation != null) | ||
2113 | { | ||
2114 | LLVector3 pos = new LLVector3(block.Data, 0); | ||
2115 | LLQuaternion rot = new LLQuaternion(block.Data, 12, true); | ||
2116 | //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | ||
2117 | // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | ||
2118 | OnUpdatePrimGroupMouseRotation(localId, pos, rot, | ||
2119 | this); | ||
2120 | } | ||
2121 | break; | ||
2122 | case 13: | ||
2123 | if (OnUpdatePrimScale != null) | ||
2124 | { | ||
2125 | LLVector3 scale = new LLVector3(block.Data, 12); | ||
2126 | //Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
2127 | OnUpdatePrimScale(localId, scale, this); | ||
2128 | |||
2129 | // Change the position based on scale (for bug number 246) | ||
2130 | LLVector3 pos = new LLVector3(block.Data, 0); | ||
2131 | // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | ||
2132 | OnUpdatePrimSinglePosition(localId, pos, this); | ||
2133 | } | ||
2134 | break; | ||
2135 | case 29: | ||
2136 | if (OnUpdatePrimScale != null) | ||
2137 | { | ||
2138 | LLVector3 scale = new LLVector3(block.Data, 12); | ||
2139 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); | ||
2140 | OnUpdatePrimScale(localId, scale, this); | ||
2141 | LLVector3 pos = new LLVector3(block.Data, 0); | ||
2142 | OnUpdatePrimSinglePosition(localId, pos, this); | ||
2143 | } | ||
2144 | break; | ||
2145 | case 21: | ||
2146 | if (OnUpdatePrimScale != null) | ||
2147 | { | ||
2148 | LLVector3 scale = new LLVector3(block.Data, 12); | ||
2149 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
2150 | OnUpdatePrimScale(localId, scale, this); | ||
2151 | } | ||
2152 | break; | ||
2156 | } | 2153 | } |
2157 | |||
2158 | #endregion | ||
2159 | } | 2154 | } |
2160 | } // editobj != null; | ||
2161 | else | ||
2162 | { | ||
2163 | // It's a ghost! tell the client to delete it from view. | ||
2164 | simClient.SendKillObject(Scene.RegionInfo.RegionHandle, | ||
2165 | multipleupdate.ObjectData[i].ObjectLocalID); | ||
2166 | } | 2155 | } |
2167 | } | 2156 | } |
2168 | } | 2157 | } |