From dce400da7c65d659129abf9bc6e8f38b360a63d2 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Mon, 26 Aug 2019 20:13:01 -0400
Subject: [PATCH] Fix camera version + VR using spacebar.

---
 ObjEditor.java |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/ObjEditor.java b/ObjEditor.java
index fd5504d..68657fd 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -1882,7 +1882,7 @@
         tabbedPane.add(creditsPanel);
         tabbedPane.setToolTipTextAt(3, "Credits");
         
-        if (Globals.ADVANCED)
+        if (Globals.SHOWINFO)
         {
             objectPanel.add(infoPanel);
             objectPanel.setIconAt(5, GetIcon("icons/info.png"));
@@ -4469,6 +4469,8 @@
             CopyChanged(copy);
         
         SetVersionStates();
+        
+        SetCameras();
     }
     
     public boolean Save(boolean user)
@@ -4547,6 +4549,11 @@
     void RefreshSelection()
     {
         Object3D selection = new Object3D();
+        
+        if (objEditor.copy.selection == null)
+        {
+            objEditor.copy.selection = new Object3D();
+        }
         
         for (int i = 0; i < objEditor.copy.selection.size(); i++)
         {
@@ -4682,7 +4689,7 @@
         // Option?
         Replace();
         
-        System.err.println("Undo");
+        //System.err.println("Previous");
         
         //cRadio tab = GetCurrentTab();
         
@@ -4711,6 +4718,8 @@
         
         SetVersionStates();
         
+        SetCameras();
+        
         return true;
     }
 
@@ -4730,6 +4739,8 @@
         CopyChanged(copy);
         
         SetVersionStates();
+        
+        SetCameras();
         
         return true;
     }
@@ -4771,9 +4782,20 @@
         //if (!tab.user[tab.versionindex])
         //    tab.graphs[tab.versionindex] = null;
         
-        SetVersionStates();        
+        SetVersionStates();
+        
+        SetCameras();
     }
 
+    void SetCameras()
+    {
+        Camera neweye = (Camera)copy.GetObject(cameraView.cameras[0].GetUUID());
+        Camera newlight = (Camera)copy.GetObject(cameraView.LightCamera().GetUUID());
+        
+        cameraView.SetCamera(neweye);
+        cameraView.SetLight(newlight);
+    }
+    
         void ImportGFD()
         {
             FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
@@ -5119,6 +5141,7 @@
                 copy.versionindex = version;
                 CopyChanged(copy);
                 SetVersionStates();
+                SetCameras();
             }
             
             return;

--
Gitblit v1.6.2