.. | .. |
---|
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 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 56 | + { |
---|
| 57 | + try |
---|
| 58 | + { |
---|
| 59 | + ImageIcon icon = GetIcon(name); |
---|
| 60 | + return new cCheckBox(icon, border); |
---|
| 61 | + } |
---|
| 62 | + catch (Exception e) |
---|
| 63 | + { |
---|
| 64 | + return new cCheckBox(name, border); |
---|
| 65 | + } |
---|
| 66 | + } |
---|
| 67 | + |
---|
| 68 | + private ImageIcon GetIcon(String name) throws IOException |
---|
| 69 | + { |
---|
| 70 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 71 | + |
---|
| 72 | + if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 73 | + { |
---|
| 74 | + BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
| 75 | + Graphics2D g = resized.createGraphics(); |
---|
| 76 | + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 77 | + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 78 | + g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 79 | + g.dispose(); |
---|
| 80 | + |
---|
| 81 | + image = resized; |
---|
| 82 | + } |
---|
| 83 | + |
---|
| 84 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 85 | + return icon; |
---|
| 86 | + } |
---|
38 | 87 | |
---|
39 | 88 | // SCRIPT |
---|
40 | 89 | |
---|
.. | .. |
---|
138 | 187 | public void closeUI() |
---|
139 | 188 | { |
---|
140 | 189 | //new Exception().printStackTrace(); |
---|
141 | | - System.out.println("this = " + this); |
---|
142 | | - System.out.println("objEditor = " + objEditor); |
---|
| 190 | +// System.out.println("this = " + this); |
---|
| 191 | +// System.out.println("objEditor = " + objEditor); |
---|
143 | 192 | //nameField.removeActionListener(this); |
---|
144 | | - objEditor.ctrlPanel.remove(nameField); |
---|
| 193 | +// objEditor.ctrlPanel.remove(nameField); |
---|
| 194 | + |
---|
| 195 | + objEditor.ctrlPanel.remove(namePanel); |
---|
145 | 196 | |
---|
146 | 197 | if (!GroupEditor.allparams) |
---|
147 | 198 | return; |
---|
148 | 199 | |
---|
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); |
---|
| 200 | +// objEditor.ctrlPanel.remove(liveCB); |
---|
| 201 | +// objEditor.ctrlPanel.remove(hideCB); |
---|
| 202 | +// objEditor.ctrlPanel.remove(markCB); |
---|
| 203 | +// |
---|
| 204 | +// objEditor.ctrlPanel.remove(randomCB); |
---|
| 205 | +// objEditor.ctrlPanel.remove(speedupCB); |
---|
| 206 | +// objEditor.ctrlPanel.remove(rewindCB); |
---|
| 207 | +// |
---|
| 208 | +// objEditor.ctrlPanel.remove(resetButton); |
---|
| 209 | +// objEditor.ctrlPanel.remove(stepButton); |
---|
| 210 | +//// objEditor.ctrlPanel.remove(stepAllButton); |
---|
| 211 | +//// objEditor.ctrlPanel.remove(resetAllButton); |
---|
| 212 | +// objEditor.ctrlPanel.remove(link2masterCB); |
---|
| 213 | +// //objEditor.ctrlPanel.remove(flipVCB); |
---|
| 214 | +// //objEditor.ctrlPanel.remove(texresMenu); |
---|
| 215 | +// objEditor.ctrlPanel.remove(slowerButton); |
---|
| 216 | +// objEditor.ctrlPanel.remove(fasterButton); |
---|
| 217 | +// objEditor.ctrlPanel.remove(remarkButton); |
---|
167 | 218 | |
---|
168 | | - Remove(normalpushField); |
---|
| 219 | + objEditor.ctrlPanel.remove(setupPanel); |
---|
| 220 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 221 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
| 222 | + objEditor.ctrlPanel.remove(pushPanel); |
---|
| 223 | + //objEditor.ctrlPanel.remove(fillPanel); |
---|
| 224 | + |
---|
| 225 | + //Remove(normalpushField); |
---|
169 | 226 | } |
---|
170 | 227 | |
---|
171 | 228 | public ObjEditor GetEditor() |
---|
.. | .. |
---|
236 | 293 | //localCopy.parent = null; |
---|
237 | 294 | |
---|
238 | 295 | frame = new JFrame(); |
---|
| 296 | + frame.setUndecorated(true); |
---|
239 | 297 | objEditor = this; |
---|
240 | 298 | this.callee = callee; |
---|
241 | 299 | |
---|
.. | .. |
---|
269 | 327 | void SetupMenu() |
---|
270 | 328 | { |
---|
271 | 329 | 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...")); |
---|
| 330 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 331 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 332 | + fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 333 | + |
---|
| 334 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 335 | + Menu menu = new Menu("Import"); |
---|
| 336 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 337 | + importOBJItem.addActionListener(this); |
---|
| 338 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 339 | + import3DSItem.addActionListener(this); |
---|
| 340 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 341 | + importVRMLX3DItem.addActionListener(this); |
---|
| 342 | + menu.add("-"); |
---|
| 343 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 344 | + importGFDItem.addActionListener(this); |
---|
| 345 | + fileMenu.add(menu); |
---|
| 346 | + fileMenu.add("-"); |
---|
| 347 | + |
---|
| 348 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 349 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
277 | 350 | //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("-"); |
---|
| 351 | + fileMenu.add("-"); |
---|
| 352 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 353 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 354 | + fileMenu.add("-"); |
---|
282 | 355 | if (client.parent != null) |
---|
283 | 356 | { |
---|
284 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 357 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
285 | 358 | } else |
---|
286 | 359 | { |
---|
287 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 360 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
288 | 361 | } |
---|
289 | 362 | |
---|
| 363 | + newItem.addActionListener(this); |
---|
290 | 364 | loadItem.addActionListener(this); |
---|
291 | 365 | saveItem.addActionListener(this); |
---|
292 | 366 | saveAsItem.addActionListener(this); |
---|
.. | .. |
---|
295 | 369 | //povItem.addActionListener(this); |
---|
296 | 370 | closeItem.addActionListener(this); |
---|
297 | 371 | |
---|
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 | 372 | objectPanel = new JTabbedPane(); |
---|
354 | 373 | toolbarPanel = new JPanel(); |
---|
355 | 374 | toolbarPanel.setName("Toolbar"); |
---|
356 | | - treePanel = new JPanel(); |
---|
| 375 | + treePanel = new cGridBag(); |
---|
357 | 376 | treePanel.setName("Tree"); |
---|
358 | | - ctrlPanel = new cGridBag(); // new GridBagLayout()); |
---|
359 | | - ctrlPanel.setName("Edit"); |
---|
| 377 | + |
---|
| 378 | + editPanel = new cGridBag().setVertical(true); |
---|
| 379 | + editPanel.setName("Edit"); |
---|
| 380 | + |
---|
| 381 | + ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
| 382 | + |
---|
| 383 | + editCommandsPanel = new cGridBag(); |
---|
| 384 | + editPanel.add(editCommandsPanel); |
---|
| 385 | + editPanel.add(ctrlPanel); |
---|
| 386 | + |
---|
360 | 387 | materialPanel = new cGridBag().setVertical(true); |
---|
| 388 | + |
---|
361 | 389 | materialPanel.setName("Material"); |
---|
362 | 390 | /*JTextPane*/ |
---|
363 | 391 | infoarea = createTextPane(); |
---|
| 392 | + doc = infoarea.getStyledDocument(); |
---|
| 393 | + |
---|
364 | 394 | infoarea.setEditable(true); |
---|
365 | 395 | SetText(); |
---|
366 | 396 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
367 | 397 | // infoarea.setOpaque(false); |
---|
368 | 398 | // //infoarea.setForeground(textcolor); |
---|
369 | | - infoarea.setLineWrap(true); |
---|
370 | | - infoarea.setWrapStyleWord(true); |
---|
| 399 | +// TEXTAREA infoarea.setLineWrap(true); |
---|
| 400 | +// TEXTAREA infoarea.setWrapStyleWord(true); |
---|
371 | 401 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
372 | 402 | infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
373 | 403 | infoPanel.setName("Info"); |
---|
.. | .. |
---|
378 | 408 | mainPanel.setName("Main"); |
---|
379 | 409 | mainPanel.setContinuousLayout(true); |
---|
380 | 410 | mainPanel.setOneTouchExpandable(true); |
---|
381 | | - mainPanel.setDividerLocation(1.0); |
---|
382 | 411 | mainPanel.setDividerSize(9); |
---|
383 | | - mainPanel.setResizeWeight(0); |
---|
| 412 | + mainPanel.setDividerLocation(0.5); //1.0); |
---|
| 413 | + mainPanel.setResizeWeight(0.5); |
---|
384 | 414 | |
---|
385 | 415 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
386 | 416 | //mainPanel.setLayout(new GridBagLayout()); |
---|
387 | 417 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
388 | | - treePanel.setLayout(new GridBagLayout()); |
---|
389 | | - ctrlPanel.setLayout(new GridBagLayout()); |
---|
| 418 | +// treePanel.setLayout(new GridBagLayout()); |
---|
| 419 | + //ctrlPanel.setLayout(new GridBagLayout()); |
---|
390 | 420 | //materialPanel.setLayout(new GridBagLayout()); |
---|
391 | 421 | |
---|
392 | 422 | aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, |
---|
.. | .. |
---|
426 | 456 | static String newline = "\n"; |
---|
427 | 457 | protected static final String buttonString = "JButton"; |
---|
428 | 458 | StyledDocument doc; |
---|
429 | | - JTextArea infoarea; |
---|
| 459 | + JTextPane infoarea; |
---|
430 | 460 | |
---|
431 | 461 | void ClearInfo() |
---|
432 | 462 | { |
---|
.. | .. |
---|
449 | 479 | e.printStackTrace(); |
---|
450 | 480 | } |
---|
451 | 481 | |
---|
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(); |
---|
| 482 | +// String selection = infoarea.getText(); |
---|
| 483 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 484 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 485 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
456 | 486 | //clipboard.setContents(data, data); |
---|
457 | 487 | } |
---|
458 | 488 | |
---|
.. | .. |
---|
475 | 505 | //SendInfo("Name:", "bold"); |
---|
476 | 506 | if (sel.GetTextures() != null || debug) |
---|
477 | 507 | { |
---|
478 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 508 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
479 | 509 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
480 | 510 | if (sel.Size() > 0) |
---|
481 | 511 | { |
---|
482 | 512 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
483 | 513 | } |
---|
484 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 514 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
485 | 515 | if (debug) |
---|
486 | 516 | { |
---|
487 | 517 | try |
---|
.. | .. |
---|
493 | 523 | } |
---|
494 | 524 | |
---|
495 | 525 | if (full) |
---|
496 | | - si.SendInfo(" BBox: " + minima + " - " + maxima, "regular"); |
---|
| 526 | + { |
---|
| 527 | + si.SendInfo(" BBox min: " + minima, "regular"); |
---|
| 528 | + si.SendInfo(" BBox max: " + maxima, "regular"); |
---|
| 529 | + } |
---|
497 | 530 | |
---|
498 | 531 | if (sel.bRep != null) |
---|
499 | 532 | { |
---|
.. | .. |
---|
520 | 553 | } |
---|
521 | 554 | if (sel.support != null) |
---|
522 | 555 | { |
---|
523 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 556 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
524 | 557 | } |
---|
525 | 558 | if (sel.scriptnode != null) |
---|
526 | 559 | { |
---|
.. | .. |
---|
591 | 624 | { |
---|
592 | 625 | CameraPane.pointflow = (PointFlow) sel; |
---|
593 | 626 | } |
---|
| 627 | + |
---|
| 628 | + si.SendInfo("_____________________", "regular"); |
---|
| 629 | + si.SendInfo("", "regular"); |
---|
594 | 630 | } |
---|
595 | 631 | } |
---|
596 | 632 | |
---|
.. | .. |
---|
606 | 642 | } |
---|
607 | 643 | } |
---|
608 | 644 | |
---|
| 645 | +static GraphicsDevice device = GraphicsEnvironment |
---|
| 646 | + .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 647 | + |
---|
| 648 | + Rectangle keeprect; |
---|
| 649 | + cRadio radio; |
---|
| 650 | + |
---|
| 651 | +cButton keepButton; |
---|
| 652 | + cButton twoButton; // Full 3D |
---|
| 653 | + cButton sixButton; |
---|
| 654 | + cButton threeButton; |
---|
| 655 | + cButton sevenButton; |
---|
| 656 | + cButton fourButton; // full panel |
---|
| 657 | + cButton oneButton; // full XYZ |
---|
| 658 | + //cButton currentLayout; |
---|
| 659 | + |
---|
| 660 | + boolean maximized; |
---|
| 661 | + |
---|
| 662 | + void Minimize() |
---|
| 663 | + { |
---|
| 664 | + frame.setState(Frame.ICONIFIED); |
---|
| 665 | + } |
---|
| 666 | + |
---|
| 667 | + void Maximize() |
---|
| 668 | + { |
---|
| 669 | + if (maximized) |
---|
| 670 | + { |
---|
| 671 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 672 | + } |
---|
| 673 | + else |
---|
| 674 | + { |
---|
| 675 | + keeprect = frame.getBounds(); |
---|
| 676 | + Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 677 | + Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 678 | + frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 679 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 680 | + } |
---|
| 681 | + |
---|
| 682 | + maximized ^= true; |
---|
| 683 | + } |
---|
| 684 | + |
---|
609 | 685 | void ToggleFullScreen() |
---|
610 | 686 | { |
---|
611 | 687 | if (CameraPane.FULLSCREEN) |
---|
612 | 688 | { |
---|
613 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
614 | | - framePanel.add(bigThree); |
---|
615 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 689 | + device.setFullScreenWindow(null); |
---|
| 690 | + //frame.setVisible(false); |
---|
| 691 | +// frame.removeNotify(); |
---|
| 692 | +// frame.setUndecorated(false); |
---|
| 693 | +// frame.addNotify(); |
---|
| 694 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 695 | + |
---|
| 696 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 697 | +// X framePanel.add(bigThree); |
---|
| 698 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 699 | + framePanel.setDividerLocation(1); |
---|
| 700 | + |
---|
| 701 | + //frame.setVisible(true); |
---|
| 702 | + radio.layout = keepButton; |
---|
| 703 | + //theFrame = null; |
---|
| 704 | + keepButton = null; |
---|
| 705 | + radio.layout.doClick(); |
---|
| 706 | + |
---|
616 | 707 | } else |
---|
617 | 708 | { |
---|
618 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
619 | | - framePanel.remove(bigThree); |
---|
620 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 709 | + keepButton = radio.layout; |
---|
| 710 | + //keeprect = frame.getBounds(); |
---|
| 711 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 712 | +// frame.getToolkit().getScreenSize().height); |
---|
| 713 | + //frame.setVisible(false); |
---|
| 714 | + device.setFullScreenWindow(frame); |
---|
| 715 | +// frame.removeNotify(); |
---|
| 716 | +// frame.setUndecorated(true); |
---|
| 717 | +// frame.addNotify(); |
---|
| 718 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 719 | +// X framePanel.remove(bigThree); |
---|
| 720 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 721 | + framePanel.setDividerLocation(0); |
---|
| 722 | + |
---|
| 723 | + radio.layout = twoButton; |
---|
| 724 | + radio.layout.doClick(); |
---|
| 725 | + //frame.setVisible(true); |
---|
621 | 726 | } |
---|
| 727 | + |
---|
622 | 728 | cameraView.ToggleFullScreen(); |
---|
623 | 729 | } |
---|
624 | 730 | |
---|
625 | | - private JTextArea createTextPane() |
---|
| 731 | + private JTextPane createTextPane() |
---|
626 | 732 | { |
---|
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 | | - }; |
---|
| 733 | +// TEXTAREA String[] initString = |
---|
| 734 | +// { |
---|
| 735 | +// "This is an editable JTextPane, ", //regular |
---|
| 736 | +// "another ", //italic |
---|
| 737 | +// "styled ", //bold |
---|
| 738 | +// "text ", //small |
---|
| 739 | +// "component, ", //large |
---|
| 740 | +// "which supports embedded components..." + newline,//regular |
---|
| 741 | +// " " + newline, //button |
---|
| 742 | +// "...and embedded icons..." + newline, //regular |
---|
| 743 | +// " ", //icon |
---|
| 744 | +// newline + "JTextPane is a subclass of JEditorPane that " |
---|
| 745 | +// + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
| 746 | +// + "cover methods for interacting with those objects." |
---|
| 747 | +// }; |
---|
| 748 | +// |
---|
| 749 | +// String[] initStyles = |
---|
| 750 | +// { |
---|
| 751 | +// "regular", "italic", "bold", "small", "large", |
---|
| 752 | +// "regular", "button", "regular", "icon", |
---|
| 753 | +// "regular" |
---|
| 754 | +// }; |
---|
| 755 | +// |
---|
| 756 | +// JTextPane textPane = new JTextPane(); |
---|
| 757 | +// textPane.setEditable(true); |
---|
| 758 | +// /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
| 759 | +// addStylesToDocument(doc); |
---|
| 760 | +// |
---|
| 761 | +// try |
---|
| 762 | +// { |
---|
| 763 | +// for (int j = 0; j < 2; j++) |
---|
| 764 | +// { |
---|
| 765 | +// for (int i = 0; i < initString.length; i++) |
---|
| 766 | +// { |
---|
| 767 | +// doc.insertString(doc.getLength(), initString[i], |
---|
| 768 | +// doc.getStyle(initStyles[i])); |
---|
| 769 | +// } |
---|
| 770 | +// } |
---|
| 771 | +// } catch (BadLocationException ble) |
---|
| 772 | +// { |
---|
| 773 | +// System.err.println("Couldn't insert initial text into text pane."); |
---|
| 774 | +// } |
---|
642 | 775 | |
---|
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; |
---|
| 776 | + return new JTextPane(); // textPane; |
---|
671 | 777 | } |
---|
672 | 778 | |
---|
673 | 779 | protected void addStylesToDocument(StyledDocument doc) |
---|
.. | .. |
---|
720 | 826 | protected static ImageIcon createImageIcon(String path, |
---|
721 | 827 | String description) |
---|
722 | 828 | { |
---|
723 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 829 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
724 | 830 | if (imgURL != null) |
---|
725 | 831 | { |
---|
726 | 832 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
752 | 858 | // NumberSlider vDivsField; |
---|
753 | 859 | // JCheckBox endcaps; |
---|
754 | 860 | JCheckBox liveCB; |
---|
| 861 | + JCheckBox selectCB; |
---|
755 | 862 | JCheckBox hideCB; |
---|
756 | 863 | JCheckBox link2masterCB; |
---|
757 | 864 | JCheckBox markCB; |
---|
.. | .. |
---|
767 | 874 | JButton slowerButton; |
---|
768 | 875 | JButton fasterButton; |
---|
769 | 876 | JButton remarkButton; |
---|
| 877 | + |
---|
| 878 | + cGridBag editPanel; |
---|
| 879 | + cGridBag editCommandsPanel; |
---|
| 880 | + |
---|
| 881 | + cGridBag namePanel; |
---|
| 882 | + cGridBag setupPanel; |
---|
| 883 | + cGridBag setupPanel2; |
---|
| 884 | + cGridBag objectCommandsPanel; |
---|
| 885 | + cGridBag pushPanel; |
---|
| 886 | + cGridBag fillPanel; |
---|
770 | 887 | |
---|
771 | | - JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on) |
---|
| 888 | + JCheckBox AddCheckBox(cGridBag panel, String label, boolean on) |
---|
772 | 889 | { |
---|
773 | 890 | JCheckBox cb; |
---|
774 | 891 | |
---|
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); |
---|
| 892 | + panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
780 | 893 | cb.addItemListener(this); |
---|
781 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
782 | | - oe.aConstraints.gridwidth = 1; |
---|
783 | | - oe.aConstraints.gridx += 1; |
---|
784 | 894 | |
---|
785 | 895 | return cb; |
---|
786 | 896 | } |
---|
787 | 897 | |
---|
788 | | - cButton AddButton(ObjEditor oe, String label) |
---|
| 898 | + cButton AddButton(cGridBag panel, String label) |
---|
789 | 899 | { |
---|
790 | 900 | cButton cb; |
---|
791 | 901 | |
---|
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); |
---|
| 902 | + panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); |
---|
797 | 903 | cb.addActionListener(this); |
---|
798 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
799 | | - oe.aConstraints.gridwidth = 1; |
---|
800 | | - oe.aConstraints.gridx += 1; |
---|
801 | 904 | |
---|
802 | 905 | return cb; |
---|
803 | 906 | } |
---|
804 | 907 | |
---|
805 | | - JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item) |
---|
| 908 | + JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item) |
---|
806 | 909 | { |
---|
807 | 910 | JComboBox combo; |
---|
808 | 911 | |
---|
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; |
---|
| 912 | + panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
812 | 913 | combo.addActionListener(this); |
---|
813 | 914 | |
---|
814 | 915 | return combo; |
---|
815 | 916 | } |
---|
816 | 917 | |
---|
817 | | - cNumberSlider AddSlider(cGridBag ctrlPanel, String label, double min, double max, double current, double pow) |
---|
| 918 | + cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow) |
---|
818 | 919 | { |
---|
819 | 920 | cGridBag control = new cGridBag(); |
---|
820 | 921 | |
---|
.. | .. |
---|
826 | 927 | control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
827 | 928 | combo.setFloat(current); |
---|
828 | 929 | |
---|
829 | | - ctrlPanel.add(control); |
---|
| 930 | + panel.add(control); |
---|
830 | 931 | |
---|
831 | | - return combo; |
---|
| 932 | + return control; |
---|
832 | 933 | } |
---|
833 | 934 | |
---|
834 | | - cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current) |
---|
| 935 | + cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current) |
---|
835 | 936 | { |
---|
836 | 937 | cGridBag control = new cGridBag(); |
---|
837 | 938 | |
---|
.. | .. |
---|
839 | 940 | |
---|
840 | 941 | JLabel jlabel = new JLabel(label); |
---|
841 | 942 | 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); |
---|
| 943 | + control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 944 | + control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
844 | 945 | combo.setInteger(current); |
---|
845 | 946 | |
---|
846 | | - ctrlPanel.add(control); |
---|
| 947 | + panel.add(control); |
---|
847 | 948 | |
---|
848 | | - return combo; |
---|
| 949 | + return control; |
---|
849 | 950 | } |
---|
850 | 951 | |
---|
851 | 952 | JTextArea AddText(cGridBag ctrlPanel, String name) |
---|
852 | 953 | { |
---|
853 | 954 | JTextArea text; |
---|
854 | 955 | |
---|
855 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
856 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
857 | 956 | ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
858 | 957 | text.addCaretListener(this); |
---|
859 | | - aConstraints.gridx += 1; |
---|
860 | | - aConstraints.gridwidth = 1; |
---|
861 | 958 | |
---|
862 | 959 | return text; |
---|
863 | 960 | } |
---|
.. | .. |
---|
896 | 993 | |
---|
897 | 994 | /* |
---|
898 | 995 | */ |
---|
899 | | - void Return() // ObjEditor oe) |
---|
| 996 | + void Return0() // ObjEditor oe) |
---|
900 | 997 | { |
---|
901 | 998 | aConstraints.gridy += 1; |
---|
902 | 999 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
951 | 1048 | |
---|
952 | 1049 | void SetupUI2(ObjEditor oe) |
---|
953 | 1050 | { |
---|
954 | | -// oe.aConstraints.weightx = 0; |
---|
955 | | -// oe.aConstraints.weighty = 0; |
---|
956 | | -// oe.aConstraints.gridx = 0; |
---|
957 | | -// oe.aConstraints.gridy = 0; |
---|
958 | | - SetupName(oe); |
---|
| 1051 | + //SetupName(oe); |
---|
| 1052 | + |
---|
| 1053 | + namePanel = new cGridBag(); |
---|
| 1054 | + |
---|
| 1055 | + nameField = AddText(namePanel, copy.GetName()); |
---|
| 1056 | + namePanel.add(nameField); |
---|
| 1057 | + oe.ctrlPanel.add(namePanel); |
---|
| 1058 | + |
---|
| 1059 | + oe.ctrlPanel.Return(); |
---|
959 | 1060 | |
---|
960 | 1061 | if (!GroupEditor.allparams) |
---|
961 | 1062 | return; |
---|
962 | 1063 | |
---|
963 | | - liveCB = AddCheckBox(oe, "Live", copy.live); |
---|
964 | | - link2masterCB = AddCheckBox(oe, "Supp", copy.link2master); |
---|
965 | | - hideCB = AddCheckBox(oe, "Hide", copy.hide); |
---|
| 1064 | + setupPanel = new cGridBag().setVertical(false); |
---|
| 1065 | + |
---|
| 1066 | + liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
| 1067 | + liveCB.setToolTipText("Animate object"); |
---|
| 1068 | + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1069 | + selectCB.setToolTipText("Make object selectable"); |
---|
966 | 1070 | // 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"); |
---|
| 1071 | + hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 1072 | + hideCB.setToolTipText("Hide object"); |
---|
| 1073 | + markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
| 1074 | + markCB.setToolTipText("Set the animation target transform"); |
---|
| 1075 | + |
---|
| 1076 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1077 | + |
---|
| 1078 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
| 1079 | + rewindCB.setToolTipText("Rewind animation"); |
---|
| 1080 | + |
---|
| 1081 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 1082 | + randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
| 1083 | + |
---|
| 1084 | + if (Globals.ADVANCED) |
---|
| 1085 | + { |
---|
| 1086 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
| 1087 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1088 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
| 1089 | + speedupCB.setToolTipText("Option motion capture"); |
---|
| 1090 | + } |
---|
| 1091 | + |
---|
| 1092 | + oe.ctrlPanel.add(setupPanel); |
---|
| 1093 | + oe.ctrlPanel.Return(); |
---|
| 1094 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1095 | + oe.ctrlPanel.Return(); |
---|
| 1096 | + |
---|
| 1097 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
| 1098 | + |
---|
| 1099 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
| 1100 | + resetButton.setToolTipText("Jump to frame zero"); |
---|
| 1101 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
| 1102 | + stepButton.setToolTipText("Step one frame"); |
---|
973 | 1103 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
974 | 1104 | // stepAllButton = AddButton(oe, "Step All"); |
---|
975 | | - speedupCB = AddCheckBox(oe, "Speed", copy.speedup); |
---|
976 | 1105 | // Return(); |
---|
977 | | - slowerButton = AddButton(oe, "Slow"); |
---|
978 | | - fasterButton = AddButton(oe, "Fast"); |
---|
979 | | - remarkButton = AddButton(oe, "Rem"); |
---|
| 1106 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
| 1107 | + slowerButton.setToolTipText("Decrease animation speed"); |
---|
| 1108 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
| 1109 | + fasterButton.setToolTipText("Increase animation speed"); |
---|
| 1110 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
| 1111 | + remarkButton.setToolTipText("Set the current transform as the target"); |
---|
980 | 1112 | |
---|
981 | | - //Return(); |
---|
| 1113 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
| 1114 | + oe.ctrlPanel.Return(); |
---|
982 | 1115 | |
---|
983 | | - //normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1); |
---|
| 1116 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
| 1117 | + normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
984 | 1118 | //Return(); |
---|
| 1119 | + |
---|
| 1120 | + oe.ctrlPanel.Return(); |
---|
985 | 1121 | |
---|
986 | 1122 | // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2); |
---|
987 | 1123 | // ObjEditor.aConstraints.gridx += 1; |
---|
.. | .. |
---|
1076 | 1212 | oe.aConstraints.gridwidth = 1; |
---|
1077 | 1213 | /**/ |
---|
1078 | 1214 | nameField = AddText(oe.ctrlPanel, copy.GetName()); |
---|
1079 | | - Return(); |
---|
| 1215 | + oe.ctrlPanel.Return(); |
---|
1080 | 1216 | |
---|
1081 | 1217 | //ctrlPanel.add(textureButton = new Button("Texture...")); |
---|
1082 | 1218 | //textureButton.setEnabled(false); |
---|
.. | .. |
---|
1180 | 1316 | //worldPanel.setName("World"); |
---|
1181 | 1317 | centralPanel = new cGridBag(); |
---|
1182 | 1318 | centralPanel.preferredWidth = 20; |
---|
1183 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1184 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1319 | + |
---|
| 1320 | + if (Globals.ADVANCED) |
---|
| 1321 | + { |
---|
| 1322 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1323 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1185 | 1324 | |
---|
1186 | 1325 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1187 | 1326 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1190 | 1329 | // cameraPanel.setDividerSize(9); |
---|
1191 | 1330 | cameraPanel.setResizeWeight(1.0); |
---|
1192 | 1331 | |
---|
| 1332 | + } |
---|
| 1333 | + |
---|
1193 | 1334 | centralPanel.add(cameraView); |
---|
| 1335 | + centralPanel.setFocusable(true); |
---|
1194 | 1336 | //frame.setJMenuBar(timelineMenubar); |
---|
1195 | 1337 | //centralPanel.add(timelinePanel); |
---|
1196 | 1338 | |
---|
.. | .. |
---|
1253 | 1395 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1254 | 1396 | //tmp.setName("Edit"); |
---|
1255 | 1397 | objectPanel.add(materialPanel); |
---|
1256 | | - JPanel north = new JPanel(new BorderLayout()); |
---|
1257 | | - north.setName("Edit"); |
---|
1258 | | - north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1259 | | - objectPanel.add(north); |
---|
| 1398 | +// JPanel north = new JPanel(new BorderLayout()); |
---|
| 1399 | +// north.setName("Edit"); |
---|
| 1400 | +// north.add(ctrlPanel, BorderLayout.NORTH); |
---|
| 1401 | +// objectPanel.add(north); |
---|
| 1402 | + objectPanel.add(editPanel); |
---|
1260 | 1403 | objectPanel.add(infoPanel); |
---|
1261 | 1404 | |
---|
1262 | 1405 | /* |
---|
.. | .. |
---|
1278 | 1421 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1279 | 1422 | |
---|
1280 | 1423 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1281 | | - scenePanel.preferredWidth = 7; |
---|
| 1424 | + scenePanel.preferredWidth = 6; |
---|
1282 | 1425 | |
---|
1283 | 1426 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1284 | 1427 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1384 | 1527 | |
---|
1385 | 1528 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1386 | 1529 | |
---|
1387 | | - frame.setSize(1024, 768); |
---|
1388 | | - frame.show(); |
---|
| 1530 | + frame.setSize(1280, 860); |
---|
| 1531 | + frame.setVisible(true); |
---|
1389 | 1532 | |
---|
| 1533 | + cameraView.requestFocusInWindow(); |
---|
| 1534 | + |
---|
1390 | 1535 | gridPanel.setDividerLocation(1.0); |
---|
1391 | 1536 | |
---|
1392 | 1537 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
1415 | 1560 | ctrlPanel.removeAll(); |
---|
1416 | 1561 | } |
---|
1417 | 1562 | |
---|
1418 | | - void SetupMaterial(cGridBag ctrlPanel) |
---|
| 1563 | + void SetupMaterial(cGridBag panel) |
---|
1419 | 1564 | { |
---|
1420 | 1565 | /* |
---|
1421 | 1566 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
.. | .. |
---|
1424 | 1569 | |
---|
1425 | 1570 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1426 | 1571 | |
---|
1427 | | - editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints); |
---|
| 1572 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1573 | + createMaterialButton.setToolTipText("Create material"); |
---|
1428 | 1574 | |
---|
1429 | 1575 | /* |
---|
1430 | 1576 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1431 | 1577 | */ |
---|
1432 | 1578 | |
---|
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); |
---|
| 1579 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1580 | + clearMaterialButton.setToolTipText("Clear material"); |
---|
| 1581 | + |
---|
| 1582 | + if (Globals.ADVANCED) |
---|
| 1583 | + { |
---|
| 1584 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1585 | + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
| 1586 | + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 1587 | + } |
---|
1437 | 1588 | |
---|
1438 | | - ctrlPanel.add(editBar); |
---|
| 1589 | + editBar.preferredHeight = 15; |
---|
| 1590 | + |
---|
| 1591 | + panel.add(editBar); |
---|
1439 | 1592 | |
---|
1440 | 1593 | /**/ |
---|
1441 | 1594 | //aConstraints.weighty = 0; |
---|
.. | .. |
---|
1484 | 1637 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1485 | 1638 | colorSection.add(shadowbias); |
---|
1486 | 1639 | |
---|
1487 | | - ctrlPanel.add(new JSeparator()); |
---|
| 1640 | + panel.add(new JSeparator()); |
---|
1488 | 1641 | |
---|
1489 | | - ctrlPanel.add(colorSection); |
---|
| 1642 | + panel.add(colorSection); |
---|
1490 | 1643 | |
---|
1491 | 1644 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1492 | 1645 | |
---|
.. | .. |
---|
1534 | 1687 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1535 | 1688 | diffuseSection.add(fakedepth); |
---|
1536 | 1689 | |
---|
1537 | | - ctrlPanel.add(new JSeparator()); |
---|
| 1690 | + panel.add(new JSeparator()); |
---|
1538 | 1691 | |
---|
1539 | | - ctrlPanel.add(diffuseSection); |
---|
| 1692 | + panel.add(diffuseSection); |
---|
1540 | 1693 | |
---|
1541 | 1694 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1542 | 1695 | |
---|
.. | .. |
---|
1572 | 1725 | velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1573 | 1726 | specularSection.add(velvet); |
---|
1574 | 1727 | |
---|
1575 | | - shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1); |
---|
| 1728 | + shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1); |
---|
1576 | 1729 | //Return(); |
---|
1577 | 1730 | // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints); |
---|
1578 | 1731 | // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
.. | .. |
---|
1585 | 1738 | // aConstraints.gridwidth = 1; |
---|
1586 | 1739 | |
---|
1587 | 1740 | |
---|
1588 | | - ctrlPanel.add(new JSeparator()); |
---|
| 1741 | + panel.add(new JSeparator()); |
---|
1589 | 1742 | |
---|
1590 | | - ctrlPanel.add(specularSection); |
---|
| 1743 | + panel.add(specularSection); |
---|
1591 | 1744 | |
---|
1592 | 1745 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1593 | 1746 | |
---|
.. | .. |
---|
1617 | 1770 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1618 | 1771 | globalSection.add(opacity); |
---|
1619 | 1772 | |
---|
1620 | | - ctrlPanel.add(new JSeparator()); |
---|
| 1773 | + panel.add(new JSeparator()); |
---|
1621 | 1774 | |
---|
1622 | | - ctrlPanel.add(globalSection); |
---|
| 1775 | + panel.add(globalSection); |
---|
1623 | 1776 | |
---|
1624 | 1777 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1625 | 1778 | |
---|
.. | .. |
---|
1661 | 1814 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1662 | 1815 | textureSection.add(opacityPower); |
---|
1663 | 1816 | |
---|
1664 | | - ctrlPanel.add(new JSeparator()); |
---|
| 1817 | + panel.add(new JSeparator()); |
---|
1665 | 1818 | |
---|
1666 | | - ctrlPanel.add(textureSection); |
---|
| 1819 | + panel.add(textureSection); |
---|
1667 | 1820 | |
---|
1668 | 1821 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1669 | 1822 | |
---|
.. | .. |
---|
1700 | 1853 | opacityPowerField.addChangeListener(this); |
---|
1701 | 1854 | /**/ |
---|
1702 | 1855 | |
---|
1703 | | - resetSlidersButton.addActionListener(this); |
---|
1704 | 1856 | clearMaterialButton.addActionListener(this); |
---|
1705 | 1857 | createMaterialButton.addActionListener(this); |
---|
1706 | | - |
---|
1707 | | - propagateToggle.addItemListener(this); |
---|
1708 | | - multiplyToggle.addItemListener(this); |
---|
| 1858 | + |
---|
| 1859 | + if (Globals.ADVANCED) |
---|
| 1860 | + { |
---|
| 1861 | + resetSlidersButton.addActionListener(this); |
---|
| 1862 | + propagateToggle.addItemListener(this); |
---|
| 1863 | + multiplyToggle.addItemListener(this); |
---|
| 1864 | + } |
---|
1709 | 1865 | } |
---|
1710 | 1866 | |
---|
1711 | 1867 | void DropFile(java.io.File[] files, boolean textures) |
---|
.. | .. |
---|
1876 | 2032 | |
---|
1877 | 2033 | //? flashIt = false; |
---|
1878 | 2034 | CameraPane pane = (CameraPane) cameraView; |
---|
1879 | | - pane.clickStart(location.x, location.y, 0); |
---|
| 2035 | + pane.clickStart(location.x, location.y, 0, 0); |
---|
1880 | 2036 | pane.clickEnd(location.x, location.y, 0, true); |
---|
1881 | 2037 | |
---|
1882 | 2038 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
1925 | 2081 | e2.printStackTrace(); |
---|
1926 | 2082 | } |
---|
1927 | 2083 | } |
---|
| 2084 | + |
---|
1928 | 2085 | LoadJMEThread loadThread; |
---|
1929 | 2086 | |
---|
1930 | 2087 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
1982 | 2139 | //LoadFile0(filename, converter); |
---|
1983 | 2140 | } |
---|
1984 | 2141 | } |
---|
| 2142 | + |
---|
1985 | 2143 | LoadOBJThread loadObjThread; |
---|
1986 | 2144 | |
---|
1987 | 2145 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2060 | 2218 | |
---|
2061 | 2219 | void LoadObjFile(String fullname) |
---|
2062 | 2220 | { |
---|
2063 | | - /* |
---|
| 2221 | + System.out.println("Loading " + fullname); |
---|
| 2222 | + /**/ |
---|
2064 | 2223 | //lastFilename = fullname; |
---|
2065 | 2224 | if(loadObjThread == null) |
---|
2066 | 2225 | { |
---|
2067 | | - loadObjThread = new LoadOBJThread(); |
---|
2068 | | - loadObjThread.start(); |
---|
| 2226 | + loadObjThread = new LoadOBJThread(); |
---|
| 2227 | + loadObjThread.start(); |
---|
2069 | 2228 | } |
---|
2070 | 2229 | |
---|
2071 | 2230 | loadObjThread.add(fullname); |
---|
2072 | | - */ |
---|
| 2231 | + /**/ |
---|
2073 | 2232 | |
---|
2074 | | - System.out.println("Loading " + fullname); |
---|
2075 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2233 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2076 | 2234 | } |
---|
2077 | 2235 | |
---|
2078 | 2236 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2333 | 2491 | |
---|
2334 | 2492 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2335 | 2493 | { |
---|
2336 | | - if (GrafreeD.standAlone) |
---|
| 2494 | + if (Grafreed.standAlone) |
---|
2337 | 2495 | { |
---|
2338 | 2496 | /**/ |
---|
2339 | 2497 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2340 | | - browser.show(); |
---|
| 2498 | + browser.setVisible(true); |
---|
2341 | 2499 | String filename = browser.getFile(); |
---|
2342 | 2500 | if (filename != null && filename.length() > 0) |
---|
2343 | 2501 | { |
---|
.. | .. |
---|
2482 | 2640 | } |
---|
2483 | 2641 | if (input == null) |
---|
2484 | 2642 | { |
---|
| 2643 | + new Exception().printStackTrace(); |
---|
2485 | 2644 | System.exit(0); |
---|
2486 | 2645 | } |
---|
2487 | 2646 | |
---|
.. | .. |
---|
2696 | 2855 | return; |
---|
2697 | 2856 | } |
---|
2698 | 2857 | |
---|
2699 | | - multiplyToggle.setSelected(mat.multiply); |
---|
| 2858 | + if (multiplyToggle != null) |
---|
| 2859 | + multiplyToggle.setSelected(mat.multiply); |
---|
2700 | 2860 | |
---|
2701 | 2861 | assert (object.projectedVertices != null); |
---|
2702 | 2862 | |
---|
.. | .. |
---|
2911 | 3071 | frame.validate(); |
---|
2912 | 3072 | |
---|
2913 | 3073 | return; |
---|
2914 | | - } else if (event.getSource() == toggleRandomItem) |
---|
| 3074 | + } else if (event.getSource() == toggleSwitchItem) |
---|
2915 | 3075 | { |
---|
2916 | | - cameraView.ToggleRandom(); |
---|
| 3076 | + cameraView.ToggleSwitch(); |
---|
2917 | 3077 | cameraView.repaint(); |
---|
2918 | 3078 | return; |
---|
2919 | 3079 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
2942 | 3102 | { |
---|
2943 | 3103 | copy.live ^= true; |
---|
2944 | 3104 | return; |
---|
| 3105 | + } else if (event.getSource() == selectCB) |
---|
| 3106 | + { |
---|
| 3107 | + copy.dontselect ^= true; |
---|
| 3108 | + return; |
---|
2945 | 3109 | } else if (event.getSource() == hideCB) |
---|
2946 | 3110 | { |
---|
2947 | 3111 | copy.hide ^= true; |
---|
.. | .. |
---|
2956 | 3120 | if (event.getSource() == randomCB) |
---|
2957 | 3121 | { |
---|
2958 | 3122 | copy.random ^= true; |
---|
| 3123 | + objEditor.refreshContents(); |
---|
2959 | 3124 | return; |
---|
2960 | 3125 | } |
---|
2961 | 3126 | if (event.getSource() == speedupCB) |
---|
.. | .. |
---|
2979 | 3144 | |
---|
2980 | 3145 | public void actionPerformed(ActionEvent event) |
---|
2981 | 3146 | { |
---|
| 3147 | + Object source = event.getSource(); |
---|
2982 | 3148 | // SCRIPT DIALOG |
---|
2983 | | - if (event.getSource() == okbutton) |
---|
| 3149 | + if (source == okbutton) |
---|
2984 | 3150 | { |
---|
2985 | 3151 | textpanel.setVisible(false); |
---|
2986 | 3152 | textpanel.remove(textarea); |
---|
.. | .. |
---|
2992 | 3158 | textarea = null; |
---|
2993 | 3159 | textpanel = null; |
---|
2994 | 3160 | } |
---|
2995 | | - if (event.getSource() == cancelbutton) |
---|
| 3161 | + if (source == cancelbutton) |
---|
2996 | 3162 | { |
---|
2997 | 3163 | textpanel.setVisible(false); |
---|
2998 | 3164 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3004 | 3170 | //applySelf(); |
---|
3005 | 3171 | //client.refreshEditWindow(); |
---|
3006 | 3172 | //refreshContents(); |
---|
3007 | | - if (event.getSource() == nameField) |
---|
| 3173 | + if (source == nameField) |
---|
3008 | 3174 | { |
---|
3009 | 3175 | //System.out.println("ObjEditor " + event); |
---|
3010 | 3176 | applySelf0(true); |
---|
3011 | 3177 | //parent.applySelf(); |
---|
3012 | 3178 | objEditor.refreshContents(); |
---|
3013 | | - } else if (event.getSource() == resetButton) |
---|
| 3179 | + } else if (source == resetButton) |
---|
3014 | 3180 | { |
---|
3015 | 3181 | CameraPane.fullreset = true; |
---|
3016 | 3182 | copy.Reset(); // ResetMeshes(); |
---|
3017 | 3183 | copy.Touch(); |
---|
3018 | 3184 | objEditor.refreshContents(); |
---|
3019 | | - } else if (event.getSource() == stepItem) |
---|
| 3185 | + } else if (source == stepItem) |
---|
3020 | 3186 | { |
---|
3021 | 3187 | //cameraView.ONESTEP = true; |
---|
3022 | 3188 | Globals.ONESTEP = true; |
---|
3023 | 3189 | cameraView.repaint(); |
---|
3024 | 3190 | return; |
---|
3025 | | - } else if (event.getSource() == stepButton) |
---|
| 3191 | + } else if (source == stepButton) |
---|
3026 | 3192 | { |
---|
3027 | 3193 | copy.Step(); |
---|
3028 | 3194 | copy.Touch(); |
---|
3029 | 3195 | objEditor.refreshContents(); |
---|
3030 | | - } else if (event.getSource() == slowerButton) |
---|
| 3196 | + } else if (source == slowerButton) |
---|
3031 | 3197 | { |
---|
3032 | 3198 | copy.Slower(); |
---|
3033 | 3199 | copy.Touch(); |
---|
3034 | 3200 | objEditor.refreshContents(); |
---|
3035 | | - } else if (event.getSource() == fasterButton) |
---|
| 3201 | + } else if (source == fasterButton) |
---|
3036 | 3202 | { |
---|
3037 | 3203 | copy.Faster(); |
---|
3038 | 3204 | copy.Touch(); |
---|
3039 | 3205 | objEditor.refreshContents(); |
---|
3040 | | - } else if (event.getSource() == remarkButton) |
---|
| 3206 | + } else if (source == remarkButton) |
---|
3041 | 3207 | { |
---|
3042 | 3208 | copy.Remark(); |
---|
3043 | 3209 | copy.Touch(); |
---|
3044 | 3210 | objEditor.refreshContents(); |
---|
3045 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3211 | + } else if (source == stepAllButton) |
---|
3046 | 3212 | { |
---|
3047 | 3213 | copy.StepAll(); |
---|
3048 | 3214 | copy.Touch(); |
---|
3049 | 3215 | objEditor.refreshContents(); |
---|
3050 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3216 | + } else if (source == resetAllButton) |
---|
3051 | 3217 | { |
---|
3052 | 3218 | //CameraPane.fullreset = true; |
---|
3053 | 3219 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3080 | 3246 | // Close(); |
---|
3081 | 3247 | // } |
---|
3082 | 3248 | // else |
---|
3083 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3249 | + if (source == resetSlidersButton) |
---|
3084 | 3250 | { |
---|
3085 | 3251 | ResetSliders(); |
---|
3086 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3252 | + } else if (source == clearMaterialButton) |
---|
3087 | 3253 | { |
---|
3088 | 3254 | ClearMaterial(); |
---|
3089 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3255 | + } else if (source == createMaterialButton) |
---|
3090 | 3256 | { |
---|
3091 | 3257 | CreateMaterial(); |
---|
3092 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3258 | + } else if (source == clearPanelButton) |
---|
3093 | 3259 | { |
---|
3094 | 3260 | copy.ClearUI(); |
---|
3095 | 3261 | refreshContents(true); |
---|
3096 | | - } /* |
---|
3097 | | - } |
---|
3098 | | - |
---|
3099 | | - public boolean action(Event event, Object arg) |
---|
3100 | | - { |
---|
3101 | | - */ else if (event.getSource() == closeItem) |
---|
| 3262 | + } else if (source == importGFDItem) |
---|
| 3263 | + { |
---|
| 3264 | + ImportGFD(); |
---|
| 3265 | + } else |
---|
| 3266 | + if (source == importVRMLX3DItem) |
---|
| 3267 | + { |
---|
| 3268 | + ImportVRMLX3D(); |
---|
| 3269 | + } else |
---|
| 3270 | + if (source == import3DSItem) |
---|
| 3271 | + { |
---|
| 3272 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3273 | + } else |
---|
| 3274 | + if (source == importOBJItem) |
---|
| 3275 | + { |
---|
| 3276 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3277 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3278 | + browser.setVisible(true); |
---|
| 3279 | + String filename = browser.getFile(); |
---|
| 3280 | + if (filename != null && filename.length() > 0) |
---|
| 3281 | + { |
---|
| 3282 | + String fullname = browser.getDirectory() + filename; |
---|
| 3283 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3284 | + } |
---|
| 3285 | + } else |
---|
| 3286 | + if (source == closeItem) |
---|
3102 | 3287 | { |
---|
3103 | 3288 | Close(); |
---|
3104 | 3289 | //return true; |
---|
3105 | | - } else if (event.getSource() == loadItem) |
---|
| 3290 | + } else if (source == loadItem) |
---|
3106 | 3291 | { |
---|
3107 | 3292 | load(); |
---|
3108 | 3293 | //return true; |
---|
3109 | | - } else if (event.getSource() == saveItem) |
---|
| 3294 | + } else if (source == newItem) |
---|
| 3295 | + { |
---|
| 3296 | + New(); |
---|
| 3297 | + } else if (source == saveItem) |
---|
3110 | 3298 | { |
---|
3111 | 3299 | save(); |
---|
3112 | 3300 | //return true; |
---|
3113 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3301 | + } else if (source == saveAsItem) |
---|
3114 | 3302 | { |
---|
3115 | 3303 | saveAs(); |
---|
3116 | 3304 | //return true; |
---|
3117 | | - } else if (event.getSource() == reexportItem) |
---|
| 3305 | + } else if (source == reexportItem) |
---|
3118 | 3306 | { |
---|
3119 | 3307 | reexport(); |
---|
3120 | 3308 | //return true; |
---|
3121 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3309 | + } else if (source == exportAsItem) |
---|
3122 | 3310 | { |
---|
3123 | 3311 | export(); |
---|
3124 | 3312 | //return true; |
---|
3125 | | - } else if (event.getSource() == povItem) |
---|
| 3313 | + } else if (source == povItem) |
---|
3126 | 3314 | { |
---|
3127 | 3315 | generatePOV(); |
---|
3128 | 3316 | //return true; |
---|
3129 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3317 | + } else if (source == zBufferItem) |
---|
3130 | 3318 | { |
---|
3131 | 3319 | try |
---|
3132 | 3320 | { |
---|
.. | .. |
---|
3148 | 3336 | cameraView.repaint(); |
---|
3149 | 3337 | //return true; |
---|
3150 | 3338 | } |
---|
3151 | | - */ else if (event.getSource() == editCameraItem) |
---|
3152 | | - { |
---|
3153 | | - cameraView.ProtectCamera(); |
---|
3154 | | - cameraView.repaint(); |
---|
3155 | | - return; |
---|
3156 | | - } else if (event.getSource() == revertCameraItem) |
---|
3157 | | - { |
---|
3158 | | - cameraView.RevertCamera(); |
---|
3159 | | - cameraView.repaint(); |
---|
3160 | | - return; |
---|
3161 | | -// } else if (event.getSource() == textureButton) |
---|
3162 | | -// { |
---|
3163 | | -// return; // true; |
---|
3164 | | - } else // combos... |
---|
3165 | | - if (event.getSource() == texresMenu) |
---|
| 3339 | + */ else // combos... |
---|
| 3340 | + if (source == texresMenu) |
---|
3166 | 3341 | { |
---|
3167 | 3342 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3168 | 3343 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3174 | 3349 | } |
---|
3175 | 3350 | } |
---|
3176 | 3351 | |
---|
| 3352 | + void New() |
---|
| 3353 | + { |
---|
| 3354 | + while (copy.Size() > 1) |
---|
| 3355 | + { |
---|
| 3356 | + copy.remove(1); |
---|
| 3357 | + } |
---|
| 3358 | + |
---|
| 3359 | + ResetModel(); |
---|
| 3360 | + objEditor.refreshContents(); |
---|
| 3361 | + } |
---|
| 3362 | + |
---|
| 3363 | + static public byte[] Compress(Object3D o) |
---|
| 3364 | + { |
---|
| 3365 | + try |
---|
| 3366 | + { |
---|
| 3367 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3368 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3369 | + ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3370 | + |
---|
| 3371 | + Object3D parent = o.parent; |
---|
| 3372 | + o.parent = null; |
---|
| 3373 | + |
---|
| 3374 | + out.writeObject(o); |
---|
| 3375 | + |
---|
| 3376 | + o.parent = parent; |
---|
| 3377 | + |
---|
| 3378 | + out.flush(); |
---|
| 3379 | + |
---|
| 3380 | + zstream.close(); |
---|
| 3381 | + out.close(); |
---|
| 3382 | + |
---|
| 3383 | + return baos.toByteArray(); |
---|
| 3384 | + } catch (Exception e) |
---|
| 3385 | + { |
---|
| 3386 | + System.err.println(e); |
---|
| 3387 | + return null; |
---|
| 3388 | + } |
---|
| 3389 | + } |
---|
| 3390 | + |
---|
| 3391 | + static public Object Uncompress(byte[] bytes) |
---|
| 3392 | + { |
---|
| 3393 | + System.out.println("#bytes = " + bytes.length); |
---|
| 3394 | + try |
---|
| 3395 | + { |
---|
| 3396 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3397 | + java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3398 | + ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3399 | + Object obj = in.readObject(); |
---|
| 3400 | + in.close(); |
---|
| 3401 | + |
---|
| 3402 | + return obj; |
---|
| 3403 | + } catch (Exception e) |
---|
| 3404 | + { |
---|
| 3405 | + System.err.println(e); |
---|
| 3406 | + return null; |
---|
| 3407 | + } |
---|
| 3408 | + } |
---|
| 3409 | + |
---|
| 3410 | + static public Object clone(Object o) |
---|
| 3411 | + { |
---|
| 3412 | + try |
---|
| 3413 | + { |
---|
| 3414 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3415 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3416 | + |
---|
| 3417 | + out.writeObject(o); |
---|
| 3418 | + |
---|
| 3419 | + out.flush(); |
---|
| 3420 | + out.close(); |
---|
| 3421 | + |
---|
| 3422 | + byte[] bytes = baos.toByteArray(); |
---|
| 3423 | + |
---|
| 3424 | + System.out.println("clone = " + bytes.length); |
---|
| 3425 | + |
---|
| 3426 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3427 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3428 | + Object obj = in.readObject(); |
---|
| 3429 | + in.close(); |
---|
| 3430 | + |
---|
| 3431 | + return obj; |
---|
| 3432 | + } catch (Exception e) |
---|
| 3433 | + { |
---|
| 3434 | + System.err.println(e); |
---|
| 3435 | + return null; |
---|
| 3436 | + } |
---|
| 3437 | + } |
---|
| 3438 | + |
---|
| 3439 | + cRadio GetCurrentTab() |
---|
| 3440 | + { |
---|
| 3441 | + cRadio ab; |
---|
| 3442 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3443 | + { |
---|
| 3444 | + ab = (cRadio)e.nextElement(); |
---|
| 3445 | + if(ab.GetObject() == copy) |
---|
| 3446 | + { |
---|
| 3447 | + return ab; |
---|
| 3448 | + } |
---|
| 3449 | + } |
---|
| 3450 | + |
---|
| 3451 | + return null; |
---|
| 3452 | + } |
---|
| 3453 | + |
---|
| 3454 | + java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3455 | + |
---|
| 3456 | + public void Save() |
---|
| 3457 | + { |
---|
| 3458 | + System.err.println("Save"); |
---|
| 3459 | + |
---|
| 3460 | + cRadio tab = GetCurrentTab(); |
---|
| 3461 | + |
---|
| 3462 | + boolean temp = CameraPane.SWITCH; |
---|
| 3463 | + CameraPane.SWITCH = false; |
---|
| 3464 | + |
---|
| 3465 | + copy.ExtractBigData(hashtable); |
---|
| 3466 | + |
---|
| 3467 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3468 | + tab.graphs[tab.undoindex++] = Compress(copy); |
---|
| 3469 | + |
---|
| 3470 | + copy.RestoreBigData(hashtable); |
---|
| 3471 | + |
---|
| 3472 | + CameraPane.SWITCH = temp; |
---|
| 3473 | + |
---|
| 3474 | + //assert(hashtable.isEmpty()); |
---|
| 3475 | + |
---|
| 3476 | + for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3477 | + { |
---|
| 3478 | + tab.graphs[i] = null; |
---|
| 3479 | + } |
---|
| 3480 | + |
---|
| 3481 | + // test save |
---|
| 3482 | + if (false) |
---|
| 3483 | + { |
---|
| 3484 | + try |
---|
| 3485 | + { |
---|
| 3486 | + FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3487 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3488 | + |
---|
| 3489 | + p.writeObject(copy); |
---|
| 3490 | + |
---|
| 3491 | + p.flush(); |
---|
| 3492 | + |
---|
| 3493 | + ostream.close(); |
---|
| 3494 | + } catch (Exception e) |
---|
| 3495 | + { |
---|
| 3496 | + e.printStackTrace(); |
---|
| 3497 | + } |
---|
| 3498 | + } |
---|
| 3499 | + } |
---|
| 3500 | + |
---|
| 3501 | + void CopyChanged(Object3D obj) |
---|
| 3502 | + { |
---|
| 3503 | + boolean temp = CameraPane.SWITCH; |
---|
| 3504 | + CameraPane.SWITCH = false; |
---|
| 3505 | + |
---|
| 3506 | + copy.ExtractBigData(hashtable); |
---|
| 3507 | + |
---|
| 3508 | + copy.clear(); |
---|
| 3509 | + |
---|
| 3510 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3511 | + { |
---|
| 3512 | + copy.add(obj.get(i)); |
---|
| 3513 | + } |
---|
| 3514 | + |
---|
| 3515 | + copy.RestoreBigData(hashtable); |
---|
| 3516 | + |
---|
| 3517 | + CameraPane.SWITCH = temp; |
---|
| 3518 | + |
---|
| 3519 | + //assert(hashtable.isEmpty()); |
---|
| 3520 | + |
---|
| 3521 | + copy.Touch(); |
---|
| 3522 | + |
---|
| 3523 | + ResetModel(); |
---|
| 3524 | + copy.HardTouch(); // recompile? |
---|
| 3525 | + |
---|
| 3526 | + cRadio ab; |
---|
| 3527 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3528 | + { |
---|
| 3529 | + ab = (cRadio)e.nextElement(); |
---|
| 3530 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3531 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3532 | + if (test != null) |
---|
| 3533 | + { |
---|
| 3534 | + test.editWindow = ab.object.editWindow; |
---|
| 3535 | + ab.object = test; |
---|
| 3536 | + } |
---|
| 3537 | + } |
---|
| 3538 | + |
---|
| 3539 | + refreshContents(); |
---|
| 3540 | + } |
---|
| 3541 | + |
---|
| 3542 | + public void Undo() |
---|
| 3543 | + { |
---|
| 3544 | + System.err.println("Undo"); |
---|
| 3545 | + |
---|
| 3546 | + cRadio tab = GetCurrentTab(); |
---|
| 3547 | + |
---|
| 3548 | + if (tab.undoindex == 0) |
---|
| 3549 | + { |
---|
| 3550 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3551 | + return; |
---|
| 3552 | + } |
---|
| 3553 | + |
---|
| 3554 | + if (tab.graphs[tab.undoindex] == null) |
---|
| 3555 | + { |
---|
| 3556 | + Save(); |
---|
| 3557 | + tab.undoindex -= 1; |
---|
| 3558 | + } |
---|
| 3559 | + |
---|
| 3560 | + tab.undoindex -= 1; |
---|
| 3561 | + |
---|
| 3562 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3563 | + } |
---|
| 3564 | + |
---|
| 3565 | + public void Redo() |
---|
| 3566 | + { |
---|
| 3567 | + cRadio tab = GetCurrentTab(); |
---|
| 3568 | + |
---|
| 3569 | + if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3570 | + { |
---|
| 3571 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3572 | + return; |
---|
| 3573 | + } |
---|
| 3574 | + |
---|
| 3575 | + tab.undoindex += 1; |
---|
| 3576 | + |
---|
| 3577 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3578 | + } |
---|
| 3579 | + |
---|
| 3580 | + void ImportGFD() |
---|
| 3581 | + { |
---|
| 3582 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 3583 | + browser.show(); |
---|
| 3584 | + String filename = browser.getFile(); |
---|
| 3585 | + if (filename != null && filename.length() > 0) |
---|
| 3586 | + { |
---|
| 3587 | + String fullname = browser.getDirectory() + filename; |
---|
| 3588 | + |
---|
| 3589 | + //Object3D readobj = |
---|
| 3590 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 3591 | + //makeSomething(readobj); |
---|
| 3592 | + } |
---|
| 3593 | + } |
---|
| 3594 | + |
---|
| 3595 | + void ImportVRMLX3D() |
---|
| 3596 | + { |
---|
| 3597 | + if (Grafreed.standAlone) |
---|
| 3598 | + { |
---|
| 3599 | + /**/ |
---|
| 3600 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 3601 | + browser.show(); |
---|
| 3602 | + String filename = browser.getFile(); |
---|
| 3603 | + if (filename != null && filename.length() > 0) |
---|
| 3604 | + { |
---|
| 3605 | + String fullname = browser.getDirectory() + filename; |
---|
| 3606 | + LoadVRMLX3D(fullname); |
---|
| 3607 | + } |
---|
| 3608 | + /**/ |
---|
| 3609 | + } |
---|
| 3610 | + } |
---|
| 3611 | + |
---|
3177 | 3612 | void ToggleAnimation() |
---|
3178 | 3613 | { |
---|
3179 | 3614 | if (!Globals.ANIMATION) |
---|
3180 | 3615 | { |
---|
3181 | 3616 | FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); |
---|
3182 | | - browser.show(); |
---|
| 3617 | + browser.setVisible(true); |
---|
3183 | 3618 | String filename = browser.getFile(); |
---|
3184 | 3619 | if (filename != null && filename.length() > 0) |
---|
3185 | 3620 | { |
---|
.. | .. |
---|
3189 | 3624 | |
---|
3190 | 3625 | Globals.ANIMATION ^= true; |
---|
3191 | 3626 | |
---|
3192 | | - GrafreeD.wav.cursor = 0; |
---|
3193 | | - GrafreeD.wav.loop = 0; |
---|
| 3627 | + Grafreed.wav.cursor = 0; |
---|
| 3628 | + Grafreed.wav.loop = 0; |
---|
3194 | 3629 | } |
---|
3195 | 3630 | } else |
---|
3196 | 3631 | { |
---|
.. | .. |
---|
3240 | 3675 | void CreateMaterial() |
---|
3241 | 3676 | { |
---|
3242 | 3677 | //copy.ClearMaterial(); // PATCH |
---|
3243 | | - copy.CreateMaterialS(multiplyToggle.isSelected()); |
---|
| 3678 | + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); |
---|
3244 | 3679 | if (copy.selection.size() > 0) |
---|
3245 | 3680 | //SetMaterial(copy); |
---|
3246 | 3681 | { |
---|
.. | .. |
---|
3299 | 3734 | { |
---|
3300 | 3735 | copy.ResetBlockLoop(); // temporary problem |
---|
3301 | 3736 | |
---|
3302 | | - boolean random = CameraPane.RANDOM; |
---|
3303 | | - CameraPane.RANDOM = false; // parse everything |
---|
| 3737 | + boolean random = CameraPane.SWITCH; |
---|
| 3738 | + CameraPane.SWITCH = false; // parse everything |
---|
3304 | 3739 | copy.ResetDisplayList(); |
---|
3305 | 3740 | copy.HardTouch(); |
---|
3306 | | - CameraPane.RANDOM = random; |
---|
| 3741 | + CameraPane.SWITCH = random; |
---|
3307 | 3742 | } |
---|
3308 | 3743 | |
---|
3309 | 3744 | // public void applySelf() |
---|
.. | .. |
---|
3377 | 3812 | { |
---|
3378 | 3813 | //System.out.println("Propagate = " + propagate); |
---|
3379 | 3814 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 3815 | + |
---|
| 3816 | + if (copy.material != null) |
---|
| 3817 | + { |
---|
| 3818 | + cMaterial mat = copy.material; |
---|
| 3819 | + |
---|
| 3820 | + colorField.SetToolTipValue((mat.color)); |
---|
| 3821 | + modulationField.SetToolTipValue((mat.modulation)); |
---|
| 3822 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 3823 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 3824 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 3825 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 3826 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 3827 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 3828 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 3829 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 3830 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 3831 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 3832 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 3833 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 3834 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 3835 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 3836 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 3837 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 3838 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 3839 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 3840 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 3841 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 3842 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 3843 | + } |
---|
| 3844 | + |
---|
3380 | 3845 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3381 | 3846 | { |
---|
3382 | 3847 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3421 | 3886 | || e.getSource() == apertureField |
---|
3422 | 3887 | || e.getSource() == shadowblurField) |
---|
3423 | 3888 | { |
---|
| 3889 | + new Exception().printStackTrace(); |
---|
3424 | 3890 | System.exit(0); |
---|
3425 | 3891 | cameraView.options1[0] = (float) focusField.getFloat() * 10; |
---|
3426 | 3892 | cameraView.options1[1] = (float) apertureField.getFloat() / 1000; |
---|
.. | .. |
---|
3491 | 3957 | } |
---|
3492 | 3958 | |
---|
3493 | 3959 | if (normalpushField != null) |
---|
3494 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 3960 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3495 | 3961 | } |
---|
3496 | 3962 | |
---|
3497 | 3963 | void SnapObject() |
---|
.. | .. |
---|
3755 | 4221 | |
---|
3756 | 4222 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3757 | 4223 | { |
---|
| 4224 | + if (Globals.SAVEONMAKE) |
---|
| 4225 | + Save(); |
---|
3758 | 4226 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3759 | 4227 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3760 | 4228 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3958 | 4426 | } |
---|
3959 | 4427 | } |
---|
3960 | 4428 | } |
---|
| 4429 | + |
---|
3961 | 4430 | LoadGFDThread loadGFDThread; |
---|
3962 | 4431 | |
---|
3963 | 4432 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
3977 | 4446 | |
---|
3978 | 4447 | try |
---|
3979 | 4448 | { |
---|
| 4449 | + // Try compressed version first. |
---|
3980 | 4450 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
3981 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4451 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4452 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
3982 | 4453 | |
---|
3983 | 4454 | readobj = (Object3D) p.readObject(); |
---|
3984 | 4455 | istream.close(); |
---|
.. | .. |
---|
3986 | 4457 | readobj.ResetDisplayList(); |
---|
3987 | 4458 | } catch (Exception e) |
---|
3988 | 4459 | { |
---|
3989 | | - e.printStackTrace(); |
---|
| 4460 | + //e.printStackTrace(); |
---|
| 4461 | + try |
---|
| 4462 | + { |
---|
| 4463 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4464 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4465 | + |
---|
| 4466 | + readobj = (Object3D) p.readObject(); |
---|
| 4467 | + istream.close(); |
---|
| 4468 | + |
---|
| 4469 | + readobj.ResetDisplayList(); |
---|
| 4470 | + } catch (Exception e2) |
---|
| 4471 | + { |
---|
| 4472 | + e2.printStackTrace(); |
---|
| 4473 | + } |
---|
3990 | 4474 | } |
---|
3991 | 4475 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
3992 | 4476 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4032 | 4516 | |
---|
4033 | 4517 | void LoadIt(Object obj) |
---|
4034 | 4518 | { |
---|
| 4519 | + if (obj == null) |
---|
| 4520 | + { |
---|
| 4521 | + // Invalid file |
---|
| 4522 | + return; |
---|
| 4523 | + } |
---|
| 4524 | + |
---|
4035 | 4525 | System.out.println("Loaded " + obj); |
---|
4036 | 4526 | //new Exception().printStackTrace(); |
---|
4037 | 4527 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4041 | 4531 | |
---|
4042 | 4532 | if (readobj != null) |
---|
4043 | 4533 | { |
---|
| 4534 | + if (Globals.SAVEONMAKE) |
---|
| 4535 | + Save(); |
---|
4044 | 4536 | try |
---|
4045 | 4537 | { |
---|
4046 | 4538 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4103 | 4595 | |
---|
4104 | 4596 | void load() // throws ClassNotFoundException |
---|
4105 | 4597 | { |
---|
4106 | | - if (GrafreeD.standAlone) |
---|
| 4598 | + if (Grafreed.standAlone) |
---|
4107 | 4599 | { |
---|
4108 | 4600 | FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
4109 | 4601 | browser.show(); |
---|
.. | .. |
---|
4190 | 4682 | try |
---|
4191 | 4683 | { |
---|
4192 | 4684 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4193 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4685 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4686 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4194 | 4687 | |
---|
4195 | 4688 | p.writeObject(copy); |
---|
4196 | 4689 | p.flush(); |
---|
4197 | 4690 | |
---|
| 4691 | + zstream.close(); |
---|
4198 | 4692 | ostream.close(); |
---|
4199 | 4693 | |
---|
4200 | 4694 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4204 | 4698 | { |
---|
4205 | 4699 | } |
---|
4206 | 4700 | } |
---|
| 4701 | + |
---|
4207 | 4702 | String lastname; |
---|
4208 | 4703 | |
---|
4209 | 4704 | void saveAs() |
---|
4210 | 4705 | { |
---|
4211 | | - if (GrafreeD.standAlone) |
---|
| 4706 | + if (Grafreed.standAlone) |
---|
4212 | 4707 | { |
---|
4213 | 4708 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4214 | 4709 | browser.setVisible(true); |
---|
.. | .. |
---|
4313 | 4808 | try |
---|
4314 | 4809 | { |
---|
4315 | 4810 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4316 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4317 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 4811 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4812 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4318 | 4813 | |
---|
4319 | 4814 | Object3D objectparent = obj.parent; |
---|
4320 | 4815 | obj.parent = null; |
---|
4321 | 4816 | |
---|
4322 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 4817 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4323 | 4818 | |
---|
4324 | 4819 | obj.parent = objectparent; |
---|
4325 | 4820 | |
---|
.. | .. |
---|
4331 | 4826 | p.writeObject(object); |
---|
4332 | 4827 | p.flush(); |
---|
4333 | 4828 | |
---|
| 4829 | + zstream.close(); |
---|
4334 | 4830 | ostream.close(); |
---|
4335 | | - // zstream.close(); |
---|
4336 | 4831 | |
---|
4337 | 4832 | // group.selection.get(0).parent = parent; |
---|
4338 | 4833 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4353 | 4848 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4354 | 4849 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4355 | 4850 | copy.generatePOV(buffer); |
---|
4356 | | - if (GrafreeD.standAlone) |
---|
| 4851 | + if (Grafreed.standAlone) |
---|
4357 | 4852 | { |
---|
4358 | 4853 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4359 | 4854 | browser.show(); |
---|
.. | .. |
---|
4379 | 4874 | Object3D client; |
---|
4380 | 4875 | Object3D copy; |
---|
4381 | 4876 | MenuBar menuBar; |
---|
4382 | | - Menu windowMenu; |
---|
| 4877 | + Menu fileMenu; |
---|
| 4878 | + MenuItem newItem; |
---|
4383 | 4879 | MenuItem loadItem; |
---|
4384 | 4880 | MenuItem saveItem; |
---|
4385 | 4881 | MenuItem saveAsItem; |
---|
.. | .. |
---|
4387 | 4883 | MenuItem reexportItem; |
---|
4388 | 4884 | MenuItem povItem; |
---|
4389 | 4885 | MenuItem closeItem; |
---|
4390 | | - Menu cameraMenu; |
---|
| 4886 | + |
---|
4391 | 4887 | CheckboxMenuItem zBufferItem; |
---|
4392 | 4888 | //MenuItem normalLensItem; |
---|
4393 | | - MenuItem editCameraItem; |
---|
4394 | | - MenuItem revertCameraItem; |
---|
4395 | | - CheckboxMenuItem toggleLiveItem; |
---|
4396 | 4889 | MenuItem stepItem; |
---|
| 4890 | + CheckboxMenuItem toggleLiveItem; |
---|
4397 | 4891 | CheckboxMenuItem toggleFullScreenItem; |
---|
4398 | 4892 | CheckboxMenuItem toggleTimelineItem; |
---|
4399 | 4893 | CheckboxMenuItem toggleRenderItem; |
---|
.. | .. |
---|
4402 | 4896 | CheckboxMenuItem toggleFootContactItem; |
---|
4403 | 4897 | CheckboxMenuItem toggleDLItem; |
---|
4404 | 4898 | CheckboxMenuItem toggleTextureItem; |
---|
4405 | | - CheckboxMenuItem toggleRandomItem; |
---|
| 4899 | + CheckboxMenuItem toggleSwitchItem; |
---|
4406 | 4900 | CheckboxMenuItem toggleRootItem; |
---|
4407 | 4901 | CheckboxMenuItem animationItem; |
---|
4408 | 4902 | CheckboxMenuItem toggleHandleItem; |
---|
.. | .. |
---|
4410 | 4904 | JSplitPane mainPanel; |
---|
4411 | 4905 | JScrollPane scrollpane; |
---|
4412 | 4906 | JPanel toolbarPanel; |
---|
4413 | | - JPanel treePanel; |
---|
| 4907 | + cGridBag treePanel; |
---|
4414 | 4908 | JPanel radioPanel; |
---|
4415 | 4909 | ButtonGroup buttonGroup; |
---|
4416 | 4910 | cGridBag ctrlPanel; |
---|
.. | .. |
---|
4539 | 5033 | //ObjectUI parent; |
---|
4540 | 5034 | |
---|
4541 | 5035 | cNumberSlider normalpushField; |
---|
| 5036 | + |
---|
| 5037 | + private MenuItem importGFDItem; |
---|
| 5038 | + private MenuItem importVRMLX3DItem; |
---|
| 5039 | + private MenuItem import3DSItem; |
---|
| 5040 | + private MenuItem importOBJItem; |
---|
4542 | 5041 | } |
---|