.. | .. |
---|
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 | + 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(getClass().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 | + |
---|
276 | 429 | void SetupMenu() |
---|
277 | 430 | { |
---|
278 | 431 | 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...")); |
---|
| 432 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 433 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 434 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
| 435 | + |
---|
| 436 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 437 | + Menu menu = new Menu("Import"); |
---|
| 438 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 439 | + importOBJItem.addActionListener(this); |
---|
| 440 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 441 | + import3DSItem.addActionListener(this); |
---|
| 442 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 443 | + importVRMLX3DItem.addActionListener(this); |
---|
| 444 | + menu.add("-"); |
---|
| 445 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 446 | + importGFDItem.addActionListener(this); |
---|
| 447 | + fileMenu.add(menu); |
---|
| 448 | + fileMenu.add("-"); |
---|
| 449 | + |
---|
| 450 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 451 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
284 | 452 | //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("-"); |
---|
| 453 | + fileMenu.add("-"); |
---|
| 454 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 455 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 456 | + fileMenu.add("-"); |
---|
289 | 457 | if (client.parent != null) |
---|
290 | 458 | { |
---|
291 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 459 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
292 | 460 | } else |
---|
293 | 461 | { |
---|
294 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 462 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
295 | 463 | } |
---|
296 | 464 | |
---|
297 | | - loadItem.addActionListener(this); |
---|
| 465 | + newItem.addActionListener(this); |
---|
| 466 | + openItem.addActionListener(this); |
---|
298 | 467 | saveItem.addActionListener(this); |
---|
299 | 468 | saveAsItem.addActionListener(this); |
---|
300 | 469 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
302 | 471 | //povItem.addActionListener(this); |
---|
303 | 472 | closeItem.addActionListener(this); |
---|
304 | 473 | |
---|
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 | 474 | objectPanel = new JTabbedPane(); |
---|
| 475 | + |
---|
| 476 | + ChangeListener changeListener = new ChangeListener() |
---|
| 477 | + { |
---|
| 478 | + //String name; |
---|
| 479 | + |
---|
| 480 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 481 | + { |
---|
| 482 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 483 | +// { |
---|
| 484 | +// if (latestObject != null) |
---|
| 485 | +// { |
---|
| 486 | +// refreshContents(true); |
---|
| 487 | +// SetMaterial(latestObject); |
---|
| 488 | +// } |
---|
| 489 | +// |
---|
| 490 | +// materialFlushed = true; |
---|
| 491 | +// } |
---|
| 492 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 493 | +// { |
---|
| 494 | +// if (listUI.size() == 0) |
---|
| 495 | +// EditSelection(false); |
---|
| 496 | +// } |
---|
| 497 | + |
---|
| 498 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 499 | +// { |
---|
| 500 | +// name = copy.skyboxname; |
---|
| 501 | +// |
---|
| 502 | +// if (name == null) |
---|
| 503 | +// { |
---|
| 504 | +// name = ""; |
---|
| 505 | +// } |
---|
| 506 | +// |
---|
| 507 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 508 | +// copy.skyboxext = "jpg"; |
---|
| 509 | +// } |
---|
| 510 | +// else |
---|
| 511 | +// { |
---|
| 512 | +// if (name != null) |
---|
| 513 | +// { |
---|
| 514 | +// if (name.equals("")) |
---|
| 515 | +// { |
---|
| 516 | +// copy.skyboxname = null; |
---|
| 517 | +// copy.skyboxext = null; |
---|
| 518 | +// } |
---|
| 519 | +// else |
---|
| 520 | +// { |
---|
| 521 | +// copy.skyboxname = name; |
---|
| 522 | +// } |
---|
| 523 | +// } |
---|
| 524 | +// } |
---|
| 525 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 526 | + |
---|
| 527 | +// refreshContents(false); // To refresh Info tab |
---|
| 528 | + cameraView.repaint(); |
---|
| 529 | + } |
---|
| 530 | + }; |
---|
| 531 | + objectPanel.addChangeListener(changeListener); |
---|
| 532 | + |
---|
378 | 533 | toolbarPanel = new JPanel(); |
---|
379 | 534 | toolbarPanel.setName("Toolbar"); |
---|
| 535 | + |
---|
380 | 536 | treePanel = new cGridBag(); |
---|
381 | 537 | treePanel.setName("Tree"); |
---|
| 538 | + |
---|
| 539 | + editPanel = new cGridBag().setVertical(true); |
---|
| 540 | + //editPanel.setName("Edit"); |
---|
| 541 | + |
---|
382 | 542 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
383 | | - ctrlPanel.setName("Edit"); |
---|
384 | | - materialPanel = new cGridBag().setVertical(true); |
---|
385 | | - materialPanel.setName("Material"); |
---|
| 543 | + |
---|
| 544 | + editCommandsPanel = new cGridBag(); |
---|
| 545 | + editPanel.add(editCommandsPanel); |
---|
| 546 | + editPanel.add(ctrlPanel); |
---|
| 547 | + |
---|
| 548 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 549 | + //toolboxPanel.setName("Toolbox"); |
---|
| 550 | + |
---|
| 551 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 552 | + |
---|
| 553 | + materialPanel = new cGridBag().setVertical(false); |
---|
| 554 | + //materialPanel.setName("Material"); |
---|
| 555 | + |
---|
386 | 556 | /*JTextPane*/ |
---|
387 | 557 | infoarea = createTextPane(); |
---|
388 | 558 | doc = infoarea.getStyledDocument(); |
---|
389 | 559 | |
---|
390 | 560 | infoarea.setEditable(true); |
---|
391 | 561 | SetText(); |
---|
| 562 | + |
---|
392 | 563 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
393 | 564 | // infoarea.setOpaque(false); |
---|
394 | 565 | // //infoarea.setForeground(textcolor); |
---|
395 | 566 | // TEXTAREA infoarea.setLineWrap(true); |
---|
396 | 567 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
397 | 568 | 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"); |
---|
| 569 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
| 570 | + //infoPanel.setName("Info"); |
---|
400 | 571 | //infoPanel.setLayout(new BorderLayout()); |
---|
401 | 572 | //infoPanel.add(createTextPane()); |
---|
402 | 573 | |
---|
.. | .. |
---|
407 | 578 | mainPanel.setDividerSize(9); |
---|
408 | 579 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
409 | 580 | mainPanel.setResizeWeight(0.5); |
---|
410 | | - |
---|
| 581 | + |
---|
| 582 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 583 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 584 | + divider.setDividerSize(15); |
---|
| 585 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 586 | + |
---|
| 587 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 588 | + |
---|
411 | 589 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
412 | 590 | //mainPanel.setLayout(new GridBagLayout()); |
---|
413 | 591 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
475 | 653 | e.printStackTrace(); |
---|
476 | 654 | } |
---|
477 | 655 | |
---|
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(); |
---|
| 656 | +// String selection = infoarea.getText(); |
---|
| 657 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 658 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 659 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
482 | 660 | //clipboard.setContents(data, data); |
---|
483 | 661 | } |
---|
484 | 662 | |
---|
.. | .. |
---|
501 | 679 | //SendInfo("Name:", "bold"); |
---|
502 | 680 | if (sel.GetTextures() != null || debug) |
---|
503 | 681 | { |
---|
504 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 682 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
505 | 683 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
506 | 684 | if (sel.Size() > 0) |
---|
507 | 685 | { |
---|
508 | 686 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
509 | 687 | } |
---|
510 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 688 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
511 | 689 | if (debug) |
---|
512 | 690 | { |
---|
513 | 691 | try |
---|
.. | .. |
---|
549 | 727 | } |
---|
550 | 728 | if (sel.support != null) |
---|
551 | 729 | { |
---|
552 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 730 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
553 | 731 | } |
---|
554 | 732 | if (sel.scriptnode != null) |
---|
555 | 733 | { |
---|
.. | .. |
---|
638 | 816 | } |
---|
639 | 817 | } |
---|
640 | 818 | |
---|
| 819 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 820 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 821 | + |
---|
| 822 | + Rectangle keeprect; |
---|
| 823 | + cRadio radio; |
---|
| 824 | + |
---|
| 825 | +cButton keepButton; |
---|
| 826 | + cButton twoButton; // Full 3D |
---|
| 827 | + cButton sixButton; |
---|
| 828 | + cButton threeButton; |
---|
| 829 | + cButton sevenButton; |
---|
| 830 | + cButton fourButton; // full panel |
---|
| 831 | + cButton oneButton; // full XYZ |
---|
| 832 | + //cButton currentLayout; |
---|
| 833 | + |
---|
| 834 | + boolean maximized; |
---|
| 835 | + |
---|
| 836 | + cButton fullscreenLayout; |
---|
| 837 | + cButton expandedLayout; |
---|
| 838 | + |
---|
| 839 | + void Minimize() |
---|
| 840 | + { |
---|
| 841 | + frame.setState(Frame.ICONIFIED); |
---|
| 842 | + frame.validate(); |
---|
| 843 | + } |
---|
| 844 | + |
---|
| 845 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 846 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 847 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
| 848 | + void Maximize() |
---|
| 849 | + { |
---|
| 850 | + if (CameraPane.FULLSCREEN) |
---|
| 851 | + { |
---|
| 852 | + ToggleFullScreen(); |
---|
| 853 | + } |
---|
| 854 | + |
---|
| 855 | + if (maximized) |
---|
| 856 | + { |
---|
| 857 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 858 | + } |
---|
| 859 | + else |
---|
| 860 | + { |
---|
| 861 | + keeprect = frame.getBounds(); |
---|
| 862 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 863 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 864 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 865 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 866 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
| 867 | + } |
---|
| 868 | + |
---|
| 869 | + maximized ^= true; |
---|
| 870 | + |
---|
| 871 | + frame.validate(); |
---|
| 872 | + } |
---|
| 873 | + |
---|
| 874 | + cButton minButton; |
---|
| 875 | + cButton maxButton; |
---|
| 876 | + cButton fullButton; |
---|
| 877 | + cButton collapseButton; |
---|
| 878 | + cButton maximize3DButton; |
---|
| 879 | + |
---|
641 | 880 | void ToggleFullScreen() |
---|
642 | 881 | { |
---|
643 | | - if (CameraPane.FULLSCREEN) |
---|
| 882 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 883 | + |
---|
| 884 | + cameraView.ToggleFullScreen(); |
---|
| 885 | + |
---|
| 886 | + if (!CameraPane.FULLSCREEN) |
---|
644 | 887 | { |
---|
645 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
646 | | - framePanel.add(bigThree); |
---|
647 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 888 | + device.setFullScreenWindow(null); |
---|
| 889 | + frame.dispose(); |
---|
| 890 | + frame.setUndecorated(false); |
---|
| 891 | + frame.validate(); |
---|
| 892 | + frame.setVisible(true); |
---|
| 893 | + |
---|
| 894 | + //frame.setVisible(false); |
---|
| 895 | +// frame.removeNotify(); |
---|
| 896 | +// frame.setUndecorated(false); |
---|
| 897 | +// frame.addNotify(); |
---|
| 898 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 899 | + |
---|
| 900 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 901 | +// X framePanel.add(bigThree); |
---|
| 902 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 903 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
| 904 | + |
---|
| 905 | + //frame.setVisible(true); |
---|
| 906 | +// radio.layout = keepButton; |
---|
| 907 | + //theFrame = null; |
---|
| 908 | + keepButton = null; |
---|
| 909 | +// radio.layout.doClick(); |
---|
| 910 | + |
---|
648 | 911 | } else |
---|
649 | 912 | { |
---|
650 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
651 | | - framePanel.remove(bigThree); |
---|
652 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 913 | + keepButton = radio.layout; |
---|
| 914 | + //keeprect = frame.getBounds(); |
---|
| 915 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 916 | +// frame.getToolkit().getScreenSize().height); |
---|
| 917 | + //frame.setVisible(false); |
---|
| 918 | + |
---|
| 919 | + frame.dispose(); |
---|
| 920 | + frame.setUndecorated(true); |
---|
| 921 | + device.setFullScreenWindow(frame); |
---|
| 922 | + frame.validate(); |
---|
| 923 | + frame.setVisible(true); |
---|
| 924 | +// frame.removeNotify(); |
---|
| 925 | +// frame.setUndecorated(true); |
---|
| 926 | +// frame.addNotify(); |
---|
| 927 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 928 | +// X framePanel.remove(bigThree); |
---|
| 929 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 930 | +// framePanel.setDividerLocation(0); |
---|
| 931 | + |
---|
| 932 | +// radio.layout = fullscreenLayout; |
---|
| 933 | +// radio.layout.doClick(); |
---|
| 934 | + //frame.setVisible(true); |
---|
653 | 935 | } |
---|
654 | | - cameraView.ToggleFullScreen(); |
---|
| 936 | + frame.validate(); |
---|
| 937 | + |
---|
| 938 | + cameraView.requestFocusInWindow(); |
---|
655 | 939 | } |
---|
| 940 | + |
---|
| 941 | + void CollapseToolbar() |
---|
| 942 | + { |
---|
| 943 | + framePanel.setDividerLocation(0); |
---|
| 944 | + //frame.validate(); |
---|
| 945 | + |
---|
| 946 | + cameraView.requestFocusInWindow(); |
---|
| 947 | + } |
---|
| 948 | + |
---|
| 949 | + private Object3D Duplicate(Object3D object) |
---|
| 950 | + { |
---|
| 951 | + boolean temp = CameraPane.SWITCH; |
---|
| 952 | + CameraPane.SWITCH = false; |
---|
| 953 | + |
---|
| 954 | + object.ExtractBigData(versiontable); |
---|
| 955 | + // if (copy == client) |
---|
| 956 | + |
---|
| 957 | + Object3D versions[] = object.versionlist; |
---|
| 958 | + object.versionlist = null; |
---|
| 959 | + |
---|
| 960 | + //byte[] compress = Compress(copy); |
---|
| 961 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
| 962 | + |
---|
| 963 | + object.versionlist = versions; |
---|
| 964 | + |
---|
| 965 | + object.RestoreBigData(versiontable); |
---|
| 966 | + |
---|
| 967 | + CameraPane.SWITCH = temp; |
---|
| 968 | + |
---|
| 969 | + return compress; |
---|
| 970 | + } |
---|
656 | 971 | |
---|
657 | 972 | private JTextPane createTextPane() |
---|
658 | 973 | { |
---|
.. | .. |
---|
775 | 1090 | { |
---|
776 | 1091 | SetupMaterial(materialPanel); |
---|
777 | 1092 | } |
---|
| 1093 | + |
---|
778 | 1094 | //SetupName(); |
---|
779 | 1095 | //SetupViews(); |
---|
780 | 1096 | } |
---|
.. | .. |
---|
784 | 1100 | // NumberSlider vDivsField; |
---|
785 | 1101 | // JCheckBox endcaps; |
---|
786 | 1102 | JCheckBox liveCB; |
---|
| 1103 | + JCheckBox selectableCB; |
---|
787 | 1104 | JCheckBox hideCB; |
---|
788 | 1105 | JCheckBox link2masterCB; |
---|
789 | 1106 | JCheckBox markCB; |
---|
.. | .. |
---|
791 | 1108 | JCheckBox speedupCB; |
---|
792 | 1109 | JCheckBox rewindCB; |
---|
793 | 1110 | JCheckBox flipVCB; |
---|
| 1111 | + |
---|
| 1112 | + cCheckBox toggleTextureCB; |
---|
| 1113 | + cCheckBox toggleSwitchCB; |
---|
| 1114 | + |
---|
794 | 1115 | JComboBox texresMenu; |
---|
| 1116 | + |
---|
795 | 1117 | JButton resetButton; |
---|
796 | 1118 | JButton stepButton; |
---|
797 | 1119 | JButton stepAllButton; |
---|
.. | .. |
---|
800 | 1122 | JButton fasterButton; |
---|
801 | 1123 | JButton remarkButton; |
---|
802 | 1124 | |
---|
| 1125 | + cGridBag editPanel; |
---|
| 1126 | + cGridBag editCommandsPanel; |
---|
| 1127 | + |
---|
803 | 1128 | cGridBag namePanel; |
---|
804 | 1129 | cGridBag setupPanel; |
---|
805 | | - cGridBag commandsPanel; |
---|
| 1130 | + cGridBag setupPanel2; |
---|
| 1131 | + cGridBag objectCommandsPanel; |
---|
806 | 1132 | cGridBag pushPanel; |
---|
807 | 1133 | cGridBag fillPanel; |
---|
808 | 1134 | |
---|
.. | .. |
---|
973 | 1299 | |
---|
974 | 1300 | namePanel = new cGridBag(); |
---|
975 | 1301 | |
---|
| 1302 | + //if (copy.pinned) |
---|
| 1303 | + { |
---|
| 1304 | + pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF); |
---|
| 1305 | + pinButton.setSelected(copy.pinned); |
---|
| 1306 | + cGridBag t = new cGridBag(); |
---|
| 1307 | + t.preferredWidth = 2; |
---|
| 1308 | + t.add(pinButton); |
---|
| 1309 | + namePanel.add(t); |
---|
| 1310 | + |
---|
| 1311 | + pinButton.addItemListener(this); |
---|
| 1312 | + } |
---|
| 1313 | + |
---|
976 | 1314 | nameField = AddText(namePanel, copy.GetName()); |
---|
977 | | - namePanel.add(nameField); |
---|
| 1315 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
978 | 1316 | oe.ctrlPanel.add(namePanel); |
---|
979 | 1317 | |
---|
980 | 1318 | oe.ctrlPanel.Return(); |
---|
981 | 1319 | |
---|
982 | | - if (!GroupEditor.allparams) |
---|
| 1320 | + if (!allparams) |
---|
983 | 1321 | return; |
---|
984 | 1322 | |
---|
985 | 1323 | setupPanel = new cGridBag().setVertical(false); |
---|
986 | 1324 | |
---|
987 | 1325 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
988 | 1326 | liveCB.setToolTipText("Animate object"); |
---|
| 1327 | + markCB = AddCheckBox(setupPanel, "Anim", copy.marked); |
---|
| 1328 | + markCB.setToolTipText("Set target transform"); |
---|
| 1329 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1330 | + selectableCB.setToolTipText("Make object selectable"); |
---|
| 1331 | +// Return(); |
---|
| 1332 | + |
---|
989 | 1333 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
990 | 1334 | hideCB.setToolTipText("Hide object"); |
---|
991 | | -// Return(); |
---|
992 | | - markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
993 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
994 | 1335 | |
---|
995 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1336 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
| 1337 | + |
---|
| 1338 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1339 | + |
---|
| 1340 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
996 | 1341 | rewindCB.setToolTipText("Rewind animation"); |
---|
997 | 1342 | |
---|
998 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
999 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1343 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1344 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1000 | 1345 | |
---|
| 1346 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1347 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1348 | + |
---|
1001 | 1349 | if (Globals.ADVANCED) |
---|
1002 | 1350 | { |
---|
1003 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
1004 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1005 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1351 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1006 | 1352 | speedupCB.setToolTipText("Option motion capture"); |
---|
1007 | 1353 | } |
---|
1008 | 1354 | |
---|
1009 | 1355 | oe.ctrlPanel.add(setupPanel); |
---|
1010 | 1356 | oe.ctrlPanel.Return(); |
---|
| 1357 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1358 | + oe.ctrlPanel.Return(); |
---|
1011 | 1359 | |
---|
1012 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1360 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
1013 | 1361 | |
---|
1014 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1362 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
1015 | 1363 | resetButton.setToolTipText("Jump to frame zero"); |
---|
1016 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1364 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
1017 | 1365 | stepButton.setToolTipText("Step one frame"); |
---|
1018 | 1366 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
1019 | 1367 | // stepAllButton = AddButton(oe, "Step All"); |
---|
1020 | 1368 | // Return(); |
---|
1021 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1369 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
1022 | 1370 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
1023 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1371 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
1024 | 1372 | fasterButton.setToolTipText("Increase animation speed"); |
---|
1025 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1373 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
1026 | 1374 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
1027 | 1375 | |
---|
1028 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1376 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
1029 | 1377 | oe.ctrlPanel.Return(); |
---|
1030 | 1378 | |
---|
1031 | | - pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1); |
---|
| 1379 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
1032 | 1380 | normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
1033 | 1381 | //Return(); |
---|
1034 | 1382 | |
---|
.. | .. |
---|
1185 | 1533 | |
---|
1186 | 1534 | if (cam == null || !(copy.get(0) instanceof cGroup)) |
---|
1187 | 1535 | { |
---|
| 1536 | + if (Globals.DEBUG) |
---|
1188 | 1537 | System.out.println("CREATE CAMERAS"); |
---|
1189 | 1538 | cams = new cTemplate(); |
---|
1190 | 1539 | cams.name = "Cameras"; |
---|
.. | .. |
---|
1231 | 1580 | //worldPanel.setName("World"); |
---|
1232 | 1581 | centralPanel = new cGridBag(); |
---|
1233 | 1582 | centralPanel.preferredWidth = 20; |
---|
1234 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1235 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1583 | + |
---|
| 1584 | + if (Globals.ADVANCED) |
---|
| 1585 | + { |
---|
| 1586 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1587 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1236 | 1588 | |
---|
1237 | 1589 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1238 | 1590 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1241 | 1593 | // cameraPanel.setDividerSize(9); |
---|
1242 | 1594 | cameraPanel.setResizeWeight(1.0); |
---|
1243 | 1595 | |
---|
| 1596 | + } |
---|
| 1597 | + |
---|
1244 | 1598 | centralPanel.add(cameraView); |
---|
| 1599 | + centralPanel.setFocusable(true); |
---|
1245 | 1600 | //frame.setJMenuBar(timelineMenubar); |
---|
1246 | 1601 | //centralPanel.add(timelinePanel); |
---|
1247 | 1602 | |
---|
.. | .. |
---|
1267 | 1622 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1268 | 1623 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1269 | 1624 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1625 | + //XYZPanel.setName("XYZ"); |
---|
1270 | 1626 | |
---|
1271 | 1627 | /* |
---|
1272 | 1628 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1304 | 1660 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1305 | 1661 | //tmp.setName("Edit"); |
---|
1306 | 1662 | objectPanel.add(materialPanel); |
---|
| 1663 | + objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1664 | + objectPanel.setToolTipTextAt(0, "Material"); |
---|
| 1665 | + |
---|
| 1666 | + objectPanel.add(toolboxPanel); |
---|
| 1667 | + objectPanel.setIconAt(1, GetIcon("icons/primitives.png")); |
---|
| 1668 | + objectPanel.setToolTipTextAt(1, "Objects & textures"); |
---|
| 1669 | + |
---|
| 1670 | + objectPanel.add(skyboxPanel); |
---|
| 1671 | + objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
| 1672 | + objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
| 1673 | + |
---|
1307 | 1674 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1308 | 1675 | // north.setName("Edit"); |
---|
1309 | 1676 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1310 | 1677 | // objectPanel.add(north); |
---|
1311 | | - objectPanel.add(ctrlPanel); |
---|
1312 | | - objectPanel.add(infoPanel); |
---|
1313 | | - |
---|
| 1678 | + objectPanel.add(editPanel); |
---|
| 1679 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1680 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
| 1681 | + |
---|
| 1682 | + objectPanel.add(XYZPanel); |
---|
| 1683 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1684 | + objectPanel.setToolTipTextAt(4, "XYZ/RGB transform"); |
---|
| 1685 | + |
---|
1314 | 1686 | /* |
---|
1315 | 1687 | aConstraints.gridx = 0; |
---|
1316 | 1688 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1318 | 1690 | aConstraints.gridy += 1; |
---|
1319 | 1691 | aConstraints.gridwidth = 1; |
---|
1320 | 1692 | mainPanel.add(objectPanel, aConstraints); |
---|
1321 | | - */ |
---|
| 1693 | + */ |
---|
1322 | 1694 | |
---|
1323 | 1695 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1324 | 1696 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1330 | 1702 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1331 | 1703 | |
---|
1332 | 1704 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1333 | | - scenePanel.preferredWidth = 6; |
---|
| 1705 | + scenePanel.preferredWidth = 5; |
---|
1334 | 1706 | |
---|
1335 | 1707 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1336 | 1708 | tabbedPane.add(scrollpane); |
---|
1337 | 1709 | |
---|
1338 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1339 | | - |
---|
1340 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1710 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1341 | 1711 | |
---|
1342 | 1712 | optionsPanel.setName("Options"); |
---|
1343 | 1713 | |
---|
.. | .. |
---|
1345 | 1715 | |
---|
1346 | 1716 | tabbedPane.add(optionsPanel); |
---|
1347 | 1717 | |
---|
| 1718 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1719 | + |
---|
1348 | 1720 | scenePanel.add(tabbedPane); |
---|
1349 | 1721 | |
---|
| 1722 | + //if (Globals.ADVANCED) |
---|
| 1723 | +// tabbedPane.add(infoPanel); |
---|
| 1724 | +// tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
| 1725 | +// tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1726 | + |
---|
1350 | 1727 | /* |
---|
1351 | 1728 | cTree jTree = new cTree(null); |
---|
1352 | 1729 | ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
.. | .. |
---|
1408 | 1785 | bigThree = new cGridBag(); |
---|
1409 | 1786 | bigThree.addComponent(scenePanel); |
---|
1410 | 1787 | bigThree.addComponent(centralPanel); |
---|
1411 | | - bigThree.addComponent(XYZPanel); |
---|
| 1788 | + //bigThree.addComponent(XYZPanel); |
---|
1412 | 1789 | |
---|
1413 | 1790 | // // SIDE EFFECT!!! |
---|
1414 | 1791 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1417 | 1794 | // aConstraints.gridheight = 1; |
---|
1418 | 1795 | |
---|
1419 | 1796 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1420 | | - framePanel.setContinuousLayout(true); |
---|
1421 | | - framePanel.setOneTouchExpandable(true); |
---|
1422 | | - framePanel.setDividerLocation(0.8); |
---|
| 1797 | + |
---|
| 1798 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1799 | + new java.beans.PropertyChangeListener() |
---|
| 1800 | + { |
---|
| 1801 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1802 | + { |
---|
| 1803 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1804 | + { |
---|
| 1805 | + if (radio.layout != expandedLayout) |
---|
| 1806 | + { |
---|
| 1807 | + radio.layout = expandedLayout; |
---|
| 1808 | + radio.layout.doClick(); |
---|
| 1809 | + } |
---|
| 1810 | + } |
---|
| 1811 | + } |
---|
| 1812 | + }); |
---|
| 1813 | + |
---|
| 1814 | + framePanel.setContinuousLayout(false); |
---|
| 1815 | + framePanel.setOneTouchExpandable(false); |
---|
| 1816 | + //.setDividerLocation(0.8); |
---|
1423 | 1817 | //framePanel.setDividerSize(15); |
---|
1424 | 1818 | //framePanel.setResizeWeight(0.15); |
---|
1425 | 1819 | framePanel.setName("Frame"); |
---|
1426 | 1820 | |
---|
1427 | 1821 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1428 | 1822 | /**/ |
---|
1429 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1823 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1430 | 1824 | //worldPane.add(bigPanel); |
---|
1431 | 1825 | //worldPane.add(worldPanel); |
---|
1432 | 1826 | /**/ |
---|
.. | .. |
---|
1437 | 1831 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1438 | 1832 | |
---|
1439 | 1833 | frame.setSize(1280, 860); |
---|
1440 | | - frame.setVisible(true); |
---|
1441 | | - |
---|
| 1834 | + |
---|
| 1835 | + cameraView.requestFocusInWindow(); |
---|
| 1836 | + |
---|
1442 | 1837 | gridPanel.setDividerLocation(1.0); |
---|
| 1838 | + |
---|
| 1839 | + frame.validate(); |
---|
| 1840 | + |
---|
| 1841 | + frame.setVisible(true); |
---|
1443 | 1842 | |
---|
1444 | 1843 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1445 | 1844 | frame.addWindowListener(new WindowAdapter() |
---|
1446 | 1845 | { |
---|
1447 | | - |
---|
1448 | 1846 | public void windowClosing(WindowEvent e) |
---|
1449 | 1847 | { |
---|
1450 | 1848 | Close(); |
---|
.. | .. |
---|
1467 | 1865 | ctrlPanel.removeAll(); |
---|
1468 | 1866 | } |
---|
1469 | 1867 | |
---|
1470 | | - void SetupMaterial(cGridBag panel) |
---|
| 1868 | + void SetupMaterial(cGridBag materialpanel) |
---|
1471 | 1869 | { |
---|
1472 | | - /* |
---|
| 1870 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1871 | + |
---|
| 1872 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1873 | + skin.setToolTipText("Skin"); |
---|
| 1874 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1875 | + { |
---|
| 1876 | + public void mouseClicked(MouseEvent e) |
---|
| 1877 | + { |
---|
| 1878 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1879 | + cMaterial material = object.material; |
---|
| 1880 | + |
---|
| 1881 | + // Skin |
---|
| 1882 | + colorField.setFloat(material.color); |
---|
| 1883 | + saturationField.setFloat(material.modulation); |
---|
| 1884 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1885 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1886 | + diffusenessField.setFloat(material.factor); |
---|
| 1887 | + shininessField.setFloat(material.shininess); |
---|
| 1888 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1889 | + diffuseField.setFloat(material.diffuse); |
---|
| 1890 | + specularField.setFloat(material.specular); |
---|
| 1891 | + |
---|
| 1892 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1893 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1894 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1895 | + |
---|
| 1896 | + materialtouched = true; |
---|
| 1897 | + applySelf(); |
---|
| 1898 | + } |
---|
| 1899 | + }); |
---|
| 1900 | + presetpanel.add(skin); |
---|
| 1901 | + |
---|
| 1902 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF); |
---|
| 1903 | + lambert.setToolTipText("Diffuse"); |
---|
| 1904 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 1905 | + { |
---|
| 1906 | + public void mouseClicked(MouseEvent e) |
---|
| 1907 | + { |
---|
| 1908 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 1909 | + cMaterial material = object.material; |
---|
| 1910 | + |
---|
| 1911 | + diffusenessField.setFloat(material.factor); |
---|
| 1912 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1913 | + |
---|
| 1914 | + materialtouched = true; |
---|
| 1915 | + applySelf(); |
---|
| 1916 | + } |
---|
| 1917 | + }); |
---|
| 1918 | + presetpanel.add(lambert); |
---|
| 1919 | + |
---|
| 1920 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF); |
---|
| 1921 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 1922 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 1923 | + { |
---|
| 1924 | + public void mouseClicked(MouseEvent e) |
---|
| 1925 | + { |
---|
| 1926 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 1927 | + cMaterial material = object.material; |
---|
| 1928 | + |
---|
| 1929 | + diffusenessField.setFloat(material.factor); |
---|
| 1930 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1931 | + |
---|
| 1932 | + materialtouched = true; |
---|
| 1933 | + applySelf(); |
---|
| 1934 | + } |
---|
| 1935 | + }); |
---|
| 1936 | + presetpanel.add(diffuse2); |
---|
| 1937 | + |
---|
| 1938 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF); |
---|
| 1939 | + diffusemoon.setToolTipText("Moon"); |
---|
| 1940 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 1941 | + { |
---|
| 1942 | + public void mouseClicked(MouseEvent e) |
---|
| 1943 | + { |
---|
| 1944 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 1945 | + cMaterial material = object.material; |
---|
| 1946 | + |
---|
| 1947 | + diffusenessField.setFloat(material.factor); |
---|
| 1948 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1949 | + |
---|
| 1950 | + materialtouched = true; |
---|
| 1951 | + applySelf(); |
---|
| 1952 | + } |
---|
| 1953 | + }); |
---|
| 1954 | + presetpanel.add(diffusemoon); |
---|
| 1955 | + |
---|
| 1956 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF); |
---|
| 1957 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 1958 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 1959 | + { |
---|
| 1960 | + public void mouseClicked(MouseEvent e) |
---|
| 1961 | + { |
---|
| 1962 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 1963 | + cMaterial material = object.material; |
---|
| 1964 | + |
---|
| 1965 | + diffusenessField.setFloat(material.factor); |
---|
| 1966 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1967 | + |
---|
| 1968 | + materialtouched = true; |
---|
| 1969 | + applySelf(); |
---|
| 1970 | + } |
---|
| 1971 | + }); |
---|
| 1972 | + presetpanel.add(diffusemoon2); |
---|
| 1973 | + |
---|
| 1974 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF); |
---|
| 1975 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 1976 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 1977 | + { |
---|
| 1978 | + public void mouseClicked(MouseEvent e) |
---|
| 1979 | + { |
---|
| 1980 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 1981 | + cMaterial material = object.material; |
---|
| 1982 | + |
---|
| 1983 | + diffusenessField.setFloat(material.factor); |
---|
| 1984 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1985 | + |
---|
| 1986 | + materialtouched = true; |
---|
| 1987 | + applySelf(); |
---|
| 1988 | + } |
---|
| 1989 | + }); |
---|
| 1990 | + presetpanel.add(diffusemoon3); |
---|
| 1991 | + |
---|
| 1992 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF); |
---|
| 1993 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 1994 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 1995 | + { |
---|
| 1996 | + public void mouseClicked(MouseEvent e) |
---|
| 1997 | + { |
---|
| 1998 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 1999 | + cMaterial material = object.material; |
---|
| 2000 | + |
---|
| 2001 | + sheenField.setFloat(material.sheen); |
---|
| 2002 | + |
---|
| 2003 | + materialtouched = true; |
---|
| 2004 | + applySelf(); |
---|
| 2005 | + } |
---|
| 2006 | + }); |
---|
| 2007 | + presetpanel.add(diffusesheen); |
---|
| 2008 | + |
---|
| 2009 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 2010 | + rough.setToolTipText("Rough metal"); |
---|
| 2011 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2012 | + { |
---|
| 2013 | + public void mouseClicked(MouseEvent e) |
---|
| 2014 | + { |
---|
| 2015 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2016 | + cMaterial material = object.material; |
---|
| 2017 | + |
---|
| 2018 | + shininessField.setFloat(material.shininess); |
---|
| 2019 | + velvetField.setFloat(material.velvet); |
---|
| 2020 | + |
---|
| 2021 | + materialtouched = true; |
---|
| 2022 | + applySelf(); |
---|
| 2023 | + } |
---|
| 2024 | + }); |
---|
| 2025 | + presetpanel.add(rough); |
---|
| 2026 | + |
---|
| 2027 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF); |
---|
| 2028 | + rough2.setToolTipText("Medium metal"); |
---|
| 2029 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2030 | + { |
---|
| 2031 | + public void mouseClicked(MouseEvent e) |
---|
| 2032 | + { |
---|
| 2033 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2034 | + cMaterial material = object.material; |
---|
| 2035 | + |
---|
| 2036 | + shininessField.setFloat(material.shininess); |
---|
| 2037 | + lightareaField.setFloat(material.lightarea); |
---|
| 2038 | + |
---|
| 2039 | + materialtouched = true; |
---|
| 2040 | + applySelf(); |
---|
| 2041 | + } |
---|
| 2042 | + }); |
---|
| 2043 | + presetpanel.add(rough2); |
---|
| 2044 | + |
---|
| 2045 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF); |
---|
| 2046 | + shini0.setToolTipText("Shiny"); |
---|
| 2047 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2048 | + { |
---|
| 2049 | + public void mouseClicked(MouseEvent e) |
---|
| 2050 | + { |
---|
| 2051 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2052 | + cMaterial material = object.material; |
---|
| 2053 | + |
---|
| 2054 | + shininessField.setFloat(material.shininess); |
---|
| 2055 | + lightareaField.setFloat(material.lightarea); |
---|
| 2056 | + |
---|
| 2057 | + materialtouched = true; |
---|
| 2058 | + applySelf(); |
---|
| 2059 | + } |
---|
| 2060 | + }); |
---|
| 2061 | + presetpanel.add(shini0); |
---|
| 2062 | + |
---|
| 2063 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF); |
---|
| 2064 | + shini1.setToolTipText("Shiny2"); |
---|
| 2065 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2066 | + { |
---|
| 2067 | + public void mouseClicked(MouseEvent e) |
---|
| 2068 | + { |
---|
| 2069 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2070 | + cMaterial material = object.material; |
---|
| 2071 | + |
---|
| 2072 | + shininessField.setFloat(material.shininess); |
---|
| 2073 | + lightareaField.setFloat(material.lightarea); |
---|
| 2074 | + |
---|
| 2075 | + materialtouched = true; |
---|
| 2076 | + applySelf(); |
---|
| 2077 | + } |
---|
| 2078 | + }); |
---|
| 2079 | + presetpanel.add(shini1); |
---|
| 2080 | + |
---|
| 2081 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF); |
---|
| 2082 | + shini2.setToolTipText("Shiny3"); |
---|
| 2083 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2084 | + { |
---|
| 2085 | + public void mouseClicked(MouseEvent e) |
---|
| 2086 | + { |
---|
| 2087 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2088 | + cMaterial material = object.material; |
---|
| 2089 | + |
---|
| 2090 | + shininessField.setFloat(material.shininess); |
---|
| 2091 | + lightareaField.setFloat(material.lightarea); |
---|
| 2092 | + |
---|
| 2093 | + materialtouched = true; |
---|
| 2094 | + applySelf(); |
---|
| 2095 | + } |
---|
| 2096 | + }); |
---|
| 2097 | + presetpanel.add(shini2); |
---|
| 2098 | + |
---|
| 2099 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF); |
---|
| 2100 | + aniso.setToolTipText("AnisoU"); |
---|
| 2101 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2102 | + { |
---|
| 2103 | + public void mouseClicked(MouseEvent e) |
---|
| 2104 | + { |
---|
| 2105 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2106 | + cMaterial material = object.material; |
---|
| 2107 | + |
---|
| 2108 | + anisoField.setFloat(material.aniso); |
---|
| 2109 | + anisoVField.setFloat(material.anisoV); |
---|
| 2110 | + |
---|
| 2111 | + materialtouched = true; |
---|
| 2112 | + applySelf(); |
---|
| 2113 | + } |
---|
| 2114 | + }); |
---|
| 2115 | + presetpanel.add(aniso); |
---|
| 2116 | + |
---|
| 2117 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF); |
---|
| 2118 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2119 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2120 | + { |
---|
| 2121 | + public void mouseClicked(MouseEvent e) |
---|
| 2122 | + { |
---|
| 2123 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2124 | + cMaterial material = object.material; |
---|
| 2125 | + |
---|
| 2126 | + anisoField.setFloat(material.aniso); |
---|
| 2127 | + anisoVField.setFloat(material.anisoV); |
---|
| 2128 | + |
---|
| 2129 | + materialtouched = true; |
---|
| 2130 | + applySelf(); |
---|
| 2131 | + } |
---|
| 2132 | + }); |
---|
| 2133 | + presetpanel.add(aniso2); |
---|
| 2134 | + |
---|
| 2135 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF); |
---|
| 2136 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2137 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2138 | + { |
---|
| 2139 | + public void mouseClicked(MouseEvent e) |
---|
| 2140 | + { |
---|
| 2141 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2142 | + cMaterial material = object.material; |
---|
| 2143 | + |
---|
| 2144 | + anisoField.setFloat(material.aniso); |
---|
| 2145 | + anisoVField.setFloat(material.anisoV); |
---|
| 2146 | + |
---|
| 2147 | + materialtouched = true; |
---|
| 2148 | + applySelf(); |
---|
| 2149 | + } |
---|
| 2150 | + }); |
---|
| 2151 | + presetpanel.add(aniso3); |
---|
| 2152 | + |
---|
| 2153 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF); |
---|
| 2154 | + velvet0.setToolTipText("Velvet"); |
---|
| 2155 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2156 | + { |
---|
| 2157 | + public void mouseClicked(MouseEvent e) |
---|
| 2158 | + { |
---|
| 2159 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2160 | + cMaterial material = object.material; |
---|
| 2161 | + |
---|
| 2162 | + diffusenessField.setFloat(material.factor); |
---|
| 2163 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2164 | + sheenField.setFloat(material.sheen); |
---|
| 2165 | + shininessField.setFloat(material.shininess); |
---|
| 2166 | + velvetField.setFloat(material.velvet); |
---|
| 2167 | + shiftField.setFloat(material.shift); |
---|
| 2168 | + |
---|
| 2169 | + materialtouched = true; |
---|
| 2170 | + applySelf(); |
---|
| 2171 | + } |
---|
| 2172 | + }); |
---|
| 2173 | + presetpanel.add(velvet0); |
---|
| 2174 | + |
---|
| 2175 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF); |
---|
| 2176 | + bump0.setToolTipText("Bump texture"); |
---|
| 2177 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2178 | + { |
---|
| 2179 | + public void mouseClicked(MouseEvent e) |
---|
| 2180 | + { |
---|
| 2181 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2182 | + cMaterial material = object.material; |
---|
| 2183 | + |
---|
| 2184 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2185 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2186 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2187 | + |
---|
| 2188 | + materialtouched = true; |
---|
| 2189 | + applySelf(); |
---|
| 2190 | + } |
---|
| 2191 | + }); |
---|
| 2192 | + presetpanel.add(bump0); |
---|
| 2193 | + |
---|
| 2194 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF); |
---|
| 2195 | + borderShader.setToolTipText("Border fade"); |
---|
| 2196 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2197 | + { |
---|
| 2198 | + public void mouseClicked(MouseEvent e) |
---|
| 2199 | + { |
---|
| 2200 | + borderfadeField.setFloat(0.5); |
---|
| 2201 | + opacityField.setFloat(0.75); |
---|
| 2202 | + |
---|
| 2203 | + materialtouched = true; |
---|
| 2204 | + applySelf(); |
---|
| 2205 | + } |
---|
| 2206 | + }); |
---|
| 2207 | + presetpanel.add(borderShader); |
---|
| 2208 | + |
---|
| 2209 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF); |
---|
| 2210 | + halo.setToolTipText("Halo"); |
---|
| 2211 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2212 | + { |
---|
| 2213 | + public void mouseClicked(MouseEvent e) |
---|
| 2214 | + { |
---|
| 2215 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2216 | + cMaterial material = object.material; |
---|
| 2217 | + |
---|
| 2218 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2219 | + |
---|
| 2220 | + materialtouched = true; |
---|
| 2221 | + applySelf(); |
---|
| 2222 | + } |
---|
| 2223 | + }); |
---|
| 2224 | + presetpanel.add(halo); |
---|
| 2225 | + |
---|
| 2226 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF); |
---|
| 2227 | + candle.setToolTipText("Candle"); |
---|
| 2228 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2229 | + { |
---|
| 2230 | + public void mouseClicked(MouseEvent e) |
---|
| 2231 | + { |
---|
| 2232 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2233 | + cMaterial material = object.material; |
---|
| 2234 | + |
---|
| 2235 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2236 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2237 | + ambientField.setFloat(material.ambient); |
---|
| 2238 | + specularField.setFloat(material.specular); |
---|
| 2239 | + lightareaField.setFloat(material.lightarea); |
---|
| 2240 | + shininessField.setFloat(material.shininess); |
---|
| 2241 | + |
---|
| 2242 | + materialtouched = true; |
---|
| 2243 | + applySelf(); |
---|
| 2244 | + } |
---|
| 2245 | + }); |
---|
| 2246 | + presetpanel.add(candle); |
---|
| 2247 | + |
---|
| 2248 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF); |
---|
| 2249 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2250 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2251 | + { |
---|
| 2252 | + public void mouseClicked(MouseEvent e) |
---|
| 2253 | + { |
---|
| 2254 | + diffuseField.setFloat(0.001); |
---|
| 2255 | + ambientField.setFloat(0.001); |
---|
| 2256 | + cameraField.setFloat(0.001); |
---|
| 2257 | + specularField.setFloat(0.001); |
---|
| 2258 | + fakedepthField.setFloat(0.001); |
---|
| 2259 | + opacityField.setFloat(0.6); |
---|
| 2260 | + |
---|
| 2261 | + materialtouched = true; |
---|
| 2262 | + applySelf(); |
---|
| 2263 | + } |
---|
| 2264 | + }); |
---|
| 2265 | + presetpanel.add(shadowShader); |
---|
| 2266 | + |
---|
| 2267 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2268 | + |
---|
| 2269 | + presetpanel.preferredWidth = 1; |
---|
| 2270 | + |
---|
| 2271 | + materialpanel.add(presetpanel); |
---|
| 2272 | + materialpanel.add(panel); |
---|
| 2273 | + |
---|
| 2274 | + panel.preferredWidth = 8; |
---|
| 2275 | + |
---|
| 2276 | + /* |
---|
1473 | 2277 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1474 | 2278 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1475 | | - */ |
---|
| 2279 | + */ |
---|
1476 | 2280 | |
---|
1477 | 2281 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1478 | 2282 | |
---|
.. | .. |
---|
1506 | 2310 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1507 | 2311 | |
---|
1508 | 2312 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 2313 | + |
---|
| 2314 | + cGridBag huepanel = new cGridBag(); |
---|
| 2315 | + cGridBag huelabel = new cGridBag(); |
---|
| 2316 | + cLabel hue = GetLabel("icons/hue.png", false); |
---|
| 2317 | + hue.fit = true; |
---|
| 2318 | + |
---|
| 2319 | + hue.addMouseListener(new MouseAdapter() |
---|
| 2320 | + { |
---|
| 2321 | + public void mousePressed(MouseEvent e) |
---|
| 2322 | + { |
---|
| 2323 | + int x = e.getX(); |
---|
| 2324 | + |
---|
| 2325 | + colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth()); |
---|
| 2326 | + } |
---|
| 2327 | + }); |
---|
| 2328 | + |
---|
| 2329 | + huelabel.add(hue); |
---|
| 2330 | + huelabel.preferredWidth = 20; |
---|
| 2331 | + huepanel.add(new cGridBag()); // Label |
---|
| 2332 | + huepanel.add(huelabel); // Field/slider |
---|
| 2333 | + |
---|
| 2334 | + huepanel.preferredHeight = 7; |
---|
| 2335 | + |
---|
| 2336 | + colorSection.add(huepanel); |
---|
1509 | 2337 | |
---|
1510 | 2338 | 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); |
---|
| 2339 | + |
---|
| 2340 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 2341 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2342 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2343 | + |
---|
1514 | 2344 | //colorField.preferredWidth = 200; |
---|
1515 | 2345 | colorSection.add(color); |
---|
1516 | 2346 | |
---|
1517 | 2347 | cGridBag modulation = new cGridBag(); |
---|
1518 | 2348 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1519 | 2349 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1520 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2350 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1521 | 2351 | colorSection.add(modulation); |
---|
1522 | 2352 | |
---|
| 2353 | + cGridBag opacity = new cGridBag(); |
---|
| 2354 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 2355 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2356 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2357 | + colorSection.add(opacity); |
---|
| 2358 | + |
---|
| 2359 | + colorSection.add(GetSeparator()); |
---|
| 2360 | + |
---|
1523 | 2361 | cGridBag texture = new cGridBag(); |
---|
1524 | 2362 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1525 | 2363 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1526 | 2364 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1527 | 2365 | colorSection.add(texture); |
---|
1528 | 2366 | |
---|
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()); |
---|
| 2367 | + panel.add(GetSeparator()); |
---|
1548 | 2368 | |
---|
1549 | 2369 | panel.add(colorSection); |
---|
1550 | 2370 | |
---|
.. | .. |
---|
1594 | 2414 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1595 | 2415 | diffuseSection.add(fakedepth); |
---|
1596 | 2416 | |
---|
1597 | | - panel.add(new JSeparator()); |
---|
| 2417 | + cGridBag shadowbias = new cGridBag(); |
---|
| 2418 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 2419 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2420 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2421 | + diffuseSection.add(shadowbias); |
---|
| 2422 | + |
---|
| 2423 | + panel.add(GetSeparator()); |
---|
1598 | 2424 | |
---|
1599 | 2425 | panel.add(diffuseSection); |
---|
1600 | 2426 | |
---|
.. | .. |
---|
1644 | 2470 | // aConstraints.gridy += 1; |
---|
1645 | 2471 | // aConstraints.gridwidth = 1; |
---|
1646 | 2472 | |
---|
| 2473 | + cGridBag anisoU = new cGridBag(); |
---|
| 2474 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 2475 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2476 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2477 | + specularSection.add(anisoU); |
---|
1647 | 2478 | |
---|
1648 | | - panel.add(new JSeparator()); |
---|
| 2479 | + cGridBag anisoV = new cGridBag(); |
---|
| 2480 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 2481 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2482 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2483 | + specularSection.add(anisoV); |
---|
| 2484 | + |
---|
| 2485 | + |
---|
| 2486 | + panel.add(GetSeparator()); |
---|
1649 | 2487 | |
---|
1650 | 2488 | panel.add(specularSection); |
---|
1651 | 2489 | |
---|
1652 | 2490 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1653 | 2491 | |
---|
1654 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 2492 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1655 | 2493 | |
---|
1656 | 2494 | cGridBag camera = new cGridBag(); |
---|
1657 | 2495 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1658 | 2496 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1659 | 2497 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1660 | | - globalSection.add(camera); |
---|
| 2498 | + colorSection.add(camera); |
---|
1661 | 2499 | |
---|
1662 | 2500 | cGridBag ambient = new cGridBag(); |
---|
1663 | 2501 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1664 | 2502 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1665 | 2503 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1666 | | - globalSection.add(ambient); |
---|
| 2504 | + colorSection.add(ambient); |
---|
1667 | 2505 | |
---|
1668 | 2506 | cGridBag backlit = new cGridBag(); |
---|
1669 | 2507 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1670 | 2508 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1671 | 2509 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1672 | | - globalSection.add(backlit); |
---|
| 2510 | + colorSection.add(backlit); |
---|
1673 | 2511 | |
---|
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()); |
---|
| 2512 | + //panel.add(new JSeparator()); |
---|
1681 | 2513 | |
---|
1682 | | - panel.add(globalSection); |
---|
| 2514 | + //panel.add(globalSection); |
---|
1683 | 2515 | |
---|
1684 | 2516 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1685 | 2517 | |
---|
.. | .. |
---|
1721 | 2553 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1722 | 2554 | textureSection.add(opacityPower); |
---|
1723 | 2555 | |
---|
1724 | | - panel.add(new JSeparator()); |
---|
| 2556 | + panel.add(GetSeparator()); |
---|
1725 | 2557 | |
---|
1726 | 2558 | panel.add(textureSection); |
---|
1727 | 2559 | |
---|
.. | .. |
---|
1786 | 2618 | // 3D models |
---|
1787 | 2619 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1788 | 2620 | { |
---|
1789 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1790 | | - LoadFile(filename, lastConverter); |
---|
| 2621 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2622 | + //LoadFile(filename, lastConverter); |
---|
| 2623 | + LoadObjFile(filename); // New 3ds loader |
---|
1791 | 2624 | continue; |
---|
1792 | 2625 | } |
---|
1793 | 2626 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
1988 | 2821 | e2.printStackTrace(); |
---|
1989 | 2822 | } |
---|
1990 | 2823 | } |
---|
| 2824 | + |
---|
1991 | 2825 | LoadJMEThread loadThread; |
---|
1992 | 2826 | |
---|
1993 | 2827 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
2045 | 2879 | //LoadFile0(filename, converter); |
---|
2046 | 2880 | } |
---|
2047 | 2881 | } |
---|
| 2882 | + |
---|
2048 | 2883 | LoadOBJThread loadObjThread; |
---|
2049 | 2884 | |
---|
2050 | 2885 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2123 | 2958 | |
---|
2124 | 2959 | void LoadObjFile(String fullname) |
---|
2125 | 2960 | { |
---|
2126 | | - /* |
---|
| 2961 | + System.out.println("Loading " + fullname); |
---|
| 2962 | + /**/ |
---|
2127 | 2963 | //lastFilename = fullname; |
---|
2128 | 2964 | if(loadObjThread == null) |
---|
2129 | 2965 | { |
---|
2130 | | - loadObjThread = new LoadOBJThread(); |
---|
2131 | | - loadObjThread.start(); |
---|
| 2966 | + loadObjThread = new LoadOBJThread(); |
---|
| 2967 | + loadObjThread.start(); |
---|
2132 | 2968 | } |
---|
2133 | 2969 | |
---|
2134 | 2970 | loadObjThread.add(fullname); |
---|
2135 | | - */ |
---|
| 2971 | + /**/ |
---|
2136 | 2972 | |
---|
2137 | | - System.out.println("Loading " + fullname); |
---|
2138 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2973 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2139 | 2974 | } |
---|
2140 | 2975 | |
---|
2141 | 2976 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2511 | 3346 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2512 | 3347 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2513 | 3348 | } |
---|
| 3349 | + |
---|
2514 | 3350 | //cJME.count++; |
---|
2515 | 3351 | //cJME.count %= 12; |
---|
2516 | 3352 | if (gc) |
---|
.. | .. |
---|
2694 | 3530 | } |
---|
2695 | 3531 | } |
---|
2696 | 3532 | } |
---|
| 3533 | + |
---|
2697 | 3534 | cFileSystemPane FSPane; |
---|
2698 | 3535 | |
---|
2699 | 3536 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2703 | 3540 | |
---|
2704 | 3541 | freezematerial = true; |
---|
2705 | 3542 | colorField.setFloat(mat.color); |
---|
2706 | | - modulationField.setFloat(mat.modulation); |
---|
| 3543 | + saturationField.setFloat(mat.modulation); |
---|
2707 | 3544 | metalnessField.setFloat(mat.metalness); |
---|
2708 | 3545 | diffuseField.setFloat(mat.diffuse); |
---|
2709 | 3546 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
2747 | 3584 | } |
---|
2748 | 3585 | } |
---|
2749 | 3586 | } |
---|
| 3587 | + |
---|
2750 | 3588 | freezematerial = false; |
---|
2751 | 3589 | } |
---|
2752 | 3590 | |
---|
2753 | 3591 | void SetMaterial(Object3D object) |
---|
2754 | 3592 | { |
---|
| 3593 | + latestObject = object; |
---|
| 3594 | + |
---|
2755 | 3595 | cMaterial mat = object.material; |
---|
2756 | 3596 | |
---|
2757 | 3597 | if (mat == null) |
---|
.. | .. |
---|
2762 | 3602 | |
---|
2763 | 3603 | if (multiplyToggle != null) |
---|
2764 | 3604 | 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 | | - } |
---|
| 3605 | + |
---|
| 3606 | + AllocProjectedVertices(object); |
---|
2791 | 3607 | |
---|
2792 | 3608 | SetMaterial(mat, object.projectedVertices); |
---|
2793 | 3609 | } |
---|
.. | .. |
---|
2863 | 3679 | // } |
---|
2864 | 3680 | |
---|
2865 | 3681 | /**/ |
---|
2866 | | - if (deselect) |
---|
| 3682 | + if (deselect || child == null) |
---|
2867 | 3683 | { |
---|
2868 | 3684 | //group.deselectAll(); |
---|
2869 | 3685 | //freeze = true; |
---|
2870 | 3686 | GetTree().clearSelection(); |
---|
2871 | 3687 | //freeze = false; |
---|
| 3688 | + |
---|
| 3689 | + if (child == null) |
---|
| 3690 | + { |
---|
| 3691 | + return; |
---|
| 3692 | + } |
---|
2872 | 3693 | } |
---|
2873 | 3694 | |
---|
2874 | 3695 | //group.addSelectee(child); |
---|
.. | .. |
---|
2902 | 3723 | public void itemStateChanged(ItemEvent event) |
---|
2903 | 3724 | { |
---|
2904 | 3725 | // System.out.println("Propagate = " + propagate); |
---|
| 3726 | + if (event.getSource() == pinButton) |
---|
| 3727 | + { |
---|
| 3728 | + copy.pinned ^= true; |
---|
| 3729 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3730 | + { |
---|
| 3731 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3732 | + copy.CloseUI(); |
---|
| 3733 | + //copy.editWindow.refreshContents(); |
---|
| 3734 | + } |
---|
| 3735 | + } |
---|
| 3736 | + else |
---|
2905 | 3737 | if (event.getSource() == propagateToggle) |
---|
2906 | 3738 | { |
---|
2907 | 3739 | propagate ^= true; |
---|
.. | .. |
---|
2937 | 3769 | cameraView.ToggleDL(); |
---|
2938 | 3770 | cameraView.repaint(); |
---|
2939 | 3771 | return; |
---|
2940 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3772 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2941 | 3773 | { |
---|
2942 | 3774 | cameraView.ToggleTexture(); |
---|
2943 | 3775 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2976 | 3808 | frame.validate(); |
---|
2977 | 3809 | |
---|
2978 | 3810 | return; |
---|
2979 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3811 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2980 | 3812 | { |
---|
2981 | | - cameraView.ToggleRandom(); |
---|
| 3813 | + cameraView.ToggleSwitch(); |
---|
2982 | 3814 | cameraView.repaint(); |
---|
2983 | 3815 | return; |
---|
2984 | 3816 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
3006 | 3838 | } else if (event.getSource() == liveCB) |
---|
3007 | 3839 | { |
---|
3008 | 3840 | copy.live ^= true; |
---|
| 3841 | + objEditor.refreshContents(true); // To show item colors |
---|
| 3842 | + return; |
---|
| 3843 | + } else if (event.getSource() == selectableCB) |
---|
| 3844 | + { |
---|
| 3845 | + copy.dontselect ^= true; |
---|
3009 | 3846 | return; |
---|
3010 | 3847 | } else if (event.getSource() == hideCB) |
---|
3011 | 3848 | { |
---|
3012 | 3849 | copy.hide ^= true; |
---|
3013 | 3850 | copy.Touch(); // display list issue |
---|
3014 | | - objEditor.refreshContents(); |
---|
| 3851 | + objEditor.refreshContents(true); // To show item colors |
---|
3015 | 3852 | return; |
---|
3016 | 3853 | } else if (event.getSource() == link2masterCB) |
---|
3017 | 3854 | { |
---|
.. | .. |
---|
3045 | 3882 | |
---|
3046 | 3883 | public void actionPerformed(ActionEvent event) |
---|
3047 | 3884 | { |
---|
| 3885 | + Object source = event.getSource(); |
---|
3048 | 3886 | // SCRIPT DIALOG |
---|
3049 | | - if (event.getSource() == okbutton) |
---|
| 3887 | + if (source == okbutton) |
---|
3050 | 3888 | { |
---|
3051 | 3889 | textpanel.setVisible(false); |
---|
3052 | 3890 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3058 | 3896 | textarea = null; |
---|
3059 | 3897 | textpanel = null; |
---|
3060 | 3898 | } |
---|
3061 | | - if (event.getSource() == cancelbutton) |
---|
| 3899 | + if (source == cancelbutton) |
---|
3062 | 3900 | { |
---|
3063 | 3901 | textpanel.setVisible(false); |
---|
3064 | 3902 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3070 | 3908 | //applySelf(); |
---|
3071 | 3909 | //client.refreshEditWindow(); |
---|
3072 | 3910 | //refreshContents(); |
---|
3073 | | - if (event.getSource() == nameField) |
---|
| 3911 | + if (source == nameField) |
---|
3074 | 3912 | { |
---|
3075 | 3913 | //System.out.println("ObjEditor " + event); |
---|
3076 | 3914 | applySelf0(true); |
---|
3077 | 3915 | //parent.applySelf(); |
---|
3078 | 3916 | objEditor.refreshContents(); |
---|
3079 | | - } else if (event.getSource() == resetButton) |
---|
| 3917 | + } else if (source == resetButton) |
---|
3080 | 3918 | { |
---|
3081 | 3919 | CameraPane.fullreset = true; |
---|
3082 | 3920 | copy.Reset(); // ResetMeshes(); |
---|
3083 | 3921 | copy.Touch(); |
---|
3084 | 3922 | objEditor.refreshContents(); |
---|
3085 | | - } else if (event.getSource() == stepItem) |
---|
| 3923 | + } else if (source == stepItem) |
---|
3086 | 3924 | { |
---|
3087 | 3925 | //cameraView.ONESTEP = true; |
---|
3088 | 3926 | Globals.ONESTEP = true; |
---|
3089 | 3927 | cameraView.repaint(); |
---|
3090 | 3928 | return; |
---|
3091 | | - } else if (event.getSource() == stepButton) |
---|
| 3929 | + } else if (source == stepButton) |
---|
3092 | 3930 | { |
---|
3093 | 3931 | copy.Step(); |
---|
3094 | 3932 | copy.Touch(); |
---|
3095 | 3933 | objEditor.refreshContents(); |
---|
3096 | | - } else if (event.getSource() == slowerButton) |
---|
| 3934 | + } else if (source == slowerButton) |
---|
3097 | 3935 | { |
---|
3098 | 3936 | copy.Slower(); |
---|
3099 | 3937 | copy.Touch(); |
---|
3100 | 3938 | objEditor.refreshContents(); |
---|
3101 | | - } else if (event.getSource() == fasterButton) |
---|
| 3939 | + } else if (source == fasterButton) |
---|
3102 | 3940 | { |
---|
3103 | 3941 | copy.Faster(); |
---|
3104 | 3942 | copy.Touch(); |
---|
3105 | 3943 | objEditor.refreshContents(); |
---|
3106 | | - } else if (event.getSource() == remarkButton) |
---|
| 3944 | + } else if (source == remarkButton) |
---|
3107 | 3945 | { |
---|
3108 | 3946 | copy.Remark(); |
---|
3109 | 3947 | copy.Touch(); |
---|
3110 | 3948 | objEditor.refreshContents(); |
---|
3111 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3949 | + } else if (source == stepAllButton) |
---|
3112 | 3950 | { |
---|
3113 | 3951 | copy.StepAll(); |
---|
3114 | 3952 | copy.Touch(); |
---|
3115 | 3953 | objEditor.refreshContents(); |
---|
3116 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3954 | + } else if (source == resetAllButton) |
---|
3117 | 3955 | { |
---|
3118 | 3956 | //CameraPane.fullreset = true; |
---|
3119 | 3957 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3146 | 3984 | // Close(); |
---|
3147 | 3985 | // } |
---|
3148 | 3986 | // else |
---|
3149 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3987 | + if (source == resetSlidersButton) |
---|
3150 | 3988 | { |
---|
3151 | 3989 | ResetSliders(); |
---|
3152 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3990 | + } else if (source == clearMaterialButton) |
---|
3153 | 3991 | { |
---|
3154 | 3992 | ClearMaterial(); |
---|
3155 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3993 | + } else if (source == createMaterialButton) |
---|
3156 | 3994 | { |
---|
3157 | 3995 | CreateMaterial(); |
---|
3158 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3996 | + } else if (source == clearPanelButton) |
---|
3159 | 3997 | { |
---|
3160 | 3998 | copy.ClearUI(); |
---|
3161 | 3999 | refreshContents(true); |
---|
3162 | | - } /* |
---|
3163 | | - } |
---|
3164 | | - |
---|
3165 | | - public boolean action(Event event, Object arg) |
---|
3166 | | - { |
---|
3167 | | - */ else if (event.getSource() == closeItem) |
---|
| 4000 | + } else if (source == importGFDItem) |
---|
| 4001 | + { |
---|
| 4002 | + ImportGFD(); |
---|
| 4003 | + } else |
---|
| 4004 | + if (source == importVRMLX3DItem) |
---|
| 4005 | + { |
---|
| 4006 | + ImportVRMLX3D(); |
---|
| 4007 | + } else |
---|
| 4008 | + if (source == import3DSItem) |
---|
| 4009 | + { |
---|
| 4010 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 4011 | + } else |
---|
| 4012 | + if (source == importOBJItem) |
---|
| 4013 | + { |
---|
| 4014 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 4015 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 4016 | + browser.setVisible(true); |
---|
| 4017 | + String filename = browser.getFile(); |
---|
| 4018 | + if (filename != null && filename.length() > 0) |
---|
| 4019 | + { |
---|
| 4020 | + String fullname = browser.getDirectory() + filename; |
---|
| 4021 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 4022 | + } |
---|
| 4023 | + } else |
---|
| 4024 | + if (source == closeItem) |
---|
3168 | 4025 | { |
---|
3169 | 4026 | Close(); |
---|
3170 | 4027 | //return true; |
---|
3171 | | - } else if (event.getSource() == loadItem) |
---|
| 4028 | + } else if (source == openItem) |
---|
3172 | 4029 | { |
---|
3173 | | - load(); |
---|
| 4030 | + Open(); |
---|
3174 | 4031 | //return true; |
---|
3175 | | - } else if (event.getSource() == saveItem) |
---|
| 4032 | + } else if (source == newItem) |
---|
| 4033 | + { |
---|
| 4034 | + New(); |
---|
| 4035 | + } else if (source == saveItem) |
---|
3176 | 4036 | { |
---|
3177 | 4037 | save(); |
---|
3178 | 4038 | //return true; |
---|
3179 | | - } else if (event.getSource() == saveAsItem) |
---|
| 4039 | + } else if (source == saveAsItem) |
---|
3180 | 4040 | { |
---|
3181 | 4041 | saveAs(); |
---|
3182 | 4042 | //return true; |
---|
3183 | | - } else if (event.getSource() == reexportItem) |
---|
| 4043 | + } else if (source == reexportItem) |
---|
3184 | 4044 | { |
---|
3185 | 4045 | reexport(); |
---|
3186 | 4046 | //return true; |
---|
3187 | | - } else if (event.getSource() == exportAsItem) |
---|
| 4047 | + } else if (source == exportAsItem) |
---|
3188 | 4048 | { |
---|
3189 | 4049 | export(); |
---|
3190 | 4050 | //return true; |
---|
3191 | | - } else if (event.getSource() == povItem) |
---|
| 4051 | + } else if (source == povItem) |
---|
3192 | 4052 | { |
---|
3193 | 4053 | generatePOV(); |
---|
3194 | 4054 | //return true; |
---|
3195 | | - } else if (event.getSource() == zBufferItem) |
---|
| 4055 | + } else if (event.getSource() == archiveItem) |
---|
| 4056 | + { |
---|
| 4057 | + cTools.Archive(frame); |
---|
| 4058 | + return; |
---|
| 4059 | + } else if (source == zBufferItem) |
---|
3196 | 4060 | { |
---|
3197 | 4061 | try |
---|
3198 | 4062 | { |
---|
.. | .. |
---|
3214 | 4078 | cameraView.repaint(); |
---|
3215 | 4079 | //return true; |
---|
3216 | 4080 | } |
---|
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) |
---|
| 4081 | + */ else // combos... |
---|
| 4082 | + if (source == texresMenu) |
---|
3232 | 4083 | { |
---|
3233 | 4084 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3234 | 4085 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3240 | 4091 | } |
---|
3241 | 4092 | } |
---|
3242 | 4093 | |
---|
| 4094 | + void New() |
---|
| 4095 | + { |
---|
| 4096 | + while (copy.Size() > 1) |
---|
| 4097 | + { |
---|
| 4098 | + copy.remove(1); |
---|
| 4099 | + } |
---|
| 4100 | + |
---|
| 4101 | + ResetModel(); |
---|
| 4102 | + objEditor.refreshContents(); |
---|
| 4103 | + } |
---|
| 4104 | + |
---|
| 4105 | + static public byte[] Compress(Object3D o) |
---|
| 4106 | + { |
---|
| 4107 | + // Slower to actually compress. |
---|
| 4108 | + try |
---|
| 4109 | + { |
---|
| 4110 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 4111 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 4112 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
| 4113 | + |
---|
| 4114 | + Object3D parent = o.parent; |
---|
| 4115 | + o.parent = null; |
---|
| 4116 | + |
---|
| 4117 | + out.writeObject(o); |
---|
| 4118 | + |
---|
| 4119 | + o.parent = parent; |
---|
| 4120 | + |
---|
| 4121 | + out.flush(); |
---|
| 4122 | + |
---|
| 4123 | + baos //zstream |
---|
| 4124 | + .close(); |
---|
| 4125 | + out.close(); |
---|
| 4126 | + |
---|
| 4127 | + byte[] bytes = baos.toByteArray(); |
---|
| 4128 | + |
---|
| 4129 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 4130 | + return bytes; |
---|
| 4131 | + } catch (Exception e) |
---|
| 4132 | + { |
---|
| 4133 | + System.err.println(e); |
---|
| 4134 | + return null; |
---|
| 4135 | + } |
---|
| 4136 | + } |
---|
| 4137 | + |
---|
| 4138 | + static public Object Uncompress(byte[] bytes) |
---|
| 4139 | + { |
---|
| 4140 | + System.out.println("restore #bytes = " + bytes.length); |
---|
| 4141 | + try |
---|
| 4142 | + { |
---|
| 4143 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 4144 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 4145 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
| 4146 | + Object obj = in.readObject(); |
---|
| 4147 | + |
---|
| 4148 | + bais //istream |
---|
| 4149 | + .close(); |
---|
| 4150 | + in.close(); |
---|
| 4151 | + |
---|
| 4152 | + return obj; |
---|
| 4153 | + } catch (Exception e) |
---|
| 4154 | + { |
---|
| 4155 | + System.err.println(e); |
---|
| 4156 | + return null; |
---|
| 4157 | + } |
---|
| 4158 | + } |
---|
| 4159 | + |
---|
| 4160 | + static public Object clone(Object o) |
---|
| 4161 | + { |
---|
| 4162 | + try |
---|
| 4163 | + { |
---|
| 4164 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 4165 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 4166 | + |
---|
| 4167 | + out.writeObject(o); |
---|
| 4168 | + |
---|
| 4169 | + out.flush(); |
---|
| 4170 | + out.close(); |
---|
| 4171 | + |
---|
| 4172 | + byte[] bytes = baos.toByteArray(); |
---|
| 4173 | + |
---|
| 4174 | + System.out.println("clone = " + bytes.length); |
---|
| 4175 | + |
---|
| 4176 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 4177 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 4178 | + Object obj = in.readObject(); |
---|
| 4179 | + in.close(); |
---|
| 4180 | + |
---|
| 4181 | + return obj; |
---|
| 4182 | + } catch (Exception e) |
---|
| 4183 | + { |
---|
| 4184 | + System.err.println(e); |
---|
| 4185 | + return null; |
---|
| 4186 | + } |
---|
| 4187 | + } |
---|
| 4188 | + |
---|
| 4189 | + cRadio GetCurrentTab() |
---|
| 4190 | + { |
---|
| 4191 | + cRadio ab; |
---|
| 4192 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 4193 | + { |
---|
| 4194 | + ab = (cRadio)e.nextElement(); |
---|
| 4195 | + if(ab.GetObject() == copy) |
---|
| 4196 | + { |
---|
| 4197 | + return ab; |
---|
| 4198 | + } |
---|
| 4199 | + } |
---|
| 4200 | + |
---|
| 4201 | + return null; |
---|
| 4202 | + } |
---|
| 4203 | + |
---|
| 4204 | + |
---|
| 4205 | + public void Save() |
---|
| 4206 | + { |
---|
| 4207 | + //Save(true); |
---|
| 4208 | + Replace(); |
---|
| 4209 | + SetVersionStates(); |
---|
| 4210 | + } |
---|
| 4211 | + |
---|
| 4212 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 4213 | + { |
---|
| 4214 | + if (compress.length != name.length) |
---|
| 4215 | + { |
---|
| 4216 | + return false; |
---|
| 4217 | + } |
---|
| 4218 | + |
---|
| 4219 | + for (int i=compress.length; --i>=0;) |
---|
| 4220 | + { |
---|
| 4221 | + if (compress[i] != name[i]) |
---|
| 4222 | + return false; |
---|
| 4223 | + } |
---|
| 4224 | + |
---|
| 4225 | + return true; |
---|
| 4226 | + } |
---|
| 4227 | + |
---|
| 4228 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 4229 | + |
---|
| 4230 | + void DeleteVersion() |
---|
| 4231 | + { |
---|
| 4232 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4233 | + { |
---|
| 4234 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4235 | + } |
---|
| 4236 | + |
---|
| 4237 | + CopyChanged(); |
---|
| 4238 | + |
---|
| 4239 | + SetVersionStates(); |
---|
| 4240 | + } |
---|
| 4241 | + |
---|
| 4242 | + public boolean Save(boolean user) |
---|
| 4243 | + { |
---|
| 4244 | + System.err.println("Save"); |
---|
| 4245 | + Replace(); |
---|
| 4246 | + |
---|
| 4247 | + //cRadio tab = GetCurrentTab(); |
---|
| 4248 | + |
---|
| 4249 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
| 4250 | + |
---|
| 4251 | + boolean thesame = false; |
---|
| 4252 | + |
---|
| 4253 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4254 | +// { |
---|
| 4255 | +// thesame = true; |
---|
| 4256 | +// } |
---|
| 4257 | + |
---|
| 4258 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 4259 | + if (!thesame) |
---|
| 4260 | + { |
---|
| 4261 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4262 | + { |
---|
| 4263 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4264 | + } |
---|
| 4265 | + |
---|
| 4266 | + //tab.user[tab.versionindex] = user; |
---|
| 4267 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 4268 | + |
---|
| 4269 | + copy.versionlist[++copy.versionindex] = compress; |
---|
| 4270 | + |
---|
| 4271 | + // if (increment) |
---|
| 4272 | + // tab.versionindex++; |
---|
| 4273 | + } |
---|
| 4274 | + |
---|
| 4275 | + //copy.RestoreBigData(versiontable); |
---|
| 4276 | + |
---|
| 4277 | + //assert(hashtable.isEmpty()); |
---|
| 4278 | + |
---|
| 4279 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4280 | +// { |
---|
| 4281 | +// //tab.user[i] = false; |
---|
| 4282 | +// copy.versionlist[i] = null; |
---|
| 4283 | +// } |
---|
| 4284 | + |
---|
| 4285 | + SetVersionStates(); |
---|
| 4286 | + |
---|
| 4287 | + // test save |
---|
| 4288 | + if (false) |
---|
| 4289 | + { |
---|
| 4290 | + try |
---|
| 4291 | + { |
---|
| 4292 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
| 4293 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4294 | + |
---|
| 4295 | + p.writeObject(copy); |
---|
| 4296 | + |
---|
| 4297 | + p.flush(); |
---|
| 4298 | + |
---|
| 4299 | + ostream.close(); |
---|
| 4300 | + } catch (Exception e) |
---|
| 4301 | + { |
---|
| 4302 | + e.printStackTrace(); |
---|
| 4303 | + } |
---|
| 4304 | + } |
---|
| 4305 | + |
---|
| 4306 | + return !thesame; |
---|
| 4307 | + } |
---|
| 4308 | + |
---|
| 4309 | + boolean flashIt = true; |
---|
| 4310 | + |
---|
| 4311 | + void RefreshSelection() |
---|
| 4312 | + { |
---|
| 4313 | + Object3D selection = new Object3D(); |
---|
| 4314 | + |
---|
| 4315 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4316 | + { |
---|
| 4317 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 4318 | + |
---|
| 4319 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4320 | + |
---|
| 4321 | + if (obj == null) |
---|
| 4322 | + { |
---|
| 4323 | + copy.selection.remove(i--); |
---|
| 4324 | + } |
---|
| 4325 | + else |
---|
| 4326 | + { |
---|
| 4327 | + selection.add(obj); |
---|
| 4328 | + copy.selection.setElementAt(obj, i); |
---|
| 4329 | + } |
---|
| 4330 | + } |
---|
| 4331 | + |
---|
| 4332 | + flashIt = false; |
---|
| 4333 | + GetTree().clearSelection(); |
---|
| 4334 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4335 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4336 | + flashIt = true; |
---|
| 4337 | + |
---|
| 4338 | + //refreshContents(false); |
---|
| 4339 | + } |
---|
| 4340 | + |
---|
| 4341 | + void CopyChanged() |
---|
| 4342 | + { |
---|
| 4343 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4344 | + |
---|
| 4345 | + SetVersionStates(); |
---|
| 4346 | + |
---|
| 4347 | + boolean temp = CameraPane.SWITCH; |
---|
| 4348 | + CameraPane.SWITCH = false; |
---|
| 4349 | + |
---|
| 4350 | + copy.ExtractBigData(versiontable); |
---|
| 4351 | + |
---|
| 4352 | + copy.clear(); |
---|
| 4353 | + |
---|
| 4354 | + copy.skyboxname = obj.skyboxname; |
---|
| 4355 | + copy.skyboxext = obj.skyboxext; |
---|
| 4356 | + |
---|
| 4357 | + for (int i=0; i<obj.Size(); i++) |
---|
| 4358 | + { |
---|
| 4359 | + copy.add(obj.get(i)); |
---|
| 4360 | + } |
---|
| 4361 | + |
---|
| 4362 | + copy.RestoreBigData(versiontable); |
---|
| 4363 | + |
---|
| 4364 | + CameraPane.SWITCH = temp; |
---|
| 4365 | + |
---|
| 4366 | + RefreshSelection(); |
---|
| 4367 | + //assert(hashtable.isEmpty()); |
---|
| 4368 | + |
---|
| 4369 | + copy.Touch(); |
---|
| 4370 | + |
---|
| 4371 | + ResetModel(); |
---|
| 4372 | + copy.HardTouch(); // recompile? |
---|
| 4373 | + |
---|
| 4374 | + cRadio ab; |
---|
| 4375 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 4376 | + { |
---|
| 4377 | + ab = (cRadio)e.nextElement(); |
---|
| 4378 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 4379 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 4380 | + if (test != null) |
---|
| 4381 | + { |
---|
| 4382 | + test.editWindow = ab.object.editWindow; |
---|
| 4383 | + ab.object = test; |
---|
| 4384 | + } |
---|
| 4385 | + } |
---|
| 4386 | + |
---|
| 4387 | + refreshContents(true); |
---|
| 4388 | + } |
---|
| 4389 | + |
---|
| 4390 | + cButton previousVersionButton; |
---|
| 4391 | + cButton restoreButton; |
---|
| 4392 | + cButton replaceButton; |
---|
| 4393 | + cButton nextVersionButton; |
---|
| 4394 | + cButton saveVersionButton; |
---|
| 4395 | + cButton deleteVersionButton; |
---|
| 4396 | + |
---|
| 4397 | + boolean muteSlider; |
---|
| 4398 | + |
---|
| 4399 | + int VersionCount() |
---|
| 4400 | + { |
---|
| 4401 | + int count = 0; |
---|
| 4402 | + |
---|
| 4403 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
| 4404 | + { |
---|
| 4405 | + if (copy.versionlist[i] != null) |
---|
| 4406 | + count++; |
---|
| 4407 | + } |
---|
| 4408 | + |
---|
| 4409 | + return count; |
---|
| 4410 | + } |
---|
| 4411 | + |
---|
| 4412 | + void SetVersionStates() |
---|
| 4413 | + { |
---|
| 4414 | + //if (true) |
---|
| 4415 | + // return; |
---|
| 4416 | + |
---|
| 4417 | + //cRadio tab = GetCurrentTab(); |
---|
| 4418 | + |
---|
| 4419 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 4420 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 4421 | + |
---|
| 4422 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4423 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4424 | + |
---|
| 4425 | + deleteVersionButton.setEnabled(//copy.versionindex > 0 && |
---|
| 4426 | + copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4427 | + |
---|
| 4428 | + muteSlider = true; |
---|
| 4429 | + versionSlider.setMinimum(0); |
---|
| 4430 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4431 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4432 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
| 4433 | + muteSlider = false; |
---|
| 4434 | + } |
---|
| 4435 | + |
---|
| 4436 | + public boolean PreviousVersion() |
---|
| 4437 | + { |
---|
| 4438 | + // Option? |
---|
| 4439 | + Replace(); |
---|
| 4440 | + |
---|
| 4441 | + System.err.println("Undo"); |
---|
| 4442 | + |
---|
| 4443 | + //cRadio tab = GetCurrentTab(); |
---|
| 4444 | + |
---|
| 4445 | + if (copy.versionindex == 0) |
---|
| 4446 | + { |
---|
| 4447 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4448 | + return false; |
---|
| 4449 | + } |
---|
| 4450 | + |
---|
| 4451 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 4452 | +// { |
---|
| 4453 | +// if (Save(false)) |
---|
| 4454 | +// tab.versionindex -= 1; |
---|
| 4455 | +// else |
---|
| 4456 | +// { |
---|
| 4457 | +// if (tab.versionindex <= 0) |
---|
| 4458 | +// return false; |
---|
| 4459 | +// else |
---|
| 4460 | +// tab.versionindex -= 1; |
---|
| 4461 | +// } |
---|
| 4462 | +// } |
---|
| 4463 | + |
---|
| 4464 | + copy.versionindex -= 1; |
---|
| 4465 | + |
---|
| 4466 | + CopyChanged(); |
---|
| 4467 | + |
---|
| 4468 | + return true; |
---|
| 4469 | + } |
---|
| 4470 | + |
---|
| 4471 | + public boolean Restore() |
---|
| 4472 | + { |
---|
| 4473 | + System.err.println("Restore"); |
---|
| 4474 | + |
---|
| 4475 | + //cRadio tab = GetCurrentTab(); |
---|
| 4476 | + |
---|
| 4477 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4478 | + { |
---|
| 4479 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4480 | + return false; |
---|
| 4481 | + } |
---|
| 4482 | + |
---|
| 4483 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4484 | + CopyChanged(); |
---|
| 4485 | + |
---|
| 4486 | + return true; |
---|
| 4487 | + } |
---|
| 4488 | + |
---|
| 4489 | + public boolean Replace() |
---|
| 4490 | + { |
---|
| 4491 | + System.err.println("Replace"); |
---|
| 4492 | + |
---|
| 4493 | + //cRadio tab = GetCurrentTab(); |
---|
| 4494 | + |
---|
| 4495 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4496 | + { |
---|
| 4497 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4498 | + return false; |
---|
| 4499 | + } |
---|
| 4500 | + |
---|
| 4501 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
| 4502 | + |
---|
| 4503 | + return true; |
---|
| 4504 | + } |
---|
| 4505 | + |
---|
| 4506 | + public void NextVersion() |
---|
| 4507 | + { |
---|
| 4508 | + // Option? |
---|
| 4509 | + Replace(); |
---|
| 4510 | + |
---|
| 4511 | + //cRadio tab = GetCurrentTab(); |
---|
| 4512 | + |
---|
| 4513 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
| 4514 | + { |
---|
| 4515 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4516 | + return; |
---|
| 4517 | + } |
---|
| 4518 | + |
---|
| 4519 | + copy.versionindex += 1; |
---|
| 4520 | + |
---|
| 4521 | + CopyChanged(); |
---|
| 4522 | + |
---|
| 4523 | + //if (!tab.user[tab.versionindex]) |
---|
| 4524 | + // tab.graphs[tab.versionindex] = null; |
---|
| 4525 | + } |
---|
| 4526 | + |
---|
| 4527 | + void ImportGFD() |
---|
| 4528 | + { |
---|
| 4529 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 4530 | + browser.show(); |
---|
| 4531 | + String filename = browser.getFile(); |
---|
| 4532 | + if (filename != null && filename.length() > 0) |
---|
| 4533 | + { |
---|
| 4534 | + String fullname = browser.getDirectory() + filename; |
---|
| 4535 | + |
---|
| 4536 | + //Object3D readobj = |
---|
| 4537 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 4538 | + //makeSomething(readobj); |
---|
| 4539 | + } |
---|
| 4540 | + } |
---|
| 4541 | + |
---|
| 4542 | + void ImportVRMLX3D() |
---|
| 4543 | + { |
---|
| 4544 | + if (Grafreed.standAlone) |
---|
| 4545 | + { |
---|
| 4546 | + /**/ |
---|
| 4547 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 4548 | + browser.show(); |
---|
| 4549 | + String filename = browser.getFile(); |
---|
| 4550 | + if (filename != null && filename.length() > 0) |
---|
| 4551 | + { |
---|
| 4552 | + String fullname = browser.getDirectory() + filename; |
---|
| 4553 | + LoadVRMLX3D(fullname); |
---|
| 4554 | + } |
---|
| 4555 | + /**/ |
---|
| 4556 | + } |
---|
| 4557 | + } |
---|
| 4558 | + |
---|
3243 | 4559 | void ToggleAnimation() |
---|
3244 | 4560 | { |
---|
3245 | 4561 | if (!Globals.ANIMATION) |
---|
.. | .. |
---|
3357 | 4673 | assert false; |
---|
3358 | 4674 | } |
---|
3359 | 4675 | |
---|
3360 | | - void EditSelection() |
---|
| 4676 | + void EditSelection(boolean newWindow) |
---|
3361 | 4677 | { |
---|
3362 | 4678 | } |
---|
3363 | 4679 | |
---|
.. | .. |
---|
3416 | 4732 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
3417 | 4733 | |
---|
3418 | 4734 | current.color = (float) colorField.getFloat(); |
---|
3419 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4735 | + current.modulation = (float) saturationField.getFloat(); |
---|
3420 | 4736 | current.metalness = (float) metalnessField.getFloat(); |
---|
3421 | 4737 | current.diffuse = (float) diffuseField.getFloat(); |
---|
3422 | 4738 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
3449 | 4765 | cMaterial mat = copy.material; |
---|
3450 | 4766 | |
---|
3451 | 4767 | colorField.SetToolTipValue((mat.color)); |
---|
3452 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
| 4768 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
3453 | 4769 | metalnessField.SetToolTipValue((mat.metalness)); |
---|
3454 | 4770 | diffuseField.SetToolTipValue((mat.diffuse)); |
---|
3455 | 4771 | specularField.SetToolTipValue((mat.specular)); |
---|
.. | .. |
---|
3501 | 4817 | //copy.Touch(); |
---|
3502 | 4818 | } |
---|
3503 | 4819 | |
---|
| 4820 | + cNumberSlider versionSlider; |
---|
| 4821 | + |
---|
3504 | 4822 | public void stateChanged(ChangeEvent e) |
---|
3505 | 4823 | { |
---|
3506 | 4824 | // assert(false); |
---|
| 4825 | + if (e.getSource() == versionSlider) |
---|
| 4826 | + { |
---|
| 4827 | + if (muteSlider) |
---|
| 4828 | + return; |
---|
| 4829 | + |
---|
| 4830 | + Replace(); |
---|
| 4831 | + |
---|
| 4832 | + int version = versionSlider.getInteger(); |
---|
| 4833 | + |
---|
| 4834 | + if (version != -1 && copy.versionlist[version] != null) |
---|
| 4835 | + { |
---|
| 4836 | + copy.versionindex = version; |
---|
| 4837 | + CopyChanged(); |
---|
| 4838 | + } |
---|
| 4839 | + |
---|
| 4840 | + return; |
---|
| 4841 | + } |
---|
3507 | 4842 | |
---|
3508 | 4843 | if (freezematerial) |
---|
3509 | 4844 | { |
---|
.. | .. |
---|
3539 | 4874 | { |
---|
3540 | 4875 | //System.out.println("stateChanged = " + this); |
---|
3541 | 4876 | materialtouched = true; |
---|
| 4877 | + |
---|
| 4878 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4879 | + { |
---|
| 4880 | + saturationField.setFloat(1); |
---|
| 4881 | + } |
---|
| 4882 | + |
---|
3542 | 4883 | applySelf(); |
---|
3543 | 4884 | //System.out.println("this = " + this); |
---|
3544 | 4885 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
3588 | 4929 | } |
---|
3589 | 4930 | |
---|
3590 | 4931 | if (normalpushField != null) |
---|
3591 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 4932 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3592 | 4933 | } |
---|
3593 | 4934 | |
---|
3594 | 4935 | void SnapObject() |
---|
.. | .. |
---|
3838 | 5179 | { |
---|
3839 | 5180 | if (GetTree() != null) |
---|
3840 | 5181 | { |
---|
| 5182 | + GetTree().revalidate(); |
---|
3841 | 5183 | GetTree().repaint(); |
---|
3842 | 5184 | } |
---|
3843 | 5185 | |
---|
.. | .. |
---|
3846 | 5188 | ctrlPanel.validate(); // ? new |
---|
3847 | 5189 | ctrlPanel.repaint(); |
---|
3848 | 5190 | } |
---|
| 5191 | + |
---|
| 5192 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5193 | + SetVersionStates(); |
---|
| 5194 | + |
---|
| 5195 | + cameraView.requestFocusInWindow(); |
---|
3849 | 5196 | } |
---|
3850 | 5197 | |
---|
3851 | 5198 | static TweenManager tweenManager = new TweenManager(); |
---|
3852 | 5199 | |
---|
3853 | 5200 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3854 | 5201 | { |
---|
| 5202 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
| 5203 | + Save(); |
---|
3855 | 5204 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3856 | 5205 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3857 | 5206 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3875 | 5224 | // group = (Composite) group.get(0); |
---|
3876 | 5225 | // } |
---|
3877 | 5226 | |
---|
3878 | | - System.out.println("makeSomething of " + thing); |
---|
| 5227 | + //System.out.println("makeSomething of " + thing); |
---|
3879 | 5228 | |
---|
3880 | 5229 | /* |
---|
3881 | 5230 | if (deselect && jList != null) |
---|
.. | .. |
---|
3938 | 5287 | { |
---|
3939 | 5288 | ResetModel(); |
---|
3940 | 5289 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 5290 | + |
---|
| 5291 | + if (thing.Size() == 0) |
---|
| 5292 | + { |
---|
| 5293 | + //EditSelection(false); |
---|
| 5294 | + } |
---|
| 5295 | + |
---|
3941 | 5296 | refreshContents(); |
---|
3942 | 5297 | } |
---|
3943 | 5298 | |
---|
.. | .. |
---|
4055 | 5410 | } |
---|
4056 | 5411 | } |
---|
4057 | 5412 | } |
---|
| 5413 | + |
---|
4058 | 5414 | LoadGFDThread loadGFDThread; |
---|
4059 | 5415 | |
---|
4060 | 5416 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
4074 | 5430 | |
---|
4075 | 5431 | try |
---|
4076 | 5432 | { |
---|
| 5433 | + // Try compressed version first. |
---|
4077 | 5434 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4078 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 5435 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 5436 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
4079 | 5437 | |
---|
4080 | 5438 | readobj = (Object3D) p.readObject(); |
---|
4081 | 5439 | istream.close(); |
---|
.. | .. |
---|
4083 | 5441 | readobj.ResetDisplayList(); |
---|
4084 | 5442 | } catch (Exception e) |
---|
4085 | 5443 | { |
---|
4086 | | - e.printStackTrace(); |
---|
| 5444 | + if (!e.toString().contains("GZIP")) |
---|
| 5445 | + e.printStackTrace(); |
---|
| 5446 | + |
---|
| 5447 | + try |
---|
| 5448 | + { |
---|
| 5449 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 5450 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 5451 | + |
---|
| 5452 | + readobj = (Object3D) p.readObject(); |
---|
| 5453 | + istream.close(); |
---|
| 5454 | + |
---|
| 5455 | + readobj.ResetDisplayList(); |
---|
| 5456 | + } catch (Exception e2) |
---|
| 5457 | + { |
---|
| 5458 | + e2.printStackTrace(); |
---|
| 5459 | + } |
---|
4087 | 5460 | } |
---|
4088 | 5461 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4089 | 5462 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4129 | 5502 | |
---|
4130 | 5503 | void LoadIt(Object obj) |
---|
4131 | 5504 | { |
---|
| 5505 | + if (obj == null) |
---|
| 5506 | + { |
---|
| 5507 | + // Invalid file |
---|
| 5508 | + return; |
---|
| 5509 | + } |
---|
| 5510 | + |
---|
4132 | 5511 | System.out.println("Loaded " + obj); |
---|
4133 | 5512 | //new Exception().printStackTrace(); |
---|
4134 | 5513 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4138 | 5517 | |
---|
4139 | 5518 | if (readobj != null) |
---|
4140 | 5519 | { |
---|
| 5520 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 5521 | + // Save(); |
---|
4141 | 5522 | try |
---|
4142 | 5523 | { |
---|
4143 | 5524 | //readobj.deepCopySelf(copy); |
---|
4144 | 5525 | copy.clear(); // june 2014 |
---|
| 5526 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5527 | + copy.skyboxext = readobj.skyboxext; |
---|
4145 | 5528 | for (int i = 0; i < readobj.size(); i++) |
---|
4146 | 5529 | { |
---|
4147 | 5530 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4182 | 5565 | } |
---|
4183 | 5566 | } catch (ClassCastException e) |
---|
4184 | 5567 | { |
---|
| 5568 | + e.printStackTrace(); |
---|
4185 | 5569 | assert (false); |
---|
4186 | 5570 | Composite c = (Composite) copy; |
---|
4187 | 5571 | c.children.clear(); |
---|
.. | .. |
---|
4192 | 5576 | c.addChild(csg); |
---|
4193 | 5577 | } |
---|
4194 | 5578 | |
---|
| 5579 | + copy.versionlist = readobj.versionlist; |
---|
| 5580 | + copy.versionindex = readobj.versionindex; |
---|
| 5581 | + |
---|
| 5582 | + if (copy.versionlist == null) |
---|
| 5583 | + { |
---|
| 5584 | + // Backward compatibility |
---|
| 5585 | + copy.versionlist = new Object3D[100]; |
---|
| 5586 | + copy.versionindex = -1; |
---|
| 5587 | + |
---|
| 5588 | + //Save(true); |
---|
| 5589 | + } |
---|
| 5590 | + |
---|
| 5591 | + //? SetUndoStates(); |
---|
| 5592 | + |
---|
4195 | 5593 | ResetModel(); |
---|
4196 | 5594 | copy.HardTouch(); // recompile? |
---|
4197 | 5595 | refreshContents(); |
---|
4198 | 5596 | } |
---|
4199 | 5597 | } |
---|
4200 | 5598 | |
---|
4201 | | - void load() // throws ClassNotFoundException |
---|
| 5599 | + void Open() // throws ClassNotFoundException |
---|
4202 | 5600 | { |
---|
4203 | 5601 | if (Grafreed.standAlone) |
---|
4204 | 5602 | { |
---|
4205 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5603 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4206 | 5604 | browser.show(); |
---|
4207 | 5605 | String filename = browser.getFile(); |
---|
4208 | 5606 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4279 | 5677 | |
---|
4280 | 5678 | void save() |
---|
4281 | 5679 | { |
---|
| 5680 | + Replace(); |
---|
| 5681 | + |
---|
4282 | 5682 | if (lastname == null) |
---|
4283 | 5683 | { |
---|
4284 | 5684 | return; |
---|
.. | .. |
---|
4287 | 5687 | try |
---|
4288 | 5688 | { |
---|
4289 | 5689 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4290 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 5690 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5691 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4291 | 5692 | |
---|
4292 | 5693 | p.writeObject(copy); |
---|
4293 | 5694 | p.flush(); |
---|
4294 | 5695 | |
---|
| 5696 | + zstream.close(); |
---|
4295 | 5697 | ostream.close(); |
---|
4296 | 5698 | |
---|
4297 | 5699 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4299 | 5701 | //ps.print(buffer.toString()); |
---|
4300 | 5702 | } catch (IOException e) |
---|
4301 | 5703 | { |
---|
| 5704 | + e.printStackTrace(); |
---|
4302 | 5705 | } |
---|
4303 | 5706 | } |
---|
| 5707 | + |
---|
4304 | 5708 | String lastname; |
---|
4305 | 5709 | |
---|
4306 | 5710 | void saveAs() |
---|
.. | .. |
---|
4312 | 5716 | String filename = browser.getFile(); |
---|
4313 | 5717 | if (filename != null && filename.length() > 0) |
---|
4314 | 5718 | { |
---|
| 5719 | + if (!filename.endsWith(".gfd")) |
---|
| 5720 | + filename += ".gfd"; |
---|
4315 | 5721 | lastname = browser.getDirectory() + filename; |
---|
4316 | 5722 | save(); |
---|
4317 | 5723 | } |
---|
.. | .. |
---|
4410 | 5816 | try |
---|
4411 | 5817 | { |
---|
4412 | 5818 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4413 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4414 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 5819 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5820 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4415 | 5821 | |
---|
4416 | 5822 | Object3D objectparent = obj.parent; |
---|
4417 | 5823 | obj.parent = null; |
---|
.. | .. |
---|
4428 | 5834 | p.writeObject(object); |
---|
4429 | 5835 | p.flush(); |
---|
4430 | 5836 | |
---|
| 5837 | + zstream.close(); |
---|
4431 | 5838 | ostream.close(); |
---|
4432 | | - // zstream.close(); |
---|
4433 | 5839 | |
---|
4434 | 5840 | // group.selection.get(0).parent = parent; |
---|
4435 | 5841 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4476 | 5882 | Object3D client; |
---|
4477 | 5883 | Object3D copy; |
---|
4478 | 5884 | MenuBar menuBar; |
---|
4479 | | - Menu windowMenu; |
---|
4480 | | - MenuItem loadItem; |
---|
| 5885 | + Menu fileMenu; |
---|
| 5886 | + MenuItem newItem; |
---|
| 5887 | + MenuItem openItem; |
---|
4481 | 5888 | MenuItem saveItem; |
---|
4482 | 5889 | MenuItem saveAsItem; |
---|
4483 | 5890 | MenuItem exportAsItem; |
---|
4484 | 5891 | MenuItem reexportItem; |
---|
4485 | 5892 | MenuItem povItem; |
---|
4486 | 5893 | MenuItem closeItem; |
---|
4487 | | - Menu cameraMenu; |
---|
| 5894 | + |
---|
4488 | 5895 | CheckboxMenuItem zBufferItem; |
---|
4489 | 5896 | //MenuItem normalLensItem; |
---|
4490 | | - MenuItem editCameraItem; |
---|
4491 | | - MenuItem revertCameraItem; |
---|
4492 | 5897 | MenuItem stepItem; |
---|
4493 | 5898 | CheckboxMenuItem toggleLiveItem; |
---|
4494 | 5899 | CheckboxMenuItem toggleFullScreenItem; |
---|
.. | .. |
---|
4502 | 5907 | CheckboxMenuItem toggleSwitchItem; |
---|
4503 | 5908 | CheckboxMenuItem toggleRootItem; |
---|
4504 | 5909 | CheckboxMenuItem animationItem; |
---|
| 5910 | + MenuItem archiveItem; |
---|
4505 | 5911 | CheckboxMenuItem toggleHandleItem; |
---|
4506 | 5912 | CheckboxMenuItem togglePaintItem; |
---|
4507 | 5913 | JSplitPane mainPanel; |
---|
4508 | 5914 | JScrollPane scrollpane; |
---|
| 5915 | + |
---|
4509 | 5916 | JPanel toolbarPanel; |
---|
| 5917 | + |
---|
4510 | 5918 | cGridBag treePanel; |
---|
| 5919 | + |
---|
4511 | 5920 | JPanel radioPanel; |
---|
4512 | 5921 | ButtonGroup buttonGroup; |
---|
4513 | | - cGridBag ctrlPanel; |
---|
| 5922 | + |
---|
| 5923 | + cGridBag toolboxPanel; |
---|
| 5924 | + cGridBag skyboxPanel; |
---|
4514 | 5925 | cGridBag materialPanel; |
---|
| 5926 | + cGridBag ctrlPanel; |
---|
| 5927 | + |
---|
4515 | 5928 | JScrollPane infoPanel; |
---|
| 5929 | + |
---|
4516 | 5930 | cGridBag optionsPanel; |
---|
| 5931 | + |
---|
4517 | 5932 | JTabbedPane objectPanel; |
---|
| 5933 | + boolean materialFlushed; |
---|
| 5934 | + Object3D latestObject; |
---|
| 5935 | + |
---|
4518 | 5936 | cGridBag XYZPanel; |
---|
| 5937 | + |
---|
4519 | 5938 | JSplitPane gridPanel; |
---|
4520 | 5939 | JSplitPane bigPanel; |
---|
| 5940 | + |
---|
4521 | 5941 | cGridBag bigThree; |
---|
4522 | 5942 | cGridBag scenePanel; |
---|
4523 | 5943 | cGridBag centralPanel; |
---|
.. | .. |
---|
4575 | 5995 | JLabel colorLabel; |
---|
4576 | 5996 | cNumberSlider colorField; |
---|
4577 | 5997 | JLabel modulationLabel; |
---|
4578 | | - cNumberSlider modulationField; |
---|
| 5998 | + cNumberSlider saturationField; |
---|
4579 | 5999 | JLabel metalnessLabel; |
---|
4580 | 6000 | cNumberSlider metalnessField; |
---|
4581 | 6001 | JLabel diffuseLabel; |
---|
.. | .. |
---|
4606 | 6026 | cNumberSlider anisoField; |
---|
4607 | 6027 | JLabel anisoVLabel; |
---|
4608 | 6028 | cNumberSlider anisoVField; |
---|
| 6029 | + |
---|
4609 | 6030 | JLabel cameraLabel; |
---|
4610 | 6031 | cNumberSlider cameraField; |
---|
4611 | 6032 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
4620 | 6041 | cNumberSlider fakedepthField; |
---|
4621 | 6042 | JLabel shadowbiasLabel; |
---|
4622 | 6043 | cNumberSlider shadowbiasField; |
---|
| 6044 | + |
---|
4623 | 6045 | JLabel bumpLabel; |
---|
4624 | 6046 | cNumberSlider bumpField; |
---|
4625 | 6047 | JLabel noiseLabel; |
---|
.. | .. |
---|
4632 | 6054 | cNumberSlider fogField; |
---|
4633 | 6055 | JLabel opacityPowerLabel; |
---|
4634 | 6056 | cNumberSlider opacityPowerField; |
---|
4635 | | - JTree jTree; |
---|
| 6057 | + cTree jTree; |
---|
4636 | 6058 | //ObjectUI parent; |
---|
4637 | 6059 | |
---|
4638 | 6060 | cNumberSlider normalpushField; |
---|
| 6061 | + |
---|
| 6062 | + private MenuItem importGFDItem; |
---|
| 6063 | + private MenuItem importVRMLX3DItem; |
---|
| 6064 | + private MenuItem import3DSItem; |
---|
| 6065 | + private MenuItem importOBJItem; |
---|
4639 | 6066 | } |
---|