.. | .. |
---|
138 | 138 | public void closeUI() |
---|
139 | 139 | { |
---|
140 | 140 | //new Exception().printStackTrace(); |
---|
141 | | - System.out.println("this = " + this); |
---|
142 | | - System.out.println("objEditor = " + objEditor); |
---|
| 141 | +// System.out.println("this = " + this); |
---|
| 142 | +// System.out.println("objEditor = " + objEditor); |
---|
143 | 143 | //nameField.removeActionListener(this); |
---|
144 | | - objEditor.ctrlPanel.remove(nameField); |
---|
| 144 | +// objEditor.ctrlPanel.remove(nameField); |
---|
| 145 | + |
---|
| 146 | + objEditor.ctrlPanel.remove(namePanel); |
---|
145 | 147 | |
---|
146 | 148 | if (!GroupEditor.allparams) |
---|
147 | 149 | return; |
---|
148 | 150 | |
---|
149 | | - objEditor.ctrlPanel.remove(liveCB); |
---|
150 | | - objEditor.ctrlPanel.remove(hideCB); |
---|
151 | | - objEditor.ctrlPanel.remove(markCB); |
---|
152 | | - |
---|
153 | | - objEditor.ctrlPanel.remove(randomCB); |
---|
154 | | - objEditor.ctrlPanel.remove(speedupCB); |
---|
155 | | - objEditor.ctrlPanel.remove(rewindCB); |
---|
156 | | - |
---|
157 | | - objEditor.ctrlPanel.remove(resetButton); |
---|
158 | | - objEditor.ctrlPanel.remove(stepButton); |
---|
159 | | -// objEditor.ctrlPanel.remove(stepAllButton); |
---|
160 | | -// objEditor.ctrlPanel.remove(resetAllButton); |
---|
161 | | - objEditor.ctrlPanel.remove(link2masterCB); |
---|
162 | | - //objEditor.ctrlPanel.remove(flipVCB); |
---|
163 | | - //objEditor.ctrlPanel.remove(texresMenu); |
---|
164 | | - objEditor.ctrlPanel.remove(slowerButton); |
---|
165 | | - objEditor.ctrlPanel.remove(fasterButton); |
---|
166 | | - objEditor.ctrlPanel.remove(remarkButton); |
---|
| 151 | +// objEditor.ctrlPanel.remove(liveCB); |
---|
| 152 | +// objEditor.ctrlPanel.remove(hideCB); |
---|
| 153 | +// objEditor.ctrlPanel.remove(markCB); |
---|
| 154 | +// |
---|
| 155 | +// objEditor.ctrlPanel.remove(randomCB); |
---|
| 156 | +// objEditor.ctrlPanel.remove(speedupCB); |
---|
| 157 | +// objEditor.ctrlPanel.remove(rewindCB); |
---|
| 158 | +// |
---|
| 159 | +// objEditor.ctrlPanel.remove(resetButton); |
---|
| 160 | +// objEditor.ctrlPanel.remove(stepButton); |
---|
| 161 | +//// objEditor.ctrlPanel.remove(stepAllButton); |
---|
| 162 | +//// objEditor.ctrlPanel.remove(resetAllButton); |
---|
| 163 | +// objEditor.ctrlPanel.remove(link2masterCB); |
---|
| 164 | +// //objEditor.ctrlPanel.remove(flipVCB); |
---|
| 165 | +// //objEditor.ctrlPanel.remove(texresMenu); |
---|
| 166 | +// objEditor.ctrlPanel.remove(slowerButton); |
---|
| 167 | +// objEditor.ctrlPanel.remove(fasterButton); |
---|
| 168 | +// objEditor.ctrlPanel.remove(remarkButton); |
---|
167 | 169 | |
---|
168 | | - Remove(normalpushField); |
---|
| 170 | + objEditor.ctrlPanel.remove(setupPanel); |
---|
| 171 | + objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 172 | + objEditor.ctrlPanel.remove(pushPanel); |
---|
| 173 | + //objEditor.ctrlPanel.remove(fillPanel); |
---|
| 174 | + |
---|
| 175 | + //Remove(normalpushField); |
---|
169 | 176 | } |
---|
170 | 177 | |
---|
171 | 178 | public ObjEditor GetEditor() |
---|
.. | .. |
---|
269 | 276 | void SetupMenu() |
---|
270 | 277 | { |
---|
271 | 278 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
272 | | - menuBar.add(windowMenu = new Menu("File")); |
---|
273 | | - windowMenu.add(loadItem = new MenuItem("Load...")); |
---|
274 | | - windowMenu.add("-"); |
---|
275 | | - windowMenu.add(saveItem = new MenuItem("Save")); |
---|
276 | | - windowMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
| 279 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 280 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 281 | + fileMenu.add(loadItem = new MenuItem("Load...")); |
---|
| 282 | + |
---|
| 283 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 284 | + Menu menu = new Menu("Import"); |
---|
| 285 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 286 | + importOBJItem.addActionListener(this); |
---|
| 287 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 288 | + import3DSItem.addActionListener(this); |
---|
| 289 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 290 | + importVRMLX3DItem.addActionListener(this); |
---|
| 291 | + menu.add("-"); |
---|
| 292 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 293 | + importGFDItem.addActionListener(this); |
---|
| 294 | + fileMenu.add(menu); |
---|
| 295 | + fileMenu.add("-"); |
---|
| 296 | + |
---|
| 297 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 298 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
277 | 299 | //windowMenu.add(povItem = new MenuItem("Emit POV-Ray...")); |
---|
278 | | - windowMenu.add("-"); |
---|
279 | | - windowMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
280 | | - windowMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
281 | | - windowMenu.add("-"); |
---|
| 300 | + fileMenu.add("-"); |
---|
| 301 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 302 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 303 | + fileMenu.add("-"); |
---|
282 | 304 | if (client.parent != null) |
---|
283 | 305 | { |
---|
284 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 306 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
285 | 307 | } else |
---|
286 | 308 | { |
---|
287 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 309 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
288 | 310 | } |
---|
289 | 311 | |
---|
| 312 | + newItem.addActionListener(this); |
---|
290 | 313 | loadItem.addActionListener(this); |
---|
291 | 314 | saveItem.addActionListener(this); |
---|
292 | 315 | saveAsItem.addActionListener(this); |
---|
.. | .. |
---|
295 | 318 | //povItem.addActionListener(this); |
---|
296 | 319 | closeItem.addActionListener(this); |
---|
297 | 320 | |
---|
298 | | - menuBar.add(cameraMenu = new Menu("View")); |
---|
299 | | - //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer")); |
---|
300 | | - //zBufferItem.addActionListener(this); |
---|
301 | | - //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens")); |
---|
302 | | - //normalLensItem.addActionListener(this); |
---|
303 | | - cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera")); |
---|
304 | | - revertCameraItem.addActionListener(this); |
---|
305 | | - cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline")); |
---|
306 | | - toggleTimelineItem.addItemListener(this); |
---|
307 | | - cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); |
---|
308 | | - toggleFullScreenItem.addItemListener(this); |
---|
309 | | - toggleFullScreenItem.setState(CameraPane.FULLSCREEN); |
---|
310 | | - cameraMenu.add("-"); |
---|
311 | | - cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); |
---|
312 | | - toggleTextureItem.addItemListener(this); |
---|
313 | | - toggleTextureItem.setState(CameraPane.textureon); |
---|
314 | | - cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); |
---|
315 | | - toggleLiveItem.addItemListener(this); |
---|
316 | | - toggleLiveItem.setState(Globals.isLIVE()); |
---|
317 | | - cameraMenu.add(stepItem = new MenuItem("Step")); |
---|
318 | | - stepItem.addActionListener(this); |
---|
319 | | -// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); |
---|
320 | | -// toggleDLItem.addItemListener(this); |
---|
321 | | -// toggleDLItem.setState(false); |
---|
322 | | - cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render")); |
---|
323 | | - toggleRenderItem.addItemListener(this); |
---|
324 | | - toggleRenderItem.setState(!CameraPane.frozen); |
---|
325 | | - cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); |
---|
326 | | - toggleDebugItem.addItemListener(this); |
---|
327 | | - toggleDebugItem.setState(CameraPane.DEBUG); |
---|
328 | | - cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); |
---|
329 | | - toggleFrustumItem.addItemListener(this); |
---|
330 | | - toggleFrustumItem.setState(CameraPane.FRUSTUM); |
---|
331 | | - cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact")); |
---|
332 | | - toggleFootContactItem.addItemListener(this); |
---|
333 | | - toggleFootContactItem.setState(CameraPane.FOOTCONTACT); |
---|
334 | | - cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random")); |
---|
335 | | - toggleRandomItem.addItemListener(this); |
---|
336 | | - toggleRandomItem.setState(CameraPane.RANDOM); |
---|
337 | | - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); |
---|
338 | | - toggleHandleItem.addItemListener(this); |
---|
339 | | - toggleHandleItem.setState(CameraPane.HANDLES); |
---|
340 | | - cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode")); |
---|
341 | | - togglePaintItem.addItemListener(this); |
---|
342 | | - togglePaintItem.setState(CameraPane.PAINTMODE); |
---|
343 | | -// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root")); |
---|
344 | | -// toggleRootItem.addItemListener(this); |
---|
345 | | -// toggleRootItem.setState(false); |
---|
346 | | -// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation")); |
---|
347 | | -// animationItem.addItemListener(this); |
---|
348 | | -// animationItem.setState(CameraPane.ANIMATION); |
---|
349 | | - cameraMenu.add("-"); |
---|
350 | | - cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera")); |
---|
351 | | - editCameraItem.addActionListener(this); |
---|
352 | | - |
---|
353 | 321 | objectPanel = new JTabbedPane(); |
---|
354 | 322 | toolbarPanel = new JPanel(); |
---|
355 | 323 | toolbarPanel.setName("Toolbar"); |
---|
356 | | - treePanel = new JPanel(); |
---|
| 324 | + treePanel = new cGridBag(); |
---|
357 | 325 | treePanel.setName("Tree"); |
---|
358 | | - ctrlPanel = new cGridBag(); // new GridBagLayout()); |
---|
| 326 | + ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
359 | 327 | ctrlPanel.setName("Edit"); |
---|
360 | 328 | materialPanel = new cGridBag().setVertical(true); |
---|
361 | 329 | materialPanel.setName("Material"); |
---|
362 | 330 | /*JTextPane*/ |
---|
363 | 331 | infoarea = createTextPane(); |
---|
| 332 | + doc = infoarea.getStyledDocument(); |
---|
| 333 | + |
---|
364 | 334 | infoarea.setEditable(true); |
---|
365 | 335 | SetText(); |
---|
366 | 336 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
367 | 337 | // infoarea.setOpaque(false); |
---|
368 | 338 | // //infoarea.setForeground(textcolor); |
---|
369 | | - infoarea.setLineWrap(true); |
---|
370 | | - infoarea.setWrapStyleWord(true); |
---|
| 339 | +// TEXTAREA infoarea.setLineWrap(true); |
---|
| 340 | +// TEXTAREA infoarea.setWrapStyleWord(true); |
---|
371 | 341 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
372 | 342 | infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
373 | 343 | infoPanel.setName("Info"); |
---|
.. | .. |
---|
378 | 348 | mainPanel.setName("Main"); |
---|
379 | 349 | mainPanel.setContinuousLayout(true); |
---|
380 | 350 | mainPanel.setOneTouchExpandable(true); |
---|
381 | | - mainPanel.setDividerLocation(1.0); |
---|
382 | 351 | mainPanel.setDividerSize(9); |
---|
383 | | - mainPanel.setResizeWeight(0); |
---|
| 352 | + mainPanel.setDividerLocation(0.5); //1.0); |
---|
| 353 | + mainPanel.setResizeWeight(0.5); |
---|
384 | 354 | |
---|
385 | 355 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
386 | 356 | //mainPanel.setLayout(new GridBagLayout()); |
---|
387 | 357 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
388 | | - treePanel.setLayout(new GridBagLayout()); |
---|
389 | | - ctrlPanel.setLayout(new GridBagLayout()); |
---|
| 358 | +// treePanel.setLayout(new GridBagLayout()); |
---|
| 359 | + //ctrlPanel.setLayout(new GridBagLayout()); |
---|
390 | 360 | //materialPanel.setLayout(new GridBagLayout()); |
---|
391 | 361 | |
---|
392 | 362 | aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, |
---|
.. | .. |
---|
426 | 396 | static String newline = "\n"; |
---|
427 | 397 | protected static final String buttonString = "JButton"; |
---|
428 | 398 | StyledDocument doc; |
---|
429 | | - JTextArea infoarea; |
---|
| 399 | + JTextPane infoarea; |
---|
430 | 400 | |
---|
431 | 401 | void ClearInfo() |
---|
432 | 402 | { |
---|
.. | .. |
---|
475 | 445 | //SendInfo("Name:", "bold"); |
---|
476 | 446 | if (sel.GetTextures() != null || debug) |
---|
477 | 447 | { |
---|
478 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 448 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
479 | 449 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
480 | 450 | if (sel.Size() > 0) |
---|
481 | 451 | { |
---|
482 | 452 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
483 | 453 | } |
---|
484 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 454 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
485 | 455 | if (debug) |
---|
486 | 456 | { |
---|
487 | 457 | try |
---|
.. | .. |
---|
493 | 463 | } |
---|
494 | 464 | |
---|
495 | 465 | if (full) |
---|
496 | | - si.SendInfo(" BBox: " + minima + " - " + maxima, "regular"); |
---|
| 466 | + { |
---|
| 467 | + si.SendInfo(" BBox min: " + minima, "regular"); |
---|
| 468 | + si.SendInfo(" BBox max: " + maxima, "regular"); |
---|
| 469 | + } |
---|
497 | 470 | |
---|
498 | 471 | if (sel.bRep != null) |
---|
499 | 472 | { |
---|
.. | .. |
---|
520 | 493 | } |
---|
521 | 494 | if (sel.support != null) |
---|
522 | 495 | { |
---|
523 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 496 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
524 | 497 | } |
---|
525 | 498 | if (sel.scriptnode != null) |
---|
526 | 499 | { |
---|
.. | .. |
---|
591 | 564 | { |
---|
592 | 565 | CameraPane.pointflow = (PointFlow) sel; |
---|
593 | 566 | } |
---|
| 567 | + |
---|
| 568 | + si.SendInfo("_____________________", "regular"); |
---|
| 569 | + si.SendInfo("", "regular"); |
---|
594 | 570 | } |
---|
595 | 571 | } |
---|
596 | 572 | |
---|
.. | .. |
---|
622 | 598 | cameraView.ToggleFullScreen(); |
---|
623 | 599 | } |
---|
624 | 600 | |
---|
625 | | - private JTextArea createTextPane() |
---|
| 601 | + private JTextPane createTextPane() |
---|
626 | 602 | { |
---|
627 | | - String[] initString = |
---|
628 | | - { |
---|
629 | | - "This is an editable JTextPane, ", //regular |
---|
630 | | - "another ", //italic |
---|
631 | | - "styled ", //bold |
---|
632 | | - "text ", //small |
---|
633 | | - "component, ", //large |
---|
634 | | - "which supports embedded components..." + newline,//regular |
---|
635 | | - " " + newline, //button |
---|
636 | | - "...and embedded icons..." + newline, //regular |
---|
637 | | - " ", //icon |
---|
638 | | - newline + "JTextPane is a subclass of JEditorPane that " |
---|
639 | | - + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
640 | | - + "cover methods for interacting with those objects." |
---|
641 | | - }; |
---|
| 603 | +// TEXTAREA String[] initString = |
---|
| 604 | +// { |
---|
| 605 | +// "This is an editable JTextPane, ", //regular |
---|
| 606 | +// "another ", //italic |
---|
| 607 | +// "styled ", //bold |
---|
| 608 | +// "text ", //small |
---|
| 609 | +// "component, ", //large |
---|
| 610 | +// "which supports embedded components..." + newline,//regular |
---|
| 611 | +// " " + newline, //button |
---|
| 612 | +// "...and embedded icons..." + newline, //regular |
---|
| 613 | +// " ", //icon |
---|
| 614 | +// newline + "JTextPane is a subclass of JEditorPane that " |
---|
| 615 | +// + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
| 616 | +// + "cover methods for interacting with those objects." |
---|
| 617 | +// }; |
---|
| 618 | +// |
---|
| 619 | +// String[] initStyles = |
---|
| 620 | +// { |
---|
| 621 | +// "regular", "italic", "bold", "small", "large", |
---|
| 622 | +// "regular", "button", "regular", "icon", |
---|
| 623 | +// "regular" |
---|
| 624 | +// }; |
---|
| 625 | +// |
---|
| 626 | +// JTextPane textPane = new JTextPane(); |
---|
| 627 | +// textPane.setEditable(true); |
---|
| 628 | +// /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
| 629 | +// addStylesToDocument(doc); |
---|
| 630 | +// |
---|
| 631 | +// try |
---|
| 632 | +// { |
---|
| 633 | +// for (int j = 0; j < 2; j++) |
---|
| 634 | +// { |
---|
| 635 | +// for (int i = 0; i < initString.length; i++) |
---|
| 636 | +// { |
---|
| 637 | +// doc.insertString(doc.getLength(), initString[i], |
---|
| 638 | +// doc.getStyle(initStyles[i])); |
---|
| 639 | +// } |
---|
| 640 | +// } |
---|
| 641 | +// } catch (BadLocationException ble) |
---|
| 642 | +// { |
---|
| 643 | +// System.err.println("Couldn't insert initial text into text pane."); |
---|
| 644 | +// } |
---|
642 | 645 | |
---|
643 | | - String[] initStyles = |
---|
644 | | - { |
---|
645 | | - "regular", "italic", "bold", "small", "large", |
---|
646 | | - "regular", "button", "regular", "icon", |
---|
647 | | - "regular" |
---|
648 | | - }; |
---|
649 | | - |
---|
650 | | - JTextPane textPane = new JTextPane(); |
---|
651 | | - textPane.setEditable(true); |
---|
652 | | - /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
653 | | - addStylesToDocument(doc); |
---|
654 | | - |
---|
655 | | - try |
---|
656 | | - { |
---|
657 | | - for (int j = 0; j < 2; j++) |
---|
658 | | - { |
---|
659 | | - for (int i = 0; i < initString.length; i++) |
---|
660 | | - { |
---|
661 | | - doc.insertString(doc.getLength(), initString[i], |
---|
662 | | - doc.getStyle(initStyles[i])); |
---|
663 | | - } |
---|
664 | | - } |
---|
665 | | - } catch (BadLocationException ble) |
---|
666 | | - { |
---|
667 | | - System.err.println("Couldn't insert initial text into text pane."); |
---|
668 | | - } |
---|
669 | | - |
---|
670 | | - return new JTextArea(); // textPane; |
---|
| 646 | + return new JTextPane(); // textPane; |
---|
671 | 647 | } |
---|
672 | 648 | |
---|
673 | 649 | protected void addStylesToDocument(StyledDocument doc) |
---|
.. | .. |
---|
720 | 696 | protected static ImageIcon createImageIcon(String path, |
---|
721 | 697 | String description) |
---|
722 | 698 | { |
---|
723 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 699 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
724 | 700 | if (imgURL != null) |
---|
725 | 701 | { |
---|
726 | 702 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
752 | 728 | // NumberSlider vDivsField; |
---|
753 | 729 | // JCheckBox endcaps; |
---|
754 | 730 | JCheckBox liveCB; |
---|
| 731 | + JCheckBox selectCB; |
---|
755 | 732 | JCheckBox hideCB; |
---|
756 | 733 | JCheckBox link2masterCB; |
---|
757 | 734 | JCheckBox markCB; |
---|
.. | .. |
---|
767 | 744 | JButton slowerButton; |
---|
768 | 745 | JButton fasterButton; |
---|
769 | 746 | JButton remarkButton; |
---|
| 747 | + |
---|
| 748 | + cGridBag namePanel; |
---|
| 749 | + cGridBag setupPanel; |
---|
| 750 | + cGridBag commandsPanel; |
---|
| 751 | + cGridBag pushPanel; |
---|
| 752 | + cGridBag fillPanel; |
---|
770 | 753 | |
---|
771 | | - JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on) |
---|
| 754 | + JCheckBox AddCheckBox(cGridBag panel, String label, boolean on) |
---|
772 | 755 | { |
---|
773 | 756 | JCheckBox cb; |
---|
774 | 757 | |
---|
775 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
776 | | - oe.aConstraints.gridwidth = 1; // 3; |
---|
777 | | -// oe.aConstraints.weightx = 1; |
---|
778 | | -// oe.aConstraints.anchor = GridBagConstraints.WEST; |
---|
779 | | - oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 758 | + panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
780 | 759 | cb.addItemListener(this); |
---|
781 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
782 | | - oe.aConstraints.gridwidth = 1; |
---|
783 | | - oe.aConstraints.gridx += 1; |
---|
784 | 760 | |
---|
785 | 761 | return cb; |
---|
786 | 762 | } |
---|
787 | 763 | |
---|
788 | | - cButton AddButton(ObjEditor oe, String label) |
---|
| 764 | + cButton AddButton(cGridBag panel, String label) |
---|
789 | 765 | { |
---|
790 | 766 | cButton cb; |
---|
791 | 767 | |
---|
792 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
793 | | - oe.aConstraints.gridwidth = 1; |
---|
794 | | -// oe.aConstraints.weightx = 1; |
---|
795 | | -// oe.aConstraints.anchor = GridBagConstraints.WEST; |
---|
796 | | - oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); |
---|
| 768 | + panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); |
---|
797 | 769 | cb.addActionListener(this); |
---|
798 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
799 | | - oe.aConstraints.gridwidth = 1; |
---|
800 | | - oe.aConstraints.gridx += 1; |
---|
801 | 770 | |
---|
802 | 771 | return cb; |
---|
803 | 772 | } |
---|
804 | 773 | |
---|
805 | | - JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item) |
---|
| 774 | + JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item) |
---|
806 | 775 | { |
---|
807 | 776 | JComboBox combo; |
---|
808 | 777 | |
---|
809 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
810 | | - oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
811 | | - oe.aConstraints.gridx += 1; |
---|
| 778 | + panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
812 | 779 | combo.addActionListener(this); |
---|
813 | 780 | |
---|
814 | 781 | return combo; |
---|
815 | 782 | } |
---|
816 | 783 | |
---|
817 | | - cNumberSlider AddSlider(cGridBag ctrlPanel, String label, double min, double max, double current, double pow) |
---|
| 784 | + cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow) |
---|
818 | 785 | { |
---|
819 | 786 | cGridBag control = new cGridBag(); |
---|
820 | 787 | |
---|
.. | .. |
---|
826 | 793 | control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
827 | 794 | combo.setFloat(current); |
---|
828 | 795 | |
---|
829 | | - ctrlPanel.add(control); |
---|
| 796 | + panel.add(control); |
---|
830 | 797 | |
---|
831 | | - return combo; |
---|
| 798 | + return control; |
---|
832 | 799 | } |
---|
833 | 800 | |
---|
834 | | - cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current) |
---|
| 801 | + cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current) |
---|
835 | 802 | { |
---|
836 | 803 | cGridBag control = new cGridBag(); |
---|
837 | 804 | |
---|
.. | .. |
---|
839 | 806 | |
---|
840 | 807 | JLabel jlabel = new JLabel(label); |
---|
841 | 808 | jlabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
842 | | - ctrlPanel.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
843 | | - ctrlPanel.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 809 | + control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 810 | + control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
844 | 811 | combo.setInteger(current); |
---|
845 | 812 | |
---|
846 | | - ctrlPanel.add(control); |
---|
| 813 | + panel.add(control); |
---|
847 | 814 | |
---|
848 | | - return combo; |
---|
| 815 | + return control; |
---|
849 | 816 | } |
---|
850 | 817 | |
---|
851 | 818 | JTextArea AddText(cGridBag ctrlPanel, String name) |
---|
852 | 819 | { |
---|
853 | 820 | JTextArea text; |
---|
854 | 821 | |
---|
855 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
856 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
857 | 822 | ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
858 | 823 | text.addCaretListener(this); |
---|
859 | | - aConstraints.gridx += 1; |
---|
860 | | - aConstraints.gridwidth = 1; |
---|
861 | 824 | |
---|
862 | 825 | return text; |
---|
863 | 826 | } |
---|
.. | .. |
---|
896 | 859 | |
---|
897 | 860 | /* |
---|
898 | 861 | */ |
---|
899 | | - void Return() // ObjEditor oe) |
---|
| 862 | + void Return0() // ObjEditor oe) |
---|
900 | 863 | { |
---|
901 | 864 | aConstraints.gridy += 1; |
---|
902 | 865 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
951 | 914 | |
---|
952 | 915 | void SetupUI2(ObjEditor oe) |
---|
953 | 916 | { |
---|
954 | | -// oe.aConstraints.weightx = 0; |
---|
955 | | -// oe.aConstraints.weighty = 0; |
---|
956 | | -// oe.aConstraints.gridx = 0; |
---|
957 | | -// oe.aConstraints.gridy = 0; |
---|
958 | | - SetupName(oe); |
---|
| 917 | + //SetupName(oe); |
---|
| 918 | + |
---|
| 919 | + namePanel = new cGridBag(); |
---|
| 920 | + |
---|
| 921 | + nameField = AddText(namePanel, copy.GetName()); |
---|
| 922 | + namePanel.add(nameField); |
---|
| 923 | + oe.ctrlPanel.add(namePanel); |
---|
| 924 | + |
---|
| 925 | + oe.ctrlPanel.Return(); |
---|
959 | 926 | |
---|
960 | 927 | if (!GroupEditor.allparams) |
---|
961 | 928 | return; |
---|
962 | 929 | |
---|
963 | | - liveCB = AddCheckBox(oe, "Live", copy.live); |
---|
964 | | - link2masterCB = AddCheckBox(oe, "Supp", copy.link2master); |
---|
965 | | - hideCB = AddCheckBox(oe, "Hide", copy.hide); |
---|
| 930 | + setupPanel = new cGridBag().setVertical(false); |
---|
| 931 | + |
---|
| 932 | + liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
| 933 | + liveCB.setToolTipText("Animate object"); |
---|
| 934 | + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 935 | + selectCB.setToolTipText("Make object selectable"); |
---|
966 | 936 | // Return(); |
---|
967 | | - markCB = AddCheckBox(oe, "Mark", copy.marked); |
---|
968 | | - rewindCB = AddCheckBox(oe, "Rew", copy.rewind); |
---|
969 | | - randomCB = AddCheckBox(oe, "Rand", copy.random); |
---|
970 | | - Return(); |
---|
971 | | - resetButton = AddButton(oe, "Reset"); |
---|
972 | | - stepButton = AddButton(oe, "Step"); |
---|
| 937 | + hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 938 | + hideCB.setToolTipText("Hide object"); |
---|
| 939 | + markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
| 940 | + markCB.setToolTipText("Set the animation target transform"); |
---|
| 941 | + |
---|
| 942 | + rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 943 | + rewindCB.setToolTipText("Rewind animation"); |
---|
| 944 | + |
---|
| 945 | + randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
| 946 | + randomCB.setToolTipText("Option for switch node"); |
---|
| 947 | + |
---|
| 948 | + if (Globals.ADVANCED) |
---|
| 949 | + { |
---|
| 950 | + link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
| 951 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 952 | + speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 953 | + speedupCB.setToolTipText("Option motion capture"); |
---|
| 954 | + } |
---|
| 955 | + |
---|
| 956 | + oe.ctrlPanel.add(setupPanel); |
---|
| 957 | + oe.ctrlPanel.Return(); |
---|
| 958 | + |
---|
| 959 | + commandsPanel = new cGridBag().setVertical(false); |
---|
| 960 | + |
---|
| 961 | + resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 962 | + resetButton.setToolTipText("Jump to frame zero"); |
---|
| 963 | + stepButton = AddButton(commandsPanel, "Step"); |
---|
| 964 | + stepButton.setToolTipText("Step one frame"); |
---|
973 | 965 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
974 | 966 | // stepAllButton = AddButton(oe, "Step All"); |
---|
975 | | - speedupCB = AddCheckBox(oe, "Speed", copy.speedup); |
---|
976 | 967 | // Return(); |
---|
977 | | - slowerButton = AddButton(oe, "Slow"); |
---|
978 | | - fasterButton = AddButton(oe, "Fast"); |
---|
979 | | - remarkButton = AddButton(oe, "Rem"); |
---|
| 968 | + slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 969 | + slowerButton.setToolTipText("Decrease animation speed"); |
---|
| 970 | + fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 971 | + fasterButton.setToolTipText("Increase animation speed"); |
---|
| 972 | + remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 973 | + remarkButton.setToolTipText("Set the current transform as the target"); |
---|
980 | 974 | |
---|
981 | | - Return(); |
---|
| 975 | + oe.ctrlPanel.add(commandsPanel); |
---|
| 976 | + oe.ctrlPanel.Return(); |
---|
982 | 977 | |
---|
983 | | - normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1); |
---|
984 | | - Return(); |
---|
| 978 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
| 979 | + normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
| 980 | + //Return(); |
---|
| 981 | + |
---|
| 982 | + oe.ctrlPanel.Return(); |
---|
985 | 983 | |
---|
986 | 984 | // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2); |
---|
987 | 985 | // ObjEditor.aConstraints.gridx += 1; |
---|
.. | .. |
---|
1076 | 1074 | oe.aConstraints.gridwidth = 1; |
---|
1077 | 1075 | /**/ |
---|
1078 | 1076 | nameField = AddText(oe.ctrlPanel, copy.GetName()); |
---|
1079 | | - Return(); |
---|
| 1077 | + oe.ctrlPanel.Return(); |
---|
1080 | 1078 | |
---|
1081 | 1079 | //ctrlPanel.add(textureButton = new Button("Texture...")); |
---|
1082 | 1080 | //textureButton.setEnabled(false); |
---|
.. | .. |
---|
1253 | 1251 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1254 | 1252 | //tmp.setName("Edit"); |
---|
1255 | 1253 | objectPanel.add(materialPanel); |
---|
1256 | | - JPanel north = new JPanel(new BorderLayout()); |
---|
1257 | | - north.setName("Edit"); |
---|
1258 | | - north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1259 | | - objectPanel.add(north); |
---|
| 1254 | +// JPanel north = new JPanel(new BorderLayout()); |
---|
| 1255 | +// north.setName("Edit"); |
---|
| 1256 | +// north.add(ctrlPanel, BorderLayout.NORTH); |
---|
| 1257 | +// objectPanel.add(north); |
---|
| 1258 | + objectPanel.add(ctrlPanel); |
---|
1260 | 1259 | objectPanel.add(infoPanel); |
---|
1261 | 1260 | |
---|
1262 | 1261 | /* |
---|
.. | .. |
---|
1278 | 1277 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1279 | 1278 | |
---|
1280 | 1279 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1281 | | - scenePanel.preferredWidth = 7; |
---|
| 1280 | + scenePanel.preferredWidth = 6; |
---|
1282 | 1281 | |
---|
1283 | 1282 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1284 | 1283 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1384 | 1383 | |
---|
1385 | 1384 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1386 | 1385 | |
---|
1387 | | - frame.setSize(1024, 768); |
---|
1388 | | - frame.show(); |
---|
| 1386 | + frame.setSize(1280, 860); |
---|
| 1387 | + frame.setVisible(true); |
---|
1389 | 1388 | |
---|
1390 | 1389 | gridPanel.setDividerLocation(1.0); |
---|
1391 | 1390 | |
---|
.. | .. |
---|
1415 | 1414 | ctrlPanel.removeAll(); |
---|
1416 | 1415 | } |
---|
1417 | 1416 | |
---|
1418 | | - void SetupMaterial(cGridBag ctrlPanel) |
---|
| 1417 | + void SetupMaterial(cGridBag panel) |
---|
1419 | 1418 | { |
---|
1420 | 1419 | /* |
---|
1421 | 1420 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
.. | .. |
---|
1424 | 1423 | |
---|
1425 | 1424 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1426 | 1425 | |
---|
1427 | | - editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints); |
---|
| 1426 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1427 | + createMaterialButton.setToolTipText("Create material"); |
---|
1428 | 1428 | |
---|
1429 | 1429 | /* |
---|
1430 | 1430 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1431 | 1431 | */ |
---|
1432 | 1432 | |
---|
1433 | | - editBar.add(clearMaterialButton = new cButton("Clear")); // , aConstraints); |
---|
1434 | | - editBar.add(resetSlidersButton = new cButton("Reset")); // , aConstraints); |
---|
1435 | | - editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1436 | | - editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 1433 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1434 | + clearMaterialButton.setToolTipText("Clear material"); |
---|
| 1435 | + |
---|
| 1436 | + if (Globals.ADVANCED) |
---|
| 1437 | + { |
---|
| 1438 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1439 | + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
| 1440 | + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 1441 | + } |
---|
1437 | 1442 | |
---|
1438 | | - ctrlPanel.add(editBar); |
---|
| 1443 | + editBar.preferredHeight = 15; |
---|
| 1444 | + |
---|
| 1445 | + panel.add(editBar); |
---|
1439 | 1446 | |
---|
1440 | 1447 | /**/ |
---|
1441 | 1448 | //aConstraints.weighty = 0; |
---|
.. | .. |
---|
1445 | 1452 | //aConstraints.gridx += 1; |
---|
1446 | 1453 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1447 | 1454 | |
---|
1448 | | - JPanel colorPanel = new JPanel(new BorderLayout()); |
---|
1449 | | - colorPanel.setBorder(BorderFactory.createLineBorder(Color.black)); |
---|
1450 | | - |
---|
1451 | 1455 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
1452 | | - |
---|
1453 | | - colorPanel.add(colorSection); |
---|
1454 | 1456 | |
---|
1455 | 1457 | cGridBag color = new cGridBag(); |
---|
1456 | 1458 | color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1457 | 1459 | colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1458 | 1460 | color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1461 | + //colorField.preferredWidth = 200; |
---|
1459 | 1462 | colorSection.add(color); |
---|
1460 | 1463 | |
---|
1461 | 1464 | cGridBag modulation = new cGridBag(); |
---|
.. | .. |
---|
1488 | 1491 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1489 | 1492 | colorSection.add(shadowbias); |
---|
1490 | 1493 | |
---|
1491 | | - ctrlPanel.add(colorPanel); |
---|
| 1494 | + panel.add(new JSeparator()); |
---|
| 1495 | + |
---|
| 1496 | + panel.add(colorSection); |
---|
1492 | 1497 | |
---|
1493 | 1498 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1494 | 1499 | |
---|
1495 | | - JPanel diffusePanel = new JPanel(new BorderLayout()); |
---|
1496 | | - diffusePanel.setBorder(BorderFactory.createLineBorder(Color.black)); |
---|
1497 | | - |
---|
1498 | 1500 | cGridBag diffuseSection = new cGridBag().setVertical(true); |
---|
1499 | | - |
---|
1500 | | - diffusePanel.add(diffuseSection); |
---|
1501 | 1501 | |
---|
1502 | 1502 | cGridBag diffuse = new cGridBag(); |
---|
1503 | 1503 | diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints); |
---|
.. | .. |
---|
1541 | 1541 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1542 | 1542 | diffuseSection.add(fakedepth); |
---|
1543 | 1543 | |
---|
1544 | | - ctrlPanel.add(diffusePanel); |
---|
| 1544 | + panel.add(new JSeparator()); |
---|
| 1545 | + |
---|
| 1546 | + panel.add(diffuseSection); |
---|
1545 | 1547 | |
---|
1546 | 1548 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1547 | 1549 | |
---|
1548 | | - JPanel specularPanel = new JPanel(new BorderLayout()); |
---|
1549 | | - specularPanel.setBorder(BorderFactory.createLineBorder(Color.black)); |
---|
1550 | | - |
---|
1551 | 1550 | cGridBag specularSection = new cGridBag().setVertical(true); |
---|
1552 | | - |
---|
1553 | | - specularPanel.add(specularSection); |
---|
1554 | 1551 | |
---|
1555 | 1552 | cGridBag specular = new cGridBag(); |
---|
1556 | 1553 | specular.add(specularLabel = new JLabel("Specular")); // , aConstraints); |
---|
.. | .. |
---|
1582 | 1579 | velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1583 | 1580 | specularSection.add(velvet); |
---|
1584 | 1581 | |
---|
1585 | | - shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1); |
---|
| 1582 | + shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1); |
---|
1586 | 1583 | //Return(); |
---|
1587 | 1584 | // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints); |
---|
1588 | 1585 | // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
.. | .. |
---|
1595 | 1592 | // aConstraints.gridwidth = 1; |
---|
1596 | 1593 | |
---|
1597 | 1594 | |
---|
1598 | | - ctrlPanel.add(specularPanel); |
---|
| 1595 | + panel.add(new JSeparator()); |
---|
| 1596 | + |
---|
| 1597 | + panel.add(specularSection); |
---|
1599 | 1598 | |
---|
1600 | 1599 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1601 | 1600 | |
---|
1602 | | - JPanel globalPanel = new JPanel(new BorderLayout()); |
---|
1603 | | - globalPanel.setBorder(BorderFactory.createLineBorder(Color.black)); |
---|
1604 | | - |
---|
1605 | 1601 | cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1606 | | - |
---|
1607 | | - globalPanel.add(globalSection); |
---|
1608 | 1602 | |
---|
1609 | 1603 | cGridBag camera = new cGridBag(); |
---|
1610 | 1604 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
.. | .. |
---|
1630 | 1624 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1631 | 1625 | globalSection.add(opacity); |
---|
1632 | 1626 | |
---|
1633 | | - ctrlPanel.add(globalPanel); |
---|
| 1627 | + panel.add(new JSeparator()); |
---|
| 1628 | + |
---|
| 1629 | + panel.add(globalSection); |
---|
1634 | 1630 | |
---|
1635 | 1631 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1636 | 1632 | |
---|
1637 | | - JPanel texturePanel = new JPanel(new BorderLayout()); |
---|
1638 | | - texturePanel.setBorder(BorderFactory.createLineBorder(Color.black)); |
---|
1639 | | - |
---|
1640 | 1633 | cGridBag textureSection = new cGridBag().setVertical(true); |
---|
1641 | | - |
---|
1642 | | - texturePanel.add(textureSection); |
---|
1643 | 1634 | |
---|
1644 | 1635 | cGridBag bump = new cGridBag(); |
---|
1645 | 1636 | bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints); |
---|
.. | .. |
---|
1677 | 1668 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1678 | 1669 | textureSection.add(opacityPower); |
---|
1679 | 1670 | |
---|
1680 | | - ctrlPanel.add(texturePanel); |
---|
| 1671 | + panel.add(new JSeparator()); |
---|
| 1672 | + |
---|
| 1673 | + panel.add(textureSection); |
---|
1681 | 1674 | |
---|
1682 | 1675 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1683 | 1676 | |
---|
.. | .. |
---|
1714 | 1707 | opacityPowerField.addChangeListener(this); |
---|
1715 | 1708 | /**/ |
---|
1716 | 1709 | |
---|
1717 | | - resetSlidersButton.addActionListener(this); |
---|
1718 | 1710 | clearMaterialButton.addActionListener(this); |
---|
1719 | 1711 | createMaterialButton.addActionListener(this); |
---|
1720 | | - |
---|
1721 | | - propagateToggle.addItemListener(this); |
---|
1722 | | - multiplyToggle.addItemListener(this); |
---|
| 1712 | + |
---|
| 1713 | + if (Globals.ADVANCED) |
---|
| 1714 | + { |
---|
| 1715 | + resetSlidersButton.addActionListener(this); |
---|
| 1716 | + propagateToggle.addItemListener(this); |
---|
| 1717 | + multiplyToggle.addItemListener(this); |
---|
| 1718 | + } |
---|
1723 | 1719 | } |
---|
1724 | 1720 | |
---|
1725 | 1721 | void DropFile(java.io.File[] files, boolean textures) |
---|
.. | .. |
---|
1890 | 1886 | |
---|
1891 | 1887 | //? flashIt = false; |
---|
1892 | 1888 | CameraPane pane = (CameraPane) cameraView; |
---|
1893 | | - pane.clickStart(location.x, location.y, 0); |
---|
| 1889 | + pane.clickStart(location.x, location.y, 0, 0); |
---|
1894 | 1890 | pane.clickEnd(location.x, location.y, 0, true); |
---|
1895 | 1891 | |
---|
1896 | 1892 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
1939 | 1935 | e2.printStackTrace(); |
---|
1940 | 1936 | } |
---|
1941 | 1937 | } |
---|
| 1938 | + |
---|
1942 | 1939 | LoadJMEThread loadThread; |
---|
1943 | 1940 | |
---|
1944 | 1941 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
1996 | 1993 | //LoadFile0(filename, converter); |
---|
1997 | 1994 | } |
---|
1998 | 1995 | } |
---|
| 1996 | + |
---|
1999 | 1997 | LoadOBJThread loadObjThread; |
---|
2000 | 1998 | |
---|
2001 | 1999 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2347 | 2345 | |
---|
2348 | 2346 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2349 | 2347 | { |
---|
2350 | | - if (GrafreeD.standAlone) |
---|
| 2348 | + if (Grafreed.standAlone) |
---|
2351 | 2349 | { |
---|
2352 | 2350 | /**/ |
---|
2353 | 2351 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2354 | | - browser.show(); |
---|
| 2352 | + browser.setVisible(true); |
---|
2355 | 2353 | String filename = browser.getFile(); |
---|
2356 | 2354 | if (filename != null && filename.length() > 0) |
---|
2357 | 2355 | { |
---|
.. | .. |
---|
2496 | 2494 | } |
---|
2497 | 2495 | if (input == null) |
---|
2498 | 2496 | { |
---|
| 2497 | + new Exception().printStackTrace(); |
---|
2499 | 2498 | System.exit(0); |
---|
2500 | 2499 | } |
---|
2501 | 2500 | |
---|
.. | .. |
---|
2710 | 2709 | return; |
---|
2711 | 2710 | } |
---|
2712 | 2711 | |
---|
2713 | | - multiplyToggle.setSelected(mat.multiply); |
---|
| 2712 | + if (multiplyToggle != null) |
---|
| 2713 | + multiplyToggle.setSelected(mat.multiply); |
---|
2714 | 2714 | |
---|
2715 | 2715 | assert (object.projectedVertices != null); |
---|
2716 | 2716 | |
---|
.. | .. |
---|
2925 | 2925 | frame.validate(); |
---|
2926 | 2926 | |
---|
2927 | 2927 | return; |
---|
2928 | | - } else if (event.getSource() == toggleRandomItem) |
---|
| 2928 | + } else if (event.getSource() == toggleSwitchItem) |
---|
2929 | 2929 | { |
---|
2930 | | - cameraView.ToggleRandom(); |
---|
| 2930 | + cameraView.ToggleSwitch(); |
---|
2931 | 2931 | cameraView.repaint(); |
---|
2932 | 2932 | return; |
---|
2933 | 2933 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
2956 | 2956 | { |
---|
2957 | 2957 | copy.live ^= true; |
---|
2958 | 2958 | return; |
---|
| 2959 | + } else if (event.getSource() == selectCB) |
---|
| 2960 | + { |
---|
| 2961 | + copy.dontselect ^= true; |
---|
| 2962 | + return; |
---|
2959 | 2963 | } else if (event.getSource() == hideCB) |
---|
2960 | 2964 | { |
---|
2961 | 2965 | copy.hide ^= true; |
---|
.. | .. |
---|
2970 | 2974 | if (event.getSource() == randomCB) |
---|
2971 | 2975 | { |
---|
2972 | 2976 | copy.random ^= true; |
---|
| 2977 | + objEditor.refreshContents(); |
---|
2973 | 2978 | return; |
---|
2974 | 2979 | } |
---|
2975 | 2980 | if (event.getSource() == speedupCB) |
---|
.. | .. |
---|
2993 | 2998 | |
---|
2994 | 2999 | public void actionPerformed(ActionEvent event) |
---|
2995 | 3000 | { |
---|
| 3001 | + Object source = event.getSource(); |
---|
2996 | 3002 | // SCRIPT DIALOG |
---|
2997 | | - if (event.getSource() == okbutton) |
---|
| 3003 | + if (source == okbutton) |
---|
2998 | 3004 | { |
---|
2999 | 3005 | textpanel.setVisible(false); |
---|
3000 | 3006 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3006 | 3012 | textarea = null; |
---|
3007 | 3013 | textpanel = null; |
---|
3008 | 3014 | } |
---|
3009 | | - if (event.getSource() == cancelbutton) |
---|
| 3015 | + if (source == cancelbutton) |
---|
3010 | 3016 | { |
---|
3011 | 3017 | textpanel.setVisible(false); |
---|
3012 | 3018 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3018 | 3024 | //applySelf(); |
---|
3019 | 3025 | //client.refreshEditWindow(); |
---|
3020 | 3026 | //refreshContents(); |
---|
3021 | | - if (event.getSource() == nameField) |
---|
| 3027 | + if (source == nameField) |
---|
3022 | 3028 | { |
---|
3023 | 3029 | //System.out.println("ObjEditor " + event); |
---|
3024 | 3030 | applySelf0(true); |
---|
3025 | 3031 | //parent.applySelf(); |
---|
3026 | 3032 | objEditor.refreshContents(); |
---|
3027 | | - } else if (event.getSource() == resetButton) |
---|
| 3033 | + } else if (source == resetButton) |
---|
3028 | 3034 | { |
---|
3029 | 3035 | CameraPane.fullreset = true; |
---|
3030 | 3036 | copy.Reset(); // ResetMeshes(); |
---|
3031 | 3037 | copy.Touch(); |
---|
3032 | 3038 | objEditor.refreshContents(); |
---|
3033 | | - } else if (event.getSource() == stepItem) |
---|
| 3039 | + } else if (source == stepItem) |
---|
3034 | 3040 | { |
---|
3035 | 3041 | //cameraView.ONESTEP = true; |
---|
3036 | 3042 | Globals.ONESTEP = true; |
---|
3037 | 3043 | cameraView.repaint(); |
---|
3038 | 3044 | return; |
---|
3039 | | - } else if (event.getSource() == stepButton) |
---|
| 3045 | + } else if (source == stepButton) |
---|
3040 | 3046 | { |
---|
3041 | 3047 | copy.Step(); |
---|
3042 | 3048 | copy.Touch(); |
---|
3043 | 3049 | objEditor.refreshContents(); |
---|
3044 | | - } else if (event.getSource() == slowerButton) |
---|
| 3050 | + } else if (source == slowerButton) |
---|
3045 | 3051 | { |
---|
3046 | 3052 | copy.Slower(); |
---|
3047 | 3053 | copy.Touch(); |
---|
3048 | 3054 | objEditor.refreshContents(); |
---|
3049 | | - } else if (event.getSource() == fasterButton) |
---|
| 3055 | + } else if (source == fasterButton) |
---|
3050 | 3056 | { |
---|
3051 | 3057 | copy.Faster(); |
---|
3052 | 3058 | copy.Touch(); |
---|
3053 | 3059 | objEditor.refreshContents(); |
---|
3054 | | - } else if (event.getSource() == remarkButton) |
---|
| 3060 | + } else if (source == remarkButton) |
---|
3055 | 3061 | { |
---|
3056 | 3062 | copy.Remark(); |
---|
3057 | 3063 | copy.Touch(); |
---|
3058 | 3064 | objEditor.refreshContents(); |
---|
3059 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3065 | + } else if (source == stepAllButton) |
---|
3060 | 3066 | { |
---|
3061 | 3067 | copy.StepAll(); |
---|
3062 | 3068 | copy.Touch(); |
---|
3063 | 3069 | objEditor.refreshContents(); |
---|
3064 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3070 | + } else if (source == resetAllButton) |
---|
3065 | 3071 | { |
---|
3066 | 3072 | //CameraPane.fullreset = true; |
---|
3067 | 3073 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3094 | 3100 | // Close(); |
---|
3095 | 3101 | // } |
---|
3096 | 3102 | // else |
---|
3097 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3103 | + if (source == resetSlidersButton) |
---|
3098 | 3104 | { |
---|
3099 | 3105 | ResetSliders(); |
---|
3100 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3106 | + } else if (source == clearMaterialButton) |
---|
3101 | 3107 | { |
---|
3102 | 3108 | ClearMaterial(); |
---|
3103 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3109 | + } else if (source == createMaterialButton) |
---|
3104 | 3110 | { |
---|
3105 | 3111 | CreateMaterial(); |
---|
3106 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3112 | + } else if (source == clearPanelButton) |
---|
3107 | 3113 | { |
---|
3108 | 3114 | copy.ClearUI(); |
---|
3109 | 3115 | refreshContents(true); |
---|
3110 | | - } /* |
---|
3111 | | - } |
---|
3112 | | - |
---|
3113 | | - public boolean action(Event event, Object arg) |
---|
3114 | | - { |
---|
3115 | | - */ else if (event.getSource() == closeItem) |
---|
| 3116 | + } else if (source == importGFDItem) |
---|
| 3117 | + { |
---|
| 3118 | + ImportGFD(); |
---|
| 3119 | + } else |
---|
| 3120 | + if (source == importVRMLX3DItem) |
---|
| 3121 | + { |
---|
| 3122 | + ImportVRMLX3D(); |
---|
| 3123 | + } else |
---|
| 3124 | + if (source == import3DSItem) |
---|
| 3125 | + { |
---|
| 3126 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3127 | + } else |
---|
| 3128 | + if (source == importOBJItem) |
---|
| 3129 | + { |
---|
| 3130 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3131 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3132 | + browser.setVisible(true); |
---|
| 3133 | + String filename = browser.getFile(); |
---|
| 3134 | + if (filename != null && filename.length() > 0) |
---|
| 3135 | + { |
---|
| 3136 | + String fullname = browser.getDirectory() + filename; |
---|
| 3137 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3138 | + } |
---|
| 3139 | + } else |
---|
| 3140 | + if (source == closeItem) |
---|
3116 | 3141 | { |
---|
3117 | 3142 | Close(); |
---|
3118 | 3143 | //return true; |
---|
3119 | | - } else if (event.getSource() == loadItem) |
---|
| 3144 | + } else if (source == loadItem) |
---|
3120 | 3145 | { |
---|
3121 | 3146 | load(); |
---|
3122 | 3147 | //return true; |
---|
3123 | | - } else if (event.getSource() == saveItem) |
---|
| 3148 | + } else if (source == newItem) |
---|
| 3149 | + { |
---|
| 3150 | + New(); |
---|
| 3151 | + } else if (source == saveItem) |
---|
3124 | 3152 | { |
---|
3125 | 3153 | save(); |
---|
3126 | 3154 | //return true; |
---|
3127 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3155 | + } else if (source == saveAsItem) |
---|
3128 | 3156 | { |
---|
3129 | 3157 | saveAs(); |
---|
3130 | 3158 | //return true; |
---|
3131 | | - } else if (event.getSource() == reexportItem) |
---|
| 3159 | + } else if (source == reexportItem) |
---|
3132 | 3160 | { |
---|
3133 | 3161 | reexport(); |
---|
3134 | 3162 | //return true; |
---|
3135 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3163 | + } else if (source == exportAsItem) |
---|
3136 | 3164 | { |
---|
3137 | 3165 | export(); |
---|
3138 | 3166 | //return true; |
---|
3139 | | - } else if (event.getSource() == povItem) |
---|
| 3167 | + } else if (source == povItem) |
---|
3140 | 3168 | { |
---|
3141 | 3169 | generatePOV(); |
---|
3142 | 3170 | //return true; |
---|
3143 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3171 | + } else if (source == zBufferItem) |
---|
3144 | 3172 | { |
---|
3145 | 3173 | try |
---|
3146 | 3174 | { |
---|
.. | .. |
---|
3162 | 3190 | cameraView.repaint(); |
---|
3163 | 3191 | //return true; |
---|
3164 | 3192 | } |
---|
3165 | | - */ else if (event.getSource() == editCameraItem) |
---|
3166 | | - { |
---|
3167 | | - cameraView.ProtectCamera(); |
---|
3168 | | - cameraView.repaint(); |
---|
3169 | | - return; |
---|
3170 | | - } else if (event.getSource() == revertCameraItem) |
---|
3171 | | - { |
---|
3172 | | - cameraView.RevertCamera(); |
---|
3173 | | - cameraView.repaint(); |
---|
3174 | | - return; |
---|
3175 | | -// } else if (event.getSource() == textureButton) |
---|
3176 | | -// { |
---|
3177 | | -// return; // true; |
---|
3178 | | - } else // combos... |
---|
3179 | | - if (event.getSource() == texresMenu) |
---|
| 3193 | + */ else // combos... |
---|
| 3194 | + if (source == texresMenu) |
---|
3180 | 3195 | { |
---|
3181 | 3196 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3182 | 3197 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3188 | 3203 | } |
---|
3189 | 3204 | } |
---|
3190 | 3205 | |
---|
| 3206 | + void New() |
---|
| 3207 | + { |
---|
| 3208 | + while (copy.Size() > 1) |
---|
| 3209 | + { |
---|
| 3210 | + copy.remove(1); |
---|
| 3211 | + } |
---|
| 3212 | + |
---|
| 3213 | + ResetModel(); |
---|
| 3214 | + objEditor.refreshContents(); |
---|
| 3215 | + } |
---|
| 3216 | + |
---|
| 3217 | + static public byte[] Compress(Object o) |
---|
| 3218 | + { |
---|
| 3219 | + try |
---|
| 3220 | + { |
---|
| 3221 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3222 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3223 | + ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3224 | + |
---|
| 3225 | + out.writeObject(o); |
---|
| 3226 | + |
---|
| 3227 | + out.flush(); |
---|
| 3228 | + |
---|
| 3229 | + zstream.close(); |
---|
| 3230 | + out.close(); |
---|
| 3231 | + |
---|
| 3232 | + return baos.toByteArray(); |
---|
| 3233 | + } catch (Exception e) |
---|
| 3234 | + { |
---|
| 3235 | + System.err.println(e); |
---|
| 3236 | + return null; |
---|
| 3237 | + } |
---|
| 3238 | + } |
---|
| 3239 | + |
---|
| 3240 | + static public Object Uncompress(byte[] bytes) |
---|
| 3241 | + { |
---|
| 3242 | + System.out.println("#bytes = " + bytes.length); |
---|
| 3243 | + try |
---|
| 3244 | + { |
---|
| 3245 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3246 | + java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3247 | + ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3248 | + Object obj = in.readObject(); |
---|
| 3249 | + in.close(); |
---|
| 3250 | + |
---|
| 3251 | + return obj; |
---|
| 3252 | + } catch (Exception e) |
---|
| 3253 | + { |
---|
| 3254 | + System.err.println(e); |
---|
| 3255 | + return null; |
---|
| 3256 | + } |
---|
| 3257 | + } |
---|
| 3258 | + |
---|
| 3259 | + static public Object clone(Object o) |
---|
| 3260 | + { |
---|
| 3261 | + try |
---|
| 3262 | + { |
---|
| 3263 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3264 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3265 | + |
---|
| 3266 | + out.writeObject(o); |
---|
| 3267 | + |
---|
| 3268 | + out.flush(); |
---|
| 3269 | + out.close(); |
---|
| 3270 | + |
---|
| 3271 | + byte[] bytes = baos.toByteArray(); |
---|
| 3272 | + |
---|
| 3273 | + System.out.println("clone = " + bytes.length); |
---|
| 3274 | + |
---|
| 3275 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3276 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3277 | + Object obj = in.readObject(); |
---|
| 3278 | + in.close(); |
---|
| 3279 | + |
---|
| 3280 | + return obj; |
---|
| 3281 | + } catch (Exception e) |
---|
| 3282 | + { |
---|
| 3283 | + System.err.println(e); |
---|
| 3284 | + return null; |
---|
| 3285 | + } |
---|
| 3286 | + } |
---|
| 3287 | + |
---|
| 3288 | + cRadio GetCurrentTab() |
---|
| 3289 | + { |
---|
| 3290 | + cRadio ab; |
---|
| 3291 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3292 | + { |
---|
| 3293 | + ab = (cRadio)e.nextElement(); |
---|
| 3294 | + if(ab.GetObject() == copy) |
---|
| 3295 | + { |
---|
| 3296 | + return ab; |
---|
| 3297 | + } |
---|
| 3298 | + } |
---|
| 3299 | + |
---|
| 3300 | + return null; |
---|
| 3301 | + } |
---|
| 3302 | + |
---|
| 3303 | + java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3304 | + |
---|
| 3305 | + public void Save() |
---|
| 3306 | + { |
---|
| 3307 | + cRadio tab = GetCurrentTab(); |
---|
| 3308 | + |
---|
| 3309 | + copy.ExtractBigData(hashtable); |
---|
| 3310 | + |
---|
| 3311 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3312 | + tab.graphs[tab.undoindex++] = Compress(copy); |
---|
| 3313 | + |
---|
| 3314 | + copy.RestoreBigData(hashtable); |
---|
| 3315 | + |
---|
| 3316 | + //assert(hashtable.isEmpty()); |
---|
| 3317 | + |
---|
| 3318 | + for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3319 | + { |
---|
| 3320 | + tab.graphs[i] = null; |
---|
| 3321 | + } |
---|
| 3322 | + |
---|
| 3323 | + // test save |
---|
| 3324 | + if (false) |
---|
| 3325 | + { |
---|
| 3326 | + try |
---|
| 3327 | + { |
---|
| 3328 | + FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3329 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3330 | + |
---|
| 3331 | + p.writeObject(copy); |
---|
| 3332 | + |
---|
| 3333 | + p.flush(); |
---|
| 3334 | + |
---|
| 3335 | + ostream.close(); |
---|
| 3336 | + } catch (Exception e) |
---|
| 3337 | + { |
---|
| 3338 | + e.printStackTrace(); |
---|
| 3339 | + } |
---|
| 3340 | + } |
---|
| 3341 | + } |
---|
| 3342 | + |
---|
| 3343 | + void CopyChanged(Object3D obj) |
---|
| 3344 | + { |
---|
| 3345 | + copy.ExtractBigData(hashtable); |
---|
| 3346 | + |
---|
| 3347 | + copy.clear(); |
---|
| 3348 | + |
---|
| 3349 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3350 | + { |
---|
| 3351 | + copy.add(obj.get(i)); |
---|
| 3352 | + } |
---|
| 3353 | + |
---|
| 3354 | + copy.RestoreBigData(hashtable); |
---|
| 3355 | + |
---|
| 3356 | + //assert(hashtable.isEmpty()); |
---|
| 3357 | + |
---|
| 3358 | + copy.Touch(); |
---|
| 3359 | + |
---|
| 3360 | + ResetModel(); |
---|
| 3361 | + copy.HardTouch(); // recompile? |
---|
| 3362 | + |
---|
| 3363 | + cRadio ab; |
---|
| 3364 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3365 | + { |
---|
| 3366 | + ab = (cRadio)e.nextElement(); |
---|
| 3367 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3368 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3369 | + if (test != null) |
---|
| 3370 | + { |
---|
| 3371 | + test.editWindow = ab.object.editWindow; |
---|
| 3372 | + ab.object = test; |
---|
| 3373 | + } |
---|
| 3374 | + } |
---|
| 3375 | + |
---|
| 3376 | + refreshContents(); |
---|
| 3377 | + } |
---|
| 3378 | + |
---|
| 3379 | + public void Undo() |
---|
| 3380 | + { |
---|
| 3381 | + cRadio tab = GetCurrentTab(); |
---|
| 3382 | + |
---|
| 3383 | + if (tab.undoindex == 0) |
---|
| 3384 | + { |
---|
| 3385 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3386 | + return; |
---|
| 3387 | + } |
---|
| 3388 | + |
---|
| 3389 | + if (tab.graphs[tab.undoindex] == null) |
---|
| 3390 | + { |
---|
| 3391 | + Save(); |
---|
| 3392 | + tab.undoindex -= 1; |
---|
| 3393 | + } |
---|
| 3394 | + |
---|
| 3395 | + tab.undoindex -= 1; |
---|
| 3396 | + |
---|
| 3397 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3398 | + } |
---|
| 3399 | + |
---|
| 3400 | + public void Redo() |
---|
| 3401 | + { |
---|
| 3402 | + cRadio tab = GetCurrentTab(); |
---|
| 3403 | + |
---|
| 3404 | + if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3405 | + { |
---|
| 3406 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3407 | + return; |
---|
| 3408 | + } |
---|
| 3409 | + |
---|
| 3410 | + tab.undoindex += 1; |
---|
| 3411 | + |
---|
| 3412 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3413 | + } |
---|
| 3414 | + |
---|
| 3415 | + void ImportGFD() |
---|
| 3416 | + { |
---|
| 3417 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 3418 | + browser.show(); |
---|
| 3419 | + String filename = browser.getFile(); |
---|
| 3420 | + if (filename != null && filename.length() > 0) |
---|
| 3421 | + { |
---|
| 3422 | + String fullname = browser.getDirectory() + filename; |
---|
| 3423 | + |
---|
| 3424 | + //Object3D readobj = |
---|
| 3425 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 3426 | + //makeSomething(readobj); |
---|
| 3427 | + } |
---|
| 3428 | + } |
---|
| 3429 | + |
---|
| 3430 | + void ImportVRMLX3D() |
---|
| 3431 | + { |
---|
| 3432 | + if (Grafreed.standAlone) |
---|
| 3433 | + { |
---|
| 3434 | + /**/ |
---|
| 3435 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 3436 | + browser.show(); |
---|
| 3437 | + String filename = browser.getFile(); |
---|
| 3438 | + if (filename != null && filename.length() > 0) |
---|
| 3439 | + { |
---|
| 3440 | + String fullname = browser.getDirectory() + filename; |
---|
| 3441 | + LoadVRMLX3D(fullname); |
---|
| 3442 | + } |
---|
| 3443 | + /**/ |
---|
| 3444 | + } |
---|
| 3445 | + } |
---|
| 3446 | + |
---|
3191 | 3447 | void ToggleAnimation() |
---|
3192 | 3448 | { |
---|
3193 | 3449 | if (!Globals.ANIMATION) |
---|
3194 | 3450 | { |
---|
3195 | 3451 | FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); |
---|
3196 | | - browser.show(); |
---|
| 3452 | + browser.setVisible(true); |
---|
3197 | 3453 | String filename = browser.getFile(); |
---|
3198 | 3454 | if (filename != null && filename.length() > 0) |
---|
3199 | 3455 | { |
---|
.. | .. |
---|
3203 | 3459 | |
---|
3204 | 3460 | Globals.ANIMATION ^= true; |
---|
3205 | 3461 | |
---|
3206 | | - GrafreeD.wav.cursor = 0; |
---|
3207 | | - GrafreeD.wav.loop = 0; |
---|
| 3462 | + Grafreed.wav.cursor = 0; |
---|
| 3463 | + Grafreed.wav.loop = 0; |
---|
3208 | 3464 | } |
---|
3209 | 3465 | } else |
---|
3210 | 3466 | { |
---|
.. | .. |
---|
3254 | 3510 | void CreateMaterial() |
---|
3255 | 3511 | { |
---|
3256 | 3512 | //copy.ClearMaterial(); // PATCH |
---|
3257 | | - copy.CreateMaterialS(multiplyToggle.isSelected()); |
---|
| 3513 | + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); |
---|
3258 | 3514 | if (copy.selection.size() > 0) |
---|
3259 | 3515 | //SetMaterial(copy); |
---|
3260 | 3516 | { |
---|
.. | .. |
---|
3313 | 3569 | { |
---|
3314 | 3570 | copy.ResetBlockLoop(); // temporary problem |
---|
3315 | 3571 | |
---|
3316 | | - boolean random = CameraPane.RANDOM; |
---|
3317 | | - CameraPane.RANDOM = false; // parse everything |
---|
| 3572 | + boolean random = CameraPane.SWITCH; |
---|
| 3573 | + CameraPane.SWITCH = false; // parse everything |
---|
3318 | 3574 | copy.ResetDisplayList(); |
---|
3319 | 3575 | copy.HardTouch(); |
---|
3320 | | - CameraPane.RANDOM = random; |
---|
| 3576 | + CameraPane.SWITCH = random; |
---|
3321 | 3577 | } |
---|
3322 | 3578 | |
---|
3323 | 3579 | // public void applySelf() |
---|
.. | .. |
---|
3391 | 3647 | { |
---|
3392 | 3648 | //System.out.println("Propagate = " + propagate); |
---|
3393 | 3649 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 3650 | + |
---|
| 3651 | + if (copy.material != null) |
---|
| 3652 | + { |
---|
| 3653 | + cMaterial mat = copy.material; |
---|
| 3654 | + |
---|
| 3655 | + colorField.SetToolTipValue((mat.color)); |
---|
| 3656 | + modulationField.SetToolTipValue((mat.modulation)); |
---|
| 3657 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 3658 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 3659 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 3660 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 3661 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 3662 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 3663 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 3664 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 3665 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 3666 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 3667 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 3668 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 3669 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 3670 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 3671 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 3672 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 3673 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 3674 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 3675 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 3676 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 3677 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 3678 | + } |
---|
| 3679 | + |
---|
3394 | 3680 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3395 | 3681 | { |
---|
3396 | 3682 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3435 | 3721 | || e.getSource() == apertureField |
---|
3436 | 3722 | || e.getSource() == shadowblurField) |
---|
3437 | 3723 | { |
---|
| 3724 | + new Exception().printStackTrace(); |
---|
3438 | 3725 | System.exit(0); |
---|
3439 | 3726 | cameraView.options1[0] = (float) focusField.getFloat() * 10; |
---|
3440 | 3727 | cameraView.options1[1] = (float) apertureField.getFloat() / 1000; |
---|
.. | .. |
---|
3505 | 3792 | } |
---|
3506 | 3793 | |
---|
3507 | 3794 | if (normalpushField != null) |
---|
3508 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 3795 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3509 | 3796 | } |
---|
3510 | 3797 | |
---|
3511 | 3798 | void SnapObject() |
---|
.. | .. |
---|
3769 | 4056 | |
---|
3770 | 4057 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3771 | 4058 | { |
---|
| 4059 | + Save(); |
---|
3772 | 4060 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3773 | 4061 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3774 | 4062 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3972 | 4260 | } |
---|
3973 | 4261 | } |
---|
3974 | 4262 | } |
---|
| 4263 | + |
---|
3975 | 4264 | LoadGFDThread loadGFDThread; |
---|
3976 | 4265 | |
---|
3977 | 4266 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
3992 | 4281 | try |
---|
3993 | 4282 | { |
---|
3994 | 4283 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
3995 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4284 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4285 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
3996 | 4286 | |
---|
3997 | 4287 | readobj = (Object3D) p.readObject(); |
---|
3998 | 4288 | istream.close(); |
---|
.. | .. |
---|
4000 | 4290 | readobj.ResetDisplayList(); |
---|
4001 | 4291 | } catch (Exception e) |
---|
4002 | 4292 | { |
---|
4003 | | - e.printStackTrace(); |
---|
| 4293 | + //e.printStackTrace(); |
---|
| 4294 | + try |
---|
| 4295 | + { |
---|
| 4296 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4297 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4298 | + |
---|
| 4299 | + readobj = (Object3D) p.readObject(); |
---|
| 4300 | + istream.close(); |
---|
| 4301 | + |
---|
| 4302 | + readobj.ResetDisplayList(); |
---|
| 4303 | + } catch (Exception e2) |
---|
| 4304 | + { |
---|
| 4305 | + e2.printStackTrace(); |
---|
| 4306 | + } |
---|
4004 | 4307 | } |
---|
4005 | 4308 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4006 | 4309 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4055 | 4358 | |
---|
4056 | 4359 | if (readobj != null) |
---|
4057 | 4360 | { |
---|
| 4361 | + Save(); |
---|
4058 | 4362 | try |
---|
4059 | 4363 | { |
---|
4060 | 4364 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4117 | 4421 | |
---|
4118 | 4422 | void load() // throws ClassNotFoundException |
---|
4119 | 4423 | { |
---|
4120 | | - if (GrafreeD.standAlone) |
---|
| 4424 | + if (Grafreed.standAlone) |
---|
4121 | 4425 | { |
---|
4122 | 4426 | FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
4123 | 4427 | browser.show(); |
---|
.. | .. |
---|
4204 | 4508 | try |
---|
4205 | 4509 | { |
---|
4206 | 4510 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4207 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4511 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4512 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4208 | 4513 | |
---|
4209 | 4514 | p.writeObject(copy); |
---|
4210 | 4515 | p.flush(); |
---|
4211 | 4516 | |
---|
| 4517 | + zstream.close(); |
---|
4212 | 4518 | ostream.close(); |
---|
4213 | 4519 | |
---|
4214 | 4520 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4218 | 4524 | { |
---|
4219 | 4525 | } |
---|
4220 | 4526 | } |
---|
| 4527 | + |
---|
4221 | 4528 | String lastname; |
---|
4222 | 4529 | |
---|
4223 | 4530 | void saveAs() |
---|
4224 | 4531 | { |
---|
4225 | | - if (GrafreeD.standAlone) |
---|
| 4532 | + if (Grafreed.standAlone) |
---|
4226 | 4533 | { |
---|
4227 | 4534 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4228 | 4535 | browser.setVisible(true); |
---|
.. | .. |
---|
4327 | 4634 | try |
---|
4328 | 4635 | { |
---|
4329 | 4636 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4330 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4331 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 4637 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4638 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4332 | 4639 | |
---|
4333 | 4640 | Object3D objectparent = obj.parent; |
---|
4334 | 4641 | obj.parent = null; |
---|
4335 | 4642 | |
---|
4336 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 4643 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4337 | 4644 | |
---|
4338 | 4645 | obj.parent = objectparent; |
---|
4339 | 4646 | |
---|
.. | .. |
---|
4345 | 4652 | p.writeObject(object); |
---|
4346 | 4653 | p.flush(); |
---|
4347 | 4654 | |
---|
| 4655 | + zstream.close(); |
---|
4348 | 4656 | ostream.close(); |
---|
4349 | | - // zstream.close(); |
---|
4350 | 4657 | |
---|
4351 | 4658 | // group.selection.get(0).parent = parent; |
---|
4352 | 4659 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4367 | 4674 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4368 | 4675 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4369 | 4676 | copy.generatePOV(buffer); |
---|
4370 | | - if (GrafreeD.standAlone) |
---|
| 4677 | + if (Grafreed.standAlone) |
---|
4371 | 4678 | { |
---|
4372 | 4679 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4373 | 4680 | browser.show(); |
---|
.. | .. |
---|
4393 | 4700 | Object3D client; |
---|
4394 | 4701 | Object3D copy; |
---|
4395 | 4702 | MenuBar menuBar; |
---|
4396 | | - Menu windowMenu; |
---|
| 4703 | + Menu fileMenu; |
---|
| 4704 | + MenuItem newItem; |
---|
4397 | 4705 | MenuItem loadItem; |
---|
4398 | 4706 | MenuItem saveItem; |
---|
4399 | 4707 | MenuItem saveAsItem; |
---|
.. | .. |
---|
4401 | 4709 | MenuItem reexportItem; |
---|
4402 | 4710 | MenuItem povItem; |
---|
4403 | 4711 | MenuItem closeItem; |
---|
4404 | | - Menu cameraMenu; |
---|
| 4712 | + |
---|
4405 | 4713 | CheckboxMenuItem zBufferItem; |
---|
4406 | 4714 | //MenuItem normalLensItem; |
---|
4407 | | - MenuItem editCameraItem; |
---|
4408 | | - MenuItem revertCameraItem; |
---|
4409 | | - CheckboxMenuItem toggleLiveItem; |
---|
4410 | 4715 | MenuItem stepItem; |
---|
| 4716 | + CheckboxMenuItem toggleLiveItem; |
---|
4411 | 4717 | CheckboxMenuItem toggleFullScreenItem; |
---|
4412 | 4718 | CheckboxMenuItem toggleTimelineItem; |
---|
4413 | 4719 | CheckboxMenuItem toggleRenderItem; |
---|
.. | .. |
---|
4416 | 4722 | CheckboxMenuItem toggleFootContactItem; |
---|
4417 | 4723 | CheckboxMenuItem toggleDLItem; |
---|
4418 | 4724 | CheckboxMenuItem toggleTextureItem; |
---|
4419 | | - CheckboxMenuItem toggleRandomItem; |
---|
| 4725 | + CheckboxMenuItem toggleSwitchItem; |
---|
4420 | 4726 | CheckboxMenuItem toggleRootItem; |
---|
4421 | 4727 | CheckboxMenuItem animationItem; |
---|
4422 | 4728 | CheckboxMenuItem toggleHandleItem; |
---|
.. | .. |
---|
4424 | 4730 | JSplitPane mainPanel; |
---|
4425 | 4731 | JScrollPane scrollpane; |
---|
4426 | 4732 | JPanel toolbarPanel; |
---|
4427 | | - JPanel treePanel; |
---|
| 4733 | + cGridBag treePanel; |
---|
4428 | 4734 | JPanel radioPanel; |
---|
4429 | 4735 | ButtonGroup buttonGroup; |
---|
4430 | 4736 | cGridBag ctrlPanel; |
---|
.. | .. |
---|
4553 | 4859 | //ObjectUI parent; |
---|
4554 | 4860 | |
---|
4555 | 4861 | cNumberSlider normalpushField; |
---|
| 4862 | + |
---|
| 4863 | + private MenuItem importGFDItem; |
---|
| 4864 | + private MenuItem importVRMLX3DItem; |
---|
| 4865 | + private MenuItem import3DSItem; |
---|
| 4866 | + private MenuItem importOBJItem; |
---|
4556 | 4867 | } |
---|