.. | .. |
---|
168 | 168 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
169 | 169 | |
---|
170 | 170 | objEditor.ctrlPanel.remove(setupPanel); |
---|
| 171 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
171 | 172 | objEditor.ctrlPanel.remove(commandsPanel); |
---|
172 | 173 | objEditor.ctrlPanel.remove(pushPanel); |
---|
173 | 174 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
.. | .. |
---|
276 | 277 | void SetupMenu() |
---|
277 | 278 | { |
---|
278 | 279 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
279 | | - menuBar.add(windowMenu = new Menu("File")); |
---|
280 | | - windowMenu.add(loadItem = new MenuItem("Load...")); |
---|
281 | | - windowMenu.add("-"); |
---|
282 | | - windowMenu.add(saveItem = new MenuItem("Save")); |
---|
283 | | - windowMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
| 280 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 281 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 282 | + fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 283 | + |
---|
| 284 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 285 | + Menu menu = new Menu("Import"); |
---|
| 286 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 287 | + importOBJItem.addActionListener(this); |
---|
| 288 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 289 | + import3DSItem.addActionListener(this); |
---|
| 290 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 291 | + importVRMLX3DItem.addActionListener(this); |
---|
| 292 | + menu.add("-"); |
---|
| 293 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 294 | + importGFDItem.addActionListener(this); |
---|
| 295 | + fileMenu.add(menu); |
---|
| 296 | + fileMenu.add("-"); |
---|
| 297 | + |
---|
| 298 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 299 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
284 | 300 | //windowMenu.add(povItem = new MenuItem("Emit POV-Ray...")); |
---|
285 | | - windowMenu.add("-"); |
---|
286 | | - windowMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
287 | | - windowMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
288 | | - windowMenu.add("-"); |
---|
| 301 | + fileMenu.add("-"); |
---|
| 302 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 303 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 304 | + fileMenu.add("-"); |
---|
289 | 305 | if (client.parent != null) |
---|
290 | 306 | { |
---|
291 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 307 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
292 | 308 | } else |
---|
293 | 309 | { |
---|
294 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 310 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
295 | 311 | } |
---|
296 | 312 | |
---|
| 313 | + newItem.addActionListener(this); |
---|
297 | 314 | loadItem.addActionListener(this); |
---|
298 | 315 | saveItem.addActionListener(this); |
---|
299 | 316 | saveAsItem.addActionListener(this); |
---|
.. | .. |
---|
301 | 318 | reexportItem.addActionListener(this); |
---|
302 | 319 | //povItem.addActionListener(this); |
---|
303 | 320 | closeItem.addActionListener(this); |
---|
304 | | - |
---|
305 | | - menuBar.add(cameraMenu = new Menu("View")); |
---|
306 | | - //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer")); |
---|
307 | | - //zBufferItem.addActionListener(this); |
---|
308 | | - //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens")); |
---|
309 | | - //normalLensItem.addActionListener(this); |
---|
310 | | - cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera")); |
---|
311 | | - revertCameraItem.addActionListener(this); |
---|
312 | | - |
---|
313 | | - cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); |
---|
314 | | - toggleFullScreenItem.addItemListener(this); |
---|
315 | | - toggleFullScreenItem.setState(CameraPane.FULLSCREEN); |
---|
316 | | - cameraMenu.add("-"); |
---|
317 | | - |
---|
318 | | - cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); |
---|
319 | | - toggleTextureItem.addItemListener(this); |
---|
320 | | - toggleTextureItem.setState(CameraPane.textureon); |
---|
321 | | - |
---|
322 | | - cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch")); |
---|
323 | | - toggleSwitchItem.addItemListener(this); |
---|
324 | | - toggleSwitchItem.setState(CameraPane.SWITCH); |
---|
325 | | - |
---|
326 | | - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); |
---|
327 | | - toggleHandleItem.addItemListener(this); |
---|
328 | | - toggleHandleItem.setState(CameraPane.HANDLES); |
---|
329 | | - |
---|
330 | | - cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode")); |
---|
331 | | - togglePaintItem.addItemListener(this); |
---|
332 | | - togglePaintItem.setState(CameraPane.PAINTMODE); |
---|
333 | | - |
---|
334 | | - if (Globals.ADVANCED) |
---|
335 | | - { |
---|
336 | | - cameraMenu.add("-"); |
---|
337 | | - cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); |
---|
338 | | - toggleLiveItem.addItemListener(this); |
---|
339 | | - toggleLiveItem.setState(Globals.isLIVE()); |
---|
340 | | - |
---|
341 | | - cameraMenu.add(stepItem = new MenuItem("Step")); |
---|
342 | | - stepItem.addActionListener(this); |
---|
343 | | - // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); |
---|
344 | | - // toggleDLItem.addItemListener(this); |
---|
345 | | - // toggleDLItem.setState(false); |
---|
346 | | - |
---|
347 | | - cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render")); |
---|
348 | | - toggleRenderItem.addItemListener(this); |
---|
349 | | - toggleRenderItem.setState(!CameraPane.frozen); |
---|
350 | | - |
---|
351 | | - cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); |
---|
352 | | - toggleDebugItem.addItemListener(this); |
---|
353 | | - toggleDebugItem.setState(CameraPane.DEBUG); |
---|
354 | | - |
---|
355 | | - cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); |
---|
356 | | - toggleFrustumItem.addItemListener(this); |
---|
357 | | - toggleFrustumItem.setState(CameraPane.FRUSTUM); |
---|
358 | | - |
---|
359 | | - cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact")); |
---|
360 | | - toggleFootContactItem.addItemListener(this); |
---|
361 | | - toggleFootContactItem.setState(CameraPane.FOOTCONTACT); |
---|
362 | | - |
---|
363 | | - cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline")); |
---|
364 | | - toggleTimelineItem.addItemListener(this); |
---|
365 | | - } |
---|
366 | | - |
---|
367 | | -// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root")); |
---|
368 | | -// toggleRootItem.addItemListener(this); |
---|
369 | | -// toggleRootItem.setState(false); |
---|
370 | | -// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation")); |
---|
371 | | -// animationItem.addItemListener(this); |
---|
372 | | -// animationItem.setState(CameraPane.ANIMATION); |
---|
373 | | - cameraMenu.add("-"); |
---|
374 | | - cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera")); |
---|
375 | | - editCameraItem.addActionListener(this); |
---|
376 | 321 | |
---|
377 | 322 | objectPanel = new JTabbedPane(); |
---|
378 | 323 | toolbarPanel = new JPanel(); |
---|
.. | .. |
---|
475 | 420 | e.printStackTrace(); |
---|
476 | 421 | } |
---|
477 | 422 | |
---|
478 | | - String selection = infoarea.getText(); |
---|
479 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
480 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
481 | | - Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
| 423 | +// String selection = infoarea.getText(); |
---|
| 424 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 425 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 426 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
482 | 427 | //clipboard.setContents(data, data); |
---|
483 | 428 | } |
---|
484 | 429 | |
---|
.. | .. |
---|
501 | 446 | //SendInfo("Name:", "bold"); |
---|
502 | 447 | if (sel.GetTextures() != null || debug) |
---|
503 | 448 | { |
---|
504 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 449 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
505 | 450 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
506 | 451 | if (sel.Size() > 0) |
---|
507 | 452 | { |
---|
508 | 453 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
509 | 454 | } |
---|
510 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 455 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
511 | 456 | if (debug) |
---|
512 | 457 | { |
---|
513 | 458 | try |
---|
.. | .. |
---|
549 | 494 | } |
---|
550 | 495 | if (sel.support != null) |
---|
551 | 496 | { |
---|
552 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 497 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
553 | 498 | } |
---|
554 | 499 | if (sel.scriptnode != null) |
---|
555 | 500 | { |
---|
.. | .. |
---|
752 | 697 | protected static ImageIcon createImageIcon(String path, |
---|
753 | 698 | String description) |
---|
754 | 699 | { |
---|
755 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 700 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
756 | 701 | if (imgURL != null) |
---|
757 | 702 | { |
---|
758 | 703 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
784 | 729 | // NumberSlider vDivsField; |
---|
785 | 730 | // JCheckBox endcaps; |
---|
786 | 731 | JCheckBox liveCB; |
---|
| 732 | + JCheckBox selectCB; |
---|
787 | 733 | JCheckBox hideCB; |
---|
788 | 734 | JCheckBox link2masterCB; |
---|
789 | 735 | JCheckBox markCB; |
---|
.. | .. |
---|
802 | 748 | |
---|
803 | 749 | cGridBag namePanel; |
---|
804 | 750 | cGridBag setupPanel; |
---|
| 751 | + cGridBag setupPanel2; |
---|
805 | 752 | cGridBag commandsPanel; |
---|
806 | 753 | cGridBag pushPanel; |
---|
807 | 754 | cGridBag fillPanel; |
---|
.. | .. |
---|
986 | 933 | |
---|
987 | 934 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
988 | 935 | liveCB.setToolTipText("Animate object"); |
---|
| 936 | + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 937 | + selectCB.setToolTipText("Make object selectable"); |
---|
| 938 | +// Return(); |
---|
989 | 939 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
990 | 940 | hideCB.setToolTipText("Hide object"); |
---|
991 | | -// Return(); |
---|
992 | 941 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
993 | 942 | markCB.setToolTipText("Set the animation target transform"); |
---|
994 | 943 | |
---|
995 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 944 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 945 | + |
---|
| 946 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
996 | 947 | rewindCB.setToolTipText("Rewind animation"); |
---|
997 | 948 | |
---|
998 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
999 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 949 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 950 | + randomCB.setToolTipText("Rewind or Go back and forth randomly"); |
---|
1000 | 951 | |
---|
1001 | 952 | if (Globals.ADVANCED) |
---|
1002 | 953 | { |
---|
1003 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
| 954 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
1004 | 955 | link2masterCB.setToolTipText("Attach to support"); |
---|
1005 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 956 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1006 | 957 | speedupCB.setToolTipText("Option motion capture"); |
---|
1007 | 958 | } |
---|
1008 | 959 | |
---|
1009 | 960 | oe.ctrlPanel.add(setupPanel); |
---|
| 961 | + oe.ctrlPanel.Return(); |
---|
| 962 | + oe.ctrlPanel.add(setupPanel2); |
---|
1010 | 963 | oe.ctrlPanel.Return(); |
---|
1011 | 964 | |
---|
1012 | 965 | commandsPanel = new cGridBag().setVertical(false); |
---|
.. | .. |
---|
1028 | 981 | oe.ctrlPanel.add(commandsPanel); |
---|
1029 | 982 | oe.ctrlPanel.Return(); |
---|
1030 | 983 | |
---|
1031 | | - pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1); |
---|
| 984 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
1032 | 985 | normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
1033 | 986 | //Return(); |
---|
1034 | 987 | |
---|
.. | .. |
---|
1476 | 1429 | |
---|
1477 | 1430 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1478 | 1431 | |
---|
1479 | | - editBar.add(createMaterialButton = new cButton("Create", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 1432 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1480 | 1433 | createMaterialButton.setToolTipText("Create material"); |
---|
1481 | 1434 | |
---|
1482 | 1435 | /* |
---|
1483 | 1436 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1484 | 1437 | */ |
---|
1485 | 1438 | |
---|
1486 | | - editBar.add(clearMaterialButton = new cButton("Clear", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 1439 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1487 | 1440 | clearMaterialButton.setToolTipText("Clear material"); |
---|
1488 | 1441 | |
---|
1489 | 1442 | if (Globals.ADVANCED) |
---|
1490 | 1443 | { |
---|
1491 | | - editBar.add(resetSlidersButton = new cButton("Reset", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 1444 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1492 | 1445 | editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1493 | 1446 | editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
1494 | 1447 | } |
---|
.. | .. |
---|
1988 | 1941 | e2.printStackTrace(); |
---|
1989 | 1942 | } |
---|
1990 | 1943 | } |
---|
| 1944 | + |
---|
1991 | 1945 | LoadJMEThread loadThread; |
---|
1992 | 1946 | |
---|
1993 | 1947 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
2045 | 1999 | //LoadFile0(filename, converter); |
---|
2046 | 2000 | } |
---|
2047 | 2001 | } |
---|
| 2002 | + |
---|
2048 | 2003 | LoadOBJThread loadObjThread; |
---|
2049 | 2004 | |
---|
2050 | 2005 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2123 | 2078 | |
---|
2124 | 2079 | void LoadObjFile(String fullname) |
---|
2125 | 2080 | { |
---|
2126 | | - /* |
---|
| 2081 | + System.out.println("Loading " + fullname); |
---|
| 2082 | + /**/ |
---|
2127 | 2083 | //lastFilename = fullname; |
---|
2128 | 2084 | if(loadObjThread == null) |
---|
2129 | 2085 | { |
---|
2130 | | - loadObjThread = new LoadOBJThread(); |
---|
2131 | | - loadObjThread.start(); |
---|
| 2086 | + loadObjThread = new LoadOBJThread(); |
---|
| 2087 | + loadObjThread.start(); |
---|
2132 | 2088 | } |
---|
2133 | 2089 | |
---|
2134 | 2090 | loadObjThread.add(fullname); |
---|
2135 | | - */ |
---|
| 2091 | + /**/ |
---|
2136 | 2092 | |
---|
2137 | | - System.out.println("Loading " + fullname); |
---|
2138 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2093 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2139 | 2094 | } |
---|
2140 | 2095 | |
---|
2141 | 2096 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2396 | 2351 | |
---|
2397 | 2352 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2398 | 2353 | { |
---|
2399 | | - if (GrafreeD.standAlone) |
---|
| 2354 | + if (Grafreed.standAlone) |
---|
2400 | 2355 | { |
---|
2401 | 2356 | /**/ |
---|
2402 | 2357 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
.. | .. |
---|
2978 | 2933 | return; |
---|
2979 | 2934 | } else if (event.getSource() == toggleSwitchItem) |
---|
2980 | 2935 | { |
---|
2981 | | - cameraView.ToggleRandom(); |
---|
| 2936 | + cameraView.ToggleSwitch(); |
---|
2982 | 2937 | cameraView.repaint(); |
---|
2983 | 2938 | return; |
---|
2984 | 2939 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
3006 | 2961 | } else if (event.getSource() == liveCB) |
---|
3007 | 2962 | { |
---|
3008 | 2963 | copy.live ^= true; |
---|
| 2964 | + return; |
---|
| 2965 | + } else if (event.getSource() == selectCB) |
---|
| 2966 | + { |
---|
| 2967 | + copy.dontselect ^= true; |
---|
3009 | 2968 | return; |
---|
3010 | 2969 | } else if (event.getSource() == hideCB) |
---|
3011 | 2970 | { |
---|
.. | .. |
---|
3045 | 3004 | |
---|
3046 | 3005 | public void actionPerformed(ActionEvent event) |
---|
3047 | 3006 | { |
---|
| 3007 | + Object source = event.getSource(); |
---|
3048 | 3008 | // SCRIPT DIALOG |
---|
3049 | | - if (event.getSource() == okbutton) |
---|
| 3009 | + if (source == okbutton) |
---|
3050 | 3010 | { |
---|
3051 | 3011 | textpanel.setVisible(false); |
---|
3052 | 3012 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3058 | 3018 | textarea = null; |
---|
3059 | 3019 | textpanel = null; |
---|
3060 | 3020 | } |
---|
3061 | | - if (event.getSource() == cancelbutton) |
---|
| 3021 | + if (source == cancelbutton) |
---|
3062 | 3022 | { |
---|
3063 | 3023 | textpanel.setVisible(false); |
---|
3064 | 3024 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3070 | 3030 | //applySelf(); |
---|
3071 | 3031 | //client.refreshEditWindow(); |
---|
3072 | 3032 | //refreshContents(); |
---|
3073 | | - if (event.getSource() == nameField) |
---|
| 3033 | + if (source == nameField) |
---|
3074 | 3034 | { |
---|
3075 | 3035 | //System.out.println("ObjEditor " + event); |
---|
3076 | 3036 | applySelf0(true); |
---|
3077 | 3037 | //parent.applySelf(); |
---|
3078 | 3038 | objEditor.refreshContents(); |
---|
3079 | | - } else if (event.getSource() == resetButton) |
---|
| 3039 | + } else if (source == resetButton) |
---|
3080 | 3040 | { |
---|
3081 | 3041 | CameraPane.fullreset = true; |
---|
3082 | 3042 | copy.Reset(); // ResetMeshes(); |
---|
3083 | 3043 | copy.Touch(); |
---|
3084 | 3044 | objEditor.refreshContents(); |
---|
3085 | | - } else if (event.getSource() == stepItem) |
---|
| 3045 | + } else if (source == stepItem) |
---|
3086 | 3046 | { |
---|
3087 | 3047 | //cameraView.ONESTEP = true; |
---|
3088 | 3048 | Globals.ONESTEP = true; |
---|
3089 | 3049 | cameraView.repaint(); |
---|
3090 | 3050 | return; |
---|
3091 | | - } else if (event.getSource() == stepButton) |
---|
| 3051 | + } else if (source == stepButton) |
---|
3092 | 3052 | { |
---|
3093 | 3053 | copy.Step(); |
---|
3094 | 3054 | copy.Touch(); |
---|
3095 | 3055 | objEditor.refreshContents(); |
---|
3096 | | - } else if (event.getSource() == slowerButton) |
---|
| 3056 | + } else if (source == slowerButton) |
---|
3097 | 3057 | { |
---|
3098 | 3058 | copy.Slower(); |
---|
3099 | 3059 | copy.Touch(); |
---|
3100 | 3060 | objEditor.refreshContents(); |
---|
3101 | | - } else if (event.getSource() == fasterButton) |
---|
| 3061 | + } else if (source == fasterButton) |
---|
3102 | 3062 | { |
---|
3103 | 3063 | copy.Faster(); |
---|
3104 | 3064 | copy.Touch(); |
---|
3105 | 3065 | objEditor.refreshContents(); |
---|
3106 | | - } else if (event.getSource() == remarkButton) |
---|
| 3066 | + } else if (source == remarkButton) |
---|
3107 | 3067 | { |
---|
3108 | 3068 | copy.Remark(); |
---|
3109 | 3069 | copy.Touch(); |
---|
3110 | 3070 | objEditor.refreshContents(); |
---|
3111 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3071 | + } else if (source == stepAllButton) |
---|
3112 | 3072 | { |
---|
3113 | 3073 | copy.StepAll(); |
---|
3114 | 3074 | copy.Touch(); |
---|
3115 | 3075 | objEditor.refreshContents(); |
---|
3116 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3076 | + } else if (source == resetAllButton) |
---|
3117 | 3077 | { |
---|
3118 | 3078 | //CameraPane.fullreset = true; |
---|
3119 | 3079 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3146 | 3106 | // Close(); |
---|
3147 | 3107 | // } |
---|
3148 | 3108 | // else |
---|
3149 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3109 | + if (source == resetSlidersButton) |
---|
3150 | 3110 | { |
---|
3151 | 3111 | ResetSliders(); |
---|
3152 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3112 | + } else if (source == clearMaterialButton) |
---|
3153 | 3113 | { |
---|
3154 | 3114 | ClearMaterial(); |
---|
3155 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3115 | + } else if (source == createMaterialButton) |
---|
3156 | 3116 | { |
---|
3157 | 3117 | CreateMaterial(); |
---|
3158 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3118 | + } else if (source == clearPanelButton) |
---|
3159 | 3119 | { |
---|
3160 | 3120 | copy.ClearUI(); |
---|
3161 | 3121 | refreshContents(true); |
---|
3162 | | - } /* |
---|
3163 | | - } |
---|
3164 | | - |
---|
3165 | | - public boolean action(Event event, Object arg) |
---|
3166 | | - { |
---|
3167 | | - */ else if (event.getSource() == closeItem) |
---|
| 3122 | + } else if (source == importGFDItem) |
---|
| 3123 | + { |
---|
| 3124 | + ImportGFD(); |
---|
| 3125 | + } else |
---|
| 3126 | + if (source == importVRMLX3DItem) |
---|
| 3127 | + { |
---|
| 3128 | + ImportVRMLX3D(); |
---|
| 3129 | + } else |
---|
| 3130 | + if (source == import3DSItem) |
---|
| 3131 | + { |
---|
| 3132 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3133 | + } else |
---|
| 3134 | + if (source == importOBJItem) |
---|
| 3135 | + { |
---|
| 3136 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3137 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3138 | + browser.setVisible(true); |
---|
| 3139 | + String filename = browser.getFile(); |
---|
| 3140 | + if (filename != null && filename.length() > 0) |
---|
| 3141 | + { |
---|
| 3142 | + String fullname = browser.getDirectory() + filename; |
---|
| 3143 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3144 | + } |
---|
| 3145 | + } else |
---|
| 3146 | + if (source == closeItem) |
---|
3168 | 3147 | { |
---|
3169 | 3148 | Close(); |
---|
3170 | 3149 | //return true; |
---|
3171 | | - } else if (event.getSource() == loadItem) |
---|
| 3150 | + } else if (source == loadItem) |
---|
3172 | 3151 | { |
---|
3173 | 3152 | load(); |
---|
3174 | 3153 | //return true; |
---|
3175 | | - } else if (event.getSource() == saveItem) |
---|
| 3154 | + } else if (source == newItem) |
---|
| 3155 | + { |
---|
| 3156 | + New(); |
---|
| 3157 | + } else if (source == saveItem) |
---|
3176 | 3158 | { |
---|
3177 | 3159 | save(); |
---|
3178 | 3160 | //return true; |
---|
3179 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3161 | + } else if (source == saveAsItem) |
---|
3180 | 3162 | { |
---|
3181 | 3163 | saveAs(); |
---|
3182 | 3164 | //return true; |
---|
3183 | | - } else if (event.getSource() == reexportItem) |
---|
| 3165 | + } else if (source == reexportItem) |
---|
3184 | 3166 | { |
---|
3185 | 3167 | reexport(); |
---|
3186 | 3168 | //return true; |
---|
3187 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3169 | + } else if (source == exportAsItem) |
---|
3188 | 3170 | { |
---|
3189 | 3171 | export(); |
---|
3190 | 3172 | //return true; |
---|
3191 | | - } else if (event.getSource() == povItem) |
---|
| 3173 | + } else if (source == povItem) |
---|
3192 | 3174 | { |
---|
3193 | 3175 | generatePOV(); |
---|
3194 | 3176 | //return true; |
---|
3195 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3177 | + } else if (source == zBufferItem) |
---|
3196 | 3178 | { |
---|
3197 | 3179 | try |
---|
3198 | 3180 | { |
---|
.. | .. |
---|
3214 | 3196 | cameraView.repaint(); |
---|
3215 | 3197 | //return true; |
---|
3216 | 3198 | } |
---|
3217 | | - */ else if (event.getSource() == editCameraItem) |
---|
3218 | | - { |
---|
3219 | | - cameraView.ProtectCamera(); |
---|
3220 | | - cameraView.repaint(); |
---|
3221 | | - return; |
---|
3222 | | - } else if (event.getSource() == revertCameraItem) |
---|
3223 | | - { |
---|
3224 | | - cameraView.RevertCamera(); |
---|
3225 | | - cameraView.repaint(); |
---|
3226 | | - return; |
---|
3227 | | -// } else if (event.getSource() == textureButton) |
---|
3228 | | -// { |
---|
3229 | | -// return; // true; |
---|
3230 | | - } else // combos... |
---|
3231 | | - if (event.getSource() == texresMenu) |
---|
| 3199 | + */ else // combos... |
---|
| 3200 | + if (source == texresMenu) |
---|
3232 | 3201 | { |
---|
3233 | 3202 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3234 | 3203 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3240 | 3209 | } |
---|
3241 | 3210 | } |
---|
3242 | 3211 | |
---|
| 3212 | + void New() |
---|
| 3213 | + { |
---|
| 3214 | + while (copy.Size() > 1) |
---|
| 3215 | + { |
---|
| 3216 | + copy.remove(1); |
---|
| 3217 | + } |
---|
| 3218 | + |
---|
| 3219 | + ResetModel(); |
---|
| 3220 | + objEditor.refreshContents(); |
---|
| 3221 | + } |
---|
| 3222 | + |
---|
| 3223 | + static public byte[] Compress(Object3D o) |
---|
| 3224 | + { |
---|
| 3225 | + try |
---|
| 3226 | + { |
---|
| 3227 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3228 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3229 | + ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3230 | + |
---|
| 3231 | + Object3D parent = o.parent; |
---|
| 3232 | + o.parent = null; |
---|
| 3233 | + |
---|
| 3234 | + out.writeObject(o); |
---|
| 3235 | + |
---|
| 3236 | + o.parent = parent; |
---|
| 3237 | + |
---|
| 3238 | + out.flush(); |
---|
| 3239 | + |
---|
| 3240 | + zstream.close(); |
---|
| 3241 | + out.close(); |
---|
| 3242 | + |
---|
| 3243 | + return baos.toByteArray(); |
---|
| 3244 | + } catch (Exception e) |
---|
| 3245 | + { |
---|
| 3246 | + System.err.println(e); |
---|
| 3247 | + return null; |
---|
| 3248 | + } |
---|
| 3249 | + } |
---|
| 3250 | + |
---|
| 3251 | + static public Object Uncompress(byte[] bytes) |
---|
| 3252 | + { |
---|
| 3253 | + System.out.println("#bytes = " + bytes.length); |
---|
| 3254 | + try |
---|
| 3255 | + { |
---|
| 3256 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3257 | + java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3258 | + ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3259 | + Object obj = in.readObject(); |
---|
| 3260 | + in.close(); |
---|
| 3261 | + |
---|
| 3262 | + return obj; |
---|
| 3263 | + } catch (Exception e) |
---|
| 3264 | + { |
---|
| 3265 | + System.err.println(e); |
---|
| 3266 | + return null; |
---|
| 3267 | + } |
---|
| 3268 | + } |
---|
| 3269 | + |
---|
| 3270 | + static public Object clone(Object o) |
---|
| 3271 | + { |
---|
| 3272 | + try |
---|
| 3273 | + { |
---|
| 3274 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3275 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3276 | + |
---|
| 3277 | + out.writeObject(o); |
---|
| 3278 | + |
---|
| 3279 | + out.flush(); |
---|
| 3280 | + out.close(); |
---|
| 3281 | + |
---|
| 3282 | + byte[] bytes = baos.toByteArray(); |
---|
| 3283 | + |
---|
| 3284 | + System.out.println("clone = " + bytes.length); |
---|
| 3285 | + |
---|
| 3286 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3287 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3288 | + Object obj = in.readObject(); |
---|
| 3289 | + in.close(); |
---|
| 3290 | + |
---|
| 3291 | + return obj; |
---|
| 3292 | + } catch (Exception e) |
---|
| 3293 | + { |
---|
| 3294 | + System.err.println(e); |
---|
| 3295 | + return null; |
---|
| 3296 | + } |
---|
| 3297 | + } |
---|
| 3298 | + |
---|
| 3299 | + cRadio GetCurrentTab() |
---|
| 3300 | + { |
---|
| 3301 | + cRadio ab; |
---|
| 3302 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3303 | + { |
---|
| 3304 | + ab = (cRadio)e.nextElement(); |
---|
| 3305 | + if(ab.GetObject() == copy) |
---|
| 3306 | + { |
---|
| 3307 | + return ab; |
---|
| 3308 | + } |
---|
| 3309 | + } |
---|
| 3310 | + |
---|
| 3311 | + return null; |
---|
| 3312 | + } |
---|
| 3313 | + |
---|
| 3314 | + java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3315 | + |
---|
| 3316 | + public void Save() |
---|
| 3317 | + { |
---|
| 3318 | + cRadio tab = GetCurrentTab(); |
---|
| 3319 | + |
---|
| 3320 | + boolean temp = CameraPane.SWITCH; |
---|
| 3321 | + CameraPane.SWITCH = false; |
---|
| 3322 | + |
---|
| 3323 | + copy.ExtractBigData(hashtable); |
---|
| 3324 | + |
---|
| 3325 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3326 | + tab.graphs[tab.undoindex++] = Compress(copy); |
---|
| 3327 | + |
---|
| 3328 | + copy.RestoreBigData(hashtable); |
---|
| 3329 | + |
---|
| 3330 | + CameraPane.SWITCH = temp; |
---|
| 3331 | + |
---|
| 3332 | + //assert(hashtable.isEmpty()); |
---|
| 3333 | + |
---|
| 3334 | + for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3335 | + { |
---|
| 3336 | + tab.graphs[i] = null; |
---|
| 3337 | + } |
---|
| 3338 | + |
---|
| 3339 | + // test save |
---|
| 3340 | + if (false) |
---|
| 3341 | + { |
---|
| 3342 | + try |
---|
| 3343 | + { |
---|
| 3344 | + FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3345 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3346 | + |
---|
| 3347 | + p.writeObject(copy); |
---|
| 3348 | + |
---|
| 3349 | + p.flush(); |
---|
| 3350 | + |
---|
| 3351 | + ostream.close(); |
---|
| 3352 | + } catch (Exception e) |
---|
| 3353 | + { |
---|
| 3354 | + e.printStackTrace(); |
---|
| 3355 | + } |
---|
| 3356 | + } |
---|
| 3357 | + } |
---|
| 3358 | + |
---|
| 3359 | + void CopyChanged(Object3D obj) |
---|
| 3360 | + { |
---|
| 3361 | + boolean temp = CameraPane.SWITCH; |
---|
| 3362 | + CameraPane.SWITCH = false; |
---|
| 3363 | + |
---|
| 3364 | + copy.ExtractBigData(hashtable); |
---|
| 3365 | + |
---|
| 3366 | + copy.clear(); |
---|
| 3367 | + |
---|
| 3368 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3369 | + { |
---|
| 3370 | + copy.add(obj.get(i)); |
---|
| 3371 | + } |
---|
| 3372 | + |
---|
| 3373 | + copy.RestoreBigData(hashtable); |
---|
| 3374 | + |
---|
| 3375 | + CameraPane.SWITCH = temp; |
---|
| 3376 | + |
---|
| 3377 | + //assert(hashtable.isEmpty()); |
---|
| 3378 | + |
---|
| 3379 | + copy.Touch(); |
---|
| 3380 | + |
---|
| 3381 | + ResetModel(); |
---|
| 3382 | + copy.HardTouch(); // recompile? |
---|
| 3383 | + |
---|
| 3384 | + cRadio ab; |
---|
| 3385 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3386 | + { |
---|
| 3387 | + ab = (cRadio)e.nextElement(); |
---|
| 3388 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3389 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3390 | + if (test != null) |
---|
| 3391 | + { |
---|
| 3392 | + test.editWindow = ab.object.editWindow; |
---|
| 3393 | + ab.object = test; |
---|
| 3394 | + } |
---|
| 3395 | + } |
---|
| 3396 | + |
---|
| 3397 | + refreshContents(); |
---|
| 3398 | + } |
---|
| 3399 | + |
---|
| 3400 | + public void Undo() |
---|
| 3401 | + { |
---|
| 3402 | + cRadio tab = GetCurrentTab(); |
---|
| 3403 | + |
---|
| 3404 | + if (tab.undoindex == 0) |
---|
| 3405 | + { |
---|
| 3406 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3407 | + return; |
---|
| 3408 | + } |
---|
| 3409 | + |
---|
| 3410 | + if (tab.graphs[tab.undoindex] == null) |
---|
| 3411 | + { |
---|
| 3412 | + Save(); |
---|
| 3413 | + tab.undoindex -= 1; |
---|
| 3414 | + } |
---|
| 3415 | + |
---|
| 3416 | + tab.undoindex -= 1; |
---|
| 3417 | + |
---|
| 3418 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3419 | + } |
---|
| 3420 | + |
---|
| 3421 | + public void Redo() |
---|
| 3422 | + { |
---|
| 3423 | + cRadio tab = GetCurrentTab(); |
---|
| 3424 | + |
---|
| 3425 | + if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3426 | + { |
---|
| 3427 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3428 | + return; |
---|
| 3429 | + } |
---|
| 3430 | + |
---|
| 3431 | + tab.undoindex += 1; |
---|
| 3432 | + |
---|
| 3433 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3434 | + } |
---|
| 3435 | + |
---|
| 3436 | + void ImportGFD() |
---|
| 3437 | + { |
---|
| 3438 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 3439 | + browser.show(); |
---|
| 3440 | + String filename = browser.getFile(); |
---|
| 3441 | + if (filename != null && filename.length() > 0) |
---|
| 3442 | + { |
---|
| 3443 | + String fullname = browser.getDirectory() + filename; |
---|
| 3444 | + |
---|
| 3445 | + //Object3D readobj = |
---|
| 3446 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 3447 | + //makeSomething(readobj); |
---|
| 3448 | + } |
---|
| 3449 | + } |
---|
| 3450 | + |
---|
| 3451 | + void ImportVRMLX3D() |
---|
| 3452 | + { |
---|
| 3453 | + if (Grafreed.standAlone) |
---|
| 3454 | + { |
---|
| 3455 | + /**/ |
---|
| 3456 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 3457 | + browser.show(); |
---|
| 3458 | + String filename = browser.getFile(); |
---|
| 3459 | + if (filename != null && filename.length() > 0) |
---|
| 3460 | + { |
---|
| 3461 | + String fullname = browser.getDirectory() + filename; |
---|
| 3462 | + LoadVRMLX3D(fullname); |
---|
| 3463 | + } |
---|
| 3464 | + /**/ |
---|
| 3465 | + } |
---|
| 3466 | + } |
---|
| 3467 | + |
---|
3243 | 3468 | void ToggleAnimation() |
---|
3244 | 3469 | { |
---|
3245 | 3470 | if (!Globals.ANIMATION) |
---|
.. | .. |
---|
3255 | 3480 | |
---|
3256 | 3481 | Globals.ANIMATION ^= true; |
---|
3257 | 3482 | |
---|
3258 | | - GrafreeD.wav.cursor = 0; |
---|
3259 | | - GrafreeD.wav.loop = 0; |
---|
| 3483 | + Grafreed.wav.cursor = 0; |
---|
| 3484 | + Grafreed.wav.loop = 0; |
---|
3260 | 3485 | } |
---|
3261 | 3486 | } else |
---|
3262 | 3487 | { |
---|
.. | .. |
---|
3588 | 3813 | } |
---|
3589 | 3814 | |
---|
3590 | 3815 | if (normalpushField != null) |
---|
3591 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 3816 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3592 | 3817 | } |
---|
3593 | 3818 | |
---|
3594 | 3819 | void SnapObject() |
---|
.. | .. |
---|
3852 | 4077 | |
---|
3853 | 4078 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3854 | 4079 | { |
---|
| 4080 | + Save(); |
---|
3855 | 4081 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3856 | 4082 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3857 | 4083 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4055 | 4281 | } |
---|
4056 | 4282 | } |
---|
4057 | 4283 | } |
---|
| 4284 | + |
---|
4058 | 4285 | LoadGFDThread loadGFDThread; |
---|
4059 | 4286 | |
---|
4060 | 4287 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
4074 | 4301 | |
---|
4075 | 4302 | try |
---|
4076 | 4303 | { |
---|
| 4304 | + // Try compressed version first. |
---|
4077 | 4305 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4078 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4306 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4307 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
4079 | 4308 | |
---|
4080 | 4309 | readobj = (Object3D) p.readObject(); |
---|
4081 | 4310 | istream.close(); |
---|
.. | .. |
---|
4083 | 4312 | readobj.ResetDisplayList(); |
---|
4084 | 4313 | } catch (Exception e) |
---|
4085 | 4314 | { |
---|
4086 | | - e.printStackTrace(); |
---|
| 4315 | + //e.printStackTrace(); |
---|
| 4316 | + try |
---|
| 4317 | + { |
---|
| 4318 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4319 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4320 | + |
---|
| 4321 | + readobj = (Object3D) p.readObject(); |
---|
| 4322 | + istream.close(); |
---|
| 4323 | + |
---|
| 4324 | + readobj.ResetDisplayList(); |
---|
| 4325 | + } catch (Exception e2) |
---|
| 4326 | + { |
---|
| 4327 | + e2.printStackTrace(); |
---|
| 4328 | + } |
---|
4087 | 4329 | } |
---|
4088 | 4330 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4089 | 4331 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4129 | 4371 | |
---|
4130 | 4372 | void LoadIt(Object obj) |
---|
4131 | 4373 | { |
---|
| 4374 | + if (obj == null) |
---|
| 4375 | + { |
---|
| 4376 | + // Invalid file |
---|
| 4377 | + return; |
---|
| 4378 | + } |
---|
| 4379 | + |
---|
4132 | 4380 | System.out.println("Loaded " + obj); |
---|
4133 | 4381 | //new Exception().printStackTrace(); |
---|
4134 | 4382 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4138 | 4386 | |
---|
4139 | 4387 | if (readobj != null) |
---|
4140 | 4388 | { |
---|
| 4389 | + Save(); |
---|
4141 | 4390 | try |
---|
4142 | 4391 | { |
---|
4143 | 4392 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4200 | 4449 | |
---|
4201 | 4450 | void load() // throws ClassNotFoundException |
---|
4202 | 4451 | { |
---|
4203 | | - if (GrafreeD.standAlone) |
---|
| 4452 | + if (Grafreed.standAlone) |
---|
4204 | 4453 | { |
---|
4205 | 4454 | FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
4206 | 4455 | browser.show(); |
---|
.. | .. |
---|
4287 | 4536 | try |
---|
4288 | 4537 | { |
---|
4289 | 4538 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4290 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4539 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4540 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4291 | 4541 | |
---|
4292 | 4542 | p.writeObject(copy); |
---|
4293 | 4543 | p.flush(); |
---|
4294 | 4544 | |
---|
| 4545 | + zstream.close(); |
---|
4295 | 4546 | ostream.close(); |
---|
4296 | 4547 | |
---|
4297 | 4548 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4301 | 4552 | { |
---|
4302 | 4553 | } |
---|
4303 | 4554 | } |
---|
| 4555 | + |
---|
4304 | 4556 | String lastname; |
---|
4305 | 4557 | |
---|
4306 | 4558 | void saveAs() |
---|
4307 | 4559 | { |
---|
4308 | | - if (GrafreeD.standAlone) |
---|
| 4560 | + if (Grafreed.standAlone) |
---|
4309 | 4561 | { |
---|
4310 | 4562 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4311 | 4563 | browser.setVisible(true); |
---|
.. | .. |
---|
4410 | 4662 | try |
---|
4411 | 4663 | { |
---|
4412 | 4664 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4413 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4414 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 4665 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4666 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4415 | 4667 | |
---|
4416 | 4668 | Object3D objectparent = obj.parent; |
---|
4417 | 4669 | obj.parent = null; |
---|
4418 | 4670 | |
---|
4419 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 4671 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4420 | 4672 | |
---|
4421 | 4673 | obj.parent = objectparent; |
---|
4422 | 4674 | |
---|
.. | .. |
---|
4428 | 4680 | p.writeObject(object); |
---|
4429 | 4681 | p.flush(); |
---|
4430 | 4682 | |
---|
| 4683 | + zstream.close(); |
---|
4431 | 4684 | ostream.close(); |
---|
4432 | | - // zstream.close(); |
---|
4433 | 4685 | |
---|
4434 | 4686 | // group.selection.get(0).parent = parent; |
---|
4435 | 4687 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4450 | 4702 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4451 | 4703 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4452 | 4704 | copy.generatePOV(buffer); |
---|
4453 | | - if (GrafreeD.standAlone) |
---|
| 4705 | + if (Grafreed.standAlone) |
---|
4454 | 4706 | { |
---|
4455 | 4707 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4456 | 4708 | browser.show(); |
---|
.. | .. |
---|
4476 | 4728 | Object3D client; |
---|
4477 | 4729 | Object3D copy; |
---|
4478 | 4730 | MenuBar menuBar; |
---|
4479 | | - Menu windowMenu; |
---|
| 4731 | + Menu fileMenu; |
---|
| 4732 | + MenuItem newItem; |
---|
4480 | 4733 | MenuItem loadItem; |
---|
4481 | 4734 | MenuItem saveItem; |
---|
4482 | 4735 | MenuItem saveAsItem; |
---|
.. | .. |
---|
4484 | 4737 | MenuItem reexportItem; |
---|
4485 | 4738 | MenuItem povItem; |
---|
4486 | 4739 | MenuItem closeItem; |
---|
4487 | | - Menu cameraMenu; |
---|
| 4740 | + |
---|
4488 | 4741 | CheckboxMenuItem zBufferItem; |
---|
4489 | 4742 | //MenuItem normalLensItem; |
---|
4490 | | - MenuItem editCameraItem; |
---|
4491 | | - MenuItem revertCameraItem; |
---|
4492 | 4743 | MenuItem stepItem; |
---|
4493 | 4744 | CheckboxMenuItem toggleLiveItem; |
---|
4494 | 4745 | CheckboxMenuItem toggleFullScreenItem; |
---|
.. | .. |
---|
4636 | 4887 | //ObjectUI parent; |
---|
4637 | 4888 | |
---|
4638 | 4889 | cNumberSlider normalpushField; |
---|
| 4890 | + |
---|
| 4891 | + private MenuItem importGFDItem; |
---|
| 4892 | + private MenuItem importVRMLX3DItem; |
---|
| 4893 | + private MenuItem import3DSItem; |
---|
| 4894 | + private MenuItem importOBJItem; |
---|
4639 | 4895 | } |
---|