.. | .. |
---|
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 | | - cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline")); |
---|
313 | | - toggleTimelineItem.addItemListener(this); |
---|
314 | | - cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); |
---|
315 | | - toggleFullScreenItem.addItemListener(this); |
---|
316 | | - toggleFullScreenItem.setState(CameraPane.FULLSCREEN); |
---|
317 | | - cameraMenu.add("-"); |
---|
318 | | - cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); |
---|
319 | | - toggleTextureItem.addItemListener(this); |
---|
320 | | - toggleTextureItem.setState(CameraPane.textureon); |
---|
321 | | - cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); |
---|
322 | | - toggleLiveItem.addItemListener(this); |
---|
323 | | - toggleLiveItem.setState(Globals.isLIVE()); |
---|
324 | | - cameraMenu.add(stepItem = new MenuItem("Step")); |
---|
325 | | - stepItem.addActionListener(this); |
---|
326 | | -// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); |
---|
327 | | -// toggleDLItem.addItemListener(this); |
---|
328 | | -// toggleDLItem.setState(false); |
---|
329 | | - cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render")); |
---|
330 | | - toggleRenderItem.addItemListener(this); |
---|
331 | | - toggleRenderItem.setState(!CameraPane.frozen); |
---|
332 | | - cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); |
---|
333 | | - toggleDebugItem.addItemListener(this); |
---|
334 | | - toggleDebugItem.setState(CameraPane.DEBUG); |
---|
335 | | - cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); |
---|
336 | | - toggleFrustumItem.addItemListener(this); |
---|
337 | | - toggleFrustumItem.setState(CameraPane.FRUSTUM); |
---|
338 | | - cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact")); |
---|
339 | | - toggleFootContactItem.addItemListener(this); |
---|
340 | | - toggleFootContactItem.setState(CameraPane.FOOTCONTACT); |
---|
341 | | - cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random")); |
---|
342 | | - toggleRandomItem.addItemListener(this); |
---|
343 | | - toggleRandomItem.setState(CameraPane.RANDOM); |
---|
344 | | - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); |
---|
345 | | - toggleHandleItem.addItemListener(this); |
---|
346 | | - toggleHandleItem.setState(CameraPane.HANDLES); |
---|
347 | | - cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode")); |
---|
348 | | - togglePaintItem.addItemListener(this); |
---|
349 | | - togglePaintItem.setState(CameraPane.PAINTMODE); |
---|
350 | | -// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root")); |
---|
351 | | -// toggleRootItem.addItemListener(this); |
---|
352 | | -// toggleRootItem.setState(false); |
---|
353 | | -// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation")); |
---|
354 | | -// animationItem.addItemListener(this); |
---|
355 | | -// animationItem.setState(CameraPane.ANIMATION); |
---|
356 | | - cameraMenu.add("-"); |
---|
357 | | - cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera")); |
---|
358 | | - editCameraItem.addActionListener(this); |
---|
359 | 321 | |
---|
360 | 322 | objectPanel = new JTabbedPane(); |
---|
361 | 323 | toolbarPanel = new JPanel(); |
---|
.. | .. |
---|
458 | 420 | e.printStackTrace(); |
---|
459 | 421 | } |
---|
460 | 422 | |
---|
461 | | - String selection = infoarea.getText(); |
---|
462 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
463 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
464 | | - 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(); |
---|
465 | 427 | //clipboard.setContents(data, data); |
---|
466 | 428 | } |
---|
467 | 429 | |
---|
.. | .. |
---|
484 | 446 | //SendInfo("Name:", "bold"); |
---|
485 | 447 | if (sel.GetTextures() != null || debug) |
---|
486 | 448 | { |
---|
487 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 449 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
488 | 450 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
489 | 451 | if (sel.Size() > 0) |
---|
490 | 452 | { |
---|
491 | 453 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
492 | 454 | } |
---|
493 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 455 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
494 | 456 | if (debug) |
---|
495 | 457 | { |
---|
496 | 458 | try |
---|
.. | .. |
---|
532 | 494 | } |
---|
533 | 495 | if (sel.support != null) |
---|
534 | 496 | { |
---|
535 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 497 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
536 | 498 | } |
---|
537 | 499 | if (sel.scriptnode != null) |
---|
538 | 500 | { |
---|
.. | .. |
---|
735 | 697 | protected static ImageIcon createImageIcon(String path, |
---|
736 | 698 | String description) |
---|
737 | 699 | { |
---|
738 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 700 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
739 | 701 | if (imgURL != null) |
---|
740 | 702 | { |
---|
741 | 703 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
767 | 729 | // NumberSlider vDivsField; |
---|
768 | 730 | // JCheckBox endcaps; |
---|
769 | 731 | JCheckBox liveCB; |
---|
| 732 | + JCheckBox selectCB; |
---|
770 | 733 | JCheckBox hideCB; |
---|
771 | 734 | JCheckBox link2masterCB; |
---|
772 | 735 | JCheckBox markCB; |
---|
.. | .. |
---|
785 | 748 | |
---|
786 | 749 | cGridBag namePanel; |
---|
787 | 750 | cGridBag setupPanel; |
---|
| 751 | + cGridBag setupPanel2; |
---|
788 | 752 | cGridBag commandsPanel; |
---|
789 | 753 | cGridBag pushPanel; |
---|
790 | 754 | cGridBag fillPanel; |
---|
.. | .. |
---|
969 | 933 | |
---|
970 | 934 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
971 | 935 | liveCB.setToolTipText("Animate object"); |
---|
| 936 | + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 937 | + selectCB.setToolTipText("Make object selectable"); |
---|
| 938 | +// Return(); |
---|
972 | 939 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
973 | 940 | hideCB.setToolTipText("Hide object"); |
---|
974 | | -// Return(); |
---|
975 | 941 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
976 | 942 | markCB.setToolTipText("Set the animation target transform"); |
---|
977 | 943 | |
---|
978 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 944 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 945 | + |
---|
| 946 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
979 | 947 | rewindCB.setToolTipText("Rewind animation"); |
---|
980 | 948 | |
---|
981 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
982 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 949 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 950 | + randomCB.setToolTipText("Rewind or Go back and forth randomly"); |
---|
983 | 951 | |
---|
984 | 952 | if (Globals.ADVANCED) |
---|
985 | 953 | { |
---|
986 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
| 954 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
987 | 955 | link2masterCB.setToolTipText("Attach to support"); |
---|
988 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 956 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
989 | 957 | speedupCB.setToolTipText("Option motion capture"); |
---|
990 | 958 | } |
---|
991 | 959 | |
---|
992 | 960 | oe.ctrlPanel.add(setupPanel); |
---|
| 961 | + oe.ctrlPanel.Return(); |
---|
| 962 | + oe.ctrlPanel.add(setupPanel2); |
---|
993 | 963 | oe.ctrlPanel.Return(); |
---|
994 | 964 | |
---|
995 | 965 | commandsPanel = new cGridBag().setVertical(false); |
---|
.. | .. |
---|
1011 | 981 | oe.ctrlPanel.add(commandsPanel); |
---|
1012 | 982 | oe.ctrlPanel.Return(); |
---|
1013 | 983 | |
---|
1014 | | - 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 |
---|
1015 | 985 | normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
1016 | 986 | //Return(); |
---|
1017 | 987 | |
---|
.. | .. |
---|
1313 | 1283 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1314 | 1284 | |
---|
1315 | 1285 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1316 | | - scenePanel.preferredWidth = 7; |
---|
| 1286 | + scenePanel.preferredWidth = 6; |
---|
1317 | 1287 | |
---|
1318 | 1288 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1319 | 1289 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1419 | 1389 | |
---|
1420 | 1390 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1421 | 1391 | |
---|
1422 | | - frame.setSize(1024, 768); |
---|
1423 | | - frame.show(); |
---|
| 1392 | + frame.setSize(1280, 860); |
---|
| 1393 | + frame.setVisible(true); |
---|
1424 | 1394 | |
---|
1425 | 1395 | gridPanel.setDividerLocation(1.0); |
---|
1426 | 1396 | |
---|
.. | .. |
---|
1459 | 1429 | |
---|
1460 | 1430 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1461 | 1431 | |
---|
1462 | | - editBar.add(createMaterialButton = new cButton("Create", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 1432 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1463 | 1433 | createMaterialButton.setToolTipText("Create material"); |
---|
1464 | 1434 | |
---|
1465 | 1435 | /* |
---|
1466 | 1436 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1467 | 1437 | */ |
---|
1468 | 1438 | |
---|
1469 | | - editBar.add(clearMaterialButton = new cButton("Clear", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 1439 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1470 | 1440 | clearMaterialButton.setToolTipText("Clear material"); |
---|
1471 | 1441 | |
---|
1472 | | - editBar.add(resetSlidersButton = new cButton("Reset", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
1473 | | - editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1474 | | - editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 1442 | + if (Globals.ADVANCED) |
---|
| 1443 | + { |
---|
| 1444 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1445 | + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
| 1446 | + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 1447 | + } |
---|
1475 | 1448 | |
---|
1476 | 1449 | editBar.preferredHeight = 15; |
---|
1477 | 1450 | |
---|
.. | .. |
---|
1740 | 1713 | opacityPowerField.addChangeListener(this); |
---|
1741 | 1714 | /**/ |
---|
1742 | 1715 | |
---|
1743 | | - resetSlidersButton.addActionListener(this); |
---|
1744 | 1716 | clearMaterialButton.addActionListener(this); |
---|
1745 | 1717 | createMaterialButton.addActionListener(this); |
---|
1746 | | - |
---|
1747 | | - propagateToggle.addItemListener(this); |
---|
1748 | | - multiplyToggle.addItemListener(this); |
---|
| 1718 | + |
---|
| 1719 | + if (Globals.ADVANCED) |
---|
| 1720 | + { |
---|
| 1721 | + resetSlidersButton.addActionListener(this); |
---|
| 1722 | + propagateToggle.addItemListener(this); |
---|
| 1723 | + multiplyToggle.addItemListener(this); |
---|
| 1724 | + } |
---|
1749 | 1725 | } |
---|
1750 | 1726 | |
---|
1751 | 1727 | void DropFile(java.io.File[] files, boolean textures) |
---|
.. | .. |
---|
1916 | 1892 | |
---|
1917 | 1893 | //? flashIt = false; |
---|
1918 | 1894 | CameraPane pane = (CameraPane) cameraView; |
---|
1919 | | - pane.clickStart(location.x, location.y, 0); |
---|
| 1895 | + pane.clickStart(location.x, location.y, 0, 0); |
---|
1920 | 1896 | pane.clickEnd(location.x, location.y, 0, true); |
---|
1921 | 1897 | |
---|
1922 | 1898 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
1965 | 1941 | e2.printStackTrace(); |
---|
1966 | 1942 | } |
---|
1967 | 1943 | } |
---|
| 1944 | + |
---|
1968 | 1945 | LoadJMEThread loadThread; |
---|
1969 | 1946 | |
---|
1970 | 1947 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
2022 | 1999 | //LoadFile0(filename, converter); |
---|
2023 | 2000 | } |
---|
2024 | 2001 | } |
---|
| 2002 | + |
---|
2025 | 2003 | LoadOBJThread loadObjThread; |
---|
2026 | 2004 | |
---|
2027 | 2005 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2100 | 2078 | |
---|
2101 | 2079 | void LoadObjFile(String fullname) |
---|
2102 | 2080 | { |
---|
2103 | | - /* |
---|
| 2081 | + System.out.println("Loading " + fullname); |
---|
| 2082 | + /**/ |
---|
2104 | 2083 | //lastFilename = fullname; |
---|
2105 | 2084 | if(loadObjThread == null) |
---|
2106 | 2085 | { |
---|
2107 | | - loadObjThread = new LoadOBJThread(); |
---|
2108 | | - loadObjThread.start(); |
---|
| 2086 | + loadObjThread = new LoadOBJThread(); |
---|
| 2087 | + loadObjThread.start(); |
---|
2109 | 2088 | } |
---|
2110 | 2089 | |
---|
2111 | 2090 | loadObjThread.add(fullname); |
---|
2112 | | - */ |
---|
| 2091 | + /**/ |
---|
2113 | 2092 | |
---|
2114 | | - System.out.println("Loading " + fullname); |
---|
2115 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2093 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2116 | 2094 | } |
---|
2117 | 2095 | |
---|
2118 | 2096 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2373 | 2351 | |
---|
2374 | 2352 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2375 | 2353 | { |
---|
2376 | | - if (GrafreeD.standAlone) |
---|
| 2354 | + if (Grafreed.standAlone) |
---|
2377 | 2355 | { |
---|
2378 | 2356 | /**/ |
---|
2379 | 2357 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2380 | | - browser.show(); |
---|
| 2358 | + browser.setVisible(true); |
---|
2381 | 2359 | String filename = browser.getFile(); |
---|
2382 | 2360 | if (filename != null && filename.length() > 0) |
---|
2383 | 2361 | { |
---|
.. | .. |
---|
2737 | 2715 | return; |
---|
2738 | 2716 | } |
---|
2739 | 2717 | |
---|
2740 | | - multiplyToggle.setSelected(mat.multiply); |
---|
| 2718 | + if (multiplyToggle != null) |
---|
| 2719 | + multiplyToggle.setSelected(mat.multiply); |
---|
2741 | 2720 | |
---|
2742 | 2721 | assert (object.projectedVertices != null); |
---|
2743 | 2722 | |
---|
.. | .. |
---|
2952 | 2931 | frame.validate(); |
---|
2953 | 2932 | |
---|
2954 | 2933 | return; |
---|
2955 | | - } else if (event.getSource() == toggleRandomItem) |
---|
| 2934 | + } else if (event.getSource() == toggleSwitchItem) |
---|
2956 | 2935 | { |
---|
2957 | | - cameraView.ToggleRandom(); |
---|
| 2936 | + cameraView.ToggleSwitch(); |
---|
2958 | 2937 | cameraView.repaint(); |
---|
2959 | 2938 | return; |
---|
2960 | 2939 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
2982 | 2961 | } else if (event.getSource() == liveCB) |
---|
2983 | 2962 | { |
---|
2984 | 2963 | copy.live ^= true; |
---|
| 2964 | + return; |
---|
| 2965 | + } else if (event.getSource() == selectCB) |
---|
| 2966 | + { |
---|
| 2967 | + copy.dontselect ^= true; |
---|
2985 | 2968 | return; |
---|
2986 | 2969 | } else if (event.getSource() == hideCB) |
---|
2987 | 2970 | { |
---|
.. | .. |
---|
3021 | 3004 | |
---|
3022 | 3005 | public void actionPerformed(ActionEvent event) |
---|
3023 | 3006 | { |
---|
| 3007 | + Object source = event.getSource(); |
---|
3024 | 3008 | // SCRIPT DIALOG |
---|
3025 | | - if (event.getSource() == okbutton) |
---|
| 3009 | + if (source == okbutton) |
---|
3026 | 3010 | { |
---|
3027 | 3011 | textpanel.setVisible(false); |
---|
3028 | 3012 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3034 | 3018 | textarea = null; |
---|
3035 | 3019 | textpanel = null; |
---|
3036 | 3020 | } |
---|
3037 | | - if (event.getSource() == cancelbutton) |
---|
| 3021 | + if (source == cancelbutton) |
---|
3038 | 3022 | { |
---|
3039 | 3023 | textpanel.setVisible(false); |
---|
3040 | 3024 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3046 | 3030 | //applySelf(); |
---|
3047 | 3031 | //client.refreshEditWindow(); |
---|
3048 | 3032 | //refreshContents(); |
---|
3049 | | - if (event.getSource() == nameField) |
---|
| 3033 | + if (source == nameField) |
---|
3050 | 3034 | { |
---|
3051 | 3035 | //System.out.println("ObjEditor " + event); |
---|
3052 | 3036 | applySelf0(true); |
---|
3053 | 3037 | //parent.applySelf(); |
---|
3054 | 3038 | objEditor.refreshContents(); |
---|
3055 | | - } else if (event.getSource() == resetButton) |
---|
| 3039 | + } else if (source == resetButton) |
---|
3056 | 3040 | { |
---|
3057 | 3041 | CameraPane.fullreset = true; |
---|
3058 | 3042 | copy.Reset(); // ResetMeshes(); |
---|
3059 | 3043 | copy.Touch(); |
---|
3060 | 3044 | objEditor.refreshContents(); |
---|
3061 | | - } else if (event.getSource() == stepItem) |
---|
| 3045 | + } else if (source == stepItem) |
---|
3062 | 3046 | { |
---|
3063 | 3047 | //cameraView.ONESTEP = true; |
---|
3064 | 3048 | Globals.ONESTEP = true; |
---|
3065 | 3049 | cameraView.repaint(); |
---|
3066 | 3050 | return; |
---|
3067 | | - } else if (event.getSource() == stepButton) |
---|
| 3051 | + } else if (source == stepButton) |
---|
3068 | 3052 | { |
---|
3069 | 3053 | copy.Step(); |
---|
3070 | 3054 | copy.Touch(); |
---|
3071 | 3055 | objEditor.refreshContents(); |
---|
3072 | | - } else if (event.getSource() == slowerButton) |
---|
| 3056 | + } else if (source == slowerButton) |
---|
3073 | 3057 | { |
---|
3074 | 3058 | copy.Slower(); |
---|
3075 | 3059 | copy.Touch(); |
---|
3076 | 3060 | objEditor.refreshContents(); |
---|
3077 | | - } else if (event.getSource() == fasterButton) |
---|
| 3061 | + } else if (source == fasterButton) |
---|
3078 | 3062 | { |
---|
3079 | 3063 | copy.Faster(); |
---|
3080 | 3064 | copy.Touch(); |
---|
3081 | 3065 | objEditor.refreshContents(); |
---|
3082 | | - } else if (event.getSource() == remarkButton) |
---|
| 3066 | + } else if (source == remarkButton) |
---|
3083 | 3067 | { |
---|
3084 | 3068 | copy.Remark(); |
---|
3085 | 3069 | copy.Touch(); |
---|
3086 | 3070 | objEditor.refreshContents(); |
---|
3087 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3071 | + } else if (source == stepAllButton) |
---|
3088 | 3072 | { |
---|
3089 | 3073 | copy.StepAll(); |
---|
3090 | 3074 | copy.Touch(); |
---|
3091 | 3075 | objEditor.refreshContents(); |
---|
3092 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3076 | + } else if (source == resetAllButton) |
---|
3093 | 3077 | { |
---|
3094 | 3078 | //CameraPane.fullreset = true; |
---|
3095 | 3079 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3122 | 3106 | // Close(); |
---|
3123 | 3107 | // } |
---|
3124 | 3108 | // else |
---|
3125 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3109 | + if (source == resetSlidersButton) |
---|
3126 | 3110 | { |
---|
3127 | 3111 | ResetSliders(); |
---|
3128 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3112 | + } else if (source == clearMaterialButton) |
---|
3129 | 3113 | { |
---|
3130 | 3114 | ClearMaterial(); |
---|
3131 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3115 | + } else if (source == createMaterialButton) |
---|
3132 | 3116 | { |
---|
3133 | 3117 | CreateMaterial(); |
---|
3134 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3118 | + } else if (source == clearPanelButton) |
---|
3135 | 3119 | { |
---|
3136 | 3120 | copy.ClearUI(); |
---|
3137 | 3121 | refreshContents(true); |
---|
3138 | | - } /* |
---|
3139 | | - } |
---|
3140 | | - |
---|
3141 | | - public boolean action(Event event, Object arg) |
---|
3142 | | - { |
---|
3143 | | - */ 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) |
---|
3144 | 3147 | { |
---|
3145 | 3148 | Close(); |
---|
3146 | 3149 | //return true; |
---|
3147 | | - } else if (event.getSource() == loadItem) |
---|
| 3150 | + } else if (source == loadItem) |
---|
3148 | 3151 | { |
---|
3149 | 3152 | load(); |
---|
3150 | 3153 | //return true; |
---|
3151 | | - } else if (event.getSource() == saveItem) |
---|
| 3154 | + } else if (source == newItem) |
---|
| 3155 | + { |
---|
| 3156 | + New(); |
---|
| 3157 | + } else if (source == saveItem) |
---|
3152 | 3158 | { |
---|
3153 | 3159 | save(); |
---|
3154 | 3160 | //return true; |
---|
3155 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3161 | + } else if (source == saveAsItem) |
---|
3156 | 3162 | { |
---|
3157 | 3163 | saveAs(); |
---|
3158 | 3164 | //return true; |
---|
3159 | | - } else if (event.getSource() == reexportItem) |
---|
| 3165 | + } else if (source == reexportItem) |
---|
3160 | 3166 | { |
---|
3161 | 3167 | reexport(); |
---|
3162 | 3168 | //return true; |
---|
3163 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3169 | + } else if (source == exportAsItem) |
---|
3164 | 3170 | { |
---|
3165 | 3171 | export(); |
---|
3166 | 3172 | //return true; |
---|
3167 | | - } else if (event.getSource() == povItem) |
---|
| 3173 | + } else if (source == povItem) |
---|
3168 | 3174 | { |
---|
3169 | 3175 | generatePOV(); |
---|
3170 | 3176 | //return true; |
---|
3171 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3177 | + } else if (source == zBufferItem) |
---|
3172 | 3178 | { |
---|
3173 | 3179 | try |
---|
3174 | 3180 | { |
---|
.. | .. |
---|
3190 | 3196 | cameraView.repaint(); |
---|
3191 | 3197 | //return true; |
---|
3192 | 3198 | } |
---|
3193 | | - */ else if (event.getSource() == editCameraItem) |
---|
3194 | | - { |
---|
3195 | | - cameraView.ProtectCamera(); |
---|
3196 | | - cameraView.repaint(); |
---|
3197 | | - return; |
---|
3198 | | - } else if (event.getSource() == revertCameraItem) |
---|
3199 | | - { |
---|
3200 | | - cameraView.RevertCamera(); |
---|
3201 | | - cameraView.repaint(); |
---|
3202 | | - return; |
---|
3203 | | -// } else if (event.getSource() == textureButton) |
---|
3204 | | -// { |
---|
3205 | | -// return; // true; |
---|
3206 | | - } else // combos... |
---|
3207 | | - if (event.getSource() == texresMenu) |
---|
| 3199 | + */ else // combos... |
---|
| 3200 | + if (source == texresMenu) |
---|
3208 | 3201 | { |
---|
3209 | 3202 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3210 | 3203 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3216 | 3209 | } |
---|
3217 | 3210 | } |
---|
3218 | 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 | + |
---|
3219 | 3468 | void ToggleAnimation() |
---|
3220 | 3469 | { |
---|
3221 | 3470 | if (!Globals.ANIMATION) |
---|
.. | .. |
---|
3231 | 3480 | |
---|
3232 | 3481 | Globals.ANIMATION ^= true; |
---|
3233 | 3482 | |
---|
3234 | | - GrafreeD.wav.cursor = 0; |
---|
3235 | | - GrafreeD.wav.loop = 0; |
---|
| 3483 | + Grafreed.wav.cursor = 0; |
---|
| 3484 | + Grafreed.wav.loop = 0; |
---|
3236 | 3485 | } |
---|
3237 | 3486 | } else |
---|
3238 | 3487 | { |
---|
.. | .. |
---|
3253 | 3502 | callee.refreshContents(); |
---|
3254 | 3503 | } else |
---|
3255 | 3504 | { |
---|
3256 | | - new Exception().printStackTrace(); |
---|
3257 | 3505 | System.exit(0); |
---|
3258 | 3506 | } |
---|
3259 | 3507 | } |
---|
.. | .. |
---|
3283 | 3531 | void CreateMaterial() |
---|
3284 | 3532 | { |
---|
3285 | 3533 | //copy.ClearMaterial(); // PATCH |
---|
3286 | | - copy.CreateMaterialS(multiplyToggle.isSelected()); |
---|
| 3534 | + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); |
---|
3287 | 3535 | if (copy.selection.size() > 0) |
---|
3288 | 3536 | //SetMaterial(copy); |
---|
3289 | 3537 | { |
---|
.. | .. |
---|
3342 | 3590 | { |
---|
3343 | 3591 | copy.ResetBlockLoop(); // temporary problem |
---|
3344 | 3592 | |
---|
3345 | | - boolean random = CameraPane.RANDOM; |
---|
3346 | | - CameraPane.RANDOM = false; // parse everything |
---|
| 3593 | + boolean random = CameraPane.SWITCH; |
---|
| 3594 | + CameraPane.SWITCH = false; // parse everything |
---|
3347 | 3595 | copy.ResetDisplayList(); |
---|
3348 | 3596 | copy.HardTouch(); |
---|
3349 | | - CameraPane.RANDOM = random; |
---|
| 3597 | + CameraPane.SWITCH = random; |
---|
3350 | 3598 | } |
---|
3351 | 3599 | |
---|
3352 | 3600 | // public void applySelf() |
---|
.. | .. |
---|
3420 | 3668 | { |
---|
3421 | 3669 | //System.out.println("Propagate = " + propagate); |
---|
3422 | 3670 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 3671 | + |
---|
| 3672 | + if (copy.material != null) |
---|
| 3673 | + { |
---|
| 3674 | + cMaterial mat = copy.material; |
---|
| 3675 | + |
---|
| 3676 | + colorField.SetToolTipValue((mat.color)); |
---|
| 3677 | + modulationField.SetToolTipValue((mat.modulation)); |
---|
| 3678 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 3679 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 3680 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 3681 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 3682 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 3683 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 3684 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 3685 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 3686 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 3687 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 3688 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 3689 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 3690 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 3691 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 3692 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 3693 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 3694 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 3695 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 3696 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 3697 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 3698 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 3699 | + } |
---|
| 3700 | + |
---|
3423 | 3701 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3424 | 3702 | { |
---|
3425 | 3703 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3535 | 3813 | } |
---|
3536 | 3814 | |
---|
3537 | 3815 | if (normalpushField != null) |
---|
3538 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 3816 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3539 | 3817 | } |
---|
3540 | 3818 | |
---|
3541 | 3819 | void SnapObject() |
---|
.. | .. |
---|
3799 | 4077 | |
---|
3800 | 4078 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3801 | 4079 | { |
---|
| 4080 | + Save(); |
---|
3802 | 4081 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3803 | 4082 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3804 | 4083 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4002 | 4281 | } |
---|
4003 | 4282 | } |
---|
4004 | 4283 | } |
---|
| 4284 | + |
---|
4005 | 4285 | LoadGFDThread loadGFDThread; |
---|
4006 | 4286 | |
---|
4007 | 4287 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
4021 | 4301 | |
---|
4022 | 4302 | try |
---|
4023 | 4303 | { |
---|
| 4304 | + // Try compressed version first. |
---|
4024 | 4305 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4025 | | - 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); |
---|
4026 | 4308 | |
---|
4027 | 4309 | readobj = (Object3D) p.readObject(); |
---|
4028 | 4310 | istream.close(); |
---|
.. | .. |
---|
4030 | 4312 | readobj.ResetDisplayList(); |
---|
4031 | 4313 | } catch (Exception e) |
---|
4032 | 4314 | { |
---|
4033 | | - 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 | + } |
---|
4034 | 4329 | } |
---|
4035 | 4330 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4036 | 4331 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4076 | 4371 | |
---|
4077 | 4372 | void LoadIt(Object obj) |
---|
4078 | 4373 | { |
---|
| 4374 | + if (obj == null) |
---|
| 4375 | + { |
---|
| 4376 | + // Invalid file |
---|
| 4377 | + return; |
---|
| 4378 | + } |
---|
| 4379 | + |
---|
4079 | 4380 | System.out.println("Loaded " + obj); |
---|
4080 | 4381 | //new Exception().printStackTrace(); |
---|
4081 | 4382 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4085 | 4386 | |
---|
4086 | 4387 | if (readobj != null) |
---|
4087 | 4388 | { |
---|
| 4389 | + Save(); |
---|
4088 | 4390 | try |
---|
4089 | 4391 | { |
---|
4090 | 4392 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4147 | 4449 | |
---|
4148 | 4450 | void load() // throws ClassNotFoundException |
---|
4149 | 4451 | { |
---|
4150 | | - if (GrafreeD.standAlone) |
---|
| 4452 | + if (Grafreed.standAlone) |
---|
4151 | 4453 | { |
---|
4152 | 4454 | FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
4153 | 4455 | browser.show(); |
---|
.. | .. |
---|
4234 | 4536 | try |
---|
4235 | 4537 | { |
---|
4236 | 4538 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4237 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4539 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4540 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4238 | 4541 | |
---|
4239 | 4542 | p.writeObject(copy); |
---|
4240 | 4543 | p.flush(); |
---|
4241 | 4544 | |
---|
| 4545 | + zstream.close(); |
---|
4242 | 4546 | ostream.close(); |
---|
4243 | 4547 | |
---|
4244 | 4548 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4248 | 4552 | { |
---|
4249 | 4553 | } |
---|
4250 | 4554 | } |
---|
| 4555 | + |
---|
4251 | 4556 | String lastname; |
---|
4252 | 4557 | |
---|
4253 | 4558 | void saveAs() |
---|
4254 | 4559 | { |
---|
4255 | | - if (GrafreeD.standAlone) |
---|
| 4560 | + if (Grafreed.standAlone) |
---|
4256 | 4561 | { |
---|
4257 | 4562 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4258 | 4563 | browser.setVisible(true); |
---|
.. | .. |
---|
4357 | 4662 | try |
---|
4358 | 4663 | { |
---|
4359 | 4664 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4360 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4361 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 4665 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4666 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4362 | 4667 | |
---|
4363 | 4668 | Object3D objectparent = obj.parent; |
---|
4364 | 4669 | obj.parent = null; |
---|
4365 | 4670 | |
---|
4366 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 4671 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4367 | 4672 | |
---|
4368 | 4673 | obj.parent = objectparent; |
---|
4369 | 4674 | |
---|
.. | .. |
---|
4375 | 4680 | p.writeObject(object); |
---|
4376 | 4681 | p.flush(); |
---|
4377 | 4682 | |
---|
| 4683 | + zstream.close(); |
---|
4378 | 4684 | ostream.close(); |
---|
4379 | | - // zstream.close(); |
---|
4380 | 4685 | |
---|
4381 | 4686 | // group.selection.get(0).parent = parent; |
---|
4382 | 4687 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4397 | 4702 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4398 | 4703 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4399 | 4704 | copy.generatePOV(buffer); |
---|
4400 | | - if (GrafreeD.standAlone) |
---|
| 4705 | + if (Grafreed.standAlone) |
---|
4401 | 4706 | { |
---|
4402 | 4707 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4403 | 4708 | browser.show(); |
---|
.. | .. |
---|
4423 | 4728 | Object3D client; |
---|
4424 | 4729 | Object3D copy; |
---|
4425 | 4730 | MenuBar menuBar; |
---|
4426 | | - Menu windowMenu; |
---|
| 4731 | + Menu fileMenu; |
---|
| 4732 | + MenuItem newItem; |
---|
4427 | 4733 | MenuItem loadItem; |
---|
4428 | 4734 | MenuItem saveItem; |
---|
4429 | 4735 | MenuItem saveAsItem; |
---|
.. | .. |
---|
4431 | 4737 | MenuItem reexportItem; |
---|
4432 | 4738 | MenuItem povItem; |
---|
4433 | 4739 | MenuItem closeItem; |
---|
4434 | | - Menu cameraMenu; |
---|
| 4740 | + |
---|
4435 | 4741 | CheckboxMenuItem zBufferItem; |
---|
4436 | 4742 | //MenuItem normalLensItem; |
---|
4437 | | - MenuItem editCameraItem; |
---|
4438 | | - MenuItem revertCameraItem; |
---|
4439 | 4743 | MenuItem stepItem; |
---|
4440 | 4744 | CheckboxMenuItem toggleLiveItem; |
---|
4441 | 4745 | CheckboxMenuItem toggleFullScreenItem; |
---|
.. | .. |
---|
4446 | 4750 | CheckboxMenuItem toggleFootContactItem; |
---|
4447 | 4751 | CheckboxMenuItem toggleDLItem; |
---|
4448 | 4752 | CheckboxMenuItem toggleTextureItem; |
---|
4449 | | - CheckboxMenuItem toggleRandomItem; |
---|
| 4753 | + CheckboxMenuItem toggleSwitchItem; |
---|
4450 | 4754 | CheckboxMenuItem toggleRootItem; |
---|
4451 | 4755 | CheckboxMenuItem animationItem; |
---|
4452 | 4756 | CheckboxMenuItem toggleHandleItem; |
---|
.. | .. |
---|
4583 | 4887 | //ObjectUI parent; |
---|
4584 | 4888 | |
---|
4585 | 4889 | cNumberSlider normalpushField; |
---|
| 4890 | + |
---|
| 4891 | + private MenuItem importGFDItem; |
---|
| 4892 | + private MenuItem importVRMLX3DItem; |
---|
| 4893 | + private MenuItem import3DSItem; |
---|
| 4894 | + private MenuItem importOBJItem; |
---|
4586 | 4895 | } |
---|