.. | .. |
---|
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) |
---|
.. | .. |
---|
1937 | 1935 | e2.printStackTrace(); |
---|
1938 | 1936 | } |
---|
1939 | 1937 | } |
---|
| 1938 | + |
---|
1940 | 1939 | LoadJMEThread loadThread; |
---|
1941 | 1940 | |
---|
1942 | 1941 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
1994 | 1993 | //LoadFile0(filename, converter); |
---|
1995 | 1994 | } |
---|
1996 | 1995 | } |
---|
| 1996 | + |
---|
1997 | 1997 | LoadOBJThread loadObjThread; |
---|
1998 | 1998 | |
---|
1999 | 1999 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2345 | 2345 | |
---|
2346 | 2346 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2347 | 2347 | { |
---|
2348 | | - if (GrafreeD.standAlone) |
---|
| 2348 | + if (Grafreed.standAlone) |
---|
2349 | 2349 | { |
---|
2350 | 2350 | /**/ |
---|
2351 | 2351 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2352 | | - browser.show(); |
---|
| 2352 | + browser.setVisible(true); |
---|
2353 | 2353 | String filename = browser.getFile(); |
---|
2354 | 2354 | if (filename != null && filename.length() > 0) |
---|
2355 | 2355 | { |
---|
.. | .. |
---|
2709 | 2709 | return; |
---|
2710 | 2710 | } |
---|
2711 | 2711 | |
---|
2712 | | - multiplyToggle.setSelected(mat.multiply); |
---|
| 2712 | + if (multiplyToggle != null) |
---|
| 2713 | + multiplyToggle.setSelected(mat.multiply); |
---|
2713 | 2714 | |
---|
2714 | 2715 | assert (object.projectedVertices != null); |
---|
2715 | 2716 | |
---|
.. | .. |
---|
2924 | 2925 | frame.validate(); |
---|
2925 | 2926 | |
---|
2926 | 2927 | return; |
---|
2927 | | - } else if (event.getSource() == toggleRandomItem) |
---|
| 2928 | + } else if (event.getSource() == toggleSwitchItem) |
---|
2928 | 2929 | { |
---|
2929 | | - cameraView.ToggleRandom(); |
---|
| 2930 | + cameraView.ToggleSwitch(); |
---|
2930 | 2931 | cameraView.repaint(); |
---|
2931 | 2932 | return; |
---|
2932 | 2933 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
2955 | 2956 | { |
---|
2956 | 2957 | copy.live ^= true; |
---|
2957 | 2958 | return; |
---|
| 2959 | + } else if (event.getSource() == selectCB) |
---|
| 2960 | + { |
---|
| 2961 | + copy.dontselect ^= true; |
---|
| 2962 | + return; |
---|
2958 | 2963 | } else if (event.getSource() == hideCB) |
---|
2959 | 2964 | { |
---|
2960 | 2965 | copy.hide ^= true; |
---|
.. | .. |
---|
2969 | 2974 | if (event.getSource() == randomCB) |
---|
2970 | 2975 | { |
---|
2971 | 2976 | copy.random ^= true; |
---|
| 2977 | + objEditor.refreshContents(); |
---|
2972 | 2978 | return; |
---|
2973 | 2979 | } |
---|
2974 | 2980 | if (event.getSource() == speedupCB) |
---|
.. | .. |
---|
2992 | 2998 | |
---|
2993 | 2999 | public void actionPerformed(ActionEvent event) |
---|
2994 | 3000 | { |
---|
| 3001 | + Object source = event.getSource(); |
---|
2995 | 3002 | // SCRIPT DIALOG |
---|
2996 | | - if (event.getSource() == okbutton) |
---|
| 3003 | + if (source == okbutton) |
---|
2997 | 3004 | { |
---|
2998 | 3005 | textpanel.setVisible(false); |
---|
2999 | 3006 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3005 | 3012 | textarea = null; |
---|
3006 | 3013 | textpanel = null; |
---|
3007 | 3014 | } |
---|
3008 | | - if (event.getSource() == cancelbutton) |
---|
| 3015 | + if (source == cancelbutton) |
---|
3009 | 3016 | { |
---|
3010 | 3017 | textpanel.setVisible(false); |
---|
3011 | 3018 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3017 | 3024 | //applySelf(); |
---|
3018 | 3025 | //client.refreshEditWindow(); |
---|
3019 | 3026 | //refreshContents(); |
---|
3020 | | - if (event.getSource() == nameField) |
---|
| 3027 | + if (source == nameField) |
---|
3021 | 3028 | { |
---|
3022 | 3029 | //System.out.println("ObjEditor " + event); |
---|
3023 | 3030 | applySelf0(true); |
---|
3024 | 3031 | //parent.applySelf(); |
---|
3025 | 3032 | objEditor.refreshContents(); |
---|
3026 | | - } else if (event.getSource() == resetButton) |
---|
| 3033 | + } else if (source == resetButton) |
---|
3027 | 3034 | { |
---|
3028 | 3035 | CameraPane.fullreset = true; |
---|
3029 | 3036 | copy.Reset(); // ResetMeshes(); |
---|
3030 | 3037 | copy.Touch(); |
---|
3031 | 3038 | objEditor.refreshContents(); |
---|
3032 | | - } else if (event.getSource() == stepItem) |
---|
| 3039 | + } else if (source == stepItem) |
---|
3033 | 3040 | { |
---|
3034 | 3041 | //cameraView.ONESTEP = true; |
---|
3035 | 3042 | Globals.ONESTEP = true; |
---|
3036 | 3043 | cameraView.repaint(); |
---|
3037 | 3044 | return; |
---|
3038 | | - } else if (event.getSource() == stepButton) |
---|
| 3045 | + } else if (source == stepButton) |
---|
3039 | 3046 | { |
---|
3040 | 3047 | copy.Step(); |
---|
3041 | 3048 | copy.Touch(); |
---|
3042 | 3049 | objEditor.refreshContents(); |
---|
3043 | | - } else if (event.getSource() == slowerButton) |
---|
| 3050 | + } else if (source == slowerButton) |
---|
3044 | 3051 | { |
---|
3045 | 3052 | copy.Slower(); |
---|
3046 | 3053 | copy.Touch(); |
---|
3047 | 3054 | objEditor.refreshContents(); |
---|
3048 | | - } else if (event.getSource() == fasterButton) |
---|
| 3055 | + } else if (source == fasterButton) |
---|
3049 | 3056 | { |
---|
3050 | 3057 | copy.Faster(); |
---|
3051 | 3058 | copy.Touch(); |
---|
3052 | 3059 | objEditor.refreshContents(); |
---|
3053 | | - } else if (event.getSource() == remarkButton) |
---|
| 3060 | + } else if (source == remarkButton) |
---|
3054 | 3061 | { |
---|
3055 | 3062 | copy.Remark(); |
---|
3056 | 3063 | copy.Touch(); |
---|
3057 | 3064 | objEditor.refreshContents(); |
---|
3058 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3065 | + } else if (source == stepAllButton) |
---|
3059 | 3066 | { |
---|
3060 | 3067 | copy.StepAll(); |
---|
3061 | 3068 | copy.Touch(); |
---|
3062 | 3069 | objEditor.refreshContents(); |
---|
3063 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3070 | + } else if (source == resetAllButton) |
---|
3064 | 3071 | { |
---|
3065 | 3072 | //CameraPane.fullreset = true; |
---|
3066 | 3073 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3093 | 3100 | // Close(); |
---|
3094 | 3101 | // } |
---|
3095 | 3102 | // else |
---|
3096 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3103 | + if (source == resetSlidersButton) |
---|
3097 | 3104 | { |
---|
3098 | 3105 | ResetSliders(); |
---|
3099 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3106 | + } else if (source == clearMaterialButton) |
---|
3100 | 3107 | { |
---|
3101 | 3108 | ClearMaterial(); |
---|
3102 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3109 | + } else if (source == createMaterialButton) |
---|
3103 | 3110 | { |
---|
3104 | 3111 | CreateMaterial(); |
---|
3105 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3112 | + } else if (source == clearPanelButton) |
---|
3106 | 3113 | { |
---|
3107 | 3114 | copy.ClearUI(); |
---|
3108 | 3115 | refreshContents(true); |
---|
3109 | | - } /* |
---|
3110 | | - } |
---|
3111 | | - |
---|
3112 | | - public boolean action(Event event, Object arg) |
---|
3113 | | - { |
---|
3114 | | - */ 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) |
---|
3115 | 3141 | { |
---|
3116 | 3142 | Close(); |
---|
3117 | 3143 | //return true; |
---|
3118 | | - } else if (event.getSource() == loadItem) |
---|
| 3144 | + } else if (source == loadItem) |
---|
3119 | 3145 | { |
---|
3120 | 3146 | load(); |
---|
3121 | 3147 | //return true; |
---|
3122 | | - } else if (event.getSource() == saveItem) |
---|
| 3148 | + } else if (source == newItem) |
---|
| 3149 | + { |
---|
| 3150 | + New(); |
---|
| 3151 | + } else if (source == saveItem) |
---|
3123 | 3152 | { |
---|
3124 | 3153 | save(); |
---|
3125 | 3154 | //return true; |
---|
3126 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3155 | + } else if (source == saveAsItem) |
---|
3127 | 3156 | { |
---|
3128 | 3157 | saveAs(); |
---|
3129 | 3158 | //return true; |
---|
3130 | | - } else if (event.getSource() == reexportItem) |
---|
| 3159 | + } else if (source == reexportItem) |
---|
3131 | 3160 | { |
---|
3132 | 3161 | reexport(); |
---|
3133 | 3162 | //return true; |
---|
3134 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3163 | + } else if (source == exportAsItem) |
---|
3135 | 3164 | { |
---|
3136 | 3165 | export(); |
---|
3137 | 3166 | //return true; |
---|
3138 | | - } else if (event.getSource() == povItem) |
---|
| 3167 | + } else if (source == povItem) |
---|
3139 | 3168 | { |
---|
3140 | 3169 | generatePOV(); |
---|
3141 | 3170 | //return true; |
---|
3142 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3171 | + } else if (source == zBufferItem) |
---|
3143 | 3172 | { |
---|
3144 | 3173 | try |
---|
3145 | 3174 | { |
---|
.. | .. |
---|
3161 | 3190 | cameraView.repaint(); |
---|
3162 | 3191 | //return true; |
---|
3163 | 3192 | } |
---|
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) |
---|
| 3193 | + */ else // combos... |
---|
| 3194 | + if (source == texresMenu) |
---|
3179 | 3195 | { |
---|
3180 | 3196 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3181 | 3197 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3187 | 3203 | } |
---|
3188 | 3204 | } |
---|
3189 | 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 byte[] Compress(Object o) |
---|
| 3218 | + { |
---|
| 3219 | + try |
---|
| 3220 | + { |
---|
| 3221 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3222 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3223 | + ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3224 | + |
---|
| 3225 | + out.writeObject(o); |
---|
| 3226 | + |
---|
| 3227 | + out.flush(); |
---|
| 3228 | + |
---|
| 3229 | + zstream.close(); |
---|
| 3230 | + out.close(); |
---|
| 3231 | + |
---|
| 3232 | + return baos.toByteArray(); |
---|
| 3233 | + } catch (Exception e) |
---|
| 3234 | + { |
---|
| 3235 | + System.err.println(e); |
---|
| 3236 | + return null; |
---|
| 3237 | + } |
---|
| 3238 | + } |
---|
| 3239 | + |
---|
| 3240 | + static public Object Uncompress(byte[] bytes) |
---|
| 3241 | + { |
---|
| 3242 | + System.out.println("#bytes = " + bytes.length); |
---|
| 3243 | + try |
---|
| 3244 | + { |
---|
| 3245 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3246 | + java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3247 | + ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3248 | + Object obj = in.readObject(); |
---|
| 3249 | + in.close(); |
---|
| 3250 | + |
---|
| 3251 | + return obj; |
---|
| 3252 | + } catch (Exception e) |
---|
| 3253 | + { |
---|
| 3254 | + System.err.println(e); |
---|
| 3255 | + return null; |
---|
| 3256 | + } |
---|
| 3257 | + } |
---|
| 3258 | + |
---|
| 3259 | + static public Object clone(Object o) |
---|
| 3260 | + { |
---|
| 3261 | + try |
---|
| 3262 | + { |
---|
| 3263 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3264 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3265 | + |
---|
| 3266 | + out.writeObject(o); |
---|
| 3267 | + |
---|
| 3268 | + out.flush(); |
---|
| 3269 | + out.close(); |
---|
| 3270 | + |
---|
| 3271 | + byte[] bytes = baos.toByteArray(); |
---|
| 3272 | + |
---|
| 3273 | + System.out.println("clone = " + bytes.length); |
---|
| 3274 | + |
---|
| 3275 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3276 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3277 | + Object obj = in.readObject(); |
---|
| 3278 | + in.close(); |
---|
| 3279 | + |
---|
| 3280 | + return obj; |
---|
| 3281 | + } catch (Exception e) |
---|
| 3282 | + { |
---|
| 3283 | + System.err.println(e); |
---|
| 3284 | + return null; |
---|
| 3285 | + } |
---|
| 3286 | + } |
---|
| 3287 | + |
---|
| 3288 | + cRadio GetCurrentTab() |
---|
| 3289 | + { |
---|
| 3290 | + cRadio ab; |
---|
| 3291 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3292 | + { |
---|
| 3293 | + ab = (cRadio)e.nextElement(); |
---|
| 3294 | + if(ab.GetObject() == copy) |
---|
| 3295 | + { |
---|
| 3296 | + return ab; |
---|
| 3297 | + } |
---|
| 3298 | + } |
---|
| 3299 | + |
---|
| 3300 | + return null; |
---|
| 3301 | + } |
---|
| 3302 | + |
---|
| 3303 | + java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3304 | + |
---|
| 3305 | + public void Save() |
---|
| 3306 | + { |
---|
| 3307 | + cRadio tab = GetCurrentTab(); |
---|
| 3308 | + |
---|
| 3309 | + boolean temp = CameraPane.SWITCH; |
---|
| 3310 | + CameraPane.SWITCH = false; |
---|
| 3311 | + |
---|
| 3312 | + copy.ExtractBigData(hashtable); |
---|
| 3313 | + |
---|
| 3314 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3315 | + tab.graphs[tab.undoindex++] = Compress(copy); |
---|
| 3316 | + |
---|
| 3317 | + copy.RestoreBigData(hashtable); |
---|
| 3318 | + |
---|
| 3319 | + CameraPane.SWITCH = temp; |
---|
| 3320 | + |
---|
| 3321 | + //assert(hashtable.isEmpty()); |
---|
| 3322 | + |
---|
| 3323 | + for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3324 | + { |
---|
| 3325 | + tab.graphs[i] = null; |
---|
| 3326 | + } |
---|
| 3327 | + |
---|
| 3328 | + // test save |
---|
| 3329 | + if (false) |
---|
| 3330 | + { |
---|
| 3331 | + try |
---|
| 3332 | + { |
---|
| 3333 | + FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3334 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3335 | + |
---|
| 3336 | + p.writeObject(copy); |
---|
| 3337 | + |
---|
| 3338 | + p.flush(); |
---|
| 3339 | + |
---|
| 3340 | + ostream.close(); |
---|
| 3341 | + } catch (Exception e) |
---|
| 3342 | + { |
---|
| 3343 | + e.printStackTrace(); |
---|
| 3344 | + } |
---|
| 3345 | + } |
---|
| 3346 | + } |
---|
| 3347 | + |
---|
| 3348 | + void CopyChanged(Object3D obj) |
---|
| 3349 | + { |
---|
| 3350 | + boolean temp = CameraPane.SWITCH; |
---|
| 3351 | + CameraPane.SWITCH = false; |
---|
| 3352 | + |
---|
| 3353 | + copy.ExtractBigData(hashtable); |
---|
| 3354 | + |
---|
| 3355 | + copy.clear(); |
---|
| 3356 | + |
---|
| 3357 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3358 | + { |
---|
| 3359 | + copy.add(obj.get(i)); |
---|
| 3360 | + } |
---|
| 3361 | + |
---|
| 3362 | + copy.RestoreBigData(hashtable); |
---|
| 3363 | + |
---|
| 3364 | + CameraPane.SWITCH = temp; |
---|
| 3365 | + |
---|
| 3366 | + //assert(hashtable.isEmpty()); |
---|
| 3367 | + |
---|
| 3368 | + copy.Touch(); |
---|
| 3369 | + |
---|
| 3370 | + ResetModel(); |
---|
| 3371 | + copy.HardTouch(); // recompile? |
---|
| 3372 | + |
---|
| 3373 | + cRadio ab; |
---|
| 3374 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3375 | + { |
---|
| 3376 | + ab = (cRadio)e.nextElement(); |
---|
| 3377 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3378 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3379 | + if (test != null) |
---|
| 3380 | + { |
---|
| 3381 | + test.editWindow = ab.object.editWindow; |
---|
| 3382 | + ab.object = test; |
---|
| 3383 | + } |
---|
| 3384 | + } |
---|
| 3385 | + |
---|
| 3386 | + refreshContents(); |
---|
| 3387 | + } |
---|
| 3388 | + |
---|
| 3389 | + public void Undo() |
---|
| 3390 | + { |
---|
| 3391 | + cRadio tab = GetCurrentTab(); |
---|
| 3392 | + |
---|
| 3393 | + if (tab.undoindex == 0) |
---|
| 3394 | + { |
---|
| 3395 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3396 | + return; |
---|
| 3397 | + } |
---|
| 3398 | + |
---|
| 3399 | + if (tab.graphs[tab.undoindex] == null) |
---|
| 3400 | + { |
---|
| 3401 | + Save(); |
---|
| 3402 | + tab.undoindex -= 1; |
---|
| 3403 | + } |
---|
| 3404 | + |
---|
| 3405 | + tab.undoindex -= 1; |
---|
| 3406 | + |
---|
| 3407 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3408 | + } |
---|
| 3409 | + |
---|
| 3410 | + public void Redo() |
---|
| 3411 | + { |
---|
| 3412 | + cRadio tab = GetCurrentTab(); |
---|
| 3413 | + |
---|
| 3414 | + if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3415 | + { |
---|
| 3416 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3417 | + return; |
---|
| 3418 | + } |
---|
| 3419 | + |
---|
| 3420 | + tab.undoindex += 1; |
---|
| 3421 | + |
---|
| 3422 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3423 | + } |
---|
| 3424 | + |
---|
| 3425 | + void ImportGFD() |
---|
| 3426 | + { |
---|
| 3427 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 3428 | + browser.show(); |
---|
| 3429 | + String filename = browser.getFile(); |
---|
| 3430 | + if (filename != null && filename.length() > 0) |
---|
| 3431 | + { |
---|
| 3432 | + String fullname = browser.getDirectory() + filename; |
---|
| 3433 | + |
---|
| 3434 | + //Object3D readobj = |
---|
| 3435 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 3436 | + //makeSomething(readobj); |
---|
| 3437 | + } |
---|
| 3438 | + } |
---|
| 3439 | + |
---|
| 3440 | + void ImportVRMLX3D() |
---|
| 3441 | + { |
---|
| 3442 | + if (Grafreed.standAlone) |
---|
| 3443 | + { |
---|
| 3444 | + /**/ |
---|
| 3445 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 3446 | + browser.show(); |
---|
| 3447 | + String filename = browser.getFile(); |
---|
| 3448 | + if (filename != null && filename.length() > 0) |
---|
| 3449 | + { |
---|
| 3450 | + String fullname = browser.getDirectory() + filename; |
---|
| 3451 | + LoadVRMLX3D(fullname); |
---|
| 3452 | + } |
---|
| 3453 | + /**/ |
---|
| 3454 | + } |
---|
| 3455 | + } |
---|
| 3456 | + |
---|
3190 | 3457 | void ToggleAnimation() |
---|
3191 | 3458 | { |
---|
3192 | 3459 | if (!Globals.ANIMATION) |
---|
3193 | 3460 | { |
---|
3194 | 3461 | FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); |
---|
3195 | | - browser.show(); |
---|
| 3462 | + browser.setVisible(true); |
---|
3196 | 3463 | String filename = browser.getFile(); |
---|
3197 | 3464 | if (filename != null && filename.length() > 0) |
---|
3198 | 3465 | { |
---|
.. | .. |
---|
3202 | 3469 | |
---|
3203 | 3470 | Globals.ANIMATION ^= true; |
---|
3204 | 3471 | |
---|
3205 | | - GrafreeD.wav.cursor = 0; |
---|
3206 | | - GrafreeD.wav.loop = 0; |
---|
| 3472 | + Grafreed.wav.cursor = 0; |
---|
| 3473 | + Grafreed.wav.loop = 0; |
---|
3207 | 3474 | } |
---|
3208 | 3475 | } else |
---|
3209 | 3476 | { |
---|
.. | .. |
---|
3224 | 3491 | callee.refreshContents(); |
---|
3225 | 3492 | } else |
---|
3226 | 3493 | { |
---|
3227 | | - new Exception().printStackTrace(); |
---|
3228 | 3494 | System.exit(0); |
---|
3229 | 3495 | } |
---|
3230 | 3496 | } |
---|
.. | .. |
---|
3254 | 3520 | void CreateMaterial() |
---|
3255 | 3521 | { |
---|
3256 | 3522 | //copy.ClearMaterial(); // PATCH |
---|
3257 | | - copy.CreateMaterialS(multiplyToggle.isSelected()); |
---|
| 3523 | + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); |
---|
3258 | 3524 | if (copy.selection.size() > 0) |
---|
3259 | 3525 | //SetMaterial(copy); |
---|
3260 | 3526 | { |
---|
.. | .. |
---|
3313 | 3579 | { |
---|
3314 | 3580 | copy.ResetBlockLoop(); // temporary problem |
---|
3315 | 3581 | |
---|
3316 | | - boolean random = CameraPane.RANDOM; |
---|
3317 | | - CameraPane.RANDOM = false; // parse everything |
---|
| 3582 | + boolean random = CameraPane.SWITCH; |
---|
| 3583 | + CameraPane.SWITCH = false; // parse everything |
---|
3318 | 3584 | copy.ResetDisplayList(); |
---|
3319 | 3585 | copy.HardTouch(); |
---|
3320 | | - CameraPane.RANDOM = random; |
---|
| 3586 | + CameraPane.SWITCH = random; |
---|
3321 | 3587 | } |
---|
3322 | 3588 | |
---|
3323 | 3589 | // public void applySelf() |
---|
.. | .. |
---|
3391 | 3657 | { |
---|
3392 | 3658 | //System.out.println("Propagate = " + propagate); |
---|
3393 | 3659 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 3660 | + |
---|
| 3661 | + if (copy.material != null) |
---|
| 3662 | + { |
---|
| 3663 | + cMaterial mat = copy.material; |
---|
| 3664 | + |
---|
| 3665 | + colorField.SetToolTipValue((mat.color)); |
---|
| 3666 | + modulationField.SetToolTipValue((mat.modulation)); |
---|
| 3667 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 3668 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 3669 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 3670 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 3671 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 3672 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 3673 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 3674 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 3675 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 3676 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 3677 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 3678 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 3679 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 3680 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 3681 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 3682 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 3683 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 3684 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 3685 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 3686 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 3687 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 3688 | + } |
---|
| 3689 | + |
---|
3394 | 3690 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3395 | 3691 | { |
---|
3396 | 3692 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3506 | 3802 | } |
---|
3507 | 3803 | |
---|
3508 | 3804 | if (normalpushField != null) |
---|
3509 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 3805 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3510 | 3806 | } |
---|
3511 | 3807 | |
---|
3512 | 3808 | void SnapObject() |
---|
.. | .. |
---|
3770 | 4066 | |
---|
3771 | 4067 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3772 | 4068 | { |
---|
| 4069 | + Save(); |
---|
3773 | 4070 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3774 | 4071 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3775 | 4072 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3973 | 4270 | } |
---|
3974 | 4271 | } |
---|
3975 | 4272 | } |
---|
| 4273 | + |
---|
3976 | 4274 | LoadGFDThread loadGFDThread; |
---|
3977 | 4275 | |
---|
3978 | 4276 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
3993 | 4291 | try |
---|
3994 | 4292 | { |
---|
3995 | 4293 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
3996 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4294 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4295 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
3997 | 4296 | |
---|
3998 | 4297 | readobj = (Object3D) p.readObject(); |
---|
3999 | 4298 | istream.close(); |
---|
.. | .. |
---|
4001 | 4300 | readobj.ResetDisplayList(); |
---|
4002 | 4301 | } catch (Exception e) |
---|
4003 | 4302 | { |
---|
4004 | | - e.printStackTrace(); |
---|
| 4303 | + //e.printStackTrace(); |
---|
| 4304 | + try |
---|
| 4305 | + { |
---|
| 4306 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4307 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4308 | + |
---|
| 4309 | + readobj = (Object3D) p.readObject(); |
---|
| 4310 | + istream.close(); |
---|
| 4311 | + |
---|
| 4312 | + readobj.ResetDisplayList(); |
---|
| 4313 | + } catch (Exception e2) |
---|
| 4314 | + { |
---|
| 4315 | + e2.printStackTrace(); |
---|
| 4316 | + } |
---|
4005 | 4317 | } |
---|
4006 | 4318 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4007 | 4319 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4056 | 4368 | |
---|
4057 | 4369 | if (readobj != null) |
---|
4058 | 4370 | { |
---|
| 4371 | + Save(); |
---|
4059 | 4372 | try |
---|
4060 | 4373 | { |
---|
4061 | 4374 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4118 | 4431 | |
---|
4119 | 4432 | void load() // throws ClassNotFoundException |
---|
4120 | 4433 | { |
---|
4121 | | - if (GrafreeD.standAlone) |
---|
| 4434 | + if (Grafreed.standAlone) |
---|
4122 | 4435 | { |
---|
4123 | 4436 | FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
4124 | 4437 | browser.show(); |
---|
.. | .. |
---|
4205 | 4518 | try |
---|
4206 | 4519 | { |
---|
4207 | 4520 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4208 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4521 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4522 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4209 | 4523 | |
---|
4210 | 4524 | p.writeObject(copy); |
---|
4211 | 4525 | p.flush(); |
---|
4212 | 4526 | |
---|
| 4527 | + zstream.close(); |
---|
4213 | 4528 | ostream.close(); |
---|
4214 | 4529 | |
---|
4215 | 4530 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4219 | 4534 | { |
---|
4220 | 4535 | } |
---|
4221 | 4536 | } |
---|
| 4537 | + |
---|
4222 | 4538 | String lastname; |
---|
4223 | 4539 | |
---|
4224 | 4540 | void saveAs() |
---|
4225 | 4541 | { |
---|
4226 | | - if (GrafreeD.standAlone) |
---|
| 4542 | + if (Grafreed.standAlone) |
---|
4227 | 4543 | { |
---|
4228 | 4544 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4229 | 4545 | browser.setVisible(true); |
---|
.. | .. |
---|
4328 | 4644 | try |
---|
4329 | 4645 | { |
---|
4330 | 4646 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4331 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4332 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 4647 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4648 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4333 | 4649 | |
---|
4334 | 4650 | Object3D objectparent = obj.parent; |
---|
4335 | 4651 | obj.parent = null; |
---|
4336 | 4652 | |
---|
4337 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 4653 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4338 | 4654 | |
---|
4339 | 4655 | obj.parent = objectparent; |
---|
4340 | 4656 | |
---|
.. | .. |
---|
4346 | 4662 | p.writeObject(object); |
---|
4347 | 4663 | p.flush(); |
---|
4348 | 4664 | |
---|
| 4665 | + zstream.close(); |
---|
4349 | 4666 | ostream.close(); |
---|
4350 | | - // zstream.close(); |
---|
4351 | 4667 | |
---|
4352 | 4668 | // group.selection.get(0).parent = parent; |
---|
4353 | 4669 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4368 | 4684 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4369 | 4685 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4370 | 4686 | copy.generatePOV(buffer); |
---|
4371 | | - if (GrafreeD.standAlone) |
---|
| 4687 | + if (Grafreed.standAlone) |
---|
4372 | 4688 | { |
---|
4373 | 4689 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4374 | 4690 | browser.show(); |
---|
.. | .. |
---|
4394 | 4710 | Object3D client; |
---|
4395 | 4711 | Object3D copy; |
---|
4396 | 4712 | MenuBar menuBar; |
---|
4397 | | - Menu windowMenu; |
---|
| 4713 | + Menu fileMenu; |
---|
| 4714 | + MenuItem newItem; |
---|
4398 | 4715 | MenuItem loadItem; |
---|
4399 | 4716 | MenuItem saveItem; |
---|
4400 | 4717 | MenuItem saveAsItem; |
---|
.. | .. |
---|
4402 | 4719 | MenuItem reexportItem; |
---|
4403 | 4720 | MenuItem povItem; |
---|
4404 | 4721 | MenuItem closeItem; |
---|
4405 | | - Menu cameraMenu; |
---|
| 4722 | + |
---|
4406 | 4723 | CheckboxMenuItem zBufferItem; |
---|
4407 | 4724 | //MenuItem normalLensItem; |
---|
4408 | | - MenuItem editCameraItem; |
---|
4409 | | - MenuItem revertCameraItem; |
---|
4410 | 4725 | MenuItem stepItem; |
---|
4411 | 4726 | CheckboxMenuItem toggleLiveItem; |
---|
4412 | 4727 | CheckboxMenuItem toggleFullScreenItem; |
---|
.. | .. |
---|
4417 | 4732 | CheckboxMenuItem toggleFootContactItem; |
---|
4418 | 4733 | CheckboxMenuItem toggleDLItem; |
---|
4419 | 4734 | CheckboxMenuItem toggleTextureItem; |
---|
4420 | | - CheckboxMenuItem toggleRandomItem; |
---|
| 4735 | + CheckboxMenuItem toggleSwitchItem; |
---|
4421 | 4736 | CheckboxMenuItem toggleRootItem; |
---|
4422 | 4737 | CheckboxMenuItem animationItem; |
---|
4423 | 4738 | CheckboxMenuItem toggleHandleItem; |
---|
.. | .. |
---|
4425 | 4740 | JSplitPane mainPanel; |
---|
4426 | 4741 | JScrollPane scrollpane; |
---|
4427 | 4742 | JPanel toolbarPanel; |
---|
4428 | | - JPanel treePanel; |
---|
| 4743 | + cGridBag treePanel; |
---|
4429 | 4744 | JPanel radioPanel; |
---|
4430 | 4745 | ButtonGroup buttonGroup; |
---|
4431 | 4746 | cGridBag ctrlPanel; |
---|
.. | .. |
---|
4554 | 4869 | //ObjectUI parent; |
---|
4555 | 4870 | |
---|
4556 | 4871 | cNumberSlider normalpushField; |
---|
| 4872 | + |
---|
| 4873 | + private MenuItem importGFDItem; |
---|
| 4874 | + private MenuItem importVRMLX3DItem; |
---|
| 4875 | + private MenuItem import3DSItem; |
---|
| 4876 | + private MenuItem importOBJItem; |
---|
4557 | 4877 | } |
---|