.. | .. |
---|
4 | 4 | |
---|
5 | 5 | import java.awt.*; |
---|
6 | 6 | import java.awt.event.*; |
---|
| 7 | +import java.awt.image.BufferedImage; |
---|
7 | 8 | import javax.swing.*; |
---|
8 | 9 | import javax.swing.event.*; |
---|
9 | 10 | import javax.swing.text.*; |
---|
.. | .. |
---|
13 | 14 | import javax.swing.plaf.metal.MetalLookAndFeel; |
---|
14 | 15 | //import javax.swing.plaf.ColorUIResource; |
---|
15 | 16 | //import javax.swing.plaf.metal.DefaultMetalTheme; |
---|
| 17 | + |
---|
| 18 | +import javax.swing.plaf.basic.BasicSplitPaneDivider; |
---|
| 19 | +import javax.swing.plaf.basic.BasicSplitPaneUI; |
---|
16 | 20 | |
---|
17 | 21 | //import javax.media.opengl.GLCanvas; |
---|
18 | 22 | |
---|
.. | .. |
---|
30 | 34 | iSendInfo |
---|
31 | 35 | //KeyListener |
---|
32 | 36 | { |
---|
| 37 | + public cToggleButton pinButton; |
---|
33 | 38 | boolean timeline; |
---|
34 | 39 | boolean wasFullScreen; |
---|
35 | 40 | |
---|
36 | 41 | GroupEditor callee; |
---|
37 | 42 | JFrame frame; |
---|
| 43 | + |
---|
| 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 | + } |
---|
| 82 | + |
---|
| 83 | + cButton GetButton(String name, boolean border) |
---|
| 84 | + { |
---|
| 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); |
---|
| 93 | + } |
---|
| 94 | + |
---|
| 95 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 96 | + { |
---|
| 97 | + ImageIcon icon = GetIcon(name); |
---|
| 98 | + return new cToggleButton(icon, border); |
---|
| 99 | + } |
---|
| 100 | + |
---|
| 101 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 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 | + |
---|
| 117 | + try |
---|
| 118 | + { |
---|
| 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; |
---|
| 138 | + } |
---|
| 139 | + catch (Exception e) |
---|
| 140 | + { |
---|
| 141 | + //icons.put(name, null); |
---|
| 142 | + return null; |
---|
| 143 | + } |
---|
| 144 | + } |
---|
| 145 | + |
---|
| 146 | + BufferedImage GetImage(String name) |
---|
| 147 | + { |
---|
| 148 | + try |
---|
| 149 | + { |
---|
| 150 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 151 | + |
---|
| 152 | + return image; |
---|
| 153 | + } |
---|
| 154 | + catch (Exception e) |
---|
| 155 | + { |
---|
| 156 | + return null; |
---|
| 157 | + } |
---|
| 158 | + } |
---|
38 | 159 | |
---|
39 | 160 | // SCRIPT |
---|
40 | 161 | |
---|
.. | .. |
---|
145 | 266 | |
---|
146 | 267 | objEditor.ctrlPanel.remove(namePanel); |
---|
147 | 268 | |
---|
148 | | - if (!GroupEditor.allparams) |
---|
| 269 | + if (!allparams) |
---|
149 | 270 | return; |
---|
150 | 271 | |
---|
151 | 272 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
168 | 289 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
169 | 290 | |
---|
170 | 291 | objEditor.ctrlPanel.remove(setupPanel); |
---|
171 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 292 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 293 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
172 | 294 | objEditor.ctrlPanel.remove(pushPanel); |
---|
173 | 295 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
174 | 296 | |
---|
.. | .. |
---|
216 | 338 | client = inClient; |
---|
217 | 339 | copy = client; |
---|
218 | 340 | |
---|
| 341 | +// if (copy.versionlist == null) |
---|
| 342 | +// { |
---|
| 343 | +// copy.versionlist = new Object3D[100]; |
---|
| 344 | +// copy.versionindex = -1; |
---|
| 345 | +// |
---|
| 346 | +// callee.Save(true); |
---|
| 347 | +// } |
---|
| 348 | + |
---|
219 | 349 | // "this" is not called: SetupUI2(objEditor); |
---|
220 | 350 | } |
---|
221 | 351 | |
---|
.. | .. |
---|
229 | 359 | client = inClient; |
---|
230 | 360 | copy = client; |
---|
231 | 361 | |
---|
| 362 | + if (copy.versionlist == null) |
---|
| 363 | + { |
---|
| 364 | + copy.versionlist = new Object3D[100]; |
---|
| 365 | + copy.versionindex = -1; |
---|
| 366 | + |
---|
| 367 | +// Save(true); |
---|
| 368 | + } |
---|
| 369 | + |
---|
232 | 370 | SetupUI2(callee.GetEditor()); |
---|
233 | 371 | } |
---|
234 | 372 | |
---|
.. | .. |
---|
243 | 381 | //localCopy.parent = null; |
---|
244 | 382 | |
---|
245 | 383 | frame = new JFrame(); |
---|
| 384 | + frame.setUndecorated(false); |
---|
246 | 385 | objEditor = this; |
---|
247 | 386 | this.callee = callee; |
---|
248 | 387 | |
---|
249 | 388 | //parent = p; |
---|
250 | 389 | |
---|
251 | 390 | GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
---|
252 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 391 | + if (Globals.DEBUG) |
---|
| 392 | + System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
253 | 393 | //gd.setFullScreenWindow(this); |
---|
254 | 394 | //setResizable(false); |
---|
255 | 395 | //if (!isDisplayable()) |
---|
.. | .. |
---|
260 | 400 | copy = localCopy; |
---|
261 | 401 | copy.editWindow = this; |
---|
262 | 402 | |
---|
| 403 | +// if (copy.versionlist == null) |
---|
| 404 | +// { |
---|
| 405 | +// copy.versionlist = new Object3D[100]; |
---|
| 406 | +// copy.versionindex = -1; |
---|
| 407 | +// |
---|
| 408 | +// Save(true); |
---|
| 409 | +// } |
---|
| 410 | + |
---|
263 | 411 | SetupMenu(); |
---|
264 | 412 | |
---|
265 | 413 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
273 | 421 | return frame.action(event, obj); |
---|
274 | 422 | } |
---|
275 | 423 | |
---|
| 424 | + // Cannot work without static |
---|
| 425 | + static boolean allparams = true; |
---|
| 426 | + |
---|
| 427 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 428 | + |
---|
276 | 429 | void SetupMenu() |
---|
277 | 430 | { |
---|
278 | 431 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
279 | 432 | menuBar.add(fileMenu = new Menu("File")); |
---|
280 | 433 | fileMenu.add(newItem = new MenuItem("New")); |
---|
281 | | - fileMenu.add(loadItem = new MenuItem("Load...")); |
---|
| 434 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
282 | 435 | |
---|
283 | 436 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
284 | 437 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
310 | 463 | } |
---|
311 | 464 | |
---|
312 | 465 | newItem.addActionListener(this); |
---|
313 | | - loadItem.addActionListener(this); |
---|
| 466 | + openItem.addActionListener(this); |
---|
314 | 467 | saveItem.addActionListener(this); |
---|
315 | 468 | saveAsItem.addActionListener(this); |
---|
316 | 469 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
319 | 472 | closeItem.addActionListener(this); |
---|
320 | 473 | |
---|
321 | 474 | objectPanel = new JTabbedPane(); |
---|
| 475 | + |
---|
| 476 | + ChangeListener changeListener = new ChangeListener() |
---|
| 477 | + { |
---|
| 478 | + //String name; |
---|
| 479 | + |
---|
| 480 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 481 | + { |
---|
| 482 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 483 | +// { |
---|
| 484 | +// if (latestObject != null) |
---|
| 485 | +// { |
---|
| 486 | +// refreshContents(true); |
---|
| 487 | +// SetMaterial(latestObject); |
---|
| 488 | +// } |
---|
| 489 | +// |
---|
| 490 | +// materialFlushed = true; |
---|
| 491 | +// } |
---|
| 492 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 493 | +// { |
---|
| 494 | +// if (listUI.size() == 0) |
---|
| 495 | +// EditSelection(false); |
---|
| 496 | +// } |
---|
| 497 | + |
---|
| 498 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 499 | +// { |
---|
| 500 | +// name = copy.skyboxname; |
---|
| 501 | +// |
---|
| 502 | +// if (name == null) |
---|
| 503 | +// { |
---|
| 504 | +// name = ""; |
---|
| 505 | +// } |
---|
| 506 | +// |
---|
| 507 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 508 | +// copy.skyboxext = "jpg"; |
---|
| 509 | +// } |
---|
| 510 | +// else |
---|
| 511 | +// { |
---|
| 512 | +// if (name != null) |
---|
| 513 | +// { |
---|
| 514 | +// if (name.equals("")) |
---|
| 515 | +// { |
---|
| 516 | +// copy.skyboxname = null; |
---|
| 517 | +// copy.skyboxext = null; |
---|
| 518 | +// } |
---|
| 519 | +// else |
---|
| 520 | +// { |
---|
| 521 | +// copy.skyboxname = name; |
---|
| 522 | +// } |
---|
| 523 | +// } |
---|
| 524 | +// } |
---|
| 525 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 526 | + |
---|
| 527 | +// refreshContents(false); // To refresh Info tab |
---|
| 528 | + cameraView.repaint(); |
---|
| 529 | + } |
---|
| 530 | + }; |
---|
| 531 | + objectPanel.addChangeListener(changeListener); |
---|
| 532 | + |
---|
322 | 533 | toolbarPanel = new JPanel(); |
---|
323 | 534 | toolbarPanel.setName("Toolbar"); |
---|
| 535 | + |
---|
324 | 536 | treePanel = new cGridBag(); |
---|
325 | 537 | treePanel.setName("Tree"); |
---|
| 538 | + |
---|
| 539 | + editPanel = new cGridBag().setVertical(true); |
---|
| 540 | + //editPanel.setName("Edit"); |
---|
| 541 | + |
---|
326 | 542 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
327 | | - ctrlPanel.setName("Edit"); |
---|
328 | | - materialPanel = new cGridBag().setVertical(true); |
---|
329 | | - materialPanel.setName("Material"); |
---|
| 543 | + |
---|
| 544 | + editCommandsPanel = new cGridBag(); |
---|
| 545 | + editPanel.add(editCommandsPanel); |
---|
| 546 | + editPanel.add(ctrlPanel); |
---|
| 547 | + |
---|
| 548 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 549 | + //toolboxPanel.setName("Toolbox"); |
---|
| 550 | + |
---|
| 551 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 552 | + |
---|
| 553 | + materialPanel = new cGridBag().setVertical(false); |
---|
| 554 | + //materialPanel.setName("Material"); |
---|
| 555 | + |
---|
330 | 556 | /*JTextPane*/ |
---|
331 | 557 | infoarea = createTextPane(); |
---|
332 | 558 | doc = infoarea.getStyledDocument(); |
---|
333 | 559 | |
---|
334 | 560 | infoarea.setEditable(true); |
---|
335 | 561 | SetText(); |
---|
| 562 | + |
---|
336 | 563 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
337 | 564 | // infoarea.setOpaque(false); |
---|
338 | 565 | // //infoarea.setForeground(textcolor); |
---|
339 | 566 | // TEXTAREA infoarea.setLineWrap(true); |
---|
340 | 567 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
341 | 568 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
342 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
343 | | - infoPanel.setName("Info"); |
---|
| 569 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
| 570 | + //infoPanel.setName("Info"); |
---|
344 | 571 | //infoPanel.setLayout(new BorderLayout()); |
---|
345 | 572 | //infoPanel.add(createTextPane()); |
---|
346 | 573 | |
---|
.. | .. |
---|
351 | 578 | mainPanel.setDividerSize(9); |
---|
352 | 579 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
353 | 580 | mainPanel.setResizeWeight(0.5); |
---|
354 | | - |
---|
| 581 | + |
---|
| 582 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 583 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 584 | + divider.setDividerSize(15); |
---|
| 585 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 586 | + |
---|
| 587 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 588 | + |
---|
355 | 589 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
356 | 590 | //mainPanel.setLayout(new GridBagLayout()); |
---|
357 | 591 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
419 | 653 | e.printStackTrace(); |
---|
420 | 654 | } |
---|
421 | 655 | |
---|
422 | | - String selection = infoarea.getText(); |
---|
423 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
424 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
425 | | - Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
| 656 | +// String selection = infoarea.getText(); |
---|
| 657 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 658 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 659 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
426 | 660 | //clipboard.setContents(data, data); |
---|
427 | 661 | } |
---|
428 | 662 | |
---|
.. | .. |
---|
582 | 816 | } |
---|
583 | 817 | } |
---|
584 | 818 | |
---|
| 819 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 820 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 821 | + |
---|
| 822 | + Rectangle keeprect; |
---|
| 823 | + cRadio radio; |
---|
| 824 | + |
---|
| 825 | +cButton keepButton; |
---|
| 826 | + cButton twoButton; // Full 3D |
---|
| 827 | + cButton sixButton; |
---|
| 828 | + cButton threeButton; |
---|
| 829 | + cButton sevenButton; |
---|
| 830 | + cButton fourButton; // full panel |
---|
| 831 | + cButton oneButton; // full XYZ |
---|
| 832 | + //cButton currentLayout; |
---|
| 833 | + |
---|
| 834 | + boolean maximized; |
---|
| 835 | + |
---|
| 836 | + cButton fullscreenLayout; |
---|
| 837 | + cButton expandedLayout; |
---|
| 838 | + |
---|
| 839 | + void Minimize() |
---|
| 840 | + { |
---|
| 841 | + frame.setState(Frame.ICONIFIED); |
---|
| 842 | + frame.validate(); |
---|
| 843 | + } |
---|
| 844 | + |
---|
| 845 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 846 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 847 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
| 848 | + void Maximize() |
---|
| 849 | + { |
---|
| 850 | + if (CameraPane.FULLSCREEN) |
---|
| 851 | + { |
---|
| 852 | + ToggleFullScreen(); |
---|
| 853 | + } |
---|
| 854 | + |
---|
| 855 | + if (maximized) |
---|
| 856 | + { |
---|
| 857 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 858 | + } |
---|
| 859 | + else |
---|
| 860 | + { |
---|
| 861 | + keeprect = frame.getBounds(); |
---|
| 862 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 863 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 864 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 865 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 866 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
| 867 | + } |
---|
| 868 | + |
---|
| 869 | + maximized ^= true; |
---|
| 870 | + |
---|
| 871 | + frame.validate(); |
---|
| 872 | + } |
---|
| 873 | + |
---|
| 874 | + cButton minButton; |
---|
| 875 | + cButton maxButton; |
---|
| 876 | + cButton fullButton; |
---|
| 877 | + cButton collapseButton; |
---|
| 878 | + cButton maximize3DButton; |
---|
| 879 | + |
---|
585 | 880 | void ToggleFullScreen() |
---|
586 | 881 | { |
---|
587 | | - if (CameraPane.FULLSCREEN) |
---|
| 882 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 883 | + |
---|
| 884 | + cameraView.ToggleFullScreen(); |
---|
| 885 | + |
---|
| 886 | + if (!CameraPane.FULLSCREEN) |
---|
588 | 887 | { |
---|
589 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
590 | | - framePanel.add(bigThree); |
---|
591 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 888 | + device.setFullScreenWindow(null); |
---|
| 889 | + frame.dispose(); |
---|
| 890 | + frame.setUndecorated(false); |
---|
| 891 | + frame.validate(); |
---|
| 892 | + frame.setVisible(true); |
---|
| 893 | + |
---|
| 894 | + //frame.setVisible(false); |
---|
| 895 | +// frame.removeNotify(); |
---|
| 896 | +// frame.setUndecorated(false); |
---|
| 897 | +// frame.addNotify(); |
---|
| 898 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 899 | + |
---|
| 900 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 901 | +// X framePanel.add(bigThree); |
---|
| 902 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 903 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
| 904 | + |
---|
| 905 | + //frame.setVisible(true); |
---|
| 906 | +// radio.layout = keepButton; |
---|
| 907 | + //theFrame = null; |
---|
| 908 | + keepButton = null; |
---|
| 909 | +// radio.layout.doClick(); |
---|
| 910 | + |
---|
592 | 911 | } else |
---|
593 | 912 | { |
---|
594 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
595 | | - framePanel.remove(bigThree); |
---|
596 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 913 | + keepButton = radio.layout; |
---|
| 914 | + //keeprect = frame.getBounds(); |
---|
| 915 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 916 | +// frame.getToolkit().getScreenSize().height); |
---|
| 917 | + //frame.setVisible(false); |
---|
| 918 | + |
---|
| 919 | + frame.dispose(); |
---|
| 920 | + frame.setUndecorated(true); |
---|
| 921 | + device.setFullScreenWindow(frame); |
---|
| 922 | + frame.validate(); |
---|
| 923 | + frame.setVisible(true); |
---|
| 924 | +// frame.removeNotify(); |
---|
| 925 | +// frame.setUndecorated(true); |
---|
| 926 | +// frame.addNotify(); |
---|
| 927 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 928 | +// X framePanel.remove(bigThree); |
---|
| 929 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 930 | +// framePanel.setDividerLocation(0); |
---|
| 931 | + |
---|
| 932 | +// radio.layout = fullscreenLayout; |
---|
| 933 | +// radio.layout.doClick(); |
---|
| 934 | + //frame.setVisible(true); |
---|
597 | 935 | } |
---|
598 | | - cameraView.ToggleFullScreen(); |
---|
| 936 | + frame.validate(); |
---|
| 937 | + |
---|
| 938 | + cameraView.requestFocusInWindow(); |
---|
599 | 939 | } |
---|
| 940 | + |
---|
| 941 | + void CollapseToolbar() |
---|
| 942 | + { |
---|
| 943 | + framePanel.setDividerLocation(0); |
---|
| 944 | + //frame.validate(); |
---|
| 945 | + |
---|
| 946 | + cameraView.requestFocusInWindow(); |
---|
| 947 | + } |
---|
| 948 | + |
---|
| 949 | + private Object3D Duplicate(Object3D object) |
---|
| 950 | + { |
---|
| 951 | + boolean temp = CameraPane.SWITCH; |
---|
| 952 | + CameraPane.SWITCH = false; |
---|
| 953 | + |
---|
| 954 | + if (Grafreed.grafreed.universe.versiontable == null) |
---|
| 955 | + Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 956 | + |
---|
| 957 | + object.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 958 | + // if (copy == client) |
---|
| 959 | + |
---|
| 960 | + Object3D versions[] = object.versionlist; |
---|
| 961 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe |
---|
| 962 | + object.versionlist = null; |
---|
| 963 | + object.versiontable = null; |
---|
| 964 | + |
---|
| 965 | + //byte[] compress = Compress(copy); |
---|
| 966 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
| 967 | + |
---|
| 968 | + object.versionlist = versions; |
---|
| 969 | + object.versiontable = versiontable; // if Grafreed.grafreed.universe |
---|
| 970 | + |
---|
| 971 | + object.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 972 | + |
---|
| 973 | + CameraPane.SWITCH = temp; |
---|
| 974 | + |
---|
| 975 | + return compress; |
---|
| 976 | + } |
---|
600 | 977 | |
---|
601 | 978 | private JTextPane createTextPane() |
---|
602 | 979 | { |
---|
.. | .. |
---|
719 | 1096 | { |
---|
720 | 1097 | SetupMaterial(materialPanel); |
---|
721 | 1098 | } |
---|
| 1099 | + |
---|
722 | 1100 | //SetupName(); |
---|
723 | 1101 | //SetupViews(); |
---|
724 | 1102 | } |
---|
.. | .. |
---|
728 | 1106 | // NumberSlider vDivsField; |
---|
729 | 1107 | // JCheckBox endcaps; |
---|
730 | 1108 | JCheckBox liveCB; |
---|
731 | | - JCheckBox selectCB; |
---|
| 1109 | + JCheckBox selectableCB; |
---|
732 | 1110 | JCheckBox hideCB; |
---|
733 | 1111 | JCheckBox link2masterCB; |
---|
734 | 1112 | JCheckBox markCB; |
---|
.. | .. |
---|
736 | 1114 | JCheckBox speedupCB; |
---|
737 | 1115 | JCheckBox rewindCB; |
---|
738 | 1116 | JCheckBox flipVCB; |
---|
| 1117 | + |
---|
| 1118 | + cCheckBox toggleTextureCB; |
---|
| 1119 | + cCheckBox toggleSwitchCB; |
---|
| 1120 | + |
---|
739 | 1121 | JComboBox texresMenu; |
---|
| 1122 | + |
---|
740 | 1123 | JButton resetButton; |
---|
741 | 1124 | JButton stepButton; |
---|
742 | 1125 | JButton stepAllButton; |
---|
.. | .. |
---|
745 | 1128 | JButton fasterButton; |
---|
746 | 1129 | JButton remarkButton; |
---|
747 | 1130 | |
---|
| 1131 | + cGridBag editPanel; |
---|
| 1132 | + cGridBag editCommandsPanel; |
---|
| 1133 | + |
---|
748 | 1134 | cGridBag namePanel; |
---|
749 | 1135 | cGridBag setupPanel; |
---|
750 | | - cGridBag commandsPanel; |
---|
| 1136 | + cGridBag setupPanel2; |
---|
| 1137 | + cGridBag objectCommandsPanel; |
---|
751 | 1138 | cGridBag pushPanel; |
---|
752 | 1139 | cGridBag fillPanel; |
---|
753 | 1140 | |
---|
.. | .. |
---|
918 | 1305 | |
---|
919 | 1306 | namePanel = new cGridBag(); |
---|
920 | 1307 | |
---|
| 1308 | + //if (copy.pinned) |
---|
| 1309 | + { |
---|
| 1310 | + pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF); |
---|
| 1311 | + pinButton.setSelected(copy.pinned); |
---|
| 1312 | + cGridBag t = new cGridBag(); |
---|
| 1313 | + t.preferredWidth = 2; |
---|
| 1314 | + t.add(pinButton); |
---|
| 1315 | + namePanel.add(t); |
---|
| 1316 | + |
---|
| 1317 | + pinButton.addItemListener(this); |
---|
| 1318 | + } |
---|
| 1319 | + |
---|
921 | 1320 | nameField = AddText(namePanel, copy.GetName()); |
---|
922 | | - namePanel.add(nameField); |
---|
| 1321 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
923 | 1322 | oe.ctrlPanel.add(namePanel); |
---|
924 | 1323 | |
---|
925 | 1324 | oe.ctrlPanel.Return(); |
---|
926 | 1325 | |
---|
927 | | - if (!GroupEditor.allparams) |
---|
| 1326 | + if (!allparams) |
---|
928 | 1327 | return; |
---|
929 | 1328 | |
---|
930 | 1329 | setupPanel = new cGridBag().setVertical(false); |
---|
931 | 1330 | |
---|
932 | 1331 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
933 | 1332 | liveCB.setToolTipText("Animate object"); |
---|
934 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
935 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1333 | + markCB = AddCheckBox(setupPanel, "Anim", copy.marked); |
---|
| 1334 | + markCB.setToolTipText("Set target transform"); |
---|
| 1335 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1336 | + selectableCB.setToolTipText("Make object selectable"); |
---|
936 | 1337 | // Return(); |
---|
| 1338 | + |
---|
937 | 1339 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
938 | 1340 | hideCB.setToolTipText("Hide object"); |
---|
939 | | - markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
940 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
941 | 1341 | |
---|
942 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1342 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
| 1343 | + |
---|
| 1344 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1345 | + |
---|
| 1346 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
943 | 1347 | rewindCB.setToolTipText("Rewind animation"); |
---|
944 | 1348 | |
---|
945 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
946 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1349 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1350 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
947 | 1351 | |
---|
| 1352 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1353 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1354 | + |
---|
948 | 1355 | if (Globals.ADVANCED) |
---|
949 | 1356 | { |
---|
950 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
951 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
952 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1357 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
953 | 1358 | speedupCB.setToolTipText("Option motion capture"); |
---|
954 | 1359 | } |
---|
955 | 1360 | |
---|
956 | 1361 | oe.ctrlPanel.add(setupPanel); |
---|
957 | 1362 | oe.ctrlPanel.Return(); |
---|
| 1363 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1364 | + oe.ctrlPanel.Return(); |
---|
958 | 1365 | |
---|
959 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1366 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
960 | 1367 | |
---|
961 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1368 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
962 | 1369 | resetButton.setToolTipText("Jump to frame zero"); |
---|
963 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1370 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
964 | 1371 | stepButton.setToolTipText("Step one frame"); |
---|
965 | 1372 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
966 | 1373 | // stepAllButton = AddButton(oe, "Step All"); |
---|
967 | 1374 | // Return(); |
---|
968 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1375 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
969 | 1376 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
970 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1377 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
971 | 1378 | fasterButton.setToolTipText("Increase animation speed"); |
---|
972 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1379 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
973 | 1380 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
974 | 1381 | |
---|
975 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1382 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
976 | 1383 | oe.ctrlPanel.Return(); |
---|
977 | 1384 | |
---|
978 | 1385 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1132 | 1539 | |
---|
1133 | 1540 | if (cam == null || !(copy.get(0) instanceof cGroup)) |
---|
1134 | 1541 | { |
---|
| 1542 | + if (Globals.DEBUG) |
---|
1135 | 1543 | System.out.println("CREATE CAMERAS"); |
---|
1136 | 1544 | cams = new cTemplate(); |
---|
1137 | 1545 | cams.name = "Cameras"; |
---|
.. | .. |
---|
1178 | 1586 | //worldPanel.setName("World"); |
---|
1179 | 1587 | centralPanel = new cGridBag(); |
---|
1180 | 1588 | centralPanel.preferredWidth = 20; |
---|
1181 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1182 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1589 | + |
---|
| 1590 | + if (Globals.ADVANCED) |
---|
| 1591 | + { |
---|
| 1592 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1593 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1183 | 1594 | |
---|
1184 | 1595 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1185 | 1596 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1188 | 1599 | // cameraPanel.setDividerSize(9); |
---|
1189 | 1600 | cameraPanel.setResizeWeight(1.0); |
---|
1190 | 1601 | |
---|
| 1602 | + } |
---|
| 1603 | + |
---|
1191 | 1604 | centralPanel.add(cameraView); |
---|
| 1605 | + centralPanel.setFocusable(true); |
---|
1192 | 1606 | //frame.setJMenuBar(timelineMenubar); |
---|
1193 | 1607 | //centralPanel.add(timelinePanel); |
---|
1194 | 1608 | |
---|
.. | .. |
---|
1214 | 1628 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1215 | 1629 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1216 | 1630 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1631 | + //XYZPanel.setName("XYZ"); |
---|
1217 | 1632 | |
---|
1218 | 1633 | /* |
---|
1219 | 1634 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1250 | 1665 | |
---|
1251 | 1666 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1252 | 1667 | //tmp.setName("Edit"); |
---|
| 1668 | + objectPanel.add(toolboxPanel); |
---|
| 1669 | + objectPanel.setIconAt(0, GetIcon("icons/primitives.png")); |
---|
| 1670 | + objectPanel.setToolTipTextAt(0, "Objects & textures"); |
---|
| 1671 | + |
---|
1253 | 1672 | objectPanel.add(materialPanel); |
---|
| 1673 | + objectPanel.setIconAt(1, GetIcon("icons/material.png")); |
---|
| 1674 | + objectPanel.setToolTipTextAt(1, "Material"); |
---|
| 1675 | + |
---|
| 1676 | + objectPanel.add(skyboxPanel); |
---|
| 1677 | + objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
| 1678 | + objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
| 1679 | + |
---|
1254 | 1680 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1255 | 1681 | // north.setName("Edit"); |
---|
1256 | 1682 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1257 | 1683 | // objectPanel.add(north); |
---|
1258 | | - objectPanel.add(ctrlPanel); |
---|
1259 | | - objectPanel.add(infoPanel); |
---|
1260 | | - |
---|
| 1684 | + objectPanel.add(editPanel); |
---|
| 1685 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1686 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
| 1687 | + |
---|
| 1688 | + objectPanel.add(XYZPanel); |
---|
| 1689 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1690 | + objectPanel.setToolTipTextAt(4, "XYZ/RGB transform"); |
---|
| 1691 | + |
---|
1261 | 1692 | /* |
---|
1262 | 1693 | aConstraints.gridx = 0; |
---|
1263 | 1694 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1265 | 1696 | aConstraints.gridy += 1; |
---|
1266 | 1697 | aConstraints.gridwidth = 1; |
---|
1267 | 1698 | mainPanel.add(objectPanel, aConstraints); |
---|
1268 | | - */ |
---|
| 1699 | + */ |
---|
1269 | 1700 | |
---|
1270 | 1701 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1271 | 1702 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1277 | 1708 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1278 | 1709 | |
---|
1279 | 1710 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1280 | | - scenePanel.preferredWidth = 6; |
---|
| 1711 | + scenePanel.preferredWidth = 5; |
---|
1281 | 1712 | |
---|
1282 | 1713 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1283 | 1714 | tabbedPane.add(scrollpane); |
---|
1284 | 1715 | |
---|
1285 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1286 | | - |
---|
1287 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1716 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1288 | 1717 | |
---|
1289 | 1718 | optionsPanel.setName("Options"); |
---|
1290 | 1719 | |
---|
.. | .. |
---|
1292 | 1721 | |
---|
1293 | 1722 | tabbedPane.add(optionsPanel); |
---|
1294 | 1723 | |
---|
| 1724 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1725 | + |
---|
1295 | 1726 | scenePanel.add(tabbedPane); |
---|
1296 | 1727 | |
---|
| 1728 | + //if (Globals.ADVANCED) |
---|
| 1729 | +// tabbedPane.add(infoPanel); |
---|
| 1730 | +// tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
| 1731 | +// tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1732 | + |
---|
1297 | 1733 | /* |
---|
1298 | 1734 | cTree jTree = new cTree(null); |
---|
1299 | 1735 | ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
.. | .. |
---|
1355 | 1791 | bigThree = new cGridBag(); |
---|
1356 | 1792 | bigThree.addComponent(scenePanel); |
---|
1357 | 1793 | bigThree.addComponent(centralPanel); |
---|
1358 | | - bigThree.addComponent(XYZPanel); |
---|
| 1794 | + //bigThree.addComponent(XYZPanel); |
---|
1359 | 1795 | |
---|
1360 | 1796 | // // SIDE EFFECT!!! |
---|
1361 | 1797 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1364 | 1800 | // aConstraints.gridheight = 1; |
---|
1365 | 1801 | |
---|
1366 | 1802 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1367 | | - framePanel.setContinuousLayout(true); |
---|
1368 | | - framePanel.setOneTouchExpandable(true); |
---|
1369 | | - framePanel.setDividerLocation(0.8); |
---|
| 1803 | + |
---|
| 1804 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1805 | + new java.beans.PropertyChangeListener() |
---|
| 1806 | + { |
---|
| 1807 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1808 | + { |
---|
| 1809 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1810 | + { |
---|
| 1811 | + if (radio.layout != expandedLayout) |
---|
| 1812 | + { |
---|
| 1813 | + radio.layout = expandedLayout; |
---|
| 1814 | + radio.layout.doClick(); |
---|
| 1815 | + } |
---|
| 1816 | + } |
---|
| 1817 | + } |
---|
| 1818 | + }); |
---|
| 1819 | + |
---|
| 1820 | + framePanel.setContinuousLayout(false); |
---|
| 1821 | + framePanel.setOneTouchExpandable(false); |
---|
| 1822 | + //.setDividerLocation(0.8); |
---|
1370 | 1823 | //framePanel.setDividerSize(15); |
---|
1371 | 1824 | //framePanel.setResizeWeight(0.15); |
---|
1372 | 1825 | framePanel.setName("Frame"); |
---|
1373 | 1826 | |
---|
1374 | 1827 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1375 | 1828 | /**/ |
---|
1376 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1829 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1377 | 1830 | //worldPane.add(bigPanel); |
---|
1378 | 1831 | //worldPane.add(worldPanel); |
---|
1379 | 1832 | /**/ |
---|
.. | .. |
---|
1384 | 1837 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1385 | 1838 | |
---|
1386 | 1839 | frame.setSize(1280, 860); |
---|
1387 | | - frame.setVisible(true); |
---|
1388 | | - |
---|
| 1840 | + |
---|
| 1841 | + cameraView.requestFocusInWindow(); |
---|
| 1842 | + |
---|
1389 | 1843 | gridPanel.setDividerLocation(1.0); |
---|
| 1844 | + |
---|
| 1845 | + frame.validate(); |
---|
| 1846 | + |
---|
| 1847 | + frame.setVisible(true); |
---|
1390 | 1848 | |
---|
1391 | 1849 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1392 | 1850 | frame.addWindowListener(new WindowAdapter() |
---|
1393 | 1851 | { |
---|
1394 | | - |
---|
1395 | 1852 | public void windowClosing(WindowEvent e) |
---|
1396 | 1853 | { |
---|
1397 | 1854 | Close(); |
---|
.. | .. |
---|
1414 | 1871 | ctrlPanel.removeAll(); |
---|
1415 | 1872 | } |
---|
1416 | 1873 | |
---|
1417 | | - void SetupMaterial(cGridBag panel) |
---|
| 1874 | + void SetupMaterial(cGridBag materialpanel) |
---|
1418 | 1875 | { |
---|
1419 | | - /* |
---|
| 1876 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1877 | + |
---|
| 1878 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1879 | + skin.setToolTipText("Skin"); |
---|
| 1880 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1881 | + { |
---|
| 1882 | + public void mouseClicked(MouseEvent e) |
---|
| 1883 | + { |
---|
| 1884 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1885 | + cMaterial material = object.material; |
---|
| 1886 | + |
---|
| 1887 | + // Skin |
---|
| 1888 | + colorField.setFloat(material.color); |
---|
| 1889 | + saturationField.setFloat(material.modulation); |
---|
| 1890 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1891 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1892 | + diffusenessField.setFloat(material.factor); |
---|
| 1893 | + shininessField.setFloat(material.shininess); |
---|
| 1894 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1895 | + diffuseField.setFloat(material.diffuse); |
---|
| 1896 | + specularField.setFloat(material.specular); |
---|
| 1897 | + |
---|
| 1898 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1899 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1900 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1901 | + |
---|
| 1902 | + materialtouched = true; |
---|
| 1903 | + applySelf(); |
---|
| 1904 | + } |
---|
| 1905 | + }); |
---|
| 1906 | + presetpanel.add(skin); |
---|
| 1907 | + |
---|
| 1908 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF); |
---|
| 1909 | + lambert.setToolTipText("Diffuse"); |
---|
| 1910 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 1911 | + { |
---|
| 1912 | + public void mouseClicked(MouseEvent e) |
---|
| 1913 | + { |
---|
| 1914 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 1915 | + cMaterial material = object.material; |
---|
| 1916 | + |
---|
| 1917 | + diffusenessField.setFloat(material.factor); |
---|
| 1918 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1919 | + |
---|
| 1920 | + materialtouched = true; |
---|
| 1921 | + applySelf(); |
---|
| 1922 | + } |
---|
| 1923 | + }); |
---|
| 1924 | + presetpanel.add(lambert); |
---|
| 1925 | + |
---|
| 1926 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF); |
---|
| 1927 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 1928 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 1929 | + { |
---|
| 1930 | + public void mouseClicked(MouseEvent e) |
---|
| 1931 | + { |
---|
| 1932 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 1933 | + cMaterial material = object.material; |
---|
| 1934 | + |
---|
| 1935 | + diffusenessField.setFloat(material.factor); |
---|
| 1936 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1937 | + |
---|
| 1938 | + materialtouched = true; |
---|
| 1939 | + applySelf(); |
---|
| 1940 | + } |
---|
| 1941 | + }); |
---|
| 1942 | + presetpanel.add(diffuse2); |
---|
| 1943 | + |
---|
| 1944 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF); |
---|
| 1945 | + diffusemoon.setToolTipText("Moon"); |
---|
| 1946 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 1947 | + { |
---|
| 1948 | + public void mouseClicked(MouseEvent e) |
---|
| 1949 | + { |
---|
| 1950 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 1951 | + cMaterial material = object.material; |
---|
| 1952 | + |
---|
| 1953 | + diffusenessField.setFloat(material.factor); |
---|
| 1954 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1955 | + |
---|
| 1956 | + materialtouched = true; |
---|
| 1957 | + applySelf(); |
---|
| 1958 | + } |
---|
| 1959 | + }); |
---|
| 1960 | + presetpanel.add(diffusemoon); |
---|
| 1961 | + |
---|
| 1962 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF); |
---|
| 1963 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 1964 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 1965 | + { |
---|
| 1966 | + public void mouseClicked(MouseEvent e) |
---|
| 1967 | + { |
---|
| 1968 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 1969 | + cMaterial material = object.material; |
---|
| 1970 | + |
---|
| 1971 | + diffusenessField.setFloat(material.factor); |
---|
| 1972 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1973 | + |
---|
| 1974 | + materialtouched = true; |
---|
| 1975 | + applySelf(); |
---|
| 1976 | + } |
---|
| 1977 | + }); |
---|
| 1978 | + presetpanel.add(diffusemoon2); |
---|
| 1979 | + |
---|
| 1980 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF); |
---|
| 1981 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 1982 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 1983 | + { |
---|
| 1984 | + public void mouseClicked(MouseEvent e) |
---|
| 1985 | + { |
---|
| 1986 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 1987 | + cMaterial material = object.material; |
---|
| 1988 | + |
---|
| 1989 | + diffusenessField.setFloat(material.factor); |
---|
| 1990 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1991 | + |
---|
| 1992 | + materialtouched = true; |
---|
| 1993 | + applySelf(); |
---|
| 1994 | + } |
---|
| 1995 | + }); |
---|
| 1996 | + presetpanel.add(diffusemoon3); |
---|
| 1997 | + |
---|
| 1998 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF); |
---|
| 1999 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 2000 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 2001 | + { |
---|
| 2002 | + public void mouseClicked(MouseEvent e) |
---|
| 2003 | + { |
---|
| 2004 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 2005 | + cMaterial material = object.material; |
---|
| 2006 | + |
---|
| 2007 | + sheenField.setFloat(material.sheen); |
---|
| 2008 | + |
---|
| 2009 | + materialtouched = true; |
---|
| 2010 | + applySelf(); |
---|
| 2011 | + } |
---|
| 2012 | + }); |
---|
| 2013 | + presetpanel.add(diffusesheen); |
---|
| 2014 | + |
---|
| 2015 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 2016 | + rough.setToolTipText("Rough metal"); |
---|
| 2017 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2018 | + { |
---|
| 2019 | + public void mouseClicked(MouseEvent e) |
---|
| 2020 | + { |
---|
| 2021 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2022 | + cMaterial material = object.material; |
---|
| 2023 | + |
---|
| 2024 | + shininessField.setFloat(material.shininess); |
---|
| 2025 | + velvetField.setFloat(material.velvet); |
---|
| 2026 | + |
---|
| 2027 | + materialtouched = true; |
---|
| 2028 | + applySelf(); |
---|
| 2029 | + } |
---|
| 2030 | + }); |
---|
| 2031 | + presetpanel.add(rough); |
---|
| 2032 | + |
---|
| 2033 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF); |
---|
| 2034 | + rough2.setToolTipText("Medium metal"); |
---|
| 2035 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2036 | + { |
---|
| 2037 | + public void mouseClicked(MouseEvent e) |
---|
| 2038 | + { |
---|
| 2039 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2040 | + cMaterial material = object.material; |
---|
| 2041 | + |
---|
| 2042 | + shininessField.setFloat(material.shininess); |
---|
| 2043 | + lightareaField.setFloat(material.lightarea); |
---|
| 2044 | + |
---|
| 2045 | + materialtouched = true; |
---|
| 2046 | + applySelf(); |
---|
| 2047 | + } |
---|
| 2048 | + }); |
---|
| 2049 | + presetpanel.add(rough2); |
---|
| 2050 | + |
---|
| 2051 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF); |
---|
| 2052 | + shini0.setToolTipText("Shiny"); |
---|
| 2053 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2054 | + { |
---|
| 2055 | + public void mouseClicked(MouseEvent e) |
---|
| 2056 | + { |
---|
| 2057 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2058 | + cMaterial material = object.material; |
---|
| 2059 | + |
---|
| 2060 | + shininessField.setFloat(material.shininess); |
---|
| 2061 | + lightareaField.setFloat(material.lightarea); |
---|
| 2062 | + |
---|
| 2063 | + materialtouched = true; |
---|
| 2064 | + applySelf(); |
---|
| 2065 | + } |
---|
| 2066 | + }); |
---|
| 2067 | + presetpanel.add(shini0); |
---|
| 2068 | + |
---|
| 2069 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF); |
---|
| 2070 | + shini1.setToolTipText("Shiny2"); |
---|
| 2071 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2072 | + { |
---|
| 2073 | + public void mouseClicked(MouseEvent e) |
---|
| 2074 | + { |
---|
| 2075 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2076 | + cMaterial material = object.material; |
---|
| 2077 | + |
---|
| 2078 | + shininessField.setFloat(material.shininess); |
---|
| 2079 | + lightareaField.setFloat(material.lightarea); |
---|
| 2080 | + |
---|
| 2081 | + materialtouched = true; |
---|
| 2082 | + applySelf(); |
---|
| 2083 | + } |
---|
| 2084 | + }); |
---|
| 2085 | + presetpanel.add(shini1); |
---|
| 2086 | + |
---|
| 2087 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF); |
---|
| 2088 | + shini2.setToolTipText("Shiny3"); |
---|
| 2089 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2090 | + { |
---|
| 2091 | + public void mouseClicked(MouseEvent e) |
---|
| 2092 | + { |
---|
| 2093 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2094 | + cMaterial material = object.material; |
---|
| 2095 | + |
---|
| 2096 | + shininessField.setFloat(material.shininess); |
---|
| 2097 | + lightareaField.setFloat(material.lightarea); |
---|
| 2098 | + |
---|
| 2099 | + materialtouched = true; |
---|
| 2100 | + applySelf(); |
---|
| 2101 | + } |
---|
| 2102 | + }); |
---|
| 2103 | + presetpanel.add(shini2); |
---|
| 2104 | + |
---|
| 2105 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF); |
---|
| 2106 | + aniso.setToolTipText("AnisoU"); |
---|
| 2107 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2108 | + { |
---|
| 2109 | + public void mouseClicked(MouseEvent e) |
---|
| 2110 | + { |
---|
| 2111 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2112 | + cMaterial material = object.material; |
---|
| 2113 | + |
---|
| 2114 | + anisoField.setFloat(material.aniso); |
---|
| 2115 | + anisoVField.setFloat(material.anisoV); |
---|
| 2116 | + |
---|
| 2117 | + materialtouched = true; |
---|
| 2118 | + applySelf(); |
---|
| 2119 | + } |
---|
| 2120 | + }); |
---|
| 2121 | + presetpanel.add(aniso); |
---|
| 2122 | + |
---|
| 2123 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF); |
---|
| 2124 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2125 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2126 | + { |
---|
| 2127 | + public void mouseClicked(MouseEvent e) |
---|
| 2128 | + { |
---|
| 2129 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2130 | + cMaterial material = object.material; |
---|
| 2131 | + |
---|
| 2132 | + anisoField.setFloat(material.aniso); |
---|
| 2133 | + anisoVField.setFloat(material.anisoV); |
---|
| 2134 | + |
---|
| 2135 | + materialtouched = true; |
---|
| 2136 | + applySelf(); |
---|
| 2137 | + } |
---|
| 2138 | + }); |
---|
| 2139 | + presetpanel.add(aniso2); |
---|
| 2140 | + |
---|
| 2141 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF); |
---|
| 2142 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2143 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2144 | + { |
---|
| 2145 | + public void mouseClicked(MouseEvent e) |
---|
| 2146 | + { |
---|
| 2147 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2148 | + cMaterial material = object.material; |
---|
| 2149 | + |
---|
| 2150 | + anisoField.setFloat(material.aniso); |
---|
| 2151 | + anisoVField.setFloat(material.anisoV); |
---|
| 2152 | + |
---|
| 2153 | + materialtouched = true; |
---|
| 2154 | + applySelf(); |
---|
| 2155 | + } |
---|
| 2156 | + }); |
---|
| 2157 | + presetpanel.add(aniso3); |
---|
| 2158 | + |
---|
| 2159 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF); |
---|
| 2160 | + velvet0.setToolTipText("Velvet"); |
---|
| 2161 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2162 | + { |
---|
| 2163 | + public void mouseClicked(MouseEvent e) |
---|
| 2164 | + { |
---|
| 2165 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2166 | + cMaterial material = object.material; |
---|
| 2167 | + |
---|
| 2168 | + diffusenessField.setFloat(material.factor); |
---|
| 2169 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2170 | + sheenField.setFloat(material.sheen); |
---|
| 2171 | + shininessField.setFloat(material.shininess); |
---|
| 2172 | + velvetField.setFloat(material.velvet); |
---|
| 2173 | + shiftField.setFloat(material.shift); |
---|
| 2174 | + |
---|
| 2175 | + materialtouched = true; |
---|
| 2176 | + applySelf(); |
---|
| 2177 | + } |
---|
| 2178 | + }); |
---|
| 2179 | + presetpanel.add(velvet0); |
---|
| 2180 | + |
---|
| 2181 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF); |
---|
| 2182 | + bump0.setToolTipText("Bump texture"); |
---|
| 2183 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2184 | + { |
---|
| 2185 | + public void mouseClicked(MouseEvent e) |
---|
| 2186 | + { |
---|
| 2187 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2188 | + cMaterial material = object.material; |
---|
| 2189 | + |
---|
| 2190 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2191 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2192 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2193 | + |
---|
| 2194 | + materialtouched = true; |
---|
| 2195 | + applySelf(); |
---|
| 2196 | + } |
---|
| 2197 | + }); |
---|
| 2198 | + presetpanel.add(bump0); |
---|
| 2199 | + |
---|
| 2200 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF); |
---|
| 2201 | + borderShader.setToolTipText("Border fade"); |
---|
| 2202 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2203 | + { |
---|
| 2204 | + public void mouseClicked(MouseEvent e) |
---|
| 2205 | + { |
---|
| 2206 | + borderfadeField.setFloat(0.5); |
---|
| 2207 | + opacityField.setFloat(0.75); |
---|
| 2208 | + |
---|
| 2209 | + materialtouched = true; |
---|
| 2210 | + applySelf(); |
---|
| 2211 | + } |
---|
| 2212 | + }); |
---|
| 2213 | + presetpanel.add(borderShader); |
---|
| 2214 | + |
---|
| 2215 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF); |
---|
| 2216 | + halo.setToolTipText("Halo"); |
---|
| 2217 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2218 | + { |
---|
| 2219 | + public void mouseClicked(MouseEvent e) |
---|
| 2220 | + { |
---|
| 2221 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2222 | + cMaterial material = object.material; |
---|
| 2223 | + |
---|
| 2224 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2225 | + |
---|
| 2226 | + materialtouched = true; |
---|
| 2227 | + applySelf(); |
---|
| 2228 | + } |
---|
| 2229 | + }); |
---|
| 2230 | + presetpanel.add(halo); |
---|
| 2231 | + |
---|
| 2232 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF); |
---|
| 2233 | + candle.setToolTipText("Candle"); |
---|
| 2234 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2235 | + { |
---|
| 2236 | + public void mouseClicked(MouseEvent e) |
---|
| 2237 | + { |
---|
| 2238 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2239 | + cMaterial material = object.material; |
---|
| 2240 | + |
---|
| 2241 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2242 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2243 | + ambientField.setFloat(material.ambient); |
---|
| 2244 | + specularField.setFloat(material.specular); |
---|
| 2245 | + lightareaField.setFloat(material.lightarea); |
---|
| 2246 | + shininessField.setFloat(material.shininess); |
---|
| 2247 | + |
---|
| 2248 | + materialtouched = true; |
---|
| 2249 | + applySelf(); |
---|
| 2250 | + } |
---|
| 2251 | + }); |
---|
| 2252 | + presetpanel.add(candle); |
---|
| 2253 | + |
---|
| 2254 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF); |
---|
| 2255 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2256 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2257 | + { |
---|
| 2258 | + public void mouseClicked(MouseEvent e) |
---|
| 2259 | + { |
---|
| 2260 | + diffuseField.setFloat(0.001); |
---|
| 2261 | + ambientField.setFloat(0.001); |
---|
| 2262 | + cameraField.setFloat(0.001); |
---|
| 2263 | + specularField.setFloat(0.001); |
---|
| 2264 | + fakedepthField.setFloat(0.001); |
---|
| 2265 | + opacityField.setFloat(0.6); |
---|
| 2266 | + |
---|
| 2267 | + materialtouched = true; |
---|
| 2268 | + applySelf(); |
---|
| 2269 | + } |
---|
| 2270 | + }); |
---|
| 2271 | + presetpanel.add(shadowShader); |
---|
| 2272 | + |
---|
| 2273 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2274 | + |
---|
| 2275 | + presetpanel.preferredWidth = 1; |
---|
| 2276 | + |
---|
| 2277 | + materialpanel.add(presetpanel); |
---|
| 2278 | + materialpanel.add(panel); |
---|
| 2279 | + |
---|
| 2280 | + panel.preferredWidth = 8; |
---|
| 2281 | + |
---|
| 2282 | + /* |
---|
1420 | 2283 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1421 | 2284 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1422 | | - */ |
---|
| 2285 | + */ |
---|
1423 | 2286 | |
---|
1424 | 2287 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1425 | 2288 | |
---|
.. | .. |
---|
1453 | 2316 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1454 | 2317 | |
---|
1455 | 2318 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 2319 | + |
---|
| 2320 | + cGridBag huepanel = new cGridBag(); |
---|
| 2321 | + cGridBag huelabel = new cGridBag(); |
---|
| 2322 | + cLabel hue = GetLabel("icons/hue.png", false); |
---|
| 2323 | + hue.fit = true; |
---|
| 2324 | + |
---|
| 2325 | + hue.addMouseListener(new MouseAdapter() |
---|
| 2326 | + { |
---|
| 2327 | + public void mousePressed(MouseEvent e) |
---|
| 2328 | + { |
---|
| 2329 | + int x = e.getX(); |
---|
| 2330 | + |
---|
| 2331 | + colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth()); |
---|
| 2332 | + } |
---|
| 2333 | + }); |
---|
| 2334 | + |
---|
| 2335 | + huelabel.add(hue); |
---|
| 2336 | + huelabel.preferredWidth = 20; |
---|
| 2337 | + huepanel.add(new cGridBag()); // Label |
---|
| 2338 | + huepanel.add(huelabel); // Field/slider |
---|
| 2339 | + |
---|
| 2340 | + huepanel.preferredHeight = 7; |
---|
| 2341 | + |
---|
| 2342 | + colorSection.add(huepanel); |
---|
1456 | 2343 | |
---|
1457 | 2344 | cGridBag color = new cGridBag(); |
---|
1458 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1459 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1460 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2345 | + |
---|
| 2346 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 2347 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2348 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2349 | + |
---|
1461 | 2350 | //colorField.preferredWidth = 200; |
---|
1462 | 2351 | colorSection.add(color); |
---|
1463 | 2352 | |
---|
1464 | 2353 | cGridBag modulation = new cGridBag(); |
---|
1465 | 2354 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1466 | 2355 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1467 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2356 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1468 | 2357 | colorSection.add(modulation); |
---|
1469 | 2358 | |
---|
| 2359 | + cGridBag opacity = new cGridBag(); |
---|
| 2360 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 2361 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2362 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2363 | + colorSection.add(opacity); |
---|
| 2364 | + |
---|
| 2365 | + colorSection.add(GetSeparator()); |
---|
| 2366 | + |
---|
1470 | 2367 | cGridBag texture = new cGridBag(); |
---|
1471 | 2368 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1472 | 2369 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1473 | 2370 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1474 | 2371 | colorSection.add(texture); |
---|
1475 | 2372 | |
---|
1476 | | - cGridBag anisoU = new cGridBag(); |
---|
1477 | | - anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
1478 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1479 | | - anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1480 | | - colorSection.add(anisoU); |
---|
1481 | | - |
---|
1482 | | - cGridBag anisoV = new cGridBag(); |
---|
1483 | | - anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
1484 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1485 | | - anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1486 | | - colorSection.add(anisoV); |
---|
1487 | | - |
---|
1488 | | - cGridBag shadowbias = new cGridBag(); |
---|
1489 | | - shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
1490 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1491 | | - shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1492 | | - colorSection.add(shadowbias); |
---|
1493 | | - |
---|
1494 | | - panel.add(new JSeparator()); |
---|
| 2373 | + panel.add(GetSeparator()); |
---|
1495 | 2374 | |
---|
1496 | 2375 | panel.add(colorSection); |
---|
1497 | 2376 | |
---|
.. | .. |
---|
1541 | 2420 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1542 | 2421 | diffuseSection.add(fakedepth); |
---|
1543 | 2422 | |
---|
1544 | | - panel.add(new JSeparator()); |
---|
| 2423 | + cGridBag shadowbias = new cGridBag(); |
---|
| 2424 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 2425 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2426 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2427 | + diffuseSection.add(shadowbias); |
---|
| 2428 | + |
---|
| 2429 | + panel.add(GetSeparator()); |
---|
1545 | 2430 | |
---|
1546 | 2431 | panel.add(diffuseSection); |
---|
1547 | 2432 | |
---|
.. | .. |
---|
1591 | 2476 | // aConstraints.gridy += 1; |
---|
1592 | 2477 | // aConstraints.gridwidth = 1; |
---|
1593 | 2478 | |
---|
| 2479 | + cGridBag anisoU = new cGridBag(); |
---|
| 2480 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 2481 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2482 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2483 | + specularSection.add(anisoU); |
---|
1594 | 2484 | |
---|
1595 | | - panel.add(new JSeparator()); |
---|
| 2485 | + cGridBag anisoV = new cGridBag(); |
---|
| 2486 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 2487 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2488 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2489 | + specularSection.add(anisoV); |
---|
| 2490 | + |
---|
| 2491 | + |
---|
| 2492 | + panel.add(GetSeparator()); |
---|
1596 | 2493 | |
---|
1597 | 2494 | panel.add(specularSection); |
---|
1598 | 2495 | |
---|
1599 | 2496 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1600 | 2497 | |
---|
1601 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 2498 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1602 | 2499 | |
---|
1603 | 2500 | cGridBag camera = new cGridBag(); |
---|
1604 | 2501 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1605 | 2502 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1606 | 2503 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1607 | | - globalSection.add(camera); |
---|
| 2504 | + colorSection.add(camera); |
---|
1608 | 2505 | |
---|
1609 | 2506 | cGridBag ambient = new cGridBag(); |
---|
1610 | 2507 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1611 | 2508 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1612 | 2509 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1613 | | - globalSection.add(ambient); |
---|
| 2510 | + colorSection.add(ambient); |
---|
1614 | 2511 | |
---|
1615 | 2512 | cGridBag backlit = new cGridBag(); |
---|
1616 | 2513 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1617 | 2514 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1618 | 2515 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1619 | | - globalSection.add(backlit); |
---|
| 2516 | + colorSection.add(backlit); |
---|
1620 | 2517 | |
---|
1621 | | - cGridBag opacity = new cGridBag(); |
---|
1622 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1623 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1624 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1625 | | - globalSection.add(opacity); |
---|
1626 | | - |
---|
1627 | | - panel.add(new JSeparator()); |
---|
| 2518 | + //panel.add(new JSeparator()); |
---|
1628 | 2519 | |
---|
1629 | | - panel.add(globalSection); |
---|
| 2520 | + //panel.add(globalSection); |
---|
1630 | 2521 | |
---|
1631 | 2522 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1632 | 2523 | |
---|
.. | .. |
---|
1668 | 2559 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1669 | 2560 | textureSection.add(opacityPower); |
---|
1670 | 2561 | |
---|
1671 | | - panel.add(new JSeparator()); |
---|
| 2562 | + panel.add(GetSeparator()); |
---|
1672 | 2563 | |
---|
1673 | 2564 | panel.add(textureSection); |
---|
1674 | 2565 | |
---|
.. | .. |
---|
1733 | 2624 | // 3D models |
---|
1734 | 2625 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1735 | 2626 | { |
---|
1736 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1737 | | - LoadFile(filename, lastConverter); |
---|
| 2627 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2628 | + //LoadFile(filename, lastConverter); |
---|
| 2629 | + LoadObjFile(filename); // New 3ds loader |
---|
1738 | 2630 | continue; |
---|
1739 | 2631 | } |
---|
1740 | 2632 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
2072 | 2964 | |
---|
2073 | 2965 | void LoadObjFile(String fullname) |
---|
2074 | 2966 | { |
---|
2075 | | - /* |
---|
| 2967 | + System.out.println("Loading " + fullname); |
---|
| 2968 | + /**/ |
---|
2076 | 2969 | //lastFilename = fullname; |
---|
2077 | 2970 | if(loadObjThread == null) |
---|
2078 | 2971 | { |
---|
2079 | | - loadObjThread = new LoadOBJThread(); |
---|
2080 | | - loadObjThread.start(); |
---|
| 2972 | + loadObjThread = new LoadOBJThread(); |
---|
| 2973 | + loadObjThread.start(); |
---|
2081 | 2974 | } |
---|
2082 | 2975 | |
---|
2083 | 2976 | loadObjThread.add(fullname); |
---|
2084 | | - */ |
---|
| 2977 | + /**/ |
---|
2085 | 2978 | |
---|
2086 | | - System.out.println("Loading " + fullname); |
---|
2087 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2979 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2088 | 2980 | } |
---|
2089 | 2981 | |
---|
2090 | 2982 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2460 | 3352 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2461 | 3353 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2462 | 3354 | } |
---|
| 3355 | + |
---|
2463 | 3356 | //cJME.count++; |
---|
2464 | 3357 | //cJME.count %= 12; |
---|
2465 | 3358 | if (gc) |
---|
.. | .. |
---|
2643 | 3536 | } |
---|
2644 | 3537 | } |
---|
2645 | 3538 | } |
---|
| 3539 | + |
---|
2646 | 3540 | cFileSystemPane FSPane; |
---|
2647 | 3541 | |
---|
2648 | 3542 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2652 | 3546 | |
---|
2653 | 3547 | freezematerial = true; |
---|
2654 | 3548 | colorField.setFloat(mat.color); |
---|
2655 | | - modulationField.setFloat(mat.modulation); |
---|
| 3549 | + saturationField.setFloat(mat.modulation); |
---|
2656 | 3550 | metalnessField.setFloat(mat.metalness); |
---|
2657 | 3551 | diffuseField.setFloat(mat.diffuse); |
---|
2658 | 3552 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
2696 | 3590 | } |
---|
2697 | 3591 | } |
---|
2698 | 3592 | } |
---|
| 3593 | + |
---|
2699 | 3594 | freezematerial = false; |
---|
2700 | 3595 | } |
---|
2701 | 3596 | |
---|
2702 | 3597 | void SetMaterial(Object3D object) |
---|
2703 | 3598 | { |
---|
| 3599 | + latestObject = object; |
---|
| 3600 | + |
---|
2704 | 3601 | cMaterial mat = object.material; |
---|
2705 | 3602 | |
---|
2706 | 3603 | if (mat == null) |
---|
.. | .. |
---|
2711 | 3608 | |
---|
2712 | 3609 | if (multiplyToggle != null) |
---|
2713 | 3610 | multiplyToggle.setSelected(mat.multiply); |
---|
2714 | | - |
---|
2715 | | - assert (object.projectedVertices != null); |
---|
2716 | | - |
---|
2717 | | - if (object.projectedVertices.length <= 2) |
---|
2718 | | - { |
---|
2719 | | - // Side effect... |
---|
2720 | | - Object3D.cVector2[] keep = object.projectedVertices; |
---|
2721 | | - object.projectedVertices = new Object3D.cVector2[3]; |
---|
2722 | | - for (int i = 0; i < 3; i++) |
---|
2723 | | - { |
---|
2724 | | - if (i < keep.length) |
---|
2725 | | - { |
---|
2726 | | - object.projectedVertices[i] = keep[i]; |
---|
2727 | | - } else |
---|
2728 | | - { |
---|
2729 | | - object.projectedVertices[i] = new Object3D.cVector2(); |
---|
2730 | | - } |
---|
2731 | | - /* |
---|
2732 | | - if(keep.length == 0) |
---|
2733 | | - object.projectedVertices[0] = new Object3D.cVector2(); |
---|
2734 | | - else |
---|
2735 | | - object.projectedVertices[0] = keep[0]; |
---|
2736 | | - object.projectedVertices[1] = new Object3D.cVector2(); |
---|
2737 | | - */ |
---|
2738 | | - } |
---|
2739 | | - } |
---|
| 3611 | + |
---|
| 3612 | + AllocProjectedVertices(object); |
---|
2740 | 3613 | |
---|
2741 | 3614 | SetMaterial(mat, object.projectedVertices); |
---|
2742 | 3615 | } |
---|
.. | .. |
---|
2812 | 3685 | // } |
---|
2813 | 3686 | |
---|
2814 | 3687 | /**/ |
---|
2815 | | - if (deselect) |
---|
| 3688 | + if (deselect || child == null) |
---|
2816 | 3689 | { |
---|
2817 | 3690 | //group.deselectAll(); |
---|
2818 | 3691 | //freeze = true; |
---|
2819 | 3692 | GetTree().clearSelection(); |
---|
2820 | 3693 | //freeze = false; |
---|
| 3694 | + |
---|
| 3695 | + if (child == null) |
---|
| 3696 | + { |
---|
| 3697 | + return; |
---|
| 3698 | + } |
---|
2821 | 3699 | } |
---|
2822 | 3700 | |
---|
2823 | 3701 | //group.addSelectee(child); |
---|
.. | .. |
---|
2851 | 3729 | public void itemStateChanged(ItemEvent event) |
---|
2852 | 3730 | { |
---|
2853 | 3731 | // System.out.println("Propagate = " + propagate); |
---|
| 3732 | + if (event.getSource() == pinButton) |
---|
| 3733 | + { |
---|
| 3734 | + copy.pinned ^= true; |
---|
| 3735 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3736 | + { |
---|
| 3737 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3738 | + copy.CloseUI(); |
---|
| 3739 | + //copy.editWindow.refreshContents(); |
---|
| 3740 | + } |
---|
| 3741 | + } |
---|
| 3742 | + else |
---|
2854 | 3743 | if (event.getSource() == propagateToggle) |
---|
2855 | 3744 | { |
---|
2856 | 3745 | propagate ^= true; |
---|
.. | .. |
---|
2886 | 3775 | cameraView.ToggleDL(); |
---|
2887 | 3776 | cameraView.repaint(); |
---|
2888 | 3777 | return; |
---|
2889 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3778 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2890 | 3779 | { |
---|
2891 | 3780 | cameraView.ToggleTexture(); |
---|
2892 | 3781 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2925 | 3814 | frame.validate(); |
---|
2926 | 3815 | |
---|
2927 | 3816 | return; |
---|
2928 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3817 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2929 | 3818 | { |
---|
2930 | | - cameraView.ToggleRandom(); |
---|
| 3819 | + cameraView.ToggleSwitch(); |
---|
2931 | 3820 | cameraView.repaint(); |
---|
2932 | 3821 | return; |
---|
2933 | 3822 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
2955 | 3844 | } else if (event.getSource() == liveCB) |
---|
2956 | 3845 | { |
---|
2957 | 3846 | copy.live ^= true; |
---|
| 3847 | + objEditor.refreshContents(true); // To show item colors |
---|
2958 | 3848 | return; |
---|
2959 | | - } else if (event.getSource() == selectCB) |
---|
| 3849 | + } else if (event.getSource() == selectableCB) |
---|
2960 | 3850 | { |
---|
2961 | 3851 | copy.dontselect ^= true; |
---|
2962 | 3852 | return; |
---|
.. | .. |
---|
2964 | 3854 | { |
---|
2965 | 3855 | copy.hide ^= true; |
---|
2966 | 3856 | copy.Touch(); // display list issue |
---|
2967 | | - objEditor.refreshContents(); |
---|
| 3857 | + objEditor.refreshContents(true); // To show item colors |
---|
2968 | 3858 | return; |
---|
2969 | 3859 | } else if (event.getSource() == link2masterCB) |
---|
2970 | 3860 | { |
---|
.. | .. |
---|
3029 | 3919 | //System.out.println("ObjEditor " + event); |
---|
3030 | 3920 | applySelf0(true); |
---|
3031 | 3921 | //parent.applySelf(); |
---|
3032 | | - objEditor.refreshContents(); |
---|
| 3922 | + // conflicts with requestFocus objEditor.refreshContents(); |
---|
3033 | 3923 | } else if (source == resetButton) |
---|
3034 | 3924 | { |
---|
3035 | 3925 | CameraPane.fullreset = true; |
---|
.. | .. |
---|
3141 | 4031 | { |
---|
3142 | 4032 | Close(); |
---|
3143 | 4033 | //return true; |
---|
3144 | | - } else if (source == loadItem) |
---|
| 4034 | + } else if (source == openItem) |
---|
3145 | 4035 | { |
---|
3146 | | - load(); |
---|
| 4036 | + Open(); |
---|
3147 | 4037 | //return true; |
---|
3148 | 4038 | } else if (source == newItem) |
---|
3149 | 4039 | { |
---|
.. | .. |
---|
3168 | 4058 | { |
---|
3169 | 4059 | generatePOV(); |
---|
3170 | 4060 | //return true; |
---|
| 4061 | + } else if (event.getSource() == archiveItem) |
---|
| 4062 | + { |
---|
| 4063 | + cTools.Archive(frame); |
---|
| 4064 | + return; |
---|
3171 | 4065 | } else if (source == zBufferItem) |
---|
3172 | 4066 | { |
---|
3173 | 4067 | try |
---|
.. | .. |
---|
3214 | 4108 | objEditor.refreshContents(); |
---|
3215 | 4109 | } |
---|
3216 | 4110 | |
---|
3217 | | - static public byte[] Compress(Object o) |
---|
| 4111 | + static public byte[] Compress(Object3D o) |
---|
3218 | 4112 | { |
---|
| 4113 | + // Slower to actually compress. |
---|
3219 | 4114 | try |
---|
3220 | 4115 | { |
---|
3221 | 4116 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
3222 | | - java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3223 | | - ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 4117 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 4118 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
3224 | 4119 | |
---|
| 4120 | + Object3D parent = o.parent; |
---|
| 4121 | + o.parent = null; |
---|
| 4122 | + |
---|
3225 | 4123 | out.writeObject(o); |
---|
3226 | 4124 | |
---|
| 4125 | + o.parent = parent; |
---|
| 4126 | + |
---|
3227 | 4127 | out.flush(); |
---|
3228 | 4128 | |
---|
3229 | | - zstream.close(); |
---|
| 4129 | + baos //zstream |
---|
| 4130 | + .close(); |
---|
3230 | 4131 | out.close(); |
---|
3231 | 4132 | |
---|
3232 | | - return baos.toByteArray(); |
---|
| 4133 | + byte[] bytes = baos.toByteArray(); |
---|
| 4134 | + |
---|
| 4135 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 4136 | + return bytes; |
---|
3233 | 4137 | } catch (Exception e) |
---|
3234 | 4138 | { |
---|
3235 | 4139 | System.err.println(e); |
---|
.. | .. |
---|
3239 | 4143 | |
---|
3240 | 4144 | static public Object Uncompress(byte[] bytes) |
---|
3241 | 4145 | { |
---|
| 4146 | + System.out.println("restore #bytes = " + bytes.length); |
---|
3242 | 4147 | try |
---|
3243 | 4148 | { |
---|
3244 | 4149 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
3245 | | - java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
3246 | | - ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 4150 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 4151 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
3247 | 4152 | Object obj = in.readObject(); |
---|
| 4153 | + |
---|
| 4154 | + bais //istream |
---|
| 4155 | + .close(); |
---|
3248 | 4156 | in.close(); |
---|
3249 | 4157 | |
---|
3250 | 4158 | return obj; |
---|
.. | .. |
---|
3299 | 4207 | return null; |
---|
3300 | 4208 | } |
---|
3301 | 4209 | |
---|
3302 | | - java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3303 | 4210 | |
---|
3304 | 4211 | public void Save() |
---|
3305 | 4212 | { |
---|
3306 | | - cRadio tab = GetCurrentTab(); |
---|
| 4213 | + //Save(true); |
---|
| 4214 | + Replace(); |
---|
| 4215 | + SetVersionStates(); |
---|
| 4216 | + } |
---|
| 4217 | + |
---|
| 4218 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 4219 | + { |
---|
| 4220 | + if (compress.length != name.length) |
---|
| 4221 | + { |
---|
| 4222 | + return false; |
---|
| 4223 | + } |
---|
3307 | 4224 | |
---|
3308 | | - copy.ExtractBigData(hashtable); |
---|
| 4225 | + for (int i=compress.length; --i>=0;) |
---|
| 4226 | + { |
---|
| 4227 | + if (compress[i] != name[i]) |
---|
| 4228 | + return false; |
---|
| 4229 | + } |
---|
| 4230 | + |
---|
| 4231 | + return true; |
---|
| 4232 | + } |
---|
| 4233 | + |
---|
| 4234 | + void DeleteVersion() |
---|
| 4235 | + { |
---|
| 4236 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4237 | + { |
---|
| 4238 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4239 | + } |
---|
| 4240 | + |
---|
| 4241 | + if (copy.versionlist[copy.versionindex] == null) |
---|
| 4242 | + copy.versionindex -= 1; |
---|
| 4243 | + |
---|
| 4244 | + if (copy.versionindex != -1) |
---|
| 4245 | + CopyChanged(); |
---|
| 4246 | + |
---|
| 4247 | + SetVersionStates(); |
---|
| 4248 | + } |
---|
| 4249 | + |
---|
| 4250 | + public boolean Save(boolean user) |
---|
| 4251 | + { |
---|
| 4252 | + System.err.println("Save"); |
---|
| 4253 | + Replace(); |
---|
| 4254 | + |
---|
| 4255 | + //cRadio tab = GetCurrentTab(); |
---|
| 4256 | + |
---|
| 4257 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
| 4258 | + |
---|
| 4259 | + boolean thesame = false; |
---|
| 4260 | + |
---|
| 4261 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4262 | +// { |
---|
| 4263 | +// thesame = true; |
---|
| 4264 | +// } |
---|
3309 | 4265 | |
---|
3310 | 4266 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3311 | | - tab.graphs[tab.undoindex++] = (Object3D)clone(copy); |
---|
3312 | | - |
---|
3313 | | - copy.RestoreBigData(hashtable); |
---|
3314 | | - |
---|
3315 | | - //assert(hashtable.isEmpty()); |
---|
3316 | | - |
---|
3317 | | - for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 4267 | + if (!thesame) |
---|
3318 | 4268 | { |
---|
3319 | | - tab.graphs[i] = null; |
---|
| 4269 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4270 | + { |
---|
| 4271 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4272 | + } |
---|
| 4273 | + |
---|
| 4274 | + //tab.user[tab.versionindex] = user; |
---|
| 4275 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 4276 | + |
---|
| 4277 | + copy.versionlist[++copy.versionindex] = compress; |
---|
| 4278 | + |
---|
| 4279 | + // if (increment) |
---|
| 4280 | + // tab.versionindex++; |
---|
3320 | 4281 | } |
---|
3321 | 4282 | |
---|
| 4283 | + //copy.RestoreBigData(versiontable); |
---|
| 4284 | + |
---|
| 4285 | + //assert(hashtable.isEmpty()); |
---|
| 4286 | + |
---|
| 4287 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4288 | +// { |
---|
| 4289 | +// //tab.user[i] = false; |
---|
| 4290 | +// copy.versionlist[i] = null; |
---|
| 4291 | +// } |
---|
| 4292 | + |
---|
| 4293 | + SetVersionStates(); |
---|
| 4294 | + |
---|
3322 | 4295 | // test save |
---|
3323 | 4296 | if (false) |
---|
3324 | 4297 | { |
---|
3325 | 4298 | try |
---|
3326 | 4299 | { |
---|
3327 | | - FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 4300 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
3328 | 4301 | ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
3329 | 4302 | |
---|
3330 | 4303 | p.writeObject(copy); |
---|
.. | .. |
---|
3337 | 4310 | e.printStackTrace(); |
---|
3338 | 4311 | } |
---|
3339 | 4312 | } |
---|
| 4313 | + |
---|
| 4314 | + return !thesame; |
---|
| 4315 | + } |
---|
| 4316 | + |
---|
| 4317 | + boolean flashIt = true; |
---|
| 4318 | + |
---|
| 4319 | + void RefreshSelection() |
---|
| 4320 | + { |
---|
| 4321 | + Object3D selection = new Object3D(); |
---|
| 4322 | + |
---|
| 4323 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4324 | + { |
---|
| 4325 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 4326 | + |
---|
| 4327 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4328 | + |
---|
| 4329 | + if (obj == null) |
---|
| 4330 | + { |
---|
| 4331 | + copy.selection.remove(i--); |
---|
| 4332 | + } |
---|
| 4333 | + else |
---|
| 4334 | + { |
---|
| 4335 | + selection.add(obj); |
---|
| 4336 | + copy.selection.setElementAt(obj, i); |
---|
| 4337 | + } |
---|
| 4338 | + } |
---|
| 4339 | + |
---|
| 4340 | + flashIt = false; |
---|
| 4341 | + GetTree().clearSelection(); |
---|
| 4342 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4343 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4344 | + flashIt = true; |
---|
| 4345 | + |
---|
| 4346 | + //refreshContents(false); |
---|
3340 | 4347 | } |
---|
3341 | 4348 | |
---|
3342 | | - void CopyChanged(Object3D obj) |
---|
| 4349 | + void CopyChanged() |
---|
3343 | 4350 | { |
---|
3344 | | - copy.ExtractBigData(hashtable); |
---|
| 4351 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4352 | + |
---|
| 4353 | + SetVersionStates(); |
---|
| 4354 | + |
---|
| 4355 | + boolean temp = CameraPane.SWITCH; |
---|
| 4356 | + CameraPane.SWITCH = false; |
---|
| 4357 | + |
---|
| 4358 | + copy.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
3345 | 4359 | |
---|
3346 | 4360 | copy.clear(); |
---|
3347 | 4361 | |
---|
| 4362 | + copy.skyboxname = obj.skyboxname; |
---|
| 4363 | + copy.skyboxext = obj.skyboxext; |
---|
| 4364 | + |
---|
3348 | 4365 | for (int i=0; i<obj.Size(); i++) |
---|
3349 | 4366 | { |
---|
3350 | 4367 | copy.add(obj.get(i)); |
---|
3351 | 4368 | } |
---|
3352 | 4369 | |
---|
3353 | | - copy.RestoreBigData(hashtable); |
---|
| 4370 | + copy.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
3354 | 4371 | |
---|
| 4372 | + CameraPane.SWITCH = temp; |
---|
| 4373 | + |
---|
| 4374 | + RefreshSelection(); |
---|
3355 | 4375 | //assert(hashtable.isEmpty()); |
---|
3356 | 4376 | |
---|
3357 | 4377 | copy.Touch(); |
---|
.. | .. |
---|
3372 | 4392 | } |
---|
3373 | 4393 | } |
---|
3374 | 4394 | |
---|
3375 | | - refreshContents(); |
---|
| 4395 | + refreshContents(true); |
---|
3376 | 4396 | } |
---|
3377 | 4397 | |
---|
3378 | | - public void Undo() |
---|
3379 | | - { |
---|
3380 | | - cRadio tab = GetCurrentTab(); |
---|
| 4398 | + cButton previousVersionButton; |
---|
| 4399 | + cButton restoreButton; |
---|
| 4400 | + cButton replaceButton; |
---|
| 4401 | + cButton nextVersionButton; |
---|
| 4402 | + cButton saveVersionButton; |
---|
| 4403 | + cButton deleteVersionButton; |
---|
3381 | 4404 | |
---|
3382 | | - if (tab.undoindex == 0) |
---|
| 4405 | + boolean muteSlider; |
---|
| 4406 | + |
---|
| 4407 | + int VersionCount() |
---|
| 4408 | + { |
---|
| 4409 | + int count = 0; |
---|
| 4410 | + |
---|
| 4411 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
| 4412 | + { |
---|
| 4413 | + if (copy.versionlist[i] != null) |
---|
| 4414 | + count++; |
---|
| 4415 | + } |
---|
| 4416 | + |
---|
| 4417 | + return count; |
---|
| 4418 | + } |
---|
| 4419 | + |
---|
| 4420 | + void SetVersionStates() |
---|
| 4421 | + { |
---|
| 4422 | + //if (true) |
---|
| 4423 | + // return; |
---|
| 4424 | + |
---|
| 4425 | + //cRadio tab = GetCurrentTab(); |
---|
| 4426 | + |
---|
| 4427 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 4428 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 4429 | + |
---|
| 4430 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4431 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4432 | + |
---|
| 4433 | + deleteVersionButton.setEnabled(copy.versionindex != -1); |
---|
| 4434 | + //copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4435 | + |
---|
| 4436 | + muteSlider = true; |
---|
| 4437 | + versionSlider.setMinimum(0); |
---|
| 4438 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4439 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4440 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
| 4441 | + muteSlider = false; |
---|
| 4442 | + } |
---|
| 4443 | + |
---|
| 4444 | + public boolean PreviousVersion() |
---|
| 4445 | + { |
---|
| 4446 | + // Option? |
---|
| 4447 | + Replace(); |
---|
| 4448 | + |
---|
| 4449 | + System.err.println("Undo"); |
---|
| 4450 | + |
---|
| 4451 | + //cRadio tab = GetCurrentTab(); |
---|
| 4452 | + |
---|
| 4453 | + if (copy.versionindex == 0) |
---|
3383 | 4454 | { |
---|
3384 | 4455 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3385 | | - return; |
---|
| 4456 | + return false; |
---|
3386 | 4457 | } |
---|
3387 | 4458 | |
---|
3388 | | - if (tab.graphs[tab.undoindex] == null) |
---|
3389 | | - { |
---|
3390 | | - Save(); |
---|
3391 | | - tab.undoindex -= 1; |
---|
3392 | | - } |
---|
| 4459 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 4460 | +// { |
---|
| 4461 | +// if (Save(false)) |
---|
| 4462 | +// tab.versionindex -= 1; |
---|
| 4463 | +// else |
---|
| 4464 | +// { |
---|
| 4465 | +// if (tab.versionindex <= 0) |
---|
| 4466 | +// return false; |
---|
| 4467 | +// else |
---|
| 4468 | +// tab.versionindex -= 1; |
---|
| 4469 | +// } |
---|
| 4470 | +// } |
---|
3393 | 4471 | |
---|
3394 | | - tab.undoindex -= 1; |
---|
| 4472 | + copy.versionindex -= 1; |
---|
3395 | 4473 | |
---|
3396 | | - CopyChanged(tab.graphs[tab.undoindex]); |
---|
| 4474 | + CopyChanged(); |
---|
| 4475 | + |
---|
| 4476 | + return true; |
---|
3397 | 4477 | } |
---|
3398 | 4478 | |
---|
3399 | | - public void Redo() |
---|
| 4479 | + public boolean Restore() |
---|
3400 | 4480 | { |
---|
3401 | | - cRadio tab = GetCurrentTab(); |
---|
| 4481 | + System.err.println("Restore"); |
---|
3402 | 4482 | |
---|
3403 | | - if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 4483 | + //cRadio tab = GetCurrentTab(); |
---|
| 4484 | + |
---|
| 4485 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4486 | + { |
---|
| 4487 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4488 | + return false; |
---|
| 4489 | + } |
---|
| 4490 | + |
---|
| 4491 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4492 | + CopyChanged(); |
---|
| 4493 | + |
---|
| 4494 | + return true; |
---|
| 4495 | + } |
---|
| 4496 | + |
---|
| 4497 | + public boolean Replace() |
---|
| 4498 | + { |
---|
| 4499 | + //System.err.println("Replace"); |
---|
| 4500 | + |
---|
| 4501 | + //cRadio tab = GetCurrentTab(); |
---|
| 4502 | + |
---|
| 4503 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4504 | + { |
---|
| 4505 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4506 | + return false; |
---|
| 4507 | + } |
---|
| 4508 | + |
---|
| 4509 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
| 4510 | + |
---|
| 4511 | + return true; |
---|
| 4512 | + } |
---|
| 4513 | + |
---|
| 4514 | + public void NextVersion() |
---|
| 4515 | + { |
---|
| 4516 | + // Option? |
---|
| 4517 | + Replace(); |
---|
| 4518 | + |
---|
| 4519 | + //cRadio tab = GetCurrentTab(); |
---|
| 4520 | + |
---|
| 4521 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3404 | 4522 | { |
---|
3405 | 4523 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3406 | 4524 | return; |
---|
3407 | 4525 | } |
---|
3408 | 4526 | |
---|
3409 | | - tab.undoindex += 1; |
---|
| 4527 | + copy.versionindex += 1; |
---|
3410 | 4528 | |
---|
3411 | | - CopyChanged(tab.graphs[tab.undoindex]); |
---|
| 4529 | + CopyChanged(); |
---|
| 4530 | + |
---|
| 4531 | + //if (!tab.user[tab.versionindex]) |
---|
| 4532 | + // tab.graphs[tab.versionindex] = null; |
---|
3412 | 4533 | } |
---|
3413 | 4534 | |
---|
3414 | 4535 | void ImportGFD() |
---|
.. | .. |
---|
3560 | 4681 | assert false; |
---|
3561 | 4682 | } |
---|
3562 | 4683 | |
---|
3563 | | - void EditSelection() |
---|
| 4684 | + void EditSelection(boolean newWindow) |
---|
3564 | 4685 | { |
---|
3565 | 4686 | } |
---|
3566 | 4687 | |
---|
.. | .. |
---|
3619 | 4740 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
3620 | 4741 | |
---|
3621 | 4742 | current.color = (float) colorField.getFloat(); |
---|
3622 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4743 | + current.modulation = (float) saturationField.getFloat(); |
---|
3623 | 4744 | current.metalness = (float) metalnessField.getFloat(); |
---|
3624 | 4745 | current.diffuse = (float) diffuseField.getFloat(); |
---|
3625 | 4746 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
3652 | 4773 | cMaterial mat = copy.material; |
---|
3653 | 4774 | |
---|
3654 | 4775 | colorField.SetToolTipValue((mat.color)); |
---|
3655 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
| 4776 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
3656 | 4777 | metalnessField.SetToolTipValue((mat.metalness)); |
---|
3657 | 4778 | diffuseField.SetToolTipValue((mat.diffuse)); |
---|
3658 | 4779 | specularField.SetToolTipValue((mat.specular)); |
---|
.. | .. |
---|
3704 | 4825 | //copy.Touch(); |
---|
3705 | 4826 | } |
---|
3706 | 4827 | |
---|
| 4828 | + cNumberSlider versionSlider; |
---|
| 4829 | + |
---|
3707 | 4830 | public void stateChanged(ChangeEvent e) |
---|
3708 | 4831 | { |
---|
3709 | 4832 | // assert(false); |
---|
| 4833 | + if (e.getSource() == versionSlider) |
---|
| 4834 | + { |
---|
| 4835 | + if (muteSlider) |
---|
| 4836 | + return; |
---|
| 4837 | + |
---|
| 4838 | + Replace(); |
---|
| 4839 | + |
---|
| 4840 | + int version = versionSlider.getInteger(); |
---|
| 4841 | + |
---|
| 4842 | + if (version != -1 && copy.versionlist[version] != null) |
---|
| 4843 | + { |
---|
| 4844 | + copy.versionindex = version; |
---|
| 4845 | + CopyChanged(); |
---|
| 4846 | + } |
---|
| 4847 | + |
---|
| 4848 | + return; |
---|
| 4849 | + } |
---|
3710 | 4850 | |
---|
3711 | 4851 | if (freezematerial) |
---|
3712 | 4852 | { |
---|
.. | .. |
---|
3742 | 4882 | { |
---|
3743 | 4883 | //System.out.println("stateChanged = " + this); |
---|
3744 | 4884 | materialtouched = true; |
---|
| 4885 | + |
---|
| 4886 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4887 | + { |
---|
| 4888 | + saturationField.setFloat(1); |
---|
| 4889 | + } |
---|
| 4890 | + |
---|
3745 | 4891 | applySelf(); |
---|
3746 | 4892 | //System.out.println("this = " + this); |
---|
3747 | 4893 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
4041 | 5187 | { |
---|
4042 | 5188 | if (GetTree() != null) |
---|
4043 | 5189 | { |
---|
| 5190 | + GetTree().revalidate(); |
---|
4044 | 5191 | GetTree().repaint(); |
---|
4045 | 5192 | } |
---|
4046 | 5193 | |
---|
.. | .. |
---|
4049 | 5196 | ctrlPanel.validate(); // ? new |
---|
4050 | 5197 | ctrlPanel.repaint(); |
---|
4051 | 5198 | } |
---|
| 5199 | + |
---|
| 5200 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5201 | + SetVersionStates(); |
---|
| 5202 | + |
---|
| 5203 | + cameraView.requestFocusInWindow(); |
---|
4052 | 5204 | } |
---|
4053 | 5205 | |
---|
4054 | 5206 | static TweenManager tweenManager = new TweenManager(); |
---|
4055 | 5207 | |
---|
4056 | 5208 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4057 | 5209 | { |
---|
4058 | | - Save(); |
---|
| 5210 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
| 5211 | + Save(); |
---|
4059 | 5212 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4060 | 5213 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
4061 | 5214 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4079 | 5232 | // group = (Composite) group.get(0); |
---|
4080 | 5233 | // } |
---|
4081 | 5234 | |
---|
4082 | | - System.out.println("makeSomething of " + thing); |
---|
| 5235 | + //System.out.println("makeSomething of " + thing); |
---|
4083 | 5236 | |
---|
4084 | 5237 | /* |
---|
4085 | 5238 | if (deselect && jList != null) |
---|
.. | .. |
---|
4142 | 5295 | { |
---|
4143 | 5296 | ResetModel(); |
---|
4144 | 5297 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 5298 | + |
---|
| 5299 | + if (thing.Size() == 0) |
---|
| 5300 | + { |
---|
| 5301 | + //EditSelection(false); |
---|
| 5302 | + } |
---|
| 5303 | + |
---|
4145 | 5304 | refreshContents(); |
---|
4146 | 5305 | } |
---|
4147 | 5306 | |
---|
.. | .. |
---|
4279 | 5438 | |
---|
4280 | 5439 | try |
---|
4281 | 5440 | { |
---|
| 5441 | + // Try compressed version first. |
---|
4282 | 5442 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4283 | 5443 | java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
4284 | 5444 | java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
.. | .. |
---|
4289 | 5449 | readobj.ResetDisplayList(); |
---|
4290 | 5450 | } catch (Exception e) |
---|
4291 | 5451 | { |
---|
4292 | | - //e.printStackTrace(); |
---|
| 5452 | + if (!e.toString().contains("GZIP")) |
---|
| 5453 | + e.printStackTrace(); |
---|
| 5454 | + |
---|
4293 | 5455 | try |
---|
4294 | 5456 | { |
---|
4295 | 5457 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4348 | 5510 | |
---|
4349 | 5511 | void LoadIt(Object obj) |
---|
4350 | 5512 | { |
---|
| 5513 | + if (obj == null) |
---|
| 5514 | + { |
---|
| 5515 | + // Invalid file |
---|
| 5516 | + return; |
---|
| 5517 | + } |
---|
| 5518 | + |
---|
4351 | 5519 | System.out.println("Loaded " + obj); |
---|
4352 | 5520 | //new Exception().printStackTrace(); |
---|
4353 | 5521 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4357 | 5525 | |
---|
4358 | 5526 | if (readobj != null) |
---|
4359 | 5527 | { |
---|
4360 | | - Save(); |
---|
| 5528 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 5529 | + // Save(); |
---|
4361 | 5530 | try |
---|
4362 | 5531 | { |
---|
4363 | 5532 | //readobj.deepCopySelf(copy); |
---|
4364 | 5533 | copy.clear(); // june 2014 |
---|
| 5534 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5535 | + copy.skyboxext = readobj.skyboxext; |
---|
4365 | 5536 | for (int i = 0; i < readobj.size(); i++) |
---|
4366 | 5537 | { |
---|
4367 | 5538 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4402 | 5573 | } |
---|
4403 | 5574 | } catch (ClassCastException e) |
---|
4404 | 5575 | { |
---|
| 5576 | + e.printStackTrace(); |
---|
4405 | 5577 | assert (false); |
---|
4406 | 5578 | Composite c = (Composite) copy; |
---|
4407 | 5579 | c.children.clear(); |
---|
.. | .. |
---|
4412 | 5584 | c.addChild(csg); |
---|
4413 | 5585 | } |
---|
4414 | 5586 | |
---|
| 5587 | + copy.versionlist = readobj.versionlist; |
---|
| 5588 | + copy.versionindex = readobj.versionindex; |
---|
| 5589 | + copy.versiontable = readobj.versiontable; |
---|
| 5590 | + |
---|
| 5591 | + if (copy.versionlist == null) |
---|
| 5592 | + { |
---|
| 5593 | + // Backward compatibility |
---|
| 5594 | + copy.versionlist = new Object3D[100]; |
---|
| 5595 | + copy.versionindex = -1; |
---|
| 5596 | + |
---|
| 5597 | + //Save(true); |
---|
| 5598 | + } |
---|
| 5599 | + |
---|
| 5600 | + //? SetUndoStates(); |
---|
| 5601 | + |
---|
4415 | 5602 | ResetModel(); |
---|
4416 | 5603 | copy.HardTouch(); // recompile? |
---|
4417 | 5604 | refreshContents(); |
---|
4418 | 5605 | } |
---|
4419 | 5606 | } |
---|
4420 | 5607 | |
---|
4421 | | - void load() // throws ClassNotFoundException |
---|
| 5608 | + void Open() // throws ClassNotFoundException |
---|
4422 | 5609 | { |
---|
4423 | 5610 | if (Grafreed.standAlone) |
---|
4424 | 5611 | { |
---|
4425 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5612 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4426 | 5613 | browser.show(); |
---|
4427 | 5614 | String filename = browser.getFile(); |
---|
4428 | 5615 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4499 | 5686 | |
---|
4500 | 5687 | void save() |
---|
4501 | 5688 | { |
---|
| 5689 | + Replace(); |
---|
| 5690 | + |
---|
4502 | 5691 | if (lastname == null) |
---|
4503 | 5692 | { |
---|
4504 | 5693 | return; |
---|
.. | .. |
---|
4521 | 5710 | //ps.print(buffer.toString()); |
---|
4522 | 5711 | } catch (IOException e) |
---|
4523 | 5712 | { |
---|
| 5713 | + e.printStackTrace(); |
---|
4524 | 5714 | } |
---|
4525 | 5715 | } |
---|
4526 | 5716 | |
---|
.. | .. |
---|
4535 | 5725 | String filename = browser.getFile(); |
---|
4536 | 5726 | if (filename != null && filename.length() > 0) |
---|
4537 | 5727 | { |
---|
| 5728 | + if (!filename.endsWith(".gfd")) |
---|
| 5729 | + filename += ".gfd"; |
---|
4538 | 5730 | lastname = browser.getDirectory() + filename; |
---|
4539 | 5731 | save(); |
---|
4540 | 5732 | } |
---|
.. | .. |
---|
4701 | 5893 | MenuBar menuBar; |
---|
4702 | 5894 | Menu fileMenu; |
---|
4703 | 5895 | MenuItem newItem; |
---|
4704 | | - MenuItem loadItem; |
---|
| 5896 | + MenuItem openItem; |
---|
4705 | 5897 | MenuItem saveItem; |
---|
4706 | 5898 | MenuItem saveAsItem; |
---|
4707 | 5899 | MenuItem exportAsItem; |
---|
.. | .. |
---|
4724 | 5916 | CheckboxMenuItem toggleSwitchItem; |
---|
4725 | 5917 | CheckboxMenuItem toggleRootItem; |
---|
4726 | 5918 | CheckboxMenuItem animationItem; |
---|
| 5919 | + MenuItem archiveItem; |
---|
4727 | 5920 | CheckboxMenuItem toggleHandleItem; |
---|
4728 | 5921 | CheckboxMenuItem togglePaintItem; |
---|
4729 | 5922 | JSplitPane mainPanel; |
---|
4730 | 5923 | JScrollPane scrollpane; |
---|
| 5924 | + |
---|
4731 | 5925 | JPanel toolbarPanel; |
---|
| 5926 | + |
---|
4732 | 5927 | cGridBag treePanel; |
---|
| 5928 | + |
---|
4733 | 5929 | JPanel radioPanel; |
---|
4734 | 5930 | ButtonGroup buttonGroup; |
---|
4735 | | - cGridBag ctrlPanel; |
---|
| 5931 | + |
---|
| 5932 | + cGridBag toolboxPanel; |
---|
| 5933 | + cGridBag skyboxPanel; |
---|
4736 | 5934 | cGridBag materialPanel; |
---|
| 5935 | + cGridBag ctrlPanel; |
---|
| 5936 | + |
---|
4737 | 5937 | JScrollPane infoPanel; |
---|
| 5938 | + |
---|
4738 | 5939 | cGridBag optionsPanel; |
---|
| 5940 | + |
---|
4739 | 5941 | JTabbedPane objectPanel; |
---|
| 5942 | + boolean materialFlushed; |
---|
| 5943 | + Object3D latestObject; |
---|
| 5944 | + |
---|
4740 | 5945 | cGridBag XYZPanel; |
---|
| 5946 | + |
---|
4741 | 5947 | JSplitPane gridPanel; |
---|
4742 | 5948 | JSplitPane bigPanel; |
---|
| 5949 | + |
---|
4743 | 5950 | cGridBag bigThree; |
---|
4744 | 5951 | cGridBag scenePanel; |
---|
4745 | 5952 | cGridBag centralPanel; |
---|
.. | .. |
---|
4797 | 6004 | JLabel colorLabel; |
---|
4798 | 6005 | cNumberSlider colorField; |
---|
4799 | 6006 | JLabel modulationLabel; |
---|
4800 | | - cNumberSlider modulationField; |
---|
| 6007 | + cNumberSlider saturationField; |
---|
4801 | 6008 | JLabel metalnessLabel; |
---|
4802 | 6009 | cNumberSlider metalnessField; |
---|
4803 | 6010 | JLabel diffuseLabel; |
---|
.. | .. |
---|
4828 | 6035 | cNumberSlider anisoField; |
---|
4829 | 6036 | JLabel anisoVLabel; |
---|
4830 | 6037 | cNumberSlider anisoVField; |
---|
| 6038 | + |
---|
4831 | 6039 | JLabel cameraLabel; |
---|
4832 | 6040 | cNumberSlider cameraField; |
---|
4833 | 6041 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
4842 | 6050 | cNumberSlider fakedepthField; |
---|
4843 | 6051 | JLabel shadowbiasLabel; |
---|
4844 | 6052 | cNumberSlider shadowbiasField; |
---|
| 6053 | + |
---|
4845 | 6054 | JLabel bumpLabel; |
---|
4846 | 6055 | cNumberSlider bumpField; |
---|
4847 | 6056 | JLabel noiseLabel; |
---|
.. | .. |
---|
4854 | 6063 | cNumberSlider fogField; |
---|
4855 | 6064 | JLabel opacityPowerLabel; |
---|
4856 | 6065 | cNumberSlider opacityPowerField; |
---|
4857 | | - JTree jTree; |
---|
| 6066 | + cTree jTree; |
---|
4858 | 6067 | //ObjectUI parent; |
---|
4859 | 6068 | |
---|
4860 | 6069 | cNumberSlider normalpushField; |
---|