OSDN Git Service

Set camera to default position when clicking refresh on the object list
authorLatif Khalifa <latifer@streamgrid.net>
Sun, 18 Aug 2013 00:22:03 +0000 (02:22 +0200)
committerLatif Khalifa <latifer@streamgrid.net>
Sun, 18 Aug 2013 00:22:03 +0000 (02:22 +0200)
Radegast/Core/StateManager.cs
Radegast/GUI/Consoles/ObjectsConsole.cs

index 54c723f..5177d7f 100644 (file)
@@ -610,8 +610,10 @@ namespace Radegast
                 }
                 else
                 {
+                    Vector3 pos = client.Self.SimPosition + DefaultCameraOffset * client.Self.Movement.BodyRotation;
+                    Logger.Log("Setting camera position to " + pos.ToString(), Helpers.LogLevel.Debug);
                     client.Self.Movement.Camera.LookAt(
-                        client.Self.SimPosition + DefaultCameraOffset * client.Self.Movement.BodyRotation,
+                        pos,
                         client.Self.SimPosition
                     );
                 }
index 7ca9f72..f04bd26 100644 (file)
@@ -213,7 +213,7 @@ namespace Radegast
 
             lock (Prims)
             {
-                for (int i=0; i<Prims.Count; i++)
+                for (int i = 0; i < Prims.Count; i++)
                 {
                     Primitive prim = Prims[i];
                     if (prim.Properties != null && e.Names.ContainsKey(prim.Properties.OwnerID))
@@ -249,7 +249,7 @@ namespace Radegast
         {
             lock (Prims)
             {
-                for (int i=0; i<Prims.Count; i++)
+                for (int i = 0; i < Prims.Count; i++)
                 {
                     if (Prims[i].ID == props.ObjectID)
                     {
@@ -817,29 +817,33 @@ namespace Radegast
 
             lock (Prims)
             {
-                client.Network.CurrentSim.ObjectsPrimitives.ForEach(
-                    new Action<Primitive>(
-                    delegate(Primitive prim)
+                /*
+                var prims = client.Network.CurrentSim.ObjectsPrimitives.FindAll(prim =>
+                {
+                    return ((prim.ParentID == client.Self.LocalID) && (filter == ObjectConsoleFilter.Attached || filter == ObjectConsoleFilter.Both)) ||
+                        ((prim.ParentID == 0) && (filter == ObjectConsoleFilter.Rezzed || filter == ObjectConsoleFilter.Both));
+                });
+                */
+                client.Network.CurrentSim.ObjectsPrimitives.ForEach(prim =>
+                {
+                    int distance = (int)Vector3.Distance(prim.Position, location);
+                    if (prim.ParentID == client.Self.LocalID)
+                    {
+                        distance = 0;
+                    }
+                    if (IncludePrim(prim) &&
+                        (prim.Position != Vector3.Zero) &&
+                        (distance < searchRadius) &&
+                        (txtSearch.Text.Length == 0 || (prim.Properties != null && prim.Properties.Name.ToLower().Contains(txtSearch.Text.ToLower()))) && //root prims and attachments only
+                        !Prims.Contains(prim))
                     {
-                        int distance = (int)Vector3.Distance(prim.Position, location);
-                        if (prim.ParentID == client.Self.LocalID)
+                        Prims.Add(prim);
+                        if (prim.Properties == null)
                         {
-                            distance = 0;
-                        }
-                        if (IncludePrim(prim) &&
-                            (prim.Position != Vector3.Zero) &&
-                            (distance < searchRadius) &&
-                            (txtSearch.Text.Length == 0 || (prim.Properties != null && prim.Properties.Name.ToLower().Contains(txtSearch.Text.ToLower()))) && //root prims and attachments only
-                            !Prims.Contains(prim))
-                        {
-                            Prims.Add(prim);
-                            if (prim.Properties == null)
-                            {
-                                propRequester.RequestProps(prim);
-                            }
+                            propRequester.RequestProps(prim);
                         }
                     }
-                    ));
+                });
                 Prims.Sort(PrimSorter);
                 lstPrims.VirtualListSize = Prims.Count;
                 lstPrims.Invalidate();
@@ -891,9 +895,11 @@ namespace Radegast
 
         private void btnRefresh_Click(object sender, EventArgs e)
         {
+            instance.State.SetDefaultCamera();
             Cursor.Current = Cursors.WaitCursor;
             Prims.Clear();
             AddAllObjects();
+
             Cursor.Current = Cursors.Default;
         }
 
@@ -1143,14 +1149,14 @@ namespace Radegast
             ctxMenuObjects.Items.Add("Take", null, btnTake_Click);
             ctxMenuObjects.Items.Add("Delete", null, btnDelete_Click);
             ctxMenuObjects.Items.Add("Return", null, btnReturn_Click);
-            
+
             if (currentPrim.Properties != null)
             {
-               if (currentPrim.Properties.CreatorID == client.Self.AgentID &&
-                   currentPrim.Properties.OwnerID == client.Self.AgentID)
-               {
-                                       ctxMenuObjects.Items.Add("Export", null, btnExport_Click);
-               }
+                if (currentPrim.Properties.CreatorID == client.Self.AgentID &&
+                    currentPrim.Properties.OwnerID == client.Self.AgentID)
+                {
+                    ctxMenuObjects.Items.Add("Export", null, btnExport_Click);
+                }
             }
 
             if (currentPrim.Properties != null)
@@ -1231,10 +1237,10 @@ namespace Radegast
             UpdateObjectContents();
             lstContents.Focus();
         }
-        
+
         private void btnExport_Click(object sender, EventArgs e)
         {
-               instance.MainForm.DisplayExportConsole(currentPrim.LocalID);
+            instance.MainForm.DisplayExportConsole(currentPrim.LocalID);
         }
 
         private void lstContents_MouseDoubleClick(object sender, MouseEventArgs e)