.. | .. |
---|
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.versionlist == null) |
---|
| 300 | + { |
---|
| 301 | + copy.versionlist = new Object3D[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.versionlist == null) |
---|
| 319 | + { |
---|
| 320 | + copy.versionlist = new Object3D[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.versionlist == 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"); |
---|
384 | | - materialPanel = new cGridBag().setVertical(true); |
---|
385 | | - materialPanel.setName("Material"); |
---|
| 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 | + |
---|
| 470 | + materialPanel = new cGridBag().setVertical(false); |
---|
| 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 | |
---|
.. | .. |
---|
501 | 596 | //SendInfo("Name:", "bold"); |
---|
502 | 597 | if (sel.GetTextures() != null || debug) |
---|
503 | 598 | { |
---|
504 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 599 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
505 | 600 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
506 | 601 | if (sel.Size() > 0) |
---|
507 | 602 | { |
---|
508 | 603 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
509 | 604 | } |
---|
510 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 605 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
511 | 606 | if (debug) |
---|
512 | 607 | { |
---|
513 | 608 | try |
---|
.. | .. |
---|
549 | 644 | } |
---|
550 | 645 | if (sel.support != null) |
---|
551 | 646 | { |
---|
552 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 647 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
553 | 648 | } |
---|
554 | 649 | if (sel.scriptnode != null) |
---|
555 | 650 | { |
---|
.. | .. |
---|
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(); |
---|
| 851 | + |
---|
| 852 | + cameraView.requestFocusInWindow(); |
---|
655 | 853 | } |
---|
| 854 | + |
---|
| 855 | + private Object3D CompressCopy() |
---|
| 856 | + { |
---|
| 857 | + boolean temp = CameraPane.SWITCH; |
---|
| 858 | + CameraPane.SWITCH = false; |
---|
| 859 | + |
---|
| 860 | + copy.ExtractBigData(versiontable); |
---|
| 861 | + // if (copy == client) |
---|
| 862 | + |
---|
| 863 | + Object3D versions[] = copy.versionlist; |
---|
| 864 | + copy.versionlist = null; |
---|
| 865 | + |
---|
| 866 | + //byte[] compress = Compress(copy); |
---|
| 867 | + Object3D compress = (Object3D)Grafreed.clone(copy); |
---|
| 868 | + |
---|
| 869 | + copy.versionlist = versions; |
---|
| 870 | + |
---|
| 871 | + copy.RestoreBigData(versiontable); |
---|
| 872 | + |
---|
| 873 | + CameraPane.SWITCH = temp; |
---|
| 874 | + |
---|
| 875 | + return compress; |
---|
| 876 | + } |
---|
656 | 877 | |
---|
657 | 878 | private JTextPane createTextPane() |
---|
658 | 879 | { |
---|
.. | .. |
---|
752 | 973 | protected static ImageIcon createImageIcon(String path, |
---|
753 | 974 | String description) |
---|
754 | 975 | { |
---|
755 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 976 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
756 | 977 | if (imgURL != null) |
---|
757 | 978 | { |
---|
758 | 979 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
775 | 996 | { |
---|
776 | 997 | SetupMaterial(materialPanel); |
---|
777 | 998 | } |
---|
| 999 | + |
---|
778 | 1000 | //SetupName(); |
---|
779 | 1001 | //SetupViews(); |
---|
780 | 1002 | } |
---|
.. | .. |
---|
784 | 1006 | // NumberSlider vDivsField; |
---|
785 | 1007 | // JCheckBox endcaps; |
---|
786 | 1008 | JCheckBox liveCB; |
---|
| 1009 | + JCheckBox selectableCB; |
---|
787 | 1010 | JCheckBox hideCB; |
---|
788 | 1011 | JCheckBox link2masterCB; |
---|
789 | 1012 | JCheckBox markCB; |
---|
.. | .. |
---|
791 | 1014 | JCheckBox speedupCB; |
---|
792 | 1015 | JCheckBox rewindCB; |
---|
793 | 1016 | JCheckBox flipVCB; |
---|
| 1017 | + |
---|
| 1018 | + cCheckBox toggleTextureCB; |
---|
| 1019 | + cCheckBox toggleSwitchCB; |
---|
| 1020 | + |
---|
794 | 1021 | JComboBox texresMenu; |
---|
| 1022 | + |
---|
795 | 1023 | JButton resetButton; |
---|
796 | 1024 | JButton stepButton; |
---|
797 | 1025 | JButton stepAllButton; |
---|
.. | .. |
---|
800 | 1028 | JButton fasterButton; |
---|
801 | 1029 | JButton remarkButton; |
---|
802 | 1030 | |
---|
| 1031 | + cGridBag editPanel; |
---|
| 1032 | + cGridBag editCommandsPanel; |
---|
| 1033 | + |
---|
803 | 1034 | cGridBag namePanel; |
---|
804 | 1035 | cGridBag setupPanel; |
---|
805 | | - cGridBag commandsPanel; |
---|
| 1036 | + cGridBag setupPanel2; |
---|
| 1037 | + cGridBag objectCommandsPanel; |
---|
806 | 1038 | cGridBag pushPanel; |
---|
807 | 1039 | cGridBag fillPanel; |
---|
808 | 1040 | |
---|
.. | .. |
---|
974 | 1206 | namePanel = new cGridBag(); |
---|
975 | 1207 | |
---|
976 | 1208 | nameField = AddText(namePanel, copy.GetName()); |
---|
977 | | - namePanel.add(nameField); |
---|
| 1209 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
978 | 1210 | oe.ctrlPanel.add(namePanel); |
---|
979 | 1211 | |
---|
980 | 1212 | oe.ctrlPanel.Return(); |
---|
981 | 1213 | |
---|
982 | | - if (!GroupEditor.allparams) |
---|
| 1214 | + if (!allparams) |
---|
983 | 1215 | return; |
---|
984 | 1216 | |
---|
985 | 1217 | setupPanel = new cGridBag().setVertical(false); |
---|
986 | 1218 | |
---|
987 | 1219 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
988 | 1220 | liveCB.setToolTipText("Animate object"); |
---|
| 1221 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1222 | + selectableCB.setToolTipText("Make object selectable"); |
---|
| 1223 | +// Return(); |
---|
| 1224 | + |
---|
989 | 1225 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
990 | 1226 | hideCB.setToolTipText("Hide object"); |
---|
991 | | -// Return(); |
---|
992 | 1227 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
993 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1228 | + markCB.setToolTipText("As animation target transform"); |
---|
994 | 1229 | |
---|
995 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1230 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
| 1231 | + |
---|
| 1232 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1233 | + |
---|
| 1234 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
996 | 1235 | rewindCB.setToolTipText("Rewind animation"); |
---|
997 | 1236 | |
---|
998 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
999 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1237 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1238 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1000 | 1239 | |
---|
| 1240 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1241 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1242 | + |
---|
1001 | 1243 | if (Globals.ADVANCED) |
---|
1002 | 1244 | { |
---|
1003 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
1004 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1005 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1245 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1006 | 1246 | speedupCB.setToolTipText("Option motion capture"); |
---|
1007 | 1247 | } |
---|
1008 | 1248 | |
---|
1009 | 1249 | oe.ctrlPanel.add(setupPanel); |
---|
1010 | 1250 | oe.ctrlPanel.Return(); |
---|
| 1251 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1252 | + oe.ctrlPanel.Return(); |
---|
1011 | 1253 | |
---|
1012 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1254 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
1013 | 1255 | |
---|
1014 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1256 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
1015 | 1257 | resetButton.setToolTipText("Jump to frame zero"); |
---|
1016 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1258 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
1017 | 1259 | stepButton.setToolTipText("Step one frame"); |
---|
1018 | 1260 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
1019 | 1261 | // stepAllButton = AddButton(oe, "Step All"); |
---|
1020 | 1262 | // Return(); |
---|
1021 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1263 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
1022 | 1264 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
1023 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1265 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
1024 | 1266 | fasterButton.setToolTipText("Increase animation speed"); |
---|
1025 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1267 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
1026 | 1268 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
1027 | 1269 | |
---|
1028 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1270 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
1029 | 1271 | oe.ctrlPanel.Return(); |
---|
1030 | 1272 | |
---|
1031 | | - pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1); |
---|
| 1273 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
1032 | 1274 | normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
1033 | 1275 | //Return(); |
---|
1034 | 1276 | |
---|
.. | .. |
---|
1231 | 1473 | //worldPanel.setName("World"); |
---|
1232 | 1474 | centralPanel = new cGridBag(); |
---|
1233 | 1475 | centralPanel.preferredWidth = 20; |
---|
1234 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1235 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1476 | + |
---|
| 1477 | + if (Globals.ADVANCED) |
---|
| 1478 | + { |
---|
| 1479 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1480 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1236 | 1481 | |
---|
1237 | 1482 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1238 | 1483 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1241 | 1486 | // cameraPanel.setDividerSize(9); |
---|
1242 | 1487 | cameraPanel.setResizeWeight(1.0); |
---|
1243 | 1488 | |
---|
| 1489 | + } |
---|
| 1490 | + |
---|
1244 | 1491 | centralPanel.add(cameraView); |
---|
| 1492 | + centralPanel.setFocusable(true); |
---|
1245 | 1493 | //frame.setJMenuBar(timelineMenubar); |
---|
1246 | 1494 | //centralPanel.add(timelinePanel); |
---|
1247 | 1495 | |
---|
.. | .. |
---|
1267 | 1515 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1268 | 1516 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1269 | 1517 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1518 | + //XYZPanel.setName("XYZ"); |
---|
1270 | 1519 | |
---|
1271 | 1520 | /* |
---|
1272 | 1521 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1304 | 1553 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1305 | 1554 | //tmp.setName("Edit"); |
---|
1306 | 1555 | objectPanel.add(materialPanel); |
---|
| 1556 | + objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1557 | + objectPanel.setToolTipTextAt(0, "Material"); |
---|
| 1558 | + |
---|
1307 | 1559 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1308 | 1560 | // north.setName("Edit"); |
---|
1309 | 1561 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1310 | 1562 | // objectPanel.add(north); |
---|
1311 | | - objectPanel.add(ctrlPanel); |
---|
1312 | | - objectPanel.add(infoPanel); |
---|
| 1563 | + objectPanel.add(editPanel); |
---|
| 1564 | + objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
| 1565 | + objectPanel.setToolTipTextAt(1, "Edit controls"); |
---|
| 1566 | + |
---|
| 1567 | + //if (Globals.ADVANCED) |
---|
| 1568 | + objectPanel.add(infoPanel); |
---|
| 1569 | + objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
| 1570 | + objectPanel.setToolTipTextAt(2, "Information"); |
---|
| 1571 | + |
---|
| 1572 | + objectPanel.add(XYZPanel); |
---|
| 1573 | + objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
| 1574 | + objectPanel.setToolTipTextAt(3, "XYZ/RGB transform"); |
---|
| 1575 | + |
---|
| 1576 | + objectPanel.add(toolboxPanel); |
---|
| 1577 | + objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
| 1578 | + objectPanel.setToolTipTextAt(4, "Objects & backgrounds"); |
---|
1313 | 1579 | |
---|
1314 | 1580 | /* |
---|
1315 | 1581 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1318 | 1584 | aConstraints.gridy += 1; |
---|
1319 | 1585 | aConstraints.gridwidth = 1; |
---|
1320 | 1586 | mainPanel.add(objectPanel, aConstraints); |
---|
1321 | | - */ |
---|
| 1587 | + */ |
---|
1322 | 1588 | |
---|
1323 | 1589 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1324 | 1590 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1330 | 1596 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1331 | 1597 | |
---|
1332 | 1598 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1333 | | - scenePanel.preferredWidth = 6; |
---|
| 1599 | + scenePanel.preferredWidth = 5; |
---|
1334 | 1600 | |
---|
1335 | 1601 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1336 | 1602 | tabbedPane.add(scrollpane); |
---|
1337 | 1603 | |
---|
1338 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1339 | | - |
---|
1340 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1604 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1341 | 1605 | |
---|
1342 | 1606 | optionsPanel.setName("Options"); |
---|
1343 | 1607 | |
---|
.. | .. |
---|
1345 | 1609 | |
---|
1346 | 1610 | tabbedPane.add(optionsPanel); |
---|
1347 | 1611 | |
---|
| 1612 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1613 | + |
---|
1348 | 1614 | scenePanel.add(tabbedPane); |
---|
1349 | 1615 | |
---|
1350 | 1616 | /* |
---|
.. | .. |
---|
1408 | 1674 | bigThree = new cGridBag(); |
---|
1409 | 1675 | bigThree.addComponent(scenePanel); |
---|
1410 | 1676 | bigThree.addComponent(centralPanel); |
---|
1411 | | - bigThree.addComponent(XYZPanel); |
---|
| 1677 | + //bigThree.addComponent(XYZPanel); |
---|
1412 | 1678 | |
---|
1413 | 1679 | // // SIDE EFFECT!!! |
---|
1414 | 1680 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1417 | 1683 | // aConstraints.gridheight = 1; |
---|
1418 | 1684 | |
---|
1419 | 1685 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1420 | | - framePanel.setContinuousLayout(true); |
---|
1421 | | - framePanel.setOneTouchExpandable(true); |
---|
1422 | | - framePanel.setDividerLocation(0.8); |
---|
| 1686 | + framePanel.setContinuousLayout(false); |
---|
| 1687 | + framePanel.setOneTouchExpandable(false); |
---|
| 1688 | + //.setDividerLocation(0.8); |
---|
1423 | 1689 | //framePanel.setDividerSize(15); |
---|
1424 | 1690 | //framePanel.setResizeWeight(0.15); |
---|
1425 | 1691 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1437 | 1703 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1438 | 1704 | |
---|
1439 | 1705 | frame.setSize(1280, 860); |
---|
1440 | | - frame.setVisible(true); |
---|
1441 | | - |
---|
| 1706 | + |
---|
| 1707 | + cameraView.requestFocusInWindow(); |
---|
| 1708 | + |
---|
1442 | 1709 | gridPanel.setDividerLocation(1.0); |
---|
| 1710 | + |
---|
| 1711 | + frame.validate(); |
---|
| 1712 | + |
---|
| 1713 | + frame.setVisible(true); |
---|
1443 | 1714 | |
---|
1444 | 1715 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1445 | 1716 | frame.addWindowListener(new WindowAdapter() |
---|
1446 | 1717 | { |
---|
1447 | | - |
---|
1448 | 1718 | public void windowClosing(WindowEvent e) |
---|
1449 | 1719 | { |
---|
1450 | 1720 | Close(); |
---|
.. | .. |
---|
1467 | 1737 | ctrlPanel.removeAll(); |
---|
1468 | 1738 | } |
---|
1469 | 1739 | |
---|
1470 | | - void SetupMaterial(cGridBag panel) |
---|
| 1740 | + void SetupMaterial(cGridBag materialpanel) |
---|
1471 | 1741 | { |
---|
1472 | | - /* |
---|
| 1742 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1743 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1744 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1745 | + { |
---|
| 1746 | + public void mouseClicked(MouseEvent e) |
---|
| 1747 | + { |
---|
| 1748 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1749 | + cMaterial material = object.material; |
---|
| 1750 | + |
---|
| 1751 | + // Skin |
---|
| 1752 | + colorField.setFloat(material.color); |
---|
| 1753 | + saturationField.setFloat(material.modulation); |
---|
| 1754 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1755 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1756 | + diffusenessField.setFloat(material.factor); |
---|
| 1757 | + shininessField.setFloat(material.shininess); |
---|
| 1758 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1759 | + diffuseField.setFloat(material.diffuse); |
---|
| 1760 | + specularField.setFloat(material.specular); |
---|
| 1761 | + |
---|
| 1762 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1763 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1764 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1765 | + |
---|
| 1766 | + materialtouched = true; |
---|
| 1767 | + applySelf(); |
---|
| 1768 | + } |
---|
| 1769 | + }); |
---|
| 1770 | + presetpanel.add(skin); |
---|
| 1771 | + |
---|
| 1772 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 1773 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 1774 | + { |
---|
| 1775 | + public void mouseClicked(MouseEvent e) |
---|
| 1776 | + { |
---|
| 1777 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 1778 | + cMaterial material = object.material; |
---|
| 1779 | + |
---|
| 1780 | + shininessField.setFloat(material.shininess); |
---|
| 1781 | + velvetField.setFloat(material.velvet); |
---|
| 1782 | + |
---|
| 1783 | + materialtouched = true; |
---|
| 1784 | + applySelf(); |
---|
| 1785 | + } |
---|
| 1786 | + }); |
---|
| 1787 | + presetpanel.add(rough2); |
---|
| 1788 | + |
---|
| 1789 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF)); |
---|
| 1790 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF)); |
---|
| 1791 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF)); |
---|
| 1792 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF)); |
---|
| 1793 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF)); |
---|
| 1794 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF)); |
---|
| 1795 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF)); |
---|
| 1796 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF)); |
---|
| 1797 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF)); |
---|
| 1798 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF)); |
---|
| 1799 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF)); |
---|
| 1800 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF)); |
---|
| 1801 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF)); |
---|
| 1802 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF)); |
---|
| 1803 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF)); |
---|
| 1804 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF)); |
---|
| 1805 | + |
---|
| 1806 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 1807 | + |
---|
| 1808 | + presetpanel.preferredWidth = 1; |
---|
| 1809 | + |
---|
| 1810 | + materialpanel.add(panel); |
---|
| 1811 | + materialpanel.add(presetpanel); |
---|
| 1812 | + |
---|
| 1813 | + panel.preferredWidth = 8; |
---|
| 1814 | + |
---|
| 1815 | + /* |
---|
1473 | 1816 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1474 | 1817 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1475 | | - */ |
---|
| 1818 | + */ |
---|
1476 | 1819 | |
---|
1477 | 1820 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1478 | 1821 | |
---|
1479 | | - editBar.add(createMaterialButton = new cButton("Create", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 1822 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1480 | 1823 | createMaterialButton.setToolTipText("Create material"); |
---|
1481 | 1824 | |
---|
1482 | 1825 | /* |
---|
1483 | 1826 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1484 | 1827 | */ |
---|
1485 | 1828 | |
---|
1486 | | - editBar.add(clearMaterialButton = new cButton("Clear", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 1829 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1487 | 1830 | clearMaterialButton.setToolTipText("Clear material"); |
---|
1488 | 1831 | |
---|
1489 | 1832 | if (Globals.ADVANCED) |
---|
1490 | 1833 | { |
---|
1491 | | - editBar.add(resetSlidersButton = new cButton("Reset", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 1834 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1492 | 1835 | editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1493 | 1836 | editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
1494 | 1837 | } |
---|
.. | .. |
---|
1506 | 1849 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1507 | 1850 | |
---|
1508 | 1851 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 1852 | + |
---|
| 1853 | + cGridBag huepanel = new cGridBag(); |
---|
| 1854 | + cGridBag huelabel = new cGridBag(); |
---|
| 1855 | + skin = GetLabel("icons/hue.png", false); |
---|
| 1856 | + skin.fit = true; |
---|
| 1857 | + huelabel.add(skin); |
---|
| 1858 | + huelabel.preferredWidth = 20; |
---|
| 1859 | + huepanel.add(new cGridBag()); // Label |
---|
| 1860 | + huepanel.add(huelabel); // Field/slider |
---|
| 1861 | + |
---|
| 1862 | + huepanel.preferredHeight = 7; |
---|
| 1863 | + |
---|
| 1864 | + colorSection.add(huepanel); |
---|
1509 | 1865 | |
---|
1510 | 1866 | cGridBag color = new cGridBag(); |
---|
1511 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1512 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1513 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1867 | + |
---|
| 1868 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 1869 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1870 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1871 | + |
---|
1514 | 1872 | //colorField.preferredWidth = 200; |
---|
1515 | 1873 | colorSection.add(color); |
---|
1516 | 1874 | |
---|
1517 | 1875 | cGridBag modulation = new cGridBag(); |
---|
1518 | 1876 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1519 | 1877 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1520 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1878 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1521 | 1879 | colorSection.add(modulation); |
---|
1522 | 1880 | |
---|
| 1881 | + cGridBag opacity = new cGridBag(); |
---|
| 1882 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 1883 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1884 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1885 | + colorSection.add(opacity); |
---|
| 1886 | + |
---|
| 1887 | + colorSection.add(GetSeparator()); |
---|
| 1888 | + |
---|
1523 | 1889 | cGridBag texture = new cGridBag(); |
---|
1524 | 1890 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1525 | 1891 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1526 | 1892 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1527 | 1893 | colorSection.add(texture); |
---|
1528 | 1894 | |
---|
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 | | - |
---|
1547 | | - panel.add(new JSeparator()); |
---|
| 1895 | + panel.add(GetSeparator()); |
---|
1548 | 1896 | |
---|
1549 | 1897 | panel.add(colorSection); |
---|
1550 | 1898 | |
---|
.. | .. |
---|
1594 | 1942 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1595 | 1943 | diffuseSection.add(fakedepth); |
---|
1596 | 1944 | |
---|
1597 | | - panel.add(new JSeparator()); |
---|
| 1945 | + cGridBag shadowbias = new cGridBag(); |
---|
| 1946 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 1947 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1948 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1949 | + diffuseSection.add(shadowbias); |
---|
| 1950 | + |
---|
| 1951 | + panel.add(GetSeparator()); |
---|
1598 | 1952 | |
---|
1599 | 1953 | panel.add(diffuseSection); |
---|
1600 | 1954 | |
---|
.. | .. |
---|
1644 | 1998 | // aConstraints.gridy += 1; |
---|
1645 | 1999 | // aConstraints.gridwidth = 1; |
---|
1646 | 2000 | |
---|
| 2001 | + cGridBag anisoU = new cGridBag(); |
---|
| 2002 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 2003 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2004 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2005 | + specularSection.add(anisoU); |
---|
1647 | 2006 | |
---|
1648 | | - panel.add(new JSeparator()); |
---|
| 2007 | + cGridBag anisoV = new cGridBag(); |
---|
| 2008 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 2009 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2010 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2011 | + specularSection.add(anisoV); |
---|
| 2012 | + |
---|
| 2013 | + |
---|
| 2014 | + panel.add(GetSeparator()); |
---|
1649 | 2015 | |
---|
1650 | 2016 | panel.add(specularSection); |
---|
1651 | 2017 | |
---|
1652 | 2018 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1653 | 2019 | |
---|
1654 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 2020 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1655 | 2021 | |
---|
1656 | 2022 | cGridBag camera = new cGridBag(); |
---|
1657 | 2023 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1658 | 2024 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1659 | 2025 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1660 | | - globalSection.add(camera); |
---|
| 2026 | + colorSection.add(camera); |
---|
1661 | 2027 | |
---|
1662 | 2028 | cGridBag ambient = new cGridBag(); |
---|
1663 | 2029 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1664 | 2030 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1665 | 2031 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1666 | | - globalSection.add(ambient); |
---|
| 2032 | + colorSection.add(ambient); |
---|
1667 | 2033 | |
---|
1668 | 2034 | cGridBag backlit = new cGridBag(); |
---|
1669 | 2035 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1670 | 2036 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1671 | 2037 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1672 | | - globalSection.add(backlit); |
---|
| 2038 | + colorSection.add(backlit); |
---|
1673 | 2039 | |
---|
1674 | | - cGridBag opacity = new cGridBag(); |
---|
1675 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1676 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1677 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1678 | | - globalSection.add(opacity); |
---|
1679 | | - |
---|
1680 | | - panel.add(new JSeparator()); |
---|
| 2040 | + //panel.add(new JSeparator()); |
---|
1681 | 2041 | |
---|
1682 | | - panel.add(globalSection); |
---|
| 2042 | + //panel.add(globalSection); |
---|
1683 | 2043 | |
---|
1684 | 2044 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1685 | 2045 | |
---|
.. | .. |
---|
1721 | 2081 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1722 | 2082 | textureSection.add(opacityPower); |
---|
1723 | 2083 | |
---|
1724 | | - panel.add(new JSeparator()); |
---|
| 2084 | + panel.add(GetSeparator()); |
---|
1725 | 2085 | |
---|
1726 | 2086 | panel.add(textureSection); |
---|
1727 | 2087 | |
---|
.. | .. |
---|
1786 | 2146 | // 3D models |
---|
1787 | 2147 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1788 | 2148 | { |
---|
1789 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1790 | | - LoadFile(filename, lastConverter); |
---|
| 2149 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2150 | + //LoadFile(filename, lastConverter); |
---|
| 2151 | + LoadObjFile(filename); // New 3ds loader |
---|
1791 | 2152 | continue; |
---|
1792 | 2153 | } |
---|
1793 | 2154 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
1939 | 2300 | |
---|
1940 | 2301 | //? flashIt = false; |
---|
1941 | 2302 | CameraPane pane = (CameraPane) cameraView; |
---|
1942 | | - pane.clickStart(location.x, location.y, 0); |
---|
| 2303 | + pane.clickStart(location.x, location.y, 0, 0); |
---|
1943 | 2304 | pane.clickEnd(location.x, location.y, 0, true); |
---|
1944 | 2305 | |
---|
1945 | 2306 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
1988 | 2349 | e2.printStackTrace(); |
---|
1989 | 2350 | } |
---|
1990 | 2351 | } |
---|
| 2352 | + |
---|
1991 | 2353 | LoadJMEThread loadThread; |
---|
1992 | 2354 | |
---|
1993 | 2355 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
2045 | 2407 | //LoadFile0(filename, converter); |
---|
2046 | 2408 | } |
---|
2047 | 2409 | } |
---|
| 2410 | + |
---|
2048 | 2411 | LoadOBJThread loadObjThread; |
---|
2049 | 2412 | |
---|
2050 | 2413 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2123 | 2486 | |
---|
2124 | 2487 | void LoadObjFile(String fullname) |
---|
2125 | 2488 | { |
---|
2126 | | - /* |
---|
| 2489 | + System.out.println("Loading " + fullname); |
---|
| 2490 | + /**/ |
---|
2127 | 2491 | //lastFilename = fullname; |
---|
2128 | 2492 | if(loadObjThread == null) |
---|
2129 | 2493 | { |
---|
2130 | | - loadObjThread = new LoadOBJThread(); |
---|
2131 | | - loadObjThread.start(); |
---|
| 2494 | + loadObjThread = new LoadOBJThread(); |
---|
| 2495 | + loadObjThread.start(); |
---|
2132 | 2496 | } |
---|
2133 | 2497 | |
---|
2134 | 2498 | loadObjThread.add(fullname); |
---|
2135 | | - */ |
---|
| 2499 | + /**/ |
---|
2136 | 2500 | |
---|
2137 | | - System.out.println("Loading " + fullname); |
---|
2138 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2501 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2139 | 2502 | } |
---|
2140 | 2503 | |
---|
2141 | 2504 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2396 | 2759 | |
---|
2397 | 2760 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2398 | 2761 | { |
---|
2399 | | - if (GrafreeD.standAlone) |
---|
| 2762 | + if (Grafreed.standAlone) |
---|
2400 | 2763 | { |
---|
2401 | 2764 | /**/ |
---|
2402 | 2765 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2403 | | - browser.show(); |
---|
| 2766 | + browser.setVisible(true); |
---|
2404 | 2767 | String filename = browser.getFile(); |
---|
2405 | 2768 | if (filename != null && filename.length() > 0) |
---|
2406 | 2769 | { |
---|
.. | .. |
---|
2511 | 2874 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2512 | 2875 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2513 | 2876 | } |
---|
| 2877 | + |
---|
2514 | 2878 | //cJME.count++; |
---|
2515 | 2879 | //cJME.count %= 12; |
---|
2516 | 2880 | if (gc) |
---|
.. | .. |
---|
2694 | 3058 | } |
---|
2695 | 3059 | } |
---|
2696 | 3060 | } |
---|
| 3061 | + |
---|
2697 | 3062 | cFileSystemPane FSPane; |
---|
2698 | 3063 | |
---|
2699 | 3064 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2703 | 3068 | |
---|
2704 | 3069 | freezematerial = true; |
---|
2705 | 3070 | colorField.setFloat(mat.color); |
---|
2706 | | - modulationField.setFloat(mat.modulation); |
---|
| 3071 | + saturationField.setFloat(mat.modulation); |
---|
2707 | 3072 | metalnessField.setFloat(mat.metalness); |
---|
2708 | 3073 | diffuseField.setFloat(mat.diffuse); |
---|
2709 | 3074 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
2747 | 3112 | } |
---|
2748 | 3113 | } |
---|
2749 | 3114 | } |
---|
| 3115 | + |
---|
2750 | 3116 | freezematerial = false; |
---|
2751 | 3117 | } |
---|
2752 | 3118 | |
---|
2753 | 3119 | void SetMaterial(Object3D object) |
---|
2754 | 3120 | { |
---|
| 3121 | + latestObject = object; |
---|
| 3122 | + |
---|
2755 | 3123 | cMaterial mat = object.material; |
---|
2756 | 3124 | |
---|
2757 | 3125 | if (mat == null) |
---|
.. | .. |
---|
2863 | 3231 | // } |
---|
2864 | 3232 | |
---|
2865 | 3233 | /**/ |
---|
2866 | | - if (deselect) |
---|
| 3234 | + if (deselect || child == null) |
---|
2867 | 3235 | { |
---|
2868 | 3236 | //group.deselectAll(); |
---|
2869 | 3237 | //freeze = true; |
---|
2870 | 3238 | GetTree().clearSelection(); |
---|
2871 | 3239 | //freeze = false; |
---|
| 3240 | + |
---|
| 3241 | + if (child == null) |
---|
| 3242 | + { |
---|
| 3243 | + return; |
---|
| 3244 | + } |
---|
2872 | 3245 | } |
---|
2873 | 3246 | |
---|
2874 | 3247 | //group.addSelectee(child); |
---|
.. | .. |
---|
2937 | 3310 | cameraView.ToggleDL(); |
---|
2938 | 3311 | cameraView.repaint(); |
---|
2939 | 3312 | return; |
---|
2940 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3313 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2941 | 3314 | { |
---|
2942 | 3315 | cameraView.ToggleTexture(); |
---|
2943 | 3316 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2976 | 3349 | frame.validate(); |
---|
2977 | 3350 | |
---|
2978 | 3351 | return; |
---|
2979 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3352 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2980 | 3353 | { |
---|
2981 | | - cameraView.ToggleRandom(); |
---|
| 3354 | + cameraView.ToggleSwitch(); |
---|
2982 | 3355 | cameraView.repaint(); |
---|
2983 | 3356 | return; |
---|
2984 | 3357 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
3006 | 3379 | } else if (event.getSource() == liveCB) |
---|
3007 | 3380 | { |
---|
3008 | 3381 | copy.live ^= true; |
---|
| 3382 | + objEditor.refreshContents(true); // To show item colors |
---|
| 3383 | + return; |
---|
| 3384 | + } else if (event.getSource() == selectableCB) |
---|
| 3385 | + { |
---|
| 3386 | + copy.dontselect ^= true; |
---|
3009 | 3387 | return; |
---|
3010 | 3388 | } else if (event.getSource() == hideCB) |
---|
3011 | 3389 | { |
---|
3012 | 3390 | copy.hide ^= true; |
---|
3013 | 3391 | copy.Touch(); // display list issue |
---|
3014 | | - objEditor.refreshContents(); |
---|
| 3392 | + objEditor.refreshContents(true); // To show item colors |
---|
3015 | 3393 | return; |
---|
3016 | 3394 | } else if (event.getSource() == link2masterCB) |
---|
3017 | 3395 | { |
---|
.. | .. |
---|
3045 | 3423 | |
---|
3046 | 3424 | public void actionPerformed(ActionEvent event) |
---|
3047 | 3425 | { |
---|
| 3426 | + Object source = event.getSource(); |
---|
3048 | 3427 | // SCRIPT DIALOG |
---|
3049 | | - if (event.getSource() == okbutton) |
---|
| 3428 | + if (source == okbutton) |
---|
3050 | 3429 | { |
---|
3051 | 3430 | textpanel.setVisible(false); |
---|
3052 | 3431 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3058 | 3437 | textarea = null; |
---|
3059 | 3438 | textpanel = null; |
---|
3060 | 3439 | } |
---|
3061 | | - if (event.getSource() == cancelbutton) |
---|
| 3440 | + if (source == cancelbutton) |
---|
3062 | 3441 | { |
---|
3063 | 3442 | textpanel.setVisible(false); |
---|
3064 | 3443 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3070 | 3449 | //applySelf(); |
---|
3071 | 3450 | //client.refreshEditWindow(); |
---|
3072 | 3451 | //refreshContents(); |
---|
3073 | | - if (event.getSource() == nameField) |
---|
| 3452 | + if (source == nameField) |
---|
3074 | 3453 | { |
---|
3075 | 3454 | //System.out.println("ObjEditor " + event); |
---|
3076 | 3455 | applySelf0(true); |
---|
3077 | 3456 | //parent.applySelf(); |
---|
3078 | 3457 | objEditor.refreshContents(); |
---|
3079 | | - } else if (event.getSource() == resetButton) |
---|
| 3458 | + } else if (source == resetButton) |
---|
3080 | 3459 | { |
---|
3081 | 3460 | CameraPane.fullreset = true; |
---|
3082 | 3461 | copy.Reset(); // ResetMeshes(); |
---|
3083 | 3462 | copy.Touch(); |
---|
3084 | 3463 | objEditor.refreshContents(); |
---|
3085 | | - } else if (event.getSource() == stepItem) |
---|
| 3464 | + } else if (source == stepItem) |
---|
3086 | 3465 | { |
---|
3087 | 3466 | //cameraView.ONESTEP = true; |
---|
3088 | 3467 | Globals.ONESTEP = true; |
---|
3089 | 3468 | cameraView.repaint(); |
---|
3090 | 3469 | return; |
---|
3091 | | - } else if (event.getSource() == stepButton) |
---|
| 3470 | + } else if (source == stepButton) |
---|
3092 | 3471 | { |
---|
3093 | 3472 | copy.Step(); |
---|
3094 | 3473 | copy.Touch(); |
---|
3095 | 3474 | objEditor.refreshContents(); |
---|
3096 | | - } else if (event.getSource() == slowerButton) |
---|
| 3475 | + } else if (source == slowerButton) |
---|
3097 | 3476 | { |
---|
3098 | 3477 | copy.Slower(); |
---|
3099 | 3478 | copy.Touch(); |
---|
3100 | 3479 | objEditor.refreshContents(); |
---|
3101 | | - } else if (event.getSource() == fasterButton) |
---|
| 3480 | + } else if (source == fasterButton) |
---|
3102 | 3481 | { |
---|
3103 | 3482 | copy.Faster(); |
---|
3104 | 3483 | copy.Touch(); |
---|
3105 | 3484 | objEditor.refreshContents(); |
---|
3106 | | - } else if (event.getSource() == remarkButton) |
---|
| 3485 | + } else if (source == remarkButton) |
---|
3107 | 3486 | { |
---|
3108 | 3487 | copy.Remark(); |
---|
3109 | 3488 | copy.Touch(); |
---|
3110 | 3489 | objEditor.refreshContents(); |
---|
3111 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3490 | + } else if (source == stepAllButton) |
---|
3112 | 3491 | { |
---|
3113 | 3492 | copy.StepAll(); |
---|
3114 | 3493 | copy.Touch(); |
---|
3115 | 3494 | objEditor.refreshContents(); |
---|
3116 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3495 | + } else if (source == resetAllButton) |
---|
3117 | 3496 | { |
---|
3118 | 3497 | //CameraPane.fullreset = true; |
---|
3119 | 3498 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3146 | 3525 | // Close(); |
---|
3147 | 3526 | // } |
---|
3148 | 3527 | // else |
---|
3149 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3528 | + if (source == resetSlidersButton) |
---|
3150 | 3529 | { |
---|
3151 | 3530 | ResetSliders(); |
---|
3152 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3531 | + } else if (source == clearMaterialButton) |
---|
3153 | 3532 | { |
---|
3154 | 3533 | ClearMaterial(); |
---|
3155 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3534 | + } else if (source == createMaterialButton) |
---|
3156 | 3535 | { |
---|
3157 | 3536 | CreateMaterial(); |
---|
3158 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3537 | + } else if (source == clearPanelButton) |
---|
3159 | 3538 | { |
---|
3160 | 3539 | copy.ClearUI(); |
---|
3161 | 3540 | refreshContents(true); |
---|
3162 | | - } /* |
---|
3163 | | - } |
---|
3164 | | - |
---|
3165 | | - public boolean action(Event event, Object arg) |
---|
3166 | | - { |
---|
3167 | | - */ else if (event.getSource() == closeItem) |
---|
| 3541 | + } else if (source == importGFDItem) |
---|
| 3542 | + { |
---|
| 3543 | + ImportGFD(); |
---|
| 3544 | + } else |
---|
| 3545 | + if (source == importVRMLX3DItem) |
---|
| 3546 | + { |
---|
| 3547 | + ImportVRMLX3D(); |
---|
| 3548 | + } else |
---|
| 3549 | + if (source == import3DSItem) |
---|
| 3550 | + { |
---|
| 3551 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3552 | + } else |
---|
| 3553 | + if (source == importOBJItem) |
---|
| 3554 | + { |
---|
| 3555 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3556 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3557 | + browser.setVisible(true); |
---|
| 3558 | + String filename = browser.getFile(); |
---|
| 3559 | + if (filename != null && filename.length() > 0) |
---|
| 3560 | + { |
---|
| 3561 | + String fullname = browser.getDirectory() + filename; |
---|
| 3562 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3563 | + } |
---|
| 3564 | + } else |
---|
| 3565 | + if (source == closeItem) |
---|
3168 | 3566 | { |
---|
3169 | 3567 | Close(); |
---|
3170 | 3568 | //return true; |
---|
3171 | | - } else if (event.getSource() == loadItem) |
---|
| 3569 | + } else if (source == openItem) |
---|
3172 | 3570 | { |
---|
3173 | | - load(); |
---|
| 3571 | + Open(); |
---|
3174 | 3572 | //return true; |
---|
3175 | | - } else if (event.getSource() == saveItem) |
---|
| 3573 | + } else if (source == newItem) |
---|
| 3574 | + { |
---|
| 3575 | + New(); |
---|
| 3576 | + } else if (source == saveItem) |
---|
3176 | 3577 | { |
---|
3177 | 3578 | save(); |
---|
3178 | 3579 | //return true; |
---|
3179 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3580 | + } else if (source == saveAsItem) |
---|
3180 | 3581 | { |
---|
3181 | 3582 | saveAs(); |
---|
3182 | 3583 | //return true; |
---|
3183 | | - } else if (event.getSource() == reexportItem) |
---|
| 3584 | + } else if (source == reexportItem) |
---|
3184 | 3585 | { |
---|
3185 | 3586 | reexport(); |
---|
3186 | 3587 | //return true; |
---|
3187 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3588 | + } else if (source == exportAsItem) |
---|
3188 | 3589 | { |
---|
3189 | 3590 | export(); |
---|
3190 | 3591 | //return true; |
---|
3191 | | - } else if (event.getSource() == povItem) |
---|
| 3592 | + } else if (source == povItem) |
---|
3192 | 3593 | { |
---|
3193 | 3594 | generatePOV(); |
---|
3194 | 3595 | //return true; |
---|
3195 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3596 | + } else if (event.getSource() == archiveItem) |
---|
| 3597 | + { |
---|
| 3598 | + cTools.Archive(frame); |
---|
| 3599 | + return; |
---|
| 3600 | + } else if (source == zBufferItem) |
---|
3196 | 3601 | { |
---|
3197 | 3602 | try |
---|
3198 | 3603 | { |
---|
.. | .. |
---|
3214 | 3619 | cameraView.repaint(); |
---|
3215 | 3620 | //return true; |
---|
3216 | 3621 | } |
---|
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) |
---|
| 3622 | + */ else // combos... |
---|
| 3623 | + if (source == texresMenu) |
---|
3232 | 3624 | { |
---|
3233 | 3625 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3234 | 3626 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3240 | 3632 | } |
---|
3241 | 3633 | } |
---|
3242 | 3634 | |
---|
| 3635 | + void New() |
---|
| 3636 | + { |
---|
| 3637 | + while (copy.Size() > 1) |
---|
| 3638 | + { |
---|
| 3639 | + copy.remove(1); |
---|
| 3640 | + } |
---|
| 3641 | + |
---|
| 3642 | + ResetModel(); |
---|
| 3643 | + objEditor.refreshContents(); |
---|
| 3644 | + } |
---|
| 3645 | + |
---|
| 3646 | + static public byte[] Compress(Object3D o) |
---|
| 3647 | + { |
---|
| 3648 | + // Slower to actually compress. |
---|
| 3649 | + try |
---|
| 3650 | + { |
---|
| 3651 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3652 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3653 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
| 3654 | + |
---|
| 3655 | + Object3D parent = o.parent; |
---|
| 3656 | + o.parent = null; |
---|
| 3657 | + |
---|
| 3658 | + out.writeObject(o); |
---|
| 3659 | + |
---|
| 3660 | + o.parent = parent; |
---|
| 3661 | + |
---|
| 3662 | + out.flush(); |
---|
| 3663 | + |
---|
| 3664 | + baos //zstream |
---|
| 3665 | + .close(); |
---|
| 3666 | + out.close(); |
---|
| 3667 | + |
---|
| 3668 | + byte[] bytes = baos.toByteArray(); |
---|
| 3669 | + |
---|
| 3670 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 3671 | + return bytes; |
---|
| 3672 | + } catch (Exception e) |
---|
| 3673 | + { |
---|
| 3674 | + System.err.println(e); |
---|
| 3675 | + return null; |
---|
| 3676 | + } |
---|
| 3677 | + } |
---|
| 3678 | + |
---|
| 3679 | + static public Object Uncompress(byte[] bytes) |
---|
| 3680 | + { |
---|
| 3681 | + System.out.println("restore #bytes = " + bytes.length); |
---|
| 3682 | + try |
---|
| 3683 | + { |
---|
| 3684 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3685 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3686 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
| 3687 | + Object obj = in.readObject(); |
---|
| 3688 | + |
---|
| 3689 | + bais //istream |
---|
| 3690 | + .close(); |
---|
| 3691 | + in.close(); |
---|
| 3692 | + |
---|
| 3693 | + return obj; |
---|
| 3694 | + } catch (Exception e) |
---|
| 3695 | + { |
---|
| 3696 | + System.err.println(e); |
---|
| 3697 | + return null; |
---|
| 3698 | + } |
---|
| 3699 | + } |
---|
| 3700 | + |
---|
| 3701 | + static public Object clone(Object o) |
---|
| 3702 | + { |
---|
| 3703 | + try |
---|
| 3704 | + { |
---|
| 3705 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3706 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3707 | + |
---|
| 3708 | + out.writeObject(o); |
---|
| 3709 | + |
---|
| 3710 | + out.flush(); |
---|
| 3711 | + out.close(); |
---|
| 3712 | + |
---|
| 3713 | + byte[] bytes = baos.toByteArray(); |
---|
| 3714 | + |
---|
| 3715 | + System.out.println("clone = " + bytes.length); |
---|
| 3716 | + |
---|
| 3717 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3718 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3719 | + Object obj = in.readObject(); |
---|
| 3720 | + in.close(); |
---|
| 3721 | + |
---|
| 3722 | + return obj; |
---|
| 3723 | + } catch (Exception e) |
---|
| 3724 | + { |
---|
| 3725 | + System.err.println(e); |
---|
| 3726 | + return null; |
---|
| 3727 | + } |
---|
| 3728 | + } |
---|
| 3729 | + |
---|
| 3730 | + cRadio GetCurrentTab() |
---|
| 3731 | + { |
---|
| 3732 | + cRadio ab; |
---|
| 3733 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3734 | + { |
---|
| 3735 | + ab = (cRadio)e.nextElement(); |
---|
| 3736 | + if(ab.GetObject() == copy) |
---|
| 3737 | + { |
---|
| 3738 | + return ab; |
---|
| 3739 | + } |
---|
| 3740 | + } |
---|
| 3741 | + |
---|
| 3742 | + return null; |
---|
| 3743 | + } |
---|
| 3744 | + |
---|
| 3745 | + |
---|
| 3746 | + public void Save() |
---|
| 3747 | + { |
---|
| 3748 | + //Save(true); |
---|
| 3749 | + Replace(); |
---|
| 3750 | + SetUndoStates(); |
---|
| 3751 | + } |
---|
| 3752 | + |
---|
| 3753 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 3754 | + { |
---|
| 3755 | + if (compress.length != name.length) |
---|
| 3756 | + { |
---|
| 3757 | + return false; |
---|
| 3758 | + } |
---|
| 3759 | + |
---|
| 3760 | + for (int i=compress.length; --i>=0;) |
---|
| 3761 | + { |
---|
| 3762 | + if (compress[i] != name[i]) |
---|
| 3763 | + return false; |
---|
| 3764 | + } |
---|
| 3765 | + |
---|
| 3766 | + return true; |
---|
| 3767 | + } |
---|
| 3768 | + |
---|
| 3769 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3770 | + |
---|
| 3771 | + void DeleteVersion() |
---|
| 3772 | + { |
---|
| 3773 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 3774 | + { |
---|
| 3775 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 3776 | + } |
---|
| 3777 | + |
---|
| 3778 | + CopyChanged(); |
---|
| 3779 | + |
---|
| 3780 | + SetUndoStates(); |
---|
| 3781 | + } |
---|
| 3782 | + |
---|
| 3783 | + public boolean Save(boolean user) |
---|
| 3784 | + { |
---|
| 3785 | + System.err.println("Save"); |
---|
| 3786 | + //Replace(); |
---|
| 3787 | + |
---|
| 3788 | + cRadio tab = GetCurrentTab(); |
---|
| 3789 | + |
---|
| 3790 | + Object3D compress = CompressCopy(); // Saved version. No need for "Replace"? |
---|
| 3791 | + |
---|
| 3792 | + boolean thesame = false; |
---|
| 3793 | + |
---|
| 3794 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 3795 | +// { |
---|
| 3796 | +// thesame = true; |
---|
| 3797 | +// } |
---|
| 3798 | + |
---|
| 3799 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3800 | + if (!thesame) |
---|
| 3801 | + { |
---|
| 3802 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 3803 | + { |
---|
| 3804 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 3805 | + } |
---|
| 3806 | + |
---|
| 3807 | + //tab.user[tab.versionindex] = user; |
---|
| 3808 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 3809 | + |
---|
| 3810 | + copy.versionlist[++copy.versionindex] = compress; |
---|
| 3811 | + |
---|
| 3812 | + // if (increment) |
---|
| 3813 | + // tab.versionindex++; |
---|
| 3814 | + } |
---|
| 3815 | + |
---|
| 3816 | + //copy.RestoreBigData(versiontable); |
---|
| 3817 | + |
---|
| 3818 | + //assert(hashtable.isEmpty()); |
---|
| 3819 | + |
---|
| 3820 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 3821 | +// { |
---|
| 3822 | +// //tab.user[i] = false; |
---|
| 3823 | +// copy.versionlist[i] = null; |
---|
| 3824 | +// } |
---|
| 3825 | + |
---|
| 3826 | + SetUndoStates(); |
---|
| 3827 | + |
---|
| 3828 | + // test save |
---|
| 3829 | + if (false) |
---|
| 3830 | + { |
---|
| 3831 | + try |
---|
| 3832 | + { |
---|
| 3833 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
| 3834 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3835 | + |
---|
| 3836 | + p.writeObject(copy); |
---|
| 3837 | + |
---|
| 3838 | + p.flush(); |
---|
| 3839 | + |
---|
| 3840 | + ostream.close(); |
---|
| 3841 | + } catch (Exception e) |
---|
| 3842 | + { |
---|
| 3843 | + e.printStackTrace(); |
---|
| 3844 | + } |
---|
| 3845 | + } |
---|
| 3846 | + |
---|
| 3847 | + return !thesame; |
---|
| 3848 | + } |
---|
| 3849 | + |
---|
| 3850 | + boolean flashIt = true; |
---|
| 3851 | + |
---|
| 3852 | + void RefreshSelection() |
---|
| 3853 | + { |
---|
| 3854 | + Object3D selection = new Object3D(); |
---|
| 3855 | + |
---|
| 3856 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 3857 | + { |
---|
| 3858 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 3859 | + |
---|
| 3860 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 3861 | + |
---|
| 3862 | + if (obj == null) |
---|
| 3863 | + { |
---|
| 3864 | + copy.selection.remove(i--); |
---|
| 3865 | + } |
---|
| 3866 | + else |
---|
| 3867 | + { |
---|
| 3868 | + selection.add(obj); |
---|
| 3869 | + copy.selection.setElementAt(obj, i); |
---|
| 3870 | + } |
---|
| 3871 | + } |
---|
| 3872 | + |
---|
| 3873 | + flashIt = false; |
---|
| 3874 | + GetTree().clearSelection(); |
---|
| 3875 | + for (int i = 0; i < selection.size(); i++) |
---|
| 3876 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 3877 | + flashIt = true; |
---|
| 3878 | + |
---|
| 3879 | + //refreshContents(false); |
---|
| 3880 | + } |
---|
| 3881 | + |
---|
| 3882 | + void CopyChanged() |
---|
| 3883 | + { |
---|
| 3884 | + Object3D obj = copy.versionlist[copy.versionindex]; |
---|
| 3885 | + |
---|
| 3886 | + SetUndoStates(); |
---|
| 3887 | + |
---|
| 3888 | + boolean temp = CameraPane.SWITCH; |
---|
| 3889 | + CameraPane.SWITCH = false; |
---|
| 3890 | + |
---|
| 3891 | + copy.ExtractBigData(versiontable); |
---|
| 3892 | + |
---|
| 3893 | + copy.clear(); |
---|
| 3894 | + |
---|
| 3895 | + copy.skyboxname = obj.skyboxname; |
---|
| 3896 | + copy.skyboxext = obj.skyboxext; |
---|
| 3897 | + |
---|
| 3898 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3899 | + { |
---|
| 3900 | + copy.add(obj.get(i)); |
---|
| 3901 | + } |
---|
| 3902 | + |
---|
| 3903 | + copy.RestoreBigData(versiontable); |
---|
| 3904 | + |
---|
| 3905 | + CameraPane.SWITCH = temp; |
---|
| 3906 | + |
---|
| 3907 | + RefreshSelection(); |
---|
| 3908 | + //assert(hashtable.isEmpty()); |
---|
| 3909 | + |
---|
| 3910 | + copy.Touch(); |
---|
| 3911 | + |
---|
| 3912 | + ResetModel(); |
---|
| 3913 | + copy.HardTouch(); // recompile? |
---|
| 3914 | + |
---|
| 3915 | + cRadio ab; |
---|
| 3916 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3917 | + { |
---|
| 3918 | + ab = (cRadio)e.nextElement(); |
---|
| 3919 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3920 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3921 | + if (test != null) |
---|
| 3922 | + { |
---|
| 3923 | + test.editWindow = ab.object.editWindow; |
---|
| 3924 | + ab.object = test; |
---|
| 3925 | + } |
---|
| 3926 | + } |
---|
| 3927 | + |
---|
| 3928 | + refreshContents(true); |
---|
| 3929 | + } |
---|
| 3930 | + |
---|
| 3931 | + cButton previousVersionButton; |
---|
| 3932 | + cButton restoreButton; |
---|
| 3933 | + cButton replaceButton; |
---|
| 3934 | + cButton nextVersionButton; |
---|
| 3935 | + cButton saveVersionButton; |
---|
| 3936 | + cButton deleteVersionButton; |
---|
| 3937 | + |
---|
| 3938 | + boolean muteSlider; |
---|
| 3939 | + |
---|
| 3940 | + int VersionCount() |
---|
| 3941 | + { |
---|
| 3942 | + int count = 0; |
---|
| 3943 | + |
---|
| 3944 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
| 3945 | + { |
---|
| 3946 | + if (copy.versionlist[i] != null) |
---|
| 3947 | + count++; |
---|
| 3948 | + } |
---|
| 3949 | + |
---|
| 3950 | + return count; |
---|
| 3951 | + } |
---|
| 3952 | + |
---|
| 3953 | + void SetUndoStates() |
---|
| 3954 | + { |
---|
| 3955 | + cRadio tab = GetCurrentTab(); |
---|
| 3956 | + |
---|
| 3957 | + restoreButton.setEnabled(true); // copy.versionindex != -1); |
---|
| 3958 | + replaceButton.setEnabled(true); // copy.versionindex != -1); |
---|
| 3959 | + |
---|
| 3960 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 3961 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 3962 | + |
---|
| 3963 | + deleteVersionButton.setEnabled(//copy.versionindex > 0 && |
---|
| 3964 | + copy.versionlist[copy.versionindex + 1] != null); |
---|
| 3965 | + |
---|
| 3966 | + muteSlider = true; |
---|
| 3967 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 3968 | + versionSlider.setInteger(copy.versionindex); |
---|
| 3969 | + muteSlider = false; |
---|
| 3970 | + } |
---|
| 3971 | + |
---|
| 3972 | + public boolean PreviousVersion() |
---|
| 3973 | + { |
---|
| 3974 | + // Option? |
---|
| 3975 | + Replace(); |
---|
| 3976 | + |
---|
| 3977 | + System.err.println("Undo"); |
---|
| 3978 | + |
---|
| 3979 | + cRadio tab = GetCurrentTab(); |
---|
| 3980 | + |
---|
| 3981 | + if (copy.versionindex == 0) |
---|
| 3982 | + { |
---|
| 3983 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3984 | + return false; |
---|
| 3985 | + } |
---|
| 3986 | + |
---|
| 3987 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 3988 | +// { |
---|
| 3989 | +// if (Save(false)) |
---|
| 3990 | +// tab.versionindex -= 1; |
---|
| 3991 | +// else |
---|
| 3992 | +// { |
---|
| 3993 | +// if (tab.versionindex <= 0) |
---|
| 3994 | +// return false; |
---|
| 3995 | +// else |
---|
| 3996 | +// tab.versionindex -= 1; |
---|
| 3997 | +// } |
---|
| 3998 | +// } |
---|
| 3999 | + |
---|
| 4000 | + copy.versionindex -= 1; |
---|
| 4001 | + |
---|
| 4002 | + CopyChanged(); |
---|
| 4003 | + |
---|
| 4004 | + return true; |
---|
| 4005 | + } |
---|
| 4006 | + |
---|
| 4007 | + public boolean Restore() |
---|
| 4008 | + { |
---|
| 4009 | + System.err.println("Restore"); |
---|
| 4010 | + |
---|
| 4011 | + cRadio tab = GetCurrentTab(); |
---|
| 4012 | + |
---|
| 4013 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4014 | + { |
---|
| 4015 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4016 | + return false; |
---|
| 4017 | + } |
---|
| 4018 | + |
---|
| 4019 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4020 | + CopyChanged(); |
---|
| 4021 | + |
---|
| 4022 | + return true; |
---|
| 4023 | + } |
---|
| 4024 | + |
---|
| 4025 | + public boolean Replace() |
---|
| 4026 | + { |
---|
| 4027 | + System.err.println("Replace"); |
---|
| 4028 | + |
---|
| 4029 | + cRadio tab = GetCurrentTab(); |
---|
| 4030 | + |
---|
| 4031 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4032 | + { |
---|
| 4033 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4034 | + return false; |
---|
| 4035 | + } |
---|
| 4036 | + |
---|
| 4037 | + copy.versionlist[copy.versionindex] = CompressCopy(); |
---|
| 4038 | + |
---|
| 4039 | + return true; |
---|
| 4040 | + } |
---|
| 4041 | + |
---|
| 4042 | + public void NextVersion() |
---|
| 4043 | + { |
---|
| 4044 | + // Option? |
---|
| 4045 | + Replace(); |
---|
| 4046 | + |
---|
| 4047 | + cRadio tab = GetCurrentTab(); |
---|
| 4048 | + |
---|
| 4049 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
| 4050 | + { |
---|
| 4051 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4052 | + return; |
---|
| 4053 | + } |
---|
| 4054 | + |
---|
| 4055 | + copy.versionindex += 1; |
---|
| 4056 | + |
---|
| 4057 | + CopyChanged(); |
---|
| 4058 | + |
---|
| 4059 | + //if (!tab.user[tab.versionindex]) |
---|
| 4060 | + // tab.graphs[tab.versionindex] = null; |
---|
| 4061 | + } |
---|
| 4062 | + |
---|
| 4063 | + void ImportGFD() |
---|
| 4064 | + { |
---|
| 4065 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 4066 | + browser.show(); |
---|
| 4067 | + String filename = browser.getFile(); |
---|
| 4068 | + if (filename != null && filename.length() > 0) |
---|
| 4069 | + { |
---|
| 4070 | + String fullname = browser.getDirectory() + filename; |
---|
| 4071 | + |
---|
| 4072 | + //Object3D readobj = |
---|
| 4073 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 4074 | + //makeSomething(readobj); |
---|
| 4075 | + } |
---|
| 4076 | + } |
---|
| 4077 | + |
---|
| 4078 | + void ImportVRMLX3D() |
---|
| 4079 | + { |
---|
| 4080 | + if (Grafreed.standAlone) |
---|
| 4081 | + { |
---|
| 4082 | + /**/ |
---|
| 4083 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 4084 | + browser.show(); |
---|
| 4085 | + String filename = browser.getFile(); |
---|
| 4086 | + if (filename != null && filename.length() > 0) |
---|
| 4087 | + { |
---|
| 4088 | + String fullname = browser.getDirectory() + filename; |
---|
| 4089 | + LoadVRMLX3D(fullname); |
---|
| 4090 | + } |
---|
| 4091 | + /**/ |
---|
| 4092 | + } |
---|
| 4093 | + } |
---|
| 4094 | + |
---|
3243 | 4095 | void ToggleAnimation() |
---|
3244 | 4096 | { |
---|
3245 | 4097 | if (!Globals.ANIMATION) |
---|
.. | .. |
---|
3255 | 4107 | |
---|
3256 | 4108 | Globals.ANIMATION ^= true; |
---|
3257 | 4109 | |
---|
3258 | | - GrafreeD.wav.cursor = 0; |
---|
3259 | | - GrafreeD.wav.loop = 0; |
---|
| 4110 | + Grafreed.wav.cursor = 0; |
---|
| 4111 | + Grafreed.wav.loop = 0; |
---|
3260 | 4112 | } |
---|
3261 | 4113 | } else |
---|
3262 | 4114 | { |
---|
.. | .. |
---|
3357 | 4209 | assert false; |
---|
3358 | 4210 | } |
---|
3359 | 4211 | |
---|
3360 | | - void EditSelection() |
---|
| 4212 | + void EditSelection(boolean newWindow) |
---|
3361 | 4213 | { |
---|
3362 | 4214 | } |
---|
3363 | 4215 | |
---|
.. | .. |
---|
3416 | 4268 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
3417 | 4269 | |
---|
3418 | 4270 | current.color = (float) colorField.getFloat(); |
---|
3419 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4271 | + current.modulation = (float) saturationField.getFloat(); |
---|
3420 | 4272 | current.metalness = (float) metalnessField.getFloat(); |
---|
3421 | 4273 | current.diffuse = (float) diffuseField.getFloat(); |
---|
3422 | 4274 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
3443 | 4295 | { |
---|
3444 | 4296 | //System.out.println("Propagate = " + propagate); |
---|
3445 | 4297 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 4298 | + |
---|
| 4299 | + if (copy.material != null) |
---|
| 4300 | + { |
---|
| 4301 | + cMaterial mat = copy.material; |
---|
| 4302 | + |
---|
| 4303 | + colorField.SetToolTipValue((mat.color)); |
---|
| 4304 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
| 4305 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 4306 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 4307 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 4308 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 4309 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 4310 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 4311 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 4312 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 4313 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 4314 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 4315 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 4316 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 4317 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 4318 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 4319 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 4320 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 4321 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 4322 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 4323 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 4324 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 4325 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 4326 | + } |
---|
| 4327 | + |
---|
3446 | 4328 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3447 | 4329 | { |
---|
3448 | 4330 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3471 | 4353 | //copy.Touch(); |
---|
3472 | 4354 | } |
---|
3473 | 4355 | |
---|
| 4356 | + cNumberSlider versionSlider; |
---|
| 4357 | + |
---|
3474 | 4358 | public void stateChanged(ChangeEvent e) |
---|
3475 | 4359 | { |
---|
3476 | 4360 | // assert(false); |
---|
| 4361 | + if (e.getSource() == versionSlider) |
---|
| 4362 | + { |
---|
| 4363 | + if (muteSlider) |
---|
| 4364 | + return; |
---|
| 4365 | + |
---|
| 4366 | + int version = versionSlider.getInteger(); |
---|
| 4367 | + |
---|
| 4368 | + if (copy.versionlist[version] != null) |
---|
| 4369 | + { |
---|
| 4370 | + copy.versionindex = version; |
---|
| 4371 | + CopyChanged(); |
---|
| 4372 | + } |
---|
| 4373 | + |
---|
| 4374 | + return; |
---|
| 4375 | + } |
---|
3477 | 4376 | |
---|
3478 | 4377 | if (freezematerial) |
---|
3479 | 4378 | { |
---|
.. | .. |
---|
3509 | 4408 | { |
---|
3510 | 4409 | //System.out.println("stateChanged = " + this); |
---|
3511 | 4410 | materialtouched = true; |
---|
| 4411 | + |
---|
| 4412 | + if (e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4413 | + { |
---|
| 4414 | + saturationField.setFloat(1); |
---|
| 4415 | + } |
---|
| 4416 | + |
---|
3512 | 4417 | applySelf(); |
---|
3513 | 4418 | //System.out.println("this = " + this); |
---|
3514 | 4419 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
3558 | 4463 | } |
---|
3559 | 4464 | |
---|
3560 | 4465 | if (normalpushField != null) |
---|
3561 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 4466 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3562 | 4467 | } |
---|
3563 | 4468 | |
---|
3564 | 4469 | void SnapObject() |
---|
.. | .. |
---|
3808 | 4713 | { |
---|
3809 | 4714 | if (GetTree() != null) |
---|
3810 | 4715 | { |
---|
| 4716 | + GetTree().revalidate(); |
---|
3811 | 4717 | GetTree().repaint(); |
---|
3812 | 4718 | } |
---|
3813 | 4719 | |
---|
.. | .. |
---|
3816 | 4722 | ctrlPanel.validate(); // ? new |
---|
3817 | 4723 | ctrlPanel.repaint(); |
---|
3818 | 4724 | } |
---|
| 4725 | + |
---|
| 4726 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 4727 | + SetUndoStates(); |
---|
3819 | 4728 | } |
---|
3820 | 4729 | |
---|
3821 | 4730 | static TweenManager tweenManager = new TweenManager(); |
---|
3822 | 4731 | |
---|
3823 | 4732 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3824 | 4733 | { |
---|
| 4734 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
| 4735 | + Save(); |
---|
3825 | 4736 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3826 | 4737 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3827 | 4738 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3908 | 4819 | { |
---|
3909 | 4820 | ResetModel(); |
---|
3910 | 4821 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4822 | + |
---|
| 4823 | + if (thing.Size() == 0) |
---|
| 4824 | + { |
---|
| 4825 | + //EditSelection(false); |
---|
| 4826 | + } |
---|
| 4827 | + |
---|
3911 | 4828 | refreshContents(); |
---|
3912 | 4829 | } |
---|
3913 | 4830 | |
---|
.. | .. |
---|
4025 | 4942 | } |
---|
4026 | 4943 | } |
---|
4027 | 4944 | } |
---|
| 4945 | + |
---|
4028 | 4946 | LoadGFDThread loadGFDThread; |
---|
4029 | 4947 | |
---|
4030 | 4948 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
4044 | 4962 | |
---|
4045 | 4963 | try |
---|
4046 | 4964 | { |
---|
| 4965 | + // Try compressed version first. |
---|
4047 | 4966 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4048 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4967 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4968 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
4049 | 4969 | |
---|
4050 | 4970 | readobj = (Object3D) p.readObject(); |
---|
4051 | 4971 | istream.close(); |
---|
.. | .. |
---|
4053 | 4973 | readobj.ResetDisplayList(); |
---|
4054 | 4974 | } catch (Exception e) |
---|
4055 | 4975 | { |
---|
4056 | | - e.printStackTrace(); |
---|
| 4976 | + if (!e.toString().contains("GZIP")) |
---|
| 4977 | + e.printStackTrace(); |
---|
| 4978 | + |
---|
| 4979 | + try |
---|
| 4980 | + { |
---|
| 4981 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4982 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4983 | + |
---|
| 4984 | + readobj = (Object3D) p.readObject(); |
---|
| 4985 | + istream.close(); |
---|
| 4986 | + |
---|
| 4987 | + readobj.ResetDisplayList(); |
---|
| 4988 | + } catch (Exception e2) |
---|
| 4989 | + { |
---|
| 4990 | + e2.printStackTrace(); |
---|
| 4991 | + } |
---|
4057 | 4992 | } |
---|
4058 | 4993 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4059 | 4994 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4099 | 5034 | |
---|
4100 | 5035 | void LoadIt(Object obj) |
---|
4101 | 5036 | { |
---|
| 5037 | + if (obj == null) |
---|
| 5038 | + { |
---|
| 5039 | + // Invalid file |
---|
| 5040 | + return; |
---|
| 5041 | + } |
---|
| 5042 | + |
---|
4102 | 5043 | System.out.println("Loaded " + obj); |
---|
4103 | 5044 | //new Exception().printStackTrace(); |
---|
4104 | 5045 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4108 | 5049 | |
---|
4109 | 5050 | if (readobj != null) |
---|
4110 | 5051 | { |
---|
| 5052 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 5053 | + // Save(); |
---|
4111 | 5054 | try |
---|
4112 | 5055 | { |
---|
4113 | 5056 | //readobj.deepCopySelf(copy); |
---|
4114 | 5057 | copy.clear(); // june 2014 |
---|
| 5058 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5059 | + copy.skyboxext = readobj.skyboxext; |
---|
4115 | 5060 | for (int i = 0; i < readobj.size(); i++) |
---|
4116 | 5061 | { |
---|
4117 | 5062 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4152 | 5097 | } |
---|
4153 | 5098 | } catch (ClassCastException e) |
---|
4154 | 5099 | { |
---|
| 5100 | + e.printStackTrace(); |
---|
4155 | 5101 | assert (false); |
---|
4156 | 5102 | Composite c = (Composite) copy; |
---|
4157 | 5103 | c.children.clear(); |
---|
.. | .. |
---|
4162 | 5108 | c.addChild(csg); |
---|
4163 | 5109 | } |
---|
4164 | 5110 | |
---|
| 5111 | + copy.versionlist = readobj.versionlist; |
---|
| 5112 | + copy.versionindex = readobj.versionindex; |
---|
| 5113 | + |
---|
| 5114 | + if (copy.versionlist == null) |
---|
| 5115 | + { |
---|
| 5116 | + copy.versionlist = new Object3D[100]; |
---|
| 5117 | + copy.versionindex = -1; |
---|
| 5118 | + } |
---|
| 5119 | + |
---|
| 5120 | + //? SetUndoStates(); |
---|
| 5121 | + |
---|
4165 | 5122 | ResetModel(); |
---|
4166 | 5123 | copy.HardTouch(); // recompile? |
---|
4167 | 5124 | refreshContents(); |
---|
4168 | 5125 | } |
---|
4169 | 5126 | } |
---|
4170 | 5127 | |
---|
4171 | | - void load() // throws ClassNotFoundException |
---|
| 5128 | + void Open() // throws ClassNotFoundException |
---|
4172 | 5129 | { |
---|
4173 | | - if (GrafreeD.standAlone) |
---|
| 5130 | + if (Grafreed.standAlone) |
---|
4174 | 5131 | { |
---|
4175 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5132 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4176 | 5133 | browser.show(); |
---|
4177 | 5134 | String filename = browser.getFile(); |
---|
4178 | 5135 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4257 | 5214 | try |
---|
4258 | 5215 | { |
---|
4259 | 5216 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4260 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 5217 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5218 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4261 | 5219 | |
---|
4262 | 5220 | p.writeObject(copy); |
---|
4263 | 5221 | p.flush(); |
---|
4264 | 5222 | |
---|
| 5223 | + zstream.close(); |
---|
4265 | 5224 | ostream.close(); |
---|
4266 | 5225 | |
---|
4267 | 5226 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4269 | 5228 | //ps.print(buffer.toString()); |
---|
4270 | 5229 | } catch (IOException e) |
---|
4271 | 5230 | { |
---|
| 5231 | + e.printStackTrace(); |
---|
4272 | 5232 | } |
---|
4273 | 5233 | } |
---|
| 5234 | + |
---|
4274 | 5235 | String lastname; |
---|
4275 | 5236 | |
---|
4276 | 5237 | void saveAs() |
---|
4277 | 5238 | { |
---|
4278 | | - if (GrafreeD.standAlone) |
---|
| 5239 | + if (Grafreed.standAlone) |
---|
4279 | 5240 | { |
---|
4280 | 5241 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4281 | 5242 | browser.setVisible(true); |
---|
4282 | 5243 | String filename = browser.getFile(); |
---|
4283 | 5244 | if (filename != null && filename.length() > 0) |
---|
4284 | 5245 | { |
---|
| 5246 | + if (!filename.endsWith(".gfd")) |
---|
| 5247 | + filename += ".gfd"; |
---|
4285 | 5248 | lastname = browser.getDirectory() + filename; |
---|
4286 | 5249 | save(); |
---|
4287 | 5250 | } |
---|
.. | .. |
---|
4380 | 5343 | try |
---|
4381 | 5344 | { |
---|
4382 | 5345 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4383 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4384 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 5346 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5347 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4385 | 5348 | |
---|
4386 | 5349 | Object3D objectparent = obj.parent; |
---|
4387 | 5350 | obj.parent = null; |
---|
4388 | 5351 | |
---|
4389 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 5352 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4390 | 5353 | |
---|
4391 | 5354 | obj.parent = objectparent; |
---|
4392 | 5355 | |
---|
.. | .. |
---|
4398 | 5361 | p.writeObject(object); |
---|
4399 | 5362 | p.flush(); |
---|
4400 | 5363 | |
---|
| 5364 | + zstream.close(); |
---|
4401 | 5365 | ostream.close(); |
---|
4402 | | - // zstream.close(); |
---|
4403 | 5366 | |
---|
4404 | 5367 | // group.selection.get(0).parent = parent; |
---|
4405 | 5368 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4420 | 5383 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4421 | 5384 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4422 | 5385 | copy.generatePOV(buffer); |
---|
4423 | | - if (GrafreeD.standAlone) |
---|
| 5386 | + if (Grafreed.standAlone) |
---|
4424 | 5387 | { |
---|
4425 | 5388 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4426 | 5389 | browser.show(); |
---|
.. | .. |
---|
4446 | 5409 | Object3D client; |
---|
4447 | 5410 | Object3D copy; |
---|
4448 | 5411 | MenuBar menuBar; |
---|
4449 | | - Menu windowMenu; |
---|
4450 | | - MenuItem loadItem; |
---|
| 5412 | + Menu fileMenu; |
---|
| 5413 | + MenuItem newItem; |
---|
| 5414 | + MenuItem openItem; |
---|
4451 | 5415 | MenuItem saveItem; |
---|
4452 | 5416 | MenuItem saveAsItem; |
---|
4453 | 5417 | MenuItem exportAsItem; |
---|
4454 | 5418 | MenuItem reexportItem; |
---|
4455 | 5419 | MenuItem povItem; |
---|
4456 | 5420 | MenuItem closeItem; |
---|
4457 | | - Menu cameraMenu; |
---|
| 5421 | + |
---|
4458 | 5422 | CheckboxMenuItem zBufferItem; |
---|
4459 | 5423 | //MenuItem normalLensItem; |
---|
4460 | | - MenuItem editCameraItem; |
---|
4461 | | - MenuItem revertCameraItem; |
---|
4462 | 5424 | MenuItem stepItem; |
---|
4463 | 5425 | CheckboxMenuItem toggleLiveItem; |
---|
4464 | 5426 | CheckboxMenuItem toggleFullScreenItem; |
---|
.. | .. |
---|
4472 | 5434 | CheckboxMenuItem toggleSwitchItem; |
---|
4473 | 5435 | CheckboxMenuItem toggleRootItem; |
---|
4474 | 5436 | CheckboxMenuItem animationItem; |
---|
| 5437 | + MenuItem archiveItem; |
---|
4475 | 5438 | CheckboxMenuItem toggleHandleItem; |
---|
4476 | 5439 | CheckboxMenuItem togglePaintItem; |
---|
4477 | 5440 | JSplitPane mainPanel; |
---|
4478 | 5441 | JScrollPane scrollpane; |
---|
| 5442 | + |
---|
4479 | 5443 | JPanel toolbarPanel; |
---|
| 5444 | + |
---|
4480 | 5445 | cGridBag treePanel; |
---|
| 5446 | + |
---|
4481 | 5447 | JPanel radioPanel; |
---|
4482 | 5448 | ButtonGroup buttonGroup; |
---|
4483 | | - cGridBag ctrlPanel; |
---|
| 5449 | + |
---|
| 5450 | + cGridBag toolboxPanel; |
---|
4484 | 5451 | cGridBag materialPanel; |
---|
| 5452 | + cGridBag ctrlPanel; |
---|
| 5453 | + |
---|
4485 | 5454 | JScrollPane infoPanel; |
---|
| 5455 | + |
---|
4486 | 5456 | cGridBag optionsPanel; |
---|
| 5457 | + |
---|
4487 | 5458 | JTabbedPane objectPanel; |
---|
| 5459 | + boolean materialFlushed; |
---|
| 5460 | + Object3D latestObject; |
---|
| 5461 | + |
---|
4488 | 5462 | cGridBag XYZPanel; |
---|
| 5463 | + |
---|
4489 | 5464 | JSplitPane gridPanel; |
---|
4490 | 5465 | JSplitPane bigPanel; |
---|
| 5466 | + |
---|
4491 | 5467 | cGridBag bigThree; |
---|
4492 | 5468 | cGridBag scenePanel; |
---|
4493 | 5469 | cGridBag centralPanel; |
---|
.. | .. |
---|
4545 | 5521 | JLabel colorLabel; |
---|
4546 | 5522 | cNumberSlider colorField; |
---|
4547 | 5523 | JLabel modulationLabel; |
---|
4548 | | - cNumberSlider modulationField; |
---|
| 5524 | + cNumberSlider saturationField; |
---|
4549 | 5525 | JLabel metalnessLabel; |
---|
4550 | 5526 | cNumberSlider metalnessField; |
---|
4551 | 5527 | JLabel diffuseLabel; |
---|
.. | .. |
---|
4602 | 5578 | cNumberSlider fogField; |
---|
4603 | 5579 | JLabel opacityPowerLabel; |
---|
4604 | 5580 | cNumberSlider opacityPowerField; |
---|
4605 | | - JTree jTree; |
---|
| 5581 | + cTree jTree; |
---|
4606 | 5582 | //ObjectUI parent; |
---|
4607 | 5583 | |
---|
4608 | 5584 | cNumberSlider normalpushField; |
---|
| 5585 | + |
---|
| 5586 | + private MenuItem importGFDItem; |
---|
| 5587 | + private MenuItem importVRMLX3DItem; |
---|
| 5588 | + private MenuItem import3DSItem; |
---|
| 5589 | + private MenuItem importOBJItem; |
---|
4609 | 5590 | } |
---|