.. | .. |
---|
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 cGridBag GetSeparator() |
---|
| 76 | + { |
---|
| 77 | + cGridBag separator = new cGridBag(); |
---|
| 78 | + separator.add(new JSeparator()); |
---|
| 79 | + separator.preferredHeight = 5; |
---|
| 80 | + return separator; |
---|
| 81 | + } |
---|
| 82 | + |
---|
| 83 | + cButton GetButton(String name, boolean border) |
---|
| 84 | + { |
---|
| 85 | + ImageIcon icon = GetIcon(name); |
---|
| 86 | + return new cButton(icon, border); |
---|
| 87 | + } |
---|
| 88 | + |
---|
| 89 | + cLabel GetLabel(String name, boolean border) |
---|
| 90 | + { |
---|
| 91 | + //ImageIcon icon = GetIcon(name); |
---|
| 92 | + return new cLabel(GetImage(name), border); |
---|
| 93 | + } |
---|
| 94 | + |
---|
| 95 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 96 | + { |
---|
| 97 | + ImageIcon icon = GetIcon(name); |
---|
| 98 | + return new cToggleButton(icon, border); |
---|
| 99 | + } |
---|
| 100 | + |
---|
| 101 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 102 | + { |
---|
| 103 | + ImageIcon icon = GetIcon(name); |
---|
| 104 | + return new cCheckBox(icon, border); |
---|
| 105 | + } |
---|
| 106 | + |
---|
| 107 | + static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>(); |
---|
| 108 | + |
---|
| 109 | + static ImageIcon GetIcon(String name) |
---|
| 110 | + { |
---|
| 111 | + javax.swing.ImageIcon iconCache = icons.get(name); |
---|
| 112 | + if (iconCache != null) |
---|
| 113 | + { |
---|
| 114 | + return iconCache; |
---|
| 115 | + } |
---|
| 116 | + |
---|
| 117 | + try |
---|
| 118 | + { |
---|
| 119 | + BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
| 120 | + |
---|
| 121 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 122 | +// { |
---|
| 123 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 124 | +// Graphics2D g = resized.createGraphics(); |
---|
| 125 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 126 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 127 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 128 | +// g.dispose(); |
---|
| 129 | +// |
---|
| 130 | +// image = resized; |
---|
| 131 | +// } |
---|
| 132 | + |
---|
| 133 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 134 | + |
---|
| 135 | + icons.put(name, icon); |
---|
| 136 | + |
---|
| 137 | + return icon; |
---|
| 138 | + } |
---|
| 139 | + catch (Exception e) |
---|
| 140 | + { |
---|
| 141 | + //icons.put(name, null); |
---|
| 142 | + return null; |
---|
| 143 | + } |
---|
| 144 | + } |
---|
| 145 | + |
---|
| 146 | + BufferedImage GetImage(String name) |
---|
| 147 | + { |
---|
| 148 | + try |
---|
| 149 | + { |
---|
| 150 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 151 | + |
---|
| 152 | + return image; |
---|
| 153 | + } |
---|
| 154 | + catch (Exception e) |
---|
| 155 | + { |
---|
| 156 | + return null; |
---|
| 157 | + } |
---|
| 158 | + } |
---|
38 | 159 | |
---|
39 | 160 | // SCRIPT |
---|
40 | 161 | |
---|
.. | .. |
---|
145 | 266 | |
---|
146 | 267 | objEditor.ctrlPanel.remove(namePanel); |
---|
147 | 268 | |
---|
148 | | - if (!GroupEditor.allparams) |
---|
| 269 | + if (!allparams) |
---|
149 | 270 | return; |
---|
150 | 271 | |
---|
151 | 272 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
168 | 289 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
169 | 290 | |
---|
170 | 291 | objEditor.ctrlPanel.remove(setupPanel); |
---|
171 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 292 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 293 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
172 | 294 | objEditor.ctrlPanel.remove(pushPanel); |
---|
173 | 295 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
174 | 296 | |
---|
.. | .. |
---|
216 | 338 | client = inClient; |
---|
217 | 339 | copy = client; |
---|
218 | 340 | |
---|
| 341 | +// if (copy.versionlist == null) |
---|
| 342 | +// { |
---|
| 343 | +// copy.versionlist = new Object3D[100]; |
---|
| 344 | +// copy.versionindex = -1; |
---|
| 345 | +// |
---|
| 346 | +// callee.Save(true); |
---|
| 347 | +// } |
---|
| 348 | + |
---|
219 | 349 | // "this" is not called: SetupUI2(objEditor); |
---|
220 | 350 | } |
---|
221 | 351 | |
---|
.. | .. |
---|
229 | 359 | client = inClient; |
---|
230 | 360 | copy = client; |
---|
231 | 361 | |
---|
| 362 | + if (copy.versionlist == null) |
---|
| 363 | + { |
---|
| 364 | + copy.versionlist = new Object3D[100]; |
---|
| 365 | + copy.versionindex = -1; |
---|
| 366 | + |
---|
| 367 | +// Save(true); |
---|
| 368 | + } |
---|
| 369 | + |
---|
232 | 370 | SetupUI2(callee.GetEditor()); |
---|
233 | 371 | } |
---|
234 | 372 | |
---|
.. | .. |
---|
243 | 381 | //localCopy.parent = null; |
---|
244 | 382 | |
---|
245 | 383 | frame = new JFrame(); |
---|
| 384 | + frame.setUndecorated(false); |
---|
246 | 385 | objEditor = this; |
---|
247 | 386 | this.callee = callee; |
---|
248 | 387 | |
---|
249 | 388 | //parent = p; |
---|
250 | 389 | |
---|
251 | 390 | GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
---|
252 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 391 | + if (Globals.DEBUG) |
---|
| 392 | + System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
253 | 393 | //gd.setFullScreenWindow(this); |
---|
254 | 394 | //setResizable(false); |
---|
255 | 395 | //if (!isDisplayable()) |
---|
.. | .. |
---|
260 | 400 | copy = localCopy; |
---|
261 | 401 | copy.editWindow = this; |
---|
262 | 402 | |
---|
| 403 | +// if (copy.versionlist == null) |
---|
| 404 | +// { |
---|
| 405 | +// copy.versionlist = new Object3D[100]; |
---|
| 406 | +// copy.versionindex = -1; |
---|
| 407 | +// |
---|
| 408 | +// Save(true); |
---|
| 409 | +// } |
---|
| 410 | + |
---|
263 | 411 | SetupMenu(); |
---|
264 | 412 | |
---|
265 | 413 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
273 | 421 | return frame.action(event, obj); |
---|
274 | 422 | } |
---|
275 | 423 | |
---|
| 424 | + // Cannot work without static |
---|
| 425 | + static boolean allparams = true; |
---|
| 426 | + |
---|
| 427 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 428 | + |
---|
| 429 | + // This is to refresh the UI of the material panel. |
---|
| 430 | + boolean patchMaterial; |
---|
| 431 | + |
---|
276 | 432 | void SetupMenu() |
---|
277 | 433 | { |
---|
278 | 434 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
279 | | - menuBar.add(windowMenu = new Menu("File")); |
---|
280 | | - windowMenu.add(loadItem = new MenuItem("Load...")); |
---|
281 | | - windowMenu.add("-"); |
---|
282 | | - windowMenu.add(saveItem = new MenuItem("Save")); |
---|
283 | | - windowMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
| 435 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 436 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 437 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
| 438 | + |
---|
| 439 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 440 | + Menu menu = new Menu("Import"); |
---|
| 441 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 442 | + importOBJItem.addActionListener(this); |
---|
| 443 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 444 | + import3DSItem.addActionListener(this); |
---|
| 445 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 446 | + importVRMLX3DItem.addActionListener(this); |
---|
| 447 | + menu.add("-"); |
---|
| 448 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 449 | + importGFDItem.addActionListener(this); |
---|
| 450 | + fileMenu.add(menu); |
---|
| 451 | + fileMenu.add("-"); |
---|
| 452 | + |
---|
| 453 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 454 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
284 | 455 | //windowMenu.add(povItem = new MenuItem("Emit POV-Ray...")); |
---|
285 | | - windowMenu.add("-"); |
---|
286 | | - windowMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
287 | | - windowMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
288 | | - windowMenu.add("-"); |
---|
| 456 | + fileMenu.add("-"); |
---|
| 457 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 458 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 459 | + fileMenu.add("-"); |
---|
289 | 460 | if (client.parent != null) |
---|
290 | 461 | { |
---|
291 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 462 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
292 | 463 | } else |
---|
293 | 464 | { |
---|
294 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 465 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
295 | 466 | } |
---|
296 | 467 | |
---|
297 | | - loadItem.addActionListener(this); |
---|
| 468 | + newItem.addActionListener(this); |
---|
| 469 | + openItem.addActionListener(this); |
---|
298 | 470 | saveItem.addActionListener(this); |
---|
299 | 471 | saveAsItem.addActionListener(this); |
---|
300 | 472 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
302 | 474 | //povItem.addActionListener(this); |
---|
303 | 475 | closeItem.addActionListener(this); |
---|
304 | 476 | |
---|
305 | | - menuBar.add(cameraMenu = new Menu("View")); |
---|
306 | | - //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer")); |
---|
307 | | - //zBufferItem.addActionListener(this); |
---|
308 | | - //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens")); |
---|
309 | | - //normalLensItem.addActionListener(this); |
---|
310 | | - cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera")); |
---|
311 | | - revertCameraItem.addActionListener(this); |
---|
312 | | - |
---|
313 | | - cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); |
---|
314 | | - toggleFullScreenItem.addItemListener(this); |
---|
315 | | - toggleFullScreenItem.setState(CameraPane.FULLSCREEN); |
---|
316 | | - cameraMenu.add("-"); |
---|
317 | | - |
---|
318 | | - cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); |
---|
319 | | - toggleTextureItem.addItemListener(this); |
---|
320 | | - toggleTextureItem.setState(CameraPane.textureon); |
---|
321 | | - |
---|
322 | | - cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch")); |
---|
323 | | - toggleSwitchItem.addItemListener(this); |
---|
324 | | - toggleSwitchItem.setState(CameraPane.SWITCH); |
---|
325 | | - |
---|
326 | | - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); |
---|
327 | | - toggleHandleItem.addItemListener(this); |
---|
328 | | - toggleHandleItem.setState(CameraPane.HANDLES); |
---|
329 | | - |
---|
330 | | - cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode")); |
---|
331 | | - togglePaintItem.addItemListener(this); |
---|
332 | | - togglePaintItem.setState(CameraPane.PAINTMODE); |
---|
333 | | - |
---|
334 | | - if (Globals.ADVANCED) |
---|
335 | | - { |
---|
336 | | - cameraMenu.add("-"); |
---|
337 | | - cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); |
---|
338 | | - toggleLiveItem.addItemListener(this); |
---|
339 | | - toggleLiveItem.setState(Globals.isLIVE()); |
---|
340 | | - |
---|
341 | | - cameraMenu.add(stepItem = new MenuItem("Step")); |
---|
342 | | - stepItem.addActionListener(this); |
---|
343 | | - // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); |
---|
344 | | - // toggleDLItem.addItemListener(this); |
---|
345 | | - // toggleDLItem.setState(false); |
---|
346 | | - |
---|
347 | | - cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render")); |
---|
348 | | - toggleRenderItem.addItemListener(this); |
---|
349 | | - toggleRenderItem.setState(!CameraPane.frozen); |
---|
350 | | - |
---|
351 | | - cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); |
---|
352 | | - toggleDebugItem.addItemListener(this); |
---|
353 | | - toggleDebugItem.setState(CameraPane.DEBUG); |
---|
354 | | - |
---|
355 | | - cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); |
---|
356 | | - toggleFrustumItem.addItemListener(this); |
---|
357 | | - toggleFrustumItem.setState(CameraPane.FRUSTUM); |
---|
358 | | - |
---|
359 | | - cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact")); |
---|
360 | | - toggleFootContactItem.addItemListener(this); |
---|
361 | | - toggleFootContactItem.setState(CameraPane.FOOTCONTACT); |
---|
362 | | - |
---|
363 | | - cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline")); |
---|
364 | | - toggleTimelineItem.addItemListener(this); |
---|
365 | | - } |
---|
366 | | - |
---|
367 | | -// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root")); |
---|
368 | | -// toggleRootItem.addItemListener(this); |
---|
369 | | -// toggleRootItem.setState(false); |
---|
370 | | -// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation")); |
---|
371 | | -// animationItem.addItemListener(this); |
---|
372 | | -// animationItem.setState(CameraPane.ANIMATION); |
---|
373 | | - cameraMenu.add("-"); |
---|
374 | | - cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera")); |
---|
375 | | - editCameraItem.addActionListener(this); |
---|
376 | | - |
---|
377 | 477 | objectPanel = new JTabbedPane(); |
---|
| 478 | + |
---|
| 479 | + ChangeListener changeListener = new ChangeListener() |
---|
| 480 | + { |
---|
| 481 | + //String name; |
---|
| 482 | + |
---|
| 483 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 484 | + { |
---|
| 485 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 486 | +// { |
---|
| 487 | +// if (latestObject != null) |
---|
| 488 | +// { |
---|
| 489 | +// refreshContents(true); |
---|
| 490 | +// SetMaterial(latestObject); |
---|
| 491 | +// } |
---|
| 492 | +// |
---|
| 493 | +// materialFlushed = true; |
---|
| 494 | +// } |
---|
| 495 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 496 | +// { |
---|
| 497 | +// if (listUI.size() == 0) |
---|
| 498 | +// EditSelection(false); |
---|
| 499 | +// } |
---|
| 500 | + |
---|
| 501 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 502 | +// { |
---|
| 503 | +// name = copy.skyboxname; |
---|
| 504 | +// |
---|
| 505 | +// if (name == null) |
---|
| 506 | +// { |
---|
| 507 | +// name = ""; |
---|
| 508 | +// } |
---|
| 509 | +// |
---|
| 510 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 511 | +// copy.skyboxext = "jpg"; |
---|
| 512 | +// } |
---|
| 513 | +// else |
---|
| 514 | +// { |
---|
| 515 | +// if (name != null) |
---|
| 516 | +// { |
---|
| 517 | +// if (name.equals("")) |
---|
| 518 | +// { |
---|
| 519 | +// copy.skyboxname = null; |
---|
| 520 | +// copy.skyboxext = null; |
---|
| 521 | +// } |
---|
| 522 | +// else |
---|
| 523 | +// { |
---|
| 524 | +// copy.skyboxname = name; |
---|
| 525 | +// } |
---|
| 526 | +// } |
---|
| 527 | +// } |
---|
| 528 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 529 | + |
---|
| 530 | +// refreshContents(false); // To refresh Info tab |
---|
| 531 | + cameraView.repaint(); |
---|
| 532 | + } |
---|
| 533 | + }; |
---|
| 534 | + objectPanel.addChangeListener(changeListener); |
---|
| 535 | + |
---|
378 | 536 | toolbarPanel = new JPanel(); |
---|
379 | 537 | toolbarPanel.setName("Toolbar"); |
---|
| 538 | + |
---|
380 | 539 | treePanel = new cGridBag(); |
---|
381 | 540 | treePanel.setName("Tree"); |
---|
| 541 | + |
---|
| 542 | + editPanel = new cGridBag().setVertical(true); |
---|
| 543 | + //editPanel.setName("Edit"); |
---|
| 544 | + |
---|
382 | 545 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
383 | | - ctrlPanel.setName("Edit"); |
---|
384 | | - materialPanel = new cGridBag().setVertical(true); |
---|
385 | | - materialPanel.setName("Material"); |
---|
| 546 | + |
---|
| 547 | + editCommandsPanel = new cGridBag(); |
---|
| 548 | + editPanel.add(editCommandsPanel); |
---|
| 549 | + editPanel.add(ctrlPanel); |
---|
| 550 | + |
---|
| 551 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 552 | + //toolboxPanel.setName("Toolbox"); |
---|
| 553 | + |
---|
| 554 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 555 | + |
---|
| 556 | + materialPanel = new cGridBag().setVertical(false); |
---|
| 557 | + //materialPanel.setName("Material"); |
---|
| 558 | + |
---|
386 | 559 | /*JTextPane*/ |
---|
387 | 560 | infoarea = createTextPane(); |
---|
388 | 561 | doc = infoarea.getStyledDocument(); |
---|
389 | 562 | |
---|
390 | 563 | infoarea.setEditable(true); |
---|
391 | 564 | SetText(); |
---|
| 565 | + |
---|
392 | 566 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
393 | 567 | // infoarea.setOpaque(false); |
---|
394 | 568 | // //infoarea.setForeground(textcolor); |
---|
395 | 569 | // TEXTAREA infoarea.setLineWrap(true); |
---|
396 | 570 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
397 | 571 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
398 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
399 | | - infoPanel.setName("Info"); |
---|
| 572 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
| 573 | + //infoPanel.setName("Info"); |
---|
400 | 574 | //infoPanel.setLayout(new BorderLayout()); |
---|
401 | 575 | //infoPanel.add(createTextPane()); |
---|
402 | 576 | |
---|
.. | .. |
---|
407 | 581 | mainPanel.setDividerSize(9); |
---|
408 | 582 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
409 | 583 | mainPanel.setResizeWeight(0.5); |
---|
410 | | - |
---|
| 584 | + |
---|
| 585 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 586 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 587 | + divider.setDividerSize(15); |
---|
| 588 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 589 | + |
---|
| 590 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 591 | + |
---|
411 | 592 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
412 | 593 | //mainPanel.setLayout(new GridBagLayout()); |
---|
413 | 594 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
475 | 656 | e.printStackTrace(); |
---|
476 | 657 | } |
---|
477 | 658 | |
---|
478 | | - String selection = infoarea.getText(); |
---|
479 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
480 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
481 | | - Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
| 659 | +// String selection = infoarea.getText(); |
---|
| 660 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 661 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 662 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
482 | 663 | //clipboard.setContents(data, data); |
---|
483 | 664 | } |
---|
484 | 665 | |
---|
.. | .. |
---|
501 | 682 | //SendInfo("Name:", "bold"); |
---|
502 | 683 | if (sel.GetTextures() != null || debug) |
---|
503 | 684 | { |
---|
504 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 685 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
505 | 686 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
506 | 687 | if (sel.Size() > 0) |
---|
507 | 688 | { |
---|
508 | 689 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
509 | 690 | } |
---|
510 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 691 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
511 | 692 | if (debug) |
---|
512 | 693 | { |
---|
513 | 694 | try |
---|
.. | .. |
---|
549 | 730 | } |
---|
550 | 731 | if (sel.support != null) |
---|
551 | 732 | { |
---|
552 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 733 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
553 | 734 | } |
---|
554 | 735 | if (sel.scriptnode != null) |
---|
555 | 736 | { |
---|
.. | .. |
---|
638 | 819 | } |
---|
639 | 820 | } |
---|
640 | 821 | |
---|
| 822 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 823 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 824 | + |
---|
| 825 | + Rectangle keeprect; |
---|
| 826 | + cRadio radio; |
---|
| 827 | + |
---|
| 828 | +cButton keepButton; |
---|
| 829 | + cButton twoButton; // Full 3D |
---|
| 830 | + cButton sixButton; |
---|
| 831 | + cButton threeButton; |
---|
| 832 | + cButton sevenButton; |
---|
| 833 | + cButton fourButton; // full panel |
---|
| 834 | + cButton oneButton; // full XYZ |
---|
| 835 | + //cButton currentLayout; |
---|
| 836 | + |
---|
| 837 | + boolean maximized; |
---|
| 838 | + |
---|
| 839 | + cButton fullscreenLayout; |
---|
| 840 | + cButton expandedLayout; |
---|
| 841 | + |
---|
| 842 | + void Minimize() |
---|
| 843 | + { |
---|
| 844 | + frame.setState(Frame.ICONIFIED); |
---|
| 845 | + frame.validate(); |
---|
| 846 | + } |
---|
| 847 | + |
---|
| 848 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 849 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 850 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
| 851 | + void Maximize() |
---|
| 852 | + { |
---|
| 853 | + if (CameraPane.FULLSCREEN) |
---|
| 854 | + { |
---|
| 855 | + ToggleFullScreen(); |
---|
| 856 | + } |
---|
| 857 | + |
---|
| 858 | + if (maximized) |
---|
| 859 | + { |
---|
| 860 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 861 | + } |
---|
| 862 | + else |
---|
| 863 | + { |
---|
| 864 | + keeprect = frame.getBounds(); |
---|
| 865 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 866 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 867 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 868 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 869 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
| 870 | + } |
---|
| 871 | + |
---|
| 872 | + maximized ^= true; |
---|
| 873 | + |
---|
| 874 | + frame.validate(); |
---|
| 875 | + } |
---|
| 876 | + |
---|
| 877 | + cButton minButton; |
---|
| 878 | + cButton maxButton; |
---|
| 879 | + cButton fullButton; |
---|
| 880 | + cButton collapseButton; |
---|
| 881 | + cButton maximize3DButton; |
---|
| 882 | + |
---|
641 | 883 | void ToggleFullScreen() |
---|
642 | 884 | { |
---|
643 | | - if (CameraPane.FULLSCREEN) |
---|
| 885 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 886 | + |
---|
| 887 | + cameraView.ToggleFullScreen(); |
---|
| 888 | + |
---|
| 889 | + if (!CameraPane.FULLSCREEN) |
---|
644 | 890 | { |
---|
645 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
646 | | - framePanel.add(bigThree); |
---|
647 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 891 | + device.setFullScreenWindow(null); |
---|
| 892 | + frame.dispose(); |
---|
| 893 | + frame.setUndecorated(false); |
---|
| 894 | + frame.validate(); |
---|
| 895 | + frame.setVisible(true); |
---|
| 896 | + |
---|
| 897 | + //frame.setVisible(false); |
---|
| 898 | +// frame.removeNotify(); |
---|
| 899 | +// frame.setUndecorated(false); |
---|
| 900 | +// frame.addNotify(); |
---|
| 901 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 902 | + |
---|
| 903 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 904 | +// X framePanel.add(bigThree); |
---|
| 905 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 906 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
| 907 | + |
---|
| 908 | + //frame.setVisible(true); |
---|
| 909 | +// radio.layout = keepButton; |
---|
| 910 | + //theFrame = null; |
---|
| 911 | + keepButton = null; |
---|
| 912 | +// radio.layout.doClick(); |
---|
| 913 | + |
---|
648 | 914 | } else |
---|
649 | 915 | { |
---|
650 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
651 | | - framePanel.remove(bigThree); |
---|
652 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 916 | + keepButton = radio.layout; |
---|
| 917 | + //keeprect = frame.getBounds(); |
---|
| 918 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 919 | +// frame.getToolkit().getScreenSize().height); |
---|
| 920 | + //frame.setVisible(false); |
---|
| 921 | + |
---|
| 922 | + frame.dispose(); |
---|
| 923 | + frame.setUndecorated(true); |
---|
| 924 | + device.setFullScreenWindow(frame); |
---|
| 925 | + frame.validate(); |
---|
| 926 | + frame.setVisible(true); |
---|
| 927 | +// frame.removeNotify(); |
---|
| 928 | +// frame.setUndecorated(true); |
---|
| 929 | +// frame.addNotify(); |
---|
| 930 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 931 | +// X framePanel.remove(bigThree); |
---|
| 932 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 933 | +// framePanel.setDividerLocation(0); |
---|
| 934 | + |
---|
| 935 | +// radio.layout = fullscreenLayout; |
---|
| 936 | +// radio.layout.doClick(); |
---|
| 937 | + //frame.setVisible(true); |
---|
653 | 938 | } |
---|
654 | | - cameraView.ToggleFullScreen(); |
---|
| 939 | + frame.validate(); |
---|
| 940 | + |
---|
| 941 | + cameraView.requestFocusInWindow(); |
---|
655 | 942 | } |
---|
| 943 | + |
---|
| 944 | + void CollapseToolbar() |
---|
| 945 | + { |
---|
| 946 | + framePanel.setDividerLocation(0); |
---|
| 947 | + //frame.validate(); |
---|
| 948 | + |
---|
| 949 | + cameraView.requestFocusInWindow(); |
---|
| 950 | + } |
---|
| 951 | + |
---|
| 952 | + private Object3D Duplicate(Object3D object) |
---|
| 953 | + { |
---|
| 954 | + boolean temp = CameraPane.SWITCH; |
---|
| 955 | + CameraPane.SWITCH = false; |
---|
| 956 | + |
---|
| 957 | + if (Grafreed.grafreed.universe.versiontable == null) |
---|
| 958 | + Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 959 | + |
---|
| 960 | + object.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 961 | + // if (copy == client) |
---|
| 962 | + |
---|
| 963 | + Object3D versions[] = object.versionlist; |
---|
| 964 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe |
---|
| 965 | + object.versionlist = null; |
---|
| 966 | + object.versiontable = null; |
---|
| 967 | + |
---|
| 968 | + //byte[] compress = Compress(copy); |
---|
| 969 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
| 970 | + |
---|
| 971 | + object.versionlist = versions; |
---|
| 972 | + object.versiontable = versiontable; // if Grafreed.grafreed.universe |
---|
| 973 | + |
---|
| 974 | + object.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 975 | + |
---|
| 976 | + CameraPane.SWITCH = temp; |
---|
| 977 | + |
---|
| 978 | + return compress; |
---|
| 979 | + } |
---|
656 | 980 | |
---|
657 | 981 | private JTextPane createTextPane() |
---|
658 | 982 | { |
---|
.. | .. |
---|
752 | 1076 | protected static ImageIcon createImageIcon(String path, |
---|
753 | 1077 | String description) |
---|
754 | 1078 | { |
---|
755 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 1079 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
756 | 1080 | if (imgURL != null) |
---|
757 | 1081 | { |
---|
758 | 1082 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
775 | 1099 | { |
---|
776 | 1100 | SetupMaterial(materialPanel); |
---|
777 | 1101 | } |
---|
| 1102 | + |
---|
778 | 1103 | //SetupName(); |
---|
779 | 1104 | //SetupViews(); |
---|
780 | 1105 | } |
---|
.. | .. |
---|
784 | 1109 | // NumberSlider vDivsField; |
---|
785 | 1110 | // JCheckBox endcaps; |
---|
786 | 1111 | JCheckBox liveCB; |
---|
| 1112 | + JCheckBox selectableCB; |
---|
787 | 1113 | JCheckBox hideCB; |
---|
788 | 1114 | JCheckBox link2masterCB; |
---|
789 | 1115 | JCheckBox markCB; |
---|
.. | .. |
---|
791 | 1117 | JCheckBox speedupCB; |
---|
792 | 1118 | JCheckBox rewindCB; |
---|
793 | 1119 | JCheckBox flipVCB; |
---|
| 1120 | + |
---|
| 1121 | + cCheckBox toggleTextureCB; |
---|
| 1122 | + cCheckBox toggleSwitchCB; |
---|
| 1123 | + |
---|
794 | 1124 | JComboBox texresMenu; |
---|
| 1125 | + |
---|
795 | 1126 | JButton resetButton; |
---|
796 | 1127 | JButton stepButton; |
---|
797 | 1128 | JButton stepAllButton; |
---|
.. | .. |
---|
800 | 1131 | JButton fasterButton; |
---|
801 | 1132 | JButton remarkButton; |
---|
802 | 1133 | |
---|
| 1134 | + cGridBag editPanel; |
---|
| 1135 | + cGridBag editCommandsPanel; |
---|
| 1136 | + |
---|
803 | 1137 | cGridBag namePanel; |
---|
804 | 1138 | cGridBag setupPanel; |
---|
805 | | - cGridBag commandsPanel; |
---|
| 1139 | + cGridBag setupPanel2; |
---|
| 1140 | + cGridBag objectCommandsPanel; |
---|
806 | 1141 | cGridBag pushPanel; |
---|
807 | 1142 | cGridBag fillPanel; |
---|
808 | 1143 | |
---|
.. | .. |
---|
973 | 1308 | |
---|
974 | 1309 | namePanel = new cGridBag(); |
---|
975 | 1310 | |
---|
| 1311 | + //if (copy.pinned) |
---|
| 1312 | + { |
---|
| 1313 | + pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF); |
---|
| 1314 | + pinButton.setSelected(copy.pinned); |
---|
| 1315 | + cGridBag t = new cGridBag(); |
---|
| 1316 | + t.preferredWidth = 2; |
---|
| 1317 | + t.add(pinButton); |
---|
| 1318 | + namePanel.add(t); |
---|
| 1319 | + |
---|
| 1320 | + pinButton.addItemListener(this); |
---|
| 1321 | + } |
---|
| 1322 | + |
---|
976 | 1323 | nameField = AddText(namePanel, copy.GetName()); |
---|
977 | | - namePanel.add(nameField); |
---|
| 1324 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
978 | 1325 | oe.ctrlPanel.add(namePanel); |
---|
979 | 1326 | |
---|
980 | 1327 | oe.ctrlPanel.Return(); |
---|
981 | 1328 | |
---|
982 | | - if (!GroupEditor.allparams) |
---|
| 1329 | + if (!allparams) |
---|
983 | 1330 | return; |
---|
984 | 1331 | |
---|
985 | 1332 | setupPanel = new cGridBag().setVertical(false); |
---|
986 | 1333 | |
---|
987 | 1334 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
988 | 1335 | liveCB.setToolTipText("Animate object"); |
---|
| 1336 | + markCB = AddCheckBox(setupPanel, "Anim", copy.marked); |
---|
| 1337 | + markCB.setToolTipText("Set target transform"); |
---|
| 1338 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1339 | + selectableCB.setToolTipText("Make object selectable"); |
---|
| 1340 | +// Return(); |
---|
| 1341 | + |
---|
989 | 1342 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
990 | 1343 | hideCB.setToolTipText("Hide object"); |
---|
991 | | -// Return(); |
---|
992 | | - markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
993 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
994 | 1344 | |
---|
995 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1345 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
| 1346 | + |
---|
| 1347 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1348 | + |
---|
| 1349 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
996 | 1350 | rewindCB.setToolTipText("Rewind animation"); |
---|
997 | 1351 | |
---|
998 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
999 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1352 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1353 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1000 | 1354 | |
---|
| 1355 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1356 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1357 | + |
---|
1001 | 1358 | if (Globals.ADVANCED) |
---|
1002 | 1359 | { |
---|
1003 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
1004 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1005 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1360 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1006 | 1361 | speedupCB.setToolTipText("Option motion capture"); |
---|
1007 | 1362 | } |
---|
1008 | 1363 | |
---|
1009 | 1364 | oe.ctrlPanel.add(setupPanel); |
---|
1010 | 1365 | oe.ctrlPanel.Return(); |
---|
| 1366 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1367 | + oe.ctrlPanel.Return(); |
---|
1011 | 1368 | |
---|
1012 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1369 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
1013 | 1370 | |
---|
1014 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1371 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
1015 | 1372 | resetButton.setToolTipText("Jump to frame zero"); |
---|
1016 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1373 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
1017 | 1374 | stepButton.setToolTipText("Step one frame"); |
---|
1018 | 1375 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
1019 | 1376 | // stepAllButton = AddButton(oe, "Step All"); |
---|
1020 | 1377 | // Return(); |
---|
1021 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1378 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
1022 | 1379 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
1023 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1380 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
1024 | 1381 | fasterButton.setToolTipText("Increase animation speed"); |
---|
1025 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1382 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
1026 | 1383 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
1027 | 1384 | |
---|
1028 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1385 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
1029 | 1386 | oe.ctrlPanel.Return(); |
---|
1030 | 1387 | |
---|
1031 | | - pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1); |
---|
| 1388 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
1032 | 1389 | normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
1033 | 1390 | //Return(); |
---|
1034 | 1391 | |
---|
.. | .. |
---|
1185 | 1542 | |
---|
1186 | 1543 | if (cam == null || !(copy.get(0) instanceof cGroup)) |
---|
1187 | 1544 | { |
---|
| 1545 | + if (Globals.DEBUG) |
---|
1188 | 1546 | System.out.println("CREATE CAMERAS"); |
---|
1189 | 1547 | cams = new cTemplate(); |
---|
1190 | 1548 | cams.name = "Cameras"; |
---|
.. | .. |
---|
1231 | 1589 | //worldPanel.setName("World"); |
---|
1232 | 1590 | centralPanel = new cGridBag(); |
---|
1233 | 1591 | centralPanel.preferredWidth = 20; |
---|
1234 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1235 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1592 | + |
---|
| 1593 | + if (Globals.ADVANCED) |
---|
| 1594 | + { |
---|
| 1595 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1596 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1236 | 1597 | |
---|
1237 | 1598 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1238 | 1599 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1241 | 1602 | // cameraPanel.setDividerSize(9); |
---|
1242 | 1603 | cameraPanel.setResizeWeight(1.0); |
---|
1243 | 1604 | |
---|
| 1605 | + } |
---|
| 1606 | + |
---|
1244 | 1607 | centralPanel.add(cameraView); |
---|
| 1608 | + centralPanel.setFocusable(true); |
---|
1245 | 1609 | //frame.setJMenuBar(timelineMenubar); |
---|
1246 | 1610 | //centralPanel.add(timelinePanel); |
---|
1247 | 1611 | |
---|
.. | .. |
---|
1267 | 1631 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1268 | 1632 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1269 | 1633 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1634 | + //XYZPanel.setName("XYZ"); |
---|
1270 | 1635 | |
---|
1271 | 1636 | /* |
---|
1272 | 1637 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1303 | 1668 | |
---|
1304 | 1669 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1305 | 1670 | //tmp.setName("Edit"); |
---|
| 1671 | + objectPanel.add(toolboxPanel); |
---|
| 1672 | + objectPanel.setIconAt(0, GetIcon("icons/primitives.png")); |
---|
| 1673 | + objectPanel.setToolTipTextAt(0, "Objects & textures"); |
---|
| 1674 | + |
---|
1306 | 1675 | objectPanel.add(materialPanel); |
---|
| 1676 | + objectPanel.setIconAt(1, GetIcon("icons/material.png")); |
---|
| 1677 | + objectPanel.setToolTipTextAt(1, "Material"); |
---|
| 1678 | + |
---|
| 1679 | + objectPanel.add(skyboxPanel); |
---|
| 1680 | + objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
| 1681 | + objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
| 1682 | + |
---|
1307 | 1683 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1308 | 1684 | // north.setName("Edit"); |
---|
1309 | 1685 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1310 | 1686 | // objectPanel.add(north); |
---|
1311 | | - objectPanel.add(ctrlPanel); |
---|
1312 | | - objectPanel.add(infoPanel); |
---|
1313 | | - |
---|
| 1687 | + objectPanel.add(editPanel); |
---|
| 1688 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1689 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
| 1690 | + |
---|
| 1691 | + objectPanel.add(XYZPanel); |
---|
| 1692 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1693 | + objectPanel.setToolTipTextAt(4, "XYZ/RGB transform"); |
---|
| 1694 | + |
---|
| 1695 | + patchMaterial = true; |
---|
| 1696 | + cameraView.patchMaterial = this; |
---|
| 1697 | + objectPanel.setSelectedIndex(1); |
---|
| 1698 | + |
---|
1314 | 1699 | /* |
---|
1315 | 1700 | aConstraints.gridx = 0; |
---|
1316 | 1701 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1318 | 1703 | aConstraints.gridy += 1; |
---|
1319 | 1704 | aConstraints.gridwidth = 1; |
---|
1320 | 1705 | mainPanel.add(objectPanel, aConstraints); |
---|
1321 | | - */ |
---|
| 1706 | + */ |
---|
1322 | 1707 | |
---|
1323 | 1708 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1324 | 1709 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1335 | 1720 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1336 | 1721 | tabbedPane.add(scrollpane); |
---|
1337 | 1722 | |
---|
1338 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1339 | | - |
---|
1340 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1723 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1341 | 1724 | |
---|
1342 | 1725 | optionsPanel.setName("Options"); |
---|
1343 | 1726 | |
---|
.. | .. |
---|
1345 | 1728 | |
---|
1346 | 1729 | tabbedPane.add(optionsPanel); |
---|
1347 | 1730 | |
---|
| 1731 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1732 | + |
---|
1348 | 1733 | scenePanel.add(tabbedPane); |
---|
1349 | 1734 | |
---|
| 1735 | + //if (Globals.ADVANCED) |
---|
| 1736 | +// tabbedPane.add(infoPanel); |
---|
| 1737 | +// tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
| 1738 | +// tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1739 | + |
---|
1350 | 1740 | /* |
---|
1351 | 1741 | cTree jTree = new cTree(null); |
---|
1352 | 1742 | ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
.. | .. |
---|
1408 | 1798 | bigThree = new cGridBag(); |
---|
1409 | 1799 | bigThree.addComponent(scenePanel); |
---|
1410 | 1800 | bigThree.addComponent(centralPanel); |
---|
1411 | | - bigThree.addComponent(XYZPanel); |
---|
| 1801 | + //bigThree.addComponent(XYZPanel); |
---|
1412 | 1802 | |
---|
1413 | 1803 | // // SIDE EFFECT!!! |
---|
1414 | 1804 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1417 | 1807 | // aConstraints.gridheight = 1; |
---|
1418 | 1808 | |
---|
1419 | 1809 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1420 | | - framePanel.setContinuousLayout(true); |
---|
1421 | | - framePanel.setOneTouchExpandable(true); |
---|
1422 | | - framePanel.setDividerLocation(0.8); |
---|
| 1810 | + |
---|
| 1811 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1812 | + new java.beans.PropertyChangeListener() |
---|
| 1813 | + { |
---|
| 1814 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1815 | + { |
---|
| 1816 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1817 | + { |
---|
| 1818 | + if (radio.layout != expandedLayout) |
---|
| 1819 | + { |
---|
| 1820 | + radio.layout = expandedLayout; |
---|
| 1821 | + radio.layout.doClick(); |
---|
| 1822 | + } |
---|
| 1823 | + } |
---|
| 1824 | + } |
---|
| 1825 | + }); |
---|
| 1826 | + |
---|
| 1827 | + framePanel.setContinuousLayout(false); |
---|
| 1828 | + framePanel.setOneTouchExpandable(false); |
---|
| 1829 | + //.setDividerLocation(0.8); |
---|
1423 | 1830 | //framePanel.setDividerSize(15); |
---|
1424 | 1831 | //framePanel.setResizeWeight(0.15); |
---|
1425 | 1832 | framePanel.setName("Frame"); |
---|
1426 | 1833 | |
---|
1427 | 1834 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1428 | 1835 | /**/ |
---|
1429 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1836 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1430 | 1837 | //worldPane.add(bigPanel); |
---|
1431 | 1838 | //worldPane.add(worldPanel); |
---|
1432 | 1839 | /**/ |
---|
.. | .. |
---|
1437 | 1844 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1438 | 1845 | |
---|
1439 | 1846 | frame.setSize(1280, 860); |
---|
1440 | | - frame.setVisible(true); |
---|
1441 | | - |
---|
| 1847 | + |
---|
| 1848 | + cameraView.requestFocusInWindow(); |
---|
| 1849 | + |
---|
1442 | 1850 | gridPanel.setDividerLocation(1.0); |
---|
| 1851 | + |
---|
| 1852 | + frame.validate(); |
---|
| 1853 | + |
---|
| 1854 | + frame.setVisible(true); |
---|
1443 | 1855 | |
---|
1444 | 1856 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1445 | 1857 | frame.addWindowListener(new WindowAdapter() |
---|
1446 | 1858 | { |
---|
1447 | | - |
---|
1448 | 1859 | public void windowClosing(WindowEvent e) |
---|
1449 | 1860 | { |
---|
1450 | 1861 | Close(); |
---|
.. | .. |
---|
1467 | 1878 | ctrlPanel.removeAll(); |
---|
1468 | 1879 | } |
---|
1469 | 1880 | |
---|
1470 | | - void SetupMaterial(cGridBag panel) |
---|
| 1881 | + void SetupMaterial(cGridBag materialpanel) |
---|
1471 | 1882 | { |
---|
1472 | | - /* |
---|
| 1883 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1884 | + |
---|
| 1885 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1886 | + skin.setToolTipText("Skin"); |
---|
| 1887 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1888 | + { |
---|
| 1889 | + public void mouseClicked(MouseEvent e) |
---|
| 1890 | + { |
---|
| 1891 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1892 | + cMaterial material = object.material; |
---|
| 1893 | + |
---|
| 1894 | + // Skin |
---|
| 1895 | + colorField.setFloat(material.color); |
---|
| 1896 | + float saturation = material.modulation; |
---|
| 1897 | + |
---|
| 1898 | + if (!cameraView.Skinshader) |
---|
| 1899 | + { |
---|
| 1900 | + saturation /= 1.5; |
---|
| 1901 | + } |
---|
| 1902 | + |
---|
| 1903 | + saturationField.setFloat(saturation); |
---|
| 1904 | + |
---|
| 1905 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1906 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1907 | + diffusenessField.setFloat(material.factor); |
---|
| 1908 | + shininessField.setFloat(material.shininess); |
---|
| 1909 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1910 | + diffuseField.setFloat(material.diffuse); |
---|
| 1911 | + specularField.setFloat(material.specular); |
---|
| 1912 | + |
---|
| 1913 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1914 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1915 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1916 | + |
---|
| 1917 | + materialtouched = true; |
---|
| 1918 | + applySelf(); |
---|
| 1919 | + } |
---|
| 1920 | + }); |
---|
| 1921 | + presetpanel.add(skin); |
---|
| 1922 | + |
---|
| 1923 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF); |
---|
| 1924 | + lambert.setToolTipText("Diffuse"); |
---|
| 1925 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 1926 | + { |
---|
| 1927 | + public void mouseClicked(MouseEvent e) |
---|
| 1928 | + { |
---|
| 1929 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 1930 | + cMaterial material = object.material; |
---|
| 1931 | + |
---|
| 1932 | + diffusenessField.setFloat(material.factor); |
---|
| 1933 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1934 | + |
---|
| 1935 | + materialtouched = true; |
---|
| 1936 | + applySelf(); |
---|
| 1937 | + } |
---|
| 1938 | + }); |
---|
| 1939 | + presetpanel.add(lambert); |
---|
| 1940 | + |
---|
| 1941 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF); |
---|
| 1942 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 1943 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 1944 | + { |
---|
| 1945 | + public void mouseClicked(MouseEvent e) |
---|
| 1946 | + { |
---|
| 1947 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 1948 | + cMaterial material = object.material; |
---|
| 1949 | + |
---|
| 1950 | + diffusenessField.setFloat(material.factor); |
---|
| 1951 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1952 | + |
---|
| 1953 | + materialtouched = true; |
---|
| 1954 | + applySelf(); |
---|
| 1955 | + } |
---|
| 1956 | + }); |
---|
| 1957 | + presetpanel.add(diffuse2); |
---|
| 1958 | + |
---|
| 1959 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF); |
---|
| 1960 | + diffusemoon.setToolTipText("Moon"); |
---|
| 1961 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 1962 | + { |
---|
| 1963 | + public void mouseClicked(MouseEvent e) |
---|
| 1964 | + { |
---|
| 1965 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 1966 | + cMaterial material = object.material; |
---|
| 1967 | + |
---|
| 1968 | + diffusenessField.setFloat(material.factor); |
---|
| 1969 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1970 | + |
---|
| 1971 | + materialtouched = true; |
---|
| 1972 | + applySelf(); |
---|
| 1973 | + } |
---|
| 1974 | + }); |
---|
| 1975 | + presetpanel.add(diffusemoon); |
---|
| 1976 | + |
---|
| 1977 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF); |
---|
| 1978 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 1979 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 1980 | + { |
---|
| 1981 | + public void mouseClicked(MouseEvent e) |
---|
| 1982 | + { |
---|
| 1983 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 1984 | + cMaterial material = object.material; |
---|
| 1985 | + |
---|
| 1986 | + diffusenessField.setFloat(material.factor); |
---|
| 1987 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1988 | + |
---|
| 1989 | + materialtouched = true; |
---|
| 1990 | + applySelf(); |
---|
| 1991 | + } |
---|
| 1992 | + }); |
---|
| 1993 | + presetpanel.add(diffusemoon2); |
---|
| 1994 | + |
---|
| 1995 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF); |
---|
| 1996 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 1997 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 1998 | + { |
---|
| 1999 | + public void mouseClicked(MouseEvent e) |
---|
| 2000 | + { |
---|
| 2001 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 2002 | + cMaterial material = object.material; |
---|
| 2003 | + |
---|
| 2004 | + diffusenessField.setFloat(material.factor); |
---|
| 2005 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2006 | + |
---|
| 2007 | + materialtouched = true; |
---|
| 2008 | + applySelf(); |
---|
| 2009 | + } |
---|
| 2010 | + }); |
---|
| 2011 | + presetpanel.add(diffusemoon3); |
---|
| 2012 | + |
---|
| 2013 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF); |
---|
| 2014 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 2015 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 2016 | + { |
---|
| 2017 | + public void mouseClicked(MouseEvent e) |
---|
| 2018 | + { |
---|
| 2019 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 2020 | + cMaterial material = object.material; |
---|
| 2021 | + |
---|
| 2022 | + sheenField.setFloat(material.sheen); |
---|
| 2023 | + |
---|
| 2024 | + materialtouched = true; |
---|
| 2025 | + applySelf(); |
---|
| 2026 | + } |
---|
| 2027 | + }); |
---|
| 2028 | + presetpanel.add(diffusesheen); |
---|
| 2029 | + |
---|
| 2030 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 2031 | + rough.setToolTipText("Rough metal"); |
---|
| 2032 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2033 | + { |
---|
| 2034 | + public void mouseClicked(MouseEvent e) |
---|
| 2035 | + { |
---|
| 2036 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2037 | + cMaterial material = object.material; |
---|
| 2038 | + |
---|
| 2039 | + shininessField.setFloat(material.shininess); |
---|
| 2040 | + velvetField.setFloat(material.velvet); |
---|
| 2041 | + |
---|
| 2042 | + materialtouched = true; |
---|
| 2043 | + applySelf(); |
---|
| 2044 | + } |
---|
| 2045 | + }); |
---|
| 2046 | + presetpanel.add(rough); |
---|
| 2047 | + |
---|
| 2048 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF); |
---|
| 2049 | + rough2.setToolTipText("Medium metal"); |
---|
| 2050 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2051 | + { |
---|
| 2052 | + public void mouseClicked(MouseEvent e) |
---|
| 2053 | + { |
---|
| 2054 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2055 | + cMaterial material = object.material; |
---|
| 2056 | + |
---|
| 2057 | + shininessField.setFloat(material.shininess); |
---|
| 2058 | + lightareaField.setFloat(material.lightarea); |
---|
| 2059 | + |
---|
| 2060 | + materialtouched = true; |
---|
| 2061 | + applySelf(); |
---|
| 2062 | + } |
---|
| 2063 | + }); |
---|
| 2064 | + presetpanel.add(rough2); |
---|
| 2065 | + |
---|
| 2066 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF); |
---|
| 2067 | + shini0.setToolTipText("Shiny"); |
---|
| 2068 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2069 | + { |
---|
| 2070 | + public void mouseClicked(MouseEvent e) |
---|
| 2071 | + { |
---|
| 2072 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2073 | + cMaterial material = object.material; |
---|
| 2074 | + |
---|
| 2075 | + shininessField.setFloat(material.shininess); |
---|
| 2076 | + lightareaField.setFloat(material.lightarea); |
---|
| 2077 | + |
---|
| 2078 | + materialtouched = true; |
---|
| 2079 | + applySelf(); |
---|
| 2080 | + } |
---|
| 2081 | + }); |
---|
| 2082 | + presetpanel.add(shini0); |
---|
| 2083 | + |
---|
| 2084 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF); |
---|
| 2085 | + shini1.setToolTipText("Shiny2"); |
---|
| 2086 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2087 | + { |
---|
| 2088 | + public void mouseClicked(MouseEvent e) |
---|
| 2089 | + { |
---|
| 2090 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2091 | + cMaterial material = object.material; |
---|
| 2092 | + |
---|
| 2093 | + shininessField.setFloat(material.shininess); |
---|
| 2094 | + lightareaField.setFloat(material.lightarea); |
---|
| 2095 | + |
---|
| 2096 | + materialtouched = true; |
---|
| 2097 | + applySelf(); |
---|
| 2098 | + } |
---|
| 2099 | + }); |
---|
| 2100 | + presetpanel.add(shini1); |
---|
| 2101 | + |
---|
| 2102 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF); |
---|
| 2103 | + shini2.setToolTipText("Shiny3"); |
---|
| 2104 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2105 | + { |
---|
| 2106 | + public void mouseClicked(MouseEvent e) |
---|
| 2107 | + { |
---|
| 2108 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2109 | + cMaterial material = object.material; |
---|
| 2110 | + |
---|
| 2111 | + shininessField.setFloat(material.shininess); |
---|
| 2112 | + lightareaField.setFloat(material.lightarea); |
---|
| 2113 | + |
---|
| 2114 | + materialtouched = true; |
---|
| 2115 | + applySelf(); |
---|
| 2116 | + } |
---|
| 2117 | + }); |
---|
| 2118 | + presetpanel.add(shini2); |
---|
| 2119 | + |
---|
| 2120 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF); |
---|
| 2121 | + aniso.setToolTipText("AnisoU"); |
---|
| 2122 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2123 | + { |
---|
| 2124 | + public void mouseClicked(MouseEvent e) |
---|
| 2125 | + { |
---|
| 2126 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2127 | + cMaterial material = object.material; |
---|
| 2128 | + |
---|
| 2129 | + anisoField.setFloat(material.aniso); |
---|
| 2130 | + anisoVField.setFloat(material.anisoV); |
---|
| 2131 | + |
---|
| 2132 | + materialtouched = true; |
---|
| 2133 | + applySelf(); |
---|
| 2134 | + } |
---|
| 2135 | + }); |
---|
| 2136 | + presetpanel.add(aniso); |
---|
| 2137 | + |
---|
| 2138 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF); |
---|
| 2139 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2140 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2141 | + { |
---|
| 2142 | + public void mouseClicked(MouseEvent e) |
---|
| 2143 | + { |
---|
| 2144 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2145 | + cMaterial material = object.material; |
---|
| 2146 | + |
---|
| 2147 | + anisoField.setFloat(material.aniso); |
---|
| 2148 | + anisoVField.setFloat(material.anisoV); |
---|
| 2149 | + |
---|
| 2150 | + materialtouched = true; |
---|
| 2151 | + applySelf(); |
---|
| 2152 | + } |
---|
| 2153 | + }); |
---|
| 2154 | + presetpanel.add(aniso2); |
---|
| 2155 | + |
---|
| 2156 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF); |
---|
| 2157 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2158 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2159 | + { |
---|
| 2160 | + public void mouseClicked(MouseEvent e) |
---|
| 2161 | + { |
---|
| 2162 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2163 | + cMaterial material = object.material; |
---|
| 2164 | + |
---|
| 2165 | + anisoField.setFloat(material.aniso); |
---|
| 2166 | + anisoVField.setFloat(material.anisoV); |
---|
| 2167 | + |
---|
| 2168 | + materialtouched = true; |
---|
| 2169 | + applySelf(); |
---|
| 2170 | + } |
---|
| 2171 | + }); |
---|
| 2172 | + presetpanel.add(aniso3); |
---|
| 2173 | + |
---|
| 2174 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF); |
---|
| 2175 | + velvet0.setToolTipText("Velvet"); |
---|
| 2176 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2177 | + { |
---|
| 2178 | + public void mouseClicked(MouseEvent e) |
---|
| 2179 | + { |
---|
| 2180 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2181 | + cMaterial material = object.material; |
---|
| 2182 | + |
---|
| 2183 | + diffusenessField.setFloat(material.factor); |
---|
| 2184 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2185 | + sheenField.setFloat(material.sheen); |
---|
| 2186 | + shininessField.setFloat(material.shininess); |
---|
| 2187 | + velvetField.setFloat(material.velvet); |
---|
| 2188 | + shiftField.setFloat(material.shift); |
---|
| 2189 | + |
---|
| 2190 | + materialtouched = true; |
---|
| 2191 | + applySelf(); |
---|
| 2192 | + } |
---|
| 2193 | + }); |
---|
| 2194 | + presetpanel.add(velvet0); |
---|
| 2195 | + |
---|
| 2196 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF); |
---|
| 2197 | + bump0.setToolTipText("Bump texture"); |
---|
| 2198 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2199 | + { |
---|
| 2200 | + public void mouseClicked(MouseEvent e) |
---|
| 2201 | + { |
---|
| 2202 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2203 | + cMaterial material = object.material; |
---|
| 2204 | + |
---|
| 2205 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2206 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2207 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2208 | + |
---|
| 2209 | + materialtouched = true; |
---|
| 2210 | + applySelf(); |
---|
| 2211 | + } |
---|
| 2212 | + }); |
---|
| 2213 | + presetpanel.add(bump0); |
---|
| 2214 | + |
---|
| 2215 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF); |
---|
| 2216 | + borderShader.setToolTipText("Border fade"); |
---|
| 2217 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2218 | + { |
---|
| 2219 | + public void mouseClicked(MouseEvent e) |
---|
| 2220 | + { |
---|
| 2221 | + borderfadeField.setFloat(0.5); |
---|
| 2222 | + opacityField.setFloat(0.75); |
---|
| 2223 | + |
---|
| 2224 | + materialtouched = true; |
---|
| 2225 | + applySelf(); |
---|
| 2226 | + } |
---|
| 2227 | + }); |
---|
| 2228 | + presetpanel.add(borderShader); |
---|
| 2229 | + |
---|
| 2230 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF); |
---|
| 2231 | + halo.setToolTipText("Halo"); |
---|
| 2232 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2233 | + { |
---|
| 2234 | + public void mouseClicked(MouseEvent e) |
---|
| 2235 | + { |
---|
| 2236 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2237 | + cMaterial material = object.material; |
---|
| 2238 | + |
---|
| 2239 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2240 | + |
---|
| 2241 | + materialtouched = true; |
---|
| 2242 | + applySelf(); |
---|
| 2243 | + } |
---|
| 2244 | + }); |
---|
| 2245 | + presetpanel.add(halo); |
---|
| 2246 | + |
---|
| 2247 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF); |
---|
| 2248 | + candle.setToolTipText("Candle"); |
---|
| 2249 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2250 | + { |
---|
| 2251 | + public void mouseClicked(MouseEvent e) |
---|
| 2252 | + { |
---|
| 2253 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2254 | + cMaterial material = object.material; |
---|
| 2255 | + |
---|
| 2256 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2257 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2258 | + ambientField.setFloat(material.ambient); |
---|
| 2259 | + specularField.setFloat(material.specular); |
---|
| 2260 | + lightareaField.setFloat(material.lightarea); |
---|
| 2261 | + shininessField.setFloat(material.shininess); |
---|
| 2262 | + |
---|
| 2263 | + materialtouched = true; |
---|
| 2264 | + applySelf(); |
---|
| 2265 | + } |
---|
| 2266 | + }); |
---|
| 2267 | + presetpanel.add(candle); |
---|
| 2268 | + |
---|
| 2269 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF); |
---|
| 2270 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2271 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2272 | + { |
---|
| 2273 | + public void mouseClicked(MouseEvent e) |
---|
| 2274 | + { |
---|
| 2275 | + diffuseField.setFloat(0.001); |
---|
| 2276 | + ambientField.setFloat(0.001); |
---|
| 2277 | + cameraField.setFloat(0.001); |
---|
| 2278 | + specularField.setFloat(0.001); |
---|
| 2279 | + fakedepthField.setFloat(0.001); |
---|
| 2280 | + opacityField.setFloat(0.6); |
---|
| 2281 | + |
---|
| 2282 | + materialtouched = true; |
---|
| 2283 | + applySelf(); |
---|
| 2284 | + } |
---|
| 2285 | + }); |
---|
| 2286 | + presetpanel.add(shadowShader); |
---|
| 2287 | + |
---|
| 2288 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2289 | + |
---|
| 2290 | + presetpanel.preferredWidth = 1; |
---|
| 2291 | + |
---|
| 2292 | + materialpanel.add(presetpanel); |
---|
| 2293 | + materialpanel.add(panel); |
---|
| 2294 | + |
---|
| 2295 | + panel.preferredWidth = 8; |
---|
| 2296 | + |
---|
| 2297 | + /* |
---|
1473 | 2298 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1474 | 2299 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1475 | | - */ |
---|
| 2300 | + */ |
---|
1476 | 2301 | |
---|
1477 | 2302 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1478 | 2303 | |
---|
1479 | | - editBar.add(createMaterialButton = new cButton("Create", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 2304 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1480 | 2305 | createMaterialButton.setToolTipText("Create material"); |
---|
1481 | 2306 | |
---|
1482 | 2307 | /* |
---|
1483 | 2308 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1484 | 2309 | */ |
---|
1485 | 2310 | |
---|
1486 | | - editBar.add(clearMaterialButton = new cButton("Clear", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 2311 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1487 | 2312 | clearMaterialButton.setToolTipText("Clear material"); |
---|
1488 | 2313 | |
---|
1489 | 2314 | if (Globals.ADVANCED) |
---|
1490 | 2315 | { |
---|
1491 | | - editBar.add(resetSlidersButton = new cButton("Reset", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 2316 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1492 | 2317 | editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1493 | 2318 | editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
1494 | 2319 | } |
---|
.. | .. |
---|
1506 | 2331 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1507 | 2332 | |
---|
1508 | 2333 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 2334 | + |
---|
| 2335 | + cGridBag huepanel = new cGridBag(); |
---|
| 2336 | + cGridBag huelabel = new cGridBag(); |
---|
| 2337 | + cLabel hue = GetLabel("icons/hue.png", false); |
---|
| 2338 | + hue.fit = true; |
---|
| 2339 | + |
---|
| 2340 | + hue.addMouseListener(new MouseAdapter() |
---|
| 2341 | + { |
---|
| 2342 | + public void mousePressed(MouseEvent e) |
---|
| 2343 | + { |
---|
| 2344 | + int x = e.getX(); |
---|
| 2345 | + |
---|
| 2346 | + colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth()); |
---|
| 2347 | + } |
---|
| 2348 | + }); |
---|
| 2349 | + |
---|
| 2350 | + huelabel.add(hue); |
---|
| 2351 | + huelabel.preferredWidth = 20; |
---|
| 2352 | + huepanel.add(new cGridBag()); // Label |
---|
| 2353 | + huepanel.add(huelabel); // Field/slider |
---|
| 2354 | + |
---|
| 2355 | + huepanel.preferredHeight = 7; |
---|
| 2356 | + |
---|
| 2357 | + colorSection.add(huepanel); |
---|
1509 | 2358 | |
---|
1510 | 2359 | cGridBag color = new cGridBag(); |
---|
1511 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1512 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1513 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2360 | + |
---|
| 2361 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 2362 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2363 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2364 | + |
---|
1514 | 2365 | //colorField.preferredWidth = 200; |
---|
1515 | 2366 | colorSection.add(color); |
---|
1516 | 2367 | |
---|
1517 | 2368 | cGridBag modulation = new cGridBag(); |
---|
1518 | 2369 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1519 | 2370 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1520 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2371 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1521 | 2372 | colorSection.add(modulation); |
---|
1522 | 2373 | |
---|
| 2374 | + cGridBag opacity = new cGridBag(); |
---|
| 2375 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 2376 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2377 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2378 | + colorSection.add(opacity); |
---|
| 2379 | + |
---|
| 2380 | + colorSection.add(GetSeparator()); |
---|
| 2381 | + |
---|
1523 | 2382 | cGridBag texture = new cGridBag(); |
---|
1524 | 2383 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1525 | 2384 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1526 | 2385 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1527 | 2386 | colorSection.add(texture); |
---|
1528 | 2387 | |
---|
1529 | | - cGridBag anisoU = new cGridBag(); |
---|
1530 | | - anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
1531 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1532 | | - anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1533 | | - colorSection.add(anisoU); |
---|
1534 | | - |
---|
1535 | | - cGridBag anisoV = new cGridBag(); |
---|
1536 | | - anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
1537 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1538 | | - anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1539 | | - colorSection.add(anisoV); |
---|
1540 | | - |
---|
1541 | | - cGridBag shadowbias = new cGridBag(); |
---|
1542 | | - shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
1543 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1544 | | - shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1545 | | - colorSection.add(shadowbias); |
---|
1546 | | - |
---|
1547 | | - panel.add(new JSeparator()); |
---|
| 2388 | + panel.add(GetSeparator()); |
---|
1548 | 2389 | |
---|
1549 | 2390 | panel.add(colorSection); |
---|
1550 | 2391 | |
---|
.. | .. |
---|
1594 | 2435 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1595 | 2436 | diffuseSection.add(fakedepth); |
---|
1596 | 2437 | |
---|
1597 | | - panel.add(new JSeparator()); |
---|
| 2438 | + cGridBag shadowbias = new cGridBag(); |
---|
| 2439 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 2440 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2441 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2442 | + diffuseSection.add(shadowbias); |
---|
| 2443 | + |
---|
| 2444 | + panel.add(GetSeparator()); |
---|
1598 | 2445 | |
---|
1599 | 2446 | panel.add(diffuseSection); |
---|
1600 | 2447 | |
---|
.. | .. |
---|
1644 | 2491 | // aConstraints.gridy += 1; |
---|
1645 | 2492 | // aConstraints.gridwidth = 1; |
---|
1646 | 2493 | |
---|
| 2494 | + cGridBag anisoU = new cGridBag(); |
---|
| 2495 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 2496 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2497 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2498 | + specularSection.add(anisoU); |
---|
1647 | 2499 | |
---|
1648 | | - panel.add(new JSeparator()); |
---|
| 2500 | + cGridBag anisoV = new cGridBag(); |
---|
| 2501 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 2502 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2503 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2504 | + specularSection.add(anisoV); |
---|
| 2505 | + |
---|
| 2506 | + |
---|
| 2507 | + panel.add(GetSeparator()); |
---|
1649 | 2508 | |
---|
1650 | 2509 | panel.add(specularSection); |
---|
1651 | 2510 | |
---|
1652 | 2511 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1653 | 2512 | |
---|
1654 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 2513 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1655 | 2514 | |
---|
1656 | 2515 | cGridBag camera = new cGridBag(); |
---|
1657 | 2516 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1658 | 2517 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1659 | 2518 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1660 | | - globalSection.add(camera); |
---|
| 2519 | + colorSection.add(camera); |
---|
1661 | 2520 | |
---|
1662 | 2521 | cGridBag ambient = new cGridBag(); |
---|
1663 | 2522 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1664 | 2523 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1665 | 2524 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1666 | | - globalSection.add(ambient); |
---|
| 2525 | + colorSection.add(ambient); |
---|
1667 | 2526 | |
---|
1668 | 2527 | cGridBag backlit = new cGridBag(); |
---|
1669 | 2528 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1670 | 2529 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1671 | 2530 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1672 | | - globalSection.add(backlit); |
---|
| 2531 | + colorSection.add(backlit); |
---|
1673 | 2532 | |
---|
1674 | | - cGridBag opacity = new cGridBag(); |
---|
1675 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1676 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1677 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1678 | | - globalSection.add(opacity); |
---|
1679 | | - |
---|
1680 | | - panel.add(new JSeparator()); |
---|
| 2533 | + //panel.add(new JSeparator()); |
---|
1681 | 2534 | |
---|
1682 | | - panel.add(globalSection); |
---|
| 2535 | + //panel.add(globalSection); |
---|
1683 | 2536 | |
---|
1684 | 2537 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1685 | 2538 | |
---|
.. | .. |
---|
1721 | 2574 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1722 | 2575 | textureSection.add(opacityPower); |
---|
1723 | 2576 | |
---|
1724 | | - panel.add(new JSeparator()); |
---|
| 2577 | + panel.add(GetSeparator()); |
---|
1725 | 2578 | |
---|
1726 | 2579 | panel.add(textureSection); |
---|
1727 | 2580 | |
---|
.. | .. |
---|
1786 | 2639 | // 3D models |
---|
1787 | 2640 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1788 | 2641 | { |
---|
1789 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1790 | | - LoadFile(filename, lastConverter); |
---|
| 2642 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2643 | + //LoadFile(filename, lastConverter); |
---|
| 2644 | + LoadObjFile(filename); // New 3ds loader |
---|
1791 | 2645 | continue; |
---|
1792 | 2646 | } |
---|
1793 | 2647 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
1988 | 2842 | e2.printStackTrace(); |
---|
1989 | 2843 | } |
---|
1990 | 2844 | } |
---|
| 2845 | + |
---|
1991 | 2846 | LoadJMEThread loadThread; |
---|
1992 | 2847 | |
---|
1993 | 2848 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
2045 | 2900 | //LoadFile0(filename, converter); |
---|
2046 | 2901 | } |
---|
2047 | 2902 | } |
---|
| 2903 | + |
---|
2048 | 2904 | LoadOBJThread loadObjThread; |
---|
2049 | 2905 | |
---|
2050 | 2906 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2123 | 2979 | |
---|
2124 | 2980 | void LoadObjFile(String fullname) |
---|
2125 | 2981 | { |
---|
2126 | | - /* |
---|
| 2982 | + System.out.println("Loading " + fullname); |
---|
| 2983 | + /**/ |
---|
2127 | 2984 | //lastFilename = fullname; |
---|
2128 | 2985 | if(loadObjThread == null) |
---|
2129 | 2986 | { |
---|
2130 | | - loadObjThread = new LoadOBJThread(); |
---|
2131 | | - loadObjThread.start(); |
---|
| 2987 | + loadObjThread = new LoadOBJThread(); |
---|
| 2988 | + loadObjThread.start(); |
---|
2132 | 2989 | } |
---|
2133 | 2990 | |
---|
2134 | 2991 | loadObjThread.add(fullname); |
---|
2135 | | - */ |
---|
| 2992 | + /**/ |
---|
2136 | 2993 | |
---|
2137 | | - System.out.println("Loading " + fullname); |
---|
2138 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2994 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2139 | 2995 | } |
---|
2140 | 2996 | |
---|
2141 | 2997 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2396 | 3252 | |
---|
2397 | 3253 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2398 | 3254 | { |
---|
2399 | | - if (GrafreeD.standAlone) |
---|
| 3255 | + if (Grafreed.standAlone) |
---|
2400 | 3256 | { |
---|
2401 | 3257 | /**/ |
---|
2402 | 3258 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
.. | .. |
---|
2511 | 3367 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2512 | 3368 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2513 | 3369 | } |
---|
| 3370 | + |
---|
2514 | 3371 | //cJME.count++; |
---|
2515 | 3372 | //cJME.count %= 12; |
---|
2516 | 3373 | if (gc) |
---|
.. | .. |
---|
2694 | 3551 | } |
---|
2695 | 3552 | } |
---|
2696 | 3553 | } |
---|
| 3554 | + |
---|
2697 | 3555 | cFileSystemPane FSPane; |
---|
2698 | 3556 | |
---|
2699 | 3557 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2703 | 3561 | |
---|
2704 | 3562 | freezematerial = true; |
---|
2705 | 3563 | colorField.setFloat(mat.color); |
---|
2706 | | - modulationField.setFloat(mat.modulation); |
---|
| 3564 | + saturationField.setFloat(mat.modulation); |
---|
2707 | 3565 | metalnessField.setFloat(mat.metalness); |
---|
2708 | 3566 | diffuseField.setFloat(mat.diffuse); |
---|
2709 | 3567 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
2747 | 3605 | } |
---|
2748 | 3606 | } |
---|
2749 | 3607 | } |
---|
| 3608 | + |
---|
2750 | 3609 | freezematerial = false; |
---|
2751 | 3610 | } |
---|
2752 | 3611 | |
---|
2753 | 3612 | void SetMaterial(Object3D object) |
---|
2754 | 3613 | { |
---|
| 3614 | + latestObject = object; |
---|
| 3615 | + |
---|
2755 | 3616 | cMaterial mat = object.material; |
---|
2756 | 3617 | |
---|
2757 | 3618 | if (mat == null) |
---|
.. | .. |
---|
2762 | 3623 | |
---|
2763 | 3624 | if (multiplyToggle != null) |
---|
2764 | 3625 | multiplyToggle.setSelected(mat.multiply); |
---|
2765 | | - |
---|
2766 | | - assert (object.projectedVertices != null); |
---|
2767 | | - |
---|
2768 | | - if (object.projectedVertices.length <= 2) |
---|
2769 | | - { |
---|
2770 | | - // Side effect... |
---|
2771 | | - Object3D.cVector2[] keep = object.projectedVertices; |
---|
2772 | | - object.projectedVertices = new Object3D.cVector2[3]; |
---|
2773 | | - for (int i = 0; i < 3; i++) |
---|
2774 | | - { |
---|
2775 | | - if (i < keep.length) |
---|
2776 | | - { |
---|
2777 | | - object.projectedVertices[i] = keep[i]; |
---|
2778 | | - } else |
---|
2779 | | - { |
---|
2780 | | - object.projectedVertices[i] = new Object3D.cVector2(); |
---|
2781 | | - } |
---|
2782 | | - /* |
---|
2783 | | - if(keep.length == 0) |
---|
2784 | | - object.projectedVertices[0] = new Object3D.cVector2(); |
---|
2785 | | - else |
---|
2786 | | - object.projectedVertices[0] = keep[0]; |
---|
2787 | | - object.projectedVertices[1] = new Object3D.cVector2(); |
---|
2788 | | - */ |
---|
2789 | | - } |
---|
2790 | | - } |
---|
| 3626 | + |
---|
| 3627 | + AllocProjectedVertices(object); |
---|
2791 | 3628 | |
---|
2792 | 3629 | SetMaterial(mat, object.projectedVertices); |
---|
2793 | 3630 | } |
---|
.. | .. |
---|
2863 | 3700 | // } |
---|
2864 | 3701 | |
---|
2865 | 3702 | /**/ |
---|
2866 | | - if (deselect) |
---|
| 3703 | + if (deselect || child == null) |
---|
2867 | 3704 | { |
---|
2868 | 3705 | //group.deselectAll(); |
---|
2869 | 3706 | //freeze = true; |
---|
2870 | 3707 | GetTree().clearSelection(); |
---|
2871 | 3708 | //freeze = false; |
---|
| 3709 | + |
---|
| 3710 | + if (child == null) |
---|
| 3711 | + { |
---|
| 3712 | + return; |
---|
| 3713 | + } |
---|
2872 | 3714 | } |
---|
2873 | 3715 | |
---|
2874 | 3716 | //group.addSelectee(child); |
---|
.. | .. |
---|
2902 | 3744 | public void itemStateChanged(ItemEvent event) |
---|
2903 | 3745 | { |
---|
2904 | 3746 | // System.out.println("Propagate = " + propagate); |
---|
| 3747 | + if (event.getSource() == pinButton) |
---|
| 3748 | + { |
---|
| 3749 | + copy.pinned ^= true; |
---|
| 3750 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3751 | + { |
---|
| 3752 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3753 | + copy.CloseUI(); |
---|
| 3754 | + //copy.editWindow.refreshContents(); |
---|
| 3755 | + } |
---|
| 3756 | + } |
---|
| 3757 | + else |
---|
2905 | 3758 | if (event.getSource() == propagateToggle) |
---|
2906 | 3759 | { |
---|
2907 | 3760 | propagate ^= true; |
---|
.. | .. |
---|
2937 | 3790 | cameraView.ToggleDL(); |
---|
2938 | 3791 | cameraView.repaint(); |
---|
2939 | 3792 | return; |
---|
2940 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3793 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2941 | 3794 | { |
---|
2942 | 3795 | cameraView.ToggleTexture(); |
---|
2943 | 3796 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2976 | 3829 | frame.validate(); |
---|
2977 | 3830 | |
---|
2978 | 3831 | return; |
---|
2979 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3832 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2980 | 3833 | { |
---|
2981 | | - cameraView.ToggleRandom(); |
---|
| 3834 | + cameraView.ToggleSwitch(); |
---|
2982 | 3835 | cameraView.repaint(); |
---|
2983 | 3836 | return; |
---|
2984 | 3837 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
3006 | 3859 | } else if (event.getSource() == liveCB) |
---|
3007 | 3860 | { |
---|
3008 | 3861 | copy.live ^= true; |
---|
| 3862 | + objEditor.refreshContents(true); // To show item colors |
---|
| 3863 | + return; |
---|
| 3864 | + } else if (event.getSource() == selectableCB) |
---|
| 3865 | + { |
---|
| 3866 | + copy.dontselect ^= true; |
---|
3009 | 3867 | return; |
---|
3010 | 3868 | } else if (event.getSource() == hideCB) |
---|
3011 | 3869 | { |
---|
3012 | 3870 | copy.hide ^= true; |
---|
3013 | 3871 | copy.Touch(); // display list issue |
---|
3014 | | - objEditor.refreshContents(); |
---|
| 3872 | + objEditor.refreshContents(true); // To show item colors |
---|
3015 | 3873 | return; |
---|
3016 | 3874 | } else if (event.getSource() == link2masterCB) |
---|
3017 | 3875 | { |
---|
.. | .. |
---|
3045 | 3903 | |
---|
3046 | 3904 | public void actionPerformed(ActionEvent event) |
---|
3047 | 3905 | { |
---|
| 3906 | + Object source = event.getSource(); |
---|
3048 | 3907 | // SCRIPT DIALOG |
---|
3049 | | - if (event.getSource() == okbutton) |
---|
| 3908 | + if (source == okbutton) |
---|
3050 | 3909 | { |
---|
3051 | 3910 | textpanel.setVisible(false); |
---|
3052 | 3911 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3058 | 3917 | textarea = null; |
---|
3059 | 3918 | textpanel = null; |
---|
3060 | 3919 | } |
---|
3061 | | - if (event.getSource() == cancelbutton) |
---|
| 3920 | + if (source == cancelbutton) |
---|
3062 | 3921 | { |
---|
3063 | 3922 | textpanel.setVisible(false); |
---|
3064 | 3923 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3070 | 3929 | //applySelf(); |
---|
3071 | 3930 | //client.refreshEditWindow(); |
---|
3072 | 3931 | //refreshContents(); |
---|
3073 | | - if (event.getSource() == nameField) |
---|
| 3932 | + if (source == nameField) |
---|
3074 | 3933 | { |
---|
3075 | 3934 | //System.out.println("ObjEditor " + event); |
---|
3076 | 3935 | applySelf0(true); |
---|
3077 | 3936 | //parent.applySelf(); |
---|
3078 | | - objEditor.refreshContents(); |
---|
3079 | | - } else if (event.getSource() == resetButton) |
---|
| 3937 | + // conflicts with requestFocus objEditor.refreshContents(); |
---|
| 3938 | + } else if (source == resetButton) |
---|
3080 | 3939 | { |
---|
3081 | 3940 | CameraPane.fullreset = true; |
---|
3082 | 3941 | copy.Reset(); // ResetMeshes(); |
---|
3083 | 3942 | copy.Touch(); |
---|
3084 | 3943 | objEditor.refreshContents(); |
---|
3085 | | - } else if (event.getSource() == stepItem) |
---|
| 3944 | + } else if (source == stepItem) |
---|
3086 | 3945 | { |
---|
3087 | 3946 | //cameraView.ONESTEP = true; |
---|
3088 | 3947 | Globals.ONESTEP = true; |
---|
3089 | 3948 | cameraView.repaint(); |
---|
3090 | 3949 | return; |
---|
3091 | | - } else if (event.getSource() == stepButton) |
---|
| 3950 | + } else if (source == stepButton) |
---|
3092 | 3951 | { |
---|
3093 | 3952 | copy.Step(); |
---|
3094 | 3953 | copy.Touch(); |
---|
3095 | 3954 | objEditor.refreshContents(); |
---|
3096 | | - } else if (event.getSource() == slowerButton) |
---|
| 3955 | + } else if (source == slowerButton) |
---|
3097 | 3956 | { |
---|
3098 | 3957 | copy.Slower(); |
---|
3099 | 3958 | copy.Touch(); |
---|
3100 | 3959 | objEditor.refreshContents(); |
---|
3101 | | - } else if (event.getSource() == fasterButton) |
---|
| 3960 | + } else if (source == fasterButton) |
---|
3102 | 3961 | { |
---|
3103 | 3962 | copy.Faster(); |
---|
3104 | 3963 | copy.Touch(); |
---|
3105 | 3964 | objEditor.refreshContents(); |
---|
3106 | | - } else if (event.getSource() == remarkButton) |
---|
| 3965 | + } else if (source == remarkButton) |
---|
3107 | 3966 | { |
---|
3108 | 3967 | copy.Remark(); |
---|
3109 | 3968 | copy.Touch(); |
---|
3110 | 3969 | objEditor.refreshContents(); |
---|
3111 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3970 | + } else if (source == stepAllButton) |
---|
3112 | 3971 | { |
---|
3113 | 3972 | copy.StepAll(); |
---|
3114 | 3973 | copy.Touch(); |
---|
3115 | 3974 | objEditor.refreshContents(); |
---|
3116 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3975 | + } else if (source == resetAllButton) |
---|
3117 | 3976 | { |
---|
3118 | 3977 | //CameraPane.fullreset = true; |
---|
3119 | 3978 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3146 | 4005 | // Close(); |
---|
3147 | 4006 | // } |
---|
3148 | 4007 | // else |
---|
3149 | | - if (event.getSource() == resetSlidersButton) |
---|
| 4008 | + if (source == resetSlidersButton) |
---|
3150 | 4009 | { |
---|
3151 | 4010 | ResetSliders(); |
---|
3152 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 4011 | + } else if (source == clearMaterialButton) |
---|
3153 | 4012 | { |
---|
3154 | 4013 | ClearMaterial(); |
---|
3155 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 4014 | + } else if (source == createMaterialButton) |
---|
3156 | 4015 | { |
---|
3157 | 4016 | CreateMaterial(); |
---|
3158 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 4017 | + } else if (source == clearPanelButton) |
---|
3159 | 4018 | { |
---|
3160 | 4019 | copy.ClearUI(); |
---|
3161 | 4020 | refreshContents(true); |
---|
3162 | | - } /* |
---|
3163 | | - } |
---|
3164 | | - |
---|
3165 | | - public boolean action(Event event, Object arg) |
---|
3166 | | - { |
---|
3167 | | - */ else if (event.getSource() == closeItem) |
---|
| 4021 | + } else if (source == importGFDItem) |
---|
| 4022 | + { |
---|
| 4023 | + ImportGFD(); |
---|
| 4024 | + } else |
---|
| 4025 | + if (source == importVRMLX3DItem) |
---|
| 4026 | + { |
---|
| 4027 | + ImportVRMLX3D(); |
---|
| 4028 | + } else |
---|
| 4029 | + if (source == import3DSItem) |
---|
| 4030 | + { |
---|
| 4031 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 4032 | + } else |
---|
| 4033 | + if (source == importOBJItem) |
---|
| 4034 | + { |
---|
| 4035 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 4036 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 4037 | + browser.setVisible(true); |
---|
| 4038 | + String filename = browser.getFile(); |
---|
| 4039 | + if (filename != null && filename.length() > 0) |
---|
| 4040 | + { |
---|
| 4041 | + String fullname = browser.getDirectory() + filename; |
---|
| 4042 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 4043 | + } |
---|
| 4044 | + } else |
---|
| 4045 | + if (source == closeItem) |
---|
3168 | 4046 | { |
---|
3169 | 4047 | Close(); |
---|
3170 | 4048 | //return true; |
---|
3171 | | - } else if (event.getSource() == loadItem) |
---|
| 4049 | + } else if (source == openItem) |
---|
3172 | 4050 | { |
---|
3173 | | - load(); |
---|
| 4051 | + Open(); |
---|
3174 | 4052 | //return true; |
---|
3175 | | - } else if (event.getSource() == saveItem) |
---|
| 4053 | + } else if (source == newItem) |
---|
| 4054 | + { |
---|
| 4055 | + New(); |
---|
| 4056 | + } else if (source == saveItem) |
---|
3176 | 4057 | { |
---|
3177 | 4058 | save(); |
---|
3178 | 4059 | //return true; |
---|
3179 | | - } else if (event.getSource() == saveAsItem) |
---|
| 4060 | + } else if (source == saveAsItem) |
---|
3180 | 4061 | { |
---|
3181 | 4062 | saveAs(); |
---|
3182 | 4063 | //return true; |
---|
3183 | | - } else if (event.getSource() == reexportItem) |
---|
| 4064 | + } else if (source == reexportItem) |
---|
3184 | 4065 | { |
---|
3185 | 4066 | reexport(); |
---|
3186 | 4067 | //return true; |
---|
3187 | | - } else if (event.getSource() == exportAsItem) |
---|
| 4068 | + } else if (source == exportAsItem) |
---|
3188 | 4069 | { |
---|
3189 | 4070 | export(); |
---|
3190 | 4071 | //return true; |
---|
3191 | | - } else if (event.getSource() == povItem) |
---|
| 4072 | + } else if (source == povItem) |
---|
3192 | 4073 | { |
---|
3193 | 4074 | generatePOV(); |
---|
3194 | 4075 | //return true; |
---|
3195 | | - } else if (event.getSource() == zBufferItem) |
---|
| 4076 | + } else if (event.getSource() == archiveItem) |
---|
| 4077 | + { |
---|
| 4078 | + cTools.Archive(frame); |
---|
| 4079 | + return; |
---|
| 4080 | + } else if (source == zBufferItem) |
---|
3196 | 4081 | { |
---|
3197 | 4082 | try |
---|
3198 | 4083 | { |
---|
.. | .. |
---|
3214 | 4099 | cameraView.repaint(); |
---|
3215 | 4100 | //return true; |
---|
3216 | 4101 | } |
---|
3217 | | - */ else if (event.getSource() == editCameraItem) |
---|
3218 | | - { |
---|
3219 | | - cameraView.ProtectCamera(); |
---|
3220 | | - cameraView.repaint(); |
---|
3221 | | - return; |
---|
3222 | | - } else if (event.getSource() == revertCameraItem) |
---|
3223 | | - { |
---|
3224 | | - cameraView.RevertCamera(); |
---|
3225 | | - cameraView.repaint(); |
---|
3226 | | - return; |
---|
3227 | | -// } else if (event.getSource() == textureButton) |
---|
3228 | | -// { |
---|
3229 | | -// return; // true; |
---|
3230 | | - } else // combos... |
---|
3231 | | - if (event.getSource() == texresMenu) |
---|
| 4102 | + */ else // combos... |
---|
| 4103 | + if (source == texresMenu) |
---|
3232 | 4104 | { |
---|
3233 | 4105 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3234 | 4106 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3240 | 4112 | } |
---|
3241 | 4113 | } |
---|
3242 | 4114 | |
---|
| 4115 | + void New() |
---|
| 4116 | + { |
---|
| 4117 | + while (copy.Size() > 1) |
---|
| 4118 | + { |
---|
| 4119 | + copy.remove(1); |
---|
| 4120 | + } |
---|
| 4121 | + |
---|
| 4122 | + ResetModel(); |
---|
| 4123 | + objEditor.refreshContents(); |
---|
| 4124 | + } |
---|
| 4125 | + |
---|
| 4126 | + static public byte[] Compress(Object3D o) |
---|
| 4127 | + { |
---|
| 4128 | + // Slower to actually compress. |
---|
| 4129 | + try |
---|
| 4130 | + { |
---|
| 4131 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 4132 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 4133 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
| 4134 | + |
---|
| 4135 | + Object3D parent = o.parent; |
---|
| 4136 | + o.parent = null; |
---|
| 4137 | + |
---|
| 4138 | + out.writeObject(o); |
---|
| 4139 | + |
---|
| 4140 | + o.parent = parent; |
---|
| 4141 | + |
---|
| 4142 | + out.flush(); |
---|
| 4143 | + |
---|
| 4144 | + baos //zstream |
---|
| 4145 | + .close(); |
---|
| 4146 | + out.close(); |
---|
| 4147 | + |
---|
| 4148 | + byte[] bytes = baos.toByteArray(); |
---|
| 4149 | + |
---|
| 4150 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 4151 | + return bytes; |
---|
| 4152 | + } catch (Exception e) |
---|
| 4153 | + { |
---|
| 4154 | + System.err.println(e); |
---|
| 4155 | + return null; |
---|
| 4156 | + } |
---|
| 4157 | + } |
---|
| 4158 | + |
---|
| 4159 | + static public Object Uncompress(byte[] bytes) |
---|
| 4160 | + { |
---|
| 4161 | + System.out.println("restore #bytes = " + bytes.length); |
---|
| 4162 | + try |
---|
| 4163 | + { |
---|
| 4164 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 4165 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 4166 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
| 4167 | + Object obj = in.readObject(); |
---|
| 4168 | + |
---|
| 4169 | + bais //istream |
---|
| 4170 | + .close(); |
---|
| 4171 | + in.close(); |
---|
| 4172 | + |
---|
| 4173 | + return obj; |
---|
| 4174 | + } catch (Exception e) |
---|
| 4175 | + { |
---|
| 4176 | + System.err.println(e); |
---|
| 4177 | + return null; |
---|
| 4178 | + } |
---|
| 4179 | + } |
---|
| 4180 | + |
---|
| 4181 | + static public Object clone(Object o) |
---|
| 4182 | + { |
---|
| 4183 | + try |
---|
| 4184 | + { |
---|
| 4185 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 4186 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 4187 | + |
---|
| 4188 | + out.writeObject(o); |
---|
| 4189 | + |
---|
| 4190 | + out.flush(); |
---|
| 4191 | + out.close(); |
---|
| 4192 | + |
---|
| 4193 | + byte[] bytes = baos.toByteArray(); |
---|
| 4194 | + |
---|
| 4195 | + System.out.println("clone = " + bytes.length); |
---|
| 4196 | + |
---|
| 4197 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 4198 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 4199 | + Object obj = in.readObject(); |
---|
| 4200 | + in.close(); |
---|
| 4201 | + |
---|
| 4202 | + return obj; |
---|
| 4203 | + } catch (Exception e) |
---|
| 4204 | + { |
---|
| 4205 | + System.err.println(e); |
---|
| 4206 | + return null; |
---|
| 4207 | + } |
---|
| 4208 | + } |
---|
| 4209 | + |
---|
| 4210 | + cRadio GetCurrentTab() |
---|
| 4211 | + { |
---|
| 4212 | + cRadio ab; |
---|
| 4213 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 4214 | + { |
---|
| 4215 | + ab = (cRadio)e.nextElement(); |
---|
| 4216 | + if(ab.GetObject() == copy) |
---|
| 4217 | + { |
---|
| 4218 | + return ab; |
---|
| 4219 | + } |
---|
| 4220 | + } |
---|
| 4221 | + |
---|
| 4222 | + return null; |
---|
| 4223 | + } |
---|
| 4224 | + |
---|
| 4225 | + |
---|
| 4226 | + public void Save() |
---|
| 4227 | + { |
---|
| 4228 | + //Save(true); |
---|
| 4229 | + Replace(); |
---|
| 4230 | + SetVersionStates(); |
---|
| 4231 | + } |
---|
| 4232 | + |
---|
| 4233 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 4234 | + { |
---|
| 4235 | + if (compress.length != name.length) |
---|
| 4236 | + { |
---|
| 4237 | + return false; |
---|
| 4238 | + } |
---|
| 4239 | + |
---|
| 4240 | + for (int i=compress.length; --i>=0;) |
---|
| 4241 | + { |
---|
| 4242 | + if (compress[i] != name[i]) |
---|
| 4243 | + return false; |
---|
| 4244 | + } |
---|
| 4245 | + |
---|
| 4246 | + return true; |
---|
| 4247 | + } |
---|
| 4248 | + |
---|
| 4249 | + void DeleteVersion() |
---|
| 4250 | + { |
---|
| 4251 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4252 | + { |
---|
| 4253 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4254 | + } |
---|
| 4255 | + |
---|
| 4256 | + if (copy.versionlist[copy.versionindex] == null) |
---|
| 4257 | + copy.versionindex -= 1; |
---|
| 4258 | + |
---|
| 4259 | + if (copy.versionindex != -1) |
---|
| 4260 | + CopyChanged(); |
---|
| 4261 | + |
---|
| 4262 | + SetVersionStates(); |
---|
| 4263 | + } |
---|
| 4264 | + |
---|
| 4265 | + public boolean Save(boolean user) |
---|
| 4266 | + { |
---|
| 4267 | + System.err.println("Save"); |
---|
| 4268 | + Replace(); |
---|
| 4269 | + |
---|
| 4270 | + //cRadio tab = GetCurrentTab(); |
---|
| 4271 | + |
---|
| 4272 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
| 4273 | + |
---|
| 4274 | + boolean thesame = false; |
---|
| 4275 | + |
---|
| 4276 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4277 | +// { |
---|
| 4278 | +// thesame = true; |
---|
| 4279 | +// } |
---|
| 4280 | + |
---|
| 4281 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 4282 | + if (!thesame) |
---|
| 4283 | + { |
---|
| 4284 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4285 | + { |
---|
| 4286 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4287 | + } |
---|
| 4288 | + |
---|
| 4289 | + //tab.user[tab.versionindex] = user; |
---|
| 4290 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 4291 | + |
---|
| 4292 | + copy.versionlist[++copy.versionindex] = compress; |
---|
| 4293 | + |
---|
| 4294 | + // if (increment) |
---|
| 4295 | + // tab.versionindex++; |
---|
| 4296 | + } |
---|
| 4297 | + |
---|
| 4298 | + //copy.RestoreBigData(versiontable); |
---|
| 4299 | + |
---|
| 4300 | + //assert(hashtable.isEmpty()); |
---|
| 4301 | + |
---|
| 4302 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4303 | +// { |
---|
| 4304 | +// //tab.user[i] = false; |
---|
| 4305 | +// copy.versionlist[i] = null; |
---|
| 4306 | +// } |
---|
| 4307 | + |
---|
| 4308 | + SetVersionStates(); |
---|
| 4309 | + |
---|
| 4310 | + // test save |
---|
| 4311 | + if (false) |
---|
| 4312 | + { |
---|
| 4313 | + try |
---|
| 4314 | + { |
---|
| 4315 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
| 4316 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4317 | + |
---|
| 4318 | + p.writeObject(copy); |
---|
| 4319 | + |
---|
| 4320 | + p.flush(); |
---|
| 4321 | + |
---|
| 4322 | + ostream.close(); |
---|
| 4323 | + } catch (Exception e) |
---|
| 4324 | + { |
---|
| 4325 | + e.printStackTrace(); |
---|
| 4326 | + } |
---|
| 4327 | + } |
---|
| 4328 | + |
---|
| 4329 | + return !thesame; |
---|
| 4330 | + } |
---|
| 4331 | + |
---|
| 4332 | + boolean flashIt = true; |
---|
| 4333 | + |
---|
| 4334 | + void RefreshSelection() |
---|
| 4335 | + { |
---|
| 4336 | + Object3D selection = new Object3D(); |
---|
| 4337 | + |
---|
| 4338 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4339 | + { |
---|
| 4340 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 4341 | + |
---|
| 4342 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4343 | + |
---|
| 4344 | + if (obj == null) |
---|
| 4345 | + { |
---|
| 4346 | + copy.selection.remove(i--); |
---|
| 4347 | + } |
---|
| 4348 | + else |
---|
| 4349 | + { |
---|
| 4350 | + selection.add(obj); |
---|
| 4351 | + copy.selection.setElementAt(obj, i); |
---|
| 4352 | + } |
---|
| 4353 | + } |
---|
| 4354 | + |
---|
| 4355 | + flashIt = false; |
---|
| 4356 | + GetTree().clearSelection(); |
---|
| 4357 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4358 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4359 | + flashIt = true; |
---|
| 4360 | + |
---|
| 4361 | + //refreshContents(false); |
---|
| 4362 | + } |
---|
| 4363 | + |
---|
| 4364 | + void CopyChanged() |
---|
| 4365 | + { |
---|
| 4366 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4367 | + |
---|
| 4368 | + SetVersionStates(); |
---|
| 4369 | + |
---|
| 4370 | + boolean temp = CameraPane.SWITCH; |
---|
| 4371 | + CameraPane.SWITCH = false; |
---|
| 4372 | + |
---|
| 4373 | + copy.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 4374 | + |
---|
| 4375 | + copy.clear(); |
---|
| 4376 | + |
---|
| 4377 | + copy.skyboxname = obj.skyboxname; |
---|
| 4378 | + copy.skyboxext = obj.skyboxext; |
---|
| 4379 | + |
---|
| 4380 | + for (int i=0; i<obj.Size(); i++) |
---|
| 4381 | + { |
---|
| 4382 | + copy.add(obj.get(i)); |
---|
| 4383 | + } |
---|
| 4384 | + |
---|
| 4385 | + copy.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 4386 | + |
---|
| 4387 | + CameraPane.SWITCH = temp; |
---|
| 4388 | + |
---|
| 4389 | + RefreshSelection(); |
---|
| 4390 | + //assert(hashtable.isEmpty()); |
---|
| 4391 | + |
---|
| 4392 | + copy.Touch(); |
---|
| 4393 | + |
---|
| 4394 | + ResetModel(); |
---|
| 4395 | + copy.HardTouch(); // recompile? |
---|
| 4396 | + |
---|
| 4397 | + cRadio ab; |
---|
| 4398 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 4399 | + { |
---|
| 4400 | + ab = (cRadio)e.nextElement(); |
---|
| 4401 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 4402 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 4403 | + if (test != null) |
---|
| 4404 | + { |
---|
| 4405 | + test.editWindow = ab.object.editWindow; |
---|
| 4406 | + ab.object = test; |
---|
| 4407 | + } |
---|
| 4408 | + } |
---|
| 4409 | + |
---|
| 4410 | + refreshContents(true); |
---|
| 4411 | + } |
---|
| 4412 | + |
---|
| 4413 | + cButton previousVersionButton; |
---|
| 4414 | + cButton restoreButton; |
---|
| 4415 | + cButton replaceButton; |
---|
| 4416 | + cButton nextVersionButton; |
---|
| 4417 | + cButton saveVersionButton; |
---|
| 4418 | + cButton deleteVersionButton; |
---|
| 4419 | + |
---|
| 4420 | + boolean muteSlider; |
---|
| 4421 | + |
---|
| 4422 | + int VersionCount() |
---|
| 4423 | + { |
---|
| 4424 | + int count = 0; |
---|
| 4425 | + |
---|
| 4426 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
| 4427 | + { |
---|
| 4428 | + if (copy.versionlist[i] != null) |
---|
| 4429 | + count++; |
---|
| 4430 | + } |
---|
| 4431 | + |
---|
| 4432 | + return count; |
---|
| 4433 | + } |
---|
| 4434 | + |
---|
| 4435 | + void SetVersionStates() |
---|
| 4436 | + { |
---|
| 4437 | + //if (true) |
---|
| 4438 | + // return; |
---|
| 4439 | + |
---|
| 4440 | + //cRadio tab = GetCurrentTab(); |
---|
| 4441 | + |
---|
| 4442 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 4443 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 4444 | + |
---|
| 4445 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4446 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4447 | + |
---|
| 4448 | + deleteVersionButton.setEnabled(copy.versionindex != -1); |
---|
| 4449 | + //copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4450 | + |
---|
| 4451 | + muteSlider = true; |
---|
| 4452 | + versionSlider.setMinimum(0); |
---|
| 4453 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4454 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4455 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
| 4456 | + muteSlider = false; |
---|
| 4457 | + } |
---|
| 4458 | + |
---|
| 4459 | + public boolean PreviousVersion() |
---|
| 4460 | + { |
---|
| 4461 | + // Option? |
---|
| 4462 | + Replace(); |
---|
| 4463 | + |
---|
| 4464 | + System.err.println("Undo"); |
---|
| 4465 | + |
---|
| 4466 | + //cRadio tab = GetCurrentTab(); |
---|
| 4467 | + |
---|
| 4468 | + if (copy.versionindex == 0) |
---|
| 4469 | + { |
---|
| 4470 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4471 | + return false; |
---|
| 4472 | + } |
---|
| 4473 | + |
---|
| 4474 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 4475 | +// { |
---|
| 4476 | +// if (Save(false)) |
---|
| 4477 | +// tab.versionindex -= 1; |
---|
| 4478 | +// else |
---|
| 4479 | +// { |
---|
| 4480 | +// if (tab.versionindex <= 0) |
---|
| 4481 | +// return false; |
---|
| 4482 | +// else |
---|
| 4483 | +// tab.versionindex -= 1; |
---|
| 4484 | +// } |
---|
| 4485 | +// } |
---|
| 4486 | + |
---|
| 4487 | + copy.versionindex -= 1; |
---|
| 4488 | + |
---|
| 4489 | + CopyChanged(); |
---|
| 4490 | + |
---|
| 4491 | + return true; |
---|
| 4492 | + } |
---|
| 4493 | + |
---|
| 4494 | + public boolean Restore() |
---|
| 4495 | + { |
---|
| 4496 | + System.err.println("Restore"); |
---|
| 4497 | + |
---|
| 4498 | + //cRadio tab = GetCurrentTab(); |
---|
| 4499 | + |
---|
| 4500 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4501 | + { |
---|
| 4502 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4503 | + return false; |
---|
| 4504 | + } |
---|
| 4505 | + |
---|
| 4506 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4507 | + CopyChanged(); |
---|
| 4508 | + |
---|
| 4509 | + return true; |
---|
| 4510 | + } |
---|
| 4511 | + |
---|
| 4512 | + public boolean Replace() |
---|
| 4513 | + { |
---|
| 4514 | + //System.err.println("Replace"); |
---|
| 4515 | + |
---|
| 4516 | + //cRadio tab = GetCurrentTab(); |
---|
| 4517 | + |
---|
| 4518 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4519 | + { |
---|
| 4520 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4521 | + return false; |
---|
| 4522 | + } |
---|
| 4523 | + |
---|
| 4524 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
| 4525 | + |
---|
| 4526 | + return true; |
---|
| 4527 | + } |
---|
| 4528 | + |
---|
| 4529 | + public void NextVersion() |
---|
| 4530 | + { |
---|
| 4531 | + // Option? |
---|
| 4532 | + Replace(); |
---|
| 4533 | + |
---|
| 4534 | + //cRadio tab = GetCurrentTab(); |
---|
| 4535 | + |
---|
| 4536 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
| 4537 | + { |
---|
| 4538 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4539 | + return; |
---|
| 4540 | + } |
---|
| 4541 | + |
---|
| 4542 | + copy.versionindex += 1; |
---|
| 4543 | + |
---|
| 4544 | + CopyChanged(); |
---|
| 4545 | + |
---|
| 4546 | + //if (!tab.user[tab.versionindex]) |
---|
| 4547 | + // tab.graphs[tab.versionindex] = null; |
---|
| 4548 | + } |
---|
| 4549 | + |
---|
| 4550 | + void ImportGFD() |
---|
| 4551 | + { |
---|
| 4552 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 4553 | + browser.show(); |
---|
| 4554 | + String filename = browser.getFile(); |
---|
| 4555 | + if (filename != null && filename.length() > 0) |
---|
| 4556 | + { |
---|
| 4557 | + String fullname = browser.getDirectory() + filename; |
---|
| 4558 | + |
---|
| 4559 | + //Object3D readobj = |
---|
| 4560 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 4561 | + //makeSomething(readobj); |
---|
| 4562 | + } |
---|
| 4563 | + } |
---|
| 4564 | + |
---|
| 4565 | + void ImportVRMLX3D() |
---|
| 4566 | + { |
---|
| 4567 | + if (Grafreed.standAlone) |
---|
| 4568 | + { |
---|
| 4569 | + /**/ |
---|
| 4570 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 4571 | + browser.show(); |
---|
| 4572 | + String filename = browser.getFile(); |
---|
| 4573 | + if (filename != null && filename.length() > 0) |
---|
| 4574 | + { |
---|
| 4575 | + String fullname = browser.getDirectory() + filename; |
---|
| 4576 | + LoadVRMLX3D(fullname); |
---|
| 4577 | + } |
---|
| 4578 | + /**/ |
---|
| 4579 | + } |
---|
| 4580 | + } |
---|
| 4581 | + |
---|
3243 | 4582 | void ToggleAnimation() |
---|
3244 | 4583 | { |
---|
3245 | 4584 | if (!Globals.ANIMATION) |
---|
.. | .. |
---|
3255 | 4594 | |
---|
3256 | 4595 | Globals.ANIMATION ^= true; |
---|
3257 | 4596 | |
---|
3258 | | - GrafreeD.wav.cursor = 0; |
---|
3259 | | - GrafreeD.wav.loop = 0; |
---|
| 4597 | + Grafreed.wav.cursor = 0; |
---|
| 4598 | + Grafreed.wav.loop = 0; |
---|
3260 | 4599 | } |
---|
3261 | 4600 | } else |
---|
3262 | 4601 | { |
---|
.. | .. |
---|
3357 | 4696 | assert false; |
---|
3358 | 4697 | } |
---|
3359 | 4698 | |
---|
3360 | | - void EditSelection() |
---|
| 4699 | + void EditSelection(boolean newWindow) |
---|
3361 | 4700 | { |
---|
3362 | 4701 | } |
---|
3363 | 4702 | |
---|
.. | .. |
---|
3399 | 4738 | // else |
---|
3400 | 4739 | // applySelf(true); |
---|
3401 | 4740 | // } |
---|
| 4741 | + |
---|
| 4742 | + boolean Equal(double a, double b) |
---|
| 4743 | + { |
---|
| 4744 | + return Math.abs(a - b) < 0.001; |
---|
| 4745 | + } |
---|
| 4746 | + |
---|
3402 | 4747 | void applySelf0(boolean name) |
---|
3403 | 4748 | { |
---|
3404 | 4749 | if (name) |
---|
.. | .. |
---|
3416 | 4761 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
3417 | 4762 | |
---|
3418 | 4763 | current.color = (float) colorField.getFloat(); |
---|
3419 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4764 | + current.modulation = (float) saturationField.getFloat(); |
---|
3420 | 4765 | current.metalness = (float) metalnessField.getFloat(); |
---|
3421 | 4766 | current.diffuse = (float) diffuseField.getFloat(); |
---|
3422 | 4767 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
3443 | 4788 | { |
---|
3444 | 4789 | //System.out.println("Propagate = " + propagate); |
---|
3445 | 4790 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 4791 | + |
---|
| 4792 | + if (copy.material != null) |
---|
| 4793 | + { |
---|
| 4794 | + cMaterial mat = copy.material; |
---|
| 4795 | + |
---|
| 4796 | + if (!Equal(colorField.getFloat(), mat.color)) |
---|
| 4797 | + colorField.SetToolTipValue((mat.color)); |
---|
| 4798 | + if (!Equal(saturationField.getFloat(), mat.modulation)) |
---|
| 4799 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
| 4800 | + if (!Equal(metalnessField.getFloat(), mat.metalness)) |
---|
| 4801 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 4802 | + if (!Equal(diffuseField.getFloat(), mat.diffuse)) |
---|
| 4803 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 4804 | + if (!Equal(specularField.getFloat(), mat.specular)) |
---|
| 4805 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 4806 | + if (!Equal(shininessField.getFloat(), mat.shininess)) |
---|
| 4807 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 4808 | + if (!Equal(shiftField.getFloat(), mat.shift)) |
---|
| 4809 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 4810 | + if (!Equal(ambientField.getFloat(), mat.ambient)) |
---|
| 4811 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 4812 | + if (!Equal(lightareaField.getFloat(), mat.lightarea)) |
---|
| 4813 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 4814 | + if (!Equal(diffusenessField.getFloat(), mat.factor)) |
---|
| 4815 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 4816 | + if (!Equal(velvetField.getFloat(), mat.velvet)) |
---|
| 4817 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 4818 | + if (!Equal(sheenField.getFloat(), mat.sheen)) |
---|
| 4819 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 4820 | + if (!Equal(subsurfaceField.getFloat(), mat.subsurface)) |
---|
| 4821 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 4822 | + if (!Equal(backlitField.getFloat(), mat.bump)) |
---|
| 4823 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 4824 | + if (!Equal(anisoField.getFloat(), mat.aniso)) |
---|
| 4825 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 4826 | + if (!Equal(anisoVField.getFloat(), mat.anisoV)) |
---|
| 4827 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 4828 | + if (!Equal(cameraField.getFloat(), mat.cameralight)) |
---|
| 4829 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 4830 | + if (!Equal(selfshadowField.getFloat(), mat.diffuseness)) |
---|
| 4831 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 4832 | + if (!Equal(shadowField.getFloat(), mat.shadow)) |
---|
| 4833 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 4834 | + if (!Equal(textureField.getFloat(), mat.texture)) |
---|
| 4835 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 4836 | + if (!Equal(opacityField.getFloat(), mat.opacity)) |
---|
| 4837 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 4838 | + if (!Equal(fakedepthField.getFloat(), mat.fakedepth)) |
---|
| 4839 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 4840 | + if (!Equal(shadowbiasField.getFloat(), mat.shadowbias)) |
---|
| 4841 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 4842 | + } |
---|
| 4843 | + |
---|
3446 | 4844 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3447 | 4845 | { |
---|
3448 | 4846 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3471 | 4869 | //copy.Touch(); |
---|
3472 | 4870 | } |
---|
3473 | 4871 | |
---|
| 4872 | + cNumberSlider versionSlider; |
---|
| 4873 | + |
---|
3474 | 4874 | public void stateChanged(ChangeEvent e) |
---|
3475 | 4875 | { |
---|
3476 | 4876 | // assert(false); |
---|
| 4877 | + if (e.getSource() == versionSlider) |
---|
| 4878 | + { |
---|
| 4879 | + if (muteSlider) |
---|
| 4880 | + return; |
---|
| 4881 | + |
---|
| 4882 | + Replace(); |
---|
| 4883 | + |
---|
| 4884 | + int version = versionSlider.getInteger(); |
---|
| 4885 | + |
---|
| 4886 | + if (version != -1 && copy.versionlist[version] != null) |
---|
| 4887 | + { |
---|
| 4888 | + copy.versionindex = version; |
---|
| 4889 | + CopyChanged(); |
---|
| 4890 | + } |
---|
| 4891 | + |
---|
| 4892 | + return; |
---|
| 4893 | + } |
---|
3477 | 4894 | |
---|
3478 | 4895 | if (freezematerial) |
---|
3479 | 4896 | { |
---|
.. | .. |
---|
3509 | 4926 | { |
---|
3510 | 4927 | //System.out.println("stateChanged = " + this); |
---|
3511 | 4928 | materialtouched = true; |
---|
| 4929 | + |
---|
| 4930 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4931 | + { |
---|
| 4932 | + saturationField.setFloat(1); |
---|
| 4933 | + } |
---|
| 4934 | + |
---|
3512 | 4935 | applySelf(); |
---|
3513 | 4936 | //System.out.println("this = " + this); |
---|
3514 | 4937 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
3558 | 4981 | } |
---|
3559 | 4982 | |
---|
3560 | 4983 | if (normalpushField != null) |
---|
3561 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 4984 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3562 | 4985 | } |
---|
3563 | 4986 | |
---|
3564 | 4987 | void SnapObject() |
---|
.. | .. |
---|
3808 | 5231 | { |
---|
3809 | 5232 | if (GetTree() != null) |
---|
3810 | 5233 | { |
---|
| 5234 | + GetTree().revalidate(); |
---|
3811 | 5235 | GetTree().repaint(); |
---|
3812 | 5236 | } |
---|
3813 | 5237 | |
---|
.. | .. |
---|
3816 | 5240 | ctrlPanel.validate(); // ? new |
---|
3817 | 5241 | ctrlPanel.repaint(); |
---|
3818 | 5242 | } |
---|
| 5243 | + |
---|
| 5244 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5245 | + SetVersionStates(); |
---|
| 5246 | + |
---|
| 5247 | + cameraView.requestFocusInWindow(); |
---|
3819 | 5248 | } |
---|
3820 | 5249 | |
---|
3821 | 5250 | static TweenManager tweenManager = new TweenManager(); |
---|
3822 | 5251 | |
---|
3823 | 5252 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3824 | 5253 | { |
---|
| 5254 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
| 5255 | + Save(); |
---|
3825 | 5256 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3826 | 5257 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3827 | 5258 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3845 | 5276 | // group = (Composite) group.get(0); |
---|
3846 | 5277 | // } |
---|
3847 | 5278 | |
---|
3848 | | - System.out.println("makeSomething of " + thing); |
---|
| 5279 | + //System.out.println("makeSomething of " + thing); |
---|
3849 | 5280 | |
---|
3850 | 5281 | /* |
---|
3851 | 5282 | if (deselect && jList != null) |
---|
.. | .. |
---|
3908 | 5339 | { |
---|
3909 | 5340 | ResetModel(); |
---|
3910 | 5341 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 5342 | + |
---|
| 5343 | + if (thing.Size() == 0) |
---|
| 5344 | + { |
---|
| 5345 | + //EditSelection(false); |
---|
| 5346 | + } |
---|
| 5347 | + |
---|
3911 | 5348 | refreshContents(); |
---|
3912 | 5349 | } |
---|
3913 | 5350 | |
---|
.. | .. |
---|
4025 | 5462 | } |
---|
4026 | 5463 | } |
---|
4027 | 5464 | } |
---|
| 5465 | + |
---|
4028 | 5466 | LoadGFDThread loadGFDThread; |
---|
4029 | 5467 | |
---|
4030 | 5468 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
4044 | 5482 | |
---|
4045 | 5483 | try |
---|
4046 | 5484 | { |
---|
| 5485 | + // Try compressed version first. |
---|
4047 | 5486 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4048 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 5487 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 5488 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
4049 | 5489 | |
---|
4050 | 5490 | readobj = (Object3D) p.readObject(); |
---|
4051 | 5491 | istream.close(); |
---|
.. | .. |
---|
4053 | 5493 | readobj.ResetDisplayList(); |
---|
4054 | 5494 | } catch (Exception e) |
---|
4055 | 5495 | { |
---|
4056 | | - e.printStackTrace(); |
---|
| 5496 | + if (!e.toString().contains("GZIP")) |
---|
| 5497 | + e.printStackTrace(); |
---|
| 5498 | + |
---|
| 5499 | + try |
---|
| 5500 | + { |
---|
| 5501 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 5502 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 5503 | + |
---|
| 5504 | + readobj = (Object3D) p.readObject(); |
---|
| 5505 | + istream.close(); |
---|
| 5506 | + |
---|
| 5507 | + readobj.ResetDisplayList(); |
---|
| 5508 | + } catch (Exception e2) |
---|
| 5509 | + { |
---|
| 5510 | + e2.printStackTrace(); |
---|
| 5511 | + } |
---|
4057 | 5512 | } |
---|
4058 | 5513 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4059 | 5514 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4099 | 5554 | |
---|
4100 | 5555 | void LoadIt(Object obj) |
---|
4101 | 5556 | { |
---|
| 5557 | + if (obj == null) |
---|
| 5558 | + { |
---|
| 5559 | + // Invalid file |
---|
| 5560 | + return; |
---|
| 5561 | + } |
---|
| 5562 | + |
---|
4102 | 5563 | System.out.println("Loaded " + obj); |
---|
4103 | 5564 | //new Exception().printStackTrace(); |
---|
4104 | 5565 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4108 | 5569 | |
---|
4109 | 5570 | if (readobj != null) |
---|
4110 | 5571 | { |
---|
| 5572 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 5573 | + // Save(); |
---|
4111 | 5574 | try |
---|
4112 | 5575 | { |
---|
4113 | 5576 | //readobj.deepCopySelf(copy); |
---|
4114 | 5577 | copy.clear(); // june 2014 |
---|
| 5578 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5579 | + copy.skyboxext = readobj.skyboxext; |
---|
4115 | 5580 | for (int i = 0; i < readobj.size(); i++) |
---|
4116 | 5581 | { |
---|
4117 | 5582 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4152 | 5617 | } |
---|
4153 | 5618 | } catch (ClassCastException e) |
---|
4154 | 5619 | { |
---|
| 5620 | + e.printStackTrace(); |
---|
4155 | 5621 | assert (false); |
---|
4156 | 5622 | Composite c = (Composite) copy; |
---|
4157 | 5623 | c.children.clear(); |
---|
.. | .. |
---|
4162 | 5628 | c.addChild(csg); |
---|
4163 | 5629 | } |
---|
4164 | 5630 | |
---|
| 5631 | + copy.versionlist = readobj.versionlist; |
---|
| 5632 | + copy.versionindex = readobj.versionindex; |
---|
| 5633 | + copy.versiontable = readobj.versiontable; |
---|
| 5634 | + |
---|
| 5635 | + if (copy.versionlist == null) |
---|
| 5636 | + { |
---|
| 5637 | + // Backward compatibility |
---|
| 5638 | + copy.versionlist = new Object3D[100]; |
---|
| 5639 | + copy.versionindex = -1; |
---|
| 5640 | + |
---|
| 5641 | + //Save(true); |
---|
| 5642 | + } |
---|
| 5643 | + |
---|
| 5644 | + //? SetUndoStates(); |
---|
| 5645 | + |
---|
4165 | 5646 | ResetModel(); |
---|
4166 | 5647 | copy.HardTouch(); // recompile? |
---|
4167 | 5648 | refreshContents(); |
---|
4168 | 5649 | } |
---|
4169 | 5650 | } |
---|
4170 | 5651 | |
---|
4171 | | - void load() // throws ClassNotFoundException |
---|
| 5652 | + void Open() // throws ClassNotFoundException |
---|
4172 | 5653 | { |
---|
4173 | | - if (GrafreeD.standAlone) |
---|
| 5654 | + if (Grafreed.standAlone) |
---|
4174 | 5655 | { |
---|
4175 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5656 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4176 | 5657 | browser.show(); |
---|
4177 | 5658 | String filename = browser.getFile(); |
---|
4178 | 5659 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4249 | 5730 | |
---|
4250 | 5731 | void save() |
---|
4251 | 5732 | { |
---|
| 5733 | + Replace(); |
---|
| 5734 | + |
---|
4252 | 5735 | if (lastname == null) |
---|
4253 | 5736 | { |
---|
4254 | 5737 | return; |
---|
.. | .. |
---|
4257 | 5740 | try |
---|
4258 | 5741 | { |
---|
4259 | 5742 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4260 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 5743 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5744 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4261 | 5745 | |
---|
4262 | 5746 | p.writeObject(copy); |
---|
4263 | 5747 | p.flush(); |
---|
4264 | 5748 | |
---|
| 5749 | + zstream.close(); |
---|
4265 | 5750 | ostream.close(); |
---|
4266 | 5751 | |
---|
4267 | 5752 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4269 | 5754 | //ps.print(buffer.toString()); |
---|
4270 | 5755 | } catch (IOException e) |
---|
4271 | 5756 | { |
---|
| 5757 | + e.printStackTrace(); |
---|
4272 | 5758 | } |
---|
4273 | 5759 | } |
---|
| 5760 | + |
---|
4274 | 5761 | String lastname; |
---|
4275 | 5762 | |
---|
4276 | 5763 | void saveAs() |
---|
4277 | 5764 | { |
---|
4278 | | - if (GrafreeD.standAlone) |
---|
| 5765 | + if (Grafreed.standAlone) |
---|
4279 | 5766 | { |
---|
4280 | 5767 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4281 | 5768 | browser.setVisible(true); |
---|
4282 | 5769 | String filename = browser.getFile(); |
---|
4283 | 5770 | if (filename != null && filename.length() > 0) |
---|
4284 | 5771 | { |
---|
| 5772 | + if (!filename.endsWith(".gfd")) |
---|
| 5773 | + filename += ".gfd"; |
---|
4285 | 5774 | lastname = browser.getDirectory() + filename; |
---|
4286 | 5775 | save(); |
---|
4287 | 5776 | } |
---|
.. | .. |
---|
4380 | 5869 | try |
---|
4381 | 5870 | { |
---|
4382 | 5871 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4383 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4384 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 5872 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5873 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4385 | 5874 | |
---|
4386 | 5875 | Object3D objectparent = obj.parent; |
---|
4387 | 5876 | obj.parent = null; |
---|
4388 | 5877 | |
---|
4389 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 5878 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4390 | 5879 | |
---|
4391 | 5880 | obj.parent = objectparent; |
---|
4392 | 5881 | |
---|
.. | .. |
---|
4398 | 5887 | p.writeObject(object); |
---|
4399 | 5888 | p.flush(); |
---|
4400 | 5889 | |
---|
| 5890 | + zstream.close(); |
---|
4401 | 5891 | ostream.close(); |
---|
4402 | | - // zstream.close(); |
---|
4403 | 5892 | |
---|
4404 | 5893 | // group.selection.get(0).parent = parent; |
---|
4405 | 5894 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4420 | 5909 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4421 | 5910 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4422 | 5911 | copy.generatePOV(buffer); |
---|
4423 | | - if (GrafreeD.standAlone) |
---|
| 5912 | + if (Grafreed.standAlone) |
---|
4424 | 5913 | { |
---|
4425 | 5914 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4426 | 5915 | browser.show(); |
---|
.. | .. |
---|
4446 | 5935 | Object3D client; |
---|
4447 | 5936 | Object3D copy; |
---|
4448 | 5937 | MenuBar menuBar; |
---|
4449 | | - Menu windowMenu; |
---|
4450 | | - MenuItem loadItem; |
---|
| 5938 | + Menu fileMenu; |
---|
| 5939 | + MenuItem newItem; |
---|
| 5940 | + MenuItem openItem; |
---|
4451 | 5941 | MenuItem saveItem; |
---|
4452 | 5942 | MenuItem saveAsItem; |
---|
4453 | 5943 | MenuItem exportAsItem; |
---|
4454 | 5944 | MenuItem reexportItem; |
---|
4455 | 5945 | MenuItem povItem; |
---|
4456 | 5946 | MenuItem closeItem; |
---|
4457 | | - Menu cameraMenu; |
---|
| 5947 | + |
---|
4458 | 5948 | CheckboxMenuItem zBufferItem; |
---|
4459 | 5949 | //MenuItem normalLensItem; |
---|
4460 | | - MenuItem editCameraItem; |
---|
4461 | | - MenuItem revertCameraItem; |
---|
4462 | 5950 | MenuItem stepItem; |
---|
4463 | 5951 | CheckboxMenuItem toggleLiveItem; |
---|
4464 | 5952 | CheckboxMenuItem toggleFullScreenItem; |
---|
.. | .. |
---|
4472 | 5960 | CheckboxMenuItem toggleSwitchItem; |
---|
4473 | 5961 | CheckboxMenuItem toggleRootItem; |
---|
4474 | 5962 | CheckboxMenuItem animationItem; |
---|
| 5963 | + MenuItem archiveItem; |
---|
4475 | 5964 | CheckboxMenuItem toggleHandleItem; |
---|
4476 | 5965 | CheckboxMenuItem togglePaintItem; |
---|
4477 | 5966 | JSplitPane mainPanel; |
---|
4478 | 5967 | JScrollPane scrollpane; |
---|
| 5968 | + |
---|
4479 | 5969 | JPanel toolbarPanel; |
---|
| 5970 | + |
---|
4480 | 5971 | cGridBag treePanel; |
---|
| 5972 | + |
---|
4481 | 5973 | JPanel radioPanel; |
---|
4482 | 5974 | ButtonGroup buttonGroup; |
---|
4483 | | - cGridBag ctrlPanel; |
---|
| 5975 | + |
---|
| 5976 | + cGridBag toolboxPanel; |
---|
| 5977 | + cGridBag skyboxPanel; |
---|
4484 | 5978 | cGridBag materialPanel; |
---|
| 5979 | + cGridBag ctrlPanel; |
---|
| 5980 | + |
---|
4485 | 5981 | JScrollPane infoPanel; |
---|
| 5982 | + |
---|
4486 | 5983 | cGridBag optionsPanel; |
---|
| 5984 | + |
---|
4487 | 5985 | JTabbedPane objectPanel; |
---|
| 5986 | + boolean materialFlushed; |
---|
| 5987 | + Object3D latestObject; |
---|
| 5988 | + |
---|
4488 | 5989 | cGridBag XYZPanel; |
---|
| 5990 | + |
---|
4489 | 5991 | JSplitPane gridPanel; |
---|
4490 | 5992 | JSplitPane bigPanel; |
---|
| 5993 | + |
---|
4491 | 5994 | cGridBag bigThree; |
---|
4492 | 5995 | cGridBag scenePanel; |
---|
4493 | 5996 | cGridBag centralPanel; |
---|
.. | .. |
---|
4545 | 6048 | JLabel colorLabel; |
---|
4546 | 6049 | cNumberSlider colorField; |
---|
4547 | 6050 | JLabel modulationLabel; |
---|
4548 | | - cNumberSlider modulationField; |
---|
| 6051 | + cNumberSlider saturationField; |
---|
4549 | 6052 | JLabel metalnessLabel; |
---|
4550 | 6053 | cNumberSlider metalnessField; |
---|
4551 | 6054 | JLabel diffuseLabel; |
---|
.. | .. |
---|
4576 | 6079 | cNumberSlider anisoField; |
---|
4577 | 6080 | JLabel anisoVLabel; |
---|
4578 | 6081 | cNumberSlider anisoVField; |
---|
| 6082 | + |
---|
4579 | 6083 | JLabel cameraLabel; |
---|
4580 | 6084 | cNumberSlider cameraField; |
---|
4581 | 6085 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
4590 | 6094 | cNumberSlider fakedepthField; |
---|
4591 | 6095 | JLabel shadowbiasLabel; |
---|
4592 | 6096 | cNumberSlider shadowbiasField; |
---|
| 6097 | + |
---|
4593 | 6098 | JLabel bumpLabel; |
---|
4594 | 6099 | cNumberSlider bumpField; |
---|
4595 | 6100 | JLabel noiseLabel; |
---|
.. | .. |
---|
4602 | 6107 | cNumberSlider fogField; |
---|
4603 | 6108 | JLabel opacityPowerLabel; |
---|
4604 | 6109 | cNumberSlider opacityPowerField; |
---|
4605 | | - JTree jTree; |
---|
| 6110 | + cTree jTree; |
---|
4606 | 6111 | //ObjectUI parent; |
---|
4607 | 6112 | |
---|
4608 | 6113 | cNumberSlider normalpushField; |
---|
| 6114 | + |
---|
| 6115 | + private MenuItem importGFDItem; |
---|
| 6116 | + private MenuItem importVRMLX3DItem; |
---|
| 6117 | + private MenuItem import3DSItem; |
---|
| 6118 | + private MenuItem importOBJItem; |
---|
4609 | 6119 | } |
---|