.. | .. |
---|
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.*; |
---|
.. | .. |
---|
35 | 36 | |
---|
36 | 37 | GroupEditor callee; |
---|
37 | 38 | JFrame frame; |
---|
| 39 | + |
---|
| 40 | + static ObjEditor theFrame; |
---|
| 41 | + |
---|
| 42 | + cButton GetButton(String name, boolean border) |
---|
| 43 | + { |
---|
| 44 | + try |
---|
| 45 | + { |
---|
| 46 | + ImageIcon icon = GetIcon(name); |
---|
| 47 | + return new cButton(icon, border); |
---|
| 48 | + } |
---|
| 49 | + catch (Exception e) |
---|
| 50 | + { |
---|
| 51 | + return new cButton(name, border); |
---|
| 52 | + } |
---|
| 53 | + } |
---|
| 54 | + |
---|
| 55 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 56 | + { |
---|
| 57 | + try |
---|
| 58 | + { |
---|
| 59 | + ImageIcon icon = GetIcon(name); |
---|
| 60 | + return new cToggleButton(icon, border); |
---|
| 61 | + } |
---|
| 62 | + catch (Exception e) |
---|
| 63 | + { |
---|
| 64 | + return new cToggleButton(name, border); |
---|
| 65 | + } |
---|
| 66 | + } |
---|
| 67 | + |
---|
| 68 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 69 | + { |
---|
| 70 | + try |
---|
| 71 | + { |
---|
| 72 | + ImageIcon icon = GetIcon(name); |
---|
| 73 | + return new cCheckBox(icon, border); |
---|
| 74 | + } |
---|
| 75 | + catch (Exception e) |
---|
| 76 | + { |
---|
| 77 | + return new cCheckBox(name, border); |
---|
| 78 | + } |
---|
| 79 | + } |
---|
| 80 | + |
---|
| 81 | + private ImageIcon GetIcon(String name) throws IOException |
---|
| 82 | + { |
---|
| 83 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 84 | + |
---|
| 85 | + if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 86 | + { |
---|
| 87 | + BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
| 88 | + Graphics2D g = resized.createGraphics(); |
---|
| 89 | + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 90 | + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 91 | + g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 92 | + g.dispose(); |
---|
| 93 | + |
---|
| 94 | + image = resized; |
---|
| 95 | + } |
---|
| 96 | + |
---|
| 97 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 98 | + return icon; |
---|
| 99 | + } |
---|
38 | 100 | |
---|
39 | 101 | // SCRIPT |
---|
40 | 102 | |
---|
.. | .. |
---|
138 | 200 | public void closeUI() |
---|
139 | 201 | { |
---|
140 | 202 | //new Exception().printStackTrace(); |
---|
141 | | - System.out.println("this = " + this); |
---|
142 | | - System.out.println("objEditor = " + objEditor); |
---|
| 203 | +// System.out.println("this = " + this); |
---|
| 204 | +// System.out.println("objEditor = " + objEditor); |
---|
143 | 205 | //nameField.removeActionListener(this); |
---|
144 | | - objEditor.ctrlPanel.remove(nameField); |
---|
| 206 | +// objEditor.ctrlPanel.remove(nameField); |
---|
| 207 | + |
---|
| 208 | + objEditor.ctrlPanel.remove(namePanel); |
---|
145 | 209 | |
---|
146 | 210 | if (!GroupEditor.allparams) |
---|
147 | 211 | return; |
---|
148 | 212 | |
---|
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); |
---|
| 213 | +// objEditor.ctrlPanel.remove(liveCB); |
---|
| 214 | +// objEditor.ctrlPanel.remove(hideCB); |
---|
| 215 | +// objEditor.ctrlPanel.remove(markCB); |
---|
| 216 | +// |
---|
| 217 | +// objEditor.ctrlPanel.remove(randomCB); |
---|
| 218 | +// objEditor.ctrlPanel.remove(speedupCB); |
---|
| 219 | +// objEditor.ctrlPanel.remove(rewindCB); |
---|
| 220 | +// |
---|
| 221 | +// objEditor.ctrlPanel.remove(resetButton); |
---|
| 222 | +// objEditor.ctrlPanel.remove(stepButton); |
---|
| 223 | +//// objEditor.ctrlPanel.remove(stepAllButton); |
---|
| 224 | +//// objEditor.ctrlPanel.remove(resetAllButton); |
---|
| 225 | +// objEditor.ctrlPanel.remove(link2masterCB); |
---|
| 226 | +// //objEditor.ctrlPanel.remove(flipVCB); |
---|
| 227 | +// //objEditor.ctrlPanel.remove(texresMenu); |
---|
| 228 | +// objEditor.ctrlPanel.remove(slowerButton); |
---|
| 229 | +// objEditor.ctrlPanel.remove(fasterButton); |
---|
| 230 | +// objEditor.ctrlPanel.remove(remarkButton); |
---|
167 | 231 | |
---|
168 | | - Remove(normalpushField); |
---|
| 232 | + objEditor.ctrlPanel.remove(setupPanel); |
---|
| 233 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 234 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
| 235 | + objEditor.ctrlPanel.remove(pushPanel); |
---|
| 236 | + //objEditor.ctrlPanel.remove(fillPanel); |
---|
| 237 | + |
---|
| 238 | + //Remove(normalpushField); |
---|
169 | 239 | } |
---|
170 | 240 | |
---|
171 | 241 | public ObjEditor GetEditor() |
---|
.. | .. |
---|
236 | 306 | //localCopy.parent = null; |
---|
237 | 307 | |
---|
238 | 308 | frame = new JFrame(); |
---|
| 309 | + frame.setUndecorated(true); |
---|
239 | 310 | objEditor = this; |
---|
240 | 311 | this.callee = callee; |
---|
241 | 312 | |
---|
.. | .. |
---|
269 | 340 | void SetupMenu() |
---|
270 | 341 | { |
---|
271 | 342 | 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...")); |
---|
| 343 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 344 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 345 | + fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 346 | + |
---|
| 347 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 348 | + Menu menu = new Menu("Import"); |
---|
| 349 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 350 | + importOBJItem.addActionListener(this); |
---|
| 351 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 352 | + import3DSItem.addActionListener(this); |
---|
| 353 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 354 | + importVRMLX3DItem.addActionListener(this); |
---|
| 355 | + menu.add("-"); |
---|
| 356 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 357 | + importGFDItem.addActionListener(this); |
---|
| 358 | + fileMenu.add(menu); |
---|
| 359 | + fileMenu.add("-"); |
---|
| 360 | + |
---|
| 361 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 362 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
277 | 363 | //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("-"); |
---|
| 364 | + fileMenu.add("-"); |
---|
| 365 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 366 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 367 | + fileMenu.add("-"); |
---|
282 | 368 | if (client.parent != null) |
---|
283 | 369 | { |
---|
284 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 370 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
285 | 371 | } else |
---|
286 | 372 | { |
---|
287 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 373 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
288 | 374 | } |
---|
289 | 375 | |
---|
| 376 | + newItem.addActionListener(this); |
---|
290 | 377 | loadItem.addActionListener(this); |
---|
291 | 378 | saveItem.addActionListener(this); |
---|
292 | 379 | saveAsItem.addActionListener(this); |
---|
.. | .. |
---|
295 | 382 | //povItem.addActionListener(this); |
---|
296 | 383 | closeItem.addActionListener(this); |
---|
297 | 384 | |
---|
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 | 385 | objectPanel = new JTabbedPane(); |
---|
354 | 386 | toolbarPanel = new JPanel(); |
---|
355 | 387 | toolbarPanel.setName("Toolbar"); |
---|
356 | | - treePanel = new JPanel(); |
---|
| 388 | + treePanel = new cGridBag(); |
---|
357 | 389 | treePanel.setName("Tree"); |
---|
358 | | - ctrlPanel = new cGridBag(); // new GridBagLayout()); |
---|
359 | | - ctrlPanel.setName("Edit"); |
---|
| 390 | + |
---|
| 391 | + editPanel = new cGridBag().setVertical(true); |
---|
| 392 | + editPanel.setName("Edit"); |
---|
| 393 | + |
---|
| 394 | + ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
| 395 | + |
---|
| 396 | + editCommandsPanel = new cGridBag(); |
---|
| 397 | + editPanel.add(editCommandsPanel); |
---|
| 398 | + editPanel.add(ctrlPanel); |
---|
| 399 | + |
---|
| 400 | + toolboxPanel = new cGridBag().setVertical(false); |
---|
| 401 | + toolboxPanel.setName("Toolbox"); |
---|
| 402 | + |
---|
360 | 403 | materialPanel = new cGridBag().setVertical(true); |
---|
361 | 404 | materialPanel.setName("Material"); |
---|
| 405 | + |
---|
362 | 406 | /*JTextPane*/ |
---|
363 | 407 | infoarea = createTextPane(); |
---|
| 408 | + doc = infoarea.getStyledDocument(); |
---|
| 409 | + |
---|
364 | 410 | infoarea.setEditable(true); |
---|
365 | 411 | SetText(); |
---|
366 | 412 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
367 | 413 | // infoarea.setOpaque(false); |
---|
368 | 414 | // //infoarea.setForeground(textcolor); |
---|
369 | | - infoarea.setLineWrap(true); |
---|
370 | | - infoarea.setWrapStyleWord(true); |
---|
| 415 | +// TEXTAREA infoarea.setLineWrap(true); |
---|
| 416 | +// TEXTAREA infoarea.setWrapStyleWord(true); |
---|
371 | 417 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
372 | 418 | infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
373 | 419 | infoPanel.setName("Info"); |
---|
.. | .. |
---|
378 | 424 | mainPanel.setName("Main"); |
---|
379 | 425 | mainPanel.setContinuousLayout(true); |
---|
380 | 426 | mainPanel.setOneTouchExpandable(true); |
---|
381 | | - mainPanel.setDividerLocation(1.0); |
---|
382 | 427 | mainPanel.setDividerSize(9); |
---|
383 | | - mainPanel.setResizeWeight(0); |
---|
| 428 | + mainPanel.setDividerLocation(0.5); //1.0); |
---|
| 429 | + mainPanel.setResizeWeight(0.5); |
---|
384 | 430 | |
---|
385 | 431 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
386 | 432 | //mainPanel.setLayout(new GridBagLayout()); |
---|
387 | 433 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
388 | | - treePanel.setLayout(new GridBagLayout()); |
---|
389 | | - ctrlPanel.setLayout(new GridBagLayout()); |
---|
| 434 | +// treePanel.setLayout(new GridBagLayout()); |
---|
| 435 | + //ctrlPanel.setLayout(new GridBagLayout()); |
---|
390 | 436 | //materialPanel.setLayout(new GridBagLayout()); |
---|
391 | 437 | |
---|
392 | 438 | aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, |
---|
.. | .. |
---|
426 | 472 | static String newline = "\n"; |
---|
427 | 473 | protected static final String buttonString = "JButton"; |
---|
428 | 474 | StyledDocument doc; |
---|
429 | | - JTextArea infoarea; |
---|
| 475 | + JTextPane infoarea; |
---|
430 | 476 | |
---|
431 | 477 | void ClearInfo() |
---|
432 | 478 | { |
---|
.. | .. |
---|
449 | 495 | e.printStackTrace(); |
---|
450 | 496 | } |
---|
451 | 497 | |
---|
452 | | - String selection = infoarea.getText(); |
---|
453 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
454 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
455 | | - Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
| 498 | +// String selection = infoarea.getText(); |
---|
| 499 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 500 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 501 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
456 | 502 | //clipboard.setContents(data, data); |
---|
457 | 503 | } |
---|
458 | 504 | |
---|
.. | .. |
---|
475 | 521 | //SendInfo("Name:", "bold"); |
---|
476 | 522 | if (sel.GetTextures() != null || debug) |
---|
477 | 523 | { |
---|
478 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 524 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
479 | 525 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
480 | 526 | if (sel.Size() > 0) |
---|
481 | 527 | { |
---|
482 | 528 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
483 | 529 | } |
---|
484 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 530 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
485 | 531 | if (debug) |
---|
486 | 532 | { |
---|
487 | 533 | try |
---|
.. | .. |
---|
493 | 539 | } |
---|
494 | 540 | |
---|
495 | 541 | if (full) |
---|
496 | | - si.SendInfo(" BBox: " + minima + " - " + maxima, "regular"); |
---|
| 542 | + { |
---|
| 543 | + si.SendInfo(" BBox min: " + minima, "regular"); |
---|
| 544 | + si.SendInfo(" BBox max: " + maxima, "regular"); |
---|
| 545 | + } |
---|
497 | 546 | |
---|
498 | 547 | if (sel.bRep != null) |
---|
499 | 548 | { |
---|
.. | .. |
---|
520 | 569 | } |
---|
521 | 570 | if (sel.support != null) |
---|
522 | 571 | { |
---|
523 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 572 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
524 | 573 | } |
---|
525 | 574 | if (sel.scriptnode != null) |
---|
526 | 575 | { |
---|
.. | .. |
---|
591 | 640 | { |
---|
592 | 641 | CameraPane.pointflow = (PointFlow) sel; |
---|
593 | 642 | } |
---|
| 643 | + |
---|
| 644 | + si.SendInfo("_____________________", "regular"); |
---|
| 645 | + si.SendInfo("", "regular"); |
---|
594 | 646 | } |
---|
595 | 647 | } |
---|
596 | 648 | |
---|
.. | .. |
---|
606 | 658 | } |
---|
607 | 659 | } |
---|
608 | 660 | |
---|
| 661 | +static GraphicsDevice device = GraphicsEnvironment |
---|
| 662 | + .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 663 | + |
---|
| 664 | + Rectangle keeprect; |
---|
| 665 | + cRadio radio; |
---|
| 666 | + |
---|
| 667 | +cButton keepButton; |
---|
| 668 | + cButton twoButton; // Full 3D |
---|
| 669 | + cButton sixButton; |
---|
| 670 | + cButton threeButton; |
---|
| 671 | + cButton sevenButton; |
---|
| 672 | + cButton fourButton; // full panel |
---|
| 673 | + cButton oneButton; // full XYZ |
---|
| 674 | + //cButton currentLayout; |
---|
| 675 | + |
---|
| 676 | + boolean maximized; |
---|
| 677 | + |
---|
| 678 | + cButton fullscreenLayout; |
---|
| 679 | + |
---|
| 680 | + void Minimize() |
---|
| 681 | + { |
---|
| 682 | + frame.setState(Frame.ICONIFIED); |
---|
| 683 | + } |
---|
| 684 | + |
---|
| 685 | + void Maximize() |
---|
| 686 | + { |
---|
| 687 | + if (maximized) |
---|
| 688 | + { |
---|
| 689 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 690 | + } |
---|
| 691 | + else |
---|
| 692 | + { |
---|
| 693 | + keeprect = frame.getBounds(); |
---|
| 694 | + Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 695 | + Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 696 | + frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 697 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 698 | + } |
---|
| 699 | + |
---|
| 700 | + maximized ^= true; |
---|
| 701 | + } |
---|
| 702 | + |
---|
609 | 703 | void ToggleFullScreen() |
---|
610 | 704 | { |
---|
611 | 705 | if (CameraPane.FULLSCREEN) |
---|
612 | 706 | { |
---|
613 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
614 | | - framePanel.add(bigThree); |
---|
615 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 707 | + device.setFullScreenWindow(null); |
---|
| 708 | + //frame.setVisible(false); |
---|
| 709 | +// frame.removeNotify(); |
---|
| 710 | +// frame.setUndecorated(false); |
---|
| 711 | +// frame.addNotify(); |
---|
| 712 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 713 | + |
---|
| 714 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 715 | +// X framePanel.add(bigThree); |
---|
| 716 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 717 | + framePanel.setDividerLocation(1); |
---|
| 718 | + |
---|
| 719 | + //frame.setVisible(true); |
---|
| 720 | + radio.layout = keepButton; |
---|
| 721 | + //theFrame = null; |
---|
| 722 | + keepButton = null; |
---|
| 723 | + radio.layout.doClick(); |
---|
| 724 | + |
---|
616 | 725 | } else |
---|
617 | 726 | { |
---|
618 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
619 | | - framePanel.remove(bigThree); |
---|
620 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 727 | + keepButton = radio.layout; |
---|
| 728 | + //keeprect = frame.getBounds(); |
---|
| 729 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 730 | +// frame.getToolkit().getScreenSize().height); |
---|
| 731 | + //frame.setVisible(false); |
---|
| 732 | + device.setFullScreenWindow(frame); |
---|
| 733 | +// frame.removeNotify(); |
---|
| 734 | +// frame.setUndecorated(true); |
---|
| 735 | +// frame.addNotify(); |
---|
| 736 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 737 | +// X framePanel.remove(bigThree); |
---|
| 738 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 739 | + framePanel.setDividerLocation(0); |
---|
| 740 | + |
---|
| 741 | + radio.layout = fullscreenLayout; |
---|
| 742 | + radio.layout.doClick(); |
---|
| 743 | + //frame.setVisible(true); |
---|
621 | 744 | } |
---|
| 745 | + |
---|
622 | 746 | cameraView.ToggleFullScreen(); |
---|
623 | 747 | } |
---|
624 | 748 | |
---|
625 | | - private JTextArea createTextPane() |
---|
| 749 | + private JTextPane createTextPane() |
---|
626 | 750 | { |
---|
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 | | - }; |
---|
| 751 | +// TEXTAREA String[] initString = |
---|
| 752 | +// { |
---|
| 753 | +// "This is an editable JTextPane, ", //regular |
---|
| 754 | +// "another ", //italic |
---|
| 755 | +// "styled ", //bold |
---|
| 756 | +// "text ", //small |
---|
| 757 | +// "component, ", //large |
---|
| 758 | +// "which supports embedded components..." + newline,//regular |
---|
| 759 | +// " " + newline, //button |
---|
| 760 | +// "...and embedded icons..." + newline, //regular |
---|
| 761 | +// " ", //icon |
---|
| 762 | +// newline + "JTextPane is a subclass of JEditorPane that " |
---|
| 763 | +// + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
| 764 | +// + "cover methods for interacting with those objects." |
---|
| 765 | +// }; |
---|
| 766 | +// |
---|
| 767 | +// String[] initStyles = |
---|
| 768 | +// { |
---|
| 769 | +// "regular", "italic", "bold", "small", "large", |
---|
| 770 | +// "regular", "button", "regular", "icon", |
---|
| 771 | +// "regular" |
---|
| 772 | +// }; |
---|
| 773 | +// |
---|
| 774 | +// JTextPane textPane = new JTextPane(); |
---|
| 775 | +// textPane.setEditable(true); |
---|
| 776 | +// /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
| 777 | +// addStylesToDocument(doc); |
---|
| 778 | +// |
---|
| 779 | +// try |
---|
| 780 | +// { |
---|
| 781 | +// for (int j = 0; j < 2; j++) |
---|
| 782 | +// { |
---|
| 783 | +// for (int i = 0; i < initString.length; i++) |
---|
| 784 | +// { |
---|
| 785 | +// doc.insertString(doc.getLength(), initString[i], |
---|
| 786 | +// doc.getStyle(initStyles[i])); |
---|
| 787 | +// } |
---|
| 788 | +// } |
---|
| 789 | +// } catch (BadLocationException ble) |
---|
| 790 | +// { |
---|
| 791 | +// System.err.println("Couldn't insert initial text into text pane."); |
---|
| 792 | +// } |
---|
642 | 793 | |
---|
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; |
---|
| 794 | + return new JTextPane(); // textPane; |
---|
671 | 795 | } |
---|
672 | 796 | |
---|
673 | 797 | protected void addStylesToDocument(StyledDocument doc) |
---|
.. | .. |
---|
720 | 844 | protected static ImageIcon createImageIcon(String path, |
---|
721 | 845 | String description) |
---|
722 | 846 | { |
---|
723 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 847 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
724 | 848 | if (imgURL != null) |
---|
725 | 849 | { |
---|
726 | 850 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
752 | 876 | // NumberSlider vDivsField; |
---|
753 | 877 | // JCheckBox endcaps; |
---|
754 | 878 | JCheckBox liveCB; |
---|
| 879 | + JCheckBox selectCB; |
---|
755 | 880 | JCheckBox hideCB; |
---|
756 | 881 | JCheckBox link2masterCB; |
---|
757 | 882 | JCheckBox markCB; |
---|
.. | .. |
---|
767 | 892 | JButton slowerButton; |
---|
768 | 893 | JButton fasterButton; |
---|
769 | 894 | JButton remarkButton; |
---|
| 895 | + |
---|
| 896 | + cGridBag editPanel; |
---|
| 897 | + cGridBag editCommandsPanel; |
---|
| 898 | + |
---|
| 899 | + cGridBag namePanel; |
---|
| 900 | + cGridBag setupPanel; |
---|
| 901 | + cGridBag setupPanel2; |
---|
| 902 | + cGridBag objectCommandsPanel; |
---|
| 903 | + cGridBag pushPanel; |
---|
| 904 | + cGridBag fillPanel; |
---|
770 | 905 | |
---|
771 | | - JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on) |
---|
| 906 | + JCheckBox AddCheckBox(cGridBag panel, String label, boolean on) |
---|
772 | 907 | { |
---|
773 | 908 | JCheckBox cb; |
---|
774 | 909 | |
---|
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); |
---|
| 910 | + panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
780 | 911 | cb.addItemListener(this); |
---|
781 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
782 | | - oe.aConstraints.gridwidth = 1; |
---|
783 | | - oe.aConstraints.gridx += 1; |
---|
784 | 912 | |
---|
785 | 913 | return cb; |
---|
786 | 914 | } |
---|
787 | 915 | |
---|
788 | | - cButton AddButton(ObjEditor oe, String label) |
---|
| 916 | + cButton AddButton(cGridBag panel, String label) |
---|
789 | 917 | { |
---|
790 | 918 | cButton cb; |
---|
791 | 919 | |
---|
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); |
---|
| 920 | + panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); |
---|
797 | 921 | cb.addActionListener(this); |
---|
798 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
799 | | - oe.aConstraints.gridwidth = 1; |
---|
800 | | - oe.aConstraints.gridx += 1; |
---|
801 | 922 | |
---|
802 | 923 | return cb; |
---|
803 | 924 | } |
---|
804 | 925 | |
---|
805 | | - JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item) |
---|
| 926 | + JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item) |
---|
806 | 927 | { |
---|
807 | 928 | JComboBox combo; |
---|
808 | 929 | |
---|
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; |
---|
| 930 | + panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
812 | 931 | combo.addActionListener(this); |
---|
813 | 932 | |
---|
814 | 933 | return combo; |
---|
815 | 934 | } |
---|
816 | 935 | |
---|
817 | | - cNumberSlider AddSlider(cGridBag ctrlPanel, String label, double min, double max, double current, double pow) |
---|
| 936 | + cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow) |
---|
818 | 937 | { |
---|
819 | 938 | cGridBag control = new cGridBag(); |
---|
820 | 939 | |
---|
.. | .. |
---|
826 | 945 | control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
827 | 946 | combo.setFloat(current); |
---|
828 | 947 | |
---|
829 | | - ctrlPanel.add(control); |
---|
| 948 | + panel.add(control); |
---|
830 | 949 | |
---|
831 | | - return combo; |
---|
| 950 | + return control; |
---|
832 | 951 | } |
---|
833 | 952 | |
---|
834 | | - cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current) |
---|
| 953 | + cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current) |
---|
835 | 954 | { |
---|
836 | 955 | cGridBag control = new cGridBag(); |
---|
837 | 956 | |
---|
.. | .. |
---|
839 | 958 | |
---|
840 | 959 | JLabel jlabel = new JLabel(label); |
---|
841 | 960 | 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); |
---|
| 961 | + control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 962 | + control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
844 | 963 | combo.setInteger(current); |
---|
845 | 964 | |
---|
846 | | - ctrlPanel.add(control); |
---|
| 965 | + panel.add(control); |
---|
847 | 966 | |
---|
848 | | - return combo; |
---|
| 967 | + return control; |
---|
849 | 968 | } |
---|
850 | 969 | |
---|
851 | 970 | JTextArea AddText(cGridBag ctrlPanel, String name) |
---|
852 | 971 | { |
---|
853 | 972 | JTextArea text; |
---|
854 | 973 | |
---|
855 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
856 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
857 | 974 | ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
858 | 975 | text.addCaretListener(this); |
---|
859 | | - aConstraints.gridx += 1; |
---|
860 | | - aConstraints.gridwidth = 1; |
---|
861 | 976 | |
---|
862 | 977 | return text; |
---|
863 | 978 | } |
---|
.. | .. |
---|
896 | 1011 | |
---|
897 | 1012 | /* |
---|
898 | 1013 | */ |
---|
899 | | - void Return() // ObjEditor oe) |
---|
| 1014 | + void Return0() // ObjEditor oe) |
---|
900 | 1015 | { |
---|
901 | 1016 | aConstraints.gridy += 1; |
---|
902 | 1017 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
951 | 1066 | |
---|
952 | 1067 | void SetupUI2(ObjEditor oe) |
---|
953 | 1068 | { |
---|
954 | | -// oe.aConstraints.weightx = 0; |
---|
955 | | -// oe.aConstraints.weighty = 0; |
---|
956 | | -// oe.aConstraints.gridx = 0; |
---|
957 | | -// oe.aConstraints.gridy = 0; |
---|
958 | | - SetupName(oe); |
---|
| 1069 | + //SetupName(oe); |
---|
| 1070 | + |
---|
| 1071 | + namePanel = new cGridBag(); |
---|
| 1072 | + |
---|
| 1073 | + nameField = AddText(namePanel, copy.GetName()); |
---|
| 1074 | + namePanel.add(nameField); |
---|
| 1075 | + oe.ctrlPanel.add(namePanel); |
---|
| 1076 | + |
---|
| 1077 | + oe.ctrlPanel.Return(); |
---|
959 | 1078 | |
---|
960 | 1079 | if (!GroupEditor.allparams) |
---|
961 | 1080 | return; |
---|
962 | 1081 | |
---|
963 | | - liveCB = AddCheckBox(oe, "Live", copy.live); |
---|
964 | | - link2masterCB = AddCheckBox(oe, "Supp", copy.link2master); |
---|
965 | | - hideCB = AddCheckBox(oe, "Hide", copy.hide); |
---|
| 1082 | + setupPanel = new cGridBag().setVertical(false); |
---|
| 1083 | + |
---|
| 1084 | + liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
| 1085 | + liveCB.setToolTipText("Animate object"); |
---|
| 1086 | + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1087 | + selectCB.setToolTipText("Make object selectable"); |
---|
966 | 1088 | // 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"); |
---|
| 1089 | + hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 1090 | + hideCB.setToolTipText("Hide object"); |
---|
| 1091 | + markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
| 1092 | + markCB.setToolTipText("Set the animation target transform"); |
---|
| 1093 | + |
---|
| 1094 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1095 | + |
---|
| 1096 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
| 1097 | + rewindCB.setToolTipText("Rewind animation"); |
---|
| 1098 | + |
---|
| 1099 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 1100 | + randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
| 1101 | + |
---|
| 1102 | + if (Globals.ADVANCED) |
---|
| 1103 | + { |
---|
| 1104 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
| 1105 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1106 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
| 1107 | + speedupCB.setToolTipText("Option motion capture"); |
---|
| 1108 | + } |
---|
| 1109 | + |
---|
| 1110 | + oe.ctrlPanel.add(setupPanel); |
---|
| 1111 | + oe.ctrlPanel.Return(); |
---|
| 1112 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1113 | + oe.ctrlPanel.Return(); |
---|
| 1114 | + |
---|
| 1115 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
| 1116 | + |
---|
| 1117 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
| 1118 | + resetButton.setToolTipText("Jump to frame zero"); |
---|
| 1119 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
| 1120 | + stepButton.setToolTipText("Step one frame"); |
---|
973 | 1121 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
974 | 1122 | // stepAllButton = AddButton(oe, "Step All"); |
---|
975 | | - speedupCB = AddCheckBox(oe, "Speed", copy.speedup); |
---|
976 | 1123 | // Return(); |
---|
977 | | - slowerButton = AddButton(oe, "Slow"); |
---|
978 | | - fasterButton = AddButton(oe, "Fast"); |
---|
979 | | - remarkButton = AddButton(oe, "Rem"); |
---|
| 1124 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
| 1125 | + slowerButton.setToolTipText("Decrease animation speed"); |
---|
| 1126 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
| 1127 | + fasterButton.setToolTipText("Increase animation speed"); |
---|
| 1128 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
| 1129 | + remarkButton.setToolTipText("Set the current transform as the target"); |
---|
980 | 1130 | |
---|
981 | | - //Return(); |
---|
| 1131 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
| 1132 | + oe.ctrlPanel.Return(); |
---|
982 | 1133 | |
---|
983 | | - //normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1); |
---|
| 1134 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
| 1135 | + normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
984 | 1136 | //Return(); |
---|
| 1137 | + |
---|
| 1138 | + oe.ctrlPanel.Return(); |
---|
985 | 1139 | |
---|
986 | 1140 | // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2); |
---|
987 | 1141 | // ObjEditor.aConstraints.gridx += 1; |
---|
.. | .. |
---|
1076 | 1230 | oe.aConstraints.gridwidth = 1; |
---|
1077 | 1231 | /**/ |
---|
1078 | 1232 | nameField = AddText(oe.ctrlPanel, copy.GetName()); |
---|
1079 | | - Return(); |
---|
| 1233 | + oe.ctrlPanel.Return(); |
---|
1080 | 1234 | |
---|
1081 | 1235 | //ctrlPanel.add(textureButton = new Button("Texture...")); |
---|
1082 | 1236 | //textureButton.setEnabled(false); |
---|
.. | .. |
---|
1180 | 1334 | //worldPanel.setName("World"); |
---|
1181 | 1335 | centralPanel = new cGridBag(); |
---|
1182 | 1336 | centralPanel.preferredWidth = 20; |
---|
1183 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1184 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1337 | + |
---|
| 1338 | + if (Globals.ADVANCED) |
---|
| 1339 | + { |
---|
| 1340 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1341 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1185 | 1342 | |
---|
1186 | 1343 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1187 | 1344 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1190 | 1347 | // cameraPanel.setDividerSize(9); |
---|
1191 | 1348 | cameraPanel.setResizeWeight(1.0); |
---|
1192 | 1349 | |
---|
| 1350 | + } |
---|
| 1351 | + |
---|
1193 | 1352 | centralPanel.add(cameraView); |
---|
| 1353 | + centralPanel.setFocusable(true); |
---|
1194 | 1354 | //frame.setJMenuBar(timelineMenubar); |
---|
1195 | 1355 | //centralPanel.add(timelinePanel); |
---|
1196 | 1356 | |
---|
.. | .. |
---|
1252 | 1412 | |
---|
1253 | 1413 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1254 | 1414 | //tmp.setName("Edit"); |
---|
| 1415 | + objectPanel.add(toolboxPanel); |
---|
1255 | 1416 | objectPanel.add(materialPanel); |
---|
1256 | | - JPanel north = new JPanel(new BorderLayout()); |
---|
1257 | | - north.setName("Edit"); |
---|
1258 | | - north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1259 | | - objectPanel.add(north); |
---|
| 1417 | +// JPanel north = new JPanel(new BorderLayout()); |
---|
| 1418 | +// north.setName("Edit"); |
---|
| 1419 | +// north.add(ctrlPanel, BorderLayout.NORTH); |
---|
| 1420 | +// objectPanel.add(north); |
---|
| 1421 | + objectPanel.add(editPanel); |
---|
1260 | 1422 | objectPanel.add(infoPanel); |
---|
1261 | 1423 | |
---|
1262 | 1424 | /* |
---|
.. | .. |
---|
1278 | 1440 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1279 | 1441 | |
---|
1280 | 1442 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1281 | | - scenePanel.preferredWidth = 7; |
---|
| 1443 | + scenePanel.preferredWidth = 6; |
---|
1282 | 1444 | |
---|
1283 | 1445 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1284 | 1446 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1384 | 1546 | |
---|
1385 | 1547 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1386 | 1548 | |
---|
1387 | | - frame.setSize(1024, 768); |
---|
1388 | | - frame.show(); |
---|
| 1549 | + frame.setSize(1280, 860); |
---|
| 1550 | + frame.setVisible(true); |
---|
1389 | 1551 | |
---|
| 1552 | + cameraView.requestFocusInWindow(); |
---|
| 1553 | + |
---|
1390 | 1554 | gridPanel.setDividerLocation(1.0); |
---|
1391 | 1555 | |
---|
1392 | 1556 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
1415 | 1579 | ctrlPanel.removeAll(); |
---|
1416 | 1580 | } |
---|
1417 | 1581 | |
---|
1418 | | - void SetupMaterial(cGridBag ctrlPanel) |
---|
| 1582 | + void SetupMaterial(cGridBag panel) |
---|
1419 | 1583 | { |
---|
1420 | 1584 | /* |
---|
1421 | 1585 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
.. | .. |
---|
1424 | 1588 | |
---|
1425 | 1589 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1426 | 1590 | |
---|
1427 | | - editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints); |
---|
| 1591 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1592 | + createMaterialButton.setToolTipText("Create material"); |
---|
1428 | 1593 | |
---|
1429 | 1594 | /* |
---|
1430 | 1595 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1431 | 1596 | */ |
---|
1432 | 1597 | |
---|
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); |
---|
| 1598 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1599 | + clearMaterialButton.setToolTipText("Clear material"); |
---|
| 1600 | + |
---|
| 1601 | + if (Globals.ADVANCED) |
---|
| 1602 | + { |
---|
| 1603 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1604 | + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
| 1605 | + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 1606 | + } |
---|
1437 | 1607 | |
---|
1438 | | - ctrlPanel.add(editBar); |
---|
| 1608 | + editBar.preferredHeight = 15; |
---|
| 1609 | + |
---|
| 1610 | + panel.add(editBar); |
---|
1439 | 1611 | |
---|
1440 | 1612 | /**/ |
---|
1441 | 1613 | //aConstraints.weighty = 0; |
---|
.. | .. |
---|
1484 | 1656 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1485 | 1657 | colorSection.add(shadowbias); |
---|
1486 | 1658 | |
---|
1487 | | - ctrlPanel.add(new JSeparator()); |
---|
| 1659 | + panel.add(new JSeparator()); |
---|
1488 | 1660 | |
---|
1489 | | - ctrlPanel.add(colorSection); |
---|
| 1661 | + panel.add(colorSection); |
---|
1490 | 1662 | |
---|
1491 | 1663 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1492 | 1664 | |
---|
.. | .. |
---|
1534 | 1706 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1535 | 1707 | diffuseSection.add(fakedepth); |
---|
1536 | 1708 | |
---|
1537 | | - ctrlPanel.add(new JSeparator()); |
---|
| 1709 | + panel.add(new JSeparator()); |
---|
1538 | 1710 | |
---|
1539 | | - ctrlPanel.add(diffuseSection); |
---|
| 1711 | + panel.add(diffuseSection); |
---|
1540 | 1712 | |
---|
1541 | 1713 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1542 | 1714 | |
---|
.. | .. |
---|
1572 | 1744 | velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1573 | 1745 | specularSection.add(velvet); |
---|
1574 | 1746 | |
---|
1575 | | - shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1); |
---|
| 1747 | + shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1); |
---|
1576 | 1748 | //Return(); |
---|
1577 | 1749 | // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints); |
---|
1578 | 1750 | // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
.. | .. |
---|
1585 | 1757 | // aConstraints.gridwidth = 1; |
---|
1586 | 1758 | |
---|
1587 | 1759 | |
---|
1588 | | - ctrlPanel.add(new JSeparator()); |
---|
| 1760 | + panel.add(new JSeparator()); |
---|
1589 | 1761 | |
---|
1590 | | - ctrlPanel.add(specularSection); |
---|
| 1762 | + panel.add(specularSection); |
---|
1591 | 1763 | |
---|
1592 | 1764 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1593 | 1765 | |
---|
.. | .. |
---|
1617 | 1789 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1618 | 1790 | globalSection.add(opacity); |
---|
1619 | 1791 | |
---|
1620 | | - ctrlPanel.add(new JSeparator()); |
---|
| 1792 | + panel.add(new JSeparator()); |
---|
1621 | 1793 | |
---|
1622 | | - ctrlPanel.add(globalSection); |
---|
| 1794 | + panel.add(globalSection); |
---|
1623 | 1795 | |
---|
1624 | 1796 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1625 | 1797 | |
---|
.. | .. |
---|
1661 | 1833 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1662 | 1834 | textureSection.add(opacityPower); |
---|
1663 | 1835 | |
---|
1664 | | - ctrlPanel.add(new JSeparator()); |
---|
| 1836 | + panel.add(new JSeparator()); |
---|
1665 | 1837 | |
---|
1666 | | - ctrlPanel.add(textureSection); |
---|
| 1838 | + panel.add(textureSection); |
---|
1667 | 1839 | |
---|
1668 | 1840 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1669 | 1841 | |
---|
.. | .. |
---|
1700 | 1872 | opacityPowerField.addChangeListener(this); |
---|
1701 | 1873 | /**/ |
---|
1702 | 1874 | |
---|
1703 | | - resetSlidersButton.addActionListener(this); |
---|
1704 | 1875 | clearMaterialButton.addActionListener(this); |
---|
1705 | 1876 | createMaterialButton.addActionListener(this); |
---|
1706 | | - |
---|
1707 | | - propagateToggle.addItemListener(this); |
---|
1708 | | - multiplyToggle.addItemListener(this); |
---|
| 1877 | + |
---|
| 1878 | + if (Globals.ADVANCED) |
---|
| 1879 | + { |
---|
| 1880 | + resetSlidersButton.addActionListener(this); |
---|
| 1881 | + propagateToggle.addItemListener(this); |
---|
| 1882 | + multiplyToggle.addItemListener(this); |
---|
| 1883 | + } |
---|
1709 | 1884 | } |
---|
1710 | 1885 | |
---|
1711 | 1886 | void DropFile(java.io.File[] files, boolean textures) |
---|
.. | .. |
---|
1876 | 2051 | |
---|
1877 | 2052 | //? flashIt = false; |
---|
1878 | 2053 | CameraPane pane = (CameraPane) cameraView; |
---|
1879 | | - pane.clickStart(location.x, location.y, 0); |
---|
| 2054 | + pane.clickStart(location.x, location.y, 0, 0); |
---|
1880 | 2055 | pane.clickEnd(location.x, location.y, 0, true); |
---|
1881 | 2056 | |
---|
1882 | 2057 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
1925 | 2100 | e2.printStackTrace(); |
---|
1926 | 2101 | } |
---|
1927 | 2102 | } |
---|
| 2103 | + |
---|
1928 | 2104 | LoadJMEThread loadThread; |
---|
1929 | 2105 | |
---|
1930 | 2106 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
1982 | 2158 | //LoadFile0(filename, converter); |
---|
1983 | 2159 | } |
---|
1984 | 2160 | } |
---|
| 2161 | + |
---|
1985 | 2162 | LoadOBJThread loadObjThread; |
---|
1986 | 2163 | |
---|
1987 | 2164 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2060 | 2237 | |
---|
2061 | 2238 | void LoadObjFile(String fullname) |
---|
2062 | 2239 | { |
---|
2063 | | - /* |
---|
| 2240 | + System.out.println("Loading " + fullname); |
---|
| 2241 | + /**/ |
---|
2064 | 2242 | //lastFilename = fullname; |
---|
2065 | 2243 | if(loadObjThread == null) |
---|
2066 | 2244 | { |
---|
2067 | | - loadObjThread = new LoadOBJThread(); |
---|
2068 | | - loadObjThread.start(); |
---|
| 2245 | + loadObjThread = new LoadOBJThread(); |
---|
| 2246 | + loadObjThread.start(); |
---|
2069 | 2247 | } |
---|
2070 | 2248 | |
---|
2071 | 2249 | loadObjThread.add(fullname); |
---|
2072 | | - */ |
---|
| 2250 | + /**/ |
---|
2073 | 2251 | |
---|
2074 | | - System.out.println("Loading " + fullname); |
---|
2075 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2252 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2076 | 2253 | } |
---|
2077 | 2254 | |
---|
2078 | 2255 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2333 | 2510 | |
---|
2334 | 2511 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2335 | 2512 | { |
---|
2336 | | - if (GrafreeD.standAlone) |
---|
| 2513 | + if (Grafreed.standAlone) |
---|
2337 | 2514 | { |
---|
2338 | 2515 | /**/ |
---|
2339 | 2516 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2340 | | - browser.show(); |
---|
| 2517 | + browser.setVisible(true); |
---|
2341 | 2518 | String filename = browser.getFile(); |
---|
2342 | 2519 | if (filename != null && filename.length() > 0) |
---|
2343 | 2520 | { |
---|
.. | .. |
---|
2482 | 2659 | } |
---|
2483 | 2660 | if (input == null) |
---|
2484 | 2661 | { |
---|
| 2662 | + new Exception().printStackTrace(); |
---|
2485 | 2663 | System.exit(0); |
---|
2486 | 2664 | } |
---|
2487 | 2665 | |
---|
.. | .. |
---|
2696 | 2874 | return; |
---|
2697 | 2875 | } |
---|
2698 | 2876 | |
---|
2699 | | - multiplyToggle.setSelected(mat.multiply); |
---|
| 2877 | + if (multiplyToggle != null) |
---|
| 2878 | + multiplyToggle.setSelected(mat.multiply); |
---|
2700 | 2879 | |
---|
2701 | 2880 | assert (object.projectedVertices != null); |
---|
2702 | 2881 | |
---|
.. | .. |
---|
2911 | 3090 | frame.validate(); |
---|
2912 | 3091 | |
---|
2913 | 3092 | return; |
---|
2914 | | - } else if (event.getSource() == toggleRandomItem) |
---|
| 3093 | + } else if (event.getSource() == toggleSwitchItem) |
---|
2915 | 3094 | { |
---|
2916 | | - cameraView.ToggleRandom(); |
---|
| 3095 | + cameraView.ToggleSwitch(); |
---|
2917 | 3096 | cameraView.repaint(); |
---|
2918 | 3097 | return; |
---|
2919 | 3098 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
2942 | 3121 | { |
---|
2943 | 3122 | copy.live ^= true; |
---|
2944 | 3123 | return; |
---|
| 3124 | + } else if (event.getSource() == selectCB) |
---|
| 3125 | + { |
---|
| 3126 | + copy.dontselect ^= true; |
---|
| 3127 | + return; |
---|
2945 | 3128 | } else if (event.getSource() == hideCB) |
---|
2946 | 3129 | { |
---|
2947 | 3130 | copy.hide ^= true; |
---|
.. | .. |
---|
2956 | 3139 | if (event.getSource() == randomCB) |
---|
2957 | 3140 | { |
---|
2958 | 3141 | copy.random ^= true; |
---|
| 3142 | + objEditor.refreshContents(); |
---|
2959 | 3143 | return; |
---|
2960 | 3144 | } |
---|
2961 | 3145 | if (event.getSource() == speedupCB) |
---|
.. | .. |
---|
2979 | 3163 | |
---|
2980 | 3164 | public void actionPerformed(ActionEvent event) |
---|
2981 | 3165 | { |
---|
| 3166 | + Object source = event.getSource(); |
---|
2982 | 3167 | // SCRIPT DIALOG |
---|
2983 | | - if (event.getSource() == okbutton) |
---|
| 3168 | + if (source == okbutton) |
---|
2984 | 3169 | { |
---|
2985 | 3170 | textpanel.setVisible(false); |
---|
2986 | 3171 | textpanel.remove(textarea); |
---|
.. | .. |
---|
2992 | 3177 | textarea = null; |
---|
2993 | 3178 | textpanel = null; |
---|
2994 | 3179 | } |
---|
2995 | | - if (event.getSource() == cancelbutton) |
---|
| 3180 | + if (source == cancelbutton) |
---|
2996 | 3181 | { |
---|
2997 | 3182 | textpanel.setVisible(false); |
---|
2998 | 3183 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3004 | 3189 | //applySelf(); |
---|
3005 | 3190 | //client.refreshEditWindow(); |
---|
3006 | 3191 | //refreshContents(); |
---|
3007 | | - if (event.getSource() == nameField) |
---|
| 3192 | + if (source == nameField) |
---|
3008 | 3193 | { |
---|
3009 | 3194 | //System.out.println("ObjEditor " + event); |
---|
3010 | 3195 | applySelf0(true); |
---|
3011 | 3196 | //parent.applySelf(); |
---|
3012 | 3197 | objEditor.refreshContents(); |
---|
3013 | | - } else if (event.getSource() == resetButton) |
---|
| 3198 | + } else if (source == resetButton) |
---|
3014 | 3199 | { |
---|
3015 | 3200 | CameraPane.fullreset = true; |
---|
3016 | 3201 | copy.Reset(); // ResetMeshes(); |
---|
3017 | 3202 | copy.Touch(); |
---|
3018 | 3203 | objEditor.refreshContents(); |
---|
3019 | | - } else if (event.getSource() == stepItem) |
---|
| 3204 | + } else if (source == stepItem) |
---|
3020 | 3205 | { |
---|
3021 | 3206 | //cameraView.ONESTEP = true; |
---|
3022 | 3207 | Globals.ONESTEP = true; |
---|
3023 | 3208 | cameraView.repaint(); |
---|
3024 | 3209 | return; |
---|
3025 | | - } else if (event.getSource() == stepButton) |
---|
| 3210 | + } else if (source == stepButton) |
---|
3026 | 3211 | { |
---|
3027 | 3212 | copy.Step(); |
---|
3028 | 3213 | copy.Touch(); |
---|
3029 | 3214 | objEditor.refreshContents(); |
---|
3030 | | - } else if (event.getSource() == slowerButton) |
---|
| 3215 | + } else if (source == slowerButton) |
---|
3031 | 3216 | { |
---|
3032 | 3217 | copy.Slower(); |
---|
3033 | 3218 | copy.Touch(); |
---|
3034 | 3219 | objEditor.refreshContents(); |
---|
3035 | | - } else if (event.getSource() == fasterButton) |
---|
| 3220 | + } else if (source == fasterButton) |
---|
3036 | 3221 | { |
---|
3037 | 3222 | copy.Faster(); |
---|
3038 | 3223 | copy.Touch(); |
---|
3039 | 3224 | objEditor.refreshContents(); |
---|
3040 | | - } else if (event.getSource() == remarkButton) |
---|
| 3225 | + } else if (source == remarkButton) |
---|
3041 | 3226 | { |
---|
3042 | 3227 | copy.Remark(); |
---|
3043 | 3228 | copy.Touch(); |
---|
3044 | 3229 | objEditor.refreshContents(); |
---|
3045 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3230 | + } else if (source == stepAllButton) |
---|
3046 | 3231 | { |
---|
3047 | 3232 | copy.StepAll(); |
---|
3048 | 3233 | copy.Touch(); |
---|
3049 | 3234 | objEditor.refreshContents(); |
---|
3050 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3235 | + } else if (source == resetAllButton) |
---|
3051 | 3236 | { |
---|
3052 | 3237 | //CameraPane.fullreset = true; |
---|
3053 | 3238 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3080 | 3265 | // Close(); |
---|
3081 | 3266 | // } |
---|
3082 | 3267 | // else |
---|
3083 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3268 | + if (source == resetSlidersButton) |
---|
3084 | 3269 | { |
---|
3085 | 3270 | ResetSliders(); |
---|
3086 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3271 | + } else if (source == clearMaterialButton) |
---|
3087 | 3272 | { |
---|
3088 | 3273 | ClearMaterial(); |
---|
3089 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3274 | + } else if (source == createMaterialButton) |
---|
3090 | 3275 | { |
---|
3091 | 3276 | CreateMaterial(); |
---|
3092 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3277 | + } else if (source == clearPanelButton) |
---|
3093 | 3278 | { |
---|
3094 | 3279 | copy.ClearUI(); |
---|
3095 | 3280 | refreshContents(true); |
---|
3096 | | - } /* |
---|
3097 | | - } |
---|
3098 | | - |
---|
3099 | | - public boolean action(Event event, Object arg) |
---|
3100 | | - { |
---|
3101 | | - */ else if (event.getSource() == closeItem) |
---|
| 3281 | + } else if (source == importGFDItem) |
---|
| 3282 | + { |
---|
| 3283 | + ImportGFD(); |
---|
| 3284 | + } else |
---|
| 3285 | + if (source == importVRMLX3DItem) |
---|
| 3286 | + { |
---|
| 3287 | + ImportVRMLX3D(); |
---|
| 3288 | + } else |
---|
| 3289 | + if (source == import3DSItem) |
---|
| 3290 | + { |
---|
| 3291 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3292 | + } else |
---|
| 3293 | + if (source == importOBJItem) |
---|
| 3294 | + { |
---|
| 3295 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3296 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3297 | + browser.setVisible(true); |
---|
| 3298 | + String filename = browser.getFile(); |
---|
| 3299 | + if (filename != null && filename.length() > 0) |
---|
| 3300 | + { |
---|
| 3301 | + String fullname = browser.getDirectory() + filename; |
---|
| 3302 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3303 | + } |
---|
| 3304 | + } else |
---|
| 3305 | + if (source == closeItem) |
---|
3102 | 3306 | { |
---|
3103 | 3307 | Close(); |
---|
3104 | 3308 | //return true; |
---|
3105 | | - } else if (event.getSource() == loadItem) |
---|
| 3309 | + } else if (source == loadItem) |
---|
3106 | 3310 | { |
---|
3107 | 3311 | load(); |
---|
3108 | 3312 | //return true; |
---|
3109 | | - } else if (event.getSource() == saveItem) |
---|
| 3313 | + } else if (source == newItem) |
---|
| 3314 | + { |
---|
| 3315 | + New(); |
---|
| 3316 | + } else if (source == saveItem) |
---|
3110 | 3317 | { |
---|
3111 | 3318 | save(); |
---|
3112 | 3319 | //return true; |
---|
3113 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3320 | + } else if (source == saveAsItem) |
---|
3114 | 3321 | { |
---|
3115 | 3322 | saveAs(); |
---|
3116 | 3323 | //return true; |
---|
3117 | | - } else if (event.getSource() == reexportItem) |
---|
| 3324 | + } else if (source == reexportItem) |
---|
3118 | 3325 | { |
---|
3119 | 3326 | reexport(); |
---|
3120 | 3327 | //return true; |
---|
3121 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3328 | + } else if (source == exportAsItem) |
---|
3122 | 3329 | { |
---|
3123 | 3330 | export(); |
---|
3124 | 3331 | //return true; |
---|
3125 | | - } else if (event.getSource() == povItem) |
---|
| 3332 | + } else if (source == povItem) |
---|
3126 | 3333 | { |
---|
3127 | 3334 | generatePOV(); |
---|
3128 | 3335 | //return true; |
---|
3129 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3336 | + } else if (source == zBufferItem) |
---|
3130 | 3337 | { |
---|
3131 | 3338 | try |
---|
3132 | 3339 | { |
---|
.. | .. |
---|
3148 | 3355 | cameraView.repaint(); |
---|
3149 | 3356 | //return true; |
---|
3150 | 3357 | } |
---|
3151 | | - */ else if (event.getSource() == editCameraItem) |
---|
3152 | | - { |
---|
3153 | | - cameraView.ProtectCamera(); |
---|
3154 | | - cameraView.repaint(); |
---|
3155 | | - return; |
---|
3156 | | - } else if (event.getSource() == revertCameraItem) |
---|
3157 | | - { |
---|
3158 | | - cameraView.RevertCamera(); |
---|
3159 | | - cameraView.repaint(); |
---|
3160 | | - return; |
---|
3161 | | -// } else if (event.getSource() == textureButton) |
---|
3162 | | -// { |
---|
3163 | | -// return; // true; |
---|
3164 | | - } else // combos... |
---|
3165 | | - if (event.getSource() == texresMenu) |
---|
| 3358 | + */ else // combos... |
---|
| 3359 | + if (source == texresMenu) |
---|
3166 | 3360 | { |
---|
3167 | 3361 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3168 | 3362 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3174 | 3368 | } |
---|
3175 | 3369 | } |
---|
3176 | 3370 | |
---|
| 3371 | + void New() |
---|
| 3372 | + { |
---|
| 3373 | + while (copy.Size() > 1) |
---|
| 3374 | + { |
---|
| 3375 | + copy.remove(1); |
---|
| 3376 | + } |
---|
| 3377 | + |
---|
| 3378 | + ResetModel(); |
---|
| 3379 | + objEditor.refreshContents(); |
---|
| 3380 | + } |
---|
| 3381 | + |
---|
| 3382 | + static public byte[] Compress(Object3D o) |
---|
| 3383 | + { |
---|
| 3384 | + try |
---|
| 3385 | + { |
---|
| 3386 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3387 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3388 | + ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3389 | + |
---|
| 3390 | + Object3D parent = o.parent; |
---|
| 3391 | + o.parent = null; |
---|
| 3392 | + |
---|
| 3393 | + out.writeObject(o); |
---|
| 3394 | + |
---|
| 3395 | + o.parent = parent; |
---|
| 3396 | + |
---|
| 3397 | + out.flush(); |
---|
| 3398 | + |
---|
| 3399 | + zstream.close(); |
---|
| 3400 | + out.close(); |
---|
| 3401 | + |
---|
| 3402 | + return baos.toByteArray(); |
---|
| 3403 | + } catch (Exception e) |
---|
| 3404 | + { |
---|
| 3405 | + System.err.println(e); |
---|
| 3406 | + return null; |
---|
| 3407 | + } |
---|
| 3408 | + } |
---|
| 3409 | + |
---|
| 3410 | + static public Object Uncompress(byte[] bytes) |
---|
| 3411 | + { |
---|
| 3412 | + System.out.println("#bytes = " + bytes.length); |
---|
| 3413 | + try |
---|
| 3414 | + { |
---|
| 3415 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3416 | + java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3417 | + ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3418 | + Object obj = in.readObject(); |
---|
| 3419 | + in.close(); |
---|
| 3420 | + |
---|
| 3421 | + return obj; |
---|
| 3422 | + } catch (Exception e) |
---|
| 3423 | + { |
---|
| 3424 | + System.err.println(e); |
---|
| 3425 | + return null; |
---|
| 3426 | + } |
---|
| 3427 | + } |
---|
| 3428 | + |
---|
| 3429 | + static public Object clone(Object o) |
---|
| 3430 | + { |
---|
| 3431 | + try |
---|
| 3432 | + { |
---|
| 3433 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3434 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3435 | + |
---|
| 3436 | + out.writeObject(o); |
---|
| 3437 | + |
---|
| 3438 | + out.flush(); |
---|
| 3439 | + out.close(); |
---|
| 3440 | + |
---|
| 3441 | + byte[] bytes = baos.toByteArray(); |
---|
| 3442 | + |
---|
| 3443 | + System.out.println("clone = " + bytes.length); |
---|
| 3444 | + |
---|
| 3445 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3446 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3447 | + Object obj = in.readObject(); |
---|
| 3448 | + in.close(); |
---|
| 3449 | + |
---|
| 3450 | + return obj; |
---|
| 3451 | + } catch (Exception e) |
---|
| 3452 | + { |
---|
| 3453 | + System.err.println(e); |
---|
| 3454 | + return null; |
---|
| 3455 | + } |
---|
| 3456 | + } |
---|
| 3457 | + |
---|
| 3458 | + cRadio GetCurrentTab() |
---|
| 3459 | + { |
---|
| 3460 | + cRadio ab; |
---|
| 3461 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3462 | + { |
---|
| 3463 | + ab = (cRadio)e.nextElement(); |
---|
| 3464 | + if(ab.GetObject() == copy) |
---|
| 3465 | + { |
---|
| 3466 | + return ab; |
---|
| 3467 | + } |
---|
| 3468 | + } |
---|
| 3469 | + |
---|
| 3470 | + return null; |
---|
| 3471 | + } |
---|
| 3472 | + |
---|
| 3473 | + java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3474 | + |
---|
| 3475 | + public void Save() |
---|
| 3476 | + { |
---|
| 3477 | + System.err.println("Save"); |
---|
| 3478 | + |
---|
| 3479 | + cRadio tab = GetCurrentTab(); |
---|
| 3480 | + |
---|
| 3481 | + boolean temp = CameraPane.SWITCH; |
---|
| 3482 | + CameraPane.SWITCH = false; |
---|
| 3483 | + |
---|
| 3484 | + copy.ExtractBigData(hashtable); |
---|
| 3485 | + |
---|
| 3486 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3487 | + tab.graphs[tab.undoindex++] = Compress(copy); |
---|
| 3488 | + |
---|
| 3489 | + copy.RestoreBigData(hashtable); |
---|
| 3490 | + |
---|
| 3491 | + CameraPane.SWITCH = temp; |
---|
| 3492 | + |
---|
| 3493 | + //assert(hashtable.isEmpty()); |
---|
| 3494 | + |
---|
| 3495 | + for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3496 | + { |
---|
| 3497 | + tab.graphs[i] = null; |
---|
| 3498 | + } |
---|
| 3499 | + |
---|
| 3500 | + // test save |
---|
| 3501 | + if (false) |
---|
| 3502 | + { |
---|
| 3503 | + try |
---|
| 3504 | + { |
---|
| 3505 | + FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3506 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3507 | + |
---|
| 3508 | + p.writeObject(copy); |
---|
| 3509 | + |
---|
| 3510 | + p.flush(); |
---|
| 3511 | + |
---|
| 3512 | + ostream.close(); |
---|
| 3513 | + } catch (Exception e) |
---|
| 3514 | + { |
---|
| 3515 | + e.printStackTrace(); |
---|
| 3516 | + } |
---|
| 3517 | + } |
---|
| 3518 | + } |
---|
| 3519 | + |
---|
| 3520 | + void CopyChanged(Object3D obj) |
---|
| 3521 | + { |
---|
| 3522 | + boolean temp = CameraPane.SWITCH; |
---|
| 3523 | + CameraPane.SWITCH = false; |
---|
| 3524 | + |
---|
| 3525 | + copy.ExtractBigData(hashtable); |
---|
| 3526 | + |
---|
| 3527 | + copy.clear(); |
---|
| 3528 | + |
---|
| 3529 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3530 | + { |
---|
| 3531 | + copy.add(obj.get(i)); |
---|
| 3532 | + } |
---|
| 3533 | + |
---|
| 3534 | + copy.RestoreBigData(hashtable); |
---|
| 3535 | + |
---|
| 3536 | + CameraPane.SWITCH = temp; |
---|
| 3537 | + |
---|
| 3538 | + //assert(hashtable.isEmpty()); |
---|
| 3539 | + |
---|
| 3540 | + copy.Touch(); |
---|
| 3541 | + |
---|
| 3542 | + ResetModel(); |
---|
| 3543 | + copy.HardTouch(); // recompile? |
---|
| 3544 | + |
---|
| 3545 | + cRadio ab; |
---|
| 3546 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3547 | + { |
---|
| 3548 | + ab = (cRadio)e.nextElement(); |
---|
| 3549 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3550 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3551 | + if (test != null) |
---|
| 3552 | + { |
---|
| 3553 | + test.editWindow = ab.object.editWindow; |
---|
| 3554 | + ab.object = test; |
---|
| 3555 | + } |
---|
| 3556 | + } |
---|
| 3557 | + |
---|
| 3558 | + refreshContents(); |
---|
| 3559 | + } |
---|
| 3560 | + |
---|
| 3561 | + public void Undo() |
---|
| 3562 | + { |
---|
| 3563 | + System.err.println("Undo"); |
---|
| 3564 | + |
---|
| 3565 | + cRadio tab = GetCurrentTab(); |
---|
| 3566 | + |
---|
| 3567 | + if (tab.undoindex == 0) |
---|
| 3568 | + { |
---|
| 3569 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3570 | + return; |
---|
| 3571 | + } |
---|
| 3572 | + |
---|
| 3573 | + if (tab.graphs[tab.undoindex] == null) |
---|
| 3574 | + { |
---|
| 3575 | + Save(); |
---|
| 3576 | + tab.undoindex -= 1; |
---|
| 3577 | + } |
---|
| 3578 | + |
---|
| 3579 | + tab.undoindex -= 1; |
---|
| 3580 | + |
---|
| 3581 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3582 | + } |
---|
| 3583 | + |
---|
| 3584 | + public void Redo() |
---|
| 3585 | + { |
---|
| 3586 | + cRadio tab = GetCurrentTab(); |
---|
| 3587 | + |
---|
| 3588 | + if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3589 | + { |
---|
| 3590 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3591 | + return; |
---|
| 3592 | + } |
---|
| 3593 | + |
---|
| 3594 | + tab.undoindex += 1; |
---|
| 3595 | + |
---|
| 3596 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3597 | + } |
---|
| 3598 | + |
---|
| 3599 | + void ImportGFD() |
---|
| 3600 | + { |
---|
| 3601 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 3602 | + browser.show(); |
---|
| 3603 | + String filename = browser.getFile(); |
---|
| 3604 | + if (filename != null && filename.length() > 0) |
---|
| 3605 | + { |
---|
| 3606 | + String fullname = browser.getDirectory() + filename; |
---|
| 3607 | + |
---|
| 3608 | + //Object3D readobj = |
---|
| 3609 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 3610 | + //makeSomething(readobj); |
---|
| 3611 | + } |
---|
| 3612 | + } |
---|
| 3613 | + |
---|
| 3614 | + void ImportVRMLX3D() |
---|
| 3615 | + { |
---|
| 3616 | + if (Grafreed.standAlone) |
---|
| 3617 | + { |
---|
| 3618 | + /**/ |
---|
| 3619 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 3620 | + browser.show(); |
---|
| 3621 | + String filename = browser.getFile(); |
---|
| 3622 | + if (filename != null && filename.length() > 0) |
---|
| 3623 | + { |
---|
| 3624 | + String fullname = browser.getDirectory() + filename; |
---|
| 3625 | + LoadVRMLX3D(fullname); |
---|
| 3626 | + } |
---|
| 3627 | + /**/ |
---|
| 3628 | + } |
---|
| 3629 | + } |
---|
| 3630 | + |
---|
3177 | 3631 | void ToggleAnimation() |
---|
3178 | 3632 | { |
---|
3179 | 3633 | if (!Globals.ANIMATION) |
---|
3180 | 3634 | { |
---|
3181 | 3635 | FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); |
---|
3182 | | - browser.show(); |
---|
| 3636 | + browser.setVisible(true); |
---|
3183 | 3637 | String filename = browser.getFile(); |
---|
3184 | 3638 | if (filename != null && filename.length() > 0) |
---|
3185 | 3639 | { |
---|
.. | .. |
---|
3189 | 3643 | |
---|
3190 | 3644 | Globals.ANIMATION ^= true; |
---|
3191 | 3645 | |
---|
3192 | | - GrafreeD.wav.cursor = 0; |
---|
3193 | | - GrafreeD.wav.loop = 0; |
---|
| 3646 | + Grafreed.wav.cursor = 0; |
---|
| 3647 | + Grafreed.wav.loop = 0; |
---|
3194 | 3648 | } |
---|
3195 | 3649 | } else |
---|
3196 | 3650 | { |
---|
.. | .. |
---|
3240 | 3694 | void CreateMaterial() |
---|
3241 | 3695 | { |
---|
3242 | 3696 | //copy.ClearMaterial(); // PATCH |
---|
3243 | | - copy.CreateMaterialS(multiplyToggle.isSelected()); |
---|
| 3697 | + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); |
---|
3244 | 3698 | if (copy.selection.size() > 0) |
---|
3245 | 3699 | //SetMaterial(copy); |
---|
3246 | 3700 | { |
---|
.. | .. |
---|
3291 | 3745 | assert false; |
---|
3292 | 3746 | } |
---|
3293 | 3747 | |
---|
3294 | | - void EditSelection() |
---|
| 3748 | + void EditSelection(boolean newWindow) |
---|
3295 | 3749 | { |
---|
3296 | 3750 | } |
---|
3297 | 3751 | |
---|
.. | .. |
---|
3299 | 3753 | { |
---|
3300 | 3754 | copy.ResetBlockLoop(); // temporary problem |
---|
3301 | 3755 | |
---|
3302 | | - boolean random = CameraPane.RANDOM; |
---|
3303 | | - CameraPane.RANDOM = false; // parse everything |
---|
| 3756 | + boolean random = CameraPane.SWITCH; |
---|
| 3757 | + CameraPane.SWITCH = false; // parse everything |
---|
3304 | 3758 | copy.ResetDisplayList(); |
---|
3305 | 3759 | copy.HardTouch(); |
---|
3306 | | - CameraPane.RANDOM = random; |
---|
| 3760 | + CameraPane.SWITCH = random; |
---|
3307 | 3761 | } |
---|
3308 | 3762 | |
---|
3309 | 3763 | // public void applySelf() |
---|
.. | .. |
---|
3377 | 3831 | { |
---|
3378 | 3832 | //System.out.println("Propagate = " + propagate); |
---|
3379 | 3833 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 3834 | + |
---|
| 3835 | + if (copy.material != null) |
---|
| 3836 | + { |
---|
| 3837 | + cMaterial mat = copy.material; |
---|
| 3838 | + |
---|
| 3839 | + colorField.SetToolTipValue((mat.color)); |
---|
| 3840 | + modulationField.SetToolTipValue((mat.modulation)); |
---|
| 3841 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 3842 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 3843 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 3844 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 3845 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 3846 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 3847 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 3848 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 3849 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 3850 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 3851 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 3852 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 3853 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 3854 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 3855 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 3856 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 3857 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 3858 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 3859 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 3860 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 3861 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 3862 | + } |
---|
| 3863 | + |
---|
3380 | 3864 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3381 | 3865 | { |
---|
3382 | 3866 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3421 | 3905 | || e.getSource() == apertureField |
---|
3422 | 3906 | || e.getSource() == shadowblurField) |
---|
3423 | 3907 | { |
---|
| 3908 | + new Exception().printStackTrace(); |
---|
3424 | 3909 | System.exit(0); |
---|
3425 | 3910 | cameraView.options1[0] = (float) focusField.getFloat() * 10; |
---|
3426 | 3911 | cameraView.options1[1] = (float) apertureField.getFloat() / 1000; |
---|
.. | .. |
---|
3491 | 3976 | } |
---|
3492 | 3977 | |
---|
3493 | 3978 | if (normalpushField != null) |
---|
3494 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 3979 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3495 | 3980 | } |
---|
3496 | 3981 | |
---|
3497 | 3982 | void SnapObject() |
---|
.. | .. |
---|
3755 | 4240 | |
---|
3756 | 4241 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3757 | 4242 | { |
---|
| 4243 | + if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4244 | + Save(); |
---|
3758 | 4245 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3759 | 4246 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3760 | 4247 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3841 | 4328 | { |
---|
3842 | 4329 | ResetModel(); |
---|
3843 | 4330 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4331 | + |
---|
| 4332 | + if (thing.Size() == 0) |
---|
| 4333 | + { |
---|
| 4334 | + //EditSelection(false); |
---|
| 4335 | + } |
---|
| 4336 | + |
---|
3844 | 4337 | refreshContents(); |
---|
3845 | 4338 | } |
---|
3846 | 4339 | |
---|
.. | .. |
---|
3958 | 4451 | } |
---|
3959 | 4452 | } |
---|
3960 | 4453 | } |
---|
| 4454 | + |
---|
3961 | 4455 | LoadGFDThread loadGFDThread; |
---|
3962 | 4456 | |
---|
3963 | 4457 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
3977 | 4471 | |
---|
3978 | 4472 | try |
---|
3979 | 4473 | { |
---|
| 4474 | + // Try compressed version first. |
---|
3980 | 4475 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
3981 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4476 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4477 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
3982 | 4478 | |
---|
3983 | 4479 | readobj = (Object3D) p.readObject(); |
---|
3984 | 4480 | istream.close(); |
---|
.. | .. |
---|
3986 | 4482 | readobj.ResetDisplayList(); |
---|
3987 | 4483 | } catch (Exception e) |
---|
3988 | 4484 | { |
---|
3989 | | - e.printStackTrace(); |
---|
| 4485 | + //e.printStackTrace(); |
---|
| 4486 | + try |
---|
| 4487 | + { |
---|
| 4488 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4489 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4490 | + |
---|
| 4491 | + readobj = (Object3D) p.readObject(); |
---|
| 4492 | + istream.close(); |
---|
| 4493 | + |
---|
| 4494 | + readobj.ResetDisplayList(); |
---|
| 4495 | + } catch (Exception e2) |
---|
| 4496 | + { |
---|
| 4497 | + e2.printStackTrace(); |
---|
| 4498 | + } |
---|
3990 | 4499 | } |
---|
3991 | 4500 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
3992 | 4501 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4032 | 4541 | |
---|
4033 | 4542 | void LoadIt(Object obj) |
---|
4034 | 4543 | { |
---|
| 4544 | + if (obj == null) |
---|
| 4545 | + { |
---|
| 4546 | + // Invalid file |
---|
| 4547 | + return; |
---|
| 4548 | + } |
---|
| 4549 | + |
---|
4035 | 4550 | System.out.println("Loaded " + obj); |
---|
4036 | 4551 | //new Exception().printStackTrace(); |
---|
4037 | 4552 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4041 | 4556 | |
---|
4042 | 4557 | if (readobj != null) |
---|
4043 | 4558 | { |
---|
| 4559 | + if (Globals.SAVEONMAKE) |
---|
| 4560 | + Save(); |
---|
4044 | 4561 | try |
---|
4045 | 4562 | { |
---|
4046 | 4563 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4103 | 4620 | |
---|
4104 | 4621 | void load() // throws ClassNotFoundException |
---|
4105 | 4622 | { |
---|
4106 | | - if (GrafreeD.standAlone) |
---|
| 4623 | + if (Grafreed.standAlone) |
---|
4107 | 4624 | { |
---|
4108 | 4625 | FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
4109 | 4626 | browser.show(); |
---|
.. | .. |
---|
4190 | 4707 | try |
---|
4191 | 4708 | { |
---|
4192 | 4709 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4193 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4710 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4711 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4194 | 4712 | |
---|
4195 | 4713 | p.writeObject(copy); |
---|
4196 | 4714 | p.flush(); |
---|
4197 | 4715 | |
---|
| 4716 | + zstream.close(); |
---|
4198 | 4717 | ostream.close(); |
---|
4199 | 4718 | |
---|
4200 | 4719 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4204 | 4723 | { |
---|
4205 | 4724 | } |
---|
4206 | 4725 | } |
---|
| 4726 | + |
---|
4207 | 4727 | String lastname; |
---|
4208 | 4728 | |
---|
4209 | 4729 | void saveAs() |
---|
4210 | 4730 | { |
---|
4211 | | - if (GrafreeD.standAlone) |
---|
| 4731 | + if (Grafreed.standAlone) |
---|
4212 | 4732 | { |
---|
4213 | 4733 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4214 | 4734 | browser.setVisible(true); |
---|
.. | .. |
---|
4313 | 4833 | try |
---|
4314 | 4834 | { |
---|
4315 | 4835 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4316 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4317 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 4836 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4837 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4318 | 4838 | |
---|
4319 | 4839 | Object3D objectparent = obj.parent; |
---|
4320 | 4840 | obj.parent = null; |
---|
4321 | 4841 | |
---|
4322 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 4842 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4323 | 4843 | |
---|
4324 | 4844 | obj.parent = objectparent; |
---|
4325 | 4845 | |
---|
.. | .. |
---|
4331 | 4851 | p.writeObject(object); |
---|
4332 | 4852 | p.flush(); |
---|
4333 | 4853 | |
---|
| 4854 | + zstream.close(); |
---|
4334 | 4855 | ostream.close(); |
---|
4335 | | - // zstream.close(); |
---|
4336 | 4856 | |
---|
4337 | 4857 | // group.selection.get(0).parent = parent; |
---|
4338 | 4858 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4353 | 4873 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4354 | 4874 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4355 | 4875 | copy.generatePOV(buffer); |
---|
4356 | | - if (GrafreeD.standAlone) |
---|
| 4876 | + if (Grafreed.standAlone) |
---|
4357 | 4877 | { |
---|
4358 | 4878 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4359 | 4879 | browser.show(); |
---|
.. | .. |
---|
4379 | 4899 | Object3D client; |
---|
4380 | 4900 | Object3D copy; |
---|
4381 | 4901 | MenuBar menuBar; |
---|
4382 | | - Menu windowMenu; |
---|
| 4902 | + Menu fileMenu; |
---|
| 4903 | + MenuItem newItem; |
---|
4383 | 4904 | MenuItem loadItem; |
---|
4384 | 4905 | MenuItem saveItem; |
---|
4385 | 4906 | MenuItem saveAsItem; |
---|
.. | .. |
---|
4387 | 4908 | MenuItem reexportItem; |
---|
4388 | 4909 | MenuItem povItem; |
---|
4389 | 4910 | MenuItem closeItem; |
---|
4390 | | - Menu cameraMenu; |
---|
| 4911 | + |
---|
4391 | 4912 | CheckboxMenuItem zBufferItem; |
---|
4392 | 4913 | //MenuItem normalLensItem; |
---|
4393 | | - MenuItem editCameraItem; |
---|
4394 | | - MenuItem revertCameraItem; |
---|
4395 | | - CheckboxMenuItem toggleLiveItem; |
---|
4396 | 4914 | MenuItem stepItem; |
---|
| 4915 | + CheckboxMenuItem toggleLiveItem; |
---|
4397 | 4916 | CheckboxMenuItem toggleFullScreenItem; |
---|
4398 | 4917 | CheckboxMenuItem toggleTimelineItem; |
---|
4399 | 4918 | CheckboxMenuItem toggleRenderItem; |
---|
.. | .. |
---|
4402 | 4921 | CheckboxMenuItem toggleFootContactItem; |
---|
4403 | 4922 | CheckboxMenuItem toggleDLItem; |
---|
4404 | 4923 | CheckboxMenuItem toggleTextureItem; |
---|
4405 | | - CheckboxMenuItem toggleRandomItem; |
---|
| 4924 | + CheckboxMenuItem toggleSwitchItem; |
---|
4406 | 4925 | CheckboxMenuItem toggleRootItem; |
---|
4407 | 4926 | CheckboxMenuItem animationItem; |
---|
4408 | 4927 | CheckboxMenuItem toggleHandleItem; |
---|
4409 | 4928 | CheckboxMenuItem togglePaintItem; |
---|
4410 | 4929 | JSplitPane mainPanel; |
---|
4411 | 4930 | JScrollPane scrollpane; |
---|
| 4931 | + |
---|
4412 | 4932 | JPanel toolbarPanel; |
---|
4413 | | - JPanel treePanel; |
---|
| 4933 | + |
---|
| 4934 | + cGridBag treePanel; |
---|
| 4935 | + |
---|
4414 | 4936 | JPanel radioPanel; |
---|
4415 | 4937 | ButtonGroup buttonGroup; |
---|
4416 | | - cGridBag ctrlPanel; |
---|
| 4938 | + |
---|
| 4939 | + cGridBag toolboxPanel; |
---|
4417 | 4940 | cGridBag materialPanel; |
---|
| 4941 | + cGridBag ctrlPanel; |
---|
| 4942 | + |
---|
4418 | 4943 | JScrollPane infoPanel; |
---|
| 4944 | + |
---|
4419 | 4945 | cGridBag optionsPanel; |
---|
| 4946 | + |
---|
4420 | 4947 | JTabbedPane objectPanel; |
---|
| 4948 | + |
---|
4421 | 4949 | cGridBag XYZPanel; |
---|
| 4950 | + |
---|
4422 | 4951 | JSplitPane gridPanel; |
---|
4423 | 4952 | JSplitPane bigPanel; |
---|
| 4953 | + |
---|
4424 | 4954 | cGridBag bigThree; |
---|
4425 | 4955 | cGridBag scenePanel; |
---|
4426 | 4956 | cGridBag centralPanel; |
---|
.. | .. |
---|
4535 | 5065 | cNumberSlider fogField; |
---|
4536 | 5066 | JLabel opacityPowerLabel; |
---|
4537 | 5067 | cNumberSlider opacityPowerField; |
---|
4538 | | - JTree jTree; |
---|
| 5068 | + cTree jTree; |
---|
4539 | 5069 | //ObjectUI parent; |
---|
4540 | 5070 | |
---|
4541 | 5071 | cNumberSlider normalpushField; |
---|
| 5072 | + |
---|
| 5073 | + private MenuItem importGFDItem; |
---|
| 5074 | + private MenuItem importVRMLX3DItem; |
---|
| 5075 | + private MenuItem import3DSItem; |
---|
| 5076 | + private MenuItem importOBJItem; |
---|
4542 | 5077 | } |
---|