.. | .. |
---|
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 void AllocProjectedVertices(Object3D object) |
---|
| 47 | + { |
---|
| 48 | + assert (object.projectedVertices != null); |
---|
| 49 | + |
---|
| 50 | + if (object.projectedVertices.length <= 2) |
---|
| 51 | + { |
---|
| 52 | + // Side effect... |
---|
| 53 | + Object3D.cVector2[] keep = object.projectedVertices; |
---|
| 54 | + object.projectedVertices = new Object3D.cVector2[3]; |
---|
| 55 | + for (int i = 0; i < 3; i++) |
---|
| 56 | + { |
---|
| 57 | + if (i < keep.length) |
---|
| 58 | + { |
---|
| 59 | + object.projectedVertices[i] = keep[i]; |
---|
| 60 | + } else |
---|
| 61 | + { |
---|
| 62 | + object.projectedVertices[i] = new Object3D.cVector2(); |
---|
| 63 | + } |
---|
| 64 | + /* |
---|
| 65 | + if(keep.length == 0) |
---|
| 66 | + object.projectedVertices[0] = new Object3D.cVector2(); |
---|
| 67 | + else |
---|
| 68 | + object.projectedVertices[0] = keep[0]; |
---|
| 69 | + object.projectedVertices[1] = new Object3D.cVector2(); |
---|
| 70 | + */ |
---|
| 71 | + } |
---|
| 72 | + } |
---|
| 73 | + } |
---|
| 74 | + |
---|
| 75 | + public Composite CreateCameras() |
---|
| 76 | + { |
---|
| 77 | + Composite cams = new cTemplate(); |
---|
| 78 | + cams.name = "Cameras"; |
---|
| 79 | + copy.insertElementAt(cams, 0); |
---|
| 80 | + |
---|
| 81 | + cams.addChild(new Camera()); |
---|
| 82 | + cams.addChild(new Camera(1)); |
---|
| 83 | + cams.addChild(new Camera(2)); |
---|
| 84 | + cams.addChild(new Camera(3)); |
---|
| 85 | + cams.addChild(new Camera(4)); |
---|
| 86 | + |
---|
| 87 | + return cams; |
---|
| 88 | + } |
---|
| 89 | + |
---|
| 90 | + public cGridBag GetSeparator() |
---|
| 91 | + { |
---|
| 92 | + cGridBag separator = new cGridBag(); |
---|
| 93 | + separator.add(new JSeparator()); |
---|
| 94 | + separator.preferredHeight = 5; |
---|
| 95 | + return separator; |
---|
| 96 | + } |
---|
| 97 | + |
---|
| 98 | + cButton GetButton(String name, boolean border) |
---|
| 99 | + { |
---|
| 100 | + ImageIcon icon = GetIcon(name); |
---|
| 101 | + if (icon != null || name.contains("/")) |
---|
| 102 | + return new cButton(icon, border); |
---|
| 103 | + else |
---|
| 104 | + return new cButton(name, border); |
---|
| 105 | + } |
---|
| 106 | + |
---|
| 107 | + cLabel GetLabel(String name, boolean border) |
---|
| 108 | + { |
---|
| 109 | + //ImageIcon icon = GetIcon(name); |
---|
| 110 | + return new cLabel(GetImage(name), border); |
---|
| 111 | + } |
---|
| 112 | + |
---|
| 113 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 114 | + { |
---|
| 115 | + ImageIcon icon = GetIcon(name); |
---|
| 116 | + return new cToggleButton(icon, border); |
---|
| 117 | + } |
---|
| 118 | + |
---|
| 119 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 120 | + { |
---|
| 121 | + ImageIcon icon = GetIcon(name); |
---|
| 122 | + return new cCheckBox(icon, border); |
---|
| 123 | + } |
---|
| 124 | + |
---|
| 125 | + static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>(); |
---|
| 126 | + |
---|
| 127 | + static ImageIcon GetIcon(String name) |
---|
| 128 | + { |
---|
| 129 | + javax.swing.ImageIcon iconCache = icons.get(name); |
---|
| 130 | + if (iconCache != null) |
---|
| 131 | + { |
---|
| 132 | + return iconCache; |
---|
| 133 | + } |
---|
| 134 | + |
---|
| 135 | + try |
---|
| 136 | + { |
---|
| 137 | + BufferedImage image; |
---|
| 138 | + |
---|
| 139 | + if (name.endsWith("jpg")) |
---|
| 140 | + // Much faster! |
---|
| 141 | + image = new sun.awt.image.codec.JPEGImageDecoderImpl(ObjEditor.class.getClassLoader().getResourceAsStream(name)).decodeAsBufferedImage(); |
---|
| 142 | + else |
---|
| 143 | + image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
| 144 | + |
---|
| 145 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 146 | +// { |
---|
| 147 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 148 | +// Graphics2D g = resized.createGraphics(); |
---|
| 149 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 150 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 151 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 152 | +// g.dispose(); |
---|
| 153 | +// |
---|
| 154 | +// image = resized; |
---|
| 155 | +// } |
---|
| 156 | + |
---|
| 157 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 158 | + |
---|
| 159 | + icons.put(name, icon); |
---|
| 160 | + |
---|
| 161 | + return icon; |
---|
| 162 | + } |
---|
| 163 | + catch (Exception e) |
---|
| 164 | + { |
---|
| 165 | + //icons.put(name, null); |
---|
| 166 | + return null; |
---|
| 167 | + } |
---|
| 168 | + } |
---|
| 169 | + |
---|
| 170 | + BufferedImage GetImage(String name) |
---|
| 171 | + { |
---|
| 172 | + try |
---|
| 173 | + { |
---|
| 174 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 175 | + |
---|
| 176 | + return image; |
---|
| 177 | + } |
---|
| 178 | + catch (Exception e) |
---|
| 179 | + { |
---|
| 180 | + return null; |
---|
| 181 | + } |
---|
| 182 | + } |
---|
38 | 183 | |
---|
39 | 184 | // SCRIPT |
---|
40 | 185 | |
---|
.. | .. |
---|
143 | 288 | //nameField.removeActionListener(this); |
---|
144 | 289 | // objEditor.ctrlPanel.remove(nameField); |
---|
145 | 290 | |
---|
146 | | - if (!GroupEditor.allparams) |
---|
| 291 | + objEditor.ctrlPanel.remove(namePanel); |
---|
| 292 | + |
---|
| 293 | + if (!allparams) |
---|
147 | 294 | return; |
---|
148 | 295 | |
---|
149 | 296 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
165 | 312 | // objEditor.ctrlPanel.remove(fasterButton); |
---|
166 | 313 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
167 | 314 | |
---|
168 | | - objEditor.ctrlPanel.remove(namePanel); |
---|
169 | 315 | objEditor.ctrlPanel.remove(setupPanel); |
---|
170 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 316 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 317 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
171 | 318 | objEditor.ctrlPanel.remove(pushPanel); |
---|
172 | 319 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
173 | 320 | |
---|
.. | .. |
---|
215 | 362 | client = inClient; |
---|
216 | 363 | copy = client; |
---|
217 | 364 | |
---|
| 365 | +// if (copy.versionlist == null) |
---|
| 366 | +// { |
---|
| 367 | +// copy.versionlist = new Object3D[100]; |
---|
| 368 | +// copy.versionindex = -1; |
---|
| 369 | +// |
---|
| 370 | +// callee.Save(true); |
---|
| 371 | +// } |
---|
| 372 | + |
---|
218 | 373 | // "this" is not called: SetupUI2(objEditor); |
---|
219 | 374 | } |
---|
220 | 375 | |
---|
.. | .. |
---|
242 | 397 | //localCopy.parent = null; |
---|
243 | 398 | |
---|
244 | 399 | frame = new JFrame(); |
---|
| 400 | + frame.setUndecorated(false); |
---|
245 | 401 | objEditor = this; |
---|
246 | 402 | this.callee = callee; |
---|
247 | 403 | |
---|
248 | 404 | //parent = p; |
---|
249 | 405 | |
---|
250 | 406 | GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
---|
251 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 407 | + if (Globals.DEBUG) |
---|
| 408 | + System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
252 | 409 | //gd.setFullScreenWindow(this); |
---|
253 | 410 | //setResizable(false); |
---|
254 | 411 | //if (!isDisplayable()) |
---|
.. | .. |
---|
259 | 416 | copy = localCopy; |
---|
260 | 417 | copy.editWindow = this; |
---|
261 | 418 | |
---|
| 419 | +// if (copy.versionlist == null) |
---|
| 420 | +// { |
---|
| 421 | +// copy.versionlist = new Object3D[100]; |
---|
| 422 | +// copy.versionindex = -1; |
---|
| 423 | +// |
---|
| 424 | +// Save(true); |
---|
| 425 | +// } |
---|
| 426 | + |
---|
262 | 427 | SetupMenu(); |
---|
263 | 428 | |
---|
264 | 429 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
272 | 437 | return frame.action(event, obj); |
---|
273 | 438 | } |
---|
274 | 439 | |
---|
| 440 | + // Cannot work without static |
---|
| 441 | + static boolean allparams = true; |
---|
| 442 | + |
---|
| 443 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 444 | + |
---|
| 445 | + // This is to refresh the UI of the material panel. |
---|
| 446 | + boolean patchMaterial; |
---|
| 447 | + |
---|
275 | 448 | void SetupMenu() |
---|
276 | 449 | { |
---|
277 | 450 | 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...")); |
---|
| 451 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 452 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 453 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
| 454 | + |
---|
| 455 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 456 | + Menu menu = new Menu("Import"); |
---|
| 457 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 458 | + importOBJItem.addActionListener(this); |
---|
| 459 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 460 | + import3DSItem.addActionListener(this); |
---|
| 461 | + if (Globals.ADVANCED) |
---|
| 462 | + { |
---|
| 463 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 464 | + importVRMLX3DItem.addActionListener(this); |
---|
| 465 | + } |
---|
| 466 | + menu.add("-"); |
---|
| 467 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 468 | + importGFDItem.addActionListener(this); |
---|
| 469 | + fileMenu.add(menu); |
---|
| 470 | + fileMenu.add("-"); |
---|
| 471 | + |
---|
| 472 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 473 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
283 | 474 | //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("-"); |
---|
| 475 | + fileMenu.add("-"); |
---|
| 476 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 477 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 478 | + fileMenu.add("-"); |
---|
288 | 479 | if (client.parent != null) |
---|
289 | 480 | { |
---|
290 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 481 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
291 | 482 | } else |
---|
292 | 483 | { |
---|
293 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 484 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
294 | 485 | } |
---|
295 | 486 | |
---|
296 | | - loadItem.addActionListener(this); |
---|
| 487 | + newItem.addActionListener(this); |
---|
| 488 | + openItem.addActionListener(this); |
---|
297 | 489 | saveItem.addActionListener(this); |
---|
298 | 490 | saveAsItem.addActionListener(this); |
---|
299 | 491 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
301 | 493 | //povItem.addActionListener(this); |
---|
302 | 494 | closeItem.addActionListener(this); |
---|
303 | 495 | |
---|
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 | 496 | objectPanel = new JTabbedPane(); |
---|
| 497 | + |
---|
| 498 | + ChangeListener changeListener = new ChangeListener() |
---|
| 499 | + { |
---|
| 500 | + //String name; |
---|
| 501 | + |
---|
| 502 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 503 | + { |
---|
| 504 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 505 | +// { |
---|
| 506 | +// if (latestObject != null) |
---|
| 507 | +// { |
---|
| 508 | +// refreshContents(true); |
---|
| 509 | +// SetMaterial(latestObject); |
---|
| 510 | +// } |
---|
| 511 | +// |
---|
| 512 | +// materialFlushed = true; |
---|
| 513 | +// } |
---|
| 514 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 515 | +// { |
---|
| 516 | +// if (listUI.size() == 0) |
---|
| 517 | +// EditSelection(false); |
---|
| 518 | +// } |
---|
| 519 | + |
---|
| 520 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 521 | +// { |
---|
| 522 | +// name = copy.skyboxname; |
---|
| 523 | +// |
---|
| 524 | +// if (name == null) |
---|
| 525 | +// { |
---|
| 526 | +// name = ""; |
---|
| 527 | +// } |
---|
| 528 | +// |
---|
| 529 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 530 | +// copy.skyboxext = "jpg"; |
---|
| 531 | +// } |
---|
| 532 | +// else |
---|
| 533 | +// { |
---|
| 534 | +// if (name != null) |
---|
| 535 | +// { |
---|
| 536 | +// if (name.equals("")) |
---|
| 537 | +// { |
---|
| 538 | +// copy.skyboxname = null; |
---|
| 539 | +// copy.skyboxext = null; |
---|
| 540 | +// } |
---|
| 541 | +// else |
---|
| 542 | +// { |
---|
| 543 | +// copy.skyboxname = name; |
---|
| 544 | +// } |
---|
| 545 | +// } |
---|
| 546 | +// } |
---|
| 547 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 548 | + |
---|
| 549 | +// refreshContents(false); // To refresh Info tab |
---|
| 550 | + cameraView.repaint(); |
---|
| 551 | + } |
---|
| 552 | + }; |
---|
| 553 | + objectPanel.addChangeListener(changeListener); |
---|
| 554 | + |
---|
360 | 555 | toolbarPanel = new JPanel(); |
---|
361 | 556 | toolbarPanel.setName("Toolbar"); |
---|
| 557 | + |
---|
362 | 558 | treePanel = new cGridBag(); |
---|
363 | 559 | treePanel.setName("Tree"); |
---|
| 560 | + |
---|
| 561 | + editPanel = new cGridBag().setVertical(true); |
---|
| 562 | + //editPanel.setName("Edit"); |
---|
| 563 | + |
---|
364 | 564 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
365 | | - ctrlPanel.setName("Edit"); |
---|
366 | | - materialPanel = new cGridBag().setVertical(true); |
---|
367 | | - materialPanel.setName("Material"); |
---|
| 565 | + |
---|
| 566 | + editCommandsPanel = new cGridBag(); |
---|
| 567 | + editPanel.add(editCommandsPanel); |
---|
| 568 | + editPanel.add(ctrlPanel); |
---|
| 569 | + |
---|
| 570 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 571 | + //toolboxPanel.setName("Toolbox"); |
---|
| 572 | + |
---|
| 573 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 574 | + |
---|
| 575 | + materialPanel = new cGridBag().setVertical(false); |
---|
| 576 | + //materialPanel.setName("Material"); |
---|
| 577 | + |
---|
368 | 578 | /*JTextPane*/ |
---|
369 | 579 | infoarea = createTextPane(); |
---|
370 | 580 | doc = infoarea.getStyledDocument(); |
---|
371 | 581 | |
---|
372 | 582 | infoarea.setEditable(true); |
---|
373 | 583 | SetText(); |
---|
| 584 | + |
---|
374 | 585 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
375 | 586 | // infoarea.setOpaque(false); |
---|
376 | 587 | // //infoarea.setForeground(textcolor); |
---|
377 | 588 | // TEXTAREA infoarea.setLineWrap(true); |
---|
378 | 589 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
379 | 590 | 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"); |
---|
| 591 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
| 592 | + //infoPanel.setName("Info"); |
---|
382 | 593 | //infoPanel.setLayout(new BorderLayout()); |
---|
383 | 594 | //infoPanel.add(createTextPane()); |
---|
384 | 595 | |
---|
.. | .. |
---|
389 | 600 | mainPanel.setDividerSize(9); |
---|
390 | 601 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
391 | 602 | mainPanel.setResizeWeight(0.5); |
---|
392 | | - |
---|
| 603 | + |
---|
| 604 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 605 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 606 | + divider.setDividerSize(15); |
---|
| 607 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 608 | + |
---|
| 609 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 610 | + |
---|
393 | 611 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
394 | 612 | //mainPanel.setLayout(new GridBagLayout()); |
---|
395 | 613 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
457 | 675 | e.printStackTrace(); |
---|
458 | 676 | } |
---|
459 | 677 | |
---|
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(); |
---|
| 678 | +// String selection = infoarea.getText(); |
---|
| 679 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 680 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 681 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
464 | 682 | //clipboard.setContents(data, data); |
---|
465 | 683 | } |
---|
466 | 684 | |
---|
.. | .. |
---|
483 | 701 | //SendInfo("Name:", "bold"); |
---|
484 | 702 | if (sel.GetTextures() != null || debug) |
---|
485 | 703 | { |
---|
486 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 704 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
487 | 705 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
488 | 706 | if (sel.Size() > 0) |
---|
489 | 707 | { |
---|
490 | 708 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
491 | 709 | } |
---|
492 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 710 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
493 | 711 | if (debug) |
---|
494 | 712 | { |
---|
495 | 713 | try |
---|
.. | .. |
---|
531 | 749 | } |
---|
532 | 750 | if (sel.support != null) |
---|
533 | 751 | { |
---|
534 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 752 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
535 | 753 | } |
---|
536 | 754 | if (sel.scriptnode != null) |
---|
537 | 755 | { |
---|
.. | .. |
---|
620 | 838 | } |
---|
621 | 839 | } |
---|
622 | 840 | |
---|
| 841 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 842 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 843 | + |
---|
| 844 | + Rectangle keeprect; |
---|
| 845 | + cRadio radio; |
---|
| 846 | + |
---|
| 847 | +cButton keepButton; |
---|
| 848 | + cButton twoButton; // Full 3D |
---|
| 849 | + cButton sixButton; |
---|
| 850 | + cButton threeButton; |
---|
| 851 | + cButton sevenButton; |
---|
| 852 | + cButton fourButton; // full panel |
---|
| 853 | + cButton oneButton; // full XYZ |
---|
| 854 | + //cButton currentLayout; |
---|
| 855 | + |
---|
| 856 | + boolean maximized; |
---|
| 857 | + |
---|
| 858 | + cButton fullscreenLayout; |
---|
| 859 | + cButton expandedLayout; |
---|
| 860 | + |
---|
| 861 | + void Minimize() |
---|
| 862 | + { |
---|
| 863 | + frame.setState(Frame.ICONIFIED); |
---|
| 864 | + frame.validate(); |
---|
| 865 | + } |
---|
| 866 | + |
---|
| 867 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 868 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 869 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
| 870 | + void Maximize() |
---|
| 871 | + { |
---|
| 872 | + if (CameraPane.FULLSCREEN) |
---|
| 873 | + { |
---|
| 874 | + ToggleFullScreen(); |
---|
| 875 | + } |
---|
| 876 | + |
---|
| 877 | + if (maximized) |
---|
| 878 | + { |
---|
| 879 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 880 | + } |
---|
| 881 | + else |
---|
| 882 | + { |
---|
| 883 | + keeprect = frame.getBounds(); |
---|
| 884 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 885 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 886 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 887 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 888 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
| 889 | + } |
---|
| 890 | + |
---|
| 891 | + maximized ^= true; |
---|
| 892 | + |
---|
| 893 | + frame.validate(); |
---|
| 894 | + } |
---|
| 895 | + |
---|
| 896 | + cButton minButton; |
---|
| 897 | + cButton maxButton; |
---|
| 898 | + cButton fullButton; |
---|
| 899 | + cButton collapseButton; |
---|
| 900 | + cButton maximize3DButton; |
---|
| 901 | + |
---|
623 | 902 | void ToggleFullScreen() |
---|
624 | 903 | { |
---|
625 | | - if (CameraPane.FULLSCREEN) |
---|
| 904 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 905 | + |
---|
| 906 | + cameraView.ToggleFullScreen(); |
---|
| 907 | + |
---|
| 908 | + if (!CameraPane.FULLSCREEN) |
---|
626 | 909 | { |
---|
627 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
628 | | - framePanel.add(bigThree); |
---|
629 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 910 | + device.setFullScreenWindow(null); |
---|
| 911 | + frame.dispose(); |
---|
| 912 | + frame.setUndecorated(false); |
---|
| 913 | + frame.validate(); |
---|
| 914 | + frame.setVisible(true); |
---|
| 915 | + |
---|
| 916 | + //frame.setVisible(false); |
---|
| 917 | +// frame.removeNotify(); |
---|
| 918 | +// frame.setUndecorated(false); |
---|
| 919 | +// frame.addNotify(); |
---|
| 920 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 921 | + |
---|
| 922 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 923 | +// X framePanel.add(bigThree); |
---|
| 924 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 925 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
| 926 | + |
---|
| 927 | + //frame.setVisible(true); |
---|
| 928 | +// radio.layout = keepButton; |
---|
| 929 | + //theFrame = null; |
---|
| 930 | + keepButton = null; |
---|
| 931 | +// radio.layout.doClick(); |
---|
| 932 | + |
---|
630 | 933 | } else |
---|
631 | 934 | { |
---|
632 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
633 | | - framePanel.remove(bigThree); |
---|
634 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 935 | + keepButton = radio.layout; |
---|
| 936 | + //keeprect = frame.getBounds(); |
---|
| 937 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 938 | +// frame.getToolkit().getScreenSize().height); |
---|
| 939 | + //frame.setVisible(false); |
---|
| 940 | + |
---|
| 941 | + frame.dispose(); |
---|
| 942 | + frame.setUndecorated(true); |
---|
| 943 | + device.setFullScreenWindow(frame); |
---|
| 944 | + frame.validate(); |
---|
| 945 | + frame.setVisible(true); |
---|
| 946 | +// frame.removeNotify(); |
---|
| 947 | +// frame.setUndecorated(true); |
---|
| 948 | +// frame.addNotify(); |
---|
| 949 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 950 | +// X framePanel.remove(bigThree); |
---|
| 951 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 952 | +// framePanel.setDividerLocation(0); |
---|
| 953 | + |
---|
| 954 | +// radio.layout = fullscreenLayout; |
---|
| 955 | +// radio.layout.doClick(); |
---|
| 956 | + //frame.setVisible(true); |
---|
635 | 957 | } |
---|
636 | | - cameraView.ToggleFullScreen(); |
---|
| 958 | + frame.validate(); |
---|
| 959 | + |
---|
| 960 | + cameraView.requestFocusInWindow(); |
---|
637 | 961 | } |
---|
| 962 | + |
---|
| 963 | + void CollapseToolbar() |
---|
| 964 | + { |
---|
| 965 | + framePanel.setDividerLocation(0); |
---|
| 966 | + //frame.validate(); |
---|
| 967 | + |
---|
| 968 | + cameraView.requestFocusInWindow(); |
---|
| 969 | + } |
---|
| 970 | + |
---|
| 971 | + private Object3D Duplicate(Object3D object) |
---|
| 972 | + { |
---|
| 973 | + boolean temp = CameraPane.SWITCH; |
---|
| 974 | + CameraPane.SWITCH = false; |
---|
| 975 | + |
---|
| 976 | + if (Grafreed.grafreed.universe.versiontable == null) |
---|
| 977 | + Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 978 | + |
---|
| 979 | + object.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 980 | + // if (copy == client) |
---|
| 981 | + |
---|
| 982 | + Object3D versions[] = object.versionlist; |
---|
| 983 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe |
---|
| 984 | + object.versionlist = null; |
---|
| 985 | + object.versiontable = null; |
---|
| 986 | + |
---|
| 987 | + Object3D parent = object.parent; |
---|
| 988 | + object.parent = null; |
---|
| 989 | + |
---|
| 990 | + //byte[] compress = Compress(copy); |
---|
| 991 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
| 992 | + |
---|
| 993 | + object.parent = parent; |
---|
| 994 | + |
---|
| 995 | + object.versionlist = versions; |
---|
| 996 | + object.versiontable = versiontable; // if Grafreed.grafreed.universe |
---|
| 997 | + |
---|
| 998 | + object.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 999 | + |
---|
| 1000 | + CameraPane.SWITCH = temp; |
---|
| 1001 | + |
---|
| 1002 | + return compress; |
---|
| 1003 | + } |
---|
638 | 1004 | |
---|
639 | 1005 | private JTextPane createTextPane() |
---|
640 | 1006 | { |
---|
.. | .. |
---|
734 | 1100 | protected static ImageIcon createImageIcon(String path, |
---|
735 | 1101 | String description) |
---|
736 | 1102 | { |
---|
737 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 1103 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
738 | 1104 | if (imgURL != null) |
---|
739 | 1105 | { |
---|
740 | 1106 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
757 | 1123 | { |
---|
758 | 1124 | SetupMaterial(materialPanel); |
---|
759 | 1125 | } |
---|
| 1126 | + |
---|
760 | 1127 | //SetupName(); |
---|
761 | 1128 | //SetupViews(); |
---|
762 | 1129 | } |
---|
.. | .. |
---|
766 | 1133 | // NumberSlider vDivsField; |
---|
767 | 1134 | // JCheckBox endcaps; |
---|
768 | 1135 | JCheckBox liveCB; |
---|
| 1136 | + JCheckBox selectableCB; |
---|
769 | 1137 | JCheckBox hideCB; |
---|
770 | 1138 | JCheckBox link2masterCB; |
---|
771 | 1139 | JCheckBox markCB; |
---|
.. | .. |
---|
773 | 1141 | JCheckBox speedupCB; |
---|
774 | 1142 | JCheckBox rewindCB; |
---|
775 | 1143 | JCheckBox flipVCB; |
---|
| 1144 | + |
---|
| 1145 | + cCheckBox toggleTextureCB; |
---|
| 1146 | + cCheckBox toggleSwitchCB; |
---|
| 1147 | + |
---|
776 | 1148 | JComboBox texresMenu; |
---|
| 1149 | + |
---|
777 | 1150 | JButton resetButton; |
---|
778 | 1151 | JButton stepButton; |
---|
779 | 1152 | JButton stepAllButton; |
---|
.. | .. |
---|
782 | 1155 | JButton fasterButton; |
---|
783 | 1156 | JButton remarkButton; |
---|
784 | 1157 | |
---|
| 1158 | + cGridBag editPanel; |
---|
| 1159 | + cGridBag editCommandsPanel; |
---|
| 1160 | + |
---|
785 | 1161 | cGridBag namePanel; |
---|
786 | 1162 | cGridBag setupPanel; |
---|
787 | | - cGridBag commandsPanel; |
---|
| 1163 | + cGridBag setupPanel2; |
---|
| 1164 | + cGridBag objectCommandsPanel; |
---|
788 | 1165 | cGridBag pushPanel; |
---|
789 | 1166 | cGridBag fillPanel; |
---|
790 | 1167 | |
---|
.. | .. |
---|
951 | 1328 | |
---|
952 | 1329 | void SetupUI2(ObjEditor oe) |
---|
953 | 1330 | { |
---|
954 | | -// oe.aConstraints.weightx = 0; |
---|
955 | | -// oe.aConstraints.weighty = 0; |
---|
956 | | -// oe.aConstraints.gridx = 0; |
---|
957 | | -// oe.aConstraints.gridy = 0; |
---|
958 | 1331 | //SetupName(oe); |
---|
959 | 1332 | |
---|
960 | 1333 | namePanel = new cGridBag(); |
---|
961 | 1334 | |
---|
| 1335 | + //if (copy.pinned) |
---|
| 1336 | + { |
---|
| 1337 | + pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF); |
---|
| 1338 | + pinButton.setSelected(copy.pinned); |
---|
| 1339 | + cGridBag t = new cGridBag(); |
---|
| 1340 | + t.preferredWidth = 2; |
---|
| 1341 | + t.add(pinButton); |
---|
| 1342 | + namePanel.add(t); |
---|
| 1343 | + |
---|
| 1344 | + pinButton.addItemListener(this); |
---|
| 1345 | + } |
---|
| 1346 | + |
---|
962 | 1347 | nameField = AddText(namePanel, copy.GetName()); |
---|
963 | | - namePanel.add(nameField); |
---|
| 1348 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
964 | 1349 | oe.ctrlPanel.add(namePanel); |
---|
965 | 1350 | |
---|
966 | 1351 | oe.ctrlPanel.Return(); |
---|
967 | 1352 | |
---|
968 | | - if (!GroupEditor.allparams) |
---|
| 1353 | + if (!allparams) |
---|
969 | 1354 | return; |
---|
970 | 1355 | |
---|
971 | 1356 | setupPanel = new cGridBag().setVertical(false); |
---|
972 | 1357 | |
---|
973 | 1358 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
974 | | - link2masterCB = AddCheckBox(setupPanel, "Supp", copy.link2master); |
---|
975 | | - hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 1359 | + liveCB.setToolTipText("Animate object"); |
---|
| 1360 | + markCB = AddCheckBox(setupPanel, "Anim", copy.marked); |
---|
| 1361 | + markCB.setToolTipText("Set target transform"); |
---|
| 1362 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1363 | + selectableCB.setToolTipText("Make object selectable"); |
---|
976 | 1364 | // Return(); |
---|
977 | | - markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
978 | | - rewindCB = AddCheckBox(setupPanel, "Rew", copy.rewind); |
---|
979 | | - randomCB = AddCheckBox(setupPanel, "Rand", copy.random); |
---|
| 1365 | + |
---|
| 1366 | + hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 1367 | + hideCB.setToolTipText("Hide object"); |
---|
| 1368 | + |
---|
| 1369 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
| 1370 | + |
---|
| 1371 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1372 | + |
---|
| 1373 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
| 1374 | + rewindCB.setToolTipText("Rewind animation"); |
---|
| 1375 | + |
---|
| 1376 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1377 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
980 | 1378 | |
---|
| 1379 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1380 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1381 | + |
---|
| 1382 | + if (Globals.ADVANCED) |
---|
| 1383 | + { |
---|
| 1384 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
| 1385 | + speedupCB.setToolTipText("Option motion capture"); |
---|
| 1386 | + } |
---|
| 1387 | + |
---|
981 | 1388 | oe.ctrlPanel.add(setupPanel); |
---|
982 | 1389 | oe.ctrlPanel.Return(); |
---|
| 1390 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1391 | + oe.ctrlPanel.Return(); |
---|
983 | 1392 | |
---|
984 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1393 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
985 | 1394 | |
---|
986 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
987 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1395 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
| 1396 | + resetButton.setToolTipText("Jump to frame zero"); |
---|
| 1397 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
| 1398 | + stepButton.setToolTipText("Step one frame"); |
---|
988 | 1399 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
989 | 1400 | // stepAllButton = AddButton(oe, "Step All"); |
---|
990 | | - speedupCB = AddCheckBox(commandsPanel, "Speed", copy.speedup); |
---|
991 | 1401 | // Return(); |
---|
992 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
993 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
994 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1402 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
| 1403 | + slowerButton.setToolTipText("Decrease animation speed"); |
---|
| 1404 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
| 1405 | + fasterButton.setToolTipText("Increase animation speed"); |
---|
| 1406 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
| 1407 | + remarkButton.setToolTipText("Set the current transform as the target"); |
---|
995 | 1408 | |
---|
996 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1409 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
997 | 1410 | oe.ctrlPanel.Return(); |
---|
998 | 1411 | |
---|
999 | | - pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1); |
---|
| 1412 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
1000 | 1413 | normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
1001 | 1414 | //Return(); |
---|
1002 | 1415 | |
---|
.. | .. |
---|
1153 | 1566 | |
---|
1154 | 1567 | if (cam == null || !(copy.get(0) instanceof cGroup)) |
---|
1155 | 1568 | { |
---|
1156 | | - System.out.println("CREATE CAMERAS"); |
---|
1157 | | - cams = new cTemplate(); |
---|
1158 | | - cams.name = "Cameras"; |
---|
1159 | | - copy.insertElementAt(cams, 0); |
---|
1160 | | - //cams.parent = copy; |
---|
1161 | | - |
---|
1162 | | - cam = new Camera(); // LA.newVector(3, 2, 1)); |
---|
1163 | | - cams.addChild(cam); |
---|
1164 | | - cam = new Camera(1); |
---|
1165 | | - cams.addChild(cam); |
---|
1166 | | - cam = new Camera(2); |
---|
1167 | | - cams.addChild(cam); |
---|
1168 | | - cam = new Camera(3); |
---|
1169 | | - cams.addChild(cam); |
---|
1170 | | - cam = new Camera(4); // Light |
---|
1171 | | - cams.addChild(cam); |
---|
| 1569 | + if (Globals.DEBUG) |
---|
| 1570 | + System.out.println("CREATE CAMERAS"); |
---|
| 1571 | + cams = CreateCameras(); |
---|
1172 | 1572 | } else |
---|
1173 | 1573 | { |
---|
1174 | 1574 | cams = (cGroup) copy.get(0); |
---|
.. | .. |
---|
1199 | 1599 | //worldPanel.setName("World"); |
---|
1200 | 1600 | centralPanel = new cGridBag(); |
---|
1201 | 1601 | centralPanel.preferredWidth = 20; |
---|
1202 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1203 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1602 | + |
---|
| 1603 | + if (Globals.ADVANCED) |
---|
| 1604 | + { |
---|
| 1605 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1606 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1204 | 1607 | |
---|
1205 | 1608 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1206 | 1609 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1209 | 1612 | // cameraPanel.setDividerSize(9); |
---|
1210 | 1613 | cameraPanel.setResizeWeight(1.0); |
---|
1211 | 1614 | |
---|
| 1615 | + } |
---|
| 1616 | + |
---|
1212 | 1617 | centralPanel.add(cameraView); |
---|
| 1618 | + centralPanel.setFocusable(true); |
---|
1213 | 1619 | //frame.setJMenuBar(timelineMenubar); |
---|
1214 | 1620 | //centralPanel.add(timelinePanel); |
---|
1215 | 1621 | |
---|
.. | .. |
---|
1228 | 1634 | //frontView.object = copy; |
---|
1229 | 1635 | //sideView.object = copy; |
---|
1230 | 1636 | |
---|
| 1637 | + transformPanel = new cGridBag().setVertical(true); |
---|
| 1638 | + |
---|
| 1639 | + cGridBag resetTransformPanel = new cGridBag(); |
---|
| 1640 | + |
---|
| 1641 | + resetTransformPanel.preferredHeight = 2; |
---|
| 1642 | + |
---|
| 1643 | + cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF); |
---|
| 1644 | + resetTransform.setToolTipText("Reset Translation, Rotation and Scale"); |
---|
| 1645 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1646 | + { |
---|
| 1647 | + public void mouseClicked(MouseEvent e) |
---|
| 1648 | + { |
---|
| 1649 | + ResetTransform(); |
---|
| 1650 | + } |
---|
| 1651 | + }); |
---|
| 1652 | + resetTransformPanel.add(resetTransform); |
---|
| 1653 | + |
---|
| 1654 | + resetTransform = GetButton("T only", !Globals.NIMBUSLAF); |
---|
| 1655 | + resetTransform.setToolTipText("Reset Translation only"); |
---|
| 1656 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1657 | + { |
---|
| 1658 | + public void mouseClicked(MouseEvent e) |
---|
| 1659 | + { |
---|
| 1660 | + ResetTransform(1); |
---|
| 1661 | + } |
---|
| 1662 | + }); |
---|
| 1663 | + resetTransformPanel.add(resetTransform); |
---|
| 1664 | + |
---|
| 1665 | + resetTransform = GetButton("RS only", !Globals.NIMBUSLAF); |
---|
| 1666 | + resetTransform.setToolTipText("Reset Rotation and Scale only"); |
---|
| 1667 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1668 | + { |
---|
| 1669 | + public void mouseClicked(MouseEvent e) |
---|
| 1670 | + { |
---|
| 1671 | + ResetTransform(2); |
---|
| 1672 | + } |
---|
| 1673 | + }); |
---|
| 1674 | + resetTransformPanel.add(resetTransform); |
---|
| 1675 | + |
---|
1231 | 1676 | XYZPanel = new cGridBag().setVertical(true); |
---|
1232 | 1677 | //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); |
---|
1233 | 1678 | |
---|
.. | .. |
---|
1235 | 1680 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1236 | 1681 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1237 | 1682 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1683 | + //XYZPanel.setName("XYZ"); |
---|
1238 | 1684 | |
---|
| 1685 | + transformPanel.add(resetTransformPanel); |
---|
| 1686 | + transformPanel.add(XYZPanel); |
---|
| 1687 | + |
---|
1239 | 1688 | /* |
---|
1240 | 1689 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
1241 | 1690 | gridPanel.setLayout(new GridLayout(1, 2)); |
---|
.. | .. |
---|
1243 | 1692 | gridPanel.add(cameraView); |
---|
1244 | 1693 | gridPanel.add(XYZPanel); |
---|
1245 | 1694 | */ |
---|
1246 | | - gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout()); |
---|
1247 | | - gridPanel.setContinuousLayout(true); |
---|
1248 | | - gridPanel.setOneTouchExpandable(true); |
---|
1249 | | - gridPanel.setDividerLocation(1.0); |
---|
1250 | | - gridPanel.setDividerSize(9); |
---|
1251 | | - gridPanel.setResizeWeight(0.85); |
---|
| 1695 | +// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout()); |
---|
| 1696 | +// gridPanel.setContinuousLayout(true); |
---|
| 1697 | +// gridPanel.setOneTouchExpandable(true); |
---|
| 1698 | +// gridPanel.setDividerLocation(1.0); |
---|
| 1699 | +// gridPanel.setDividerSize(9); |
---|
| 1700 | +// gridPanel.setResizeWeight(0.85); |
---|
1252 | 1701 | |
---|
1253 | 1702 | // aConstraints.weighty = 0; |
---|
1254 | 1703 | //System.out.println("THIS = " + this); |
---|
.. | .. |
---|
1271 | 1720 | |
---|
1272 | 1721 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1273 | 1722 | //tmp.setName("Edit"); |
---|
| 1723 | + objectPanel.add(skyboxPanel); |
---|
| 1724 | + objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg")); |
---|
| 1725 | + objectPanel.setToolTipTextAt(0, "Backgrounds"); |
---|
| 1726 | + |
---|
| 1727 | + objectPanel.add(toolboxPanel); |
---|
| 1728 | + objectPanel.setIconAt(1, GetIcon("icons/primitives.png")); |
---|
| 1729 | + objectPanel.setToolTipTextAt(1, "Objects & textures"); |
---|
| 1730 | + |
---|
1274 | 1731 | objectPanel.add(materialPanel); |
---|
| 1732 | + objectPanel.setIconAt(2, GetIcon("icons/material.png")); |
---|
| 1733 | + objectPanel.setToolTipTextAt(2, "Material"); |
---|
| 1734 | + |
---|
1275 | 1735 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1276 | 1736 | // north.setName("Edit"); |
---|
1277 | 1737 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1278 | 1738 | // objectPanel.add(north); |
---|
1279 | | - objectPanel.add(ctrlPanel); |
---|
1280 | | - objectPanel.add(infoPanel); |
---|
1281 | | - |
---|
| 1739 | + objectPanel.add(editPanel); |
---|
| 1740 | + objectPanel.setIconAt(3, GetIcon("icons/writewhite.png")); |
---|
| 1741 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
| 1742 | + |
---|
| 1743 | + objectPanel.add(transformPanel); |
---|
| 1744 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1745 | + objectPanel.setToolTipTextAt(4, "TRS transform"); |
---|
| 1746 | + |
---|
| 1747 | + patchMaterial = true; |
---|
| 1748 | + cameraView.patchMaterial = this; |
---|
| 1749 | + objectPanel.setSelectedIndex(2); |
---|
| 1750 | + |
---|
1282 | 1751 | /* |
---|
1283 | 1752 | aConstraints.gridx = 0; |
---|
1284 | 1753 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1286 | 1755 | aConstraints.gridy += 1; |
---|
1287 | 1756 | aConstraints.gridwidth = 1; |
---|
1288 | 1757 | mainPanel.add(objectPanel, aConstraints); |
---|
1289 | | - */ |
---|
| 1758 | + */ |
---|
1290 | 1759 | |
---|
1291 | 1760 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1292 | 1761 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1298 | 1767 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1299 | 1768 | |
---|
1300 | 1769 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1301 | | - scenePanel.preferredWidth = 7; |
---|
| 1770 | + scenePanel.preferredWidth = 5; |
---|
1302 | 1771 | |
---|
1303 | 1772 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1304 | 1773 | tabbedPane.add(scrollpane); |
---|
1305 | 1774 | |
---|
1306 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1307 | | - |
---|
1308 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1775 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1309 | 1776 | |
---|
1310 | 1777 | optionsPanel.setName("Options"); |
---|
1311 | 1778 | |
---|
1312 | 1779 | AddOptions(optionsPanel); //, aConstraints); |
---|
1313 | 1780 | |
---|
| 1781 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1782 | + |
---|
1314 | 1783 | tabbedPane.add(optionsPanel); |
---|
1315 | 1784 | |
---|
1316 | 1785 | scenePanel.add(tabbedPane); |
---|
| 1786 | + |
---|
| 1787 | + cGridBag creditsPanel = new cGridBag().setVertical(true); |
---|
| 1788 | + creditsPanel.setName("Credits"); |
---|
| 1789 | + |
---|
| 1790 | + cLabel ogaLabel = new cLabel(" Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF); |
---|
| 1791 | + creditsPanel.add(ogaLabel); |
---|
| 1792 | + |
---|
| 1793 | + cButton creditButton; |
---|
| 1794 | + creditsPanel.add(creditButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF)); |
---|
| 1795 | + creditButton.setToolTipText("https://opengameart.org"); |
---|
| 1796 | + |
---|
| 1797 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1798 | + { |
---|
| 1799 | + public void mouseClicked(MouseEvent e) |
---|
| 1800 | + { |
---|
| 1801 | + try |
---|
| 1802 | + { |
---|
| 1803 | + Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/")); |
---|
| 1804 | + } catch (Exception e1) |
---|
| 1805 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1806 | + { |
---|
| 1807 | + e1.printStackTrace(); |
---|
| 1808 | + } |
---|
| 1809 | + } |
---|
| 1810 | + }); |
---|
| 1811 | + |
---|
| 1812 | + ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF); |
---|
| 1813 | + creditsPanel.add(ogaLabel); |
---|
| 1814 | + |
---|
| 1815 | + creditsPanel.add(creditButton = GetButton("icons/3delicious.png", !Globals.NIMBUSLAF)); |
---|
| 1816 | + creditButton.setToolTipText("https://3delicious.net"); |
---|
| 1817 | + |
---|
| 1818 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1819 | + { |
---|
| 1820 | + public void mouseClicked(MouseEvent e) |
---|
| 1821 | + { |
---|
| 1822 | + try |
---|
| 1823 | + { |
---|
| 1824 | + Desktop.getDesktop().browse(new java.net.URI("https://3delicious.net")); |
---|
| 1825 | + } catch (Exception e1) |
---|
| 1826 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1827 | + { |
---|
| 1828 | + e1.printStackTrace(); |
---|
| 1829 | + } |
---|
| 1830 | + } |
---|
| 1831 | + }); |
---|
| 1832 | + |
---|
| 1833 | + creditsPanel.add(creditButton = GetButton("icons/archive3d.png", !Globals.NIMBUSLAF)); |
---|
| 1834 | + creditButton.setToolTipText("https://archive3d.net"); |
---|
| 1835 | + |
---|
| 1836 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1837 | + { |
---|
| 1838 | + public void mouseClicked(MouseEvent e) |
---|
| 1839 | + { |
---|
| 1840 | + try |
---|
| 1841 | + { |
---|
| 1842 | + Desktop.getDesktop().browse(new java.net.URI("https://archive3d.net")); |
---|
| 1843 | + } catch (Exception e1) |
---|
| 1844 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1845 | + { |
---|
| 1846 | + e1.printStackTrace(); |
---|
| 1847 | + } |
---|
| 1848 | + } |
---|
| 1849 | + }); |
---|
| 1850 | + |
---|
| 1851 | + creditsPanel.add(creditButton = GetButton("icons/turbosquid.png", !Globals.NIMBUSLAF)); |
---|
| 1852 | + creditButton.setToolTipText("https://turbosquid.com"); |
---|
| 1853 | + |
---|
| 1854 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1855 | + { |
---|
| 1856 | + public void mouseClicked(MouseEvent e) |
---|
| 1857 | + { |
---|
| 1858 | + try |
---|
| 1859 | + { |
---|
| 1860 | + Desktop.getDesktop().browse(new java.net.URI("https://www.turbosquid.com/Search/3D-Models/free")); |
---|
| 1861 | + } catch (Exception e1) |
---|
| 1862 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1863 | + { |
---|
| 1864 | + e1.printStackTrace(); |
---|
| 1865 | + } |
---|
| 1866 | + } |
---|
| 1867 | + }); |
---|
| 1868 | + |
---|
| 1869 | + for (int i=6; --i>=0;) |
---|
| 1870 | + { |
---|
| 1871 | + creditsPanel.add(new cGridBag()); |
---|
| 1872 | + } |
---|
| 1873 | + |
---|
| 1874 | + tabbedPane.add(creditsPanel); |
---|
| 1875 | + tabbedPane.setToolTipTextAt(3, "Credits"); |
---|
| 1876 | + |
---|
| 1877 | + if (Globals.ADVANCED) |
---|
| 1878 | + { |
---|
| 1879 | + objectPanel.add(infoPanel); |
---|
| 1880 | + objectPanel.setIconAt(5, GetIcon("icons/info.png")); |
---|
| 1881 | + objectPanel.setToolTipTextAt(4, "Information"); |
---|
| 1882 | + } |
---|
1317 | 1883 | |
---|
1318 | 1884 | /* |
---|
1319 | 1885 | cTree jTree = new cTree(null); |
---|
.. | .. |
---|
1335 | 1901 | jtp.add(tree); |
---|
1336 | 1902 | */ |
---|
1337 | 1903 | |
---|
1338 | | - bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel); |
---|
1339 | | - bigPanel.setContinuousLayout(true); |
---|
1340 | | - bigPanel.setOneTouchExpandable(true); |
---|
1341 | | - bigPanel.setDividerLocation(0.8); |
---|
1342 | | - bigPanel.setDividerSize(15); |
---|
1343 | | - bigPanel.setResizeWeight(0.15); |
---|
1344 | | - bigPanel.setName("Scene"); |
---|
| 1904 | +// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel); |
---|
| 1905 | +// bigPanel.setContinuousLayout(true); |
---|
| 1906 | +// bigPanel.setOneTouchExpandable(true); |
---|
| 1907 | +// bigPanel.setDividerLocation(0.8); |
---|
| 1908 | +// bigPanel.setDividerSize(15); |
---|
| 1909 | +// bigPanel.setResizeWeight(0.15); |
---|
| 1910 | +// bigPanel.setName("Scene"); |
---|
1345 | 1911 | |
---|
1346 | 1912 | //bigPanel.setLayout(new BorderLayout()); |
---|
1347 | 1913 | //bigPanel.setSize(new Dimension(10,10)); |
---|
.. | .. |
---|
1376 | 1942 | bigThree = new cGridBag(); |
---|
1377 | 1943 | bigThree.addComponent(scenePanel); |
---|
1378 | 1944 | bigThree.addComponent(centralPanel); |
---|
1379 | | - bigThree.addComponent(XYZPanel); |
---|
| 1945 | + //bigThree.addComponent(XYZPanel); |
---|
1380 | 1946 | |
---|
1381 | 1947 | // // SIDE EFFECT!!! |
---|
1382 | 1948 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1385 | 1951 | // aConstraints.gridheight = 1; |
---|
1386 | 1952 | |
---|
1387 | 1953 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1388 | | - framePanel.setContinuousLayout(true); |
---|
1389 | | - framePanel.setOneTouchExpandable(true); |
---|
1390 | | - framePanel.setDividerLocation(0.8); |
---|
| 1954 | + |
---|
| 1955 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1956 | + new java.beans.PropertyChangeListener() |
---|
| 1957 | + { |
---|
| 1958 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1959 | + { |
---|
| 1960 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1961 | + { |
---|
| 1962 | + if (radio.layout != expandedLayout) |
---|
| 1963 | + { |
---|
| 1964 | + radio.layout = expandedLayout; |
---|
| 1965 | + radio.layout.doClick(); |
---|
| 1966 | + } |
---|
| 1967 | + } |
---|
| 1968 | + } |
---|
| 1969 | + }); |
---|
| 1970 | + |
---|
| 1971 | + framePanel.setContinuousLayout(false); |
---|
| 1972 | + framePanel.setOneTouchExpandable(false); |
---|
| 1973 | + //.setDividerLocation(0.8); |
---|
1391 | 1974 | //framePanel.setDividerSize(15); |
---|
1392 | 1975 | //framePanel.setResizeWeight(0.15); |
---|
1393 | 1976 | framePanel.setName("Frame"); |
---|
1394 | 1977 | |
---|
1395 | 1978 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1396 | 1979 | /**/ |
---|
1397 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1980 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1398 | 1981 | //worldPane.add(bigPanel); |
---|
1399 | 1982 | //worldPane.add(worldPanel); |
---|
1400 | 1983 | /**/ |
---|
.. | .. |
---|
1404 | 1987 | |
---|
1405 | 1988 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1406 | 1989 | |
---|
1407 | | - frame.setSize(1024, 768); |
---|
1408 | | - frame.show(); |
---|
| 1990 | + frame.setSize(1280, 860); |
---|
| 1991 | + |
---|
| 1992 | + cameraView.requestFocusInWindow(); |
---|
| 1993 | + |
---|
| 1994 | +// gridPanel.setDividerLocation(1.0); |
---|
| 1995 | + |
---|
| 1996 | + frame.validate(); |
---|
1409 | 1997 | |
---|
1410 | | - gridPanel.setDividerLocation(1.0); |
---|
| 1998 | + frame.setVisible(true); |
---|
1411 | 1999 | |
---|
1412 | 2000 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1413 | 2001 | frame.addWindowListener(new WindowAdapter() |
---|
1414 | 2002 | { |
---|
1415 | | - |
---|
1416 | 2003 | public void windowClosing(WindowEvent e) |
---|
1417 | 2004 | { |
---|
1418 | 2005 | Close(); |
---|
.. | .. |
---|
1435 | 2022 | ctrlPanel.removeAll(); |
---|
1436 | 2023 | } |
---|
1437 | 2024 | |
---|
1438 | | - void SetupMaterial(cGridBag panel) |
---|
| 2025 | + void SetupMaterial(cGridBag materialpanel) |
---|
1439 | 2026 | { |
---|
1440 | | - /* |
---|
| 2027 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 2028 | + |
---|
| 2029 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF); |
---|
| 2030 | + skin.setToolTipText("Skin"); |
---|
| 2031 | + skin.addMouseListener(new MouseAdapter() |
---|
| 2032 | + { |
---|
| 2033 | + public void mouseClicked(MouseEvent e) |
---|
| 2034 | + { |
---|
| 2035 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 2036 | + cMaterial material = object.material; |
---|
| 2037 | + |
---|
| 2038 | + // Skin |
---|
| 2039 | + colorField.setFloat(material.color); |
---|
| 2040 | + float saturation = material.modulation; |
---|
| 2041 | + |
---|
| 2042 | + if (!cameraView.Skinshader) |
---|
| 2043 | + { |
---|
| 2044 | + saturation /= 1.5; |
---|
| 2045 | + } |
---|
| 2046 | + |
---|
| 2047 | + saturationField.setFloat(saturation); |
---|
| 2048 | + |
---|
| 2049 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2050 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2051 | + diffusenessField.setFloat(material.factor); |
---|
| 2052 | + shininessField.setFloat(material.shininess); |
---|
| 2053 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2054 | + diffuseField.setFloat(material.diffuse); |
---|
| 2055 | + specularField.setFloat(material.specular); |
---|
| 2056 | + |
---|
| 2057 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2058 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2059 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2060 | + |
---|
| 2061 | + materialtouched = true; |
---|
| 2062 | + applySelf(); |
---|
| 2063 | + } |
---|
| 2064 | + }); |
---|
| 2065 | + presetpanel.add(skin); |
---|
| 2066 | + |
---|
| 2067 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF); |
---|
| 2068 | + lambert.setToolTipText("Diffuse"); |
---|
| 2069 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 2070 | + { |
---|
| 2071 | + public void mouseClicked(MouseEvent e) |
---|
| 2072 | + { |
---|
| 2073 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 2074 | + cMaterial material = object.material; |
---|
| 2075 | + |
---|
| 2076 | + diffusenessField.setFloat(material.factor); |
---|
| 2077 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2078 | + |
---|
| 2079 | + materialtouched = true; |
---|
| 2080 | + applySelf(); |
---|
| 2081 | + } |
---|
| 2082 | + }); |
---|
| 2083 | + presetpanel.add(lambert); |
---|
| 2084 | + |
---|
| 2085 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF); |
---|
| 2086 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 2087 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 2088 | + { |
---|
| 2089 | + public void mouseClicked(MouseEvent e) |
---|
| 2090 | + { |
---|
| 2091 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 2092 | + cMaterial material = object.material; |
---|
| 2093 | + |
---|
| 2094 | + diffusenessField.setFloat(material.factor); |
---|
| 2095 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2096 | + |
---|
| 2097 | + materialtouched = true; |
---|
| 2098 | + applySelf(); |
---|
| 2099 | + } |
---|
| 2100 | + }); |
---|
| 2101 | + presetpanel.add(diffuse2); |
---|
| 2102 | + |
---|
| 2103 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF); |
---|
| 2104 | + diffusemoon.setToolTipText("Moon"); |
---|
| 2105 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 2106 | + { |
---|
| 2107 | + public void mouseClicked(MouseEvent e) |
---|
| 2108 | + { |
---|
| 2109 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 2110 | + cMaterial material = object.material; |
---|
| 2111 | + |
---|
| 2112 | + diffusenessField.setFloat(material.factor); |
---|
| 2113 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2114 | + |
---|
| 2115 | + materialtouched = true; |
---|
| 2116 | + applySelf(); |
---|
| 2117 | + } |
---|
| 2118 | + }); |
---|
| 2119 | + presetpanel.add(diffusemoon); |
---|
| 2120 | + |
---|
| 2121 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF); |
---|
| 2122 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 2123 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 2124 | + { |
---|
| 2125 | + public void mouseClicked(MouseEvent e) |
---|
| 2126 | + { |
---|
| 2127 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 2128 | + cMaterial material = object.material; |
---|
| 2129 | + |
---|
| 2130 | + diffusenessField.setFloat(material.factor); |
---|
| 2131 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2132 | + |
---|
| 2133 | + materialtouched = true; |
---|
| 2134 | + applySelf(); |
---|
| 2135 | + } |
---|
| 2136 | + }); |
---|
| 2137 | + presetpanel.add(diffusemoon2); |
---|
| 2138 | + |
---|
| 2139 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF); |
---|
| 2140 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 2141 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 2142 | + { |
---|
| 2143 | + public void mouseClicked(MouseEvent e) |
---|
| 2144 | + { |
---|
| 2145 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 2146 | + cMaterial material = object.material; |
---|
| 2147 | + |
---|
| 2148 | + diffusenessField.setFloat(material.factor); |
---|
| 2149 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2150 | + |
---|
| 2151 | + materialtouched = true; |
---|
| 2152 | + applySelf(); |
---|
| 2153 | + } |
---|
| 2154 | + }); |
---|
| 2155 | + presetpanel.add(diffusemoon3); |
---|
| 2156 | + |
---|
| 2157 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF); |
---|
| 2158 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 2159 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 2160 | + { |
---|
| 2161 | + public void mouseClicked(MouseEvent e) |
---|
| 2162 | + { |
---|
| 2163 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 2164 | + cMaterial material = object.material; |
---|
| 2165 | + |
---|
| 2166 | + sheenField.setFloat(material.sheen); |
---|
| 2167 | + |
---|
| 2168 | + materialtouched = true; |
---|
| 2169 | + applySelf(); |
---|
| 2170 | + } |
---|
| 2171 | + }); |
---|
| 2172 | + presetpanel.add(diffusesheen); |
---|
| 2173 | + |
---|
| 2174 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF); |
---|
| 2175 | + rough.setToolTipText("Rough metal"); |
---|
| 2176 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2177 | + { |
---|
| 2178 | + public void mouseClicked(MouseEvent e) |
---|
| 2179 | + { |
---|
| 2180 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2181 | + cMaterial material = object.material; |
---|
| 2182 | + |
---|
| 2183 | + shininessField.setFloat(material.shininess); |
---|
| 2184 | + velvetField.setFloat(material.velvet); |
---|
| 2185 | + |
---|
| 2186 | + materialtouched = true; |
---|
| 2187 | + applySelf(); |
---|
| 2188 | + } |
---|
| 2189 | + }); |
---|
| 2190 | + presetpanel.add(rough); |
---|
| 2191 | + |
---|
| 2192 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF); |
---|
| 2193 | + rough2.setToolTipText("Medium metal"); |
---|
| 2194 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2195 | + { |
---|
| 2196 | + public void mouseClicked(MouseEvent e) |
---|
| 2197 | + { |
---|
| 2198 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2199 | + cMaterial material = object.material; |
---|
| 2200 | + |
---|
| 2201 | + shininessField.setFloat(material.shininess); |
---|
| 2202 | + lightareaField.setFloat(material.lightarea); |
---|
| 2203 | + |
---|
| 2204 | + materialtouched = true; |
---|
| 2205 | + applySelf(); |
---|
| 2206 | + } |
---|
| 2207 | + }); |
---|
| 2208 | + presetpanel.add(rough2); |
---|
| 2209 | + |
---|
| 2210 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF); |
---|
| 2211 | + shini0.setToolTipText("Shiny"); |
---|
| 2212 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2213 | + { |
---|
| 2214 | + public void mouseClicked(MouseEvent e) |
---|
| 2215 | + { |
---|
| 2216 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2217 | + cMaterial material = object.material; |
---|
| 2218 | + |
---|
| 2219 | + shininessField.setFloat(material.shininess); |
---|
| 2220 | + lightareaField.setFloat(material.lightarea); |
---|
| 2221 | + |
---|
| 2222 | + materialtouched = true; |
---|
| 2223 | + applySelf(); |
---|
| 2224 | + } |
---|
| 2225 | + }); |
---|
| 2226 | + presetpanel.add(shini0); |
---|
| 2227 | + |
---|
| 2228 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF); |
---|
| 2229 | + shini1.setToolTipText("Shiny2"); |
---|
| 2230 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2231 | + { |
---|
| 2232 | + public void mouseClicked(MouseEvent e) |
---|
| 2233 | + { |
---|
| 2234 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2235 | + cMaterial material = object.material; |
---|
| 2236 | + |
---|
| 2237 | + shininessField.setFloat(material.shininess); |
---|
| 2238 | + lightareaField.setFloat(material.lightarea); |
---|
| 2239 | + |
---|
| 2240 | + materialtouched = true; |
---|
| 2241 | + applySelf(); |
---|
| 2242 | + } |
---|
| 2243 | + }); |
---|
| 2244 | + presetpanel.add(shini1); |
---|
| 2245 | + |
---|
| 2246 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF); |
---|
| 2247 | + shini2.setToolTipText("Shiny3"); |
---|
| 2248 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2249 | + { |
---|
| 2250 | + public void mouseClicked(MouseEvent e) |
---|
| 2251 | + { |
---|
| 2252 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2253 | + cMaterial material = object.material; |
---|
| 2254 | + |
---|
| 2255 | + shininessField.setFloat(material.shininess); |
---|
| 2256 | + lightareaField.setFloat(material.lightarea); |
---|
| 2257 | + |
---|
| 2258 | + materialtouched = true; |
---|
| 2259 | + applySelf(); |
---|
| 2260 | + } |
---|
| 2261 | + }); |
---|
| 2262 | + presetpanel.add(shini2); |
---|
| 2263 | + |
---|
| 2264 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF); |
---|
| 2265 | + aniso.setToolTipText("AnisoU"); |
---|
| 2266 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2267 | + { |
---|
| 2268 | + public void mouseClicked(MouseEvent e) |
---|
| 2269 | + { |
---|
| 2270 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2271 | + cMaterial material = object.material; |
---|
| 2272 | + |
---|
| 2273 | + anisoField.setFloat(material.aniso); |
---|
| 2274 | + anisoVField.setFloat(material.anisoV); |
---|
| 2275 | + |
---|
| 2276 | + materialtouched = true; |
---|
| 2277 | + applySelf(); |
---|
| 2278 | + } |
---|
| 2279 | + }); |
---|
| 2280 | + presetpanel.add(aniso); |
---|
| 2281 | + |
---|
| 2282 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF); |
---|
| 2283 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2284 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2285 | + { |
---|
| 2286 | + public void mouseClicked(MouseEvent e) |
---|
| 2287 | + { |
---|
| 2288 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2289 | + cMaterial material = object.material; |
---|
| 2290 | + |
---|
| 2291 | + anisoField.setFloat(material.aniso); |
---|
| 2292 | + anisoVField.setFloat(material.anisoV); |
---|
| 2293 | + |
---|
| 2294 | + materialtouched = true; |
---|
| 2295 | + applySelf(); |
---|
| 2296 | + } |
---|
| 2297 | + }); |
---|
| 2298 | + presetpanel.add(aniso2); |
---|
| 2299 | + |
---|
| 2300 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF); |
---|
| 2301 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2302 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2303 | + { |
---|
| 2304 | + public void mouseClicked(MouseEvent e) |
---|
| 2305 | + { |
---|
| 2306 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2307 | + cMaterial material = object.material; |
---|
| 2308 | + |
---|
| 2309 | + anisoField.setFloat(material.aniso); |
---|
| 2310 | + anisoVField.setFloat(material.anisoV); |
---|
| 2311 | + |
---|
| 2312 | + materialtouched = true; |
---|
| 2313 | + applySelf(); |
---|
| 2314 | + } |
---|
| 2315 | + }); |
---|
| 2316 | + presetpanel.add(aniso3); |
---|
| 2317 | + |
---|
| 2318 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF); |
---|
| 2319 | + velvet0.setToolTipText("Velvet"); |
---|
| 2320 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2321 | + { |
---|
| 2322 | + public void mouseClicked(MouseEvent e) |
---|
| 2323 | + { |
---|
| 2324 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2325 | + cMaterial material = object.material; |
---|
| 2326 | + |
---|
| 2327 | + diffusenessField.setFloat(material.factor); |
---|
| 2328 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2329 | + sheenField.setFloat(material.sheen); |
---|
| 2330 | + shininessField.setFloat(material.shininess); |
---|
| 2331 | + velvetField.setFloat(material.velvet); |
---|
| 2332 | + shiftField.setFloat(material.shift); |
---|
| 2333 | + |
---|
| 2334 | + materialtouched = true; |
---|
| 2335 | + applySelf(); |
---|
| 2336 | + } |
---|
| 2337 | + }); |
---|
| 2338 | + presetpanel.add(velvet0); |
---|
| 2339 | + |
---|
| 2340 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF); |
---|
| 2341 | + bump0.setToolTipText("Bump texture"); |
---|
| 2342 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2343 | + { |
---|
| 2344 | + public void mouseClicked(MouseEvent e) |
---|
| 2345 | + { |
---|
| 2346 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2347 | + cMaterial material = object.material; |
---|
| 2348 | + |
---|
| 2349 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2350 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2351 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2352 | + |
---|
| 2353 | + materialtouched = true; |
---|
| 2354 | + applySelf(); |
---|
| 2355 | + } |
---|
| 2356 | + }); |
---|
| 2357 | + presetpanel.add(bump0); |
---|
| 2358 | + |
---|
| 2359 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF); |
---|
| 2360 | + borderShader.setToolTipText("Border fade"); |
---|
| 2361 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2362 | + { |
---|
| 2363 | + public void mouseClicked(MouseEvent e) |
---|
| 2364 | + { |
---|
| 2365 | + borderfadeField.setFloat(0.4); |
---|
| 2366 | + opacityField.setFloat(0.75); |
---|
| 2367 | + |
---|
| 2368 | + materialtouched = true; |
---|
| 2369 | + applySelf(); |
---|
| 2370 | + } |
---|
| 2371 | + }); |
---|
| 2372 | + presetpanel.add(borderShader); |
---|
| 2373 | + |
---|
| 2374 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF); |
---|
| 2375 | + halo.setToolTipText("Halo"); |
---|
| 2376 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2377 | + { |
---|
| 2378 | + public void mouseClicked(MouseEvent e) |
---|
| 2379 | + { |
---|
| 2380 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2381 | + cMaterial material = object.material; |
---|
| 2382 | + |
---|
| 2383 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2384 | + |
---|
| 2385 | + materialtouched = true; |
---|
| 2386 | + applySelf(); |
---|
| 2387 | + } |
---|
| 2388 | + }); |
---|
| 2389 | + presetpanel.add(halo); |
---|
| 2390 | + |
---|
| 2391 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF); |
---|
| 2392 | + candle.setToolTipText("Candle"); |
---|
| 2393 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2394 | + { |
---|
| 2395 | + public void mouseClicked(MouseEvent e) |
---|
| 2396 | + { |
---|
| 2397 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2398 | + cMaterial material = object.material; |
---|
| 2399 | + |
---|
| 2400 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2401 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2402 | + ambientField.setFloat(material.ambient); |
---|
| 2403 | + specularField.setFloat(material.specular); |
---|
| 2404 | + lightareaField.setFloat(material.lightarea); |
---|
| 2405 | + shininessField.setFloat(material.shininess); |
---|
| 2406 | + |
---|
| 2407 | + materialtouched = true; |
---|
| 2408 | + applySelf(); |
---|
| 2409 | + } |
---|
| 2410 | + }); |
---|
| 2411 | + presetpanel.add(candle); |
---|
| 2412 | + |
---|
| 2413 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF); |
---|
| 2414 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2415 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2416 | + { |
---|
| 2417 | + public void mouseClicked(MouseEvent e) |
---|
| 2418 | + { |
---|
| 2419 | + diffuseField.setFloat(0.001); |
---|
| 2420 | + ambientField.setFloat(0.001); |
---|
| 2421 | + cameraField.setFloat(0.001); |
---|
| 2422 | + specularField.setFloat(0.001); |
---|
| 2423 | + fakedepthField.setFloat(0.001); |
---|
| 2424 | + opacityField.setFloat(0.6); |
---|
| 2425 | + |
---|
| 2426 | + materialtouched = true; |
---|
| 2427 | + applySelf(); |
---|
| 2428 | + } |
---|
| 2429 | + }); |
---|
| 2430 | + presetpanel.add(shadowShader); |
---|
| 2431 | + |
---|
| 2432 | + cLabel para0 = GetLabel("icons/shadericons/parallax0.png", !Globals.NIMBUSLAF); |
---|
| 2433 | + para0.setToolTipText("No parallax"); |
---|
| 2434 | + para0.addMouseListener(new MouseAdapter() |
---|
| 2435 | + { |
---|
| 2436 | + public void mouseClicked(MouseEvent e) |
---|
| 2437 | + { |
---|
| 2438 | + parallaxField.setFloat(0.125); |
---|
| 2439 | + |
---|
| 2440 | + materialtouched = true; |
---|
| 2441 | + applySelf(); |
---|
| 2442 | + } |
---|
| 2443 | + }); |
---|
| 2444 | + presetpanel.add(para0); |
---|
| 2445 | + |
---|
| 2446 | + cLabel para1 = GetLabel("icons/shadericons/parallax1.png", !Globals.NIMBUSLAF); |
---|
| 2447 | + para1.setToolTipText("With parallax"); |
---|
| 2448 | + para1.addMouseListener(new MouseAdapter() |
---|
| 2449 | + { |
---|
| 2450 | + public void mouseClicked(MouseEvent e) |
---|
| 2451 | + { |
---|
| 2452 | + parallaxField.setFloat(0.13); |
---|
| 2453 | + |
---|
| 2454 | + materialtouched = true; |
---|
| 2455 | + applySelf(); |
---|
| 2456 | + } |
---|
| 2457 | + }); |
---|
| 2458 | + presetpanel.add(para1); |
---|
| 2459 | + |
---|
| 2460 | + cLabel para2 = GetLabel("icons/shadericons/parallax2.png", !Globals.NIMBUSLAF); |
---|
| 2461 | + para2.setToolTipText("Reset parallax"); |
---|
| 2462 | + para2.addMouseListener(new MouseAdapter() |
---|
| 2463 | + { |
---|
| 2464 | + public void mouseClicked(MouseEvent e) |
---|
| 2465 | + { |
---|
| 2466 | + parallaxField.setFloat(0.14); |
---|
| 2467 | + |
---|
| 2468 | + materialtouched = true; |
---|
| 2469 | + applySelf(); |
---|
| 2470 | + } |
---|
| 2471 | + }); |
---|
| 2472 | + presetpanel.add(para2); |
---|
| 2473 | + |
---|
| 2474 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2475 | + |
---|
| 2476 | + presetpanel.preferredWidth = 1; |
---|
| 2477 | + |
---|
| 2478 | + materialpanel.add(presetpanel); |
---|
| 2479 | + materialpanel.add(panel); |
---|
| 2480 | + |
---|
| 2481 | + panel.preferredWidth = 8; |
---|
| 2482 | + |
---|
| 2483 | + /* |
---|
1441 | 2484 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1442 | 2485 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1443 | | - */ |
---|
| 2486 | + */ |
---|
1444 | 2487 | |
---|
1445 | 2488 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1446 | 2489 | |
---|
1447 | | - editBar.add(createMaterialButton = new cButton("Create", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 2490 | + editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1448 | 2491 | createMaterialButton.setToolTipText("Create material"); |
---|
1449 | 2492 | |
---|
1450 | 2493 | /* |
---|
1451 | 2494 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1452 | 2495 | */ |
---|
1453 | 2496 | |
---|
1454 | | - editBar.add(clearMaterialButton = new cButton("Clear", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 2497 | + editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1455 | 2498 | clearMaterialButton.setToolTipText("Clear material"); |
---|
1456 | 2499 | |
---|
1457 | | - editBar.add(resetSlidersButton = new cButton("Reset", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
1458 | | - editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1459 | | - editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 2500 | + if (Globals.ADVANCED) |
---|
| 2501 | + { |
---|
| 2502 | + editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
| 2503 | + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
| 2504 | + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 2505 | + } |
---|
1460 | 2506 | |
---|
1461 | 2507 | editBar.preferredHeight = 15; |
---|
1462 | 2508 | |
---|
.. | .. |
---|
1471 | 2517 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1472 | 2518 | |
---|
1473 | 2519 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 2520 | + |
---|
| 2521 | + cGridBag huepanel = new cGridBag(); |
---|
| 2522 | + cGridBag huelabel = new cGridBag(); |
---|
| 2523 | + cLabel hue = GetLabel("icons/hue.png", false); |
---|
| 2524 | + hue.fit = true; |
---|
| 2525 | + |
---|
| 2526 | + hue.addMouseListener(new MouseAdapter() |
---|
| 2527 | + { |
---|
| 2528 | + public void mousePressed(MouseEvent e) |
---|
| 2529 | + { |
---|
| 2530 | + int x = e.getX(); |
---|
| 2531 | + |
---|
| 2532 | + colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth()); |
---|
| 2533 | + } |
---|
| 2534 | + }); |
---|
| 2535 | + |
---|
| 2536 | + huelabel.add(hue); |
---|
| 2537 | + huelabel.preferredWidth = 20; |
---|
| 2538 | + huepanel.add(new cGridBag()); // Label |
---|
| 2539 | + huepanel.add(huelabel); // Field/slider |
---|
| 2540 | + |
---|
| 2541 | + huepanel.preferredHeight = 7; |
---|
| 2542 | + |
---|
| 2543 | + colorSection.add(huepanel); |
---|
1474 | 2544 | |
---|
1475 | 2545 | cGridBag color = new cGridBag(); |
---|
1476 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1477 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1478 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2546 | + |
---|
| 2547 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 2548 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2549 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2550 | + |
---|
1479 | 2551 | //colorField.preferredWidth = 200; |
---|
1480 | 2552 | colorSection.add(color); |
---|
1481 | 2553 | |
---|
1482 | 2554 | cGridBag modulation = new cGridBag(); |
---|
1483 | 2555 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1484 | 2556 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1485 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2557 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1486 | 2558 | colorSection.add(modulation); |
---|
1487 | 2559 | |
---|
| 2560 | + cGridBag opacity = new cGridBag(); |
---|
| 2561 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 2562 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2563 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2564 | + colorSection.add(opacity); |
---|
| 2565 | + |
---|
| 2566 | + colorSection.add(GetSeparator()); |
---|
| 2567 | + |
---|
1488 | 2568 | cGridBag texture = new cGridBag(); |
---|
1489 | 2569 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1490 | 2570 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1491 | 2571 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1492 | 2572 | colorSection.add(texture); |
---|
1493 | 2573 | |
---|
1494 | | - cGridBag anisoU = new cGridBag(); |
---|
1495 | | - anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
1496 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1497 | | - anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1498 | | - colorSection.add(anisoU); |
---|
1499 | | - |
---|
1500 | | - cGridBag anisoV = new cGridBag(); |
---|
1501 | | - anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
1502 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1503 | | - anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1504 | | - colorSection.add(anisoV); |
---|
1505 | | - |
---|
1506 | | - cGridBag shadowbias = new cGridBag(); |
---|
1507 | | - shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
1508 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1509 | | - shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1510 | | - colorSection.add(shadowbias); |
---|
1511 | | - |
---|
1512 | | - panel.add(new JSeparator()); |
---|
| 2574 | + panel.add(GetSeparator()); |
---|
1513 | 2575 | |
---|
1514 | 2576 | panel.add(colorSection); |
---|
1515 | 2577 | |
---|
.. | .. |
---|
1559 | 2621 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1560 | 2622 | diffuseSection.add(fakedepth); |
---|
1561 | 2623 | |
---|
1562 | | - panel.add(new JSeparator()); |
---|
| 2624 | + cGridBag shadowbias = new cGridBag(); |
---|
| 2625 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 2626 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2627 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2628 | + diffuseSection.add(shadowbias); |
---|
| 2629 | + |
---|
| 2630 | + panel.add(GetSeparator()); |
---|
1563 | 2631 | |
---|
1564 | 2632 | panel.add(diffuseSection); |
---|
1565 | 2633 | |
---|
.. | .. |
---|
1609 | 2677 | // aConstraints.gridy += 1; |
---|
1610 | 2678 | // aConstraints.gridwidth = 1; |
---|
1611 | 2679 | |
---|
| 2680 | + cGridBag anisoU = new cGridBag(); |
---|
| 2681 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 2682 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2683 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2684 | + specularSection.add(anisoU); |
---|
1612 | 2685 | |
---|
1613 | | - panel.add(new JSeparator()); |
---|
| 2686 | + cGridBag anisoV = new cGridBag(); |
---|
| 2687 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 2688 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2689 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2690 | + specularSection.add(anisoV); |
---|
| 2691 | + |
---|
| 2692 | + |
---|
| 2693 | + panel.add(GetSeparator()); |
---|
1614 | 2694 | |
---|
1615 | 2695 | panel.add(specularSection); |
---|
1616 | 2696 | |
---|
1617 | 2697 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1618 | 2698 | |
---|
1619 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 2699 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1620 | 2700 | |
---|
1621 | 2701 | cGridBag camera = new cGridBag(); |
---|
1622 | 2702 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1623 | 2703 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1624 | 2704 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1625 | | - globalSection.add(camera); |
---|
| 2705 | + colorSection.add(camera); |
---|
1626 | 2706 | |
---|
1627 | 2707 | cGridBag ambient = new cGridBag(); |
---|
1628 | 2708 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1629 | 2709 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1630 | 2710 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1631 | | - globalSection.add(ambient); |
---|
| 2711 | + colorSection.add(ambient); |
---|
1632 | 2712 | |
---|
1633 | 2713 | cGridBag backlit = new cGridBag(); |
---|
1634 | 2714 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1635 | 2715 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1636 | 2716 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1637 | | - globalSection.add(backlit); |
---|
| 2717 | + colorSection.add(backlit); |
---|
1638 | 2718 | |
---|
1639 | | - cGridBag opacity = new cGridBag(); |
---|
1640 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1641 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1642 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1643 | | - globalSection.add(opacity); |
---|
1644 | | - |
---|
1645 | | - panel.add(new JSeparator()); |
---|
| 2719 | + cGridBag parallax = new cGridBag(); |
---|
| 2720 | + parallax.add(parallaxLabel = new JLabel("Parallax")); // , aConstraints); |
---|
| 2721 | + parallaxLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2722 | + parallax.add(parallaxField = new cNumberSlider(this, 0.001, 0.25, -0.125)); // , aConstraints); |
---|
| 2723 | + colorSection.add(parallax); |
---|
1646 | 2724 | |
---|
1647 | | - panel.add(globalSection); |
---|
| 2725 | + //panel.add(new JSeparator()); |
---|
| 2726 | + |
---|
| 2727 | + //panel.add(globalSection); |
---|
1648 | 2728 | |
---|
1649 | 2729 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1650 | 2730 | |
---|
.. | .. |
---|
1686 | 2766 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1687 | 2767 | textureSection.add(opacityPower); |
---|
1688 | 2768 | |
---|
1689 | | - panel.add(new JSeparator()); |
---|
| 2769 | + panel.add(GetSeparator()); |
---|
1690 | 2770 | |
---|
1691 | 2771 | panel.add(textureSection); |
---|
1692 | 2772 | |
---|
.. | .. |
---|
1725 | 2805 | opacityPowerField.addChangeListener(this); |
---|
1726 | 2806 | /**/ |
---|
1727 | 2807 | |
---|
1728 | | - resetSlidersButton.addActionListener(this); |
---|
1729 | 2808 | clearMaterialButton.addActionListener(this); |
---|
1730 | 2809 | createMaterialButton.addActionListener(this); |
---|
1731 | | - |
---|
1732 | | - propagateToggle.addItemListener(this); |
---|
1733 | | - multiplyToggle.addItemListener(this); |
---|
| 2810 | + |
---|
| 2811 | + if (Globals.ADVANCED) |
---|
| 2812 | + { |
---|
| 2813 | + resetSlidersButton.addActionListener(this); |
---|
| 2814 | + propagateToggle.addItemListener(this); |
---|
| 2815 | + multiplyToggle.addItemListener(this); |
---|
| 2816 | + } |
---|
1734 | 2817 | } |
---|
1735 | 2818 | |
---|
1736 | 2819 | void DropFile(java.io.File[] files, boolean textures) |
---|
.. | .. |
---|
1748 | 2831 | // 3D models |
---|
1749 | 2832 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1750 | 2833 | { |
---|
1751 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1752 | | - LoadFile(filename, lastConverter); |
---|
| 2834 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2835 | + //LoadFile(filename, lastConverter); |
---|
| 2836 | + LoadObjFile(filename); // New 3ds loader |
---|
1753 | 2837 | continue; |
---|
1754 | 2838 | } |
---|
1755 | 2839 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
1901 | 2985 | |
---|
1902 | 2986 | //? flashIt = false; |
---|
1903 | 2987 | CameraPane pane = (CameraPane) cameraView; |
---|
1904 | | - pane.clickStart(location.x, location.y, 0); |
---|
| 2988 | + pane.clickStart(location.x, location.y, 0, 0); |
---|
1905 | 2989 | pane.clickEnd(location.x, location.y, 0, true); |
---|
1906 | 2990 | |
---|
1907 | 2991 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
1950 | 3034 | e2.printStackTrace(); |
---|
1951 | 3035 | } |
---|
1952 | 3036 | } |
---|
| 3037 | + |
---|
1953 | 3038 | LoadJMEThread loadThread; |
---|
1954 | 3039 | |
---|
1955 | 3040 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
2007 | 3092 | //LoadFile0(filename, converter); |
---|
2008 | 3093 | } |
---|
2009 | 3094 | } |
---|
| 3095 | + |
---|
2010 | 3096 | LoadOBJThread loadObjThread; |
---|
2011 | 3097 | |
---|
2012 | 3098 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2085 | 3171 | |
---|
2086 | 3172 | void LoadObjFile(String fullname) |
---|
2087 | 3173 | { |
---|
2088 | | - /* |
---|
| 3174 | + System.out.println("Loading " + fullname); |
---|
| 3175 | + /**/ |
---|
2089 | 3176 | //lastFilename = fullname; |
---|
2090 | 3177 | if(loadObjThread == null) |
---|
2091 | 3178 | { |
---|
2092 | | - loadObjThread = new LoadOBJThread(); |
---|
2093 | | - loadObjThread.start(); |
---|
| 3179 | + loadObjThread = new LoadOBJThread(); |
---|
| 3180 | + loadObjThread.start(); |
---|
2094 | 3181 | } |
---|
2095 | 3182 | |
---|
2096 | 3183 | loadObjThread.add(fullname); |
---|
2097 | | - */ |
---|
| 3184 | + /**/ |
---|
2098 | 3185 | |
---|
2099 | | - System.out.println("Loading " + fullname); |
---|
2100 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 3186 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2101 | 3187 | } |
---|
2102 | 3188 | |
---|
2103 | 3189 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2358 | 3444 | |
---|
2359 | 3445 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2360 | 3446 | { |
---|
2361 | | - if (GrafreeD.standAlone) |
---|
| 3447 | + if (Grafreed.standAlone) |
---|
2362 | 3448 | { |
---|
2363 | 3449 | /**/ |
---|
2364 | 3450 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2365 | | - browser.show(); |
---|
| 3451 | + browser.setVisible(true); |
---|
2366 | 3452 | String filename = browser.getFile(); |
---|
2367 | 3453 | if (filename != null && filename.length() > 0) |
---|
2368 | 3454 | { |
---|
.. | .. |
---|
2473 | 3559 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2474 | 3560 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2475 | 3561 | } |
---|
| 3562 | + |
---|
2476 | 3563 | //cJME.count++; |
---|
2477 | 3564 | //cJME.count %= 12; |
---|
2478 | 3565 | if (gc) |
---|
.. | .. |
---|
2656 | 3743 | } |
---|
2657 | 3744 | } |
---|
2658 | 3745 | } |
---|
| 3746 | + |
---|
2659 | 3747 | cFileSystemPane FSPane; |
---|
2660 | 3748 | |
---|
2661 | 3749 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2665 | 3753 | |
---|
2666 | 3754 | freezematerial = true; |
---|
2667 | 3755 | colorField.setFloat(mat.color); |
---|
2668 | | - modulationField.setFloat(mat.modulation); |
---|
| 3756 | + saturationField.setFloat(mat.modulation); |
---|
2669 | 3757 | metalnessField.setFloat(mat.metalness); |
---|
2670 | 3758 | diffuseField.setFloat(mat.diffuse); |
---|
2671 | 3759 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
2685 | 3773 | shadowField.setFloat(mat.shadow); |
---|
2686 | 3774 | textureField.setFloat(mat.texture); |
---|
2687 | 3775 | opacityField.setFloat(mat.opacity); |
---|
| 3776 | + parallaxField.setFloat(mat.parallax + 0.125f); |
---|
2688 | 3777 | fakedepthField.setFloat(mat.fakedepth); |
---|
2689 | 3778 | shadowbiasField.setFloat(mat.shadowbias); |
---|
2690 | 3779 | bumpField.setInteger(1); // dec 2013 |
---|
.. | .. |
---|
2709 | 3798 | } |
---|
2710 | 3799 | } |
---|
2711 | 3800 | } |
---|
| 3801 | + |
---|
2712 | 3802 | freezematerial = false; |
---|
2713 | 3803 | } |
---|
2714 | 3804 | |
---|
2715 | 3805 | void SetMaterial(Object3D object) |
---|
2716 | 3806 | { |
---|
| 3807 | + latestObject = object; |
---|
| 3808 | + |
---|
2717 | 3809 | cMaterial mat = object.material; |
---|
2718 | 3810 | |
---|
2719 | 3811 | if (mat == null) |
---|
.. | .. |
---|
2722 | 3814 | return; |
---|
2723 | 3815 | } |
---|
2724 | 3816 | |
---|
2725 | | - multiplyToggle.setSelected(mat.multiply); |
---|
2726 | | - |
---|
2727 | | - assert (object.projectedVertices != null); |
---|
2728 | | - |
---|
2729 | | - if (object.projectedVertices.length <= 2) |
---|
2730 | | - { |
---|
2731 | | - // Side effect... |
---|
2732 | | - Object3D.cVector2[] keep = object.projectedVertices; |
---|
2733 | | - object.projectedVertices = new Object3D.cVector2[3]; |
---|
2734 | | - for (int i = 0; i < 3; i++) |
---|
2735 | | - { |
---|
2736 | | - if (i < keep.length) |
---|
2737 | | - { |
---|
2738 | | - object.projectedVertices[i] = keep[i]; |
---|
2739 | | - } else |
---|
2740 | | - { |
---|
2741 | | - object.projectedVertices[i] = new Object3D.cVector2(); |
---|
2742 | | - } |
---|
2743 | | - /* |
---|
2744 | | - if(keep.length == 0) |
---|
2745 | | - object.projectedVertices[0] = new Object3D.cVector2(); |
---|
2746 | | - else |
---|
2747 | | - object.projectedVertices[0] = keep[0]; |
---|
2748 | | - object.projectedVertices[1] = new Object3D.cVector2(); |
---|
2749 | | - */ |
---|
2750 | | - } |
---|
2751 | | - } |
---|
| 3817 | + if (multiplyToggle != null) |
---|
| 3818 | + multiplyToggle.setSelected(mat.multiply); |
---|
| 3819 | + |
---|
| 3820 | + AllocProjectedVertices(object); |
---|
2752 | 3821 | |
---|
2753 | 3822 | SetMaterial(mat, object.projectedVertices); |
---|
2754 | 3823 | } |
---|
.. | .. |
---|
2824 | 3893 | // } |
---|
2825 | 3894 | |
---|
2826 | 3895 | /**/ |
---|
2827 | | - if (deselect) |
---|
| 3896 | + if (deselect || child == null) |
---|
2828 | 3897 | { |
---|
2829 | 3898 | //group.deselectAll(); |
---|
2830 | 3899 | //freeze = true; |
---|
2831 | 3900 | GetTree().clearSelection(); |
---|
2832 | 3901 | //freeze = false; |
---|
| 3902 | + |
---|
| 3903 | + if (child == null) |
---|
| 3904 | + { |
---|
| 3905 | + return; |
---|
| 3906 | + } |
---|
2833 | 3907 | } |
---|
2834 | 3908 | |
---|
2835 | 3909 | //group.addSelectee(child); |
---|
.. | .. |
---|
2863 | 3937 | public void itemStateChanged(ItemEvent event) |
---|
2864 | 3938 | { |
---|
2865 | 3939 | // System.out.println("Propagate = " + propagate); |
---|
| 3940 | + if (event.getSource() == pinButton) |
---|
| 3941 | + { |
---|
| 3942 | + copy.pinned ^= true; |
---|
| 3943 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3944 | + { |
---|
| 3945 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3946 | + copy.CloseUI(); |
---|
| 3947 | + //copy.editWindow.refreshContents(); |
---|
| 3948 | + } |
---|
| 3949 | + } |
---|
| 3950 | + else |
---|
2866 | 3951 | if (event.getSource() == propagateToggle) |
---|
2867 | 3952 | { |
---|
2868 | 3953 | propagate ^= true; |
---|
.. | .. |
---|
2898 | 3983 | cameraView.ToggleDL(); |
---|
2899 | 3984 | cameraView.repaint(); |
---|
2900 | 3985 | return; |
---|
2901 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3986 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2902 | 3987 | { |
---|
2903 | 3988 | cameraView.ToggleTexture(); |
---|
2904 | 3989 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2937 | 4022 | frame.validate(); |
---|
2938 | 4023 | |
---|
2939 | 4024 | return; |
---|
2940 | | - } else if (event.getSource() == toggleRandomItem) |
---|
| 4025 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2941 | 4026 | { |
---|
2942 | | - cameraView.ToggleRandom(); |
---|
| 4027 | + cameraView.ToggleSwitch(); |
---|
2943 | 4028 | cameraView.repaint(); |
---|
2944 | 4029 | return; |
---|
2945 | 4030 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
2967 | 4052 | } else if (event.getSource() == liveCB) |
---|
2968 | 4053 | { |
---|
2969 | 4054 | copy.live ^= true; |
---|
| 4055 | + objEditor.refreshContents(true); // To show item colors |
---|
| 4056 | + return; |
---|
| 4057 | + } else if (event.getSource() == selectableCB) |
---|
| 4058 | + { |
---|
| 4059 | + copy.dontselect ^= true; |
---|
2970 | 4060 | return; |
---|
2971 | 4061 | } else if (event.getSource() == hideCB) |
---|
2972 | 4062 | { |
---|
2973 | 4063 | copy.hide ^= true; |
---|
2974 | 4064 | copy.Touch(); // display list issue |
---|
2975 | | - objEditor.refreshContents(); |
---|
| 4065 | + objEditor.refreshContents(true); // To show item colors |
---|
2976 | 4066 | return; |
---|
2977 | 4067 | } else if (event.getSource() == link2masterCB) |
---|
2978 | 4068 | { |
---|
.. | .. |
---|
2982 | 4072 | if (event.getSource() == randomCB) |
---|
2983 | 4073 | { |
---|
2984 | 4074 | copy.random ^= true; |
---|
| 4075 | + objEditor.refreshContents(); |
---|
2985 | 4076 | return; |
---|
2986 | 4077 | } |
---|
2987 | 4078 | if (event.getSource() == speedupCB) |
---|
.. | .. |
---|
3005 | 4096 | |
---|
3006 | 4097 | public void actionPerformed(ActionEvent event) |
---|
3007 | 4098 | { |
---|
| 4099 | + Object source = event.getSource(); |
---|
3008 | 4100 | // SCRIPT DIALOG |
---|
3009 | | - if (event.getSource() == okbutton) |
---|
| 4101 | + if (source == okbutton) |
---|
3010 | 4102 | { |
---|
3011 | 4103 | textpanel.setVisible(false); |
---|
3012 | 4104 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3018 | 4110 | textarea = null; |
---|
3019 | 4111 | textpanel = null; |
---|
3020 | 4112 | } |
---|
3021 | | - if (event.getSource() == cancelbutton) |
---|
| 4113 | + if (source == cancelbutton) |
---|
3022 | 4114 | { |
---|
3023 | 4115 | textpanel.setVisible(false); |
---|
3024 | 4116 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3030 | 4122 | //applySelf(); |
---|
3031 | 4123 | //client.refreshEditWindow(); |
---|
3032 | 4124 | //refreshContents(); |
---|
3033 | | - if (event.getSource() == nameField) |
---|
| 4125 | + if (source == nameField) |
---|
3034 | 4126 | { |
---|
3035 | 4127 | //System.out.println("ObjEditor " + event); |
---|
3036 | 4128 | applySelf0(true); |
---|
3037 | 4129 | //parent.applySelf(); |
---|
3038 | | - objEditor.refreshContents(); |
---|
3039 | | - } else if (event.getSource() == resetButton) |
---|
| 4130 | + // conflicts with requestFocus objEditor.refreshContents(); |
---|
| 4131 | + } else if (source == resetButton) |
---|
3040 | 4132 | { |
---|
3041 | 4133 | CameraPane.fullreset = true; |
---|
3042 | 4134 | copy.Reset(); // ResetMeshes(); |
---|
3043 | 4135 | copy.Touch(); |
---|
3044 | 4136 | objEditor.refreshContents(); |
---|
3045 | | - } else if (event.getSource() == stepItem) |
---|
| 4137 | + } else if (source == stepItem) |
---|
3046 | 4138 | { |
---|
3047 | 4139 | //cameraView.ONESTEP = true; |
---|
3048 | 4140 | Globals.ONESTEP = true; |
---|
3049 | 4141 | cameraView.repaint(); |
---|
3050 | 4142 | return; |
---|
3051 | | - } else if (event.getSource() == stepButton) |
---|
| 4143 | + } else if (source == stepButton) |
---|
3052 | 4144 | { |
---|
3053 | 4145 | copy.Step(); |
---|
3054 | 4146 | copy.Touch(); |
---|
3055 | 4147 | objEditor.refreshContents(); |
---|
3056 | | - } else if (event.getSource() == slowerButton) |
---|
| 4148 | + } else if (source == slowerButton) |
---|
3057 | 4149 | { |
---|
3058 | 4150 | copy.Slower(); |
---|
3059 | 4151 | copy.Touch(); |
---|
3060 | 4152 | objEditor.refreshContents(); |
---|
3061 | | - } else if (event.getSource() == fasterButton) |
---|
| 4153 | + } else if (source == fasterButton) |
---|
3062 | 4154 | { |
---|
3063 | 4155 | copy.Faster(); |
---|
3064 | 4156 | copy.Touch(); |
---|
3065 | 4157 | objEditor.refreshContents(); |
---|
3066 | | - } else if (event.getSource() == remarkButton) |
---|
| 4158 | + } else if (source == remarkButton) |
---|
3067 | 4159 | { |
---|
3068 | 4160 | copy.Remark(); |
---|
3069 | 4161 | copy.Touch(); |
---|
3070 | 4162 | objEditor.refreshContents(); |
---|
3071 | | - } else if (event.getSource() == stepAllButton) |
---|
| 4163 | + } else if (source == stepAllButton) |
---|
3072 | 4164 | { |
---|
3073 | 4165 | copy.StepAll(); |
---|
3074 | 4166 | copy.Touch(); |
---|
3075 | 4167 | objEditor.refreshContents(); |
---|
3076 | | - } else if (event.getSource() == resetAllButton) |
---|
| 4168 | + } else if (source == resetAllButton) |
---|
3077 | 4169 | { |
---|
3078 | 4170 | //CameraPane.fullreset = true; |
---|
3079 | 4171 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3106 | 4198 | // Close(); |
---|
3107 | 4199 | // } |
---|
3108 | 4200 | // else |
---|
3109 | | - if (event.getSource() == resetSlidersButton) |
---|
| 4201 | + if (source == resetSlidersButton) |
---|
3110 | 4202 | { |
---|
3111 | 4203 | ResetSliders(); |
---|
3112 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 4204 | + } else if (source == clearMaterialButton) |
---|
3113 | 4205 | { |
---|
3114 | 4206 | ClearMaterial(); |
---|
3115 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 4207 | + } else if (source == createMaterialButton) |
---|
3116 | 4208 | { |
---|
3117 | 4209 | CreateMaterial(); |
---|
3118 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 4210 | + } else if (source == clearPanelButton) |
---|
3119 | 4211 | { |
---|
3120 | 4212 | copy.ClearUI(); |
---|
3121 | 4213 | refreshContents(true); |
---|
3122 | | - } /* |
---|
3123 | | - } |
---|
3124 | | - |
---|
3125 | | - public boolean action(Event event, Object arg) |
---|
3126 | | - { |
---|
3127 | | - */ else if (event.getSource() == closeItem) |
---|
| 4214 | + } else if (source == importGFDItem) |
---|
| 4215 | + { |
---|
| 4216 | + ImportGFD(); |
---|
| 4217 | + } else |
---|
| 4218 | + if (source == importVRMLX3DItem) |
---|
| 4219 | + { |
---|
| 4220 | + ImportVRMLX3D(); |
---|
| 4221 | + } else |
---|
| 4222 | + if (source == import3DSItem) |
---|
| 4223 | + { |
---|
| 4224 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 4225 | + } else |
---|
| 4226 | + if (source == importOBJItem) |
---|
| 4227 | + { |
---|
| 4228 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 4229 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 4230 | + browser.setVisible(true); |
---|
| 4231 | + String filename = browser.getFile(); |
---|
| 4232 | + if (filename != null && filename.length() > 0) |
---|
| 4233 | + { |
---|
| 4234 | + String fullname = browser.getDirectory() + filename; |
---|
| 4235 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 4236 | + } |
---|
| 4237 | + } else |
---|
| 4238 | + if (source == closeItem) |
---|
3128 | 4239 | { |
---|
3129 | 4240 | Close(); |
---|
3130 | 4241 | //return true; |
---|
3131 | | - } else if (event.getSource() == loadItem) |
---|
| 4242 | + } else if (source == openItem) |
---|
3132 | 4243 | { |
---|
3133 | | - load(); |
---|
| 4244 | + Open(); |
---|
3134 | 4245 | //return true; |
---|
3135 | | - } else if (event.getSource() == saveItem) |
---|
| 4246 | + } else if (source == newItem) |
---|
| 4247 | + { |
---|
| 4248 | + New(); |
---|
| 4249 | + } else if (source == saveItem) |
---|
3136 | 4250 | { |
---|
3137 | 4251 | save(); |
---|
3138 | 4252 | //return true; |
---|
3139 | | - } else if (event.getSource() == saveAsItem) |
---|
| 4253 | + } else if (source == saveAsItem) |
---|
3140 | 4254 | { |
---|
3141 | 4255 | saveAs(); |
---|
3142 | 4256 | //return true; |
---|
3143 | | - } else if (event.getSource() == reexportItem) |
---|
| 4257 | + } else if (source == reexportItem) |
---|
3144 | 4258 | { |
---|
3145 | 4259 | reexport(); |
---|
3146 | 4260 | //return true; |
---|
3147 | | - } else if (event.getSource() == exportAsItem) |
---|
| 4261 | + } else if (source == exportAsItem) |
---|
3148 | 4262 | { |
---|
3149 | 4263 | export(); |
---|
3150 | 4264 | //return true; |
---|
3151 | | - } else if (event.getSource() == povItem) |
---|
| 4265 | + } else if (source == povItem) |
---|
3152 | 4266 | { |
---|
3153 | 4267 | generatePOV(); |
---|
3154 | 4268 | //return true; |
---|
3155 | | - } else if (event.getSource() == zBufferItem) |
---|
| 4269 | + } else if (event.getSource() == archiveItem) |
---|
| 4270 | + { |
---|
| 4271 | + cTools.Archive(frame); |
---|
| 4272 | + return; |
---|
| 4273 | + } else if (source == zBufferItem) |
---|
3156 | 4274 | { |
---|
3157 | 4275 | try |
---|
3158 | 4276 | { |
---|
.. | .. |
---|
3174 | 4292 | cameraView.repaint(); |
---|
3175 | 4293 | //return true; |
---|
3176 | 4294 | } |
---|
3177 | | - */ else if (event.getSource() == editCameraItem) |
---|
3178 | | - { |
---|
3179 | | - cameraView.ProtectCamera(); |
---|
3180 | | - cameraView.repaint(); |
---|
3181 | | - return; |
---|
3182 | | - } else if (event.getSource() == revertCameraItem) |
---|
3183 | | - { |
---|
3184 | | - cameraView.RevertCamera(); |
---|
3185 | | - cameraView.repaint(); |
---|
3186 | | - return; |
---|
3187 | | -// } else if (event.getSource() == textureButton) |
---|
3188 | | -// { |
---|
3189 | | -// return; // true; |
---|
3190 | | - } else // combos... |
---|
3191 | | - if (event.getSource() == texresMenu) |
---|
| 4295 | + */ else // combos... |
---|
| 4296 | + if (source == texresMenu) |
---|
3192 | 4297 | { |
---|
3193 | 4298 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3194 | 4299 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3200 | 4305 | } |
---|
3201 | 4306 | } |
---|
3202 | 4307 | |
---|
| 4308 | + void New() |
---|
| 4309 | + { |
---|
| 4310 | + while (copy.Size() > 0) |
---|
| 4311 | + { |
---|
| 4312 | + copy.remove(0); |
---|
| 4313 | + } |
---|
| 4314 | + |
---|
| 4315 | + copy.selection.clear(); |
---|
| 4316 | + |
---|
| 4317 | + if (copy == Grafreed.grafreed.universe) |
---|
| 4318 | + { |
---|
| 4319 | + CreateCameras(); |
---|
| 4320 | + cameraView.SetCamera(GetCamera(copy, 0)); |
---|
| 4321 | + } |
---|
| 4322 | + ResetModel(); |
---|
| 4323 | + objEditor.refreshContents(); |
---|
| 4324 | + } |
---|
| 4325 | + |
---|
| 4326 | + static public byte[] Compress(Object3D o) |
---|
| 4327 | + { |
---|
| 4328 | + // Slower to actually compress. |
---|
| 4329 | + try |
---|
| 4330 | + { |
---|
| 4331 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 4332 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 4333 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
| 4334 | + |
---|
| 4335 | + Object3D parent = o.parent; |
---|
| 4336 | + o.parent = null; |
---|
| 4337 | + |
---|
| 4338 | + out.writeObject(o); |
---|
| 4339 | + |
---|
| 4340 | + o.parent = parent; |
---|
| 4341 | + |
---|
| 4342 | + out.flush(); |
---|
| 4343 | + |
---|
| 4344 | + baos //zstream |
---|
| 4345 | + .close(); |
---|
| 4346 | + out.close(); |
---|
| 4347 | + |
---|
| 4348 | + byte[] bytes = baos.toByteArray(); |
---|
| 4349 | + |
---|
| 4350 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 4351 | + return bytes; |
---|
| 4352 | + } catch (Exception e) |
---|
| 4353 | + { |
---|
| 4354 | + System.err.println(e); |
---|
| 4355 | + return null; |
---|
| 4356 | + } |
---|
| 4357 | + } |
---|
| 4358 | + |
---|
| 4359 | + static public Object Uncompress(byte[] bytes) |
---|
| 4360 | + { |
---|
| 4361 | + System.out.println("restore #bytes = " + bytes.length); |
---|
| 4362 | + try |
---|
| 4363 | + { |
---|
| 4364 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 4365 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 4366 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
| 4367 | + Object obj = in.readObject(); |
---|
| 4368 | + |
---|
| 4369 | + bais //istream |
---|
| 4370 | + .close(); |
---|
| 4371 | + in.close(); |
---|
| 4372 | + |
---|
| 4373 | + return obj; |
---|
| 4374 | + } catch (Exception e) |
---|
| 4375 | + { |
---|
| 4376 | + System.err.println(e); |
---|
| 4377 | + return null; |
---|
| 4378 | + } |
---|
| 4379 | + } |
---|
| 4380 | + |
---|
| 4381 | + static public Object clone(Object o) |
---|
| 4382 | + { |
---|
| 4383 | + try |
---|
| 4384 | + { |
---|
| 4385 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 4386 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 4387 | + |
---|
| 4388 | + out.writeObject(o); |
---|
| 4389 | + |
---|
| 4390 | + out.flush(); |
---|
| 4391 | + out.close(); |
---|
| 4392 | + |
---|
| 4393 | + byte[] bytes = baos.toByteArray(); |
---|
| 4394 | + |
---|
| 4395 | + System.out.println("clone = " + bytes.length); |
---|
| 4396 | + |
---|
| 4397 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 4398 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 4399 | + Object obj = in.readObject(); |
---|
| 4400 | + in.close(); |
---|
| 4401 | + |
---|
| 4402 | + return obj; |
---|
| 4403 | + } catch (Exception e) |
---|
| 4404 | + { |
---|
| 4405 | + System.err.println(e); |
---|
| 4406 | + return null; |
---|
| 4407 | + } |
---|
| 4408 | + } |
---|
| 4409 | + |
---|
| 4410 | + cRadio GetCurrentTab() |
---|
| 4411 | + { |
---|
| 4412 | + cRadio ab; |
---|
| 4413 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 4414 | + { |
---|
| 4415 | + ab = (cRadio)e.nextElement(); |
---|
| 4416 | + if(ab.GetObject() == copy) |
---|
| 4417 | + { |
---|
| 4418 | + return ab; |
---|
| 4419 | + } |
---|
| 4420 | + } |
---|
| 4421 | + |
---|
| 4422 | + return null; |
---|
| 4423 | + } |
---|
| 4424 | + |
---|
| 4425 | + |
---|
| 4426 | + public void Save() |
---|
| 4427 | + { |
---|
| 4428 | + //Save(true); |
---|
| 4429 | + Replace(); |
---|
| 4430 | + SetVersionStates(); |
---|
| 4431 | + } |
---|
| 4432 | + |
---|
| 4433 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 4434 | + { |
---|
| 4435 | + if (compress.length != name.length) |
---|
| 4436 | + { |
---|
| 4437 | + return false; |
---|
| 4438 | + } |
---|
| 4439 | + |
---|
| 4440 | + for (int i=compress.length; --i>=0;) |
---|
| 4441 | + { |
---|
| 4442 | + if (compress[i] != name[i]) |
---|
| 4443 | + return false; |
---|
| 4444 | + } |
---|
| 4445 | + |
---|
| 4446 | + return true; |
---|
| 4447 | + } |
---|
| 4448 | + |
---|
| 4449 | + void DeleteVersion() |
---|
| 4450 | + { |
---|
| 4451 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4452 | + { |
---|
| 4453 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4454 | + } |
---|
| 4455 | + |
---|
| 4456 | + if (copy.versionlist[copy.versionindex] == null) |
---|
| 4457 | + copy.versionindex -= 1; |
---|
| 4458 | + |
---|
| 4459 | + if (copy.versionindex != -1) |
---|
| 4460 | + CopyChanged(); |
---|
| 4461 | + |
---|
| 4462 | + SetVersionStates(); |
---|
| 4463 | + } |
---|
| 4464 | + |
---|
| 4465 | + public boolean Save(boolean user) |
---|
| 4466 | + { |
---|
| 4467 | + System.err.println("Save"); |
---|
| 4468 | + Replace(); |
---|
| 4469 | + |
---|
| 4470 | + if (copy.versionlist == null) |
---|
| 4471 | + { |
---|
| 4472 | + copy.versionlist = new Object3D[100]; |
---|
| 4473 | + copy.versionindex = -1; |
---|
| 4474 | + } |
---|
| 4475 | + |
---|
| 4476 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
| 4477 | + |
---|
| 4478 | + boolean thesame = false; |
---|
| 4479 | + |
---|
| 4480 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4481 | +// { |
---|
| 4482 | +// thesame = true; |
---|
| 4483 | +// } |
---|
| 4484 | + |
---|
| 4485 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 4486 | + if (!thesame) |
---|
| 4487 | + { |
---|
| 4488 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4489 | + { |
---|
| 4490 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4491 | + } |
---|
| 4492 | + |
---|
| 4493 | + //tab.user[tab.versionindex] = user; |
---|
| 4494 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 4495 | + |
---|
| 4496 | + copy.versionlist[++copy.versionindex] = compress; |
---|
| 4497 | + |
---|
| 4498 | + // if (increment) |
---|
| 4499 | + // tab.versionindex++; |
---|
| 4500 | + } |
---|
| 4501 | + |
---|
| 4502 | + //copy.RestoreBigData(versiontable); |
---|
| 4503 | + |
---|
| 4504 | + //assert(hashtable.isEmpty()); |
---|
| 4505 | + |
---|
| 4506 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4507 | +// { |
---|
| 4508 | +// //tab.user[i] = false; |
---|
| 4509 | +// copy.versionlist[i] = null; |
---|
| 4510 | +// } |
---|
| 4511 | + |
---|
| 4512 | + SetVersionStates(); |
---|
| 4513 | + |
---|
| 4514 | + // test save |
---|
| 4515 | + if (false) |
---|
| 4516 | + { |
---|
| 4517 | + try |
---|
| 4518 | + { |
---|
| 4519 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
| 4520 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4521 | + |
---|
| 4522 | + p.writeObject(copy); |
---|
| 4523 | + |
---|
| 4524 | + p.flush(); |
---|
| 4525 | + |
---|
| 4526 | + ostream.close(); |
---|
| 4527 | + } catch (Exception e) |
---|
| 4528 | + { |
---|
| 4529 | + e.printStackTrace(); |
---|
| 4530 | + } |
---|
| 4531 | + } |
---|
| 4532 | + |
---|
| 4533 | + return !thesame; |
---|
| 4534 | + } |
---|
| 4535 | + |
---|
| 4536 | + boolean flashIt = true; |
---|
| 4537 | + |
---|
| 4538 | + void RefreshSelection() |
---|
| 4539 | + { |
---|
| 4540 | + Object3D selection = new Object3D(); |
---|
| 4541 | + |
---|
| 4542 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4543 | + { |
---|
| 4544 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 4545 | + |
---|
| 4546 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4547 | + |
---|
| 4548 | + if (obj == null) |
---|
| 4549 | + { |
---|
| 4550 | + copy.selection.remove(i--); |
---|
| 4551 | + } |
---|
| 4552 | + else |
---|
| 4553 | + { |
---|
| 4554 | + selection.add(obj); |
---|
| 4555 | + copy.selection.setElementAt(obj, i); |
---|
| 4556 | + } |
---|
| 4557 | + } |
---|
| 4558 | + |
---|
| 4559 | + flashIt = false; |
---|
| 4560 | + GetTree().clearSelection(); |
---|
| 4561 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4562 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4563 | + flashIt = true; |
---|
| 4564 | + |
---|
| 4565 | + //refreshContents(false); |
---|
| 4566 | + } |
---|
| 4567 | + |
---|
| 4568 | + void CopyChanged() |
---|
| 4569 | + { |
---|
| 4570 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4571 | + |
---|
| 4572 | + SetVersionStates(); |
---|
| 4573 | + |
---|
| 4574 | + boolean temp = CameraPane.SWITCH; |
---|
| 4575 | + CameraPane.SWITCH = false; |
---|
| 4576 | + |
---|
| 4577 | + copy.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 4578 | + |
---|
| 4579 | + copy.clear(); |
---|
| 4580 | + |
---|
| 4581 | + copy.skyboxname = obj.skyboxname; |
---|
| 4582 | + copy.skyboxext = obj.skyboxext; |
---|
| 4583 | + |
---|
| 4584 | + for (int i=0; i<obj.Size(); i++) |
---|
| 4585 | + { |
---|
| 4586 | + copy.add(obj.get(i)); |
---|
| 4587 | + } |
---|
| 4588 | + |
---|
| 4589 | + copy.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 4590 | + |
---|
| 4591 | + CameraPane.SWITCH = temp; |
---|
| 4592 | + |
---|
| 4593 | + RefreshSelection(); |
---|
| 4594 | + //assert(hashtable.isEmpty()); |
---|
| 4595 | + |
---|
| 4596 | + copy.Touch(); |
---|
| 4597 | + |
---|
| 4598 | + ResetModel(); |
---|
| 4599 | + copy.HardTouch(); // recompile? |
---|
| 4600 | + |
---|
| 4601 | + cRadio ab; |
---|
| 4602 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 4603 | + { |
---|
| 4604 | + ab = (cRadio)e.nextElement(); |
---|
| 4605 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 4606 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 4607 | + if (test != null) |
---|
| 4608 | + { |
---|
| 4609 | + test.editWindow = ab.object.editWindow; |
---|
| 4610 | + ab.object = test; |
---|
| 4611 | + } |
---|
| 4612 | + } |
---|
| 4613 | + |
---|
| 4614 | + refreshContents(true); |
---|
| 4615 | + } |
---|
| 4616 | + |
---|
| 4617 | + cButton previousVersionButton; |
---|
| 4618 | + cButton restoreButton; |
---|
| 4619 | + cButton replaceButton; |
---|
| 4620 | + cButton nextVersionButton; |
---|
| 4621 | + cButton saveVersionButton; |
---|
| 4622 | + cButton deleteVersionButton; |
---|
| 4623 | + |
---|
| 4624 | + boolean muteSlider; |
---|
| 4625 | + |
---|
| 4626 | + int VersionCount() |
---|
| 4627 | + { |
---|
| 4628 | + int count = 0; |
---|
| 4629 | + |
---|
| 4630 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
| 4631 | + { |
---|
| 4632 | + if (copy.versionlist[i] != null) |
---|
| 4633 | + count++; |
---|
| 4634 | + } |
---|
| 4635 | + |
---|
| 4636 | + return count; |
---|
| 4637 | + } |
---|
| 4638 | + |
---|
| 4639 | + public cGridBag versionSliderPane; |
---|
| 4640 | + |
---|
| 4641 | + void SetVersionStates() |
---|
| 4642 | + { |
---|
| 4643 | + //if (true) |
---|
| 4644 | + // return; |
---|
| 4645 | + |
---|
| 4646 | + //cRadio tab = GetCurrentTab(); |
---|
| 4647 | + |
---|
| 4648 | + if (copy.versionindex == -2) |
---|
| 4649 | + { |
---|
| 4650 | + saveVersionButton.setEnabled(false); |
---|
| 4651 | + restoreButton.setEnabled(false); |
---|
| 4652 | + replaceButton.setEnabled(false); |
---|
| 4653 | + previousVersionButton.setEnabled(false); |
---|
| 4654 | + nextVersionButton.setEnabled(false); |
---|
| 4655 | + deleteVersionButton.setEnabled(false); |
---|
| 4656 | + versionSliderPane.setVisible(false); |
---|
| 4657 | + } |
---|
| 4658 | + else |
---|
| 4659 | + { |
---|
| 4660 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 4661 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 4662 | + |
---|
| 4663 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4664 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4665 | + |
---|
| 4666 | + deleteVersionButton.setEnabled(copy.versionindex != -1); |
---|
| 4667 | + //copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4668 | + |
---|
| 4669 | + muteSlider = true; |
---|
| 4670 | + versionSlider.setMinimum(0); |
---|
| 4671 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4672 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4673 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
| 4674 | + muteSlider = false; |
---|
| 4675 | + |
---|
| 4676 | + versionSliderPane.setVisible(true); |
---|
| 4677 | + } |
---|
| 4678 | + } |
---|
| 4679 | + |
---|
| 4680 | + public boolean PreviousVersion() |
---|
| 4681 | + { |
---|
| 4682 | + // Option? |
---|
| 4683 | + Replace(); |
---|
| 4684 | + |
---|
| 4685 | + System.err.println("Undo"); |
---|
| 4686 | + |
---|
| 4687 | + //cRadio tab = GetCurrentTab(); |
---|
| 4688 | + |
---|
| 4689 | + if (copy.versionindex == 0) |
---|
| 4690 | + { |
---|
| 4691 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4692 | + return false; |
---|
| 4693 | + } |
---|
| 4694 | + |
---|
| 4695 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 4696 | +// { |
---|
| 4697 | +// if (Save(false)) |
---|
| 4698 | +// tab.versionindex -= 1; |
---|
| 4699 | +// else |
---|
| 4700 | +// { |
---|
| 4701 | +// if (tab.versionindex <= 0) |
---|
| 4702 | +// return false; |
---|
| 4703 | +// else |
---|
| 4704 | +// tab.versionindex -= 1; |
---|
| 4705 | +// } |
---|
| 4706 | +// } |
---|
| 4707 | + |
---|
| 4708 | + copy.versionindex -= 1; |
---|
| 4709 | + |
---|
| 4710 | + CopyChanged(); |
---|
| 4711 | + |
---|
| 4712 | + return true; |
---|
| 4713 | + } |
---|
| 4714 | + |
---|
| 4715 | + public boolean Restore() |
---|
| 4716 | + { |
---|
| 4717 | + System.err.println("Restore"); |
---|
| 4718 | + |
---|
| 4719 | + //cRadio tab = GetCurrentTab(); |
---|
| 4720 | + |
---|
| 4721 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4722 | + { |
---|
| 4723 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4724 | + return false; |
---|
| 4725 | + } |
---|
| 4726 | + |
---|
| 4727 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4728 | + CopyChanged(); |
---|
| 4729 | + |
---|
| 4730 | + return true; |
---|
| 4731 | + } |
---|
| 4732 | + |
---|
| 4733 | + public boolean Replace() |
---|
| 4734 | + { |
---|
| 4735 | + //System.err.println("Replace"); |
---|
| 4736 | + |
---|
| 4737 | + //cRadio tab = GetCurrentTab(); |
---|
| 4738 | + |
---|
| 4739 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4740 | + { |
---|
| 4741 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4742 | + return false; |
---|
| 4743 | + } |
---|
| 4744 | + |
---|
| 4745 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
| 4746 | + |
---|
| 4747 | + return true; |
---|
| 4748 | + } |
---|
| 4749 | + |
---|
| 4750 | + public void NextVersion() |
---|
| 4751 | + { |
---|
| 4752 | + // Option? |
---|
| 4753 | + Replace(); |
---|
| 4754 | + |
---|
| 4755 | + //cRadio tab = GetCurrentTab(); |
---|
| 4756 | + |
---|
| 4757 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
| 4758 | + { |
---|
| 4759 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4760 | + return; |
---|
| 4761 | + } |
---|
| 4762 | + |
---|
| 4763 | + copy.versionindex += 1; |
---|
| 4764 | + |
---|
| 4765 | + CopyChanged(); |
---|
| 4766 | + |
---|
| 4767 | + //if (!tab.user[tab.versionindex]) |
---|
| 4768 | + // tab.graphs[tab.versionindex] = null; |
---|
| 4769 | + } |
---|
| 4770 | + |
---|
| 4771 | + void ImportGFD() |
---|
| 4772 | + { |
---|
| 4773 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 4774 | + browser.show(); |
---|
| 4775 | + String filename = browser.getFile(); |
---|
| 4776 | + if (filename != null && filename.length() > 0) |
---|
| 4777 | + { |
---|
| 4778 | + String fullname = browser.getDirectory() + filename; |
---|
| 4779 | + |
---|
| 4780 | + //Object3D readobj = |
---|
| 4781 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 4782 | + //makeSomething(readobj); |
---|
| 4783 | + } |
---|
| 4784 | + } |
---|
| 4785 | + |
---|
| 4786 | + void ImportVRMLX3D() |
---|
| 4787 | + { |
---|
| 4788 | + if (Grafreed.standAlone) |
---|
| 4789 | + { |
---|
| 4790 | + /**/ |
---|
| 4791 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 4792 | + browser.show(); |
---|
| 4793 | + String filename = browser.getFile(); |
---|
| 4794 | + if (filename != null && filename.length() > 0) |
---|
| 4795 | + { |
---|
| 4796 | + String fullname = browser.getDirectory() + filename; |
---|
| 4797 | + LoadVRMLX3D(fullname); |
---|
| 4798 | + } |
---|
| 4799 | + /**/ |
---|
| 4800 | + } |
---|
| 4801 | + } |
---|
| 4802 | + |
---|
3203 | 4803 | void ToggleAnimation() |
---|
3204 | 4804 | { |
---|
3205 | 4805 | if (!Globals.ANIMATION) |
---|
.. | .. |
---|
3215 | 4815 | |
---|
3216 | 4816 | Globals.ANIMATION ^= true; |
---|
3217 | 4817 | |
---|
3218 | | - GrafreeD.wav.cursor = 0; |
---|
3219 | | - GrafreeD.wav.loop = 0; |
---|
| 4818 | + Grafreed.wav.cursor = 0; |
---|
| 4819 | + Grafreed.wav.loop = 0; |
---|
3220 | 4820 | } |
---|
3221 | 4821 | } else |
---|
3222 | 4822 | { |
---|
.. | .. |
---|
3237 | 4837 | callee.refreshContents(); |
---|
3238 | 4838 | } else |
---|
3239 | 4839 | { |
---|
3240 | | - new Exception().printStackTrace(); |
---|
3241 | 4840 | System.exit(0); |
---|
3242 | 4841 | } |
---|
3243 | 4842 | } |
---|
.. | .. |
---|
3267 | 4866 | void CreateMaterial() |
---|
3268 | 4867 | { |
---|
3269 | 4868 | //copy.ClearMaterial(); // PATCH |
---|
3270 | | - copy.CreateMaterialS(multiplyToggle.isSelected()); |
---|
| 4869 | + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); |
---|
3271 | 4870 | if (copy.selection.size() > 0) |
---|
3272 | 4871 | //SetMaterial(copy); |
---|
3273 | 4872 | { |
---|
.. | .. |
---|
3318 | 4917 | assert false; |
---|
3319 | 4918 | } |
---|
3320 | 4919 | |
---|
3321 | | - void EditSelection() |
---|
| 4920 | + void EditSelection(boolean newWindow) |
---|
3322 | 4921 | { |
---|
3323 | 4922 | } |
---|
3324 | 4923 | |
---|
.. | .. |
---|
3326 | 4925 | { |
---|
3327 | 4926 | copy.ResetBlockLoop(); // temporary problem |
---|
3328 | 4927 | |
---|
3329 | | - boolean random = CameraPane.RANDOM; |
---|
3330 | | - CameraPane.RANDOM = false; // parse everything |
---|
| 4928 | + boolean random = CameraPane.SWITCH; |
---|
| 4929 | + CameraPane.SWITCH = false; // parse everything |
---|
3331 | 4930 | copy.ResetDisplayList(); |
---|
3332 | 4931 | copy.HardTouch(); |
---|
3333 | | - CameraPane.RANDOM = random; |
---|
| 4932 | + CameraPane.SWITCH = random; |
---|
3334 | 4933 | } |
---|
3335 | 4934 | |
---|
3336 | 4935 | // public void applySelf() |
---|
.. | .. |
---|
3360 | 4959 | // else |
---|
3361 | 4960 | // applySelf(true); |
---|
3362 | 4961 | // } |
---|
| 4962 | + |
---|
| 4963 | + boolean Equal(double a, double b) |
---|
| 4964 | + { |
---|
| 4965 | + return Math.abs(a - b) < 0.001; |
---|
| 4966 | + } |
---|
| 4967 | + |
---|
3363 | 4968 | void applySelf0(boolean name) |
---|
3364 | 4969 | { |
---|
3365 | 4970 | if (name) |
---|
.. | .. |
---|
3377 | 4982 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
3378 | 4983 | |
---|
3379 | 4984 | current.color = (float) colorField.getFloat(); |
---|
3380 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4985 | + current.modulation = (float) saturationField.getFloat(); |
---|
3381 | 4986 | current.metalness = (float) metalnessField.getFloat(); |
---|
3382 | 4987 | current.diffuse = (float) diffuseField.getFloat(); |
---|
3383 | 4988 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
3397 | 5002 | current.shadow = (float) shadowField.getFloat(); |
---|
3398 | 5003 | current.texture = (float) textureField.getFloat(); |
---|
3399 | 5004 | current.opacity = (float) opacityField.getFloat(); |
---|
| 5005 | + current.parallax = (float) parallaxField.getFloat() - 0.125f; |
---|
3400 | 5006 | current.fakedepth = (float) fakedepthField.getFloat(); |
---|
3401 | 5007 | current.shadowbias = (float) shadowbiasField.getFloat(); |
---|
3402 | 5008 | |
---|
.. | .. |
---|
3404 | 5010 | { |
---|
3405 | 5011 | //System.out.println("Propagate = " + propagate); |
---|
3406 | 5012 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 5013 | + |
---|
| 5014 | + if (copy.material != null) |
---|
| 5015 | + { |
---|
| 5016 | + cMaterial mat = copy.material; |
---|
| 5017 | + |
---|
| 5018 | + if (!Equal(colorField.getFloat(), mat.color)) |
---|
| 5019 | + colorField.SetToolTipValue((mat.color)); |
---|
| 5020 | + if (!Equal(saturationField.getFloat(), mat.modulation)) |
---|
| 5021 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
| 5022 | + if (!Equal(metalnessField.getFloat(), mat.metalness)) |
---|
| 5023 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 5024 | + if (!Equal(diffuseField.getFloat(), mat.diffuse)) |
---|
| 5025 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 5026 | + if (!Equal(specularField.getFloat(), mat.specular)) |
---|
| 5027 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 5028 | + if (!Equal(shininessField.getFloat(), mat.shininess)) |
---|
| 5029 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 5030 | + if (!Equal(shiftField.getFloat(), mat.shift)) |
---|
| 5031 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 5032 | + if (!Equal(ambientField.getFloat(), mat.ambient)) |
---|
| 5033 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 5034 | + if (!Equal(lightareaField.getFloat(), mat.lightarea)) |
---|
| 5035 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 5036 | + if (!Equal(diffusenessField.getFloat(), mat.factor)) |
---|
| 5037 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 5038 | + if (!Equal(velvetField.getFloat(), mat.velvet)) |
---|
| 5039 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 5040 | + if (!Equal(sheenField.getFloat(), mat.sheen)) |
---|
| 5041 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 5042 | + if (!Equal(subsurfaceField.getFloat(), mat.subsurface)) |
---|
| 5043 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 5044 | + if (!Equal(backlitField.getFloat(), mat.bump)) |
---|
| 5045 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 5046 | + if (!Equal(anisoField.getFloat(), mat.aniso)) |
---|
| 5047 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 5048 | + if (!Equal(anisoVField.getFloat(), mat.anisoV)) |
---|
| 5049 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 5050 | + if (!Equal(cameraField.getFloat(), mat.cameralight)) |
---|
| 5051 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 5052 | + if (!Equal(selfshadowField.getFloat(), mat.diffuseness)) |
---|
| 5053 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 5054 | + if (!Equal(shadowField.getFloat(), mat.shadow)) |
---|
| 5055 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 5056 | + if (!Equal(textureField.getFloat(), mat.texture)) |
---|
| 5057 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 5058 | + if (!Equal(opacityField.getFloat(), mat.opacity)) |
---|
| 5059 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 5060 | + //if (!Equal(parallaxField.getFloat(), mat.parallax)) |
---|
| 5061 | + parallaxField.SetToolTipValue((mat.parallax)); |
---|
| 5062 | + if (!Equal(fakedepthField.getFloat(), mat.fakedepth)) |
---|
| 5063 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 5064 | + if (!Equal(shadowbiasField.getFloat(), mat.shadowbias)) |
---|
| 5065 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 5066 | + } |
---|
| 5067 | + |
---|
3407 | 5068 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3408 | 5069 | { |
---|
3409 | 5070 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3432 | 5093 | //copy.Touch(); |
---|
3433 | 5094 | } |
---|
3434 | 5095 | |
---|
| 5096 | + cNumberSlider versionSlider; |
---|
| 5097 | + |
---|
3435 | 5098 | public void stateChanged(ChangeEvent e) |
---|
3436 | 5099 | { |
---|
3437 | | - // assert(false); |
---|
| 5100 | + // assert(false); |
---|
| 5101 | + if (e.getSource() == versionSlider) |
---|
| 5102 | + { |
---|
| 5103 | + if (muteSlider) |
---|
| 5104 | + return; |
---|
| 5105 | + |
---|
| 5106 | + Replace(); |
---|
| 5107 | + |
---|
| 5108 | + int version = versionSlider.getInteger(); |
---|
| 5109 | + |
---|
| 5110 | + if (version != -1 && copy.versionlist[version] != null) |
---|
| 5111 | + { |
---|
| 5112 | + copy.versionindex = version; |
---|
| 5113 | + CopyChanged(); |
---|
| 5114 | + } |
---|
| 5115 | + |
---|
| 5116 | + return; |
---|
| 5117 | + } |
---|
3438 | 5118 | |
---|
3439 | 5119 | if (freezematerial) |
---|
3440 | 5120 | { |
---|
.. | .. |
---|
3470 | 5150 | { |
---|
3471 | 5151 | //System.out.println("stateChanged = " + this); |
---|
3472 | 5152 | materialtouched = true; |
---|
| 5153 | + |
---|
| 5154 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 5155 | + { |
---|
| 5156 | + saturationField.setFloat(1); |
---|
| 5157 | + } |
---|
| 5158 | + |
---|
3473 | 5159 | applySelf(); |
---|
3474 | 5160 | //System.out.println("this = " + this); |
---|
3475 | 5161 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
3519 | 5205 | } |
---|
3520 | 5206 | |
---|
3521 | 5207 | if (normalpushField != null) |
---|
3522 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 5208 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3523 | 5209 | } |
---|
3524 | 5210 | |
---|
3525 | 5211 | void SnapObject() |
---|
.. | .. |
---|
3769 | 5455 | { |
---|
3770 | 5456 | if (GetTree() != null) |
---|
3771 | 5457 | { |
---|
| 5458 | + GetTree().revalidate(); |
---|
3772 | 5459 | GetTree().repaint(); |
---|
3773 | 5460 | } |
---|
3774 | 5461 | |
---|
.. | .. |
---|
3777 | 5464 | ctrlPanel.validate(); // ? new |
---|
3778 | 5465 | ctrlPanel.repaint(); |
---|
3779 | 5466 | } |
---|
| 5467 | + |
---|
| 5468 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5469 | + SetVersionStates(); |
---|
| 5470 | + |
---|
| 5471 | + cameraView.requestFocusInWindow(); |
---|
3780 | 5472 | } |
---|
3781 | 5473 | |
---|
3782 | 5474 | static TweenManager tweenManager = new TweenManager(); |
---|
3783 | 5475 | |
---|
3784 | 5476 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3785 | 5477 | { |
---|
| 5478 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
| 5479 | + Save(); |
---|
3786 | 5480 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3787 | 5481 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3788 | 5482 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3806 | 5500 | // group = (Composite) group.get(0); |
---|
3807 | 5501 | // } |
---|
3808 | 5502 | |
---|
3809 | | - System.out.println("makeSomething of " + thing); |
---|
| 5503 | + //System.out.println("makeSomething of " + thing); |
---|
3810 | 5504 | |
---|
3811 | 5505 | /* |
---|
3812 | 5506 | if (deselect && jList != null) |
---|
.. | .. |
---|
3869 | 5563 | { |
---|
3870 | 5564 | ResetModel(); |
---|
3871 | 5565 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 5566 | + |
---|
| 5567 | + if (thing.Size() == 0) |
---|
| 5568 | + { |
---|
| 5569 | + //EditSelection(false); |
---|
| 5570 | + } |
---|
| 5571 | + |
---|
3872 | 5572 | refreshContents(); |
---|
3873 | 5573 | } |
---|
3874 | 5574 | |
---|
.. | .. |
---|
3986 | 5686 | } |
---|
3987 | 5687 | } |
---|
3988 | 5688 | } |
---|
| 5689 | + |
---|
3989 | 5690 | LoadGFDThread loadGFDThread; |
---|
3990 | 5691 | |
---|
3991 | 5692 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
4005 | 5706 | |
---|
4006 | 5707 | try |
---|
4007 | 5708 | { |
---|
| 5709 | + // Try compressed version first. |
---|
4008 | 5710 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4009 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 5711 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 5712 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
4010 | 5713 | |
---|
4011 | 5714 | readobj = (Object3D) p.readObject(); |
---|
4012 | 5715 | istream.close(); |
---|
.. | .. |
---|
4014 | 5717 | readobj.ResetDisplayList(); |
---|
4015 | 5718 | } catch (Exception e) |
---|
4016 | 5719 | { |
---|
4017 | | - e.printStackTrace(); |
---|
| 5720 | + if (!e.toString().contains("GZIP")) |
---|
| 5721 | + e.printStackTrace(); |
---|
| 5722 | + |
---|
| 5723 | + try |
---|
| 5724 | + { |
---|
| 5725 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 5726 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 5727 | + |
---|
| 5728 | + readobj = (Object3D) p.readObject(); |
---|
| 5729 | + istream.close(); |
---|
| 5730 | + |
---|
| 5731 | + readobj.ResetDisplayList(); |
---|
| 5732 | + } catch (Exception e2) |
---|
| 5733 | + { |
---|
| 5734 | + e2.printStackTrace(); |
---|
| 5735 | + } |
---|
4018 | 5736 | } |
---|
4019 | 5737 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4020 | 5738 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4060 | 5778 | |
---|
4061 | 5779 | void LoadIt(Object obj) |
---|
4062 | 5780 | { |
---|
| 5781 | + if (obj == null) |
---|
| 5782 | + { |
---|
| 5783 | + // Invalid file |
---|
| 5784 | + return; |
---|
| 5785 | + } |
---|
| 5786 | + |
---|
4063 | 5787 | System.out.println("Loaded " + obj); |
---|
4064 | 5788 | //new Exception().printStackTrace(); |
---|
4065 | 5789 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4069 | 5793 | |
---|
4070 | 5794 | if (readobj != null) |
---|
4071 | 5795 | { |
---|
| 5796 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 5797 | + // Save(); |
---|
4072 | 5798 | try |
---|
4073 | 5799 | { |
---|
4074 | 5800 | //readobj.deepCopySelf(copy); |
---|
4075 | 5801 | copy.clear(); // june 2014 |
---|
| 5802 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5803 | + copy.skyboxext = readobj.skyboxext; |
---|
4076 | 5804 | for (int i = 0; i < readobj.size(); i++) |
---|
4077 | 5805 | { |
---|
4078 | 5806 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4113 | 5841 | } |
---|
4114 | 5842 | } catch (ClassCastException e) |
---|
4115 | 5843 | { |
---|
| 5844 | + e.printStackTrace(); |
---|
4116 | 5845 | assert (false); |
---|
4117 | 5846 | Composite c = (Composite) copy; |
---|
4118 | 5847 | c.children.clear(); |
---|
.. | .. |
---|
4123 | 5852 | c.addChild(csg); |
---|
4124 | 5853 | } |
---|
4125 | 5854 | |
---|
| 5855 | + copy.versionlist = readobj.versionlist; |
---|
| 5856 | + copy.versionindex = readobj.versionindex; |
---|
| 5857 | + copy.versiontable = readobj.versiontable; |
---|
| 5858 | + |
---|
| 5859 | + if (copy.versionlist == null) |
---|
| 5860 | + { |
---|
| 5861 | + // Backward compatibility |
---|
| 5862 | + copy.versionlist = new Object3D[100]; |
---|
| 5863 | + copy.versionindex = -1; |
---|
| 5864 | + |
---|
| 5865 | + //Save(true); |
---|
| 5866 | + } |
---|
| 5867 | + |
---|
| 5868 | + //? SetUndoStates(); |
---|
| 5869 | + |
---|
4126 | 5870 | ResetModel(); |
---|
4127 | 5871 | copy.HardTouch(); // recompile? |
---|
4128 | 5872 | refreshContents(); |
---|
4129 | 5873 | } |
---|
4130 | 5874 | } |
---|
4131 | 5875 | |
---|
4132 | | - void load() // throws ClassNotFoundException |
---|
| 5876 | + void Open() // throws ClassNotFoundException |
---|
4133 | 5877 | { |
---|
4134 | | - if (GrafreeD.standAlone) |
---|
| 5878 | + if (Grafreed.standAlone) |
---|
4135 | 5879 | { |
---|
4136 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5880 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4137 | 5881 | browser.show(); |
---|
4138 | 5882 | String filename = browser.getFile(); |
---|
4139 | 5883 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4210 | 5954 | |
---|
4211 | 5955 | void save() |
---|
4212 | 5956 | { |
---|
| 5957 | + Replace(); |
---|
| 5958 | + |
---|
4213 | 5959 | if (lastname == null) |
---|
4214 | 5960 | { |
---|
4215 | 5961 | return; |
---|
.. | .. |
---|
4218 | 5964 | try |
---|
4219 | 5965 | { |
---|
4220 | 5966 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4221 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 5967 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5968 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4222 | 5969 | |
---|
4223 | 5970 | p.writeObject(copy); |
---|
4224 | 5971 | p.flush(); |
---|
4225 | 5972 | |
---|
| 5973 | + zstream.close(); |
---|
4226 | 5974 | ostream.close(); |
---|
4227 | 5975 | |
---|
4228 | 5976 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4230 | 5978 | //ps.print(buffer.toString()); |
---|
4231 | 5979 | } catch (IOException e) |
---|
4232 | 5980 | { |
---|
| 5981 | + e.printStackTrace(); |
---|
4233 | 5982 | } |
---|
4234 | 5983 | } |
---|
| 5984 | + |
---|
4235 | 5985 | String lastname; |
---|
4236 | 5986 | |
---|
4237 | 5987 | void saveAs() |
---|
4238 | 5988 | { |
---|
4239 | | - if (GrafreeD.standAlone) |
---|
| 5989 | + if (Grafreed.standAlone) |
---|
4240 | 5990 | { |
---|
4241 | 5991 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4242 | 5992 | browser.setVisible(true); |
---|
4243 | 5993 | String filename = browser.getFile(); |
---|
4244 | 5994 | if (filename != null && filename.length() > 0) |
---|
4245 | 5995 | { |
---|
| 5996 | + if (!filename.endsWith(".gfd")) |
---|
| 5997 | + filename += ".gfd"; |
---|
4246 | 5998 | lastname = browser.getDirectory() + filename; |
---|
4247 | 5999 | save(); |
---|
4248 | 6000 | } |
---|
.. | .. |
---|
4341 | 6093 | try |
---|
4342 | 6094 | { |
---|
4343 | 6095 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4344 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4345 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 6096 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 6097 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4346 | 6098 | |
---|
4347 | 6099 | Object3D objectparent = obj.parent; |
---|
4348 | 6100 | obj.parent = null; |
---|
4349 | 6101 | |
---|
4350 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 6102 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4351 | 6103 | |
---|
4352 | 6104 | obj.parent = objectparent; |
---|
4353 | 6105 | |
---|
.. | .. |
---|
4359 | 6111 | p.writeObject(object); |
---|
4360 | 6112 | p.flush(); |
---|
4361 | 6113 | |
---|
| 6114 | + zstream.close(); |
---|
4362 | 6115 | ostream.close(); |
---|
4363 | | - // zstream.close(); |
---|
4364 | 6116 | |
---|
4365 | 6117 | // group.selection.get(0).parent = parent; |
---|
4366 | 6118 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4381 | 6133 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4382 | 6134 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4383 | 6135 | copy.generatePOV(buffer); |
---|
4384 | | - if (GrafreeD.standAlone) |
---|
| 6136 | + if (Grafreed.standAlone) |
---|
4385 | 6137 | { |
---|
4386 | 6138 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4387 | 6139 | browser.show(); |
---|
.. | .. |
---|
4407 | 6159 | Object3D client; |
---|
4408 | 6160 | Object3D copy; |
---|
4409 | 6161 | MenuBar menuBar; |
---|
4410 | | - Menu windowMenu; |
---|
4411 | | - MenuItem loadItem; |
---|
| 6162 | + Menu fileMenu; |
---|
| 6163 | + MenuItem newItem; |
---|
| 6164 | + MenuItem openItem; |
---|
4412 | 6165 | MenuItem saveItem; |
---|
4413 | 6166 | MenuItem saveAsItem; |
---|
4414 | 6167 | MenuItem exportAsItem; |
---|
4415 | 6168 | MenuItem reexportItem; |
---|
4416 | 6169 | MenuItem povItem; |
---|
4417 | 6170 | MenuItem closeItem; |
---|
4418 | | - Menu cameraMenu; |
---|
| 6171 | + |
---|
4419 | 6172 | CheckboxMenuItem zBufferItem; |
---|
4420 | 6173 | //MenuItem normalLensItem; |
---|
4421 | | - MenuItem editCameraItem; |
---|
4422 | | - MenuItem revertCameraItem; |
---|
4423 | 6174 | MenuItem stepItem; |
---|
4424 | 6175 | CheckboxMenuItem toggleLiveItem; |
---|
4425 | 6176 | CheckboxMenuItem toggleFullScreenItem; |
---|
.. | .. |
---|
4430 | 6181 | CheckboxMenuItem toggleFootContactItem; |
---|
4431 | 6182 | CheckboxMenuItem toggleDLItem; |
---|
4432 | 6183 | CheckboxMenuItem toggleTextureItem; |
---|
4433 | | - CheckboxMenuItem toggleRandomItem; |
---|
| 6184 | + CheckboxMenuItem toggleSwitchItem; |
---|
4434 | 6185 | CheckboxMenuItem toggleRootItem; |
---|
4435 | 6186 | CheckboxMenuItem animationItem; |
---|
| 6187 | + MenuItem archiveItem; |
---|
4436 | 6188 | CheckboxMenuItem toggleHandleItem; |
---|
4437 | 6189 | CheckboxMenuItem togglePaintItem; |
---|
4438 | 6190 | JSplitPane mainPanel; |
---|
4439 | 6191 | JScrollPane scrollpane; |
---|
| 6192 | + |
---|
4440 | 6193 | JPanel toolbarPanel; |
---|
| 6194 | + |
---|
4441 | 6195 | cGridBag treePanel; |
---|
| 6196 | + |
---|
4442 | 6197 | JPanel radioPanel; |
---|
4443 | 6198 | ButtonGroup buttonGroup; |
---|
4444 | | - cGridBag ctrlPanel; |
---|
| 6199 | + |
---|
| 6200 | + cGridBag toolboxPanel; |
---|
| 6201 | + cGridBag skyboxPanel; |
---|
4445 | 6202 | cGridBag materialPanel; |
---|
| 6203 | + cGridBag ctrlPanel; |
---|
| 6204 | + |
---|
4446 | 6205 | JScrollPane infoPanel; |
---|
| 6206 | + |
---|
4447 | 6207 | cGridBag optionsPanel; |
---|
| 6208 | + |
---|
4448 | 6209 | JTabbedPane objectPanel; |
---|
| 6210 | + boolean materialFlushed; |
---|
| 6211 | + Object3D latestObject; |
---|
| 6212 | + |
---|
| 6213 | + cGridBag transformPanel; |
---|
4449 | 6214 | cGridBag XYZPanel; |
---|
| 6215 | + |
---|
4450 | 6216 | JSplitPane gridPanel; |
---|
4451 | 6217 | JSplitPane bigPanel; |
---|
| 6218 | + |
---|
4452 | 6219 | cGridBag bigThree; |
---|
4453 | 6220 | cGridBag scenePanel; |
---|
4454 | 6221 | cGridBag centralPanel; |
---|
.. | .. |
---|
4506 | 6273 | JLabel colorLabel; |
---|
4507 | 6274 | cNumberSlider colorField; |
---|
4508 | 6275 | JLabel modulationLabel; |
---|
4509 | | - cNumberSlider modulationField; |
---|
| 6276 | + cNumberSlider saturationField; |
---|
4510 | 6277 | JLabel metalnessLabel; |
---|
4511 | 6278 | cNumberSlider metalnessField; |
---|
4512 | 6279 | JLabel diffuseLabel; |
---|
.. | .. |
---|
4537 | 6304 | cNumberSlider anisoField; |
---|
4538 | 6305 | JLabel anisoVLabel; |
---|
4539 | 6306 | cNumberSlider anisoVField; |
---|
| 6307 | + |
---|
4540 | 6308 | JLabel cameraLabel; |
---|
4541 | 6309 | cNumberSlider cameraField; |
---|
4542 | 6310 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
4547 | 6315 | cNumberSlider textureField; |
---|
4548 | 6316 | JLabel opacityLabel; |
---|
4549 | 6317 | cNumberSlider opacityField; |
---|
| 6318 | + JLabel parallaxLabel; |
---|
| 6319 | + cNumberSlider parallaxField; |
---|
4550 | 6320 | JLabel fakedepthLabel; |
---|
4551 | 6321 | cNumberSlider fakedepthField; |
---|
4552 | 6322 | JLabel shadowbiasLabel; |
---|
4553 | 6323 | cNumberSlider shadowbiasField; |
---|
| 6324 | + |
---|
4554 | 6325 | JLabel bumpLabel; |
---|
4555 | 6326 | cNumberSlider bumpField; |
---|
4556 | 6327 | JLabel noiseLabel; |
---|
.. | .. |
---|
4563 | 6334 | cNumberSlider fogField; |
---|
4564 | 6335 | JLabel opacityPowerLabel; |
---|
4565 | 6336 | cNumberSlider opacityPowerField; |
---|
4566 | | - JTree jTree; |
---|
| 6337 | + cTree jTree; |
---|
4567 | 6338 | //ObjectUI parent; |
---|
4568 | 6339 | |
---|
4569 | 6340 | cNumberSlider normalpushField; |
---|
| 6341 | + |
---|
| 6342 | + private MenuItem importGFDItem; |
---|
| 6343 | + private MenuItem importVRMLX3DItem; |
---|
| 6344 | + private MenuItem import3DSItem; |
---|
| 6345 | + private MenuItem importOBJItem; |
---|
4570 | 6346 | } |
---|