.. | .. |
---|
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.*; |
---|
.. | .. |
---|
35 | 36 | |
---|
36 | 37 | GroupEditor callee; |
---|
37 | 38 | JFrame frame; |
---|
| 39 | + |
---|
| 40 | + static ObjEditor theFrame; |
---|
| 41 | + |
---|
| 42 | + cButton GetButton(String name, boolean border) |
---|
| 43 | + { |
---|
| 44 | + try |
---|
| 45 | + { |
---|
| 46 | + ImageIcon icon = GetIcon(name); |
---|
| 47 | + return new cButton(icon, border); |
---|
| 48 | + } |
---|
| 49 | + catch (Exception e) |
---|
| 50 | + { |
---|
| 51 | + return new cButton(name, border); |
---|
| 52 | + } |
---|
| 53 | + } |
---|
| 54 | + |
---|
| 55 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 56 | + { |
---|
| 57 | + try |
---|
| 58 | + { |
---|
| 59 | + ImageIcon icon = GetIcon(name); |
---|
| 60 | + return new cToggleButton(icon, border); |
---|
| 61 | + } |
---|
| 62 | + catch (Exception e) |
---|
| 63 | + { |
---|
| 64 | + return new cToggleButton(name, border); |
---|
| 65 | + } |
---|
| 66 | + } |
---|
| 67 | + |
---|
| 68 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 69 | + { |
---|
| 70 | + try |
---|
| 71 | + { |
---|
| 72 | + ImageIcon icon = GetIcon(name); |
---|
| 73 | + return new cCheckBox(icon, border); |
---|
| 74 | + } |
---|
| 75 | + catch (Exception e) |
---|
| 76 | + { |
---|
| 77 | + return new cCheckBox(name, border); |
---|
| 78 | + } |
---|
| 79 | + } |
---|
| 80 | + |
---|
| 81 | + private ImageIcon GetIcon(String name) throws IOException |
---|
| 82 | + { |
---|
| 83 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 84 | + |
---|
| 85 | + if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 86 | + { |
---|
| 87 | + BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
| 88 | + Graphics2D g = resized.createGraphics(); |
---|
| 89 | + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 90 | + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 91 | + g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 92 | + g.dispose(); |
---|
| 93 | + |
---|
| 94 | + image = resized; |
---|
| 95 | + } |
---|
| 96 | + |
---|
| 97 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 98 | + return icon; |
---|
| 99 | + } |
---|
38 | 100 | |
---|
39 | 101 | // SCRIPT |
---|
40 | 102 | |
---|
.. | .. |
---|
138 | 200 | public void closeUI() |
---|
139 | 201 | { |
---|
140 | 202 | //new Exception().printStackTrace(); |
---|
141 | | - System.out.println("this = " + this); |
---|
142 | | - System.out.println("objEditor = " + objEditor); |
---|
| 203 | +// System.out.println("this = " + this); |
---|
| 204 | +// System.out.println("objEditor = " + objEditor); |
---|
143 | 205 | //nameField.removeActionListener(this); |
---|
144 | | - objEditor.ctrlPanel.remove(nameField); |
---|
| 206 | +// objEditor.ctrlPanel.remove(nameField); |
---|
| 207 | + |
---|
| 208 | + objEditor.ctrlPanel.remove(namePanel); |
---|
145 | 209 | |
---|
146 | 210 | if (!GroupEditor.allparams) |
---|
147 | 211 | return; |
---|
148 | 212 | |
---|
149 | | - objEditor.ctrlPanel.remove(liveCB); |
---|
150 | | - objEditor.ctrlPanel.remove(hideCB); |
---|
151 | | - objEditor.ctrlPanel.remove(markCB); |
---|
152 | | - |
---|
153 | | - objEditor.ctrlPanel.remove(randomCB); |
---|
154 | | - objEditor.ctrlPanel.remove(speedupCB); |
---|
155 | | - objEditor.ctrlPanel.remove(rewindCB); |
---|
156 | | - |
---|
157 | | - objEditor.ctrlPanel.remove(resetButton); |
---|
158 | | - objEditor.ctrlPanel.remove(stepButton); |
---|
159 | | -// objEditor.ctrlPanel.remove(stepAllButton); |
---|
160 | | -// objEditor.ctrlPanel.remove(resetAllButton); |
---|
161 | | - objEditor.ctrlPanel.remove(link2masterCB); |
---|
162 | | - //objEditor.ctrlPanel.remove(flipVCB); |
---|
163 | | - //objEditor.ctrlPanel.remove(texresMenu); |
---|
164 | | - objEditor.ctrlPanel.remove(slowerButton); |
---|
165 | | - objEditor.ctrlPanel.remove(fasterButton); |
---|
166 | | - objEditor.ctrlPanel.remove(remarkButton); |
---|
| 213 | +// objEditor.ctrlPanel.remove(liveCB); |
---|
| 214 | +// objEditor.ctrlPanel.remove(hideCB); |
---|
| 215 | +// objEditor.ctrlPanel.remove(markCB); |
---|
| 216 | +// |
---|
| 217 | +// objEditor.ctrlPanel.remove(randomCB); |
---|
| 218 | +// objEditor.ctrlPanel.remove(speedupCB); |
---|
| 219 | +// objEditor.ctrlPanel.remove(rewindCB); |
---|
| 220 | +// |
---|
| 221 | +// objEditor.ctrlPanel.remove(resetButton); |
---|
| 222 | +// objEditor.ctrlPanel.remove(stepButton); |
---|
| 223 | +//// objEditor.ctrlPanel.remove(stepAllButton); |
---|
| 224 | +//// objEditor.ctrlPanel.remove(resetAllButton); |
---|
| 225 | +// objEditor.ctrlPanel.remove(link2masterCB); |
---|
| 226 | +// //objEditor.ctrlPanel.remove(flipVCB); |
---|
| 227 | +// //objEditor.ctrlPanel.remove(texresMenu); |
---|
| 228 | +// objEditor.ctrlPanel.remove(slowerButton); |
---|
| 229 | +// objEditor.ctrlPanel.remove(fasterButton); |
---|
| 230 | +// objEditor.ctrlPanel.remove(remarkButton); |
---|
167 | 231 | |
---|
168 | | - Remove(normalpushField); |
---|
| 232 | + objEditor.ctrlPanel.remove(setupPanel); |
---|
| 233 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 234 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
| 235 | + objEditor.ctrlPanel.remove(pushPanel); |
---|
| 236 | + //objEditor.ctrlPanel.remove(fillPanel); |
---|
| 237 | + |
---|
| 238 | + //Remove(normalpushField); |
---|
169 | 239 | } |
---|
170 | 240 | |
---|
171 | 241 | public ObjEditor GetEditor() |
---|
.. | .. |
---|
236 | 306 | //localCopy.parent = null; |
---|
237 | 307 | |
---|
238 | 308 | frame = new JFrame(); |
---|
| 309 | + frame.setUndecorated(true); |
---|
239 | 310 | objEditor = this; |
---|
240 | 311 | this.callee = callee; |
---|
241 | 312 | |
---|
.. | .. |
---|
269 | 340 | void SetupMenu() |
---|
270 | 341 | { |
---|
271 | 342 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
272 | | - menuBar.add(windowMenu = new Menu("File")); |
---|
273 | | - windowMenu.add(loadItem = new MenuItem("Load...")); |
---|
274 | | - windowMenu.add("-"); |
---|
275 | | - windowMenu.add(saveItem = new MenuItem("Save")); |
---|
276 | | - windowMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
| 343 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 344 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 345 | + fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 346 | + |
---|
| 347 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 348 | + Menu menu = new Menu("Import"); |
---|
| 349 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 350 | + importOBJItem.addActionListener(this); |
---|
| 351 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 352 | + import3DSItem.addActionListener(this); |
---|
| 353 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 354 | + importVRMLX3DItem.addActionListener(this); |
---|
| 355 | + menu.add("-"); |
---|
| 356 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 357 | + importGFDItem.addActionListener(this); |
---|
| 358 | + fileMenu.add(menu); |
---|
| 359 | + fileMenu.add("-"); |
---|
| 360 | + |
---|
| 361 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 362 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
277 | 363 | //windowMenu.add(povItem = new MenuItem("Emit POV-Ray...")); |
---|
278 | | - windowMenu.add("-"); |
---|
279 | | - windowMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
280 | | - windowMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
281 | | - windowMenu.add("-"); |
---|
| 364 | + fileMenu.add("-"); |
---|
| 365 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 366 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 367 | + fileMenu.add("-"); |
---|
282 | 368 | if (client.parent != null) |
---|
283 | 369 | { |
---|
284 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 370 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
285 | 371 | } else |
---|
286 | 372 | { |
---|
287 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 373 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
288 | 374 | } |
---|
289 | 375 | |
---|
| 376 | + newItem.addActionListener(this); |
---|
290 | 377 | loadItem.addActionListener(this); |
---|
291 | 378 | saveItem.addActionListener(this); |
---|
292 | 379 | saveAsItem.addActionListener(this); |
---|
.. | .. |
---|
295 | 382 | //povItem.addActionListener(this); |
---|
296 | 383 | closeItem.addActionListener(this); |
---|
297 | 384 | |
---|
298 | | - menuBar.add(cameraMenu = new Menu("View")); |
---|
299 | | - //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer")); |
---|
300 | | - //zBufferItem.addActionListener(this); |
---|
301 | | - //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens")); |
---|
302 | | - //normalLensItem.addActionListener(this); |
---|
303 | | - cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera")); |
---|
304 | | - revertCameraItem.addActionListener(this); |
---|
305 | | - cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline")); |
---|
306 | | - toggleTimelineItem.addItemListener(this); |
---|
307 | | - cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); |
---|
308 | | - toggleFullScreenItem.addItemListener(this); |
---|
309 | | - toggleFullScreenItem.setState(CameraPane.FULLSCREEN); |
---|
310 | | - cameraMenu.add("-"); |
---|
311 | | - cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); |
---|
312 | | - toggleTextureItem.addItemListener(this); |
---|
313 | | - toggleTextureItem.setState(CameraPane.textureon); |
---|
314 | | - cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); |
---|
315 | | - toggleLiveItem.addItemListener(this); |
---|
316 | | - toggleLiveItem.setState(Globals.isLIVE()); |
---|
317 | | - cameraMenu.add(stepItem = new MenuItem("Step")); |
---|
318 | | - stepItem.addActionListener(this); |
---|
319 | | -// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); |
---|
320 | | -// toggleDLItem.addItemListener(this); |
---|
321 | | -// toggleDLItem.setState(false); |
---|
322 | | - cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render")); |
---|
323 | | - toggleRenderItem.addItemListener(this); |
---|
324 | | - toggleRenderItem.setState(!CameraPane.frozen); |
---|
325 | | - cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); |
---|
326 | | - toggleDebugItem.addItemListener(this); |
---|
327 | | - toggleDebugItem.setState(CameraPane.DEBUG); |
---|
328 | | - cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); |
---|
329 | | - toggleFrustumItem.addItemListener(this); |
---|
330 | | - toggleFrustumItem.setState(CameraPane.FRUSTUM); |
---|
331 | | - cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact")); |
---|
332 | | - toggleFootContactItem.addItemListener(this); |
---|
333 | | - toggleFootContactItem.setState(CameraPane.FOOTCONTACT); |
---|
334 | | - cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random")); |
---|
335 | | - toggleRandomItem.addItemListener(this); |
---|
336 | | - toggleRandomItem.setState(CameraPane.RANDOM); |
---|
337 | | - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); |
---|
338 | | - toggleHandleItem.addItemListener(this); |
---|
339 | | - toggleHandleItem.setState(CameraPane.HANDLES); |
---|
340 | | - cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode")); |
---|
341 | | - togglePaintItem.addItemListener(this); |
---|
342 | | - togglePaintItem.setState(CameraPane.PAINTMODE); |
---|
343 | | -// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root")); |
---|
344 | | -// toggleRootItem.addItemListener(this); |
---|
345 | | -// toggleRootItem.setState(false); |
---|
346 | | -// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation")); |
---|
347 | | -// animationItem.addItemListener(this); |
---|
348 | | -// animationItem.setState(CameraPane.ANIMATION); |
---|
349 | | - cameraMenu.add("-"); |
---|
350 | | - cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera")); |
---|
351 | | - editCameraItem.addActionListener(this); |
---|
352 | | - |
---|
353 | 385 | objectPanel = new JTabbedPane(); |
---|
| 386 | + |
---|
| 387 | + ChangeListener changeListener = new ChangeListener() |
---|
| 388 | + { |
---|
| 389 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 390 | + { |
---|
| 391 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 392 | +// { |
---|
| 393 | +// if (latestObject != null) |
---|
| 394 | +// { |
---|
| 395 | +// refreshContents(true); |
---|
| 396 | +// SetMaterial(latestObject); |
---|
| 397 | +// } |
---|
| 398 | +// |
---|
| 399 | +// materialFlushed = true; |
---|
| 400 | +// } |
---|
| 401 | + |
---|
| 402 | + refreshContents(false); // To refresh Info tab |
---|
| 403 | + } |
---|
| 404 | + }; |
---|
| 405 | + objectPanel.addChangeListener(changeListener); |
---|
| 406 | + |
---|
354 | 407 | toolbarPanel = new JPanel(); |
---|
355 | 408 | toolbarPanel.setName("Toolbar"); |
---|
356 | | - treePanel = new JPanel(); |
---|
| 409 | + treePanel = new cGridBag(); |
---|
357 | 410 | treePanel.setName("Tree"); |
---|
358 | | - ctrlPanel = new cGridBag(); // new GridBagLayout()); |
---|
359 | | - ctrlPanel.setName("Edit"); |
---|
| 411 | + |
---|
| 412 | + editPanel = new cGridBag().setVertical(true); |
---|
| 413 | + editPanel.setName("Edit"); |
---|
| 414 | + |
---|
| 415 | + ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
| 416 | + |
---|
| 417 | + editCommandsPanel = new cGridBag(); |
---|
| 418 | + editPanel.add(editCommandsPanel); |
---|
| 419 | + editPanel.add(ctrlPanel); |
---|
| 420 | + |
---|
| 421 | + toolboxPanel = new cGridBag().setVertical(false); |
---|
| 422 | + toolboxPanel.setName("Toolbox"); |
---|
| 423 | + |
---|
360 | 424 | materialPanel = new cGridBag().setVertical(true); |
---|
361 | 425 | materialPanel.setName("Material"); |
---|
| 426 | + |
---|
362 | 427 | /*JTextPane*/ |
---|
363 | 428 | infoarea = createTextPane(); |
---|
| 429 | + doc = infoarea.getStyledDocument(); |
---|
| 430 | + |
---|
364 | 431 | infoarea.setEditable(true); |
---|
365 | 432 | SetText(); |
---|
366 | 433 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
367 | 434 | // infoarea.setOpaque(false); |
---|
368 | 435 | // //infoarea.setForeground(textcolor); |
---|
369 | | - infoarea.setLineWrap(true); |
---|
370 | | - infoarea.setWrapStyleWord(true); |
---|
| 436 | +// TEXTAREA infoarea.setLineWrap(true); |
---|
| 437 | +// TEXTAREA infoarea.setWrapStyleWord(true); |
---|
371 | 438 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
372 | 439 | infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
373 | 440 | infoPanel.setName("Info"); |
---|
.. | .. |
---|
378 | 445 | mainPanel.setName("Main"); |
---|
379 | 446 | mainPanel.setContinuousLayout(true); |
---|
380 | 447 | mainPanel.setOneTouchExpandable(true); |
---|
381 | | - mainPanel.setDividerLocation(1.0); |
---|
382 | 448 | mainPanel.setDividerSize(9); |
---|
383 | | - mainPanel.setResizeWeight(0); |
---|
| 449 | + mainPanel.setDividerLocation(0.5); //1.0); |
---|
| 450 | + mainPanel.setResizeWeight(0.5); |
---|
384 | 451 | |
---|
385 | 452 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
386 | 453 | //mainPanel.setLayout(new GridBagLayout()); |
---|
387 | 454 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
388 | | - treePanel.setLayout(new GridBagLayout()); |
---|
389 | | - ctrlPanel.setLayout(new GridBagLayout()); |
---|
| 455 | +// treePanel.setLayout(new GridBagLayout()); |
---|
| 456 | + //ctrlPanel.setLayout(new GridBagLayout()); |
---|
390 | 457 | //materialPanel.setLayout(new GridBagLayout()); |
---|
391 | 458 | |
---|
392 | 459 | aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, |
---|
.. | .. |
---|
426 | 493 | static String newline = "\n"; |
---|
427 | 494 | protected static final String buttonString = "JButton"; |
---|
428 | 495 | StyledDocument doc; |
---|
429 | | - JTextArea infoarea; |
---|
| 496 | + JTextPane infoarea; |
---|
430 | 497 | |
---|
431 | 498 | void ClearInfo() |
---|
432 | 499 | { |
---|
.. | .. |
---|
449 | 516 | e.printStackTrace(); |
---|
450 | 517 | } |
---|
451 | 518 | |
---|
452 | | - String selection = infoarea.getText(); |
---|
453 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
454 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
455 | | - Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
| 519 | +// String selection = infoarea.getText(); |
---|
| 520 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 521 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 522 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
456 | 523 | //clipboard.setContents(data, data); |
---|
457 | 524 | } |
---|
458 | 525 | |
---|
.. | .. |
---|
475 | 542 | //SendInfo("Name:", "bold"); |
---|
476 | 543 | if (sel.GetTextures() != null || debug) |
---|
477 | 544 | { |
---|
478 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 545 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
479 | 546 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
480 | 547 | if (sel.Size() > 0) |
---|
481 | 548 | { |
---|
482 | 549 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
483 | 550 | } |
---|
484 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 551 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
485 | 552 | if (debug) |
---|
486 | 553 | { |
---|
487 | 554 | try |
---|
.. | .. |
---|
493 | 560 | } |
---|
494 | 561 | |
---|
495 | 562 | if (full) |
---|
496 | | - si.SendInfo(" BBox: " + minima + " - " + maxima, "regular"); |
---|
| 563 | + { |
---|
| 564 | + si.SendInfo(" BBox min: " + minima, "regular"); |
---|
| 565 | + si.SendInfo(" BBox max: " + maxima, "regular"); |
---|
| 566 | + } |
---|
497 | 567 | |
---|
498 | 568 | if (sel.bRep != null) |
---|
499 | 569 | { |
---|
.. | .. |
---|
520 | 590 | } |
---|
521 | 591 | if (sel.support != null) |
---|
522 | 592 | { |
---|
523 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 593 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
524 | 594 | } |
---|
525 | 595 | if (sel.scriptnode != null) |
---|
526 | 596 | { |
---|
.. | .. |
---|
591 | 661 | { |
---|
592 | 662 | CameraPane.pointflow = (PointFlow) sel; |
---|
593 | 663 | } |
---|
| 664 | + |
---|
| 665 | + si.SendInfo("_____________________", "regular"); |
---|
| 666 | + si.SendInfo("", "regular"); |
---|
594 | 667 | } |
---|
595 | 668 | } |
---|
596 | 669 | |
---|
.. | .. |
---|
606 | 679 | } |
---|
607 | 680 | } |
---|
608 | 681 | |
---|
| 682 | +static GraphicsDevice device = GraphicsEnvironment |
---|
| 683 | + .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 684 | + |
---|
| 685 | + Rectangle keeprect; |
---|
| 686 | + cRadio radio; |
---|
| 687 | + |
---|
| 688 | +cButton keepButton; |
---|
| 689 | + cButton twoButton; // Full 3D |
---|
| 690 | + cButton sixButton; |
---|
| 691 | + cButton threeButton; |
---|
| 692 | + cButton sevenButton; |
---|
| 693 | + cButton fourButton; // full panel |
---|
| 694 | + cButton oneButton; // full XYZ |
---|
| 695 | + //cButton currentLayout; |
---|
| 696 | + |
---|
| 697 | + boolean maximized; |
---|
| 698 | + |
---|
| 699 | + cButton fullscreenLayout; |
---|
| 700 | + |
---|
| 701 | + void Minimize() |
---|
| 702 | + { |
---|
| 703 | + frame.setState(Frame.ICONIFIED); |
---|
| 704 | + } |
---|
| 705 | + |
---|
| 706 | + void Maximize() |
---|
| 707 | + { |
---|
| 708 | + if (maximized) |
---|
| 709 | + { |
---|
| 710 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 711 | + } |
---|
| 712 | + else |
---|
| 713 | + { |
---|
| 714 | + keeprect = frame.getBounds(); |
---|
| 715 | + Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 716 | + Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 717 | + frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 718 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 719 | + } |
---|
| 720 | + |
---|
| 721 | + maximized ^= true; |
---|
| 722 | + } |
---|
| 723 | + |
---|
609 | 724 | void ToggleFullScreen() |
---|
610 | 725 | { |
---|
611 | | - if (CameraPane.FULLSCREEN) |
---|
| 726 | + cameraView.ToggleFullScreen(); |
---|
| 727 | + |
---|
| 728 | + if (!CameraPane.FULLSCREEN) |
---|
612 | 729 | { |
---|
613 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
614 | | - framePanel.add(bigThree); |
---|
615 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 730 | + device.setFullScreenWindow(null); |
---|
| 731 | + //frame.setVisible(false); |
---|
| 732 | +// frame.removeNotify(); |
---|
| 733 | +// frame.setUndecorated(false); |
---|
| 734 | +// frame.addNotify(); |
---|
| 735 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 736 | + |
---|
| 737 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 738 | +// X framePanel.add(bigThree); |
---|
| 739 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 740 | + framePanel.setDividerLocation(1); |
---|
| 741 | + |
---|
| 742 | + //frame.setVisible(true); |
---|
| 743 | + radio.layout = keepButton; |
---|
| 744 | + //theFrame = null; |
---|
| 745 | + keepButton = null; |
---|
| 746 | + radio.layout.doClick(); |
---|
| 747 | + |
---|
616 | 748 | } else |
---|
617 | 749 | { |
---|
618 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
619 | | - framePanel.remove(bigThree); |
---|
620 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 750 | + keepButton = radio.layout; |
---|
| 751 | + //keeprect = frame.getBounds(); |
---|
| 752 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 753 | +// frame.getToolkit().getScreenSize().height); |
---|
| 754 | + //frame.setVisible(false); |
---|
| 755 | + device.setFullScreenWindow(frame); |
---|
| 756 | +// frame.removeNotify(); |
---|
| 757 | +// frame.setUndecorated(true); |
---|
| 758 | +// frame.addNotify(); |
---|
| 759 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 760 | +// X framePanel.remove(bigThree); |
---|
| 761 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 762 | + framePanel.setDividerLocation(0); |
---|
| 763 | + |
---|
| 764 | + radio.layout = fullscreenLayout; |
---|
| 765 | + radio.layout.doClick(); |
---|
| 766 | + //frame.setVisible(true); |
---|
621 | 767 | } |
---|
622 | | - cameraView.ToggleFullScreen(); |
---|
623 | 768 | } |
---|
624 | 769 | |
---|
625 | | - private JTextArea createTextPane() |
---|
| 770 | + private JTextPane createTextPane() |
---|
626 | 771 | { |
---|
627 | | - String[] initString = |
---|
628 | | - { |
---|
629 | | - "This is an editable JTextPane, ", //regular |
---|
630 | | - "another ", //italic |
---|
631 | | - "styled ", //bold |
---|
632 | | - "text ", //small |
---|
633 | | - "component, ", //large |
---|
634 | | - "which supports embedded components..." + newline,//regular |
---|
635 | | - " " + newline, //button |
---|
636 | | - "...and embedded icons..." + newline, //regular |
---|
637 | | - " ", //icon |
---|
638 | | - newline + "JTextPane is a subclass of JEditorPane that " |
---|
639 | | - + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
640 | | - + "cover methods for interacting with those objects." |
---|
641 | | - }; |
---|
| 772 | +// TEXTAREA String[] initString = |
---|
| 773 | +// { |
---|
| 774 | +// "This is an editable JTextPane, ", //regular |
---|
| 775 | +// "another ", //italic |
---|
| 776 | +// "styled ", //bold |
---|
| 777 | +// "text ", //small |
---|
| 778 | +// "component, ", //large |
---|
| 779 | +// "which supports embedded components..." + newline,//regular |
---|
| 780 | +// " " + newline, //button |
---|
| 781 | +// "...and embedded icons..." + newline, //regular |
---|
| 782 | +// " ", //icon |
---|
| 783 | +// newline + "JTextPane is a subclass of JEditorPane that " |
---|
| 784 | +// + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
| 785 | +// + "cover methods for interacting with those objects." |
---|
| 786 | +// }; |
---|
| 787 | +// |
---|
| 788 | +// String[] initStyles = |
---|
| 789 | +// { |
---|
| 790 | +// "regular", "italic", "bold", "small", "large", |
---|
| 791 | +// "regular", "button", "regular", "icon", |
---|
| 792 | +// "regular" |
---|
| 793 | +// }; |
---|
| 794 | +// |
---|
| 795 | +// JTextPane textPane = new JTextPane(); |
---|
| 796 | +// textPane.setEditable(true); |
---|
| 797 | +// /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
| 798 | +// addStylesToDocument(doc); |
---|
| 799 | +// |
---|
| 800 | +// try |
---|
| 801 | +// { |
---|
| 802 | +// for (int j = 0; j < 2; j++) |
---|
| 803 | +// { |
---|
| 804 | +// for (int i = 0; i < initString.length; i++) |
---|
| 805 | +// { |
---|
| 806 | +// doc.insertString(doc.getLength(), initString[i], |
---|
| 807 | +// doc.getStyle(initStyles[i])); |
---|
| 808 | +// } |
---|
| 809 | +// } |
---|
| 810 | +// } catch (BadLocationException ble) |
---|
| 811 | +// { |
---|
| 812 | +// System.err.println("Couldn't insert initial text into text pane."); |
---|
| 813 | +// } |
---|
642 | 814 | |
---|
643 | | - String[] initStyles = |
---|
644 | | - { |
---|
645 | | - "regular", "italic", "bold", "small", "large", |
---|
646 | | - "regular", "button", "regular", "icon", |
---|
647 | | - "regular" |
---|
648 | | - }; |
---|
649 | | - |
---|
650 | | - JTextPane textPane = new JTextPane(); |
---|
651 | | - textPane.setEditable(true); |
---|
652 | | - /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
653 | | - addStylesToDocument(doc); |
---|
654 | | - |
---|
655 | | - try |
---|
656 | | - { |
---|
657 | | - for (int j = 0; j < 2; j++) |
---|
658 | | - { |
---|
659 | | - for (int i = 0; i < initString.length; i++) |
---|
660 | | - { |
---|
661 | | - doc.insertString(doc.getLength(), initString[i], |
---|
662 | | - doc.getStyle(initStyles[i])); |
---|
663 | | - } |
---|
664 | | - } |
---|
665 | | - } catch (BadLocationException ble) |
---|
666 | | - { |
---|
667 | | - System.err.println("Couldn't insert initial text into text pane."); |
---|
668 | | - } |
---|
669 | | - |
---|
670 | | - return new JTextArea(); // textPane; |
---|
| 815 | + return new JTextPane(); // textPane; |
---|
671 | 816 | } |
---|
672 | 817 | |
---|
673 | 818 | protected void addStylesToDocument(StyledDocument doc) |
---|
.. | .. |
---|
720 | 865 | protected static ImageIcon createImageIcon(String path, |
---|
721 | 866 | String description) |
---|
722 | 867 | { |
---|
723 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 868 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
724 | 869 | if (imgURL != null) |
---|
725 | 870 | { |
---|
726 | 871 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
752 | 897 | // NumberSlider vDivsField; |
---|
753 | 898 | // JCheckBox endcaps; |
---|
754 | 899 | JCheckBox liveCB; |
---|
| 900 | + JCheckBox selectCB; |
---|
755 | 901 | JCheckBox hideCB; |
---|
756 | 902 | JCheckBox link2masterCB; |
---|
757 | 903 | JCheckBox markCB; |
---|
.. | .. |
---|
759 | 905 | JCheckBox speedupCB; |
---|
760 | 906 | JCheckBox rewindCB; |
---|
761 | 907 | JCheckBox flipVCB; |
---|
| 908 | + |
---|
| 909 | + cCheckBox toggleTextureCB; |
---|
| 910 | + cCheckBox toggleSwitchCB; |
---|
| 911 | + |
---|
762 | 912 | JComboBox texresMenu; |
---|
| 913 | + |
---|
763 | 914 | JButton resetButton; |
---|
764 | 915 | JButton stepButton; |
---|
765 | 916 | JButton stepAllButton; |
---|
.. | .. |
---|
767 | 918 | JButton slowerButton; |
---|
768 | 919 | JButton fasterButton; |
---|
769 | 920 | JButton remarkButton; |
---|
| 921 | + |
---|
| 922 | + cGridBag editPanel; |
---|
| 923 | + cGridBag editCommandsPanel; |
---|
| 924 | + |
---|
| 925 | + cGridBag namePanel; |
---|
| 926 | + cGridBag setupPanel; |
---|
| 927 | + cGridBag setupPanel2; |
---|
| 928 | + cGridBag objectCommandsPanel; |
---|
| 929 | + cGridBag pushPanel; |
---|
| 930 | + cGridBag fillPanel; |
---|
770 | 931 | |
---|
771 | | - JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on) |
---|
| 932 | + JCheckBox AddCheckBox(cGridBag panel, String label, boolean on) |
---|
772 | 933 | { |
---|
773 | 934 | JCheckBox cb; |
---|
774 | 935 | |
---|
775 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
776 | | - oe.aConstraints.gridwidth = 1; // 3; |
---|
777 | | -// oe.aConstraints.weightx = 1; |
---|
778 | | -// oe.aConstraints.anchor = GridBagConstraints.WEST; |
---|
779 | | - oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 936 | + panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
780 | 937 | cb.addItemListener(this); |
---|
781 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
782 | | - oe.aConstraints.gridwidth = 1; |
---|
783 | | - oe.aConstraints.gridx += 1; |
---|
784 | 938 | |
---|
785 | 939 | return cb; |
---|
786 | 940 | } |
---|
787 | 941 | |
---|
788 | | - cButton AddButton(ObjEditor oe, String label) |
---|
| 942 | + cButton AddButton(cGridBag panel, String label) |
---|
789 | 943 | { |
---|
790 | 944 | cButton cb; |
---|
791 | 945 | |
---|
792 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
793 | | - oe.aConstraints.gridwidth = 1; |
---|
794 | | -// oe.aConstraints.weightx = 1; |
---|
795 | | -// oe.aConstraints.anchor = GridBagConstraints.WEST; |
---|
796 | | - oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); |
---|
| 946 | + panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); |
---|
797 | 947 | cb.addActionListener(this); |
---|
798 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
799 | | - oe.aConstraints.gridwidth = 1; |
---|
800 | | - oe.aConstraints.gridx += 1; |
---|
801 | 948 | |
---|
802 | 949 | return cb; |
---|
803 | 950 | } |
---|
804 | 951 | |
---|
805 | | - JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item) |
---|
| 952 | + JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item) |
---|
806 | 953 | { |
---|
807 | 954 | JComboBox combo; |
---|
808 | 955 | |
---|
809 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
810 | | - oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
811 | | - oe.aConstraints.gridx += 1; |
---|
| 956 | + panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
812 | 957 | combo.addActionListener(this); |
---|
813 | 958 | |
---|
814 | 959 | return combo; |
---|
815 | 960 | } |
---|
816 | 961 | |
---|
817 | | - cNumberSlider AddSlider(cGridBag ctrlPanel, String label, double min, double max, double current, double pow) |
---|
| 962 | + cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow) |
---|
818 | 963 | { |
---|
819 | 964 | cGridBag control = new cGridBag(); |
---|
820 | 965 | |
---|
.. | .. |
---|
826 | 971 | control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
827 | 972 | combo.setFloat(current); |
---|
828 | 973 | |
---|
829 | | - ctrlPanel.add(control); |
---|
| 974 | + panel.add(control); |
---|
830 | 975 | |
---|
831 | | - return combo; |
---|
| 976 | + return control; |
---|
832 | 977 | } |
---|
833 | 978 | |
---|
834 | | - cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current) |
---|
| 979 | + cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current) |
---|
835 | 980 | { |
---|
836 | 981 | cGridBag control = new cGridBag(); |
---|
837 | 982 | |
---|
.. | .. |
---|
839 | 984 | |
---|
840 | 985 | JLabel jlabel = new JLabel(label); |
---|
841 | 986 | jlabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
842 | | - ctrlPanel.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
843 | | - ctrlPanel.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 987 | + control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 988 | + control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
844 | 989 | combo.setInteger(current); |
---|
845 | 990 | |
---|
846 | | - ctrlPanel.add(control); |
---|
| 991 | + panel.add(control); |
---|
847 | 992 | |
---|
848 | | - return combo; |
---|
| 993 | + return control; |
---|
849 | 994 | } |
---|
850 | 995 | |
---|
851 | 996 | JTextArea AddText(cGridBag ctrlPanel, String name) |
---|
852 | 997 | { |
---|
853 | 998 | JTextArea text; |
---|
854 | 999 | |
---|
855 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
856 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
857 | 1000 | ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
858 | 1001 | text.addCaretListener(this); |
---|
859 | | - aConstraints.gridx += 1; |
---|
860 | | - aConstraints.gridwidth = 1; |
---|
861 | 1002 | |
---|
862 | 1003 | return text; |
---|
863 | 1004 | } |
---|
.. | .. |
---|
896 | 1037 | |
---|
897 | 1038 | /* |
---|
898 | 1039 | */ |
---|
899 | | - void Return() // ObjEditor oe) |
---|
| 1040 | + void Return0() // ObjEditor oe) |
---|
900 | 1041 | { |
---|
901 | 1042 | aConstraints.gridy += 1; |
---|
902 | 1043 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
951 | 1092 | |
---|
952 | 1093 | void SetupUI2(ObjEditor oe) |
---|
953 | 1094 | { |
---|
954 | | -// oe.aConstraints.weightx = 0; |
---|
955 | | -// oe.aConstraints.weighty = 0; |
---|
956 | | -// oe.aConstraints.gridx = 0; |
---|
957 | | -// oe.aConstraints.gridy = 0; |
---|
958 | | - SetupName(oe); |
---|
| 1095 | + //SetupName(oe); |
---|
| 1096 | + |
---|
| 1097 | + namePanel = new cGridBag(); |
---|
| 1098 | + |
---|
| 1099 | + nameField = AddText(namePanel, copy.GetName()); |
---|
| 1100 | + namePanel.add(nameField); |
---|
| 1101 | + oe.ctrlPanel.add(namePanel); |
---|
| 1102 | + |
---|
| 1103 | + oe.ctrlPanel.Return(); |
---|
959 | 1104 | |
---|
960 | 1105 | if (!GroupEditor.allparams) |
---|
961 | 1106 | return; |
---|
962 | 1107 | |
---|
963 | | - liveCB = AddCheckBox(oe, "Live", copy.live); |
---|
964 | | - link2masterCB = AddCheckBox(oe, "Supp", copy.link2master); |
---|
965 | | - hideCB = AddCheckBox(oe, "Hide", copy.hide); |
---|
| 1108 | + setupPanel = new cGridBag().setVertical(false); |
---|
| 1109 | + |
---|
| 1110 | + liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
| 1111 | + liveCB.setToolTipText("Animate object"); |
---|
| 1112 | + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1113 | + selectCB.setToolTipText("Make object selectable"); |
---|
966 | 1114 | // Return(); |
---|
967 | | - markCB = AddCheckBox(oe, "Mark", copy.marked); |
---|
968 | | - rewindCB = AddCheckBox(oe, "Rew", copy.rewind); |
---|
969 | | - randomCB = AddCheckBox(oe, "Rand", copy.random); |
---|
970 | | - Return(); |
---|
971 | | - resetButton = AddButton(oe, "Reset"); |
---|
972 | | - stepButton = AddButton(oe, "Step"); |
---|
| 1115 | + hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 1116 | + hideCB.setToolTipText("Hide object"); |
---|
| 1117 | + markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
| 1118 | + markCB.setToolTipText("Set the animation target transform"); |
---|
| 1119 | + |
---|
| 1120 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1121 | + |
---|
| 1122 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
| 1123 | + rewindCB.setToolTipText("Rewind animation"); |
---|
| 1124 | + |
---|
| 1125 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 1126 | + randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
| 1127 | + |
---|
| 1128 | + if (Globals.ADVANCED) |
---|
| 1129 | + { |
---|
| 1130 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
| 1131 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1132 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
| 1133 | + speedupCB.setToolTipText("Option motion capture"); |
---|
| 1134 | + } |
---|
| 1135 | + |
---|
| 1136 | + oe.ctrlPanel.add(setupPanel); |
---|
| 1137 | + oe.ctrlPanel.Return(); |
---|
| 1138 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1139 | + oe.ctrlPanel.Return(); |
---|
| 1140 | + |
---|
| 1141 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
| 1142 | + |
---|
| 1143 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
| 1144 | + resetButton.setToolTipText("Jump to frame zero"); |
---|
| 1145 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
| 1146 | + stepButton.setToolTipText("Step one frame"); |
---|
973 | 1147 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
974 | 1148 | // stepAllButton = AddButton(oe, "Step All"); |
---|
975 | | - speedupCB = AddCheckBox(oe, "Speed", copy.speedup); |
---|
976 | 1149 | // Return(); |
---|
977 | | - slowerButton = AddButton(oe, "Slow"); |
---|
978 | | - fasterButton = AddButton(oe, "Fast"); |
---|
979 | | - remarkButton = AddButton(oe, "Rem"); |
---|
| 1150 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
| 1151 | + slowerButton.setToolTipText("Decrease animation speed"); |
---|
| 1152 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
| 1153 | + fasterButton.setToolTipText("Increase animation speed"); |
---|
| 1154 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
| 1155 | + remarkButton.setToolTipText("Set the current transform as the target"); |
---|
980 | 1156 | |
---|
981 | | - Return(); |
---|
| 1157 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
| 1158 | + oe.ctrlPanel.Return(); |
---|
982 | 1159 | |
---|
983 | | - normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1); |
---|
984 | | - Return(); |
---|
| 1160 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
| 1161 | + normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
| 1162 | + //Return(); |
---|
| 1163 | + |
---|
| 1164 | + oe.ctrlPanel.Return(); |
---|
985 | 1165 | |
---|
986 | 1166 | // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2); |
---|
987 | 1167 | // ObjEditor.aConstraints.gridx += 1; |
---|
.. | .. |
---|
1076 | 1256 | oe.aConstraints.gridwidth = 1; |
---|
1077 | 1257 | /**/ |
---|
1078 | 1258 | nameField = AddText(oe.ctrlPanel, copy.GetName()); |
---|
1079 | | - Return(); |
---|
| 1259 | + oe.ctrlPanel.Return(); |
---|
1080 | 1260 | |
---|
1081 | 1261 | //ctrlPanel.add(textureButton = new Button("Texture...")); |
---|
1082 | 1262 | //textureButton.setEnabled(false); |
---|
.. | .. |
---|
1180 | 1360 | //worldPanel.setName("World"); |
---|
1181 | 1361 | centralPanel = new cGridBag(); |
---|
1182 | 1362 | centralPanel.preferredWidth = 20; |
---|
1183 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1184 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1363 | + |
---|
| 1364 | + if (Globals.ADVANCED) |
---|
| 1365 | + { |
---|
| 1366 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1367 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1185 | 1368 | |
---|
1186 | 1369 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1187 | 1370 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1190 | 1373 | // cameraPanel.setDividerSize(9); |
---|
1191 | 1374 | cameraPanel.setResizeWeight(1.0); |
---|
1192 | 1375 | |
---|
| 1376 | + } |
---|
| 1377 | + |
---|
1193 | 1378 | centralPanel.add(cameraView); |
---|
| 1379 | + centralPanel.setFocusable(true); |
---|
1194 | 1380 | //frame.setJMenuBar(timelineMenubar); |
---|
1195 | 1381 | //centralPanel.add(timelinePanel); |
---|
1196 | 1382 | |
---|
.. | .. |
---|
1253 | 1439 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1254 | 1440 | //tmp.setName("Edit"); |
---|
1255 | 1441 | objectPanel.add(materialPanel); |
---|
1256 | | - JPanel north = new JPanel(new BorderLayout()); |
---|
1257 | | - north.setName("Edit"); |
---|
1258 | | - north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1259 | | - objectPanel.add(north); |
---|
| 1442 | + objectPanel.add(toolboxPanel); |
---|
| 1443 | +// JPanel north = new JPanel(new BorderLayout()); |
---|
| 1444 | +// north.setName("Edit"); |
---|
| 1445 | +// north.add(ctrlPanel, BorderLayout.NORTH); |
---|
| 1446 | +// objectPanel.add(north); |
---|
| 1447 | + objectPanel.add(editPanel); |
---|
1260 | 1448 | objectPanel.add(infoPanel); |
---|
1261 | 1449 | |
---|
1262 | 1450 | /* |
---|
.. | .. |
---|
1278 | 1466 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1279 | 1467 | |
---|
1280 | 1468 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1281 | | - scenePanel.preferredWidth = 7; |
---|
| 1469 | + scenePanel.preferredWidth = 6; |
---|
1282 | 1470 | |
---|
1283 | 1471 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1284 | 1472 | tabbedPane.add(scrollpane); |
---|
1285 | 1473 | |
---|
1286 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1287 | | - |
---|
1288 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1474 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1289 | 1475 | |
---|
1290 | 1476 | optionsPanel.setName("Options"); |
---|
1291 | 1477 | |
---|
.. | .. |
---|
1293 | 1479 | |
---|
1294 | 1480 | tabbedPane.add(optionsPanel); |
---|
1295 | 1481 | |
---|
| 1482 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1483 | + |
---|
1296 | 1484 | scenePanel.add(tabbedPane); |
---|
1297 | 1485 | |
---|
1298 | 1486 | /* |
---|
.. | .. |
---|
1384 | 1572 | |
---|
1385 | 1573 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1386 | 1574 | |
---|
1387 | | - frame.setSize(1024, 768); |
---|
1388 | | - frame.show(); |
---|
| 1575 | + frame.setSize(1280, 860); |
---|
| 1576 | + |
---|
| 1577 | + frame.validate(); |
---|
| 1578 | + frame.setVisible(true); |
---|
1389 | 1579 | |
---|
| 1580 | + cameraView.requestFocusInWindow(); |
---|
| 1581 | + |
---|
1390 | 1582 | gridPanel.setDividerLocation(1.0); |
---|
1391 | 1583 | |
---|
1392 | 1584 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
1415 | 1607 | ctrlPanel.removeAll(); |
---|
1416 | 1608 | } |
---|
1417 | 1609 | |
---|
1418 | | - void SetupMaterial(cGridBag ctrlPanel) |
---|
| 1610 | + void SetupMaterial(cGridBag panel) |
---|
1419 | 1611 | { |
---|
1420 | 1612 | /* |
---|
1421 | 1613 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
.. | .. |
---|
1424 | 1616 | |
---|
1425 | 1617 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1426 | 1618 | |
---|
1427 | | - editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints); |
---|
| 1619 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1620 | + createMaterialButton.setToolTipText("Create material"); |
---|
1428 | 1621 | |
---|
1429 | 1622 | /* |
---|
1430 | 1623 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1431 | 1624 | */ |
---|
1432 | 1625 | |
---|
1433 | | - editBar.add(clearMaterialButton = new cButton("Clear")); // , aConstraints); |
---|
1434 | | - editBar.add(resetSlidersButton = new cButton("Reset")); // , aConstraints); |
---|
1435 | | - editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1436 | | - editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 1626 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1627 | + clearMaterialButton.setToolTipText("Clear material"); |
---|
| 1628 | + |
---|
| 1629 | + if (Globals.ADVANCED) |
---|
| 1630 | + { |
---|
| 1631 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1632 | + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
| 1633 | + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 1634 | + } |
---|
1437 | 1635 | |
---|
1438 | | - ctrlPanel.add(editBar); |
---|
| 1636 | + editBar.preferredHeight = 15; |
---|
| 1637 | + |
---|
| 1638 | + panel.add(editBar); |
---|
1439 | 1639 | |
---|
1440 | 1640 | /**/ |
---|
1441 | 1641 | //aConstraints.weighty = 0; |
---|
.. | .. |
---|
1445 | 1645 | //aConstraints.gridx += 1; |
---|
1446 | 1646 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1447 | 1647 | |
---|
1448 | | - JPanel colorPanel = new JPanel(new BorderLayout()); |
---|
1449 | | - colorPanel.setBorder(BorderFactory.createLineBorder(Color.black)); |
---|
1450 | | - |
---|
1451 | 1648 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
1452 | | - |
---|
1453 | | - colorPanel.add(colorSection); |
---|
1454 | 1649 | |
---|
1455 | 1650 | cGridBag color = new cGridBag(); |
---|
1456 | 1651 | color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1457 | 1652 | colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1458 | 1653 | color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1654 | + //colorField.preferredWidth = 200; |
---|
1459 | 1655 | colorSection.add(color); |
---|
1460 | 1656 | |
---|
1461 | 1657 | cGridBag modulation = new cGridBag(); |
---|
.. | .. |
---|
1488 | 1684 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1489 | 1685 | colorSection.add(shadowbias); |
---|
1490 | 1686 | |
---|
1491 | | - ctrlPanel.add(colorPanel); |
---|
| 1687 | + panel.add(new JSeparator()); |
---|
| 1688 | + |
---|
| 1689 | + panel.add(colorSection); |
---|
1492 | 1690 | |
---|
1493 | 1691 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1494 | 1692 | |
---|
1495 | | - JPanel diffusePanel = new JPanel(new BorderLayout()); |
---|
1496 | | - diffusePanel.setBorder(BorderFactory.createLineBorder(Color.black)); |
---|
1497 | | - |
---|
1498 | 1693 | cGridBag diffuseSection = new cGridBag().setVertical(true); |
---|
1499 | | - |
---|
1500 | | - diffusePanel.add(diffuseSection); |
---|
1501 | 1694 | |
---|
1502 | 1695 | cGridBag diffuse = new cGridBag(); |
---|
1503 | 1696 | diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints); |
---|
.. | .. |
---|
1541 | 1734 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1542 | 1735 | diffuseSection.add(fakedepth); |
---|
1543 | 1736 | |
---|
1544 | | - ctrlPanel.add(diffusePanel); |
---|
| 1737 | + panel.add(new JSeparator()); |
---|
| 1738 | + |
---|
| 1739 | + panel.add(diffuseSection); |
---|
1545 | 1740 | |
---|
1546 | 1741 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1547 | 1742 | |
---|
1548 | | - JPanel specularPanel = new JPanel(new BorderLayout()); |
---|
1549 | | - specularPanel.setBorder(BorderFactory.createLineBorder(Color.black)); |
---|
1550 | | - |
---|
1551 | 1743 | cGridBag specularSection = new cGridBag().setVertical(true); |
---|
1552 | | - |
---|
1553 | | - specularPanel.add(specularSection); |
---|
1554 | 1744 | |
---|
1555 | 1745 | cGridBag specular = new cGridBag(); |
---|
1556 | 1746 | specular.add(specularLabel = new JLabel("Specular")); // , aConstraints); |
---|
.. | .. |
---|
1582 | 1772 | velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1583 | 1773 | specularSection.add(velvet); |
---|
1584 | 1774 | |
---|
1585 | | - shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1); |
---|
| 1775 | + shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1); |
---|
1586 | 1776 | //Return(); |
---|
1587 | 1777 | // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints); |
---|
1588 | 1778 | // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
.. | .. |
---|
1595 | 1785 | // aConstraints.gridwidth = 1; |
---|
1596 | 1786 | |
---|
1597 | 1787 | |
---|
1598 | | - ctrlPanel.add(specularPanel); |
---|
| 1788 | + panel.add(new JSeparator()); |
---|
| 1789 | + |
---|
| 1790 | + panel.add(specularSection); |
---|
1599 | 1791 | |
---|
1600 | 1792 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1601 | 1793 | |
---|
1602 | | - JPanel globalPanel = new JPanel(new BorderLayout()); |
---|
1603 | | - globalPanel.setBorder(BorderFactory.createLineBorder(Color.black)); |
---|
1604 | | - |
---|
1605 | 1794 | cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1606 | | - |
---|
1607 | | - globalPanel.add(globalSection); |
---|
1608 | 1795 | |
---|
1609 | 1796 | cGridBag camera = new cGridBag(); |
---|
1610 | 1797 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
.. | .. |
---|
1630 | 1817 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1631 | 1818 | globalSection.add(opacity); |
---|
1632 | 1819 | |
---|
1633 | | - ctrlPanel.add(globalPanel); |
---|
| 1820 | + panel.add(new JSeparator()); |
---|
| 1821 | + |
---|
| 1822 | + panel.add(globalSection); |
---|
1634 | 1823 | |
---|
1635 | 1824 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1636 | 1825 | |
---|
1637 | | - JPanel texturePanel = new JPanel(new BorderLayout()); |
---|
1638 | | - texturePanel.setBorder(BorderFactory.createLineBorder(Color.black)); |
---|
1639 | | - |
---|
1640 | 1826 | cGridBag textureSection = new cGridBag().setVertical(true); |
---|
1641 | | - |
---|
1642 | | - texturePanel.add(textureSection); |
---|
1643 | 1827 | |
---|
1644 | 1828 | cGridBag bump = new cGridBag(); |
---|
1645 | 1829 | bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints); |
---|
.. | .. |
---|
1677 | 1861 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1678 | 1862 | textureSection.add(opacityPower); |
---|
1679 | 1863 | |
---|
1680 | | - ctrlPanel.add(texturePanel); |
---|
| 1864 | + panel.add(new JSeparator()); |
---|
| 1865 | + |
---|
| 1866 | + panel.add(textureSection); |
---|
1681 | 1867 | |
---|
1682 | 1868 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1683 | 1869 | |
---|
.. | .. |
---|
1714 | 1900 | opacityPowerField.addChangeListener(this); |
---|
1715 | 1901 | /**/ |
---|
1716 | 1902 | |
---|
1717 | | - resetSlidersButton.addActionListener(this); |
---|
1718 | 1903 | clearMaterialButton.addActionListener(this); |
---|
1719 | 1904 | createMaterialButton.addActionListener(this); |
---|
1720 | | - |
---|
1721 | | - propagateToggle.addItemListener(this); |
---|
1722 | | - multiplyToggle.addItemListener(this); |
---|
| 1905 | + |
---|
| 1906 | + if (Globals.ADVANCED) |
---|
| 1907 | + { |
---|
| 1908 | + resetSlidersButton.addActionListener(this); |
---|
| 1909 | + propagateToggle.addItemListener(this); |
---|
| 1910 | + multiplyToggle.addItemListener(this); |
---|
| 1911 | + } |
---|
1723 | 1912 | } |
---|
1724 | 1913 | |
---|
1725 | 1914 | void DropFile(java.io.File[] files, boolean textures) |
---|
.. | .. |
---|
1890 | 2079 | |
---|
1891 | 2080 | //? flashIt = false; |
---|
1892 | 2081 | CameraPane pane = (CameraPane) cameraView; |
---|
1893 | | - pane.clickStart(location.x, location.y, 0); |
---|
| 2082 | + pane.clickStart(location.x, location.y, 0, 0); |
---|
1894 | 2083 | pane.clickEnd(location.x, location.y, 0, true); |
---|
1895 | 2084 | |
---|
1896 | 2085 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
1939 | 2128 | e2.printStackTrace(); |
---|
1940 | 2129 | } |
---|
1941 | 2130 | } |
---|
| 2131 | + |
---|
1942 | 2132 | LoadJMEThread loadThread; |
---|
1943 | 2133 | |
---|
1944 | 2134 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
1996 | 2186 | //LoadFile0(filename, converter); |
---|
1997 | 2187 | } |
---|
1998 | 2188 | } |
---|
| 2189 | + |
---|
1999 | 2190 | LoadOBJThread loadObjThread; |
---|
2000 | 2191 | |
---|
2001 | 2192 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2074 | 2265 | |
---|
2075 | 2266 | void LoadObjFile(String fullname) |
---|
2076 | 2267 | { |
---|
2077 | | - /* |
---|
| 2268 | + System.out.println("Loading " + fullname); |
---|
| 2269 | + /**/ |
---|
2078 | 2270 | //lastFilename = fullname; |
---|
2079 | 2271 | if(loadObjThread == null) |
---|
2080 | 2272 | { |
---|
2081 | | - loadObjThread = new LoadOBJThread(); |
---|
2082 | | - loadObjThread.start(); |
---|
| 2273 | + loadObjThread = new LoadOBJThread(); |
---|
| 2274 | + loadObjThread.start(); |
---|
2083 | 2275 | } |
---|
2084 | 2276 | |
---|
2085 | 2277 | loadObjThread.add(fullname); |
---|
2086 | | - */ |
---|
| 2278 | + /**/ |
---|
2087 | 2279 | |
---|
2088 | | - System.out.println("Loading " + fullname); |
---|
2089 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2280 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2090 | 2281 | } |
---|
2091 | 2282 | |
---|
2092 | 2283 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2347 | 2538 | |
---|
2348 | 2539 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2349 | 2540 | { |
---|
2350 | | - if (GrafreeD.standAlone) |
---|
| 2541 | + if (Grafreed.standAlone) |
---|
2351 | 2542 | { |
---|
2352 | 2543 | /**/ |
---|
2353 | 2544 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2354 | | - browser.show(); |
---|
| 2545 | + browser.setVisible(true); |
---|
2355 | 2546 | String filename = browser.getFile(); |
---|
2356 | 2547 | if (filename != null && filename.length() > 0) |
---|
2357 | 2548 | { |
---|
.. | .. |
---|
2496 | 2687 | } |
---|
2497 | 2688 | if (input == null) |
---|
2498 | 2689 | { |
---|
| 2690 | + new Exception().printStackTrace(); |
---|
2499 | 2691 | System.exit(0); |
---|
2500 | 2692 | } |
---|
2501 | 2693 | |
---|
.. | .. |
---|
2702 | 2894 | |
---|
2703 | 2895 | void SetMaterial(Object3D object) |
---|
2704 | 2896 | { |
---|
| 2897 | + latestObject = object; |
---|
| 2898 | + |
---|
2705 | 2899 | cMaterial mat = object.material; |
---|
2706 | 2900 | |
---|
2707 | 2901 | if (mat == null) |
---|
.. | .. |
---|
2710 | 2904 | return; |
---|
2711 | 2905 | } |
---|
2712 | 2906 | |
---|
2713 | | - multiplyToggle.setSelected(mat.multiply); |
---|
| 2907 | + if (multiplyToggle != null) |
---|
| 2908 | + multiplyToggle.setSelected(mat.multiply); |
---|
2714 | 2909 | |
---|
2715 | 2910 | assert (object.projectedVertices != null); |
---|
2716 | 2911 | |
---|
.. | .. |
---|
2886 | 3081 | cameraView.ToggleDL(); |
---|
2887 | 3082 | cameraView.repaint(); |
---|
2888 | 3083 | return; |
---|
2889 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3084 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2890 | 3085 | { |
---|
2891 | 3086 | cameraView.ToggleTexture(); |
---|
2892 | 3087 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2925 | 3120 | frame.validate(); |
---|
2926 | 3121 | |
---|
2927 | 3122 | return; |
---|
2928 | | - } else if (event.getSource() == toggleRandomItem) |
---|
| 3123 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2929 | 3124 | { |
---|
2930 | | - cameraView.ToggleRandom(); |
---|
| 3125 | + cameraView.ToggleSwitch(); |
---|
2931 | 3126 | cameraView.repaint(); |
---|
2932 | 3127 | return; |
---|
2933 | 3128 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
2956 | 3151 | { |
---|
2957 | 3152 | copy.live ^= true; |
---|
2958 | 3153 | return; |
---|
| 3154 | + } else if (event.getSource() == selectCB) |
---|
| 3155 | + { |
---|
| 3156 | + copy.dontselect ^= true; |
---|
| 3157 | + return; |
---|
2959 | 3158 | } else if (event.getSource() == hideCB) |
---|
2960 | 3159 | { |
---|
2961 | 3160 | copy.hide ^= true; |
---|
.. | .. |
---|
2970 | 3169 | if (event.getSource() == randomCB) |
---|
2971 | 3170 | { |
---|
2972 | 3171 | copy.random ^= true; |
---|
| 3172 | + objEditor.refreshContents(); |
---|
2973 | 3173 | return; |
---|
2974 | 3174 | } |
---|
2975 | 3175 | if (event.getSource() == speedupCB) |
---|
.. | .. |
---|
2993 | 3193 | |
---|
2994 | 3194 | public void actionPerformed(ActionEvent event) |
---|
2995 | 3195 | { |
---|
| 3196 | + Object source = event.getSource(); |
---|
2996 | 3197 | // SCRIPT DIALOG |
---|
2997 | | - if (event.getSource() == okbutton) |
---|
| 3198 | + if (source == okbutton) |
---|
2998 | 3199 | { |
---|
2999 | 3200 | textpanel.setVisible(false); |
---|
3000 | 3201 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3006 | 3207 | textarea = null; |
---|
3007 | 3208 | textpanel = null; |
---|
3008 | 3209 | } |
---|
3009 | | - if (event.getSource() == cancelbutton) |
---|
| 3210 | + if (source == cancelbutton) |
---|
3010 | 3211 | { |
---|
3011 | 3212 | textpanel.setVisible(false); |
---|
3012 | 3213 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3018 | 3219 | //applySelf(); |
---|
3019 | 3220 | //client.refreshEditWindow(); |
---|
3020 | 3221 | //refreshContents(); |
---|
3021 | | - if (event.getSource() == nameField) |
---|
| 3222 | + if (source == nameField) |
---|
3022 | 3223 | { |
---|
3023 | 3224 | //System.out.println("ObjEditor " + event); |
---|
3024 | 3225 | applySelf0(true); |
---|
3025 | 3226 | //parent.applySelf(); |
---|
3026 | 3227 | objEditor.refreshContents(); |
---|
3027 | | - } else if (event.getSource() == resetButton) |
---|
| 3228 | + } else if (source == resetButton) |
---|
3028 | 3229 | { |
---|
3029 | 3230 | CameraPane.fullreset = true; |
---|
3030 | 3231 | copy.Reset(); // ResetMeshes(); |
---|
3031 | 3232 | copy.Touch(); |
---|
3032 | 3233 | objEditor.refreshContents(); |
---|
3033 | | - } else if (event.getSource() == stepItem) |
---|
| 3234 | + } else if (source == stepItem) |
---|
3034 | 3235 | { |
---|
3035 | 3236 | //cameraView.ONESTEP = true; |
---|
3036 | 3237 | Globals.ONESTEP = true; |
---|
3037 | 3238 | cameraView.repaint(); |
---|
3038 | 3239 | return; |
---|
3039 | | - } else if (event.getSource() == stepButton) |
---|
| 3240 | + } else if (source == stepButton) |
---|
3040 | 3241 | { |
---|
3041 | 3242 | copy.Step(); |
---|
3042 | 3243 | copy.Touch(); |
---|
3043 | 3244 | objEditor.refreshContents(); |
---|
3044 | | - } else if (event.getSource() == slowerButton) |
---|
| 3245 | + } else if (source == slowerButton) |
---|
3045 | 3246 | { |
---|
3046 | 3247 | copy.Slower(); |
---|
3047 | 3248 | copy.Touch(); |
---|
3048 | 3249 | objEditor.refreshContents(); |
---|
3049 | | - } else if (event.getSource() == fasterButton) |
---|
| 3250 | + } else if (source == fasterButton) |
---|
3050 | 3251 | { |
---|
3051 | 3252 | copy.Faster(); |
---|
3052 | 3253 | copy.Touch(); |
---|
3053 | 3254 | objEditor.refreshContents(); |
---|
3054 | | - } else if (event.getSource() == remarkButton) |
---|
| 3255 | + } else if (source == remarkButton) |
---|
3055 | 3256 | { |
---|
3056 | 3257 | copy.Remark(); |
---|
3057 | 3258 | copy.Touch(); |
---|
3058 | 3259 | objEditor.refreshContents(); |
---|
3059 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3260 | + } else if (source == stepAllButton) |
---|
3060 | 3261 | { |
---|
3061 | 3262 | copy.StepAll(); |
---|
3062 | 3263 | copy.Touch(); |
---|
3063 | 3264 | objEditor.refreshContents(); |
---|
3064 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3265 | + } else if (source == resetAllButton) |
---|
3065 | 3266 | { |
---|
3066 | 3267 | //CameraPane.fullreset = true; |
---|
3067 | 3268 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3094 | 3295 | // Close(); |
---|
3095 | 3296 | // } |
---|
3096 | 3297 | // else |
---|
3097 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3298 | + if (source == resetSlidersButton) |
---|
3098 | 3299 | { |
---|
3099 | 3300 | ResetSliders(); |
---|
3100 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3301 | + } else if (source == clearMaterialButton) |
---|
3101 | 3302 | { |
---|
3102 | 3303 | ClearMaterial(); |
---|
3103 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3304 | + } else if (source == createMaterialButton) |
---|
3104 | 3305 | { |
---|
3105 | 3306 | CreateMaterial(); |
---|
3106 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3307 | + } else if (source == clearPanelButton) |
---|
3107 | 3308 | { |
---|
3108 | 3309 | copy.ClearUI(); |
---|
3109 | 3310 | refreshContents(true); |
---|
3110 | | - } /* |
---|
3111 | | - } |
---|
3112 | | - |
---|
3113 | | - public boolean action(Event event, Object arg) |
---|
3114 | | - { |
---|
3115 | | - */ else if (event.getSource() == closeItem) |
---|
| 3311 | + } else if (source == importGFDItem) |
---|
| 3312 | + { |
---|
| 3313 | + ImportGFD(); |
---|
| 3314 | + } else |
---|
| 3315 | + if (source == importVRMLX3DItem) |
---|
| 3316 | + { |
---|
| 3317 | + ImportVRMLX3D(); |
---|
| 3318 | + } else |
---|
| 3319 | + if (source == import3DSItem) |
---|
| 3320 | + { |
---|
| 3321 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3322 | + } else |
---|
| 3323 | + if (source == importOBJItem) |
---|
| 3324 | + { |
---|
| 3325 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3326 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3327 | + browser.setVisible(true); |
---|
| 3328 | + String filename = browser.getFile(); |
---|
| 3329 | + if (filename != null && filename.length() > 0) |
---|
| 3330 | + { |
---|
| 3331 | + String fullname = browser.getDirectory() + filename; |
---|
| 3332 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3333 | + } |
---|
| 3334 | + } else |
---|
| 3335 | + if (source == closeItem) |
---|
3116 | 3336 | { |
---|
3117 | 3337 | Close(); |
---|
3118 | 3338 | //return true; |
---|
3119 | | - } else if (event.getSource() == loadItem) |
---|
| 3339 | + } else if (source == loadItem) |
---|
3120 | 3340 | { |
---|
3121 | 3341 | load(); |
---|
3122 | 3342 | //return true; |
---|
3123 | | - } else if (event.getSource() == saveItem) |
---|
| 3343 | + } else if (source == newItem) |
---|
| 3344 | + { |
---|
| 3345 | + New(); |
---|
| 3346 | + } else if (source == saveItem) |
---|
3124 | 3347 | { |
---|
3125 | 3348 | save(); |
---|
3126 | 3349 | //return true; |
---|
3127 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3350 | + } else if (source == saveAsItem) |
---|
3128 | 3351 | { |
---|
3129 | 3352 | saveAs(); |
---|
3130 | 3353 | //return true; |
---|
3131 | | - } else if (event.getSource() == reexportItem) |
---|
| 3354 | + } else if (source == reexportItem) |
---|
3132 | 3355 | { |
---|
3133 | 3356 | reexport(); |
---|
3134 | 3357 | //return true; |
---|
3135 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3358 | + } else if (source == exportAsItem) |
---|
3136 | 3359 | { |
---|
3137 | 3360 | export(); |
---|
3138 | 3361 | //return true; |
---|
3139 | | - } else if (event.getSource() == povItem) |
---|
| 3362 | + } else if (source == povItem) |
---|
3140 | 3363 | { |
---|
3141 | 3364 | generatePOV(); |
---|
3142 | 3365 | //return true; |
---|
3143 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3366 | + } else if (source == zBufferItem) |
---|
3144 | 3367 | { |
---|
3145 | 3368 | try |
---|
3146 | 3369 | { |
---|
.. | .. |
---|
3162 | 3385 | cameraView.repaint(); |
---|
3163 | 3386 | //return true; |
---|
3164 | 3387 | } |
---|
3165 | | - */ else if (event.getSource() == editCameraItem) |
---|
3166 | | - { |
---|
3167 | | - cameraView.ProtectCamera(); |
---|
3168 | | - cameraView.repaint(); |
---|
3169 | | - return; |
---|
3170 | | - } else if (event.getSource() == revertCameraItem) |
---|
3171 | | - { |
---|
3172 | | - cameraView.RevertCamera(); |
---|
3173 | | - cameraView.repaint(); |
---|
3174 | | - return; |
---|
3175 | | -// } else if (event.getSource() == textureButton) |
---|
3176 | | -// { |
---|
3177 | | -// return; // true; |
---|
3178 | | - } else // combos... |
---|
3179 | | - if (event.getSource() == texresMenu) |
---|
| 3388 | + */ else // combos... |
---|
| 3389 | + if (source == texresMenu) |
---|
3180 | 3390 | { |
---|
3181 | 3391 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3182 | 3392 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3188 | 3398 | } |
---|
3189 | 3399 | } |
---|
3190 | 3400 | |
---|
| 3401 | + void New() |
---|
| 3402 | + { |
---|
| 3403 | + while (copy.Size() > 1) |
---|
| 3404 | + { |
---|
| 3405 | + copy.remove(1); |
---|
| 3406 | + } |
---|
| 3407 | + |
---|
| 3408 | + ResetModel(); |
---|
| 3409 | + objEditor.refreshContents(); |
---|
| 3410 | + } |
---|
| 3411 | + |
---|
| 3412 | + static public byte[] Compress(Object3D o) |
---|
| 3413 | + { |
---|
| 3414 | + try |
---|
| 3415 | + { |
---|
| 3416 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3417 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3418 | + ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3419 | + |
---|
| 3420 | + Object3D parent = o.parent; |
---|
| 3421 | + o.parent = null; |
---|
| 3422 | + |
---|
| 3423 | + out.writeObject(o); |
---|
| 3424 | + |
---|
| 3425 | + o.parent = parent; |
---|
| 3426 | + |
---|
| 3427 | + out.flush(); |
---|
| 3428 | + |
---|
| 3429 | + zstream.close(); |
---|
| 3430 | + out.close(); |
---|
| 3431 | + |
---|
| 3432 | + return baos.toByteArray(); |
---|
| 3433 | + } catch (Exception e) |
---|
| 3434 | + { |
---|
| 3435 | + System.err.println(e); |
---|
| 3436 | + return null; |
---|
| 3437 | + } |
---|
| 3438 | + } |
---|
| 3439 | + |
---|
| 3440 | + static public Object Uncompress(byte[] bytes) |
---|
| 3441 | + { |
---|
| 3442 | + System.out.println("#bytes = " + bytes.length); |
---|
| 3443 | + try |
---|
| 3444 | + { |
---|
| 3445 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3446 | + java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3447 | + ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3448 | + Object obj = in.readObject(); |
---|
| 3449 | + in.close(); |
---|
| 3450 | + |
---|
| 3451 | + return obj; |
---|
| 3452 | + } catch (Exception e) |
---|
| 3453 | + { |
---|
| 3454 | + System.err.println(e); |
---|
| 3455 | + return null; |
---|
| 3456 | + } |
---|
| 3457 | + } |
---|
| 3458 | + |
---|
| 3459 | + static public Object clone(Object o) |
---|
| 3460 | + { |
---|
| 3461 | + try |
---|
| 3462 | + { |
---|
| 3463 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3464 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3465 | + |
---|
| 3466 | + out.writeObject(o); |
---|
| 3467 | + |
---|
| 3468 | + out.flush(); |
---|
| 3469 | + out.close(); |
---|
| 3470 | + |
---|
| 3471 | + byte[] bytes = baos.toByteArray(); |
---|
| 3472 | + |
---|
| 3473 | + System.out.println("clone = " + bytes.length); |
---|
| 3474 | + |
---|
| 3475 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3476 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3477 | + Object obj = in.readObject(); |
---|
| 3478 | + in.close(); |
---|
| 3479 | + |
---|
| 3480 | + return obj; |
---|
| 3481 | + } catch (Exception e) |
---|
| 3482 | + { |
---|
| 3483 | + System.err.println(e); |
---|
| 3484 | + return null; |
---|
| 3485 | + } |
---|
| 3486 | + } |
---|
| 3487 | + |
---|
| 3488 | + cRadio GetCurrentTab() |
---|
| 3489 | + { |
---|
| 3490 | + cRadio ab; |
---|
| 3491 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3492 | + { |
---|
| 3493 | + ab = (cRadio)e.nextElement(); |
---|
| 3494 | + if(ab.GetObject() == copy) |
---|
| 3495 | + { |
---|
| 3496 | + return ab; |
---|
| 3497 | + } |
---|
| 3498 | + } |
---|
| 3499 | + |
---|
| 3500 | + return null; |
---|
| 3501 | + } |
---|
| 3502 | + |
---|
| 3503 | + java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3504 | + |
---|
| 3505 | + public void Save() |
---|
| 3506 | + { |
---|
| 3507 | + System.err.println("Save"); |
---|
| 3508 | + |
---|
| 3509 | + cRadio tab = GetCurrentTab(); |
---|
| 3510 | + |
---|
| 3511 | + boolean temp = CameraPane.SWITCH; |
---|
| 3512 | + CameraPane.SWITCH = false; |
---|
| 3513 | + |
---|
| 3514 | + copy.ExtractBigData(hashtable); |
---|
| 3515 | + |
---|
| 3516 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3517 | + tab.graphs[tab.undoindex++] = Compress(copy); |
---|
| 3518 | + |
---|
| 3519 | + copy.RestoreBigData(hashtable); |
---|
| 3520 | + |
---|
| 3521 | + CameraPane.SWITCH = temp; |
---|
| 3522 | + |
---|
| 3523 | + //assert(hashtable.isEmpty()); |
---|
| 3524 | + |
---|
| 3525 | + for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3526 | + { |
---|
| 3527 | + tab.graphs[i] = null; |
---|
| 3528 | + } |
---|
| 3529 | + |
---|
| 3530 | + // test save |
---|
| 3531 | + if (false) |
---|
| 3532 | + { |
---|
| 3533 | + try |
---|
| 3534 | + { |
---|
| 3535 | + FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3536 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3537 | + |
---|
| 3538 | + p.writeObject(copy); |
---|
| 3539 | + |
---|
| 3540 | + p.flush(); |
---|
| 3541 | + |
---|
| 3542 | + ostream.close(); |
---|
| 3543 | + } catch (Exception e) |
---|
| 3544 | + { |
---|
| 3545 | + e.printStackTrace(); |
---|
| 3546 | + } |
---|
| 3547 | + } |
---|
| 3548 | + } |
---|
| 3549 | + |
---|
| 3550 | + void CopyChanged(Object3D obj) |
---|
| 3551 | + { |
---|
| 3552 | + boolean temp = CameraPane.SWITCH; |
---|
| 3553 | + CameraPane.SWITCH = false; |
---|
| 3554 | + |
---|
| 3555 | + copy.ExtractBigData(hashtable); |
---|
| 3556 | + |
---|
| 3557 | + copy.clear(); |
---|
| 3558 | + |
---|
| 3559 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3560 | + { |
---|
| 3561 | + copy.add(obj.get(i)); |
---|
| 3562 | + } |
---|
| 3563 | + |
---|
| 3564 | + copy.RestoreBigData(hashtable); |
---|
| 3565 | + |
---|
| 3566 | + CameraPane.SWITCH = temp; |
---|
| 3567 | + |
---|
| 3568 | + //assert(hashtable.isEmpty()); |
---|
| 3569 | + |
---|
| 3570 | + copy.Touch(); |
---|
| 3571 | + |
---|
| 3572 | + ResetModel(); |
---|
| 3573 | + copy.HardTouch(); // recompile? |
---|
| 3574 | + |
---|
| 3575 | + cRadio ab; |
---|
| 3576 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3577 | + { |
---|
| 3578 | + ab = (cRadio)e.nextElement(); |
---|
| 3579 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3580 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3581 | + if (test != null) |
---|
| 3582 | + { |
---|
| 3583 | + test.editWindow = ab.object.editWindow; |
---|
| 3584 | + ab.object = test; |
---|
| 3585 | + } |
---|
| 3586 | + } |
---|
| 3587 | + |
---|
| 3588 | + refreshContents(); |
---|
| 3589 | + } |
---|
| 3590 | + |
---|
| 3591 | + public void Undo() |
---|
| 3592 | + { |
---|
| 3593 | + System.err.println("Undo"); |
---|
| 3594 | + |
---|
| 3595 | + cRadio tab = GetCurrentTab(); |
---|
| 3596 | + |
---|
| 3597 | + if (tab.undoindex == 0) |
---|
| 3598 | + { |
---|
| 3599 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3600 | + return; |
---|
| 3601 | + } |
---|
| 3602 | + |
---|
| 3603 | + if (tab.graphs[tab.undoindex] == null) |
---|
| 3604 | + { |
---|
| 3605 | + Save(); |
---|
| 3606 | + tab.undoindex -= 1; |
---|
| 3607 | + } |
---|
| 3608 | + |
---|
| 3609 | + tab.undoindex -= 1; |
---|
| 3610 | + |
---|
| 3611 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3612 | + } |
---|
| 3613 | + |
---|
| 3614 | + public void Redo() |
---|
| 3615 | + { |
---|
| 3616 | + cRadio tab = GetCurrentTab(); |
---|
| 3617 | + |
---|
| 3618 | + if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3619 | + { |
---|
| 3620 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3621 | + return; |
---|
| 3622 | + } |
---|
| 3623 | + |
---|
| 3624 | + tab.undoindex += 1; |
---|
| 3625 | + |
---|
| 3626 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3627 | + } |
---|
| 3628 | + |
---|
| 3629 | + void ImportGFD() |
---|
| 3630 | + { |
---|
| 3631 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 3632 | + browser.show(); |
---|
| 3633 | + String filename = browser.getFile(); |
---|
| 3634 | + if (filename != null && filename.length() > 0) |
---|
| 3635 | + { |
---|
| 3636 | + String fullname = browser.getDirectory() + filename; |
---|
| 3637 | + |
---|
| 3638 | + //Object3D readobj = |
---|
| 3639 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 3640 | + //makeSomething(readobj); |
---|
| 3641 | + } |
---|
| 3642 | + } |
---|
| 3643 | + |
---|
| 3644 | + void ImportVRMLX3D() |
---|
| 3645 | + { |
---|
| 3646 | + if (Grafreed.standAlone) |
---|
| 3647 | + { |
---|
| 3648 | + /**/ |
---|
| 3649 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 3650 | + browser.show(); |
---|
| 3651 | + String filename = browser.getFile(); |
---|
| 3652 | + if (filename != null && filename.length() > 0) |
---|
| 3653 | + { |
---|
| 3654 | + String fullname = browser.getDirectory() + filename; |
---|
| 3655 | + LoadVRMLX3D(fullname); |
---|
| 3656 | + } |
---|
| 3657 | + /**/ |
---|
| 3658 | + } |
---|
| 3659 | + } |
---|
| 3660 | + |
---|
3191 | 3661 | void ToggleAnimation() |
---|
3192 | 3662 | { |
---|
3193 | 3663 | if (!Globals.ANIMATION) |
---|
3194 | 3664 | { |
---|
3195 | 3665 | FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); |
---|
3196 | | - browser.show(); |
---|
| 3666 | + browser.setVisible(true); |
---|
3197 | 3667 | String filename = browser.getFile(); |
---|
3198 | 3668 | if (filename != null && filename.length() > 0) |
---|
3199 | 3669 | { |
---|
.. | .. |
---|
3203 | 3673 | |
---|
3204 | 3674 | Globals.ANIMATION ^= true; |
---|
3205 | 3675 | |
---|
3206 | | - GrafreeD.wav.cursor = 0; |
---|
3207 | | - GrafreeD.wav.loop = 0; |
---|
| 3676 | + Grafreed.wav.cursor = 0; |
---|
| 3677 | + Grafreed.wav.loop = 0; |
---|
3208 | 3678 | } |
---|
3209 | 3679 | } else |
---|
3210 | 3680 | { |
---|
.. | .. |
---|
3254 | 3724 | void CreateMaterial() |
---|
3255 | 3725 | { |
---|
3256 | 3726 | //copy.ClearMaterial(); // PATCH |
---|
3257 | | - copy.CreateMaterialS(multiplyToggle.isSelected()); |
---|
| 3727 | + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); |
---|
3258 | 3728 | if (copy.selection.size() > 0) |
---|
3259 | 3729 | //SetMaterial(copy); |
---|
3260 | 3730 | { |
---|
.. | .. |
---|
3305 | 3775 | assert false; |
---|
3306 | 3776 | } |
---|
3307 | 3777 | |
---|
3308 | | - void EditSelection() |
---|
| 3778 | + void EditSelection(boolean newWindow) |
---|
3309 | 3779 | { |
---|
3310 | 3780 | } |
---|
3311 | 3781 | |
---|
.. | .. |
---|
3313 | 3783 | { |
---|
3314 | 3784 | copy.ResetBlockLoop(); // temporary problem |
---|
3315 | 3785 | |
---|
3316 | | - boolean random = CameraPane.RANDOM; |
---|
3317 | | - CameraPane.RANDOM = false; // parse everything |
---|
| 3786 | + boolean random = CameraPane.SWITCH; |
---|
| 3787 | + CameraPane.SWITCH = false; // parse everything |
---|
3318 | 3788 | copy.ResetDisplayList(); |
---|
3319 | 3789 | copy.HardTouch(); |
---|
3320 | | - CameraPane.RANDOM = random; |
---|
| 3790 | + CameraPane.SWITCH = random; |
---|
3321 | 3791 | } |
---|
3322 | 3792 | |
---|
3323 | 3793 | // public void applySelf() |
---|
.. | .. |
---|
3391 | 3861 | { |
---|
3392 | 3862 | //System.out.println("Propagate = " + propagate); |
---|
3393 | 3863 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 3864 | + |
---|
| 3865 | + if (copy.material != null) |
---|
| 3866 | + { |
---|
| 3867 | + cMaterial mat = copy.material; |
---|
| 3868 | + |
---|
| 3869 | + colorField.SetToolTipValue((mat.color)); |
---|
| 3870 | + modulationField.SetToolTipValue((mat.modulation)); |
---|
| 3871 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 3872 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 3873 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 3874 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 3875 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 3876 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 3877 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 3878 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 3879 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 3880 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 3881 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 3882 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 3883 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 3884 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 3885 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 3886 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 3887 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 3888 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 3889 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 3890 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 3891 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 3892 | + } |
---|
| 3893 | + |
---|
3394 | 3894 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3395 | 3895 | { |
---|
3396 | 3896 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3435 | 3935 | || e.getSource() == apertureField |
---|
3436 | 3936 | || e.getSource() == shadowblurField) |
---|
3437 | 3937 | { |
---|
| 3938 | + new Exception().printStackTrace(); |
---|
3438 | 3939 | System.exit(0); |
---|
3439 | 3940 | cameraView.options1[0] = (float) focusField.getFloat() * 10; |
---|
3440 | 3941 | cameraView.options1[1] = (float) apertureField.getFloat() / 1000; |
---|
.. | .. |
---|
3505 | 4006 | } |
---|
3506 | 4007 | |
---|
3507 | 4008 | if (normalpushField != null) |
---|
3508 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 4009 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3509 | 4010 | } |
---|
3510 | 4011 | |
---|
3511 | 4012 | void SnapObject() |
---|
.. | .. |
---|
3769 | 4270 | |
---|
3770 | 4271 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3771 | 4272 | { |
---|
| 4273 | + if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4274 | + Save(); |
---|
3772 | 4275 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3773 | 4276 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3774 | 4277 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3855 | 4358 | { |
---|
3856 | 4359 | ResetModel(); |
---|
3857 | 4360 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4361 | + |
---|
| 4362 | + if (thing.Size() == 0) |
---|
| 4363 | + { |
---|
| 4364 | + //EditSelection(false); |
---|
| 4365 | + } |
---|
| 4366 | + |
---|
3858 | 4367 | refreshContents(); |
---|
3859 | 4368 | } |
---|
3860 | 4369 | |
---|
.. | .. |
---|
3972 | 4481 | } |
---|
3973 | 4482 | } |
---|
3974 | 4483 | } |
---|
| 4484 | + |
---|
3975 | 4485 | LoadGFDThread loadGFDThread; |
---|
3976 | 4486 | |
---|
3977 | 4487 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
3991 | 4501 | |
---|
3992 | 4502 | try |
---|
3993 | 4503 | { |
---|
| 4504 | + // Try compressed version first. |
---|
3994 | 4505 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
3995 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4506 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4507 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
3996 | 4508 | |
---|
3997 | 4509 | readobj = (Object3D) p.readObject(); |
---|
3998 | 4510 | istream.close(); |
---|
.. | .. |
---|
4000 | 4512 | readobj.ResetDisplayList(); |
---|
4001 | 4513 | } catch (Exception e) |
---|
4002 | 4514 | { |
---|
4003 | | - e.printStackTrace(); |
---|
| 4515 | + //e.printStackTrace(); |
---|
| 4516 | + try |
---|
| 4517 | + { |
---|
| 4518 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4519 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4520 | + |
---|
| 4521 | + readobj = (Object3D) p.readObject(); |
---|
| 4522 | + istream.close(); |
---|
| 4523 | + |
---|
| 4524 | + readobj.ResetDisplayList(); |
---|
| 4525 | + } catch (Exception e2) |
---|
| 4526 | + { |
---|
| 4527 | + e2.printStackTrace(); |
---|
| 4528 | + } |
---|
4004 | 4529 | } |
---|
4005 | 4530 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4006 | 4531 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4046 | 4571 | |
---|
4047 | 4572 | void LoadIt(Object obj) |
---|
4048 | 4573 | { |
---|
| 4574 | + if (obj == null) |
---|
| 4575 | + { |
---|
| 4576 | + // Invalid file |
---|
| 4577 | + return; |
---|
| 4578 | + } |
---|
| 4579 | + |
---|
4049 | 4580 | System.out.println("Loaded " + obj); |
---|
4050 | 4581 | //new Exception().printStackTrace(); |
---|
4051 | 4582 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4055 | 4586 | |
---|
4056 | 4587 | if (readobj != null) |
---|
4057 | 4588 | { |
---|
| 4589 | + if (Globals.SAVEONMAKE) |
---|
| 4590 | + Save(); |
---|
4058 | 4591 | try |
---|
4059 | 4592 | { |
---|
4060 | 4593 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4117 | 4650 | |
---|
4118 | 4651 | void load() // throws ClassNotFoundException |
---|
4119 | 4652 | { |
---|
4120 | | - if (GrafreeD.standAlone) |
---|
| 4653 | + if (Grafreed.standAlone) |
---|
4121 | 4654 | { |
---|
4122 | 4655 | FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
4123 | 4656 | browser.show(); |
---|
.. | .. |
---|
4204 | 4737 | try |
---|
4205 | 4738 | { |
---|
4206 | 4739 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4207 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4740 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4741 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4208 | 4742 | |
---|
4209 | 4743 | p.writeObject(copy); |
---|
4210 | 4744 | p.flush(); |
---|
4211 | 4745 | |
---|
| 4746 | + zstream.close(); |
---|
4212 | 4747 | ostream.close(); |
---|
4213 | 4748 | |
---|
4214 | 4749 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4218 | 4753 | { |
---|
4219 | 4754 | } |
---|
4220 | 4755 | } |
---|
| 4756 | + |
---|
4221 | 4757 | String lastname; |
---|
4222 | 4758 | |
---|
4223 | 4759 | void saveAs() |
---|
4224 | 4760 | { |
---|
4225 | | - if (GrafreeD.standAlone) |
---|
| 4761 | + if (Grafreed.standAlone) |
---|
4226 | 4762 | { |
---|
4227 | 4763 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4228 | 4764 | browser.setVisible(true); |
---|
.. | .. |
---|
4327 | 4863 | try |
---|
4328 | 4864 | { |
---|
4329 | 4865 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4330 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4331 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 4866 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4867 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4332 | 4868 | |
---|
4333 | 4869 | Object3D objectparent = obj.parent; |
---|
4334 | 4870 | obj.parent = null; |
---|
4335 | 4871 | |
---|
4336 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 4872 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4337 | 4873 | |
---|
4338 | 4874 | obj.parent = objectparent; |
---|
4339 | 4875 | |
---|
.. | .. |
---|
4345 | 4881 | p.writeObject(object); |
---|
4346 | 4882 | p.flush(); |
---|
4347 | 4883 | |
---|
| 4884 | + zstream.close(); |
---|
4348 | 4885 | ostream.close(); |
---|
4349 | | - // zstream.close(); |
---|
4350 | 4886 | |
---|
4351 | 4887 | // group.selection.get(0).parent = parent; |
---|
4352 | 4888 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4367 | 4903 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4368 | 4904 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4369 | 4905 | copy.generatePOV(buffer); |
---|
4370 | | - if (GrafreeD.standAlone) |
---|
| 4906 | + if (Grafreed.standAlone) |
---|
4371 | 4907 | { |
---|
4372 | 4908 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4373 | 4909 | browser.show(); |
---|
.. | .. |
---|
4393 | 4929 | Object3D client; |
---|
4394 | 4930 | Object3D copy; |
---|
4395 | 4931 | MenuBar menuBar; |
---|
4396 | | - Menu windowMenu; |
---|
| 4932 | + Menu fileMenu; |
---|
| 4933 | + MenuItem newItem; |
---|
4397 | 4934 | MenuItem loadItem; |
---|
4398 | 4935 | MenuItem saveItem; |
---|
4399 | 4936 | MenuItem saveAsItem; |
---|
.. | .. |
---|
4401 | 4938 | MenuItem reexportItem; |
---|
4402 | 4939 | MenuItem povItem; |
---|
4403 | 4940 | MenuItem closeItem; |
---|
4404 | | - Menu cameraMenu; |
---|
| 4941 | + |
---|
4405 | 4942 | CheckboxMenuItem zBufferItem; |
---|
4406 | 4943 | //MenuItem normalLensItem; |
---|
4407 | | - MenuItem editCameraItem; |
---|
4408 | | - MenuItem revertCameraItem; |
---|
4409 | | - CheckboxMenuItem toggleLiveItem; |
---|
4410 | 4944 | MenuItem stepItem; |
---|
| 4945 | + CheckboxMenuItem toggleLiveItem; |
---|
4411 | 4946 | CheckboxMenuItem toggleFullScreenItem; |
---|
4412 | 4947 | CheckboxMenuItem toggleTimelineItem; |
---|
4413 | 4948 | CheckboxMenuItem toggleRenderItem; |
---|
.. | .. |
---|
4416 | 4951 | CheckboxMenuItem toggleFootContactItem; |
---|
4417 | 4952 | CheckboxMenuItem toggleDLItem; |
---|
4418 | 4953 | CheckboxMenuItem toggleTextureItem; |
---|
4419 | | - CheckboxMenuItem toggleRandomItem; |
---|
| 4954 | + CheckboxMenuItem toggleSwitchItem; |
---|
4420 | 4955 | CheckboxMenuItem toggleRootItem; |
---|
4421 | 4956 | CheckboxMenuItem animationItem; |
---|
4422 | 4957 | CheckboxMenuItem toggleHandleItem; |
---|
4423 | 4958 | CheckboxMenuItem togglePaintItem; |
---|
4424 | 4959 | JSplitPane mainPanel; |
---|
4425 | 4960 | JScrollPane scrollpane; |
---|
| 4961 | + |
---|
4426 | 4962 | JPanel toolbarPanel; |
---|
4427 | | - JPanel treePanel; |
---|
| 4963 | + |
---|
| 4964 | + cGridBag treePanel; |
---|
| 4965 | + |
---|
4428 | 4966 | JPanel radioPanel; |
---|
4429 | 4967 | ButtonGroup buttonGroup; |
---|
4430 | | - cGridBag ctrlPanel; |
---|
| 4968 | + |
---|
| 4969 | + cGridBag toolboxPanel; |
---|
4431 | 4970 | cGridBag materialPanel; |
---|
| 4971 | + cGridBag ctrlPanel; |
---|
| 4972 | + |
---|
4432 | 4973 | JScrollPane infoPanel; |
---|
| 4974 | + |
---|
4433 | 4975 | cGridBag optionsPanel; |
---|
| 4976 | + |
---|
4434 | 4977 | JTabbedPane objectPanel; |
---|
| 4978 | + boolean materialFlushed; |
---|
| 4979 | + Object3D latestObject; |
---|
| 4980 | + |
---|
4435 | 4981 | cGridBag XYZPanel; |
---|
| 4982 | + |
---|
4436 | 4983 | JSplitPane gridPanel; |
---|
4437 | 4984 | JSplitPane bigPanel; |
---|
| 4985 | + |
---|
4438 | 4986 | cGridBag bigThree; |
---|
4439 | 4987 | cGridBag scenePanel; |
---|
4440 | 4988 | cGridBag centralPanel; |
---|
.. | .. |
---|
4549 | 5097 | cNumberSlider fogField; |
---|
4550 | 5098 | JLabel opacityPowerLabel; |
---|
4551 | 5099 | cNumberSlider opacityPowerField; |
---|
4552 | | - JTree jTree; |
---|
| 5100 | + cTree jTree; |
---|
4553 | 5101 | //ObjectUI parent; |
---|
4554 | 5102 | |
---|
4555 | 5103 | cNumberSlider normalpushField; |
---|
| 5104 | + |
---|
| 5105 | + private MenuItem importGFDItem; |
---|
| 5106 | + private MenuItem importVRMLX3DItem; |
---|
| 5107 | + private MenuItem import3DSItem; |
---|
| 5108 | + private MenuItem importOBJItem; |
---|
4556 | 5109 | } |
---|