.. | .. |
---|
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 | |
---|
.. | .. |
---|
30 | 34 | iSendInfo |
---|
31 | 35 | //KeyListener |
---|
32 | 36 | { |
---|
| 37 | + public cToggleButton pinButton; |
---|
33 | 38 | boolean timeline; |
---|
34 | 39 | boolean wasFullScreen; |
---|
35 | 40 | |
---|
36 | 41 | GroupEditor callee; |
---|
37 | 42 | JFrame frame; |
---|
| 43 | + |
---|
| 44 | + static ObjEditor theFrame; |
---|
| 45 | + |
---|
| 46 | + public cGridBag GetSeparator() |
---|
| 47 | + { |
---|
| 48 | + cGridBag separator = new cGridBag(); |
---|
| 49 | + separator.add(new JSeparator()); |
---|
| 50 | + separator.preferredHeight = 5; |
---|
| 51 | + return separator; |
---|
| 52 | + } |
---|
| 53 | + |
---|
| 54 | + cButton GetButton(String name, boolean border) |
---|
| 55 | + { |
---|
| 56 | + ImageIcon icon = GetIcon(name); |
---|
| 57 | + return new cButton(icon, border); |
---|
| 58 | + } |
---|
| 59 | + |
---|
| 60 | + cLabel GetLabel(String name, boolean border) |
---|
| 61 | + { |
---|
| 62 | + //ImageIcon icon = GetIcon(name); |
---|
| 63 | + return new cLabel(GetImage(name), border); |
---|
| 64 | + } |
---|
| 65 | + |
---|
| 66 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 67 | + { |
---|
| 68 | + ImageIcon icon = GetIcon(name); |
---|
| 69 | + return new cToggleButton(icon, border); |
---|
| 70 | + } |
---|
| 71 | + |
---|
| 72 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 73 | + { |
---|
| 74 | + ImageIcon icon = GetIcon(name); |
---|
| 75 | + return new cCheckBox(icon, border); |
---|
| 76 | + } |
---|
| 77 | + |
---|
| 78 | + ImageIcon GetIcon(String name) |
---|
| 79 | + { |
---|
| 80 | + try |
---|
| 81 | + { |
---|
| 82 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 83 | + |
---|
| 84 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 85 | +// { |
---|
| 86 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 87 | +// Graphics2D g = resized.createGraphics(); |
---|
| 88 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 89 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 90 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 91 | +// g.dispose(); |
---|
| 92 | +// |
---|
| 93 | +// image = resized; |
---|
| 94 | +// } |
---|
| 95 | + |
---|
| 96 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 97 | + return icon; |
---|
| 98 | + } |
---|
| 99 | + catch (Exception e) |
---|
| 100 | + { |
---|
| 101 | + return null; |
---|
| 102 | + } |
---|
| 103 | + } |
---|
| 104 | + |
---|
| 105 | + BufferedImage GetImage(String name) |
---|
| 106 | + { |
---|
| 107 | + try |
---|
| 108 | + { |
---|
| 109 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 110 | + |
---|
| 111 | + return image; |
---|
| 112 | + } |
---|
| 113 | + catch (Exception e) |
---|
| 114 | + { |
---|
| 115 | + return null; |
---|
| 116 | + } |
---|
| 117 | + } |
---|
38 | 118 | |
---|
39 | 119 | // SCRIPT |
---|
40 | 120 | |
---|
.. | .. |
---|
143 | 223 | //nameField.removeActionListener(this); |
---|
144 | 224 | // objEditor.ctrlPanel.remove(nameField); |
---|
145 | 225 | |
---|
146 | | - if (!GroupEditor.allparams) |
---|
| 226 | + objEditor.ctrlPanel.remove(namePanel); |
---|
| 227 | + |
---|
| 228 | + if (!allparams) |
---|
147 | 229 | return; |
---|
148 | 230 | |
---|
149 | 231 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
165 | 247 | // objEditor.ctrlPanel.remove(fasterButton); |
---|
166 | 248 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
167 | 249 | |
---|
168 | | - objEditor.ctrlPanel.remove(namePanel); |
---|
169 | 250 | objEditor.ctrlPanel.remove(setupPanel); |
---|
170 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 251 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 252 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
171 | 253 | objEditor.ctrlPanel.remove(pushPanel); |
---|
172 | 254 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
173 | 255 | |
---|
.. | .. |
---|
215 | 297 | client = inClient; |
---|
216 | 298 | copy = client; |
---|
217 | 299 | |
---|
| 300 | +// if (copy.versionlist == null) |
---|
| 301 | +// { |
---|
| 302 | +// copy.versionlist = new Object3D[100]; |
---|
| 303 | +// copy.versionindex = -1; |
---|
| 304 | +// |
---|
| 305 | +// callee.Save(true); |
---|
| 306 | +// } |
---|
| 307 | + |
---|
218 | 308 | // "this" is not called: SetupUI2(objEditor); |
---|
219 | 309 | } |
---|
220 | 310 | |
---|
.. | .. |
---|
228 | 318 | client = inClient; |
---|
229 | 319 | copy = client; |
---|
230 | 320 | |
---|
| 321 | + if (copy.versionlist == null) |
---|
| 322 | + { |
---|
| 323 | + copy.versionlist = new Object3D[100]; |
---|
| 324 | + copy.versionindex = -1; |
---|
| 325 | + |
---|
| 326 | +// Save(true); |
---|
| 327 | + } |
---|
| 328 | + |
---|
231 | 329 | SetupUI2(callee.GetEditor()); |
---|
232 | 330 | } |
---|
233 | 331 | |
---|
.. | .. |
---|
242 | 340 | //localCopy.parent = null; |
---|
243 | 341 | |
---|
244 | 342 | frame = new JFrame(); |
---|
| 343 | + frame.setUndecorated(false); |
---|
245 | 344 | objEditor = this; |
---|
246 | 345 | this.callee = callee; |
---|
247 | 346 | |
---|
.. | .. |
---|
259 | 358 | copy = localCopy; |
---|
260 | 359 | copy.editWindow = this; |
---|
261 | 360 | |
---|
| 361 | +// if (copy.versionlist == null) |
---|
| 362 | +// { |
---|
| 363 | +// copy.versionlist = new Object3D[100]; |
---|
| 364 | +// copy.versionindex = -1; |
---|
| 365 | +// |
---|
| 366 | +// Save(true); |
---|
| 367 | +// } |
---|
| 368 | + |
---|
262 | 369 | SetupMenu(); |
---|
263 | 370 | |
---|
264 | 371 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
272 | 379 | return frame.action(event, obj); |
---|
273 | 380 | } |
---|
274 | 381 | |
---|
| 382 | + // Cannot work without static |
---|
| 383 | + static boolean allparams = true; |
---|
| 384 | + |
---|
| 385 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 386 | + |
---|
275 | 387 | void SetupMenu() |
---|
276 | 388 | { |
---|
277 | 389 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
278 | | - menuBar.add(windowMenu = new Menu("File")); |
---|
279 | | - windowMenu.add(loadItem = new MenuItem("Load...")); |
---|
280 | | - windowMenu.add("-"); |
---|
281 | | - windowMenu.add(saveItem = new MenuItem("Save")); |
---|
282 | | - windowMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
| 390 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 391 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 392 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
| 393 | + |
---|
| 394 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 395 | + Menu menu = new Menu("Import"); |
---|
| 396 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 397 | + importOBJItem.addActionListener(this); |
---|
| 398 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 399 | + import3DSItem.addActionListener(this); |
---|
| 400 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 401 | + importVRMLX3DItem.addActionListener(this); |
---|
| 402 | + menu.add("-"); |
---|
| 403 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 404 | + importGFDItem.addActionListener(this); |
---|
| 405 | + fileMenu.add(menu); |
---|
| 406 | + fileMenu.add("-"); |
---|
| 407 | + |
---|
| 408 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 409 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
283 | 410 | //windowMenu.add(povItem = new MenuItem("Emit POV-Ray...")); |
---|
284 | | - windowMenu.add("-"); |
---|
285 | | - windowMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
286 | | - windowMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
287 | | - windowMenu.add("-"); |
---|
| 411 | + fileMenu.add("-"); |
---|
| 412 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 413 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 414 | + fileMenu.add("-"); |
---|
288 | 415 | if (client.parent != null) |
---|
289 | 416 | { |
---|
290 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 417 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
291 | 418 | } else |
---|
292 | 419 | { |
---|
293 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 420 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
294 | 421 | } |
---|
295 | 422 | |
---|
296 | | - loadItem.addActionListener(this); |
---|
| 423 | + newItem.addActionListener(this); |
---|
| 424 | + openItem.addActionListener(this); |
---|
297 | 425 | saveItem.addActionListener(this); |
---|
298 | 426 | saveAsItem.addActionListener(this); |
---|
299 | 427 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
301 | 429 | //povItem.addActionListener(this); |
---|
302 | 430 | closeItem.addActionListener(this); |
---|
303 | 431 | |
---|
304 | | - menuBar.add(cameraMenu = new Menu("View")); |
---|
305 | | - //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer")); |
---|
306 | | - //zBufferItem.addActionListener(this); |
---|
307 | | - //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens")); |
---|
308 | | - //normalLensItem.addActionListener(this); |
---|
309 | | - cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera")); |
---|
310 | | - revertCameraItem.addActionListener(this); |
---|
311 | | - cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline")); |
---|
312 | | - toggleTimelineItem.addItemListener(this); |
---|
313 | | - cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); |
---|
314 | | - toggleFullScreenItem.addItemListener(this); |
---|
315 | | - toggleFullScreenItem.setState(CameraPane.FULLSCREEN); |
---|
316 | | - cameraMenu.add("-"); |
---|
317 | | - cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); |
---|
318 | | - toggleTextureItem.addItemListener(this); |
---|
319 | | - toggleTextureItem.setState(CameraPane.textureon); |
---|
320 | | - cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); |
---|
321 | | - toggleLiveItem.addItemListener(this); |
---|
322 | | - toggleLiveItem.setState(Globals.isLIVE()); |
---|
323 | | - cameraMenu.add(stepItem = new MenuItem("Step")); |
---|
324 | | - stepItem.addActionListener(this); |
---|
325 | | -// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); |
---|
326 | | -// toggleDLItem.addItemListener(this); |
---|
327 | | -// toggleDLItem.setState(false); |
---|
328 | | - cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render")); |
---|
329 | | - toggleRenderItem.addItemListener(this); |
---|
330 | | - toggleRenderItem.setState(!CameraPane.frozen); |
---|
331 | | - cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); |
---|
332 | | - toggleDebugItem.addItemListener(this); |
---|
333 | | - toggleDebugItem.setState(CameraPane.DEBUG); |
---|
334 | | - cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); |
---|
335 | | - toggleFrustumItem.addItemListener(this); |
---|
336 | | - toggleFrustumItem.setState(CameraPane.FRUSTUM); |
---|
337 | | - cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact")); |
---|
338 | | - toggleFootContactItem.addItemListener(this); |
---|
339 | | - toggleFootContactItem.setState(CameraPane.FOOTCONTACT); |
---|
340 | | - cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random")); |
---|
341 | | - toggleRandomItem.addItemListener(this); |
---|
342 | | - toggleRandomItem.setState(CameraPane.RANDOM); |
---|
343 | | - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); |
---|
344 | | - toggleHandleItem.addItemListener(this); |
---|
345 | | - toggleHandleItem.setState(CameraPane.HANDLES); |
---|
346 | | - cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode")); |
---|
347 | | - togglePaintItem.addItemListener(this); |
---|
348 | | - togglePaintItem.setState(CameraPane.PAINTMODE); |
---|
349 | | -// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root")); |
---|
350 | | -// toggleRootItem.addItemListener(this); |
---|
351 | | -// toggleRootItem.setState(false); |
---|
352 | | -// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation")); |
---|
353 | | -// animationItem.addItemListener(this); |
---|
354 | | -// animationItem.setState(CameraPane.ANIMATION); |
---|
355 | | - cameraMenu.add("-"); |
---|
356 | | - cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera")); |
---|
357 | | - editCameraItem.addActionListener(this); |
---|
358 | | - |
---|
359 | 432 | objectPanel = new JTabbedPane(); |
---|
| 433 | + |
---|
| 434 | + ChangeListener changeListener = new ChangeListener() |
---|
| 435 | + { |
---|
| 436 | + String name; |
---|
| 437 | + |
---|
| 438 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 439 | + { |
---|
| 440 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 441 | +// { |
---|
| 442 | +// if (latestObject != null) |
---|
| 443 | +// { |
---|
| 444 | +// refreshContents(true); |
---|
| 445 | +// SetMaterial(latestObject); |
---|
| 446 | +// } |
---|
| 447 | +// |
---|
| 448 | +// materialFlushed = true; |
---|
| 449 | +// } |
---|
| 450 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 451 | +// { |
---|
| 452 | +// if (listUI.size() == 0) |
---|
| 453 | +// EditSelection(false); |
---|
| 454 | +// } |
---|
| 455 | + |
---|
| 456 | + if (objectPanel.getSelectedIndex() == 4) |
---|
| 457 | + { |
---|
| 458 | + name = copy.skyboxname; |
---|
| 459 | + |
---|
| 460 | + if (name == null) |
---|
| 461 | + { |
---|
| 462 | + name = ""; |
---|
| 463 | + } |
---|
| 464 | + |
---|
| 465 | + copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 466 | + copy.skyboxext = "jpg"; |
---|
| 467 | + } |
---|
| 468 | + else |
---|
| 469 | + { |
---|
| 470 | + if (name != null) |
---|
| 471 | + { |
---|
| 472 | + if (name.equals("")) |
---|
| 473 | + { |
---|
| 474 | + copy.skyboxname = null; |
---|
| 475 | + copy.skyboxext = null; |
---|
| 476 | + } |
---|
| 477 | + else |
---|
| 478 | + { |
---|
| 479 | + copy.skyboxname = name; |
---|
| 480 | + } |
---|
| 481 | + } |
---|
| 482 | + } |
---|
| 483 | + |
---|
| 484 | +// refreshContents(false); // To refresh Info tab |
---|
| 485 | + cameraView.repaint(); |
---|
| 486 | + } |
---|
| 487 | + }; |
---|
| 488 | + objectPanel.addChangeListener(changeListener); |
---|
| 489 | + |
---|
360 | 490 | toolbarPanel = new JPanel(); |
---|
361 | 491 | toolbarPanel.setName("Toolbar"); |
---|
| 492 | + |
---|
362 | 493 | treePanel = new cGridBag(); |
---|
363 | 494 | treePanel.setName("Tree"); |
---|
| 495 | + |
---|
| 496 | + editPanel = new cGridBag().setVertical(true); |
---|
| 497 | + //editPanel.setName("Edit"); |
---|
| 498 | + |
---|
364 | 499 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
365 | | - ctrlPanel.setName("Edit"); |
---|
366 | | - materialPanel = new cGridBag().setVertical(true); |
---|
367 | | - materialPanel.setName("Material"); |
---|
| 500 | + |
---|
| 501 | + editCommandsPanel = new cGridBag(); |
---|
| 502 | + editPanel.add(editCommandsPanel); |
---|
| 503 | + editPanel.add(ctrlPanel); |
---|
| 504 | + |
---|
| 505 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 506 | + //toolboxPanel.setName("Toolbox"); |
---|
| 507 | + |
---|
| 508 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 509 | + |
---|
| 510 | + materialPanel = new cGridBag().setVertical(false); |
---|
| 511 | + //materialPanel.setName("Material"); |
---|
| 512 | + |
---|
368 | 513 | /*JTextPane*/ |
---|
369 | 514 | infoarea = createTextPane(); |
---|
370 | 515 | doc = infoarea.getStyledDocument(); |
---|
371 | 516 | |
---|
372 | 517 | infoarea.setEditable(true); |
---|
373 | 518 | SetText(); |
---|
| 519 | + |
---|
374 | 520 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
375 | 521 | // infoarea.setOpaque(false); |
---|
376 | 522 | // //infoarea.setForeground(textcolor); |
---|
377 | 523 | // TEXTAREA infoarea.setLineWrap(true); |
---|
378 | 524 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
379 | 525 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
380 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
381 | | - infoPanel.setName("Info"); |
---|
| 526 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
| 527 | + //infoPanel.setName("Info"); |
---|
382 | 528 | //infoPanel.setLayout(new BorderLayout()); |
---|
383 | 529 | //infoPanel.add(createTextPane()); |
---|
384 | 530 | |
---|
.. | .. |
---|
389 | 535 | mainPanel.setDividerSize(9); |
---|
390 | 536 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
391 | 537 | mainPanel.setResizeWeight(0.5); |
---|
392 | | - |
---|
| 538 | + |
---|
| 539 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 540 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 541 | + divider.setDividerSize(15); |
---|
| 542 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 543 | + |
---|
| 544 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 545 | + |
---|
393 | 546 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
394 | 547 | //mainPanel.setLayout(new GridBagLayout()); |
---|
395 | 548 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
457 | 610 | e.printStackTrace(); |
---|
458 | 611 | } |
---|
459 | 612 | |
---|
460 | | - String selection = infoarea.getText(); |
---|
461 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
462 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
463 | | - Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
| 613 | +// String selection = infoarea.getText(); |
---|
| 614 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 615 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 616 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
464 | 617 | //clipboard.setContents(data, data); |
---|
465 | 618 | } |
---|
466 | 619 | |
---|
.. | .. |
---|
483 | 636 | //SendInfo("Name:", "bold"); |
---|
484 | 637 | if (sel.GetTextures() != null || debug) |
---|
485 | 638 | { |
---|
486 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 639 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
487 | 640 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
488 | 641 | if (sel.Size() > 0) |
---|
489 | 642 | { |
---|
490 | 643 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
491 | 644 | } |
---|
492 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 645 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
493 | 646 | if (debug) |
---|
494 | 647 | { |
---|
495 | 648 | try |
---|
.. | .. |
---|
531 | 684 | } |
---|
532 | 685 | if (sel.support != null) |
---|
533 | 686 | { |
---|
534 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 687 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
535 | 688 | } |
---|
536 | 689 | if (sel.scriptnode != null) |
---|
537 | 690 | { |
---|
.. | .. |
---|
620 | 773 | } |
---|
621 | 774 | } |
---|
622 | 775 | |
---|
| 776 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 777 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 778 | + |
---|
| 779 | + Rectangle keeprect; |
---|
| 780 | + cRadio radio; |
---|
| 781 | + |
---|
| 782 | +cButton keepButton; |
---|
| 783 | + cButton twoButton; // Full 3D |
---|
| 784 | + cButton sixButton; |
---|
| 785 | + cButton threeButton; |
---|
| 786 | + cButton sevenButton; |
---|
| 787 | + cButton fourButton; // full panel |
---|
| 788 | + cButton oneButton; // full XYZ |
---|
| 789 | + //cButton currentLayout; |
---|
| 790 | + |
---|
| 791 | + boolean maximized; |
---|
| 792 | + |
---|
| 793 | + cButton fullscreenLayout; |
---|
| 794 | + cButton expandedLayout; |
---|
| 795 | + |
---|
| 796 | + void Minimize() |
---|
| 797 | + { |
---|
| 798 | + frame.setState(Frame.ICONIFIED); |
---|
| 799 | + frame.validate(); |
---|
| 800 | + } |
---|
| 801 | + |
---|
| 802 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 803 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 804 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
| 805 | + void Maximize() |
---|
| 806 | + { |
---|
| 807 | + if (CameraPane.FULLSCREEN) |
---|
| 808 | + { |
---|
| 809 | + ToggleFullScreen(); |
---|
| 810 | + } |
---|
| 811 | + |
---|
| 812 | + if (maximized) |
---|
| 813 | + { |
---|
| 814 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 815 | + } |
---|
| 816 | + else |
---|
| 817 | + { |
---|
| 818 | + keeprect = frame.getBounds(); |
---|
| 819 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 820 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 821 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 822 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 823 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
| 824 | + } |
---|
| 825 | + |
---|
| 826 | + maximized ^= true; |
---|
| 827 | + |
---|
| 828 | + frame.validate(); |
---|
| 829 | + } |
---|
| 830 | + |
---|
| 831 | + cButton minButton; |
---|
| 832 | + cButton maxButton; |
---|
| 833 | + cButton fullButton; |
---|
| 834 | + cButton collapseButton; |
---|
| 835 | + cButton maximize3DButton; |
---|
| 836 | + |
---|
623 | 837 | void ToggleFullScreen() |
---|
624 | 838 | { |
---|
625 | | - if (CameraPane.FULLSCREEN) |
---|
| 839 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 840 | + |
---|
| 841 | + cameraView.ToggleFullScreen(); |
---|
| 842 | + |
---|
| 843 | + if (!CameraPane.FULLSCREEN) |
---|
626 | 844 | { |
---|
627 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
628 | | - framePanel.add(bigThree); |
---|
629 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 845 | + device.setFullScreenWindow(null); |
---|
| 846 | + frame.dispose(); |
---|
| 847 | + frame.setUndecorated(false); |
---|
| 848 | + frame.validate(); |
---|
| 849 | + frame.setVisible(true); |
---|
| 850 | + |
---|
| 851 | + //frame.setVisible(false); |
---|
| 852 | +// frame.removeNotify(); |
---|
| 853 | +// frame.setUndecorated(false); |
---|
| 854 | +// frame.addNotify(); |
---|
| 855 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 856 | + |
---|
| 857 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 858 | +// X framePanel.add(bigThree); |
---|
| 859 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 860 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
| 861 | + |
---|
| 862 | + //frame.setVisible(true); |
---|
| 863 | +// radio.layout = keepButton; |
---|
| 864 | + //theFrame = null; |
---|
| 865 | + keepButton = null; |
---|
| 866 | +// radio.layout.doClick(); |
---|
| 867 | + |
---|
630 | 868 | } else |
---|
631 | 869 | { |
---|
632 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
633 | | - framePanel.remove(bigThree); |
---|
634 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 870 | + keepButton = radio.layout; |
---|
| 871 | + //keeprect = frame.getBounds(); |
---|
| 872 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 873 | +// frame.getToolkit().getScreenSize().height); |
---|
| 874 | + //frame.setVisible(false); |
---|
| 875 | + |
---|
| 876 | + frame.dispose(); |
---|
| 877 | + frame.setUndecorated(true); |
---|
| 878 | + device.setFullScreenWindow(frame); |
---|
| 879 | + frame.validate(); |
---|
| 880 | + frame.setVisible(true); |
---|
| 881 | +// frame.removeNotify(); |
---|
| 882 | +// frame.setUndecorated(true); |
---|
| 883 | +// frame.addNotify(); |
---|
| 884 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 885 | +// X framePanel.remove(bigThree); |
---|
| 886 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 887 | +// framePanel.setDividerLocation(0); |
---|
| 888 | + |
---|
| 889 | +// radio.layout = fullscreenLayout; |
---|
| 890 | +// radio.layout.doClick(); |
---|
| 891 | + //frame.setVisible(true); |
---|
635 | 892 | } |
---|
636 | | - cameraView.ToggleFullScreen(); |
---|
| 893 | + frame.validate(); |
---|
| 894 | + |
---|
| 895 | + cameraView.requestFocusInWindow(); |
---|
637 | 896 | } |
---|
| 897 | + |
---|
| 898 | + void CollapseToolbar() |
---|
| 899 | + { |
---|
| 900 | + framePanel.setDividerLocation(0); |
---|
| 901 | + //frame.validate(); |
---|
| 902 | + |
---|
| 903 | + cameraView.requestFocusInWindow(); |
---|
| 904 | + } |
---|
| 905 | + |
---|
| 906 | + private Object3D Duplicate(Object3D object) |
---|
| 907 | + { |
---|
| 908 | + boolean temp = CameraPane.SWITCH; |
---|
| 909 | + CameraPane.SWITCH = false; |
---|
| 910 | + |
---|
| 911 | + object.ExtractBigData(versiontable); |
---|
| 912 | + // if (copy == client) |
---|
| 913 | + |
---|
| 914 | + Object3D versions[] = object.versionlist; |
---|
| 915 | + object.versionlist = null; |
---|
| 916 | + |
---|
| 917 | + //byte[] compress = Compress(copy); |
---|
| 918 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
| 919 | + |
---|
| 920 | + object.versionlist = versions; |
---|
| 921 | + |
---|
| 922 | + object.RestoreBigData(versiontable); |
---|
| 923 | + |
---|
| 924 | + CameraPane.SWITCH = temp; |
---|
| 925 | + |
---|
| 926 | + return compress; |
---|
| 927 | + } |
---|
638 | 928 | |
---|
639 | 929 | private JTextPane createTextPane() |
---|
640 | 930 | { |
---|
.. | .. |
---|
734 | 1024 | protected static ImageIcon createImageIcon(String path, |
---|
735 | 1025 | String description) |
---|
736 | 1026 | { |
---|
737 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 1027 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
738 | 1028 | if (imgURL != null) |
---|
739 | 1029 | { |
---|
740 | 1030 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
757 | 1047 | { |
---|
758 | 1048 | SetupMaterial(materialPanel); |
---|
759 | 1049 | } |
---|
| 1050 | + |
---|
760 | 1051 | //SetupName(); |
---|
761 | 1052 | //SetupViews(); |
---|
762 | 1053 | } |
---|
.. | .. |
---|
766 | 1057 | // NumberSlider vDivsField; |
---|
767 | 1058 | // JCheckBox endcaps; |
---|
768 | 1059 | JCheckBox liveCB; |
---|
| 1060 | + JCheckBox selectableCB; |
---|
769 | 1061 | JCheckBox hideCB; |
---|
770 | 1062 | JCheckBox link2masterCB; |
---|
771 | 1063 | JCheckBox markCB; |
---|
.. | .. |
---|
773 | 1065 | JCheckBox speedupCB; |
---|
774 | 1066 | JCheckBox rewindCB; |
---|
775 | 1067 | JCheckBox flipVCB; |
---|
| 1068 | + |
---|
| 1069 | + cCheckBox toggleTextureCB; |
---|
| 1070 | + cCheckBox toggleSwitchCB; |
---|
| 1071 | + |
---|
776 | 1072 | JComboBox texresMenu; |
---|
| 1073 | + |
---|
777 | 1074 | JButton resetButton; |
---|
778 | 1075 | JButton stepButton; |
---|
779 | 1076 | JButton stepAllButton; |
---|
.. | .. |
---|
782 | 1079 | JButton fasterButton; |
---|
783 | 1080 | JButton remarkButton; |
---|
784 | 1081 | |
---|
| 1082 | + cGridBag editPanel; |
---|
| 1083 | + cGridBag editCommandsPanel; |
---|
| 1084 | + |
---|
785 | 1085 | cGridBag namePanel; |
---|
786 | 1086 | cGridBag setupPanel; |
---|
787 | | - cGridBag commandsPanel; |
---|
| 1087 | + cGridBag setupPanel2; |
---|
| 1088 | + cGridBag objectCommandsPanel; |
---|
788 | 1089 | cGridBag pushPanel; |
---|
789 | 1090 | cGridBag fillPanel; |
---|
790 | 1091 | |
---|
.. | .. |
---|
955 | 1256 | |
---|
956 | 1257 | namePanel = new cGridBag(); |
---|
957 | 1258 | |
---|
| 1259 | + //if (copy.pinned) |
---|
| 1260 | + { |
---|
| 1261 | + pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF); |
---|
| 1262 | + pinButton.setSelected(copy.pinned); |
---|
| 1263 | + cGridBag t = new cGridBag(); |
---|
| 1264 | + t.preferredWidth = 2; |
---|
| 1265 | + t.add(pinButton); |
---|
| 1266 | + namePanel.add(t); |
---|
| 1267 | + |
---|
| 1268 | + pinButton.addItemListener(this); |
---|
| 1269 | + } |
---|
| 1270 | + |
---|
958 | 1271 | nameField = AddText(namePanel, copy.GetName()); |
---|
959 | | - namePanel.add(nameField); |
---|
| 1272 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
960 | 1273 | oe.ctrlPanel.add(namePanel); |
---|
961 | 1274 | |
---|
962 | 1275 | oe.ctrlPanel.Return(); |
---|
963 | 1276 | |
---|
964 | | - if (!GroupEditor.allparams) |
---|
| 1277 | + if (!allparams) |
---|
965 | 1278 | return; |
---|
966 | 1279 | |
---|
967 | 1280 | setupPanel = new cGridBag().setVertical(false); |
---|
968 | 1281 | |
---|
969 | 1282 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
970 | | - if (Globals.ADVANCED) |
---|
971 | | - link2masterCB = AddCheckBox(setupPanel, "Supp", copy.link2master); |
---|
972 | | - hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 1283 | + liveCB.setToolTipText("Animate object"); |
---|
| 1284 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1285 | + selectableCB.setToolTipText("Make object selectable"); |
---|
973 | 1286 | // Return(); |
---|
| 1287 | + |
---|
| 1288 | + hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 1289 | + hideCB.setToolTipText("Hide object"); |
---|
974 | 1290 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
975 | | - rewindCB = AddCheckBox(setupPanel, "Rew", copy.rewind); |
---|
976 | | - randomCB = AddCheckBox(setupPanel, "Rand", copy.random); |
---|
| 1291 | + markCB.setToolTipText("As animation target transform"); |
---|
| 1292 | + |
---|
| 1293 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
| 1294 | + |
---|
| 1295 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1296 | + |
---|
| 1297 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
| 1298 | + rewindCB.setToolTipText("Rewind animation"); |
---|
| 1299 | + |
---|
| 1300 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1301 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
977 | 1302 | |
---|
| 1303 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1304 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1305 | + |
---|
| 1306 | + if (Globals.ADVANCED) |
---|
| 1307 | + { |
---|
| 1308 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
| 1309 | + speedupCB.setToolTipText("Option motion capture"); |
---|
| 1310 | + } |
---|
| 1311 | + |
---|
978 | 1312 | oe.ctrlPanel.add(setupPanel); |
---|
979 | 1313 | oe.ctrlPanel.Return(); |
---|
| 1314 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1315 | + oe.ctrlPanel.Return(); |
---|
980 | 1316 | |
---|
981 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1317 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
982 | 1318 | |
---|
983 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
984 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1319 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
| 1320 | + resetButton.setToolTipText("Jump to frame zero"); |
---|
| 1321 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
| 1322 | + stepButton.setToolTipText("Step one frame"); |
---|
985 | 1323 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
986 | 1324 | // stepAllButton = AddButton(oe, "Step All"); |
---|
987 | | - speedupCB = AddCheckBox(commandsPanel, "Speed", copy.speedup); |
---|
988 | 1325 | // Return(); |
---|
989 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
990 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
991 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1326 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
| 1327 | + slowerButton.setToolTipText("Decrease animation speed"); |
---|
| 1328 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
| 1329 | + fasterButton.setToolTipText("Increase animation speed"); |
---|
| 1330 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
| 1331 | + remarkButton.setToolTipText("Set the current transform as the target"); |
---|
992 | 1332 | |
---|
993 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1333 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
994 | 1334 | oe.ctrlPanel.Return(); |
---|
995 | 1335 | |
---|
996 | | - pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1); |
---|
| 1336 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
997 | 1337 | normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
998 | 1338 | //Return(); |
---|
999 | 1339 | |
---|
.. | .. |
---|
1196 | 1536 | //worldPanel.setName("World"); |
---|
1197 | 1537 | centralPanel = new cGridBag(); |
---|
1198 | 1538 | centralPanel.preferredWidth = 20; |
---|
1199 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1200 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1539 | + |
---|
| 1540 | + if (Globals.ADVANCED) |
---|
| 1541 | + { |
---|
| 1542 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1543 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1201 | 1544 | |
---|
1202 | 1545 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1203 | 1546 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1206 | 1549 | // cameraPanel.setDividerSize(9); |
---|
1207 | 1550 | cameraPanel.setResizeWeight(1.0); |
---|
1208 | 1551 | |
---|
| 1552 | + } |
---|
| 1553 | + |
---|
1209 | 1554 | centralPanel.add(cameraView); |
---|
| 1555 | + centralPanel.setFocusable(true); |
---|
1210 | 1556 | //frame.setJMenuBar(timelineMenubar); |
---|
1211 | 1557 | //centralPanel.add(timelinePanel); |
---|
1212 | 1558 | |
---|
.. | .. |
---|
1232 | 1578 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1233 | 1579 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1234 | 1580 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1581 | + //XYZPanel.setName("XYZ"); |
---|
1235 | 1582 | |
---|
1236 | 1583 | /* |
---|
1237 | 1584 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1269 | 1616 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1270 | 1617 | //tmp.setName("Edit"); |
---|
1271 | 1618 | objectPanel.add(materialPanel); |
---|
| 1619 | + objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1620 | + objectPanel.setToolTipTextAt(0, "Material"); |
---|
| 1621 | + |
---|
| 1622 | + objectPanel.add(toolboxPanel); |
---|
| 1623 | + objectPanel.setIconAt(1, GetIcon("icons/primitives.png")); |
---|
| 1624 | + objectPanel.setToolTipTextAt(1, "Objects & textures"); |
---|
| 1625 | + |
---|
| 1626 | + objectPanel.add(skyboxPanel); |
---|
| 1627 | + objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
| 1628 | + objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
| 1629 | + |
---|
1272 | 1630 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1273 | 1631 | // north.setName("Edit"); |
---|
1274 | 1632 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1275 | 1633 | // objectPanel.add(north); |
---|
1276 | | - objectPanel.add(ctrlPanel); |
---|
1277 | | - objectPanel.add(infoPanel); |
---|
1278 | | - |
---|
| 1634 | + objectPanel.add(editPanel); |
---|
| 1635 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1636 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
| 1637 | + |
---|
| 1638 | + objectPanel.add(XYZPanel); |
---|
| 1639 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1640 | + objectPanel.setToolTipTextAt(4, "XYZ/RGB transform"); |
---|
| 1641 | + |
---|
1279 | 1642 | /* |
---|
1280 | 1643 | aConstraints.gridx = 0; |
---|
1281 | 1644 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1283 | 1646 | aConstraints.gridy += 1; |
---|
1284 | 1647 | aConstraints.gridwidth = 1; |
---|
1285 | 1648 | mainPanel.add(objectPanel, aConstraints); |
---|
1286 | | - */ |
---|
| 1649 | + */ |
---|
1287 | 1650 | |
---|
1288 | 1651 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1289 | 1652 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1295 | 1658 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1296 | 1659 | |
---|
1297 | 1660 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1298 | | - scenePanel.preferredWidth = 7; |
---|
| 1661 | + scenePanel.preferredWidth = 5; |
---|
1299 | 1662 | |
---|
1300 | 1663 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1301 | 1664 | tabbedPane.add(scrollpane); |
---|
1302 | 1665 | |
---|
1303 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1304 | | - |
---|
1305 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1666 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1306 | 1667 | |
---|
1307 | 1668 | optionsPanel.setName("Options"); |
---|
1308 | 1669 | |
---|
.. | .. |
---|
1310 | 1671 | |
---|
1311 | 1672 | tabbedPane.add(optionsPanel); |
---|
1312 | 1673 | |
---|
| 1674 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1675 | + |
---|
1313 | 1676 | scenePanel.add(tabbedPane); |
---|
1314 | 1677 | |
---|
| 1678 | + //if (Globals.ADVANCED) |
---|
| 1679 | + tabbedPane.add(infoPanel); |
---|
| 1680 | + tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
| 1681 | + tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1682 | + |
---|
1315 | 1683 | /* |
---|
1316 | 1684 | cTree jTree = new cTree(null); |
---|
1317 | 1685 | ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
.. | .. |
---|
1373 | 1741 | bigThree = new cGridBag(); |
---|
1374 | 1742 | bigThree.addComponent(scenePanel); |
---|
1375 | 1743 | bigThree.addComponent(centralPanel); |
---|
1376 | | - bigThree.addComponent(XYZPanel); |
---|
| 1744 | + //bigThree.addComponent(XYZPanel); |
---|
1377 | 1745 | |
---|
1378 | 1746 | // // SIDE EFFECT!!! |
---|
1379 | 1747 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1382 | 1750 | // aConstraints.gridheight = 1; |
---|
1383 | 1751 | |
---|
1384 | 1752 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1385 | | - framePanel.setContinuousLayout(true); |
---|
1386 | | - framePanel.setOneTouchExpandable(true); |
---|
1387 | | - framePanel.setDividerLocation(0.8); |
---|
| 1753 | + |
---|
| 1754 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1755 | + new java.beans.PropertyChangeListener() |
---|
| 1756 | + { |
---|
| 1757 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1758 | + { |
---|
| 1759 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1760 | + { |
---|
| 1761 | + if (radio.layout != expandedLayout) |
---|
| 1762 | + { |
---|
| 1763 | + radio.layout = expandedLayout; |
---|
| 1764 | + radio.layout.doClick(); |
---|
| 1765 | + } |
---|
| 1766 | + } |
---|
| 1767 | + } |
---|
| 1768 | + }); |
---|
| 1769 | + |
---|
| 1770 | + framePanel.setContinuousLayout(false); |
---|
| 1771 | + framePanel.setOneTouchExpandable(false); |
---|
| 1772 | + //.setDividerLocation(0.8); |
---|
1388 | 1773 | //framePanel.setDividerSize(15); |
---|
1389 | 1774 | //framePanel.setResizeWeight(0.15); |
---|
1390 | 1775 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1401 | 1786 | |
---|
1402 | 1787 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1403 | 1788 | |
---|
1404 | | - frame.setSize(1024, 768); |
---|
1405 | | - frame.show(); |
---|
1406 | | - |
---|
| 1789 | + frame.setSize(1280, 860); |
---|
| 1790 | + |
---|
| 1791 | + cameraView.requestFocusInWindow(); |
---|
| 1792 | + |
---|
1407 | 1793 | gridPanel.setDividerLocation(1.0); |
---|
| 1794 | + |
---|
| 1795 | + frame.validate(); |
---|
| 1796 | + |
---|
| 1797 | + frame.setVisible(true); |
---|
1408 | 1798 | |
---|
1409 | 1799 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1410 | 1800 | frame.addWindowListener(new WindowAdapter() |
---|
1411 | 1801 | { |
---|
1412 | | - |
---|
1413 | 1802 | public void windowClosing(WindowEvent e) |
---|
1414 | 1803 | { |
---|
1415 | 1804 | Close(); |
---|
.. | .. |
---|
1432 | 1821 | ctrlPanel.removeAll(); |
---|
1433 | 1822 | } |
---|
1434 | 1823 | |
---|
1435 | | - void SetupMaterial(cGridBag panel) |
---|
| 1824 | + void SetupMaterial(cGridBag materialpanel) |
---|
1436 | 1825 | { |
---|
1437 | | - /* |
---|
| 1826 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1827 | + |
---|
| 1828 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1829 | + skin.setToolTipText("Skin"); |
---|
| 1830 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1831 | + { |
---|
| 1832 | + public void mouseClicked(MouseEvent e) |
---|
| 1833 | + { |
---|
| 1834 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1835 | + cMaterial material = object.material; |
---|
| 1836 | + |
---|
| 1837 | + // Skin |
---|
| 1838 | + colorField.setFloat(material.color); |
---|
| 1839 | + saturationField.setFloat(material.modulation); |
---|
| 1840 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1841 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1842 | + diffusenessField.setFloat(material.factor); |
---|
| 1843 | + shininessField.setFloat(material.shininess); |
---|
| 1844 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1845 | + diffuseField.setFloat(material.diffuse); |
---|
| 1846 | + specularField.setFloat(material.specular); |
---|
| 1847 | + |
---|
| 1848 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1849 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1850 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1851 | + |
---|
| 1852 | + materialtouched = true; |
---|
| 1853 | + applySelf(); |
---|
| 1854 | + } |
---|
| 1855 | + }); |
---|
| 1856 | + presetpanel.add(skin); |
---|
| 1857 | + |
---|
| 1858 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF); |
---|
| 1859 | + lambert.setToolTipText("Diffuse"); |
---|
| 1860 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 1861 | + { |
---|
| 1862 | + public void mouseClicked(MouseEvent e) |
---|
| 1863 | + { |
---|
| 1864 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 1865 | + cMaterial material = object.material; |
---|
| 1866 | + |
---|
| 1867 | + diffusenessField.setFloat(material.factor); |
---|
| 1868 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1869 | + |
---|
| 1870 | + materialtouched = true; |
---|
| 1871 | + applySelf(); |
---|
| 1872 | + } |
---|
| 1873 | + }); |
---|
| 1874 | + presetpanel.add(lambert); |
---|
| 1875 | + |
---|
| 1876 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF); |
---|
| 1877 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 1878 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 1879 | + { |
---|
| 1880 | + public void mouseClicked(MouseEvent e) |
---|
| 1881 | + { |
---|
| 1882 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 1883 | + cMaterial material = object.material; |
---|
| 1884 | + |
---|
| 1885 | + diffusenessField.setFloat(material.factor); |
---|
| 1886 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1887 | + |
---|
| 1888 | + materialtouched = true; |
---|
| 1889 | + applySelf(); |
---|
| 1890 | + } |
---|
| 1891 | + }); |
---|
| 1892 | + presetpanel.add(diffuse2); |
---|
| 1893 | + |
---|
| 1894 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF); |
---|
| 1895 | + diffusemoon.setToolTipText("Moon"); |
---|
| 1896 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 1897 | + { |
---|
| 1898 | + public void mouseClicked(MouseEvent e) |
---|
| 1899 | + { |
---|
| 1900 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 1901 | + cMaterial material = object.material; |
---|
| 1902 | + |
---|
| 1903 | + diffusenessField.setFloat(material.factor); |
---|
| 1904 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1905 | + |
---|
| 1906 | + materialtouched = true; |
---|
| 1907 | + applySelf(); |
---|
| 1908 | + } |
---|
| 1909 | + }); |
---|
| 1910 | + presetpanel.add(diffusemoon); |
---|
| 1911 | + |
---|
| 1912 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF); |
---|
| 1913 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 1914 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 1915 | + { |
---|
| 1916 | + public void mouseClicked(MouseEvent e) |
---|
| 1917 | + { |
---|
| 1918 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 1919 | + cMaterial material = object.material; |
---|
| 1920 | + |
---|
| 1921 | + diffusenessField.setFloat(material.factor); |
---|
| 1922 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1923 | + |
---|
| 1924 | + materialtouched = true; |
---|
| 1925 | + applySelf(); |
---|
| 1926 | + } |
---|
| 1927 | + }); |
---|
| 1928 | + presetpanel.add(diffusemoon2); |
---|
| 1929 | + |
---|
| 1930 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF); |
---|
| 1931 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 1932 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 1933 | + { |
---|
| 1934 | + public void mouseClicked(MouseEvent e) |
---|
| 1935 | + { |
---|
| 1936 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 1937 | + cMaterial material = object.material; |
---|
| 1938 | + |
---|
| 1939 | + diffusenessField.setFloat(material.factor); |
---|
| 1940 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1941 | + |
---|
| 1942 | + materialtouched = true; |
---|
| 1943 | + applySelf(); |
---|
| 1944 | + } |
---|
| 1945 | + }); |
---|
| 1946 | + presetpanel.add(diffusemoon3); |
---|
| 1947 | + |
---|
| 1948 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF); |
---|
| 1949 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 1950 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 1951 | + { |
---|
| 1952 | + public void mouseClicked(MouseEvent e) |
---|
| 1953 | + { |
---|
| 1954 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 1955 | + cMaterial material = object.material; |
---|
| 1956 | + |
---|
| 1957 | + sheenField.setFloat(material.sheen); |
---|
| 1958 | + |
---|
| 1959 | + materialtouched = true; |
---|
| 1960 | + applySelf(); |
---|
| 1961 | + } |
---|
| 1962 | + }); |
---|
| 1963 | + presetpanel.add(diffusesheen); |
---|
| 1964 | + |
---|
| 1965 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 1966 | + rough.setToolTipText("Rough metal"); |
---|
| 1967 | + rough.addMouseListener(new MouseAdapter() |
---|
| 1968 | + { |
---|
| 1969 | + public void mouseClicked(MouseEvent e) |
---|
| 1970 | + { |
---|
| 1971 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 1972 | + cMaterial material = object.material; |
---|
| 1973 | + |
---|
| 1974 | + shininessField.setFloat(material.shininess); |
---|
| 1975 | + velvetField.setFloat(material.velvet); |
---|
| 1976 | + |
---|
| 1977 | + materialtouched = true; |
---|
| 1978 | + applySelf(); |
---|
| 1979 | + } |
---|
| 1980 | + }); |
---|
| 1981 | + presetpanel.add(rough); |
---|
| 1982 | + |
---|
| 1983 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF); |
---|
| 1984 | + rough2.setToolTipText("Medium metal"); |
---|
| 1985 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 1986 | + { |
---|
| 1987 | + public void mouseClicked(MouseEvent e) |
---|
| 1988 | + { |
---|
| 1989 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 1990 | + cMaterial material = object.material; |
---|
| 1991 | + |
---|
| 1992 | + shininessField.setFloat(material.shininess); |
---|
| 1993 | + lightareaField.setFloat(material.lightarea); |
---|
| 1994 | + |
---|
| 1995 | + materialtouched = true; |
---|
| 1996 | + applySelf(); |
---|
| 1997 | + } |
---|
| 1998 | + }); |
---|
| 1999 | + presetpanel.add(rough2); |
---|
| 2000 | + |
---|
| 2001 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF); |
---|
| 2002 | + shini0.setToolTipText("Shiny"); |
---|
| 2003 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2004 | + { |
---|
| 2005 | + public void mouseClicked(MouseEvent e) |
---|
| 2006 | + { |
---|
| 2007 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2008 | + cMaterial material = object.material; |
---|
| 2009 | + |
---|
| 2010 | + shininessField.setFloat(material.shininess); |
---|
| 2011 | + lightareaField.setFloat(material.lightarea); |
---|
| 2012 | + |
---|
| 2013 | + materialtouched = true; |
---|
| 2014 | + applySelf(); |
---|
| 2015 | + } |
---|
| 2016 | + }); |
---|
| 2017 | + presetpanel.add(shini0); |
---|
| 2018 | + |
---|
| 2019 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF); |
---|
| 2020 | + shini1.setToolTipText("Shiny2"); |
---|
| 2021 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2022 | + { |
---|
| 2023 | + public void mouseClicked(MouseEvent e) |
---|
| 2024 | + { |
---|
| 2025 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2026 | + cMaterial material = object.material; |
---|
| 2027 | + |
---|
| 2028 | + shininessField.setFloat(material.shininess); |
---|
| 2029 | + lightareaField.setFloat(material.lightarea); |
---|
| 2030 | + |
---|
| 2031 | + materialtouched = true; |
---|
| 2032 | + applySelf(); |
---|
| 2033 | + } |
---|
| 2034 | + }); |
---|
| 2035 | + presetpanel.add(shini1); |
---|
| 2036 | + |
---|
| 2037 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF); |
---|
| 2038 | + shini2.setToolTipText("Shiny3"); |
---|
| 2039 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2040 | + { |
---|
| 2041 | + public void mouseClicked(MouseEvent e) |
---|
| 2042 | + { |
---|
| 2043 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2044 | + cMaterial material = object.material; |
---|
| 2045 | + |
---|
| 2046 | + shininessField.setFloat(material.shininess); |
---|
| 2047 | + lightareaField.setFloat(material.lightarea); |
---|
| 2048 | + |
---|
| 2049 | + materialtouched = true; |
---|
| 2050 | + applySelf(); |
---|
| 2051 | + } |
---|
| 2052 | + }); |
---|
| 2053 | + presetpanel.add(shini2); |
---|
| 2054 | + |
---|
| 2055 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF); |
---|
| 2056 | + aniso.setToolTipText("AnisoU"); |
---|
| 2057 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2058 | + { |
---|
| 2059 | + public void mouseClicked(MouseEvent e) |
---|
| 2060 | + { |
---|
| 2061 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2062 | + cMaterial material = object.material; |
---|
| 2063 | + |
---|
| 2064 | + anisoField.setFloat(material.aniso); |
---|
| 2065 | + anisoVField.setFloat(material.anisoV); |
---|
| 2066 | + |
---|
| 2067 | + materialtouched = true; |
---|
| 2068 | + applySelf(); |
---|
| 2069 | + } |
---|
| 2070 | + }); |
---|
| 2071 | + presetpanel.add(aniso); |
---|
| 2072 | + |
---|
| 2073 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF); |
---|
| 2074 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2075 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2076 | + { |
---|
| 2077 | + public void mouseClicked(MouseEvent e) |
---|
| 2078 | + { |
---|
| 2079 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2080 | + cMaterial material = object.material; |
---|
| 2081 | + |
---|
| 2082 | + anisoField.setFloat(material.aniso); |
---|
| 2083 | + anisoVField.setFloat(material.anisoV); |
---|
| 2084 | + |
---|
| 2085 | + materialtouched = true; |
---|
| 2086 | + applySelf(); |
---|
| 2087 | + } |
---|
| 2088 | + }); |
---|
| 2089 | + presetpanel.add(aniso2); |
---|
| 2090 | + |
---|
| 2091 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF); |
---|
| 2092 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2093 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2094 | + { |
---|
| 2095 | + public void mouseClicked(MouseEvent e) |
---|
| 2096 | + { |
---|
| 2097 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2098 | + cMaterial material = object.material; |
---|
| 2099 | + |
---|
| 2100 | + anisoField.setFloat(material.aniso); |
---|
| 2101 | + anisoVField.setFloat(material.anisoV); |
---|
| 2102 | + |
---|
| 2103 | + materialtouched = true; |
---|
| 2104 | + applySelf(); |
---|
| 2105 | + } |
---|
| 2106 | + }); |
---|
| 2107 | + presetpanel.add(aniso3); |
---|
| 2108 | + |
---|
| 2109 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF); |
---|
| 2110 | + velvet0.setToolTipText("Velvet"); |
---|
| 2111 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2112 | + { |
---|
| 2113 | + public void mouseClicked(MouseEvent e) |
---|
| 2114 | + { |
---|
| 2115 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2116 | + cMaterial material = object.material; |
---|
| 2117 | + |
---|
| 2118 | + diffusenessField.setFloat(material.factor); |
---|
| 2119 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2120 | + sheenField.setFloat(material.sheen); |
---|
| 2121 | + shininessField.setFloat(material.shininess); |
---|
| 2122 | + velvetField.setFloat(material.velvet); |
---|
| 2123 | + shiftField.setFloat(material.shift); |
---|
| 2124 | + |
---|
| 2125 | + materialtouched = true; |
---|
| 2126 | + applySelf(); |
---|
| 2127 | + } |
---|
| 2128 | + }); |
---|
| 2129 | + presetpanel.add(velvet0); |
---|
| 2130 | + |
---|
| 2131 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF); |
---|
| 2132 | + bump0.setToolTipText("Bump texture"); |
---|
| 2133 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2134 | + { |
---|
| 2135 | + public void mouseClicked(MouseEvent e) |
---|
| 2136 | + { |
---|
| 2137 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2138 | + cMaterial material = object.material; |
---|
| 2139 | + |
---|
| 2140 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2141 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2142 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2143 | + |
---|
| 2144 | + materialtouched = true; |
---|
| 2145 | + applySelf(); |
---|
| 2146 | + } |
---|
| 2147 | + }); |
---|
| 2148 | + presetpanel.add(bump0); |
---|
| 2149 | + |
---|
| 2150 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF); |
---|
| 2151 | + halo.setToolTipText("Halo"); |
---|
| 2152 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2153 | + { |
---|
| 2154 | + public void mouseClicked(MouseEvent e) |
---|
| 2155 | + { |
---|
| 2156 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2157 | + cMaterial material = object.material; |
---|
| 2158 | + |
---|
| 2159 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2160 | + |
---|
| 2161 | + materialtouched = true; |
---|
| 2162 | + applySelf(); |
---|
| 2163 | + } |
---|
| 2164 | + }); |
---|
| 2165 | + presetpanel.add(halo); |
---|
| 2166 | + |
---|
| 2167 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF); |
---|
| 2168 | + candle.setToolTipText("Candle"); |
---|
| 2169 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2170 | + { |
---|
| 2171 | + public void mouseClicked(MouseEvent e) |
---|
| 2172 | + { |
---|
| 2173 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2174 | + cMaterial material = object.material; |
---|
| 2175 | + |
---|
| 2176 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2177 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2178 | + ambientField.setFloat(material.ambient); |
---|
| 2179 | + specularField.setFloat(material.specular); |
---|
| 2180 | + lightareaField.setFloat(material.lightarea); |
---|
| 2181 | + shininessField.setFloat(material.shininess); |
---|
| 2182 | + |
---|
| 2183 | + materialtouched = true; |
---|
| 2184 | + applySelf(); |
---|
| 2185 | + } |
---|
| 2186 | + }); |
---|
| 2187 | + presetpanel.add(candle); |
---|
| 2188 | + |
---|
| 2189 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF); |
---|
| 2190 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2191 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2192 | + { |
---|
| 2193 | + public void mouseClicked(MouseEvent e) |
---|
| 2194 | + { |
---|
| 2195 | + diffuseField.setFloat(0.001); |
---|
| 2196 | + ambientField.setFloat(0.001); |
---|
| 2197 | + cameraField.setFloat(0.001); |
---|
| 2198 | + specularField.setFloat(0.001); |
---|
| 2199 | + fakedepthField.setFloat(0.001); |
---|
| 2200 | + opacityField.setFloat(0.6); |
---|
| 2201 | + |
---|
| 2202 | + materialtouched = true; |
---|
| 2203 | + applySelf(); |
---|
| 2204 | + } |
---|
| 2205 | + }); |
---|
| 2206 | + presetpanel.add(shadowShader); |
---|
| 2207 | + |
---|
| 2208 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2209 | + |
---|
| 2210 | + presetpanel.preferredWidth = 1; |
---|
| 2211 | + |
---|
| 2212 | + materialpanel.add(presetpanel); |
---|
| 2213 | + materialpanel.add(panel); |
---|
| 2214 | + |
---|
| 2215 | + panel.preferredWidth = 8; |
---|
| 2216 | + |
---|
| 2217 | + /* |
---|
1438 | 2218 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1439 | 2219 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1440 | | - */ |
---|
| 2220 | + */ |
---|
1441 | 2221 | |
---|
1442 | 2222 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1443 | 2223 | |
---|
1444 | | - editBar.add(createMaterialButton = new cButton("Create", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 2224 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1445 | 2225 | createMaterialButton.setToolTipText("Create material"); |
---|
1446 | 2226 | |
---|
1447 | 2227 | /* |
---|
1448 | 2228 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1449 | 2229 | */ |
---|
1450 | 2230 | |
---|
1451 | | - editBar.add(clearMaterialButton = new cButton("Clear", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 2231 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1452 | 2232 | clearMaterialButton.setToolTipText("Clear material"); |
---|
1453 | 2233 | |
---|
1454 | | - editBar.add(resetSlidersButton = new cButton("Reset", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
1455 | | - editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1456 | | - editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 2234 | + if (Globals.ADVANCED) |
---|
| 2235 | + { |
---|
| 2236 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2237 | + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
| 2238 | + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 2239 | + } |
---|
1457 | 2240 | |
---|
1458 | 2241 | editBar.preferredHeight = 15; |
---|
1459 | 2242 | |
---|
.. | .. |
---|
1468 | 2251 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1469 | 2252 | |
---|
1470 | 2253 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 2254 | + |
---|
| 2255 | + cGridBag huepanel = new cGridBag(); |
---|
| 2256 | + cGridBag huelabel = new cGridBag(); |
---|
| 2257 | + skin = GetLabel("icons/hue.png", false); |
---|
| 2258 | + skin.fit = true; |
---|
| 2259 | + huelabel.add(skin); |
---|
| 2260 | + huelabel.preferredWidth = 20; |
---|
| 2261 | + huepanel.add(new cGridBag()); // Label |
---|
| 2262 | + huepanel.add(huelabel); // Field/slider |
---|
| 2263 | + |
---|
| 2264 | + huepanel.preferredHeight = 7; |
---|
| 2265 | + |
---|
| 2266 | + colorSection.add(huepanel); |
---|
1471 | 2267 | |
---|
1472 | 2268 | cGridBag color = new cGridBag(); |
---|
1473 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1474 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1475 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2269 | + |
---|
| 2270 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 2271 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2272 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2273 | + |
---|
1476 | 2274 | //colorField.preferredWidth = 200; |
---|
1477 | 2275 | colorSection.add(color); |
---|
1478 | 2276 | |
---|
1479 | 2277 | cGridBag modulation = new cGridBag(); |
---|
1480 | 2278 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1481 | 2279 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1482 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2280 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1483 | 2281 | colorSection.add(modulation); |
---|
1484 | 2282 | |
---|
| 2283 | + cGridBag opacity = new cGridBag(); |
---|
| 2284 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 2285 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2286 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2287 | + colorSection.add(opacity); |
---|
| 2288 | + |
---|
| 2289 | + colorSection.add(GetSeparator()); |
---|
| 2290 | + |
---|
1485 | 2291 | cGridBag texture = new cGridBag(); |
---|
1486 | 2292 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1487 | 2293 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1488 | 2294 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1489 | 2295 | colorSection.add(texture); |
---|
1490 | 2296 | |
---|
1491 | | - cGridBag anisoU = new cGridBag(); |
---|
1492 | | - anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
1493 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1494 | | - anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1495 | | - colorSection.add(anisoU); |
---|
1496 | | - |
---|
1497 | | - cGridBag anisoV = new cGridBag(); |
---|
1498 | | - anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
1499 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1500 | | - anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1501 | | - colorSection.add(anisoV); |
---|
1502 | | - |
---|
1503 | | - cGridBag shadowbias = new cGridBag(); |
---|
1504 | | - shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
1505 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1506 | | - shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1507 | | - colorSection.add(shadowbias); |
---|
1508 | | - |
---|
1509 | | - panel.add(new JSeparator()); |
---|
| 2297 | + panel.add(GetSeparator()); |
---|
1510 | 2298 | |
---|
1511 | 2299 | panel.add(colorSection); |
---|
1512 | 2300 | |
---|
.. | .. |
---|
1556 | 2344 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1557 | 2345 | diffuseSection.add(fakedepth); |
---|
1558 | 2346 | |
---|
1559 | | - panel.add(new JSeparator()); |
---|
| 2347 | + cGridBag shadowbias = new cGridBag(); |
---|
| 2348 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 2349 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2350 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2351 | + diffuseSection.add(shadowbias); |
---|
| 2352 | + |
---|
| 2353 | + panel.add(GetSeparator()); |
---|
1560 | 2354 | |
---|
1561 | 2355 | panel.add(diffuseSection); |
---|
1562 | 2356 | |
---|
.. | .. |
---|
1606 | 2400 | // aConstraints.gridy += 1; |
---|
1607 | 2401 | // aConstraints.gridwidth = 1; |
---|
1608 | 2402 | |
---|
| 2403 | + cGridBag anisoU = new cGridBag(); |
---|
| 2404 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 2405 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2406 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2407 | + specularSection.add(anisoU); |
---|
1609 | 2408 | |
---|
1610 | | - panel.add(new JSeparator()); |
---|
| 2409 | + cGridBag anisoV = new cGridBag(); |
---|
| 2410 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 2411 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2412 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2413 | + specularSection.add(anisoV); |
---|
| 2414 | + |
---|
| 2415 | + |
---|
| 2416 | + panel.add(GetSeparator()); |
---|
1611 | 2417 | |
---|
1612 | 2418 | panel.add(specularSection); |
---|
1613 | 2419 | |
---|
1614 | 2420 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1615 | 2421 | |
---|
1616 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 2422 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1617 | 2423 | |
---|
1618 | 2424 | cGridBag camera = new cGridBag(); |
---|
1619 | 2425 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1620 | 2426 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1621 | 2427 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1622 | | - globalSection.add(camera); |
---|
| 2428 | + colorSection.add(camera); |
---|
1623 | 2429 | |
---|
1624 | 2430 | cGridBag ambient = new cGridBag(); |
---|
1625 | 2431 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1626 | 2432 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1627 | 2433 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1628 | | - globalSection.add(ambient); |
---|
| 2434 | + colorSection.add(ambient); |
---|
1629 | 2435 | |
---|
1630 | 2436 | cGridBag backlit = new cGridBag(); |
---|
1631 | 2437 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1632 | 2438 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1633 | 2439 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1634 | | - globalSection.add(backlit); |
---|
| 2440 | + colorSection.add(backlit); |
---|
1635 | 2441 | |
---|
1636 | | - cGridBag opacity = new cGridBag(); |
---|
1637 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1638 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1639 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1640 | | - globalSection.add(opacity); |
---|
1641 | | - |
---|
1642 | | - panel.add(new JSeparator()); |
---|
| 2442 | + //panel.add(new JSeparator()); |
---|
1643 | 2443 | |
---|
1644 | | - panel.add(globalSection); |
---|
| 2444 | + //panel.add(globalSection); |
---|
1645 | 2445 | |
---|
1646 | 2446 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1647 | 2447 | |
---|
.. | .. |
---|
1683 | 2483 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1684 | 2484 | textureSection.add(opacityPower); |
---|
1685 | 2485 | |
---|
1686 | | - panel.add(new JSeparator()); |
---|
| 2486 | + panel.add(GetSeparator()); |
---|
1687 | 2487 | |
---|
1688 | 2488 | panel.add(textureSection); |
---|
1689 | 2489 | |
---|
.. | .. |
---|
1722 | 2522 | opacityPowerField.addChangeListener(this); |
---|
1723 | 2523 | /**/ |
---|
1724 | 2524 | |
---|
1725 | | - resetSlidersButton.addActionListener(this); |
---|
1726 | 2525 | clearMaterialButton.addActionListener(this); |
---|
1727 | 2526 | createMaterialButton.addActionListener(this); |
---|
1728 | | - |
---|
1729 | | - propagateToggle.addItemListener(this); |
---|
1730 | | - multiplyToggle.addItemListener(this); |
---|
| 2527 | + |
---|
| 2528 | + if (Globals.ADVANCED) |
---|
| 2529 | + { |
---|
| 2530 | + resetSlidersButton.addActionListener(this); |
---|
| 2531 | + propagateToggle.addItemListener(this); |
---|
| 2532 | + multiplyToggle.addItemListener(this); |
---|
| 2533 | + } |
---|
1731 | 2534 | } |
---|
1732 | 2535 | |
---|
1733 | 2536 | void DropFile(java.io.File[] files, boolean textures) |
---|
.. | .. |
---|
1745 | 2548 | // 3D models |
---|
1746 | 2549 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1747 | 2550 | { |
---|
1748 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1749 | | - LoadFile(filename, lastConverter); |
---|
| 2551 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2552 | + //LoadFile(filename, lastConverter); |
---|
| 2553 | + LoadObjFile(filename); // New 3ds loader |
---|
1750 | 2554 | continue; |
---|
1751 | 2555 | } |
---|
1752 | 2556 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
1898 | 2702 | |
---|
1899 | 2703 | //? flashIt = false; |
---|
1900 | 2704 | CameraPane pane = (CameraPane) cameraView; |
---|
1901 | | - pane.clickStart(location.x, location.y, 0); |
---|
| 2705 | + pane.clickStart(location.x, location.y, 0, 0); |
---|
1902 | 2706 | pane.clickEnd(location.x, location.y, 0, true); |
---|
1903 | 2707 | |
---|
1904 | 2708 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
1947 | 2751 | e2.printStackTrace(); |
---|
1948 | 2752 | } |
---|
1949 | 2753 | } |
---|
| 2754 | + |
---|
1950 | 2755 | LoadJMEThread loadThread; |
---|
1951 | 2756 | |
---|
1952 | 2757 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
2004 | 2809 | //LoadFile0(filename, converter); |
---|
2005 | 2810 | } |
---|
2006 | 2811 | } |
---|
| 2812 | + |
---|
2007 | 2813 | LoadOBJThread loadObjThread; |
---|
2008 | 2814 | |
---|
2009 | 2815 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2082 | 2888 | |
---|
2083 | 2889 | void LoadObjFile(String fullname) |
---|
2084 | 2890 | { |
---|
2085 | | - /* |
---|
| 2891 | + System.out.println("Loading " + fullname); |
---|
| 2892 | + /**/ |
---|
2086 | 2893 | //lastFilename = fullname; |
---|
2087 | 2894 | if(loadObjThread == null) |
---|
2088 | 2895 | { |
---|
2089 | | - loadObjThread = new LoadOBJThread(); |
---|
2090 | | - loadObjThread.start(); |
---|
| 2896 | + loadObjThread = new LoadOBJThread(); |
---|
| 2897 | + loadObjThread.start(); |
---|
2091 | 2898 | } |
---|
2092 | 2899 | |
---|
2093 | 2900 | loadObjThread.add(fullname); |
---|
2094 | | - */ |
---|
| 2901 | + /**/ |
---|
2095 | 2902 | |
---|
2096 | | - System.out.println("Loading " + fullname); |
---|
2097 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2903 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2098 | 2904 | } |
---|
2099 | 2905 | |
---|
2100 | 2906 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2355 | 3161 | |
---|
2356 | 3162 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2357 | 3163 | { |
---|
2358 | | - if (GrafreeD.standAlone) |
---|
| 3164 | + if (Grafreed.standAlone) |
---|
2359 | 3165 | { |
---|
2360 | 3166 | /**/ |
---|
2361 | 3167 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2362 | | - browser.show(); |
---|
| 3168 | + browser.setVisible(true); |
---|
2363 | 3169 | String filename = browser.getFile(); |
---|
2364 | 3170 | if (filename != null && filename.length() > 0) |
---|
2365 | 3171 | { |
---|
.. | .. |
---|
2470 | 3276 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2471 | 3277 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2472 | 3278 | } |
---|
| 3279 | + |
---|
2473 | 3280 | //cJME.count++; |
---|
2474 | 3281 | //cJME.count %= 12; |
---|
2475 | 3282 | if (gc) |
---|
.. | .. |
---|
2653 | 3460 | } |
---|
2654 | 3461 | } |
---|
2655 | 3462 | } |
---|
| 3463 | + |
---|
2656 | 3464 | cFileSystemPane FSPane; |
---|
2657 | 3465 | |
---|
2658 | 3466 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2662 | 3470 | |
---|
2663 | 3471 | freezematerial = true; |
---|
2664 | 3472 | colorField.setFloat(mat.color); |
---|
2665 | | - modulationField.setFloat(mat.modulation); |
---|
| 3473 | + saturationField.setFloat(mat.modulation); |
---|
2666 | 3474 | metalnessField.setFloat(mat.metalness); |
---|
2667 | 3475 | diffuseField.setFloat(mat.diffuse); |
---|
2668 | 3476 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
2706 | 3514 | } |
---|
2707 | 3515 | } |
---|
2708 | 3516 | } |
---|
| 3517 | + |
---|
2709 | 3518 | freezematerial = false; |
---|
2710 | 3519 | } |
---|
2711 | 3520 | |
---|
2712 | 3521 | void SetMaterial(Object3D object) |
---|
2713 | 3522 | { |
---|
| 3523 | + latestObject = object; |
---|
| 3524 | + |
---|
2714 | 3525 | cMaterial mat = object.material; |
---|
2715 | 3526 | |
---|
2716 | 3527 | if (mat == null) |
---|
.. | .. |
---|
2719 | 3530 | return; |
---|
2720 | 3531 | } |
---|
2721 | 3532 | |
---|
2722 | | - multiplyToggle.setSelected(mat.multiply); |
---|
| 3533 | + if (multiplyToggle != null) |
---|
| 3534 | + multiplyToggle.setSelected(mat.multiply); |
---|
2723 | 3535 | |
---|
2724 | 3536 | assert (object.projectedVertices != null); |
---|
2725 | 3537 | |
---|
.. | .. |
---|
2821 | 3633 | // } |
---|
2822 | 3634 | |
---|
2823 | 3635 | /**/ |
---|
2824 | | - if (deselect) |
---|
| 3636 | + if (deselect || child == null) |
---|
2825 | 3637 | { |
---|
2826 | 3638 | //group.deselectAll(); |
---|
2827 | 3639 | //freeze = true; |
---|
2828 | 3640 | GetTree().clearSelection(); |
---|
2829 | 3641 | //freeze = false; |
---|
| 3642 | + |
---|
| 3643 | + if (child == null) |
---|
| 3644 | + { |
---|
| 3645 | + return; |
---|
| 3646 | + } |
---|
2830 | 3647 | } |
---|
2831 | 3648 | |
---|
2832 | 3649 | //group.addSelectee(child); |
---|
.. | .. |
---|
2860 | 3677 | public void itemStateChanged(ItemEvent event) |
---|
2861 | 3678 | { |
---|
2862 | 3679 | // System.out.println("Propagate = " + propagate); |
---|
| 3680 | + if (event.getSource() == pinButton) |
---|
| 3681 | + { |
---|
| 3682 | + copy.pinned ^= true; |
---|
| 3683 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3684 | + { |
---|
| 3685 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3686 | + copy.CloseUI(); |
---|
| 3687 | + //copy.editWindow.refreshContents(); |
---|
| 3688 | + } |
---|
| 3689 | + } |
---|
| 3690 | + else |
---|
2863 | 3691 | if (event.getSource() == propagateToggle) |
---|
2864 | 3692 | { |
---|
2865 | 3693 | propagate ^= true; |
---|
.. | .. |
---|
2895 | 3723 | cameraView.ToggleDL(); |
---|
2896 | 3724 | cameraView.repaint(); |
---|
2897 | 3725 | return; |
---|
2898 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3726 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2899 | 3727 | { |
---|
2900 | 3728 | cameraView.ToggleTexture(); |
---|
2901 | 3729 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2934 | 3762 | frame.validate(); |
---|
2935 | 3763 | |
---|
2936 | 3764 | return; |
---|
2937 | | - } else if (event.getSource() == toggleRandomItem) |
---|
| 3765 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2938 | 3766 | { |
---|
2939 | | - cameraView.ToggleRandom(); |
---|
| 3767 | + cameraView.ToggleSwitch(); |
---|
2940 | 3768 | cameraView.repaint(); |
---|
2941 | 3769 | return; |
---|
2942 | 3770 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
2964 | 3792 | } else if (event.getSource() == liveCB) |
---|
2965 | 3793 | { |
---|
2966 | 3794 | copy.live ^= true; |
---|
| 3795 | + objEditor.refreshContents(true); // To show item colors |
---|
| 3796 | + return; |
---|
| 3797 | + } else if (event.getSource() == selectableCB) |
---|
| 3798 | + { |
---|
| 3799 | + copy.dontselect ^= true; |
---|
2967 | 3800 | return; |
---|
2968 | 3801 | } else if (event.getSource() == hideCB) |
---|
2969 | 3802 | { |
---|
2970 | 3803 | copy.hide ^= true; |
---|
2971 | 3804 | copy.Touch(); // display list issue |
---|
2972 | | - objEditor.refreshContents(); |
---|
| 3805 | + objEditor.refreshContents(true); // To show item colors |
---|
2973 | 3806 | return; |
---|
2974 | 3807 | } else if (event.getSource() == link2masterCB) |
---|
2975 | 3808 | { |
---|
.. | .. |
---|
2979 | 3812 | if (event.getSource() == randomCB) |
---|
2980 | 3813 | { |
---|
2981 | 3814 | copy.random ^= true; |
---|
| 3815 | + objEditor.refreshContents(); |
---|
2982 | 3816 | return; |
---|
2983 | 3817 | } |
---|
2984 | 3818 | if (event.getSource() == speedupCB) |
---|
.. | .. |
---|
3002 | 3836 | |
---|
3003 | 3837 | public void actionPerformed(ActionEvent event) |
---|
3004 | 3838 | { |
---|
| 3839 | + Object source = event.getSource(); |
---|
3005 | 3840 | // SCRIPT DIALOG |
---|
3006 | | - if (event.getSource() == okbutton) |
---|
| 3841 | + if (source == okbutton) |
---|
3007 | 3842 | { |
---|
3008 | 3843 | textpanel.setVisible(false); |
---|
3009 | 3844 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3015 | 3850 | textarea = null; |
---|
3016 | 3851 | textpanel = null; |
---|
3017 | 3852 | } |
---|
3018 | | - if (event.getSource() == cancelbutton) |
---|
| 3853 | + if (source == cancelbutton) |
---|
3019 | 3854 | { |
---|
3020 | 3855 | textpanel.setVisible(false); |
---|
3021 | 3856 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3027 | 3862 | //applySelf(); |
---|
3028 | 3863 | //client.refreshEditWindow(); |
---|
3029 | 3864 | //refreshContents(); |
---|
3030 | | - if (event.getSource() == nameField) |
---|
| 3865 | + if (source == nameField) |
---|
3031 | 3866 | { |
---|
3032 | 3867 | //System.out.println("ObjEditor " + event); |
---|
3033 | 3868 | applySelf0(true); |
---|
3034 | 3869 | //parent.applySelf(); |
---|
3035 | 3870 | objEditor.refreshContents(); |
---|
3036 | | - } else if (event.getSource() == resetButton) |
---|
| 3871 | + } else if (source == resetButton) |
---|
3037 | 3872 | { |
---|
3038 | 3873 | CameraPane.fullreset = true; |
---|
3039 | 3874 | copy.Reset(); // ResetMeshes(); |
---|
3040 | 3875 | copy.Touch(); |
---|
3041 | 3876 | objEditor.refreshContents(); |
---|
3042 | | - } else if (event.getSource() == stepItem) |
---|
| 3877 | + } else if (source == stepItem) |
---|
3043 | 3878 | { |
---|
3044 | 3879 | //cameraView.ONESTEP = true; |
---|
3045 | 3880 | Globals.ONESTEP = true; |
---|
3046 | 3881 | cameraView.repaint(); |
---|
3047 | 3882 | return; |
---|
3048 | | - } else if (event.getSource() == stepButton) |
---|
| 3883 | + } else if (source == stepButton) |
---|
3049 | 3884 | { |
---|
3050 | 3885 | copy.Step(); |
---|
3051 | 3886 | copy.Touch(); |
---|
3052 | 3887 | objEditor.refreshContents(); |
---|
3053 | | - } else if (event.getSource() == slowerButton) |
---|
| 3888 | + } else if (source == slowerButton) |
---|
3054 | 3889 | { |
---|
3055 | 3890 | copy.Slower(); |
---|
3056 | 3891 | copy.Touch(); |
---|
3057 | 3892 | objEditor.refreshContents(); |
---|
3058 | | - } else if (event.getSource() == fasterButton) |
---|
| 3893 | + } else if (source == fasterButton) |
---|
3059 | 3894 | { |
---|
3060 | 3895 | copy.Faster(); |
---|
3061 | 3896 | copy.Touch(); |
---|
3062 | 3897 | objEditor.refreshContents(); |
---|
3063 | | - } else if (event.getSource() == remarkButton) |
---|
| 3898 | + } else if (source == remarkButton) |
---|
3064 | 3899 | { |
---|
3065 | 3900 | copy.Remark(); |
---|
3066 | 3901 | copy.Touch(); |
---|
3067 | 3902 | objEditor.refreshContents(); |
---|
3068 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3903 | + } else if (source == stepAllButton) |
---|
3069 | 3904 | { |
---|
3070 | 3905 | copy.StepAll(); |
---|
3071 | 3906 | copy.Touch(); |
---|
3072 | 3907 | objEditor.refreshContents(); |
---|
3073 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3908 | + } else if (source == resetAllButton) |
---|
3074 | 3909 | { |
---|
3075 | 3910 | //CameraPane.fullreset = true; |
---|
3076 | 3911 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3103 | 3938 | // Close(); |
---|
3104 | 3939 | // } |
---|
3105 | 3940 | // else |
---|
3106 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3941 | + if (source == resetSlidersButton) |
---|
3107 | 3942 | { |
---|
3108 | 3943 | ResetSliders(); |
---|
3109 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3944 | + } else if (source == clearMaterialButton) |
---|
3110 | 3945 | { |
---|
3111 | 3946 | ClearMaterial(); |
---|
3112 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3947 | + } else if (source == createMaterialButton) |
---|
3113 | 3948 | { |
---|
3114 | 3949 | CreateMaterial(); |
---|
3115 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3950 | + } else if (source == clearPanelButton) |
---|
3116 | 3951 | { |
---|
3117 | 3952 | copy.ClearUI(); |
---|
3118 | 3953 | refreshContents(true); |
---|
3119 | | - } /* |
---|
3120 | | - } |
---|
3121 | | - |
---|
3122 | | - public boolean action(Event event, Object arg) |
---|
3123 | | - { |
---|
3124 | | - */ else if (event.getSource() == closeItem) |
---|
| 3954 | + } else if (source == importGFDItem) |
---|
| 3955 | + { |
---|
| 3956 | + ImportGFD(); |
---|
| 3957 | + } else |
---|
| 3958 | + if (source == importVRMLX3DItem) |
---|
| 3959 | + { |
---|
| 3960 | + ImportVRMLX3D(); |
---|
| 3961 | + } else |
---|
| 3962 | + if (source == import3DSItem) |
---|
| 3963 | + { |
---|
| 3964 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3965 | + } else |
---|
| 3966 | + if (source == importOBJItem) |
---|
| 3967 | + { |
---|
| 3968 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3969 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3970 | + browser.setVisible(true); |
---|
| 3971 | + String filename = browser.getFile(); |
---|
| 3972 | + if (filename != null && filename.length() > 0) |
---|
| 3973 | + { |
---|
| 3974 | + String fullname = browser.getDirectory() + filename; |
---|
| 3975 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3976 | + } |
---|
| 3977 | + } else |
---|
| 3978 | + if (source == closeItem) |
---|
3125 | 3979 | { |
---|
3126 | 3980 | Close(); |
---|
3127 | 3981 | //return true; |
---|
3128 | | - } else if (event.getSource() == loadItem) |
---|
| 3982 | + } else if (source == openItem) |
---|
3129 | 3983 | { |
---|
3130 | | - load(); |
---|
| 3984 | + Open(); |
---|
3131 | 3985 | //return true; |
---|
3132 | | - } else if (event.getSource() == saveItem) |
---|
| 3986 | + } else if (source == newItem) |
---|
| 3987 | + { |
---|
| 3988 | + New(); |
---|
| 3989 | + } else if (source == saveItem) |
---|
3133 | 3990 | { |
---|
3134 | 3991 | save(); |
---|
3135 | 3992 | //return true; |
---|
3136 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3993 | + } else if (source == saveAsItem) |
---|
3137 | 3994 | { |
---|
3138 | 3995 | saveAs(); |
---|
3139 | 3996 | //return true; |
---|
3140 | | - } else if (event.getSource() == reexportItem) |
---|
| 3997 | + } else if (source == reexportItem) |
---|
3141 | 3998 | { |
---|
3142 | 3999 | reexport(); |
---|
3143 | 4000 | //return true; |
---|
3144 | | - } else if (event.getSource() == exportAsItem) |
---|
| 4001 | + } else if (source == exportAsItem) |
---|
3145 | 4002 | { |
---|
3146 | 4003 | export(); |
---|
3147 | 4004 | //return true; |
---|
3148 | | - } else if (event.getSource() == povItem) |
---|
| 4005 | + } else if (source == povItem) |
---|
3149 | 4006 | { |
---|
3150 | 4007 | generatePOV(); |
---|
3151 | 4008 | //return true; |
---|
3152 | | - } else if (event.getSource() == zBufferItem) |
---|
| 4009 | + } else if (event.getSource() == archiveItem) |
---|
| 4010 | + { |
---|
| 4011 | + cTools.Archive(frame); |
---|
| 4012 | + return; |
---|
| 4013 | + } else if (source == zBufferItem) |
---|
3153 | 4014 | { |
---|
3154 | 4015 | try |
---|
3155 | 4016 | { |
---|
.. | .. |
---|
3171 | 4032 | cameraView.repaint(); |
---|
3172 | 4033 | //return true; |
---|
3173 | 4034 | } |
---|
3174 | | - */ else if (event.getSource() == editCameraItem) |
---|
3175 | | - { |
---|
3176 | | - cameraView.ProtectCamera(); |
---|
3177 | | - cameraView.repaint(); |
---|
3178 | | - return; |
---|
3179 | | - } else if (event.getSource() == revertCameraItem) |
---|
3180 | | - { |
---|
3181 | | - cameraView.RevertCamera(); |
---|
3182 | | - cameraView.repaint(); |
---|
3183 | | - return; |
---|
3184 | | -// } else if (event.getSource() == textureButton) |
---|
3185 | | -// { |
---|
3186 | | -// return; // true; |
---|
3187 | | - } else // combos... |
---|
3188 | | - if (event.getSource() == texresMenu) |
---|
| 4035 | + */ else // combos... |
---|
| 4036 | + if (source == texresMenu) |
---|
3189 | 4037 | { |
---|
3190 | 4038 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3191 | 4039 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3197 | 4045 | } |
---|
3198 | 4046 | } |
---|
3199 | 4047 | |
---|
| 4048 | + void New() |
---|
| 4049 | + { |
---|
| 4050 | + while (copy.Size() > 1) |
---|
| 4051 | + { |
---|
| 4052 | + copy.remove(1); |
---|
| 4053 | + } |
---|
| 4054 | + |
---|
| 4055 | + ResetModel(); |
---|
| 4056 | + objEditor.refreshContents(); |
---|
| 4057 | + } |
---|
| 4058 | + |
---|
| 4059 | + static public byte[] Compress(Object3D o) |
---|
| 4060 | + { |
---|
| 4061 | + // Slower to actually compress. |
---|
| 4062 | + try |
---|
| 4063 | + { |
---|
| 4064 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 4065 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 4066 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
| 4067 | + |
---|
| 4068 | + Object3D parent = o.parent; |
---|
| 4069 | + o.parent = null; |
---|
| 4070 | + |
---|
| 4071 | + out.writeObject(o); |
---|
| 4072 | + |
---|
| 4073 | + o.parent = parent; |
---|
| 4074 | + |
---|
| 4075 | + out.flush(); |
---|
| 4076 | + |
---|
| 4077 | + baos //zstream |
---|
| 4078 | + .close(); |
---|
| 4079 | + out.close(); |
---|
| 4080 | + |
---|
| 4081 | + byte[] bytes = baos.toByteArray(); |
---|
| 4082 | + |
---|
| 4083 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 4084 | + return bytes; |
---|
| 4085 | + } catch (Exception e) |
---|
| 4086 | + { |
---|
| 4087 | + System.err.println(e); |
---|
| 4088 | + return null; |
---|
| 4089 | + } |
---|
| 4090 | + } |
---|
| 4091 | + |
---|
| 4092 | + static public Object Uncompress(byte[] bytes) |
---|
| 4093 | + { |
---|
| 4094 | + System.out.println("restore #bytes = " + bytes.length); |
---|
| 4095 | + try |
---|
| 4096 | + { |
---|
| 4097 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 4098 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 4099 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
| 4100 | + Object obj = in.readObject(); |
---|
| 4101 | + |
---|
| 4102 | + bais //istream |
---|
| 4103 | + .close(); |
---|
| 4104 | + in.close(); |
---|
| 4105 | + |
---|
| 4106 | + return obj; |
---|
| 4107 | + } catch (Exception e) |
---|
| 4108 | + { |
---|
| 4109 | + System.err.println(e); |
---|
| 4110 | + return null; |
---|
| 4111 | + } |
---|
| 4112 | + } |
---|
| 4113 | + |
---|
| 4114 | + static public Object clone(Object o) |
---|
| 4115 | + { |
---|
| 4116 | + try |
---|
| 4117 | + { |
---|
| 4118 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 4119 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 4120 | + |
---|
| 4121 | + out.writeObject(o); |
---|
| 4122 | + |
---|
| 4123 | + out.flush(); |
---|
| 4124 | + out.close(); |
---|
| 4125 | + |
---|
| 4126 | + byte[] bytes = baos.toByteArray(); |
---|
| 4127 | + |
---|
| 4128 | + System.out.println("clone = " + bytes.length); |
---|
| 4129 | + |
---|
| 4130 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 4131 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 4132 | + Object obj = in.readObject(); |
---|
| 4133 | + in.close(); |
---|
| 4134 | + |
---|
| 4135 | + return obj; |
---|
| 4136 | + } catch (Exception e) |
---|
| 4137 | + { |
---|
| 4138 | + System.err.println(e); |
---|
| 4139 | + return null; |
---|
| 4140 | + } |
---|
| 4141 | + } |
---|
| 4142 | + |
---|
| 4143 | + cRadio GetCurrentTab() |
---|
| 4144 | + { |
---|
| 4145 | + cRadio ab; |
---|
| 4146 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 4147 | + { |
---|
| 4148 | + ab = (cRadio)e.nextElement(); |
---|
| 4149 | + if(ab.GetObject() == copy) |
---|
| 4150 | + { |
---|
| 4151 | + return ab; |
---|
| 4152 | + } |
---|
| 4153 | + } |
---|
| 4154 | + |
---|
| 4155 | + return null; |
---|
| 4156 | + } |
---|
| 4157 | + |
---|
| 4158 | + |
---|
| 4159 | + public void Save() |
---|
| 4160 | + { |
---|
| 4161 | + //Save(true); |
---|
| 4162 | + Replace(); |
---|
| 4163 | + SetVersionStates(); |
---|
| 4164 | + } |
---|
| 4165 | + |
---|
| 4166 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 4167 | + { |
---|
| 4168 | + if (compress.length != name.length) |
---|
| 4169 | + { |
---|
| 4170 | + return false; |
---|
| 4171 | + } |
---|
| 4172 | + |
---|
| 4173 | + for (int i=compress.length; --i>=0;) |
---|
| 4174 | + { |
---|
| 4175 | + if (compress[i] != name[i]) |
---|
| 4176 | + return false; |
---|
| 4177 | + } |
---|
| 4178 | + |
---|
| 4179 | + return true; |
---|
| 4180 | + } |
---|
| 4181 | + |
---|
| 4182 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 4183 | + |
---|
| 4184 | + void DeleteVersion() |
---|
| 4185 | + { |
---|
| 4186 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4187 | + { |
---|
| 4188 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4189 | + } |
---|
| 4190 | + |
---|
| 4191 | + CopyChanged(); |
---|
| 4192 | + |
---|
| 4193 | + SetVersionStates(); |
---|
| 4194 | + } |
---|
| 4195 | + |
---|
| 4196 | + public boolean Save(boolean user) |
---|
| 4197 | + { |
---|
| 4198 | + System.err.println("Save"); |
---|
| 4199 | + Replace(); |
---|
| 4200 | + |
---|
| 4201 | + //cRadio tab = GetCurrentTab(); |
---|
| 4202 | + |
---|
| 4203 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
| 4204 | + |
---|
| 4205 | + boolean thesame = false; |
---|
| 4206 | + |
---|
| 4207 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4208 | +// { |
---|
| 4209 | +// thesame = true; |
---|
| 4210 | +// } |
---|
| 4211 | + |
---|
| 4212 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 4213 | + if (!thesame) |
---|
| 4214 | + { |
---|
| 4215 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4216 | + { |
---|
| 4217 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4218 | + } |
---|
| 4219 | + |
---|
| 4220 | + //tab.user[tab.versionindex] = user; |
---|
| 4221 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 4222 | + |
---|
| 4223 | + copy.versionlist[++copy.versionindex] = compress; |
---|
| 4224 | + |
---|
| 4225 | + // if (increment) |
---|
| 4226 | + // tab.versionindex++; |
---|
| 4227 | + } |
---|
| 4228 | + |
---|
| 4229 | + //copy.RestoreBigData(versiontable); |
---|
| 4230 | + |
---|
| 4231 | + //assert(hashtable.isEmpty()); |
---|
| 4232 | + |
---|
| 4233 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4234 | +// { |
---|
| 4235 | +// //tab.user[i] = false; |
---|
| 4236 | +// copy.versionlist[i] = null; |
---|
| 4237 | +// } |
---|
| 4238 | + |
---|
| 4239 | + SetVersionStates(); |
---|
| 4240 | + |
---|
| 4241 | + // test save |
---|
| 4242 | + if (false) |
---|
| 4243 | + { |
---|
| 4244 | + try |
---|
| 4245 | + { |
---|
| 4246 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
| 4247 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4248 | + |
---|
| 4249 | + p.writeObject(copy); |
---|
| 4250 | + |
---|
| 4251 | + p.flush(); |
---|
| 4252 | + |
---|
| 4253 | + ostream.close(); |
---|
| 4254 | + } catch (Exception e) |
---|
| 4255 | + { |
---|
| 4256 | + e.printStackTrace(); |
---|
| 4257 | + } |
---|
| 4258 | + } |
---|
| 4259 | + |
---|
| 4260 | + return !thesame; |
---|
| 4261 | + } |
---|
| 4262 | + |
---|
| 4263 | + boolean flashIt = true; |
---|
| 4264 | + |
---|
| 4265 | + void RefreshSelection() |
---|
| 4266 | + { |
---|
| 4267 | + Object3D selection = new Object3D(); |
---|
| 4268 | + |
---|
| 4269 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4270 | + { |
---|
| 4271 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 4272 | + |
---|
| 4273 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4274 | + |
---|
| 4275 | + if (obj == null) |
---|
| 4276 | + { |
---|
| 4277 | + copy.selection.remove(i--); |
---|
| 4278 | + } |
---|
| 4279 | + else |
---|
| 4280 | + { |
---|
| 4281 | + selection.add(obj); |
---|
| 4282 | + copy.selection.setElementAt(obj, i); |
---|
| 4283 | + } |
---|
| 4284 | + } |
---|
| 4285 | + |
---|
| 4286 | + flashIt = false; |
---|
| 4287 | + GetTree().clearSelection(); |
---|
| 4288 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4289 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4290 | + flashIt = true; |
---|
| 4291 | + |
---|
| 4292 | + //refreshContents(false); |
---|
| 4293 | + } |
---|
| 4294 | + |
---|
| 4295 | + void CopyChanged() |
---|
| 4296 | + { |
---|
| 4297 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4298 | + |
---|
| 4299 | + SetVersionStates(); |
---|
| 4300 | + |
---|
| 4301 | + boolean temp = CameraPane.SWITCH; |
---|
| 4302 | + CameraPane.SWITCH = false; |
---|
| 4303 | + |
---|
| 4304 | + copy.ExtractBigData(versiontable); |
---|
| 4305 | + |
---|
| 4306 | + copy.clear(); |
---|
| 4307 | + |
---|
| 4308 | + copy.skyboxname = obj.skyboxname; |
---|
| 4309 | + copy.skyboxext = obj.skyboxext; |
---|
| 4310 | + |
---|
| 4311 | + for (int i=0; i<obj.Size(); i++) |
---|
| 4312 | + { |
---|
| 4313 | + copy.add(obj.get(i)); |
---|
| 4314 | + } |
---|
| 4315 | + |
---|
| 4316 | + copy.RestoreBigData(versiontable); |
---|
| 4317 | + |
---|
| 4318 | + CameraPane.SWITCH = temp; |
---|
| 4319 | + |
---|
| 4320 | + RefreshSelection(); |
---|
| 4321 | + //assert(hashtable.isEmpty()); |
---|
| 4322 | + |
---|
| 4323 | + copy.Touch(); |
---|
| 4324 | + |
---|
| 4325 | + ResetModel(); |
---|
| 4326 | + copy.HardTouch(); // recompile? |
---|
| 4327 | + |
---|
| 4328 | + cRadio ab; |
---|
| 4329 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 4330 | + { |
---|
| 4331 | + ab = (cRadio)e.nextElement(); |
---|
| 4332 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 4333 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 4334 | + if (test != null) |
---|
| 4335 | + { |
---|
| 4336 | + test.editWindow = ab.object.editWindow; |
---|
| 4337 | + ab.object = test; |
---|
| 4338 | + } |
---|
| 4339 | + } |
---|
| 4340 | + |
---|
| 4341 | + refreshContents(true); |
---|
| 4342 | + } |
---|
| 4343 | + |
---|
| 4344 | + cButton previousVersionButton; |
---|
| 4345 | + cButton restoreButton; |
---|
| 4346 | + cButton replaceButton; |
---|
| 4347 | + cButton nextVersionButton; |
---|
| 4348 | + cButton saveVersionButton; |
---|
| 4349 | + cButton deleteVersionButton; |
---|
| 4350 | + |
---|
| 4351 | + boolean muteSlider; |
---|
| 4352 | + |
---|
| 4353 | + int VersionCount() |
---|
| 4354 | + { |
---|
| 4355 | + int count = 0; |
---|
| 4356 | + |
---|
| 4357 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
| 4358 | + { |
---|
| 4359 | + if (copy.versionlist[i] != null) |
---|
| 4360 | + count++; |
---|
| 4361 | + } |
---|
| 4362 | + |
---|
| 4363 | + return count; |
---|
| 4364 | + } |
---|
| 4365 | + |
---|
| 4366 | + void SetVersionStates() |
---|
| 4367 | + { |
---|
| 4368 | + //if (true) |
---|
| 4369 | + // return; |
---|
| 4370 | + |
---|
| 4371 | + //cRadio tab = GetCurrentTab(); |
---|
| 4372 | + |
---|
| 4373 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 4374 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 4375 | + |
---|
| 4376 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4377 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4378 | + |
---|
| 4379 | + deleteVersionButton.setEnabled(//copy.versionindex > 0 && |
---|
| 4380 | + copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4381 | + |
---|
| 4382 | + muteSlider = true; |
---|
| 4383 | + versionSlider.setMinimum(0); |
---|
| 4384 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4385 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4386 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
| 4387 | + muteSlider = false; |
---|
| 4388 | + } |
---|
| 4389 | + |
---|
| 4390 | + public boolean PreviousVersion() |
---|
| 4391 | + { |
---|
| 4392 | + // Option? |
---|
| 4393 | + Replace(); |
---|
| 4394 | + |
---|
| 4395 | + System.err.println("Undo"); |
---|
| 4396 | + |
---|
| 4397 | + //cRadio tab = GetCurrentTab(); |
---|
| 4398 | + |
---|
| 4399 | + if (copy.versionindex == 0) |
---|
| 4400 | + { |
---|
| 4401 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4402 | + return false; |
---|
| 4403 | + } |
---|
| 4404 | + |
---|
| 4405 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 4406 | +// { |
---|
| 4407 | +// if (Save(false)) |
---|
| 4408 | +// tab.versionindex -= 1; |
---|
| 4409 | +// else |
---|
| 4410 | +// { |
---|
| 4411 | +// if (tab.versionindex <= 0) |
---|
| 4412 | +// return false; |
---|
| 4413 | +// else |
---|
| 4414 | +// tab.versionindex -= 1; |
---|
| 4415 | +// } |
---|
| 4416 | +// } |
---|
| 4417 | + |
---|
| 4418 | + copy.versionindex -= 1; |
---|
| 4419 | + |
---|
| 4420 | + CopyChanged(); |
---|
| 4421 | + |
---|
| 4422 | + return true; |
---|
| 4423 | + } |
---|
| 4424 | + |
---|
| 4425 | + public boolean Restore() |
---|
| 4426 | + { |
---|
| 4427 | + System.err.println("Restore"); |
---|
| 4428 | + |
---|
| 4429 | + //cRadio tab = GetCurrentTab(); |
---|
| 4430 | + |
---|
| 4431 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4432 | + { |
---|
| 4433 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4434 | + return false; |
---|
| 4435 | + } |
---|
| 4436 | + |
---|
| 4437 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4438 | + CopyChanged(); |
---|
| 4439 | + |
---|
| 4440 | + return true; |
---|
| 4441 | + } |
---|
| 4442 | + |
---|
| 4443 | + public boolean Replace() |
---|
| 4444 | + { |
---|
| 4445 | + System.err.println("Replace"); |
---|
| 4446 | + |
---|
| 4447 | + //cRadio tab = GetCurrentTab(); |
---|
| 4448 | + |
---|
| 4449 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4450 | + { |
---|
| 4451 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4452 | + return false; |
---|
| 4453 | + } |
---|
| 4454 | + |
---|
| 4455 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
| 4456 | + |
---|
| 4457 | + return true; |
---|
| 4458 | + } |
---|
| 4459 | + |
---|
| 4460 | + public void NextVersion() |
---|
| 4461 | + { |
---|
| 4462 | + // Option? |
---|
| 4463 | + Replace(); |
---|
| 4464 | + |
---|
| 4465 | + //cRadio tab = GetCurrentTab(); |
---|
| 4466 | + |
---|
| 4467 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
| 4468 | + { |
---|
| 4469 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4470 | + return; |
---|
| 4471 | + } |
---|
| 4472 | + |
---|
| 4473 | + copy.versionindex += 1; |
---|
| 4474 | + |
---|
| 4475 | + CopyChanged(); |
---|
| 4476 | + |
---|
| 4477 | + //if (!tab.user[tab.versionindex]) |
---|
| 4478 | + // tab.graphs[tab.versionindex] = null; |
---|
| 4479 | + } |
---|
| 4480 | + |
---|
| 4481 | + void ImportGFD() |
---|
| 4482 | + { |
---|
| 4483 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 4484 | + browser.show(); |
---|
| 4485 | + String filename = browser.getFile(); |
---|
| 4486 | + if (filename != null && filename.length() > 0) |
---|
| 4487 | + { |
---|
| 4488 | + String fullname = browser.getDirectory() + filename; |
---|
| 4489 | + |
---|
| 4490 | + //Object3D readobj = |
---|
| 4491 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 4492 | + //makeSomething(readobj); |
---|
| 4493 | + } |
---|
| 4494 | + } |
---|
| 4495 | + |
---|
| 4496 | + void ImportVRMLX3D() |
---|
| 4497 | + { |
---|
| 4498 | + if (Grafreed.standAlone) |
---|
| 4499 | + { |
---|
| 4500 | + /**/ |
---|
| 4501 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 4502 | + browser.show(); |
---|
| 4503 | + String filename = browser.getFile(); |
---|
| 4504 | + if (filename != null && filename.length() > 0) |
---|
| 4505 | + { |
---|
| 4506 | + String fullname = browser.getDirectory() + filename; |
---|
| 4507 | + LoadVRMLX3D(fullname); |
---|
| 4508 | + } |
---|
| 4509 | + /**/ |
---|
| 4510 | + } |
---|
| 4511 | + } |
---|
| 4512 | + |
---|
3200 | 4513 | void ToggleAnimation() |
---|
3201 | 4514 | { |
---|
3202 | 4515 | if (!Globals.ANIMATION) |
---|
.. | .. |
---|
3212 | 4525 | |
---|
3213 | 4526 | Globals.ANIMATION ^= true; |
---|
3214 | 4527 | |
---|
3215 | | - GrafreeD.wav.cursor = 0; |
---|
3216 | | - GrafreeD.wav.loop = 0; |
---|
| 4528 | + Grafreed.wav.cursor = 0; |
---|
| 4529 | + Grafreed.wav.loop = 0; |
---|
3217 | 4530 | } |
---|
3218 | 4531 | } else |
---|
3219 | 4532 | { |
---|
.. | .. |
---|
3234 | 4547 | callee.refreshContents(); |
---|
3235 | 4548 | } else |
---|
3236 | 4549 | { |
---|
3237 | | - new Exception().printStackTrace(); |
---|
3238 | 4550 | System.exit(0); |
---|
3239 | 4551 | } |
---|
3240 | 4552 | } |
---|
.. | .. |
---|
3264 | 4576 | void CreateMaterial() |
---|
3265 | 4577 | { |
---|
3266 | 4578 | //copy.ClearMaterial(); // PATCH |
---|
3267 | | - copy.CreateMaterialS(multiplyToggle.isSelected()); |
---|
| 4579 | + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); |
---|
3268 | 4580 | if (copy.selection.size() > 0) |
---|
3269 | 4581 | //SetMaterial(copy); |
---|
3270 | 4582 | { |
---|
.. | .. |
---|
3315 | 4627 | assert false; |
---|
3316 | 4628 | } |
---|
3317 | 4629 | |
---|
3318 | | - void EditSelection() |
---|
| 4630 | + void EditSelection(boolean newWindow) |
---|
3319 | 4631 | { |
---|
3320 | 4632 | } |
---|
3321 | 4633 | |
---|
.. | .. |
---|
3323 | 4635 | { |
---|
3324 | 4636 | copy.ResetBlockLoop(); // temporary problem |
---|
3325 | 4637 | |
---|
3326 | | - boolean random = CameraPane.RANDOM; |
---|
3327 | | - CameraPane.RANDOM = false; // parse everything |
---|
| 4638 | + boolean random = CameraPane.SWITCH; |
---|
| 4639 | + CameraPane.SWITCH = false; // parse everything |
---|
3328 | 4640 | copy.ResetDisplayList(); |
---|
3329 | 4641 | copy.HardTouch(); |
---|
3330 | | - CameraPane.RANDOM = random; |
---|
| 4642 | + CameraPane.SWITCH = random; |
---|
3331 | 4643 | } |
---|
3332 | 4644 | |
---|
3333 | 4645 | // public void applySelf() |
---|
.. | .. |
---|
3374 | 4686 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
3375 | 4687 | |
---|
3376 | 4688 | current.color = (float) colorField.getFloat(); |
---|
3377 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4689 | + current.modulation = (float) saturationField.getFloat(); |
---|
3378 | 4690 | current.metalness = (float) metalnessField.getFloat(); |
---|
3379 | 4691 | current.diffuse = (float) diffuseField.getFloat(); |
---|
3380 | 4692 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
3401 | 4713 | { |
---|
3402 | 4714 | //System.out.println("Propagate = " + propagate); |
---|
3403 | 4715 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 4716 | + |
---|
| 4717 | + if (copy.material != null) |
---|
| 4718 | + { |
---|
| 4719 | + cMaterial mat = copy.material; |
---|
| 4720 | + |
---|
| 4721 | + colorField.SetToolTipValue((mat.color)); |
---|
| 4722 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
| 4723 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 4724 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 4725 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 4726 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 4727 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 4728 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 4729 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 4730 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 4731 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 4732 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 4733 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 4734 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 4735 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 4736 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 4737 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 4738 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 4739 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 4740 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 4741 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 4742 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 4743 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 4744 | + } |
---|
| 4745 | + |
---|
3404 | 4746 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3405 | 4747 | { |
---|
3406 | 4748 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3429 | 4771 | //copy.Touch(); |
---|
3430 | 4772 | } |
---|
3431 | 4773 | |
---|
| 4774 | + cNumberSlider versionSlider; |
---|
| 4775 | + |
---|
3432 | 4776 | public void stateChanged(ChangeEvent e) |
---|
3433 | 4777 | { |
---|
3434 | 4778 | // assert(false); |
---|
| 4779 | + if (e.getSource() == versionSlider) |
---|
| 4780 | + { |
---|
| 4781 | + if (muteSlider) |
---|
| 4782 | + return; |
---|
| 4783 | + |
---|
| 4784 | + int version = versionSlider.getInteger(); |
---|
| 4785 | + |
---|
| 4786 | + if (version != -1 && copy.versionlist[version] != null) |
---|
| 4787 | + { |
---|
| 4788 | + copy.versionindex = version; |
---|
| 4789 | + CopyChanged(); |
---|
| 4790 | + } |
---|
| 4791 | + |
---|
| 4792 | + return; |
---|
| 4793 | + } |
---|
3435 | 4794 | |
---|
3436 | 4795 | if (freezematerial) |
---|
3437 | 4796 | { |
---|
.. | .. |
---|
3467 | 4826 | { |
---|
3468 | 4827 | //System.out.println("stateChanged = " + this); |
---|
3469 | 4828 | materialtouched = true; |
---|
| 4829 | + |
---|
| 4830 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4831 | + { |
---|
| 4832 | + saturationField.setFloat(1); |
---|
| 4833 | + } |
---|
| 4834 | + |
---|
3470 | 4835 | applySelf(); |
---|
3471 | 4836 | //System.out.println("this = " + this); |
---|
3472 | 4837 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
3516 | 4881 | } |
---|
3517 | 4882 | |
---|
3518 | 4883 | if (normalpushField != null) |
---|
3519 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 4884 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3520 | 4885 | } |
---|
3521 | 4886 | |
---|
3522 | 4887 | void SnapObject() |
---|
.. | .. |
---|
3766 | 5131 | { |
---|
3767 | 5132 | if (GetTree() != null) |
---|
3768 | 5133 | { |
---|
| 5134 | + GetTree().revalidate(); |
---|
3769 | 5135 | GetTree().repaint(); |
---|
3770 | 5136 | } |
---|
3771 | 5137 | |
---|
.. | .. |
---|
3774 | 5140 | ctrlPanel.validate(); // ? new |
---|
3775 | 5141 | ctrlPanel.repaint(); |
---|
3776 | 5142 | } |
---|
| 5143 | + |
---|
| 5144 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5145 | + SetVersionStates(); |
---|
3777 | 5146 | } |
---|
3778 | 5147 | |
---|
3779 | 5148 | static TweenManager tweenManager = new TweenManager(); |
---|
3780 | 5149 | |
---|
3781 | 5150 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3782 | 5151 | { |
---|
| 5152 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
| 5153 | + Save(); |
---|
3783 | 5154 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3784 | 5155 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3785 | 5156 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3866 | 5237 | { |
---|
3867 | 5238 | ResetModel(); |
---|
3868 | 5239 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 5240 | + |
---|
| 5241 | + if (thing.Size() == 0) |
---|
| 5242 | + { |
---|
| 5243 | + //EditSelection(false); |
---|
| 5244 | + } |
---|
| 5245 | + |
---|
3869 | 5246 | refreshContents(); |
---|
3870 | 5247 | } |
---|
3871 | 5248 | |
---|
.. | .. |
---|
3983 | 5360 | } |
---|
3984 | 5361 | } |
---|
3985 | 5362 | } |
---|
| 5363 | + |
---|
3986 | 5364 | LoadGFDThread loadGFDThread; |
---|
3987 | 5365 | |
---|
3988 | 5366 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
4002 | 5380 | |
---|
4003 | 5381 | try |
---|
4004 | 5382 | { |
---|
| 5383 | + // Try compressed version first. |
---|
4005 | 5384 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4006 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 5385 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 5386 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
4007 | 5387 | |
---|
4008 | 5388 | readobj = (Object3D) p.readObject(); |
---|
4009 | 5389 | istream.close(); |
---|
.. | .. |
---|
4011 | 5391 | readobj.ResetDisplayList(); |
---|
4012 | 5392 | } catch (Exception e) |
---|
4013 | 5393 | { |
---|
4014 | | - e.printStackTrace(); |
---|
| 5394 | + if (!e.toString().contains("GZIP")) |
---|
| 5395 | + e.printStackTrace(); |
---|
| 5396 | + |
---|
| 5397 | + try |
---|
| 5398 | + { |
---|
| 5399 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 5400 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 5401 | + |
---|
| 5402 | + readobj = (Object3D) p.readObject(); |
---|
| 5403 | + istream.close(); |
---|
| 5404 | + |
---|
| 5405 | + readobj.ResetDisplayList(); |
---|
| 5406 | + } catch (Exception e2) |
---|
| 5407 | + { |
---|
| 5408 | + e2.printStackTrace(); |
---|
| 5409 | + } |
---|
4015 | 5410 | } |
---|
4016 | 5411 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4017 | 5412 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4057 | 5452 | |
---|
4058 | 5453 | void LoadIt(Object obj) |
---|
4059 | 5454 | { |
---|
| 5455 | + if (obj == null) |
---|
| 5456 | + { |
---|
| 5457 | + // Invalid file |
---|
| 5458 | + return; |
---|
| 5459 | + } |
---|
| 5460 | + |
---|
4060 | 5461 | System.out.println("Loaded " + obj); |
---|
4061 | 5462 | //new Exception().printStackTrace(); |
---|
4062 | 5463 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4066 | 5467 | |
---|
4067 | 5468 | if (readobj != null) |
---|
4068 | 5469 | { |
---|
| 5470 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 5471 | + // Save(); |
---|
4069 | 5472 | try |
---|
4070 | 5473 | { |
---|
4071 | 5474 | //readobj.deepCopySelf(copy); |
---|
4072 | 5475 | copy.clear(); // june 2014 |
---|
| 5476 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5477 | + copy.skyboxext = readobj.skyboxext; |
---|
4073 | 5478 | for (int i = 0; i < readobj.size(); i++) |
---|
4074 | 5479 | { |
---|
4075 | 5480 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4110 | 5515 | } |
---|
4111 | 5516 | } catch (ClassCastException e) |
---|
4112 | 5517 | { |
---|
| 5518 | + e.printStackTrace(); |
---|
4113 | 5519 | assert (false); |
---|
4114 | 5520 | Composite c = (Composite) copy; |
---|
4115 | 5521 | c.children.clear(); |
---|
.. | .. |
---|
4120 | 5526 | c.addChild(csg); |
---|
4121 | 5527 | } |
---|
4122 | 5528 | |
---|
| 5529 | + copy.versionlist = readobj.versionlist; |
---|
| 5530 | + copy.versionindex = readobj.versionindex; |
---|
| 5531 | + |
---|
| 5532 | + if (copy.versionlist == null) |
---|
| 5533 | + { |
---|
| 5534 | + // Backward compatibility |
---|
| 5535 | + copy.versionlist = new Object3D[100]; |
---|
| 5536 | + copy.versionindex = -1; |
---|
| 5537 | + |
---|
| 5538 | + Save(true); |
---|
| 5539 | + } |
---|
| 5540 | + |
---|
| 5541 | + //? SetUndoStates(); |
---|
| 5542 | + |
---|
4123 | 5543 | ResetModel(); |
---|
4124 | 5544 | copy.HardTouch(); // recompile? |
---|
4125 | 5545 | refreshContents(); |
---|
4126 | 5546 | } |
---|
4127 | 5547 | } |
---|
4128 | 5548 | |
---|
4129 | | - void load() // throws ClassNotFoundException |
---|
| 5549 | + void Open() // throws ClassNotFoundException |
---|
4130 | 5550 | { |
---|
4131 | | - if (GrafreeD.standAlone) |
---|
| 5551 | + if (Grafreed.standAlone) |
---|
4132 | 5552 | { |
---|
4133 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5553 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4134 | 5554 | browser.show(); |
---|
4135 | 5555 | String filename = browser.getFile(); |
---|
4136 | 5556 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4207 | 5627 | |
---|
4208 | 5628 | void save() |
---|
4209 | 5629 | { |
---|
| 5630 | + Replace(); |
---|
| 5631 | + |
---|
4210 | 5632 | if (lastname == null) |
---|
4211 | 5633 | { |
---|
4212 | 5634 | return; |
---|
.. | .. |
---|
4215 | 5637 | try |
---|
4216 | 5638 | { |
---|
4217 | 5639 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4218 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 5640 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5641 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4219 | 5642 | |
---|
4220 | 5643 | p.writeObject(copy); |
---|
4221 | 5644 | p.flush(); |
---|
4222 | 5645 | |
---|
| 5646 | + zstream.close(); |
---|
4223 | 5647 | ostream.close(); |
---|
4224 | 5648 | |
---|
4225 | 5649 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4227 | 5651 | //ps.print(buffer.toString()); |
---|
4228 | 5652 | } catch (IOException e) |
---|
4229 | 5653 | { |
---|
| 5654 | + e.printStackTrace(); |
---|
4230 | 5655 | } |
---|
4231 | 5656 | } |
---|
| 5657 | + |
---|
4232 | 5658 | String lastname; |
---|
4233 | 5659 | |
---|
4234 | 5660 | void saveAs() |
---|
4235 | 5661 | { |
---|
4236 | | - if (GrafreeD.standAlone) |
---|
| 5662 | + if (Grafreed.standAlone) |
---|
4237 | 5663 | { |
---|
4238 | 5664 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4239 | 5665 | browser.setVisible(true); |
---|
4240 | 5666 | String filename = browser.getFile(); |
---|
4241 | 5667 | if (filename != null && filename.length() > 0) |
---|
4242 | 5668 | { |
---|
| 5669 | + if (!filename.endsWith(".gfd")) |
---|
| 5670 | + filename += ".gfd"; |
---|
4243 | 5671 | lastname = browser.getDirectory() + filename; |
---|
4244 | 5672 | save(); |
---|
4245 | 5673 | } |
---|
.. | .. |
---|
4338 | 5766 | try |
---|
4339 | 5767 | { |
---|
4340 | 5768 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4341 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4342 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 5769 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5770 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4343 | 5771 | |
---|
4344 | 5772 | Object3D objectparent = obj.parent; |
---|
4345 | 5773 | obj.parent = null; |
---|
4346 | 5774 | |
---|
4347 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 5775 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4348 | 5776 | |
---|
4349 | 5777 | obj.parent = objectparent; |
---|
4350 | 5778 | |
---|
.. | .. |
---|
4356 | 5784 | p.writeObject(object); |
---|
4357 | 5785 | p.flush(); |
---|
4358 | 5786 | |
---|
| 5787 | + zstream.close(); |
---|
4359 | 5788 | ostream.close(); |
---|
4360 | | - // zstream.close(); |
---|
4361 | 5789 | |
---|
4362 | 5790 | // group.selection.get(0).parent = parent; |
---|
4363 | 5791 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4378 | 5806 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4379 | 5807 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4380 | 5808 | copy.generatePOV(buffer); |
---|
4381 | | - if (GrafreeD.standAlone) |
---|
| 5809 | + if (Grafreed.standAlone) |
---|
4382 | 5810 | { |
---|
4383 | 5811 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4384 | 5812 | browser.show(); |
---|
.. | .. |
---|
4404 | 5832 | Object3D client; |
---|
4405 | 5833 | Object3D copy; |
---|
4406 | 5834 | MenuBar menuBar; |
---|
4407 | | - Menu windowMenu; |
---|
4408 | | - MenuItem loadItem; |
---|
| 5835 | + Menu fileMenu; |
---|
| 5836 | + MenuItem newItem; |
---|
| 5837 | + MenuItem openItem; |
---|
4409 | 5838 | MenuItem saveItem; |
---|
4410 | 5839 | MenuItem saveAsItem; |
---|
4411 | 5840 | MenuItem exportAsItem; |
---|
4412 | 5841 | MenuItem reexportItem; |
---|
4413 | 5842 | MenuItem povItem; |
---|
4414 | 5843 | MenuItem closeItem; |
---|
4415 | | - Menu cameraMenu; |
---|
| 5844 | + |
---|
4416 | 5845 | CheckboxMenuItem zBufferItem; |
---|
4417 | 5846 | //MenuItem normalLensItem; |
---|
4418 | | - MenuItem editCameraItem; |
---|
4419 | | - MenuItem revertCameraItem; |
---|
4420 | 5847 | MenuItem stepItem; |
---|
4421 | 5848 | CheckboxMenuItem toggleLiveItem; |
---|
4422 | 5849 | CheckboxMenuItem toggleFullScreenItem; |
---|
.. | .. |
---|
4427 | 5854 | CheckboxMenuItem toggleFootContactItem; |
---|
4428 | 5855 | CheckboxMenuItem toggleDLItem; |
---|
4429 | 5856 | CheckboxMenuItem toggleTextureItem; |
---|
4430 | | - CheckboxMenuItem toggleRandomItem; |
---|
| 5857 | + CheckboxMenuItem toggleSwitchItem; |
---|
4431 | 5858 | CheckboxMenuItem toggleRootItem; |
---|
4432 | 5859 | CheckboxMenuItem animationItem; |
---|
| 5860 | + MenuItem archiveItem; |
---|
4433 | 5861 | CheckboxMenuItem toggleHandleItem; |
---|
4434 | 5862 | CheckboxMenuItem togglePaintItem; |
---|
4435 | 5863 | JSplitPane mainPanel; |
---|
4436 | 5864 | JScrollPane scrollpane; |
---|
| 5865 | + |
---|
4437 | 5866 | JPanel toolbarPanel; |
---|
| 5867 | + |
---|
4438 | 5868 | cGridBag treePanel; |
---|
| 5869 | + |
---|
4439 | 5870 | JPanel radioPanel; |
---|
4440 | 5871 | ButtonGroup buttonGroup; |
---|
4441 | | - cGridBag ctrlPanel; |
---|
| 5872 | + |
---|
| 5873 | + cGridBag toolboxPanel; |
---|
| 5874 | + cGridBag skyboxPanel; |
---|
4442 | 5875 | cGridBag materialPanel; |
---|
| 5876 | + cGridBag ctrlPanel; |
---|
| 5877 | + |
---|
4443 | 5878 | JScrollPane infoPanel; |
---|
| 5879 | + |
---|
4444 | 5880 | cGridBag optionsPanel; |
---|
| 5881 | + |
---|
4445 | 5882 | JTabbedPane objectPanel; |
---|
| 5883 | + boolean materialFlushed; |
---|
| 5884 | + Object3D latestObject; |
---|
| 5885 | + |
---|
4446 | 5886 | cGridBag XYZPanel; |
---|
| 5887 | + |
---|
4447 | 5888 | JSplitPane gridPanel; |
---|
4448 | 5889 | JSplitPane bigPanel; |
---|
| 5890 | + |
---|
4449 | 5891 | cGridBag bigThree; |
---|
4450 | 5892 | cGridBag scenePanel; |
---|
4451 | 5893 | cGridBag centralPanel; |
---|
.. | .. |
---|
4503 | 5945 | JLabel colorLabel; |
---|
4504 | 5946 | cNumberSlider colorField; |
---|
4505 | 5947 | JLabel modulationLabel; |
---|
4506 | | - cNumberSlider modulationField; |
---|
| 5948 | + cNumberSlider saturationField; |
---|
4507 | 5949 | JLabel metalnessLabel; |
---|
4508 | 5950 | cNumberSlider metalnessField; |
---|
4509 | 5951 | JLabel diffuseLabel; |
---|
.. | .. |
---|
4534 | 5976 | cNumberSlider anisoField; |
---|
4535 | 5977 | JLabel anisoVLabel; |
---|
4536 | 5978 | cNumberSlider anisoVField; |
---|
| 5979 | + |
---|
4537 | 5980 | JLabel cameraLabel; |
---|
4538 | 5981 | cNumberSlider cameraField; |
---|
4539 | 5982 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
4548 | 5991 | cNumberSlider fakedepthField; |
---|
4549 | 5992 | JLabel shadowbiasLabel; |
---|
4550 | 5993 | cNumberSlider shadowbiasField; |
---|
| 5994 | + |
---|
4551 | 5995 | JLabel bumpLabel; |
---|
4552 | 5996 | cNumberSlider bumpField; |
---|
4553 | 5997 | JLabel noiseLabel; |
---|
.. | .. |
---|
4560 | 6004 | cNumberSlider fogField; |
---|
4561 | 6005 | JLabel opacityPowerLabel; |
---|
4562 | 6006 | cNumberSlider opacityPowerField; |
---|
4563 | | - JTree jTree; |
---|
| 6007 | + cTree jTree; |
---|
4564 | 6008 | //ObjectUI parent; |
---|
4565 | 6009 | |
---|
4566 | 6010 | cNumberSlider normalpushField; |
---|
| 6011 | + |
---|
| 6012 | + private MenuItem importGFDItem; |
---|
| 6013 | + private MenuItem importVRMLX3DItem; |
---|
| 6014 | + private MenuItem import3DSItem; |
---|
| 6015 | + private MenuItem importOBJItem; |
---|
4567 | 6016 | } |
---|