.. | .. |
---|
36 | 36 | GroupEditor callee; |
---|
37 | 37 | JFrame frame; |
---|
38 | 38 | |
---|
| 39 | + static ObjEditor theFrame; |
---|
| 40 | + |
---|
39 | 41 | // SCRIPT |
---|
40 | 42 | |
---|
41 | 43 | transient JFrame textpanel = null; |
---|
.. | .. |
---|
143 | 145 | //nameField.removeActionListener(this); |
---|
144 | 146 | // objEditor.ctrlPanel.remove(nameField); |
---|
145 | 147 | |
---|
| 148 | + objEditor.ctrlPanel.remove(namePanel); |
---|
| 149 | + |
---|
146 | 150 | if (!GroupEditor.allparams) |
---|
147 | 151 | return; |
---|
148 | 152 | |
---|
.. | .. |
---|
165 | 169 | // objEditor.ctrlPanel.remove(fasterButton); |
---|
166 | 170 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
167 | 171 | |
---|
168 | | - objEditor.ctrlPanel.remove(namePanel); |
---|
169 | 172 | objEditor.ctrlPanel.remove(setupPanel); |
---|
| 173 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
170 | 174 | objEditor.ctrlPanel.remove(commandsPanel); |
---|
171 | 175 | objEditor.ctrlPanel.remove(pushPanel); |
---|
172 | 176 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
.. | .. |
---|
242 | 246 | //localCopy.parent = null; |
---|
243 | 247 | |
---|
244 | 248 | frame = new JFrame(); |
---|
| 249 | + frame.setUndecorated(true); |
---|
245 | 250 | objEditor = this; |
---|
246 | 251 | this.callee = callee; |
---|
247 | 252 | |
---|
.. | .. |
---|
275 | 280 | void SetupMenu() |
---|
276 | 281 | { |
---|
277 | 282 | 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...")); |
---|
| 283 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 284 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 285 | + fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 286 | + |
---|
| 287 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 288 | + Menu menu = new Menu("Import"); |
---|
| 289 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 290 | + importOBJItem.addActionListener(this); |
---|
| 291 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 292 | + import3DSItem.addActionListener(this); |
---|
| 293 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 294 | + importVRMLX3DItem.addActionListener(this); |
---|
| 295 | + menu.add("-"); |
---|
| 296 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 297 | + importGFDItem.addActionListener(this); |
---|
| 298 | + fileMenu.add(menu); |
---|
| 299 | + fileMenu.add("-"); |
---|
| 300 | + |
---|
| 301 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 302 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
283 | 303 | //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("-"); |
---|
| 304 | + fileMenu.add("-"); |
---|
| 305 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 306 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 307 | + fileMenu.add("-"); |
---|
288 | 308 | if (client.parent != null) |
---|
289 | 309 | { |
---|
290 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 310 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
291 | 311 | } else |
---|
292 | 312 | { |
---|
293 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 313 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
294 | 314 | } |
---|
295 | 315 | |
---|
| 316 | + newItem.addActionListener(this); |
---|
296 | 317 | loadItem.addActionListener(this); |
---|
297 | 318 | saveItem.addActionListener(this); |
---|
298 | 319 | saveAsItem.addActionListener(this); |
---|
.. | .. |
---|
301 | 322 | //povItem.addActionListener(this); |
---|
302 | 323 | closeItem.addActionListener(this); |
---|
303 | 324 | |
---|
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 | 325 | objectPanel = new JTabbedPane(); |
---|
360 | 326 | toolbarPanel = new JPanel(); |
---|
361 | 327 | toolbarPanel.setName("Toolbar"); |
---|
362 | | - treePanel = new JPanel(); |
---|
| 328 | + treePanel = new cGridBag(); |
---|
363 | 329 | treePanel.setName("Tree"); |
---|
364 | 330 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
365 | 331 | ctrlPanel.setName("Edit"); |
---|
.. | .. |
---|
367 | 333 | materialPanel.setName("Material"); |
---|
368 | 334 | /*JTextPane*/ |
---|
369 | 335 | infoarea = createTextPane(); |
---|
| 336 | + doc = infoarea.getStyledDocument(); |
---|
| 337 | + |
---|
370 | 338 | infoarea.setEditable(true); |
---|
371 | 339 | SetText(); |
---|
372 | 340 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
373 | 341 | // infoarea.setOpaque(false); |
---|
374 | 342 | // //infoarea.setForeground(textcolor); |
---|
375 | | - infoarea.setLineWrap(true); |
---|
376 | | - infoarea.setWrapStyleWord(true); |
---|
| 343 | +// TEXTAREA infoarea.setLineWrap(true); |
---|
| 344 | +// TEXTAREA infoarea.setWrapStyleWord(true); |
---|
377 | 345 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
378 | 346 | infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
379 | 347 | infoPanel.setName("Info"); |
---|
.. | .. |
---|
384 | 352 | mainPanel.setName("Main"); |
---|
385 | 353 | mainPanel.setContinuousLayout(true); |
---|
386 | 354 | mainPanel.setOneTouchExpandable(true); |
---|
387 | | - mainPanel.setDividerLocation(1.0); |
---|
388 | 355 | mainPanel.setDividerSize(9); |
---|
389 | | - mainPanel.setResizeWeight(0); |
---|
| 356 | + mainPanel.setDividerLocation(0.5); //1.0); |
---|
| 357 | + mainPanel.setResizeWeight(0.5); |
---|
390 | 358 | |
---|
391 | 359 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
392 | 360 | //mainPanel.setLayout(new GridBagLayout()); |
---|
393 | 361 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
394 | | - treePanel.setLayout(new GridBagLayout()); |
---|
| 362 | +// treePanel.setLayout(new GridBagLayout()); |
---|
395 | 363 | //ctrlPanel.setLayout(new GridBagLayout()); |
---|
396 | 364 | //materialPanel.setLayout(new GridBagLayout()); |
---|
397 | 365 | |
---|
.. | .. |
---|
432 | 400 | static String newline = "\n"; |
---|
433 | 401 | protected static final String buttonString = "JButton"; |
---|
434 | 402 | StyledDocument doc; |
---|
435 | | - JTextArea infoarea; |
---|
| 403 | + JTextPane infoarea; |
---|
436 | 404 | |
---|
437 | 405 | void ClearInfo() |
---|
438 | 406 | { |
---|
.. | .. |
---|
455 | 423 | e.printStackTrace(); |
---|
456 | 424 | } |
---|
457 | 425 | |
---|
458 | | - String selection = infoarea.getText(); |
---|
459 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
460 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
461 | | - Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
| 426 | +// String selection = infoarea.getText(); |
---|
| 427 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 428 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 429 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
462 | 430 | //clipboard.setContents(data, data); |
---|
463 | 431 | } |
---|
464 | 432 | |
---|
.. | .. |
---|
481 | 449 | //SendInfo("Name:", "bold"); |
---|
482 | 450 | if (sel.GetTextures() != null || debug) |
---|
483 | 451 | { |
---|
484 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 452 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
485 | 453 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
486 | 454 | if (sel.Size() > 0) |
---|
487 | 455 | { |
---|
488 | 456 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
489 | 457 | } |
---|
490 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 458 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
491 | 459 | if (debug) |
---|
492 | 460 | { |
---|
493 | 461 | try |
---|
.. | .. |
---|
499 | 467 | } |
---|
500 | 468 | |
---|
501 | 469 | if (full) |
---|
502 | | - si.SendInfo(" BBox: " + minima + " - " + maxima, "regular"); |
---|
| 470 | + { |
---|
| 471 | + si.SendInfo(" BBox min: " + minima, "regular"); |
---|
| 472 | + si.SendInfo(" BBox max: " + maxima, "regular"); |
---|
| 473 | + } |
---|
503 | 474 | |
---|
504 | 475 | if (sel.bRep != null) |
---|
505 | 476 | { |
---|
.. | .. |
---|
526 | 497 | } |
---|
527 | 498 | if (sel.support != null) |
---|
528 | 499 | { |
---|
529 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 500 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
530 | 501 | } |
---|
531 | 502 | if (sel.scriptnode != null) |
---|
532 | 503 | { |
---|
.. | .. |
---|
597 | 568 | { |
---|
598 | 569 | CameraPane.pointflow = (PointFlow) sel; |
---|
599 | 570 | } |
---|
| 571 | + |
---|
| 572 | + si.SendInfo("_____________________", "regular"); |
---|
| 573 | + si.SendInfo("", "regular"); |
---|
600 | 574 | } |
---|
601 | 575 | } |
---|
602 | 576 | |
---|
.. | .. |
---|
612 | 586 | } |
---|
613 | 587 | } |
---|
614 | 588 | |
---|
| 589 | +static GraphicsDevice device = GraphicsEnvironment |
---|
| 590 | + .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 591 | + |
---|
| 592 | + Rectangle keeprect; |
---|
| 593 | + cRadio radio; |
---|
| 594 | + |
---|
| 595 | +cButton keepButton; |
---|
| 596 | + cButton twoButton; // Full 3D |
---|
| 597 | + cButton sixButton; |
---|
| 598 | + cButton threeButton; |
---|
| 599 | + cButton sevenButton; |
---|
| 600 | + cButton fourButton; // full panel |
---|
| 601 | + cButton oneButton; // full XYZ |
---|
| 602 | + //cButton currentLayout; |
---|
| 603 | + |
---|
| 604 | + boolean maximized; |
---|
| 605 | + |
---|
| 606 | + void Minimize() |
---|
| 607 | + { |
---|
| 608 | + frame.setState(Frame.ICONIFIED); |
---|
| 609 | + } |
---|
| 610 | + |
---|
| 611 | + void Maximize() |
---|
| 612 | + { |
---|
| 613 | + if (maximized) |
---|
| 614 | + { |
---|
| 615 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 616 | + } |
---|
| 617 | + else |
---|
| 618 | + { |
---|
| 619 | + keeprect = frame.getBounds(); |
---|
| 620 | + Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 621 | + Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 622 | + frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 623 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 624 | + } |
---|
| 625 | + |
---|
| 626 | + maximized ^= true; |
---|
| 627 | + } |
---|
| 628 | + |
---|
615 | 629 | void ToggleFullScreen() |
---|
616 | 630 | { |
---|
617 | 631 | if (CameraPane.FULLSCREEN) |
---|
618 | 632 | { |
---|
619 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
620 | | - framePanel.add(bigThree); |
---|
621 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 633 | + device.setFullScreenWindow(null); |
---|
| 634 | + //frame.setVisible(false); |
---|
| 635 | +// frame.removeNotify(); |
---|
| 636 | +// frame.setUndecorated(false); |
---|
| 637 | +// frame.addNotify(); |
---|
| 638 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 639 | + |
---|
| 640 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 641 | +// X framePanel.add(bigThree); |
---|
| 642 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 643 | + framePanel.setDividerLocation(1); |
---|
| 644 | + |
---|
| 645 | + //frame.setVisible(true); |
---|
| 646 | + radio.layout = keepButton; |
---|
| 647 | + //theFrame = null; |
---|
| 648 | + keepButton = null; |
---|
| 649 | + radio.layout.doClick(); |
---|
| 650 | + |
---|
622 | 651 | } else |
---|
623 | 652 | { |
---|
624 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
625 | | - framePanel.remove(bigThree); |
---|
626 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 653 | + keepButton = radio.layout; |
---|
| 654 | + //keeprect = frame.getBounds(); |
---|
| 655 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 656 | +// frame.getToolkit().getScreenSize().height); |
---|
| 657 | + //frame.setVisible(false); |
---|
| 658 | + device.setFullScreenWindow(frame); |
---|
| 659 | +// frame.removeNotify(); |
---|
| 660 | +// frame.setUndecorated(true); |
---|
| 661 | +// frame.addNotify(); |
---|
| 662 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 663 | +// X framePanel.remove(bigThree); |
---|
| 664 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 665 | + framePanel.setDividerLocation(0); |
---|
| 666 | + |
---|
| 667 | + radio.layout = twoButton; |
---|
| 668 | + radio.layout.doClick(); |
---|
| 669 | + //frame.setVisible(true); |
---|
627 | 670 | } |
---|
| 671 | + |
---|
628 | 672 | cameraView.ToggleFullScreen(); |
---|
629 | 673 | } |
---|
630 | 674 | |
---|
631 | | - private JTextArea createTextPane() |
---|
| 675 | + private JTextPane createTextPane() |
---|
632 | 676 | { |
---|
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 | | - }; |
---|
| 677 | +// TEXTAREA String[] initString = |
---|
| 678 | +// { |
---|
| 679 | +// "This is an editable JTextPane, ", //regular |
---|
| 680 | +// "another ", //italic |
---|
| 681 | +// "styled ", //bold |
---|
| 682 | +// "text ", //small |
---|
| 683 | +// "component, ", //large |
---|
| 684 | +// "which supports embedded components..." + newline,//regular |
---|
| 685 | +// " " + newline, //button |
---|
| 686 | +// "...and embedded icons..." + newline, //regular |
---|
| 687 | +// " ", //icon |
---|
| 688 | +// newline + "JTextPane is a subclass of JEditorPane that " |
---|
| 689 | +// + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
| 690 | +// + "cover methods for interacting with those objects." |
---|
| 691 | +// }; |
---|
| 692 | +// |
---|
| 693 | +// String[] initStyles = |
---|
| 694 | +// { |
---|
| 695 | +// "regular", "italic", "bold", "small", "large", |
---|
| 696 | +// "regular", "button", "regular", "icon", |
---|
| 697 | +// "regular" |
---|
| 698 | +// }; |
---|
| 699 | +// |
---|
| 700 | +// JTextPane textPane = new JTextPane(); |
---|
| 701 | +// textPane.setEditable(true); |
---|
| 702 | +// /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
| 703 | +// addStylesToDocument(doc); |
---|
| 704 | +// |
---|
| 705 | +// try |
---|
| 706 | +// { |
---|
| 707 | +// for (int j = 0; j < 2; j++) |
---|
| 708 | +// { |
---|
| 709 | +// for (int i = 0; i < initString.length; i++) |
---|
| 710 | +// { |
---|
| 711 | +// doc.insertString(doc.getLength(), initString[i], |
---|
| 712 | +// doc.getStyle(initStyles[i])); |
---|
| 713 | +// } |
---|
| 714 | +// } |
---|
| 715 | +// } catch (BadLocationException ble) |
---|
| 716 | +// { |
---|
| 717 | +// System.err.println("Couldn't insert initial text into text pane."); |
---|
| 718 | +// } |
---|
648 | 719 | |
---|
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; |
---|
| 720 | + return new JTextPane(); // textPane; |
---|
677 | 721 | } |
---|
678 | 722 | |
---|
679 | 723 | protected void addStylesToDocument(StyledDocument doc) |
---|
.. | .. |
---|
726 | 770 | protected static ImageIcon createImageIcon(String path, |
---|
727 | 771 | String description) |
---|
728 | 772 | { |
---|
729 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 773 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
730 | 774 | if (imgURL != null) |
---|
731 | 775 | { |
---|
732 | 776 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
758 | 802 | // NumberSlider vDivsField; |
---|
759 | 803 | // JCheckBox endcaps; |
---|
760 | 804 | JCheckBox liveCB; |
---|
| 805 | + JCheckBox selectCB; |
---|
761 | 806 | JCheckBox hideCB; |
---|
762 | 807 | JCheckBox link2masterCB; |
---|
763 | 808 | JCheckBox markCB; |
---|
.. | .. |
---|
776 | 821 | |
---|
777 | 822 | cGridBag namePanel; |
---|
778 | 823 | cGridBag setupPanel; |
---|
| 824 | + cGridBag setupPanel2; |
---|
779 | 825 | cGridBag commandsPanel; |
---|
780 | 826 | cGridBag pushPanel; |
---|
781 | 827 | cGridBag fillPanel; |
---|
.. | .. |
---|
943 | 989 | |
---|
944 | 990 | void SetupUI2(ObjEditor oe) |
---|
945 | 991 | { |
---|
946 | | -// oe.aConstraints.weightx = 0; |
---|
947 | | -// oe.aConstraints.weighty = 0; |
---|
948 | | -// oe.aConstraints.gridx = 0; |
---|
949 | | -// oe.aConstraints.gridy = 0; |
---|
950 | 992 | //SetupName(oe); |
---|
951 | 993 | |
---|
952 | 994 | namePanel = new cGridBag(); |
---|
.. | .. |
---|
963 | 1005 | setupPanel = new cGridBag().setVertical(false); |
---|
964 | 1006 | |
---|
965 | 1007 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
966 | | - link2masterCB = AddCheckBox(setupPanel, "Supp", copy.link2master); |
---|
967 | | - hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 1008 | + liveCB.setToolTipText("Animate object"); |
---|
| 1009 | + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1010 | + selectCB.setToolTipText("Make object selectable"); |
---|
968 | 1011 | // Return(); |
---|
| 1012 | + hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 1013 | + hideCB.setToolTipText("Hide object"); |
---|
969 | 1014 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
970 | | - rewindCB = AddCheckBox(setupPanel, "Rew", copy.rewind); |
---|
971 | | - randomCB = AddCheckBox(setupPanel, "Rand", copy.random); |
---|
| 1015 | + markCB.setToolTipText("Set the animation target transform"); |
---|
| 1016 | + |
---|
| 1017 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1018 | + |
---|
| 1019 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
| 1020 | + rewindCB.setToolTipText("Rewind animation"); |
---|
| 1021 | + |
---|
| 1022 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 1023 | + randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
972 | 1024 | |
---|
| 1025 | + if (Globals.ADVANCED) |
---|
| 1026 | + { |
---|
| 1027 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
| 1028 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1029 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
| 1030 | + speedupCB.setToolTipText("Option motion capture"); |
---|
| 1031 | + } |
---|
| 1032 | + |
---|
973 | 1033 | oe.ctrlPanel.add(setupPanel); |
---|
| 1034 | + oe.ctrlPanel.Return(); |
---|
| 1035 | + oe.ctrlPanel.add(setupPanel2); |
---|
974 | 1036 | oe.ctrlPanel.Return(); |
---|
975 | 1037 | |
---|
976 | 1038 | commandsPanel = new cGridBag().setVertical(false); |
---|
977 | 1039 | |
---|
978 | 1040 | resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1041 | + resetButton.setToolTipText("Jump to frame zero"); |
---|
979 | 1042 | stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1043 | + stepButton.setToolTipText("Step one frame"); |
---|
980 | 1044 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
981 | 1045 | // stepAllButton = AddButton(oe, "Step All"); |
---|
982 | | - speedupCB = AddCheckBox(commandsPanel, "Speed", copy.speedup); |
---|
983 | 1046 | // Return(); |
---|
984 | 1047 | slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1048 | + slowerButton.setToolTipText("Decrease animation speed"); |
---|
985 | 1049 | fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1050 | + fasterButton.setToolTipText("Increase animation speed"); |
---|
986 | 1051 | remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1052 | + remarkButton.setToolTipText("Set the current transform as the target"); |
---|
987 | 1053 | |
---|
988 | 1054 | oe.ctrlPanel.add(commandsPanel); |
---|
989 | 1055 | oe.ctrlPanel.Return(); |
---|
990 | 1056 | |
---|
991 | | - pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1); |
---|
| 1057 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
992 | 1058 | normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
993 | 1059 | //Return(); |
---|
994 | 1060 | |
---|
.. | .. |
---|
1191 | 1257 | //worldPanel.setName("World"); |
---|
1192 | 1258 | centralPanel = new cGridBag(); |
---|
1193 | 1259 | centralPanel.preferredWidth = 20; |
---|
1194 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1195 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1260 | + |
---|
| 1261 | + if (Globals.ADVANCED) |
---|
| 1262 | + { |
---|
| 1263 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1264 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1196 | 1265 | |
---|
1197 | 1266 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1198 | 1267 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1201 | 1270 | // cameraPanel.setDividerSize(9); |
---|
1202 | 1271 | cameraPanel.setResizeWeight(1.0); |
---|
1203 | 1272 | |
---|
| 1273 | + } |
---|
| 1274 | + |
---|
1204 | 1275 | centralPanel.add(cameraView); |
---|
| 1276 | + centralPanel.setFocusable(true); |
---|
1205 | 1277 | //frame.setJMenuBar(timelineMenubar); |
---|
1206 | 1278 | //centralPanel.add(timelinePanel); |
---|
1207 | 1279 | |
---|
.. | .. |
---|
1290 | 1362 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1291 | 1363 | |
---|
1292 | 1364 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1293 | | - scenePanel.preferredWidth = 7; |
---|
| 1365 | + scenePanel.preferredWidth = 6; |
---|
1294 | 1366 | |
---|
1295 | 1367 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1296 | 1368 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1396 | 1468 | |
---|
1397 | 1469 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1398 | 1470 | |
---|
1399 | | - frame.setSize(1024, 768); |
---|
1400 | | - frame.show(); |
---|
| 1471 | + frame.setSize(1280, 860); |
---|
| 1472 | + frame.setVisible(true); |
---|
1401 | 1473 | |
---|
| 1474 | + cameraView.requestFocusInWindow(); |
---|
| 1475 | + |
---|
1402 | 1476 | gridPanel.setDividerLocation(1.0); |
---|
1403 | 1477 | |
---|
1404 | 1478 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
1436 | 1510 | |
---|
1437 | 1511 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1438 | 1512 | |
---|
1439 | | - editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints); |
---|
| 1513 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1514 | + createMaterialButton.setToolTipText("Create material"); |
---|
1440 | 1515 | |
---|
1441 | 1516 | /* |
---|
1442 | 1517 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1443 | 1518 | */ |
---|
1444 | 1519 | |
---|
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); |
---|
| 1520 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1521 | + clearMaterialButton.setToolTipText("Clear material"); |
---|
| 1522 | + |
---|
| 1523 | + if (Globals.ADVANCED) |
---|
| 1524 | + { |
---|
| 1525 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1526 | + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
| 1527 | + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 1528 | + } |
---|
1449 | 1529 | |
---|
| 1530 | + editBar.preferredHeight = 15; |
---|
| 1531 | + |
---|
1450 | 1532 | panel.add(editBar); |
---|
1451 | 1533 | |
---|
1452 | 1534 | /**/ |
---|
.. | .. |
---|
1712 | 1794 | opacityPowerField.addChangeListener(this); |
---|
1713 | 1795 | /**/ |
---|
1714 | 1796 | |
---|
1715 | | - resetSlidersButton.addActionListener(this); |
---|
1716 | 1797 | clearMaterialButton.addActionListener(this); |
---|
1717 | 1798 | createMaterialButton.addActionListener(this); |
---|
1718 | | - |
---|
1719 | | - propagateToggle.addItemListener(this); |
---|
1720 | | - multiplyToggle.addItemListener(this); |
---|
| 1799 | + |
---|
| 1800 | + if (Globals.ADVANCED) |
---|
| 1801 | + { |
---|
| 1802 | + resetSlidersButton.addActionListener(this); |
---|
| 1803 | + propagateToggle.addItemListener(this); |
---|
| 1804 | + multiplyToggle.addItemListener(this); |
---|
| 1805 | + } |
---|
1721 | 1806 | } |
---|
1722 | 1807 | |
---|
1723 | 1808 | void DropFile(java.io.File[] files, boolean textures) |
---|
.. | .. |
---|
1888 | 1973 | |
---|
1889 | 1974 | //? flashIt = false; |
---|
1890 | 1975 | CameraPane pane = (CameraPane) cameraView; |
---|
1891 | | - pane.clickStart(location.x, location.y, 0); |
---|
| 1976 | + pane.clickStart(location.x, location.y, 0, 0); |
---|
1892 | 1977 | pane.clickEnd(location.x, location.y, 0, true); |
---|
1893 | 1978 | |
---|
1894 | 1979 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
1937 | 2022 | e2.printStackTrace(); |
---|
1938 | 2023 | } |
---|
1939 | 2024 | } |
---|
| 2025 | + |
---|
1940 | 2026 | LoadJMEThread loadThread; |
---|
1941 | 2027 | |
---|
1942 | 2028 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
1994 | 2080 | //LoadFile0(filename, converter); |
---|
1995 | 2081 | } |
---|
1996 | 2082 | } |
---|
| 2083 | + |
---|
1997 | 2084 | LoadOBJThread loadObjThread; |
---|
1998 | 2085 | |
---|
1999 | 2086 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2072 | 2159 | |
---|
2073 | 2160 | void LoadObjFile(String fullname) |
---|
2074 | 2161 | { |
---|
2075 | | - /* |
---|
| 2162 | + System.out.println("Loading " + fullname); |
---|
| 2163 | + /**/ |
---|
2076 | 2164 | //lastFilename = fullname; |
---|
2077 | 2165 | if(loadObjThread == null) |
---|
2078 | 2166 | { |
---|
2079 | | - loadObjThread = new LoadOBJThread(); |
---|
2080 | | - loadObjThread.start(); |
---|
| 2167 | + loadObjThread = new LoadOBJThread(); |
---|
| 2168 | + loadObjThread.start(); |
---|
2081 | 2169 | } |
---|
2082 | 2170 | |
---|
2083 | 2171 | loadObjThread.add(fullname); |
---|
2084 | | - */ |
---|
| 2172 | + /**/ |
---|
2085 | 2173 | |
---|
2086 | | - System.out.println("Loading " + fullname); |
---|
2087 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2174 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2088 | 2175 | } |
---|
2089 | 2176 | |
---|
2090 | 2177 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2345 | 2432 | |
---|
2346 | 2433 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2347 | 2434 | { |
---|
2348 | | - if (GrafreeD.standAlone) |
---|
| 2435 | + if (Grafreed.standAlone) |
---|
2349 | 2436 | { |
---|
2350 | 2437 | /**/ |
---|
2351 | 2438 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2352 | | - browser.show(); |
---|
| 2439 | + browser.setVisible(true); |
---|
2353 | 2440 | String filename = browser.getFile(); |
---|
2354 | 2441 | if (filename != null && filename.length() > 0) |
---|
2355 | 2442 | { |
---|
.. | .. |
---|
2709 | 2796 | return; |
---|
2710 | 2797 | } |
---|
2711 | 2798 | |
---|
2712 | | - multiplyToggle.setSelected(mat.multiply); |
---|
| 2799 | + if (multiplyToggle != null) |
---|
| 2800 | + multiplyToggle.setSelected(mat.multiply); |
---|
2713 | 2801 | |
---|
2714 | 2802 | assert (object.projectedVertices != null); |
---|
2715 | 2803 | |
---|
.. | .. |
---|
2924 | 3012 | frame.validate(); |
---|
2925 | 3013 | |
---|
2926 | 3014 | return; |
---|
2927 | | - } else if (event.getSource() == toggleRandomItem) |
---|
| 3015 | + } else if (event.getSource() == toggleSwitchItem) |
---|
2928 | 3016 | { |
---|
2929 | | - cameraView.ToggleRandom(); |
---|
| 3017 | + cameraView.ToggleSwitch(); |
---|
2930 | 3018 | cameraView.repaint(); |
---|
2931 | 3019 | return; |
---|
2932 | 3020 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
2955 | 3043 | { |
---|
2956 | 3044 | copy.live ^= true; |
---|
2957 | 3045 | return; |
---|
| 3046 | + } else if (event.getSource() == selectCB) |
---|
| 3047 | + { |
---|
| 3048 | + copy.dontselect ^= true; |
---|
| 3049 | + return; |
---|
2958 | 3050 | } else if (event.getSource() == hideCB) |
---|
2959 | 3051 | { |
---|
2960 | 3052 | copy.hide ^= true; |
---|
.. | .. |
---|
2969 | 3061 | if (event.getSource() == randomCB) |
---|
2970 | 3062 | { |
---|
2971 | 3063 | copy.random ^= true; |
---|
| 3064 | + objEditor.refreshContents(); |
---|
2972 | 3065 | return; |
---|
2973 | 3066 | } |
---|
2974 | 3067 | if (event.getSource() == speedupCB) |
---|
.. | .. |
---|
2992 | 3085 | |
---|
2993 | 3086 | public void actionPerformed(ActionEvent event) |
---|
2994 | 3087 | { |
---|
| 3088 | + Object source = event.getSource(); |
---|
2995 | 3089 | // SCRIPT DIALOG |
---|
2996 | | - if (event.getSource() == okbutton) |
---|
| 3090 | + if (source == okbutton) |
---|
2997 | 3091 | { |
---|
2998 | 3092 | textpanel.setVisible(false); |
---|
2999 | 3093 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3005 | 3099 | textarea = null; |
---|
3006 | 3100 | textpanel = null; |
---|
3007 | 3101 | } |
---|
3008 | | - if (event.getSource() == cancelbutton) |
---|
| 3102 | + if (source == cancelbutton) |
---|
3009 | 3103 | { |
---|
3010 | 3104 | textpanel.setVisible(false); |
---|
3011 | 3105 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3017 | 3111 | //applySelf(); |
---|
3018 | 3112 | //client.refreshEditWindow(); |
---|
3019 | 3113 | //refreshContents(); |
---|
3020 | | - if (event.getSource() == nameField) |
---|
| 3114 | + if (source == nameField) |
---|
3021 | 3115 | { |
---|
3022 | 3116 | //System.out.println("ObjEditor " + event); |
---|
3023 | 3117 | applySelf0(true); |
---|
3024 | 3118 | //parent.applySelf(); |
---|
3025 | 3119 | objEditor.refreshContents(); |
---|
3026 | | - } else if (event.getSource() == resetButton) |
---|
| 3120 | + } else if (source == resetButton) |
---|
3027 | 3121 | { |
---|
3028 | 3122 | CameraPane.fullreset = true; |
---|
3029 | 3123 | copy.Reset(); // ResetMeshes(); |
---|
3030 | 3124 | copy.Touch(); |
---|
3031 | 3125 | objEditor.refreshContents(); |
---|
3032 | | - } else if (event.getSource() == stepItem) |
---|
| 3126 | + } else if (source == stepItem) |
---|
3033 | 3127 | { |
---|
3034 | 3128 | //cameraView.ONESTEP = true; |
---|
3035 | 3129 | Globals.ONESTEP = true; |
---|
3036 | 3130 | cameraView.repaint(); |
---|
3037 | 3131 | return; |
---|
3038 | | - } else if (event.getSource() == stepButton) |
---|
| 3132 | + } else if (source == stepButton) |
---|
3039 | 3133 | { |
---|
3040 | 3134 | copy.Step(); |
---|
3041 | 3135 | copy.Touch(); |
---|
3042 | 3136 | objEditor.refreshContents(); |
---|
3043 | | - } else if (event.getSource() == slowerButton) |
---|
| 3137 | + } else if (source == slowerButton) |
---|
3044 | 3138 | { |
---|
3045 | 3139 | copy.Slower(); |
---|
3046 | 3140 | copy.Touch(); |
---|
3047 | 3141 | objEditor.refreshContents(); |
---|
3048 | | - } else if (event.getSource() == fasterButton) |
---|
| 3142 | + } else if (source == fasterButton) |
---|
3049 | 3143 | { |
---|
3050 | 3144 | copy.Faster(); |
---|
3051 | 3145 | copy.Touch(); |
---|
3052 | 3146 | objEditor.refreshContents(); |
---|
3053 | | - } else if (event.getSource() == remarkButton) |
---|
| 3147 | + } else if (source == remarkButton) |
---|
3054 | 3148 | { |
---|
3055 | 3149 | copy.Remark(); |
---|
3056 | 3150 | copy.Touch(); |
---|
3057 | 3151 | objEditor.refreshContents(); |
---|
3058 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3152 | + } else if (source == stepAllButton) |
---|
3059 | 3153 | { |
---|
3060 | 3154 | copy.StepAll(); |
---|
3061 | 3155 | copy.Touch(); |
---|
3062 | 3156 | objEditor.refreshContents(); |
---|
3063 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3157 | + } else if (source == resetAllButton) |
---|
3064 | 3158 | { |
---|
3065 | 3159 | //CameraPane.fullreset = true; |
---|
3066 | 3160 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3093 | 3187 | // Close(); |
---|
3094 | 3188 | // } |
---|
3095 | 3189 | // else |
---|
3096 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3190 | + if (source == resetSlidersButton) |
---|
3097 | 3191 | { |
---|
3098 | 3192 | ResetSliders(); |
---|
3099 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3193 | + } else if (source == clearMaterialButton) |
---|
3100 | 3194 | { |
---|
3101 | 3195 | ClearMaterial(); |
---|
3102 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3196 | + } else if (source == createMaterialButton) |
---|
3103 | 3197 | { |
---|
3104 | 3198 | CreateMaterial(); |
---|
3105 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3199 | + } else if (source == clearPanelButton) |
---|
3106 | 3200 | { |
---|
3107 | 3201 | copy.ClearUI(); |
---|
3108 | 3202 | refreshContents(true); |
---|
3109 | | - } /* |
---|
3110 | | - } |
---|
3111 | | - |
---|
3112 | | - public boolean action(Event event, Object arg) |
---|
3113 | | - { |
---|
3114 | | - */ else if (event.getSource() == closeItem) |
---|
| 3203 | + } else if (source == importGFDItem) |
---|
| 3204 | + { |
---|
| 3205 | + ImportGFD(); |
---|
| 3206 | + } else |
---|
| 3207 | + if (source == importVRMLX3DItem) |
---|
| 3208 | + { |
---|
| 3209 | + ImportVRMLX3D(); |
---|
| 3210 | + } else |
---|
| 3211 | + if (source == import3DSItem) |
---|
| 3212 | + { |
---|
| 3213 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3214 | + } else |
---|
| 3215 | + if (source == importOBJItem) |
---|
| 3216 | + { |
---|
| 3217 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3218 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3219 | + browser.setVisible(true); |
---|
| 3220 | + String filename = browser.getFile(); |
---|
| 3221 | + if (filename != null && filename.length() > 0) |
---|
| 3222 | + { |
---|
| 3223 | + String fullname = browser.getDirectory() + filename; |
---|
| 3224 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3225 | + } |
---|
| 3226 | + } else |
---|
| 3227 | + if (source == closeItem) |
---|
3115 | 3228 | { |
---|
3116 | 3229 | Close(); |
---|
3117 | 3230 | //return true; |
---|
3118 | | - } else if (event.getSource() == loadItem) |
---|
| 3231 | + } else if (source == loadItem) |
---|
3119 | 3232 | { |
---|
3120 | 3233 | load(); |
---|
3121 | 3234 | //return true; |
---|
3122 | | - } else if (event.getSource() == saveItem) |
---|
| 3235 | + } else if (source == newItem) |
---|
| 3236 | + { |
---|
| 3237 | + New(); |
---|
| 3238 | + } else if (source == saveItem) |
---|
3123 | 3239 | { |
---|
3124 | 3240 | save(); |
---|
3125 | 3241 | //return true; |
---|
3126 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3242 | + } else if (source == saveAsItem) |
---|
3127 | 3243 | { |
---|
3128 | 3244 | saveAs(); |
---|
3129 | 3245 | //return true; |
---|
3130 | | - } else if (event.getSource() == reexportItem) |
---|
| 3246 | + } else if (source == reexportItem) |
---|
3131 | 3247 | { |
---|
3132 | 3248 | reexport(); |
---|
3133 | 3249 | //return true; |
---|
3134 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3250 | + } else if (source == exportAsItem) |
---|
3135 | 3251 | { |
---|
3136 | 3252 | export(); |
---|
3137 | 3253 | //return true; |
---|
3138 | | - } else if (event.getSource() == povItem) |
---|
| 3254 | + } else if (source == povItem) |
---|
3139 | 3255 | { |
---|
3140 | 3256 | generatePOV(); |
---|
3141 | 3257 | //return true; |
---|
3142 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3258 | + } else if (source == zBufferItem) |
---|
3143 | 3259 | { |
---|
3144 | 3260 | try |
---|
3145 | 3261 | { |
---|
.. | .. |
---|
3161 | 3277 | cameraView.repaint(); |
---|
3162 | 3278 | //return true; |
---|
3163 | 3279 | } |
---|
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) |
---|
| 3280 | + */ else // combos... |
---|
| 3281 | + if (source == texresMenu) |
---|
3179 | 3282 | { |
---|
3180 | 3283 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3181 | 3284 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3187 | 3290 | } |
---|
3188 | 3291 | } |
---|
3189 | 3292 | |
---|
| 3293 | + void New() |
---|
| 3294 | + { |
---|
| 3295 | + while (copy.Size() > 1) |
---|
| 3296 | + { |
---|
| 3297 | + copy.remove(1); |
---|
| 3298 | + } |
---|
| 3299 | + |
---|
| 3300 | + ResetModel(); |
---|
| 3301 | + objEditor.refreshContents(); |
---|
| 3302 | + } |
---|
| 3303 | + |
---|
| 3304 | + static public byte[] Compress(Object3D o) |
---|
| 3305 | + { |
---|
| 3306 | + try |
---|
| 3307 | + { |
---|
| 3308 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3309 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3310 | + ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3311 | + |
---|
| 3312 | + Object3D parent = o.parent; |
---|
| 3313 | + o.parent = null; |
---|
| 3314 | + |
---|
| 3315 | + out.writeObject(o); |
---|
| 3316 | + |
---|
| 3317 | + o.parent = parent; |
---|
| 3318 | + |
---|
| 3319 | + out.flush(); |
---|
| 3320 | + |
---|
| 3321 | + zstream.close(); |
---|
| 3322 | + out.close(); |
---|
| 3323 | + |
---|
| 3324 | + return baos.toByteArray(); |
---|
| 3325 | + } catch (Exception e) |
---|
| 3326 | + { |
---|
| 3327 | + System.err.println(e); |
---|
| 3328 | + return null; |
---|
| 3329 | + } |
---|
| 3330 | + } |
---|
| 3331 | + |
---|
| 3332 | + static public Object Uncompress(byte[] bytes) |
---|
| 3333 | + { |
---|
| 3334 | + System.out.println("#bytes = " + bytes.length); |
---|
| 3335 | + try |
---|
| 3336 | + { |
---|
| 3337 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3338 | + java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3339 | + ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3340 | + Object obj = in.readObject(); |
---|
| 3341 | + in.close(); |
---|
| 3342 | + |
---|
| 3343 | + return obj; |
---|
| 3344 | + } catch (Exception e) |
---|
| 3345 | + { |
---|
| 3346 | + System.err.println(e); |
---|
| 3347 | + return null; |
---|
| 3348 | + } |
---|
| 3349 | + } |
---|
| 3350 | + |
---|
| 3351 | + static public Object clone(Object o) |
---|
| 3352 | + { |
---|
| 3353 | + try |
---|
| 3354 | + { |
---|
| 3355 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3356 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3357 | + |
---|
| 3358 | + out.writeObject(o); |
---|
| 3359 | + |
---|
| 3360 | + out.flush(); |
---|
| 3361 | + out.close(); |
---|
| 3362 | + |
---|
| 3363 | + byte[] bytes = baos.toByteArray(); |
---|
| 3364 | + |
---|
| 3365 | + System.out.println("clone = " + bytes.length); |
---|
| 3366 | + |
---|
| 3367 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3368 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3369 | + Object obj = in.readObject(); |
---|
| 3370 | + in.close(); |
---|
| 3371 | + |
---|
| 3372 | + return obj; |
---|
| 3373 | + } catch (Exception e) |
---|
| 3374 | + { |
---|
| 3375 | + System.err.println(e); |
---|
| 3376 | + return null; |
---|
| 3377 | + } |
---|
| 3378 | + } |
---|
| 3379 | + |
---|
| 3380 | + cRadio GetCurrentTab() |
---|
| 3381 | + { |
---|
| 3382 | + cRadio ab; |
---|
| 3383 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3384 | + { |
---|
| 3385 | + ab = (cRadio)e.nextElement(); |
---|
| 3386 | + if(ab.GetObject() == copy) |
---|
| 3387 | + { |
---|
| 3388 | + return ab; |
---|
| 3389 | + } |
---|
| 3390 | + } |
---|
| 3391 | + |
---|
| 3392 | + return null; |
---|
| 3393 | + } |
---|
| 3394 | + |
---|
| 3395 | + java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3396 | + |
---|
| 3397 | + public void Save() |
---|
| 3398 | + { |
---|
| 3399 | + cRadio tab = GetCurrentTab(); |
---|
| 3400 | + |
---|
| 3401 | + boolean temp = CameraPane.SWITCH; |
---|
| 3402 | + CameraPane.SWITCH = false; |
---|
| 3403 | + |
---|
| 3404 | + copy.ExtractBigData(hashtable); |
---|
| 3405 | + |
---|
| 3406 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3407 | + tab.graphs[tab.undoindex++] = Compress(copy); |
---|
| 3408 | + |
---|
| 3409 | + copy.RestoreBigData(hashtable); |
---|
| 3410 | + |
---|
| 3411 | + CameraPane.SWITCH = temp; |
---|
| 3412 | + |
---|
| 3413 | + //assert(hashtable.isEmpty()); |
---|
| 3414 | + |
---|
| 3415 | + for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3416 | + { |
---|
| 3417 | + tab.graphs[i] = null; |
---|
| 3418 | + } |
---|
| 3419 | + |
---|
| 3420 | + // test save |
---|
| 3421 | + if (false) |
---|
| 3422 | + { |
---|
| 3423 | + try |
---|
| 3424 | + { |
---|
| 3425 | + FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3426 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3427 | + |
---|
| 3428 | + p.writeObject(copy); |
---|
| 3429 | + |
---|
| 3430 | + p.flush(); |
---|
| 3431 | + |
---|
| 3432 | + ostream.close(); |
---|
| 3433 | + } catch (Exception e) |
---|
| 3434 | + { |
---|
| 3435 | + e.printStackTrace(); |
---|
| 3436 | + } |
---|
| 3437 | + } |
---|
| 3438 | + } |
---|
| 3439 | + |
---|
| 3440 | + void CopyChanged(Object3D obj) |
---|
| 3441 | + { |
---|
| 3442 | + boolean temp = CameraPane.SWITCH; |
---|
| 3443 | + CameraPane.SWITCH = false; |
---|
| 3444 | + |
---|
| 3445 | + copy.ExtractBigData(hashtable); |
---|
| 3446 | + |
---|
| 3447 | + copy.clear(); |
---|
| 3448 | + |
---|
| 3449 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3450 | + { |
---|
| 3451 | + copy.add(obj.get(i)); |
---|
| 3452 | + } |
---|
| 3453 | + |
---|
| 3454 | + copy.RestoreBigData(hashtable); |
---|
| 3455 | + |
---|
| 3456 | + CameraPane.SWITCH = temp; |
---|
| 3457 | + |
---|
| 3458 | + //assert(hashtable.isEmpty()); |
---|
| 3459 | + |
---|
| 3460 | + copy.Touch(); |
---|
| 3461 | + |
---|
| 3462 | + ResetModel(); |
---|
| 3463 | + copy.HardTouch(); // recompile? |
---|
| 3464 | + |
---|
| 3465 | + cRadio ab; |
---|
| 3466 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3467 | + { |
---|
| 3468 | + ab = (cRadio)e.nextElement(); |
---|
| 3469 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3470 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3471 | + if (test != null) |
---|
| 3472 | + { |
---|
| 3473 | + test.editWindow = ab.object.editWindow; |
---|
| 3474 | + ab.object = test; |
---|
| 3475 | + } |
---|
| 3476 | + } |
---|
| 3477 | + |
---|
| 3478 | + refreshContents(); |
---|
| 3479 | + } |
---|
| 3480 | + |
---|
| 3481 | + public void Undo() |
---|
| 3482 | + { |
---|
| 3483 | + cRadio tab = GetCurrentTab(); |
---|
| 3484 | + |
---|
| 3485 | + if (tab.undoindex == 0) |
---|
| 3486 | + { |
---|
| 3487 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3488 | + return; |
---|
| 3489 | + } |
---|
| 3490 | + |
---|
| 3491 | + if (tab.graphs[tab.undoindex] == null) |
---|
| 3492 | + { |
---|
| 3493 | + Save(); |
---|
| 3494 | + tab.undoindex -= 1; |
---|
| 3495 | + } |
---|
| 3496 | + |
---|
| 3497 | + tab.undoindex -= 1; |
---|
| 3498 | + |
---|
| 3499 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3500 | + } |
---|
| 3501 | + |
---|
| 3502 | + public void Redo() |
---|
| 3503 | + { |
---|
| 3504 | + cRadio tab = GetCurrentTab(); |
---|
| 3505 | + |
---|
| 3506 | + if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3507 | + { |
---|
| 3508 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3509 | + return; |
---|
| 3510 | + } |
---|
| 3511 | + |
---|
| 3512 | + tab.undoindex += 1; |
---|
| 3513 | + |
---|
| 3514 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3515 | + } |
---|
| 3516 | + |
---|
| 3517 | + void ImportGFD() |
---|
| 3518 | + { |
---|
| 3519 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 3520 | + browser.show(); |
---|
| 3521 | + String filename = browser.getFile(); |
---|
| 3522 | + if (filename != null && filename.length() > 0) |
---|
| 3523 | + { |
---|
| 3524 | + String fullname = browser.getDirectory() + filename; |
---|
| 3525 | + |
---|
| 3526 | + //Object3D readobj = |
---|
| 3527 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 3528 | + //makeSomething(readobj); |
---|
| 3529 | + } |
---|
| 3530 | + } |
---|
| 3531 | + |
---|
| 3532 | + void ImportVRMLX3D() |
---|
| 3533 | + { |
---|
| 3534 | + if (Grafreed.standAlone) |
---|
| 3535 | + { |
---|
| 3536 | + /**/ |
---|
| 3537 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 3538 | + browser.show(); |
---|
| 3539 | + String filename = browser.getFile(); |
---|
| 3540 | + if (filename != null && filename.length() > 0) |
---|
| 3541 | + { |
---|
| 3542 | + String fullname = browser.getDirectory() + filename; |
---|
| 3543 | + LoadVRMLX3D(fullname); |
---|
| 3544 | + } |
---|
| 3545 | + /**/ |
---|
| 3546 | + } |
---|
| 3547 | + } |
---|
| 3548 | + |
---|
3190 | 3549 | void ToggleAnimation() |
---|
3191 | 3550 | { |
---|
3192 | 3551 | if (!Globals.ANIMATION) |
---|
3193 | 3552 | { |
---|
3194 | 3553 | FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); |
---|
3195 | | - browser.show(); |
---|
| 3554 | + browser.setVisible(true); |
---|
3196 | 3555 | String filename = browser.getFile(); |
---|
3197 | 3556 | if (filename != null && filename.length() > 0) |
---|
3198 | 3557 | { |
---|
.. | .. |
---|
3202 | 3561 | |
---|
3203 | 3562 | Globals.ANIMATION ^= true; |
---|
3204 | 3563 | |
---|
3205 | | - GrafreeD.wav.cursor = 0; |
---|
3206 | | - GrafreeD.wav.loop = 0; |
---|
| 3564 | + Grafreed.wav.cursor = 0; |
---|
| 3565 | + Grafreed.wav.loop = 0; |
---|
3207 | 3566 | } |
---|
3208 | 3567 | } else |
---|
3209 | 3568 | { |
---|
.. | .. |
---|
3224 | 3583 | callee.refreshContents(); |
---|
3225 | 3584 | } else |
---|
3226 | 3585 | { |
---|
3227 | | - new Exception().printStackTrace(); |
---|
3228 | 3586 | System.exit(0); |
---|
3229 | 3587 | } |
---|
3230 | 3588 | } |
---|
.. | .. |
---|
3254 | 3612 | void CreateMaterial() |
---|
3255 | 3613 | { |
---|
3256 | 3614 | //copy.ClearMaterial(); // PATCH |
---|
3257 | | - copy.CreateMaterialS(multiplyToggle.isSelected()); |
---|
| 3615 | + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); |
---|
3258 | 3616 | if (copy.selection.size() > 0) |
---|
3259 | 3617 | //SetMaterial(copy); |
---|
3260 | 3618 | { |
---|
.. | .. |
---|
3313 | 3671 | { |
---|
3314 | 3672 | copy.ResetBlockLoop(); // temporary problem |
---|
3315 | 3673 | |
---|
3316 | | - boolean random = CameraPane.RANDOM; |
---|
3317 | | - CameraPane.RANDOM = false; // parse everything |
---|
| 3674 | + boolean random = CameraPane.SWITCH; |
---|
| 3675 | + CameraPane.SWITCH = false; // parse everything |
---|
3318 | 3676 | copy.ResetDisplayList(); |
---|
3319 | 3677 | copy.HardTouch(); |
---|
3320 | | - CameraPane.RANDOM = random; |
---|
| 3678 | + CameraPane.SWITCH = random; |
---|
3321 | 3679 | } |
---|
3322 | 3680 | |
---|
3323 | 3681 | // public void applySelf() |
---|
.. | .. |
---|
3391 | 3749 | { |
---|
3392 | 3750 | //System.out.println("Propagate = " + propagate); |
---|
3393 | 3751 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 3752 | + |
---|
| 3753 | + if (copy.material != null) |
---|
| 3754 | + { |
---|
| 3755 | + cMaterial mat = copy.material; |
---|
| 3756 | + |
---|
| 3757 | + colorField.SetToolTipValue((mat.color)); |
---|
| 3758 | + modulationField.SetToolTipValue((mat.modulation)); |
---|
| 3759 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 3760 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 3761 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 3762 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 3763 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 3764 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 3765 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 3766 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 3767 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 3768 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 3769 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 3770 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 3771 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 3772 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 3773 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 3774 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 3775 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 3776 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 3777 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 3778 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 3779 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 3780 | + } |
---|
| 3781 | + |
---|
3394 | 3782 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3395 | 3783 | { |
---|
3396 | 3784 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3506 | 3894 | } |
---|
3507 | 3895 | |
---|
3508 | 3896 | if (normalpushField != null) |
---|
3509 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 3897 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3510 | 3898 | } |
---|
3511 | 3899 | |
---|
3512 | 3900 | void SnapObject() |
---|
.. | .. |
---|
3770 | 4158 | |
---|
3771 | 4159 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3772 | 4160 | { |
---|
| 4161 | + Save(); |
---|
3773 | 4162 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3774 | 4163 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3775 | 4164 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3973 | 4362 | } |
---|
3974 | 4363 | } |
---|
3975 | 4364 | } |
---|
| 4365 | + |
---|
3976 | 4366 | LoadGFDThread loadGFDThread; |
---|
3977 | 4367 | |
---|
3978 | 4368 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
3992 | 4382 | |
---|
3993 | 4383 | try |
---|
3994 | 4384 | { |
---|
| 4385 | + // Try compressed version first. |
---|
3995 | 4386 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
3996 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4387 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4388 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
3997 | 4389 | |
---|
3998 | 4390 | readobj = (Object3D) p.readObject(); |
---|
3999 | 4391 | istream.close(); |
---|
.. | .. |
---|
4001 | 4393 | readobj.ResetDisplayList(); |
---|
4002 | 4394 | } catch (Exception e) |
---|
4003 | 4395 | { |
---|
4004 | | - e.printStackTrace(); |
---|
| 4396 | + //e.printStackTrace(); |
---|
| 4397 | + try |
---|
| 4398 | + { |
---|
| 4399 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4400 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4401 | + |
---|
| 4402 | + readobj = (Object3D) p.readObject(); |
---|
| 4403 | + istream.close(); |
---|
| 4404 | + |
---|
| 4405 | + readobj.ResetDisplayList(); |
---|
| 4406 | + } catch (Exception e2) |
---|
| 4407 | + { |
---|
| 4408 | + e2.printStackTrace(); |
---|
| 4409 | + } |
---|
4005 | 4410 | } |
---|
4006 | 4411 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4007 | 4412 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4047 | 4452 | |
---|
4048 | 4453 | void LoadIt(Object obj) |
---|
4049 | 4454 | { |
---|
| 4455 | + if (obj == null) |
---|
| 4456 | + { |
---|
| 4457 | + // Invalid file |
---|
| 4458 | + return; |
---|
| 4459 | + } |
---|
| 4460 | + |
---|
4050 | 4461 | System.out.println("Loaded " + obj); |
---|
4051 | 4462 | //new Exception().printStackTrace(); |
---|
4052 | 4463 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4056 | 4467 | |
---|
4057 | 4468 | if (readobj != null) |
---|
4058 | 4469 | { |
---|
| 4470 | + Save(); |
---|
4059 | 4471 | try |
---|
4060 | 4472 | { |
---|
4061 | 4473 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4118 | 4530 | |
---|
4119 | 4531 | void load() // throws ClassNotFoundException |
---|
4120 | 4532 | { |
---|
4121 | | - if (GrafreeD.standAlone) |
---|
| 4533 | + if (Grafreed.standAlone) |
---|
4122 | 4534 | { |
---|
4123 | 4535 | FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
4124 | 4536 | browser.show(); |
---|
.. | .. |
---|
4205 | 4617 | try |
---|
4206 | 4618 | { |
---|
4207 | 4619 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4208 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4620 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4621 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4209 | 4622 | |
---|
4210 | 4623 | p.writeObject(copy); |
---|
4211 | 4624 | p.flush(); |
---|
4212 | 4625 | |
---|
| 4626 | + zstream.close(); |
---|
4213 | 4627 | ostream.close(); |
---|
4214 | 4628 | |
---|
4215 | 4629 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4219 | 4633 | { |
---|
4220 | 4634 | } |
---|
4221 | 4635 | } |
---|
| 4636 | + |
---|
4222 | 4637 | String lastname; |
---|
4223 | 4638 | |
---|
4224 | 4639 | void saveAs() |
---|
4225 | 4640 | { |
---|
4226 | | - if (GrafreeD.standAlone) |
---|
| 4641 | + if (Grafreed.standAlone) |
---|
4227 | 4642 | { |
---|
4228 | 4643 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4229 | 4644 | browser.setVisible(true); |
---|
.. | .. |
---|
4328 | 4743 | try |
---|
4329 | 4744 | { |
---|
4330 | 4745 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4331 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4332 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 4746 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4747 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4333 | 4748 | |
---|
4334 | 4749 | Object3D objectparent = obj.parent; |
---|
4335 | 4750 | obj.parent = null; |
---|
4336 | 4751 | |
---|
4337 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 4752 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4338 | 4753 | |
---|
4339 | 4754 | obj.parent = objectparent; |
---|
4340 | 4755 | |
---|
.. | .. |
---|
4346 | 4761 | p.writeObject(object); |
---|
4347 | 4762 | p.flush(); |
---|
4348 | 4763 | |
---|
| 4764 | + zstream.close(); |
---|
4349 | 4765 | ostream.close(); |
---|
4350 | | - // zstream.close(); |
---|
4351 | 4766 | |
---|
4352 | 4767 | // group.selection.get(0).parent = parent; |
---|
4353 | 4768 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4368 | 4783 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4369 | 4784 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4370 | 4785 | copy.generatePOV(buffer); |
---|
4371 | | - if (GrafreeD.standAlone) |
---|
| 4786 | + if (Grafreed.standAlone) |
---|
4372 | 4787 | { |
---|
4373 | 4788 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4374 | 4789 | browser.show(); |
---|
.. | .. |
---|
4394 | 4809 | Object3D client; |
---|
4395 | 4810 | Object3D copy; |
---|
4396 | 4811 | MenuBar menuBar; |
---|
4397 | | - Menu windowMenu; |
---|
| 4812 | + Menu fileMenu; |
---|
| 4813 | + MenuItem newItem; |
---|
4398 | 4814 | MenuItem loadItem; |
---|
4399 | 4815 | MenuItem saveItem; |
---|
4400 | 4816 | MenuItem saveAsItem; |
---|
.. | .. |
---|
4402 | 4818 | MenuItem reexportItem; |
---|
4403 | 4819 | MenuItem povItem; |
---|
4404 | 4820 | MenuItem closeItem; |
---|
4405 | | - Menu cameraMenu; |
---|
| 4821 | + |
---|
4406 | 4822 | CheckboxMenuItem zBufferItem; |
---|
4407 | 4823 | //MenuItem normalLensItem; |
---|
4408 | | - MenuItem editCameraItem; |
---|
4409 | | - MenuItem revertCameraItem; |
---|
4410 | 4824 | MenuItem stepItem; |
---|
4411 | 4825 | CheckboxMenuItem toggleLiveItem; |
---|
4412 | 4826 | CheckboxMenuItem toggleFullScreenItem; |
---|
.. | .. |
---|
4417 | 4831 | CheckboxMenuItem toggleFootContactItem; |
---|
4418 | 4832 | CheckboxMenuItem toggleDLItem; |
---|
4419 | 4833 | CheckboxMenuItem toggleTextureItem; |
---|
4420 | | - CheckboxMenuItem toggleRandomItem; |
---|
| 4834 | + CheckboxMenuItem toggleSwitchItem; |
---|
4421 | 4835 | CheckboxMenuItem toggleRootItem; |
---|
4422 | 4836 | CheckboxMenuItem animationItem; |
---|
4423 | 4837 | CheckboxMenuItem toggleHandleItem; |
---|
.. | .. |
---|
4425 | 4839 | JSplitPane mainPanel; |
---|
4426 | 4840 | JScrollPane scrollpane; |
---|
4427 | 4841 | JPanel toolbarPanel; |
---|
4428 | | - JPanel treePanel; |
---|
| 4842 | + cGridBag treePanel; |
---|
4429 | 4843 | JPanel radioPanel; |
---|
4430 | 4844 | ButtonGroup buttonGroup; |
---|
4431 | 4845 | cGridBag ctrlPanel; |
---|
.. | .. |
---|
4554 | 4968 | //ObjectUI parent; |
---|
4555 | 4969 | |
---|
4556 | 4970 | cNumberSlider normalpushField; |
---|
| 4971 | + |
---|
| 4972 | + private MenuItem importGFDItem; |
---|
| 4973 | + private MenuItem importVRMLX3DItem; |
---|
| 4974 | + private MenuItem import3DSItem; |
---|
| 4975 | + private MenuItem importOBJItem; |
---|
4557 | 4976 | } |
---|