From d0dc7ff35d71919d503ae35592478b173cf3cfd3 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Mon, 10 Jun 2019 23:45:04 -0400 Subject: [PATCH] Extract big data. --- ObjEditor.java | 960 +++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 635 insertions(+), 325 deletions(-) diff --git a/ObjEditor.java b/ObjEditor.java index e07d192..2cb5163 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -138,34 +138,41 @@ public void closeUI() { //new Exception().printStackTrace(); - System.out.println("this = " + this); - System.out.println("objEditor = " + objEditor); +// System.out.println("this = " + this); +// System.out.println("objEditor = " + objEditor); //nameField.removeActionListener(this); - objEditor.ctrlPanel.remove(nameField); +// objEditor.ctrlPanel.remove(nameField); + + objEditor.ctrlPanel.remove(namePanel); if (!GroupEditor.allparams) return; - objEditor.ctrlPanel.remove(liveCB); - objEditor.ctrlPanel.remove(hideCB); - objEditor.ctrlPanel.remove(markCB); - - objEditor.ctrlPanel.remove(randomCB); - objEditor.ctrlPanel.remove(speedupCB); - objEditor.ctrlPanel.remove(rewindCB); - - objEditor.ctrlPanel.remove(resetButton); - objEditor.ctrlPanel.remove(stepButton); -// objEditor.ctrlPanel.remove(stepAllButton); -// objEditor.ctrlPanel.remove(resetAllButton); - objEditor.ctrlPanel.remove(link2masterCB); - //objEditor.ctrlPanel.remove(flipVCB); - //objEditor.ctrlPanel.remove(texresMenu); - objEditor.ctrlPanel.remove(slowerButton); - objEditor.ctrlPanel.remove(fasterButton); - objEditor.ctrlPanel.remove(remarkButton); +// objEditor.ctrlPanel.remove(liveCB); +// objEditor.ctrlPanel.remove(hideCB); +// objEditor.ctrlPanel.remove(markCB); +// +// objEditor.ctrlPanel.remove(randomCB); +// objEditor.ctrlPanel.remove(speedupCB); +// objEditor.ctrlPanel.remove(rewindCB); +// +// objEditor.ctrlPanel.remove(resetButton); +// objEditor.ctrlPanel.remove(stepButton); +//// objEditor.ctrlPanel.remove(stepAllButton); +//// objEditor.ctrlPanel.remove(resetAllButton); +// objEditor.ctrlPanel.remove(link2masterCB); +// //objEditor.ctrlPanel.remove(flipVCB); +// //objEditor.ctrlPanel.remove(texresMenu); +// objEditor.ctrlPanel.remove(slowerButton); +// objEditor.ctrlPanel.remove(fasterButton); +// objEditor.ctrlPanel.remove(remarkButton); - Remove(normalpushField); + objEditor.ctrlPanel.remove(setupPanel); + objEditor.ctrlPanel.remove(commandsPanel); + objEditor.ctrlPanel.remove(pushPanel); + //objEditor.ctrlPanel.remove(fillPanel); + + //Remove(normalpushField); } public ObjEditor GetEditor() @@ -269,24 +276,40 @@ void SetupMenu() { frame.setMenuBar(menuBar = new MenuBar()); - menuBar.add(windowMenu = new Menu("File")); - windowMenu.add(loadItem = new MenuItem("Load...")); - windowMenu.add("-"); - windowMenu.add(saveItem = new MenuItem("Save")); - windowMenu.add(saveAsItem = new MenuItem("Save As...")); + menuBar.add(fileMenu = new Menu("File")); + fileMenu.add(newItem = new MenuItem("New")); + fileMenu.add(loadItem = new MenuItem("Load...")); + + //oe.menuBar.add(menu = new Menu("Include")); + Menu menu = new Menu("Import"); + importOBJItem = menu.add(new MenuItem("OBJ file...")); + importOBJItem.addActionListener(this); + import3DSItem = menu.add(new MenuItem("3DS file...")); + import3DSItem.addActionListener(this); + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); + importVRMLX3DItem.addActionListener(this); + menu.add("-"); + importGFDItem = menu.add(new MenuItem("Grafreed file...")); + importGFDItem.addActionListener(this); + fileMenu.add(menu); + fileMenu.add("-"); + + fileMenu.add(saveItem = new MenuItem("Save")); + fileMenu.add(saveAsItem = new MenuItem("Save As...")); //windowMenu.add(povItem = new MenuItem("Emit POV-Ray...")); - windowMenu.add("-"); - windowMenu.add(exportAsItem = new MenuItem("Export Selection...")); - windowMenu.add(reexportItem = new MenuItem("Re-export")); - windowMenu.add("-"); + fileMenu.add("-"); + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); + fileMenu.add(reexportItem = new MenuItem("Re-export")); + fileMenu.add("-"); if (client.parent != null) { - windowMenu.add(closeItem = new MenuItem("Close")); + fileMenu.add(closeItem = new MenuItem("Close")); } else { - windowMenu.add(closeItem = new MenuItem("Exit")); + fileMenu.add(closeItem = new MenuItem("Exit")); } + newItem.addActionListener(this); loadItem.addActionListener(this); saveItem.addActionListener(this); saveAsItem.addActionListener(this); @@ -295,79 +318,26 @@ //povItem.addActionListener(this); closeItem.addActionListener(this); - menuBar.add(cameraMenu = new Menu("View")); - //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer")); - //zBufferItem.addActionListener(this); - //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens")); - //normalLensItem.addActionListener(this); - cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera")); - revertCameraItem.addActionListener(this); - cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline")); - toggleTimelineItem.addItemListener(this); - cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); - toggleFullScreenItem.addItemListener(this); - toggleFullScreenItem.setState(CameraPane.FULLSCREEN); - cameraMenu.add("-"); - cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); - toggleTextureItem.addItemListener(this); - toggleTextureItem.setState(CameraPane.textureon); - cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); - toggleLiveItem.addItemListener(this); - toggleLiveItem.setState(Globals.isLIVE()); - cameraMenu.add(stepItem = new MenuItem("Step")); - stepItem.addActionListener(this); -// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); -// toggleDLItem.addItemListener(this); -// toggleDLItem.setState(false); - cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render")); - toggleRenderItem.addItemListener(this); - toggleRenderItem.setState(!CameraPane.frozen); - cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); - toggleDebugItem.addItemListener(this); - toggleDebugItem.setState(CameraPane.DEBUG); - cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); - toggleFrustumItem.addItemListener(this); - toggleFrustumItem.setState(CameraPane.FRUSTUM); - cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact")); - toggleFootContactItem.addItemListener(this); - toggleFootContactItem.setState(CameraPane.FOOTCONTACT); - cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random")); - toggleRandomItem.addItemListener(this); - toggleRandomItem.setState(CameraPane.RANDOM); - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); - toggleHandleItem.addItemListener(this); - toggleHandleItem.setState(CameraPane.HANDLES); - cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode")); - togglePaintItem.addItemListener(this); - togglePaintItem.setState(CameraPane.PAINTMODE); -// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root")); -// toggleRootItem.addItemListener(this); -// toggleRootItem.setState(false); -// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation")); -// animationItem.addItemListener(this); -// animationItem.setState(CameraPane.ANIMATION); - cameraMenu.add("-"); - cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera")); - editCameraItem.addActionListener(this); - objectPanel = new JTabbedPane(); toolbarPanel = new JPanel(); toolbarPanel.setName("Toolbar"); - treePanel = new JPanel(); + treePanel = new cGridBag(); treePanel.setName("Tree"); - ctrlPanel = new cGridBag(); // new GridBagLayout()); + ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); ctrlPanel.setName("Edit"); materialPanel = new cGridBag().setVertical(true); materialPanel.setName("Material"); /*JTextPane*/ infoarea = createTextPane(); + doc = infoarea.getStyledDocument(); + infoarea.setEditable(true); SetText(); // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); // infoarea.setOpaque(false); // //infoarea.setForeground(textcolor); - infoarea.setLineWrap(true); - infoarea.setWrapStyleWord(true); +// TEXTAREA infoarea.setLineWrap(true); +// TEXTAREA infoarea.setWrapStyleWord(true); infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); infoPanel.setPreferredSize(new Dimension(50, 200)); infoPanel.setName("Info"); @@ -378,15 +348,15 @@ mainPanel.setName("Main"); mainPanel.setContinuousLayout(true); mainPanel.setOneTouchExpandable(true); - mainPanel.setDividerLocation(1.0); mainPanel.setDividerSize(9); - mainPanel.setResizeWeight(0); + mainPanel.setDividerLocation(0.5); //1.0); + mainPanel.setResizeWeight(0.5); //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); //mainPanel.setLayout(new GridBagLayout()); toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); - treePanel.setLayout(new GridBagLayout()); - ctrlPanel.setLayout(new GridBagLayout()); +// treePanel.setLayout(new GridBagLayout()); + //ctrlPanel.setLayout(new GridBagLayout()); //materialPanel.setLayout(new GridBagLayout()); aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, @@ -426,7 +396,7 @@ static String newline = "\n"; protected static final String buttonString = "JButton"; StyledDocument doc; - JTextArea infoarea; + JTextPane infoarea; void ClearInfo() { @@ -475,13 +445,13 @@ //SendInfo("Name:", "bold"); if (sel.GetTextures() != null || debug) { - si.SendInfo(sel.toString(), "bold"); + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); if (sel.Size() > 0) { si.SendInfo("#children = " + sel.Size(), "regular"); } - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); if (debug) { try @@ -493,7 +463,10 @@ } if (full) - si.SendInfo(" BBox: " + minima + " - " + maxima, "regular"); + { + si.SendInfo(" BBox min: " + minima, "regular"); + si.SendInfo(" BBox max: " + maxima, "regular"); + } if (sel.bRep != null) { @@ -520,7 +493,7 @@ } if (sel.support != null) { - si.SendInfo(" support: " + sel.support, "regular"); + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); } if (sel.scriptnode != null) { @@ -591,6 +564,9 @@ { CameraPane.pointflow = (PointFlow) sel; } + + si.SendInfo("_____________________", "regular"); + si.SendInfo("", "regular"); } } @@ -622,52 +598,52 @@ cameraView.ToggleFullScreen(); } - private JTextArea createTextPane() + private JTextPane createTextPane() { - String[] initString = - { - "This is an editable JTextPane, ", //regular - "another ", //italic - "styled ", //bold - "text ", //small - "component, ", //large - "which supports embedded components..." + newline,//regular - " " + newline, //button - "...and embedded icons..." + newline, //regular - " ", //icon - newline + "JTextPane is a subclass of JEditorPane that " - + "uses a StyledEditorKit and StyledDocument, and provides " - + "cover methods for interacting with those objects." - }; +// TEXTAREA String[] initString = +// { +// "This is an editable JTextPane, ", //regular +// "another ", //italic +// "styled ", //bold +// "text ", //small +// "component, ", //large +// "which supports embedded components..." + newline,//regular +// " " + newline, //button +// "...and embedded icons..." + newline, //regular +// " ", //icon +// newline + "JTextPane is a subclass of JEditorPane that " +// + "uses a StyledEditorKit and StyledDocument, and provides " +// + "cover methods for interacting with those objects." +// }; +// +// String[] initStyles = +// { +// "regular", "italic", "bold", "small", "large", +// "regular", "button", "regular", "icon", +// "regular" +// }; +// +// JTextPane textPane = new JTextPane(); +// textPane.setEditable(true); +// /*StyledDocument*/ doc = textPane.getStyledDocument(); +// addStylesToDocument(doc); +// +// try +// { +// for (int j = 0; j < 2; j++) +// { +// for (int i = 0; i < initString.length; i++) +// { +// doc.insertString(doc.getLength(), initString[i], +// doc.getStyle(initStyles[i])); +// } +// } +// } catch (BadLocationException ble) +// { +// System.err.println("Couldn't insert initial text into text pane."); +// } - String[] initStyles = - { - "regular", "italic", "bold", "small", "large", - "regular", "button", "regular", "icon", - "regular" - }; - - JTextPane textPane = new JTextPane(); - textPane.setEditable(true); - /*StyledDocument*/ doc = textPane.getStyledDocument(); - addStylesToDocument(doc); - - try - { - for (int j = 0; j < 2; j++) - { - for (int i = 0; i < initString.length; i++) - { - doc.insertString(doc.getLength(), initString[i], - doc.getStyle(initStyles[i])); - } - } - } catch (BadLocationException ble) - { - System.err.println("Couldn't insert initial text into text pane."); - } - - return new JTextArea(); // textPane; + return new JTextPane(); // textPane; } protected void addStylesToDocument(StyledDocument doc) @@ -720,7 +696,7 @@ protected static ImageIcon createImageIcon(String path, String description) { - java.net.URL imgURL = GrafreeD.class.getResource(path); + java.net.URL imgURL = Grafreed.class.getResource(path); if (imgURL != null) { return new ImageIcon(imgURL, description); @@ -752,6 +728,7 @@ // NumberSlider vDivsField; // JCheckBox endcaps; JCheckBox liveCB; + JCheckBox selectCB; JCheckBox hideCB; JCheckBox link2masterCB; JCheckBox markCB; @@ -767,54 +744,44 @@ JButton slowerButton; JButton fasterButton; JButton remarkButton; + + cGridBag namePanel; + cGridBag setupPanel; + cGridBag commandsPanel; + cGridBag pushPanel; + cGridBag fillPanel; - JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on) + JCheckBox AddCheckBox(cGridBag panel, String label, boolean on) { JCheckBox cb; - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; - oe.aConstraints.gridwidth = 1; // 3; -// oe.aConstraints.weightx = 1; -// oe.aConstraints.anchor = GridBagConstraints.WEST; - oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); + panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); cb.addItemListener(this); -// oe.aConstraints.anchor = GridBagConstraints.EAST; - oe.aConstraints.gridwidth = 1; - oe.aConstraints.gridx += 1; return cb; } - cButton AddButton(ObjEditor oe, String label) + cButton AddButton(cGridBag panel, String label) { cButton cb; - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; - oe.aConstraints.gridwidth = 1; -// oe.aConstraints.weightx = 1; -// oe.aConstraints.anchor = GridBagConstraints.WEST; - oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); + panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); cb.addActionListener(this); -// oe.aConstraints.anchor = GridBagConstraints.EAST; - oe.aConstraints.gridwidth = 1; - oe.aConstraints.gridx += 1; return cb; } - JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item) + JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item) { JComboBox combo; - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; - oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); - oe.aConstraints.gridx += 1; + panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); combo.addActionListener(this); return combo; } - cNumberSlider AddSlider(cGridBag ctrlPanel, String label, double min, double max, double current, double pow) + cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow) { cGridBag control = new cGridBag(); @@ -826,12 +793,12 @@ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); combo.setFloat(current); - ctrlPanel.add(control); + panel.add(control); - return combo; + return control; } - cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current) + cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current) { cGridBag control = new cGridBag(); @@ -839,25 +806,21 @@ JLabel jlabel = new JLabel(label); jlabel.setHorizontalAlignment(SwingConstants.TRAILING); - ctrlPanel.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); - ctrlPanel.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); + control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); + control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); combo.setInteger(current); - ctrlPanel.add(control); + panel.add(control); - return combo; + return control; } JTextArea AddText(cGridBag ctrlPanel, String name) { JTextArea text; - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); text.addCaretListener(this); - aConstraints.gridx += 1; - aConstraints.gridwidth = 1; return text; } @@ -896,7 +859,7 @@ /* */ - void Return() // ObjEditor oe) + void Return0() // ObjEditor oe) { aConstraints.gridy += 1; aConstraints.gridx = 0; @@ -951,37 +914,72 @@ void SetupUI2(ObjEditor oe) { -// oe.aConstraints.weightx = 0; -// oe.aConstraints.weighty = 0; -// oe.aConstraints.gridx = 0; -// oe.aConstraints.gridy = 0; - SetupName(oe); + //SetupName(oe); + + namePanel = new cGridBag(); + + nameField = AddText(namePanel, copy.GetName()); + namePanel.add(nameField); + oe.ctrlPanel.add(namePanel); + + oe.ctrlPanel.Return(); if (!GroupEditor.allparams) return; - liveCB = AddCheckBox(oe, "Live", copy.live); - link2masterCB = AddCheckBox(oe, "Supp", copy.link2master); - hideCB = AddCheckBox(oe, "Hide", copy.hide); + setupPanel = new cGridBag().setVertical(false); + + liveCB = AddCheckBox(setupPanel, "Live", copy.live); + liveCB.setToolTipText("Animate object"); + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); + selectCB.setToolTipText("Make object selectable"); // Return(); - markCB = AddCheckBox(oe, "Mark", copy.marked); - rewindCB = AddCheckBox(oe, "Rew", copy.rewind); - randomCB = AddCheckBox(oe, "Rand", copy.random); - Return(); - resetButton = AddButton(oe, "Reset"); - stepButton = AddButton(oe, "Step"); + hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); + hideCB.setToolTipText("Hide object"); + markCB = AddCheckBox(setupPanel, "Mark", copy.marked); + markCB.setToolTipText("Set the animation target transform"); + + rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); + rewindCB.setToolTipText("Rewind animation"); + + randomCB = AddCheckBox(setupPanel, "Random", copy.random); + randomCB.setToolTipText("Option for switch node"); + + if (Globals.ADVANCED) + { + link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); + link2masterCB.setToolTipText("Attach to support"); + speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); + speedupCB.setToolTipText("Option motion capture"); + } + + oe.ctrlPanel.add(setupPanel); + oe.ctrlPanel.Return(); + + commandsPanel = new cGridBag().setVertical(false); + + resetButton = AddButton(commandsPanel, "Reset"); + resetButton.setToolTipText("Jump to frame zero"); + stepButton = AddButton(commandsPanel, "Step"); + stepButton.setToolTipText("Step one frame"); // resetAllButton = AddButton(oe, "Reset All"); // stepAllButton = AddButton(oe, "Step All"); - speedupCB = AddCheckBox(oe, "Speed", copy.speedup); // Return(); - slowerButton = AddButton(oe, "Slow"); - fasterButton = AddButton(oe, "Fast"); - remarkButton = AddButton(oe, "Rem"); + slowerButton = AddButton(commandsPanel, "Slow"); + slowerButton.setToolTipText("Decrease animation speed"); + fasterButton = AddButton(commandsPanel, "Fast"); + fasterButton.setToolTipText("Increase animation speed"); + remarkButton = AddButton(commandsPanel, "Remark"); + remarkButton.setToolTipText("Set the current transform as the target"); - Return(); + oe.ctrlPanel.add(commandsPanel); + oe.ctrlPanel.Return(); - normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1); - Return(); + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons + normalpushField = (cNumberSlider)pushPanel.getComponent(1); + //Return(); + + oe.ctrlPanel.Return(); // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2); // ObjEditor.aConstraints.gridx += 1; @@ -1076,7 +1074,7 @@ oe.aConstraints.gridwidth = 1; /**/ nameField = AddText(oe.ctrlPanel, copy.GetName()); - Return(); + oe.ctrlPanel.Return(); //ctrlPanel.add(textureButton = new Button("Texture...")); //textureButton.setEnabled(false); @@ -1253,10 +1251,11 @@ //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //tmp.setName("Edit"); objectPanel.add(materialPanel); - JPanel north = new JPanel(new BorderLayout()); - north.setName("Edit"); - north.add(ctrlPanel, BorderLayout.NORTH); - objectPanel.add(north); +// JPanel north = new JPanel(new BorderLayout()); +// north.setName("Edit"); +// north.add(ctrlPanel, BorderLayout.NORTH); +// objectPanel.add(north); + objectPanel.add(ctrlPanel); objectPanel.add(infoPanel); /* @@ -1278,7 +1277,7 @@ scrollpane.addMouseWheelListener(this); // Default not fast enough /*JTabbedPane*/ scenePanel = new cGridBag(); - scenePanel.preferredWidth = 7; + scenePanel.preferredWidth = 6; JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.add(scrollpane); @@ -1384,8 +1383,8 @@ // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); - frame.setSize(1024, 768); - frame.show(); + frame.setSize(1280, 860); + frame.setVisible(true); gridPanel.setDividerLocation(1.0); @@ -1415,7 +1414,7 @@ ctrlPanel.removeAll(); } - void SetupMaterial(cGridBag ctrlPanel) + void SetupMaterial(cGridBag panel) { /* ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); @@ -1424,18 +1423,26 @@ cGridBag editBar = new cGridBag().setVertical(false); - editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints); + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); + createMaterialButton.setToolTipText("Create material"); /* ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); */ - editBar.add(clearMaterialButton = new cButton("Clear")); // , aConstraints); - editBar.add(resetSlidersButton = new cButton("Reset")); // , aConstraints); - editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); - editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); + clearMaterialButton.setToolTipText("Clear material"); + + if (Globals.ADVANCED) + { + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); + } - ctrlPanel.add(editBar); + editBar.preferredHeight = 15; + + panel.add(editBar); /**/ //aConstraints.weighty = 0; @@ -1445,17 +1452,13 @@ //aConstraints.gridx += 1; //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); - JPanel colorPanel = new JPanel(new BorderLayout()); - colorPanel.setBorder(BorderFactory.createLineBorder(Color.black)); - cGridBag colorSection = new cGridBag().setVertical(true); - - colorPanel.add(colorSection); cGridBag color = new cGridBag(); color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + //colorField.preferredWidth = 200; colorSection.add(color); cGridBag modulation = new cGridBag(); @@ -1488,16 +1491,13 @@ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); colorSection.add(shadowbias); - ctrlPanel.add(colorPanel); + panel.add(new JSeparator()); + + panel.add(colorSection); //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); - JPanel diffusePanel = new JPanel(new BorderLayout()); - diffusePanel.setBorder(BorderFactory.createLineBorder(Color.black)); - cGridBag diffuseSection = new cGridBag().setVertical(true); - - diffusePanel.add(diffuseSection); cGridBag diffuse = new cGridBag(); diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints); @@ -1541,16 +1541,13 @@ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); diffuseSection.add(fakedepth); - ctrlPanel.add(diffusePanel); + panel.add(new JSeparator()); + + panel.add(diffuseSection); //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); - JPanel specularPanel = new JPanel(new BorderLayout()); - specularPanel.setBorder(BorderFactory.createLineBorder(Color.black)); - cGridBag specularSection = new cGridBag().setVertical(true); - - specularPanel.add(specularSection); cGridBag specular = new cGridBag(); specular.add(specularLabel = new JLabel("Specular")); // , aConstraints); @@ -1582,7 +1579,7 @@ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); specularSection.add(velvet); - shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1); + shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1); //Return(); // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints); // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING); @@ -1595,16 +1592,13 @@ // aConstraints.gridwidth = 1; - ctrlPanel.add(specularPanel); + panel.add(new JSeparator()); + + panel.add(specularSection); //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); - JPanel globalPanel = new JPanel(new BorderLayout()); - globalPanel.setBorder(BorderFactory.createLineBorder(Color.black)); - cGridBag globalSection = new cGridBag().setVertical(true); - - globalPanel.add(globalSection); cGridBag camera = new cGridBag(); camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); @@ -1630,16 +1624,13 @@ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); globalSection.add(opacity); - ctrlPanel.add(globalPanel); + panel.add(new JSeparator()); + + panel.add(globalSection); //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); - JPanel texturePanel = new JPanel(new BorderLayout()); - texturePanel.setBorder(BorderFactory.createLineBorder(Color.black)); - cGridBag textureSection = new cGridBag().setVertical(true); - - texturePanel.add(textureSection); cGridBag bump = new cGridBag(); bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints); @@ -1677,7 +1668,9 @@ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); textureSection.add(opacityPower); - ctrlPanel.add(texturePanel); + panel.add(new JSeparator()); + + panel.add(textureSection); //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); @@ -1714,12 +1707,15 @@ opacityPowerField.addChangeListener(this); /**/ - resetSlidersButton.addActionListener(this); clearMaterialButton.addActionListener(this); createMaterialButton.addActionListener(this); - - propagateToggle.addItemListener(this); - multiplyToggle.addItemListener(this); + + if (Globals.ADVANCED) + { + resetSlidersButton.addActionListener(this); + propagateToggle.addItemListener(this); + multiplyToggle.addItemListener(this); + } } void DropFile(java.io.File[] files, boolean textures) @@ -1890,7 +1886,7 @@ //? flashIt = false; CameraPane pane = (CameraPane) cameraView; - pane.clickStart(location.x, location.y, 0); + pane.clickStart(location.x, location.y, 0, 0); pane.clickEnd(location.x, location.y, 0, true); if (group.selection.size() == 1) @@ -1939,6 +1935,7 @@ e2.printStackTrace(); } } + LoadJMEThread loadThread; class LoadJMEThread extends Thread @@ -1996,6 +1993,7 @@ //LoadFile0(filename, converter); } } + LoadOBJThread loadObjThread; class LoadOBJThread extends Thread @@ -2347,11 +2345,11 @@ void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) { - if (GrafreeD.standAlone) + if (Grafreed.standAlone) { /**/ FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); - browser.show(); + browser.setVisible(true); String filename = browser.getFile(); if (filename != null && filename.length() > 0) { @@ -2496,6 +2494,7 @@ } if (input == null) { + new Exception().printStackTrace(); System.exit(0); } @@ -2710,7 +2709,8 @@ return; } - multiplyToggle.setSelected(mat.multiply); + if (multiplyToggle != null) + multiplyToggle.setSelected(mat.multiply); assert (object.projectedVertices != null); @@ -2925,7 +2925,7 @@ frame.validate(); return; - } else if (event.getSource() == toggleRandomItem) + } else if (event.getSource() == toggleSwitchItem) { cameraView.ToggleRandom(); cameraView.repaint(); @@ -2956,6 +2956,10 @@ { copy.live ^= true; return; + } else if (event.getSource() == selectCB) + { + copy.dontselect ^= true; + return; } else if (event.getSource() == hideCB) { copy.hide ^= true; @@ -2970,6 +2974,7 @@ if (event.getSource() == randomCB) { copy.random ^= true; + objEditor.refreshContents(); return; } if (event.getSource() == speedupCB) @@ -2993,8 +2998,9 @@ public void actionPerformed(ActionEvent event) { + Object source = event.getSource(); // SCRIPT DIALOG - if (event.getSource() == okbutton) + if (source == okbutton) { textpanel.setVisible(false); textpanel.remove(textarea); @@ -3006,7 +3012,7 @@ textarea = null; textpanel = null; } - if (event.getSource() == cancelbutton) + if (source == cancelbutton) { textpanel.setVisible(false); textpanel.remove(textarea); @@ -3018,50 +3024,50 @@ //applySelf(); //client.refreshEditWindow(); //refreshContents(); - if (event.getSource() == nameField) + if (source == nameField) { //System.out.println("ObjEditor " + event); applySelf0(true); //parent.applySelf(); objEditor.refreshContents(); - } else if (event.getSource() == resetButton) + } else if (source == resetButton) { CameraPane.fullreset = true; copy.Reset(); // ResetMeshes(); copy.Touch(); objEditor.refreshContents(); - } else if (event.getSource() == stepItem) + } else if (source == stepItem) { //cameraView.ONESTEP = true; Globals.ONESTEP = true; cameraView.repaint(); return; - } else if (event.getSource() == stepButton) + } else if (source == stepButton) { copy.Step(); copy.Touch(); objEditor.refreshContents(); - } else if (event.getSource() == slowerButton) + } else if (source == slowerButton) { copy.Slower(); copy.Touch(); objEditor.refreshContents(); - } else if (event.getSource() == fasterButton) + } else if (source == fasterButton) { copy.Faster(); copy.Touch(); objEditor.refreshContents(); - } else if (event.getSource() == remarkButton) + } else if (source == remarkButton) { copy.Remark(); copy.Touch(); objEditor.refreshContents(); - } else if (event.getSource() == stepAllButton) + } else if (source == stepAllButton) { copy.StepAll(); copy.Touch(); objEditor.refreshContents(); - } else if (event.getSource() == resetAllButton) + } else if (source == resetAllButton) { //CameraPane.fullreset = true; copy.ResetAll(); // ResetMeshes(); @@ -3094,53 +3100,75 @@ // Close(); // } // else - if (event.getSource() == resetSlidersButton) + if (source == resetSlidersButton) { ResetSliders(); - } else if (event.getSource() == clearMaterialButton) + } else if (source == clearMaterialButton) { ClearMaterial(); - } else if (event.getSource() == createMaterialButton) + } else if (source == createMaterialButton) { CreateMaterial(); - } else if (event.getSource() == clearPanelButton) + } else if (source == clearPanelButton) { copy.ClearUI(); refreshContents(true); - } /* - } - - public boolean action(Event event, Object arg) - { - */ else if (event.getSource() == closeItem) + } else if (source == importGFDItem) + { + ImportGFD(); + } else + if (source == importVRMLX3DItem) + { + ImportVRMLX3D(); + } else + if (source == import3DSItem) + { + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); + } else + if (source == importOBJItem) + { + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); + browser.setVisible(true); + String filename = browser.getFile(); + if (filename != null && filename.length() > 0) + { + String fullname = browser.getDirectory() + filename; + makeSomething(ReadOBJ(fullname), true); + } + } else + if (source == closeItem) { Close(); //return true; - } else if (event.getSource() == loadItem) + } else if (source == loadItem) { load(); //return true; - } else if (event.getSource() == saveItem) + } else if (source == newItem) + { + New(); + } else if (source == saveItem) { save(); //return true; - } else if (event.getSource() == saveAsItem) + } else if (source == saveAsItem) { saveAs(); //return true; - } else if (event.getSource() == reexportItem) + } else if (source == reexportItem) { reexport(); //return true; - } else if (event.getSource() == exportAsItem) + } else if (source == exportAsItem) { export(); //return true; - } else if (event.getSource() == povItem) + } else if (source == povItem) { generatePOV(); //return true; - } else if (event.getSource() == zBufferItem) + } else if (source == zBufferItem) { try { @@ -3162,21 +3190,8 @@ cameraView.repaint(); //return true; } - */ else if (event.getSource() == editCameraItem) - { - cameraView.ProtectCamera(); - cameraView.repaint(); - return; - } else if (event.getSource() == revertCameraItem) - { - cameraView.RevertCamera(); - cameraView.repaint(); - return; -// } else if (event.getSource() == textureButton) -// { -// return; // true; - } else // combos... - if (event.getSource() == texresMenu) + */ else // combos... + if (source == texresMenu) { System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); copy.texres = texresMenu.getSelectedIndex(); @@ -3188,12 +3203,252 @@ } } + void New() + { + while (copy.Size() > 1) + { + copy.remove(1); + } + + ResetModel(); + objEditor.refreshContents(); + } + + static public byte[] Compress(Object o) + { + try + { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); + ObjectOutputStream out = new ObjectOutputStream(zstream); + + out.writeObject(o); + + out.flush(); + + zstream.close(); + out.close(); + + return baos.toByteArray(); + } catch (Exception e) + { + System.err.println(e); + return null; + } + } + + static public Object Uncompress(byte[] bytes) + { + try + { + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); + java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); + ObjectInputStream in = new ObjectInputStream(istream); + Object obj = in.readObject(); + in.close(); + + return obj; + } catch (Exception e) + { + System.err.println(e); + return null; + } + } + + static public Object clone(Object o) + { + try + { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(baos); + + out.writeObject(o); + + out.flush(); + out.close(); + + byte[] bytes = baos.toByteArray(); + + System.out.println("clone = " + bytes.length); + + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); + ObjectInputStream in = new ObjectInputStream(bais); + Object obj = in.readObject(); + in.close(); + + return obj; + } catch (Exception e) + { + System.err.println(e); + return null; + } + } + + cRadio GetCurrentTab() + { + cRadio ab; + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) + { + ab = (cRadio)e.nextElement(); + if(ab.GetObject() == copy) + { + return ab; + } + } + + return null; + } + + java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); + + public void Save() + { + cRadio tab = GetCurrentTab(); + + copy.ExtractBigData(hashtable); + + //EditorFrame.m_MainFrame.requestFocusInWindow(); + tab.graphs[tab.undoindex++] = (Object3D)clone(copy); + + copy.RestoreBigData(hashtable); + + //assert(hashtable.isEmpty()); + + for (int i = tab.undoindex; i < tab.graphs.length; i++) + { + tab.graphs[i] = null; + } + + // test save + if (false) + { + try + { + FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); + ObjectOutputStream p = new ObjectOutputStream(ostream); + + p.writeObject(copy); + + p.flush(); + + ostream.close(); + } catch (Exception e) + { + e.printStackTrace(); + } + } + } + + void CopyChanged(Object3D obj) + { + copy.ExtractBigData(hashtable); + + copy.clear(); + + for (int i=0; i<obj.Size(); i++) + { + copy.add(obj.get(i)); + } + + copy.RestoreBigData(hashtable); + + //assert(hashtable.isEmpty()); + + copy.Touch(); + + ResetModel(); + copy.HardTouch(); // recompile? + + cRadio ab; + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) + { + ab = (cRadio)e.nextElement(); + Object3D test = copy.GetObject(ab.object.GetUUID()); + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); + if (test != null) + { + test.editWindow = ab.object.editWindow; + ab.object = test; + } + } + + refreshContents(); + } + + public void Undo() + { + cRadio tab = GetCurrentTab(); + + if (tab.undoindex == 0) + { + java.awt.Toolkit.getDefaultToolkit().beep(); + return; + } + + if (tab.graphs[tab.undoindex] == null) + { + Save(); + tab.undoindex -= 1; + } + + tab.undoindex -= 1; + + CopyChanged(tab.graphs[tab.undoindex]); + } + + public void Redo() + { + cRadio tab = GetCurrentTab(); + + if (tab.graphs[tab.undoindex + 1] == null) + { + java.awt.Toolkit.getDefaultToolkit().beep(); + return; + } + + tab.undoindex += 1; + + CopyChanged(tab.graphs[tab.undoindex]); + } + + void ImportGFD() + { + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); + browser.show(); + String filename = browser.getFile(); + if (filename != null && filename.length() > 0) + { + String fullname = browser.getDirectory() + filename; + + //Object3D readobj = + objEditor.ReadGFD(fullname, objEditor); + //makeSomething(readobj); + } + } + + void ImportVRMLX3D() + { + if (Grafreed.standAlone) + { + /**/ + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); + browser.show(); + String filename = browser.getFile(); + if (filename != null && filename.length() > 0) + { + String fullname = browser.getDirectory() + filename; + LoadVRMLX3D(fullname); + } + /**/ + } + } + void ToggleAnimation() { if (!Globals.ANIMATION) { FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); - browser.show(); + browser.setVisible(true); String filename = browser.getFile(); if (filename != null && filename.length() > 0) { @@ -3203,8 +3458,8 @@ Globals.ANIMATION ^= true; - GrafreeD.wav.cursor = 0; - GrafreeD.wav.loop = 0; + Grafreed.wav.cursor = 0; + Grafreed.wav.loop = 0; } } else { @@ -3254,7 +3509,7 @@ void CreateMaterial() { //copy.ClearMaterial(); // PATCH - copy.CreateMaterialS(multiplyToggle.isSelected()); + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); if (copy.selection.size() > 0) //SetMaterial(copy); { @@ -3313,11 +3568,11 @@ { copy.ResetBlockLoop(); // temporary problem - boolean random = CameraPane.RANDOM; - CameraPane.RANDOM = false; // parse everything + boolean random = CameraPane.SWITCH; + CameraPane.SWITCH = false; // parse everything copy.ResetDisplayList(); copy.HardTouch(); - CameraPane.RANDOM = random; + CameraPane.SWITCH = random; } // public void applySelf() @@ -3391,6 +3646,36 @@ { //System.out.println("Propagate = " + propagate); copy.UpdateMaterial(anchor, current, propagate); + + if (copy.material != null) + { + cMaterial mat = copy.material; + + colorField.SetToolTipValue((mat.color)); + modulationField.SetToolTipValue((mat.modulation)); + metalnessField.SetToolTipValue((mat.metalness)); + diffuseField.SetToolTipValue((mat.diffuse)); + specularField.SetToolTipValue((mat.specular)); + shininessField.SetToolTipValue((mat.shininess)); + shiftField.SetToolTipValue((mat.shift)); + ambientField.SetToolTipValue((mat.ambient)); + lightareaField.SetToolTipValue((mat.lightarea)); + diffusenessField.SetToolTipValue((mat.factor)); + velvetField.SetToolTipValue((mat.velvet)); + sheenField.SetToolTipValue((mat.sheen)); + subsurfaceField.SetToolTipValue((mat.subsurface)); + backlitField.SetToolTipValue((mat.bump)); + anisoField.SetToolTipValue((mat.aniso)); + anisoVField.SetToolTipValue((mat.anisoV)); + cameraField.SetToolTipValue((mat.cameralight)); + selfshadowField.SetToolTipValue((mat.diffuseness)); + shadowField.SetToolTipValue((mat.shadow)); + textureField.SetToolTipValue((mat.texture)); + opacityField.SetToolTipValue((mat.opacity)); + fakedepthField.SetToolTipValue((mat.fakedepth)); + shadowbiasField.SetToolTipValue((mat.shadowbias)); + } + if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) { copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); @@ -3435,6 +3720,7 @@ || e.getSource() == apertureField || e.getSource() == shadowblurField) { + new Exception().printStackTrace(); System.exit(0); cameraView.options1[0] = (float) focusField.getFloat() * 10; cameraView.options1[1] = (float) apertureField.getFloat() / 1000; @@ -3505,7 +3791,7 @@ } if (normalpushField != null) - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; } void SnapObject() @@ -3769,6 +4055,7 @@ void makeSomething(Object3D thing, boolean resetmodel) // deselect) { + Save(); //Tween.set(thing, 0).target(1).start(tweenManager); //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); // if (thing instanceof GenericJointDemo) @@ -3972,6 +4259,7 @@ } } } + LoadGFDThread loadGFDThread; void ReadGFD(String fullname, iCallBack cb) @@ -3992,7 +4280,8 @@ try { java.io.FileInputStream istream = new java.io.FileInputStream(fullname); - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); readobj = (Object3D) p.readObject(); istream.close(); @@ -4000,7 +4289,20 @@ readobj.ResetDisplayList(); } catch (Exception e) { - e.printStackTrace(); + //e.printStackTrace(); + try + { + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); + + readobj = (Object3D) p.readObject(); + istream.close(); + + readobj.ResetDisplayList(); + } catch (Exception e2) + { + e2.printStackTrace(); + } } // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } @@ -4055,6 +4357,7 @@ if (readobj != null) { + Save(); try { //readobj.deepCopySelf(copy); @@ -4117,7 +4420,7 @@ void load() // throws ClassNotFoundException { - if (GrafreeD.standAlone) + if (Grafreed.standAlone) { FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); browser.show(); @@ -4204,11 +4507,13 @@ try { FileOutputStream ostream = new FileOutputStream(lastname); - ObjectOutputStream p = new ObjectOutputStream(ostream); + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); + ObjectOutputStream p = new ObjectOutputStream(zstream); p.writeObject(copy); p.flush(); + zstream.close(); ostream.close(); //FileOutputStream fos = new FileOutputStream(fullname); @@ -4218,11 +4523,12 @@ { } } + String lastname; void saveAs() { - if (GrafreeD.standAlone) + if (Grafreed.standAlone) { FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); browser.setVisible(true); @@ -4327,13 +4633,13 @@ try { FileOutputStream ostream = new FileOutputStream(filename); - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); + ObjectOutputStream p = new ObjectOutputStream(zstream); Object3D objectparent = obj.parent; obj.parent = null; - Object3D object = (Object3D) GrafreeD.clone(obj); + Object3D object = (Object3D) Grafreed.clone(obj); obj.parent = objectparent; @@ -4345,8 +4651,8 @@ p.writeObject(object); p.flush(); + zstream.close(); ostream.close(); - // zstream.close(); // group.selection.get(0).parent = parent; //FileOutputStream fos = new FileOutputStream(fullname); @@ -4367,7 +4673,7 @@ buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); copy.generatePOV(buffer); - if (GrafreeD.standAlone) + if (Grafreed.standAlone) { FileDialog browser = new FileDialog(frame, "Export POV", 1); browser.show(); @@ -4393,7 +4699,8 @@ Object3D client; Object3D copy; MenuBar menuBar; - Menu windowMenu; + Menu fileMenu; + MenuItem newItem; MenuItem loadItem; MenuItem saveItem; MenuItem saveAsItem; @@ -4401,13 +4708,11 @@ MenuItem reexportItem; MenuItem povItem; MenuItem closeItem; - Menu cameraMenu; + CheckboxMenuItem zBufferItem; //MenuItem normalLensItem; - MenuItem editCameraItem; - MenuItem revertCameraItem; - CheckboxMenuItem toggleLiveItem; MenuItem stepItem; + CheckboxMenuItem toggleLiveItem; CheckboxMenuItem toggleFullScreenItem; CheckboxMenuItem toggleTimelineItem; CheckboxMenuItem toggleRenderItem; @@ -4416,7 +4721,7 @@ CheckboxMenuItem toggleFootContactItem; CheckboxMenuItem toggleDLItem; CheckboxMenuItem toggleTextureItem; - CheckboxMenuItem toggleRandomItem; + CheckboxMenuItem toggleSwitchItem; CheckboxMenuItem toggleRootItem; CheckboxMenuItem animationItem; CheckboxMenuItem toggleHandleItem; @@ -4424,7 +4729,7 @@ JSplitPane mainPanel; JScrollPane scrollpane; JPanel toolbarPanel; - JPanel treePanel; + cGridBag treePanel; JPanel radioPanel; ButtonGroup buttonGroup; cGridBag ctrlPanel; @@ -4553,4 +4858,9 @@ //ObjectUI parent; cNumberSlider normalpushField; + + private MenuItem importGFDItem; + private MenuItem importVRMLX3DItem; + private MenuItem import3DSItem; + private MenuItem importOBJItem; } -- Gitblit v1.6.2