.. | .. |
---|
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 | + public cGridBag GetSeparator() |
---|
| 46 | + { |
---|
| 47 | + cGridBag separator = new cGridBag(); |
---|
| 48 | + separator.add(new JSeparator()); |
---|
| 49 | + separator.preferredHeight = 5; |
---|
| 50 | + return separator; |
---|
| 51 | + } |
---|
| 52 | + |
---|
| 53 | + cButton GetButton(String name, boolean border) |
---|
| 54 | + { |
---|
| 55 | + ImageIcon icon = GetIcon(name); |
---|
| 56 | + return new cButton(icon, border); |
---|
| 57 | + } |
---|
| 58 | + |
---|
| 59 | + cLabel GetLabel(String name, boolean border) |
---|
| 60 | + { |
---|
| 61 | + //ImageIcon icon = GetIcon(name); |
---|
| 62 | + return new cLabel(GetImage(name), border); |
---|
| 63 | + } |
---|
| 64 | + |
---|
| 65 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 66 | + { |
---|
| 67 | + ImageIcon icon = GetIcon(name); |
---|
| 68 | + return new cToggleButton(icon, border); |
---|
| 69 | + } |
---|
| 70 | + |
---|
| 71 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 72 | + { |
---|
| 73 | + ImageIcon icon = GetIcon(name); |
---|
| 74 | + return new cCheckBox(icon, border); |
---|
| 75 | + } |
---|
| 76 | + |
---|
| 77 | + ImageIcon GetIcon(String name) |
---|
| 78 | + { |
---|
| 79 | + try |
---|
| 80 | + { |
---|
| 81 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 82 | + |
---|
| 83 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 84 | +// { |
---|
| 85 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 86 | +// Graphics2D g = resized.createGraphics(); |
---|
| 87 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 88 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 89 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 90 | +// g.dispose(); |
---|
| 91 | +// |
---|
| 92 | +// image = resized; |
---|
| 93 | +// } |
---|
| 94 | + |
---|
| 95 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 96 | + return icon; |
---|
| 97 | + } |
---|
| 98 | + catch (Exception e) |
---|
| 99 | + { |
---|
| 100 | + return null; |
---|
| 101 | + } |
---|
| 102 | + } |
---|
| 103 | + |
---|
| 104 | + BufferedImage GetImage(String name) |
---|
| 105 | + { |
---|
| 106 | + try |
---|
| 107 | + { |
---|
| 108 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 109 | + |
---|
| 110 | + return image; |
---|
| 111 | + } |
---|
| 112 | + catch (Exception e) |
---|
| 113 | + { |
---|
| 114 | + return null; |
---|
| 115 | + } |
---|
| 116 | + } |
---|
38 | 117 | |
---|
39 | 118 | // SCRIPT |
---|
40 | 119 | |
---|
.. | .. |
---|
145 | 224 | |
---|
146 | 225 | objEditor.ctrlPanel.remove(namePanel); |
---|
147 | 226 | |
---|
148 | | - if (!GroupEditor.allparams) |
---|
| 227 | + if (!allparams) |
---|
149 | 228 | return; |
---|
150 | 229 | |
---|
151 | 230 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
168 | 247 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
169 | 248 | |
---|
170 | 249 | objEditor.ctrlPanel.remove(setupPanel); |
---|
171 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 250 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 251 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
172 | 252 | objEditor.ctrlPanel.remove(pushPanel); |
---|
173 | 253 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
174 | 254 | |
---|
.. | .. |
---|
216 | 296 | client = inClient; |
---|
217 | 297 | copy = client; |
---|
218 | 298 | |
---|
| 299 | + if (copy.versions == null) |
---|
| 300 | + { |
---|
| 301 | + copy.versions = new byte[100][]; |
---|
| 302 | + copy.versionindex = -1; |
---|
| 303 | + } |
---|
| 304 | + |
---|
219 | 305 | // "this" is not called: SetupUI2(objEditor); |
---|
220 | 306 | } |
---|
221 | 307 | |
---|
.. | .. |
---|
229 | 315 | client = inClient; |
---|
230 | 316 | copy = client; |
---|
231 | 317 | |
---|
| 318 | + if (copy.versions == null) |
---|
| 319 | + { |
---|
| 320 | + copy.versions = new byte[100][]; |
---|
| 321 | + copy.versionindex = -1; |
---|
| 322 | + } |
---|
| 323 | + |
---|
232 | 324 | SetupUI2(callee.GetEditor()); |
---|
233 | 325 | } |
---|
234 | 326 | |
---|
.. | .. |
---|
243 | 335 | //localCopy.parent = null; |
---|
244 | 336 | |
---|
245 | 337 | frame = new JFrame(); |
---|
| 338 | + frame.setUndecorated(false); |
---|
246 | 339 | objEditor = this; |
---|
247 | 340 | this.callee = callee; |
---|
248 | 341 | |
---|
.. | .. |
---|
260 | 353 | copy = localCopy; |
---|
261 | 354 | copy.editWindow = this; |
---|
262 | 355 | |
---|
| 356 | + if (copy.versions == null) |
---|
| 357 | + { |
---|
| 358 | +// copy.versions = new byte[100][]; |
---|
| 359 | +// copy.versionindex = -1; |
---|
| 360 | + } |
---|
| 361 | + |
---|
263 | 362 | SetupMenu(); |
---|
264 | 363 | |
---|
265 | 364 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
273 | 372 | return frame.action(event, obj); |
---|
274 | 373 | } |
---|
275 | 374 | |
---|
| 375 | + // Cannot work without static |
---|
| 376 | + static boolean allparams = true; |
---|
| 377 | + |
---|
| 378 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 379 | + |
---|
276 | 380 | void SetupMenu() |
---|
277 | 381 | { |
---|
278 | 382 | 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...")); |
---|
| 383 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 384 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 385 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
| 386 | + |
---|
| 387 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 388 | + Menu menu = new Menu("Import"); |
---|
| 389 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 390 | + importOBJItem.addActionListener(this); |
---|
| 391 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 392 | + import3DSItem.addActionListener(this); |
---|
| 393 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 394 | + importVRMLX3DItem.addActionListener(this); |
---|
| 395 | + menu.add("-"); |
---|
| 396 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 397 | + importGFDItem.addActionListener(this); |
---|
| 398 | + fileMenu.add(menu); |
---|
| 399 | + fileMenu.add("-"); |
---|
| 400 | + |
---|
| 401 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 402 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
284 | 403 | //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("-"); |
---|
| 404 | + fileMenu.add("-"); |
---|
| 405 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 406 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 407 | + fileMenu.add("-"); |
---|
289 | 408 | if (client.parent != null) |
---|
290 | 409 | { |
---|
291 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 410 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
292 | 411 | } else |
---|
293 | 412 | { |
---|
294 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 413 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
295 | 414 | } |
---|
296 | 415 | |
---|
297 | | - loadItem.addActionListener(this); |
---|
| 416 | + newItem.addActionListener(this); |
---|
| 417 | + openItem.addActionListener(this); |
---|
298 | 418 | saveItem.addActionListener(this); |
---|
299 | 419 | saveAsItem.addActionListener(this); |
---|
300 | 420 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
302 | 422 | //povItem.addActionListener(this); |
---|
303 | 423 | closeItem.addActionListener(this); |
---|
304 | 424 | |
---|
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 | 425 | objectPanel = new JTabbedPane(); |
---|
| 426 | + |
---|
| 427 | + ChangeListener changeListener = new ChangeListener() |
---|
| 428 | + { |
---|
| 429 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 430 | + { |
---|
| 431 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 432 | +// { |
---|
| 433 | +// if (latestObject != null) |
---|
| 434 | +// { |
---|
| 435 | +// refreshContents(true); |
---|
| 436 | +// SetMaterial(latestObject); |
---|
| 437 | +// } |
---|
| 438 | +// |
---|
| 439 | +// materialFlushed = true; |
---|
| 440 | +// } |
---|
| 441 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 442 | +// { |
---|
| 443 | +// if (listUI.size() == 0) |
---|
| 444 | +// EditSelection(false); |
---|
| 445 | +// } |
---|
| 446 | + |
---|
| 447 | + refreshContents(false); // To refresh Info tab |
---|
| 448 | + } |
---|
| 449 | + }; |
---|
| 450 | + objectPanel.addChangeListener(changeListener); |
---|
| 451 | + |
---|
378 | 452 | toolbarPanel = new JPanel(); |
---|
379 | 453 | toolbarPanel.setName("Toolbar"); |
---|
| 454 | + |
---|
380 | 455 | treePanel = new cGridBag(); |
---|
381 | 456 | treePanel.setName("Tree"); |
---|
| 457 | + |
---|
| 458 | + editPanel = new cGridBag().setVertical(true); |
---|
| 459 | + //editPanel.setName("Edit"); |
---|
| 460 | + |
---|
382 | 461 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
383 | | - ctrlPanel.setName("Edit"); |
---|
| 462 | + |
---|
| 463 | + editCommandsPanel = new cGridBag(); |
---|
| 464 | + editPanel.add(editCommandsPanel); |
---|
| 465 | + editPanel.add(ctrlPanel); |
---|
| 466 | + |
---|
| 467 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 468 | + //toolboxPanel.setName("Toolbox"); |
---|
| 469 | + |
---|
384 | 470 | materialPanel = new cGridBag().setVertical(true); |
---|
385 | | - materialPanel.setName("Material"); |
---|
| 471 | + //materialPanel.setName("Material"); |
---|
| 472 | + |
---|
386 | 473 | /*JTextPane*/ |
---|
387 | 474 | infoarea = createTextPane(); |
---|
388 | 475 | doc = infoarea.getStyledDocument(); |
---|
389 | 476 | |
---|
390 | 477 | infoarea.setEditable(true); |
---|
391 | 478 | SetText(); |
---|
| 479 | + |
---|
392 | 480 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
393 | 481 | // infoarea.setOpaque(false); |
---|
394 | 482 | // //infoarea.setForeground(textcolor); |
---|
395 | 483 | // TEXTAREA infoarea.setLineWrap(true); |
---|
396 | 484 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
397 | 485 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
398 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
399 | | - infoPanel.setName("Info"); |
---|
| 486 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
| 487 | + //infoPanel.setName("Info"); |
---|
400 | 488 | //infoPanel.setLayout(new BorderLayout()); |
---|
401 | 489 | //infoPanel.add(createTextPane()); |
---|
402 | 490 | |
---|
.. | .. |
---|
407 | 495 | mainPanel.setDividerSize(9); |
---|
408 | 496 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
409 | 497 | mainPanel.setResizeWeight(0.5); |
---|
410 | | - |
---|
| 498 | + |
---|
| 499 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 500 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 501 | + divider.setDividerSize(15); |
---|
| 502 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 503 | + |
---|
| 504 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 505 | + |
---|
411 | 506 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
412 | 507 | //mainPanel.setLayout(new GridBagLayout()); |
---|
413 | 508 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
475 | 570 | e.printStackTrace(); |
---|
476 | 571 | } |
---|
477 | 572 | |
---|
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(); |
---|
| 573 | +// String selection = infoarea.getText(); |
---|
| 574 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 575 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 576 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
482 | 577 | //clipboard.setContents(data, data); |
---|
483 | 578 | } |
---|
484 | 579 | |
---|
.. | .. |
---|
638 | 733 | } |
---|
639 | 734 | } |
---|
640 | 735 | |
---|
| 736 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 737 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 738 | + |
---|
| 739 | + Rectangle keeprect; |
---|
| 740 | + cRadio radio; |
---|
| 741 | + |
---|
| 742 | +cButton keepButton; |
---|
| 743 | + cButton twoButton; // Full 3D |
---|
| 744 | + cButton sixButton; |
---|
| 745 | + cButton threeButton; |
---|
| 746 | + cButton sevenButton; |
---|
| 747 | + cButton fourButton; // full panel |
---|
| 748 | + cButton oneButton; // full XYZ |
---|
| 749 | + //cButton currentLayout; |
---|
| 750 | + |
---|
| 751 | + boolean maximized; |
---|
| 752 | + |
---|
| 753 | + cButton fullscreenLayout; |
---|
| 754 | + |
---|
| 755 | + void Minimize() |
---|
| 756 | + { |
---|
| 757 | + frame.setState(Frame.ICONIFIED); |
---|
| 758 | + frame.validate(); |
---|
| 759 | + } |
---|
| 760 | + |
---|
| 761 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 762 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 763 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
| 764 | + void Maximize() |
---|
| 765 | + { |
---|
| 766 | + if (CameraPane.FULLSCREEN) |
---|
| 767 | + { |
---|
| 768 | + ToggleFullScreen(); |
---|
| 769 | + } |
---|
| 770 | + |
---|
| 771 | + if (maximized) |
---|
| 772 | + { |
---|
| 773 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 774 | + } |
---|
| 775 | + else |
---|
| 776 | + { |
---|
| 777 | + keeprect = frame.getBounds(); |
---|
| 778 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 779 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 780 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 781 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 782 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
| 783 | + } |
---|
| 784 | + |
---|
| 785 | + maximized ^= true; |
---|
| 786 | + |
---|
| 787 | + frame.validate(); |
---|
| 788 | + } |
---|
| 789 | + |
---|
| 790 | + cButton minButton; |
---|
| 791 | + cButton maxButton; |
---|
| 792 | + cButton fullButton; |
---|
| 793 | + |
---|
641 | 794 | void ToggleFullScreen() |
---|
642 | 795 | { |
---|
643 | | - if (CameraPane.FULLSCREEN) |
---|
| 796 | +GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 797 | + |
---|
| 798 | + cameraView.ToggleFullScreen(); |
---|
| 799 | + |
---|
| 800 | + if (!CameraPane.FULLSCREEN) |
---|
644 | 801 | { |
---|
645 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
646 | | - framePanel.add(bigThree); |
---|
647 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 802 | + device.setFullScreenWindow(null); |
---|
| 803 | + frame.dispose(); |
---|
| 804 | + frame.setUndecorated(false); |
---|
| 805 | + frame.validate(); |
---|
| 806 | + frame.setVisible(true); |
---|
| 807 | + |
---|
| 808 | + //frame.setVisible(false); |
---|
| 809 | +// frame.removeNotify(); |
---|
| 810 | +// frame.setUndecorated(false); |
---|
| 811 | +// frame.addNotify(); |
---|
| 812 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 813 | + |
---|
| 814 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 815 | +// X framePanel.add(bigThree); |
---|
| 816 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 817 | + framePanel.setDividerLocation(46); |
---|
| 818 | + |
---|
| 819 | + //frame.setVisible(true); |
---|
| 820 | + radio.layout = keepButton; |
---|
| 821 | + //theFrame = null; |
---|
| 822 | + keepButton = null; |
---|
| 823 | + radio.layout.doClick(); |
---|
| 824 | + |
---|
648 | 825 | } else |
---|
649 | 826 | { |
---|
650 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
651 | | - framePanel.remove(bigThree); |
---|
652 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 827 | + keepButton = radio.layout; |
---|
| 828 | + //keeprect = frame.getBounds(); |
---|
| 829 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 830 | +// frame.getToolkit().getScreenSize().height); |
---|
| 831 | + //frame.setVisible(false); |
---|
| 832 | + |
---|
| 833 | + frame.dispose(); |
---|
| 834 | + frame.setUndecorated(true); |
---|
| 835 | + device.setFullScreenWindow(frame); |
---|
| 836 | + frame.validate(); |
---|
| 837 | + frame.setVisible(true); |
---|
| 838 | +// frame.removeNotify(); |
---|
| 839 | +// frame.setUndecorated(true); |
---|
| 840 | +// frame.addNotify(); |
---|
| 841 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 842 | +// X framePanel.remove(bigThree); |
---|
| 843 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 844 | + framePanel.setDividerLocation(0); |
---|
| 845 | + |
---|
| 846 | + radio.layout = fullscreenLayout; |
---|
| 847 | + radio.layout.doClick(); |
---|
| 848 | + //frame.setVisible(true); |
---|
653 | 849 | } |
---|
654 | | - cameraView.ToggleFullScreen(); |
---|
| 850 | + frame.validate(); |
---|
655 | 851 | } |
---|
| 852 | + |
---|
| 853 | + private byte[] CompressCopy() |
---|
| 854 | + { |
---|
| 855 | + boolean temp = CameraPane.SWITCH; |
---|
| 856 | + CameraPane.SWITCH = false; |
---|
| 857 | + |
---|
| 858 | + copy.ExtractBigData(versiontable); |
---|
| 859 | + // if (copy == client) |
---|
| 860 | + |
---|
| 861 | + byte[] versions[] = copy.versions; |
---|
| 862 | + copy.versions = null; |
---|
| 863 | + |
---|
| 864 | + byte[] compress = Compress(copy); |
---|
| 865 | + |
---|
| 866 | + copy.versions = versions; |
---|
| 867 | + |
---|
| 868 | + copy.RestoreBigData(versiontable); |
---|
| 869 | + |
---|
| 870 | + CameraPane.SWITCH = temp; |
---|
| 871 | + |
---|
| 872 | + return compress; |
---|
| 873 | + } |
---|
656 | 874 | |
---|
657 | 875 | private JTextPane createTextPane() |
---|
658 | 876 | { |
---|
.. | .. |
---|
784 | 1002 | // NumberSlider vDivsField; |
---|
785 | 1003 | // JCheckBox endcaps; |
---|
786 | 1004 | JCheckBox liveCB; |
---|
787 | | - JCheckBox selectCB; |
---|
| 1005 | + JCheckBox selectableCB; |
---|
788 | 1006 | JCheckBox hideCB; |
---|
789 | 1007 | JCheckBox link2masterCB; |
---|
790 | 1008 | JCheckBox markCB; |
---|
.. | .. |
---|
792 | 1010 | JCheckBox speedupCB; |
---|
793 | 1011 | JCheckBox rewindCB; |
---|
794 | 1012 | JCheckBox flipVCB; |
---|
| 1013 | + |
---|
| 1014 | + cCheckBox toggleTextureCB; |
---|
| 1015 | + cCheckBox toggleSwitchCB; |
---|
| 1016 | + |
---|
795 | 1017 | JComboBox texresMenu; |
---|
| 1018 | + |
---|
796 | 1019 | JButton resetButton; |
---|
797 | 1020 | JButton stepButton; |
---|
798 | 1021 | JButton stepAllButton; |
---|
.. | .. |
---|
801 | 1024 | JButton fasterButton; |
---|
802 | 1025 | JButton remarkButton; |
---|
803 | 1026 | |
---|
| 1027 | + cGridBag editPanel; |
---|
| 1028 | + cGridBag editCommandsPanel; |
---|
| 1029 | + |
---|
804 | 1030 | cGridBag namePanel; |
---|
805 | 1031 | cGridBag setupPanel; |
---|
806 | | - cGridBag commandsPanel; |
---|
| 1032 | + cGridBag setupPanel2; |
---|
| 1033 | + cGridBag objectCommandsPanel; |
---|
807 | 1034 | cGridBag pushPanel; |
---|
808 | 1035 | cGridBag fillPanel; |
---|
809 | 1036 | |
---|
.. | .. |
---|
975 | 1202 | namePanel = new cGridBag(); |
---|
976 | 1203 | |
---|
977 | 1204 | nameField = AddText(namePanel, copy.GetName()); |
---|
978 | | - namePanel.add(nameField); |
---|
| 1205 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
979 | 1206 | oe.ctrlPanel.add(namePanel); |
---|
980 | 1207 | |
---|
981 | 1208 | oe.ctrlPanel.Return(); |
---|
982 | 1209 | |
---|
983 | | - if (!GroupEditor.allparams) |
---|
| 1210 | + if (!allparams) |
---|
984 | 1211 | return; |
---|
985 | 1212 | |
---|
986 | 1213 | setupPanel = new cGridBag().setVertical(false); |
---|
987 | 1214 | |
---|
988 | 1215 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
989 | 1216 | liveCB.setToolTipText("Animate object"); |
---|
990 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
991 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1217 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1218 | + selectableCB.setToolTipText("Make object selectable"); |
---|
992 | 1219 | // Return(); |
---|
| 1220 | + |
---|
993 | 1221 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
994 | 1222 | hideCB.setToolTipText("Hide object"); |
---|
995 | 1223 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
996 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1224 | + markCB.setToolTipText("As animation target transform"); |
---|
997 | 1225 | |
---|
998 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1226 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
| 1227 | + |
---|
| 1228 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1229 | + |
---|
| 1230 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
999 | 1231 | rewindCB.setToolTipText("Rewind animation"); |
---|
1000 | 1232 | |
---|
1001 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
1002 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1233 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1234 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1003 | 1235 | |
---|
| 1236 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1237 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1238 | + |
---|
1004 | 1239 | if (Globals.ADVANCED) |
---|
1005 | 1240 | { |
---|
1006 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
1007 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1008 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1241 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1009 | 1242 | speedupCB.setToolTipText("Option motion capture"); |
---|
1010 | 1243 | } |
---|
1011 | 1244 | |
---|
1012 | 1245 | oe.ctrlPanel.add(setupPanel); |
---|
1013 | 1246 | oe.ctrlPanel.Return(); |
---|
| 1247 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1248 | + oe.ctrlPanel.Return(); |
---|
1014 | 1249 | |
---|
1015 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1250 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
1016 | 1251 | |
---|
1017 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1252 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
1018 | 1253 | resetButton.setToolTipText("Jump to frame zero"); |
---|
1019 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1254 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
1020 | 1255 | stepButton.setToolTipText("Step one frame"); |
---|
1021 | 1256 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
1022 | 1257 | // stepAllButton = AddButton(oe, "Step All"); |
---|
1023 | 1258 | // Return(); |
---|
1024 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1259 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
1025 | 1260 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
1026 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1261 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
1027 | 1262 | fasterButton.setToolTipText("Increase animation speed"); |
---|
1028 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1263 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
1029 | 1264 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
1030 | 1265 | |
---|
1031 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1266 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
1032 | 1267 | oe.ctrlPanel.Return(); |
---|
1033 | 1268 | |
---|
1034 | 1269 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1234 | 1469 | //worldPanel.setName("World"); |
---|
1235 | 1470 | centralPanel = new cGridBag(); |
---|
1236 | 1471 | centralPanel.preferredWidth = 20; |
---|
1237 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1238 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1472 | + |
---|
| 1473 | + if (Globals.ADVANCED) |
---|
| 1474 | + { |
---|
| 1475 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1476 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1239 | 1477 | |
---|
1240 | 1478 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1241 | 1479 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1244 | 1482 | // cameraPanel.setDividerSize(9); |
---|
1245 | 1483 | cameraPanel.setResizeWeight(1.0); |
---|
1246 | 1484 | |
---|
| 1485 | + } |
---|
| 1486 | + |
---|
1247 | 1487 | centralPanel.add(cameraView); |
---|
| 1488 | + centralPanel.setFocusable(true); |
---|
1248 | 1489 | //frame.setJMenuBar(timelineMenubar); |
---|
1249 | 1490 | //centralPanel.add(timelinePanel); |
---|
1250 | 1491 | |
---|
.. | .. |
---|
1270 | 1511 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1271 | 1512 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1272 | 1513 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1514 | + //XYZPanel.setName("XYZ"); |
---|
1273 | 1515 | |
---|
1274 | 1516 | /* |
---|
1275 | 1517 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1307 | 1549 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1308 | 1550 | //tmp.setName("Edit"); |
---|
1309 | 1551 | objectPanel.add(materialPanel); |
---|
| 1552 | + objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1553 | + objectPanel.setToolTipTextAt(0, "Material panel"); |
---|
| 1554 | + |
---|
1310 | 1555 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1311 | 1556 | // north.setName("Edit"); |
---|
1312 | 1557 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1313 | 1558 | // objectPanel.add(north); |
---|
1314 | | - objectPanel.add(ctrlPanel); |
---|
1315 | | - objectPanel.add(infoPanel); |
---|
| 1559 | + objectPanel.add(editPanel); |
---|
| 1560 | + objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
| 1561 | + objectPanel.setToolTipTextAt(1, "Edit panel"); |
---|
| 1562 | + |
---|
| 1563 | + //if (Globals.ADVANCED) |
---|
| 1564 | + objectPanel.add(infoPanel); |
---|
| 1565 | + objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
| 1566 | + objectPanel.setToolTipTextAt(2, "Info panel"); |
---|
| 1567 | + |
---|
| 1568 | + objectPanel.add(XYZPanel); |
---|
| 1569 | + objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
| 1570 | + objectPanel.setToolTipTextAt(3, "XYZ/RGB panel"); |
---|
| 1571 | + |
---|
| 1572 | + objectPanel.add(toolboxPanel); |
---|
| 1573 | + objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
| 1574 | + objectPanel.setToolTipTextAt(4, "Objects/backgrounds panel"); |
---|
1316 | 1575 | |
---|
1317 | 1576 | /* |
---|
1318 | 1577 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1321 | 1580 | aConstraints.gridy += 1; |
---|
1322 | 1581 | aConstraints.gridwidth = 1; |
---|
1323 | 1582 | mainPanel.add(objectPanel, aConstraints); |
---|
1324 | | - */ |
---|
| 1583 | + */ |
---|
1325 | 1584 | |
---|
1326 | 1585 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1327 | 1586 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1333 | 1592 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1334 | 1593 | |
---|
1335 | 1594 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1336 | | - scenePanel.preferredWidth = 6; |
---|
| 1595 | + scenePanel.preferredWidth = 5; |
---|
1337 | 1596 | |
---|
1338 | 1597 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1339 | 1598 | tabbedPane.add(scrollpane); |
---|
1340 | 1599 | |
---|
1341 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1342 | | - |
---|
1343 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1600 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1344 | 1601 | |
---|
1345 | 1602 | optionsPanel.setName("Options"); |
---|
1346 | 1603 | |
---|
.. | .. |
---|
1348 | 1605 | |
---|
1349 | 1606 | tabbedPane.add(optionsPanel); |
---|
1350 | 1607 | |
---|
| 1608 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1609 | + |
---|
1351 | 1610 | scenePanel.add(tabbedPane); |
---|
1352 | 1611 | |
---|
1353 | 1612 | /* |
---|
.. | .. |
---|
1411 | 1670 | bigThree = new cGridBag(); |
---|
1412 | 1671 | bigThree.addComponent(scenePanel); |
---|
1413 | 1672 | bigThree.addComponent(centralPanel); |
---|
1414 | | - bigThree.addComponent(XYZPanel); |
---|
| 1673 | + //bigThree.addComponent(XYZPanel); |
---|
1415 | 1674 | |
---|
1416 | 1675 | // // SIDE EFFECT!!! |
---|
1417 | 1676 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1420 | 1679 | // aConstraints.gridheight = 1; |
---|
1421 | 1680 | |
---|
1422 | 1681 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1423 | | - framePanel.setContinuousLayout(true); |
---|
1424 | | - framePanel.setOneTouchExpandable(true); |
---|
1425 | | - framePanel.setDividerLocation(0.8); |
---|
| 1682 | + framePanel.setContinuousLayout(false); |
---|
| 1683 | + framePanel.setOneTouchExpandable(false); |
---|
| 1684 | + //.setDividerLocation(0.8); |
---|
1426 | 1685 | //framePanel.setDividerSize(15); |
---|
1427 | 1686 | //framePanel.setResizeWeight(0.15); |
---|
1428 | 1687 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1440 | 1699 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1441 | 1700 | |
---|
1442 | 1701 | frame.setSize(1280, 860); |
---|
1443 | | - frame.setVisible(true); |
---|
1444 | | - |
---|
| 1702 | + |
---|
| 1703 | + cameraView.requestFocusInWindow(); |
---|
| 1704 | + |
---|
1445 | 1705 | gridPanel.setDividerLocation(1.0); |
---|
| 1706 | + |
---|
| 1707 | + frame.validate(); |
---|
| 1708 | + |
---|
| 1709 | + frame.setVisible(true); |
---|
1446 | 1710 | |
---|
1447 | 1711 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1448 | 1712 | frame.addWindowListener(new WindowAdapter() |
---|
1449 | 1713 | { |
---|
1450 | | - |
---|
1451 | 1714 | public void windowClosing(WindowEvent e) |
---|
1452 | 1715 | { |
---|
1453 | 1716 | Close(); |
---|
.. | .. |
---|
1509 | 1772 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1510 | 1773 | |
---|
1511 | 1774 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 1775 | + |
---|
| 1776 | + cGridBag huepanel = new cGridBag(); |
---|
| 1777 | + cGridBag huelabel = new cGridBag(); |
---|
| 1778 | + huelabel.add(GetLabel("icons/hue.png", false)); |
---|
| 1779 | + huelabel.preferredWidth = 20; |
---|
| 1780 | + huepanel.add(new cGridBag()); // Label |
---|
| 1781 | + huepanel.add(huelabel); // Field/slider |
---|
| 1782 | + |
---|
| 1783 | + huepanel.preferredHeight = 7; |
---|
| 1784 | + |
---|
| 1785 | + colorSection.add(huepanel); |
---|
1512 | 1786 | |
---|
1513 | 1787 | cGridBag color = new cGridBag(); |
---|
1514 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1515 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1516 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1788 | + |
---|
| 1789 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 1790 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1791 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1792 | + |
---|
1517 | 1793 | //colorField.preferredWidth = 200; |
---|
1518 | 1794 | colorSection.add(color); |
---|
1519 | 1795 | |
---|
1520 | 1796 | cGridBag modulation = new cGridBag(); |
---|
1521 | 1797 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1522 | 1798 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1523 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1799 | + modulation.add(modulationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1524 | 1800 | colorSection.add(modulation); |
---|
1525 | 1801 | |
---|
| 1802 | + cGridBag opacity = new cGridBag(); |
---|
| 1803 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 1804 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1805 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1806 | + colorSection.add(opacity); |
---|
| 1807 | + |
---|
| 1808 | + colorSection.add(GetSeparator()); |
---|
| 1809 | + |
---|
1526 | 1810 | cGridBag texture = new cGridBag(); |
---|
1527 | 1811 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1528 | 1812 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1529 | 1813 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1530 | 1814 | colorSection.add(texture); |
---|
1531 | 1815 | |
---|
1532 | | - cGridBag anisoU = new cGridBag(); |
---|
1533 | | - anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
1534 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1535 | | - anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1536 | | - colorSection.add(anisoU); |
---|
1537 | | - |
---|
1538 | | - cGridBag anisoV = new cGridBag(); |
---|
1539 | | - anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
1540 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1541 | | - anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1542 | | - colorSection.add(anisoV); |
---|
1543 | | - |
---|
1544 | | - cGridBag shadowbias = new cGridBag(); |
---|
1545 | | - shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
1546 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1547 | | - shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1548 | | - colorSection.add(shadowbias); |
---|
1549 | | - |
---|
1550 | | - panel.add(new JSeparator()); |
---|
| 1816 | + panel.add(GetSeparator()); |
---|
1551 | 1817 | |
---|
1552 | 1818 | panel.add(colorSection); |
---|
1553 | 1819 | |
---|
.. | .. |
---|
1597 | 1863 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1598 | 1864 | diffuseSection.add(fakedepth); |
---|
1599 | 1865 | |
---|
1600 | | - panel.add(new JSeparator()); |
---|
| 1866 | + cGridBag shadowbias = new cGridBag(); |
---|
| 1867 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 1868 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1869 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1870 | + diffuseSection.add(shadowbias); |
---|
| 1871 | + |
---|
| 1872 | + panel.add(GetSeparator()); |
---|
1601 | 1873 | |
---|
1602 | 1874 | panel.add(diffuseSection); |
---|
1603 | 1875 | |
---|
.. | .. |
---|
1647 | 1919 | // aConstraints.gridy += 1; |
---|
1648 | 1920 | // aConstraints.gridwidth = 1; |
---|
1649 | 1921 | |
---|
| 1922 | + cGridBag anisoU = new cGridBag(); |
---|
| 1923 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 1924 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1925 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1926 | + specularSection.add(anisoU); |
---|
1650 | 1927 | |
---|
1651 | | - panel.add(new JSeparator()); |
---|
| 1928 | + cGridBag anisoV = new cGridBag(); |
---|
| 1929 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 1930 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1931 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1932 | + specularSection.add(anisoV); |
---|
| 1933 | + |
---|
| 1934 | + |
---|
| 1935 | + panel.add(GetSeparator()); |
---|
1652 | 1936 | |
---|
1653 | 1937 | panel.add(specularSection); |
---|
1654 | 1938 | |
---|
1655 | 1939 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1656 | 1940 | |
---|
1657 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 1941 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1658 | 1942 | |
---|
1659 | 1943 | cGridBag camera = new cGridBag(); |
---|
1660 | 1944 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1661 | 1945 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1662 | 1946 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1663 | | - globalSection.add(camera); |
---|
| 1947 | + colorSection.add(camera); |
---|
1664 | 1948 | |
---|
1665 | 1949 | cGridBag ambient = new cGridBag(); |
---|
1666 | 1950 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1667 | 1951 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1668 | 1952 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1669 | | - globalSection.add(ambient); |
---|
| 1953 | + colorSection.add(ambient); |
---|
1670 | 1954 | |
---|
1671 | 1955 | cGridBag backlit = new cGridBag(); |
---|
1672 | 1956 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1673 | 1957 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1674 | 1958 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1675 | | - globalSection.add(backlit); |
---|
| 1959 | + colorSection.add(backlit); |
---|
1676 | 1960 | |
---|
1677 | | - cGridBag opacity = new cGridBag(); |
---|
1678 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1679 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1680 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1681 | | - globalSection.add(opacity); |
---|
1682 | | - |
---|
1683 | | - panel.add(new JSeparator()); |
---|
| 1961 | + //panel.add(new JSeparator()); |
---|
1684 | 1962 | |
---|
1685 | | - panel.add(globalSection); |
---|
| 1963 | + //panel.add(globalSection); |
---|
1686 | 1964 | |
---|
1687 | 1965 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1688 | 1966 | |
---|
.. | .. |
---|
1724 | 2002 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1725 | 2003 | textureSection.add(opacityPower); |
---|
1726 | 2004 | |
---|
1727 | | - panel.add(new JSeparator()); |
---|
| 2005 | + panel.add(GetSeparator()); |
---|
1728 | 2006 | |
---|
1729 | 2007 | panel.add(textureSection); |
---|
1730 | 2008 | |
---|
.. | .. |
---|
1789 | 2067 | // 3D models |
---|
1790 | 2068 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1791 | 2069 | { |
---|
1792 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1793 | | - LoadFile(filename, lastConverter); |
---|
| 2070 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2071 | + //LoadFile(filename, lastConverter); |
---|
| 2072 | + LoadObjFile(filename); // New 3ds loader |
---|
1794 | 2073 | continue; |
---|
1795 | 2074 | } |
---|
1796 | 2075 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
1991 | 2270 | e2.printStackTrace(); |
---|
1992 | 2271 | } |
---|
1993 | 2272 | } |
---|
| 2273 | + |
---|
1994 | 2274 | LoadJMEThread loadThread; |
---|
1995 | 2275 | |
---|
1996 | 2276 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
2048 | 2328 | //LoadFile0(filename, converter); |
---|
2049 | 2329 | } |
---|
2050 | 2330 | } |
---|
| 2331 | + |
---|
2051 | 2332 | LoadOBJThread loadObjThread; |
---|
2052 | 2333 | |
---|
2053 | 2334 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2126 | 2407 | |
---|
2127 | 2408 | void LoadObjFile(String fullname) |
---|
2128 | 2409 | { |
---|
2129 | | - /* |
---|
| 2410 | + System.out.println("Loading " + fullname); |
---|
| 2411 | + /**/ |
---|
2130 | 2412 | //lastFilename = fullname; |
---|
2131 | 2413 | if(loadObjThread == null) |
---|
2132 | 2414 | { |
---|
2133 | | - loadObjThread = new LoadOBJThread(); |
---|
2134 | | - loadObjThread.start(); |
---|
| 2415 | + loadObjThread = new LoadOBJThread(); |
---|
| 2416 | + loadObjThread.start(); |
---|
2135 | 2417 | } |
---|
2136 | 2418 | |
---|
2137 | 2419 | loadObjThread.add(fullname); |
---|
2138 | | - */ |
---|
| 2420 | + /**/ |
---|
2139 | 2421 | |
---|
2140 | | - System.out.println("Loading " + fullname); |
---|
2141 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2422 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2142 | 2423 | } |
---|
2143 | 2424 | |
---|
2144 | 2425 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2514 | 2795 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2515 | 2796 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2516 | 2797 | } |
---|
| 2798 | + |
---|
2517 | 2799 | //cJME.count++; |
---|
2518 | 2800 | //cJME.count %= 12; |
---|
2519 | 2801 | if (gc) |
---|
.. | .. |
---|
2697 | 2979 | } |
---|
2698 | 2980 | } |
---|
2699 | 2981 | } |
---|
| 2982 | + |
---|
2700 | 2983 | cFileSystemPane FSPane; |
---|
2701 | 2984 | |
---|
2702 | 2985 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2750 | 3033 | } |
---|
2751 | 3034 | } |
---|
2752 | 3035 | } |
---|
| 3036 | + |
---|
2753 | 3037 | freezematerial = false; |
---|
2754 | 3038 | } |
---|
2755 | 3039 | |
---|
2756 | 3040 | void SetMaterial(Object3D object) |
---|
2757 | 3041 | { |
---|
| 3042 | + latestObject = object; |
---|
| 3043 | + |
---|
2758 | 3044 | cMaterial mat = object.material; |
---|
2759 | 3045 | |
---|
2760 | 3046 | if (mat == null) |
---|
.. | .. |
---|
2866 | 3152 | // } |
---|
2867 | 3153 | |
---|
2868 | 3154 | /**/ |
---|
2869 | | - if (deselect) |
---|
| 3155 | + if (deselect || child == null) |
---|
2870 | 3156 | { |
---|
2871 | 3157 | //group.deselectAll(); |
---|
2872 | 3158 | //freeze = true; |
---|
2873 | 3159 | GetTree().clearSelection(); |
---|
2874 | 3160 | //freeze = false; |
---|
| 3161 | + |
---|
| 3162 | + if (child == null) |
---|
| 3163 | + { |
---|
| 3164 | + return; |
---|
| 3165 | + } |
---|
2875 | 3166 | } |
---|
2876 | 3167 | |
---|
2877 | 3168 | //group.addSelectee(child); |
---|
.. | .. |
---|
2940 | 3231 | cameraView.ToggleDL(); |
---|
2941 | 3232 | cameraView.repaint(); |
---|
2942 | 3233 | return; |
---|
2943 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3234 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2944 | 3235 | { |
---|
2945 | 3236 | cameraView.ToggleTexture(); |
---|
2946 | 3237 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2979 | 3270 | frame.validate(); |
---|
2980 | 3271 | |
---|
2981 | 3272 | return; |
---|
2982 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3273 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2983 | 3274 | { |
---|
2984 | | - cameraView.ToggleRandom(); |
---|
| 3275 | + cameraView.ToggleSwitch(); |
---|
2985 | 3276 | cameraView.repaint(); |
---|
2986 | 3277 | return; |
---|
2987 | 3278 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
3010 | 3301 | { |
---|
3011 | 3302 | copy.live ^= true; |
---|
3012 | 3303 | return; |
---|
3013 | | - } else if (event.getSource() == selectCB) |
---|
| 3304 | + } else if (event.getSource() == selectableCB) |
---|
3014 | 3305 | { |
---|
3015 | 3306 | copy.dontselect ^= true; |
---|
3016 | 3307 | return; |
---|
.. | .. |
---|
3052 | 3343 | |
---|
3053 | 3344 | public void actionPerformed(ActionEvent event) |
---|
3054 | 3345 | { |
---|
| 3346 | + Object source = event.getSource(); |
---|
3055 | 3347 | // SCRIPT DIALOG |
---|
3056 | | - if (event.getSource() == okbutton) |
---|
| 3348 | + if (source == okbutton) |
---|
3057 | 3349 | { |
---|
3058 | 3350 | textpanel.setVisible(false); |
---|
3059 | 3351 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3065 | 3357 | textarea = null; |
---|
3066 | 3358 | textpanel = null; |
---|
3067 | 3359 | } |
---|
3068 | | - if (event.getSource() == cancelbutton) |
---|
| 3360 | + if (source == cancelbutton) |
---|
3069 | 3361 | { |
---|
3070 | 3362 | textpanel.setVisible(false); |
---|
3071 | 3363 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3077 | 3369 | //applySelf(); |
---|
3078 | 3370 | //client.refreshEditWindow(); |
---|
3079 | 3371 | //refreshContents(); |
---|
3080 | | - if (event.getSource() == nameField) |
---|
| 3372 | + if (source == nameField) |
---|
3081 | 3373 | { |
---|
3082 | 3374 | //System.out.println("ObjEditor " + event); |
---|
3083 | 3375 | applySelf0(true); |
---|
3084 | 3376 | //parent.applySelf(); |
---|
3085 | 3377 | objEditor.refreshContents(); |
---|
3086 | | - } else if (event.getSource() == resetButton) |
---|
| 3378 | + } else if (source == resetButton) |
---|
3087 | 3379 | { |
---|
3088 | 3380 | CameraPane.fullreset = true; |
---|
3089 | 3381 | copy.Reset(); // ResetMeshes(); |
---|
3090 | 3382 | copy.Touch(); |
---|
3091 | 3383 | objEditor.refreshContents(); |
---|
3092 | | - } else if (event.getSource() == stepItem) |
---|
| 3384 | + } else if (source == stepItem) |
---|
3093 | 3385 | { |
---|
3094 | 3386 | //cameraView.ONESTEP = true; |
---|
3095 | 3387 | Globals.ONESTEP = true; |
---|
3096 | 3388 | cameraView.repaint(); |
---|
3097 | 3389 | return; |
---|
3098 | | - } else if (event.getSource() == stepButton) |
---|
| 3390 | + } else if (source == stepButton) |
---|
3099 | 3391 | { |
---|
3100 | 3392 | copy.Step(); |
---|
3101 | 3393 | copy.Touch(); |
---|
3102 | 3394 | objEditor.refreshContents(); |
---|
3103 | | - } else if (event.getSource() == slowerButton) |
---|
| 3395 | + } else if (source == slowerButton) |
---|
3104 | 3396 | { |
---|
3105 | 3397 | copy.Slower(); |
---|
3106 | 3398 | copy.Touch(); |
---|
3107 | 3399 | objEditor.refreshContents(); |
---|
3108 | | - } else if (event.getSource() == fasterButton) |
---|
| 3400 | + } else if (source == fasterButton) |
---|
3109 | 3401 | { |
---|
3110 | 3402 | copy.Faster(); |
---|
3111 | 3403 | copy.Touch(); |
---|
3112 | 3404 | objEditor.refreshContents(); |
---|
3113 | | - } else if (event.getSource() == remarkButton) |
---|
| 3405 | + } else if (source == remarkButton) |
---|
3114 | 3406 | { |
---|
3115 | 3407 | copy.Remark(); |
---|
3116 | 3408 | copy.Touch(); |
---|
3117 | 3409 | objEditor.refreshContents(); |
---|
3118 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3410 | + } else if (source == stepAllButton) |
---|
3119 | 3411 | { |
---|
3120 | 3412 | copy.StepAll(); |
---|
3121 | 3413 | copy.Touch(); |
---|
3122 | 3414 | objEditor.refreshContents(); |
---|
3123 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3415 | + } else if (source == resetAllButton) |
---|
3124 | 3416 | { |
---|
3125 | 3417 | //CameraPane.fullreset = true; |
---|
3126 | 3418 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3153 | 3445 | // Close(); |
---|
3154 | 3446 | // } |
---|
3155 | 3447 | // else |
---|
3156 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3448 | + if (source == resetSlidersButton) |
---|
3157 | 3449 | { |
---|
3158 | 3450 | ResetSliders(); |
---|
3159 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3451 | + } else if (source == clearMaterialButton) |
---|
3160 | 3452 | { |
---|
3161 | 3453 | ClearMaterial(); |
---|
3162 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3454 | + } else if (source == createMaterialButton) |
---|
3163 | 3455 | { |
---|
3164 | 3456 | CreateMaterial(); |
---|
3165 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3457 | + } else if (source == clearPanelButton) |
---|
3166 | 3458 | { |
---|
3167 | 3459 | copy.ClearUI(); |
---|
3168 | 3460 | refreshContents(true); |
---|
3169 | | - } /* |
---|
3170 | | - } |
---|
3171 | | - |
---|
3172 | | - public boolean action(Event event, Object arg) |
---|
3173 | | - { |
---|
3174 | | - */ else if (event.getSource() == closeItem) |
---|
| 3461 | + } else if (source == importGFDItem) |
---|
| 3462 | + { |
---|
| 3463 | + ImportGFD(); |
---|
| 3464 | + } else |
---|
| 3465 | + if (source == importVRMLX3DItem) |
---|
| 3466 | + { |
---|
| 3467 | + ImportVRMLX3D(); |
---|
| 3468 | + } else |
---|
| 3469 | + if (source == import3DSItem) |
---|
| 3470 | + { |
---|
| 3471 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3472 | + } else |
---|
| 3473 | + if (source == importOBJItem) |
---|
| 3474 | + { |
---|
| 3475 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3476 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3477 | + browser.setVisible(true); |
---|
| 3478 | + String filename = browser.getFile(); |
---|
| 3479 | + if (filename != null && filename.length() > 0) |
---|
| 3480 | + { |
---|
| 3481 | + String fullname = browser.getDirectory() + filename; |
---|
| 3482 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3483 | + } |
---|
| 3484 | + } else |
---|
| 3485 | + if (source == closeItem) |
---|
3175 | 3486 | { |
---|
3176 | 3487 | Close(); |
---|
3177 | 3488 | //return true; |
---|
3178 | | - } else if (event.getSource() == loadItem) |
---|
| 3489 | + } else if (source == openItem) |
---|
3179 | 3490 | { |
---|
3180 | | - load(); |
---|
| 3491 | + Open(); |
---|
3181 | 3492 | //return true; |
---|
3182 | | - } else if (event.getSource() == saveItem) |
---|
| 3493 | + } else if (source == newItem) |
---|
| 3494 | + { |
---|
| 3495 | + New(); |
---|
| 3496 | + } else if (source == saveItem) |
---|
3183 | 3497 | { |
---|
3184 | 3498 | save(); |
---|
3185 | 3499 | //return true; |
---|
3186 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3500 | + } else if (source == saveAsItem) |
---|
3187 | 3501 | { |
---|
3188 | 3502 | saveAs(); |
---|
3189 | 3503 | //return true; |
---|
3190 | | - } else if (event.getSource() == reexportItem) |
---|
| 3504 | + } else if (source == reexportItem) |
---|
3191 | 3505 | { |
---|
3192 | 3506 | reexport(); |
---|
3193 | 3507 | //return true; |
---|
3194 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3508 | + } else if (source == exportAsItem) |
---|
3195 | 3509 | { |
---|
3196 | 3510 | export(); |
---|
3197 | 3511 | //return true; |
---|
3198 | | - } else if (event.getSource() == povItem) |
---|
| 3512 | + } else if (source == povItem) |
---|
3199 | 3513 | { |
---|
3200 | 3514 | generatePOV(); |
---|
3201 | 3515 | //return true; |
---|
3202 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3516 | + } else if (event.getSource() == archiveItem) |
---|
| 3517 | + { |
---|
| 3518 | + cTools.Archive(frame); |
---|
| 3519 | + return; |
---|
| 3520 | + } else if (source == zBufferItem) |
---|
3203 | 3521 | { |
---|
3204 | 3522 | try |
---|
3205 | 3523 | { |
---|
.. | .. |
---|
3221 | 3539 | cameraView.repaint(); |
---|
3222 | 3540 | //return true; |
---|
3223 | 3541 | } |
---|
3224 | | - */ else if (event.getSource() == editCameraItem) |
---|
3225 | | - { |
---|
3226 | | - cameraView.ProtectCamera(); |
---|
3227 | | - cameraView.repaint(); |
---|
3228 | | - return; |
---|
3229 | | - } else if (event.getSource() == revertCameraItem) |
---|
3230 | | - { |
---|
3231 | | - cameraView.RevertCamera(); |
---|
3232 | | - cameraView.repaint(); |
---|
3233 | | - return; |
---|
3234 | | -// } else if (event.getSource() == textureButton) |
---|
3235 | | -// { |
---|
3236 | | -// return; // true; |
---|
3237 | | - } else // combos... |
---|
3238 | | - if (event.getSource() == texresMenu) |
---|
| 3542 | + */ else // combos... |
---|
| 3543 | + if (source == texresMenu) |
---|
3239 | 3544 | { |
---|
3240 | 3545 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3241 | 3546 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3247 | 3552 | } |
---|
3248 | 3553 | } |
---|
3249 | 3554 | |
---|
| 3555 | + void New() |
---|
| 3556 | + { |
---|
| 3557 | + while (copy.Size() > 1) |
---|
| 3558 | + { |
---|
| 3559 | + copy.remove(1); |
---|
| 3560 | + } |
---|
| 3561 | + |
---|
| 3562 | + ResetModel(); |
---|
| 3563 | + objEditor.refreshContents(); |
---|
| 3564 | + } |
---|
| 3565 | + |
---|
| 3566 | + static public byte[] Compress(Object3D o) |
---|
| 3567 | + { |
---|
| 3568 | + try |
---|
| 3569 | + { |
---|
| 3570 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3571 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3572 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
| 3573 | + |
---|
| 3574 | + Object3D parent = o.parent; |
---|
| 3575 | + o.parent = null; |
---|
| 3576 | + |
---|
| 3577 | + out.writeObject(o); |
---|
| 3578 | + |
---|
| 3579 | + o.parent = parent; |
---|
| 3580 | + |
---|
| 3581 | + out.flush(); |
---|
| 3582 | + |
---|
| 3583 | + baos //zstream |
---|
| 3584 | + .close(); |
---|
| 3585 | + out.close(); |
---|
| 3586 | + |
---|
| 3587 | + byte[] bytes = baos.toByteArray(); |
---|
| 3588 | + |
---|
| 3589 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 3590 | + return bytes; |
---|
| 3591 | + } catch (Exception e) |
---|
| 3592 | + { |
---|
| 3593 | + System.err.println(e); |
---|
| 3594 | + return null; |
---|
| 3595 | + } |
---|
| 3596 | + } |
---|
| 3597 | + |
---|
| 3598 | + static public Object Uncompress(byte[] bytes) |
---|
| 3599 | + { |
---|
| 3600 | + System.out.println("restore #bytes = " + bytes.length); |
---|
| 3601 | + try |
---|
| 3602 | + { |
---|
| 3603 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3604 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3605 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
| 3606 | + Object obj = in.readObject(); |
---|
| 3607 | + |
---|
| 3608 | + bais //istream |
---|
| 3609 | + .close(); |
---|
| 3610 | + in.close(); |
---|
| 3611 | + |
---|
| 3612 | + return obj; |
---|
| 3613 | + } catch (Exception e) |
---|
| 3614 | + { |
---|
| 3615 | + System.err.println(e); |
---|
| 3616 | + return null; |
---|
| 3617 | + } |
---|
| 3618 | + } |
---|
| 3619 | + |
---|
| 3620 | + static public Object clone(Object o) |
---|
| 3621 | + { |
---|
| 3622 | + try |
---|
| 3623 | + { |
---|
| 3624 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3625 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3626 | + |
---|
| 3627 | + out.writeObject(o); |
---|
| 3628 | + |
---|
| 3629 | + out.flush(); |
---|
| 3630 | + out.close(); |
---|
| 3631 | + |
---|
| 3632 | + byte[] bytes = baos.toByteArray(); |
---|
| 3633 | + |
---|
| 3634 | + System.out.println("clone = " + bytes.length); |
---|
| 3635 | + |
---|
| 3636 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3637 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3638 | + Object obj = in.readObject(); |
---|
| 3639 | + in.close(); |
---|
| 3640 | + |
---|
| 3641 | + return obj; |
---|
| 3642 | + } catch (Exception e) |
---|
| 3643 | + { |
---|
| 3644 | + System.err.println(e); |
---|
| 3645 | + return null; |
---|
| 3646 | + } |
---|
| 3647 | + } |
---|
| 3648 | + |
---|
| 3649 | + cRadio GetCurrentTab() |
---|
| 3650 | + { |
---|
| 3651 | + cRadio ab; |
---|
| 3652 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3653 | + { |
---|
| 3654 | + ab = (cRadio)e.nextElement(); |
---|
| 3655 | + if(ab.GetObject() == copy) |
---|
| 3656 | + { |
---|
| 3657 | + return ab; |
---|
| 3658 | + } |
---|
| 3659 | + } |
---|
| 3660 | + |
---|
| 3661 | + return null; |
---|
| 3662 | + } |
---|
| 3663 | + |
---|
| 3664 | + |
---|
| 3665 | + public void Save() |
---|
| 3666 | + { |
---|
| 3667 | + //Save(true); |
---|
| 3668 | + Replace(); |
---|
| 3669 | + } |
---|
| 3670 | + |
---|
| 3671 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 3672 | + { |
---|
| 3673 | + if (compress.length != name.length) |
---|
| 3674 | + { |
---|
| 3675 | + return false; |
---|
| 3676 | + } |
---|
| 3677 | + |
---|
| 3678 | + for (int i=compress.length; --i>=0;) |
---|
| 3679 | + { |
---|
| 3680 | + if (compress[i] != name[i]) |
---|
| 3681 | + return false; |
---|
| 3682 | + } |
---|
| 3683 | + |
---|
| 3684 | + return true; |
---|
| 3685 | + } |
---|
| 3686 | + |
---|
| 3687 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3688 | + |
---|
| 3689 | + public boolean Save(boolean user) |
---|
| 3690 | + { |
---|
| 3691 | + System.err.println("Save"); |
---|
| 3692 | + |
---|
| 3693 | + cRadio tab = GetCurrentTab(); |
---|
| 3694 | + |
---|
| 3695 | + byte[] compress = CompressCopy(); // Saved version. No need for "Replace". |
---|
| 3696 | + |
---|
| 3697 | + boolean thesame = false; |
---|
| 3698 | + |
---|
| 3699 | + // Quick heuristic using length. Works only when stream is compressed. |
---|
| 3700 | + if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 3701 | + { |
---|
| 3702 | + thesame = true; |
---|
| 3703 | + } |
---|
| 3704 | + |
---|
| 3705 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3706 | + if (!thesame) |
---|
| 3707 | + { |
---|
| 3708 | + //tab.user[tab.versionindex] = user; |
---|
| 3709 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 3710 | + |
---|
| 3711 | + copy.versions[++copy.versionindex] = compress; |
---|
| 3712 | + |
---|
| 3713 | + // if (increment) |
---|
| 3714 | + // tab.versionindex++; |
---|
| 3715 | + } |
---|
| 3716 | + |
---|
| 3717 | + //copy.RestoreBigData(versiontable); |
---|
| 3718 | + |
---|
| 3719 | + //assert(hashtable.isEmpty()); |
---|
| 3720 | + |
---|
| 3721 | + for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
| 3722 | + { |
---|
| 3723 | + //tab.user[i] = false; |
---|
| 3724 | + copy.versions[i] = null; |
---|
| 3725 | + } |
---|
| 3726 | + |
---|
| 3727 | + SetUndoStates(); |
---|
| 3728 | + |
---|
| 3729 | + // test save |
---|
| 3730 | + if (false) |
---|
| 3731 | + { |
---|
| 3732 | + try |
---|
| 3733 | + { |
---|
| 3734 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
| 3735 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3736 | + |
---|
| 3737 | + p.writeObject(copy); |
---|
| 3738 | + |
---|
| 3739 | + p.flush(); |
---|
| 3740 | + |
---|
| 3741 | + ostream.close(); |
---|
| 3742 | + } catch (Exception e) |
---|
| 3743 | + { |
---|
| 3744 | + e.printStackTrace(); |
---|
| 3745 | + } |
---|
| 3746 | + } |
---|
| 3747 | + |
---|
| 3748 | + return !thesame; |
---|
| 3749 | + } |
---|
| 3750 | + |
---|
| 3751 | + void CopyChanged(Object3D obj) |
---|
| 3752 | + { |
---|
| 3753 | + SetUndoStates(); |
---|
| 3754 | + |
---|
| 3755 | + boolean temp = CameraPane.SWITCH; |
---|
| 3756 | + CameraPane.SWITCH = false; |
---|
| 3757 | + |
---|
| 3758 | + copy.ExtractBigData(versiontable); |
---|
| 3759 | + |
---|
| 3760 | + copy.clear(); |
---|
| 3761 | + |
---|
| 3762 | + copy.skyboxname = obj.skyboxname; |
---|
| 3763 | + copy.skyboxext = obj.skyboxext; |
---|
| 3764 | + |
---|
| 3765 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3766 | + { |
---|
| 3767 | + copy.add(obj.get(i)); |
---|
| 3768 | + } |
---|
| 3769 | + |
---|
| 3770 | + copy.RestoreBigData(versiontable); |
---|
| 3771 | + |
---|
| 3772 | + CameraPane.SWITCH = temp; |
---|
| 3773 | + |
---|
| 3774 | + //assert(hashtable.isEmpty()); |
---|
| 3775 | + |
---|
| 3776 | + copy.Touch(); |
---|
| 3777 | + |
---|
| 3778 | + ResetModel(); |
---|
| 3779 | + copy.HardTouch(); // recompile? |
---|
| 3780 | + |
---|
| 3781 | + cRadio ab; |
---|
| 3782 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3783 | + { |
---|
| 3784 | + ab = (cRadio)e.nextElement(); |
---|
| 3785 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3786 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3787 | + if (test != null) |
---|
| 3788 | + { |
---|
| 3789 | + test.editWindow = ab.object.editWindow; |
---|
| 3790 | + ab.object = test; |
---|
| 3791 | + } |
---|
| 3792 | + } |
---|
| 3793 | + |
---|
| 3794 | + refreshContents(); |
---|
| 3795 | + } |
---|
| 3796 | + |
---|
| 3797 | + cButton undoButton; |
---|
| 3798 | + cButton restoreButton; |
---|
| 3799 | + cButton replaceButton; |
---|
| 3800 | + cButton redoButton; |
---|
| 3801 | + |
---|
| 3802 | + boolean muteSlider; |
---|
| 3803 | + |
---|
| 3804 | + int VersionCount() |
---|
| 3805 | + { |
---|
| 3806 | + int count = 0; |
---|
| 3807 | + |
---|
| 3808 | + for (int i = copy.versions.length; --i >= 0;) |
---|
| 3809 | + { |
---|
| 3810 | + if (copy.versions[i] != null) |
---|
| 3811 | + count++; |
---|
| 3812 | + } |
---|
| 3813 | + |
---|
| 3814 | + return count; |
---|
| 3815 | + } |
---|
| 3816 | + |
---|
| 3817 | + void SetUndoStates() |
---|
| 3818 | + { |
---|
| 3819 | + cRadio tab = GetCurrentTab(); |
---|
| 3820 | + |
---|
| 3821 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 3822 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 3823 | + |
---|
| 3824 | + undoButton.setEnabled(copy.versionindex > 0); |
---|
| 3825 | + redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 3826 | + |
---|
| 3827 | + muteSlider = true; |
---|
| 3828 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 3829 | + versionSlider.setInteger(copy.versionindex); |
---|
| 3830 | + muteSlider = false; |
---|
| 3831 | + } |
---|
| 3832 | + |
---|
| 3833 | + public boolean Undo() |
---|
| 3834 | + { |
---|
| 3835 | + // Option? |
---|
| 3836 | + Replace(); |
---|
| 3837 | + |
---|
| 3838 | + System.err.println("Undo"); |
---|
| 3839 | + |
---|
| 3840 | + cRadio tab = GetCurrentTab(); |
---|
| 3841 | + |
---|
| 3842 | + if (copy.versionindex == 0) |
---|
| 3843 | + { |
---|
| 3844 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3845 | + return false; |
---|
| 3846 | + } |
---|
| 3847 | + |
---|
| 3848 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 3849 | +// { |
---|
| 3850 | +// if (Save(false)) |
---|
| 3851 | +// tab.versionindex -= 1; |
---|
| 3852 | +// else |
---|
| 3853 | +// { |
---|
| 3854 | +// if (tab.versionindex <= 0) |
---|
| 3855 | +// return false; |
---|
| 3856 | +// else |
---|
| 3857 | +// tab.versionindex -= 1; |
---|
| 3858 | +// } |
---|
| 3859 | +// } |
---|
| 3860 | + |
---|
| 3861 | + copy.versionindex -= 1; |
---|
| 3862 | + |
---|
| 3863 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3864 | + |
---|
| 3865 | + return true; |
---|
| 3866 | + } |
---|
| 3867 | + |
---|
| 3868 | + public boolean Restore() |
---|
| 3869 | + { |
---|
| 3870 | + System.err.println("Restore"); |
---|
| 3871 | + |
---|
| 3872 | + cRadio tab = GetCurrentTab(); |
---|
| 3873 | + |
---|
| 3874 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 3875 | + { |
---|
| 3876 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3877 | + return false; |
---|
| 3878 | + } |
---|
| 3879 | + |
---|
| 3880 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3881 | + |
---|
| 3882 | + return true; |
---|
| 3883 | + } |
---|
| 3884 | + |
---|
| 3885 | + public boolean Replace() |
---|
| 3886 | + { |
---|
| 3887 | + System.err.println("Replace"); |
---|
| 3888 | + |
---|
| 3889 | + cRadio tab = GetCurrentTab(); |
---|
| 3890 | + |
---|
| 3891 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 3892 | + { |
---|
| 3893 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3894 | + return false; |
---|
| 3895 | + } |
---|
| 3896 | + |
---|
| 3897 | + copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 3898 | + |
---|
| 3899 | + return true; |
---|
| 3900 | + } |
---|
| 3901 | + |
---|
| 3902 | + public void Redo() |
---|
| 3903 | + { |
---|
| 3904 | + // Option? |
---|
| 3905 | + Replace(); |
---|
| 3906 | + |
---|
| 3907 | + cRadio tab = GetCurrentTab(); |
---|
| 3908 | + |
---|
| 3909 | + if (copy.versions[copy.versionindex + 1] == null) |
---|
| 3910 | + { |
---|
| 3911 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3912 | + return; |
---|
| 3913 | + } |
---|
| 3914 | + |
---|
| 3915 | + copy.versionindex += 1; |
---|
| 3916 | + |
---|
| 3917 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3918 | + |
---|
| 3919 | + //if (!tab.user[tab.versionindex]) |
---|
| 3920 | + // tab.graphs[tab.versionindex] = null; |
---|
| 3921 | + } |
---|
| 3922 | + |
---|
| 3923 | + void ImportGFD() |
---|
| 3924 | + { |
---|
| 3925 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 3926 | + browser.show(); |
---|
| 3927 | + String filename = browser.getFile(); |
---|
| 3928 | + if (filename != null && filename.length() > 0) |
---|
| 3929 | + { |
---|
| 3930 | + String fullname = browser.getDirectory() + filename; |
---|
| 3931 | + |
---|
| 3932 | + //Object3D readobj = |
---|
| 3933 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 3934 | + //makeSomething(readobj); |
---|
| 3935 | + } |
---|
| 3936 | + } |
---|
| 3937 | + |
---|
| 3938 | + void ImportVRMLX3D() |
---|
| 3939 | + { |
---|
| 3940 | + if (Grafreed.standAlone) |
---|
| 3941 | + { |
---|
| 3942 | + /**/ |
---|
| 3943 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 3944 | + browser.show(); |
---|
| 3945 | + String filename = browser.getFile(); |
---|
| 3946 | + if (filename != null && filename.length() > 0) |
---|
| 3947 | + { |
---|
| 3948 | + String fullname = browser.getDirectory() + filename; |
---|
| 3949 | + LoadVRMLX3D(fullname); |
---|
| 3950 | + } |
---|
| 3951 | + /**/ |
---|
| 3952 | + } |
---|
| 3953 | + } |
---|
| 3954 | + |
---|
3250 | 3955 | void ToggleAnimation() |
---|
3251 | 3956 | { |
---|
3252 | 3957 | if (!Globals.ANIMATION) |
---|
.. | .. |
---|
3364 | 4069 | assert false; |
---|
3365 | 4070 | } |
---|
3366 | 4071 | |
---|
3367 | | - void EditSelection() |
---|
| 4072 | + void EditSelection(boolean newWindow) |
---|
3368 | 4073 | { |
---|
3369 | 4074 | } |
---|
3370 | 4075 | |
---|
.. | .. |
---|
3508 | 4213 | //copy.Touch(); |
---|
3509 | 4214 | } |
---|
3510 | 4215 | |
---|
| 4216 | + cNumberSlider versionSlider; |
---|
| 4217 | + |
---|
3511 | 4218 | public void stateChanged(ChangeEvent e) |
---|
3512 | 4219 | { |
---|
3513 | 4220 | // assert(false); |
---|
| 4221 | + if (e.getSource() == versionSlider) |
---|
| 4222 | + { |
---|
| 4223 | + if (muteSlider) |
---|
| 4224 | + return; |
---|
| 4225 | + |
---|
| 4226 | + int version = versionSlider.getInteger(); |
---|
| 4227 | + |
---|
| 4228 | + if (copy.versions[version] != null) |
---|
| 4229 | + { |
---|
| 4230 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4231 | + } |
---|
| 4232 | + |
---|
| 4233 | + return; |
---|
| 4234 | + } |
---|
3514 | 4235 | |
---|
3515 | 4236 | if (freezematerial) |
---|
3516 | 4237 | { |
---|
.. | .. |
---|
3859 | 4580 | |
---|
3860 | 4581 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3861 | 4582 | { |
---|
| 4583 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
| 4584 | + Save(); |
---|
3862 | 4585 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3863 | 4586 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3864 | 4587 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3945 | 4668 | { |
---|
3946 | 4669 | ResetModel(); |
---|
3947 | 4670 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4671 | + |
---|
| 4672 | + if (thing.Size() == 0) |
---|
| 4673 | + { |
---|
| 4674 | + //EditSelection(false); |
---|
| 4675 | + } |
---|
| 4676 | + |
---|
3948 | 4677 | refreshContents(); |
---|
3949 | 4678 | } |
---|
3950 | 4679 | |
---|
.. | .. |
---|
4062 | 4791 | } |
---|
4063 | 4792 | } |
---|
4064 | 4793 | } |
---|
| 4794 | + |
---|
4065 | 4795 | LoadGFDThread loadGFDThread; |
---|
4066 | 4796 | |
---|
4067 | 4797 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
4081 | 4811 | |
---|
4082 | 4812 | try |
---|
4083 | 4813 | { |
---|
| 4814 | + // Try compressed version first. |
---|
4084 | 4815 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4085 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4816 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4817 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
4086 | 4818 | |
---|
4087 | 4819 | readobj = (Object3D) p.readObject(); |
---|
4088 | 4820 | istream.close(); |
---|
.. | .. |
---|
4090 | 4822 | readobj.ResetDisplayList(); |
---|
4091 | 4823 | } catch (Exception e) |
---|
4092 | 4824 | { |
---|
4093 | | - e.printStackTrace(); |
---|
| 4825 | + if (!e.toString().contains("GZIP")) |
---|
| 4826 | + e.printStackTrace(); |
---|
| 4827 | + |
---|
| 4828 | + try |
---|
| 4829 | + { |
---|
| 4830 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4831 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4832 | + |
---|
| 4833 | + readobj = (Object3D) p.readObject(); |
---|
| 4834 | + istream.close(); |
---|
| 4835 | + |
---|
| 4836 | + readobj.ResetDisplayList(); |
---|
| 4837 | + } catch (Exception e2) |
---|
| 4838 | + { |
---|
| 4839 | + e2.printStackTrace(); |
---|
| 4840 | + } |
---|
4094 | 4841 | } |
---|
4095 | 4842 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4096 | 4843 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4136 | 4883 | |
---|
4137 | 4884 | void LoadIt(Object obj) |
---|
4138 | 4885 | { |
---|
| 4886 | + if (obj == null) |
---|
| 4887 | + { |
---|
| 4888 | + // Invalid file |
---|
| 4889 | + return; |
---|
| 4890 | + } |
---|
| 4891 | + |
---|
4139 | 4892 | System.out.println("Loaded " + obj); |
---|
4140 | 4893 | //new Exception().printStackTrace(); |
---|
4141 | 4894 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4145 | 4898 | |
---|
4146 | 4899 | if (readobj != null) |
---|
4147 | 4900 | { |
---|
| 4901 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 4902 | + // Save(); |
---|
4148 | 4903 | try |
---|
4149 | 4904 | { |
---|
4150 | 4905 | //readobj.deepCopySelf(copy); |
---|
4151 | 4906 | copy.clear(); // june 2014 |
---|
| 4907 | + copy.skyboxname = readobj.skyboxname; |
---|
| 4908 | + copy.skyboxext = readobj.skyboxext; |
---|
4152 | 4909 | for (int i = 0; i < readobj.size(); i++) |
---|
4153 | 4910 | { |
---|
4154 | 4911 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4189 | 4946 | } |
---|
4190 | 4947 | } catch (ClassCastException e) |
---|
4191 | 4948 | { |
---|
| 4949 | + e.printStackTrace(); |
---|
4192 | 4950 | assert (false); |
---|
4193 | 4951 | Composite c = (Composite) copy; |
---|
4194 | 4952 | c.children.clear(); |
---|
.. | .. |
---|
4199 | 4957 | c.addChild(csg); |
---|
4200 | 4958 | } |
---|
4201 | 4959 | |
---|
| 4960 | + copy.versions = readobj.versions; |
---|
| 4961 | + copy.versionindex = readobj.versionindex; |
---|
| 4962 | + |
---|
| 4963 | + if (copy.versions == null) |
---|
| 4964 | + { |
---|
| 4965 | + copy.versions = new byte[100][]; |
---|
| 4966 | + copy.versionindex = -1; |
---|
| 4967 | + } |
---|
| 4968 | + |
---|
| 4969 | + //? SetUndoStates(); |
---|
| 4970 | + |
---|
4202 | 4971 | ResetModel(); |
---|
4203 | 4972 | copy.HardTouch(); // recompile? |
---|
4204 | 4973 | refreshContents(); |
---|
4205 | 4974 | } |
---|
4206 | 4975 | } |
---|
4207 | 4976 | |
---|
4208 | | - void load() // throws ClassNotFoundException |
---|
| 4977 | + void Open() // throws ClassNotFoundException |
---|
4209 | 4978 | { |
---|
4210 | 4979 | if (Grafreed.standAlone) |
---|
4211 | 4980 | { |
---|
.. | .. |
---|
4294 | 5063 | try |
---|
4295 | 5064 | { |
---|
4296 | 5065 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4297 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 5066 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5067 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4298 | 5068 | |
---|
4299 | 5069 | p.writeObject(copy); |
---|
4300 | 5070 | p.flush(); |
---|
4301 | 5071 | |
---|
| 5072 | + zstream.close(); |
---|
4302 | 5073 | ostream.close(); |
---|
4303 | 5074 | |
---|
4304 | 5075 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4306 | 5077 | //ps.print(buffer.toString()); |
---|
4307 | 5078 | } catch (IOException e) |
---|
4308 | 5079 | { |
---|
| 5080 | + e.printStackTrace(); |
---|
4309 | 5081 | } |
---|
4310 | 5082 | } |
---|
| 5083 | + |
---|
4311 | 5084 | String lastname; |
---|
4312 | 5085 | |
---|
4313 | 5086 | void saveAs() |
---|
.. | .. |
---|
4319 | 5092 | String filename = browser.getFile(); |
---|
4320 | 5093 | if (filename != null && filename.length() > 0) |
---|
4321 | 5094 | { |
---|
| 5095 | + if (!filename.endsWith(".gfd")) |
---|
| 5096 | + filename += ".gfd"; |
---|
4322 | 5097 | lastname = browser.getDirectory() + filename; |
---|
4323 | 5098 | save(); |
---|
4324 | 5099 | } |
---|
.. | .. |
---|
4417 | 5192 | try |
---|
4418 | 5193 | { |
---|
4419 | 5194 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4420 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4421 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 5195 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5196 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4422 | 5197 | |
---|
4423 | 5198 | Object3D objectparent = obj.parent; |
---|
4424 | 5199 | obj.parent = null; |
---|
.. | .. |
---|
4435 | 5210 | p.writeObject(object); |
---|
4436 | 5211 | p.flush(); |
---|
4437 | 5212 | |
---|
| 5213 | + zstream.close(); |
---|
4438 | 5214 | ostream.close(); |
---|
4439 | | - // zstream.close(); |
---|
4440 | 5215 | |
---|
4441 | 5216 | // group.selection.get(0).parent = parent; |
---|
4442 | 5217 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4483 | 5258 | Object3D client; |
---|
4484 | 5259 | Object3D copy; |
---|
4485 | 5260 | MenuBar menuBar; |
---|
4486 | | - Menu windowMenu; |
---|
4487 | | - MenuItem loadItem; |
---|
| 5261 | + Menu fileMenu; |
---|
| 5262 | + MenuItem newItem; |
---|
| 5263 | + MenuItem openItem; |
---|
4488 | 5264 | MenuItem saveItem; |
---|
4489 | 5265 | MenuItem saveAsItem; |
---|
4490 | 5266 | MenuItem exportAsItem; |
---|
4491 | 5267 | MenuItem reexportItem; |
---|
4492 | 5268 | MenuItem povItem; |
---|
4493 | 5269 | MenuItem closeItem; |
---|
4494 | | - Menu cameraMenu; |
---|
| 5270 | + |
---|
4495 | 5271 | CheckboxMenuItem zBufferItem; |
---|
4496 | 5272 | //MenuItem normalLensItem; |
---|
4497 | | - MenuItem editCameraItem; |
---|
4498 | | - MenuItem revertCameraItem; |
---|
4499 | 5273 | MenuItem stepItem; |
---|
4500 | 5274 | CheckboxMenuItem toggleLiveItem; |
---|
4501 | 5275 | CheckboxMenuItem toggleFullScreenItem; |
---|
.. | .. |
---|
4509 | 5283 | CheckboxMenuItem toggleSwitchItem; |
---|
4510 | 5284 | CheckboxMenuItem toggleRootItem; |
---|
4511 | 5285 | CheckboxMenuItem animationItem; |
---|
| 5286 | + MenuItem archiveItem; |
---|
4512 | 5287 | CheckboxMenuItem toggleHandleItem; |
---|
4513 | 5288 | CheckboxMenuItem togglePaintItem; |
---|
4514 | 5289 | JSplitPane mainPanel; |
---|
4515 | 5290 | JScrollPane scrollpane; |
---|
| 5291 | + |
---|
4516 | 5292 | JPanel toolbarPanel; |
---|
| 5293 | + |
---|
4517 | 5294 | cGridBag treePanel; |
---|
| 5295 | + |
---|
4518 | 5296 | JPanel radioPanel; |
---|
4519 | 5297 | ButtonGroup buttonGroup; |
---|
4520 | | - cGridBag ctrlPanel; |
---|
| 5298 | + |
---|
| 5299 | + cGridBag toolboxPanel; |
---|
4521 | 5300 | cGridBag materialPanel; |
---|
| 5301 | + cGridBag ctrlPanel; |
---|
| 5302 | + |
---|
4522 | 5303 | JScrollPane infoPanel; |
---|
| 5304 | + |
---|
4523 | 5305 | cGridBag optionsPanel; |
---|
| 5306 | + |
---|
4524 | 5307 | JTabbedPane objectPanel; |
---|
| 5308 | + boolean materialFlushed; |
---|
| 5309 | + Object3D latestObject; |
---|
| 5310 | + |
---|
4525 | 5311 | cGridBag XYZPanel; |
---|
| 5312 | + |
---|
4526 | 5313 | JSplitPane gridPanel; |
---|
4527 | 5314 | JSplitPane bigPanel; |
---|
| 5315 | + |
---|
4528 | 5316 | cGridBag bigThree; |
---|
4529 | 5317 | cGridBag scenePanel; |
---|
4530 | 5318 | cGridBag centralPanel; |
---|
.. | .. |
---|
4639 | 5427 | cNumberSlider fogField; |
---|
4640 | 5428 | JLabel opacityPowerLabel; |
---|
4641 | 5429 | cNumberSlider opacityPowerField; |
---|
4642 | | - JTree jTree; |
---|
| 5430 | + cTree jTree; |
---|
4643 | 5431 | //ObjectUI parent; |
---|
4644 | 5432 | |
---|
4645 | 5433 | cNumberSlider normalpushField; |
---|
| 5434 | + |
---|
| 5435 | + private MenuItem importGFDItem; |
---|
| 5436 | + private MenuItem importVRMLX3DItem; |
---|
| 5437 | + private MenuItem import3DSItem; |
---|
| 5438 | + private MenuItem importOBJItem; |
---|
4646 | 5439 | } |
---|