.. | .. |
---|
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); |
---|
.. | .. |
---|
301 | 318 | //povItem.addActionListener(this); |
---|
302 | 319 | closeItem.addActionListener(this); |
---|
303 | 320 | |
---|
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 | | - |
---|
359 | 321 | objectPanel = new JTabbedPane(); |
---|
360 | 322 | toolbarPanel = new JPanel(); |
---|
361 | 323 | toolbarPanel.setName("Toolbar"); |
---|
362 | | - treePanel = new JPanel(); |
---|
| 324 | + treePanel = new cGridBag(); |
---|
363 | 325 | treePanel.setName("Tree"); |
---|
364 | 326 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
365 | 327 | ctrlPanel.setName("Edit"); |
---|
.. | .. |
---|
367 | 329 | materialPanel.setName("Material"); |
---|
368 | 330 | /*JTextPane*/ |
---|
369 | 331 | infoarea = createTextPane(); |
---|
| 332 | + doc = infoarea.getStyledDocument(); |
---|
| 333 | + |
---|
370 | 334 | infoarea.setEditable(true); |
---|
371 | 335 | SetText(); |
---|
372 | 336 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
373 | 337 | // infoarea.setOpaque(false); |
---|
374 | 338 | // //infoarea.setForeground(textcolor); |
---|
375 | | - infoarea.setLineWrap(true); |
---|
376 | | - infoarea.setWrapStyleWord(true); |
---|
| 339 | +// TEXTAREA infoarea.setLineWrap(true); |
---|
| 340 | +// TEXTAREA infoarea.setWrapStyleWord(true); |
---|
377 | 341 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
378 | 342 | infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
379 | 343 | infoPanel.setName("Info"); |
---|
.. | .. |
---|
384 | 348 | mainPanel.setName("Main"); |
---|
385 | 349 | mainPanel.setContinuousLayout(true); |
---|
386 | 350 | mainPanel.setOneTouchExpandable(true); |
---|
387 | | - mainPanel.setDividerLocation(1.0); |
---|
388 | 351 | mainPanel.setDividerSize(9); |
---|
389 | | - mainPanel.setResizeWeight(0); |
---|
| 352 | + mainPanel.setDividerLocation(0.5); //1.0); |
---|
| 353 | + mainPanel.setResizeWeight(0.5); |
---|
390 | 354 | |
---|
391 | 355 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
392 | 356 | //mainPanel.setLayout(new GridBagLayout()); |
---|
393 | 357 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
394 | | - treePanel.setLayout(new GridBagLayout()); |
---|
| 358 | +// treePanel.setLayout(new GridBagLayout()); |
---|
395 | 359 | //ctrlPanel.setLayout(new GridBagLayout()); |
---|
396 | 360 | //materialPanel.setLayout(new GridBagLayout()); |
---|
397 | 361 | |
---|
.. | .. |
---|
432 | 396 | static String newline = "\n"; |
---|
433 | 397 | protected static final String buttonString = "JButton"; |
---|
434 | 398 | StyledDocument doc; |
---|
435 | | - JTextArea infoarea; |
---|
| 399 | + JTextPane infoarea; |
---|
436 | 400 | |
---|
437 | 401 | void ClearInfo() |
---|
438 | 402 | { |
---|
.. | .. |
---|
481 | 445 | //SendInfo("Name:", "bold"); |
---|
482 | 446 | if (sel.GetTextures() != null || debug) |
---|
483 | 447 | { |
---|
484 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 448 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
485 | 449 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
486 | 450 | if (sel.Size() > 0) |
---|
487 | 451 | { |
---|
488 | 452 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
489 | 453 | } |
---|
490 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 454 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
491 | 455 | if (debug) |
---|
492 | 456 | { |
---|
493 | 457 | try |
---|
.. | .. |
---|
499 | 463 | } |
---|
500 | 464 | |
---|
501 | 465 | if (full) |
---|
502 | | - si.SendInfo(" BBox: " + minima + " - " + maxima, "regular"); |
---|
| 466 | + { |
---|
| 467 | + si.SendInfo(" BBox min: " + minima, "regular"); |
---|
| 468 | + si.SendInfo(" BBox max: " + maxima, "regular"); |
---|
| 469 | + } |
---|
503 | 470 | |
---|
504 | 471 | if (sel.bRep != null) |
---|
505 | 472 | { |
---|
.. | .. |
---|
526 | 493 | } |
---|
527 | 494 | if (sel.support != null) |
---|
528 | 495 | { |
---|
529 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 496 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
530 | 497 | } |
---|
531 | 498 | if (sel.scriptnode != null) |
---|
532 | 499 | { |
---|
.. | .. |
---|
597 | 564 | { |
---|
598 | 565 | CameraPane.pointflow = (PointFlow) sel; |
---|
599 | 566 | } |
---|
| 567 | + |
---|
| 568 | + si.SendInfo("_____________________", "regular"); |
---|
| 569 | + si.SendInfo("", "regular"); |
---|
600 | 570 | } |
---|
601 | 571 | } |
---|
602 | 572 | |
---|
.. | .. |
---|
628 | 598 | cameraView.ToggleFullScreen(); |
---|
629 | 599 | } |
---|
630 | 600 | |
---|
631 | | - private JTextArea createTextPane() |
---|
| 601 | + private JTextPane createTextPane() |
---|
632 | 602 | { |
---|
633 | | - String[] initString = |
---|
634 | | - { |
---|
635 | | - "This is an editable JTextPane, ", //regular |
---|
636 | | - "another ", //italic |
---|
637 | | - "styled ", //bold |
---|
638 | | - "text ", //small |
---|
639 | | - "component, ", //large |
---|
640 | | - "which supports embedded components..." + newline,//regular |
---|
641 | | - " " + newline, //button |
---|
642 | | - "...and embedded icons..." + newline, //regular |
---|
643 | | - " ", //icon |
---|
644 | | - newline + "JTextPane is a subclass of JEditorPane that " |
---|
645 | | - + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
646 | | - + "cover methods for interacting with those objects." |
---|
647 | | - }; |
---|
| 603 | +// TEXTAREA String[] initString = |
---|
| 604 | +// { |
---|
| 605 | +// "This is an editable JTextPane, ", //regular |
---|
| 606 | +// "another ", //italic |
---|
| 607 | +// "styled ", //bold |
---|
| 608 | +// "text ", //small |
---|
| 609 | +// "component, ", //large |
---|
| 610 | +// "which supports embedded components..." + newline,//regular |
---|
| 611 | +// " " + newline, //button |
---|
| 612 | +// "...and embedded icons..." + newline, //regular |
---|
| 613 | +// " ", //icon |
---|
| 614 | +// newline + "JTextPane is a subclass of JEditorPane that " |
---|
| 615 | +// + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
| 616 | +// + "cover methods for interacting with those objects." |
---|
| 617 | +// }; |
---|
| 618 | +// |
---|
| 619 | +// String[] initStyles = |
---|
| 620 | +// { |
---|
| 621 | +// "regular", "italic", "bold", "small", "large", |
---|
| 622 | +// "regular", "button", "regular", "icon", |
---|
| 623 | +// "regular" |
---|
| 624 | +// }; |
---|
| 625 | +// |
---|
| 626 | +// JTextPane textPane = new JTextPane(); |
---|
| 627 | +// textPane.setEditable(true); |
---|
| 628 | +// /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
| 629 | +// addStylesToDocument(doc); |
---|
| 630 | +// |
---|
| 631 | +// try |
---|
| 632 | +// { |
---|
| 633 | +// for (int j = 0; j < 2; j++) |
---|
| 634 | +// { |
---|
| 635 | +// for (int i = 0; i < initString.length; i++) |
---|
| 636 | +// { |
---|
| 637 | +// doc.insertString(doc.getLength(), initString[i], |
---|
| 638 | +// doc.getStyle(initStyles[i])); |
---|
| 639 | +// } |
---|
| 640 | +// } |
---|
| 641 | +// } catch (BadLocationException ble) |
---|
| 642 | +// { |
---|
| 643 | +// System.err.println("Couldn't insert initial text into text pane."); |
---|
| 644 | +// } |
---|
648 | 645 | |
---|
649 | | - String[] initStyles = |
---|
650 | | - { |
---|
651 | | - "regular", "italic", "bold", "small", "large", |
---|
652 | | - "regular", "button", "regular", "icon", |
---|
653 | | - "regular" |
---|
654 | | - }; |
---|
655 | | - |
---|
656 | | - JTextPane textPane = new JTextPane(); |
---|
657 | | - textPane.setEditable(true); |
---|
658 | | - /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
659 | | - addStylesToDocument(doc); |
---|
660 | | - |
---|
661 | | - try |
---|
662 | | - { |
---|
663 | | - for (int j = 0; j < 2; j++) |
---|
664 | | - { |
---|
665 | | - for (int i = 0; i < initString.length; i++) |
---|
666 | | - { |
---|
667 | | - doc.insertString(doc.getLength(), initString[i], |
---|
668 | | - doc.getStyle(initStyles[i])); |
---|
669 | | - } |
---|
670 | | - } |
---|
671 | | - } catch (BadLocationException ble) |
---|
672 | | - { |
---|
673 | | - System.err.println("Couldn't insert initial text into text pane."); |
---|
674 | | - } |
---|
675 | | - |
---|
676 | | - return new JTextArea(); // textPane; |
---|
| 646 | + return new JTextPane(); // textPane; |
---|
677 | 647 | } |
---|
678 | 648 | |
---|
679 | 649 | protected void addStylesToDocument(StyledDocument doc) |
---|
.. | .. |
---|
726 | 696 | protected static ImageIcon createImageIcon(String path, |
---|
727 | 697 | String description) |
---|
728 | 698 | { |
---|
729 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 699 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
730 | 700 | if (imgURL != null) |
---|
731 | 701 | { |
---|
732 | 702 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
758 | 728 | // NumberSlider vDivsField; |
---|
759 | 729 | // JCheckBox endcaps; |
---|
760 | 730 | JCheckBox liveCB; |
---|
| 731 | + JCheckBox selectCB; |
---|
761 | 732 | JCheckBox hideCB; |
---|
762 | 733 | JCheckBox link2masterCB; |
---|
763 | 734 | JCheckBox markCB; |
---|
.. | .. |
---|
943 | 914 | |
---|
944 | 915 | void SetupUI2(ObjEditor oe) |
---|
945 | 916 | { |
---|
946 | | -// oe.aConstraints.weightx = 0; |
---|
947 | | -// oe.aConstraints.weighty = 0; |
---|
948 | | -// oe.aConstraints.gridx = 0; |
---|
949 | | -// oe.aConstraints.gridy = 0; |
---|
950 | 917 | //SetupName(oe); |
---|
951 | 918 | |
---|
952 | 919 | namePanel = new cGridBag(); |
---|
.. | .. |
---|
963 | 930 | setupPanel = new cGridBag().setVertical(false); |
---|
964 | 931 | |
---|
965 | 932 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
966 | | - link2masterCB = AddCheckBox(setupPanel, "Supp", copy.link2master); |
---|
967 | | - hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 933 | + liveCB.setToolTipText("Animate object"); |
---|
| 934 | + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 935 | + selectCB.setToolTipText("Make object selectable"); |
---|
968 | 936 | // Return(); |
---|
| 937 | + hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 938 | + hideCB.setToolTipText("Hide object"); |
---|
969 | 939 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
970 | | - rewindCB = AddCheckBox(setupPanel, "Rew", copy.rewind); |
---|
971 | | - 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"); |
---|
972 | 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 | + |
---|
973 | 956 | oe.ctrlPanel.add(setupPanel); |
---|
974 | 957 | oe.ctrlPanel.Return(); |
---|
975 | 958 | |
---|
976 | 959 | commandsPanel = new cGridBag().setVertical(false); |
---|
977 | 960 | |
---|
978 | 961 | resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 962 | + resetButton.setToolTipText("Jump to frame zero"); |
---|
979 | 963 | stepButton = AddButton(commandsPanel, "Step"); |
---|
| 964 | + stepButton.setToolTipText("Step one frame"); |
---|
980 | 965 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
981 | 966 | // stepAllButton = AddButton(oe, "Step All"); |
---|
982 | | - speedupCB = AddCheckBox(commandsPanel, "Speed", copy.speedup); |
---|
983 | 967 | // Return(); |
---|
984 | 968 | slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 969 | + slowerButton.setToolTipText("Decrease animation speed"); |
---|
985 | 970 | fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 971 | + fasterButton.setToolTipText("Increase animation speed"); |
---|
986 | 972 | remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 973 | + remarkButton.setToolTipText("Set the current transform as the target"); |
---|
987 | 974 | |
---|
988 | 975 | oe.ctrlPanel.add(commandsPanel); |
---|
989 | 976 | oe.ctrlPanel.Return(); |
---|
990 | 977 | |
---|
991 | | - 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 |
---|
992 | 979 | normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
993 | 980 | //Return(); |
---|
994 | 981 | |
---|
.. | .. |
---|
1290 | 1277 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1291 | 1278 | |
---|
1292 | 1279 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1293 | | - scenePanel.preferredWidth = 7; |
---|
| 1280 | + scenePanel.preferredWidth = 6; |
---|
1294 | 1281 | |
---|
1295 | 1282 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1296 | 1283 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1396 | 1383 | |
---|
1397 | 1384 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1398 | 1385 | |
---|
1399 | | - frame.setSize(1024, 768); |
---|
1400 | | - frame.show(); |
---|
| 1386 | + frame.setSize(1280, 860); |
---|
| 1387 | + frame.setVisible(true); |
---|
1401 | 1388 | |
---|
1402 | 1389 | gridPanel.setDividerLocation(1.0); |
---|
1403 | 1390 | |
---|
.. | .. |
---|
1436 | 1423 | |
---|
1437 | 1424 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1438 | 1425 | |
---|
1439 | | - editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints); |
---|
| 1426 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1427 | + createMaterialButton.setToolTipText("Create material"); |
---|
1440 | 1428 | |
---|
1441 | 1429 | /* |
---|
1442 | 1430 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1443 | 1431 | */ |
---|
1444 | 1432 | |
---|
1445 | | - editBar.add(clearMaterialButton = new cButton("Clear")); // , aConstraints); |
---|
1446 | | - editBar.add(resetSlidersButton = new cButton("Reset")); // , aConstraints); |
---|
1447 | | - editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1448 | | - editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 1433 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1434 | + clearMaterialButton.setToolTipText("Clear material"); |
---|
| 1435 | + |
---|
| 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 | + } |
---|
1449 | 1442 | |
---|
| 1443 | + editBar.preferredHeight = 15; |
---|
| 1444 | + |
---|
1450 | 1445 | panel.add(editBar); |
---|
1451 | 1446 | |
---|
1452 | 1447 | /**/ |
---|
.. | .. |
---|
1712 | 1707 | opacityPowerField.addChangeListener(this); |
---|
1713 | 1708 | /**/ |
---|
1714 | 1709 | |
---|
1715 | | - resetSlidersButton.addActionListener(this); |
---|
1716 | 1710 | clearMaterialButton.addActionListener(this); |
---|
1717 | 1711 | createMaterialButton.addActionListener(this); |
---|
1718 | | - |
---|
1719 | | - propagateToggle.addItemListener(this); |
---|
1720 | | - multiplyToggle.addItemListener(this); |
---|
| 1712 | + |
---|
| 1713 | + if (Globals.ADVANCED) |
---|
| 1714 | + { |
---|
| 1715 | + resetSlidersButton.addActionListener(this); |
---|
| 1716 | + propagateToggle.addItemListener(this); |
---|
| 1717 | + multiplyToggle.addItemListener(this); |
---|
| 1718 | + } |
---|
1721 | 1719 | } |
---|
1722 | 1720 | |
---|
1723 | 1721 | void DropFile(java.io.File[] files, boolean textures) |
---|
.. | .. |
---|
1888 | 1886 | |
---|
1889 | 1887 | //? flashIt = false; |
---|
1890 | 1888 | CameraPane pane = (CameraPane) cameraView; |
---|
1891 | | - pane.clickStart(location.x, location.y, 0); |
---|
| 1889 | + pane.clickStart(location.x, location.y, 0, 0); |
---|
1892 | 1890 | pane.clickEnd(location.x, location.y, 0, true); |
---|
1893 | 1891 | |
---|
1894 | 1892 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
2345 | 2343 | |
---|
2346 | 2344 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2347 | 2345 | { |
---|
2348 | | - if (GrafreeD.standAlone) |
---|
| 2346 | + if (Grafreed.standAlone) |
---|
2349 | 2347 | { |
---|
2350 | 2348 | /**/ |
---|
2351 | 2349 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2352 | | - browser.show(); |
---|
| 2350 | + browser.setVisible(true); |
---|
2353 | 2351 | String filename = browser.getFile(); |
---|
2354 | 2352 | if (filename != null && filename.length() > 0) |
---|
2355 | 2353 | { |
---|
.. | .. |
---|
2709 | 2707 | return; |
---|
2710 | 2708 | } |
---|
2711 | 2709 | |
---|
2712 | | - multiplyToggle.setSelected(mat.multiply); |
---|
| 2710 | + if (multiplyToggle != null) |
---|
| 2711 | + multiplyToggle.setSelected(mat.multiply); |
---|
2713 | 2712 | |
---|
2714 | 2713 | assert (object.projectedVertices != null); |
---|
2715 | 2714 | |
---|
.. | .. |
---|
2924 | 2923 | frame.validate(); |
---|
2925 | 2924 | |
---|
2926 | 2925 | return; |
---|
2927 | | - } else if (event.getSource() == toggleRandomItem) |
---|
| 2926 | + } else if (event.getSource() == toggleSwitchItem) |
---|
2928 | 2927 | { |
---|
2929 | 2928 | cameraView.ToggleRandom(); |
---|
2930 | 2929 | cameraView.repaint(); |
---|
.. | .. |
---|
2955 | 2954 | { |
---|
2956 | 2955 | copy.live ^= true; |
---|
2957 | 2956 | return; |
---|
| 2957 | + } else if (event.getSource() == selectCB) |
---|
| 2958 | + { |
---|
| 2959 | + copy.dontselect ^= true; |
---|
| 2960 | + return; |
---|
2958 | 2961 | } else if (event.getSource() == hideCB) |
---|
2959 | 2962 | { |
---|
2960 | 2963 | copy.hide ^= true; |
---|
.. | .. |
---|
2969 | 2972 | if (event.getSource() == randomCB) |
---|
2970 | 2973 | { |
---|
2971 | 2974 | copy.random ^= true; |
---|
| 2975 | + objEditor.refreshContents(); |
---|
2972 | 2976 | return; |
---|
2973 | 2977 | } |
---|
2974 | 2978 | if (event.getSource() == speedupCB) |
---|
.. | .. |
---|
2992 | 2996 | |
---|
2993 | 2997 | public void actionPerformed(ActionEvent event) |
---|
2994 | 2998 | { |
---|
| 2999 | + Object source = event.getSource(); |
---|
2995 | 3000 | // SCRIPT DIALOG |
---|
2996 | | - if (event.getSource() == okbutton) |
---|
| 3001 | + if (source == okbutton) |
---|
2997 | 3002 | { |
---|
2998 | 3003 | textpanel.setVisible(false); |
---|
2999 | 3004 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3005 | 3010 | textarea = null; |
---|
3006 | 3011 | textpanel = null; |
---|
3007 | 3012 | } |
---|
3008 | | - if (event.getSource() == cancelbutton) |
---|
| 3013 | + if (source == cancelbutton) |
---|
3009 | 3014 | { |
---|
3010 | 3015 | textpanel.setVisible(false); |
---|
3011 | 3016 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3017 | 3022 | //applySelf(); |
---|
3018 | 3023 | //client.refreshEditWindow(); |
---|
3019 | 3024 | //refreshContents(); |
---|
3020 | | - if (event.getSource() == nameField) |
---|
| 3025 | + if (source == nameField) |
---|
3021 | 3026 | { |
---|
3022 | 3027 | //System.out.println("ObjEditor " + event); |
---|
3023 | 3028 | applySelf0(true); |
---|
3024 | 3029 | //parent.applySelf(); |
---|
3025 | 3030 | objEditor.refreshContents(); |
---|
3026 | | - } else if (event.getSource() == resetButton) |
---|
| 3031 | + } else if (source == resetButton) |
---|
3027 | 3032 | { |
---|
3028 | 3033 | CameraPane.fullreset = true; |
---|
3029 | 3034 | copy.Reset(); // ResetMeshes(); |
---|
3030 | 3035 | copy.Touch(); |
---|
3031 | 3036 | objEditor.refreshContents(); |
---|
3032 | | - } else if (event.getSource() == stepItem) |
---|
| 3037 | + } else if (source == stepItem) |
---|
3033 | 3038 | { |
---|
3034 | 3039 | //cameraView.ONESTEP = true; |
---|
3035 | 3040 | Globals.ONESTEP = true; |
---|
3036 | 3041 | cameraView.repaint(); |
---|
3037 | 3042 | return; |
---|
3038 | | - } else if (event.getSource() == stepButton) |
---|
| 3043 | + } else if (source == stepButton) |
---|
3039 | 3044 | { |
---|
3040 | 3045 | copy.Step(); |
---|
3041 | 3046 | copy.Touch(); |
---|
3042 | 3047 | objEditor.refreshContents(); |
---|
3043 | | - } else if (event.getSource() == slowerButton) |
---|
| 3048 | + } else if (source == slowerButton) |
---|
3044 | 3049 | { |
---|
3045 | 3050 | copy.Slower(); |
---|
3046 | 3051 | copy.Touch(); |
---|
3047 | 3052 | objEditor.refreshContents(); |
---|
3048 | | - } else if (event.getSource() == fasterButton) |
---|
| 3053 | + } else if (source == fasterButton) |
---|
3049 | 3054 | { |
---|
3050 | 3055 | copy.Faster(); |
---|
3051 | 3056 | copy.Touch(); |
---|
3052 | 3057 | objEditor.refreshContents(); |
---|
3053 | | - } else if (event.getSource() == remarkButton) |
---|
| 3058 | + } else if (source == remarkButton) |
---|
3054 | 3059 | { |
---|
3055 | 3060 | copy.Remark(); |
---|
3056 | 3061 | copy.Touch(); |
---|
3057 | 3062 | objEditor.refreshContents(); |
---|
3058 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3063 | + } else if (source == stepAllButton) |
---|
3059 | 3064 | { |
---|
3060 | 3065 | copy.StepAll(); |
---|
3061 | 3066 | copy.Touch(); |
---|
3062 | 3067 | objEditor.refreshContents(); |
---|
3063 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3068 | + } else if (source == resetAllButton) |
---|
3064 | 3069 | { |
---|
3065 | 3070 | //CameraPane.fullreset = true; |
---|
3066 | 3071 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3093 | 3098 | // Close(); |
---|
3094 | 3099 | // } |
---|
3095 | 3100 | // else |
---|
3096 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3101 | + if (source == resetSlidersButton) |
---|
3097 | 3102 | { |
---|
3098 | 3103 | ResetSliders(); |
---|
3099 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3104 | + } else if (source == clearMaterialButton) |
---|
3100 | 3105 | { |
---|
3101 | 3106 | ClearMaterial(); |
---|
3102 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3107 | + } else if (source == createMaterialButton) |
---|
3103 | 3108 | { |
---|
3104 | 3109 | CreateMaterial(); |
---|
3105 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3110 | + } else if (source == clearPanelButton) |
---|
3106 | 3111 | { |
---|
3107 | 3112 | copy.ClearUI(); |
---|
3108 | 3113 | refreshContents(true); |
---|
3109 | | - } /* |
---|
3110 | | - } |
---|
3111 | | - |
---|
3112 | | - public boolean action(Event event, Object arg) |
---|
3113 | | - { |
---|
3114 | | - */ else if (event.getSource() == closeItem) |
---|
| 3114 | + } else if (source == importGFDItem) |
---|
| 3115 | + { |
---|
| 3116 | + ImportGFD(); |
---|
| 3117 | + } else |
---|
| 3118 | + if (source == importVRMLX3DItem) |
---|
| 3119 | + { |
---|
| 3120 | + ImportVRMLX3D(); |
---|
| 3121 | + } else |
---|
| 3122 | + if (source == import3DSItem) |
---|
| 3123 | + { |
---|
| 3124 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3125 | + } else |
---|
| 3126 | + if (source == importOBJItem) |
---|
| 3127 | + { |
---|
| 3128 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3129 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3130 | + browser.setVisible(true); |
---|
| 3131 | + String filename = browser.getFile(); |
---|
| 3132 | + if (filename != null && filename.length() > 0) |
---|
| 3133 | + { |
---|
| 3134 | + String fullname = browser.getDirectory() + filename; |
---|
| 3135 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3136 | + } |
---|
| 3137 | + } else |
---|
| 3138 | + if (source == closeItem) |
---|
3115 | 3139 | { |
---|
3116 | 3140 | Close(); |
---|
3117 | 3141 | //return true; |
---|
3118 | | - } else if (event.getSource() == loadItem) |
---|
| 3142 | + } else if (source == loadItem) |
---|
3119 | 3143 | { |
---|
3120 | 3144 | load(); |
---|
3121 | 3145 | //return true; |
---|
3122 | | - } else if (event.getSource() == saveItem) |
---|
| 3146 | + } else if (source == newItem) |
---|
| 3147 | + { |
---|
| 3148 | + New(); |
---|
| 3149 | + } else if (source == saveItem) |
---|
3123 | 3150 | { |
---|
3124 | 3151 | save(); |
---|
3125 | 3152 | //return true; |
---|
3126 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3153 | + } else if (source == saveAsItem) |
---|
3127 | 3154 | { |
---|
3128 | 3155 | saveAs(); |
---|
3129 | 3156 | //return true; |
---|
3130 | | - } else if (event.getSource() == reexportItem) |
---|
| 3157 | + } else if (source == reexportItem) |
---|
3131 | 3158 | { |
---|
3132 | 3159 | reexport(); |
---|
3133 | 3160 | //return true; |
---|
3134 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3161 | + } else if (source == exportAsItem) |
---|
3135 | 3162 | { |
---|
3136 | 3163 | export(); |
---|
3137 | 3164 | //return true; |
---|
3138 | | - } else if (event.getSource() == povItem) |
---|
| 3165 | + } else if (source == povItem) |
---|
3139 | 3166 | { |
---|
3140 | 3167 | generatePOV(); |
---|
3141 | 3168 | //return true; |
---|
3142 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3169 | + } else if (source == zBufferItem) |
---|
3143 | 3170 | { |
---|
3144 | 3171 | try |
---|
3145 | 3172 | { |
---|
.. | .. |
---|
3161 | 3188 | cameraView.repaint(); |
---|
3162 | 3189 | //return true; |
---|
3163 | 3190 | } |
---|
3164 | | - */ else if (event.getSource() == editCameraItem) |
---|
3165 | | - { |
---|
3166 | | - cameraView.ProtectCamera(); |
---|
3167 | | - cameraView.repaint(); |
---|
3168 | | - return; |
---|
3169 | | - } else if (event.getSource() == revertCameraItem) |
---|
3170 | | - { |
---|
3171 | | - cameraView.RevertCamera(); |
---|
3172 | | - cameraView.repaint(); |
---|
3173 | | - return; |
---|
3174 | | -// } else if (event.getSource() == textureButton) |
---|
3175 | | -// { |
---|
3176 | | -// return; // true; |
---|
3177 | | - } else // combos... |
---|
3178 | | - if (event.getSource() == texresMenu) |
---|
| 3191 | + */ else // combos... |
---|
| 3192 | + if (source == texresMenu) |
---|
3179 | 3193 | { |
---|
3180 | 3194 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3181 | 3195 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3187 | 3201 | } |
---|
3188 | 3202 | } |
---|
3189 | 3203 | |
---|
| 3204 | + void New() |
---|
| 3205 | + { |
---|
| 3206 | + while (copy.Size() > 1) |
---|
| 3207 | + { |
---|
| 3208 | + copy.remove(1); |
---|
| 3209 | + } |
---|
| 3210 | + |
---|
| 3211 | + ResetModel(); |
---|
| 3212 | + objEditor.refreshContents(); |
---|
| 3213 | + } |
---|
| 3214 | + |
---|
| 3215 | + Object3D graphs[] = new Object3D[10000]; |
---|
| 3216 | + int undoindex = 0; |
---|
| 3217 | + |
---|
| 3218 | + static public Object clone(Object o) |
---|
| 3219 | + { |
---|
| 3220 | + try |
---|
| 3221 | + { |
---|
| 3222 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3223 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3224 | + |
---|
| 3225 | + out.writeObject(o); |
---|
| 3226 | + |
---|
| 3227 | + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); |
---|
| 3228 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3229 | + Object obj = in.readObject(); |
---|
| 3230 | + in.close(); |
---|
| 3231 | + out.close(); |
---|
| 3232 | + return obj; |
---|
| 3233 | + } catch (Exception e) |
---|
| 3234 | + { |
---|
| 3235 | + System.err.println(e); |
---|
| 3236 | + return null; |
---|
| 3237 | + } |
---|
| 3238 | + } |
---|
| 3239 | + |
---|
| 3240 | + public void Save() |
---|
| 3241 | + { |
---|
| 3242 | + if (true) return; |
---|
| 3243 | + |
---|
| 3244 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3245 | + graphs[undoindex++] = (Object3D)clone(copy); |
---|
| 3246 | + |
---|
| 3247 | + for (int i = undoindex; i < graphs.length; i++) |
---|
| 3248 | + { |
---|
| 3249 | + graphs[i] = null; |
---|
| 3250 | + } |
---|
| 3251 | + |
---|
| 3252 | + // test save |
---|
| 3253 | + if (false) |
---|
| 3254 | + { |
---|
| 3255 | + try |
---|
| 3256 | + { |
---|
| 3257 | + FileOutputStream ostream = new FileOutputStream("save" + undoindex); |
---|
| 3258 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3259 | + |
---|
| 3260 | + p.writeObject(copy); |
---|
| 3261 | + |
---|
| 3262 | + p.flush(); |
---|
| 3263 | + |
---|
| 3264 | + ostream.close(); |
---|
| 3265 | + } catch (Exception e) |
---|
| 3266 | + { |
---|
| 3267 | + e.printStackTrace(); |
---|
| 3268 | + } |
---|
| 3269 | + } |
---|
| 3270 | + } |
---|
| 3271 | + |
---|
| 3272 | + public void Undo() |
---|
| 3273 | + { |
---|
| 3274 | + if (undoindex == 0) |
---|
| 3275 | + { |
---|
| 3276 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3277 | + return; |
---|
| 3278 | + } |
---|
| 3279 | + |
---|
| 3280 | + if (graphs[undoindex] == null) |
---|
| 3281 | + { |
---|
| 3282 | + Save(); |
---|
| 3283 | + undoindex -= 1; |
---|
| 3284 | + } |
---|
| 3285 | + |
---|
| 3286 | + undoindex -= 1; |
---|
| 3287 | + |
---|
| 3288 | + copy = graphs[undoindex]; |
---|
| 3289 | + |
---|
| 3290 | + cameraView.object = copy; |
---|
| 3291 | + copy.Touch(); |
---|
| 3292 | + |
---|
| 3293 | + ResetModel(); |
---|
| 3294 | + refreshContents(); |
---|
| 3295 | + } |
---|
| 3296 | + |
---|
| 3297 | + public void Redo() |
---|
| 3298 | + { |
---|
| 3299 | + if (graphs[undoindex + 1] == null) |
---|
| 3300 | + { |
---|
| 3301 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3302 | + return; |
---|
| 3303 | + } |
---|
| 3304 | + |
---|
| 3305 | + undoindex += 1; |
---|
| 3306 | + |
---|
| 3307 | + copy = graphs[undoindex]; |
---|
| 3308 | + |
---|
| 3309 | + cameraView.object = copy; |
---|
| 3310 | + copy.Touch(); |
---|
| 3311 | + |
---|
| 3312 | + ResetModel(); |
---|
| 3313 | + refreshContents(); |
---|
| 3314 | + } |
---|
| 3315 | + |
---|
| 3316 | + void ImportGFD() |
---|
| 3317 | + { |
---|
| 3318 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 3319 | + browser.show(); |
---|
| 3320 | + String filename = browser.getFile(); |
---|
| 3321 | + if (filename != null && filename.length() > 0) |
---|
| 3322 | + { |
---|
| 3323 | + String fullname = browser.getDirectory() + filename; |
---|
| 3324 | + |
---|
| 3325 | + //Object3D readobj = |
---|
| 3326 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 3327 | + //makeSomething(readobj); |
---|
| 3328 | + } |
---|
| 3329 | + } |
---|
| 3330 | + |
---|
| 3331 | + void ImportVRMLX3D() |
---|
| 3332 | + { |
---|
| 3333 | + if (Grafreed.standAlone) |
---|
| 3334 | + { |
---|
| 3335 | + /**/ |
---|
| 3336 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 3337 | + browser.show(); |
---|
| 3338 | + String filename = browser.getFile(); |
---|
| 3339 | + if (filename != null && filename.length() > 0) |
---|
| 3340 | + { |
---|
| 3341 | + String fullname = browser.getDirectory() + filename; |
---|
| 3342 | + LoadVRMLX3D(fullname); |
---|
| 3343 | + } |
---|
| 3344 | + /**/ |
---|
| 3345 | + } |
---|
| 3346 | + } |
---|
| 3347 | + |
---|
3190 | 3348 | void ToggleAnimation() |
---|
3191 | 3349 | { |
---|
3192 | 3350 | if (!Globals.ANIMATION) |
---|
3193 | 3351 | { |
---|
3194 | 3352 | FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); |
---|
3195 | | - browser.show(); |
---|
| 3353 | + browser.setVisible(true); |
---|
3196 | 3354 | String filename = browser.getFile(); |
---|
3197 | 3355 | if (filename != null && filename.length() > 0) |
---|
3198 | 3356 | { |
---|
.. | .. |
---|
3202 | 3360 | |
---|
3203 | 3361 | Globals.ANIMATION ^= true; |
---|
3204 | 3362 | |
---|
3205 | | - GrafreeD.wav.cursor = 0; |
---|
3206 | | - GrafreeD.wav.loop = 0; |
---|
| 3363 | + Grafreed.wav.cursor = 0; |
---|
| 3364 | + Grafreed.wav.loop = 0; |
---|
3207 | 3365 | } |
---|
3208 | 3366 | } else |
---|
3209 | 3367 | { |
---|
.. | .. |
---|
3224 | 3382 | callee.refreshContents(); |
---|
3225 | 3383 | } else |
---|
3226 | 3384 | { |
---|
3227 | | - new Exception().printStackTrace(); |
---|
3228 | 3385 | System.exit(0); |
---|
3229 | 3386 | } |
---|
3230 | 3387 | } |
---|
.. | .. |
---|
3254 | 3411 | void CreateMaterial() |
---|
3255 | 3412 | { |
---|
3256 | 3413 | //copy.ClearMaterial(); // PATCH |
---|
3257 | | - copy.CreateMaterialS(multiplyToggle.isSelected()); |
---|
| 3414 | + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); |
---|
3258 | 3415 | if (copy.selection.size() > 0) |
---|
3259 | 3416 | //SetMaterial(copy); |
---|
3260 | 3417 | { |
---|
.. | .. |
---|
3313 | 3470 | { |
---|
3314 | 3471 | copy.ResetBlockLoop(); // temporary problem |
---|
3315 | 3472 | |
---|
3316 | | - boolean random = CameraPane.RANDOM; |
---|
3317 | | - CameraPane.RANDOM = false; // parse everything |
---|
| 3473 | + boolean random = CameraPane.SWITCH; |
---|
| 3474 | + CameraPane.SWITCH = false; // parse everything |
---|
3318 | 3475 | copy.ResetDisplayList(); |
---|
3319 | 3476 | copy.HardTouch(); |
---|
3320 | | - CameraPane.RANDOM = random; |
---|
| 3477 | + CameraPane.SWITCH = random; |
---|
3321 | 3478 | } |
---|
3322 | 3479 | |
---|
3323 | 3480 | // public void applySelf() |
---|
.. | .. |
---|
3391 | 3548 | { |
---|
3392 | 3549 | //System.out.println("Propagate = " + propagate); |
---|
3393 | 3550 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 3551 | + |
---|
| 3552 | + if (copy.material != null) |
---|
| 3553 | + { |
---|
| 3554 | + cMaterial mat = copy.material; |
---|
| 3555 | + |
---|
| 3556 | + colorField.SetToolTipValue((mat.color)); |
---|
| 3557 | + modulationField.SetToolTipValue((mat.modulation)); |
---|
| 3558 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 3559 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 3560 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 3561 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 3562 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 3563 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 3564 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 3565 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 3566 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 3567 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 3568 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 3569 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 3570 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 3571 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 3572 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 3573 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 3574 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 3575 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 3576 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 3577 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 3578 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 3579 | + } |
---|
| 3580 | + |
---|
3394 | 3581 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3395 | 3582 | { |
---|
3396 | 3583 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3506 | 3693 | } |
---|
3507 | 3694 | |
---|
3508 | 3695 | if (normalpushField != null) |
---|
3509 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 3696 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3510 | 3697 | } |
---|
3511 | 3698 | |
---|
3512 | 3699 | void SnapObject() |
---|
.. | .. |
---|
3770 | 3957 | |
---|
3771 | 3958 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3772 | 3959 | { |
---|
| 3960 | + Save(); |
---|
3773 | 3961 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3774 | 3962 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3775 | 3963 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3973 | 4161 | } |
---|
3974 | 4162 | } |
---|
3975 | 4163 | } |
---|
| 4164 | + |
---|
3976 | 4165 | LoadGFDThread loadGFDThread; |
---|
3977 | 4166 | |
---|
3978 | 4167 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
3993 | 4182 | try |
---|
3994 | 4183 | { |
---|
3995 | 4184 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
3996 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4185 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4186 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
3997 | 4187 | |
---|
3998 | 4188 | readobj = (Object3D) p.readObject(); |
---|
3999 | 4189 | istream.close(); |
---|
.. | .. |
---|
4001 | 4191 | readobj.ResetDisplayList(); |
---|
4002 | 4192 | } catch (Exception e) |
---|
4003 | 4193 | { |
---|
4004 | | - e.printStackTrace(); |
---|
| 4194 | + //e.printStackTrace(); |
---|
| 4195 | + try |
---|
| 4196 | + { |
---|
| 4197 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4198 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4199 | + |
---|
| 4200 | + readobj = (Object3D) p.readObject(); |
---|
| 4201 | + istream.close(); |
---|
| 4202 | + |
---|
| 4203 | + readobj.ResetDisplayList(); |
---|
| 4204 | + } catch (Exception e2) |
---|
| 4205 | + { |
---|
| 4206 | + e2.printStackTrace(); |
---|
| 4207 | + } |
---|
4005 | 4208 | } |
---|
4006 | 4209 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4007 | 4210 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4118 | 4321 | |
---|
4119 | 4322 | void load() // throws ClassNotFoundException |
---|
4120 | 4323 | { |
---|
4121 | | - if (GrafreeD.standAlone) |
---|
| 4324 | + if (Grafreed.standAlone) |
---|
4122 | 4325 | { |
---|
4123 | 4326 | FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
4124 | 4327 | browser.show(); |
---|
.. | .. |
---|
4205 | 4408 | try |
---|
4206 | 4409 | { |
---|
4207 | 4410 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4208 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4411 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4412 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4209 | 4413 | |
---|
4210 | 4414 | p.writeObject(copy); |
---|
4211 | 4415 | p.flush(); |
---|
4212 | 4416 | |
---|
| 4417 | + zstream.close(); |
---|
4213 | 4418 | ostream.close(); |
---|
4214 | 4419 | |
---|
4215 | 4420 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4219 | 4424 | { |
---|
4220 | 4425 | } |
---|
4221 | 4426 | } |
---|
| 4427 | + |
---|
4222 | 4428 | String lastname; |
---|
4223 | 4429 | |
---|
4224 | 4430 | void saveAs() |
---|
4225 | 4431 | { |
---|
4226 | | - if (GrafreeD.standAlone) |
---|
| 4432 | + if (Grafreed.standAlone) |
---|
4227 | 4433 | { |
---|
4228 | 4434 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4229 | 4435 | browser.setVisible(true); |
---|
.. | .. |
---|
4328 | 4534 | try |
---|
4329 | 4535 | { |
---|
4330 | 4536 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4331 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4332 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 4537 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4538 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4333 | 4539 | |
---|
4334 | 4540 | Object3D objectparent = obj.parent; |
---|
4335 | 4541 | obj.parent = null; |
---|
4336 | 4542 | |
---|
4337 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 4543 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4338 | 4544 | |
---|
4339 | 4545 | obj.parent = objectparent; |
---|
4340 | 4546 | |
---|
.. | .. |
---|
4346 | 4552 | p.writeObject(object); |
---|
4347 | 4553 | p.flush(); |
---|
4348 | 4554 | |
---|
| 4555 | + zstream.close(); |
---|
4349 | 4556 | ostream.close(); |
---|
4350 | | - // zstream.close(); |
---|
4351 | 4557 | |
---|
4352 | 4558 | // group.selection.get(0).parent = parent; |
---|
4353 | 4559 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4368 | 4574 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4369 | 4575 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4370 | 4576 | copy.generatePOV(buffer); |
---|
4371 | | - if (GrafreeD.standAlone) |
---|
| 4577 | + if (Grafreed.standAlone) |
---|
4372 | 4578 | { |
---|
4373 | 4579 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4374 | 4580 | browser.show(); |
---|
.. | .. |
---|
4394 | 4600 | Object3D client; |
---|
4395 | 4601 | Object3D copy; |
---|
4396 | 4602 | MenuBar menuBar; |
---|
4397 | | - Menu windowMenu; |
---|
| 4603 | + Menu fileMenu; |
---|
| 4604 | + MenuItem newItem; |
---|
4398 | 4605 | MenuItem loadItem; |
---|
4399 | 4606 | MenuItem saveItem; |
---|
4400 | 4607 | MenuItem saveAsItem; |
---|
.. | .. |
---|
4402 | 4609 | MenuItem reexportItem; |
---|
4403 | 4610 | MenuItem povItem; |
---|
4404 | 4611 | MenuItem closeItem; |
---|
4405 | | - Menu cameraMenu; |
---|
| 4612 | + |
---|
4406 | 4613 | CheckboxMenuItem zBufferItem; |
---|
4407 | 4614 | //MenuItem normalLensItem; |
---|
4408 | | - MenuItem editCameraItem; |
---|
4409 | | - MenuItem revertCameraItem; |
---|
4410 | 4615 | MenuItem stepItem; |
---|
4411 | 4616 | CheckboxMenuItem toggleLiveItem; |
---|
4412 | 4617 | CheckboxMenuItem toggleFullScreenItem; |
---|
.. | .. |
---|
4417 | 4622 | CheckboxMenuItem toggleFootContactItem; |
---|
4418 | 4623 | CheckboxMenuItem toggleDLItem; |
---|
4419 | 4624 | CheckboxMenuItem toggleTextureItem; |
---|
4420 | | - CheckboxMenuItem toggleRandomItem; |
---|
| 4625 | + CheckboxMenuItem toggleSwitchItem; |
---|
4421 | 4626 | CheckboxMenuItem toggleRootItem; |
---|
4422 | 4627 | CheckboxMenuItem animationItem; |
---|
4423 | 4628 | CheckboxMenuItem toggleHandleItem; |
---|
.. | .. |
---|
4425 | 4630 | JSplitPane mainPanel; |
---|
4426 | 4631 | JScrollPane scrollpane; |
---|
4427 | 4632 | JPanel toolbarPanel; |
---|
4428 | | - JPanel treePanel; |
---|
| 4633 | + cGridBag treePanel; |
---|
4429 | 4634 | JPanel radioPanel; |
---|
4430 | 4635 | ButtonGroup buttonGroup; |
---|
4431 | 4636 | cGridBag ctrlPanel; |
---|
.. | .. |
---|
4554 | 4759 | //ObjectUI parent; |
---|
4555 | 4760 | |
---|
4556 | 4761 | cNumberSlider normalpushField; |
---|
| 4762 | + |
---|
| 4763 | + private MenuItem importGFDItem; |
---|
| 4764 | + private MenuItem importVRMLX3DItem; |
---|
| 4765 | + private MenuItem import3DSItem; |
---|
| 4766 | + private MenuItem importOBJItem; |
---|
4557 | 4767 | } |
---|