.. | .. |
---|
19 | 19 | import //weka.core. |
---|
20 | 20 | matrix.Matrix; |
---|
21 | 21 | |
---|
| 22 | +import grafeme.ui.*; |
---|
| 23 | + |
---|
22 | 24 | class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI, |
---|
23 | 25 | ActionListener, ChangeListener, |
---|
24 | 26 | InputMethodListener, |
---|
.. | .. |
---|
28 | 30 | iSendInfo |
---|
29 | 31 | //KeyListener |
---|
30 | 32 | { |
---|
| 33 | + boolean timeline; |
---|
| 34 | + boolean wasFullScreen; |
---|
31 | 35 | |
---|
| 36 | + GroupEditor callee; |
---|
| 37 | + JFrame frame; |
---|
| 38 | + |
---|
32 | 39 | // SCRIPT |
---|
33 | 40 | |
---|
34 | 41 | transient JFrame textpanel = null; |
---|
.. | .. |
---|
119 | 126 | void keyPressed(int key, int modifiers) |
---|
120 | 127 | { |
---|
121 | 128 | System.out.println("KEY PRESSED"); |
---|
122 | | - CameraPane.theRenderer.keyPressed(key, modifiers); |
---|
| 129 | + Globals.theRenderer.keyPressed(key, modifiers); |
---|
123 | 130 | } |
---|
124 | 131 | */ |
---|
125 | 132 | |
---|
126 | 133 | static GridBagConstraints aConstraints; |
---|
127 | 134 | static GridBagConstraints aWindowConstraints; |
---|
128 | | - GroupEditor callee; |
---|
129 | | - JFrame frame; |
---|
| 135 | + |
---|
130 | 136 | static int GRIDWIDTH = 100; // 4; |
---|
131 | 137 | |
---|
132 | 138 | public void closeUI() |
---|
133 | 139 | { |
---|
134 | 140 | //new Exception().printStackTrace(); |
---|
135 | | - System.out.println("this = " + this); |
---|
136 | | - System.out.println("objEditor = " + objEditor); |
---|
| 141 | +// System.out.println("this = " + this); |
---|
| 142 | +// System.out.println("objEditor = " + objEditor); |
---|
137 | 143 | //nameField.removeActionListener(this); |
---|
138 | | - objEditor.ctrlPanel.remove(nameField); |
---|
| 144 | +// objEditor.ctrlPanel.remove(nameField); |
---|
| 145 | + |
---|
| 146 | + objEditor.ctrlPanel.remove(namePanel); |
---|
139 | 147 | |
---|
140 | 148 | if (!GroupEditor.allparams) |
---|
141 | 149 | return; |
---|
142 | 150 | |
---|
143 | | - objEditor.ctrlPanel.remove(liveCB); |
---|
144 | | - objEditor.ctrlPanel.remove(hideCB); |
---|
145 | | - objEditor.ctrlPanel.remove(markCB); |
---|
146 | | - |
---|
147 | | - objEditor.ctrlPanel.remove(randomCB); |
---|
148 | | - objEditor.ctrlPanel.remove(speedupCB); |
---|
149 | | - objEditor.ctrlPanel.remove(rewindCB); |
---|
150 | | - |
---|
151 | | - objEditor.ctrlPanel.remove(resetButton); |
---|
152 | | - objEditor.ctrlPanel.remove(stepButton); |
---|
153 | | -// objEditor.ctrlPanel.remove(stepAllButton); |
---|
154 | | -// objEditor.ctrlPanel.remove(resetAllButton); |
---|
155 | | - objEditor.ctrlPanel.remove(link2masterCB); |
---|
156 | | - //objEditor.ctrlPanel.remove(flipVCB); |
---|
157 | | - //objEditor.ctrlPanel.remove(texresMenu); |
---|
158 | | - objEditor.ctrlPanel.remove(slowerButton); |
---|
159 | | - objEditor.ctrlPanel.remove(fasterButton); |
---|
160 | | - objEditor.ctrlPanel.remove(remarkButton); |
---|
| 151 | +// objEditor.ctrlPanel.remove(liveCB); |
---|
| 152 | +// objEditor.ctrlPanel.remove(hideCB); |
---|
| 153 | +// objEditor.ctrlPanel.remove(markCB); |
---|
| 154 | +// |
---|
| 155 | +// objEditor.ctrlPanel.remove(randomCB); |
---|
| 156 | +// objEditor.ctrlPanel.remove(speedupCB); |
---|
| 157 | +// objEditor.ctrlPanel.remove(rewindCB); |
---|
| 158 | +// |
---|
| 159 | +// objEditor.ctrlPanel.remove(resetButton); |
---|
| 160 | +// objEditor.ctrlPanel.remove(stepButton); |
---|
| 161 | +//// objEditor.ctrlPanel.remove(stepAllButton); |
---|
| 162 | +//// objEditor.ctrlPanel.remove(resetAllButton); |
---|
| 163 | +// objEditor.ctrlPanel.remove(link2masterCB); |
---|
| 164 | +// //objEditor.ctrlPanel.remove(flipVCB); |
---|
| 165 | +// //objEditor.ctrlPanel.remove(texresMenu); |
---|
| 166 | +// objEditor.ctrlPanel.remove(slowerButton); |
---|
| 167 | +// objEditor.ctrlPanel.remove(fasterButton); |
---|
| 168 | +// objEditor.ctrlPanel.remove(remarkButton); |
---|
| 169 | + |
---|
| 170 | + objEditor.ctrlPanel.remove(setupPanel); |
---|
| 171 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 172 | + objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 173 | + objEditor.ctrlPanel.remove(pushPanel); |
---|
| 174 | + //objEditor.ctrlPanel.remove(fillPanel); |
---|
| 175 | + |
---|
| 176 | + //Remove(normalpushField); |
---|
161 | 177 | } |
---|
162 | 178 | |
---|
163 | 179 | public ObjEditor GetEditor() |
---|
164 | 180 | { |
---|
165 | 181 | return objEditor; //.GetEditor(); |
---|
166 | 182 | } |
---|
| 183 | + |
---|
| 184 | + // Sometimes myself, sometimes my callee's. |
---|
167 | 185 | ObjEditor objEditor; |
---|
168 | 186 | |
---|
169 | 187 | /* |
---|
.. | .. |
---|
238 | 256 | //if (!isDisplayable()) |
---|
239 | 257 | //setUndecorated(true); |
---|
240 | 258 | |
---|
241 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 259 | + //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
242 | 260 | client = inClient; |
---|
243 | 261 | copy = localCopy; |
---|
244 | 262 | copy.editWindow = this; |
---|
.. | .. |
---|
259 | 277 | void SetupMenu() |
---|
260 | 278 | { |
---|
261 | 279 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
262 | | - menuBar.add(windowMenu = new Menu("File")); |
---|
263 | | - windowMenu.add(loadItem = new MenuItem("Load...")); |
---|
264 | | - windowMenu.add("-"); |
---|
265 | | - windowMenu.add(saveItem = new MenuItem("Save")); |
---|
266 | | - windowMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
| 280 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 281 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 282 | + fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 283 | + |
---|
| 284 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 285 | + Menu menu = new Menu("Import"); |
---|
| 286 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 287 | + importOBJItem.addActionListener(this); |
---|
| 288 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 289 | + import3DSItem.addActionListener(this); |
---|
| 290 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 291 | + importVRMLX3DItem.addActionListener(this); |
---|
| 292 | + menu.add("-"); |
---|
| 293 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 294 | + importGFDItem.addActionListener(this); |
---|
| 295 | + fileMenu.add(menu); |
---|
| 296 | + fileMenu.add("-"); |
---|
| 297 | + |
---|
| 298 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 299 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
267 | 300 | //windowMenu.add(povItem = new MenuItem("Emit POV-Ray...")); |
---|
268 | | - windowMenu.add("-"); |
---|
269 | | - windowMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
270 | | - windowMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
271 | | - windowMenu.add("-"); |
---|
| 301 | + fileMenu.add("-"); |
---|
| 302 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 303 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 304 | + fileMenu.add("-"); |
---|
272 | 305 | if (client.parent != null) |
---|
273 | 306 | { |
---|
274 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 307 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
275 | 308 | } else |
---|
276 | 309 | { |
---|
277 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 310 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
278 | 311 | } |
---|
279 | 312 | |
---|
| 313 | + newItem.addActionListener(this); |
---|
280 | 314 | loadItem.addActionListener(this); |
---|
281 | 315 | saveItem.addActionListener(this); |
---|
282 | 316 | saveAsItem.addActionListener(this); |
---|
.. | .. |
---|
285 | 319 | //povItem.addActionListener(this); |
---|
286 | 320 | closeItem.addActionListener(this); |
---|
287 | 321 | |
---|
288 | | - menuBar.add(cameraMenu = new Menu("View")); |
---|
289 | | - //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer")); |
---|
290 | | - //zBufferItem.addActionListener(this); |
---|
291 | | - //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens")); |
---|
292 | | - //normalLensItem.addActionListener(this); |
---|
293 | | - cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera")); |
---|
294 | | - revertCameraItem.addActionListener(this); |
---|
295 | | - cameraMenu.add(toggleFullItem = new CheckboxMenuItem("Full Screen")); |
---|
296 | | - toggleFullItem.addItemListener(this); |
---|
297 | | - toggleFullItem.setState(CameraPane.FULLSCREEN); |
---|
298 | | - cameraMenu.add("-"); |
---|
299 | | - cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); |
---|
300 | | - toggleTextureItem.addItemListener(this); |
---|
301 | | - toggleTextureItem.setState(CameraPane.textureon); |
---|
302 | | - cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); |
---|
303 | | - toggleLiveItem.addItemListener(this); |
---|
304 | | - toggleLiveItem.setState(CameraPane.isLIVE()); |
---|
305 | | - cameraMenu.add(stepItem = new MenuItem("Step")); |
---|
306 | | - stepItem.addActionListener(this); |
---|
307 | | -// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); |
---|
308 | | -// toggleDLItem.addItemListener(this); |
---|
309 | | -// toggleDLItem.setState(false); |
---|
310 | | - cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render")); |
---|
311 | | - toggleRenderItem.addItemListener(this); |
---|
312 | | - toggleRenderItem.setState(!CameraPane.frozen); |
---|
313 | | - cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); |
---|
314 | | - toggleDebugItem.addItemListener(this); |
---|
315 | | - toggleDebugItem.setState(CameraPane.DEBUG); |
---|
316 | | - cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); |
---|
317 | | - toggleFrustumItem.addItemListener(this); |
---|
318 | | - toggleFrustumItem.setState(CameraPane.FRUSTUM); |
---|
319 | | - cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact")); |
---|
320 | | - toggleFootContactItem.addItemListener(this); |
---|
321 | | - toggleFootContactItem.setState(CameraPane.FOOTCONTACT); |
---|
322 | | - cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random")); |
---|
323 | | - toggleRandomItem.addItemListener(this); |
---|
324 | | - toggleRandomItem.setState(CameraPane.RANDOM); |
---|
325 | | - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); |
---|
326 | | - toggleHandleItem.addItemListener(this); |
---|
327 | | - toggleHandleItem.setState(CameraPane.HANDLES); |
---|
328 | | - cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode")); |
---|
329 | | - togglePaintItem.addItemListener(this); |
---|
330 | | - togglePaintItem.setState(CameraPane.PAINTMODE); |
---|
331 | | -// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root")); |
---|
332 | | -// toggleRootItem.addItemListener(this); |
---|
333 | | -// toggleRootItem.setState(false); |
---|
334 | | -// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation")); |
---|
335 | | -// animationItem.addItemListener(this); |
---|
336 | | -// animationItem.setState(CameraPane.ANIMATION); |
---|
337 | | - cameraMenu.add("-"); |
---|
338 | | - cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera")); |
---|
339 | | - editCameraItem.addActionListener(this); |
---|
340 | | - |
---|
341 | 322 | objectPanel = new JTabbedPane(); |
---|
342 | 323 | toolbarPanel = new JPanel(); |
---|
343 | 324 | toolbarPanel.setName("Toolbar"); |
---|
344 | | - treePanel = new JPanel(); |
---|
| 325 | + treePanel = new cGridBag(); |
---|
345 | 326 | treePanel.setName("Tree"); |
---|
346 | | - ctrlPanel = new JPanel(); // new GridBagLayout()); |
---|
| 327 | + ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
347 | 328 | ctrlPanel.setName("Edit"); |
---|
348 | | - materialPanel = new JPanel(); |
---|
| 329 | + materialPanel = new cGridBag().setVertical(true); |
---|
349 | 330 | materialPanel.setName("Material"); |
---|
350 | 331 | /*JTextPane*/ |
---|
351 | 332 | infoarea = createTextPane(); |
---|
| 333 | + doc = infoarea.getStyledDocument(); |
---|
| 334 | + |
---|
352 | 335 | infoarea.setEditable(true); |
---|
353 | 336 | SetText(); |
---|
354 | 337 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
355 | 338 | // infoarea.setOpaque(false); |
---|
356 | 339 | // //infoarea.setForeground(textcolor); |
---|
357 | | - infoarea.setLineWrap(true); |
---|
358 | | - infoarea.setWrapStyleWord(true); |
---|
| 340 | +// TEXTAREA infoarea.setLineWrap(true); |
---|
| 341 | +// TEXTAREA infoarea.setWrapStyleWord(true); |
---|
359 | 342 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
360 | 343 | infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
361 | 344 | infoPanel.setName("Info"); |
---|
.. | .. |
---|
366 | 349 | mainPanel.setName("Main"); |
---|
367 | 350 | mainPanel.setContinuousLayout(true); |
---|
368 | 351 | mainPanel.setOneTouchExpandable(true); |
---|
369 | | - mainPanel.setDividerLocation(1.0); |
---|
370 | 352 | mainPanel.setDividerSize(9); |
---|
371 | | - mainPanel.setResizeWeight(0); |
---|
| 353 | + mainPanel.setDividerLocation(0.5); //1.0); |
---|
| 354 | + mainPanel.setResizeWeight(0.5); |
---|
372 | 355 | |
---|
373 | 356 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
374 | 357 | //mainPanel.setLayout(new GridBagLayout()); |
---|
375 | 358 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
376 | | - treePanel.setLayout(new GridBagLayout()); |
---|
377 | | - ctrlPanel.setLayout(new GridBagLayout()); |
---|
378 | | - materialPanel.setLayout(new GridBagLayout()); |
---|
| 359 | +// treePanel.setLayout(new GridBagLayout()); |
---|
| 360 | + //ctrlPanel.setLayout(new GridBagLayout()); |
---|
| 361 | + //materialPanel.setLayout(new GridBagLayout()); |
---|
379 | 362 | |
---|
380 | 363 | aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, |
---|
381 | 364 | GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0); |
---|
.. | .. |
---|
414 | 397 | static String newline = "\n"; |
---|
415 | 398 | protected static final String buttonString = "JButton"; |
---|
416 | 399 | StyledDocument doc; |
---|
417 | | - JTextArea infoarea; |
---|
| 400 | + JTextPane infoarea; |
---|
418 | 401 | |
---|
419 | 402 | void ClearInfo() |
---|
420 | 403 | { |
---|
.. | .. |
---|
437 | 420 | e.printStackTrace(); |
---|
438 | 421 | } |
---|
439 | 422 | |
---|
440 | | - String selection = infoarea.getText(); |
---|
441 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
442 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
443 | | - Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
| 423 | +// String selection = infoarea.getText(); |
---|
| 424 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 425 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 426 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
444 | 427 | //clipboard.setContents(data, data); |
---|
445 | 428 | } |
---|
446 | 429 | |
---|
.. | .. |
---|
463 | 446 | //SendInfo("Name:", "bold"); |
---|
464 | 447 | if (sel.GetTextures() != null || debug) |
---|
465 | 448 | { |
---|
466 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 449 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
467 | 450 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
468 | 451 | if (sel.Size() > 0) |
---|
469 | 452 | { |
---|
470 | 453 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
471 | 454 | } |
---|
472 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 455 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
473 | 456 | if (debug) |
---|
474 | 457 | { |
---|
475 | 458 | try |
---|
.. | .. |
---|
481 | 464 | } |
---|
482 | 465 | |
---|
483 | 466 | if (full) |
---|
484 | | - si.SendInfo(" BBox: " + minima + " - " + maxima, "regular"); |
---|
| 467 | + { |
---|
| 468 | + si.SendInfo(" BBox min: " + minima, "regular"); |
---|
| 469 | + si.SendInfo(" BBox max: " + maxima, "regular"); |
---|
| 470 | + } |
---|
485 | 471 | |
---|
486 | 472 | if (sel.bRep != null) |
---|
487 | 473 | { |
---|
.. | .. |
---|
508 | 494 | } |
---|
509 | 495 | if (sel.support != null) |
---|
510 | 496 | { |
---|
511 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 497 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
512 | 498 | } |
---|
513 | 499 | if (sel.scriptnode != null) |
---|
514 | 500 | { |
---|
.. | .. |
---|
579 | 565 | { |
---|
580 | 566 | CameraPane.pointflow = (PointFlow) sel; |
---|
581 | 567 | } |
---|
| 568 | + |
---|
| 569 | + si.SendInfo("_____________________", "regular"); |
---|
| 570 | + si.SendInfo("", "regular"); |
---|
582 | 571 | } |
---|
583 | 572 | } |
---|
584 | 573 | |
---|
.. | .. |
---|
594 | 583 | } |
---|
595 | 584 | } |
---|
596 | 585 | |
---|
597 | | - private JTextArea createTextPane() |
---|
598 | | - { |
---|
599 | | - String[] initString = |
---|
| 586 | + void ToggleFullScreen() |
---|
600 | 587 | { |
---|
601 | | - "This is an editable JTextPane, ", //regular |
---|
602 | | - "another ", //italic |
---|
603 | | - "styled ", //bold |
---|
604 | | - "text ", //small |
---|
605 | | - "component, ", //large |
---|
606 | | - "which supports embedded components..." + newline,//regular |
---|
607 | | - " " + newline, //button |
---|
608 | | - "...and embedded icons..." + newline, //regular |
---|
609 | | - " ", //icon |
---|
610 | | - newline + "JTextPane is a subclass of JEditorPane that " |
---|
611 | | - + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
612 | | - + "cover methods for interacting with those objects." |
---|
613 | | - }; |
---|
614 | | - |
---|
615 | | - String[] initStyles = |
---|
616 | | - { |
---|
617 | | - "regular", "italic", "bold", "small", "large", |
---|
618 | | - "regular", "button", "regular", "icon", |
---|
619 | | - "regular" |
---|
620 | | - }; |
---|
621 | | - |
---|
622 | | - JTextPane textPane = new JTextPane(); |
---|
623 | | - textPane.setEditable(true); |
---|
624 | | - /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
625 | | - addStylesToDocument(doc); |
---|
626 | | - |
---|
627 | | - try |
---|
628 | | - { |
---|
629 | | - for (int j = 0; j < 2; j++) |
---|
630 | | - { |
---|
631 | | - for (int i = 0; i < initString.length; i++) |
---|
| 588 | + if (CameraPane.FULLSCREEN) |
---|
632 | 589 | { |
---|
633 | | - doc.insertString(doc.getLength(), initString[i], |
---|
634 | | - doc.getStyle(initStyles[i])); |
---|
| 590 | + frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 591 | + framePanel.add(bigThree); |
---|
| 592 | + frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 593 | + } else |
---|
| 594 | + { |
---|
| 595 | + frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 596 | + framePanel.remove(bigThree); |
---|
| 597 | + frame.getContentPane().add(/*"Center",*/bigThree); |
---|
635 | 598 | } |
---|
636 | | - } |
---|
637 | | - } catch (BadLocationException ble) |
---|
638 | | - { |
---|
639 | | - System.err.println("Couldn't insert initial text into text pane."); |
---|
| 599 | + cameraView.ToggleFullScreen(); |
---|
640 | 600 | } |
---|
641 | 601 | |
---|
642 | | - return new JTextArea(); // textPane; |
---|
| 602 | + private JTextPane createTextPane() |
---|
| 603 | + { |
---|
| 604 | +// TEXTAREA String[] initString = |
---|
| 605 | +// { |
---|
| 606 | +// "This is an editable JTextPane, ", //regular |
---|
| 607 | +// "another ", //italic |
---|
| 608 | +// "styled ", //bold |
---|
| 609 | +// "text ", //small |
---|
| 610 | +// "component, ", //large |
---|
| 611 | +// "which supports embedded components..." + newline,//regular |
---|
| 612 | +// " " + newline, //button |
---|
| 613 | +// "...and embedded icons..." + newline, //regular |
---|
| 614 | +// " ", //icon |
---|
| 615 | +// newline + "JTextPane is a subclass of JEditorPane that " |
---|
| 616 | +// + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
| 617 | +// + "cover methods for interacting with those objects." |
---|
| 618 | +// }; |
---|
| 619 | +// |
---|
| 620 | +// String[] initStyles = |
---|
| 621 | +// { |
---|
| 622 | +// "regular", "italic", "bold", "small", "large", |
---|
| 623 | +// "regular", "button", "regular", "icon", |
---|
| 624 | +// "regular" |
---|
| 625 | +// }; |
---|
| 626 | +// |
---|
| 627 | +// JTextPane textPane = new JTextPane(); |
---|
| 628 | +// textPane.setEditable(true); |
---|
| 629 | +// /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
| 630 | +// addStylesToDocument(doc); |
---|
| 631 | +// |
---|
| 632 | +// try |
---|
| 633 | +// { |
---|
| 634 | +// for (int j = 0; j < 2; j++) |
---|
| 635 | +// { |
---|
| 636 | +// for (int i = 0; i < initString.length; i++) |
---|
| 637 | +// { |
---|
| 638 | +// doc.insertString(doc.getLength(), initString[i], |
---|
| 639 | +// doc.getStyle(initStyles[i])); |
---|
| 640 | +// } |
---|
| 641 | +// } |
---|
| 642 | +// } catch (BadLocationException ble) |
---|
| 643 | +// { |
---|
| 644 | +// System.err.println("Couldn't insert initial text into text pane."); |
---|
| 645 | +// } |
---|
| 646 | + |
---|
| 647 | + return new JTextPane(); // textPane; |
---|
643 | 648 | } |
---|
644 | 649 | |
---|
645 | 650 | protected void addStylesToDocument(StyledDocument doc) |
---|
.. | .. |
---|
692 | 697 | protected static ImageIcon createImageIcon(String path, |
---|
693 | 698 | String description) |
---|
694 | 699 | { |
---|
695 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 700 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
696 | 701 | if (imgURL != null) |
---|
697 | 702 | { |
---|
698 | 703 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
724 | 729 | // NumberSlider vDivsField; |
---|
725 | 730 | // JCheckBox endcaps; |
---|
726 | 731 | JCheckBox liveCB; |
---|
| 732 | + JCheckBox selectCB; |
---|
727 | 733 | JCheckBox hideCB; |
---|
728 | 734 | JCheckBox link2masterCB; |
---|
729 | 735 | JCheckBox markCB; |
---|
.. | .. |
---|
739 | 745 | JButton slowerButton; |
---|
740 | 746 | JButton fasterButton; |
---|
741 | 747 | JButton remarkButton; |
---|
| 748 | + |
---|
| 749 | + cGridBag namePanel; |
---|
| 750 | + cGridBag setupPanel; |
---|
| 751 | + cGridBag setupPanel2; |
---|
| 752 | + cGridBag commandsPanel; |
---|
| 753 | + cGridBag pushPanel; |
---|
| 754 | + cGridBag fillPanel; |
---|
742 | 755 | |
---|
743 | | - JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on) |
---|
| 756 | + JCheckBox AddCheckBox(cGridBag panel, String label, boolean on) |
---|
744 | 757 | { |
---|
745 | 758 | JCheckBox cb; |
---|
746 | 759 | |
---|
747 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
748 | | - oe.aConstraints.gridwidth = 1; // 3; |
---|
749 | | -// oe.aConstraints.weightx = 1; |
---|
750 | | -// oe.aConstraints.anchor = GridBagConstraints.WEST; |
---|
751 | | - oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 760 | + panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
752 | 761 | cb.addItemListener(this); |
---|
753 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
754 | | - oe.aConstraints.gridwidth = 1; |
---|
755 | | - oe.aConstraints.gridx += 1; |
---|
756 | 762 | |
---|
757 | 763 | return cb; |
---|
758 | 764 | } |
---|
759 | 765 | |
---|
760 | | - cButton AddButton(ObjEditor oe, String label) |
---|
| 766 | + cButton AddButton(cGridBag panel, String label) |
---|
761 | 767 | { |
---|
762 | 768 | cButton cb; |
---|
763 | 769 | |
---|
764 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
765 | | - oe.aConstraints.gridwidth = 1; |
---|
766 | | -// oe.aConstraints.weightx = 1; |
---|
767 | | -// oe.aConstraints.anchor = GridBagConstraints.WEST; |
---|
768 | | - oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); |
---|
| 770 | + panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); |
---|
769 | 771 | cb.addActionListener(this); |
---|
770 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
771 | | - oe.aConstraints.gridwidth = 1; |
---|
772 | | - oe.aConstraints.gridx += 1; |
---|
773 | 772 | |
---|
774 | 773 | return cb; |
---|
775 | 774 | } |
---|
776 | 775 | |
---|
777 | | - JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item) |
---|
| 776 | + JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item) |
---|
778 | 777 | { |
---|
779 | 778 | JComboBox combo; |
---|
780 | 779 | |
---|
781 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
782 | | - oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
783 | | - oe.aConstraints.gridx += 1; |
---|
| 780 | + panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
784 | 781 | combo.addActionListener(this); |
---|
785 | 782 | |
---|
786 | 783 | return combo; |
---|
787 | 784 | } |
---|
788 | 785 | |
---|
789 | | - NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow) |
---|
| 786 | + cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow) |
---|
790 | 787 | { |
---|
791 | | - NumberSlider combo; |
---|
| 788 | + cGridBag control = new cGridBag(); |
---|
| 789 | + |
---|
| 790 | + cNumberSlider combo; |
---|
792 | 791 | |
---|
793 | 792 | JLabel jlabel = new JLabel(label); |
---|
794 | | - |
---|
795 | | - aConstraints.fill = GridBagConstraints.VERTICAL; |
---|
796 | 793 | jlabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
797 | | - aConstraints.gridwidth = 2; |
---|
798 | | - ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
799 | | - aConstraints.gridx += 1; |
---|
800 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
801 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
802 | | - ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
803 | | - aConstraints.gridx += 1; |
---|
804 | | - aConstraints.gridwidth = 1; |
---|
805 | | - |
---|
| 794 | + control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 795 | + control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
806 | 796 | combo.setFloat(current); |
---|
807 | | - |
---|
808 | | - combo.label = jlabel; |
---|
809 | | - |
---|
810 | | - combo.addChangeListener(this); |
---|
811 | | - |
---|
812 | | - return combo; |
---|
| 797 | + |
---|
| 798 | + panel.add(control); |
---|
| 799 | + |
---|
| 800 | + return control; |
---|
813 | 801 | } |
---|
814 | 802 | |
---|
815 | | - NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current) |
---|
| 803 | + cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current) |
---|
816 | 804 | { |
---|
817 | | - NumberSlider combo; |
---|
| 805 | + cGridBag control = new cGridBag(); |
---|
| 806 | + |
---|
| 807 | + cNumberSlider combo; |
---|
818 | 808 | |
---|
819 | 809 | JLabel jlabel = new JLabel(label); |
---|
820 | | - |
---|
821 | | - aConstraints.fill = GridBagConstraints.VERTICAL; |
---|
822 | 810 | jlabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
823 | | - aConstraints.gridwidth = 2; |
---|
824 | | - ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
825 | | - aConstraints.gridx += 1; |
---|
826 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
827 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
828 | | - ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
829 | | - aConstraints.gridx += 1; |
---|
830 | | - aConstraints.gridwidth = 1; |
---|
831 | | - |
---|
| 811 | + control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 812 | + control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
832 | 813 | combo.setInteger(current); |
---|
833 | 814 | |
---|
834 | | - combo.label = jlabel; |
---|
835 | | - |
---|
836 | | - combo.addChangeListener(this); |
---|
837 | | - |
---|
838 | | - return combo; |
---|
| 815 | + panel.add(control); |
---|
| 816 | + |
---|
| 817 | + return control; |
---|
839 | 818 | } |
---|
840 | 819 | |
---|
841 | | - JTextArea AddText(JPanel ctrlPanel, String name) |
---|
| 820 | + JTextArea AddText(cGridBag ctrlPanel, String name) |
---|
842 | 821 | { |
---|
843 | 822 | JTextArea text; |
---|
844 | 823 | |
---|
845 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
846 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
847 | | - ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 824 | + ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
848 | 825 | text.addCaretListener(this); |
---|
849 | | - aConstraints.gridx += 1; |
---|
850 | | - aConstraints.gridwidth = 1; |
---|
851 | 826 | |
---|
852 | 827 | return text; |
---|
853 | 828 | } |
---|
.. | .. |
---|
877 | 852 | objEditor.ctrlPanel.remove(j); |
---|
878 | 853 | } |
---|
879 | 854 | |
---|
| 855 | + void Remove(cNumberSlider j) |
---|
| 856 | + { |
---|
| 857 | + j.removeChangeListener(this); |
---|
| 858 | + //objEditor.ctrlPanel.remove(j.label); |
---|
| 859 | + objEditor.ctrlPanel.remove(j); |
---|
| 860 | + } |
---|
| 861 | + |
---|
880 | 862 | /* |
---|
881 | 863 | */ |
---|
882 | | - void Return() // ObjEditor oe) |
---|
| 864 | + void Return0() // ObjEditor oe) |
---|
883 | 865 | { |
---|
884 | 866 | aConstraints.gridy += 1; |
---|
885 | 867 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
934 | 916 | |
---|
935 | 917 | void SetupUI2(ObjEditor oe) |
---|
936 | 918 | { |
---|
937 | | -// oe.aConstraints.weightx = 0; |
---|
938 | | -// oe.aConstraints.weighty = 0; |
---|
939 | | -// oe.aConstraints.gridx = 0; |
---|
940 | | -// oe.aConstraints.gridy = 0; |
---|
941 | | - SetupName(oe); |
---|
| 919 | + //SetupName(oe); |
---|
| 920 | + |
---|
| 921 | + namePanel = new cGridBag(); |
---|
| 922 | + |
---|
| 923 | + nameField = AddText(namePanel, copy.GetName()); |
---|
| 924 | + namePanel.add(nameField); |
---|
| 925 | + oe.ctrlPanel.add(namePanel); |
---|
| 926 | + |
---|
| 927 | + oe.ctrlPanel.Return(); |
---|
942 | 928 | |
---|
943 | 929 | if (!GroupEditor.allparams) |
---|
944 | 930 | return; |
---|
945 | 931 | |
---|
946 | | - liveCB = AddCheckBox(oe, "Live", copy.live); |
---|
947 | | - link2masterCB = AddCheckBox(oe, "Supp", copy.link2master); |
---|
948 | | - hideCB = AddCheckBox(oe, "Hide", copy.hide); |
---|
| 932 | + setupPanel = new cGridBag().setVertical(false); |
---|
| 933 | + |
---|
| 934 | + liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
| 935 | + liveCB.setToolTipText("Animate object"); |
---|
| 936 | + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 937 | + selectCB.setToolTipText("Make object selectable"); |
---|
949 | 938 | // Return(); |
---|
950 | | - markCB = AddCheckBox(oe, "Mark", copy.marked); |
---|
951 | | - rewindCB = AddCheckBox(oe, "Rew", copy.rewind); |
---|
952 | | - randomCB = AddCheckBox(oe, "Rand", copy.random); |
---|
953 | | - Return(); |
---|
954 | | - resetButton = AddButton(oe, "Reset"); |
---|
955 | | - stepButton = AddButton(oe, "Step"); |
---|
| 939 | + hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 940 | + hideCB.setToolTipText("Hide object"); |
---|
| 941 | + markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
| 942 | + markCB.setToolTipText("Set the animation target transform"); |
---|
| 943 | + |
---|
| 944 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 945 | + |
---|
| 946 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
| 947 | + rewindCB.setToolTipText("Rewind animation"); |
---|
| 948 | + |
---|
| 949 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 950 | + randomCB.setToolTipText("Rewind or Go back and forth randomly"); |
---|
| 951 | + |
---|
| 952 | + if (Globals.ADVANCED) |
---|
| 953 | + { |
---|
| 954 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
| 955 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 956 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
| 957 | + speedupCB.setToolTipText("Option motion capture"); |
---|
| 958 | + } |
---|
| 959 | + |
---|
| 960 | + oe.ctrlPanel.add(setupPanel); |
---|
| 961 | + oe.ctrlPanel.Return(); |
---|
| 962 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 963 | + oe.ctrlPanel.Return(); |
---|
| 964 | + |
---|
| 965 | + commandsPanel = new cGridBag().setVertical(false); |
---|
| 966 | + |
---|
| 967 | + resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 968 | + resetButton.setToolTipText("Jump to frame zero"); |
---|
| 969 | + stepButton = AddButton(commandsPanel, "Step"); |
---|
| 970 | + stepButton.setToolTipText("Step one frame"); |
---|
956 | 971 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
957 | 972 | // stepAllButton = AddButton(oe, "Step All"); |
---|
958 | | - speedupCB = AddCheckBox(oe, "Speed", copy.speedup); |
---|
959 | 973 | // Return(); |
---|
960 | | - slowerButton = AddButton(oe, "Slow"); |
---|
961 | | - fasterButton = AddButton(oe, "Fast"); |
---|
962 | | - remarkButton = AddButton(oe, "Rem"); |
---|
| 974 | + slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 975 | + slowerButton.setToolTipText("Decrease animation speed"); |
---|
| 976 | + fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 977 | + fasterButton.setToolTipText("Increase animation speed"); |
---|
| 978 | + remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 979 | + remarkButton.setToolTipText("Set the current transform as the target"); |
---|
963 | 980 | |
---|
964 | | - Return(); |
---|
| 981 | + oe.ctrlPanel.add(commandsPanel); |
---|
| 982 | + oe.ctrlPanel.Return(); |
---|
965 | 983 | |
---|
| 984 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
| 985 | + normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
| 986 | + //Return(); |
---|
| 987 | + |
---|
| 988 | + oe.ctrlPanel.Return(); |
---|
| 989 | + |
---|
966 | 990 | // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2); |
---|
967 | 991 | // ObjEditor.aConstraints.gridx += 1; |
---|
968 | 992 | |
---|
.. | .. |
---|
1056 | 1080 | oe.aConstraints.gridwidth = 1; |
---|
1057 | 1081 | /**/ |
---|
1058 | 1082 | nameField = AddText(oe.ctrlPanel, copy.GetName()); |
---|
1059 | | - Return(); |
---|
| 1083 | + oe.ctrlPanel.Return(); |
---|
1060 | 1084 | |
---|
1061 | 1085 | //ctrlPanel.add(textureButton = new Button("Texture...")); |
---|
1062 | 1086 | //textureButton.setEnabled(false); |
---|
.. | .. |
---|
1158 | 1182 | //JPanel worldPanel = |
---|
1159 | 1183 | // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true); |
---|
1160 | 1184 | //worldPanel.setName("World"); |
---|
1161 | | - /*JPanel*/ cameraPanel = |
---|
1162 | | - new JPanel(new BorderLayout()); |
---|
1163 | | - cameraPanel.add(cameraView); |
---|
| 1185 | + centralPanel = new cGridBag(); |
---|
| 1186 | + centralPanel.preferredWidth = 20; |
---|
| 1187 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1188 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1164 | 1189 | |
---|
| 1190 | + cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
| 1191 | + cameraPanel.setContinuousLayout(true); |
---|
| 1192 | + cameraPanel.setOneTouchExpandable(true); |
---|
| 1193 | +// cameraPanel.setDividerLocation(0.9); |
---|
| 1194 | +// cameraPanel.setDividerSize(9); |
---|
| 1195 | + cameraPanel.setResizeWeight(1.0); |
---|
| 1196 | + |
---|
| 1197 | + centralPanel.add(cameraView); |
---|
| 1198 | + //frame.setJMenuBar(timelineMenubar); |
---|
| 1199 | + //centralPanel.add(timelinePanel); |
---|
| 1200 | + |
---|
1165 | 1201 | //topView.camera = ; |
---|
1166 | 1202 | //frontView.camera = new Camera(2); |
---|
1167 | 1203 | //sideView.camera = new Camera(3); |
---|
.. | .. |
---|
1177 | 1213 | //frontView.object = copy; |
---|
1178 | 1214 | //sideView.object = copy; |
---|
1179 | 1215 | |
---|
1180 | | - XYZPanel = new JPanel(); |
---|
1181 | | - XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); |
---|
| 1216 | + XYZPanel = new cGridBag().setVertical(true); |
---|
| 1217 | + //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); |
---|
1182 | 1218 | |
---|
1183 | | - XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1184 | | - XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1185 | | - XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1219 | + XYZPanel.preferredWidth = 5; |
---|
| 1220 | + XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
| 1221 | + XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
| 1222 | + XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
1186 | 1223 | |
---|
1187 | 1224 | /* |
---|
1188 | 1225 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1191 | 1228 | gridPanel.add(cameraView); |
---|
1192 | 1229 | gridPanel.add(XYZPanel); |
---|
1193 | 1230 | */ |
---|
1194 | | - gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout()); |
---|
| 1231 | + gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout()); |
---|
1195 | 1232 | gridPanel.setContinuousLayout(true); |
---|
1196 | 1233 | gridPanel.setOneTouchExpandable(true); |
---|
1197 | 1234 | gridPanel.setDividerLocation(1.0); |
---|
.. | .. |
---|
1220 | 1257 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1221 | 1258 | //tmp.setName("Edit"); |
---|
1222 | 1259 | objectPanel.add(materialPanel); |
---|
1223 | | - JPanel north = new JPanel(new BorderLayout()); |
---|
1224 | | - north.setName("Edit"); |
---|
1225 | | - north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1226 | | - objectPanel.add(north); |
---|
| 1260 | +// JPanel north = new JPanel(new BorderLayout()); |
---|
| 1261 | +// north.setName("Edit"); |
---|
| 1262 | +// north.add(ctrlPanel, BorderLayout.NORTH); |
---|
| 1263 | +// objectPanel.add(north); |
---|
| 1264 | + objectPanel.add(ctrlPanel); |
---|
1227 | 1265 | objectPanel.add(infoPanel); |
---|
1228 | 1266 | |
---|
1229 | 1267 | /* |
---|
.. | .. |
---|
1244 | 1282 | scrollpane.setWheelScrollingEnabled(true); |
---|
1245 | 1283 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1246 | 1284 | |
---|
1247 | | - /*JTabbedPane*/ jtp = new JTabbedPane(); |
---|
1248 | | - jtp.add(scrollpane); |
---|
| 1285 | + /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
| 1286 | + scenePanel.preferredWidth = 6; |
---|
| 1287 | + |
---|
| 1288 | + JTabbedPane tabbedPane = new JTabbedPane(); |
---|
| 1289 | + tabbedPane.add(scrollpane); |
---|
1249 | 1290 | |
---|
1250 | | - jtp.add(FSPane = new cFileSystemPane(this)); |
---|
| 1291 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1251 | 1292 | |
---|
1252 | | - optionsPanel = new JPanel(new GridBagLayout()); |
---|
| 1293 | + optionsPanel = new cGridBag().setVertical(true); |
---|
1253 | 1294 | |
---|
1254 | 1295 | optionsPanel.setName("Options"); |
---|
1255 | | - jtp.add(optionsPanel); |
---|
1256 | | - |
---|
| 1296 | + |
---|
| 1297 | + AddOptions(optionsPanel); //, aConstraints); |
---|
| 1298 | + |
---|
| 1299 | + tabbedPane.add(optionsPanel); |
---|
| 1300 | + |
---|
| 1301 | + scenePanel.add(tabbedPane); |
---|
1257 | 1302 | |
---|
1258 | 1303 | /* |
---|
1259 | 1304 | cTree jTree = new cTree(null); |
---|
.. | .. |
---|
1275 | 1320 | jtp.add(tree); |
---|
1276 | 1321 | */ |
---|
1277 | 1322 | |
---|
1278 | | - bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel); |
---|
| 1323 | + bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel); |
---|
1279 | 1324 | bigPanel.setContinuousLayout(true); |
---|
1280 | 1325 | bigPanel.setOneTouchExpandable(true); |
---|
1281 | 1326 | bigPanel.setDividerLocation(0.8); |
---|
.. | .. |
---|
1287 | 1332 | //bigPanel.setSize(new Dimension(10,10)); |
---|
1288 | 1333 | //bigPanel.add(ctrlPanel); |
---|
1289 | 1334 | //bigPanel.add(gridPanel); |
---|
| 1335 | + /** |
---|
1290 | 1336 | bigThree = new JPanel(); |
---|
1291 | 1337 | //big.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
1292 | 1338 | bigThree.setLayout(new GridBagLayout()); //1,3,5,5)); |
---|
.. | .. |
---|
1297 | 1343 | aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
1298 | 1344 | aWindowConstraints.weightx = 0; |
---|
1299 | 1345 | aWindowConstraints.weighty = 1; |
---|
1300 | | - bigThree.add(jtp, aWindowConstraints); |
---|
| 1346 | + bigThree.add(scenePanel, aWindowConstraints); |
---|
1301 | 1347 | aWindowConstraints.weightx = 1; |
---|
1302 | 1348 | aWindowConstraints.gridwidth = 3; |
---|
1303 | 1349 | // aConstraints.gridheight = 3; |
---|
1304 | 1350 | aWindowConstraints.gridx = 1; |
---|
1305 | 1351 | aWindowConstraints.fill = GridBagConstraints.BOTH; |
---|
1306 | | - bigThree.add(cameraPanel, aWindowConstraints); |
---|
| 1352 | + bigThree.add(centralPanel, aWindowConstraints); |
---|
1307 | 1353 | aWindowConstraints.weightx = 0; |
---|
1308 | 1354 | aWindowConstraints.gridx = 4; |
---|
1309 | 1355 | aWindowConstraints.gridwidth = 1; |
---|
1310 | 1356 | // aConstraints.gridheight = 3; |
---|
1311 | 1357 | aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
1312 | 1358 | bigThree.add(XYZPanel, aWindowConstraints); |
---|
| 1359 | + /**/ |
---|
1313 | 1360 | |
---|
| 1361 | + bigThree = new cGridBag(); |
---|
| 1362 | + bigThree.addComponent(scenePanel); |
---|
| 1363 | + bigThree.addComponent(centralPanel); |
---|
| 1364 | + bigThree.addComponent(XYZPanel); |
---|
| 1365 | + |
---|
1314 | 1366 | // // SIDE EFFECT!!! |
---|
1315 | 1367 | // aConstraints.gridx = 0; |
---|
1316 | 1368 | // aConstraints.gridy = 0; |
---|
.. | .. |
---|
1331 | 1383 | //worldPane.add(bigPanel); |
---|
1332 | 1384 | //worldPane.add(worldPanel); |
---|
1333 | 1385 | /**/ |
---|
1334 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 1386 | + //frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 1387 | + frame.add(/*"Center",*/framePanel); |
---|
1335 | 1388 | //frame.getContentPane().add(/*"Center",*/ worldPane); |
---|
1336 | 1389 | |
---|
1337 | 1390 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1338 | 1391 | |
---|
1339 | | - frame.setSize(1024, 768); |
---|
1340 | | - frame.show(); |
---|
| 1392 | + frame.setSize(1280, 860); |
---|
| 1393 | + frame.setVisible(true); |
---|
1341 | 1394 | |
---|
1342 | 1395 | gridPanel.setDividerLocation(1.0); |
---|
1343 | 1396 | |
---|
.. | .. |
---|
1352 | 1405 | }); |
---|
1353 | 1406 | } |
---|
1354 | 1407 | |
---|
| 1408 | + void AddOptions(cGridBag panel) //, GridBagConstraints constraints) |
---|
| 1409 | + { |
---|
| 1410 | + } |
---|
| 1411 | + |
---|
1355 | 1412 | JTree GetTree() |
---|
1356 | 1413 | { |
---|
1357 | 1414 | return objEditor.jTree; |
---|
.. | .. |
---|
1363 | 1420 | ctrlPanel.removeAll(); |
---|
1364 | 1421 | } |
---|
1365 | 1422 | |
---|
1366 | | - void SetupMaterial(JPanel ctrlPanel) |
---|
| 1423 | + void SetupMaterial(cGridBag panel) |
---|
1367 | 1424 | { |
---|
1368 | | - aConstraints.weighty = 0; |
---|
1369 | | - //aConstraints.weightx = 1; |
---|
1370 | | - /* |
---|
| 1425 | + /* |
---|
1371 | 1426 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1372 | 1427 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1373 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1374 | | - aConstraints.gridx += 1; |
---|
1375 | 1428 | */ |
---|
1376 | 1429 | |
---|
1377 | | - aConstraints.gridwidth = 1; |
---|
1378 | | - ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints); |
---|
1379 | | - aConstraints.gridx += 1; |
---|
1380 | | - aConstraints.weighty = 0; |
---|
1381 | | - aConstraints.gridwidth = 1; |
---|
| 1430 | + cGridBag editBar = new cGridBag().setVertical(false); |
---|
| 1431 | + |
---|
| 1432 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1433 | + createMaterialButton.setToolTipText("Create material"); |
---|
1382 | 1434 | |
---|
1383 | 1435 | /* |
---|
1384 | 1436 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1385 | | - aConstraints.gridx += 1; |
---|
1386 | | - aConstraints.weighty = 0; |
---|
1387 | | - aConstraints.gridwidth = 1; |
---|
1388 | 1437 | */ |
---|
1389 | 1438 | |
---|
1390 | | - ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints); |
---|
1391 | | - aConstraints.gridx += 1; |
---|
| 1439 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1440 | + clearMaterialButton.setToolTipText("Clear material"); |
---|
| 1441 | + |
---|
| 1442 | + if (Globals.ADVANCED) |
---|
| 1443 | + { |
---|
| 1444 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 1445 | + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
| 1446 | + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 1447 | + } |
---|
1392 | 1448 | |
---|
1393 | | - ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints); |
---|
1394 | | - |
---|
1395 | | - aConstraints.gridx += 1; |
---|
1396 | | - |
---|
1397 | | - ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints); |
---|
1398 | | - |
---|
1399 | | - aConstraints.gridx += 1; |
---|
1400 | | - |
---|
1401 | | - ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints); |
---|
1402 | | - |
---|
1403 | | - aConstraints.gridx = 0; |
---|
1404 | | - aConstraints.gridy += 1; |
---|
1405 | | - aConstraints.weighty = 0; |
---|
1406 | | - aConstraints.gridwidth = 1; |
---|
| 1449 | + editBar.preferredHeight = 15; |
---|
| 1450 | + |
---|
| 1451 | + panel.add(editBar); |
---|
| 1452 | + |
---|
1407 | 1453 | /**/ |
---|
1408 | 1454 | //aConstraints.weighty = 0; |
---|
1409 | 1455 | ////aConstraints.weightx = 1; |
---|
1410 | 1456 | //aConstraints.weighty = 1; |
---|
1411 | 1457 | aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; |
---|
1412 | 1458 | //aConstraints.gridx += 1; |
---|
1413 | | - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); |
---|
1414 | | - aConstraints.weighty = 0; |
---|
1415 | | - aConstraints.gridx = 0; |
---|
1416 | | - aConstraints.gridy += 1; |
---|
1417 | | - aConstraints.gridwidth = 1; |
---|
| 1459 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1418 | 1460 | |
---|
1419 | | - ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints); |
---|
1420 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1421 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1422 | | - aConstraints.gridx += 1; |
---|
1423 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1424 | | - //aConstraints.weightx = 0; |
---|
1425 | | - ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints); |
---|
1426 | | - aConstraints.gridx = 0; |
---|
1427 | | - aConstraints.gridy += 1; |
---|
1428 | | - aConstraints.gridwidth = 1; |
---|
| 1461 | + cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 1462 | + |
---|
| 1463 | + cGridBag color = new cGridBag(); |
---|
| 1464 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 1465 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1466 | + color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1467 | + //colorField.preferredWidth = 200; |
---|
| 1468 | + colorSection.add(color); |
---|
1429 | 1469 | |
---|
1430 | | - ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints); |
---|
1431 | | - modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1432 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1433 | | - aConstraints.gridx += 1; |
---|
1434 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1435 | | - ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints); |
---|
1436 | | - aConstraints.gridx = 0; |
---|
1437 | | - aConstraints.gridy += 1; |
---|
1438 | | - aConstraints.gridwidth = 1; |
---|
| 1470 | + cGridBag modulation = new cGridBag(); |
---|
| 1471 | + modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
| 1472 | + modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1473 | + modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1474 | + colorSection.add(modulation); |
---|
1439 | 1475 | |
---|
1440 | | - ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints); |
---|
1441 | | - textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1442 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1443 | | - aConstraints.gridx += 1; |
---|
1444 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1445 | | - ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints); |
---|
1446 | | - aConstraints.gridx = 0; |
---|
1447 | | - aConstraints.gridy += 1; |
---|
1448 | | - aConstraints.gridwidth = 1; |
---|
| 1476 | + cGridBag texture = new cGridBag(); |
---|
| 1477 | + texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
| 1478 | + textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1479 | + texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1480 | + colorSection.add(texture); |
---|
1449 | 1481 | |
---|
1450 | | - ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints); |
---|
1451 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1452 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1453 | | - aConstraints.gridx += 1; |
---|
1454 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1455 | | - ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints); |
---|
1456 | | - aConstraints.gridx = 0; |
---|
1457 | | - aConstraints.gridy += 1; |
---|
1458 | | - aConstraints.gridwidth = 1; |
---|
| 1482 | + cGridBag anisoU = new cGridBag(); |
---|
| 1483 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 1484 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1485 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1486 | + colorSection.add(anisoU); |
---|
1459 | 1487 | |
---|
1460 | | - ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints); |
---|
1461 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1462 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1463 | | - aConstraints.gridx += 1; |
---|
1464 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1465 | | - ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints); |
---|
1466 | | - aConstraints.gridx = 0; |
---|
1467 | | - aConstraints.gridy += 1; |
---|
1468 | | - aConstraints.gridwidth = 1; |
---|
| 1488 | + cGridBag anisoV = new cGridBag(); |
---|
| 1489 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 1490 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1491 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1492 | + colorSection.add(anisoV); |
---|
1469 | 1493 | |
---|
1470 | | - ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints); |
---|
1471 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1472 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1473 | | - aConstraints.gridx += 1; |
---|
1474 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1475 | | - ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1476 | | - aConstraints.gridx = 0; |
---|
1477 | | - aConstraints.gridy += 1; |
---|
1478 | | - aConstraints.gridwidth = 1; |
---|
| 1494 | + cGridBag shadowbias = new cGridBag(); |
---|
| 1495 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 1496 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1497 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1498 | + colorSection.add(shadowbias); |
---|
1479 | 1499 | |
---|
1480 | | - //aConstraints.weighty = 1; |
---|
1481 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; |
---|
1482 | | - //aConstraints.gridx += 1; |
---|
1483 | | - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); |
---|
1484 | | - aConstraints.weighty = 0; |
---|
1485 | | - aConstraints.gridx = 0; |
---|
1486 | | - aConstraints.gridy += 1; |
---|
1487 | | - aConstraints.gridwidth = 1; |
---|
| 1500 | + panel.add(new JSeparator()); |
---|
| 1501 | + |
---|
| 1502 | + panel.add(colorSection); |
---|
| 1503 | + |
---|
| 1504 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
| 1505 | + |
---|
| 1506 | + cGridBag diffuseSection = new cGridBag().setVertical(true); |
---|
| 1507 | + |
---|
| 1508 | + cGridBag diffuse = new cGridBag(); |
---|
| 1509 | + diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints); |
---|
| 1510 | + diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1511 | + diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1512 | + diffuseSection.add(diffuse); |
---|
1488 | 1513 | |
---|
1489 | | - ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints); |
---|
1490 | | - diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1491 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1492 | | - aConstraints.gridx += 1; |
---|
1493 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1494 | | - ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1495 | | - aConstraints.gridx = 0; |
---|
1496 | | - aConstraints.gridy += 1; |
---|
1497 | | - aConstraints.gridwidth = 1; |
---|
| 1514 | + cGridBag diffuseness = new cGridBag(); |
---|
| 1515 | + diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints); |
---|
| 1516 | + diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1517 | + diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1518 | + diffuseSection.add(diffuseness); |
---|
1498 | 1519 | |
---|
1499 | | - ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints); |
---|
1500 | | - diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1501 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1502 | | - aConstraints.gridx += 1; |
---|
1503 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1504 | | - ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1505 | | - aConstraints.gridx = 0; |
---|
1506 | | - aConstraints.gridy += 1; |
---|
1507 | | - aConstraints.gridwidth = 1; |
---|
| 1520 | + cGridBag selfshadow = new cGridBag(); |
---|
| 1521 | + selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints); |
---|
| 1522 | + selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1523 | + selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1524 | + diffuseSection.add(selfshadow); |
---|
1508 | 1525 | |
---|
1509 | | - ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints); |
---|
1510 | | - selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1511 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1512 | | - aConstraints.gridx += 1; |
---|
1513 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1514 | | - ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1515 | | - aConstraints.gridx = 0; |
---|
1516 | | - aConstraints.gridy += 1; |
---|
1517 | | - aConstraints.gridwidth = 1; |
---|
| 1526 | + cGridBag sheen = new cGridBag(); |
---|
| 1527 | + sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints); |
---|
| 1528 | + sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1529 | + sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1530 | + diffuseSection.add(sheen); |
---|
1518 | 1531 | |
---|
1519 | | - ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints); |
---|
1520 | | - sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1521 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1522 | | - aConstraints.gridx += 1; |
---|
1523 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1524 | | - ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1525 | | - aConstraints.gridx = 0; |
---|
1526 | | - aConstraints.gridy += 1; |
---|
1527 | | - aConstraints.gridwidth = 1; |
---|
| 1532 | + cGridBag subsurface = new cGridBag(); |
---|
| 1533 | + subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints); |
---|
| 1534 | + subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1535 | + subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1536 | + diffuseSection.add(subsurface); |
---|
1528 | 1537 | |
---|
1529 | | - ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints); |
---|
1530 | | - subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1531 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1532 | | - aConstraints.gridx += 1; |
---|
1533 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1534 | | - ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints); |
---|
1535 | | - aConstraints.gridx = 0; |
---|
1536 | | - aConstraints.gridy += 1; |
---|
1537 | | - aConstraints.gridwidth = 1; |
---|
| 1538 | + cGridBag shadow = new cGridBag(); |
---|
| 1539 | + shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints); |
---|
| 1540 | + shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1541 | + shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1542 | + diffuseSection.add(shadow); |
---|
1538 | 1543 | |
---|
1539 | | - ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints); |
---|
1540 | | - shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1541 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1542 | | - aConstraints.gridx += 1; |
---|
1543 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1544 | | - ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1545 | | - aConstraints.gridx = 0; |
---|
1546 | | - aConstraints.gridy += 1; |
---|
1547 | | - aConstraints.gridwidth = 1; |
---|
| 1544 | + cGridBag fakedepth = new cGridBag(); |
---|
| 1545 | + fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints); |
---|
| 1546 | + fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1547 | + fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1548 | + diffuseSection.add(fakedepth); |
---|
1548 | 1549 | |
---|
1549 | | - ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints); |
---|
1550 | | - fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1551 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1552 | | - aConstraints.gridx += 1; |
---|
1553 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1554 | | - ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1555 | | - aConstraints.gridx = 0; |
---|
1556 | | - aConstraints.gridy += 1; |
---|
1557 | | - aConstraints.gridwidth = 1; |
---|
| 1550 | + panel.add(new JSeparator()); |
---|
| 1551 | + |
---|
| 1552 | + panel.add(diffuseSection); |
---|
| 1553 | + |
---|
| 1554 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
| 1555 | + |
---|
| 1556 | + cGridBag specularSection = new cGridBag().setVertical(true); |
---|
1558 | 1557 | |
---|
1559 | | - //aConstraints.weighty = 1; |
---|
1560 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; |
---|
1561 | | - //aConstraints.gridx += 1; |
---|
1562 | | - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); |
---|
1563 | | - aConstraints.weighty = 0; |
---|
1564 | | - aConstraints.gridx = 0; |
---|
1565 | | - aConstraints.gridy += 1; |
---|
1566 | | - aConstraints.gridwidth = 1; |
---|
| 1558 | + cGridBag specular = new cGridBag(); |
---|
| 1559 | + specular.add(specularLabel = new JLabel("Specular")); // , aConstraints); |
---|
| 1560 | + specularLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1561 | + specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1562 | + specularSection.add(specular); |
---|
1567 | 1563 | |
---|
1568 | | - ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints); |
---|
1569 | | - specularLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1570 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1571 | | - aConstraints.gridx += 1; |
---|
1572 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1573 | | - ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1574 | | - aConstraints.gridx = 0; |
---|
1575 | | - aConstraints.gridy += 1; |
---|
1576 | | - aConstraints.gridwidth = 1; |
---|
| 1564 | + cGridBag lightarea = new cGridBag(); |
---|
| 1565 | + lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints); |
---|
| 1566 | + lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1567 | + lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1568 | + specularSection.add(lightarea); |
---|
1577 | 1569 | |
---|
1578 | | - ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints); |
---|
1579 | | - lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1580 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1581 | | - aConstraints.gridx += 1; |
---|
1582 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1583 | | - ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1584 | | - aConstraints.gridx = 0; |
---|
1585 | | - aConstraints.gridy += 1; |
---|
1586 | | - aConstraints.gridwidth = 1; |
---|
| 1570 | + cGridBag shininess = new cGridBag(); |
---|
| 1571 | + shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints); |
---|
| 1572 | + shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1573 | + shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1574 | + specularSection.add(shininess); |
---|
1587 | 1575 | |
---|
1588 | | - ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints); |
---|
1589 | | - shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1590 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1591 | | - aConstraints.gridx += 1; |
---|
1592 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1593 | | - ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1594 | | - aConstraints.gridx = 0; |
---|
1595 | | - aConstraints.gridy += 1; |
---|
1596 | | - aConstraints.gridwidth = 1; |
---|
| 1576 | + cGridBag metalness = new cGridBag(); |
---|
| 1577 | + metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints); |
---|
| 1578 | + metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1579 | + metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1580 | + specularSection.add(metalness); |
---|
1597 | 1581 | |
---|
1598 | | - ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints); |
---|
1599 | | - metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1600 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1601 | | - aConstraints.gridx += 1; |
---|
1602 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1603 | | - ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints); |
---|
1604 | | - aConstraints.gridx = 0; |
---|
1605 | | - aConstraints.gridy += 1; |
---|
1606 | | - aConstraints.gridwidth = 1; |
---|
| 1582 | + cGridBag velvet = new cGridBag(); |
---|
| 1583 | + velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints); |
---|
| 1584 | + velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1585 | + velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1586 | + specularSection.add(velvet); |
---|
1607 | 1587 | |
---|
1608 | | - ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints); |
---|
1609 | | - velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1610 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1611 | | - aConstraints.gridx += 1; |
---|
1612 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1613 | | - ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1614 | | - aConstraints.gridx = 0; |
---|
1615 | | - aConstraints.gridy += 1; |
---|
1616 | | - aConstraints.gridwidth = 1; |
---|
1617 | | - |
---|
1618 | | - shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1); |
---|
1619 | | - Return(); |
---|
| 1588 | + shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1); |
---|
| 1589 | + //Return(); |
---|
1620 | 1590 | // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints); |
---|
1621 | 1591 | // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1622 | 1592 | // aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
.. | .. |
---|
1627 | 1597 | // aConstraints.gridy += 1; |
---|
1628 | 1598 | // aConstraints.gridwidth = 1; |
---|
1629 | 1599 | |
---|
1630 | | - //aConstraints.weighty = 1; |
---|
1631 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; |
---|
1632 | | - //aConstraints.gridx += 1; |
---|
1633 | | - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); |
---|
1634 | | - aConstraints.weighty = 0; |
---|
1635 | | - aConstraints.gridx = 0; |
---|
1636 | | - aConstraints.gridy += 1; |
---|
1637 | | - aConstraints.gridwidth = 1; |
---|
1638 | 1600 | |
---|
1639 | | - ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints); |
---|
1640 | | - cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1641 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1642 | | - aConstraints.gridx += 1; |
---|
1643 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1644 | | - ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1645 | | - aConstraints.gridx = 0; |
---|
1646 | | - aConstraints.gridy += 1; |
---|
1647 | | - aConstraints.gridwidth = 1; |
---|
| 1601 | + panel.add(new JSeparator()); |
---|
| 1602 | + |
---|
| 1603 | + panel.add(specularSection); |
---|
| 1604 | + |
---|
| 1605 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
| 1606 | + |
---|
| 1607 | + cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1648 | 1608 | |
---|
1649 | | - ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints); |
---|
1650 | | - ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1651 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1652 | | - aConstraints.gridx += 1; |
---|
1653 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1654 | | - ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1655 | | - aConstraints.gridx = 0; |
---|
1656 | | - aConstraints.gridy += 1; |
---|
1657 | | - aConstraints.gridwidth = 1; |
---|
| 1609 | + cGridBag camera = new cGridBag(); |
---|
| 1610 | + camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
| 1611 | + cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1612 | + camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1613 | + globalSection.add(camera); |
---|
1658 | 1614 | |
---|
1659 | | - ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints); |
---|
1660 | | - backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1661 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1662 | | - aConstraints.gridx += 1; |
---|
1663 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1664 | | - ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1665 | | - aConstraints.gridx = 0; |
---|
1666 | | - aConstraints.gridy += 1; |
---|
1667 | | - aConstraints.gridwidth = 1; |
---|
| 1615 | + cGridBag ambient = new cGridBag(); |
---|
| 1616 | + ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
| 1617 | + ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1618 | + ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1619 | + globalSection.add(ambient); |
---|
1668 | 1620 | |
---|
1669 | | - ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints); |
---|
1670 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1671 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1672 | | - aConstraints.gridx += 1; |
---|
1673 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1674 | | - ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints); |
---|
1675 | | - aConstraints.gridx = 0; |
---|
1676 | | - aConstraints.gridy += 1; |
---|
1677 | | - aConstraints.gridwidth = 1; |
---|
1678 | | - aConstraints.weighty = 0; |
---|
| 1621 | + cGridBag backlit = new cGridBag(); |
---|
| 1622 | + backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
| 1623 | + backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1624 | + backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1625 | + globalSection.add(backlit); |
---|
1679 | 1626 | |
---|
1680 | | - ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints); |
---|
1681 | | - bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1682 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1683 | | - aConstraints.gridx += 1; |
---|
1684 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1685 | | - ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints); |
---|
1686 | | - aConstraints.gridx = 0; |
---|
1687 | | - aConstraints.gridy += 1; |
---|
1688 | | - aConstraints.gridwidth = 1; |
---|
| 1627 | + cGridBag opacity = new cGridBag(); |
---|
| 1628 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 1629 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1630 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1631 | + globalSection.add(opacity); |
---|
1689 | 1632 | |
---|
1690 | | - ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints); |
---|
1691 | | - noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1692 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1693 | | - aConstraints.gridx += 1; |
---|
1694 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1695 | | - ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints); |
---|
1696 | | - aConstraints.gridx = 0; |
---|
1697 | | - aConstraints.gridy += 1; |
---|
1698 | | - aConstraints.gridwidth = 1; |
---|
| 1633 | + panel.add(new JSeparator()); |
---|
| 1634 | + |
---|
| 1635 | + panel.add(globalSection); |
---|
| 1636 | + |
---|
| 1637 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
| 1638 | + |
---|
| 1639 | + cGridBag textureSection = new cGridBag().setVertical(true); |
---|
1699 | 1640 | |
---|
1700 | | - ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints); |
---|
1701 | | - powerLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1702 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1703 | | - aConstraints.gridx += 1; |
---|
1704 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1705 | | - ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints); |
---|
1706 | | - aConstraints.gridx = 0; |
---|
1707 | | - aConstraints.gridy += 1; |
---|
1708 | | - aConstraints.gridwidth = 1; |
---|
| 1641 | + cGridBag bump = new cGridBag(); |
---|
| 1642 | + bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints); |
---|
| 1643 | + bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1644 | + bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints); |
---|
| 1645 | + textureSection.add(bump); |
---|
1709 | 1646 | |
---|
1710 | | - ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints); |
---|
1711 | | - borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1712 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1713 | | - aConstraints.gridx += 1; |
---|
1714 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1715 | | - ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints); |
---|
1716 | | - aConstraints.gridx = 0; |
---|
1717 | | - aConstraints.gridy += 1; |
---|
1718 | | - aConstraints.gridwidth = 1; |
---|
| 1647 | + cGridBag noise = new cGridBag(); |
---|
| 1648 | + noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints); |
---|
| 1649 | + noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1650 | + noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints); |
---|
| 1651 | + textureSection.add(noise); |
---|
1719 | 1652 | |
---|
1720 | | - ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints); |
---|
1721 | | - fogLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1722 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1723 | | - aConstraints.gridx += 1; |
---|
1724 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1725 | | - ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints); |
---|
1726 | | - aConstraints.gridx = 0; |
---|
1727 | | - aConstraints.gridy += 1; |
---|
1728 | | - aConstraints.gridwidth = 1; |
---|
| 1653 | + cGridBag power = new cGridBag(); |
---|
| 1654 | + power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints); |
---|
| 1655 | + powerLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1656 | + power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints); |
---|
| 1657 | + textureSection.add(power); |
---|
1729 | 1658 | |
---|
1730 | | - ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints); |
---|
1731 | | - opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1732 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1733 | | - aConstraints.gridx += 1; |
---|
1734 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1735 | | - ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints); |
---|
1736 | | - aConstraints.gridx = 0; |
---|
1737 | | - aConstraints.gridy += 1; |
---|
1738 | | - aConstraints.gridwidth = 1; |
---|
| 1659 | + cGridBag borderfade = new cGridBag(); |
---|
| 1660 | + borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints); |
---|
| 1661 | + borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1662 | + borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints); |
---|
| 1663 | + textureSection.add(borderfade); |
---|
1739 | 1664 | |
---|
1740 | | - //aConstraints.weighty = 1; |
---|
1741 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; |
---|
1742 | | - //aConstraints.gridx += 1; |
---|
1743 | | - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); |
---|
1744 | | - aConstraints.weighty = 0; |
---|
| 1665 | + cGridBag fog = new cGridBag(); |
---|
| 1666 | + fog.add(fogLabel = new JLabel("Punch")); // , aConstraints); |
---|
| 1667 | + fogLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1668 | + fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints); |
---|
| 1669 | + textureSection.add(fog); |
---|
1745 | 1670 | |
---|
1746 | | - aConstraints.gridx = 0; |
---|
1747 | | - aConstraints.gridy = 0; |
---|
1748 | | - aConstraints.gridwidth = 1; |
---|
| 1671 | + cGridBag opacityPower = new cGridBag(); |
---|
| 1672 | + opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints); |
---|
| 1673 | + opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1674 | + opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
| 1675 | + textureSection.add(opacityPower); |
---|
| 1676 | + |
---|
| 1677 | + panel.add(new JSeparator()); |
---|
| 1678 | + |
---|
| 1679 | + panel.add(textureSection); |
---|
| 1680 | + |
---|
| 1681 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1749 | 1682 | |
---|
1750 | 1683 | SetMaterial(copy); // .GetMaterial()); |
---|
1751 | 1684 | |
---|
1752 | | - colorField.addChangeListener(this); |
---|
1753 | | - modulationField.addChangeListener(this); |
---|
| 1685 | + //colorField.addChangeListener(this); |
---|
| 1686 | +// modulationField.addChangeListener(this); |
---|
1754 | 1687 | metalnessField.addChangeListener(this); |
---|
1755 | 1688 | diffuseField.addChangeListener(this); |
---|
1756 | 1689 | specularField.addChangeListener(this); |
---|
.. | .. |
---|
1780 | 1713 | opacityPowerField.addChangeListener(this); |
---|
1781 | 1714 | /**/ |
---|
1782 | 1715 | |
---|
1783 | | - resetSlidersButton.addActionListener(this); |
---|
1784 | 1716 | clearMaterialButton.addActionListener(this); |
---|
1785 | 1717 | createMaterialButton.addActionListener(this); |
---|
1786 | | - |
---|
1787 | | - propagateToggle.addItemListener(this); |
---|
1788 | | - multiplyToggle.addItemListener(this); |
---|
| 1718 | + |
---|
| 1719 | + if (Globals.ADVANCED) |
---|
| 1720 | + { |
---|
| 1721 | + resetSlidersButton.addActionListener(this); |
---|
| 1722 | + propagateToggle.addItemListener(this); |
---|
| 1723 | + multiplyToggle.addItemListener(this); |
---|
| 1724 | + } |
---|
1789 | 1725 | } |
---|
1790 | 1726 | |
---|
1791 | 1727 | void DropFile(java.io.File[] files, boolean textures) |
---|
.. | .. |
---|
1956 | 1892 | |
---|
1957 | 1893 | //? flashIt = false; |
---|
1958 | 1894 | CameraPane pane = (CameraPane) cameraView; |
---|
1959 | | - pane.clickStart(location.x, location.y, 0); |
---|
| 1895 | + pane.clickStart(location.x, location.y, 0, 0); |
---|
1960 | 1896 | pane.clickEnd(location.x, location.y, 0, true); |
---|
1961 | 1897 | |
---|
1962 | 1898 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
2005 | 1941 | e2.printStackTrace(); |
---|
2006 | 1942 | } |
---|
2007 | 1943 | } |
---|
| 1944 | + |
---|
2008 | 1945 | LoadJMEThread loadThread; |
---|
2009 | 1946 | |
---|
2010 | 1947 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
2062 | 1999 | //LoadFile0(filename, converter); |
---|
2063 | 2000 | } |
---|
2064 | 2001 | } |
---|
| 2002 | + |
---|
2065 | 2003 | LoadOBJThread loadObjThread; |
---|
2066 | 2004 | |
---|
2067 | 2005 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2140 | 2078 | |
---|
2141 | 2079 | void LoadObjFile(String fullname) |
---|
2142 | 2080 | { |
---|
2143 | | - /* |
---|
| 2081 | + System.out.println("Loading " + fullname); |
---|
| 2082 | + /**/ |
---|
2144 | 2083 | //lastFilename = fullname; |
---|
2145 | 2084 | if(loadObjThread == null) |
---|
2146 | 2085 | { |
---|
2147 | | - loadObjThread = new LoadOBJThread(); |
---|
2148 | | - loadObjThread.start(); |
---|
| 2086 | + loadObjThread = new LoadOBJThread(); |
---|
| 2087 | + loadObjThread.start(); |
---|
2149 | 2088 | } |
---|
2150 | 2089 | |
---|
2151 | 2090 | loadObjThread.add(fullname); |
---|
2152 | | - */ |
---|
| 2091 | + /**/ |
---|
2153 | 2092 | |
---|
2154 | | - System.out.println("Loading " + fullname); |
---|
2155 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2093 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2156 | 2094 | } |
---|
2157 | 2095 | |
---|
2158 | 2096 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2413 | 2351 | |
---|
2414 | 2352 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2415 | 2353 | { |
---|
2416 | | - if (GrafreeD.standAlone) |
---|
| 2354 | + if (Grafreed.standAlone) |
---|
2417 | 2355 | { |
---|
2418 | 2356 | /**/ |
---|
2419 | 2357 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2420 | | - browser.show(); |
---|
| 2358 | + browser.setVisible(true); |
---|
2421 | 2359 | String filename = browser.getFile(); |
---|
2422 | 2360 | if (filename != null && filename.length() > 0) |
---|
2423 | 2361 | { |
---|
.. | .. |
---|
2562 | 2500 | } |
---|
2563 | 2501 | if (input == null) |
---|
2564 | 2502 | { |
---|
| 2503 | + new Exception().printStackTrace(); |
---|
2565 | 2504 | System.exit(0); |
---|
2566 | 2505 | } |
---|
2567 | 2506 | |
---|
.. | .. |
---|
2776 | 2715 | return; |
---|
2777 | 2716 | } |
---|
2778 | 2717 | |
---|
2779 | | - multiplyToggle.setSelected(mat.multiply); |
---|
| 2718 | + if (multiplyToggle != null) |
---|
| 2719 | + multiplyToggle.setSelected(mat.multiply); |
---|
2780 | 2720 | |
---|
2781 | 2721 | assert (object.projectedVertices != null); |
---|
2782 | 2722 | |
---|
.. | .. |
---|
2958 | 2898 | // june 2013 copy.HardTouch(); |
---|
2959 | 2899 | cameraView.repaint(); |
---|
2960 | 2900 | return; |
---|
2961 | | - } else if (event.getSource() == toggleFullItem) |
---|
| 2901 | + } else if (event.getSource() == toggleTimelineItem) |
---|
2962 | 2902 | { |
---|
2963 | | - if (CameraPane.FULLSCREEN) |
---|
| 2903 | + timeline ^= true; |
---|
| 2904 | + |
---|
| 2905 | + if (timeline) |
---|
2964 | 2906 | { |
---|
2965 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
2966 | | - framePanel.add(bigThree); |
---|
2967 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
2968 | | - } else |
---|
2969 | | - { |
---|
2970 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
2971 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 2907 | + centralPanel.remove(cameraView); |
---|
| 2908 | + cameraPanel.add(cameraView); |
---|
| 2909 | + centralPanel.add(cameraPanel); |
---|
| 2910 | + frame.setJMenuBar(timelineMenubar); |
---|
| 2911 | + wasFullScreen = CameraPane.FULLSCREEN; |
---|
| 2912 | + if (!CameraPane.FULLSCREEN) |
---|
| 2913 | + ToggleFullScreen(); |
---|
| 2914 | + toggleFullScreenItem.setEnabled(false); |
---|
2972 | 2915 | } |
---|
| 2916 | + else |
---|
| 2917 | + { |
---|
| 2918 | + centralPanel.remove(cameraPanel); |
---|
| 2919 | + centralPanel.add(cameraView); |
---|
| 2920 | + frame.setJMenuBar(null); |
---|
| 2921 | + if (!wasFullScreen) |
---|
| 2922 | + ToggleFullScreen(); |
---|
| 2923 | + toggleFullScreenItem.setEnabled(true); |
---|
| 2924 | + } |
---|
| 2925 | + |
---|
2973 | 2926 | frame.validate(); |
---|
2974 | | - cameraView.ToggleFullScreen(); |
---|
| 2927 | + return; |
---|
| 2928 | + } else if (event.getSource() == toggleFullScreenItem) |
---|
| 2929 | + { |
---|
| 2930 | + ToggleFullScreen(); |
---|
| 2931 | + frame.validate(); |
---|
2975 | 2932 | |
---|
2976 | 2933 | return; |
---|
2977 | | - } else if (event.getSource() == toggleRandomItem) |
---|
| 2934 | + } else if (event.getSource() == toggleSwitchItem) |
---|
2978 | 2935 | { |
---|
2979 | | - cameraView.ToggleRandom(); |
---|
| 2936 | + cameraView.ToggleSwitch(); |
---|
2980 | 2937 | cameraView.repaint(); |
---|
2981 | 2938 | return; |
---|
2982 | 2939 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
3005 | 2962 | { |
---|
3006 | 2963 | copy.live ^= true; |
---|
3007 | 2964 | return; |
---|
| 2965 | + } else if (event.getSource() == selectCB) |
---|
| 2966 | + { |
---|
| 2967 | + copy.dontselect ^= true; |
---|
| 2968 | + return; |
---|
3008 | 2969 | } else if (event.getSource() == hideCB) |
---|
3009 | 2970 | { |
---|
3010 | 2971 | copy.hide ^= true; |
---|
.. | .. |
---|
3019 | 2980 | if (event.getSource() == randomCB) |
---|
3020 | 2981 | { |
---|
3021 | 2982 | copy.random ^= true; |
---|
| 2983 | + objEditor.refreshContents(); |
---|
3022 | 2984 | return; |
---|
3023 | 2985 | } |
---|
3024 | 2986 | if (event.getSource() == speedupCB) |
---|
.. | .. |
---|
3042 | 3004 | |
---|
3043 | 3005 | public void actionPerformed(ActionEvent event) |
---|
3044 | 3006 | { |
---|
| 3007 | + Object source = event.getSource(); |
---|
3045 | 3008 | // SCRIPT DIALOG |
---|
3046 | | - if (event.getSource() == okbutton) |
---|
| 3009 | + if (source == okbutton) |
---|
3047 | 3010 | { |
---|
3048 | 3011 | textpanel.setVisible(false); |
---|
3049 | 3012 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3055 | 3018 | textarea = null; |
---|
3056 | 3019 | textpanel = null; |
---|
3057 | 3020 | } |
---|
3058 | | - if (event.getSource() == cancelbutton) |
---|
| 3021 | + if (source == cancelbutton) |
---|
3059 | 3022 | { |
---|
3060 | 3023 | textpanel.setVisible(false); |
---|
3061 | 3024 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3067 | 3030 | //applySelf(); |
---|
3068 | 3031 | //client.refreshEditWindow(); |
---|
3069 | 3032 | //refreshContents(); |
---|
3070 | | - if (event.getSource() == nameField) |
---|
| 3033 | + if (source == nameField) |
---|
3071 | 3034 | { |
---|
3072 | 3035 | //System.out.println("ObjEditor " + event); |
---|
3073 | 3036 | applySelf0(true); |
---|
3074 | 3037 | //parent.applySelf(); |
---|
3075 | 3038 | objEditor.refreshContents(); |
---|
3076 | | - } else if (event.getSource() == resetButton) |
---|
| 3039 | + } else if (source == resetButton) |
---|
3077 | 3040 | { |
---|
3078 | 3041 | CameraPane.fullreset = true; |
---|
3079 | 3042 | copy.Reset(); // ResetMeshes(); |
---|
3080 | 3043 | copy.Touch(); |
---|
3081 | 3044 | objEditor.refreshContents(); |
---|
3082 | | - } else if (event.getSource() == stepItem) |
---|
| 3045 | + } else if (source == stepItem) |
---|
3083 | 3046 | { |
---|
3084 | | - cameraView.ONESTEP = true; |
---|
| 3047 | + //cameraView.ONESTEP = true; |
---|
| 3048 | + Globals.ONESTEP = true; |
---|
3085 | 3049 | cameraView.repaint(); |
---|
3086 | 3050 | return; |
---|
3087 | | - } else if (event.getSource() == stepButton) |
---|
| 3051 | + } else if (source == stepButton) |
---|
3088 | 3052 | { |
---|
3089 | 3053 | copy.Step(); |
---|
3090 | 3054 | copy.Touch(); |
---|
3091 | 3055 | objEditor.refreshContents(); |
---|
3092 | | - } else if (event.getSource() == slowerButton) |
---|
| 3056 | + } else if (source == slowerButton) |
---|
3093 | 3057 | { |
---|
3094 | 3058 | copy.Slower(); |
---|
3095 | 3059 | copy.Touch(); |
---|
3096 | 3060 | objEditor.refreshContents(); |
---|
3097 | | - } else if (event.getSource() == fasterButton) |
---|
| 3061 | + } else if (source == fasterButton) |
---|
3098 | 3062 | { |
---|
3099 | 3063 | copy.Faster(); |
---|
3100 | 3064 | copy.Touch(); |
---|
3101 | 3065 | objEditor.refreshContents(); |
---|
3102 | | - } else if (event.getSource() == remarkButton) |
---|
| 3066 | + } else if (source == remarkButton) |
---|
3103 | 3067 | { |
---|
3104 | 3068 | copy.Remark(); |
---|
3105 | 3069 | copy.Touch(); |
---|
3106 | 3070 | objEditor.refreshContents(); |
---|
3107 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3071 | + } else if (source == stepAllButton) |
---|
3108 | 3072 | { |
---|
3109 | 3073 | copy.StepAll(); |
---|
3110 | 3074 | copy.Touch(); |
---|
3111 | 3075 | objEditor.refreshContents(); |
---|
3112 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3076 | + } else if (source == resetAllButton) |
---|
3113 | 3077 | { |
---|
3114 | 3078 | //CameraPane.fullreset = true; |
---|
3115 | 3079 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3142 | 3106 | // Close(); |
---|
3143 | 3107 | // } |
---|
3144 | 3108 | // else |
---|
3145 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3109 | + if (source == resetSlidersButton) |
---|
3146 | 3110 | { |
---|
3147 | 3111 | ResetSliders(); |
---|
3148 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3112 | + } else if (source == clearMaterialButton) |
---|
3149 | 3113 | { |
---|
3150 | 3114 | ClearMaterial(); |
---|
3151 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3115 | + } else if (source == createMaterialButton) |
---|
3152 | 3116 | { |
---|
3153 | 3117 | CreateMaterial(); |
---|
3154 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3118 | + } else if (source == clearPanelButton) |
---|
3155 | 3119 | { |
---|
3156 | 3120 | copy.ClearUI(); |
---|
3157 | 3121 | refreshContents(true); |
---|
3158 | | - } /* |
---|
3159 | | - } |
---|
3160 | | - |
---|
3161 | | - public boolean action(Event event, Object arg) |
---|
3162 | | - { |
---|
3163 | | - */ else if (event.getSource() == closeItem) |
---|
| 3122 | + } else if (source == importGFDItem) |
---|
| 3123 | + { |
---|
| 3124 | + ImportGFD(); |
---|
| 3125 | + } else |
---|
| 3126 | + if (source == importVRMLX3DItem) |
---|
| 3127 | + { |
---|
| 3128 | + ImportVRMLX3D(); |
---|
| 3129 | + } else |
---|
| 3130 | + if (source == import3DSItem) |
---|
| 3131 | + { |
---|
| 3132 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3133 | + } else |
---|
| 3134 | + if (source == importOBJItem) |
---|
| 3135 | + { |
---|
| 3136 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3137 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3138 | + browser.setVisible(true); |
---|
| 3139 | + String filename = browser.getFile(); |
---|
| 3140 | + if (filename != null && filename.length() > 0) |
---|
| 3141 | + { |
---|
| 3142 | + String fullname = browser.getDirectory() + filename; |
---|
| 3143 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3144 | + } |
---|
| 3145 | + } else |
---|
| 3146 | + if (source == closeItem) |
---|
3164 | 3147 | { |
---|
3165 | 3148 | Close(); |
---|
3166 | 3149 | //return true; |
---|
3167 | | - } else if (event.getSource() == loadItem) |
---|
| 3150 | + } else if (source == loadItem) |
---|
3168 | 3151 | { |
---|
3169 | 3152 | load(); |
---|
3170 | 3153 | //return true; |
---|
3171 | | - } else if (event.getSource() == saveItem) |
---|
| 3154 | + } else if (source == newItem) |
---|
| 3155 | + { |
---|
| 3156 | + New(); |
---|
| 3157 | + } else if (source == saveItem) |
---|
3172 | 3158 | { |
---|
3173 | 3159 | save(); |
---|
3174 | 3160 | //return true; |
---|
3175 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3161 | + } else if (source == saveAsItem) |
---|
3176 | 3162 | { |
---|
3177 | 3163 | saveAs(); |
---|
3178 | 3164 | //return true; |
---|
3179 | | - } else if (event.getSource() == reexportItem) |
---|
| 3165 | + } else if (source == reexportItem) |
---|
3180 | 3166 | { |
---|
3181 | 3167 | reexport(); |
---|
3182 | 3168 | //return true; |
---|
3183 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3169 | + } else if (source == exportAsItem) |
---|
3184 | 3170 | { |
---|
3185 | 3171 | export(); |
---|
3186 | 3172 | //return true; |
---|
3187 | | - } else if (event.getSource() == povItem) |
---|
| 3173 | + } else if (source == povItem) |
---|
3188 | 3174 | { |
---|
3189 | 3175 | generatePOV(); |
---|
3190 | 3176 | //return true; |
---|
3191 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3177 | + } else if (source == zBufferItem) |
---|
3192 | 3178 | { |
---|
3193 | 3179 | try |
---|
3194 | 3180 | { |
---|
.. | .. |
---|
3210 | 3196 | cameraView.repaint(); |
---|
3211 | 3197 | //return true; |
---|
3212 | 3198 | } |
---|
3213 | | - */ else if (event.getSource() == editCameraItem) |
---|
3214 | | - { |
---|
3215 | | - cameraView.ProtectCamera(); |
---|
3216 | | - cameraView.repaint(); |
---|
3217 | | - return; |
---|
3218 | | - } else if (event.getSource() == revertCameraItem) |
---|
3219 | | - { |
---|
3220 | | - cameraView.RevertCamera(); |
---|
3221 | | - cameraView.repaint(); |
---|
3222 | | - return; |
---|
3223 | | - } else if (event.getSource() == textureButton) |
---|
3224 | | - { |
---|
3225 | | - return; // true; |
---|
3226 | | - } else // combos... |
---|
3227 | | - if (event.getSource() == texresMenu) |
---|
| 3199 | + */ else // combos... |
---|
| 3200 | + if (source == texresMenu) |
---|
3228 | 3201 | { |
---|
3229 | 3202 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3230 | 3203 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3236 | 3209 | } |
---|
3237 | 3210 | } |
---|
3238 | 3211 | |
---|
3239 | | - void ToggleAnimation() |
---|
| 3212 | + void New() |
---|
3240 | 3213 | { |
---|
3241 | | - if (!CameraPane.ANIMATION) |
---|
| 3214 | + while (copy.Size() > 1) |
---|
3242 | 3215 | { |
---|
3243 | | - FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); |
---|
| 3216 | + copy.remove(1); |
---|
| 3217 | + } |
---|
| 3218 | + |
---|
| 3219 | + ResetModel(); |
---|
| 3220 | + objEditor.refreshContents(); |
---|
| 3221 | + } |
---|
| 3222 | + |
---|
| 3223 | + static public byte[] Compress(Object3D o) |
---|
| 3224 | + { |
---|
| 3225 | + try |
---|
| 3226 | + { |
---|
| 3227 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3228 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3229 | + ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3230 | + |
---|
| 3231 | + Object3D parent = o.parent; |
---|
| 3232 | + o.parent = null; |
---|
| 3233 | + |
---|
| 3234 | + out.writeObject(o); |
---|
| 3235 | + |
---|
| 3236 | + o.parent = parent; |
---|
| 3237 | + |
---|
| 3238 | + out.flush(); |
---|
| 3239 | + |
---|
| 3240 | + zstream.close(); |
---|
| 3241 | + out.close(); |
---|
| 3242 | + |
---|
| 3243 | + return baos.toByteArray(); |
---|
| 3244 | + } catch (Exception e) |
---|
| 3245 | + { |
---|
| 3246 | + System.err.println(e); |
---|
| 3247 | + return null; |
---|
| 3248 | + } |
---|
| 3249 | + } |
---|
| 3250 | + |
---|
| 3251 | + static public Object Uncompress(byte[] bytes) |
---|
| 3252 | + { |
---|
| 3253 | + System.out.println("#bytes = " + bytes.length); |
---|
| 3254 | + try |
---|
| 3255 | + { |
---|
| 3256 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3257 | + java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3258 | + ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3259 | + Object obj = in.readObject(); |
---|
| 3260 | + in.close(); |
---|
| 3261 | + |
---|
| 3262 | + return obj; |
---|
| 3263 | + } catch (Exception e) |
---|
| 3264 | + { |
---|
| 3265 | + System.err.println(e); |
---|
| 3266 | + return null; |
---|
| 3267 | + } |
---|
| 3268 | + } |
---|
| 3269 | + |
---|
| 3270 | + static public Object clone(Object o) |
---|
| 3271 | + { |
---|
| 3272 | + try |
---|
| 3273 | + { |
---|
| 3274 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3275 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3276 | + |
---|
| 3277 | + out.writeObject(o); |
---|
| 3278 | + |
---|
| 3279 | + out.flush(); |
---|
| 3280 | + out.close(); |
---|
| 3281 | + |
---|
| 3282 | + byte[] bytes = baos.toByteArray(); |
---|
| 3283 | + |
---|
| 3284 | + System.out.println("clone = " + bytes.length); |
---|
| 3285 | + |
---|
| 3286 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3287 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3288 | + Object obj = in.readObject(); |
---|
| 3289 | + in.close(); |
---|
| 3290 | + |
---|
| 3291 | + return obj; |
---|
| 3292 | + } catch (Exception e) |
---|
| 3293 | + { |
---|
| 3294 | + System.err.println(e); |
---|
| 3295 | + return null; |
---|
| 3296 | + } |
---|
| 3297 | + } |
---|
| 3298 | + |
---|
| 3299 | + cRadio GetCurrentTab() |
---|
| 3300 | + { |
---|
| 3301 | + cRadio ab; |
---|
| 3302 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3303 | + { |
---|
| 3304 | + ab = (cRadio)e.nextElement(); |
---|
| 3305 | + if(ab.GetObject() == copy) |
---|
| 3306 | + { |
---|
| 3307 | + return ab; |
---|
| 3308 | + } |
---|
| 3309 | + } |
---|
| 3310 | + |
---|
| 3311 | + return null; |
---|
| 3312 | + } |
---|
| 3313 | + |
---|
| 3314 | + java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3315 | + |
---|
| 3316 | + public void Save() |
---|
| 3317 | + { |
---|
| 3318 | + cRadio tab = GetCurrentTab(); |
---|
| 3319 | + |
---|
| 3320 | + boolean temp = CameraPane.SWITCH; |
---|
| 3321 | + CameraPane.SWITCH = false; |
---|
| 3322 | + |
---|
| 3323 | + copy.ExtractBigData(hashtable); |
---|
| 3324 | + |
---|
| 3325 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3326 | + tab.graphs[tab.undoindex++] = Compress(copy); |
---|
| 3327 | + |
---|
| 3328 | + copy.RestoreBigData(hashtable); |
---|
| 3329 | + |
---|
| 3330 | + CameraPane.SWITCH = temp; |
---|
| 3331 | + |
---|
| 3332 | + //assert(hashtable.isEmpty()); |
---|
| 3333 | + |
---|
| 3334 | + for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3335 | + { |
---|
| 3336 | + tab.graphs[i] = null; |
---|
| 3337 | + } |
---|
| 3338 | + |
---|
| 3339 | + // test save |
---|
| 3340 | + if (false) |
---|
| 3341 | + { |
---|
| 3342 | + try |
---|
| 3343 | + { |
---|
| 3344 | + FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3345 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3346 | + |
---|
| 3347 | + p.writeObject(copy); |
---|
| 3348 | + |
---|
| 3349 | + p.flush(); |
---|
| 3350 | + |
---|
| 3351 | + ostream.close(); |
---|
| 3352 | + } catch (Exception e) |
---|
| 3353 | + { |
---|
| 3354 | + e.printStackTrace(); |
---|
| 3355 | + } |
---|
| 3356 | + } |
---|
| 3357 | + } |
---|
| 3358 | + |
---|
| 3359 | + void CopyChanged(Object3D obj) |
---|
| 3360 | + { |
---|
| 3361 | + boolean temp = CameraPane.SWITCH; |
---|
| 3362 | + CameraPane.SWITCH = false; |
---|
| 3363 | + |
---|
| 3364 | + copy.ExtractBigData(hashtable); |
---|
| 3365 | + |
---|
| 3366 | + copy.clear(); |
---|
| 3367 | + |
---|
| 3368 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3369 | + { |
---|
| 3370 | + copy.add(obj.get(i)); |
---|
| 3371 | + } |
---|
| 3372 | + |
---|
| 3373 | + copy.RestoreBigData(hashtable); |
---|
| 3374 | + |
---|
| 3375 | + CameraPane.SWITCH = temp; |
---|
| 3376 | + |
---|
| 3377 | + //assert(hashtable.isEmpty()); |
---|
| 3378 | + |
---|
| 3379 | + copy.Touch(); |
---|
| 3380 | + |
---|
| 3381 | + ResetModel(); |
---|
| 3382 | + copy.HardTouch(); // recompile? |
---|
| 3383 | + |
---|
| 3384 | + cRadio ab; |
---|
| 3385 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3386 | + { |
---|
| 3387 | + ab = (cRadio)e.nextElement(); |
---|
| 3388 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3389 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3390 | + if (test != null) |
---|
| 3391 | + { |
---|
| 3392 | + test.editWindow = ab.object.editWindow; |
---|
| 3393 | + ab.object = test; |
---|
| 3394 | + } |
---|
| 3395 | + } |
---|
| 3396 | + |
---|
| 3397 | + refreshContents(); |
---|
| 3398 | + } |
---|
| 3399 | + |
---|
| 3400 | + public void Undo() |
---|
| 3401 | + { |
---|
| 3402 | + cRadio tab = GetCurrentTab(); |
---|
| 3403 | + |
---|
| 3404 | + if (tab.undoindex == 0) |
---|
| 3405 | + { |
---|
| 3406 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3407 | + return; |
---|
| 3408 | + } |
---|
| 3409 | + |
---|
| 3410 | + if (tab.graphs[tab.undoindex] == null) |
---|
| 3411 | + { |
---|
| 3412 | + Save(); |
---|
| 3413 | + tab.undoindex -= 1; |
---|
| 3414 | + } |
---|
| 3415 | + |
---|
| 3416 | + tab.undoindex -= 1; |
---|
| 3417 | + |
---|
| 3418 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3419 | + } |
---|
| 3420 | + |
---|
| 3421 | + public void Redo() |
---|
| 3422 | + { |
---|
| 3423 | + cRadio tab = GetCurrentTab(); |
---|
| 3424 | + |
---|
| 3425 | + if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3426 | + { |
---|
| 3427 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3428 | + return; |
---|
| 3429 | + } |
---|
| 3430 | + |
---|
| 3431 | + tab.undoindex += 1; |
---|
| 3432 | + |
---|
| 3433 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3434 | + } |
---|
| 3435 | + |
---|
| 3436 | + void ImportGFD() |
---|
| 3437 | + { |
---|
| 3438 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
3244 | 3439 | browser.show(); |
---|
3245 | 3440 | String filename = browser.getFile(); |
---|
3246 | 3441 | if (filename != null && filename.length() > 0) |
---|
3247 | 3442 | { |
---|
3248 | | - CameraPane.filename = browser.getDirectory() + filename; |
---|
| 3443 | + String fullname = browser.getDirectory() + filename; |
---|
| 3444 | + |
---|
| 3445 | + //Object3D readobj = |
---|
| 3446 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 3447 | + //makeSomething(readobj); |
---|
| 3448 | + } |
---|
| 3449 | + } |
---|
| 3450 | + |
---|
| 3451 | + void ImportVRMLX3D() |
---|
| 3452 | + { |
---|
| 3453 | + if (Grafreed.standAlone) |
---|
| 3454 | + { |
---|
| 3455 | + /**/ |
---|
| 3456 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 3457 | + browser.show(); |
---|
| 3458 | + String filename = browser.getFile(); |
---|
| 3459 | + if (filename != null && filename.length() > 0) |
---|
| 3460 | + { |
---|
| 3461 | + String fullname = browser.getDirectory() + filename; |
---|
| 3462 | + LoadVRMLX3D(fullname); |
---|
| 3463 | + } |
---|
| 3464 | + /**/ |
---|
| 3465 | + } |
---|
| 3466 | + } |
---|
| 3467 | + |
---|
| 3468 | + void ToggleAnimation() |
---|
| 3469 | + { |
---|
| 3470 | + if (!Globals.ANIMATION) |
---|
| 3471 | + { |
---|
| 3472 | + FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); |
---|
| 3473 | + browser.setVisible(true); |
---|
| 3474 | + String filename = browser.getFile(); |
---|
| 3475 | + if (filename != null && filename.length() > 0) |
---|
| 3476 | + { |
---|
| 3477 | + Globals.filename = browser.getDirectory() + filename; |
---|
3249 | 3478 | //CameraPane.framecount = 0; |
---|
3250 | | - CameraPane.imagecount = 0; |
---|
| 3479 | + Globals.imagecount = 0; |
---|
3251 | 3480 | |
---|
3252 | | - CameraPane.ANIMATION ^= true; |
---|
| 3481 | + Globals.ANIMATION ^= true; |
---|
3253 | 3482 | |
---|
3254 | | - GrafreeD.wav.cursor = 0; |
---|
3255 | | - GrafreeD.wav.loop = 0; |
---|
| 3483 | + Grafreed.wav.cursor = 0; |
---|
| 3484 | + Grafreed.wav.loop = 0; |
---|
3256 | 3485 | } |
---|
3257 | 3486 | } else |
---|
3258 | 3487 | { |
---|
3259 | | - CameraPane.ANIMATION ^= true; |
---|
| 3488 | + Globals.ANIMATION ^= true; |
---|
3260 | 3489 | } |
---|
3261 | 3490 | } |
---|
3262 | 3491 | |
---|
.. | .. |
---|
3302 | 3531 | void CreateMaterial() |
---|
3303 | 3532 | { |
---|
3304 | 3533 | //copy.ClearMaterial(); // PATCH |
---|
3305 | | - copy.CreateMaterialS(multiplyToggle.isSelected()); |
---|
| 3534 | + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); |
---|
3306 | 3535 | if (copy.selection.size() > 0) |
---|
3307 | 3536 | //SetMaterial(copy); |
---|
3308 | 3537 | { |
---|
.. | .. |
---|
3361 | 3590 | { |
---|
3362 | 3591 | copy.ResetBlockLoop(); // temporary problem |
---|
3363 | 3592 | |
---|
3364 | | - boolean random = CameraPane.RANDOM; |
---|
3365 | | - CameraPane.RANDOM = false; // parse everything |
---|
| 3593 | + boolean random = CameraPane.SWITCH; |
---|
| 3594 | + CameraPane.SWITCH = false; // parse everything |
---|
3366 | 3595 | copy.ResetDisplayList(); |
---|
3367 | 3596 | copy.HardTouch(); |
---|
3368 | | - CameraPane.RANDOM = random; |
---|
| 3597 | + CameraPane.SWITCH = random; |
---|
3369 | 3598 | } |
---|
3370 | 3599 | |
---|
3371 | 3600 | // public void applySelf() |
---|
.. | .. |
---|
3435 | 3664 | current.fakedepth = (float) fakedepthField.getFloat(); |
---|
3436 | 3665 | current.shadowbias = (float) shadowbiasField.getFloat(); |
---|
3437 | 3666 | |
---|
3438 | | - if (!NumberSlider.frozen) |
---|
| 3667 | + if (!cNumberSlider.frozen) |
---|
3439 | 3668 | { |
---|
3440 | 3669 | //System.out.println("Propagate = " + propagate); |
---|
3441 | 3670 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 3671 | + |
---|
| 3672 | + if (copy.material != null) |
---|
| 3673 | + { |
---|
| 3674 | + cMaterial mat = copy.material; |
---|
| 3675 | + |
---|
| 3676 | + colorField.SetToolTipValue((mat.color)); |
---|
| 3677 | + modulationField.SetToolTipValue((mat.modulation)); |
---|
| 3678 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 3679 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 3680 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 3681 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 3682 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 3683 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 3684 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 3685 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 3686 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 3687 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 3688 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 3689 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 3690 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 3691 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 3692 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 3693 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 3694 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 3695 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 3696 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 3697 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 3698 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 3699 | + } |
---|
| 3700 | + |
---|
3442 | 3701 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3443 | 3702 | { |
---|
3444 | 3703 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3483 | 3742 | || e.getSource() == apertureField |
---|
3484 | 3743 | || e.getSource() == shadowblurField) |
---|
3485 | 3744 | { |
---|
| 3745 | + new Exception().printStackTrace(); |
---|
3486 | 3746 | System.exit(0); |
---|
3487 | 3747 | cameraView.options1[0] = (float) focusField.getFloat() * 10; |
---|
3488 | 3748 | cameraView.options1[1] = (float) apertureField.getFloat() / 1000; |
---|
.. | .. |
---|
3509 | 3769 | //System.out.println("PARENT = " + parent); |
---|
3510 | 3770 | //if (parent != null) |
---|
3511 | 3771 | // parent.applySelf(); |
---|
3512 | | - refreshContents(); |
---|
| 3772 | + if (e.getSource() == normalpushField) |
---|
| 3773 | + { |
---|
| 3774 | + objEditor.refreshContents(); |
---|
| 3775 | + //Refresh(); |
---|
| 3776 | + } |
---|
| 3777 | + else |
---|
| 3778 | + refreshContents(); |
---|
3513 | 3779 | // ??? client.refreshEditWindow(); |
---|
3514 | 3780 | } |
---|
3515 | 3781 | //else |
---|
.. | .. |
---|
3521 | 3787 | //group.name = nameField.getText(); |
---|
3522 | 3788 | //objEditor.applySelf(); |
---|
3523 | 3789 | |
---|
3524 | | - assert (objEditor == this); |
---|
| 3790 | + // OCT2018: assert (objEditor == this); |
---|
3525 | 3791 | if (copy.selection == null || copy.selection.size() == 0) |
---|
3526 | 3792 | //super.applySelf() |
---|
3527 | 3793 | ; else |
---|
.. | .. |
---|
3545 | 3811 | objEditor.copy = keep; |
---|
3546 | 3812 | } |
---|
3547 | 3813 | } |
---|
| 3814 | + |
---|
| 3815 | + if (normalpushField != null) |
---|
| 3816 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3548 | 3817 | } |
---|
3549 | 3818 | |
---|
3550 | 3819 | void SnapObject() |
---|
3551 | 3820 | { |
---|
3552 | | - Object3D obj = (Object3D)copy.selection.elementAt(0); |
---|
3553 | | - SnapObject(obj); |
---|
| 3821 | + if (copy.selection.size() > 0) |
---|
| 3822 | + { |
---|
| 3823 | + Object3D obj = (Object3D)copy.selection.elementAt(0); |
---|
| 3824 | + SnapObject(obj); |
---|
| 3825 | + } |
---|
3554 | 3826 | } |
---|
3555 | 3827 | |
---|
3556 | 3828 | void SnapObject(Object3D obj) |
---|
.. | .. |
---|
3664 | 3936 | |
---|
3665 | 3937 | if (obj.parent != null) |
---|
3666 | 3938 | { |
---|
3667 | | - obj.parent.TransformToWorld(interest); |
---|
| 3939 | +// obj.parent.TransformToWorld(interest); |
---|
3668 | 3940 | } |
---|
3669 | 3941 | |
---|
3670 | 3942 | if (!CameraPane.TRACK) |
---|
.. | .. |
---|
3796 | 4068 | |
---|
3797 | 4069 | radioPanel.revalidate(); |
---|
3798 | 4070 | radioPanel.repaint(); |
---|
3799 | | - ctrlPanel.revalidate(); // ? new |
---|
| 4071 | + ctrlPanel.validate(); // ? new |
---|
3800 | 4072 | ctrlPanel.repaint(); |
---|
3801 | 4073 | } |
---|
3802 | 4074 | } |
---|
.. | .. |
---|
3805 | 4077 | |
---|
3806 | 4078 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3807 | 4079 | { |
---|
| 4080 | + Save(); |
---|
3808 | 4081 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3809 | 4082 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3810 | 4083 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4008 | 4281 | } |
---|
4009 | 4282 | } |
---|
4010 | 4283 | } |
---|
| 4284 | + |
---|
4011 | 4285 | LoadGFDThread loadGFDThread; |
---|
4012 | 4286 | |
---|
4013 | 4287 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
4027 | 4301 | |
---|
4028 | 4302 | try |
---|
4029 | 4303 | { |
---|
| 4304 | + // Try compressed version first. |
---|
4030 | 4305 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4031 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4306 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4307 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
4032 | 4308 | |
---|
4033 | 4309 | readobj = (Object3D) p.readObject(); |
---|
4034 | 4310 | istream.close(); |
---|
.. | .. |
---|
4036 | 4312 | readobj.ResetDisplayList(); |
---|
4037 | 4313 | } catch (Exception e) |
---|
4038 | 4314 | { |
---|
4039 | | - e.printStackTrace(); |
---|
| 4315 | + //e.printStackTrace(); |
---|
| 4316 | + try |
---|
| 4317 | + { |
---|
| 4318 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4319 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4320 | + |
---|
| 4321 | + readobj = (Object3D) p.readObject(); |
---|
| 4322 | + istream.close(); |
---|
| 4323 | + |
---|
| 4324 | + readobj.ResetDisplayList(); |
---|
| 4325 | + } catch (Exception e2) |
---|
| 4326 | + { |
---|
| 4327 | + e2.printStackTrace(); |
---|
| 4328 | + } |
---|
4040 | 4329 | } |
---|
4041 | 4330 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4042 | 4331 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4082 | 4371 | |
---|
4083 | 4372 | void LoadIt(Object obj) |
---|
4084 | 4373 | { |
---|
| 4374 | + if (obj == null) |
---|
| 4375 | + { |
---|
| 4376 | + // Invalid file |
---|
| 4377 | + return; |
---|
| 4378 | + } |
---|
| 4379 | + |
---|
4085 | 4380 | System.out.println("Loaded " + obj); |
---|
4086 | 4381 | //new Exception().printStackTrace(); |
---|
4087 | 4382 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4091 | 4386 | |
---|
4092 | 4387 | if (readobj != null) |
---|
4093 | 4388 | { |
---|
| 4389 | + Save(); |
---|
4094 | 4390 | try |
---|
4095 | 4391 | { |
---|
4096 | 4392 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4153 | 4449 | |
---|
4154 | 4450 | void load() // throws ClassNotFoundException |
---|
4155 | 4451 | { |
---|
4156 | | - if (GrafreeD.standAlone) |
---|
| 4452 | + if (Grafreed.standAlone) |
---|
4157 | 4453 | { |
---|
4158 | 4454 | FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
4159 | 4455 | browser.show(); |
---|
.. | .. |
---|
4240 | 4536 | try |
---|
4241 | 4537 | { |
---|
4242 | 4538 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4243 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4539 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4540 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4244 | 4541 | |
---|
4245 | 4542 | p.writeObject(copy); |
---|
4246 | 4543 | p.flush(); |
---|
4247 | 4544 | |
---|
| 4545 | + zstream.close(); |
---|
4248 | 4546 | ostream.close(); |
---|
4249 | 4547 | |
---|
4250 | 4548 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4254 | 4552 | { |
---|
4255 | 4553 | } |
---|
4256 | 4554 | } |
---|
| 4555 | + |
---|
4257 | 4556 | String lastname; |
---|
4258 | 4557 | |
---|
4259 | 4558 | void saveAs() |
---|
4260 | 4559 | { |
---|
4261 | | - if (GrafreeD.standAlone) |
---|
| 4560 | + if (Grafreed.standAlone) |
---|
4262 | 4561 | { |
---|
4263 | 4562 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4264 | 4563 | browser.setVisible(true); |
---|
.. | .. |
---|
4363 | 4662 | try |
---|
4364 | 4663 | { |
---|
4365 | 4664 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4366 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4367 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 4665 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4666 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4368 | 4667 | |
---|
4369 | 4668 | Object3D objectparent = obj.parent; |
---|
4370 | 4669 | obj.parent = null; |
---|
4371 | 4670 | |
---|
4372 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 4671 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4373 | 4672 | |
---|
4374 | 4673 | obj.parent = objectparent; |
---|
4375 | 4674 | |
---|
.. | .. |
---|
4381 | 4680 | p.writeObject(object); |
---|
4382 | 4681 | p.flush(); |
---|
4383 | 4682 | |
---|
| 4683 | + zstream.close(); |
---|
4384 | 4684 | ostream.close(); |
---|
4385 | | - // zstream.close(); |
---|
4386 | 4685 | |
---|
4387 | 4686 | // group.selection.get(0).parent = parent; |
---|
4388 | 4687 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4403 | 4702 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4404 | 4703 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4405 | 4704 | copy.generatePOV(buffer); |
---|
4406 | | - if (GrafreeD.standAlone) |
---|
| 4705 | + if (Grafreed.standAlone) |
---|
4407 | 4706 | { |
---|
4408 | 4707 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4409 | 4708 | browser.show(); |
---|
.. | .. |
---|
4429 | 4728 | Object3D client; |
---|
4430 | 4729 | Object3D copy; |
---|
4431 | 4730 | MenuBar menuBar; |
---|
4432 | | - Menu windowMenu; |
---|
| 4731 | + Menu fileMenu; |
---|
| 4732 | + MenuItem newItem; |
---|
4433 | 4733 | MenuItem loadItem; |
---|
4434 | 4734 | MenuItem saveItem; |
---|
4435 | 4735 | MenuItem saveAsItem; |
---|
.. | .. |
---|
4437 | 4737 | MenuItem reexportItem; |
---|
4438 | 4738 | MenuItem povItem; |
---|
4439 | 4739 | MenuItem closeItem; |
---|
4440 | | - Menu cameraMenu; |
---|
| 4740 | + |
---|
4441 | 4741 | CheckboxMenuItem zBufferItem; |
---|
4442 | 4742 | //MenuItem normalLensItem; |
---|
4443 | | - MenuItem editCameraItem; |
---|
4444 | | - MenuItem revertCameraItem; |
---|
4445 | | - CheckboxMenuItem toggleLiveItem; |
---|
4446 | 4743 | MenuItem stepItem; |
---|
4447 | | - CheckboxMenuItem toggleFullItem; |
---|
| 4744 | + CheckboxMenuItem toggleLiveItem; |
---|
| 4745 | + CheckboxMenuItem toggleFullScreenItem; |
---|
| 4746 | + CheckboxMenuItem toggleTimelineItem; |
---|
4448 | 4747 | CheckboxMenuItem toggleRenderItem; |
---|
4449 | 4748 | CheckboxMenuItem toggleDebugItem; |
---|
4450 | 4749 | CheckboxMenuItem toggleFrustumItem; |
---|
4451 | 4750 | CheckboxMenuItem toggleFootContactItem; |
---|
4452 | 4751 | CheckboxMenuItem toggleDLItem; |
---|
4453 | 4752 | CheckboxMenuItem toggleTextureItem; |
---|
4454 | | - CheckboxMenuItem toggleRandomItem; |
---|
| 4753 | + CheckboxMenuItem toggleSwitchItem; |
---|
4455 | 4754 | CheckboxMenuItem toggleRootItem; |
---|
4456 | 4755 | CheckboxMenuItem animationItem; |
---|
4457 | 4756 | CheckboxMenuItem toggleHandleItem; |
---|
.. | .. |
---|
4459 | 4758 | JSplitPane mainPanel; |
---|
4460 | 4759 | JScrollPane scrollpane; |
---|
4461 | 4760 | JPanel toolbarPanel; |
---|
4462 | | - JPanel treePanel; |
---|
| 4761 | + cGridBag treePanel; |
---|
4463 | 4762 | JPanel radioPanel; |
---|
4464 | 4763 | ButtonGroup buttonGroup; |
---|
4465 | | - JPanel ctrlPanel; |
---|
4466 | | - JPanel materialPanel; |
---|
| 4764 | + cGridBag ctrlPanel; |
---|
| 4765 | + cGridBag materialPanel; |
---|
4467 | 4766 | JScrollPane infoPanel; |
---|
4468 | | - JPanel optionsPanel; |
---|
| 4767 | + cGridBag optionsPanel; |
---|
4469 | 4768 | JTabbedPane objectPanel; |
---|
4470 | | - JPanel XYZPanel; |
---|
| 4769 | + cGridBag XYZPanel; |
---|
4471 | 4770 | JSplitPane gridPanel; |
---|
4472 | 4771 | JSplitPane bigPanel; |
---|
4473 | | - JPanel bigThree; |
---|
4474 | | - JTabbedPane jtp; |
---|
4475 | | - JPanel cameraPanel; |
---|
| 4772 | + cGridBag bigThree; |
---|
| 4773 | + cGridBag scenePanel; |
---|
| 4774 | + cGridBag centralPanel; |
---|
| 4775 | + JSplitPane cameraPanel; |
---|
| 4776 | + JPanel timelinePanel; |
---|
| 4777 | + JMenuBar timelineMenubar; |
---|
4476 | 4778 | JSplitPane framePanel; |
---|
4477 | 4779 | JTextArea/*Field*/ nameField; |
---|
4478 | | - cButton textureButton; |
---|
| 4780 | + //cButton textureButton; |
---|
4479 | 4781 | cButton okButton; |
---|
4480 | 4782 | cButton applyButton; |
---|
4481 | 4783 | cButton cancelButton; |
---|
.. | .. |
---|
4522 | 4824 | // MATERIAL |
---|
4523 | 4825 | JLabel materialLabel; |
---|
4524 | 4826 | JLabel colorLabel; |
---|
4525 | | - NumberSlider colorField; |
---|
| 4827 | + cNumberSlider colorField; |
---|
4526 | 4828 | JLabel modulationLabel; |
---|
4527 | | - NumberSlider modulationField; |
---|
| 4829 | + cNumberSlider modulationField; |
---|
4528 | 4830 | JLabel metalnessLabel; |
---|
4529 | | - NumberSlider metalnessField; |
---|
| 4831 | + cNumberSlider metalnessField; |
---|
4530 | 4832 | JLabel diffuseLabel; |
---|
4531 | | - NumberSlider diffuseField; |
---|
| 4833 | + cNumberSlider diffuseField; |
---|
4532 | 4834 | JLabel specularLabel; |
---|
4533 | | - NumberSlider specularField; |
---|
| 4835 | + cNumberSlider specularField; |
---|
4534 | 4836 | JLabel shininessLabel; |
---|
4535 | | - NumberSlider shininessField; |
---|
| 4837 | + cNumberSlider shininessField; |
---|
4536 | 4838 | JLabel shiftLabel; |
---|
4537 | | - NumberSlider shiftField; |
---|
| 4839 | + cNumberSlider shiftField; |
---|
4538 | 4840 | JLabel ambientLabel; |
---|
4539 | | - NumberSlider ambientField; |
---|
| 4841 | + cNumberSlider ambientField; |
---|
4540 | 4842 | JLabel lightareaLabel; |
---|
4541 | | - NumberSlider lightareaField; |
---|
| 4843 | + cNumberSlider lightareaField; |
---|
4542 | 4844 | JLabel diffusenessLabel; |
---|
4543 | | - NumberSlider diffusenessField; |
---|
| 4845 | + cNumberSlider diffusenessField; |
---|
4544 | 4846 | JLabel velvetLabel; |
---|
4545 | | - NumberSlider velvetField; |
---|
| 4847 | + cNumberSlider velvetField; |
---|
4546 | 4848 | JLabel sheenLabel; |
---|
4547 | | - NumberSlider sheenField; |
---|
| 4849 | + cNumberSlider sheenField; |
---|
4548 | 4850 | JLabel subsurfaceLabel; |
---|
4549 | | - NumberSlider subsurfaceField; |
---|
| 4851 | + cNumberSlider subsurfaceField; |
---|
4550 | 4852 | //JLabel bumpLabel; |
---|
4551 | 4853 | //NumberSlider bumpField; |
---|
4552 | 4854 | JLabel backlitLabel; |
---|
4553 | | - NumberSlider backlitField; |
---|
| 4855 | + cNumberSlider backlitField; |
---|
4554 | 4856 | JLabel anisoLabel; |
---|
4555 | | - NumberSlider anisoField; |
---|
| 4857 | + cNumberSlider anisoField; |
---|
4556 | 4858 | JLabel anisoVLabel; |
---|
4557 | | - NumberSlider anisoVField; |
---|
| 4859 | + cNumberSlider anisoVField; |
---|
4558 | 4860 | JLabel cameraLabel; |
---|
4559 | | - NumberSlider cameraField; |
---|
| 4861 | + cNumberSlider cameraField; |
---|
4560 | 4862 | JLabel selfshadowLabel; |
---|
4561 | | - NumberSlider selfshadowField; |
---|
| 4863 | + cNumberSlider selfshadowField; |
---|
4562 | 4864 | JLabel shadowLabel; |
---|
4563 | | - NumberSlider shadowField; |
---|
| 4865 | + cNumberSlider shadowField; |
---|
4564 | 4866 | JLabel textureLabel; |
---|
4565 | | - NumberSlider textureField; |
---|
| 4867 | + cNumberSlider textureField; |
---|
4566 | 4868 | JLabel opacityLabel; |
---|
4567 | | - NumberSlider opacityField; |
---|
| 4869 | + cNumberSlider opacityField; |
---|
4568 | 4870 | JLabel fakedepthLabel; |
---|
4569 | | - NumberSlider fakedepthField; |
---|
| 4871 | + cNumberSlider fakedepthField; |
---|
4570 | 4872 | JLabel shadowbiasLabel; |
---|
4571 | | - NumberSlider shadowbiasField; |
---|
| 4873 | + cNumberSlider shadowbiasField; |
---|
4572 | 4874 | JLabel bumpLabel; |
---|
4573 | | - NumberSlider bumpField; |
---|
| 4875 | + cNumberSlider bumpField; |
---|
4574 | 4876 | JLabel noiseLabel; |
---|
4575 | | - NumberSlider noiseField; |
---|
| 4877 | + cNumberSlider noiseField; |
---|
4576 | 4878 | JLabel powerLabel; |
---|
4577 | | - NumberSlider powerField; |
---|
| 4879 | + cNumberSlider powerField; |
---|
4578 | 4880 | JLabel borderfadeLabel; |
---|
4579 | | - NumberSlider borderfadeField; |
---|
| 4881 | + cNumberSlider borderfadeField; |
---|
4580 | 4882 | JLabel fogLabel; |
---|
4581 | | - NumberSlider fogField; |
---|
| 4883 | + cNumberSlider fogField; |
---|
4582 | 4884 | JLabel opacityPowerLabel; |
---|
4583 | | - NumberSlider opacityPowerField; |
---|
| 4885 | + cNumberSlider opacityPowerField; |
---|
4584 | 4886 | JTree jTree; |
---|
4585 | 4887 | //ObjectUI parent; |
---|
| 4888 | + |
---|
| 4889 | + cNumberSlider normalpushField; |
---|
| 4890 | + |
---|
| 4891 | + private MenuItem importGFDItem; |
---|
| 4892 | + private MenuItem importVRMLX3DItem; |
---|
| 4893 | + private MenuItem import3DSItem; |
---|
| 4894 | + private MenuItem importOBJItem; |
---|
4586 | 4895 | } |
---|