From 3ebd0430d963b49012cd261cea32d11be39a5532 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 8 Jan 2008 14:54:20 +0000 Subject: * Heavy refactoring of MultipleObjUpdate flow for readability --- OpenSim/Region/ClientStack/ClientView.cs | 223 +++++++++++++++---------------- 1 file 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 for (int i = 0; i < multipleupdate.ObjectData.Length; i++) { + MultipleObjectUpdatePacket.ObjectDataBlock block = multipleupdate.ObjectData[i]; + // Can't act on Null Data - if (multipleupdate.ObjectData[i].Data != null) + if (block.Data != null) { - LLUUID editobj = tScene.GetSceneObjectPart(multipleupdate.ObjectData[i].ObjectLocalID).UUID; - if (editobj != null) - { - if (tScene.PermissionsMngr.CanEditObjectPosition(simClient.AgentId, editobj)) - { - #region position + uint localId = block.ObjectLocalID; + SceneObjectPart part = tScene.GetSceneObjectPart(localId); - if (multipleupdate.ObjectData[i].Type == 9) //change position - { - if (OnUpdatePrimGroupPosition != null) - { - LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); - OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); - } - } - else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position - { - if (OnUpdatePrimSinglePosition != null) - { - LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); - // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); - OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); - } - } - #endregion position - #region rotation - - else if (multipleupdate.ObjectData[i].Type == 2) // single item of group rotation from tab - { - if (OnUpdatePrimSingleRotation != null) - { - LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); - //System.Console.WriteLine("new tab rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); - OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); - } - } - else if (multipleupdate.ObjectData[i].Type == 3) // single item of group rotation from mouse - { - if (OnUpdatePrimSingleRotation != null) - { - LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); - //System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); - OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); - } - } - else if (multipleupdate.ObjectData[i].Type == 10) //group rotation from object tab - { - if (OnUpdatePrimGroupRotation != null) - { - LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); - // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); - OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); - } - } - else if (multipleupdate.ObjectData[i].Type == 11) //group rotation from mouse - { - if (OnUpdatePrimGroupMouseRotation != null) - { - LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); - LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); - //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); - // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); - OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, - this); - } - } - #endregion - #region scale + if (part == null) + { + // It's a ghost! tell the client to delete it from view. + simClient.SendKillObject(Scene.RegionInfo.RegionHandle, + localId); + } + else + { + LLUUID partId = part.UUID; - else if (multipleupdate.ObjectData[i].Type == 13) //group scale from object tab - { - if (OnUpdatePrimScale != null) - { - LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); - //Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); - - // Change the position based on scale (for bug number 246) - LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); - // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); - OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); - } - } - else if (multipleupdate.ObjectData[i].Type == 29) //group scale from mouse - { - if (OnUpdatePrimScale != null) - { - LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); - // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); - OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); - LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); - OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); - } - } - else if (multipleupdate.ObjectData[i].Type == 5) //single prim scale from object tab - { - if (OnUpdatePrimScale != null) - { - LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); - // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); - } - } - else if (multipleupdate.ObjectData[i].Type == 21) //single prim scale from mouse + if (tScene.PermissionsMngr.CanEditObjectPosition(simClient.AgentId, partId)) + { + switch (block.Type) { - if (OnUpdatePrimScale != null) - { - LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); - // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); - } + case 1: + if (OnUpdatePrimSinglePosition != null) + { + LLVector3 pos = new LLVector3(block.Data, 0); + // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); + OnUpdatePrimSinglePosition(localId, pos, this); + } + break; + case 2: + if (OnUpdatePrimSingleRotation != null) + { + LLQuaternion rot = new LLQuaternion(block.Data, 0, true); + //System.Console.WriteLine("new tab rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); + OnUpdatePrimSingleRotation(localId, rot, this); + } + break; + case 3: + if (OnUpdatePrimSingleRotation != null) + { + LLQuaternion rot = new LLQuaternion(block.Data, 12, true); + //System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); + OnUpdatePrimSingleRotation(localId, rot, this); + } + break; + case 5: + if (OnUpdatePrimScale != null) + { + LLVector3 scale = new LLVector3(block.Data, 12); + // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + OnUpdatePrimScale(localId, scale, this); + } + break; + case 9: + if (OnUpdatePrimGroupPosition != null) + { + LLVector3 pos = new LLVector3(block.Data, 0); + OnUpdatePrimGroupPosition(localId, pos, this); + } + break; + case 10: + if (OnUpdatePrimGroupRotation != null) + { + LLQuaternion rot = new LLQuaternion(block.Data, 0, true); + // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); + OnUpdatePrimGroupRotation(localId, rot, this); + } + break; + case 11: + if (OnUpdatePrimGroupMouseRotation != null) + { + LLVector3 pos = new LLVector3(block.Data, 0); + LLQuaternion rot = new LLQuaternion(block.Data, 12, true); + //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); + // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); + OnUpdatePrimGroupMouseRotation(localId, pos, rot, + this); + } + break; + case 13: + if (OnUpdatePrimScale != null) + { + LLVector3 scale = new LLVector3(block.Data, 12); + //Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + OnUpdatePrimScale(localId, scale, this); + + // Change the position based on scale (for bug number 246) + LLVector3 pos = new LLVector3(block.Data, 0); + // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); + OnUpdatePrimSinglePosition(localId, pos, this); + } + break; + case 29: + if (OnUpdatePrimScale != null) + { + LLVector3 scale = new LLVector3(block.Data, 12); + // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); + OnUpdatePrimScale(localId, scale, this); + LLVector3 pos = new LLVector3(block.Data, 0); + OnUpdatePrimSinglePosition(localId, pos, this); + } + break; + case 21: + if (OnUpdatePrimScale != null) + { + LLVector3 scale = new LLVector3(block.Data, 12); + // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + OnUpdatePrimScale(localId, scale, this); + } + break; } - - #endregion } - } // editobj != null; - else - { - // It's a ghost! tell the client to delete it from view. - simClient.SendKillObject(Scene.RegionInfo.RegionHandle, - multipleupdate.ObjectData[i].ObjectLocalID); } } } -- cgit v1.1