.. | .. |
---|
4 | 4 | |
---|
5 | 5 | import java.awt.*; |
---|
6 | 6 | import java.awt.event.*; |
---|
| 7 | +import java.awt.image.BufferedImage; |
---|
7 | 8 | import javax.swing.*; |
---|
8 | 9 | import javax.swing.event.*; |
---|
9 | 10 | import javax.swing.text.*; |
---|
.. | .. |
---|
13 | 14 | import javax.swing.plaf.metal.MetalLookAndFeel; |
---|
14 | 15 | //import javax.swing.plaf.ColorUIResource; |
---|
15 | 16 | //import javax.swing.plaf.metal.DefaultMetalTheme; |
---|
| 17 | + |
---|
| 18 | +import javax.swing.plaf.basic.BasicSplitPaneDivider; |
---|
| 19 | +import javax.swing.plaf.basic.BasicSplitPaneUI; |
---|
16 | 20 | |
---|
17 | 21 | //import javax.media.opengl.GLCanvas; |
---|
18 | 22 | |
---|
.. | .. |
---|
35 | 39 | |
---|
36 | 40 | GroupEditor callee; |
---|
37 | 41 | JFrame frame; |
---|
| 42 | + |
---|
| 43 | + static ObjEditor theFrame; |
---|
| 44 | + |
---|
| 45 | + cButton GetButton(String name, boolean border) |
---|
| 46 | + { |
---|
| 47 | + try |
---|
| 48 | + { |
---|
| 49 | + ImageIcon icon = GetIcon(name); |
---|
| 50 | + return new cButton(icon, border); |
---|
| 51 | + } |
---|
| 52 | + catch (Exception e) |
---|
| 53 | + { |
---|
| 54 | + return new cButton(name, border); |
---|
| 55 | + } |
---|
| 56 | + } |
---|
| 57 | + |
---|
| 58 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 59 | + { |
---|
| 60 | + try |
---|
| 61 | + { |
---|
| 62 | + ImageIcon icon = GetIcon(name); |
---|
| 63 | + return new cToggleButton(icon, border); |
---|
| 64 | + } |
---|
| 65 | + catch (Exception e) |
---|
| 66 | + { |
---|
| 67 | + return new cToggleButton(name, border); |
---|
| 68 | + } |
---|
| 69 | + } |
---|
| 70 | + |
---|
| 71 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 72 | + { |
---|
| 73 | + try |
---|
| 74 | + { |
---|
| 75 | + ImageIcon icon = GetIcon(name); |
---|
| 76 | + return new cCheckBox(icon, border); |
---|
| 77 | + } |
---|
| 78 | + catch (Exception e) |
---|
| 79 | + { |
---|
| 80 | + return new cCheckBox(name, border); |
---|
| 81 | + } |
---|
| 82 | + } |
---|
| 83 | + |
---|
| 84 | + private ImageIcon GetIcon(String name) throws IOException |
---|
| 85 | + { |
---|
| 86 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 87 | + |
---|
| 88 | + if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 89 | + { |
---|
| 90 | + BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
| 91 | + Graphics2D g = resized.createGraphics(); |
---|
| 92 | + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 93 | + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 94 | + g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 95 | + g.dispose(); |
---|
| 96 | + |
---|
| 97 | + image = resized; |
---|
| 98 | + } |
---|
| 99 | + |
---|
| 100 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 101 | + return icon; |
---|
| 102 | + } |
---|
38 | 103 | |
---|
39 | 104 | // SCRIPT |
---|
40 | 105 | |
---|
.. | .. |
---|
138 | 203 | public void closeUI() |
---|
139 | 204 | { |
---|
140 | 205 | //new Exception().printStackTrace(); |
---|
141 | | - System.out.println("this = " + this); |
---|
142 | | - System.out.println("objEditor = " + objEditor); |
---|
| 206 | +// System.out.println("this = " + this); |
---|
| 207 | +// System.out.println("objEditor = " + objEditor); |
---|
143 | 208 | //nameField.removeActionListener(this); |
---|
144 | | - objEditor.ctrlPanel.remove(nameField); |
---|
| 209 | +// objEditor.ctrlPanel.remove(nameField); |
---|
145 | 210 | |
---|
146 | | - if (!GroupEditor.allparams) |
---|
| 211 | + objEditor.ctrlPanel.remove(namePanel); |
---|
| 212 | + |
---|
| 213 | + if (!allparams) |
---|
147 | 214 | return; |
---|
148 | 215 | |
---|
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); |
---|
| 216 | +// objEditor.ctrlPanel.remove(liveCB); |
---|
| 217 | +// objEditor.ctrlPanel.remove(hideCB); |
---|
| 218 | +// objEditor.ctrlPanel.remove(markCB); |
---|
| 219 | +// |
---|
| 220 | +// objEditor.ctrlPanel.remove(randomCB); |
---|
| 221 | +// objEditor.ctrlPanel.remove(speedupCB); |
---|
| 222 | +// objEditor.ctrlPanel.remove(rewindCB); |
---|
| 223 | +// |
---|
| 224 | +// objEditor.ctrlPanel.remove(resetButton); |
---|
| 225 | +// objEditor.ctrlPanel.remove(stepButton); |
---|
| 226 | +//// objEditor.ctrlPanel.remove(stepAllButton); |
---|
| 227 | +//// objEditor.ctrlPanel.remove(resetAllButton); |
---|
| 228 | +// objEditor.ctrlPanel.remove(link2masterCB); |
---|
| 229 | +// //objEditor.ctrlPanel.remove(flipVCB); |
---|
| 230 | +// //objEditor.ctrlPanel.remove(texresMenu); |
---|
| 231 | +// objEditor.ctrlPanel.remove(slowerButton); |
---|
| 232 | +// objEditor.ctrlPanel.remove(fasterButton); |
---|
| 233 | +// objEditor.ctrlPanel.remove(remarkButton); |
---|
167 | 234 | |
---|
168 | | - Remove(normalpushField); |
---|
| 235 | + objEditor.ctrlPanel.remove(setupPanel); |
---|
| 236 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 237 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
| 238 | + objEditor.ctrlPanel.remove(pushPanel); |
---|
| 239 | + //objEditor.ctrlPanel.remove(fillPanel); |
---|
| 240 | + |
---|
| 241 | + //Remove(normalpushField); |
---|
169 | 242 | } |
---|
170 | 243 | |
---|
171 | 244 | public ObjEditor GetEditor() |
---|
.. | .. |
---|
236 | 309 | //localCopy.parent = null; |
---|
237 | 310 | |
---|
238 | 311 | frame = new JFrame(); |
---|
| 312 | + frame.setUndecorated(true); |
---|
239 | 313 | objEditor = this; |
---|
240 | 314 | this.callee = callee; |
---|
241 | 315 | |
---|
.. | .. |
---|
266 | 340 | return frame.action(event, obj); |
---|
267 | 341 | } |
---|
268 | 342 | |
---|
| 343 | + // Cannot work without static |
---|
| 344 | + static boolean allparams = true; |
---|
| 345 | + |
---|
| 346 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 347 | + |
---|
269 | 348 | void SetupMenu() |
---|
270 | 349 | { |
---|
271 | 350 | 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...")); |
---|
| 351 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 352 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 353 | + fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 354 | + |
---|
| 355 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 356 | + Menu menu = new Menu("Import"); |
---|
| 357 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 358 | + importOBJItem.addActionListener(this); |
---|
| 359 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 360 | + import3DSItem.addActionListener(this); |
---|
| 361 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 362 | + importVRMLX3DItem.addActionListener(this); |
---|
| 363 | + menu.add("-"); |
---|
| 364 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 365 | + importGFDItem.addActionListener(this); |
---|
| 366 | + fileMenu.add(menu); |
---|
| 367 | + fileMenu.add("-"); |
---|
| 368 | + |
---|
| 369 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 370 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
277 | 371 | //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("-"); |
---|
| 372 | + fileMenu.add("-"); |
---|
| 373 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 374 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 375 | + fileMenu.add("-"); |
---|
282 | 376 | if (client.parent != null) |
---|
283 | 377 | { |
---|
284 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 378 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
285 | 379 | } else |
---|
286 | 380 | { |
---|
287 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 381 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
288 | 382 | } |
---|
289 | 383 | |
---|
| 384 | + newItem.addActionListener(this); |
---|
290 | 385 | loadItem.addActionListener(this); |
---|
291 | 386 | saveItem.addActionListener(this); |
---|
292 | 387 | saveAsItem.addActionListener(this); |
---|
.. | .. |
---|
295 | 390 | //povItem.addActionListener(this); |
---|
296 | 391 | closeItem.addActionListener(this); |
---|
297 | 392 | |
---|
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 | 393 | objectPanel = new JTabbedPane(); |
---|
| 394 | + |
---|
| 395 | + ChangeListener changeListener = new ChangeListener() |
---|
| 396 | + { |
---|
| 397 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 398 | + { |
---|
| 399 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 400 | +// { |
---|
| 401 | +// if (latestObject != null) |
---|
| 402 | +// { |
---|
| 403 | +// refreshContents(true); |
---|
| 404 | +// SetMaterial(latestObject); |
---|
| 405 | +// } |
---|
| 406 | +// |
---|
| 407 | +// materialFlushed = true; |
---|
| 408 | +// } |
---|
| 409 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 410 | +// { |
---|
| 411 | +// if (listUI.size() == 0) |
---|
| 412 | +// EditSelection(false); |
---|
| 413 | +// } |
---|
| 414 | + |
---|
| 415 | + refreshContents(false); // To refresh Info tab |
---|
| 416 | + } |
---|
| 417 | + }; |
---|
| 418 | + objectPanel.addChangeListener(changeListener); |
---|
| 419 | + |
---|
354 | 420 | toolbarPanel = new JPanel(); |
---|
355 | 421 | toolbarPanel.setName("Toolbar"); |
---|
356 | | - treePanel = new JPanel(); |
---|
| 422 | + treePanel = new cGridBag(); |
---|
357 | 423 | treePanel.setName("Tree"); |
---|
358 | | - ctrlPanel = new cGridBag(); // new GridBagLayout()); |
---|
359 | | - ctrlPanel.setName("Edit"); |
---|
| 424 | + |
---|
| 425 | + editPanel = new cGridBag().setVertical(true); |
---|
| 426 | + editPanel.setName("Edit"); |
---|
| 427 | + |
---|
| 428 | + ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
| 429 | + |
---|
| 430 | + editCommandsPanel = new cGridBag(); |
---|
| 431 | + editPanel.add(editCommandsPanel); |
---|
| 432 | + editPanel.add(ctrlPanel); |
---|
| 433 | + |
---|
| 434 | + toolboxPanel = new cGridBag().setVertical(false); |
---|
| 435 | + toolboxPanel.setName("Toolbox"); |
---|
| 436 | + |
---|
360 | 437 | materialPanel = new cGridBag().setVertical(true); |
---|
361 | 438 | materialPanel.setName("Material"); |
---|
| 439 | + |
---|
362 | 440 | /*JTextPane*/ |
---|
363 | 441 | infoarea = createTextPane(); |
---|
| 442 | + doc = infoarea.getStyledDocument(); |
---|
| 443 | + |
---|
364 | 444 | infoarea.setEditable(true); |
---|
365 | 445 | SetText(); |
---|
366 | 446 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
367 | 447 | // infoarea.setOpaque(false); |
---|
368 | 448 | // //infoarea.setForeground(textcolor); |
---|
369 | | - infoarea.setLineWrap(true); |
---|
370 | | - infoarea.setWrapStyleWord(true); |
---|
| 449 | +// TEXTAREA infoarea.setLineWrap(true); |
---|
| 450 | +// TEXTAREA infoarea.setWrapStyleWord(true); |
---|
371 | 451 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
372 | 452 | infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
373 | 453 | infoPanel.setName("Info"); |
---|
.. | .. |
---|
378 | 458 | mainPanel.setName("Main"); |
---|
379 | 459 | mainPanel.setContinuousLayout(true); |
---|
380 | 460 | mainPanel.setOneTouchExpandable(true); |
---|
381 | | - mainPanel.setDividerLocation(1.0); |
---|
382 | 461 | mainPanel.setDividerSize(9); |
---|
383 | | - mainPanel.setResizeWeight(0); |
---|
384 | | - |
---|
| 462 | + mainPanel.setDividerLocation(0.5); //1.0); |
---|
| 463 | + mainPanel.setResizeWeight(0.5); |
---|
| 464 | + |
---|
| 465 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 466 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 467 | + divider.setDividerSize(15); |
---|
| 468 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 469 | + |
---|
| 470 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 471 | + |
---|
385 | 472 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
386 | 473 | //mainPanel.setLayout(new GridBagLayout()); |
---|
387 | 474 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
388 | | - treePanel.setLayout(new GridBagLayout()); |
---|
389 | | - ctrlPanel.setLayout(new GridBagLayout()); |
---|
| 475 | +// treePanel.setLayout(new GridBagLayout()); |
---|
| 476 | + //ctrlPanel.setLayout(new GridBagLayout()); |
---|
390 | 477 | //materialPanel.setLayout(new GridBagLayout()); |
---|
391 | 478 | |
---|
392 | 479 | aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, |
---|
.. | .. |
---|
426 | 513 | static String newline = "\n"; |
---|
427 | 514 | protected static final String buttonString = "JButton"; |
---|
428 | 515 | StyledDocument doc; |
---|
429 | | - JTextArea infoarea; |
---|
| 516 | + JTextPane infoarea; |
---|
430 | 517 | |
---|
431 | 518 | void ClearInfo() |
---|
432 | 519 | { |
---|
.. | .. |
---|
449 | 536 | e.printStackTrace(); |
---|
450 | 537 | } |
---|
451 | 538 | |
---|
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(); |
---|
| 539 | +// String selection = infoarea.getText(); |
---|
| 540 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 541 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 542 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
456 | 543 | //clipboard.setContents(data, data); |
---|
457 | 544 | } |
---|
458 | 545 | |
---|
.. | .. |
---|
475 | 562 | //SendInfo("Name:", "bold"); |
---|
476 | 563 | if (sel.GetTextures() != null || debug) |
---|
477 | 564 | { |
---|
478 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 565 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
479 | 566 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
480 | 567 | if (sel.Size() > 0) |
---|
481 | 568 | { |
---|
482 | 569 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
483 | 570 | } |
---|
484 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 571 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
485 | 572 | if (debug) |
---|
486 | 573 | { |
---|
487 | 574 | try |
---|
.. | .. |
---|
493 | 580 | } |
---|
494 | 581 | |
---|
495 | 582 | if (full) |
---|
496 | | - si.SendInfo(" BBox: " + minima + " - " + maxima, "regular"); |
---|
| 583 | + { |
---|
| 584 | + si.SendInfo(" BBox min: " + minima, "regular"); |
---|
| 585 | + si.SendInfo(" BBox max: " + maxima, "regular"); |
---|
| 586 | + } |
---|
497 | 587 | |
---|
498 | 588 | if (sel.bRep != null) |
---|
499 | 589 | { |
---|
.. | .. |
---|
520 | 610 | } |
---|
521 | 611 | if (sel.support != null) |
---|
522 | 612 | { |
---|
523 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 613 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
524 | 614 | } |
---|
525 | 615 | if (sel.scriptnode != null) |
---|
526 | 616 | { |
---|
.. | .. |
---|
591 | 681 | { |
---|
592 | 682 | CameraPane.pointflow = (PointFlow) sel; |
---|
593 | 683 | } |
---|
| 684 | + |
---|
| 685 | + si.SendInfo("_____________________", "regular"); |
---|
| 686 | + si.SendInfo("", "regular"); |
---|
594 | 687 | } |
---|
595 | 688 | } |
---|
596 | 689 | |
---|
.. | .. |
---|
606 | 699 | } |
---|
607 | 700 | } |
---|
608 | 701 | |
---|
| 702 | +static GraphicsDevice device = GraphicsEnvironment |
---|
| 703 | + .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 704 | + |
---|
| 705 | + Rectangle keeprect; |
---|
| 706 | + cRadio radio; |
---|
| 707 | + |
---|
| 708 | +cButton keepButton; |
---|
| 709 | + cButton twoButton; // Full 3D |
---|
| 710 | + cButton sixButton; |
---|
| 711 | + cButton threeButton; |
---|
| 712 | + cButton sevenButton; |
---|
| 713 | + cButton fourButton; // full panel |
---|
| 714 | + cButton oneButton; // full XYZ |
---|
| 715 | + //cButton currentLayout; |
---|
| 716 | + |
---|
| 717 | + boolean maximized; |
---|
| 718 | + |
---|
| 719 | + cButton fullscreenLayout; |
---|
| 720 | + |
---|
| 721 | + void Minimize() |
---|
| 722 | + { |
---|
| 723 | + frame.setState(Frame.ICONIFIED); |
---|
| 724 | + } |
---|
| 725 | + |
---|
| 726 | + void Maximize() |
---|
| 727 | + { |
---|
| 728 | + if (maximized) |
---|
| 729 | + { |
---|
| 730 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 731 | + } |
---|
| 732 | + else |
---|
| 733 | + { |
---|
| 734 | + keeprect = frame.getBounds(); |
---|
| 735 | + Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 736 | + Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 737 | + frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 738 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 739 | + } |
---|
| 740 | + |
---|
| 741 | + maximized ^= true; |
---|
| 742 | + } |
---|
| 743 | + |
---|
609 | 744 | void ToggleFullScreen() |
---|
610 | 745 | { |
---|
611 | | - if (CameraPane.FULLSCREEN) |
---|
| 746 | + cameraView.ToggleFullScreen(); |
---|
| 747 | + |
---|
| 748 | + if (!CameraPane.FULLSCREEN) |
---|
612 | 749 | { |
---|
613 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
614 | | - framePanel.add(bigThree); |
---|
615 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 750 | + device.setFullScreenWindow(null); |
---|
| 751 | + //frame.setVisible(false); |
---|
| 752 | +// frame.removeNotify(); |
---|
| 753 | +// frame.setUndecorated(false); |
---|
| 754 | +// frame.addNotify(); |
---|
| 755 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 756 | + |
---|
| 757 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 758 | +// X framePanel.add(bigThree); |
---|
| 759 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 760 | + framePanel.setDividerLocation(1); |
---|
| 761 | + |
---|
| 762 | + //frame.setVisible(true); |
---|
| 763 | + radio.layout = keepButton; |
---|
| 764 | + //theFrame = null; |
---|
| 765 | + keepButton = null; |
---|
| 766 | + radio.layout.doClick(); |
---|
| 767 | + |
---|
616 | 768 | } else |
---|
617 | 769 | { |
---|
618 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
619 | | - framePanel.remove(bigThree); |
---|
620 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 770 | + keepButton = radio.layout; |
---|
| 771 | + //keeprect = frame.getBounds(); |
---|
| 772 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 773 | +// frame.getToolkit().getScreenSize().height); |
---|
| 774 | + //frame.setVisible(false); |
---|
| 775 | + device.setFullScreenWindow(frame); |
---|
| 776 | +// frame.removeNotify(); |
---|
| 777 | +// frame.setUndecorated(true); |
---|
| 778 | +// frame.addNotify(); |
---|
| 779 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 780 | +// X framePanel.remove(bigThree); |
---|
| 781 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 782 | + framePanel.setDividerLocation(0); |
---|
| 783 | + |
---|
| 784 | + radio.layout = fullscreenLayout; |
---|
| 785 | + radio.layout.doClick(); |
---|
| 786 | + //frame.setVisible(true); |
---|
621 | 787 | } |
---|
622 | | - cameraView.ToggleFullScreen(); |
---|
623 | 788 | } |
---|
624 | 789 | |
---|
625 | | - private JTextArea createTextPane() |
---|
| 790 | + private JTextPane createTextPane() |
---|
626 | 791 | { |
---|
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 | | - }; |
---|
| 792 | +// TEXTAREA String[] initString = |
---|
| 793 | +// { |
---|
| 794 | +// "This is an editable JTextPane, ", //regular |
---|
| 795 | +// "another ", //italic |
---|
| 796 | +// "styled ", //bold |
---|
| 797 | +// "text ", //small |
---|
| 798 | +// "component, ", //large |
---|
| 799 | +// "which supports embedded components..." + newline,//regular |
---|
| 800 | +// " " + newline, //button |
---|
| 801 | +// "...and embedded icons..." + newline, //regular |
---|
| 802 | +// " ", //icon |
---|
| 803 | +// newline + "JTextPane is a subclass of JEditorPane that " |
---|
| 804 | +// + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
| 805 | +// + "cover methods for interacting with those objects." |
---|
| 806 | +// }; |
---|
| 807 | +// |
---|
| 808 | +// String[] initStyles = |
---|
| 809 | +// { |
---|
| 810 | +// "regular", "italic", "bold", "small", "large", |
---|
| 811 | +// "regular", "button", "regular", "icon", |
---|
| 812 | +// "regular" |
---|
| 813 | +// }; |
---|
| 814 | +// |
---|
| 815 | +// JTextPane textPane = new JTextPane(); |
---|
| 816 | +// textPane.setEditable(true); |
---|
| 817 | +// /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
| 818 | +// addStylesToDocument(doc); |
---|
| 819 | +// |
---|
| 820 | +// try |
---|
| 821 | +// { |
---|
| 822 | +// for (int j = 0; j < 2; j++) |
---|
| 823 | +// { |
---|
| 824 | +// for (int i = 0; i < initString.length; i++) |
---|
| 825 | +// { |
---|
| 826 | +// doc.insertString(doc.getLength(), initString[i], |
---|
| 827 | +// doc.getStyle(initStyles[i])); |
---|
| 828 | +// } |
---|
| 829 | +// } |
---|
| 830 | +// } catch (BadLocationException ble) |
---|
| 831 | +// { |
---|
| 832 | +// System.err.println("Couldn't insert initial text into text pane."); |
---|
| 833 | +// } |
---|
642 | 834 | |
---|
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; |
---|
| 835 | + return new JTextPane(); // textPane; |
---|
671 | 836 | } |
---|
672 | 837 | |
---|
673 | 838 | protected void addStylesToDocument(StyledDocument doc) |
---|
.. | .. |
---|
720 | 885 | protected static ImageIcon createImageIcon(String path, |
---|
721 | 886 | String description) |
---|
722 | 887 | { |
---|
723 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 888 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
724 | 889 | if (imgURL != null) |
---|
725 | 890 | { |
---|
726 | 891 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
752 | 917 | // NumberSlider vDivsField; |
---|
753 | 918 | // JCheckBox endcaps; |
---|
754 | 919 | JCheckBox liveCB; |
---|
| 920 | + JCheckBox selectCB; |
---|
755 | 921 | JCheckBox hideCB; |
---|
756 | 922 | JCheckBox link2masterCB; |
---|
757 | 923 | JCheckBox markCB; |
---|
.. | .. |
---|
759 | 925 | JCheckBox speedupCB; |
---|
760 | 926 | JCheckBox rewindCB; |
---|
761 | 927 | JCheckBox flipVCB; |
---|
| 928 | + |
---|
| 929 | + cCheckBox toggleTextureCB; |
---|
| 930 | + cCheckBox toggleSwitchCB; |
---|
| 931 | + |
---|
762 | 932 | JComboBox texresMenu; |
---|
| 933 | + |
---|
763 | 934 | JButton resetButton; |
---|
764 | 935 | JButton stepButton; |
---|
765 | 936 | JButton stepAllButton; |
---|
.. | .. |
---|
767 | 938 | JButton slowerButton; |
---|
768 | 939 | JButton fasterButton; |
---|
769 | 940 | JButton remarkButton; |
---|
| 941 | + |
---|
| 942 | + cGridBag editPanel; |
---|
| 943 | + cGridBag editCommandsPanel; |
---|
| 944 | + |
---|
| 945 | + cGridBag namePanel; |
---|
| 946 | + cGridBag setupPanel; |
---|
| 947 | + cGridBag setupPanel2; |
---|
| 948 | + cGridBag objectCommandsPanel; |
---|
| 949 | + cGridBag pushPanel; |
---|
| 950 | + cGridBag fillPanel; |
---|
770 | 951 | |
---|
771 | | - JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on) |
---|
| 952 | + JCheckBox AddCheckBox(cGridBag panel, String label, boolean on) |
---|
772 | 953 | { |
---|
773 | 954 | JCheckBox cb; |
---|
774 | 955 | |
---|
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); |
---|
| 956 | + panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
780 | 957 | cb.addItemListener(this); |
---|
781 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
782 | | - oe.aConstraints.gridwidth = 1; |
---|
783 | | - oe.aConstraints.gridx += 1; |
---|
784 | 958 | |
---|
785 | 959 | return cb; |
---|
786 | 960 | } |
---|
787 | 961 | |
---|
788 | | - cButton AddButton(ObjEditor oe, String label) |
---|
| 962 | + cButton AddButton(cGridBag panel, String label) |
---|
789 | 963 | { |
---|
790 | 964 | cButton cb; |
---|
791 | 965 | |
---|
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); |
---|
| 966 | + panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); |
---|
797 | 967 | cb.addActionListener(this); |
---|
798 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
799 | | - oe.aConstraints.gridwidth = 1; |
---|
800 | | - oe.aConstraints.gridx += 1; |
---|
801 | 968 | |
---|
802 | 969 | return cb; |
---|
803 | 970 | } |
---|
804 | 971 | |
---|
805 | | - JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item) |
---|
| 972 | + JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item) |
---|
806 | 973 | { |
---|
807 | 974 | JComboBox combo; |
---|
808 | 975 | |
---|
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; |
---|
| 976 | + panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
812 | 977 | combo.addActionListener(this); |
---|
813 | 978 | |
---|
814 | 979 | return combo; |
---|
815 | 980 | } |
---|
816 | 981 | |
---|
817 | | - cNumberSlider AddSlider(cGridBag ctrlPanel, String label, double min, double max, double current, double pow) |
---|
| 982 | + cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow) |
---|
818 | 983 | { |
---|
819 | 984 | cGridBag control = new cGridBag(); |
---|
820 | 985 | |
---|
.. | .. |
---|
826 | 991 | control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
827 | 992 | combo.setFloat(current); |
---|
828 | 993 | |
---|
829 | | - ctrlPanel.add(control); |
---|
| 994 | + panel.add(control); |
---|
830 | 995 | |
---|
831 | | - return combo; |
---|
| 996 | + return control; |
---|
832 | 997 | } |
---|
833 | 998 | |
---|
834 | | - cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current) |
---|
| 999 | + cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current) |
---|
835 | 1000 | { |
---|
836 | 1001 | cGridBag control = new cGridBag(); |
---|
837 | 1002 | |
---|
.. | .. |
---|
839 | 1004 | |
---|
840 | 1005 | JLabel jlabel = new JLabel(label); |
---|
841 | 1006 | 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); |
---|
| 1007 | + control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 1008 | + control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
844 | 1009 | combo.setInteger(current); |
---|
845 | 1010 | |
---|
846 | | - ctrlPanel.add(control); |
---|
| 1011 | + panel.add(control); |
---|
847 | 1012 | |
---|
848 | | - return combo; |
---|
| 1013 | + return control; |
---|
849 | 1014 | } |
---|
850 | 1015 | |
---|
851 | 1016 | JTextArea AddText(cGridBag ctrlPanel, String name) |
---|
852 | 1017 | { |
---|
853 | 1018 | JTextArea text; |
---|
854 | 1019 | |
---|
855 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
856 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
857 | 1020 | ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
858 | 1021 | text.addCaretListener(this); |
---|
859 | | - aConstraints.gridx += 1; |
---|
860 | | - aConstraints.gridwidth = 1; |
---|
861 | 1022 | |
---|
862 | 1023 | return text; |
---|
863 | 1024 | } |
---|
.. | .. |
---|
896 | 1057 | |
---|
897 | 1058 | /* |
---|
898 | 1059 | */ |
---|
899 | | - void Return() // ObjEditor oe) |
---|
| 1060 | + void Return0() // ObjEditor oe) |
---|
900 | 1061 | { |
---|
901 | 1062 | aConstraints.gridy += 1; |
---|
902 | 1063 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
951 | 1112 | |
---|
952 | 1113 | void SetupUI2(ObjEditor oe) |
---|
953 | 1114 | { |
---|
954 | | -// oe.aConstraints.weightx = 0; |
---|
955 | | -// oe.aConstraints.weighty = 0; |
---|
956 | | -// oe.aConstraints.gridx = 0; |
---|
957 | | -// oe.aConstraints.gridy = 0; |
---|
958 | | - SetupName(oe); |
---|
| 1115 | + //SetupName(oe); |
---|
959 | 1116 | |
---|
960 | | - if (!GroupEditor.allparams) |
---|
| 1117 | + namePanel = new cGridBag(); |
---|
| 1118 | + |
---|
| 1119 | + nameField = AddText(namePanel, copy.GetName()); |
---|
| 1120 | + namePanel.add(nameField); |
---|
| 1121 | + oe.ctrlPanel.add(namePanel); |
---|
| 1122 | + |
---|
| 1123 | + oe.ctrlPanel.Return(); |
---|
| 1124 | + |
---|
| 1125 | + if (!allparams) |
---|
961 | 1126 | return; |
---|
962 | 1127 | |
---|
963 | | - liveCB = AddCheckBox(oe, "Live", copy.live); |
---|
964 | | - link2masterCB = AddCheckBox(oe, "Supp", copy.link2master); |
---|
965 | | - hideCB = AddCheckBox(oe, "Hide", copy.hide); |
---|
| 1128 | + setupPanel = new cGridBag().setVertical(false); |
---|
| 1129 | + |
---|
| 1130 | + liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
| 1131 | + liveCB.setToolTipText("Animate object"); |
---|
| 1132 | + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1133 | + selectCB.setToolTipText("Make object selectable"); |
---|
966 | 1134 | // 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"); |
---|
| 1135 | + hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 1136 | + hideCB.setToolTipText("Hide object"); |
---|
| 1137 | + markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
| 1138 | + markCB.setToolTipText("As animation target transform"); |
---|
| 1139 | + |
---|
| 1140 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1141 | + |
---|
| 1142 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
| 1143 | + rewindCB.setToolTipText("Rewind animation"); |
---|
| 1144 | + |
---|
| 1145 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 1146 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
| 1147 | + |
---|
| 1148 | + if (Globals.ADVANCED) |
---|
| 1149 | + { |
---|
| 1150 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
| 1151 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1152 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
| 1153 | + speedupCB.setToolTipText("Option motion capture"); |
---|
| 1154 | + } |
---|
| 1155 | + |
---|
| 1156 | + oe.ctrlPanel.add(setupPanel); |
---|
| 1157 | + oe.ctrlPanel.Return(); |
---|
| 1158 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1159 | + oe.ctrlPanel.Return(); |
---|
| 1160 | + |
---|
| 1161 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
| 1162 | + |
---|
| 1163 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
| 1164 | + resetButton.setToolTipText("Jump to frame zero"); |
---|
| 1165 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
| 1166 | + stepButton.setToolTipText("Step one frame"); |
---|
973 | 1167 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
974 | 1168 | // stepAllButton = AddButton(oe, "Step All"); |
---|
975 | | - speedupCB = AddCheckBox(oe, "Speed", copy.speedup); |
---|
976 | 1169 | // Return(); |
---|
977 | | - slowerButton = AddButton(oe, "Slow"); |
---|
978 | | - fasterButton = AddButton(oe, "Fast"); |
---|
979 | | - remarkButton = AddButton(oe, "Rem"); |
---|
| 1170 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
| 1171 | + slowerButton.setToolTipText("Decrease animation speed"); |
---|
| 1172 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
| 1173 | + fasterButton.setToolTipText("Increase animation speed"); |
---|
| 1174 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
| 1175 | + remarkButton.setToolTipText("Set the current transform as the target"); |
---|
980 | 1176 | |
---|
981 | | - //Return(); |
---|
| 1177 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
| 1178 | + oe.ctrlPanel.Return(); |
---|
982 | 1179 | |
---|
983 | | - //normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1); |
---|
| 1180 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
| 1181 | + normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
984 | 1182 | //Return(); |
---|
| 1183 | + |
---|
| 1184 | + oe.ctrlPanel.Return(); |
---|
985 | 1185 | |
---|
986 | 1186 | // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2); |
---|
987 | 1187 | // ObjEditor.aConstraints.gridx += 1; |
---|
.. | .. |
---|
1076 | 1276 | oe.aConstraints.gridwidth = 1; |
---|
1077 | 1277 | /**/ |
---|
1078 | 1278 | nameField = AddText(oe.ctrlPanel, copy.GetName()); |
---|
1079 | | - Return(); |
---|
| 1279 | + oe.ctrlPanel.Return(); |
---|
1080 | 1280 | |
---|
1081 | 1281 | //ctrlPanel.add(textureButton = new Button("Texture...")); |
---|
1082 | 1282 | //textureButton.setEnabled(false); |
---|
.. | .. |
---|
1180 | 1380 | //worldPanel.setName("World"); |
---|
1181 | 1381 | centralPanel = new cGridBag(); |
---|
1182 | 1382 | centralPanel.preferredWidth = 20; |
---|
1183 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1184 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1383 | + |
---|
| 1384 | + if (Globals.ADVANCED) |
---|
| 1385 | + { |
---|
| 1386 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1387 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1185 | 1388 | |
---|
1186 | 1389 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1187 | 1390 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1190 | 1393 | // cameraPanel.setDividerSize(9); |
---|
1191 | 1394 | cameraPanel.setResizeWeight(1.0); |
---|
1192 | 1395 | |
---|
| 1396 | + } |
---|
| 1397 | + |
---|
1193 | 1398 | centralPanel.add(cameraView); |
---|
| 1399 | + centralPanel.setFocusable(true); |
---|
1194 | 1400 | //frame.setJMenuBar(timelineMenubar); |
---|
1195 | 1401 | //centralPanel.add(timelinePanel); |
---|
1196 | 1402 | |
---|
.. | .. |
---|
1253 | 1459 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1254 | 1460 | //tmp.setName("Edit"); |
---|
1255 | 1461 | objectPanel.add(materialPanel); |
---|
1256 | | - JPanel north = new JPanel(new BorderLayout()); |
---|
1257 | | - north.setName("Edit"); |
---|
1258 | | - north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1259 | | - objectPanel.add(north); |
---|
| 1462 | +// JPanel north = new JPanel(new BorderLayout()); |
---|
| 1463 | +// north.setName("Edit"); |
---|
| 1464 | +// north.add(ctrlPanel, BorderLayout.NORTH); |
---|
| 1465 | +// objectPanel.add(north); |
---|
| 1466 | + objectPanel.add(editPanel); |
---|
1260 | 1467 | objectPanel.add(infoPanel); |
---|
| 1468 | + objectPanel.add(toolboxPanel); |
---|
1261 | 1469 | |
---|
1262 | 1470 | /* |
---|
1263 | 1471 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1266 | 1474 | aConstraints.gridy += 1; |
---|
1267 | 1475 | aConstraints.gridwidth = 1; |
---|
1268 | 1476 | mainPanel.add(objectPanel, aConstraints); |
---|
1269 | | - */ |
---|
| 1477 | + */ |
---|
1270 | 1478 | |
---|
1271 | 1479 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1272 | 1480 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1278 | 1486 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1279 | 1487 | |
---|
1280 | 1488 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1281 | | - scenePanel.preferredWidth = 7; |
---|
| 1489 | + scenePanel.preferredWidth = 6; |
---|
1282 | 1490 | |
---|
1283 | 1491 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1284 | 1492 | tabbedPane.add(scrollpane); |
---|
1285 | 1493 | |
---|
1286 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1287 | | - |
---|
1288 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1494 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1289 | 1495 | |
---|
1290 | 1496 | optionsPanel.setName("Options"); |
---|
1291 | 1497 | |
---|
.. | .. |
---|
1293 | 1499 | |
---|
1294 | 1500 | tabbedPane.add(optionsPanel); |
---|
1295 | 1501 | |
---|
| 1502 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1503 | + |
---|
1296 | 1504 | scenePanel.add(tabbedPane); |
---|
1297 | 1505 | |
---|
1298 | 1506 | /* |
---|
.. | .. |
---|
1384 | 1592 | |
---|
1385 | 1593 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1386 | 1594 | |
---|
1387 | | - frame.setSize(1024, 768); |
---|
1388 | | - frame.show(); |
---|
| 1595 | + frame.setSize(1280, 860); |
---|
| 1596 | + |
---|
| 1597 | + frame.validate(); |
---|
| 1598 | + frame.setVisible(true); |
---|
1389 | 1599 | |
---|
| 1600 | + cameraView.requestFocusInWindow(); |
---|
| 1601 | + |
---|
1390 | 1602 | gridPanel.setDividerLocation(1.0); |
---|
1391 | 1603 | |
---|
1392 | 1604 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
1415 | 1627 | ctrlPanel.removeAll(); |
---|
1416 | 1628 | } |
---|
1417 | 1629 | |
---|
1418 | | - void SetupMaterial(cGridBag ctrlPanel) |
---|
| 1630 | + void SetupMaterial(cGridBag panel) |
---|
1419 | 1631 | { |
---|
1420 | 1632 | /* |
---|
1421 | 1633 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
.. | .. |
---|
1424 | 1636 | |
---|
1425 | 1637 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1426 | 1638 | |
---|
1427 | | - editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints); |
---|
| 1639 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1640 | + createMaterialButton.setToolTipText("Create material"); |
---|
1428 | 1641 | |
---|
1429 | 1642 | /* |
---|
1430 | 1643 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1431 | 1644 | */ |
---|
1432 | 1645 | |
---|
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); |
---|
| 1646 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1647 | + clearMaterialButton.setToolTipText("Clear material"); |
---|
| 1648 | + |
---|
| 1649 | + if (Globals.ADVANCED) |
---|
| 1650 | + { |
---|
| 1651 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1652 | + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
| 1653 | + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 1654 | + } |
---|
1437 | 1655 | |
---|
1438 | | - ctrlPanel.add(editBar); |
---|
| 1656 | + editBar.preferredHeight = 15; |
---|
| 1657 | + |
---|
| 1658 | + panel.add(editBar); |
---|
1439 | 1659 | |
---|
1440 | 1660 | /**/ |
---|
1441 | 1661 | //aConstraints.weighty = 0; |
---|
.. | .. |
---|
1484 | 1704 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1485 | 1705 | colorSection.add(shadowbias); |
---|
1486 | 1706 | |
---|
1487 | | - ctrlPanel.add(new JSeparator()); |
---|
| 1707 | + panel.add(new JSeparator()); |
---|
1488 | 1708 | |
---|
1489 | | - ctrlPanel.add(colorSection); |
---|
| 1709 | + panel.add(colorSection); |
---|
1490 | 1710 | |
---|
1491 | 1711 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1492 | 1712 | |
---|
.. | .. |
---|
1534 | 1754 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1535 | 1755 | diffuseSection.add(fakedepth); |
---|
1536 | 1756 | |
---|
1537 | | - ctrlPanel.add(new JSeparator()); |
---|
| 1757 | + panel.add(new JSeparator()); |
---|
1538 | 1758 | |
---|
1539 | | - ctrlPanel.add(diffuseSection); |
---|
| 1759 | + panel.add(diffuseSection); |
---|
1540 | 1760 | |
---|
1541 | 1761 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1542 | 1762 | |
---|
.. | .. |
---|
1572 | 1792 | velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1573 | 1793 | specularSection.add(velvet); |
---|
1574 | 1794 | |
---|
1575 | | - shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1); |
---|
| 1795 | + shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1); |
---|
1576 | 1796 | //Return(); |
---|
1577 | 1797 | // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints); |
---|
1578 | 1798 | // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
.. | .. |
---|
1585 | 1805 | // aConstraints.gridwidth = 1; |
---|
1586 | 1806 | |
---|
1587 | 1807 | |
---|
1588 | | - ctrlPanel.add(new JSeparator()); |
---|
| 1808 | + panel.add(new JSeparator()); |
---|
1589 | 1809 | |
---|
1590 | | - ctrlPanel.add(specularSection); |
---|
| 1810 | + panel.add(specularSection); |
---|
1591 | 1811 | |
---|
1592 | 1812 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1593 | 1813 | |
---|
.. | .. |
---|
1617 | 1837 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1618 | 1838 | globalSection.add(opacity); |
---|
1619 | 1839 | |
---|
1620 | | - ctrlPanel.add(new JSeparator()); |
---|
| 1840 | + panel.add(new JSeparator()); |
---|
1621 | 1841 | |
---|
1622 | | - ctrlPanel.add(globalSection); |
---|
| 1842 | + panel.add(globalSection); |
---|
1623 | 1843 | |
---|
1624 | 1844 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1625 | 1845 | |
---|
.. | .. |
---|
1661 | 1881 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1662 | 1882 | textureSection.add(opacityPower); |
---|
1663 | 1883 | |
---|
1664 | | - ctrlPanel.add(new JSeparator()); |
---|
| 1884 | + panel.add(new JSeparator()); |
---|
1665 | 1885 | |
---|
1666 | | - ctrlPanel.add(textureSection); |
---|
| 1886 | + panel.add(textureSection); |
---|
1667 | 1887 | |
---|
1668 | 1888 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1669 | 1889 | |
---|
.. | .. |
---|
1700 | 1920 | opacityPowerField.addChangeListener(this); |
---|
1701 | 1921 | /**/ |
---|
1702 | 1922 | |
---|
1703 | | - resetSlidersButton.addActionListener(this); |
---|
1704 | 1923 | clearMaterialButton.addActionListener(this); |
---|
1705 | 1924 | createMaterialButton.addActionListener(this); |
---|
1706 | | - |
---|
1707 | | - propagateToggle.addItemListener(this); |
---|
1708 | | - multiplyToggle.addItemListener(this); |
---|
| 1925 | + |
---|
| 1926 | + if (Globals.ADVANCED) |
---|
| 1927 | + { |
---|
| 1928 | + resetSlidersButton.addActionListener(this); |
---|
| 1929 | + propagateToggle.addItemListener(this); |
---|
| 1930 | + multiplyToggle.addItemListener(this); |
---|
| 1931 | + } |
---|
1709 | 1932 | } |
---|
1710 | 1933 | |
---|
1711 | 1934 | void DropFile(java.io.File[] files, boolean textures) |
---|
.. | .. |
---|
1876 | 2099 | |
---|
1877 | 2100 | //? flashIt = false; |
---|
1878 | 2101 | CameraPane pane = (CameraPane) cameraView; |
---|
1879 | | - pane.clickStart(location.x, location.y, 0); |
---|
| 2102 | + pane.clickStart(location.x, location.y, 0, 0); |
---|
1880 | 2103 | pane.clickEnd(location.x, location.y, 0, true); |
---|
1881 | 2104 | |
---|
1882 | 2105 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
1925 | 2148 | e2.printStackTrace(); |
---|
1926 | 2149 | } |
---|
1927 | 2150 | } |
---|
| 2151 | + |
---|
1928 | 2152 | LoadJMEThread loadThread; |
---|
1929 | 2153 | |
---|
1930 | 2154 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
1982 | 2206 | //LoadFile0(filename, converter); |
---|
1983 | 2207 | } |
---|
1984 | 2208 | } |
---|
| 2209 | + |
---|
1985 | 2210 | LoadOBJThread loadObjThread; |
---|
1986 | 2211 | |
---|
1987 | 2212 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2060 | 2285 | |
---|
2061 | 2286 | void LoadObjFile(String fullname) |
---|
2062 | 2287 | { |
---|
2063 | | - /* |
---|
| 2288 | + System.out.println("Loading " + fullname); |
---|
| 2289 | + /**/ |
---|
2064 | 2290 | //lastFilename = fullname; |
---|
2065 | 2291 | if(loadObjThread == null) |
---|
2066 | 2292 | { |
---|
2067 | | - loadObjThread = new LoadOBJThread(); |
---|
2068 | | - loadObjThread.start(); |
---|
| 2293 | + loadObjThread = new LoadOBJThread(); |
---|
| 2294 | + loadObjThread.start(); |
---|
2069 | 2295 | } |
---|
2070 | 2296 | |
---|
2071 | 2297 | loadObjThread.add(fullname); |
---|
2072 | | - */ |
---|
| 2298 | + /**/ |
---|
2073 | 2299 | |
---|
2074 | | - System.out.println("Loading " + fullname); |
---|
2075 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2300 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2076 | 2301 | } |
---|
2077 | 2302 | |
---|
2078 | 2303 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2333 | 2558 | |
---|
2334 | 2559 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2335 | 2560 | { |
---|
2336 | | - if (GrafreeD.standAlone) |
---|
| 2561 | + if (Grafreed.standAlone) |
---|
2337 | 2562 | { |
---|
2338 | 2563 | /**/ |
---|
2339 | 2564 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2340 | | - browser.show(); |
---|
| 2565 | + browser.setVisible(true); |
---|
2341 | 2566 | String filename = browser.getFile(); |
---|
2342 | 2567 | if (filename != null && filename.length() > 0) |
---|
2343 | 2568 | { |
---|
.. | .. |
---|
2482 | 2707 | } |
---|
2483 | 2708 | if (input == null) |
---|
2484 | 2709 | { |
---|
| 2710 | + new Exception().printStackTrace(); |
---|
2485 | 2711 | System.exit(0); |
---|
2486 | 2712 | } |
---|
2487 | 2713 | |
---|
.. | .. |
---|
2688 | 2914 | |
---|
2689 | 2915 | void SetMaterial(Object3D object) |
---|
2690 | 2916 | { |
---|
| 2917 | + latestObject = object; |
---|
| 2918 | + |
---|
2691 | 2919 | cMaterial mat = object.material; |
---|
2692 | 2920 | |
---|
2693 | 2921 | if (mat == null) |
---|
.. | .. |
---|
2696 | 2924 | return; |
---|
2697 | 2925 | } |
---|
2698 | 2926 | |
---|
2699 | | - multiplyToggle.setSelected(mat.multiply); |
---|
| 2927 | + if (multiplyToggle != null) |
---|
| 2928 | + multiplyToggle.setSelected(mat.multiply); |
---|
2700 | 2929 | |
---|
2701 | 2930 | assert (object.projectedVertices != null); |
---|
2702 | 2931 | |
---|
.. | .. |
---|
2798 | 3027 | // } |
---|
2799 | 3028 | |
---|
2800 | 3029 | /**/ |
---|
2801 | | - if (deselect) |
---|
| 3030 | + if (deselect || child == null) |
---|
2802 | 3031 | { |
---|
2803 | 3032 | //group.deselectAll(); |
---|
2804 | 3033 | //freeze = true; |
---|
2805 | 3034 | GetTree().clearSelection(); |
---|
2806 | 3035 | //freeze = false; |
---|
| 3036 | + |
---|
| 3037 | + if (child == null) |
---|
| 3038 | + { |
---|
| 3039 | + return; |
---|
| 3040 | + } |
---|
2807 | 3041 | } |
---|
2808 | 3042 | |
---|
2809 | 3043 | //group.addSelectee(child); |
---|
.. | .. |
---|
2872 | 3106 | cameraView.ToggleDL(); |
---|
2873 | 3107 | cameraView.repaint(); |
---|
2874 | 3108 | return; |
---|
2875 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3109 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2876 | 3110 | { |
---|
2877 | 3111 | cameraView.ToggleTexture(); |
---|
2878 | 3112 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2911 | 3145 | frame.validate(); |
---|
2912 | 3146 | |
---|
2913 | 3147 | return; |
---|
2914 | | - } else if (event.getSource() == toggleRandomItem) |
---|
| 3148 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2915 | 3149 | { |
---|
2916 | | - cameraView.ToggleRandom(); |
---|
| 3150 | + cameraView.ToggleSwitch(); |
---|
2917 | 3151 | cameraView.repaint(); |
---|
2918 | 3152 | return; |
---|
2919 | 3153 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
2942 | 3176 | { |
---|
2943 | 3177 | copy.live ^= true; |
---|
2944 | 3178 | return; |
---|
| 3179 | + } else if (event.getSource() == selectCB) |
---|
| 3180 | + { |
---|
| 3181 | + copy.dontselect ^= true; |
---|
| 3182 | + return; |
---|
2945 | 3183 | } else if (event.getSource() == hideCB) |
---|
2946 | 3184 | { |
---|
2947 | 3185 | copy.hide ^= true; |
---|
.. | .. |
---|
2956 | 3194 | if (event.getSource() == randomCB) |
---|
2957 | 3195 | { |
---|
2958 | 3196 | copy.random ^= true; |
---|
| 3197 | + objEditor.refreshContents(); |
---|
2959 | 3198 | return; |
---|
2960 | 3199 | } |
---|
2961 | 3200 | if (event.getSource() == speedupCB) |
---|
.. | .. |
---|
2979 | 3218 | |
---|
2980 | 3219 | public void actionPerformed(ActionEvent event) |
---|
2981 | 3220 | { |
---|
| 3221 | + Object source = event.getSource(); |
---|
2982 | 3222 | // SCRIPT DIALOG |
---|
2983 | | - if (event.getSource() == okbutton) |
---|
| 3223 | + if (source == okbutton) |
---|
2984 | 3224 | { |
---|
2985 | 3225 | textpanel.setVisible(false); |
---|
2986 | 3226 | textpanel.remove(textarea); |
---|
.. | .. |
---|
2992 | 3232 | textarea = null; |
---|
2993 | 3233 | textpanel = null; |
---|
2994 | 3234 | } |
---|
2995 | | - if (event.getSource() == cancelbutton) |
---|
| 3235 | + if (source == cancelbutton) |
---|
2996 | 3236 | { |
---|
2997 | 3237 | textpanel.setVisible(false); |
---|
2998 | 3238 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3004 | 3244 | //applySelf(); |
---|
3005 | 3245 | //client.refreshEditWindow(); |
---|
3006 | 3246 | //refreshContents(); |
---|
3007 | | - if (event.getSource() == nameField) |
---|
| 3247 | + if (source == nameField) |
---|
3008 | 3248 | { |
---|
3009 | 3249 | //System.out.println("ObjEditor " + event); |
---|
3010 | 3250 | applySelf0(true); |
---|
3011 | 3251 | //parent.applySelf(); |
---|
3012 | 3252 | objEditor.refreshContents(); |
---|
3013 | | - } else if (event.getSource() == resetButton) |
---|
| 3253 | + } else if (source == resetButton) |
---|
3014 | 3254 | { |
---|
3015 | 3255 | CameraPane.fullreset = true; |
---|
3016 | 3256 | copy.Reset(); // ResetMeshes(); |
---|
3017 | 3257 | copy.Touch(); |
---|
3018 | 3258 | objEditor.refreshContents(); |
---|
3019 | | - } else if (event.getSource() == stepItem) |
---|
| 3259 | + } else if (source == stepItem) |
---|
3020 | 3260 | { |
---|
3021 | 3261 | //cameraView.ONESTEP = true; |
---|
3022 | 3262 | Globals.ONESTEP = true; |
---|
3023 | 3263 | cameraView.repaint(); |
---|
3024 | 3264 | return; |
---|
3025 | | - } else if (event.getSource() == stepButton) |
---|
| 3265 | + } else if (source == stepButton) |
---|
3026 | 3266 | { |
---|
3027 | 3267 | copy.Step(); |
---|
3028 | 3268 | copy.Touch(); |
---|
3029 | 3269 | objEditor.refreshContents(); |
---|
3030 | | - } else if (event.getSource() == slowerButton) |
---|
| 3270 | + } else if (source == slowerButton) |
---|
3031 | 3271 | { |
---|
3032 | 3272 | copy.Slower(); |
---|
3033 | 3273 | copy.Touch(); |
---|
3034 | 3274 | objEditor.refreshContents(); |
---|
3035 | | - } else if (event.getSource() == fasterButton) |
---|
| 3275 | + } else if (source == fasterButton) |
---|
3036 | 3276 | { |
---|
3037 | 3277 | copy.Faster(); |
---|
3038 | 3278 | copy.Touch(); |
---|
3039 | 3279 | objEditor.refreshContents(); |
---|
3040 | | - } else if (event.getSource() == remarkButton) |
---|
| 3280 | + } else if (source == remarkButton) |
---|
3041 | 3281 | { |
---|
3042 | 3282 | copy.Remark(); |
---|
3043 | 3283 | copy.Touch(); |
---|
3044 | 3284 | objEditor.refreshContents(); |
---|
3045 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3285 | + } else if (source == stepAllButton) |
---|
3046 | 3286 | { |
---|
3047 | 3287 | copy.StepAll(); |
---|
3048 | 3288 | copy.Touch(); |
---|
3049 | 3289 | objEditor.refreshContents(); |
---|
3050 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3290 | + } else if (source == resetAllButton) |
---|
3051 | 3291 | { |
---|
3052 | 3292 | //CameraPane.fullreset = true; |
---|
3053 | 3293 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3080 | 3320 | // Close(); |
---|
3081 | 3321 | // } |
---|
3082 | 3322 | // else |
---|
3083 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3323 | + if (source == resetSlidersButton) |
---|
3084 | 3324 | { |
---|
3085 | 3325 | ResetSliders(); |
---|
3086 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3326 | + } else if (source == clearMaterialButton) |
---|
3087 | 3327 | { |
---|
3088 | 3328 | ClearMaterial(); |
---|
3089 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3329 | + } else if (source == createMaterialButton) |
---|
3090 | 3330 | { |
---|
3091 | 3331 | CreateMaterial(); |
---|
3092 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3332 | + } else if (source == clearPanelButton) |
---|
3093 | 3333 | { |
---|
3094 | 3334 | copy.ClearUI(); |
---|
3095 | 3335 | refreshContents(true); |
---|
3096 | | - } /* |
---|
3097 | | - } |
---|
3098 | | - |
---|
3099 | | - public boolean action(Event event, Object arg) |
---|
3100 | | - { |
---|
3101 | | - */ else if (event.getSource() == closeItem) |
---|
| 3336 | + } else if (source == importGFDItem) |
---|
| 3337 | + { |
---|
| 3338 | + ImportGFD(); |
---|
| 3339 | + } else |
---|
| 3340 | + if (source == importVRMLX3DItem) |
---|
| 3341 | + { |
---|
| 3342 | + ImportVRMLX3D(); |
---|
| 3343 | + } else |
---|
| 3344 | + if (source == import3DSItem) |
---|
| 3345 | + { |
---|
| 3346 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3347 | + } else |
---|
| 3348 | + if (source == importOBJItem) |
---|
| 3349 | + { |
---|
| 3350 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3351 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3352 | + browser.setVisible(true); |
---|
| 3353 | + String filename = browser.getFile(); |
---|
| 3354 | + if (filename != null && filename.length() > 0) |
---|
| 3355 | + { |
---|
| 3356 | + String fullname = browser.getDirectory() + filename; |
---|
| 3357 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3358 | + } |
---|
| 3359 | + } else |
---|
| 3360 | + if (source == closeItem) |
---|
3102 | 3361 | { |
---|
3103 | 3362 | Close(); |
---|
3104 | 3363 | //return true; |
---|
3105 | | - } else if (event.getSource() == loadItem) |
---|
| 3364 | + } else if (source == loadItem) |
---|
3106 | 3365 | { |
---|
3107 | 3366 | load(); |
---|
3108 | 3367 | //return true; |
---|
3109 | | - } else if (event.getSource() == saveItem) |
---|
| 3368 | + } else if (source == newItem) |
---|
| 3369 | + { |
---|
| 3370 | + New(); |
---|
| 3371 | + } else if (source == saveItem) |
---|
3110 | 3372 | { |
---|
3111 | 3373 | save(); |
---|
3112 | 3374 | //return true; |
---|
3113 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3375 | + } else if (source == saveAsItem) |
---|
3114 | 3376 | { |
---|
3115 | 3377 | saveAs(); |
---|
3116 | 3378 | //return true; |
---|
3117 | | - } else if (event.getSource() == reexportItem) |
---|
| 3379 | + } else if (source == reexportItem) |
---|
3118 | 3380 | { |
---|
3119 | 3381 | reexport(); |
---|
3120 | 3382 | //return true; |
---|
3121 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3383 | + } else if (source == exportAsItem) |
---|
3122 | 3384 | { |
---|
3123 | 3385 | export(); |
---|
3124 | 3386 | //return true; |
---|
3125 | | - } else if (event.getSource() == povItem) |
---|
| 3387 | + } else if (source == povItem) |
---|
3126 | 3388 | { |
---|
3127 | 3389 | generatePOV(); |
---|
3128 | 3390 | //return true; |
---|
3129 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3391 | + } else if (source == zBufferItem) |
---|
3130 | 3392 | { |
---|
3131 | 3393 | try |
---|
3132 | 3394 | { |
---|
.. | .. |
---|
3148 | 3410 | cameraView.repaint(); |
---|
3149 | 3411 | //return true; |
---|
3150 | 3412 | } |
---|
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) |
---|
| 3413 | + */ else // combos... |
---|
| 3414 | + if (source == texresMenu) |
---|
3166 | 3415 | { |
---|
3167 | 3416 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3168 | 3417 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3174 | 3423 | } |
---|
3175 | 3424 | } |
---|
3176 | 3425 | |
---|
| 3426 | + void New() |
---|
| 3427 | + { |
---|
| 3428 | + while (copy.Size() > 1) |
---|
| 3429 | + { |
---|
| 3430 | + copy.remove(1); |
---|
| 3431 | + } |
---|
| 3432 | + |
---|
| 3433 | + ResetModel(); |
---|
| 3434 | + objEditor.refreshContents(); |
---|
| 3435 | + } |
---|
| 3436 | + |
---|
| 3437 | + static public byte[] Compress(Object3D o) |
---|
| 3438 | + { |
---|
| 3439 | + try |
---|
| 3440 | + { |
---|
| 3441 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3442 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3443 | + ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3444 | + |
---|
| 3445 | + Object3D parent = o.parent; |
---|
| 3446 | + o.parent = null; |
---|
| 3447 | + |
---|
| 3448 | + out.writeObject(o); |
---|
| 3449 | + |
---|
| 3450 | + o.parent = parent; |
---|
| 3451 | + |
---|
| 3452 | + out.flush(); |
---|
| 3453 | + |
---|
| 3454 | + zstream.close(); |
---|
| 3455 | + out.close(); |
---|
| 3456 | + |
---|
| 3457 | + return baos.toByteArray(); |
---|
| 3458 | + } catch (Exception e) |
---|
| 3459 | + { |
---|
| 3460 | + System.err.println(e); |
---|
| 3461 | + return null; |
---|
| 3462 | + } |
---|
| 3463 | + } |
---|
| 3464 | + |
---|
| 3465 | + static public Object Uncompress(byte[] bytes) |
---|
| 3466 | + { |
---|
| 3467 | + System.out.println("#bytes = " + bytes.length); |
---|
| 3468 | + try |
---|
| 3469 | + { |
---|
| 3470 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3471 | + java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3472 | + ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3473 | + Object obj = in.readObject(); |
---|
| 3474 | + in.close(); |
---|
| 3475 | + |
---|
| 3476 | + return obj; |
---|
| 3477 | + } catch (Exception e) |
---|
| 3478 | + { |
---|
| 3479 | + System.err.println(e); |
---|
| 3480 | + return null; |
---|
| 3481 | + } |
---|
| 3482 | + } |
---|
| 3483 | + |
---|
| 3484 | + static public Object clone(Object o) |
---|
| 3485 | + { |
---|
| 3486 | + try |
---|
| 3487 | + { |
---|
| 3488 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3489 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3490 | + |
---|
| 3491 | + out.writeObject(o); |
---|
| 3492 | + |
---|
| 3493 | + out.flush(); |
---|
| 3494 | + out.close(); |
---|
| 3495 | + |
---|
| 3496 | + byte[] bytes = baos.toByteArray(); |
---|
| 3497 | + |
---|
| 3498 | + System.out.println("clone = " + bytes.length); |
---|
| 3499 | + |
---|
| 3500 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3501 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3502 | + Object obj = in.readObject(); |
---|
| 3503 | + in.close(); |
---|
| 3504 | + |
---|
| 3505 | + return obj; |
---|
| 3506 | + } catch (Exception e) |
---|
| 3507 | + { |
---|
| 3508 | + System.err.println(e); |
---|
| 3509 | + return null; |
---|
| 3510 | + } |
---|
| 3511 | + } |
---|
| 3512 | + |
---|
| 3513 | + cRadio GetCurrentTab() |
---|
| 3514 | + { |
---|
| 3515 | + cRadio ab; |
---|
| 3516 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3517 | + { |
---|
| 3518 | + ab = (cRadio)e.nextElement(); |
---|
| 3519 | + if(ab.GetObject() == copy) |
---|
| 3520 | + { |
---|
| 3521 | + return ab; |
---|
| 3522 | + } |
---|
| 3523 | + } |
---|
| 3524 | + |
---|
| 3525 | + return null; |
---|
| 3526 | + } |
---|
| 3527 | + |
---|
| 3528 | + java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3529 | + |
---|
| 3530 | + public void Save() |
---|
| 3531 | + { |
---|
| 3532 | + System.err.println("Save"); |
---|
| 3533 | + |
---|
| 3534 | + cRadio tab = GetCurrentTab(); |
---|
| 3535 | + |
---|
| 3536 | + boolean temp = CameraPane.SWITCH; |
---|
| 3537 | + CameraPane.SWITCH = false; |
---|
| 3538 | + |
---|
| 3539 | + copy.ExtractBigData(hashtable); |
---|
| 3540 | + |
---|
| 3541 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3542 | + tab.graphs[tab.undoindex++] = Compress(copy); |
---|
| 3543 | + |
---|
| 3544 | + copy.RestoreBigData(hashtable); |
---|
| 3545 | + |
---|
| 3546 | + CameraPane.SWITCH = temp; |
---|
| 3547 | + |
---|
| 3548 | + //assert(hashtable.isEmpty()); |
---|
| 3549 | + |
---|
| 3550 | + for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3551 | + { |
---|
| 3552 | + tab.graphs[i] = null; |
---|
| 3553 | + } |
---|
| 3554 | + |
---|
| 3555 | + SetUndoStates(); |
---|
| 3556 | + |
---|
| 3557 | + // test save |
---|
| 3558 | + if (false) |
---|
| 3559 | + { |
---|
| 3560 | + try |
---|
| 3561 | + { |
---|
| 3562 | + FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3563 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3564 | + |
---|
| 3565 | + p.writeObject(copy); |
---|
| 3566 | + |
---|
| 3567 | + p.flush(); |
---|
| 3568 | + |
---|
| 3569 | + ostream.close(); |
---|
| 3570 | + } catch (Exception e) |
---|
| 3571 | + { |
---|
| 3572 | + e.printStackTrace(); |
---|
| 3573 | + } |
---|
| 3574 | + } |
---|
| 3575 | + } |
---|
| 3576 | + |
---|
| 3577 | + void CopyChanged(Object3D obj) |
---|
| 3578 | + { |
---|
| 3579 | + SetUndoStates(); |
---|
| 3580 | + |
---|
| 3581 | + boolean temp = CameraPane.SWITCH; |
---|
| 3582 | + CameraPane.SWITCH = false; |
---|
| 3583 | + |
---|
| 3584 | + copy.ExtractBigData(hashtable); |
---|
| 3585 | + |
---|
| 3586 | + copy.clear(); |
---|
| 3587 | + |
---|
| 3588 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3589 | + { |
---|
| 3590 | + copy.add(obj.get(i)); |
---|
| 3591 | + } |
---|
| 3592 | + |
---|
| 3593 | + copy.RestoreBigData(hashtable); |
---|
| 3594 | + |
---|
| 3595 | + CameraPane.SWITCH = temp; |
---|
| 3596 | + |
---|
| 3597 | + //assert(hashtable.isEmpty()); |
---|
| 3598 | + |
---|
| 3599 | + copy.Touch(); |
---|
| 3600 | + |
---|
| 3601 | + ResetModel(); |
---|
| 3602 | + copy.HardTouch(); // recompile? |
---|
| 3603 | + |
---|
| 3604 | + cRadio ab; |
---|
| 3605 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3606 | + { |
---|
| 3607 | + ab = (cRadio)e.nextElement(); |
---|
| 3608 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3609 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3610 | + if (test != null) |
---|
| 3611 | + { |
---|
| 3612 | + test.editWindow = ab.object.editWindow; |
---|
| 3613 | + ab.object = test; |
---|
| 3614 | + } |
---|
| 3615 | + } |
---|
| 3616 | + |
---|
| 3617 | + refreshContents(); |
---|
| 3618 | + } |
---|
| 3619 | + |
---|
| 3620 | + cButton undoButton; |
---|
| 3621 | + cButton redoButton; |
---|
| 3622 | + |
---|
| 3623 | + void SetUndoStates() |
---|
| 3624 | + { |
---|
| 3625 | + cRadio tab = GetCurrentTab(); |
---|
| 3626 | + |
---|
| 3627 | + undoButton.setEnabled(tab.undoindex > 0); |
---|
| 3628 | + redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null); |
---|
| 3629 | + } |
---|
| 3630 | + |
---|
| 3631 | + public void Undo() |
---|
| 3632 | + { |
---|
| 3633 | + System.err.println("Undo"); |
---|
| 3634 | + |
---|
| 3635 | + cRadio tab = GetCurrentTab(); |
---|
| 3636 | + |
---|
| 3637 | + if (tab.undoindex == 0) |
---|
| 3638 | + { |
---|
| 3639 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3640 | + return; |
---|
| 3641 | + } |
---|
| 3642 | + |
---|
| 3643 | + if (tab.graphs[tab.undoindex] == null) |
---|
| 3644 | + { |
---|
| 3645 | + Save(); |
---|
| 3646 | + tab.undoindex -= 1; |
---|
| 3647 | + } |
---|
| 3648 | + |
---|
| 3649 | + tab.undoindex -= 1; |
---|
| 3650 | + |
---|
| 3651 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3652 | + } |
---|
| 3653 | + |
---|
| 3654 | + public void Redo() |
---|
| 3655 | + { |
---|
| 3656 | + cRadio tab = GetCurrentTab(); |
---|
| 3657 | + |
---|
| 3658 | + if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3659 | + { |
---|
| 3660 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3661 | + return; |
---|
| 3662 | + } |
---|
| 3663 | + |
---|
| 3664 | + tab.undoindex += 1; |
---|
| 3665 | + |
---|
| 3666 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3667 | + } |
---|
| 3668 | + |
---|
| 3669 | + void ImportGFD() |
---|
| 3670 | + { |
---|
| 3671 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 3672 | + browser.show(); |
---|
| 3673 | + String filename = browser.getFile(); |
---|
| 3674 | + if (filename != null && filename.length() > 0) |
---|
| 3675 | + { |
---|
| 3676 | + String fullname = browser.getDirectory() + filename; |
---|
| 3677 | + |
---|
| 3678 | + //Object3D readobj = |
---|
| 3679 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 3680 | + //makeSomething(readobj); |
---|
| 3681 | + } |
---|
| 3682 | + } |
---|
| 3683 | + |
---|
| 3684 | + void ImportVRMLX3D() |
---|
| 3685 | + { |
---|
| 3686 | + if (Grafreed.standAlone) |
---|
| 3687 | + { |
---|
| 3688 | + /**/ |
---|
| 3689 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 3690 | + browser.show(); |
---|
| 3691 | + String filename = browser.getFile(); |
---|
| 3692 | + if (filename != null && filename.length() > 0) |
---|
| 3693 | + { |
---|
| 3694 | + String fullname = browser.getDirectory() + filename; |
---|
| 3695 | + LoadVRMLX3D(fullname); |
---|
| 3696 | + } |
---|
| 3697 | + /**/ |
---|
| 3698 | + } |
---|
| 3699 | + } |
---|
| 3700 | + |
---|
3177 | 3701 | void ToggleAnimation() |
---|
3178 | 3702 | { |
---|
3179 | 3703 | if (!Globals.ANIMATION) |
---|
3180 | 3704 | { |
---|
3181 | 3705 | FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); |
---|
3182 | | - browser.show(); |
---|
| 3706 | + browser.setVisible(true); |
---|
3183 | 3707 | String filename = browser.getFile(); |
---|
3184 | 3708 | if (filename != null && filename.length() > 0) |
---|
3185 | 3709 | { |
---|
.. | .. |
---|
3189 | 3713 | |
---|
3190 | 3714 | Globals.ANIMATION ^= true; |
---|
3191 | 3715 | |
---|
3192 | | - GrafreeD.wav.cursor = 0; |
---|
3193 | | - GrafreeD.wav.loop = 0; |
---|
| 3716 | + Grafreed.wav.cursor = 0; |
---|
| 3717 | + Grafreed.wav.loop = 0; |
---|
3194 | 3718 | } |
---|
3195 | 3719 | } else |
---|
3196 | 3720 | { |
---|
.. | .. |
---|
3240 | 3764 | void CreateMaterial() |
---|
3241 | 3765 | { |
---|
3242 | 3766 | //copy.ClearMaterial(); // PATCH |
---|
3243 | | - copy.CreateMaterialS(multiplyToggle.isSelected()); |
---|
| 3767 | + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); |
---|
3244 | 3768 | if (copy.selection.size() > 0) |
---|
3245 | 3769 | //SetMaterial(copy); |
---|
3246 | 3770 | { |
---|
.. | .. |
---|
3291 | 3815 | assert false; |
---|
3292 | 3816 | } |
---|
3293 | 3817 | |
---|
3294 | | - void EditSelection() |
---|
| 3818 | + void EditSelection(boolean newWindow) |
---|
3295 | 3819 | { |
---|
3296 | 3820 | } |
---|
3297 | 3821 | |
---|
.. | .. |
---|
3299 | 3823 | { |
---|
3300 | 3824 | copy.ResetBlockLoop(); // temporary problem |
---|
3301 | 3825 | |
---|
3302 | | - boolean random = CameraPane.RANDOM; |
---|
3303 | | - CameraPane.RANDOM = false; // parse everything |
---|
| 3826 | + boolean random = CameraPane.SWITCH; |
---|
| 3827 | + CameraPane.SWITCH = false; // parse everything |
---|
3304 | 3828 | copy.ResetDisplayList(); |
---|
3305 | 3829 | copy.HardTouch(); |
---|
3306 | | - CameraPane.RANDOM = random; |
---|
| 3830 | + CameraPane.SWITCH = random; |
---|
3307 | 3831 | } |
---|
3308 | 3832 | |
---|
3309 | 3833 | // public void applySelf() |
---|
.. | .. |
---|
3377 | 3901 | { |
---|
3378 | 3902 | //System.out.println("Propagate = " + propagate); |
---|
3379 | 3903 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 3904 | + |
---|
| 3905 | + if (copy.material != null) |
---|
| 3906 | + { |
---|
| 3907 | + cMaterial mat = copy.material; |
---|
| 3908 | + |
---|
| 3909 | + colorField.SetToolTipValue((mat.color)); |
---|
| 3910 | + modulationField.SetToolTipValue((mat.modulation)); |
---|
| 3911 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 3912 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 3913 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 3914 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 3915 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 3916 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 3917 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 3918 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 3919 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 3920 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 3921 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 3922 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 3923 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 3924 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 3925 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 3926 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 3927 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 3928 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 3929 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 3930 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 3931 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 3932 | + } |
---|
| 3933 | + |
---|
3380 | 3934 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3381 | 3935 | { |
---|
3382 | 3936 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3421 | 3975 | || e.getSource() == apertureField |
---|
3422 | 3976 | || e.getSource() == shadowblurField) |
---|
3423 | 3977 | { |
---|
| 3978 | + new Exception().printStackTrace(); |
---|
3424 | 3979 | System.exit(0); |
---|
3425 | 3980 | cameraView.options1[0] = (float) focusField.getFloat() * 10; |
---|
3426 | 3981 | cameraView.options1[1] = (float) apertureField.getFloat() / 1000; |
---|
.. | .. |
---|
3491 | 4046 | } |
---|
3492 | 4047 | |
---|
3493 | 4048 | if (normalpushField != null) |
---|
3494 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 4049 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3495 | 4050 | } |
---|
3496 | 4051 | |
---|
3497 | 4052 | void SnapObject() |
---|
.. | .. |
---|
3755 | 4310 | |
---|
3756 | 4311 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3757 | 4312 | { |
---|
| 4313 | + if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4314 | + Save(); |
---|
3758 | 4315 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3759 | 4316 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3760 | 4317 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3841 | 4398 | { |
---|
3842 | 4399 | ResetModel(); |
---|
3843 | 4400 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4401 | + |
---|
| 4402 | + if (thing.Size() == 0) |
---|
| 4403 | + { |
---|
| 4404 | + //EditSelection(false); |
---|
| 4405 | + } |
---|
| 4406 | + |
---|
3844 | 4407 | refreshContents(); |
---|
3845 | 4408 | } |
---|
3846 | 4409 | |
---|
.. | .. |
---|
3958 | 4521 | } |
---|
3959 | 4522 | } |
---|
3960 | 4523 | } |
---|
| 4524 | + |
---|
3961 | 4525 | LoadGFDThread loadGFDThread; |
---|
3962 | 4526 | |
---|
3963 | 4527 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
3977 | 4541 | |
---|
3978 | 4542 | try |
---|
3979 | 4543 | { |
---|
| 4544 | + // Try compressed version first. |
---|
3980 | 4545 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
3981 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4546 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4547 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
3982 | 4548 | |
---|
3983 | 4549 | readobj = (Object3D) p.readObject(); |
---|
3984 | 4550 | istream.close(); |
---|
.. | .. |
---|
3986 | 4552 | readobj.ResetDisplayList(); |
---|
3987 | 4553 | } catch (Exception e) |
---|
3988 | 4554 | { |
---|
3989 | | - e.printStackTrace(); |
---|
| 4555 | + //e.printStackTrace(); |
---|
| 4556 | + try |
---|
| 4557 | + { |
---|
| 4558 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4559 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4560 | + |
---|
| 4561 | + readobj = (Object3D) p.readObject(); |
---|
| 4562 | + istream.close(); |
---|
| 4563 | + |
---|
| 4564 | + readobj.ResetDisplayList(); |
---|
| 4565 | + } catch (Exception e2) |
---|
| 4566 | + { |
---|
| 4567 | + e2.printStackTrace(); |
---|
| 4568 | + } |
---|
3990 | 4569 | } |
---|
3991 | 4570 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
3992 | 4571 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4032 | 4611 | |
---|
4033 | 4612 | void LoadIt(Object obj) |
---|
4034 | 4613 | { |
---|
| 4614 | + if (obj == null) |
---|
| 4615 | + { |
---|
| 4616 | + // Invalid file |
---|
| 4617 | + return; |
---|
| 4618 | + } |
---|
| 4619 | + |
---|
4035 | 4620 | System.out.println("Loaded " + obj); |
---|
4036 | 4621 | //new Exception().printStackTrace(); |
---|
4037 | 4622 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4041 | 4626 | |
---|
4042 | 4627 | if (readobj != null) |
---|
4043 | 4628 | { |
---|
| 4629 | + if (Globals.SAVEONMAKE) |
---|
| 4630 | + Save(); |
---|
4044 | 4631 | try |
---|
4045 | 4632 | { |
---|
4046 | 4633 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4103 | 4690 | |
---|
4104 | 4691 | void load() // throws ClassNotFoundException |
---|
4105 | 4692 | { |
---|
4106 | | - if (GrafreeD.standAlone) |
---|
| 4693 | + if (Grafreed.standAlone) |
---|
4107 | 4694 | { |
---|
4108 | 4695 | FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
4109 | 4696 | browser.show(); |
---|
.. | .. |
---|
4190 | 4777 | try |
---|
4191 | 4778 | { |
---|
4192 | 4779 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4193 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4780 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4781 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4194 | 4782 | |
---|
4195 | 4783 | p.writeObject(copy); |
---|
4196 | 4784 | p.flush(); |
---|
4197 | 4785 | |
---|
| 4786 | + zstream.close(); |
---|
4198 | 4787 | ostream.close(); |
---|
4199 | 4788 | |
---|
4200 | 4789 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4204 | 4793 | { |
---|
4205 | 4794 | } |
---|
4206 | 4795 | } |
---|
| 4796 | + |
---|
4207 | 4797 | String lastname; |
---|
4208 | 4798 | |
---|
4209 | 4799 | void saveAs() |
---|
4210 | 4800 | { |
---|
4211 | | - if (GrafreeD.standAlone) |
---|
| 4801 | + if (Grafreed.standAlone) |
---|
4212 | 4802 | { |
---|
4213 | 4803 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4214 | 4804 | browser.setVisible(true); |
---|
4215 | 4805 | String filename = browser.getFile(); |
---|
4216 | 4806 | if (filename != null && filename.length() > 0) |
---|
4217 | 4807 | { |
---|
| 4808 | + if (!filename.endsWith(".gfd")) |
---|
| 4809 | + filename += ".gfd"; |
---|
4218 | 4810 | lastname = browser.getDirectory() + filename; |
---|
4219 | 4811 | save(); |
---|
4220 | 4812 | } |
---|
.. | .. |
---|
4313 | 4905 | try |
---|
4314 | 4906 | { |
---|
4315 | 4907 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4316 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4317 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 4908 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4909 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4318 | 4910 | |
---|
4319 | 4911 | Object3D objectparent = obj.parent; |
---|
4320 | 4912 | obj.parent = null; |
---|
4321 | 4913 | |
---|
4322 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 4914 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4323 | 4915 | |
---|
4324 | 4916 | obj.parent = objectparent; |
---|
4325 | 4917 | |
---|
.. | .. |
---|
4331 | 4923 | p.writeObject(object); |
---|
4332 | 4924 | p.flush(); |
---|
4333 | 4925 | |
---|
| 4926 | + zstream.close(); |
---|
4334 | 4927 | ostream.close(); |
---|
4335 | | - // zstream.close(); |
---|
4336 | 4928 | |
---|
4337 | 4929 | // group.selection.get(0).parent = parent; |
---|
4338 | 4930 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4353 | 4945 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4354 | 4946 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4355 | 4947 | copy.generatePOV(buffer); |
---|
4356 | | - if (GrafreeD.standAlone) |
---|
| 4948 | + if (Grafreed.standAlone) |
---|
4357 | 4949 | { |
---|
4358 | 4950 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4359 | 4951 | browser.show(); |
---|
.. | .. |
---|
4379 | 4971 | Object3D client; |
---|
4380 | 4972 | Object3D copy; |
---|
4381 | 4973 | MenuBar menuBar; |
---|
4382 | | - Menu windowMenu; |
---|
| 4974 | + Menu fileMenu; |
---|
| 4975 | + MenuItem newItem; |
---|
4383 | 4976 | MenuItem loadItem; |
---|
4384 | 4977 | MenuItem saveItem; |
---|
4385 | 4978 | MenuItem saveAsItem; |
---|
.. | .. |
---|
4387 | 4980 | MenuItem reexportItem; |
---|
4388 | 4981 | MenuItem povItem; |
---|
4389 | 4982 | MenuItem closeItem; |
---|
4390 | | - Menu cameraMenu; |
---|
| 4983 | + |
---|
4391 | 4984 | CheckboxMenuItem zBufferItem; |
---|
4392 | 4985 | //MenuItem normalLensItem; |
---|
4393 | | - MenuItem editCameraItem; |
---|
4394 | | - MenuItem revertCameraItem; |
---|
4395 | | - CheckboxMenuItem toggleLiveItem; |
---|
4396 | 4986 | MenuItem stepItem; |
---|
| 4987 | + CheckboxMenuItem toggleLiveItem; |
---|
4397 | 4988 | CheckboxMenuItem toggleFullScreenItem; |
---|
4398 | 4989 | CheckboxMenuItem toggleTimelineItem; |
---|
4399 | 4990 | CheckboxMenuItem toggleRenderItem; |
---|
.. | .. |
---|
4402 | 4993 | CheckboxMenuItem toggleFootContactItem; |
---|
4403 | 4994 | CheckboxMenuItem toggleDLItem; |
---|
4404 | 4995 | CheckboxMenuItem toggleTextureItem; |
---|
4405 | | - CheckboxMenuItem toggleRandomItem; |
---|
| 4996 | + CheckboxMenuItem toggleSwitchItem; |
---|
4406 | 4997 | CheckboxMenuItem toggleRootItem; |
---|
4407 | 4998 | CheckboxMenuItem animationItem; |
---|
4408 | 4999 | CheckboxMenuItem toggleHandleItem; |
---|
4409 | 5000 | CheckboxMenuItem togglePaintItem; |
---|
4410 | 5001 | JSplitPane mainPanel; |
---|
4411 | 5002 | JScrollPane scrollpane; |
---|
| 5003 | + |
---|
4412 | 5004 | JPanel toolbarPanel; |
---|
4413 | | - JPanel treePanel; |
---|
| 5005 | + |
---|
| 5006 | + cGridBag treePanel; |
---|
| 5007 | + |
---|
4414 | 5008 | JPanel radioPanel; |
---|
4415 | 5009 | ButtonGroup buttonGroup; |
---|
4416 | | - cGridBag ctrlPanel; |
---|
| 5010 | + |
---|
| 5011 | + cGridBag toolboxPanel; |
---|
4417 | 5012 | cGridBag materialPanel; |
---|
| 5013 | + cGridBag ctrlPanel; |
---|
| 5014 | + |
---|
4418 | 5015 | JScrollPane infoPanel; |
---|
| 5016 | + |
---|
4419 | 5017 | cGridBag optionsPanel; |
---|
| 5018 | + |
---|
4420 | 5019 | JTabbedPane objectPanel; |
---|
| 5020 | + boolean materialFlushed; |
---|
| 5021 | + Object3D latestObject; |
---|
| 5022 | + |
---|
4421 | 5023 | cGridBag XYZPanel; |
---|
| 5024 | + |
---|
4422 | 5025 | JSplitPane gridPanel; |
---|
4423 | 5026 | JSplitPane bigPanel; |
---|
| 5027 | + |
---|
4424 | 5028 | cGridBag bigThree; |
---|
4425 | 5029 | cGridBag scenePanel; |
---|
4426 | 5030 | cGridBag centralPanel; |
---|
.. | .. |
---|
4535 | 5139 | cNumberSlider fogField; |
---|
4536 | 5140 | JLabel opacityPowerLabel; |
---|
4537 | 5141 | cNumberSlider opacityPowerField; |
---|
4538 | | - JTree jTree; |
---|
| 5142 | + cTree jTree; |
---|
4539 | 5143 | //ObjectUI parent; |
---|
4540 | 5144 | |
---|
4541 | 5145 | cNumberSlider normalpushField; |
---|
| 5146 | + |
---|
| 5147 | + private MenuItem importGFDItem; |
---|
| 5148 | + private MenuItem importVRMLX3DItem; |
---|
| 5149 | + private MenuItem import3DSItem; |
---|
| 5150 | + private MenuItem importOBJItem; |
---|
4542 | 5151 | } |
---|