From 57f4646563d6757f65ddc00ca38975c352d76de7 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Fri, 27 Sep 2019 20:06:14 -0400 Subject: [PATCH] Wireframe, box mode, and ragdoll zoffset. --- ObjEditor.java | 308 +++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 271 insertions(+), 37 deletions(-) diff --git a/ObjEditor.java b/ObjEditor.java index facfbbe..c8eff94 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -98,9 +98,11 @@ cButton GetButton(String name, boolean border) { - ImageIcon icon = GetIcon(name); - if (icon != null || name.contains("/")) - return new cButton(icon, border); + //ImageIcon icon = GetIcon(name); + boolean fit = !name.startsWith("icons"); + if (//icon != null || + name.contains("/")) + return new cButton(name, border, fit); else return new cButton(name, border); } @@ -797,6 +799,8 @@ // SendInfo(" delay: " + sel.delay + newline, "regular"); // live, hide, ... //?? SendInfo(" Orig: " + maxima + newline, "regular"); + if (sel.GetTextures().pigmentdata != null) + si.SendInfo(" EMBEDDED ", "regular"); si.SendInfo((debug ? " Texture: " : " ") + sel.GetTextures(), "bold"); // SendInfo((debug ? " Material: " : " ") + sel.material + newline, "regular"); if (sel instanceof cMesh) @@ -1167,6 +1171,7 @@ JCheckBox selectableCB; JCheckBox hideCB; JCheckBox link2masterCB; + JCheckBox sortCB; JCheckBox markCB; JCheckBox randomCB; JCheckBox speedupCB; @@ -1410,11 +1415,14 @@ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); rewindCB.setToolTipText("Rewind animation"); + sortCB = AddCheckBox(setupPanel2, "Sort", copy.sort); + sortCB.setToolTipText("Display from back to front"); + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); link2masterCB = AddCheckBox(setupPanel2, GetSupportText(), copy.link2master); - link2masterCB.setToolTipText("Attach to support"); + link2masterCB.setToolTipText("Link to support"); if (Globals.ADVANCED) { @@ -1786,11 +1794,11 @@ objectTabbedPane.setToolTipTextAt(objectTabCount++, "Material"); figurePanel = new cGridBag(); - figurePanel.add(new cButton("FIGURES amd POSES coming soon!")); + figurePanel.add(new cButton("FIGURES and POSES coming soon!")); objectTabbedPane.add(figurePanel); objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/figure.png")); objectTabbedPane.setToolTipTextAt(objectTabCount++, "Figures and poses"); - + // JPanel north = new JPanel(new BorderLayout()); // north.setName("Edit"); // north.add(ctrlPanel, BorderLayout.NORTH); @@ -1828,8 +1836,8 @@ /*JTabbedPane*/ scenePanel = new cGridBag(); scenePanel.preferredWidth = 6; - JTabbedPane tabbedPane = new JTabbedPane(); - tabbedPane.add(scrollpane); + JTabbedPane sceneTabbedPane = new JTabbedPane(); + sceneTabbedPane.add(scrollpane); optionsPanel = new cGridBag().setVertical(false); @@ -1837,11 +1845,207 @@ AddOptions(optionsPanel); //, aConstraints); - tabbedPane.add(FSPane = new cFileSystemPane(this)); + sceneTabbedPane.add(FSPane = new cFileSystemPane(this)); - tabbedPane.add(optionsPanel); + fullscenePanel = new cGridBag(); + fullscenePanel.setName("Download"); + sceneTabbedPane.add(fullscenePanel); - scenePanel.add(tabbedPane); + cButton fullsceneButton; + + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/alsace.png", !Globals.NIMBUSLAF)); + fullsceneButton.setToolTipText("Alsace!"); + fullsceneButton.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Alsace.gfd", new iCallBack() + { + + public void Callback(Object obj) + { + LoadIt(obj); + } + + public void DragGesture() + { + } + }); + } + }); + + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/desertmotel.png", !Globals.NIMBUSLAF)); + fullsceneButton.setToolTipText("Desert Motel!"); + fullsceneButton.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/DesertMotel.gfd", new iCallBack() + { + + public void Callback(Object obj) + { + LoadIt(obj); + } + + public void DragGesture() + { + } + }); + } + }); + + fullscenePanel.Return(); + + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/london.png", !Globals.NIMBUSLAF)); + fullsceneButton.setToolTipText("Old London!"); + fullsceneButton.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/oldlondon.gfd", new iCallBack() + { + + public void Callback(Object obj) + { + LoadIt(obj); + } + + public void DragGesture() + { + } + }); + } + }); + + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/skullcove.png", !Globals.NIMBUSLAF)); + fullsceneButton.setToolTipText("Skull Cove Island!"); + fullsceneButton.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/SkullCoveIsland.gfd", new iCallBack() + { + + public void Callback(Object obj) + { + LoadIt(obj); + } + + public void DragGesture() + { + } + }); + } + }); + + fullscenePanel.Return(); + + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/tuscany.png", !Globals.NIMBUSLAF)); + fullsceneButton.setToolTipText("Tuscany!"); + fullsceneButton.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Tuscany.gfd", new iCallBack() + { + + public void Callback(Object obj) + { + LoadIt(obj); + } + + public void DragGesture() + { + } + }); + } + }); + + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/venice.png", !Globals.NIMBUSLAF)); + fullsceneButton.setToolTipText("Venice!"); + fullsceneButton.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Venice.gfd", new iCallBack() + { + + public void Callback(Object obj) + { + LoadIt(obj); + } + + public void DragGesture() + { + } + }); + } + }); + + fullscenePanel.Return(); + + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/viking.png", !Globals.NIMBUSLAF)); + fullsceneButton.setToolTipText("Viking Village!"); + fullsceneButton.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/VikingVillage.gfd", new iCallBack() + { + + public void Callback(Object obj) + { + LoadIt(obj); + } + + public void DragGesture() + { + } + }); + } + }); + + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/yvoire.png", !Globals.NIMBUSLAF)); + fullsceneButton.setToolTipText("Yvoire!"); + fullsceneButton.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Yvoire.gfd", new iCallBack() + { + + public void Callback(Object obj) + { + LoadIt(obj); + } + + public void DragGesture() + { + } + }); + } + }); + + fullscenePanel.Return(); + + fullscenePanel.add(new cGridBag()); + fullscenePanel.add(new cGridBag()); + fullscenePanel.Return(); + fullscenePanel.add(new cGridBag()); + fullscenePanel.add(new cGridBag()); + + sceneTabbedPane.add(optionsPanel); + + scenePanel.add(sceneTabbedPane); cGridBag creditsPanel = new cGridBag().setVertical(true); creditsPanel.setName("Credits"); @@ -1930,8 +2134,8 @@ creditsPanel.add(new cGridBag()); } - tabbedPane.add(creditsPanel); - tabbedPane.setToolTipTextAt(3, "Credits"); + sceneTabbedPane.add(creditsPanel); + sceneTabbedPane.setToolTipTextAt(3, "Credits"); if (Globals.SHOWINFO) { @@ -4128,6 +4332,11 @@ copy.Touch(); // display list issue objEditor.refreshContents(true); // To show item colors return; + } else if (event.getSource() == sortCB) + { + copy.sort ^= true; + objEditor.refreshContents(); + return; } else if (event.getSource() == link2masterCB) { copy.link2master ^= true; @@ -4402,13 +4611,13 @@ if (copy == Grafreed.grafreed.universe) { CreateCameras(); - cameraView.SetCamera(GetCamera(copy, 0)); + cameraView.SetCamera(GetCamera(copy, 0), true); cameraView.SetLight(GetCamera(copy, 4)); } ResetModel(); - DuplicateVersion(); + //DuplicateVersion(); this.SetVersionStates(); objEditor.refreshContents(); @@ -4552,7 +4761,7 @@ SetVersionStates(); - SetCameras(); + SetCameras(false); } public boolean DuplicateVersion() // boolean user) @@ -4801,7 +5010,7 @@ SetVersionStates(); - SetCameras(); + SetCameras(false); return true; } @@ -4823,7 +5032,7 @@ SetVersionStates(); - SetCameras(); + SetCameras(false); return true; } @@ -4834,7 +5043,8 @@ //cRadio tab = GetCurrentTab(); - if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) + // < 0 means == -2 || == -1 + if (copy.versionindex < 0 || copy.versionlist[copy.versionindex] == null) { // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); return false; @@ -4867,33 +5077,39 @@ SetVersionStates(); - SetCameras(); + SetCameras(false); } - void SetCameras() + void SetCameras(boolean set) { if (copy == Grafreed.grafreed.universe) { Camera neweye = (Camera)copy.GetObject(cameraView.cameras[cameraView.cameracount^1].GetUUID()); Camera newlight = (Camera)copy.GetObject(cameraView.LightCamera().GetUUID()); - cameraView.SetCamera(neweye); + cameraView.SetCamera(neweye, set); cameraView.SetLight(newlight); } } - + + void ImportGFD(String url) + { + objEditor.ReadGFD(url, objEditor); + } + void ImportGFD() { FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); - browser.show(); + browser.setVisible(true); String filename = browser.getFile(); if (filename != null && filename.length() > 0) { String fullname = browser.getDirectory() + filename; //Object3D readobj = - objEditor.ReadGFD(fullname, objEditor); + // objEditor.ReadGFD(fullname, objEditor); //makeSomething(readobj); + ImportGFD(fullname); } } @@ -5234,7 +5450,7 @@ copy.versionindex = version; CopyChanged(copy); SetVersionStates(); - SetCameras(); + SetCameras(false); } return; @@ -5499,7 +5715,7 @@ interest.y = k * interest.y + (1 - k) * height; } - CameraPane.zoomonce = true; + // CameraPane.zoomonce = true; // june 2014 Camera parentcam = cameraView.manipCamera; @@ -5573,7 +5789,7 @@ objEditor.ScreenFit(obj, false); - cameraView.pingthread.StepToTarget(true); // aout 2013 + cameraView.pingthread.StepToTarget(); //true); // aout 2013 refreshContents(); } @@ -5850,10 +6066,27 @@ { Object3D readobj = null; + java.net.URL url = null; + + try + { + url = new java.net.URL(fullname); + } catch (Exception e) + { + try + { + url = new java.net.URL("file:///" + fullname); + } catch (Exception e2) + { + e2.printStackTrace(); + } + } + try { // Try compressed version first. - java.io.FileInputStream istream = new java.io.FileInputStream(fullname); + java.io.InputStream istream //= new java.io.FileInputStream(fullname); + = url.openStream(); java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); @@ -5868,7 +6101,8 @@ try { - java.io.FileInputStream istream = new java.io.FileInputStream(fullname); + java.io.InputStream istream //= new java.io.FileInputStream(fullname); + = url.openStream(); java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); readobj = (Object3D) p.readObject(); @@ -5966,12 +6200,11 @@ // // oct 2012 if(cam.parent == null) // cam.parent = copy.get(0); // cams; // } - cameraView.SetCamera((Camera) cams.get(0)); - // MAJOR CRASH!! - cameraView.SetLight((Camera) cams.get(4)); - topView.SetCamera((Camera) cams.get(1)); - frontView.SetCamera((Camera) cams.get(2)); - sideView.SetCamera((Camera) cams.get(3)); + cameraView.SetCamera((Camera) cams.get(0), true); + cameraView.SetLight((Camera) cams.get(4)); // MAJOR CRASH!! + topView.SetCamera((Camera) cams.get(1), true); + frontView.SetCamera((Camera) cams.get(2), true); + sideView.SetCamera((Camera) cams.get(3), true); // copy.get(0).clear(); // copy.get(0).addAll(cams); @@ -6026,7 +6259,7 @@ if (Grafreed.standAlone) { FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); - browser.show(); + browser.setVisible(true); String filename = browser.getFile(); if (filename != null && filename.length() > 0) { @@ -6350,6 +6583,7 @@ cGridBag materialPanel; cGridBag ctrlPanel; cGridBag figurePanel; + cGridBag fullscenePanel; JScrollPane infoPanel; -- Gitblit v1.6.2