.. | .. |
---|
15 | 15 | //import javax.swing.plaf.ColorUIResource; |
---|
16 | 16 | //import javax.swing.plaf.metal.DefaultMetalTheme; |
---|
17 | 17 | |
---|
| 18 | +import javax.swing.plaf.basic.BasicSplitPaneDivider; |
---|
| 19 | +import javax.swing.plaf.basic.BasicSplitPaneUI; |
---|
| 20 | + |
---|
18 | 21 | //import javax.media.opengl.GLCanvas; |
---|
19 | 22 | |
---|
20 | 23 | import //weka.core. |
---|
.. | .. |
---|
31 | 34 | iSendInfo |
---|
32 | 35 | //KeyListener |
---|
33 | 36 | { |
---|
| 37 | + public cToggleButton pinButton; |
---|
34 | 38 | boolean timeline; |
---|
35 | 39 | boolean wasFullScreen; |
---|
36 | 40 | |
---|
.. | .. |
---|
38 | 42 | JFrame frame; |
---|
39 | 43 | |
---|
40 | 44 | static ObjEditor theFrame; |
---|
| 45 | + |
---|
| 46 | + public void AllocProjectedVertices(Object3D object) |
---|
| 47 | + { |
---|
| 48 | + assert (object.projectedVertices != null); |
---|
| 49 | + |
---|
| 50 | + if (object.projectedVertices.length <= 2) |
---|
| 51 | + { |
---|
| 52 | + // Side effect... |
---|
| 53 | + Object3D.cVector2[] keep = object.projectedVertices; |
---|
| 54 | + object.projectedVertices = new Object3D.cVector2[3]; |
---|
| 55 | + for (int i = 0; i < 3; i++) |
---|
| 56 | + { |
---|
| 57 | + if (i < keep.length) |
---|
| 58 | + { |
---|
| 59 | + object.projectedVertices[i] = keep[i]; |
---|
| 60 | + } else |
---|
| 61 | + { |
---|
| 62 | + object.projectedVertices[i] = new Object3D.cVector2(); |
---|
| 63 | + } |
---|
| 64 | + /* |
---|
| 65 | + if(keep.length == 0) |
---|
| 66 | + object.projectedVertices[0] = new Object3D.cVector2(); |
---|
| 67 | + else |
---|
| 68 | + object.projectedVertices[0] = keep[0]; |
---|
| 69 | + object.projectedVertices[1] = new Object3D.cVector2(); |
---|
| 70 | + */ |
---|
| 71 | + } |
---|
| 72 | + } |
---|
| 73 | + } |
---|
| 74 | + |
---|
| 75 | + public cGridBag GetSeparator() |
---|
| 76 | + { |
---|
| 77 | + cGridBag separator = new cGridBag(); |
---|
| 78 | + separator.add(new JSeparator()); |
---|
| 79 | + separator.preferredHeight = 5; |
---|
| 80 | + return separator; |
---|
| 81 | + } |
---|
41 | 82 | |
---|
42 | 83 | cButton GetButton(String name, boolean border) |
---|
43 | 84 | { |
---|
44 | | - try |
---|
45 | | - { |
---|
46 | | - ImageIcon icon = GetIcon(name); |
---|
47 | | - return new cButton(icon, border); |
---|
48 | | - } |
---|
49 | | - catch (Exception e) |
---|
50 | | - { |
---|
51 | | - return new cButton(name, border); |
---|
52 | | - } |
---|
| 85 | + ImageIcon icon = GetIcon(name); |
---|
| 86 | + return new cButton(icon, border); |
---|
| 87 | + } |
---|
| 88 | + |
---|
| 89 | + cLabel GetLabel(String name, boolean border) |
---|
| 90 | + { |
---|
| 91 | + //ImageIcon icon = GetIcon(name); |
---|
| 92 | + return new cLabel(GetImage(name), border); |
---|
53 | 93 | } |
---|
54 | 94 | |
---|
55 | 95 | cToggleButton GetToggleButton(String name, boolean border) |
---|
56 | 96 | { |
---|
57 | | - try |
---|
58 | | - { |
---|
59 | | - ImageIcon icon = GetIcon(name); |
---|
60 | | - return new cToggleButton(icon, border); |
---|
61 | | - } |
---|
62 | | - catch (Exception e) |
---|
63 | | - { |
---|
64 | | - return new cToggleButton(name, border); |
---|
65 | | - } |
---|
| 97 | + ImageIcon icon = GetIcon(name); |
---|
| 98 | + return new cToggleButton(icon, border); |
---|
66 | 99 | } |
---|
67 | 100 | |
---|
68 | 101 | cCheckBox GetCheckBox(String name, boolean border) |
---|
69 | 102 | { |
---|
| 103 | + ImageIcon icon = GetIcon(name); |
---|
| 104 | + return new cCheckBox(icon, border); |
---|
| 105 | + } |
---|
| 106 | + |
---|
| 107 | + static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>(); |
---|
| 108 | + |
---|
| 109 | + ImageIcon GetIcon(String name) |
---|
| 110 | + { |
---|
| 111 | + javax.swing.ImageIcon iconCache = icons.get(name); |
---|
| 112 | + if (iconCache != null) |
---|
| 113 | + { |
---|
| 114 | + return iconCache; |
---|
| 115 | + } |
---|
| 116 | + |
---|
70 | 117 | try |
---|
71 | 118 | { |
---|
72 | | - ImageIcon icon = GetIcon(name); |
---|
73 | | - return new cCheckBox(icon, border); |
---|
| 119 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 120 | + |
---|
| 121 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 122 | +// { |
---|
| 123 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 124 | +// Graphics2D g = resized.createGraphics(); |
---|
| 125 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 126 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 127 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 128 | +// g.dispose(); |
---|
| 129 | +// |
---|
| 130 | +// image = resized; |
---|
| 131 | +// } |
---|
| 132 | + |
---|
| 133 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 134 | + |
---|
| 135 | + icons.put(name, icon); |
---|
| 136 | + |
---|
| 137 | + return icon; |
---|
74 | 138 | } |
---|
75 | 139 | catch (Exception e) |
---|
76 | 140 | { |
---|
77 | | - return new cCheckBox(name, border); |
---|
| 141 | + //icons.put(name, null); |
---|
| 142 | + return null; |
---|
78 | 143 | } |
---|
79 | 144 | } |
---|
80 | | - |
---|
81 | | - private ImageIcon GetIcon(String name) throws IOException |
---|
| 145 | + |
---|
| 146 | + BufferedImage GetImage(String name) |
---|
82 | 147 | { |
---|
83 | | - BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
84 | | - |
---|
85 | | - if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 148 | + try |
---|
86 | 149 | { |
---|
87 | | - BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
88 | | - Graphics2D g = resized.createGraphics(); |
---|
89 | | - g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
90 | | - //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
91 | | - g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
92 | | - g.dispose(); |
---|
93 | | - |
---|
94 | | - image = resized; |
---|
| 150 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 151 | + |
---|
| 152 | + return image; |
---|
95 | 153 | } |
---|
96 | | - |
---|
97 | | - javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
98 | | - return icon; |
---|
| 154 | + catch (Exception e) |
---|
| 155 | + { |
---|
| 156 | + return null; |
---|
| 157 | + } |
---|
99 | 158 | } |
---|
100 | 159 | |
---|
101 | 160 | // SCRIPT |
---|
.. | .. |
---|
207 | 266 | |
---|
208 | 267 | objEditor.ctrlPanel.remove(namePanel); |
---|
209 | 268 | |
---|
210 | | - if (!GroupEditor.allparams) |
---|
| 269 | + if (!allparams) |
---|
211 | 270 | return; |
---|
212 | 271 | |
---|
213 | 272 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
279 | 338 | client = inClient; |
---|
280 | 339 | copy = client; |
---|
281 | 340 | |
---|
| 341 | +// if (copy.versionlist == null) |
---|
| 342 | +// { |
---|
| 343 | +// copy.versionlist = new Object3D[100]; |
---|
| 344 | +// copy.versionindex = -1; |
---|
| 345 | +// |
---|
| 346 | +// callee.Save(true); |
---|
| 347 | +// } |
---|
| 348 | + |
---|
282 | 349 | // "this" is not called: SetupUI2(objEditor); |
---|
283 | 350 | } |
---|
284 | 351 | |
---|
.. | .. |
---|
292 | 359 | client = inClient; |
---|
293 | 360 | copy = client; |
---|
294 | 361 | |
---|
| 362 | + if (copy.versionlist == null) |
---|
| 363 | + { |
---|
| 364 | + copy.versionlist = new Object3D[100]; |
---|
| 365 | + copy.versionindex = -1; |
---|
| 366 | + |
---|
| 367 | +// Save(true); |
---|
| 368 | + } |
---|
| 369 | + |
---|
295 | 370 | SetupUI2(callee.GetEditor()); |
---|
296 | 371 | } |
---|
297 | 372 | |
---|
.. | .. |
---|
306 | 381 | //localCopy.parent = null; |
---|
307 | 382 | |
---|
308 | 383 | frame = new JFrame(); |
---|
309 | | - frame.setUndecorated(true); |
---|
| 384 | + frame.setUndecorated(false); |
---|
310 | 385 | objEditor = this; |
---|
311 | 386 | this.callee = callee; |
---|
312 | 387 | |
---|
.. | .. |
---|
324 | 399 | copy = localCopy; |
---|
325 | 400 | copy.editWindow = this; |
---|
326 | 401 | |
---|
| 402 | +// if (copy.versionlist == null) |
---|
| 403 | +// { |
---|
| 404 | +// copy.versionlist = new Object3D[100]; |
---|
| 405 | +// copy.versionindex = -1; |
---|
| 406 | +// |
---|
| 407 | +// Save(true); |
---|
| 408 | +// } |
---|
| 409 | + |
---|
327 | 410 | SetupMenu(); |
---|
328 | 411 | |
---|
329 | 412 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
337 | 420 | return frame.action(event, obj); |
---|
338 | 421 | } |
---|
339 | 422 | |
---|
| 423 | + // Cannot work without static |
---|
| 424 | + static boolean allparams = true; |
---|
| 425 | + |
---|
| 426 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 427 | + |
---|
340 | 428 | void SetupMenu() |
---|
341 | 429 | { |
---|
342 | 430 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
343 | 431 | menuBar.add(fileMenu = new Menu("File")); |
---|
344 | 432 | fileMenu.add(newItem = new MenuItem("New")); |
---|
345 | | - fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 433 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
346 | 434 | |
---|
347 | 435 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
348 | 436 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
374 | 462 | } |
---|
375 | 463 | |
---|
376 | 464 | newItem.addActionListener(this); |
---|
377 | | - loadItem.addActionListener(this); |
---|
| 465 | + openItem.addActionListener(this); |
---|
378 | 466 | saveItem.addActionListener(this); |
---|
379 | 467 | saveAsItem.addActionListener(this); |
---|
380 | 468 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
386 | 474 | |
---|
387 | 475 | ChangeListener changeListener = new ChangeListener() |
---|
388 | 476 | { |
---|
| 477 | + //String name; |
---|
| 478 | + |
---|
389 | 479 | public void stateChanged(ChangeEvent changeEvent) |
---|
390 | 480 | { |
---|
391 | 481 | // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
.. | .. |
---|
398 | 488 | // |
---|
399 | 489 | // materialFlushed = true; |
---|
400 | 490 | // } |
---|
| 491 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 492 | +// { |
---|
| 493 | +// if (listUI.size() == 0) |
---|
| 494 | +// EditSelection(false); |
---|
| 495 | +// } |
---|
401 | 496 | |
---|
402 | | - refreshContents(false); // To refresh Info tab |
---|
| 497 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 498 | +// { |
---|
| 499 | +// name = copy.skyboxname; |
---|
| 500 | +// |
---|
| 501 | +// if (name == null) |
---|
| 502 | +// { |
---|
| 503 | +// name = ""; |
---|
| 504 | +// } |
---|
| 505 | +// |
---|
| 506 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 507 | +// copy.skyboxext = "jpg"; |
---|
| 508 | +// } |
---|
| 509 | +// else |
---|
| 510 | +// { |
---|
| 511 | +// if (name != null) |
---|
| 512 | +// { |
---|
| 513 | +// if (name.equals("")) |
---|
| 514 | +// { |
---|
| 515 | +// copy.skyboxname = null; |
---|
| 516 | +// copy.skyboxext = null; |
---|
| 517 | +// } |
---|
| 518 | +// else |
---|
| 519 | +// { |
---|
| 520 | +// copy.skyboxname = name; |
---|
| 521 | +// } |
---|
| 522 | +// } |
---|
| 523 | +// } |
---|
| 524 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 525 | + |
---|
| 526 | +// refreshContents(false); // To refresh Info tab |
---|
| 527 | + cameraView.repaint(); |
---|
403 | 528 | } |
---|
404 | 529 | }; |
---|
405 | 530 | objectPanel.addChangeListener(changeListener); |
---|
406 | 531 | |
---|
407 | 532 | toolbarPanel = new JPanel(); |
---|
408 | 533 | toolbarPanel.setName("Toolbar"); |
---|
| 534 | + |
---|
409 | 535 | treePanel = new cGridBag(); |
---|
410 | 536 | treePanel.setName("Tree"); |
---|
411 | 537 | |
---|
412 | 538 | editPanel = new cGridBag().setVertical(true); |
---|
413 | | - editPanel.setName("Edit"); |
---|
| 539 | + //editPanel.setName("Edit"); |
---|
414 | 540 | |
---|
415 | 541 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
416 | 542 | |
---|
.. | .. |
---|
418 | 544 | editPanel.add(editCommandsPanel); |
---|
419 | 545 | editPanel.add(ctrlPanel); |
---|
420 | 546 | |
---|
421 | | - toolboxPanel = new cGridBag().setVertical(false); |
---|
422 | | - toolboxPanel.setName("Toolbox"); |
---|
| 547 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 548 | + //toolboxPanel.setName("Toolbox"); |
---|
423 | 549 | |
---|
424 | | - materialPanel = new cGridBag().setVertical(true); |
---|
425 | | - materialPanel.setName("Material"); |
---|
| 550 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 551 | + |
---|
| 552 | + materialPanel = new cGridBag().setVertical(false); |
---|
| 553 | + //materialPanel.setName("Material"); |
---|
426 | 554 | |
---|
427 | 555 | /*JTextPane*/ |
---|
428 | 556 | infoarea = createTextPane(); |
---|
.. | .. |
---|
430 | 558 | |
---|
431 | 559 | infoarea.setEditable(true); |
---|
432 | 560 | SetText(); |
---|
| 561 | + |
---|
433 | 562 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
434 | 563 | // infoarea.setOpaque(false); |
---|
435 | 564 | // //infoarea.setForeground(textcolor); |
---|
436 | 565 | // TEXTAREA infoarea.setLineWrap(true); |
---|
437 | 566 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
438 | 567 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
439 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
440 | | - infoPanel.setName("Info"); |
---|
| 568 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
| 569 | + //infoPanel.setName("Info"); |
---|
441 | 570 | //infoPanel.setLayout(new BorderLayout()); |
---|
442 | 571 | //infoPanel.add(createTextPane()); |
---|
443 | 572 | |
---|
.. | .. |
---|
448 | 577 | mainPanel.setDividerSize(9); |
---|
449 | 578 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
450 | 579 | mainPanel.setResizeWeight(0.5); |
---|
451 | | - |
---|
| 580 | + |
---|
| 581 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 582 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 583 | + divider.setDividerSize(15); |
---|
| 584 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 585 | + |
---|
| 586 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 587 | + |
---|
452 | 588 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
453 | 589 | //mainPanel.setLayout(new GridBagLayout()); |
---|
454 | 590 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
679 | 815 | } |
---|
680 | 816 | } |
---|
681 | 817 | |
---|
682 | | -static GraphicsDevice device = GraphicsEnvironment |
---|
683 | | - .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 818 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 819 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
684 | 820 | |
---|
685 | 821 | Rectangle keeprect; |
---|
686 | 822 | cRadio radio; |
---|
.. | .. |
---|
697 | 833 | boolean maximized; |
---|
698 | 834 | |
---|
699 | 835 | cButton fullscreenLayout; |
---|
| 836 | + cButton expandedLayout; |
---|
700 | 837 | |
---|
701 | 838 | void Minimize() |
---|
702 | 839 | { |
---|
703 | 840 | frame.setState(Frame.ICONIFIED); |
---|
| 841 | + frame.validate(); |
---|
704 | 842 | } |
---|
705 | 843 | |
---|
| 844 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 845 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 846 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
706 | 847 | void Maximize() |
---|
707 | 848 | { |
---|
| 849 | + if (CameraPane.FULLSCREEN) |
---|
| 850 | + { |
---|
| 851 | + ToggleFullScreen(); |
---|
| 852 | + } |
---|
| 853 | + |
---|
708 | 854 | if (maximized) |
---|
709 | 855 | { |
---|
710 | 856 | frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
.. | .. |
---|
712 | 858 | else |
---|
713 | 859 | { |
---|
714 | 860 | keeprect = frame.getBounds(); |
---|
715 | | - Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
716 | | - Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
717 | | - frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 861 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 862 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 863 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
718 | 864 | // frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 865 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
719 | 866 | } |
---|
720 | 867 | |
---|
721 | 868 | maximized ^= true; |
---|
| 869 | + |
---|
| 870 | + frame.validate(); |
---|
722 | 871 | } |
---|
| 872 | + |
---|
| 873 | + cButton minButton; |
---|
| 874 | + cButton maxButton; |
---|
| 875 | + cButton fullButton; |
---|
| 876 | + cButton collapseButton; |
---|
| 877 | + cButton maximize3DButton; |
---|
723 | 878 | |
---|
724 | 879 | void ToggleFullScreen() |
---|
725 | 880 | { |
---|
| 881 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 882 | + |
---|
726 | 883 | cameraView.ToggleFullScreen(); |
---|
727 | 884 | |
---|
728 | 885 | if (!CameraPane.FULLSCREEN) |
---|
729 | 886 | { |
---|
730 | 887 | device.setFullScreenWindow(null); |
---|
| 888 | + frame.dispose(); |
---|
| 889 | + frame.setUndecorated(false); |
---|
| 890 | + frame.validate(); |
---|
| 891 | + frame.setVisible(true); |
---|
| 892 | + |
---|
731 | 893 | //frame.setVisible(false); |
---|
732 | 894 | // frame.removeNotify(); |
---|
733 | 895 | // frame.setUndecorated(false); |
---|
.. | .. |
---|
737 | 899 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
738 | 900 | // X framePanel.add(bigThree); |
---|
739 | 901 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
740 | | - framePanel.setDividerLocation(1); |
---|
| 902 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
741 | 903 | |
---|
742 | 904 | //frame.setVisible(true); |
---|
743 | | - radio.layout = keepButton; |
---|
| 905 | +// radio.layout = keepButton; |
---|
744 | 906 | //theFrame = null; |
---|
745 | 907 | keepButton = null; |
---|
746 | | - radio.layout.doClick(); |
---|
| 908 | +// radio.layout.doClick(); |
---|
747 | 909 | |
---|
748 | 910 | } else |
---|
749 | 911 | { |
---|
.. | .. |
---|
752 | 914 | // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
753 | 915 | // frame.getToolkit().getScreenSize().height); |
---|
754 | 916 | //frame.setVisible(false); |
---|
| 917 | + |
---|
| 918 | + frame.dispose(); |
---|
| 919 | + frame.setUndecorated(true); |
---|
755 | 920 | device.setFullScreenWindow(frame); |
---|
| 921 | + frame.validate(); |
---|
| 922 | + frame.setVisible(true); |
---|
756 | 923 | // frame.removeNotify(); |
---|
757 | 924 | // frame.setUndecorated(true); |
---|
758 | 925 | // frame.addNotify(); |
---|
759 | 926 | // X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
760 | 927 | // X framePanel.remove(bigThree); |
---|
761 | 928 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
762 | | - framePanel.setDividerLocation(0); |
---|
| 929 | +// framePanel.setDividerLocation(0); |
---|
763 | 930 | |
---|
764 | | - radio.layout = fullscreenLayout; |
---|
765 | | - radio.layout.doClick(); |
---|
| 931 | +// radio.layout = fullscreenLayout; |
---|
| 932 | +// radio.layout.doClick(); |
---|
766 | 933 | //frame.setVisible(true); |
---|
767 | 934 | } |
---|
| 935 | + frame.validate(); |
---|
| 936 | + |
---|
| 937 | + cameraView.requestFocusInWindow(); |
---|
768 | 938 | } |
---|
| 939 | + |
---|
| 940 | + void CollapseToolbar() |
---|
| 941 | + { |
---|
| 942 | + framePanel.setDividerLocation(0); |
---|
| 943 | + //frame.validate(); |
---|
| 944 | + |
---|
| 945 | + cameraView.requestFocusInWindow(); |
---|
| 946 | + } |
---|
| 947 | + |
---|
| 948 | + private Object3D Duplicate(Object3D object) |
---|
| 949 | + { |
---|
| 950 | + boolean temp = CameraPane.SWITCH; |
---|
| 951 | + CameraPane.SWITCH = false; |
---|
| 952 | + |
---|
| 953 | + object.ExtractBigData(versiontable); |
---|
| 954 | + // if (copy == client) |
---|
| 955 | + |
---|
| 956 | + Object3D versions[] = object.versionlist; |
---|
| 957 | + object.versionlist = null; |
---|
| 958 | + |
---|
| 959 | + //byte[] compress = Compress(copy); |
---|
| 960 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
| 961 | + |
---|
| 962 | + object.versionlist = versions; |
---|
| 963 | + |
---|
| 964 | + object.RestoreBigData(versiontable); |
---|
| 965 | + |
---|
| 966 | + CameraPane.SWITCH = temp; |
---|
| 967 | + |
---|
| 968 | + return compress; |
---|
| 969 | + } |
---|
769 | 970 | |
---|
770 | 971 | private JTextPane createTextPane() |
---|
771 | 972 | { |
---|
.. | .. |
---|
888 | 1089 | { |
---|
889 | 1090 | SetupMaterial(materialPanel); |
---|
890 | 1091 | } |
---|
| 1092 | + |
---|
891 | 1093 | //SetupName(); |
---|
892 | 1094 | //SetupViews(); |
---|
893 | 1095 | } |
---|
.. | .. |
---|
897 | 1099 | // NumberSlider vDivsField; |
---|
898 | 1100 | // JCheckBox endcaps; |
---|
899 | 1101 | JCheckBox liveCB; |
---|
900 | | - JCheckBox selectCB; |
---|
| 1102 | + JCheckBox selectableCB; |
---|
901 | 1103 | JCheckBox hideCB; |
---|
902 | 1104 | JCheckBox link2masterCB; |
---|
903 | 1105 | JCheckBox markCB; |
---|
.. | .. |
---|
1096 | 1298 | |
---|
1097 | 1299 | namePanel = new cGridBag(); |
---|
1098 | 1300 | |
---|
| 1301 | + //if (copy.pinned) |
---|
| 1302 | + { |
---|
| 1303 | + pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF); |
---|
| 1304 | + pinButton.setSelected(copy.pinned); |
---|
| 1305 | + cGridBag t = new cGridBag(); |
---|
| 1306 | + t.preferredWidth = 2; |
---|
| 1307 | + t.add(pinButton); |
---|
| 1308 | + namePanel.add(t); |
---|
| 1309 | + |
---|
| 1310 | + pinButton.addItemListener(this); |
---|
| 1311 | + } |
---|
| 1312 | + |
---|
1099 | 1313 | nameField = AddText(namePanel, copy.GetName()); |
---|
1100 | | - namePanel.add(nameField); |
---|
| 1314 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1101 | 1315 | oe.ctrlPanel.add(namePanel); |
---|
1102 | 1316 | |
---|
1103 | 1317 | oe.ctrlPanel.Return(); |
---|
1104 | 1318 | |
---|
1105 | | - if (!GroupEditor.allparams) |
---|
| 1319 | + if (!allparams) |
---|
1106 | 1320 | return; |
---|
1107 | 1321 | |
---|
1108 | 1322 | setupPanel = new cGridBag().setVertical(false); |
---|
1109 | 1323 | |
---|
1110 | 1324 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1111 | 1325 | liveCB.setToolTipText("Animate object"); |
---|
1112 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1113 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1326 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1327 | + selectableCB.setToolTipText("Make object selectable"); |
---|
1114 | 1328 | // Return(); |
---|
| 1329 | + |
---|
1115 | 1330 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1116 | 1331 | hideCB.setToolTipText("Hide object"); |
---|
1117 | 1332 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1118 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1333 | + markCB.setToolTipText("As animation target transform"); |
---|
| 1334 | + |
---|
| 1335 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1119 | 1336 | |
---|
1120 | 1337 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1121 | 1338 | |
---|
1122 | 1339 | rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
1123 | 1340 | rewindCB.setToolTipText("Rewind animation"); |
---|
1124 | 1341 | |
---|
1125 | | - randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
1126 | | - randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
| 1342 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1343 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1127 | 1344 | |
---|
| 1345 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1346 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1347 | + |
---|
1128 | 1348 | if (Globals.ADVANCED) |
---|
1129 | 1349 | { |
---|
1130 | | - link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
1131 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1132 | 1350 | speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1133 | 1351 | speedupCB.setToolTipText("Option motion capture"); |
---|
1134 | 1352 | } |
---|
.. | .. |
---|
1402 | 1620 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1403 | 1621 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1404 | 1622 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1623 | + //XYZPanel.setName("XYZ"); |
---|
1405 | 1624 | |
---|
1406 | 1625 | /* |
---|
1407 | 1626 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1439 | 1658 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1440 | 1659 | //tmp.setName("Edit"); |
---|
1441 | 1660 | objectPanel.add(materialPanel); |
---|
| 1661 | + objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1662 | + objectPanel.setToolTipTextAt(0, "Material"); |
---|
| 1663 | + |
---|
1442 | 1664 | objectPanel.add(toolboxPanel); |
---|
| 1665 | + objectPanel.setIconAt(1, GetIcon("icons/primitives.png")); |
---|
| 1666 | + objectPanel.setToolTipTextAt(1, "Objects & textures"); |
---|
| 1667 | + |
---|
| 1668 | + objectPanel.add(skyboxPanel); |
---|
| 1669 | + objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
| 1670 | + objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
| 1671 | + |
---|
1443 | 1672 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1444 | 1673 | // north.setName("Edit"); |
---|
1445 | 1674 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1446 | 1675 | // objectPanel.add(north); |
---|
1447 | 1676 | objectPanel.add(editPanel); |
---|
1448 | | - objectPanel.add(infoPanel); |
---|
1449 | | - |
---|
| 1677 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1678 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
| 1679 | + |
---|
| 1680 | + objectPanel.add(XYZPanel); |
---|
| 1681 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1682 | + objectPanel.setToolTipTextAt(4, "XYZ/RGB transform"); |
---|
| 1683 | + |
---|
1450 | 1684 | /* |
---|
1451 | 1685 | aConstraints.gridx = 0; |
---|
1452 | 1686 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1454 | 1688 | aConstraints.gridy += 1; |
---|
1455 | 1689 | aConstraints.gridwidth = 1; |
---|
1456 | 1690 | mainPanel.add(objectPanel, aConstraints); |
---|
1457 | | - */ |
---|
| 1691 | + */ |
---|
1458 | 1692 | |
---|
1459 | 1693 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1460 | 1694 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1466 | 1700 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1467 | 1701 | |
---|
1468 | 1702 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1469 | | - scenePanel.preferredWidth = 6; |
---|
| 1703 | + scenePanel.preferredWidth = 5; |
---|
1470 | 1704 | |
---|
1471 | 1705 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1472 | 1706 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1483 | 1717 | |
---|
1484 | 1718 | scenePanel.add(tabbedPane); |
---|
1485 | 1719 | |
---|
| 1720 | + //if (Globals.ADVANCED) |
---|
| 1721 | +// tabbedPane.add(infoPanel); |
---|
| 1722 | +// tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
| 1723 | +// tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1724 | + |
---|
1486 | 1725 | /* |
---|
1487 | 1726 | cTree jTree = new cTree(null); |
---|
1488 | 1727 | ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
.. | .. |
---|
1544 | 1783 | bigThree = new cGridBag(); |
---|
1545 | 1784 | bigThree.addComponent(scenePanel); |
---|
1546 | 1785 | bigThree.addComponent(centralPanel); |
---|
1547 | | - bigThree.addComponent(XYZPanel); |
---|
| 1786 | + //bigThree.addComponent(XYZPanel); |
---|
1548 | 1787 | |
---|
1549 | 1788 | // // SIDE EFFECT!!! |
---|
1550 | 1789 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1553 | 1792 | // aConstraints.gridheight = 1; |
---|
1554 | 1793 | |
---|
1555 | 1794 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1556 | | - framePanel.setContinuousLayout(true); |
---|
1557 | | - framePanel.setOneTouchExpandable(true); |
---|
1558 | | - framePanel.setDividerLocation(0.8); |
---|
| 1795 | + |
---|
| 1796 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1797 | + new java.beans.PropertyChangeListener() |
---|
| 1798 | + { |
---|
| 1799 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1800 | + { |
---|
| 1801 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1802 | + { |
---|
| 1803 | + if (radio.layout != expandedLayout) |
---|
| 1804 | + { |
---|
| 1805 | + radio.layout = expandedLayout; |
---|
| 1806 | + radio.layout.doClick(); |
---|
| 1807 | + } |
---|
| 1808 | + } |
---|
| 1809 | + } |
---|
| 1810 | + }); |
---|
| 1811 | + |
---|
| 1812 | + framePanel.setContinuousLayout(false); |
---|
| 1813 | + framePanel.setOneTouchExpandable(false); |
---|
| 1814 | + //.setDividerLocation(0.8); |
---|
1559 | 1815 | //framePanel.setDividerSize(15); |
---|
1560 | 1816 | //framePanel.setResizeWeight(0.15); |
---|
1561 | 1817 | framePanel.setName("Frame"); |
---|
1562 | 1818 | |
---|
1563 | 1819 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1564 | 1820 | /**/ |
---|
1565 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1821 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1566 | 1822 | //worldPane.add(bigPanel); |
---|
1567 | 1823 | //worldPane.add(worldPanel); |
---|
1568 | 1824 | /**/ |
---|
.. | .. |
---|
1574 | 1830 | |
---|
1575 | 1831 | frame.setSize(1280, 860); |
---|
1576 | 1832 | |
---|
1577 | | - frame.validate(); |
---|
1578 | | - frame.setVisible(true); |
---|
1579 | | - |
---|
1580 | 1833 | cameraView.requestFocusInWindow(); |
---|
1581 | 1834 | |
---|
1582 | 1835 | gridPanel.setDividerLocation(1.0); |
---|
| 1836 | + |
---|
| 1837 | + frame.validate(); |
---|
| 1838 | + |
---|
| 1839 | + frame.setVisible(true); |
---|
1583 | 1840 | |
---|
1584 | 1841 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1585 | 1842 | frame.addWindowListener(new WindowAdapter() |
---|
1586 | 1843 | { |
---|
1587 | | - |
---|
1588 | 1844 | public void windowClosing(WindowEvent e) |
---|
1589 | 1845 | { |
---|
1590 | 1846 | Close(); |
---|
.. | .. |
---|
1607 | 1863 | ctrlPanel.removeAll(); |
---|
1608 | 1864 | } |
---|
1609 | 1865 | |
---|
1610 | | - void SetupMaterial(cGridBag panel) |
---|
| 1866 | + void SetupMaterial(cGridBag materialpanel) |
---|
1611 | 1867 | { |
---|
1612 | | - /* |
---|
| 1868 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1869 | + |
---|
| 1870 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1871 | + skin.setToolTipText("Skin"); |
---|
| 1872 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1873 | + { |
---|
| 1874 | + public void mouseClicked(MouseEvent e) |
---|
| 1875 | + { |
---|
| 1876 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1877 | + cMaterial material = object.material; |
---|
| 1878 | + |
---|
| 1879 | + // Skin |
---|
| 1880 | + colorField.setFloat(material.color); |
---|
| 1881 | + saturationField.setFloat(material.modulation); |
---|
| 1882 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1883 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1884 | + diffusenessField.setFloat(material.factor); |
---|
| 1885 | + shininessField.setFloat(material.shininess); |
---|
| 1886 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1887 | + diffuseField.setFloat(material.diffuse); |
---|
| 1888 | + specularField.setFloat(material.specular); |
---|
| 1889 | + |
---|
| 1890 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1891 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1892 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1893 | + |
---|
| 1894 | + materialtouched = true; |
---|
| 1895 | + applySelf(); |
---|
| 1896 | + } |
---|
| 1897 | + }); |
---|
| 1898 | + presetpanel.add(skin); |
---|
| 1899 | + |
---|
| 1900 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF); |
---|
| 1901 | + lambert.setToolTipText("Diffuse"); |
---|
| 1902 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 1903 | + { |
---|
| 1904 | + public void mouseClicked(MouseEvent e) |
---|
| 1905 | + { |
---|
| 1906 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 1907 | + cMaterial material = object.material; |
---|
| 1908 | + |
---|
| 1909 | + diffusenessField.setFloat(material.factor); |
---|
| 1910 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1911 | + |
---|
| 1912 | + materialtouched = true; |
---|
| 1913 | + applySelf(); |
---|
| 1914 | + } |
---|
| 1915 | + }); |
---|
| 1916 | + presetpanel.add(lambert); |
---|
| 1917 | + |
---|
| 1918 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF); |
---|
| 1919 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 1920 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 1921 | + { |
---|
| 1922 | + public void mouseClicked(MouseEvent e) |
---|
| 1923 | + { |
---|
| 1924 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 1925 | + cMaterial material = object.material; |
---|
| 1926 | + |
---|
| 1927 | + diffusenessField.setFloat(material.factor); |
---|
| 1928 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1929 | + |
---|
| 1930 | + materialtouched = true; |
---|
| 1931 | + applySelf(); |
---|
| 1932 | + } |
---|
| 1933 | + }); |
---|
| 1934 | + presetpanel.add(diffuse2); |
---|
| 1935 | + |
---|
| 1936 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF); |
---|
| 1937 | + diffusemoon.setToolTipText("Moon"); |
---|
| 1938 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 1939 | + { |
---|
| 1940 | + public void mouseClicked(MouseEvent e) |
---|
| 1941 | + { |
---|
| 1942 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 1943 | + cMaterial material = object.material; |
---|
| 1944 | + |
---|
| 1945 | + diffusenessField.setFloat(material.factor); |
---|
| 1946 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1947 | + |
---|
| 1948 | + materialtouched = true; |
---|
| 1949 | + applySelf(); |
---|
| 1950 | + } |
---|
| 1951 | + }); |
---|
| 1952 | + presetpanel.add(diffusemoon); |
---|
| 1953 | + |
---|
| 1954 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF); |
---|
| 1955 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 1956 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 1957 | + { |
---|
| 1958 | + public void mouseClicked(MouseEvent e) |
---|
| 1959 | + { |
---|
| 1960 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 1961 | + cMaterial material = object.material; |
---|
| 1962 | + |
---|
| 1963 | + diffusenessField.setFloat(material.factor); |
---|
| 1964 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1965 | + |
---|
| 1966 | + materialtouched = true; |
---|
| 1967 | + applySelf(); |
---|
| 1968 | + } |
---|
| 1969 | + }); |
---|
| 1970 | + presetpanel.add(diffusemoon2); |
---|
| 1971 | + |
---|
| 1972 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF); |
---|
| 1973 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 1974 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 1975 | + { |
---|
| 1976 | + public void mouseClicked(MouseEvent e) |
---|
| 1977 | + { |
---|
| 1978 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 1979 | + cMaterial material = object.material; |
---|
| 1980 | + |
---|
| 1981 | + diffusenessField.setFloat(material.factor); |
---|
| 1982 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1983 | + |
---|
| 1984 | + materialtouched = true; |
---|
| 1985 | + applySelf(); |
---|
| 1986 | + } |
---|
| 1987 | + }); |
---|
| 1988 | + presetpanel.add(diffusemoon3); |
---|
| 1989 | + |
---|
| 1990 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF); |
---|
| 1991 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 1992 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 1993 | + { |
---|
| 1994 | + public void mouseClicked(MouseEvent e) |
---|
| 1995 | + { |
---|
| 1996 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 1997 | + cMaterial material = object.material; |
---|
| 1998 | + |
---|
| 1999 | + sheenField.setFloat(material.sheen); |
---|
| 2000 | + |
---|
| 2001 | + materialtouched = true; |
---|
| 2002 | + applySelf(); |
---|
| 2003 | + } |
---|
| 2004 | + }); |
---|
| 2005 | + presetpanel.add(diffusesheen); |
---|
| 2006 | + |
---|
| 2007 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 2008 | + rough.setToolTipText("Rough metal"); |
---|
| 2009 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2010 | + { |
---|
| 2011 | + public void mouseClicked(MouseEvent e) |
---|
| 2012 | + { |
---|
| 2013 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2014 | + cMaterial material = object.material; |
---|
| 2015 | + |
---|
| 2016 | + shininessField.setFloat(material.shininess); |
---|
| 2017 | + velvetField.setFloat(material.velvet); |
---|
| 2018 | + |
---|
| 2019 | + materialtouched = true; |
---|
| 2020 | + applySelf(); |
---|
| 2021 | + } |
---|
| 2022 | + }); |
---|
| 2023 | + presetpanel.add(rough); |
---|
| 2024 | + |
---|
| 2025 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF); |
---|
| 2026 | + rough2.setToolTipText("Medium metal"); |
---|
| 2027 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2028 | + { |
---|
| 2029 | + public void mouseClicked(MouseEvent e) |
---|
| 2030 | + { |
---|
| 2031 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2032 | + cMaterial material = object.material; |
---|
| 2033 | + |
---|
| 2034 | + shininessField.setFloat(material.shininess); |
---|
| 2035 | + lightareaField.setFloat(material.lightarea); |
---|
| 2036 | + |
---|
| 2037 | + materialtouched = true; |
---|
| 2038 | + applySelf(); |
---|
| 2039 | + } |
---|
| 2040 | + }); |
---|
| 2041 | + presetpanel.add(rough2); |
---|
| 2042 | + |
---|
| 2043 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF); |
---|
| 2044 | + shini0.setToolTipText("Shiny"); |
---|
| 2045 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2046 | + { |
---|
| 2047 | + public void mouseClicked(MouseEvent e) |
---|
| 2048 | + { |
---|
| 2049 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2050 | + cMaterial material = object.material; |
---|
| 2051 | + |
---|
| 2052 | + shininessField.setFloat(material.shininess); |
---|
| 2053 | + lightareaField.setFloat(material.lightarea); |
---|
| 2054 | + |
---|
| 2055 | + materialtouched = true; |
---|
| 2056 | + applySelf(); |
---|
| 2057 | + } |
---|
| 2058 | + }); |
---|
| 2059 | + presetpanel.add(shini0); |
---|
| 2060 | + |
---|
| 2061 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF); |
---|
| 2062 | + shini1.setToolTipText("Shiny2"); |
---|
| 2063 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2064 | + { |
---|
| 2065 | + public void mouseClicked(MouseEvent e) |
---|
| 2066 | + { |
---|
| 2067 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2068 | + cMaterial material = object.material; |
---|
| 2069 | + |
---|
| 2070 | + shininessField.setFloat(material.shininess); |
---|
| 2071 | + lightareaField.setFloat(material.lightarea); |
---|
| 2072 | + |
---|
| 2073 | + materialtouched = true; |
---|
| 2074 | + applySelf(); |
---|
| 2075 | + } |
---|
| 2076 | + }); |
---|
| 2077 | + presetpanel.add(shini1); |
---|
| 2078 | + |
---|
| 2079 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF); |
---|
| 2080 | + shini2.setToolTipText("Shiny3"); |
---|
| 2081 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2082 | + { |
---|
| 2083 | + public void mouseClicked(MouseEvent e) |
---|
| 2084 | + { |
---|
| 2085 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2086 | + cMaterial material = object.material; |
---|
| 2087 | + |
---|
| 2088 | + shininessField.setFloat(material.shininess); |
---|
| 2089 | + lightareaField.setFloat(material.lightarea); |
---|
| 2090 | + |
---|
| 2091 | + materialtouched = true; |
---|
| 2092 | + applySelf(); |
---|
| 2093 | + } |
---|
| 2094 | + }); |
---|
| 2095 | + presetpanel.add(shini2); |
---|
| 2096 | + |
---|
| 2097 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF); |
---|
| 2098 | + aniso.setToolTipText("AnisoU"); |
---|
| 2099 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2100 | + { |
---|
| 2101 | + public void mouseClicked(MouseEvent e) |
---|
| 2102 | + { |
---|
| 2103 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2104 | + cMaterial material = object.material; |
---|
| 2105 | + |
---|
| 2106 | + anisoField.setFloat(material.aniso); |
---|
| 2107 | + anisoVField.setFloat(material.anisoV); |
---|
| 2108 | + |
---|
| 2109 | + materialtouched = true; |
---|
| 2110 | + applySelf(); |
---|
| 2111 | + } |
---|
| 2112 | + }); |
---|
| 2113 | + presetpanel.add(aniso); |
---|
| 2114 | + |
---|
| 2115 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF); |
---|
| 2116 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2117 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2118 | + { |
---|
| 2119 | + public void mouseClicked(MouseEvent e) |
---|
| 2120 | + { |
---|
| 2121 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2122 | + cMaterial material = object.material; |
---|
| 2123 | + |
---|
| 2124 | + anisoField.setFloat(material.aniso); |
---|
| 2125 | + anisoVField.setFloat(material.anisoV); |
---|
| 2126 | + |
---|
| 2127 | + materialtouched = true; |
---|
| 2128 | + applySelf(); |
---|
| 2129 | + } |
---|
| 2130 | + }); |
---|
| 2131 | + presetpanel.add(aniso2); |
---|
| 2132 | + |
---|
| 2133 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF); |
---|
| 2134 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2135 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2136 | + { |
---|
| 2137 | + public void mouseClicked(MouseEvent e) |
---|
| 2138 | + { |
---|
| 2139 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2140 | + cMaterial material = object.material; |
---|
| 2141 | + |
---|
| 2142 | + anisoField.setFloat(material.aniso); |
---|
| 2143 | + anisoVField.setFloat(material.anisoV); |
---|
| 2144 | + |
---|
| 2145 | + materialtouched = true; |
---|
| 2146 | + applySelf(); |
---|
| 2147 | + } |
---|
| 2148 | + }); |
---|
| 2149 | + presetpanel.add(aniso3); |
---|
| 2150 | + |
---|
| 2151 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF); |
---|
| 2152 | + velvet0.setToolTipText("Velvet"); |
---|
| 2153 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2154 | + { |
---|
| 2155 | + public void mouseClicked(MouseEvent e) |
---|
| 2156 | + { |
---|
| 2157 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2158 | + cMaterial material = object.material; |
---|
| 2159 | + |
---|
| 2160 | + diffusenessField.setFloat(material.factor); |
---|
| 2161 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2162 | + sheenField.setFloat(material.sheen); |
---|
| 2163 | + shininessField.setFloat(material.shininess); |
---|
| 2164 | + velvetField.setFloat(material.velvet); |
---|
| 2165 | + shiftField.setFloat(material.shift); |
---|
| 2166 | + |
---|
| 2167 | + materialtouched = true; |
---|
| 2168 | + applySelf(); |
---|
| 2169 | + } |
---|
| 2170 | + }); |
---|
| 2171 | + presetpanel.add(velvet0); |
---|
| 2172 | + |
---|
| 2173 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF); |
---|
| 2174 | + bump0.setToolTipText("Bump texture"); |
---|
| 2175 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2176 | + { |
---|
| 2177 | + public void mouseClicked(MouseEvent e) |
---|
| 2178 | + { |
---|
| 2179 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2180 | + cMaterial material = object.material; |
---|
| 2181 | + |
---|
| 2182 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2183 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2184 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2185 | + |
---|
| 2186 | + materialtouched = true; |
---|
| 2187 | + applySelf(); |
---|
| 2188 | + } |
---|
| 2189 | + }); |
---|
| 2190 | + presetpanel.add(bump0); |
---|
| 2191 | + |
---|
| 2192 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF); |
---|
| 2193 | + borderShader.setToolTipText("Border fade"); |
---|
| 2194 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2195 | + { |
---|
| 2196 | + public void mouseClicked(MouseEvent e) |
---|
| 2197 | + { |
---|
| 2198 | + borderfadeField.setFloat(0.5); |
---|
| 2199 | + opacityField.setFloat(0.6); |
---|
| 2200 | + |
---|
| 2201 | + materialtouched = true; |
---|
| 2202 | + applySelf(); |
---|
| 2203 | + } |
---|
| 2204 | + }); |
---|
| 2205 | + presetpanel.add(borderShader); |
---|
| 2206 | + |
---|
| 2207 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF); |
---|
| 2208 | + halo.setToolTipText("Halo"); |
---|
| 2209 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2210 | + { |
---|
| 2211 | + public void mouseClicked(MouseEvent e) |
---|
| 2212 | + { |
---|
| 2213 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2214 | + cMaterial material = object.material; |
---|
| 2215 | + |
---|
| 2216 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2217 | + |
---|
| 2218 | + materialtouched = true; |
---|
| 2219 | + applySelf(); |
---|
| 2220 | + } |
---|
| 2221 | + }); |
---|
| 2222 | + presetpanel.add(halo); |
---|
| 2223 | + |
---|
| 2224 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF); |
---|
| 2225 | + candle.setToolTipText("Candle"); |
---|
| 2226 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2227 | + { |
---|
| 2228 | + public void mouseClicked(MouseEvent e) |
---|
| 2229 | + { |
---|
| 2230 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2231 | + cMaterial material = object.material; |
---|
| 2232 | + |
---|
| 2233 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2234 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2235 | + ambientField.setFloat(material.ambient); |
---|
| 2236 | + specularField.setFloat(material.specular); |
---|
| 2237 | + lightareaField.setFloat(material.lightarea); |
---|
| 2238 | + shininessField.setFloat(material.shininess); |
---|
| 2239 | + |
---|
| 2240 | + materialtouched = true; |
---|
| 2241 | + applySelf(); |
---|
| 2242 | + } |
---|
| 2243 | + }); |
---|
| 2244 | + presetpanel.add(candle); |
---|
| 2245 | + |
---|
| 2246 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF); |
---|
| 2247 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2248 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2249 | + { |
---|
| 2250 | + public void mouseClicked(MouseEvent e) |
---|
| 2251 | + { |
---|
| 2252 | + diffuseField.setFloat(0.001); |
---|
| 2253 | + ambientField.setFloat(0.001); |
---|
| 2254 | + cameraField.setFloat(0.001); |
---|
| 2255 | + specularField.setFloat(0.001); |
---|
| 2256 | + fakedepthField.setFloat(0.001); |
---|
| 2257 | + opacityField.setFloat(0.6); |
---|
| 2258 | + |
---|
| 2259 | + materialtouched = true; |
---|
| 2260 | + applySelf(); |
---|
| 2261 | + } |
---|
| 2262 | + }); |
---|
| 2263 | + presetpanel.add(shadowShader); |
---|
| 2264 | + |
---|
| 2265 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2266 | + |
---|
| 2267 | + presetpanel.preferredWidth = 1; |
---|
| 2268 | + |
---|
| 2269 | + materialpanel.add(presetpanel); |
---|
| 2270 | + materialpanel.add(panel); |
---|
| 2271 | + |
---|
| 2272 | + panel.preferredWidth = 8; |
---|
| 2273 | + |
---|
| 2274 | + /* |
---|
1613 | 2275 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1614 | 2276 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1615 | | - */ |
---|
| 2277 | + */ |
---|
1616 | 2278 | |
---|
1617 | 2279 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1618 | 2280 | |
---|
.. | .. |
---|
1646 | 2308 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1647 | 2309 | |
---|
1648 | 2310 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 2311 | + |
---|
| 2312 | + cGridBag huepanel = new cGridBag(); |
---|
| 2313 | + cGridBag huelabel = new cGridBag(); |
---|
| 2314 | + skin = GetLabel("icons/hue.png", false); |
---|
| 2315 | + skin.fit = true; |
---|
| 2316 | + huelabel.add(skin); |
---|
| 2317 | + huelabel.preferredWidth = 20; |
---|
| 2318 | + huepanel.add(new cGridBag()); // Label |
---|
| 2319 | + huepanel.add(huelabel); // Field/slider |
---|
| 2320 | + |
---|
| 2321 | + huepanel.preferredHeight = 7; |
---|
| 2322 | + |
---|
| 2323 | + colorSection.add(huepanel); |
---|
1649 | 2324 | |
---|
1650 | 2325 | cGridBag color = new cGridBag(); |
---|
1651 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1652 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1653 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2326 | + |
---|
| 2327 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 2328 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2329 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2330 | + |
---|
1654 | 2331 | //colorField.preferredWidth = 200; |
---|
1655 | 2332 | colorSection.add(color); |
---|
1656 | 2333 | |
---|
1657 | 2334 | cGridBag modulation = new cGridBag(); |
---|
1658 | 2335 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1659 | 2336 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1660 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2337 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1661 | 2338 | colorSection.add(modulation); |
---|
1662 | 2339 | |
---|
| 2340 | + cGridBag opacity = new cGridBag(); |
---|
| 2341 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 2342 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2343 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2344 | + colorSection.add(opacity); |
---|
| 2345 | + |
---|
| 2346 | + colorSection.add(GetSeparator()); |
---|
| 2347 | + |
---|
1663 | 2348 | cGridBag texture = new cGridBag(); |
---|
1664 | 2349 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1665 | 2350 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1666 | 2351 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1667 | 2352 | colorSection.add(texture); |
---|
1668 | 2353 | |
---|
1669 | | - cGridBag anisoU = new cGridBag(); |
---|
1670 | | - anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
1671 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1672 | | - anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1673 | | - colorSection.add(anisoU); |
---|
1674 | | - |
---|
1675 | | - cGridBag anisoV = new cGridBag(); |
---|
1676 | | - anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
1677 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1678 | | - anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1679 | | - colorSection.add(anisoV); |
---|
1680 | | - |
---|
1681 | | - cGridBag shadowbias = new cGridBag(); |
---|
1682 | | - shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
1683 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1684 | | - shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1685 | | - colorSection.add(shadowbias); |
---|
1686 | | - |
---|
1687 | | - panel.add(new JSeparator()); |
---|
| 2354 | + panel.add(GetSeparator()); |
---|
1688 | 2355 | |
---|
1689 | 2356 | panel.add(colorSection); |
---|
1690 | 2357 | |
---|
.. | .. |
---|
1734 | 2401 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1735 | 2402 | diffuseSection.add(fakedepth); |
---|
1736 | 2403 | |
---|
1737 | | - panel.add(new JSeparator()); |
---|
| 2404 | + cGridBag shadowbias = new cGridBag(); |
---|
| 2405 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 2406 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2407 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2408 | + diffuseSection.add(shadowbias); |
---|
| 2409 | + |
---|
| 2410 | + panel.add(GetSeparator()); |
---|
1738 | 2411 | |
---|
1739 | 2412 | panel.add(diffuseSection); |
---|
1740 | 2413 | |
---|
.. | .. |
---|
1784 | 2457 | // aConstraints.gridy += 1; |
---|
1785 | 2458 | // aConstraints.gridwidth = 1; |
---|
1786 | 2459 | |
---|
| 2460 | + cGridBag anisoU = new cGridBag(); |
---|
| 2461 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 2462 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2463 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2464 | + specularSection.add(anisoU); |
---|
1787 | 2465 | |
---|
1788 | | - panel.add(new JSeparator()); |
---|
| 2466 | + cGridBag anisoV = new cGridBag(); |
---|
| 2467 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 2468 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2469 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2470 | + specularSection.add(anisoV); |
---|
| 2471 | + |
---|
| 2472 | + |
---|
| 2473 | + panel.add(GetSeparator()); |
---|
1789 | 2474 | |
---|
1790 | 2475 | panel.add(specularSection); |
---|
1791 | 2476 | |
---|
1792 | 2477 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1793 | 2478 | |
---|
1794 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 2479 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1795 | 2480 | |
---|
1796 | 2481 | cGridBag camera = new cGridBag(); |
---|
1797 | 2482 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1798 | 2483 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1799 | 2484 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1800 | | - globalSection.add(camera); |
---|
| 2485 | + colorSection.add(camera); |
---|
1801 | 2486 | |
---|
1802 | 2487 | cGridBag ambient = new cGridBag(); |
---|
1803 | 2488 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1804 | 2489 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1805 | 2490 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1806 | | - globalSection.add(ambient); |
---|
| 2491 | + colorSection.add(ambient); |
---|
1807 | 2492 | |
---|
1808 | 2493 | cGridBag backlit = new cGridBag(); |
---|
1809 | 2494 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1810 | 2495 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1811 | 2496 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1812 | | - globalSection.add(backlit); |
---|
| 2497 | + colorSection.add(backlit); |
---|
1813 | 2498 | |
---|
1814 | | - cGridBag opacity = new cGridBag(); |
---|
1815 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1816 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1817 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1818 | | - globalSection.add(opacity); |
---|
1819 | | - |
---|
1820 | | - panel.add(new JSeparator()); |
---|
| 2499 | + //panel.add(new JSeparator()); |
---|
1821 | 2500 | |
---|
1822 | | - panel.add(globalSection); |
---|
| 2501 | + //panel.add(globalSection); |
---|
1823 | 2502 | |
---|
1824 | 2503 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1825 | 2504 | |
---|
.. | .. |
---|
1861 | 2540 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1862 | 2541 | textureSection.add(opacityPower); |
---|
1863 | 2542 | |
---|
1864 | | - panel.add(new JSeparator()); |
---|
| 2543 | + panel.add(GetSeparator()); |
---|
1865 | 2544 | |
---|
1866 | 2545 | panel.add(textureSection); |
---|
1867 | 2546 | |
---|
.. | .. |
---|
1926 | 2605 | // 3D models |
---|
1927 | 2606 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1928 | 2607 | { |
---|
1929 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1930 | | - LoadFile(filename, lastConverter); |
---|
| 2608 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2609 | + //LoadFile(filename, lastConverter); |
---|
| 2610 | + LoadObjFile(filename); // New 3ds loader |
---|
1931 | 2611 | continue; |
---|
1932 | 2612 | } |
---|
1933 | 2613 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
2653 | 3333 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2654 | 3334 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2655 | 3335 | } |
---|
| 3336 | + |
---|
2656 | 3337 | //cJME.count++; |
---|
2657 | 3338 | //cJME.count %= 12; |
---|
2658 | 3339 | if (gc) |
---|
.. | .. |
---|
2836 | 3517 | } |
---|
2837 | 3518 | } |
---|
2838 | 3519 | } |
---|
| 3520 | + |
---|
2839 | 3521 | cFileSystemPane FSPane; |
---|
2840 | 3522 | |
---|
2841 | 3523 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2845 | 3527 | |
---|
2846 | 3528 | freezematerial = true; |
---|
2847 | 3529 | colorField.setFloat(mat.color); |
---|
2848 | | - modulationField.setFloat(mat.modulation); |
---|
| 3530 | + saturationField.setFloat(mat.modulation); |
---|
2849 | 3531 | metalnessField.setFloat(mat.metalness); |
---|
2850 | 3532 | diffuseField.setFloat(mat.diffuse); |
---|
2851 | 3533 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
2889 | 3571 | } |
---|
2890 | 3572 | } |
---|
2891 | 3573 | } |
---|
| 3574 | + |
---|
2892 | 3575 | freezematerial = false; |
---|
2893 | 3576 | } |
---|
2894 | 3577 | |
---|
.. | .. |
---|
2906 | 3589 | |
---|
2907 | 3590 | if (multiplyToggle != null) |
---|
2908 | 3591 | multiplyToggle.setSelected(mat.multiply); |
---|
2909 | | - |
---|
2910 | | - assert (object.projectedVertices != null); |
---|
2911 | | - |
---|
2912 | | - if (object.projectedVertices.length <= 2) |
---|
2913 | | - { |
---|
2914 | | - // Side effect... |
---|
2915 | | - Object3D.cVector2[] keep = object.projectedVertices; |
---|
2916 | | - object.projectedVertices = new Object3D.cVector2[3]; |
---|
2917 | | - for (int i = 0; i < 3; i++) |
---|
2918 | | - { |
---|
2919 | | - if (i < keep.length) |
---|
2920 | | - { |
---|
2921 | | - object.projectedVertices[i] = keep[i]; |
---|
2922 | | - } else |
---|
2923 | | - { |
---|
2924 | | - object.projectedVertices[i] = new Object3D.cVector2(); |
---|
2925 | | - } |
---|
2926 | | - /* |
---|
2927 | | - if(keep.length == 0) |
---|
2928 | | - object.projectedVertices[0] = new Object3D.cVector2(); |
---|
2929 | | - else |
---|
2930 | | - object.projectedVertices[0] = keep[0]; |
---|
2931 | | - object.projectedVertices[1] = new Object3D.cVector2(); |
---|
2932 | | - */ |
---|
2933 | | - } |
---|
2934 | | - } |
---|
| 3592 | + |
---|
| 3593 | + AllocProjectedVertices(object); |
---|
2935 | 3594 | |
---|
2936 | 3595 | SetMaterial(mat, object.projectedVertices); |
---|
2937 | 3596 | } |
---|
.. | .. |
---|
3007 | 3666 | // } |
---|
3008 | 3667 | |
---|
3009 | 3668 | /**/ |
---|
3010 | | - if (deselect) |
---|
| 3669 | + if (deselect || child == null) |
---|
3011 | 3670 | { |
---|
3012 | 3671 | //group.deselectAll(); |
---|
3013 | 3672 | //freeze = true; |
---|
3014 | 3673 | GetTree().clearSelection(); |
---|
3015 | 3674 | //freeze = false; |
---|
| 3675 | + |
---|
| 3676 | + if (child == null) |
---|
| 3677 | + { |
---|
| 3678 | + return; |
---|
| 3679 | + } |
---|
3016 | 3680 | } |
---|
3017 | 3681 | |
---|
3018 | 3682 | //group.addSelectee(child); |
---|
.. | .. |
---|
3046 | 3710 | public void itemStateChanged(ItemEvent event) |
---|
3047 | 3711 | { |
---|
3048 | 3712 | // System.out.println("Propagate = " + propagate); |
---|
| 3713 | + if (event.getSource() == pinButton) |
---|
| 3714 | + { |
---|
| 3715 | + copy.pinned ^= true; |
---|
| 3716 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3717 | + { |
---|
| 3718 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3719 | + copy.CloseUI(); |
---|
| 3720 | + //copy.editWindow.refreshContents(); |
---|
| 3721 | + } |
---|
| 3722 | + } |
---|
| 3723 | + else |
---|
3049 | 3724 | if (event.getSource() == propagateToggle) |
---|
3050 | 3725 | { |
---|
3051 | 3726 | propagate ^= true; |
---|
.. | .. |
---|
3150 | 3825 | } else if (event.getSource() == liveCB) |
---|
3151 | 3826 | { |
---|
3152 | 3827 | copy.live ^= true; |
---|
| 3828 | + objEditor.refreshContents(true); // To show item colors |
---|
3153 | 3829 | return; |
---|
3154 | | - } else if (event.getSource() == selectCB) |
---|
| 3830 | + } else if (event.getSource() == selectableCB) |
---|
3155 | 3831 | { |
---|
3156 | 3832 | copy.dontselect ^= true; |
---|
3157 | 3833 | return; |
---|
.. | .. |
---|
3159 | 3835 | { |
---|
3160 | 3836 | copy.hide ^= true; |
---|
3161 | 3837 | copy.Touch(); // display list issue |
---|
3162 | | - objEditor.refreshContents(); |
---|
| 3838 | + objEditor.refreshContents(true); // To show item colors |
---|
3163 | 3839 | return; |
---|
3164 | 3840 | } else if (event.getSource() == link2masterCB) |
---|
3165 | 3841 | { |
---|
.. | .. |
---|
3336 | 4012 | { |
---|
3337 | 4013 | Close(); |
---|
3338 | 4014 | //return true; |
---|
3339 | | - } else if (source == loadItem) |
---|
| 4015 | + } else if (source == openItem) |
---|
3340 | 4016 | { |
---|
3341 | | - load(); |
---|
| 4017 | + Open(); |
---|
3342 | 4018 | //return true; |
---|
3343 | 4019 | } else if (source == newItem) |
---|
3344 | 4020 | { |
---|
.. | .. |
---|
3363 | 4039 | { |
---|
3364 | 4040 | generatePOV(); |
---|
3365 | 4041 | //return true; |
---|
| 4042 | + } else if (event.getSource() == archiveItem) |
---|
| 4043 | + { |
---|
| 4044 | + cTools.Archive(frame); |
---|
| 4045 | + return; |
---|
3366 | 4046 | } else if (source == zBufferItem) |
---|
3367 | 4047 | { |
---|
3368 | 4048 | try |
---|
.. | .. |
---|
3411 | 4091 | |
---|
3412 | 4092 | static public byte[] Compress(Object3D o) |
---|
3413 | 4093 | { |
---|
| 4094 | + // Slower to actually compress. |
---|
3414 | 4095 | try |
---|
3415 | 4096 | { |
---|
3416 | 4097 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
3417 | | - java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3418 | | - ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 4098 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 4099 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
3419 | 4100 | |
---|
3420 | 4101 | Object3D parent = o.parent; |
---|
3421 | 4102 | o.parent = null; |
---|
.. | .. |
---|
3426 | 4107 | |
---|
3427 | 4108 | out.flush(); |
---|
3428 | 4109 | |
---|
3429 | | - zstream.close(); |
---|
| 4110 | + baos //zstream |
---|
| 4111 | + .close(); |
---|
3430 | 4112 | out.close(); |
---|
3431 | 4113 | |
---|
3432 | | - return baos.toByteArray(); |
---|
| 4114 | + byte[] bytes = baos.toByteArray(); |
---|
| 4115 | + |
---|
| 4116 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 4117 | + return bytes; |
---|
3433 | 4118 | } catch (Exception e) |
---|
3434 | 4119 | { |
---|
3435 | 4120 | System.err.println(e); |
---|
.. | .. |
---|
3439 | 4124 | |
---|
3440 | 4125 | static public Object Uncompress(byte[] bytes) |
---|
3441 | 4126 | { |
---|
3442 | | - System.out.println("#bytes = " + bytes.length); |
---|
| 4127 | + System.out.println("restore #bytes = " + bytes.length); |
---|
3443 | 4128 | try |
---|
3444 | 4129 | { |
---|
3445 | 4130 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
3446 | | - java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
3447 | | - ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 4131 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 4132 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
3448 | 4133 | Object obj = in.readObject(); |
---|
| 4134 | + |
---|
| 4135 | + bais //istream |
---|
| 4136 | + .close(); |
---|
3449 | 4137 | in.close(); |
---|
3450 | 4138 | |
---|
3451 | 4139 | return obj; |
---|
.. | .. |
---|
3500 | 4188 | return null; |
---|
3501 | 4189 | } |
---|
3502 | 4190 | |
---|
3503 | | - java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3504 | 4191 | |
---|
3505 | 4192 | public void Save() |
---|
3506 | 4193 | { |
---|
| 4194 | + //Save(true); |
---|
| 4195 | + Replace(); |
---|
| 4196 | + SetVersionStates(); |
---|
| 4197 | + } |
---|
| 4198 | + |
---|
| 4199 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 4200 | + { |
---|
| 4201 | + if (compress.length != name.length) |
---|
| 4202 | + { |
---|
| 4203 | + return false; |
---|
| 4204 | + } |
---|
| 4205 | + |
---|
| 4206 | + for (int i=compress.length; --i>=0;) |
---|
| 4207 | + { |
---|
| 4208 | + if (compress[i] != name[i]) |
---|
| 4209 | + return false; |
---|
| 4210 | + } |
---|
| 4211 | + |
---|
| 4212 | + return true; |
---|
| 4213 | + } |
---|
| 4214 | + |
---|
| 4215 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 4216 | + |
---|
| 4217 | + void DeleteVersion() |
---|
| 4218 | + { |
---|
| 4219 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4220 | + { |
---|
| 4221 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4222 | + } |
---|
| 4223 | + |
---|
| 4224 | + CopyChanged(); |
---|
| 4225 | + |
---|
| 4226 | + SetVersionStates(); |
---|
| 4227 | + } |
---|
| 4228 | + |
---|
| 4229 | + public boolean Save(boolean user) |
---|
| 4230 | + { |
---|
3507 | 4231 | System.err.println("Save"); |
---|
| 4232 | + Replace(); |
---|
3508 | 4233 | |
---|
3509 | | - cRadio tab = GetCurrentTab(); |
---|
| 4234 | + //cRadio tab = GetCurrentTab(); |
---|
3510 | 4235 | |
---|
3511 | | - boolean temp = CameraPane.SWITCH; |
---|
3512 | | - CameraPane.SWITCH = false; |
---|
| 4236 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
3513 | 4237 | |
---|
3514 | | - copy.ExtractBigData(hashtable); |
---|
| 4238 | + boolean thesame = false; |
---|
| 4239 | + |
---|
| 4240 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4241 | +// { |
---|
| 4242 | +// thesame = true; |
---|
| 4243 | +// } |
---|
3515 | 4244 | |
---|
3516 | 4245 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3517 | | - tab.graphs[tab.undoindex++] = Compress(copy); |
---|
3518 | | - |
---|
3519 | | - copy.RestoreBigData(hashtable); |
---|
3520 | | - |
---|
3521 | | - CameraPane.SWITCH = temp; |
---|
3522 | | - |
---|
3523 | | - //assert(hashtable.isEmpty()); |
---|
3524 | | - |
---|
3525 | | - for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 4246 | + if (!thesame) |
---|
3526 | 4247 | { |
---|
3527 | | - tab.graphs[i] = null; |
---|
| 4248 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4249 | + { |
---|
| 4250 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4251 | + } |
---|
| 4252 | + |
---|
| 4253 | + //tab.user[tab.versionindex] = user; |
---|
| 4254 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 4255 | + |
---|
| 4256 | + copy.versionlist[++copy.versionindex] = compress; |
---|
| 4257 | + |
---|
| 4258 | + // if (increment) |
---|
| 4259 | + // tab.versionindex++; |
---|
3528 | 4260 | } |
---|
3529 | 4261 | |
---|
| 4262 | + //copy.RestoreBigData(versiontable); |
---|
| 4263 | + |
---|
| 4264 | + //assert(hashtable.isEmpty()); |
---|
| 4265 | + |
---|
| 4266 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4267 | +// { |
---|
| 4268 | +// //tab.user[i] = false; |
---|
| 4269 | +// copy.versionlist[i] = null; |
---|
| 4270 | +// } |
---|
| 4271 | + |
---|
| 4272 | + SetVersionStates(); |
---|
| 4273 | + |
---|
3530 | 4274 | // test save |
---|
3531 | 4275 | if (false) |
---|
3532 | 4276 | { |
---|
3533 | 4277 | try |
---|
3534 | 4278 | { |
---|
3535 | | - FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 4279 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
3536 | 4280 | ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
3537 | 4281 | |
---|
3538 | 4282 | p.writeObject(copy); |
---|
.. | .. |
---|
3545 | 4289 | e.printStackTrace(); |
---|
3546 | 4290 | } |
---|
3547 | 4291 | } |
---|
| 4292 | + |
---|
| 4293 | + return !thesame; |
---|
| 4294 | + } |
---|
| 4295 | + |
---|
| 4296 | + boolean flashIt = true; |
---|
| 4297 | + |
---|
| 4298 | + void RefreshSelection() |
---|
| 4299 | + { |
---|
| 4300 | + Object3D selection = new Object3D(); |
---|
| 4301 | + |
---|
| 4302 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4303 | + { |
---|
| 4304 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 4305 | + |
---|
| 4306 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4307 | + |
---|
| 4308 | + if (obj == null) |
---|
| 4309 | + { |
---|
| 4310 | + copy.selection.remove(i--); |
---|
| 4311 | + } |
---|
| 4312 | + else |
---|
| 4313 | + { |
---|
| 4314 | + selection.add(obj); |
---|
| 4315 | + copy.selection.setElementAt(obj, i); |
---|
| 4316 | + } |
---|
| 4317 | + } |
---|
| 4318 | + |
---|
| 4319 | + flashIt = false; |
---|
| 4320 | + GetTree().clearSelection(); |
---|
| 4321 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4322 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4323 | + flashIt = true; |
---|
| 4324 | + |
---|
| 4325 | + //refreshContents(false); |
---|
3548 | 4326 | } |
---|
3549 | 4327 | |
---|
3550 | | - void CopyChanged(Object3D obj) |
---|
| 4328 | + void CopyChanged() |
---|
3551 | 4329 | { |
---|
| 4330 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4331 | + |
---|
| 4332 | + SetVersionStates(); |
---|
| 4333 | + |
---|
3552 | 4334 | boolean temp = CameraPane.SWITCH; |
---|
3553 | 4335 | CameraPane.SWITCH = false; |
---|
3554 | 4336 | |
---|
3555 | | - copy.ExtractBigData(hashtable); |
---|
| 4337 | + copy.ExtractBigData(versiontable); |
---|
3556 | 4338 | |
---|
3557 | 4339 | copy.clear(); |
---|
3558 | 4340 | |
---|
| 4341 | + copy.skyboxname = obj.skyboxname; |
---|
| 4342 | + copy.skyboxext = obj.skyboxext; |
---|
| 4343 | + |
---|
3559 | 4344 | for (int i=0; i<obj.Size(); i++) |
---|
3560 | 4345 | { |
---|
3561 | 4346 | copy.add(obj.get(i)); |
---|
3562 | 4347 | } |
---|
3563 | 4348 | |
---|
3564 | | - copy.RestoreBigData(hashtable); |
---|
| 4349 | + copy.RestoreBigData(versiontable); |
---|
3565 | 4350 | |
---|
3566 | 4351 | CameraPane.SWITCH = temp; |
---|
3567 | 4352 | |
---|
| 4353 | + RefreshSelection(); |
---|
3568 | 4354 | //assert(hashtable.isEmpty()); |
---|
3569 | 4355 | |
---|
3570 | 4356 | copy.Touch(); |
---|
.. | .. |
---|
3585 | 4371 | } |
---|
3586 | 4372 | } |
---|
3587 | 4373 | |
---|
3588 | | - refreshContents(); |
---|
| 4374 | + refreshContents(true); |
---|
3589 | 4375 | } |
---|
3590 | 4376 | |
---|
3591 | | - public void Undo() |
---|
| 4377 | + cButton previousVersionButton; |
---|
| 4378 | + cButton restoreButton; |
---|
| 4379 | + cButton replaceButton; |
---|
| 4380 | + cButton nextVersionButton; |
---|
| 4381 | + cButton saveVersionButton; |
---|
| 4382 | + cButton deleteVersionButton; |
---|
| 4383 | + |
---|
| 4384 | + boolean muteSlider; |
---|
| 4385 | + |
---|
| 4386 | + int VersionCount() |
---|
3592 | 4387 | { |
---|
| 4388 | + int count = 0; |
---|
| 4389 | + |
---|
| 4390 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
| 4391 | + { |
---|
| 4392 | + if (copy.versionlist[i] != null) |
---|
| 4393 | + count++; |
---|
| 4394 | + } |
---|
| 4395 | + |
---|
| 4396 | + return count; |
---|
| 4397 | + } |
---|
| 4398 | + |
---|
| 4399 | + void SetVersionStates() |
---|
| 4400 | + { |
---|
| 4401 | + //if (true) |
---|
| 4402 | + // return; |
---|
| 4403 | + |
---|
| 4404 | + //cRadio tab = GetCurrentTab(); |
---|
| 4405 | + |
---|
| 4406 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 4407 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 4408 | + |
---|
| 4409 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4410 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4411 | + |
---|
| 4412 | + deleteVersionButton.setEnabled(//copy.versionindex > 0 && |
---|
| 4413 | + copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4414 | + |
---|
| 4415 | + muteSlider = true; |
---|
| 4416 | + versionSlider.setMinimum(0); |
---|
| 4417 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4418 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4419 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
| 4420 | + muteSlider = false; |
---|
| 4421 | + } |
---|
| 4422 | + |
---|
| 4423 | + public boolean PreviousVersion() |
---|
| 4424 | + { |
---|
| 4425 | + // Option? |
---|
| 4426 | + Replace(); |
---|
| 4427 | + |
---|
3593 | 4428 | System.err.println("Undo"); |
---|
3594 | 4429 | |
---|
3595 | | - cRadio tab = GetCurrentTab(); |
---|
| 4430 | + //cRadio tab = GetCurrentTab(); |
---|
3596 | 4431 | |
---|
3597 | | - if (tab.undoindex == 0) |
---|
| 4432 | + if (copy.versionindex == 0) |
---|
3598 | 4433 | { |
---|
3599 | 4434 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3600 | | - return; |
---|
| 4435 | + return false; |
---|
3601 | 4436 | } |
---|
3602 | 4437 | |
---|
3603 | | - if (tab.graphs[tab.undoindex] == null) |
---|
3604 | | - { |
---|
3605 | | - Save(); |
---|
3606 | | - tab.undoindex -= 1; |
---|
3607 | | - } |
---|
| 4438 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 4439 | +// { |
---|
| 4440 | +// if (Save(false)) |
---|
| 4441 | +// tab.versionindex -= 1; |
---|
| 4442 | +// else |
---|
| 4443 | +// { |
---|
| 4444 | +// if (tab.versionindex <= 0) |
---|
| 4445 | +// return false; |
---|
| 4446 | +// else |
---|
| 4447 | +// tab.versionindex -= 1; |
---|
| 4448 | +// } |
---|
| 4449 | +// } |
---|
3608 | 4450 | |
---|
3609 | | - tab.undoindex -= 1; |
---|
| 4451 | + copy.versionindex -= 1; |
---|
3610 | 4452 | |
---|
3611 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 4453 | + CopyChanged(); |
---|
| 4454 | + |
---|
| 4455 | + return true; |
---|
3612 | 4456 | } |
---|
3613 | 4457 | |
---|
3614 | | - public void Redo() |
---|
| 4458 | + public boolean Restore() |
---|
3615 | 4459 | { |
---|
3616 | | - cRadio tab = GetCurrentTab(); |
---|
| 4460 | + System.err.println("Restore"); |
---|
3617 | 4461 | |
---|
3618 | | - if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 4462 | + //cRadio tab = GetCurrentTab(); |
---|
| 4463 | + |
---|
| 4464 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4465 | + { |
---|
| 4466 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4467 | + return false; |
---|
| 4468 | + } |
---|
| 4469 | + |
---|
| 4470 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4471 | + CopyChanged(); |
---|
| 4472 | + |
---|
| 4473 | + return true; |
---|
| 4474 | + } |
---|
| 4475 | + |
---|
| 4476 | + public boolean Replace() |
---|
| 4477 | + { |
---|
| 4478 | + System.err.println("Replace"); |
---|
| 4479 | + |
---|
| 4480 | + //cRadio tab = GetCurrentTab(); |
---|
| 4481 | + |
---|
| 4482 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4483 | + { |
---|
| 4484 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4485 | + return false; |
---|
| 4486 | + } |
---|
| 4487 | + |
---|
| 4488 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
| 4489 | + |
---|
| 4490 | + return true; |
---|
| 4491 | + } |
---|
| 4492 | + |
---|
| 4493 | + public void NextVersion() |
---|
| 4494 | + { |
---|
| 4495 | + // Option? |
---|
| 4496 | + Replace(); |
---|
| 4497 | + |
---|
| 4498 | + //cRadio tab = GetCurrentTab(); |
---|
| 4499 | + |
---|
| 4500 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3619 | 4501 | { |
---|
3620 | 4502 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3621 | 4503 | return; |
---|
3622 | 4504 | } |
---|
3623 | 4505 | |
---|
3624 | | - tab.undoindex += 1; |
---|
| 4506 | + copy.versionindex += 1; |
---|
3625 | 4507 | |
---|
3626 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 4508 | + CopyChanged(); |
---|
| 4509 | + |
---|
| 4510 | + //if (!tab.user[tab.versionindex]) |
---|
| 4511 | + // tab.graphs[tab.versionindex] = null; |
---|
3627 | 4512 | } |
---|
3628 | 4513 | |
---|
3629 | 4514 | void ImportGFD() |
---|
.. | .. |
---|
3834 | 4719 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
3835 | 4720 | |
---|
3836 | 4721 | current.color = (float) colorField.getFloat(); |
---|
3837 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4722 | + current.modulation = (float) saturationField.getFloat(); |
---|
3838 | 4723 | current.metalness = (float) metalnessField.getFloat(); |
---|
3839 | 4724 | current.diffuse = (float) diffuseField.getFloat(); |
---|
3840 | 4725 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
3867 | 4752 | cMaterial mat = copy.material; |
---|
3868 | 4753 | |
---|
3869 | 4754 | colorField.SetToolTipValue((mat.color)); |
---|
3870 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
| 4755 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
3871 | 4756 | metalnessField.SetToolTipValue((mat.metalness)); |
---|
3872 | 4757 | diffuseField.SetToolTipValue((mat.diffuse)); |
---|
3873 | 4758 | specularField.SetToolTipValue((mat.specular)); |
---|
.. | .. |
---|
3919 | 4804 | //copy.Touch(); |
---|
3920 | 4805 | } |
---|
3921 | 4806 | |
---|
| 4807 | + cNumberSlider versionSlider; |
---|
| 4808 | + |
---|
3922 | 4809 | public void stateChanged(ChangeEvent e) |
---|
3923 | 4810 | { |
---|
3924 | 4811 | // assert(false); |
---|
| 4812 | + if (e.getSource() == versionSlider) |
---|
| 4813 | + { |
---|
| 4814 | + if (muteSlider) |
---|
| 4815 | + return; |
---|
| 4816 | + |
---|
| 4817 | + Replace(); |
---|
| 4818 | + |
---|
| 4819 | + int version = versionSlider.getInteger(); |
---|
| 4820 | + |
---|
| 4821 | + if (version != -1 && copy.versionlist[version] != null) |
---|
| 4822 | + { |
---|
| 4823 | + copy.versionindex = version; |
---|
| 4824 | + CopyChanged(); |
---|
| 4825 | + } |
---|
| 4826 | + |
---|
| 4827 | + return; |
---|
| 4828 | + } |
---|
3925 | 4829 | |
---|
3926 | 4830 | if (freezematerial) |
---|
3927 | 4831 | { |
---|
.. | .. |
---|
3957 | 4861 | { |
---|
3958 | 4862 | //System.out.println("stateChanged = " + this); |
---|
3959 | 4863 | materialtouched = true; |
---|
| 4864 | + |
---|
| 4865 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4866 | + { |
---|
| 4867 | + saturationField.setFloat(1); |
---|
| 4868 | + } |
---|
| 4869 | + |
---|
3960 | 4870 | applySelf(); |
---|
3961 | 4871 | //System.out.println("this = " + this); |
---|
3962 | 4872 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
4256 | 5166 | { |
---|
4257 | 5167 | if (GetTree() != null) |
---|
4258 | 5168 | { |
---|
| 5169 | + GetTree().revalidate(); |
---|
4259 | 5170 | GetTree().repaint(); |
---|
4260 | 5171 | } |
---|
4261 | 5172 | |
---|
.. | .. |
---|
4264 | 5175 | ctrlPanel.validate(); // ? new |
---|
4265 | 5176 | ctrlPanel.repaint(); |
---|
4266 | 5177 | } |
---|
| 5178 | + |
---|
| 5179 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5180 | + SetVersionStates(); |
---|
4267 | 5181 | } |
---|
4268 | 5182 | |
---|
4269 | 5183 | static TweenManager tweenManager = new TweenManager(); |
---|
4270 | 5184 | |
---|
4271 | 5185 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4272 | 5186 | { |
---|
4273 | | - if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 5187 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
4274 | 5188 | Save(); |
---|
4275 | 5189 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4276 | 5190 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
.. | .. |
---|
4512 | 5426 | readobj.ResetDisplayList(); |
---|
4513 | 5427 | } catch (Exception e) |
---|
4514 | 5428 | { |
---|
4515 | | - //e.printStackTrace(); |
---|
| 5429 | + if (!e.toString().contains("GZIP")) |
---|
| 5430 | + e.printStackTrace(); |
---|
| 5431 | + |
---|
4516 | 5432 | try |
---|
4517 | 5433 | { |
---|
4518 | 5434 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4586 | 5502 | |
---|
4587 | 5503 | if (readobj != null) |
---|
4588 | 5504 | { |
---|
4589 | | - if (Globals.SAVEONMAKE) |
---|
4590 | | - Save(); |
---|
| 5505 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 5506 | + // Save(); |
---|
4591 | 5507 | try |
---|
4592 | 5508 | { |
---|
4593 | 5509 | //readobj.deepCopySelf(copy); |
---|
4594 | 5510 | copy.clear(); // june 2014 |
---|
| 5511 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5512 | + copy.skyboxext = readobj.skyboxext; |
---|
4595 | 5513 | for (int i = 0; i < readobj.size(); i++) |
---|
4596 | 5514 | { |
---|
4597 | 5515 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4632 | 5550 | } |
---|
4633 | 5551 | } catch (ClassCastException e) |
---|
4634 | 5552 | { |
---|
| 5553 | + e.printStackTrace(); |
---|
4635 | 5554 | assert (false); |
---|
4636 | 5555 | Composite c = (Composite) copy; |
---|
4637 | 5556 | c.children.clear(); |
---|
.. | .. |
---|
4642 | 5561 | c.addChild(csg); |
---|
4643 | 5562 | } |
---|
4644 | 5563 | |
---|
| 5564 | + copy.versionlist = readobj.versionlist; |
---|
| 5565 | + copy.versionindex = readobj.versionindex; |
---|
| 5566 | + |
---|
| 5567 | + if (copy.versionlist == null) |
---|
| 5568 | + { |
---|
| 5569 | + // Backward compatibility |
---|
| 5570 | + copy.versionlist = new Object3D[100]; |
---|
| 5571 | + copy.versionindex = -1; |
---|
| 5572 | + |
---|
| 5573 | + //Save(true); |
---|
| 5574 | + } |
---|
| 5575 | + |
---|
| 5576 | + //? SetUndoStates(); |
---|
| 5577 | + |
---|
4645 | 5578 | ResetModel(); |
---|
4646 | 5579 | copy.HardTouch(); // recompile? |
---|
4647 | 5580 | refreshContents(); |
---|
4648 | 5581 | } |
---|
4649 | 5582 | } |
---|
4650 | 5583 | |
---|
4651 | | - void load() // throws ClassNotFoundException |
---|
| 5584 | + void Open() // throws ClassNotFoundException |
---|
4652 | 5585 | { |
---|
4653 | 5586 | if (Grafreed.standAlone) |
---|
4654 | 5587 | { |
---|
4655 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5588 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4656 | 5589 | browser.show(); |
---|
4657 | 5590 | String filename = browser.getFile(); |
---|
4658 | 5591 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4729 | 5662 | |
---|
4730 | 5663 | void save() |
---|
4731 | 5664 | { |
---|
| 5665 | + Replace(); |
---|
| 5666 | + |
---|
4732 | 5667 | if (lastname == null) |
---|
4733 | 5668 | { |
---|
4734 | 5669 | return; |
---|
.. | .. |
---|
4751 | 5686 | //ps.print(buffer.toString()); |
---|
4752 | 5687 | } catch (IOException e) |
---|
4753 | 5688 | { |
---|
| 5689 | + e.printStackTrace(); |
---|
4754 | 5690 | } |
---|
4755 | 5691 | } |
---|
4756 | 5692 | |
---|
.. | .. |
---|
4765 | 5701 | String filename = browser.getFile(); |
---|
4766 | 5702 | if (filename != null && filename.length() > 0) |
---|
4767 | 5703 | { |
---|
| 5704 | + if (!filename.endsWith(".gfd")) |
---|
| 5705 | + filename += ".gfd"; |
---|
4768 | 5706 | lastname = browser.getDirectory() + filename; |
---|
4769 | 5707 | save(); |
---|
4770 | 5708 | } |
---|
.. | .. |
---|
4931 | 5869 | MenuBar menuBar; |
---|
4932 | 5870 | Menu fileMenu; |
---|
4933 | 5871 | MenuItem newItem; |
---|
4934 | | - MenuItem loadItem; |
---|
| 5872 | + MenuItem openItem; |
---|
4935 | 5873 | MenuItem saveItem; |
---|
4936 | 5874 | MenuItem saveAsItem; |
---|
4937 | 5875 | MenuItem exportAsItem; |
---|
.. | .. |
---|
4954 | 5892 | CheckboxMenuItem toggleSwitchItem; |
---|
4955 | 5893 | CheckboxMenuItem toggleRootItem; |
---|
4956 | 5894 | CheckboxMenuItem animationItem; |
---|
| 5895 | + MenuItem archiveItem; |
---|
4957 | 5896 | CheckboxMenuItem toggleHandleItem; |
---|
4958 | 5897 | CheckboxMenuItem togglePaintItem; |
---|
4959 | 5898 | JSplitPane mainPanel; |
---|
.. | .. |
---|
4967 | 5906 | ButtonGroup buttonGroup; |
---|
4968 | 5907 | |
---|
4969 | 5908 | cGridBag toolboxPanel; |
---|
| 5909 | + cGridBag skyboxPanel; |
---|
4970 | 5910 | cGridBag materialPanel; |
---|
4971 | 5911 | cGridBag ctrlPanel; |
---|
4972 | 5912 | |
---|
.. | .. |
---|
5040 | 5980 | JLabel colorLabel; |
---|
5041 | 5981 | cNumberSlider colorField; |
---|
5042 | 5982 | JLabel modulationLabel; |
---|
5043 | | - cNumberSlider modulationField; |
---|
| 5983 | + cNumberSlider saturationField; |
---|
5044 | 5984 | JLabel metalnessLabel; |
---|
5045 | 5985 | cNumberSlider metalnessField; |
---|
5046 | 5986 | JLabel diffuseLabel; |
---|
.. | .. |
---|
5071 | 6011 | cNumberSlider anisoField; |
---|
5072 | 6012 | JLabel anisoVLabel; |
---|
5073 | 6013 | cNumberSlider anisoVField; |
---|
| 6014 | + |
---|
5074 | 6015 | JLabel cameraLabel; |
---|
5075 | 6016 | cNumberSlider cameraField; |
---|
5076 | 6017 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
5085 | 6026 | cNumberSlider fakedepthField; |
---|
5086 | 6027 | JLabel shadowbiasLabel; |
---|
5087 | 6028 | cNumberSlider shadowbiasField; |
---|
| 6029 | + |
---|
5088 | 6030 | JLabel bumpLabel; |
---|
5089 | 6031 | cNumberSlider bumpField; |
---|
5090 | 6032 | JLabel noiseLabel; |
---|