.. | .. |
---|
4 | 4 | |
---|
5 | 5 | import java.awt.*; |
---|
6 | 6 | import java.awt.event.*; |
---|
| 7 | +import java.awt.image.BufferedImage; |
---|
7 | 8 | import javax.swing.*; |
---|
8 | 9 | import javax.swing.event.*; |
---|
9 | 10 | import javax.swing.text.*; |
---|
.. | .. |
---|
13 | 14 | import javax.swing.plaf.metal.MetalLookAndFeel; |
---|
14 | 15 | //import javax.swing.plaf.ColorUIResource; |
---|
15 | 16 | //import javax.swing.plaf.metal.DefaultMetalTheme; |
---|
| 17 | + |
---|
| 18 | +import javax.swing.plaf.basic.BasicSplitPaneDivider; |
---|
| 19 | +import javax.swing.plaf.basic.BasicSplitPaneUI; |
---|
16 | 20 | |
---|
17 | 21 | //import javax.media.opengl.GLCanvas; |
---|
18 | 22 | |
---|
.. | .. |
---|
35 | 39 | |
---|
36 | 40 | GroupEditor callee; |
---|
37 | 41 | JFrame frame; |
---|
| 42 | + |
---|
| 43 | + static ObjEditor theFrame; |
---|
| 44 | + |
---|
| 45 | + cButton GetButton(String name, boolean border) |
---|
| 46 | + { |
---|
| 47 | + try |
---|
| 48 | + { |
---|
| 49 | + ImageIcon icon = GetIcon(name); |
---|
| 50 | + return new cButton(icon, border); |
---|
| 51 | + } |
---|
| 52 | + catch (Exception e) |
---|
| 53 | + { |
---|
| 54 | + return new cButton(name, border); |
---|
| 55 | + } |
---|
| 56 | + } |
---|
| 57 | + |
---|
| 58 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 59 | + { |
---|
| 60 | + try |
---|
| 61 | + { |
---|
| 62 | + ImageIcon icon = GetIcon(name); |
---|
| 63 | + return new cToggleButton(icon, border); |
---|
| 64 | + } |
---|
| 65 | + catch (Exception e) |
---|
| 66 | + { |
---|
| 67 | + return new cToggleButton(name, border); |
---|
| 68 | + } |
---|
| 69 | + } |
---|
| 70 | + |
---|
| 71 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 72 | + { |
---|
| 73 | + try |
---|
| 74 | + { |
---|
| 75 | + ImageIcon icon = GetIcon(name); |
---|
| 76 | + return new cCheckBox(icon, border); |
---|
| 77 | + } |
---|
| 78 | + catch (Exception e) |
---|
| 79 | + { |
---|
| 80 | + return new cCheckBox(name, border); |
---|
| 81 | + } |
---|
| 82 | + } |
---|
| 83 | + |
---|
| 84 | + private ImageIcon GetIcon(String name) throws IOException |
---|
| 85 | + { |
---|
| 86 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 87 | + |
---|
| 88 | + if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 89 | + { |
---|
| 90 | + BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
| 91 | + Graphics2D g = resized.createGraphics(); |
---|
| 92 | + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 93 | + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 94 | + g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 95 | + g.dispose(); |
---|
| 96 | + |
---|
| 97 | + image = resized; |
---|
| 98 | + } |
---|
| 99 | + |
---|
| 100 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 101 | + return icon; |
---|
| 102 | + } |
---|
38 | 103 | |
---|
39 | 104 | // SCRIPT |
---|
40 | 105 | |
---|
.. | .. |
---|
145 | 210 | |
---|
146 | 211 | objEditor.ctrlPanel.remove(namePanel); |
---|
147 | 212 | |
---|
148 | | - if (!GroupEditor.allparams) |
---|
| 213 | + if (!allparams) |
---|
149 | 214 | return; |
---|
150 | 215 | |
---|
151 | 216 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
168 | 233 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
169 | 234 | |
---|
170 | 235 | objEditor.ctrlPanel.remove(setupPanel); |
---|
171 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 236 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 237 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
172 | 238 | objEditor.ctrlPanel.remove(pushPanel); |
---|
173 | 239 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
174 | 240 | |
---|
.. | .. |
---|
216 | 282 | client = inClient; |
---|
217 | 283 | copy = client; |
---|
218 | 284 | |
---|
| 285 | + if (copy.versions == null) |
---|
| 286 | + { |
---|
| 287 | + copy.versions = new byte[100][]; |
---|
| 288 | + copy.versionindex = -1; |
---|
| 289 | + } |
---|
| 290 | + |
---|
219 | 291 | // "this" is not called: SetupUI2(objEditor); |
---|
220 | 292 | } |
---|
221 | 293 | |
---|
.. | .. |
---|
229 | 301 | client = inClient; |
---|
230 | 302 | copy = client; |
---|
231 | 303 | |
---|
| 304 | + if (copy.versions == null) |
---|
| 305 | + { |
---|
| 306 | + copy.versions = new byte[100][]; |
---|
| 307 | + copy.versionindex = -1; |
---|
| 308 | + } |
---|
| 309 | + |
---|
232 | 310 | SetupUI2(callee.GetEditor()); |
---|
233 | 311 | } |
---|
234 | 312 | |
---|
.. | .. |
---|
243 | 321 | //localCopy.parent = null; |
---|
244 | 322 | |
---|
245 | 323 | frame = new JFrame(); |
---|
| 324 | + frame.setUndecorated(false); |
---|
246 | 325 | objEditor = this; |
---|
247 | 326 | this.callee = callee; |
---|
248 | 327 | |
---|
.. | .. |
---|
260 | 339 | copy = localCopy; |
---|
261 | 340 | copy.editWindow = this; |
---|
262 | 341 | |
---|
| 342 | + if (copy.versions == null) |
---|
| 343 | + { |
---|
| 344 | + copy.versions = new byte[100][]; |
---|
| 345 | + copy.versionindex = -1; |
---|
| 346 | + } |
---|
| 347 | + |
---|
263 | 348 | SetupMenu(); |
---|
264 | 349 | |
---|
265 | 350 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
273 | 358 | return frame.action(event, obj); |
---|
274 | 359 | } |
---|
275 | 360 | |
---|
| 361 | + // Cannot work without static |
---|
| 362 | + static boolean allparams = true; |
---|
| 363 | + |
---|
| 364 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 365 | + |
---|
276 | 366 | void SetupMenu() |
---|
277 | 367 | { |
---|
278 | 368 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
279 | | - menuBar.add(windowMenu = new Menu("File")); |
---|
280 | | - windowMenu.add(loadItem = new MenuItem("Load...")); |
---|
281 | | - windowMenu.add("-"); |
---|
282 | | - windowMenu.add(saveItem = new MenuItem("Save")); |
---|
283 | | - windowMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
| 369 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 370 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 371 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
| 372 | + |
---|
| 373 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 374 | + Menu menu = new Menu("Import"); |
---|
| 375 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 376 | + importOBJItem.addActionListener(this); |
---|
| 377 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 378 | + import3DSItem.addActionListener(this); |
---|
| 379 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 380 | + importVRMLX3DItem.addActionListener(this); |
---|
| 381 | + menu.add("-"); |
---|
| 382 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 383 | + importGFDItem.addActionListener(this); |
---|
| 384 | + fileMenu.add(menu); |
---|
| 385 | + fileMenu.add("-"); |
---|
| 386 | + |
---|
| 387 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 388 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
284 | 389 | //windowMenu.add(povItem = new MenuItem("Emit POV-Ray...")); |
---|
285 | | - windowMenu.add("-"); |
---|
286 | | - windowMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
287 | | - windowMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
288 | | - windowMenu.add("-"); |
---|
| 390 | + fileMenu.add("-"); |
---|
| 391 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 392 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 393 | + fileMenu.add("-"); |
---|
289 | 394 | if (client.parent != null) |
---|
290 | 395 | { |
---|
291 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 396 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
292 | 397 | } else |
---|
293 | 398 | { |
---|
294 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 399 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
295 | 400 | } |
---|
296 | 401 | |
---|
297 | | - loadItem.addActionListener(this); |
---|
| 402 | + newItem.addActionListener(this); |
---|
| 403 | + openItem.addActionListener(this); |
---|
298 | 404 | saveItem.addActionListener(this); |
---|
299 | 405 | saveAsItem.addActionListener(this); |
---|
300 | 406 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
302 | 408 | //povItem.addActionListener(this); |
---|
303 | 409 | closeItem.addActionListener(this); |
---|
304 | 410 | |
---|
305 | | - menuBar.add(cameraMenu = new Menu("View")); |
---|
306 | | - //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer")); |
---|
307 | | - //zBufferItem.addActionListener(this); |
---|
308 | | - //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens")); |
---|
309 | | - //normalLensItem.addActionListener(this); |
---|
310 | | - cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera")); |
---|
311 | | - revertCameraItem.addActionListener(this); |
---|
312 | | - |
---|
313 | | - cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); |
---|
314 | | - toggleFullScreenItem.addItemListener(this); |
---|
315 | | - toggleFullScreenItem.setState(CameraPane.FULLSCREEN); |
---|
316 | | - cameraMenu.add("-"); |
---|
317 | | - |
---|
318 | | - cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); |
---|
319 | | - toggleTextureItem.addItemListener(this); |
---|
320 | | - toggleTextureItem.setState(CameraPane.textureon); |
---|
321 | | - |
---|
322 | | - cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch")); |
---|
323 | | - toggleSwitchItem.addItemListener(this); |
---|
324 | | - toggleSwitchItem.setState(CameraPane.SWITCH); |
---|
325 | | - |
---|
326 | | - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); |
---|
327 | | - toggleHandleItem.addItemListener(this); |
---|
328 | | - toggleHandleItem.setState(CameraPane.HANDLES); |
---|
329 | | - |
---|
330 | | - cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode")); |
---|
331 | | - togglePaintItem.addItemListener(this); |
---|
332 | | - togglePaintItem.setState(CameraPane.PAINTMODE); |
---|
333 | | - |
---|
334 | | - if (Globals.ADVANCED) |
---|
335 | | - { |
---|
336 | | - cameraMenu.add("-"); |
---|
337 | | - cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); |
---|
338 | | - toggleLiveItem.addItemListener(this); |
---|
339 | | - toggleLiveItem.setState(Globals.isLIVE()); |
---|
340 | | - |
---|
341 | | - cameraMenu.add(stepItem = new MenuItem("Step")); |
---|
342 | | - stepItem.addActionListener(this); |
---|
343 | | - // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); |
---|
344 | | - // toggleDLItem.addItemListener(this); |
---|
345 | | - // toggleDLItem.setState(false); |
---|
346 | | - |
---|
347 | | - cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render")); |
---|
348 | | - toggleRenderItem.addItemListener(this); |
---|
349 | | - toggleRenderItem.setState(!CameraPane.frozen); |
---|
350 | | - |
---|
351 | | - cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); |
---|
352 | | - toggleDebugItem.addItemListener(this); |
---|
353 | | - toggleDebugItem.setState(CameraPane.DEBUG); |
---|
354 | | - |
---|
355 | | - cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); |
---|
356 | | - toggleFrustumItem.addItemListener(this); |
---|
357 | | - toggleFrustumItem.setState(CameraPane.FRUSTUM); |
---|
358 | | - |
---|
359 | | - cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact")); |
---|
360 | | - toggleFootContactItem.addItemListener(this); |
---|
361 | | - toggleFootContactItem.setState(CameraPane.FOOTCONTACT); |
---|
362 | | - |
---|
363 | | - cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline")); |
---|
364 | | - toggleTimelineItem.addItemListener(this); |
---|
365 | | - } |
---|
366 | | - |
---|
367 | | -// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root")); |
---|
368 | | -// toggleRootItem.addItemListener(this); |
---|
369 | | -// toggleRootItem.setState(false); |
---|
370 | | -// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation")); |
---|
371 | | -// animationItem.addItemListener(this); |
---|
372 | | -// animationItem.setState(CameraPane.ANIMATION); |
---|
373 | | - cameraMenu.add("-"); |
---|
374 | | - cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera")); |
---|
375 | | - editCameraItem.addActionListener(this); |
---|
376 | | - |
---|
377 | 411 | objectPanel = new JTabbedPane(); |
---|
| 412 | + |
---|
| 413 | + ChangeListener changeListener = new ChangeListener() |
---|
| 414 | + { |
---|
| 415 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 416 | + { |
---|
| 417 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 418 | +// { |
---|
| 419 | +// if (latestObject != null) |
---|
| 420 | +// { |
---|
| 421 | +// refreshContents(true); |
---|
| 422 | +// SetMaterial(latestObject); |
---|
| 423 | +// } |
---|
| 424 | +// |
---|
| 425 | +// materialFlushed = true; |
---|
| 426 | +// } |
---|
| 427 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 428 | +// { |
---|
| 429 | +// if (listUI.size() == 0) |
---|
| 430 | +// EditSelection(false); |
---|
| 431 | +// } |
---|
| 432 | + |
---|
| 433 | + refreshContents(false); // To refresh Info tab |
---|
| 434 | + } |
---|
| 435 | + }; |
---|
| 436 | + objectPanel.addChangeListener(changeListener); |
---|
| 437 | + |
---|
378 | 438 | toolbarPanel = new JPanel(); |
---|
379 | 439 | toolbarPanel.setName("Toolbar"); |
---|
380 | 440 | treePanel = new cGridBag(); |
---|
381 | 441 | treePanel.setName("Tree"); |
---|
| 442 | + |
---|
| 443 | + editPanel = new cGridBag().setVertical(true); |
---|
| 444 | + editPanel.setName("Edit"); |
---|
| 445 | + |
---|
382 | 446 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
383 | | - ctrlPanel.setName("Edit"); |
---|
| 447 | + |
---|
| 448 | + editCommandsPanel = new cGridBag(); |
---|
| 449 | + editPanel.add(editCommandsPanel); |
---|
| 450 | + editPanel.add(ctrlPanel); |
---|
| 451 | + |
---|
| 452 | + toolboxPanel = new cGridBag().setVertical(false); |
---|
| 453 | + toolboxPanel.setName("Toolbox"); |
---|
| 454 | + |
---|
384 | 455 | materialPanel = new cGridBag().setVertical(true); |
---|
385 | 456 | materialPanel.setName("Material"); |
---|
| 457 | + |
---|
386 | 458 | /*JTextPane*/ |
---|
387 | 459 | infoarea = createTextPane(); |
---|
388 | 460 | doc = infoarea.getStyledDocument(); |
---|
.. | .. |
---|
395 | 467 | // TEXTAREA infoarea.setLineWrap(true); |
---|
396 | 468 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
397 | 469 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
398 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
| 470 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
399 | 471 | infoPanel.setName("Info"); |
---|
400 | 472 | //infoPanel.setLayout(new BorderLayout()); |
---|
401 | 473 | //infoPanel.add(createTextPane()); |
---|
.. | .. |
---|
407 | 479 | mainPanel.setDividerSize(9); |
---|
408 | 480 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
409 | 481 | mainPanel.setResizeWeight(0.5); |
---|
410 | | - |
---|
| 482 | + |
---|
| 483 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 484 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 485 | + divider.setDividerSize(15); |
---|
| 486 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 487 | + |
---|
| 488 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 489 | + |
---|
411 | 490 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
412 | 491 | //mainPanel.setLayout(new GridBagLayout()); |
---|
413 | 492 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
475 | 554 | e.printStackTrace(); |
---|
476 | 555 | } |
---|
477 | 556 | |
---|
478 | | - String selection = infoarea.getText(); |
---|
479 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
480 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
481 | | - Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
| 557 | +// String selection = infoarea.getText(); |
---|
| 558 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 559 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 560 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
482 | 561 | //clipboard.setContents(data, data); |
---|
483 | 562 | } |
---|
484 | 563 | |
---|
.. | .. |
---|
501 | 580 | //SendInfo("Name:", "bold"); |
---|
502 | 581 | if (sel.GetTextures() != null || debug) |
---|
503 | 582 | { |
---|
504 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 583 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
505 | 584 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
506 | 585 | if (sel.Size() > 0) |
---|
507 | 586 | { |
---|
508 | 587 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
509 | 588 | } |
---|
510 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 589 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
511 | 590 | if (debug) |
---|
512 | 591 | { |
---|
513 | 592 | try |
---|
.. | .. |
---|
549 | 628 | } |
---|
550 | 629 | if (sel.support != null) |
---|
551 | 630 | { |
---|
552 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 631 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
553 | 632 | } |
---|
554 | 633 | if (sel.scriptnode != null) |
---|
555 | 634 | { |
---|
.. | .. |
---|
638 | 717 | } |
---|
639 | 718 | } |
---|
640 | 719 | |
---|
| 720 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 721 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 722 | + |
---|
| 723 | + Rectangle keeprect; |
---|
| 724 | + cRadio radio; |
---|
| 725 | + |
---|
| 726 | +cButton keepButton; |
---|
| 727 | + cButton twoButton; // Full 3D |
---|
| 728 | + cButton sixButton; |
---|
| 729 | + cButton threeButton; |
---|
| 730 | + cButton sevenButton; |
---|
| 731 | + cButton fourButton; // full panel |
---|
| 732 | + cButton oneButton; // full XYZ |
---|
| 733 | + //cButton currentLayout; |
---|
| 734 | + |
---|
| 735 | + boolean maximized; |
---|
| 736 | + |
---|
| 737 | + cButton fullscreenLayout; |
---|
| 738 | + |
---|
| 739 | + void Minimize() |
---|
| 740 | + { |
---|
| 741 | + frame.setState(Frame.ICONIFIED); |
---|
| 742 | + frame.validate(); |
---|
| 743 | + } |
---|
| 744 | + |
---|
| 745 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 746 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 747 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
| 748 | + void Maximize() |
---|
| 749 | + { |
---|
| 750 | + if (CameraPane.FULLSCREEN) |
---|
| 751 | + { |
---|
| 752 | + ToggleFullScreen(); |
---|
| 753 | + } |
---|
| 754 | + |
---|
| 755 | + if (maximized) |
---|
| 756 | + { |
---|
| 757 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 758 | + } |
---|
| 759 | + else |
---|
| 760 | + { |
---|
| 761 | + keeprect = frame.getBounds(); |
---|
| 762 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 763 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 764 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 765 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 766 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
| 767 | + } |
---|
| 768 | + |
---|
| 769 | + maximized ^= true; |
---|
| 770 | + |
---|
| 771 | + frame.validate(); |
---|
| 772 | + } |
---|
| 773 | + |
---|
| 774 | + cButton minButton; |
---|
| 775 | + cButton maxButton; |
---|
| 776 | + cButton fullButton; |
---|
| 777 | + |
---|
641 | 778 | void ToggleFullScreen() |
---|
642 | 779 | { |
---|
643 | | - if (CameraPane.FULLSCREEN) |
---|
| 780 | +GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 781 | + |
---|
| 782 | + cameraView.ToggleFullScreen(); |
---|
| 783 | + |
---|
| 784 | + if (!CameraPane.FULLSCREEN) |
---|
644 | 785 | { |
---|
645 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
646 | | - framePanel.add(bigThree); |
---|
647 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 786 | + device.setFullScreenWindow(null); |
---|
| 787 | + frame.dispose(); |
---|
| 788 | + frame.setUndecorated(false); |
---|
| 789 | + frame.validate(); |
---|
| 790 | + frame.setVisible(true); |
---|
| 791 | + |
---|
| 792 | + //frame.setVisible(false); |
---|
| 793 | +// frame.removeNotify(); |
---|
| 794 | +// frame.setUndecorated(false); |
---|
| 795 | +// frame.addNotify(); |
---|
| 796 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 797 | + |
---|
| 798 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 799 | +// X framePanel.add(bigThree); |
---|
| 800 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 801 | + framePanel.setDividerLocation(46); |
---|
| 802 | + |
---|
| 803 | + //frame.setVisible(true); |
---|
| 804 | + radio.layout = keepButton; |
---|
| 805 | + //theFrame = null; |
---|
| 806 | + keepButton = null; |
---|
| 807 | + radio.layout.doClick(); |
---|
| 808 | + |
---|
648 | 809 | } else |
---|
649 | 810 | { |
---|
650 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
651 | | - framePanel.remove(bigThree); |
---|
652 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 811 | + keepButton = radio.layout; |
---|
| 812 | + //keeprect = frame.getBounds(); |
---|
| 813 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 814 | +// frame.getToolkit().getScreenSize().height); |
---|
| 815 | + //frame.setVisible(false); |
---|
| 816 | + |
---|
| 817 | + frame.dispose(); |
---|
| 818 | + frame.setUndecorated(true); |
---|
| 819 | + device.setFullScreenWindow(frame); |
---|
| 820 | + frame.validate(); |
---|
| 821 | + frame.setVisible(true); |
---|
| 822 | +// frame.removeNotify(); |
---|
| 823 | +// frame.setUndecorated(true); |
---|
| 824 | +// frame.addNotify(); |
---|
| 825 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 826 | +// X framePanel.remove(bigThree); |
---|
| 827 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 828 | + framePanel.setDividerLocation(0); |
---|
| 829 | + |
---|
| 830 | + radio.layout = fullscreenLayout; |
---|
| 831 | + radio.layout.doClick(); |
---|
| 832 | + //frame.setVisible(true); |
---|
653 | 833 | } |
---|
654 | | - cameraView.ToggleFullScreen(); |
---|
| 834 | + frame.validate(); |
---|
655 | 835 | } |
---|
| 836 | + |
---|
| 837 | + private byte[] CompressCopy() |
---|
| 838 | + { |
---|
| 839 | + boolean temp = CameraPane.SWITCH; |
---|
| 840 | + CameraPane.SWITCH = false; |
---|
| 841 | + |
---|
| 842 | + copy.ExtractBigData(versiontable); |
---|
| 843 | + // if (copy == client) |
---|
| 844 | + |
---|
| 845 | + byte[] versions[] = copy.versions; |
---|
| 846 | + copy.versions = null; |
---|
| 847 | + |
---|
| 848 | + byte[] compress = Compress(copy); |
---|
| 849 | + |
---|
| 850 | + copy.versions = versions; |
---|
| 851 | + |
---|
| 852 | + copy.RestoreBigData(versiontable); |
---|
| 853 | + |
---|
| 854 | + CameraPane.SWITCH = temp; |
---|
| 855 | + |
---|
| 856 | + return compress; |
---|
| 857 | + } |
---|
656 | 858 | |
---|
657 | 859 | private JTextPane createTextPane() |
---|
658 | 860 | { |
---|
.. | .. |
---|
752 | 954 | protected static ImageIcon createImageIcon(String path, |
---|
753 | 955 | String description) |
---|
754 | 956 | { |
---|
755 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 957 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
756 | 958 | if (imgURL != null) |
---|
757 | 959 | { |
---|
758 | 960 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
784 | 986 | // NumberSlider vDivsField; |
---|
785 | 987 | // JCheckBox endcaps; |
---|
786 | 988 | JCheckBox liveCB; |
---|
| 989 | + JCheckBox selectCB; |
---|
787 | 990 | JCheckBox hideCB; |
---|
788 | 991 | JCheckBox link2masterCB; |
---|
789 | 992 | JCheckBox markCB; |
---|
.. | .. |
---|
791 | 994 | JCheckBox speedupCB; |
---|
792 | 995 | JCheckBox rewindCB; |
---|
793 | 996 | JCheckBox flipVCB; |
---|
| 997 | + |
---|
| 998 | + cCheckBox toggleTextureCB; |
---|
| 999 | + cCheckBox toggleSwitchCB; |
---|
| 1000 | + |
---|
794 | 1001 | JComboBox texresMenu; |
---|
| 1002 | + |
---|
795 | 1003 | JButton resetButton; |
---|
796 | 1004 | JButton stepButton; |
---|
797 | 1005 | JButton stepAllButton; |
---|
.. | .. |
---|
800 | 1008 | JButton fasterButton; |
---|
801 | 1009 | JButton remarkButton; |
---|
802 | 1010 | |
---|
| 1011 | + cGridBag editPanel; |
---|
| 1012 | + cGridBag editCommandsPanel; |
---|
| 1013 | + |
---|
803 | 1014 | cGridBag namePanel; |
---|
804 | 1015 | cGridBag setupPanel; |
---|
805 | | - cGridBag commandsPanel; |
---|
| 1016 | + cGridBag setupPanel2; |
---|
| 1017 | + cGridBag objectCommandsPanel; |
---|
806 | 1018 | cGridBag pushPanel; |
---|
807 | 1019 | cGridBag fillPanel; |
---|
808 | 1020 | |
---|
.. | .. |
---|
974 | 1186 | namePanel = new cGridBag(); |
---|
975 | 1187 | |
---|
976 | 1188 | nameField = AddText(namePanel, copy.GetName()); |
---|
977 | | - namePanel.add(nameField); |
---|
| 1189 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
978 | 1190 | oe.ctrlPanel.add(namePanel); |
---|
979 | 1191 | |
---|
980 | 1192 | oe.ctrlPanel.Return(); |
---|
981 | 1193 | |
---|
982 | | - if (!GroupEditor.allparams) |
---|
| 1194 | + if (!allparams) |
---|
983 | 1195 | return; |
---|
984 | 1196 | |
---|
985 | 1197 | setupPanel = new cGridBag().setVertical(false); |
---|
986 | 1198 | |
---|
987 | 1199 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
988 | 1200 | liveCB.setToolTipText("Animate object"); |
---|
| 1201 | + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1202 | + selectCB.setToolTipText("Make object selectable"); |
---|
| 1203 | +// Return(); |
---|
989 | 1204 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
990 | 1205 | hideCB.setToolTipText("Hide object"); |
---|
991 | | -// Return(); |
---|
992 | 1206 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
993 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1207 | + markCB.setToolTipText("As animation target transform"); |
---|
994 | 1208 | |
---|
995 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1209 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1210 | + |
---|
| 1211 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
996 | 1212 | rewindCB.setToolTipText("Rewind animation"); |
---|
997 | 1213 | |
---|
998 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
999 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1214 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1215 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1000 | 1216 | |
---|
| 1217 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1218 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1219 | + |
---|
1001 | 1220 | if (Globals.ADVANCED) |
---|
1002 | 1221 | { |
---|
1003 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
1004 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1005 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1222 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1006 | 1223 | speedupCB.setToolTipText("Option motion capture"); |
---|
1007 | 1224 | } |
---|
1008 | 1225 | |
---|
1009 | 1226 | oe.ctrlPanel.add(setupPanel); |
---|
1010 | 1227 | oe.ctrlPanel.Return(); |
---|
| 1228 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1229 | + oe.ctrlPanel.Return(); |
---|
1011 | 1230 | |
---|
1012 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1231 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
1013 | 1232 | |
---|
1014 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1233 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
1015 | 1234 | resetButton.setToolTipText("Jump to frame zero"); |
---|
1016 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1235 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
1017 | 1236 | stepButton.setToolTipText("Step one frame"); |
---|
1018 | 1237 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
1019 | 1238 | // stepAllButton = AddButton(oe, "Step All"); |
---|
1020 | 1239 | // Return(); |
---|
1021 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1240 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
1022 | 1241 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
1023 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1242 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
1024 | 1243 | fasterButton.setToolTipText("Increase animation speed"); |
---|
1025 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1244 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
1026 | 1245 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
1027 | 1246 | |
---|
1028 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1247 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
1029 | 1248 | oe.ctrlPanel.Return(); |
---|
1030 | 1249 | |
---|
1031 | | - pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1); |
---|
| 1250 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
1032 | 1251 | normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
1033 | 1252 | //Return(); |
---|
1034 | 1253 | |
---|
.. | .. |
---|
1231 | 1450 | //worldPanel.setName("World"); |
---|
1232 | 1451 | centralPanel = new cGridBag(); |
---|
1233 | 1452 | centralPanel.preferredWidth = 20; |
---|
1234 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1235 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1453 | + |
---|
| 1454 | + if (Globals.ADVANCED) |
---|
| 1455 | + { |
---|
| 1456 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1457 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1236 | 1458 | |
---|
1237 | 1459 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1238 | 1460 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1241 | 1463 | // cameraPanel.setDividerSize(9); |
---|
1242 | 1464 | cameraPanel.setResizeWeight(1.0); |
---|
1243 | 1465 | |
---|
| 1466 | + } |
---|
| 1467 | + |
---|
1244 | 1468 | centralPanel.add(cameraView); |
---|
| 1469 | + centralPanel.setFocusable(true); |
---|
1245 | 1470 | //frame.setJMenuBar(timelineMenubar); |
---|
1246 | 1471 | //centralPanel.add(timelinePanel); |
---|
1247 | 1472 | |
---|
.. | .. |
---|
1308 | 1533 | // north.setName("Edit"); |
---|
1309 | 1534 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1310 | 1535 | // objectPanel.add(north); |
---|
1311 | | - objectPanel.add(ctrlPanel); |
---|
1312 | | - objectPanel.add(infoPanel); |
---|
| 1536 | + objectPanel.add(editPanel); |
---|
| 1537 | + |
---|
| 1538 | + //if (Globals.ADVANCED) |
---|
| 1539 | + objectPanel.add(infoPanel); |
---|
| 1540 | + |
---|
| 1541 | + objectPanel.add(toolboxPanel); |
---|
1313 | 1542 | |
---|
1314 | 1543 | /* |
---|
1315 | 1544 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1318 | 1547 | aConstraints.gridy += 1; |
---|
1319 | 1548 | aConstraints.gridwidth = 1; |
---|
1320 | 1549 | mainPanel.add(objectPanel, aConstraints); |
---|
1321 | | - */ |
---|
| 1550 | + */ |
---|
1322 | 1551 | |
---|
1323 | 1552 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1324 | 1553 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1335 | 1564 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1336 | 1565 | tabbedPane.add(scrollpane); |
---|
1337 | 1566 | |
---|
1338 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1339 | | - |
---|
1340 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1567 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1341 | 1568 | |
---|
1342 | 1569 | optionsPanel.setName("Options"); |
---|
1343 | 1570 | |
---|
.. | .. |
---|
1345 | 1572 | |
---|
1346 | 1573 | tabbedPane.add(optionsPanel); |
---|
1347 | 1574 | |
---|
| 1575 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1576 | + |
---|
1348 | 1577 | scenePanel.add(tabbedPane); |
---|
1349 | 1578 | |
---|
1350 | 1579 | /* |
---|
.. | .. |
---|
1417 | 1646 | // aConstraints.gridheight = 1; |
---|
1418 | 1647 | |
---|
1419 | 1648 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1420 | | - framePanel.setContinuousLayout(true); |
---|
1421 | | - framePanel.setOneTouchExpandable(true); |
---|
1422 | | - framePanel.setDividerLocation(0.8); |
---|
| 1649 | + framePanel.setContinuousLayout(false); |
---|
| 1650 | + framePanel.setOneTouchExpandable(false); |
---|
| 1651 | + //.setDividerLocation(0.8); |
---|
1423 | 1652 | //framePanel.setDividerSize(15); |
---|
1424 | 1653 | //framePanel.setResizeWeight(0.15); |
---|
1425 | 1654 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1437 | 1666 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1438 | 1667 | |
---|
1439 | 1668 | frame.setSize(1280, 860); |
---|
1440 | | - frame.setVisible(true); |
---|
1441 | | - |
---|
| 1669 | + |
---|
| 1670 | + cameraView.requestFocusInWindow(); |
---|
| 1671 | + |
---|
1442 | 1672 | gridPanel.setDividerLocation(1.0); |
---|
| 1673 | + |
---|
| 1674 | + frame.validate(); |
---|
| 1675 | + |
---|
| 1676 | + frame.setVisible(true); |
---|
1443 | 1677 | |
---|
1444 | 1678 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1445 | 1679 | frame.addWindowListener(new WindowAdapter() |
---|
.. | .. |
---|
1476 | 1710 | |
---|
1477 | 1711 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1478 | 1712 | |
---|
1479 | | - editBar.add(createMaterialButton = new cButton("Create", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 1713 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1480 | 1714 | createMaterialButton.setToolTipText("Create material"); |
---|
1481 | 1715 | |
---|
1482 | 1716 | /* |
---|
1483 | 1717 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1484 | 1718 | */ |
---|
1485 | 1719 | |
---|
1486 | | - editBar.add(clearMaterialButton = new cButton("Clear", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 1720 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1487 | 1721 | clearMaterialButton.setToolTipText("Clear material"); |
---|
1488 | 1722 | |
---|
1489 | 1723 | if (Globals.ADVANCED) |
---|
1490 | 1724 | { |
---|
1491 | | - editBar.add(resetSlidersButton = new cButton("Reset", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 1725 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1492 | 1726 | editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1493 | 1727 | editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
1494 | 1728 | } |
---|
.. | .. |
---|
1525 | 1759 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1526 | 1760 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1527 | 1761 | colorSection.add(texture); |
---|
1528 | | - |
---|
1529 | | - cGridBag anisoU = new cGridBag(); |
---|
1530 | | - anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
1531 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1532 | | - anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1533 | | - colorSection.add(anisoU); |
---|
1534 | | - |
---|
1535 | | - cGridBag anisoV = new cGridBag(); |
---|
1536 | | - anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
1537 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1538 | | - anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1539 | | - colorSection.add(anisoV); |
---|
1540 | | - |
---|
1541 | | - cGridBag shadowbias = new cGridBag(); |
---|
1542 | | - shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
1543 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1544 | | - shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1545 | | - colorSection.add(shadowbias); |
---|
1546 | 1762 | |
---|
1547 | 1763 | panel.add(new JSeparator()); |
---|
1548 | 1764 | |
---|
.. | .. |
---|
1594 | 1810 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1595 | 1811 | diffuseSection.add(fakedepth); |
---|
1596 | 1812 | |
---|
| 1813 | + cGridBag shadowbias = new cGridBag(); |
---|
| 1814 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 1815 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1816 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1817 | + diffuseSection.add(shadowbias); |
---|
| 1818 | + |
---|
1597 | 1819 | panel.add(new JSeparator()); |
---|
1598 | 1820 | |
---|
1599 | 1821 | panel.add(diffuseSection); |
---|
.. | .. |
---|
1644 | 1866 | // aConstraints.gridy += 1; |
---|
1645 | 1867 | // aConstraints.gridwidth = 1; |
---|
1646 | 1868 | |
---|
| 1869 | + cGridBag anisoU = new cGridBag(); |
---|
| 1870 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 1871 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1872 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1873 | + specularSection.add(anisoU); |
---|
| 1874 | + |
---|
| 1875 | + cGridBag anisoV = new cGridBag(); |
---|
| 1876 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 1877 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1878 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1879 | + specularSection.add(anisoV); |
---|
| 1880 | + |
---|
1647 | 1881 | |
---|
1648 | 1882 | panel.add(new JSeparator()); |
---|
1649 | 1883 | |
---|
.. | .. |
---|
1651 | 1885 | |
---|
1652 | 1886 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1653 | 1887 | |
---|
1654 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 1888 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1655 | 1889 | |
---|
1656 | 1890 | cGridBag camera = new cGridBag(); |
---|
1657 | 1891 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1658 | 1892 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1659 | 1893 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1660 | | - globalSection.add(camera); |
---|
| 1894 | + colorSection.add(camera); |
---|
1661 | 1895 | |
---|
1662 | 1896 | cGridBag ambient = new cGridBag(); |
---|
1663 | 1897 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1664 | 1898 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1665 | 1899 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1666 | | - globalSection.add(ambient); |
---|
| 1900 | + colorSection.add(ambient); |
---|
1667 | 1901 | |
---|
1668 | 1902 | cGridBag backlit = new cGridBag(); |
---|
1669 | 1903 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1670 | 1904 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1671 | 1905 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1672 | | - globalSection.add(backlit); |
---|
| 1906 | + colorSection.add(backlit); |
---|
1673 | 1907 | |
---|
1674 | 1908 | cGridBag opacity = new cGridBag(); |
---|
1675 | 1909 | opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1676 | 1910 | opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1677 | 1911 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1678 | | - globalSection.add(opacity); |
---|
| 1912 | + colorSection.add(opacity); |
---|
1679 | 1913 | |
---|
1680 | | - panel.add(new JSeparator()); |
---|
| 1914 | + //panel.add(new JSeparator()); |
---|
1681 | 1915 | |
---|
1682 | | - panel.add(globalSection); |
---|
| 1916 | + //panel.add(globalSection); |
---|
1683 | 1917 | |
---|
1684 | 1918 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1685 | 1919 | |
---|
.. | .. |
---|
1786 | 2020 | // 3D models |
---|
1787 | 2021 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1788 | 2022 | { |
---|
1789 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1790 | | - LoadFile(filename, lastConverter); |
---|
| 2023 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2024 | + //LoadFile(filename, lastConverter); |
---|
| 2025 | + LoadObjFile(filename); // New 3ds loader |
---|
1791 | 2026 | continue; |
---|
1792 | 2027 | } |
---|
1793 | 2028 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
1988 | 2223 | e2.printStackTrace(); |
---|
1989 | 2224 | } |
---|
1990 | 2225 | } |
---|
| 2226 | + |
---|
1991 | 2227 | LoadJMEThread loadThread; |
---|
1992 | 2228 | |
---|
1993 | 2229 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
2045 | 2281 | //LoadFile0(filename, converter); |
---|
2046 | 2282 | } |
---|
2047 | 2283 | } |
---|
| 2284 | + |
---|
2048 | 2285 | LoadOBJThread loadObjThread; |
---|
2049 | 2286 | |
---|
2050 | 2287 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2123 | 2360 | |
---|
2124 | 2361 | void LoadObjFile(String fullname) |
---|
2125 | 2362 | { |
---|
2126 | | - /* |
---|
| 2363 | + System.out.println("Loading " + fullname); |
---|
| 2364 | + /**/ |
---|
2127 | 2365 | //lastFilename = fullname; |
---|
2128 | 2366 | if(loadObjThread == null) |
---|
2129 | 2367 | { |
---|
2130 | | - loadObjThread = new LoadOBJThread(); |
---|
2131 | | - loadObjThread.start(); |
---|
| 2368 | + loadObjThread = new LoadOBJThread(); |
---|
| 2369 | + loadObjThread.start(); |
---|
2132 | 2370 | } |
---|
2133 | 2371 | |
---|
2134 | 2372 | loadObjThread.add(fullname); |
---|
2135 | | - */ |
---|
| 2373 | + /**/ |
---|
2136 | 2374 | |
---|
2137 | | - System.out.println("Loading " + fullname); |
---|
2138 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2375 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2139 | 2376 | } |
---|
2140 | 2377 | |
---|
2141 | 2378 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2396 | 2633 | |
---|
2397 | 2634 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2398 | 2635 | { |
---|
2399 | | - if (GrafreeD.standAlone) |
---|
| 2636 | + if (Grafreed.standAlone) |
---|
2400 | 2637 | { |
---|
2401 | 2638 | /**/ |
---|
2402 | 2639 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
.. | .. |
---|
2511 | 2748 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2512 | 2749 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2513 | 2750 | } |
---|
| 2751 | + |
---|
2514 | 2752 | //cJME.count++; |
---|
2515 | 2753 | //cJME.count %= 12; |
---|
2516 | 2754 | if (gc) |
---|
.. | .. |
---|
2694 | 2932 | } |
---|
2695 | 2933 | } |
---|
2696 | 2934 | } |
---|
| 2935 | + |
---|
2697 | 2936 | cFileSystemPane FSPane; |
---|
2698 | 2937 | |
---|
2699 | 2938 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2747 | 2986 | } |
---|
2748 | 2987 | } |
---|
2749 | 2988 | } |
---|
| 2989 | + |
---|
2750 | 2990 | freezematerial = false; |
---|
2751 | 2991 | } |
---|
2752 | 2992 | |
---|
2753 | 2993 | void SetMaterial(Object3D object) |
---|
2754 | 2994 | { |
---|
| 2995 | + latestObject = object; |
---|
| 2996 | + |
---|
2755 | 2997 | cMaterial mat = object.material; |
---|
2756 | 2998 | |
---|
2757 | 2999 | if (mat == null) |
---|
.. | .. |
---|
2863 | 3105 | // } |
---|
2864 | 3106 | |
---|
2865 | 3107 | /**/ |
---|
2866 | | - if (deselect) |
---|
| 3108 | + if (deselect || child == null) |
---|
2867 | 3109 | { |
---|
2868 | 3110 | //group.deselectAll(); |
---|
2869 | 3111 | //freeze = true; |
---|
2870 | 3112 | GetTree().clearSelection(); |
---|
2871 | 3113 | //freeze = false; |
---|
| 3114 | + |
---|
| 3115 | + if (child == null) |
---|
| 3116 | + { |
---|
| 3117 | + return; |
---|
| 3118 | + } |
---|
2872 | 3119 | } |
---|
2873 | 3120 | |
---|
2874 | 3121 | //group.addSelectee(child); |
---|
.. | .. |
---|
2937 | 3184 | cameraView.ToggleDL(); |
---|
2938 | 3185 | cameraView.repaint(); |
---|
2939 | 3186 | return; |
---|
2940 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3187 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2941 | 3188 | { |
---|
2942 | 3189 | cameraView.ToggleTexture(); |
---|
2943 | 3190 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2976 | 3223 | frame.validate(); |
---|
2977 | 3224 | |
---|
2978 | 3225 | return; |
---|
2979 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3226 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2980 | 3227 | { |
---|
2981 | | - cameraView.ToggleRandom(); |
---|
| 3228 | + cameraView.ToggleSwitch(); |
---|
2982 | 3229 | cameraView.repaint(); |
---|
2983 | 3230 | return; |
---|
2984 | 3231 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
3006 | 3253 | } else if (event.getSource() == liveCB) |
---|
3007 | 3254 | { |
---|
3008 | 3255 | copy.live ^= true; |
---|
| 3256 | + return; |
---|
| 3257 | + } else if (event.getSource() == selectCB) |
---|
| 3258 | + { |
---|
| 3259 | + copy.dontselect ^= true; |
---|
3009 | 3260 | return; |
---|
3010 | 3261 | } else if (event.getSource() == hideCB) |
---|
3011 | 3262 | { |
---|
.. | .. |
---|
3045 | 3296 | |
---|
3046 | 3297 | public void actionPerformed(ActionEvent event) |
---|
3047 | 3298 | { |
---|
| 3299 | + Object source = event.getSource(); |
---|
3048 | 3300 | // SCRIPT DIALOG |
---|
3049 | | - if (event.getSource() == okbutton) |
---|
| 3301 | + if (source == okbutton) |
---|
3050 | 3302 | { |
---|
3051 | 3303 | textpanel.setVisible(false); |
---|
3052 | 3304 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3058 | 3310 | textarea = null; |
---|
3059 | 3311 | textpanel = null; |
---|
3060 | 3312 | } |
---|
3061 | | - if (event.getSource() == cancelbutton) |
---|
| 3313 | + if (source == cancelbutton) |
---|
3062 | 3314 | { |
---|
3063 | 3315 | textpanel.setVisible(false); |
---|
3064 | 3316 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3070 | 3322 | //applySelf(); |
---|
3071 | 3323 | //client.refreshEditWindow(); |
---|
3072 | 3324 | //refreshContents(); |
---|
3073 | | - if (event.getSource() == nameField) |
---|
| 3325 | + if (source == nameField) |
---|
3074 | 3326 | { |
---|
3075 | 3327 | //System.out.println("ObjEditor " + event); |
---|
3076 | 3328 | applySelf0(true); |
---|
3077 | 3329 | //parent.applySelf(); |
---|
3078 | 3330 | objEditor.refreshContents(); |
---|
3079 | | - } else if (event.getSource() == resetButton) |
---|
| 3331 | + } else if (source == resetButton) |
---|
3080 | 3332 | { |
---|
3081 | 3333 | CameraPane.fullreset = true; |
---|
3082 | 3334 | copy.Reset(); // ResetMeshes(); |
---|
3083 | 3335 | copy.Touch(); |
---|
3084 | 3336 | objEditor.refreshContents(); |
---|
3085 | | - } else if (event.getSource() == stepItem) |
---|
| 3337 | + } else if (source == stepItem) |
---|
3086 | 3338 | { |
---|
3087 | 3339 | //cameraView.ONESTEP = true; |
---|
3088 | 3340 | Globals.ONESTEP = true; |
---|
3089 | 3341 | cameraView.repaint(); |
---|
3090 | 3342 | return; |
---|
3091 | | - } else if (event.getSource() == stepButton) |
---|
| 3343 | + } else if (source == stepButton) |
---|
3092 | 3344 | { |
---|
3093 | 3345 | copy.Step(); |
---|
3094 | 3346 | copy.Touch(); |
---|
3095 | 3347 | objEditor.refreshContents(); |
---|
3096 | | - } else if (event.getSource() == slowerButton) |
---|
| 3348 | + } else if (source == slowerButton) |
---|
3097 | 3349 | { |
---|
3098 | 3350 | copy.Slower(); |
---|
3099 | 3351 | copy.Touch(); |
---|
3100 | 3352 | objEditor.refreshContents(); |
---|
3101 | | - } else if (event.getSource() == fasterButton) |
---|
| 3353 | + } else if (source == fasterButton) |
---|
3102 | 3354 | { |
---|
3103 | 3355 | copy.Faster(); |
---|
3104 | 3356 | copy.Touch(); |
---|
3105 | 3357 | objEditor.refreshContents(); |
---|
3106 | | - } else if (event.getSource() == remarkButton) |
---|
| 3358 | + } else if (source == remarkButton) |
---|
3107 | 3359 | { |
---|
3108 | 3360 | copy.Remark(); |
---|
3109 | 3361 | copy.Touch(); |
---|
3110 | 3362 | objEditor.refreshContents(); |
---|
3111 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3363 | + } else if (source == stepAllButton) |
---|
3112 | 3364 | { |
---|
3113 | 3365 | copy.StepAll(); |
---|
3114 | 3366 | copy.Touch(); |
---|
3115 | 3367 | objEditor.refreshContents(); |
---|
3116 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3368 | + } else if (source == resetAllButton) |
---|
3117 | 3369 | { |
---|
3118 | 3370 | //CameraPane.fullreset = true; |
---|
3119 | 3371 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3146 | 3398 | // Close(); |
---|
3147 | 3399 | // } |
---|
3148 | 3400 | // else |
---|
3149 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3401 | + if (source == resetSlidersButton) |
---|
3150 | 3402 | { |
---|
3151 | 3403 | ResetSliders(); |
---|
3152 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3404 | + } else if (source == clearMaterialButton) |
---|
3153 | 3405 | { |
---|
3154 | 3406 | ClearMaterial(); |
---|
3155 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3407 | + } else if (source == createMaterialButton) |
---|
3156 | 3408 | { |
---|
3157 | 3409 | CreateMaterial(); |
---|
3158 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3410 | + } else if (source == clearPanelButton) |
---|
3159 | 3411 | { |
---|
3160 | 3412 | copy.ClearUI(); |
---|
3161 | 3413 | refreshContents(true); |
---|
3162 | | - } /* |
---|
3163 | | - } |
---|
3164 | | - |
---|
3165 | | - public boolean action(Event event, Object arg) |
---|
3166 | | - { |
---|
3167 | | - */ else if (event.getSource() == closeItem) |
---|
| 3414 | + } else if (source == importGFDItem) |
---|
| 3415 | + { |
---|
| 3416 | + ImportGFD(); |
---|
| 3417 | + } else |
---|
| 3418 | + if (source == importVRMLX3DItem) |
---|
| 3419 | + { |
---|
| 3420 | + ImportVRMLX3D(); |
---|
| 3421 | + } else |
---|
| 3422 | + if (source == import3DSItem) |
---|
| 3423 | + { |
---|
| 3424 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3425 | + } else |
---|
| 3426 | + if (source == importOBJItem) |
---|
| 3427 | + { |
---|
| 3428 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3429 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3430 | + browser.setVisible(true); |
---|
| 3431 | + String filename = browser.getFile(); |
---|
| 3432 | + if (filename != null && filename.length() > 0) |
---|
| 3433 | + { |
---|
| 3434 | + String fullname = browser.getDirectory() + filename; |
---|
| 3435 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3436 | + } |
---|
| 3437 | + } else |
---|
| 3438 | + if (source == closeItem) |
---|
3168 | 3439 | { |
---|
3169 | 3440 | Close(); |
---|
3170 | 3441 | //return true; |
---|
3171 | | - } else if (event.getSource() == loadItem) |
---|
| 3442 | + } else if (source == openItem) |
---|
3172 | 3443 | { |
---|
3173 | | - load(); |
---|
| 3444 | + Open(); |
---|
3174 | 3445 | //return true; |
---|
3175 | | - } else if (event.getSource() == saveItem) |
---|
| 3446 | + } else if (source == newItem) |
---|
| 3447 | + { |
---|
| 3448 | + New(); |
---|
| 3449 | + } else if (source == saveItem) |
---|
3176 | 3450 | { |
---|
3177 | 3451 | save(); |
---|
3178 | 3452 | //return true; |
---|
3179 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3453 | + } else if (source == saveAsItem) |
---|
3180 | 3454 | { |
---|
3181 | 3455 | saveAs(); |
---|
3182 | 3456 | //return true; |
---|
3183 | | - } else if (event.getSource() == reexportItem) |
---|
| 3457 | + } else if (source == reexportItem) |
---|
3184 | 3458 | { |
---|
3185 | 3459 | reexport(); |
---|
3186 | 3460 | //return true; |
---|
3187 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3461 | + } else if (source == exportAsItem) |
---|
3188 | 3462 | { |
---|
3189 | 3463 | export(); |
---|
3190 | 3464 | //return true; |
---|
3191 | | - } else if (event.getSource() == povItem) |
---|
| 3465 | + } else if (source == povItem) |
---|
3192 | 3466 | { |
---|
3193 | 3467 | generatePOV(); |
---|
3194 | 3468 | //return true; |
---|
3195 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3469 | + } else if (event.getSource() == archiveItem) |
---|
| 3470 | + { |
---|
| 3471 | + cTools.Archive(frame); |
---|
| 3472 | + return; |
---|
| 3473 | + } else if (source == zBufferItem) |
---|
3196 | 3474 | { |
---|
3197 | 3475 | try |
---|
3198 | 3476 | { |
---|
.. | .. |
---|
3214 | 3492 | cameraView.repaint(); |
---|
3215 | 3493 | //return true; |
---|
3216 | 3494 | } |
---|
3217 | | - */ else if (event.getSource() == editCameraItem) |
---|
3218 | | - { |
---|
3219 | | - cameraView.ProtectCamera(); |
---|
3220 | | - cameraView.repaint(); |
---|
3221 | | - return; |
---|
3222 | | - } else if (event.getSource() == revertCameraItem) |
---|
3223 | | - { |
---|
3224 | | - cameraView.RevertCamera(); |
---|
3225 | | - cameraView.repaint(); |
---|
3226 | | - return; |
---|
3227 | | -// } else if (event.getSource() == textureButton) |
---|
3228 | | -// { |
---|
3229 | | -// return; // true; |
---|
3230 | | - } else // combos... |
---|
3231 | | - if (event.getSource() == texresMenu) |
---|
| 3495 | + */ else // combos... |
---|
| 3496 | + if (source == texresMenu) |
---|
3232 | 3497 | { |
---|
3233 | 3498 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3234 | 3499 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3240 | 3505 | } |
---|
3241 | 3506 | } |
---|
3242 | 3507 | |
---|
| 3508 | + void New() |
---|
| 3509 | + { |
---|
| 3510 | + while (copy.Size() > 1) |
---|
| 3511 | + { |
---|
| 3512 | + copy.remove(1); |
---|
| 3513 | + } |
---|
| 3514 | + |
---|
| 3515 | + ResetModel(); |
---|
| 3516 | + objEditor.refreshContents(); |
---|
| 3517 | + } |
---|
| 3518 | + |
---|
| 3519 | + static public byte[] Compress(Object3D o) |
---|
| 3520 | + { |
---|
| 3521 | + try |
---|
| 3522 | + { |
---|
| 3523 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3524 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3525 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
| 3526 | + |
---|
| 3527 | + Object3D parent = o.parent; |
---|
| 3528 | + o.parent = null; |
---|
| 3529 | + |
---|
| 3530 | + out.writeObject(o); |
---|
| 3531 | + |
---|
| 3532 | + o.parent = parent; |
---|
| 3533 | + |
---|
| 3534 | + out.flush(); |
---|
| 3535 | + |
---|
| 3536 | + baos //zstream |
---|
| 3537 | + .close(); |
---|
| 3538 | + out.close(); |
---|
| 3539 | + |
---|
| 3540 | + byte[] bytes = baos.toByteArray(); |
---|
| 3541 | + |
---|
| 3542 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 3543 | + return bytes; |
---|
| 3544 | + } catch (Exception e) |
---|
| 3545 | + { |
---|
| 3546 | + System.err.println(e); |
---|
| 3547 | + return null; |
---|
| 3548 | + } |
---|
| 3549 | + } |
---|
| 3550 | + |
---|
| 3551 | + static public Object Uncompress(byte[] bytes) |
---|
| 3552 | + { |
---|
| 3553 | + System.out.println("restore #bytes = " + bytes.length); |
---|
| 3554 | + try |
---|
| 3555 | + { |
---|
| 3556 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3557 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3558 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
| 3559 | + Object obj = in.readObject(); |
---|
| 3560 | + |
---|
| 3561 | + bais //istream |
---|
| 3562 | + .close(); |
---|
| 3563 | + in.close(); |
---|
| 3564 | + |
---|
| 3565 | + return obj; |
---|
| 3566 | + } catch (Exception e) |
---|
| 3567 | + { |
---|
| 3568 | + System.err.println(e); |
---|
| 3569 | + return null; |
---|
| 3570 | + } |
---|
| 3571 | + } |
---|
| 3572 | + |
---|
| 3573 | + static public Object clone(Object o) |
---|
| 3574 | + { |
---|
| 3575 | + try |
---|
| 3576 | + { |
---|
| 3577 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3578 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3579 | + |
---|
| 3580 | + out.writeObject(o); |
---|
| 3581 | + |
---|
| 3582 | + out.flush(); |
---|
| 3583 | + out.close(); |
---|
| 3584 | + |
---|
| 3585 | + byte[] bytes = baos.toByteArray(); |
---|
| 3586 | + |
---|
| 3587 | + System.out.println("clone = " + bytes.length); |
---|
| 3588 | + |
---|
| 3589 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3590 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3591 | + Object obj = in.readObject(); |
---|
| 3592 | + in.close(); |
---|
| 3593 | + |
---|
| 3594 | + return obj; |
---|
| 3595 | + } catch (Exception e) |
---|
| 3596 | + { |
---|
| 3597 | + System.err.println(e); |
---|
| 3598 | + return null; |
---|
| 3599 | + } |
---|
| 3600 | + } |
---|
| 3601 | + |
---|
| 3602 | + cRadio GetCurrentTab() |
---|
| 3603 | + { |
---|
| 3604 | + cRadio ab; |
---|
| 3605 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3606 | + { |
---|
| 3607 | + ab = (cRadio)e.nextElement(); |
---|
| 3608 | + if(ab.GetObject() == copy) |
---|
| 3609 | + { |
---|
| 3610 | + return ab; |
---|
| 3611 | + } |
---|
| 3612 | + } |
---|
| 3613 | + |
---|
| 3614 | + return null; |
---|
| 3615 | + } |
---|
| 3616 | + |
---|
| 3617 | + |
---|
| 3618 | + public void Save() |
---|
| 3619 | + { |
---|
| 3620 | + //Save(true); |
---|
| 3621 | + Replace(); |
---|
| 3622 | + } |
---|
| 3623 | + |
---|
| 3624 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 3625 | + { |
---|
| 3626 | + if (compress.length != name.length) |
---|
| 3627 | + { |
---|
| 3628 | + return false; |
---|
| 3629 | + } |
---|
| 3630 | + |
---|
| 3631 | + for (int i=compress.length; --i>=0;) |
---|
| 3632 | + { |
---|
| 3633 | + if (compress[i] != name[i]) |
---|
| 3634 | + return false; |
---|
| 3635 | + } |
---|
| 3636 | + |
---|
| 3637 | + return true; |
---|
| 3638 | + } |
---|
| 3639 | + |
---|
| 3640 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3641 | + |
---|
| 3642 | + public boolean Save(boolean user) |
---|
| 3643 | + { |
---|
| 3644 | + System.err.println("Save"); |
---|
| 3645 | + |
---|
| 3646 | + cRadio tab = GetCurrentTab(); |
---|
| 3647 | + |
---|
| 3648 | + byte[] compress = CompressCopy(); |
---|
| 3649 | + |
---|
| 3650 | + boolean thesame = false; |
---|
| 3651 | + |
---|
| 3652 | + // Quick heuristic using length. Works only when stream is compressed. |
---|
| 3653 | + if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 3654 | + { |
---|
| 3655 | + thesame = true; |
---|
| 3656 | + } |
---|
| 3657 | + |
---|
| 3658 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3659 | + if (!thesame) |
---|
| 3660 | + { |
---|
| 3661 | + //tab.user[tab.versionindex] = user; |
---|
| 3662 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 3663 | + |
---|
| 3664 | + copy.versions[++copy.versionindex] = compress; |
---|
| 3665 | + |
---|
| 3666 | + // if (increment) |
---|
| 3667 | + // tab.versionindex++; |
---|
| 3668 | + } |
---|
| 3669 | + |
---|
| 3670 | + //copy.RestoreBigData(versiontable); |
---|
| 3671 | + |
---|
| 3672 | + //assert(hashtable.isEmpty()); |
---|
| 3673 | + |
---|
| 3674 | + for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
| 3675 | + { |
---|
| 3676 | + //tab.user[i] = false; |
---|
| 3677 | + copy.versions[i] = null; |
---|
| 3678 | + } |
---|
| 3679 | + |
---|
| 3680 | + SetUndoStates(); |
---|
| 3681 | + |
---|
| 3682 | + // test save |
---|
| 3683 | + if (false) |
---|
| 3684 | + { |
---|
| 3685 | + try |
---|
| 3686 | + { |
---|
| 3687 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
| 3688 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3689 | + |
---|
| 3690 | + p.writeObject(copy); |
---|
| 3691 | + |
---|
| 3692 | + p.flush(); |
---|
| 3693 | + |
---|
| 3694 | + ostream.close(); |
---|
| 3695 | + } catch (Exception e) |
---|
| 3696 | + { |
---|
| 3697 | + e.printStackTrace(); |
---|
| 3698 | + } |
---|
| 3699 | + } |
---|
| 3700 | + |
---|
| 3701 | + return !thesame; |
---|
| 3702 | + } |
---|
| 3703 | + |
---|
| 3704 | + void CopyChanged(Object3D obj) |
---|
| 3705 | + { |
---|
| 3706 | + SetUndoStates(); |
---|
| 3707 | + |
---|
| 3708 | + boolean temp = CameraPane.SWITCH; |
---|
| 3709 | + CameraPane.SWITCH = false; |
---|
| 3710 | + |
---|
| 3711 | + copy.ExtractBigData(versiontable); |
---|
| 3712 | + |
---|
| 3713 | + copy.clear(); |
---|
| 3714 | + |
---|
| 3715 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3716 | + { |
---|
| 3717 | + copy.add(obj.get(i)); |
---|
| 3718 | + } |
---|
| 3719 | + |
---|
| 3720 | + copy.RestoreBigData(versiontable); |
---|
| 3721 | + |
---|
| 3722 | + CameraPane.SWITCH = temp; |
---|
| 3723 | + |
---|
| 3724 | + //assert(hashtable.isEmpty()); |
---|
| 3725 | + |
---|
| 3726 | + copy.Touch(); |
---|
| 3727 | + |
---|
| 3728 | + ResetModel(); |
---|
| 3729 | + copy.HardTouch(); // recompile? |
---|
| 3730 | + |
---|
| 3731 | + cRadio ab; |
---|
| 3732 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3733 | + { |
---|
| 3734 | + ab = (cRadio)e.nextElement(); |
---|
| 3735 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3736 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3737 | + if (test != null) |
---|
| 3738 | + { |
---|
| 3739 | + test.editWindow = ab.object.editWindow; |
---|
| 3740 | + ab.object = test; |
---|
| 3741 | + } |
---|
| 3742 | + } |
---|
| 3743 | + |
---|
| 3744 | + refreshContents(); |
---|
| 3745 | + } |
---|
| 3746 | + |
---|
| 3747 | + cButton undoButton; |
---|
| 3748 | + cButton restoreButton; |
---|
| 3749 | + cButton replaceButton; |
---|
| 3750 | + cButton redoButton; |
---|
| 3751 | + |
---|
| 3752 | + boolean muteSlider; |
---|
| 3753 | + |
---|
| 3754 | + int VersionCount() |
---|
| 3755 | + { |
---|
| 3756 | + int count = 0; |
---|
| 3757 | + |
---|
| 3758 | + for (int i = copy.versions.length; --i >= 0;) |
---|
| 3759 | + { |
---|
| 3760 | + if (copy.versions[i] != null) |
---|
| 3761 | + count++; |
---|
| 3762 | + } |
---|
| 3763 | + |
---|
| 3764 | + return count; |
---|
| 3765 | + } |
---|
| 3766 | + |
---|
| 3767 | + void SetUndoStates() |
---|
| 3768 | + { |
---|
| 3769 | + cRadio tab = GetCurrentTab(); |
---|
| 3770 | + |
---|
| 3771 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 3772 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 3773 | + |
---|
| 3774 | + undoButton.setEnabled(copy.versionindex > 0); |
---|
| 3775 | + redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 3776 | + |
---|
| 3777 | + muteSlider = true; |
---|
| 3778 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 3779 | + versionSlider.setInteger(copy.versionindex); |
---|
| 3780 | + muteSlider = false; |
---|
| 3781 | + } |
---|
| 3782 | + |
---|
| 3783 | + public boolean Undo() |
---|
| 3784 | + { |
---|
| 3785 | + // Option? |
---|
| 3786 | + Replace(); |
---|
| 3787 | + |
---|
| 3788 | + System.err.println("Undo"); |
---|
| 3789 | + |
---|
| 3790 | + cRadio tab = GetCurrentTab(); |
---|
| 3791 | + |
---|
| 3792 | + if (copy.versionindex == 0) |
---|
| 3793 | + { |
---|
| 3794 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3795 | + return false; |
---|
| 3796 | + } |
---|
| 3797 | + |
---|
| 3798 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 3799 | +// { |
---|
| 3800 | +// if (Save(false)) |
---|
| 3801 | +// tab.versionindex -= 1; |
---|
| 3802 | +// else |
---|
| 3803 | +// { |
---|
| 3804 | +// if (tab.versionindex <= 0) |
---|
| 3805 | +// return false; |
---|
| 3806 | +// else |
---|
| 3807 | +// tab.versionindex -= 1; |
---|
| 3808 | +// } |
---|
| 3809 | +// } |
---|
| 3810 | + |
---|
| 3811 | + copy.versionindex -= 1; |
---|
| 3812 | + |
---|
| 3813 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3814 | + |
---|
| 3815 | + return true; |
---|
| 3816 | + } |
---|
| 3817 | + |
---|
| 3818 | + public boolean Restore() |
---|
| 3819 | + { |
---|
| 3820 | + System.err.println("Restore"); |
---|
| 3821 | + |
---|
| 3822 | + cRadio tab = GetCurrentTab(); |
---|
| 3823 | + |
---|
| 3824 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 3825 | + { |
---|
| 3826 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3827 | + return false; |
---|
| 3828 | + } |
---|
| 3829 | + |
---|
| 3830 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3831 | + |
---|
| 3832 | + return true; |
---|
| 3833 | + } |
---|
| 3834 | + |
---|
| 3835 | + public boolean Replace() |
---|
| 3836 | + { |
---|
| 3837 | + System.err.println("Replace"); |
---|
| 3838 | + |
---|
| 3839 | + cRadio tab = GetCurrentTab(); |
---|
| 3840 | + |
---|
| 3841 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 3842 | + { |
---|
| 3843 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3844 | + return false; |
---|
| 3845 | + } |
---|
| 3846 | + |
---|
| 3847 | + copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 3848 | + |
---|
| 3849 | + return true; |
---|
| 3850 | + } |
---|
| 3851 | + |
---|
| 3852 | + public void Redo() |
---|
| 3853 | + { |
---|
| 3854 | + // Option? |
---|
| 3855 | + Replace(); |
---|
| 3856 | + |
---|
| 3857 | + cRadio tab = GetCurrentTab(); |
---|
| 3858 | + |
---|
| 3859 | + if (copy.versions[copy.versionindex + 1] == null) |
---|
| 3860 | + { |
---|
| 3861 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3862 | + return; |
---|
| 3863 | + } |
---|
| 3864 | + |
---|
| 3865 | + copy.versionindex += 1; |
---|
| 3866 | + |
---|
| 3867 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3868 | + |
---|
| 3869 | + //if (!tab.user[tab.versionindex]) |
---|
| 3870 | + // tab.graphs[tab.versionindex] = null; |
---|
| 3871 | + } |
---|
| 3872 | + |
---|
| 3873 | + void ImportGFD() |
---|
| 3874 | + { |
---|
| 3875 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 3876 | + browser.show(); |
---|
| 3877 | + String filename = browser.getFile(); |
---|
| 3878 | + if (filename != null && filename.length() > 0) |
---|
| 3879 | + { |
---|
| 3880 | + String fullname = browser.getDirectory() + filename; |
---|
| 3881 | + |
---|
| 3882 | + //Object3D readobj = |
---|
| 3883 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 3884 | + //makeSomething(readobj); |
---|
| 3885 | + } |
---|
| 3886 | + } |
---|
| 3887 | + |
---|
| 3888 | + void ImportVRMLX3D() |
---|
| 3889 | + { |
---|
| 3890 | + if (Grafreed.standAlone) |
---|
| 3891 | + { |
---|
| 3892 | + /**/ |
---|
| 3893 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 3894 | + browser.show(); |
---|
| 3895 | + String filename = browser.getFile(); |
---|
| 3896 | + if (filename != null && filename.length() > 0) |
---|
| 3897 | + { |
---|
| 3898 | + String fullname = browser.getDirectory() + filename; |
---|
| 3899 | + LoadVRMLX3D(fullname); |
---|
| 3900 | + } |
---|
| 3901 | + /**/ |
---|
| 3902 | + } |
---|
| 3903 | + } |
---|
| 3904 | + |
---|
3243 | 3905 | void ToggleAnimation() |
---|
3244 | 3906 | { |
---|
3245 | 3907 | if (!Globals.ANIMATION) |
---|
.. | .. |
---|
3255 | 3917 | |
---|
3256 | 3918 | Globals.ANIMATION ^= true; |
---|
3257 | 3919 | |
---|
3258 | | - GrafreeD.wav.cursor = 0; |
---|
3259 | | - GrafreeD.wav.loop = 0; |
---|
| 3920 | + Grafreed.wav.cursor = 0; |
---|
| 3921 | + Grafreed.wav.loop = 0; |
---|
3260 | 3922 | } |
---|
3261 | 3923 | } else |
---|
3262 | 3924 | { |
---|
.. | .. |
---|
3357 | 4019 | assert false; |
---|
3358 | 4020 | } |
---|
3359 | 4021 | |
---|
3360 | | - void EditSelection() |
---|
| 4022 | + void EditSelection(boolean newWindow) |
---|
3361 | 4023 | { |
---|
3362 | 4024 | } |
---|
3363 | 4025 | |
---|
.. | .. |
---|
3501 | 4163 | //copy.Touch(); |
---|
3502 | 4164 | } |
---|
3503 | 4165 | |
---|
| 4166 | + cNumberSlider versionSlider; |
---|
| 4167 | + |
---|
3504 | 4168 | public void stateChanged(ChangeEvent e) |
---|
3505 | 4169 | { |
---|
3506 | 4170 | // assert(false); |
---|
| 4171 | + if (e.getSource() == versionSlider) |
---|
| 4172 | + { |
---|
| 4173 | + if (muteSlider) |
---|
| 4174 | + return; |
---|
| 4175 | + |
---|
| 4176 | + int version = versionSlider.getInteger(); |
---|
| 4177 | + |
---|
| 4178 | + if (copy.versions[version] != null) |
---|
| 4179 | + { |
---|
| 4180 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4181 | + } |
---|
| 4182 | + |
---|
| 4183 | + return; |
---|
| 4184 | + } |
---|
3507 | 4185 | |
---|
3508 | 4186 | if (freezematerial) |
---|
3509 | 4187 | { |
---|
.. | .. |
---|
3588 | 4266 | } |
---|
3589 | 4267 | |
---|
3590 | 4268 | if (normalpushField != null) |
---|
3591 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 4269 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3592 | 4270 | } |
---|
3593 | 4271 | |
---|
3594 | 4272 | void SnapObject() |
---|
.. | .. |
---|
3852 | 4530 | |
---|
3853 | 4531 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3854 | 4532 | { |
---|
| 4533 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
| 4534 | + Save(); |
---|
3855 | 4535 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3856 | 4536 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3857 | 4537 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3938 | 4618 | { |
---|
3939 | 4619 | ResetModel(); |
---|
3940 | 4620 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4621 | + |
---|
| 4622 | + if (thing.Size() == 0) |
---|
| 4623 | + { |
---|
| 4624 | + //EditSelection(false); |
---|
| 4625 | + } |
---|
| 4626 | + |
---|
3941 | 4627 | refreshContents(); |
---|
3942 | 4628 | } |
---|
3943 | 4629 | |
---|
.. | .. |
---|
4055 | 4741 | } |
---|
4056 | 4742 | } |
---|
4057 | 4743 | } |
---|
| 4744 | + |
---|
4058 | 4745 | LoadGFDThread loadGFDThread; |
---|
4059 | 4746 | |
---|
4060 | 4747 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
4074 | 4761 | |
---|
4075 | 4762 | try |
---|
4076 | 4763 | { |
---|
| 4764 | + // Try compressed version first. |
---|
4077 | 4765 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4078 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4766 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4767 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
4079 | 4768 | |
---|
4080 | 4769 | readobj = (Object3D) p.readObject(); |
---|
4081 | 4770 | istream.close(); |
---|
.. | .. |
---|
4083 | 4772 | readobj.ResetDisplayList(); |
---|
4084 | 4773 | } catch (Exception e) |
---|
4085 | 4774 | { |
---|
4086 | | - e.printStackTrace(); |
---|
| 4775 | + //e.printStackTrace(); |
---|
| 4776 | + try |
---|
| 4777 | + { |
---|
| 4778 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4779 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4780 | + |
---|
| 4781 | + readobj = (Object3D) p.readObject(); |
---|
| 4782 | + istream.close(); |
---|
| 4783 | + |
---|
| 4784 | + readobj.ResetDisplayList(); |
---|
| 4785 | + } catch (Exception e2) |
---|
| 4786 | + { |
---|
| 4787 | + e2.printStackTrace(); |
---|
| 4788 | + } |
---|
4087 | 4789 | } |
---|
4088 | 4790 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4089 | 4791 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4129 | 4831 | |
---|
4130 | 4832 | void LoadIt(Object obj) |
---|
4131 | 4833 | { |
---|
| 4834 | + if (obj == null) |
---|
| 4835 | + { |
---|
| 4836 | + // Invalid file |
---|
| 4837 | + return; |
---|
| 4838 | + } |
---|
| 4839 | + |
---|
4132 | 4840 | System.out.println("Loaded " + obj); |
---|
4133 | 4841 | //new Exception().printStackTrace(); |
---|
4134 | 4842 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4138 | 4846 | |
---|
4139 | 4847 | if (readobj != null) |
---|
4140 | 4848 | { |
---|
| 4849 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 4850 | + // Save(); |
---|
4141 | 4851 | try |
---|
4142 | 4852 | { |
---|
4143 | 4853 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4192 | 4902 | c.addChild(csg); |
---|
4193 | 4903 | } |
---|
4194 | 4904 | |
---|
| 4905 | + copy.versions = readobj.versions; |
---|
| 4906 | + copy.versionindex = readobj.versionindex; |
---|
| 4907 | + |
---|
| 4908 | + if (copy.versions == null) |
---|
| 4909 | + { |
---|
| 4910 | + copy.versions = new byte[100][]; |
---|
| 4911 | + copy.versionindex = -1; |
---|
| 4912 | + } |
---|
| 4913 | + |
---|
| 4914 | + //? SetUndoStates(); |
---|
| 4915 | + |
---|
4195 | 4916 | ResetModel(); |
---|
4196 | 4917 | copy.HardTouch(); // recompile? |
---|
4197 | 4918 | refreshContents(); |
---|
4198 | 4919 | } |
---|
4199 | 4920 | } |
---|
4200 | 4921 | |
---|
4201 | | - void load() // throws ClassNotFoundException |
---|
| 4922 | + void Open() // throws ClassNotFoundException |
---|
4202 | 4923 | { |
---|
4203 | | - if (GrafreeD.standAlone) |
---|
| 4924 | + if (Grafreed.standAlone) |
---|
4204 | 4925 | { |
---|
4205 | 4926 | FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
4206 | 4927 | browser.show(); |
---|
.. | .. |
---|
4287 | 5008 | try |
---|
4288 | 5009 | { |
---|
4289 | 5010 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4290 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 5011 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5012 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4291 | 5013 | |
---|
4292 | 5014 | p.writeObject(copy); |
---|
4293 | 5015 | p.flush(); |
---|
4294 | 5016 | |
---|
| 5017 | + zstream.close(); |
---|
4295 | 5018 | ostream.close(); |
---|
4296 | 5019 | |
---|
4297 | 5020 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4301 | 5024 | { |
---|
4302 | 5025 | } |
---|
4303 | 5026 | } |
---|
| 5027 | + |
---|
4304 | 5028 | String lastname; |
---|
4305 | 5029 | |
---|
4306 | 5030 | void saveAs() |
---|
4307 | 5031 | { |
---|
4308 | | - if (GrafreeD.standAlone) |
---|
| 5032 | + if (Grafreed.standAlone) |
---|
4309 | 5033 | { |
---|
4310 | 5034 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4311 | 5035 | browser.setVisible(true); |
---|
4312 | 5036 | String filename = browser.getFile(); |
---|
4313 | 5037 | if (filename != null && filename.length() > 0) |
---|
4314 | 5038 | { |
---|
| 5039 | + if (!filename.endsWith(".gfd")) |
---|
| 5040 | + filename += ".gfd"; |
---|
4315 | 5041 | lastname = browser.getDirectory() + filename; |
---|
4316 | 5042 | save(); |
---|
4317 | 5043 | } |
---|
.. | .. |
---|
4410 | 5136 | try |
---|
4411 | 5137 | { |
---|
4412 | 5138 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4413 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4414 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 5139 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5140 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4415 | 5141 | |
---|
4416 | 5142 | Object3D objectparent = obj.parent; |
---|
4417 | 5143 | obj.parent = null; |
---|
4418 | 5144 | |
---|
4419 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 5145 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4420 | 5146 | |
---|
4421 | 5147 | obj.parent = objectparent; |
---|
4422 | 5148 | |
---|
.. | .. |
---|
4428 | 5154 | p.writeObject(object); |
---|
4429 | 5155 | p.flush(); |
---|
4430 | 5156 | |
---|
| 5157 | + zstream.close(); |
---|
4431 | 5158 | ostream.close(); |
---|
4432 | | - // zstream.close(); |
---|
4433 | 5159 | |
---|
4434 | 5160 | // group.selection.get(0).parent = parent; |
---|
4435 | 5161 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4450 | 5176 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4451 | 5177 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4452 | 5178 | copy.generatePOV(buffer); |
---|
4453 | | - if (GrafreeD.standAlone) |
---|
| 5179 | + if (Grafreed.standAlone) |
---|
4454 | 5180 | { |
---|
4455 | 5181 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4456 | 5182 | browser.show(); |
---|
.. | .. |
---|
4476 | 5202 | Object3D client; |
---|
4477 | 5203 | Object3D copy; |
---|
4478 | 5204 | MenuBar menuBar; |
---|
4479 | | - Menu windowMenu; |
---|
4480 | | - MenuItem loadItem; |
---|
| 5205 | + Menu fileMenu; |
---|
| 5206 | + MenuItem newItem; |
---|
| 5207 | + MenuItem openItem; |
---|
4481 | 5208 | MenuItem saveItem; |
---|
4482 | 5209 | MenuItem saveAsItem; |
---|
4483 | 5210 | MenuItem exportAsItem; |
---|
4484 | 5211 | MenuItem reexportItem; |
---|
4485 | 5212 | MenuItem povItem; |
---|
4486 | 5213 | MenuItem closeItem; |
---|
4487 | | - Menu cameraMenu; |
---|
| 5214 | + |
---|
4488 | 5215 | CheckboxMenuItem zBufferItem; |
---|
4489 | 5216 | //MenuItem normalLensItem; |
---|
4490 | | - MenuItem editCameraItem; |
---|
4491 | | - MenuItem revertCameraItem; |
---|
4492 | 5217 | MenuItem stepItem; |
---|
4493 | 5218 | CheckboxMenuItem toggleLiveItem; |
---|
4494 | 5219 | CheckboxMenuItem toggleFullScreenItem; |
---|
.. | .. |
---|
4502 | 5227 | CheckboxMenuItem toggleSwitchItem; |
---|
4503 | 5228 | CheckboxMenuItem toggleRootItem; |
---|
4504 | 5229 | CheckboxMenuItem animationItem; |
---|
| 5230 | + MenuItem archiveItem; |
---|
4505 | 5231 | CheckboxMenuItem toggleHandleItem; |
---|
4506 | 5232 | CheckboxMenuItem togglePaintItem; |
---|
4507 | 5233 | JSplitPane mainPanel; |
---|
4508 | 5234 | JScrollPane scrollpane; |
---|
| 5235 | + |
---|
4509 | 5236 | JPanel toolbarPanel; |
---|
| 5237 | + |
---|
4510 | 5238 | cGridBag treePanel; |
---|
| 5239 | + |
---|
4511 | 5240 | JPanel radioPanel; |
---|
4512 | 5241 | ButtonGroup buttonGroup; |
---|
4513 | | - cGridBag ctrlPanel; |
---|
| 5242 | + |
---|
| 5243 | + cGridBag toolboxPanel; |
---|
4514 | 5244 | cGridBag materialPanel; |
---|
| 5245 | + cGridBag ctrlPanel; |
---|
| 5246 | + |
---|
4515 | 5247 | JScrollPane infoPanel; |
---|
| 5248 | + |
---|
4516 | 5249 | cGridBag optionsPanel; |
---|
| 5250 | + |
---|
4517 | 5251 | JTabbedPane objectPanel; |
---|
| 5252 | + boolean materialFlushed; |
---|
| 5253 | + Object3D latestObject; |
---|
| 5254 | + |
---|
4518 | 5255 | cGridBag XYZPanel; |
---|
| 5256 | + |
---|
4519 | 5257 | JSplitPane gridPanel; |
---|
4520 | 5258 | JSplitPane bigPanel; |
---|
| 5259 | + |
---|
4521 | 5260 | cGridBag bigThree; |
---|
4522 | 5261 | cGridBag scenePanel; |
---|
4523 | 5262 | cGridBag centralPanel; |
---|
.. | .. |
---|
4632 | 5371 | cNumberSlider fogField; |
---|
4633 | 5372 | JLabel opacityPowerLabel; |
---|
4634 | 5373 | cNumberSlider opacityPowerField; |
---|
4635 | | - JTree jTree; |
---|
| 5374 | + cTree jTree; |
---|
4636 | 5375 | //ObjectUI parent; |
---|
4637 | 5376 | |
---|
4638 | 5377 | cNumberSlider normalpushField; |
---|
| 5378 | + |
---|
| 5379 | + private MenuItem importGFDItem; |
---|
| 5380 | + private MenuItem importVRMLX3DItem; |
---|
| 5381 | + private MenuItem import3DSItem; |
---|
| 5382 | + private MenuItem importOBJItem; |
---|
4639 | 5383 | } |
---|