.. | .. |
---|
36 | 36 | GroupEditor callee; |
---|
37 | 37 | JFrame frame; |
---|
38 | 38 | |
---|
| 39 | + static ObjEditor theFrame; |
---|
| 40 | + |
---|
39 | 41 | // SCRIPT |
---|
40 | 42 | |
---|
41 | 43 | transient JFrame textpanel = null; |
---|
.. | .. |
---|
138 | 140 | public void closeUI() |
---|
139 | 141 | { |
---|
140 | 142 | //new Exception().printStackTrace(); |
---|
141 | | - System.out.println("this = " + this); |
---|
142 | | - System.out.println("objEditor = " + objEditor); |
---|
| 143 | +// System.out.println("this = " + this); |
---|
| 144 | +// System.out.println("objEditor = " + objEditor); |
---|
143 | 145 | //nameField.removeActionListener(this); |
---|
144 | | - objEditor.ctrlPanel.remove(nameField); |
---|
| 146 | +// objEditor.ctrlPanel.remove(nameField); |
---|
| 147 | + |
---|
| 148 | + objEditor.ctrlPanel.remove(namePanel); |
---|
145 | 149 | |
---|
146 | 150 | if (!GroupEditor.allparams) |
---|
147 | 151 | return; |
---|
148 | 152 | |
---|
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); |
---|
| 153 | +// objEditor.ctrlPanel.remove(liveCB); |
---|
| 154 | +// objEditor.ctrlPanel.remove(hideCB); |
---|
| 155 | +// objEditor.ctrlPanel.remove(markCB); |
---|
| 156 | +// |
---|
| 157 | +// objEditor.ctrlPanel.remove(randomCB); |
---|
| 158 | +// objEditor.ctrlPanel.remove(speedupCB); |
---|
| 159 | +// objEditor.ctrlPanel.remove(rewindCB); |
---|
| 160 | +// |
---|
| 161 | +// objEditor.ctrlPanel.remove(resetButton); |
---|
| 162 | +// objEditor.ctrlPanel.remove(stepButton); |
---|
| 163 | +//// objEditor.ctrlPanel.remove(stepAllButton); |
---|
| 164 | +//// objEditor.ctrlPanel.remove(resetAllButton); |
---|
| 165 | +// objEditor.ctrlPanel.remove(link2masterCB); |
---|
| 166 | +// //objEditor.ctrlPanel.remove(flipVCB); |
---|
| 167 | +// //objEditor.ctrlPanel.remove(texresMenu); |
---|
| 168 | +// objEditor.ctrlPanel.remove(slowerButton); |
---|
| 169 | +// objEditor.ctrlPanel.remove(fasterButton); |
---|
| 170 | +// objEditor.ctrlPanel.remove(remarkButton); |
---|
167 | 171 | |
---|
168 | | - Remove(normalpushField); |
---|
| 172 | + objEditor.ctrlPanel.remove(setupPanel); |
---|
| 173 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 174 | + objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 175 | + objEditor.ctrlPanel.remove(pushPanel); |
---|
| 176 | + //objEditor.ctrlPanel.remove(fillPanel); |
---|
| 177 | + |
---|
| 178 | + //Remove(normalpushField); |
---|
169 | 179 | } |
---|
170 | 180 | |
---|
171 | 181 | public ObjEditor GetEditor() |
---|
.. | .. |
---|
236 | 246 | //localCopy.parent = null; |
---|
237 | 247 | |
---|
238 | 248 | frame = new JFrame(); |
---|
| 249 | + frame.setUndecorated(true); |
---|
239 | 250 | objEditor = this; |
---|
240 | 251 | this.callee = callee; |
---|
241 | 252 | |
---|
.. | .. |
---|
269 | 280 | void SetupMenu() |
---|
270 | 281 | { |
---|
271 | 282 | 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...")); |
---|
| 283 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 284 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 285 | + fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 286 | + |
---|
| 287 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 288 | + Menu menu = new Menu("Import"); |
---|
| 289 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 290 | + importOBJItem.addActionListener(this); |
---|
| 291 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 292 | + import3DSItem.addActionListener(this); |
---|
| 293 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 294 | + importVRMLX3DItem.addActionListener(this); |
---|
| 295 | + menu.add("-"); |
---|
| 296 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 297 | + importGFDItem.addActionListener(this); |
---|
| 298 | + fileMenu.add(menu); |
---|
| 299 | + fileMenu.add("-"); |
---|
| 300 | + |
---|
| 301 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 302 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
277 | 303 | //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("-"); |
---|
| 304 | + fileMenu.add("-"); |
---|
| 305 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 306 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 307 | + fileMenu.add("-"); |
---|
282 | 308 | if (client.parent != null) |
---|
283 | 309 | { |
---|
284 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 310 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
285 | 311 | } else |
---|
286 | 312 | { |
---|
287 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 313 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
288 | 314 | } |
---|
289 | 315 | |
---|
| 316 | + newItem.addActionListener(this); |
---|
290 | 317 | loadItem.addActionListener(this); |
---|
291 | 318 | saveItem.addActionListener(this); |
---|
292 | 319 | saveAsItem.addActionListener(this); |
---|
.. | .. |
---|
295 | 322 | //povItem.addActionListener(this); |
---|
296 | 323 | closeItem.addActionListener(this); |
---|
297 | 324 | |
---|
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 | 325 | objectPanel = new JTabbedPane(); |
---|
354 | 326 | toolbarPanel = new JPanel(); |
---|
355 | 327 | toolbarPanel.setName("Toolbar"); |
---|
356 | | - treePanel = new JPanel(); |
---|
| 328 | + treePanel = new cGridBag(); |
---|
357 | 329 | treePanel.setName("Tree"); |
---|
358 | | - ctrlPanel = new cGridBag(); // new GridBagLayout()); |
---|
| 330 | + ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
359 | 331 | ctrlPanel.setName("Edit"); |
---|
360 | 332 | materialPanel = new cGridBag().setVertical(true); |
---|
361 | 333 | materialPanel.setName("Material"); |
---|
362 | 334 | /*JTextPane*/ |
---|
363 | 335 | infoarea = createTextPane(); |
---|
| 336 | + doc = infoarea.getStyledDocument(); |
---|
| 337 | + |
---|
364 | 338 | infoarea.setEditable(true); |
---|
365 | 339 | SetText(); |
---|
366 | 340 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
367 | 341 | // infoarea.setOpaque(false); |
---|
368 | 342 | // //infoarea.setForeground(textcolor); |
---|
369 | | - infoarea.setLineWrap(true); |
---|
370 | | - infoarea.setWrapStyleWord(true); |
---|
| 343 | +// TEXTAREA infoarea.setLineWrap(true); |
---|
| 344 | +// TEXTAREA infoarea.setWrapStyleWord(true); |
---|
371 | 345 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
372 | 346 | infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
373 | 347 | infoPanel.setName("Info"); |
---|
.. | .. |
---|
378 | 352 | mainPanel.setName("Main"); |
---|
379 | 353 | mainPanel.setContinuousLayout(true); |
---|
380 | 354 | mainPanel.setOneTouchExpandable(true); |
---|
381 | | - mainPanel.setDividerLocation(1.0); |
---|
382 | 355 | mainPanel.setDividerSize(9); |
---|
383 | | - mainPanel.setResizeWeight(0); |
---|
| 356 | + mainPanel.setDividerLocation(0.5); //1.0); |
---|
| 357 | + mainPanel.setResizeWeight(0.5); |
---|
384 | 358 | |
---|
385 | 359 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
386 | 360 | //mainPanel.setLayout(new GridBagLayout()); |
---|
387 | 361 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
388 | | - treePanel.setLayout(new GridBagLayout()); |
---|
389 | | - ctrlPanel.setLayout(new GridBagLayout()); |
---|
| 362 | +// treePanel.setLayout(new GridBagLayout()); |
---|
| 363 | + //ctrlPanel.setLayout(new GridBagLayout()); |
---|
390 | 364 | //materialPanel.setLayout(new GridBagLayout()); |
---|
391 | 365 | |
---|
392 | 366 | aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, |
---|
.. | .. |
---|
426 | 400 | static String newline = "\n"; |
---|
427 | 401 | protected static final String buttonString = "JButton"; |
---|
428 | 402 | StyledDocument doc; |
---|
429 | | - JTextArea infoarea; |
---|
| 403 | + JTextPane infoarea; |
---|
430 | 404 | |
---|
431 | 405 | void ClearInfo() |
---|
432 | 406 | { |
---|
.. | .. |
---|
449 | 423 | e.printStackTrace(); |
---|
450 | 424 | } |
---|
451 | 425 | |
---|
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(); |
---|
| 426 | +// String selection = infoarea.getText(); |
---|
| 427 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 428 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 429 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
456 | 430 | //clipboard.setContents(data, data); |
---|
457 | 431 | } |
---|
458 | 432 | |
---|
.. | .. |
---|
475 | 449 | //SendInfo("Name:", "bold"); |
---|
476 | 450 | if (sel.GetTextures() != null || debug) |
---|
477 | 451 | { |
---|
478 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 452 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
479 | 453 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
480 | 454 | if (sel.Size() > 0) |
---|
481 | 455 | { |
---|
482 | 456 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
483 | 457 | } |
---|
484 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 458 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
485 | 459 | if (debug) |
---|
486 | 460 | { |
---|
487 | 461 | try |
---|
.. | .. |
---|
493 | 467 | } |
---|
494 | 468 | |
---|
495 | 469 | if (full) |
---|
496 | | - si.SendInfo(" BBox: " + minima + " - " + maxima, "regular"); |
---|
| 470 | + { |
---|
| 471 | + si.SendInfo(" BBox min: " + minima, "regular"); |
---|
| 472 | + si.SendInfo(" BBox max: " + maxima, "regular"); |
---|
| 473 | + } |
---|
497 | 474 | |
---|
498 | 475 | if (sel.bRep != null) |
---|
499 | 476 | { |
---|
.. | .. |
---|
520 | 497 | } |
---|
521 | 498 | if (sel.support != null) |
---|
522 | 499 | { |
---|
523 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 500 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
524 | 501 | } |
---|
525 | 502 | if (sel.scriptnode != null) |
---|
526 | 503 | { |
---|
.. | .. |
---|
591 | 568 | { |
---|
592 | 569 | CameraPane.pointflow = (PointFlow) sel; |
---|
593 | 570 | } |
---|
| 571 | + |
---|
| 572 | + si.SendInfo("_____________________", "regular"); |
---|
| 573 | + si.SendInfo("", "regular"); |
---|
594 | 574 | } |
---|
595 | 575 | } |
---|
596 | 576 | |
---|
.. | .. |
---|
606 | 586 | } |
---|
607 | 587 | } |
---|
608 | 588 | |
---|
| 589 | +static GraphicsDevice device = GraphicsEnvironment |
---|
| 590 | + .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 591 | + |
---|
| 592 | + Rectangle keeprect; |
---|
| 593 | + cRadio radio; |
---|
| 594 | + |
---|
| 595 | +cButton keepButton; |
---|
| 596 | + cButton twoButton; // Full 3D |
---|
| 597 | + cButton sixButton; |
---|
| 598 | + cButton threeButton; |
---|
| 599 | + cButton sevenButton; |
---|
| 600 | + cButton fourButton; // full panel |
---|
| 601 | + cButton oneButton; // full XYZ |
---|
| 602 | + //cButton currentLayout; |
---|
| 603 | + |
---|
| 604 | + boolean maximized; |
---|
| 605 | + |
---|
| 606 | + void Minimize() |
---|
| 607 | + { |
---|
| 608 | + frame.setState(Frame.ICONIFIED); |
---|
| 609 | + } |
---|
| 610 | + |
---|
| 611 | + void Maximize() |
---|
| 612 | + { |
---|
| 613 | + if (maximized) |
---|
| 614 | + { |
---|
| 615 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 616 | + } |
---|
| 617 | + else |
---|
| 618 | + { |
---|
| 619 | + keeprect = frame.getBounds(); |
---|
| 620 | + Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 621 | + Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 622 | + frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 623 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 624 | + } |
---|
| 625 | + |
---|
| 626 | + maximized ^= true; |
---|
| 627 | + } |
---|
| 628 | + |
---|
609 | 629 | void ToggleFullScreen() |
---|
610 | 630 | { |
---|
611 | 631 | if (CameraPane.FULLSCREEN) |
---|
612 | 632 | { |
---|
613 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
614 | | - framePanel.add(bigThree); |
---|
615 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 633 | + device.setFullScreenWindow(null); |
---|
| 634 | + //frame.setVisible(false); |
---|
| 635 | +// frame.removeNotify(); |
---|
| 636 | +// frame.setUndecorated(false); |
---|
| 637 | +// frame.addNotify(); |
---|
| 638 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 639 | + |
---|
| 640 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 641 | +// X framePanel.add(bigThree); |
---|
| 642 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 643 | + framePanel.setDividerLocation(1); |
---|
| 644 | + |
---|
| 645 | + //frame.setVisible(true); |
---|
| 646 | + radio.layout = keepButton; |
---|
| 647 | + //theFrame = null; |
---|
| 648 | + keepButton = null; |
---|
| 649 | + radio.layout.doClick(); |
---|
| 650 | + |
---|
616 | 651 | } else |
---|
617 | 652 | { |
---|
618 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
619 | | - framePanel.remove(bigThree); |
---|
620 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 653 | + keepButton = radio.layout; |
---|
| 654 | + //keeprect = frame.getBounds(); |
---|
| 655 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 656 | +// frame.getToolkit().getScreenSize().height); |
---|
| 657 | + //frame.setVisible(false); |
---|
| 658 | + device.setFullScreenWindow(frame); |
---|
| 659 | +// frame.removeNotify(); |
---|
| 660 | +// frame.setUndecorated(true); |
---|
| 661 | +// frame.addNotify(); |
---|
| 662 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 663 | +// X framePanel.remove(bigThree); |
---|
| 664 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 665 | + framePanel.setDividerLocation(0); |
---|
| 666 | + |
---|
| 667 | + radio.layout = twoButton; |
---|
| 668 | + radio.layout.doClick(); |
---|
| 669 | + //frame.setVisible(true); |
---|
621 | 670 | } |
---|
| 671 | + |
---|
622 | 672 | cameraView.ToggleFullScreen(); |
---|
623 | 673 | } |
---|
624 | 674 | |
---|
625 | | - private JTextArea createTextPane() |
---|
| 675 | + private JTextPane createTextPane() |
---|
626 | 676 | { |
---|
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 | | - }; |
---|
| 677 | +// TEXTAREA String[] initString = |
---|
| 678 | +// { |
---|
| 679 | +// "This is an editable JTextPane, ", //regular |
---|
| 680 | +// "another ", //italic |
---|
| 681 | +// "styled ", //bold |
---|
| 682 | +// "text ", //small |
---|
| 683 | +// "component, ", //large |
---|
| 684 | +// "which supports embedded components..." + newline,//regular |
---|
| 685 | +// " " + newline, //button |
---|
| 686 | +// "...and embedded icons..." + newline, //regular |
---|
| 687 | +// " ", //icon |
---|
| 688 | +// newline + "JTextPane is a subclass of JEditorPane that " |
---|
| 689 | +// + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
| 690 | +// + "cover methods for interacting with those objects." |
---|
| 691 | +// }; |
---|
| 692 | +// |
---|
| 693 | +// String[] initStyles = |
---|
| 694 | +// { |
---|
| 695 | +// "regular", "italic", "bold", "small", "large", |
---|
| 696 | +// "regular", "button", "regular", "icon", |
---|
| 697 | +// "regular" |
---|
| 698 | +// }; |
---|
| 699 | +// |
---|
| 700 | +// JTextPane textPane = new JTextPane(); |
---|
| 701 | +// textPane.setEditable(true); |
---|
| 702 | +// /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
| 703 | +// addStylesToDocument(doc); |
---|
| 704 | +// |
---|
| 705 | +// try |
---|
| 706 | +// { |
---|
| 707 | +// for (int j = 0; j < 2; j++) |
---|
| 708 | +// { |
---|
| 709 | +// for (int i = 0; i < initString.length; i++) |
---|
| 710 | +// { |
---|
| 711 | +// doc.insertString(doc.getLength(), initString[i], |
---|
| 712 | +// doc.getStyle(initStyles[i])); |
---|
| 713 | +// } |
---|
| 714 | +// } |
---|
| 715 | +// } catch (BadLocationException ble) |
---|
| 716 | +// { |
---|
| 717 | +// System.err.println("Couldn't insert initial text into text pane."); |
---|
| 718 | +// } |
---|
642 | 719 | |
---|
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; |
---|
| 720 | + return new JTextPane(); // textPane; |
---|
671 | 721 | } |
---|
672 | 722 | |
---|
673 | 723 | protected void addStylesToDocument(StyledDocument doc) |
---|
.. | .. |
---|
720 | 770 | protected static ImageIcon createImageIcon(String path, |
---|
721 | 771 | String description) |
---|
722 | 772 | { |
---|
723 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 773 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
724 | 774 | if (imgURL != null) |
---|
725 | 775 | { |
---|
726 | 776 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
752 | 802 | // NumberSlider vDivsField; |
---|
753 | 803 | // JCheckBox endcaps; |
---|
754 | 804 | JCheckBox liveCB; |
---|
| 805 | + JCheckBox selectCB; |
---|
755 | 806 | JCheckBox hideCB; |
---|
756 | 807 | JCheckBox link2masterCB; |
---|
757 | 808 | JCheckBox markCB; |
---|
.. | .. |
---|
767 | 818 | JButton slowerButton; |
---|
768 | 819 | JButton fasterButton; |
---|
769 | 820 | JButton remarkButton; |
---|
| 821 | + |
---|
| 822 | + cGridBag namePanel; |
---|
| 823 | + cGridBag setupPanel; |
---|
| 824 | + cGridBag setupPanel2; |
---|
| 825 | + cGridBag commandsPanel; |
---|
| 826 | + cGridBag pushPanel; |
---|
| 827 | + cGridBag fillPanel; |
---|
770 | 828 | |
---|
771 | | - JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on) |
---|
| 829 | + JCheckBox AddCheckBox(cGridBag panel, String label, boolean on) |
---|
772 | 830 | { |
---|
773 | 831 | JCheckBox cb; |
---|
774 | 832 | |
---|
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); |
---|
| 833 | + panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
780 | 834 | cb.addItemListener(this); |
---|
781 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
782 | | - oe.aConstraints.gridwidth = 1; |
---|
783 | | - oe.aConstraints.gridx += 1; |
---|
784 | 835 | |
---|
785 | 836 | return cb; |
---|
786 | 837 | } |
---|
787 | 838 | |
---|
788 | | - cButton AddButton(ObjEditor oe, String label) |
---|
| 839 | + cButton AddButton(cGridBag panel, String label) |
---|
789 | 840 | { |
---|
790 | 841 | cButton cb; |
---|
791 | 842 | |
---|
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); |
---|
| 843 | + panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); |
---|
797 | 844 | cb.addActionListener(this); |
---|
798 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
799 | | - oe.aConstraints.gridwidth = 1; |
---|
800 | | - oe.aConstraints.gridx += 1; |
---|
801 | 845 | |
---|
802 | 846 | return cb; |
---|
803 | 847 | } |
---|
804 | 848 | |
---|
805 | | - JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item) |
---|
| 849 | + JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item) |
---|
806 | 850 | { |
---|
807 | 851 | JComboBox combo; |
---|
808 | 852 | |
---|
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; |
---|
| 853 | + panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
812 | 854 | combo.addActionListener(this); |
---|
813 | 855 | |
---|
814 | 856 | return combo; |
---|
815 | 857 | } |
---|
816 | 858 | |
---|
817 | | - cNumberSlider AddSlider(cGridBag ctrlPanel, String label, double min, double max, double current, double pow) |
---|
| 859 | + cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow) |
---|
818 | 860 | { |
---|
819 | 861 | cGridBag control = new cGridBag(); |
---|
820 | 862 | |
---|
.. | .. |
---|
826 | 868 | control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
827 | 869 | combo.setFloat(current); |
---|
828 | 870 | |
---|
829 | | - ctrlPanel.add(control); |
---|
| 871 | + panel.add(control); |
---|
830 | 872 | |
---|
831 | | - return combo; |
---|
| 873 | + return control; |
---|
832 | 874 | } |
---|
833 | 875 | |
---|
834 | | - cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current) |
---|
| 876 | + cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current) |
---|
835 | 877 | { |
---|
836 | 878 | cGridBag control = new cGridBag(); |
---|
837 | 879 | |
---|
.. | .. |
---|
839 | 881 | |
---|
840 | 882 | JLabel jlabel = new JLabel(label); |
---|
841 | 883 | 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); |
---|
| 884 | + control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 885 | + control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
844 | 886 | combo.setInteger(current); |
---|
845 | 887 | |
---|
846 | | - ctrlPanel.add(control); |
---|
| 888 | + panel.add(control); |
---|
847 | 889 | |
---|
848 | | - return combo; |
---|
| 890 | + return control; |
---|
849 | 891 | } |
---|
850 | 892 | |
---|
851 | 893 | JTextArea AddText(cGridBag ctrlPanel, String name) |
---|
852 | 894 | { |
---|
853 | 895 | JTextArea text; |
---|
854 | 896 | |
---|
855 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
856 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
857 | 897 | ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
858 | 898 | text.addCaretListener(this); |
---|
859 | | - aConstraints.gridx += 1; |
---|
860 | | - aConstraints.gridwidth = 1; |
---|
861 | 899 | |
---|
862 | 900 | return text; |
---|
863 | 901 | } |
---|
.. | .. |
---|
896 | 934 | |
---|
897 | 935 | /* |
---|
898 | 936 | */ |
---|
899 | | - void Return() // ObjEditor oe) |
---|
| 937 | + void Return0() // ObjEditor oe) |
---|
900 | 938 | { |
---|
901 | 939 | aConstraints.gridy += 1; |
---|
902 | 940 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
951 | 989 | |
---|
952 | 990 | void SetupUI2(ObjEditor oe) |
---|
953 | 991 | { |
---|
954 | | -// oe.aConstraints.weightx = 0; |
---|
955 | | -// oe.aConstraints.weighty = 0; |
---|
956 | | -// oe.aConstraints.gridx = 0; |
---|
957 | | -// oe.aConstraints.gridy = 0; |
---|
958 | | - SetupName(oe); |
---|
| 992 | + //SetupName(oe); |
---|
| 993 | + |
---|
| 994 | + namePanel = new cGridBag(); |
---|
| 995 | + |
---|
| 996 | + nameField = AddText(namePanel, copy.GetName()); |
---|
| 997 | + namePanel.add(nameField); |
---|
| 998 | + oe.ctrlPanel.add(namePanel); |
---|
| 999 | + |
---|
| 1000 | + oe.ctrlPanel.Return(); |
---|
959 | 1001 | |
---|
960 | 1002 | if (!GroupEditor.allparams) |
---|
961 | 1003 | return; |
---|
962 | 1004 | |
---|
963 | | - liveCB = AddCheckBox(oe, "Live", copy.live); |
---|
964 | | - link2masterCB = AddCheckBox(oe, "Supp", copy.link2master); |
---|
965 | | - hideCB = AddCheckBox(oe, "Hide", copy.hide); |
---|
| 1005 | + setupPanel = new cGridBag().setVertical(false); |
---|
| 1006 | + |
---|
| 1007 | + liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
| 1008 | + liveCB.setToolTipText("Animate object"); |
---|
| 1009 | + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1010 | + selectCB.setToolTipText("Make object selectable"); |
---|
966 | 1011 | // 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"); |
---|
| 1012 | + hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 1013 | + hideCB.setToolTipText("Hide object"); |
---|
| 1014 | + markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
| 1015 | + markCB.setToolTipText("Set the animation target transform"); |
---|
| 1016 | + |
---|
| 1017 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1018 | + |
---|
| 1019 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
| 1020 | + rewindCB.setToolTipText("Rewind animation"); |
---|
| 1021 | + |
---|
| 1022 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 1023 | + randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
| 1024 | + |
---|
| 1025 | + if (Globals.ADVANCED) |
---|
| 1026 | + { |
---|
| 1027 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
| 1028 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1029 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
| 1030 | + speedupCB.setToolTipText("Option motion capture"); |
---|
| 1031 | + } |
---|
| 1032 | + |
---|
| 1033 | + oe.ctrlPanel.add(setupPanel); |
---|
| 1034 | + oe.ctrlPanel.Return(); |
---|
| 1035 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1036 | + oe.ctrlPanel.Return(); |
---|
| 1037 | + |
---|
| 1038 | + commandsPanel = new cGridBag().setVertical(false); |
---|
| 1039 | + |
---|
| 1040 | + resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1041 | + resetButton.setToolTipText("Jump to frame zero"); |
---|
| 1042 | + stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1043 | + stepButton.setToolTipText("Step one frame"); |
---|
973 | 1044 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
974 | 1045 | // stepAllButton = AddButton(oe, "Step All"); |
---|
975 | | - speedupCB = AddCheckBox(oe, "Speed", copy.speedup); |
---|
976 | 1046 | // Return(); |
---|
977 | | - slowerButton = AddButton(oe, "Slow"); |
---|
978 | | - fasterButton = AddButton(oe, "Fast"); |
---|
979 | | - remarkButton = AddButton(oe, "Rem"); |
---|
| 1047 | + slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1048 | + slowerButton.setToolTipText("Decrease animation speed"); |
---|
| 1049 | + fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1050 | + fasterButton.setToolTipText("Increase animation speed"); |
---|
| 1051 | + remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1052 | + remarkButton.setToolTipText("Set the current transform as the target"); |
---|
980 | 1053 | |
---|
981 | | - Return(); |
---|
| 1054 | + oe.ctrlPanel.add(commandsPanel); |
---|
| 1055 | + oe.ctrlPanel.Return(); |
---|
982 | 1056 | |
---|
983 | | - normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1); |
---|
984 | | - Return(); |
---|
| 1057 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
| 1058 | + normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
| 1059 | + //Return(); |
---|
| 1060 | + |
---|
| 1061 | + oe.ctrlPanel.Return(); |
---|
985 | 1062 | |
---|
986 | 1063 | // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2); |
---|
987 | 1064 | // ObjEditor.aConstraints.gridx += 1; |
---|
.. | .. |
---|
1076 | 1153 | oe.aConstraints.gridwidth = 1; |
---|
1077 | 1154 | /**/ |
---|
1078 | 1155 | nameField = AddText(oe.ctrlPanel, copy.GetName()); |
---|
1079 | | - Return(); |
---|
| 1156 | + oe.ctrlPanel.Return(); |
---|
1080 | 1157 | |
---|
1081 | 1158 | //ctrlPanel.add(textureButton = new Button("Texture...")); |
---|
1082 | 1159 | //textureButton.setEnabled(false); |
---|
.. | .. |
---|
1180 | 1257 | //worldPanel.setName("World"); |
---|
1181 | 1258 | centralPanel = new cGridBag(); |
---|
1182 | 1259 | centralPanel.preferredWidth = 20; |
---|
1183 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1184 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1260 | + |
---|
| 1261 | + if (Globals.ADVANCED) |
---|
| 1262 | + { |
---|
| 1263 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1264 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1185 | 1265 | |
---|
1186 | 1266 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1187 | 1267 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1190 | 1270 | // cameraPanel.setDividerSize(9); |
---|
1191 | 1271 | cameraPanel.setResizeWeight(1.0); |
---|
1192 | 1272 | |
---|
| 1273 | + } |
---|
| 1274 | + |
---|
1193 | 1275 | centralPanel.add(cameraView); |
---|
| 1276 | + centralPanel.setFocusable(true); |
---|
1194 | 1277 | //frame.setJMenuBar(timelineMenubar); |
---|
1195 | 1278 | //centralPanel.add(timelinePanel); |
---|
1196 | 1279 | |
---|
.. | .. |
---|
1253 | 1336 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1254 | 1337 | //tmp.setName("Edit"); |
---|
1255 | 1338 | objectPanel.add(materialPanel); |
---|
1256 | | - JPanel north = new JPanel(new BorderLayout()); |
---|
1257 | | - north.setName("Edit"); |
---|
1258 | | - north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1259 | | - objectPanel.add(north); |
---|
| 1339 | +// JPanel north = new JPanel(new BorderLayout()); |
---|
| 1340 | +// north.setName("Edit"); |
---|
| 1341 | +// north.add(ctrlPanel, BorderLayout.NORTH); |
---|
| 1342 | +// objectPanel.add(north); |
---|
| 1343 | + objectPanel.add(ctrlPanel); |
---|
1260 | 1344 | objectPanel.add(infoPanel); |
---|
1261 | 1345 | |
---|
1262 | 1346 | /* |
---|
.. | .. |
---|
1278 | 1362 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1279 | 1363 | |
---|
1280 | 1364 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1281 | | - scenePanel.preferredWidth = 7; |
---|
| 1365 | + scenePanel.preferredWidth = 6; |
---|
1282 | 1366 | |
---|
1283 | 1367 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1284 | 1368 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1384 | 1468 | |
---|
1385 | 1469 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1386 | 1470 | |
---|
1387 | | - frame.setSize(1024, 768); |
---|
1388 | | - frame.show(); |
---|
| 1471 | + frame.setSize(1280, 860); |
---|
| 1472 | + frame.setVisible(true); |
---|
1389 | 1473 | |
---|
| 1474 | + cameraView.requestFocusInWindow(); |
---|
| 1475 | + |
---|
1390 | 1476 | gridPanel.setDividerLocation(1.0); |
---|
1391 | 1477 | |
---|
1392 | 1478 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
1415 | 1501 | ctrlPanel.removeAll(); |
---|
1416 | 1502 | } |
---|
1417 | 1503 | |
---|
1418 | | - void SetupMaterial(cGridBag ctrlPanel) |
---|
| 1504 | + void SetupMaterial(cGridBag panel) |
---|
1419 | 1505 | { |
---|
1420 | 1506 | /* |
---|
1421 | 1507 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
.. | .. |
---|
1424 | 1510 | |
---|
1425 | 1511 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1426 | 1512 | |
---|
1427 | | - editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints); |
---|
| 1513 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1514 | + createMaterialButton.setToolTipText("Create material"); |
---|
1428 | 1515 | |
---|
1429 | 1516 | /* |
---|
1430 | 1517 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1431 | 1518 | */ |
---|
1432 | 1519 | |
---|
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); |
---|
| 1520 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1521 | + clearMaterialButton.setToolTipText("Clear material"); |
---|
| 1522 | + |
---|
| 1523 | + if (Globals.ADVANCED) |
---|
| 1524 | + { |
---|
| 1525 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1526 | + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
| 1527 | + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 1528 | + } |
---|
1437 | 1529 | |
---|
1438 | | - ctrlPanel.add(editBar); |
---|
| 1530 | + editBar.preferredHeight = 15; |
---|
| 1531 | + |
---|
| 1532 | + panel.add(editBar); |
---|
1439 | 1533 | |
---|
1440 | 1534 | /**/ |
---|
1441 | 1535 | //aConstraints.weighty = 0; |
---|
.. | .. |
---|
1445 | 1539 | //aConstraints.gridx += 1; |
---|
1446 | 1540 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1447 | 1541 | |
---|
1448 | | - JPanel colorPanel = new JPanel(new BorderLayout()); |
---|
1449 | | - colorPanel.setBorder(BorderFactory.createLineBorder(Color.black)); |
---|
1450 | | - |
---|
1451 | 1542 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
1452 | | - |
---|
1453 | | - colorPanel.add(colorSection); |
---|
1454 | 1543 | |
---|
1455 | 1544 | cGridBag color = new cGridBag(); |
---|
1456 | 1545 | color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1457 | 1546 | colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1458 | 1547 | color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1548 | + //colorField.preferredWidth = 200; |
---|
1459 | 1549 | colorSection.add(color); |
---|
1460 | 1550 | |
---|
1461 | 1551 | cGridBag modulation = new cGridBag(); |
---|
.. | .. |
---|
1488 | 1578 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1489 | 1579 | colorSection.add(shadowbias); |
---|
1490 | 1580 | |
---|
1491 | | - ctrlPanel.add(colorPanel); |
---|
| 1581 | + panel.add(new JSeparator()); |
---|
| 1582 | + |
---|
| 1583 | + panel.add(colorSection); |
---|
1492 | 1584 | |
---|
1493 | 1585 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1494 | 1586 | |
---|
1495 | | - JPanel diffusePanel = new JPanel(new BorderLayout()); |
---|
1496 | | - diffusePanel.setBorder(BorderFactory.createLineBorder(Color.black)); |
---|
1497 | | - |
---|
1498 | 1587 | cGridBag diffuseSection = new cGridBag().setVertical(true); |
---|
1499 | | - |
---|
1500 | | - diffusePanel.add(diffuseSection); |
---|
1501 | 1588 | |
---|
1502 | 1589 | cGridBag diffuse = new cGridBag(); |
---|
1503 | 1590 | diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints); |
---|
.. | .. |
---|
1541 | 1628 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1542 | 1629 | diffuseSection.add(fakedepth); |
---|
1543 | 1630 | |
---|
1544 | | - ctrlPanel.add(diffusePanel); |
---|
| 1631 | + panel.add(new JSeparator()); |
---|
| 1632 | + |
---|
| 1633 | + panel.add(diffuseSection); |
---|
1545 | 1634 | |
---|
1546 | 1635 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1547 | 1636 | |
---|
1548 | | - JPanel specularPanel = new JPanel(new BorderLayout()); |
---|
1549 | | - specularPanel.setBorder(BorderFactory.createLineBorder(Color.black)); |
---|
1550 | | - |
---|
1551 | 1637 | cGridBag specularSection = new cGridBag().setVertical(true); |
---|
1552 | | - |
---|
1553 | | - specularPanel.add(specularSection); |
---|
1554 | 1638 | |
---|
1555 | 1639 | cGridBag specular = new cGridBag(); |
---|
1556 | 1640 | specular.add(specularLabel = new JLabel("Specular")); // , aConstraints); |
---|
.. | .. |
---|
1582 | 1666 | velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1583 | 1667 | specularSection.add(velvet); |
---|
1584 | 1668 | |
---|
1585 | | - shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1); |
---|
| 1669 | + shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1); |
---|
1586 | 1670 | //Return(); |
---|
1587 | 1671 | // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints); |
---|
1588 | 1672 | // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
.. | .. |
---|
1595 | 1679 | // aConstraints.gridwidth = 1; |
---|
1596 | 1680 | |
---|
1597 | 1681 | |
---|
1598 | | - ctrlPanel.add(specularPanel); |
---|
| 1682 | + panel.add(new JSeparator()); |
---|
| 1683 | + |
---|
| 1684 | + panel.add(specularSection); |
---|
1599 | 1685 | |
---|
1600 | 1686 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1601 | 1687 | |
---|
1602 | | - JPanel globalPanel = new JPanel(new BorderLayout()); |
---|
1603 | | - globalPanel.setBorder(BorderFactory.createLineBorder(Color.black)); |
---|
1604 | | - |
---|
1605 | 1688 | cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1606 | | - |
---|
1607 | | - globalPanel.add(globalSection); |
---|
1608 | 1689 | |
---|
1609 | 1690 | cGridBag camera = new cGridBag(); |
---|
1610 | 1691 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
.. | .. |
---|
1630 | 1711 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1631 | 1712 | globalSection.add(opacity); |
---|
1632 | 1713 | |
---|
1633 | | - ctrlPanel.add(globalPanel); |
---|
| 1714 | + panel.add(new JSeparator()); |
---|
| 1715 | + |
---|
| 1716 | + panel.add(globalSection); |
---|
1634 | 1717 | |
---|
1635 | 1718 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1636 | 1719 | |
---|
1637 | | - JPanel texturePanel = new JPanel(new BorderLayout()); |
---|
1638 | | - texturePanel.setBorder(BorderFactory.createLineBorder(Color.black)); |
---|
1639 | | - |
---|
1640 | 1720 | cGridBag textureSection = new cGridBag().setVertical(true); |
---|
1641 | | - |
---|
1642 | | - texturePanel.add(textureSection); |
---|
1643 | 1721 | |
---|
1644 | 1722 | cGridBag bump = new cGridBag(); |
---|
1645 | 1723 | bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints); |
---|
.. | .. |
---|
1677 | 1755 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1678 | 1756 | textureSection.add(opacityPower); |
---|
1679 | 1757 | |
---|
1680 | | - ctrlPanel.add(texturePanel); |
---|
| 1758 | + panel.add(new JSeparator()); |
---|
| 1759 | + |
---|
| 1760 | + panel.add(textureSection); |
---|
1681 | 1761 | |
---|
1682 | 1762 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1683 | 1763 | |
---|
.. | .. |
---|
1714 | 1794 | opacityPowerField.addChangeListener(this); |
---|
1715 | 1795 | /**/ |
---|
1716 | 1796 | |
---|
1717 | | - resetSlidersButton.addActionListener(this); |
---|
1718 | 1797 | clearMaterialButton.addActionListener(this); |
---|
1719 | 1798 | createMaterialButton.addActionListener(this); |
---|
1720 | | - |
---|
1721 | | - propagateToggle.addItemListener(this); |
---|
1722 | | - multiplyToggle.addItemListener(this); |
---|
| 1799 | + |
---|
| 1800 | + if (Globals.ADVANCED) |
---|
| 1801 | + { |
---|
| 1802 | + resetSlidersButton.addActionListener(this); |
---|
| 1803 | + propagateToggle.addItemListener(this); |
---|
| 1804 | + multiplyToggle.addItemListener(this); |
---|
| 1805 | + } |
---|
1723 | 1806 | } |
---|
1724 | 1807 | |
---|
1725 | 1808 | void DropFile(java.io.File[] files, boolean textures) |
---|
.. | .. |
---|
1890 | 1973 | |
---|
1891 | 1974 | //? flashIt = false; |
---|
1892 | 1975 | CameraPane pane = (CameraPane) cameraView; |
---|
1893 | | - pane.clickStart(location.x, location.y, 0); |
---|
| 1976 | + pane.clickStart(location.x, location.y, 0, 0); |
---|
1894 | 1977 | pane.clickEnd(location.x, location.y, 0, true); |
---|
1895 | 1978 | |
---|
1896 | 1979 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
1939 | 2022 | e2.printStackTrace(); |
---|
1940 | 2023 | } |
---|
1941 | 2024 | } |
---|
| 2025 | + |
---|
1942 | 2026 | LoadJMEThread loadThread; |
---|
1943 | 2027 | |
---|
1944 | 2028 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
1996 | 2080 | //LoadFile0(filename, converter); |
---|
1997 | 2081 | } |
---|
1998 | 2082 | } |
---|
| 2083 | + |
---|
1999 | 2084 | LoadOBJThread loadObjThread; |
---|
2000 | 2085 | |
---|
2001 | 2086 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2074 | 2159 | |
---|
2075 | 2160 | void LoadObjFile(String fullname) |
---|
2076 | 2161 | { |
---|
2077 | | - /* |
---|
| 2162 | + System.out.println("Loading " + fullname); |
---|
| 2163 | + /**/ |
---|
2078 | 2164 | //lastFilename = fullname; |
---|
2079 | 2165 | if(loadObjThread == null) |
---|
2080 | 2166 | { |
---|
2081 | | - loadObjThread = new LoadOBJThread(); |
---|
2082 | | - loadObjThread.start(); |
---|
| 2167 | + loadObjThread = new LoadOBJThread(); |
---|
| 2168 | + loadObjThread.start(); |
---|
2083 | 2169 | } |
---|
2084 | 2170 | |
---|
2085 | 2171 | loadObjThread.add(fullname); |
---|
2086 | | - */ |
---|
| 2172 | + /**/ |
---|
2087 | 2173 | |
---|
2088 | | - System.out.println("Loading " + fullname); |
---|
2089 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2174 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2090 | 2175 | } |
---|
2091 | 2176 | |
---|
2092 | 2177 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2347 | 2432 | |
---|
2348 | 2433 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2349 | 2434 | { |
---|
2350 | | - if (GrafreeD.standAlone) |
---|
| 2435 | + if (Grafreed.standAlone) |
---|
2351 | 2436 | { |
---|
2352 | 2437 | /**/ |
---|
2353 | 2438 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2354 | | - browser.show(); |
---|
| 2439 | + browser.setVisible(true); |
---|
2355 | 2440 | String filename = browser.getFile(); |
---|
2356 | 2441 | if (filename != null && filename.length() > 0) |
---|
2357 | 2442 | { |
---|
.. | .. |
---|
2496 | 2581 | } |
---|
2497 | 2582 | if (input == null) |
---|
2498 | 2583 | { |
---|
| 2584 | + new Exception().printStackTrace(); |
---|
2499 | 2585 | System.exit(0); |
---|
2500 | 2586 | } |
---|
2501 | 2587 | |
---|
.. | .. |
---|
2710 | 2796 | return; |
---|
2711 | 2797 | } |
---|
2712 | 2798 | |
---|
2713 | | - multiplyToggle.setSelected(mat.multiply); |
---|
| 2799 | + if (multiplyToggle != null) |
---|
| 2800 | + multiplyToggle.setSelected(mat.multiply); |
---|
2714 | 2801 | |
---|
2715 | 2802 | assert (object.projectedVertices != null); |
---|
2716 | 2803 | |
---|
.. | .. |
---|
2925 | 3012 | frame.validate(); |
---|
2926 | 3013 | |
---|
2927 | 3014 | return; |
---|
2928 | | - } else if (event.getSource() == toggleRandomItem) |
---|
| 3015 | + } else if (event.getSource() == toggleSwitchItem) |
---|
2929 | 3016 | { |
---|
2930 | | - cameraView.ToggleRandom(); |
---|
| 3017 | + cameraView.ToggleSwitch(); |
---|
2931 | 3018 | cameraView.repaint(); |
---|
2932 | 3019 | return; |
---|
2933 | 3020 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
2956 | 3043 | { |
---|
2957 | 3044 | copy.live ^= true; |
---|
2958 | 3045 | return; |
---|
| 3046 | + } else if (event.getSource() == selectCB) |
---|
| 3047 | + { |
---|
| 3048 | + copy.dontselect ^= true; |
---|
| 3049 | + return; |
---|
2959 | 3050 | } else if (event.getSource() == hideCB) |
---|
2960 | 3051 | { |
---|
2961 | 3052 | copy.hide ^= true; |
---|
.. | .. |
---|
2970 | 3061 | if (event.getSource() == randomCB) |
---|
2971 | 3062 | { |
---|
2972 | 3063 | copy.random ^= true; |
---|
| 3064 | + objEditor.refreshContents(); |
---|
2973 | 3065 | return; |
---|
2974 | 3066 | } |
---|
2975 | 3067 | if (event.getSource() == speedupCB) |
---|
.. | .. |
---|
2993 | 3085 | |
---|
2994 | 3086 | public void actionPerformed(ActionEvent event) |
---|
2995 | 3087 | { |
---|
| 3088 | + Object source = event.getSource(); |
---|
2996 | 3089 | // SCRIPT DIALOG |
---|
2997 | | - if (event.getSource() == okbutton) |
---|
| 3090 | + if (source == okbutton) |
---|
2998 | 3091 | { |
---|
2999 | 3092 | textpanel.setVisible(false); |
---|
3000 | 3093 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3006 | 3099 | textarea = null; |
---|
3007 | 3100 | textpanel = null; |
---|
3008 | 3101 | } |
---|
3009 | | - if (event.getSource() == cancelbutton) |
---|
| 3102 | + if (source == cancelbutton) |
---|
3010 | 3103 | { |
---|
3011 | 3104 | textpanel.setVisible(false); |
---|
3012 | 3105 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3018 | 3111 | //applySelf(); |
---|
3019 | 3112 | //client.refreshEditWindow(); |
---|
3020 | 3113 | //refreshContents(); |
---|
3021 | | - if (event.getSource() == nameField) |
---|
| 3114 | + if (source == nameField) |
---|
3022 | 3115 | { |
---|
3023 | 3116 | //System.out.println("ObjEditor " + event); |
---|
3024 | 3117 | applySelf0(true); |
---|
3025 | 3118 | //parent.applySelf(); |
---|
3026 | 3119 | objEditor.refreshContents(); |
---|
3027 | | - } else if (event.getSource() == resetButton) |
---|
| 3120 | + } else if (source == resetButton) |
---|
3028 | 3121 | { |
---|
3029 | 3122 | CameraPane.fullreset = true; |
---|
3030 | 3123 | copy.Reset(); // ResetMeshes(); |
---|
3031 | 3124 | copy.Touch(); |
---|
3032 | 3125 | objEditor.refreshContents(); |
---|
3033 | | - } else if (event.getSource() == stepItem) |
---|
| 3126 | + } else if (source == stepItem) |
---|
3034 | 3127 | { |
---|
3035 | 3128 | //cameraView.ONESTEP = true; |
---|
3036 | 3129 | Globals.ONESTEP = true; |
---|
3037 | 3130 | cameraView.repaint(); |
---|
3038 | 3131 | return; |
---|
3039 | | - } else if (event.getSource() == stepButton) |
---|
| 3132 | + } else if (source == stepButton) |
---|
3040 | 3133 | { |
---|
3041 | 3134 | copy.Step(); |
---|
3042 | 3135 | copy.Touch(); |
---|
3043 | 3136 | objEditor.refreshContents(); |
---|
3044 | | - } else if (event.getSource() == slowerButton) |
---|
| 3137 | + } else if (source == slowerButton) |
---|
3045 | 3138 | { |
---|
3046 | 3139 | copy.Slower(); |
---|
3047 | 3140 | copy.Touch(); |
---|
3048 | 3141 | objEditor.refreshContents(); |
---|
3049 | | - } else if (event.getSource() == fasterButton) |
---|
| 3142 | + } else if (source == fasterButton) |
---|
3050 | 3143 | { |
---|
3051 | 3144 | copy.Faster(); |
---|
3052 | 3145 | copy.Touch(); |
---|
3053 | 3146 | objEditor.refreshContents(); |
---|
3054 | | - } else if (event.getSource() == remarkButton) |
---|
| 3147 | + } else if (source == remarkButton) |
---|
3055 | 3148 | { |
---|
3056 | 3149 | copy.Remark(); |
---|
3057 | 3150 | copy.Touch(); |
---|
3058 | 3151 | objEditor.refreshContents(); |
---|
3059 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3152 | + } else if (source == stepAllButton) |
---|
3060 | 3153 | { |
---|
3061 | 3154 | copy.StepAll(); |
---|
3062 | 3155 | copy.Touch(); |
---|
3063 | 3156 | objEditor.refreshContents(); |
---|
3064 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3157 | + } else if (source == resetAllButton) |
---|
3065 | 3158 | { |
---|
3066 | 3159 | //CameraPane.fullreset = true; |
---|
3067 | 3160 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3094 | 3187 | // Close(); |
---|
3095 | 3188 | // } |
---|
3096 | 3189 | // else |
---|
3097 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3190 | + if (source == resetSlidersButton) |
---|
3098 | 3191 | { |
---|
3099 | 3192 | ResetSliders(); |
---|
3100 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3193 | + } else if (source == clearMaterialButton) |
---|
3101 | 3194 | { |
---|
3102 | 3195 | ClearMaterial(); |
---|
3103 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3196 | + } else if (source == createMaterialButton) |
---|
3104 | 3197 | { |
---|
3105 | 3198 | CreateMaterial(); |
---|
3106 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3199 | + } else if (source == clearPanelButton) |
---|
3107 | 3200 | { |
---|
3108 | 3201 | copy.ClearUI(); |
---|
3109 | 3202 | refreshContents(true); |
---|
3110 | | - } /* |
---|
3111 | | - } |
---|
3112 | | - |
---|
3113 | | - public boolean action(Event event, Object arg) |
---|
3114 | | - { |
---|
3115 | | - */ else if (event.getSource() == closeItem) |
---|
| 3203 | + } else if (source == importGFDItem) |
---|
| 3204 | + { |
---|
| 3205 | + ImportGFD(); |
---|
| 3206 | + } else |
---|
| 3207 | + if (source == importVRMLX3DItem) |
---|
| 3208 | + { |
---|
| 3209 | + ImportVRMLX3D(); |
---|
| 3210 | + } else |
---|
| 3211 | + if (source == import3DSItem) |
---|
| 3212 | + { |
---|
| 3213 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3214 | + } else |
---|
| 3215 | + if (source == importOBJItem) |
---|
| 3216 | + { |
---|
| 3217 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3218 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3219 | + browser.setVisible(true); |
---|
| 3220 | + String filename = browser.getFile(); |
---|
| 3221 | + if (filename != null && filename.length() > 0) |
---|
| 3222 | + { |
---|
| 3223 | + String fullname = browser.getDirectory() + filename; |
---|
| 3224 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3225 | + } |
---|
| 3226 | + } else |
---|
| 3227 | + if (source == closeItem) |
---|
3116 | 3228 | { |
---|
3117 | 3229 | Close(); |
---|
3118 | 3230 | //return true; |
---|
3119 | | - } else if (event.getSource() == loadItem) |
---|
| 3231 | + } else if (source == loadItem) |
---|
3120 | 3232 | { |
---|
3121 | 3233 | load(); |
---|
3122 | 3234 | //return true; |
---|
3123 | | - } else if (event.getSource() == saveItem) |
---|
| 3235 | + } else if (source == newItem) |
---|
| 3236 | + { |
---|
| 3237 | + New(); |
---|
| 3238 | + } else if (source == saveItem) |
---|
3124 | 3239 | { |
---|
3125 | 3240 | save(); |
---|
3126 | 3241 | //return true; |
---|
3127 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3242 | + } else if (source == saveAsItem) |
---|
3128 | 3243 | { |
---|
3129 | 3244 | saveAs(); |
---|
3130 | 3245 | //return true; |
---|
3131 | | - } else if (event.getSource() == reexportItem) |
---|
| 3246 | + } else if (source == reexportItem) |
---|
3132 | 3247 | { |
---|
3133 | 3248 | reexport(); |
---|
3134 | 3249 | //return true; |
---|
3135 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3250 | + } else if (source == exportAsItem) |
---|
3136 | 3251 | { |
---|
3137 | 3252 | export(); |
---|
3138 | 3253 | //return true; |
---|
3139 | | - } else if (event.getSource() == povItem) |
---|
| 3254 | + } else if (source == povItem) |
---|
3140 | 3255 | { |
---|
3141 | 3256 | generatePOV(); |
---|
3142 | 3257 | //return true; |
---|
3143 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3258 | + } else if (source == zBufferItem) |
---|
3144 | 3259 | { |
---|
3145 | 3260 | try |
---|
3146 | 3261 | { |
---|
.. | .. |
---|
3162 | 3277 | cameraView.repaint(); |
---|
3163 | 3278 | //return true; |
---|
3164 | 3279 | } |
---|
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) |
---|
| 3280 | + */ else // combos... |
---|
| 3281 | + if (source == texresMenu) |
---|
3180 | 3282 | { |
---|
3181 | 3283 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3182 | 3284 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3188 | 3290 | } |
---|
3189 | 3291 | } |
---|
3190 | 3292 | |
---|
| 3293 | + void New() |
---|
| 3294 | + { |
---|
| 3295 | + while (copy.Size() > 1) |
---|
| 3296 | + { |
---|
| 3297 | + copy.remove(1); |
---|
| 3298 | + } |
---|
| 3299 | + |
---|
| 3300 | + ResetModel(); |
---|
| 3301 | + objEditor.refreshContents(); |
---|
| 3302 | + } |
---|
| 3303 | + |
---|
| 3304 | + static public byte[] Compress(Object3D o) |
---|
| 3305 | + { |
---|
| 3306 | + try |
---|
| 3307 | + { |
---|
| 3308 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3309 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3310 | + ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3311 | + |
---|
| 3312 | + Object3D parent = o.parent; |
---|
| 3313 | + o.parent = null; |
---|
| 3314 | + |
---|
| 3315 | + out.writeObject(o); |
---|
| 3316 | + |
---|
| 3317 | + o.parent = parent; |
---|
| 3318 | + |
---|
| 3319 | + out.flush(); |
---|
| 3320 | + |
---|
| 3321 | + zstream.close(); |
---|
| 3322 | + out.close(); |
---|
| 3323 | + |
---|
| 3324 | + return baos.toByteArray(); |
---|
| 3325 | + } catch (Exception e) |
---|
| 3326 | + { |
---|
| 3327 | + System.err.println(e); |
---|
| 3328 | + return null; |
---|
| 3329 | + } |
---|
| 3330 | + } |
---|
| 3331 | + |
---|
| 3332 | + static public Object Uncompress(byte[] bytes) |
---|
| 3333 | + { |
---|
| 3334 | + System.out.println("#bytes = " + bytes.length); |
---|
| 3335 | + try |
---|
| 3336 | + { |
---|
| 3337 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3338 | + java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3339 | + ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3340 | + Object obj = in.readObject(); |
---|
| 3341 | + in.close(); |
---|
| 3342 | + |
---|
| 3343 | + return obj; |
---|
| 3344 | + } catch (Exception e) |
---|
| 3345 | + { |
---|
| 3346 | + System.err.println(e); |
---|
| 3347 | + return null; |
---|
| 3348 | + } |
---|
| 3349 | + } |
---|
| 3350 | + |
---|
| 3351 | + static public Object clone(Object o) |
---|
| 3352 | + { |
---|
| 3353 | + try |
---|
| 3354 | + { |
---|
| 3355 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3356 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3357 | + |
---|
| 3358 | + out.writeObject(o); |
---|
| 3359 | + |
---|
| 3360 | + out.flush(); |
---|
| 3361 | + out.close(); |
---|
| 3362 | + |
---|
| 3363 | + byte[] bytes = baos.toByteArray(); |
---|
| 3364 | + |
---|
| 3365 | + System.out.println("clone = " + bytes.length); |
---|
| 3366 | + |
---|
| 3367 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3368 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3369 | + Object obj = in.readObject(); |
---|
| 3370 | + in.close(); |
---|
| 3371 | + |
---|
| 3372 | + return obj; |
---|
| 3373 | + } catch (Exception e) |
---|
| 3374 | + { |
---|
| 3375 | + System.err.println(e); |
---|
| 3376 | + return null; |
---|
| 3377 | + } |
---|
| 3378 | + } |
---|
| 3379 | + |
---|
| 3380 | + cRadio GetCurrentTab() |
---|
| 3381 | + { |
---|
| 3382 | + cRadio ab; |
---|
| 3383 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3384 | + { |
---|
| 3385 | + ab = (cRadio)e.nextElement(); |
---|
| 3386 | + if(ab.GetObject() == copy) |
---|
| 3387 | + { |
---|
| 3388 | + return ab; |
---|
| 3389 | + } |
---|
| 3390 | + } |
---|
| 3391 | + |
---|
| 3392 | + return null; |
---|
| 3393 | + } |
---|
| 3394 | + |
---|
| 3395 | + java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3396 | + |
---|
| 3397 | + public void Save() |
---|
| 3398 | + { |
---|
| 3399 | + cRadio tab = GetCurrentTab(); |
---|
| 3400 | + |
---|
| 3401 | + boolean temp = CameraPane.SWITCH; |
---|
| 3402 | + CameraPane.SWITCH = false; |
---|
| 3403 | + |
---|
| 3404 | + copy.ExtractBigData(hashtable); |
---|
| 3405 | + |
---|
| 3406 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3407 | + tab.graphs[tab.undoindex++] = Compress(copy); |
---|
| 3408 | + |
---|
| 3409 | + copy.RestoreBigData(hashtable); |
---|
| 3410 | + |
---|
| 3411 | + CameraPane.SWITCH = temp; |
---|
| 3412 | + |
---|
| 3413 | + //assert(hashtable.isEmpty()); |
---|
| 3414 | + |
---|
| 3415 | + for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3416 | + { |
---|
| 3417 | + tab.graphs[i] = null; |
---|
| 3418 | + } |
---|
| 3419 | + |
---|
| 3420 | + // test save |
---|
| 3421 | + if (false) |
---|
| 3422 | + { |
---|
| 3423 | + try |
---|
| 3424 | + { |
---|
| 3425 | + FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3426 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3427 | + |
---|
| 3428 | + p.writeObject(copy); |
---|
| 3429 | + |
---|
| 3430 | + p.flush(); |
---|
| 3431 | + |
---|
| 3432 | + ostream.close(); |
---|
| 3433 | + } catch (Exception e) |
---|
| 3434 | + { |
---|
| 3435 | + e.printStackTrace(); |
---|
| 3436 | + } |
---|
| 3437 | + } |
---|
| 3438 | + } |
---|
| 3439 | + |
---|
| 3440 | + void CopyChanged(Object3D obj) |
---|
| 3441 | + { |
---|
| 3442 | + boolean temp = CameraPane.SWITCH; |
---|
| 3443 | + CameraPane.SWITCH = false; |
---|
| 3444 | + |
---|
| 3445 | + copy.ExtractBigData(hashtable); |
---|
| 3446 | + |
---|
| 3447 | + copy.clear(); |
---|
| 3448 | + |
---|
| 3449 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3450 | + { |
---|
| 3451 | + copy.add(obj.get(i)); |
---|
| 3452 | + } |
---|
| 3453 | + |
---|
| 3454 | + copy.RestoreBigData(hashtable); |
---|
| 3455 | + |
---|
| 3456 | + CameraPane.SWITCH = temp; |
---|
| 3457 | + |
---|
| 3458 | + //assert(hashtable.isEmpty()); |
---|
| 3459 | + |
---|
| 3460 | + copy.Touch(); |
---|
| 3461 | + |
---|
| 3462 | + ResetModel(); |
---|
| 3463 | + copy.HardTouch(); // recompile? |
---|
| 3464 | + |
---|
| 3465 | + cRadio ab; |
---|
| 3466 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3467 | + { |
---|
| 3468 | + ab = (cRadio)e.nextElement(); |
---|
| 3469 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3470 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3471 | + if (test != null) |
---|
| 3472 | + { |
---|
| 3473 | + test.editWindow = ab.object.editWindow; |
---|
| 3474 | + ab.object = test; |
---|
| 3475 | + } |
---|
| 3476 | + } |
---|
| 3477 | + |
---|
| 3478 | + refreshContents(); |
---|
| 3479 | + } |
---|
| 3480 | + |
---|
| 3481 | + public void Undo() |
---|
| 3482 | + { |
---|
| 3483 | + cRadio tab = GetCurrentTab(); |
---|
| 3484 | + |
---|
| 3485 | + if (tab.undoindex == 0) |
---|
| 3486 | + { |
---|
| 3487 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3488 | + return; |
---|
| 3489 | + } |
---|
| 3490 | + |
---|
| 3491 | + if (tab.graphs[tab.undoindex] == null) |
---|
| 3492 | + { |
---|
| 3493 | + Save(); |
---|
| 3494 | + tab.undoindex -= 1; |
---|
| 3495 | + } |
---|
| 3496 | + |
---|
| 3497 | + tab.undoindex -= 1; |
---|
| 3498 | + |
---|
| 3499 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3500 | + } |
---|
| 3501 | + |
---|
| 3502 | + public void Redo() |
---|
| 3503 | + { |
---|
| 3504 | + cRadio tab = GetCurrentTab(); |
---|
| 3505 | + |
---|
| 3506 | + if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3507 | + { |
---|
| 3508 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3509 | + return; |
---|
| 3510 | + } |
---|
| 3511 | + |
---|
| 3512 | + tab.undoindex += 1; |
---|
| 3513 | + |
---|
| 3514 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3515 | + } |
---|
| 3516 | + |
---|
| 3517 | + void ImportGFD() |
---|
| 3518 | + { |
---|
| 3519 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 3520 | + browser.show(); |
---|
| 3521 | + String filename = browser.getFile(); |
---|
| 3522 | + if (filename != null && filename.length() > 0) |
---|
| 3523 | + { |
---|
| 3524 | + String fullname = browser.getDirectory() + filename; |
---|
| 3525 | + |
---|
| 3526 | + //Object3D readobj = |
---|
| 3527 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 3528 | + //makeSomething(readobj); |
---|
| 3529 | + } |
---|
| 3530 | + } |
---|
| 3531 | + |
---|
| 3532 | + void ImportVRMLX3D() |
---|
| 3533 | + { |
---|
| 3534 | + if (Grafreed.standAlone) |
---|
| 3535 | + { |
---|
| 3536 | + /**/ |
---|
| 3537 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 3538 | + browser.show(); |
---|
| 3539 | + String filename = browser.getFile(); |
---|
| 3540 | + if (filename != null && filename.length() > 0) |
---|
| 3541 | + { |
---|
| 3542 | + String fullname = browser.getDirectory() + filename; |
---|
| 3543 | + LoadVRMLX3D(fullname); |
---|
| 3544 | + } |
---|
| 3545 | + /**/ |
---|
| 3546 | + } |
---|
| 3547 | + } |
---|
| 3548 | + |
---|
3191 | 3549 | void ToggleAnimation() |
---|
3192 | 3550 | { |
---|
3193 | 3551 | if (!Globals.ANIMATION) |
---|
3194 | 3552 | { |
---|
3195 | 3553 | FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); |
---|
3196 | | - browser.show(); |
---|
| 3554 | + browser.setVisible(true); |
---|
3197 | 3555 | String filename = browser.getFile(); |
---|
3198 | 3556 | if (filename != null && filename.length() > 0) |
---|
3199 | 3557 | { |
---|
.. | .. |
---|
3203 | 3561 | |
---|
3204 | 3562 | Globals.ANIMATION ^= true; |
---|
3205 | 3563 | |
---|
3206 | | - GrafreeD.wav.cursor = 0; |
---|
3207 | | - GrafreeD.wav.loop = 0; |
---|
| 3564 | + Grafreed.wav.cursor = 0; |
---|
| 3565 | + Grafreed.wav.loop = 0; |
---|
3208 | 3566 | } |
---|
3209 | 3567 | } else |
---|
3210 | 3568 | { |
---|
.. | .. |
---|
3254 | 3612 | void CreateMaterial() |
---|
3255 | 3613 | { |
---|
3256 | 3614 | //copy.ClearMaterial(); // PATCH |
---|
3257 | | - copy.CreateMaterialS(multiplyToggle.isSelected()); |
---|
| 3615 | + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); |
---|
3258 | 3616 | if (copy.selection.size() > 0) |
---|
3259 | 3617 | //SetMaterial(copy); |
---|
3260 | 3618 | { |
---|
.. | .. |
---|
3313 | 3671 | { |
---|
3314 | 3672 | copy.ResetBlockLoop(); // temporary problem |
---|
3315 | 3673 | |
---|
3316 | | - boolean random = CameraPane.RANDOM; |
---|
3317 | | - CameraPane.RANDOM = false; // parse everything |
---|
| 3674 | + boolean random = CameraPane.SWITCH; |
---|
| 3675 | + CameraPane.SWITCH = false; // parse everything |
---|
3318 | 3676 | copy.ResetDisplayList(); |
---|
3319 | 3677 | copy.HardTouch(); |
---|
3320 | | - CameraPane.RANDOM = random; |
---|
| 3678 | + CameraPane.SWITCH = random; |
---|
3321 | 3679 | } |
---|
3322 | 3680 | |
---|
3323 | 3681 | // public void applySelf() |
---|
.. | .. |
---|
3391 | 3749 | { |
---|
3392 | 3750 | //System.out.println("Propagate = " + propagate); |
---|
3393 | 3751 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 3752 | + |
---|
| 3753 | + if (copy.material != null) |
---|
| 3754 | + { |
---|
| 3755 | + cMaterial mat = copy.material; |
---|
| 3756 | + |
---|
| 3757 | + colorField.SetToolTipValue((mat.color)); |
---|
| 3758 | + modulationField.SetToolTipValue((mat.modulation)); |
---|
| 3759 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 3760 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 3761 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 3762 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 3763 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 3764 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 3765 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 3766 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 3767 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 3768 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 3769 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 3770 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 3771 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 3772 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 3773 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 3774 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 3775 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 3776 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 3777 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 3778 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 3779 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 3780 | + } |
---|
| 3781 | + |
---|
3394 | 3782 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3395 | 3783 | { |
---|
3396 | 3784 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3435 | 3823 | || e.getSource() == apertureField |
---|
3436 | 3824 | || e.getSource() == shadowblurField) |
---|
3437 | 3825 | { |
---|
| 3826 | + new Exception().printStackTrace(); |
---|
3438 | 3827 | System.exit(0); |
---|
3439 | 3828 | cameraView.options1[0] = (float) focusField.getFloat() * 10; |
---|
3440 | 3829 | cameraView.options1[1] = (float) apertureField.getFloat() / 1000; |
---|
.. | .. |
---|
3505 | 3894 | } |
---|
3506 | 3895 | |
---|
3507 | 3896 | if (normalpushField != null) |
---|
3508 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 3897 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3509 | 3898 | } |
---|
3510 | 3899 | |
---|
3511 | 3900 | void SnapObject() |
---|
.. | .. |
---|
3769 | 4158 | |
---|
3770 | 4159 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3771 | 4160 | { |
---|
| 4161 | + Save(); |
---|
3772 | 4162 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3773 | 4163 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3774 | 4164 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3972 | 4362 | } |
---|
3973 | 4363 | } |
---|
3974 | 4364 | } |
---|
| 4365 | + |
---|
3975 | 4366 | LoadGFDThread loadGFDThread; |
---|
3976 | 4367 | |
---|
3977 | 4368 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
3991 | 4382 | |
---|
3992 | 4383 | try |
---|
3993 | 4384 | { |
---|
| 4385 | + // Try compressed version first. |
---|
3994 | 4386 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
3995 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4387 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4388 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
3996 | 4389 | |
---|
3997 | 4390 | readobj = (Object3D) p.readObject(); |
---|
3998 | 4391 | istream.close(); |
---|
.. | .. |
---|
4000 | 4393 | readobj.ResetDisplayList(); |
---|
4001 | 4394 | } catch (Exception e) |
---|
4002 | 4395 | { |
---|
4003 | | - e.printStackTrace(); |
---|
| 4396 | + //e.printStackTrace(); |
---|
| 4397 | + try |
---|
| 4398 | + { |
---|
| 4399 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4400 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4401 | + |
---|
| 4402 | + readobj = (Object3D) p.readObject(); |
---|
| 4403 | + istream.close(); |
---|
| 4404 | + |
---|
| 4405 | + readobj.ResetDisplayList(); |
---|
| 4406 | + } catch (Exception e2) |
---|
| 4407 | + { |
---|
| 4408 | + e2.printStackTrace(); |
---|
| 4409 | + } |
---|
4004 | 4410 | } |
---|
4005 | 4411 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4006 | 4412 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4046 | 4452 | |
---|
4047 | 4453 | void LoadIt(Object obj) |
---|
4048 | 4454 | { |
---|
| 4455 | + if (obj == null) |
---|
| 4456 | + { |
---|
| 4457 | + // Invalid file |
---|
| 4458 | + return; |
---|
| 4459 | + } |
---|
| 4460 | + |
---|
4049 | 4461 | System.out.println("Loaded " + obj); |
---|
4050 | 4462 | //new Exception().printStackTrace(); |
---|
4051 | 4463 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4055 | 4467 | |
---|
4056 | 4468 | if (readobj != null) |
---|
4057 | 4469 | { |
---|
| 4470 | + Save(); |
---|
4058 | 4471 | try |
---|
4059 | 4472 | { |
---|
4060 | 4473 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4117 | 4530 | |
---|
4118 | 4531 | void load() // throws ClassNotFoundException |
---|
4119 | 4532 | { |
---|
4120 | | - if (GrafreeD.standAlone) |
---|
| 4533 | + if (Grafreed.standAlone) |
---|
4121 | 4534 | { |
---|
4122 | 4535 | FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
4123 | 4536 | browser.show(); |
---|
.. | .. |
---|
4204 | 4617 | try |
---|
4205 | 4618 | { |
---|
4206 | 4619 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4207 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4620 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4621 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4208 | 4622 | |
---|
4209 | 4623 | p.writeObject(copy); |
---|
4210 | 4624 | p.flush(); |
---|
4211 | 4625 | |
---|
| 4626 | + zstream.close(); |
---|
4212 | 4627 | ostream.close(); |
---|
4213 | 4628 | |
---|
4214 | 4629 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4218 | 4633 | { |
---|
4219 | 4634 | } |
---|
4220 | 4635 | } |
---|
| 4636 | + |
---|
4221 | 4637 | String lastname; |
---|
4222 | 4638 | |
---|
4223 | 4639 | void saveAs() |
---|
4224 | 4640 | { |
---|
4225 | | - if (GrafreeD.standAlone) |
---|
| 4641 | + if (Grafreed.standAlone) |
---|
4226 | 4642 | { |
---|
4227 | 4643 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4228 | 4644 | browser.setVisible(true); |
---|
.. | .. |
---|
4327 | 4743 | try |
---|
4328 | 4744 | { |
---|
4329 | 4745 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4330 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4331 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 4746 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4747 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4332 | 4748 | |
---|
4333 | 4749 | Object3D objectparent = obj.parent; |
---|
4334 | 4750 | obj.parent = null; |
---|
4335 | 4751 | |
---|
4336 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 4752 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4337 | 4753 | |
---|
4338 | 4754 | obj.parent = objectparent; |
---|
4339 | 4755 | |
---|
.. | .. |
---|
4345 | 4761 | p.writeObject(object); |
---|
4346 | 4762 | p.flush(); |
---|
4347 | 4763 | |
---|
| 4764 | + zstream.close(); |
---|
4348 | 4765 | ostream.close(); |
---|
4349 | | - // zstream.close(); |
---|
4350 | 4766 | |
---|
4351 | 4767 | // group.selection.get(0).parent = parent; |
---|
4352 | 4768 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4367 | 4783 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4368 | 4784 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4369 | 4785 | copy.generatePOV(buffer); |
---|
4370 | | - if (GrafreeD.standAlone) |
---|
| 4786 | + if (Grafreed.standAlone) |
---|
4371 | 4787 | { |
---|
4372 | 4788 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4373 | 4789 | browser.show(); |
---|
.. | .. |
---|
4393 | 4809 | Object3D client; |
---|
4394 | 4810 | Object3D copy; |
---|
4395 | 4811 | MenuBar menuBar; |
---|
4396 | | - Menu windowMenu; |
---|
| 4812 | + Menu fileMenu; |
---|
| 4813 | + MenuItem newItem; |
---|
4397 | 4814 | MenuItem loadItem; |
---|
4398 | 4815 | MenuItem saveItem; |
---|
4399 | 4816 | MenuItem saveAsItem; |
---|
.. | .. |
---|
4401 | 4818 | MenuItem reexportItem; |
---|
4402 | 4819 | MenuItem povItem; |
---|
4403 | 4820 | MenuItem closeItem; |
---|
4404 | | - Menu cameraMenu; |
---|
| 4821 | + |
---|
4405 | 4822 | CheckboxMenuItem zBufferItem; |
---|
4406 | 4823 | //MenuItem normalLensItem; |
---|
4407 | | - MenuItem editCameraItem; |
---|
4408 | | - MenuItem revertCameraItem; |
---|
4409 | | - CheckboxMenuItem toggleLiveItem; |
---|
4410 | 4824 | MenuItem stepItem; |
---|
| 4825 | + CheckboxMenuItem toggleLiveItem; |
---|
4411 | 4826 | CheckboxMenuItem toggleFullScreenItem; |
---|
4412 | 4827 | CheckboxMenuItem toggleTimelineItem; |
---|
4413 | 4828 | CheckboxMenuItem toggleRenderItem; |
---|
.. | .. |
---|
4416 | 4831 | CheckboxMenuItem toggleFootContactItem; |
---|
4417 | 4832 | CheckboxMenuItem toggleDLItem; |
---|
4418 | 4833 | CheckboxMenuItem toggleTextureItem; |
---|
4419 | | - CheckboxMenuItem toggleRandomItem; |
---|
| 4834 | + CheckboxMenuItem toggleSwitchItem; |
---|
4420 | 4835 | CheckboxMenuItem toggleRootItem; |
---|
4421 | 4836 | CheckboxMenuItem animationItem; |
---|
4422 | 4837 | CheckboxMenuItem toggleHandleItem; |
---|
.. | .. |
---|
4424 | 4839 | JSplitPane mainPanel; |
---|
4425 | 4840 | JScrollPane scrollpane; |
---|
4426 | 4841 | JPanel toolbarPanel; |
---|
4427 | | - JPanel treePanel; |
---|
| 4842 | + cGridBag treePanel; |
---|
4428 | 4843 | JPanel radioPanel; |
---|
4429 | 4844 | ButtonGroup buttonGroup; |
---|
4430 | 4845 | cGridBag ctrlPanel; |
---|
.. | .. |
---|
4553 | 4968 | //ObjectUI parent; |
---|
4554 | 4969 | |
---|
4555 | 4970 | cNumberSlider normalpushField; |
---|
| 4971 | + |
---|
| 4972 | + private MenuItem importGFDItem; |
---|
| 4973 | + private MenuItem importVRMLX3DItem; |
---|
| 4974 | + private MenuItem import3DSItem; |
---|
| 4975 | + private MenuItem importOBJItem; |
---|
4556 | 4976 | } |
---|