.. | .. |
---|
143 | 143 | //nameField.removeActionListener(this); |
---|
144 | 144 | // objEditor.ctrlPanel.remove(nameField); |
---|
145 | 145 | |
---|
| 146 | + objEditor.ctrlPanel.remove(namePanel); |
---|
| 147 | + |
---|
146 | 148 | if (!GroupEditor.allparams) |
---|
147 | 149 | return; |
---|
148 | 150 | |
---|
.. | .. |
---|
165 | 167 | // objEditor.ctrlPanel.remove(fasterButton); |
---|
166 | 168 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
167 | 169 | |
---|
168 | | - objEditor.ctrlPanel.remove(namePanel); |
---|
169 | 170 | objEditor.ctrlPanel.remove(setupPanel); |
---|
170 | 171 | objEditor.ctrlPanel.remove(commandsPanel); |
---|
171 | 172 | objEditor.ctrlPanel.remove(pushPanel); |
---|
.. | .. |
---|
275 | 276 | void SetupMenu() |
---|
276 | 277 | { |
---|
277 | 278 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
278 | | - menuBar.add(windowMenu = new Menu("File")); |
---|
279 | | - windowMenu.add(loadItem = new MenuItem("Load...")); |
---|
280 | | - windowMenu.add("-"); |
---|
281 | | - windowMenu.add(saveItem = new MenuItem("Save")); |
---|
282 | | - windowMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
| 279 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 280 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 281 | + fileMenu.add(loadItem = new MenuItem("Load...")); |
---|
| 282 | + |
---|
| 283 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 284 | + Menu menu = new Menu("Import"); |
---|
| 285 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 286 | + importOBJItem.addActionListener(this); |
---|
| 287 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 288 | + import3DSItem.addActionListener(this); |
---|
| 289 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 290 | + importVRMLX3DItem.addActionListener(this); |
---|
| 291 | + menu.add("-"); |
---|
| 292 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 293 | + importGFDItem.addActionListener(this); |
---|
| 294 | + fileMenu.add(menu); |
---|
| 295 | + fileMenu.add("-"); |
---|
| 296 | + |
---|
| 297 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 298 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
283 | 299 | //windowMenu.add(povItem = new MenuItem("Emit POV-Ray...")); |
---|
284 | | - windowMenu.add("-"); |
---|
285 | | - windowMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
286 | | - windowMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
287 | | - windowMenu.add("-"); |
---|
| 300 | + fileMenu.add("-"); |
---|
| 301 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 302 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 303 | + fileMenu.add("-"); |
---|
288 | 304 | if (client.parent != null) |
---|
289 | 305 | { |
---|
290 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 306 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
291 | 307 | } else |
---|
292 | 308 | { |
---|
293 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 309 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
294 | 310 | } |
---|
295 | 311 | |
---|
| 312 | + newItem.addActionListener(this); |
---|
296 | 313 | loadItem.addActionListener(this); |
---|
297 | 314 | saveItem.addActionListener(this); |
---|
298 | 315 | saveAsItem.addActionListener(this); |
---|
.. | .. |
---|
300 | 317 | reexportItem.addActionListener(this); |
---|
301 | 318 | //povItem.addActionListener(this); |
---|
302 | 319 | closeItem.addActionListener(this); |
---|
303 | | - |
---|
304 | | - menuBar.add(cameraMenu = new Menu("View")); |
---|
305 | | - //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer")); |
---|
306 | | - //zBufferItem.addActionListener(this); |
---|
307 | | - //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens")); |
---|
308 | | - //normalLensItem.addActionListener(this); |
---|
309 | | - cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera")); |
---|
310 | | - revertCameraItem.addActionListener(this); |
---|
311 | | - cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline")); |
---|
312 | | - toggleTimelineItem.addItemListener(this); |
---|
313 | | - cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); |
---|
314 | | - toggleFullScreenItem.addItemListener(this); |
---|
315 | | - toggleFullScreenItem.setState(CameraPane.FULLSCREEN); |
---|
316 | | - cameraMenu.add("-"); |
---|
317 | | - cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); |
---|
318 | | - toggleTextureItem.addItemListener(this); |
---|
319 | | - toggleTextureItem.setState(CameraPane.textureon); |
---|
320 | | - cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); |
---|
321 | | - toggleLiveItem.addItemListener(this); |
---|
322 | | - toggleLiveItem.setState(Globals.isLIVE()); |
---|
323 | | - cameraMenu.add(stepItem = new MenuItem("Step")); |
---|
324 | | - stepItem.addActionListener(this); |
---|
325 | | -// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); |
---|
326 | | -// toggleDLItem.addItemListener(this); |
---|
327 | | -// toggleDLItem.setState(false); |
---|
328 | | - cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render")); |
---|
329 | | - toggleRenderItem.addItemListener(this); |
---|
330 | | - toggleRenderItem.setState(!CameraPane.frozen); |
---|
331 | | - cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); |
---|
332 | | - toggleDebugItem.addItemListener(this); |
---|
333 | | - toggleDebugItem.setState(CameraPane.DEBUG); |
---|
334 | | - cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); |
---|
335 | | - toggleFrustumItem.addItemListener(this); |
---|
336 | | - toggleFrustumItem.setState(CameraPane.FRUSTUM); |
---|
337 | | - cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact")); |
---|
338 | | - toggleFootContactItem.addItemListener(this); |
---|
339 | | - toggleFootContactItem.setState(CameraPane.FOOTCONTACT); |
---|
340 | | - cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random")); |
---|
341 | | - toggleRandomItem.addItemListener(this); |
---|
342 | | - toggleRandomItem.setState(CameraPane.RANDOM); |
---|
343 | | - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); |
---|
344 | | - toggleHandleItem.addItemListener(this); |
---|
345 | | - toggleHandleItem.setState(CameraPane.HANDLES); |
---|
346 | | - cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode")); |
---|
347 | | - togglePaintItem.addItemListener(this); |
---|
348 | | - togglePaintItem.setState(CameraPane.PAINTMODE); |
---|
349 | | -// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root")); |
---|
350 | | -// toggleRootItem.addItemListener(this); |
---|
351 | | -// toggleRootItem.setState(false); |
---|
352 | | -// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation")); |
---|
353 | | -// animationItem.addItemListener(this); |
---|
354 | | -// animationItem.setState(CameraPane.ANIMATION); |
---|
355 | | - cameraMenu.add("-"); |
---|
356 | | - cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera")); |
---|
357 | | - editCameraItem.addActionListener(this); |
---|
358 | 320 | |
---|
359 | 321 | objectPanel = new JTabbedPane(); |
---|
360 | 322 | toolbarPanel = new JPanel(); |
---|
.. | .. |
---|
483 | 445 | //SendInfo("Name:", "bold"); |
---|
484 | 446 | if (sel.GetTextures() != null || debug) |
---|
485 | 447 | { |
---|
486 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 448 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
487 | 449 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
488 | 450 | if (sel.Size() > 0) |
---|
489 | 451 | { |
---|
490 | 452 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
491 | 453 | } |
---|
492 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 454 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
493 | 455 | if (debug) |
---|
494 | 456 | { |
---|
495 | 457 | try |
---|
.. | .. |
---|
531 | 493 | } |
---|
532 | 494 | if (sel.support != null) |
---|
533 | 495 | { |
---|
534 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 496 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
535 | 497 | } |
---|
536 | 498 | if (sel.scriptnode != null) |
---|
537 | 499 | { |
---|
.. | .. |
---|
734 | 696 | protected static ImageIcon createImageIcon(String path, |
---|
735 | 697 | String description) |
---|
736 | 698 | { |
---|
737 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 699 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
738 | 700 | if (imgURL != null) |
---|
739 | 701 | { |
---|
740 | 702 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
766 | 728 | // NumberSlider vDivsField; |
---|
767 | 729 | // JCheckBox endcaps; |
---|
768 | 730 | JCheckBox liveCB; |
---|
| 731 | + JCheckBox selectCB; |
---|
769 | 732 | JCheckBox hideCB; |
---|
770 | 733 | JCheckBox link2masterCB; |
---|
771 | 734 | JCheckBox markCB; |
---|
.. | .. |
---|
951 | 914 | |
---|
952 | 915 | void SetupUI2(ObjEditor oe) |
---|
953 | 916 | { |
---|
954 | | -// oe.aConstraints.weightx = 0; |
---|
955 | | -// oe.aConstraints.weighty = 0; |
---|
956 | | -// oe.aConstraints.gridx = 0; |
---|
957 | | -// oe.aConstraints.gridy = 0; |
---|
958 | 917 | //SetupName(oe); |
---|
959 | 918 | |
---|
960 | 919 | namePanel = new cGridBag(); |
---|
.. | .. |
---|
971 | 930 | setupPanel = new cGridBag().setVertical(false); |
---|
972 | 931 | |
---|
973 | 932 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
974 | | - link2masterCB = AddCheckBox(setupPanel, "Supp", copy.link2master); |
---|
975 | | - hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 933 | + liveCB.setToolTipText("Animate object"); |
---|
| 934 | + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 935 | + selectCB.setToolTipText("Make object selectable"); |
---|
976 | 936 | // Return(); |
---|
| 937 | + hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 938 | + hideCB.setToolTipText("Hide object"); |
---|
977 | 939 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
978 | | - rewindCB = AddCheckBox(setupPanel, "Rew", copy.rewind); |
---|
979 | | - randomCB = AddCheckBox(setupPanel, "Rand", copy.random); |
---|
| 940 | + markCB.setToolTipText("Set the animation target transform"); |
---|
| 941 | + |
---|
| 942 | + rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 943 | + rewindCB.setToolTipText("Rewind animation"); |
---|
| 944 | + |
---|
| 945 | + randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
| 946 | + randomCB.setToolTipText("Option for switch node"); |
---|
980 | 947 | |
---|
| 948 | + if (Globals.ADVANCED) |
---|
| 949 | + { |
---|
| 950 | + link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
| 951 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 952 | + speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 953 | + speedupCB.setToolTipText("Option motion capture"); |
---|
| 954 | + } |
---|
| 955 | + |
---|
981 | 956 | oe.ctrlPanel.add(setupPanel); |
---|
982 | 957 | oe.ctrlPanel.Return(); |
---|
983 | 958 | |
---|
984 | 959 | commandsPanel = new cGridBag().setVertical(false); |
---|
985 | 960 | |
---|
986 | 961 | resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 962 | + resetButton.setToolTipText("Jump to frame zero"); |
---|
987 | 963 | stepButton = AddButton(commandsPanel, "Step"); |
---|
| 964 | + stepButton.setToolTipText("Step one frame"); |
---|
988 | 965 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
989 | 966 | // stepAllButton = AddButton(oe, "Step All"); |
---|
990 | | - speedupCB = AddCheckBox(commandsPanel, "Speed", copy.speedup); |
---|
991 | 967 | // Return(); |
---|
992 | 968 | slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 969 | + slowerButton.setToolTipText("Decrease animation speed"); |
---|
993 | 970 | fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 971 | + fasterButton.setToolTipText("Increase animation speed"); |
---|
994 | 972 | remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 973 | + remarkButton.setToolTipText("Set the current transform as the target"); |
---|
995 | 974 | |
---|
996 | 975 | oe.ctrlPanel.add(commandsPanel); |
---|
997 | 976 | oe.ctrlPanel.Return(); |
---|
998 | 977 | |
---|
999 | | - pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1); |
---|
| 978 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
1000 | 979 | normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
1001 | 980 | //Return(); |
---|
1002 | 981 | |
---|
.. | .. |
---|
1298 | 1277 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1299 | 1278 | |
---|
1300 | 1279 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1301 | | - scenePanel.preferredWidth = 7; |
---|
| 1280 | + scenePanel.preferredWidth = 6; |
---|
1302 | 1281 | |
---|
1303 | 1282 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1304 | 1283 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1404 | 1383 | |
---|
1405 | 1384 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1406 | 1385 | |
---|
1407 | | - frame.setSize(1024, 768); |
---|
1408 | | - frame.show(); |
---|
| 1386 | + frame.setSize(1280, 860); |
---|
| 1387 | + frame.setVisible(true); |
---|
1409 | 1388 | |
---|
1410 | 1389 | gridPanel.setDividerLocation(1.0); |
---|
1411 | 1390 | |
---|
.. | .. |
---|
1444 | 1423 | |
---|
1445 | 1424 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1446 | 1425 | |
---|
1447 | | - editBar.add(createMaterialButton = new cButton("Create", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 1426 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1448 | 1427 | createMaterialButton.setToolTipText("Create material"); |
---|
1449 | 1428 | |
---|
1450 | 1429 | /* |
---|
1451 | 1430 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1452 | 1431 | */ |
---|
1453 | 1432 | |
---|
1454 | | - editBar.add(clearMaterialButton = new cButton("Clear", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 1433 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1455 | 1434 | clearMaterialButton.setToolTipText("Clear material"); |
---|
1456 | 1435 | |
---|
1457 | | - editBar.add(resetSlidersButton = new cButton("Reset", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
1458 | | - editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1459 | | - editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 1436 | + if (Globals.ADVANCED) |
---|
| 1437 | + { |
---|
| 1438 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1439 | + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
| 1440 | + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 1441 | + } |
---|
1460 | 1442 | |
---|
1461 | 1443 | editBar.preferredHeight = 15; |
---|
1462 | 1444 | |
---|
.. | .. |
---|
1725 | 1707 | opacityPowerField.addChangeListener(this); |
---|
1726 | 1708 | /**/ |
---|
1727 | 1709 | |
---|
1728 | | - resetSlidersButton.addActionListener(this); |
---|
1729 | 1710 | clearMaterialButton.addActionListener(this); |
---|
1730 | 1711 | createMaterialButton.addActionListener(this); |
---|
1731 | | - |
---|
1732 | | - propagateToggle.addItemListener(this); |
---|
1733 | | - multiplyToggle.addItemListener(this); |
---|
| 1712 | + |
---|
| 1713 | + if (Globals.ADVANCED) |
---|
| 1714 | + { |
---|
| 1715 | + resetSlidersButton.addActionListener(this); |
---|
| 1716 | + propagateToggle.addItemListener(this); |
---|
| 1717 | + multiplyToggle.addItemListener(this); |
---|
| 1718 | + } |
---|
1734 | 1719 | } |
---|
1735 | 1720 | |
---|
1736 | 1721 | void DropFile(java.io.File[] files, boolean textures) |
---|
.. | .. |
---|
1901 | 1886 | |
---|
1902 | 1887 | //? flashIt = false; |
---|
1903 | 1888 | CameraPane pane = (CameraPane) cameraView; |
---|
1904 | | - pane.clickStart(location.x, location.y, 0); |
---|
| 1889 | + pane.clickStart(location.x, location.y, 0, 0); |
---|
1905 | 1890 | pane.clickEnd(location.x, location.y, 0, true); |
---|
1906 | 1891 | |
---|
1907 | 1892 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
1950 | 1935 | e2.printStackTrace(); |
---|
1951 | 1936 | } |
---|
1952 | 1937 | } |
---|
| 1938 | + |
---|
1953 | 1939 | LoadJMEThread loadThread; |
---|
1954 | 1940 | |
---|
1955 | 1941 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
2007 | 1993 | //LoadFile0(filename, converter); |
---|
2008 | 1994 | } |
---|
2009 | 1995 | } |
---|
| 1996 | + |
---|
2010 | 1997 | LoadOBJThread loadObjThread; |
---|
2011 | 1998 | |
---|
2012 | 1999 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2358 | 2345 | |
---|
2359 | 2346 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2360 | 2347 | { |
---|
2361 | | - if (GrafreeD.standAlone) |
---|
| 2348 | + if (Grafreed.standAlone) |
---|
2362 | 2349 | { |
---|
2363 | 2350 | /**/ |
---|
2364 | 2351 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2365 | | - browser.show(); |
---|
| 2352 | + browser.setVisible(true); |
---|
2366 | 2353 | String filename = browser.getFile(); |
---|
2367 | 2354 | if (filename != null && filename.length() > 0) |
---|
2368 | 2355 | { |
---|
.. | .. |
---|
2722 | 2709 | return; |
---|
2723 | 2710 | } |
---|
2724 | 2711 | |
---|
2725 | | - multiplyToggle.setSelected(mat.multiply); |
---|
| 2712 | + if (multiplyToggle != null) |
---|
| 2713 | + multiplyToggle.setSelected(mat.multiply); |
---|
2726 | 2714 | |
---|
2727 | 2715 | assert (object.projectedVertices != null); |
---|
2728 | 2716 | |
---|
.. | .. |
---|
2937 | 2925 | frame.validate(); |
---|
2938 | 2926 | |
---|
2939 | 2927 | return; |
---|
2940 | | - } else if (event.getSource() == toggleRandomItem) |
---|
| 2928 | + } else if (event.getSource() == toggleSwitchItem) |
---|
2941 | 2929 | { |
---|
2942 | 2930 | cameraView.ToggleRandom(); |
---|
2943 | 2931 | cameraView.repaint(); |
---|
.. | .. |
---|
2968 | 2956 | { |
---|
2969 | 2957 | copy.live ^= true; |
---|
2970 | 2958 | return; |
---|
| 2959 | + } else if (event.getSource() == selectCB) |
---|
| 2960 | + { |
---|
| 2961 | + copy.dontselect ^= true; |
---|
| 2962 | + return; |
---|
2971 | 2963 | } else if (event.getSource() == hideCB) |
---|
2972 | 2964 | { |
---|
2973 | 2965 | copy.hide ^= true; |
---|
.. | .. |
---|
2982 | 2974 | if (event.getSource() == randomCB) |
---|
2983 | 2975 | { |
---|
2984 | 2976 | copy.random ^= true; |
---|
| 2977 | + objEditor.refreshContents(); |
---|
2985 | 2978 | return; |
---|
2986 | 2979 | } |
---|
2987 | 2980 | if (event.getSource() == speedupCB) |
---|
.. | .. |
---|
3005 | 2998 | |
---|
3006 | 2999 | public void actionPerformed(ActionEvent event) |
---|
3007 | 3000 | { |
---|
| 3001 | + Object source = event.getSource(); |
---|
3008 | 3002 | // SCRIPT DIALOG |
---|
3009 | | - if (event.getSource() == okbutton) |
---|
| 3003 | + if (source == okbutton) |
---|
3010 | 3004 | { |
---|
3011 | 3005 | textpanel.setVisible(false); |
---|
3012 | 3006 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3018 | 3012 | textarea = null; |
---|
3019 | 3013 | textpanel = null; |
---|
3020 | 3014 | } |
---|
3021 | | - if (event.getSource() == cancelbutton) |
---|
| 3015 | + if (source == cancelbutton) |
---|
3022 | 3016 | { |
---|
3023 | 3017 | textpanel.setVisible(false); |
---|
3024 | 3018 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3030 | 3024 | //applySelf(); |
---|
3031 | 3025 | //client.refreshEditWindow(); |
---|
3032 | 3026 | //refreshContents(); |
---|
3033 | | - if (event.getSource() == nameField) |
---|
| 3027 | + if (source == nameField) |
---|
3034 | 3028 | { |
---|
3035 | 3029 | //System.out.println("ObjEditor " + event); |
---|
3036 | 3030 | applySelf0(true); |
---|
3037 | 3031 | //parent.applySelf(); |
---|
3038 | 3032 | objEditor.refreshContents(); |
---|
3039 | | - } else if (event.getSource() == resetButton) |
---|
| 3033 | + } else if (source == resetButton) |
---|
3040 | 3034 | { |
---|
3041 | 3035 | CameraPane.fullreset = true; |
---|
3042 | 3036 | copy.Reset(); // ResetMeshes(); |
---|
3043 | 3037 | copy.Touch(); |
---|
3044 | 3038 | objEditor.refreshContents(); |
---|
3045 | | - } else if (event.getSource() == stepItem) |
---|
| 3039 | + } else if (source == stepItem) |
---|
3046 | 3040 | { |
---|
3047 | 3041 | //cameraView.ONESTEP = true; |
---|
3048 | 3042 | Globals.ONESTEP = true; |
---|
3049 | 3043 | cameraView.repaint(); |
---|
3050 | 3044 | return; |
---|
3051 | | - } else if (event.getSource() == stepButton) |
---|
| 3045 | + } else if (source == stepButton) |
---|
3052 | 3046 | { |
---|
3053 | 3047 | copy.Step(); |
---|
3054 | 3048 | copy.Touch(); |
---|
3055 | 3049 | objEditor.refreshContents(); |
---|
3056 | | - } else if (event.getSource() == slowerButton) |
---|
| 3050 | + } else if (source == slowerButton) |
---|
3057 | 3051 | { |
---|
3058 | 3052 | copy.Slower(); |
---|
3059 | 3053 | copy.Touch(); |
---|
3060 | 3054 | objEditor.refreshContents(); |
---|
3061 | | - } else if (event.getSource() == fasterButton) |
---|
| 3055 | + } else if (source == fasterButton) |
---|
3062 | 3056 | { |
---|
3063 | 3057 | copy.Faster(); |
---|
3064 | 3058 | copy.Touch(); |
---|
3065 | 3059 | objEditor.refreshContents(); |
---|
3066 | | - } else if (event.getSource() == remarkButton) |
---|
| 3060 | + } else if (source == remarkButton) |
---|
3067 | 3061 | { |
---|
3068 | 3062 | copy.Remark(); |
---|
3069 | 3063 | copy.Touch(); |
---|
3070 | 3064 | objEditor.refreshContents(); |
---|
3071 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3065 | + } else if (source == stepAllButton) |
---|
3072 | 3066 | { |
---|
3073 | 3067 | copy.StepAll(); |
---|
3074 | 3068 | copy.Touch(); |
---|
3075 | 3069 | objEditor.refreshContents(); |
---|
3076 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3070 | + } else if (source == resetAllButton) |
---|
3077 | 3071 | { |
---|
3078 | 3072 | //CameraPane.fullreset = true; |
---|
3079 | 3073 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3106 | 3100 | // Close(); |
---|
3107 | 3101 | // } |
---|
3108 | 3102 | // else |
---|
3109 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3103 | + if (source == resetSlidersButton) |
---|
3110 | 3104 | { |
---|
3111 | 3105 | ResetSliders(); |
---|
3112 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3106 | + } else if (source == clearMaterialButton) |
---|
3113 | 3107 | { |
---|
3114 | 3108 | ClearMaterial(); |
---|
3115 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3109 | + } else if (source == createMaterialButton) |
---|
3116 | 3110 | { |
---|
3117 | 3111 | CreateMaterial(); |
---|
3118 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3112 | + } else if (source == clearPanelButton) |
---|
3119 | 3113 | { |
---|
3120 | 3114 | copy.ClearUI(); |
---|
3121 | 3115 | refreshContents(true); |
---|
3122 | | - } /* |
---|
3123 | | - } |
---|
3124 | | - |
---|
3125 | | - public boolean action(Event event, Object arg) |
---|
3126 | | - { |
---|
3127 | | - */ else if (event.getSource() == closeItem) |
---|
| 3116 | + } else if (source == importGFDItem) |
---|
| 3117 | + { |
---|
| 3118 | + ImportGFD(); |
---|
| 3119 | + } else |
---|
| 3120 | + if (source == importVRMLX3DItem) |
---|
| 3121 | + { |
---|
| 3122 | + ImportVRMLX3D(); |
---|
| 3123 | + } else |
---|
| 3124 | + if (source == import3DSItem) |
---|
| 3125 | + { |
---|
| 3126 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3127 | + } else |
---|
| 3128 | + if (source == importOBJItem) |
---|
| 3129 | + { |
---|
| 3130 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3131 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3132 | + browser.setVisible(true); |
---|
| 3133 | + String filename = browser.getFile(); |
---|
| 3134 | + if (filename != null && filename.length() > 0) |
---|
| 3135 | + { |
---|
| 3136 | + String fullname = browser.getDirectory() + filename; |
---|
| 3137 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3138 | + } |
---|
| 3139 | + } else |
---|
| 3140 | + if (source == closeItem) |
---|
3128 | 3141 | { |
---|
3129 | 3142 | Close(); |
---|
3130 | 3143 | //return true; |
---|
3131 | | - } else if (event.getSource() == loadItem) |
---|
| 3144 | + } else if (source == loadItem) |
---|
3132 | 3145 | { |
---|
3133 | 3146 | load(); |
---|
3134 | 3147 | //return true; |
---|
3135 | | - } else if (event.getSource() == saveItem) |
---|
| 3148 | + } else if (source == newItem) |
---|
| 3149 | + { |
---|
| 3150 | + New(); |
---|
| 3151 | + } else if (source == saveItem) |
---|
3136 | 3152 | { |
---|
3137 | 3153 | save(); |
---|
3138 | 3154 | //return true; |
---|
3139 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3155 | + } else if (source == saveAsItem) |
---|
3140 | 3156 | { |
---|
3141 | 3157 | saveAs(); |
---|
3142 | 3158 | //return true; |
---|
3143 | | - } else if (event.getSource() == reexportItem) |
---|
| 3159 | + } else if (source == reexportItem) |
---|
3144 | 3160 | { |
---|
3145 | 3161 | reexport(); |
---|
3146 | 3162 | //return true; |
---|
3147 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3163 | + } else if (source == exportAsItem) |
---|
3148 | 3164 | { |
---|
3149 | 3165 | export(); |
---|
3150 | 3166 | //return true; |
---|
3151 | | - } else if (event.getSource() == povItem) |
---|
| 3167 | + } else if (source == povItem) |
---|
3152 | 3168 | { |
---|
3153 | 3169 | generatePOV(); |
---|
3154 | 3170 | //return true; |
---|
3155 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3171 | + } else if (source == zBufferItem) |
---|
3156 | 3172 | { |
---|
3157 | 3173 | try |
---|
3158 | 3174 | { |
---|
.. | .. |
---|
3174 | 3190 | cameraView.repaint(); |
---|
3175 | 3191 | //return true; |
---|
3176 | 3192 | } |
---|
3177 | | - */ else if (event.getSource() == editCameraItem) |
---|
3178 | | - { |
---|
3179 | | - cameraView.ProtectCamera(); |
---|
3180 | | - cameraView.repaint(); |
---|
3181 | | - return; |
---|
3182 | | - } else if (event.getSource() == revertCameraItem) |
---|
3183 | | - { |
---|
3184 | | - cameraView.RevertCamera(); |
---|
3185 | | - cameraView.repaint(); |
---|
3186 | | - return; |
---|
3187 | | -// } else if (event.getSource() == textureButton) |
---|
3188 | | -// { |
---|
3189 | | -// return; // true; |
---|
3190 | | - } else // combos... |
---|
3191 | | - if (event.getSource() == texresMenu) |
---|
| 3193 | + */ else // combos... |
---|
| 3194 | + if (source == texresMenu) |
---|
3192 | 3195 | { |
---|
3193 | 3196 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3194 | 3197 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3200 | 3203 | } |
---|
3201 | 3204 | } |
---|
3202 | 3205 | |
---|
| 3206 | + void New() |
---|
| 3207 | + { |
---|
| 3208 | + while (copy.Size() > 1) |
---|
| 3209 | + { |
---|
| 3210 | + copy.remove(1); |
---|
| 3211 | + } |
---|
| 3212 | + |
---|
| 3213 | + ResetModel(); |
---|
| 3214 | + objEditor.refreshContents(); |
---|
| 3215 | + } |
---|
| 3216 | + |
---|
| 3217 | + static public Object clone(Object o) |
---|
| 3218 | + { |
---|
| 3219 | + try |
---|
| 3220 | + { |
---|
| 3221 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3222 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3223 | + |
---|
| 3224 | + out.writeObject(o); |
---|
| 3225 | + |
---|
| 3226 | + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); |
---|
| 3227 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3228 | + Object obj = in.readObject(); |
---|
| 3229 | + in.close(); |
---|
| 3230 | + out.close(); |
---|
| 3231 | + return obj; |
---|
| 3232 | + } catch (Exception e) |
---|
| 3233 | + { |
---|
| 3234 | + System.err.println(e); |
---|
| 3235 | + return null; |
---|
| 3236 | + } |
---|
| 3237 | + } |
---|
| 3238 | + |
---|
| 3239 | + cRadio GetCurrentTab() |
---|
| 3240 | + { |
---|
| 3241 | + cRadio ab; |
---|
| 3242 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3243 | + { |
---|
| 3244 | + ab = (cRadio)e.nextElement(); |
---|
| 3245 | + if(ab.GetObject() == copy) |
---|
| 3246 | + { |
---|
| 3247 | + return ab; |
---|
| 3248 | + } |
---|
| 3249 | + } |
---|
| 3250 | + |
---|
| 3251 | + return null; |
---|
| 3252 | + } |
---|
| 3253 | + |
---|
| 3254 | + public void Save() |
---|
| 3255 | + { |
---|
| 3256 | + cRadio tab = GetCurrentTab(); |
---|
| 3257 | + |
---|
| 3258 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3259 | + tab.graphs[tab.undoindex++] = (Object3D)clone(copy); |
---|
| 3260 | + |
---|
| 3261 | + for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3262 | + { |
---|
| 3263 | + tab.graphs[i] = null; |
---|
| 3264 | + } |
---|
| 3265 | + |
---|
| 3266 | + // test save |
---|
| 3267 | + if (false) |
---|
| 3268 | + { |
---|
| 3269 | + try |
---|
| 3270 | + { |
---|
| 3271 | + FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3272 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3273 | + |
---|
| 3274 | + p.writeObject(copy); |
---|
| 3275 | + |
---|
| 3276 | + p.flush(); |
---|
| 3277 | + |
---|
| 3278 | + ostream.close(); |
---|
| 3279 | + } catch (Exception e) |
---|
| 3280 | + { |
---|
| 3281 | + e.printStackTrace(); |
---|
| 3282 | + } |
---|
| 3283 | + } |
---|
| 3284 | + } |
---|
| 3285 | + |
---|
| 3286 | + void CopyChanged(Object3D obj) |
---|
| 3287 | + { |
---|
| 3288 | + copy.clear(); |
---|
| 3289 | + |
---|
| 3290 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3291 | + { |
---|
| 3292 | + copy.add(obj.get(i)); |
---|
| 3293 | + } |
---|
| 3294 | + |
---|
| 3295 | + copy.Touch(); |
---|
| 3296 | + |
---|
| 3297 | + ResetModel(); |
---|
| 3298 | + copy.HardTouch(); // recompile? |
---|
| 3299 | + |
---|
| 3300 | + cRadio ab; |
---|
| 3301 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3302 | + { |
---|
| 3303 | + ab = (cRadio)e.nextElement(); |
---|
| 3304 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3305 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3306 | + if (test != null) |
---|
| 3307 | + { |
---|
| 3308 | + test.editWindow = ab.object.editWindow; |
---|
| 3309 | + ab.object = test; |
---|
| 3310 | + } |
---|
| 3311 | + } |
---|
| 3312 | + |
---|
| 3313 | + refreshContents(); |
---|
| 3314 | + } |
---|
| 3315 | + |
---|
| 3316 | + public void Undo() |
---|
| 3317 | + { |
---|
| 3318 | + cRadio tab = GetCurrentTab(); |
---|
| 3319 | + |
---|
| 3320 | + if (tab.undoindex == 0) |
---|
| 3321 | + { |
---|
| 3322 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3323 | + return; |
---|
| 3324 | + } |
---|
| 3325 | + |
---|
| 3326 | + if (tab.graphs[tab.undoindex] == null) |
---|
| 3327 | + { |
---|
| 3328 | + Save(); |
---|
| 3329 | + tab.undoindex -= 1; |
---|
| 3330 | + } |
---|
| 3331 | + |
---|
| 3332 | + tab.undoindex -= 1; |
---|
| 3333 | + |
---|
| 3334 | + CopyChanged(tab.graphs[tab.undoindex]); |
---|
| 3335 | + } |
---|
| 3336 | + |
---|
| 3337 | + public void Redo() |
---|
| 3338 | + { |
---|
| 3339 | + cRadio tab = GetCurrentTab(); |
---|
| 3340 | + |
---|
| 3341 | + if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3342 | + { |
---|
| 3343 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3344 | + return; |
---|
| 3345 | + } |
---|
| 3346 | + |
---|
| 3347 | + tab.undoindex += 1; |
---|
| 3348 | + |
---|
| 3349 | + CopyChanged(tab.graphs[tab.undoindex]); |
---|
| 3350 | + } |
---|
| 3351 | + |
---|
| 3352 | + void ImportGFD() |
---|
| 3353 | + { |
---|
| 3354 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 3355 | + browser.show(); |
---|
| 3356 | + String filename = browser.getFile(); |
---|
| 3357 | + if (filename != null && filename.length() > 0) |
---|
| 3358 | + { |
---|
| 3359 | + String fullname = browser.getDirectory() + filename; |
---|
| 3360 | + |
---|
| 3361 | + //Object3D readobj = |
---|
| 3362 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 3363 | + //makeSomething(readobj); |
---|
| 3364 | + } |
---|
| 3365 | + } |
---|
| 3366 | + |
---|
| 3367 | + void ImportVRMLX3D() |
---|
| 3368 | + { |
---|
| 3369 | + if (Grafreed.standAlone) |
---|
| 3370 | + { |
---|
| 3371 | + /**/ |
---|
| 3372 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 3373 | + browser.show(); |
---|
| 3374 | + String filename = browser.getFile(); |
---|
| 3375 | + if (filename != null && filename.length() > 0) |
---|
| 3376 | + { |
---|
| 3377 | + String fullname = browser.getDirectory() + filename; |
---|
| 3378 | + LoadVRMLX3D(fullname); |
---|
| 3379 | + } |
---|
| 3380 | + /**/ |
---|
| 3381 | + } |
---|
| 3382 | + } |
---|
| 3383 | + |
---|
3203 | 3384 | void ToggleAnimation() |
---|
3204 | 3385 | { |
---|
3205 | 3386 | if (!Globals.ANIMATION) |
---|
.. | .. |
---|
3215 | 3396 | |
---|
3216 | 3397 | Globals.ANIMATION ^= true; |
---|
3217 | 3398 | |
---|
3218 | | - GrafreeD.wav.cursor = 0; |
---|
3219 | | - GrafreeD.wav.loop = 0; |
---|
| 3399 | + Grafreed.wav.cursor = 0; |
---|
| 3400 | + Grafreed.wav.loop = 0; |
---|
3220 | 3401 | } |
---|
3221 | 3402 | } else |
---|
3222 | 3403 | { |
---|
.. | .. |
---|
3237 | 3418 | callee.refreshContents(); |
---|
3238 | 3419 | } else |
---|
3239 | 3420 | { |
---|
3240 | | - new Exception().printStackTrace(); |
---|
3241 | 3421 | System.exit(0); |
---|
3242 | 3422 | } |
---|
3243 | 3423 | } |
---|
.. | .. |
---|
3267 | 3447 | void CreateMaterial() |
---|
3268 | 3448 | { |
---|
3269 | 3449 | //copy.ClearMaterial(); // PATCH |
---|
3270 | | - copy.CreateMaterialS(multiplyToggle.isSelected()); |
---|
| 3450 | + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); |
---|
3271 | 3451 | if (copy.selection.size() > 0) |
---|
3272 | 3452 | //SetMaterial(copy); |
---|
3273 | 3453 | { |
---|
.. | .. |
---|
3326 | 3506 | { |
---|
3327 | 3507 | copy.ResetBlockLoop(); // temporary problem |
---|
3328 | 3508 | |
---|
3329 | | - boolean random = CameraPane.RANDOM; |
---|
3330 | | - CameraPane.RANDOM = false; // parse everything |
---|
| 3509 | + boolean random = CameraPane.SWITCH; |
---|
| 3510 | + CameraPane.SWITCH = false; // parse everything |
---|
3331 | 3511 | copy.ResetDisplayList(); |
---|
3332 | 3512 | copy.HardTouch(); |
---|
3333 | | - CameraPane.RANDOM = random; |
---|
| 3513 | + CameraPane.SWITCH = random; |
---|
3334 | 3514 | } |
---|
3335 | 3515 | |
---|
3336 | 3516 | // public void applySelf() |
---|
.. | .. |
---|
3404 | 3584 | { |
---|
3405 | 3585 | //System.out.println("Propagate = " + propagate); |
---|
3406 | 3586 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 3587 | + |
---|
| 3588 | + if (copy.material != null) |
---|
| 3589 | + { |
---|
| 3590 | + cMaterial mat = copy.material; |
---|
| 3591 | + |
---|
| 3592 | + colorField.SetToolTipValue((mat.color)); |
---|
| 3593 | + modulationField.SetToolTipValue((mat.modulation)); |
---|
| 3594 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 3595 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 3596 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 3597 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 3598 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 3599 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 3600 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 3601 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 3602 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 3603 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 3604 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 3605 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 3606 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 3607 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 3608 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 3609 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 3610 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 3611 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 3612 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 3613 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 3614 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 3615 | + } |
---|
| 3616 | + |
---|
3407 | 3617 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3408 | 3618 | { |
---|
3409 | 3619 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3519 | 3729 | } |
---|
3520 | 3730 | |
---|
3521 | 3731 | if (normalpushField != null) |
---|
3522 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 3732 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3523 | 3733 | } |
---|
3524 | 3734 | |
---|
3525 | 3735 | void SnapObject() |
---|
.. | .. |
---|
3783 | 3993 | |
---|
3784 | 3994 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3785 | 3995 | { |
---|
| 3996 | + Save(); |
---|
3786 | 3997 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3787 | 3998 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3788 | 3999 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3986 | 4197 | } |
---|
3987 | 4198 | } |
---|
3988 | 4199 | } |
---|
| 4200 | + |
---|
3989 | 4201 | LoadGFDThread loadGFDThread; |
---|
3990 | 4202 | |
---|
3991 | 4203 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
4006 | 4218 | try |
---|
4007 | 4219 | { |
---|
4008 | 4220 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4009 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4221 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4222 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
4010 | 4223 | |
---|
4011 | 4224 | readobj = (Object3D) p.readObject(); |
---|
4012 | 4225 | istream.close(); |
---|
.. | .. |
---|
4014 | 4227 | readobj.ResetDisplayList(); |
---|
4015 | 4228 | } catch (Exception e) |
---|
4016 | 4229 | { |
---|
4017 | | - e.printStackTrace(); |
---|
| 4230 | + //e.printStackTrace(); |
---|
| 4231 | + try |
---|
| 4232 | + { |
---|
| 4233 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4234 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4235 | + |
---|
| 4236 | + readobj = (Object3D) p.readObject(); |
---|
| 4237 | + istream.close(); |
---|
| 4238 | + |
---|
| 4239 | + readobj.ResetDisplayList(); |
---|
| 4240 | + } catch (Exception e2) |
---|
| 4241 | + { |
---|
| 4242 | + e2.printStackTrace(); |
---|
| 4243 | + } |
---|
4018 | 4244 | } |
---|
4019 | 4245 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4020 | 4246 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4131 | 4357 | |
---|
4132 | 4358 | void load() // throws ClassNotFoundException |
---|
4133 | 4359 | { |
---|
4134 | | - if (GrafreeD.standAlone) |
---|
| 4360 | + if (Grafreed.standAlone) |
---|
4135 | 4361 | { |
---|
4136 | 4362 | FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
4137 | 4363 | browser.show(); |
---|
.. | .. |
---|
4218 | 4444 | try |
---|
4219 | 4445 | { |
---|
4220 | 4446 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4221 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4447 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4448 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4222 | 4449 | |
---|
4223 | 4450 | p.writeObject(copy); |
---|
4224 | 4451 | p.flush(); |
---|
4225 | 4452 | |
---|
| 4453 | + zstream.close(); |
---|
4226 | 4454 | ostream.close(); |
---|
4227 | 4455 | |
---|
4228 | 4456 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4232 | 4460 | { |
---|
4233 | 4461 | } |
---|
4234 | 4462 | } |
---|
| 4463 | + |
---|
4235 | 4464 | String lastname; |
---|
4236 | 4465 | |
---|
4237 | 4466 | void saveAs() |
---|
4238 | 4467 | { |
---|
4239 | | - if (GrafreeD.standAlone) |
---|
| 4468 | + if (Grafreed.standAlone) |
---|
4240 | 4469 | { |
---|
4241 | 4470 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4242 | 4471 | browser.setVisible(true); |
---|
.. | .. |
---|
4341 | 4570 | try |
---|
4342 | 4571 | { |
---|
4343 | 4572 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4344 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4345 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 4573 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4574 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4346 | 4575 | |
---|
4347 | 4576 | Object3D objectparent = obj.parent; |
---|
4348 | 4577 | obj.parent = null; |
---|
4349 | 4578 | |
---|
4350 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 4579 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4351 | 4580 | |
---|
4352 | 4581 | obj.parent = objectparent; |
---|
4353 | 4582 | |
---|
.. | .. |
---|
4359 | 4588 | p.writeObject(object); |
---|
4360 | 4589 | p.flush(); |
---|
4361 | 4590 | |
---|
| 4591 | + zstream.close(); |
---|
4362 | 4592 | ostream.close(); |
---|
4363 | | - // zstream.close(); |
---|
4364 | 4593 | |
---|
4365 | 4594 | // group.selection.get(0).parent = parent; |
---|
4366 | 4595 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4381 | 4610 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4382 | 4611 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4383 | 4612 | copy.generatePOV(buffer); |
---|
4384 | | - if (GrafreeD.standAlone) |
---|
| 4613 | + if (Grafreed.standAlone) |
---|
4385 | 4614 | { |
---|
4386 | 4615 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4387 | 4616 | browser.show(); |
---|
.. | .. |
---|
4407 | 4636 | Object3D client; |
---|
4408 | 4637 | Object3D copy; |
---|
4409 | 4638 | MenuBar menuBar; |
---|
4410 | | - Menu windowMenu; |
---|
| 4639 | + Menu fileMenu; |
---|
| 4640 | + MenuItem newItem; |
---|
4411 | 4641 | MenuItem loadItem; |
---|
4412 | 4642 | MenuItem saveItem; |
---|
4413 | 4643 | MenuItem saveAsItem; |
---|
.. | .. |
---|
4415 | 4645 | MenuItem reexportItem; |
---|
4416 | 4646 | MenuItem povItem; |
---|
4417 | 4647 | MenuItem closeItem; |
---|
4418 | | - Menu cameraMenu; |
---|
| 4648 | + |
---|
4419 | 4649 | CheckboxMenuItem zBufferItem; |
---|
4420 | 4650 | //MenuItem normalLensItem; |
---|
4421 | | - MenuItem editCameraItem; |
---|
4422 | | - MenuItem revertCameraItem; |
---|
4423 | 4651 | MenuItem stepItem; |
---|
4424 | 4652 | CheckboxMenuItem toggleLiveItem; |
---|
4425 | 4653 | CheckboxMenuItem toggleFullScreenItem; |
---|
.. | .. |
---|
4430 | 4658 | CheckboxMenuItem toggleFootContactItem; |
---|
4431 | 4659 | CheckboxMenuItem toggleDLItem; |
---|
4432 | 4660 | CheckboxMenuItem toggleTextureItem; |
---|
4433 | | - CheckboxMenuItem toggleRandomItem; |
---|
| 4661 | + CheckboxMenuItem toggleSwitchItem; |
---|
4434 | 4662 | CheckboxMenuItem toggleRootItem; |
---|
4435 | 4663 | CheckboxMenuItem animationItem; |
---|
4436 | 4664 | CheckboxMenuItem toggleHandleItem; |
---|
.. | .. |
---|
4567 | 4795 | //ObjectUI parent; |
---|
4568 | 4796 | |
---|
4569 | 4797 | cNumberSlider normalpushField; |
---|
| 4798 | + |
---|
| 4799 | + private MenuItem importGFDItem; |
---|
| 4800 | + private MenuItem importVRMLX3DItem; |
---|
| 4801 | + private MenuItem import3DSItem; |
---|
| 4802 | + private MenuItem importOBJItem; |
---|
4570 | 4803 | } |
---|