.. | .. |
---|
4 | 4 | |
---|
5 | 5 | import java.awt.*; |
---|
6 | 6 | import java.awt.event.*; |
---|
| 7 | +import java.awt.image.BufferedImage; |
---|
7 | 8 | import javax.swing.*; |
---|
8 | 9 | import javax.swing.event.*; |
---|
9 | 10 | import javax.swing.text.*; |
---|
.. | .. |
---|
14 | 15 | //import javax.swing.plaf.ColorUIResource; |
---|
15 | 16 | //import javax.swing.plaf.metal.DefaultMetalTheme; |
---|
16 | 17 | |
---|
| 18 | +import javax.swing.plaf.basic.BasicSplitPaneDivider; |
---|
| 19 | +import javax.swing.plaf.basic.BasicSplitPaneUI; |
---|
| 20 | + |
---|
17 | 21 | //import javax.media.opengl.GLCanvas; |
---|
18 | 22 | |
---|
19 | 23 | import //weka.core. |
---|
20 | 24 | matrix.Matrix; |
---|
| 25 | + |
---|
| 26 | +import grafeme.ui.*; |
---|
21 | 27 | |
---|
22 | 28 | class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI, |
---|
23 | 29 | ActionListener, ChangeListener, |
---|
.. | .. |
---|
28 | 34 | iSendInfo |
---|
29 | 35 | //KeyListener |
---|
30 | 36 | { |
---|
| 37 | + public cToggleButton pinButton; |
---|
31 | 38 | boolean timeline; |
---|
32 | 39 | boolean wasFullScreen; |
---|
33 | 40 | |
---|
| 41 | + GroupEditor callee; |
---|
| 42 | + JFrame frame; |
---|
| 43 | + |
---|
| 44 | + static ObjEditor theFrame; |
---|
| 45 | + |
---|
| 46 | + public void AllocProjectedVertices(Object3D object) |
---|
| 47 | + { |
---|
| 48 | + assert (object.projectedVertices != null); |
---|
| 49 | + |
---|
| 50 | + if (object.projectedVertices.length <= 2) |
---|
| 51 | + { |
---|
| 52 | + // Side effect... |
---|
| 53 | + Object3D.cVector2[] keep = object.projectedVertices; |
---|
| 54 | + object.projectedVertices = new Object3D.cVector2[3]; |
---|
| 55 | + for (int i = 0; i < 3; i++) |
---|
| 56 | + { |
---|
| 57 | + if (i < keep.length) |
---|
| 58 | + { |
---|
| 59 | + object.projectedVertices[i] = keep[i]; |
---|
| 60 | + } else |
---|
| 61 | + { |
---|
| 62 | + object.projectedVertices[i] = new Object3D.cVector2(); |
---|
| 63 | + } |
---|
| 64 | + /* |
---|
| 65 | + if(keep.length == 0) |
---|
| 66 | + object.projectedVertices[0] = new Object3D.cVector2(); |
---|
| 67 | + else |
---|
| 68 | + object.projectedVertices[0] = keep[0]; |
---|
| 69 | + object.projectedVertices[1] = new Object3D.cVector2(); |
---|
| 70 | + */ |
---|
| 71 | + } |
---|
| 72 | + } |
---|
| 73 | + } |
---|
| 74 | + |
---|
| 75 | + public cGridBag GetSeparator() |
---|
| 76 | + { |
---|
| 77 | + cGridBag separator = new cGridBag(); |
---|
| 78 | + separator.add(new JSeparator()); |
---|
| 79 | + separator.preferredHeight = 5; |
---|
| 80 | + return separator; |
---|
| 81 | + } |
---|
| 82 | + |
---|
| 83 | + cButton GetButton(String name, boolean border) |
---|
| 84 | + { |
---|
| 85 | + ImageIcon icon = GetIcon(name); |
---|
| 86 | + return new cButton(icon, border); |
---|
| 87 | + } |
---|
| 88 | + |
---|
| 89 | + cLabel GetLabel(String name, boolean border) |
---|
| 90 | + { |
---|
| 91 | + //ImageIcon icon = GetIcon(name); |
---|
| 92 | + return new cLabel(GetImage(name), border); |
---|
| 93 | + } |
---|
| 94 | + |
---|
| 95 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 96 | + { |
---|
| 97 | + ImageIcon icon = GetIcon(name); |
---|
| 98 | + return new cToggleButton(icon, border); |
---|
| 99 | + } |
---|
| 100 | + |
---|
| 101 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 102 | + { |
---|
| 103 | + ImageIcon icon = GetIcon(name); |
---|
| 104 | + return new cCheckBox(icon, border); |
---|
| 105 | + } |
---|
| 106 | + |
---|
| 107 | + static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>(); |
---|
| 108 | + |
---|
| 109 | + ImageIcon GetIcon(String name) |
---|
| 110 | + { |
---|
| 111 | + javax.swing.ImageIcon iconCache = icons.get(name); |
---|
| 112 | + if (iconCache != null) |
---|
| 113 | + { |
---|
| 114 | + return iconCache; |
---|
| 115 | + } |
---|
| 116 | + |
---|
| 117 | + try |
---|
| 118 | + { |
---|
| 119 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 120 | + |
---|
| 121 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 122 | +// { |
---|
| 123 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 124 | +// Graphics2D g = resized.createGraphics(); |
---|
| 125 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 126 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 127 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 128 | +// g.dispose(); |
---|
| 129 | +// |
---|
| 130 | +// image = resized; |
---|
| 131 | +// } |
---|
| 132 | + |
---|
| 133 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 134 | + |
---|
| 135 | + icons.put(name, icon); |
---|
| 136 | + |
---|
| 137 | + return icon; |
---|
| 138 | + } |
---|
| 139 | + catch (Exception e) |
---|
| 140 | + { |
---|
| 141 | + //icons.put(name, null); |
---|
| 142 | + return null; |
---|
| 143 | + } |
---|
| 144 | + } |
---|
| 145 | + |
---|
| 146 | + BufferedImage GetImage(String name) |
---|
| 147 | + { |
---|
| 148 | + try |
---|
| 149 | + { |
---|
| 150 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 151 | + |
---|
| 152 | + return image; |
---|
| 153 | + } |
---|
| 154 | + catch (Exception e) |
---|
| 155 | + { |
---|
| 156 | + return null; |
---|
| 157 | + } |
---|
| 158 | + } |
---|
| 159 | + |
---|
34 | 160 | // SCRIPT |
---|
35 | 161 | |
---|
36 | 162 | transient JFrame textpanel = null; |
---|
.. | .. |
---|
121 | 247 | void keyPressed(int key, int modifiers) |
---|
122 | 248 | { |
---|
123 | 249 | System.out.println("KEY PRESSED"); |
---|
124 | | - CameraPane.theRenderer.keyPressed(key, modifiers); |
---|
| 250 | + Globals.theRenderer.keyPressed(key, modifiers); |
---|
125 | 251 | } |
---|
126 | 252 | */ |
---|
127 | 253 | |
---|
128 | 254 | static GridBagConstraints aConstraints; |
---|
129 | 255 | static GridBagConstraints aWindowConstraints; |
---|
130 | | - GroupEditor callee; |
---|
131 | | - JFrame frame; |
---|
| 256 | + |
---|
132 | 257 | static int GRIDWIDTH = 100; // 4; |
---|
133 | 258 | |
---|
134 | 259 | public void closeUI() |
---|
135 | 260 | { |
---|
136 | 261 | //new Exception().printStackTrace(); |
---|
137 | | - System.out.println("this = " + this); |
---|
138 | | - System.out.println("objEditor = " + objEditor); |
---|
| 262 | +// System.out.println("this = " + this); |
---|
| 263 | +// System.out.println("objEditor = " + objEditor); |
---|
139 | 264 | //nameField.removeActionListener(this); |
---|
140 | | - objEditor.ctrlPanel.remove(nameField); |
---|
| 265 | +// objEditor.ctrlPanel.remove(nameField); |
---|
141 | 266 | |
---|
142 | | - if (!GroupEditor.allparams) |
---|
| 267 | + objEditor.ctrlPanel.remove(namePanel); |
---|
| 268 | + |
---|
| 269 | + if (!allparams) |
---|
143 | 270 | return; |
---|
144 | 271 | |
---|
145 | | - objEditor.ctrlPanel.remove(liveCB); |
---|
146 | | - objEditor.ctrlPanel.remove(hideCB); |
---|
147 | | - objEditor.ctrlPanel.remove(markCB); |
---|
148 | | - |
---|
149 | | - objEditor.ctrlPanel.remove(randomCB); |
---|
150 | | - objEditor.ctrlPanel.remove(speedupCB); |
---|
151 | | - objEditor.ctrlPanel.remove(rewindCB); |
---|
152 | | - |
---|
153 | | - objEditor.ctrlPanel.remove(resetButton); |
---|
154 | | - objEditor.ctrlPanel.remove(stepButton); |
---|
155 | | -// objEditor.ctrlPanel.remove(stepAllButton); |
---|
156 | | -// objEditor.ctrlPanel.remove(resetAllButton); |
---|
157 | | - objEditor.ctrlPanel.remove(link2masterCB); |
---|
158 | | - //objEditor.ctrlPanel.remove(flipVCB); |
---|
159 | | - //objEditor.ctrlPanel.remove(texresMenu); |
---|
160 | | - objEditor.ctrlPanel.remove(slowerButton); |
---|
161 | | - objEditor.ctrlPanel.remove(fasterButton); |
---|
162 | | - objEditor.ctrlPanel.remove(remarkButton); |
---|
| 272 | +// objEditor.ctrlPanel.remove(liveCB); |
---|
| 273 | +// objEditor.ctrlPanel.remove(hideCB); |
---|
| 274 | +// objEditor.ctrlPanel.remove(markCB); |
---|
| 275 | +// |
---|
| 276 | +// objEditor.ctrlPanel.remove(randomCB); |
---|
| 277 | +// objEditor.ctrlPanel.remove(speedupCB); |
---|
| 278 | +// objEditor.ctrlPanel.remove(rewindCB); |
---|
| 279 | +// |
---|
| 280 | +// objEditor.ctrlPanel.remove(resetButton); |
---|
| 281 | +// objEditor.ctrlPanel.remove(stepButton); |
---|
| 282 | +//// objEditor.ctrlPanel.remove(stepAllButton); |
---|
| 283 | +//// objEditor.ctrlPanel.remove(resetAllButton); |
---|
| 284 | +// objEditor.ctrlPanel.remove(link2masterCB); |
---|
| 285 | +// //objEditor.ctrlPanel.remove(flipVCB); |
---|
| 286 | +// //objEditor.ctrlPanel.remove(texresMenu); |
---|
| 287 | +// objEditor.ctrlPanel.remove(slowerButton); |
---|
| 288 | +// objEditor.ctrlPanel.remove(fasterButton); |
---|
| 289 | +// objEditor.ctrlPanel.remove(remarkButton); |
---|
163 | 290 | |
---|
164 | | - Remove(normalpushField); |
---|
| 291 | + objEditor.ctrlPanel.remove(setupPanel); |
---|
| 292 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 293 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
| 294 | + objEditor.ctrlPanel.remove(pushPanel); |
---|
| 295 | + //objEditor.ctrlPanel.remove(fillPanel); |
---|
| 296 | + |
---|
| 297 | + //Remove(normalpushField); |
---|
165 | 298 | } |
---|
166 | 299 | |
---|
167 | 300 | public ObjEditor GetEditor() |
---|
.. | .. |
---|
205 | 338 | client = inClient; |
---|
206 | 339 | copy = client; |
---|
207 | 340 | |
---|
| 341 | +// if (copy.versionlist == null) |
---|
| 342 | +// { |
---|
| 343 | +// copy.versionlist = new Object3D[100]; |
---|
| 344 | +// copy.versionindex = -1; |
---|
| 345 | +// |
---|
| 346 | +// callee.Save(true); |
---|
| 347 | +// } |
---|
| 348 | + |
---|
208 | 349 | // "this" is not called: SetupUI2(objEditor); |
---|
209 | 350 | } |
---|
210 | 351 | |
---|
.. | .. |
---|
218 | 359 | client = inClient; |
---|
219 | 360 | copy = client; |
---|
220 | 361 | |
---|
| 362 | + if (copy.versionlist == null) |
---|
| 363 | + { |
---|
| 364 | + copy.versionlist = new Object3D[100]; |
---|
| 365 | + copy.versionindex = -1; |
---|
| 366 | + |
---|
| 367 | +// Save(true); |
---|
| 368 | + } |
---|
| 369 | + |
---|
221 | 370 | SetupUI2(callee.GetEditor()); |
---|
222 | 371 | } |
---|
223 | 372 | |
---|
.. | .. |
---|
232 | 381 | //localCopy.parent = null; |
---|
233 | 382 | |
---|
234 | 383 | frame = new JFrame(); |
---|
| 384 | + frame.setUndecorated(false); |
---|
235 | 385 | objEditor = this; |
---|
236 | 386 | this.callee = callee; |
---|
237 | 387 | |
---|
238 | 388 | //parent = p; |
---|
239 | 389 | |
---|
240 | 390 | GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
---|
241 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 391 | + if (Globals.DEBUG) |
---|
| 392 | + System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
242 | 393 | //gd.setFullScreenWindow(this); |
---|
243 | 394 | //setResizable(false); |
---|
244 | 395 | //if (!isDisplayable()) |
---|
.. | .. |
---|
249 | 400 | copy = localCopy; |
---|
250 | 401 | copy.editWindow = this; |
---|
251 | 402 | |
---|
| 403 | +// if (copy.versionlist == null) |
---|
| 404 | +// { |
---|
| 405 | +// copy.versionlist = new Object3D[100]; |
---|
| 406 | +// copy.versionindex = -1; |
---|
| 407 | +// |
---|
| 408 | +// Save(true); |
---|
| 409 | +// } |
---|
| 410 | + |
---|
252 | 411 | SetupMenu(); |
---|
253 | 412 | |
---|
254 | 413 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
262 | 421 | return frame.action(event, obj); |
---|
263 | 422 | } |
---|
264 | 423 | |
---|
| 424 | + // Cannot work without static |
---|
| 425 | + static boolean allparams = true; |
---|
| 426 | + |
---|
| 427 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 428 | + |
---|
| 429 | + // This is to refresh the UI of the material panel. |
---|
| 430 | + boolean patchMaterial; |
---|
| 431 | + |
---|
265 | 432 | void SetupMenu() |
---|
266 | 433 | { |
---|
267 | 434 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
268 | | - menuBar.add(windowMenu = new Menu("File")); |
---|
269 | | - windowMenu.add(loadItem = new MenuItem("Load...")); |
---|
270 | | - windowMenu.add("-"); |
---|
271 | | - windowMenu.add(saveItem = new MenuItem("Save")); |
---|
272 | | - windowMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
| 435 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 436 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 437 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
| 438 | + |
---|
| 439 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 440 | + Menu menu = new Menu("Import"); |
---|
| 441 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 442 | + importOBJItem.addActionListener(this); |
---|
| 443 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 444 | + import3DSItem.addActionListener(this); |
---|
| 445 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 446 | + importVRMLX3DItem.addActionListener(this); |
---|
| 447 | + menu.add("-"); |
---|
| 448 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 449 | + importGFDItem.addActionListener(this); |
---|
| 450 | + fileMenu.add(menu); |
---|
| 451 | + fileMenu.add("-"); |
---|
| 452 | + |
---|
| 453 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 454 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
273 | 455 | //windowMenu.add(povItem = new MenuItem("Emit POV-Ray...")); |
---|
274 | | - windowMenu.add("-"); |
---|
275 | | - windowMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
276 | | - windowMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
277 | | - windowMenu.add("-"); |
---|
| 456 | + fileMenu.add("-"); |
---|
| 457 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 458 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 459 | + fileMenu.add("-"); |
---|
278 | 460 | if (client.parent != null) |
---|
279 | 461 | { |
---|
280 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 462 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
281 | 463 | } else |
---|
282 | 464 | { |
---|
283 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 465 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
284 | 466 | } |
---|
285 | 467 | |
---|
286 | | - loadItem.addActionListener(this); |
---|
| 468 | + newItem.addActionListener(this); |
---|
| 469 | + openItem.addActionListener(this); |
---|
287 | 470 | saveItem.addActionListener(this); |
---|
288 | 471 | saveAsItem.addActionListener(this); |
---|
289 | 472 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
291 | 474 | //povItem.addActionListener(this); |
---|
292 | 475 | closeItem.addActionListener(this); |
---|
293 | 476 | |
---|
294 | | - menuBar.add(cameraMenu = new Menu("View")); |
---|
295 | | - //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer")); |
---|
296 | | - //zBufferItem.addActionListener(this); |
---|
297 | | - //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens")); |
---|
298 | | - //normalLensItem.addActionListener(this); |
---|
299 | | - cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera")); |
---|
300 | | - revertCameraItem.addActionListener(this); |
---|
301 | | - cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline")); |
---|
302 | | - toggleTimelineItem.addItemListener(this); |
---|
303 | | - cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); |
---|
304 | | - toggleFullScreenItem.addItemListener(this); |
---|
305 | | - toggleFullScreenItem.setState(CameraPane.FULLSCREEN); |
---|
306 | | - cameraMenu.add("-"); |
---|
307 | | - cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); |
---|
308 | | - toggleTextureItem.addItemListener(this); |
---|
309 | | - toggleTextureItem.setState(CameraPane.textureon); |
---|
310 | | - cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); |
---|
311 | | - toggleLiveItem.addItemListener(this); |
---|
312 | | - toggleLiveItem.setState(CameraPane.isLIVE()); |
---|
313 | | - cameraMenu.add(stepItem = new MenuItem("Step")); |
---|
314 | | - stepItem.addActionListener(this); |
---|
315 | | -// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); |
---|
316 | | -// toggleDLItem.addItemListener(this); |
---|
317 | | -// toggleDLItem.setState(false); |
---|
318 | | - cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render")); |
---|
319 | | - toggleRenderItem.addItemListener(this); |
---|
320 | | - toggleRenderItem.setState(!CameraPane.frozen); |
---|
321 | | - cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); |
---|
322 | | - toggleDebugItem.addItemListener(this); |
---|
323 | | - toggleDebugItem.setState(CameraPane.DEBUG); |
---|
324 | | - cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); |
---|
325 | | - toggleFrustumItem.addItemListener(this); |
---|
326 | | - toggleFrustumItem.setState(CameraPane.FRUSTUM); |
---|
327 | | - cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact")); |
---|
328 | | - toggleFootContactItem.addItemListener(this); |
---|
329 | | - toggleFootContactItem.setState(CameraPane.FOOTCONTACT); |
---|
330 | | - cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random")); |
---|
331 | | - toggleRandomItem.addItemListener(this); |
---|
332 | | - toggleRandomItem.setState(CameraPane.RANDOM); |
---|
333 | | - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); |
---|
334 | | - toggleHandleItem.addItemListener(this); |
---|
335 | | - toggleHandleItem.setState(CameraPane.HANDLES); |
---|
336 | | - cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode")); |
---|
337 | | - togglePaintItem.addItemListener(this); |
---|
338 | | - togglePaintItem.setState(CameraPane.PAINTMODE); |
---|
339 | | -// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root")); |
---|
340 | | -// toggleRootItem.addItemListener(this); |
---|
341 | | -// toggleRootItem.setState(false); |
---|
342 | | -// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation")); |
---|
343 | | -// animationItem.addItemListener(this); |
---|
344 | | -// animationItem.setState(CameraPane.ANIMATION); |
---|
345 | | - cameraMenu.add("-"); |
---|
346 | | - cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera")); |
---|
347 | | - editCameraItem.addActionListener(this); |
---|
348 | | - |
---|
349 | 477 | objectPanel = new JTabbedPane(); |
---|
| 478 | + |
---|
| 479 | + ChangeListener changeListener = new ChangeListener() |
---|
| 480 | + { |
---|
| 481 | + //String name; |
---|
| 482 | + |
---|
| 483 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 484 | + { |
---|
| 485 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 486 | +// { |
---|
| 487 | +// if (latestObject != null) |
---|
| 488 | +// { |
---|
| 489 | +// refreshContents(true); |
---|
| 490 | +// SetMaterial(latestObject); |
---|
| 491 | +// } |
---|
| 492 | +// |
---|
| 493 | +// materialFlushed = true; |
---|
| 494 | +// } |
---|
| 495 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 496 | +// { |
---|
| 497 | +// if (listUI.size() == 0) |
---|
| 498 | +// EditSelection(false); |
---|
| 499 | +// } |
---|
| 500 | + |
---|
| 501 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 502 | +// { |
---|
| 503 | +// name = copy.skyboxname; |
---|
| 504 | +// |
---|
| 505 | +// if (name == null) |
---|
| 506 | +// { |
---|
| 507 | +// name = ""; |
---|
| 508 | +// } |
---|
| 509 | +// |
---|
| 510 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 511 | +// copy.skyboxext = "jpg"; |
---|
| 512 | +// } |
---|
| 513 | +// else |
---|
| 514 | +// { |
---|
| 515 | +// if (name != null) |
---|
| 516 | +// { |
---|
| 517 | +// if (name.equals("")) |
---|
| 518 | +// { |
---|
| 519 | +// copy.skyboxname = null; |
---|
| 520 | +// copy.skyboxext = null; |
---|
| 521 | +// } |
---|
| 522 | +// else |
---|
| 523 | +// { |
---|
| 524 | +// copy.skyboxname = name; |
---|
| 525 | +// } |
---|
| 526 | +// } |
---|
| 527 | +// } |
---|
| 528 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 529 | + |
---|
| 530 | +// refreshContents(false); // To refresh Info tab |
---|
| 531 | + cameraView.repaint(); |
---|
| 532 | + } |
---|
| 533 | + }; |
---|
| 534 | + objectPanel.addChangeListener(changeListener); |
---|
| 535 | + |
---|
350 | 536 | toolbarPanel = new JPanel(); |
---|
351 | 537 | toolbarPanel.setName("Toolbar"); |
---|
352 | | - treePanel = new JPanel(); |
---|
| 538 | + |
---|
| 539 | + treePanel = new cGridBag(); |
---|
353 | 540 | treePanel.setName("Tree"); |
---|
354 | | - ctrlPanel = new JPanel(); // new GridBagLayout()); |
---|
355 | | - ctrlPanel.setName("Edit"); |
---|
356 | | - materialPanel = new JPanel(); |
---|
357 | | - materialPanel.setName("Material"); |
---|
| 541 | + |
---|
| 542 | + editPanel = new cGridBag().setVertical(true); |
---|
| 543 | + //editPanel.setName("Edit"); |
---|
| 544 | + |
---|
| 545 | + ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
| 546 | + |
---|
| 547 | + editCommandsPanel = new cGridBag(); |
---|
| 548 | + editPanel.add(editCommandsPanel); |
---|
| 549 | + editPanel.add(ctrlPanel); |
---|
| 550 | + |
---|
| 551 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 552 | + //toolboxPanel.setName("Toolbox"); |
---|
| 553 | + |
---|
| 554 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 555 | + |
---|
| 556 | + materialPanel = new cGridBag().setVertical(false); |
---|
| 557 | + //materialPanel.setName("Material"); |
---|
| 558 | + |
---|
358 | 559 | /*JTextPane*/ |
---|
359 | 560 | infoarea = createTextPane(); |
---|
| 561 | + doc = infoarea.getStyledDocument(); |
---|
| 562 | + |
---|
360 | 563 | infoarea.setEditable(true); |
---|
361 | 564 | SetText(); |
---|
| 565 | + |
---|
362 | 566 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
363 | 567 | // infoarea.setOpaque(false); |
---|
364 | 568 | // //infoarea.setForeground(textcolor); |
---|
365 | | - infoarea.setLineWrap(true); |
---|
366 | | - infoarea.setWrapStyleWord(true); |
---|
| 569 | +// TEXTAREA infoarea.setLineWrap(true); |
---|
| 570 | +// TEXTAREA infoarea.setWrapStyleWord(true); |
---|
367 | 571 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
368 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
369 | | - infoPanel.setName("Info"); |
---|
| 572 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
| 573 | + //infoPanel.setName("Info"); |
---|
370 | 574 | //infoPanel.setLayout(new BorderLayout()); |
---|
371 | 575 | //infoPanel.add(createTextPane()); |
---|
372 | 576 | |
---|
.. | .. |
---|
374 | 578 | mainPanel.setName("Main"); |
---|
375 | 579 | mainPanel.setContinuousLayout(true); |
---|
376 | 580 | mainPanel.setOneTouchExpandable(true); |
---|
377 | | - mainPanel.setDividerLocation(1.0); |
---|
378 | 581 | mainPanel.setDividerSize(9); |
---|
379 | | - mainPanel.setResizeWeight(0); |
---|
380 | | - |
---|
| 582 | + mainPanel.setDividerLocation(0.5); //1.0); |
---|
| 583 | + mainPanel.setResizeWeight(0.5); |
---|
| 584 | + |
---|
| 585 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 586 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 587 | + divider.setDividerSize(15); |
---|
| 588 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 589 | + |
---|
| 590 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 591 | + |
---|
381 | 592 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
382 | 593 | //mainPanel.setLayout(new GridBagLayout()); |
---|
383 | 594 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
384 | | - treePanel.setLayout(new GridBagLayout()); |
---|
385 | | - ctrlPanel.setLayout(new GridBagLayout()); |
---|
386 | | - materialPanel.setLayout(new GridBagLayout()); |
---|
| 595 | +// treePanel.setLayout(new GridBagLayout()); |
---|
| 596 | + //ctrlPanel.setLayout(new GridBagLayout()); |
---|
| 597 | + //materialPanel.setLayout(new GridBagLayout()); |
---|
387 | 598 | |
---|
388 | 599 | aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, |
---|
389 | 600 | GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0); |
---|
.. | .. |
---|
422 | 633 | static String newline = "\n"; |
---|
423 | 634 | protected static final String buttonString = "JButton"; |
---|
424 | 635 | StyledDocument doc; |
---|
425 | | - JTextArea infoarea; |
---|
| 636 | + JTextPane infoarea; |
---|
426 | 637 | |
---|
427 | 638 | void ClearInfo() |
---|
428 | 639 | { |
---|
.. | .. |
---|
445 | 656 | e.printStackTrace(); |
---|
446 | 657 | } |
---|
447 | 658 | |
---|
448 | | - String selection = infoarea.getText(); |
---|
449 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
450 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
451 | | - Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
| 659 | +// String selection = infoarea.getText(); |
---|
| 660 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 661 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 662 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
452 | 663 | //clipboard.setContents(data, data); |
---|
453 | 664 | } |
---|
454 | 665 | |
---|
.. | .. |
---|
471 | 682 | //SendInfo("Name:", "bold"); |
---|
472 | 683 | if (sel.GetTextures() != null || debug) |
---|
473 | 684 | { |
---|
474 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 685 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
475 | 686 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
476 | 687 | if (sel.Size() > 0) |
---|
477 | 688 | { |
---|
478 | 689 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
479 | 690 | } |
---|
480 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 691 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
481 | 692 | if (debug) |
---|
482 | 693 | { |
---|
483 | 694 | try |
---|
.. | .. |
---|
489 | 700 | } |
---|
490 | 701 | |
---|
491 | 702 | if (full) |
---|
492 | | - si.SendInfo(" BBox: " + minima + " - " + maxima, "regular"); |
---|
| 703 | + { |
---|
| 704 | + si.SendInfo(" BBox min: " + minima, "regular"); |
---|
| 705 | + si.SendInfo(" BBox max: " + maxima, "regular"); |
---|
| 706 | + } |
---|
493 | 707 | |
---|
494 | 708 | if (sel.bRep != null) |
---|
495 | 709 | { |
---|
.. | .. |
---|
516 | 730 | } |
---|
517 | 731 | if (sel.support != null) |
---|
518 | 732 | { |
---|
519 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 733 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
520 | 734 | } |
---|
521 | 735 | if (sel.scriptnode != null) |
---|
522 | 736 | { |
---|
.. | .. |
---|
587 | 801 | { |
---|
588 | 802 | CameraPane.pointflow = (PointFlow) sel; |
---|
589 | 803 | } |
---|
| 804 | + |
---|
| 805 | + si.SendInfo("_____________________", "regular"); |
---|
| 806 | + si.SendInfo("", "regular"); |
---|
590 | 807 | } |
---|
591 | 808 | } |
---|
592 | 809 | |
---|
.. | .. |
---|
602 | 819 | } |
---|
603 | 820 | } |
---|
604 | 821 | |
---|
| 822 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 823 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 824 | + |
---|
| 825 | + Rectangle keeprect; |
---|
| 826 | + cRadio radio; |
---|
| 827 | + |
---|
| 828 | +cButton keepButton; |
---|
| 829 | + cButton twoButton; // Full 3D |
---|
| 830 | + cButton sixButton; |
---|
| 831 | + cButton threeButton; |
---|
| 832 | + cButton sevenButton; |
---|
| 833 | + cButton fourButton; // full panel |
---|
| 834 | + cButton oneButton; // full XYZ |
---|
| 835 | + //cButton currentLayout; |
---|
| 836 | + |
---|
| 837 | + boolean maximized; |
---|
| 838 | + |
---|
| 839 | + cButton fullscreenLayout; |
---|
| 840 | + cButton expandedLayout; |
---|
| 841 | + |
---|
| 842 | + void Minimize() |
---|
| 843 | + { |
---|
| 844 | + frame.setState(Frame.ICONIFIED); |
---|
| 845 | + frame.validate(); |
---|
| 846 | + } |
---|
| 847 | + |
---|
| 848 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 849 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 850 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
| 851 | + void Maximize() |
---|
| 852 | + { |
---|
| 853 | + if (CameraPane.FULLSCREEN) |
---|
| 854 | + { |
---|
| 855 | + ToggleFullScreen(); |
---|
| 856 | + } |
---|
| 857 | + |
---|
| 858 | + if (maximized) |
---|
| 859 | + { |
---|
| 860 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 861 | + } |
---|
| 862 | + else |
---|
| 863 | + { |
---|
| 864 | + keeprect = frame.getBounds(); |
---|
| 865 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 866 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 867 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 868 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 869 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
| 870 | + } |
---|
| 871 | + |
---|
| 872 | + maximized ^= true; |
---|
| 873 | + |
---|
| 874 | + frame.validate(); |
---|
| 875 | + } |
---|
| 876 | + |
---|
| 877 | + cButton minButton; |
---|
| 878 | + cButton maxButton; |
---|
| 879 | + cButton fullButton; |
---|
| 880 | + cButton collapseButton; |
---|
| 881 | + cButton maximize3DButton; |
---|
| 882 | + |
---|
605 | 883 | void ToggleFullScreen() |
---|
606 | 884 | { |
---|
607 | | - if (CameraPane.FULLSCREEN) |
---|
| 885 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 886 | + |
---|
| 887 | + cameraView.ToggleFullScreen(); |
---|
| 888 | + |
---|
| 889 | + if (!CameraPane.FULLSCREEN) |
---|
608 | 890 | { |
---|
609 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
610 | | - framePanel.add(bigThree); |
---|
611 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 891 | + device.setFullScreenWindow(null); |
---|
| 892 | + frame.dispose(); |
---|
| 893 | + frame.setUndecorated(false); |
---|
| 894 | + frame.validate(); |
---|
| 895 | + frame.setVisible(true); |
---|
| 896 | + |
---|
| 897 | + //frame.setVisible(false); |
---|
| 898 | +// frame.removeNotify(); |
---|
| 899 | +// frame.setUndecorated(false); |
---|
| 900 | +// frame.addNotify(); |
---|
| 901 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 902 | + |
---|
| 903 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 904 | +// X framePanel.add(bigThree); |
---|
| 905 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 906 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
| 907 | + |
---|
| 908 | + //frame.setVisible(true); |
---|
| 909 | +// radio.layout = keepButton; |
---|
| 910 | + //theFrame = null; |
---|
| 911 | + keepButton = null; |
---|
| 912 | +// radio.layout.doClick(); |
---|
| 913 | + |
---|
612 | 914 | } else |
---|
613 | 915 | { |
---|
614 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
615 | | - framePanel.remove(bigThree); |
---|
616 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 916 | + keepButton = radio.layout; |
---|
| 917 | + //keeprect = frame.getBounds(); |
---|
| 918 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 919 | +// frame.getToolkit().getScreenSize().height); |
---|
| 920 | + //frame.setVisible(false); |
---|
| 921 | + |
---|
| 922 | + frame.dispose(); |
---|
| 923 | + frame.setUndecorated(true); |
---|
| 924 | + device.setFullScreenWindow(frame); |
---|
| 925 | + frame.validate(); |
---|
| 926 | + frame.setVisible(true); |
---|
| 927 | +// frame.removeNotify(); |
---|
| 928 | +// frame.setUndecorated(true); |
---|
| 929 | +// frame.addNotify(); |
---|
| 930 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 931 | +// X framePanel.remove(bigThree); |
---|
| 932 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 933 | +// framePanel.setDividerLocation(0); |
---|
| 934 | + |
---|
| 935 | +// radio.layout = fullscreenLayout; |
---|
| 936 | +// radio.layout.doClick(); |
---|
| 937 | + //frame.setVisible(true); |
---|
617 | 938 | } |
---|
618 | | - cameraView.ToggleFullScreen(); |
---|
| 939 | + frame.validate(); |
---|
| 940 | + |
---|
| 941 | + cameraView.requestFocusInWindow(); |
---|
619 | 942 | } |
---|
620 | 943 | |
---|
621 | | - private JTextArea createTextPane() |
---|
| 944 | + void CollapseToolbar() |
---|
| 945 | + { |
---|
| 946 | + framePanel.setDividerLocation(0); |
---|
| 947 | + //frame.validate(); |
---|
| 948 | + |
---|
| 949 | + cameraView.requestFocusInWindow(); |
---|
| 950 | + } |
---|
| 951 | + |
---|
| 952 | + private Object3D Duplicate(Object3D object) |
---|
622 | 953 | { |
---|
623 | | - String[] initString = |
---|
624 | | - { |
---|
625 | | - "This is an editable JTextPane, ", //regular |
---|
626 | | - "another ", //italic |
---|
627 | | - "styled ", //bold |
---|
628 | | - "text ", //small |
---|
629 | | - "component, ", //large |
---|
630 | | - "which supports embedded components..." + newline,//regular |
---|
631 | | - " " + newline, //button |
---|
632 | | - "...and embedded icons..." + newline, //regular |
---|
633 | | - " ", //icon |
---|
634 | | - newline + "JTextPane is a subclass of JEditorPane that " |
---|
635 | | - + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
636 | | - + "cover methods for interacting with those objects." |
---|
637 | | - }; |
---|
| 954 | + boolean temp = CameraPane.SWITCH; |
---|
| 955 | + CameraPane.SWITCH = false; |
---|
| 956 | + |
---|
| 957 | + if (Grafreed.grafreed.universe.versiontable == null) |
---|
| 958 | + Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 959 | + |
---|
| 960 | + object.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 961 | + // if (copy == client) |
---|
| 962 | + |
---|
| 963 | + Object3D versions[] = object.versionlist; |
---|
| 964 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe |
---|
| 965 | + object.versionlist = null; |
---|
| 966 | + object.versiontable = null; |
---|
| 967 | + |
---|
| 968 | + //byte[] compress = Compress(copy); |
---|
| 969 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
| 970 | + |
---|
| 971 | + object.versionlist = versions; |
---|
| 972 | + object.versiontable = versiontable; // if Grafreed.grafreed.universe |
---|
| 973 | + |
---|
| 974 | + object.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 975 | + |
---|
| 976 | + CameraPane.SWITCH = temp; |
---|
| 977 | + |
---|
| 978 | + return compress; |
---|
| 979 | + } |
---|
638 | 980 | |
---|
639 | | - String[] initStyles = |
---|
640 | | - { |
---|
641 | | - "regular", "italic", "bold", "small", "large", |
---|
642 | | - "regular", "button", "regular", "icon", |
---|
643 | | - "regular" |
---|
644 | | - }; |
---|
| 981 | + private JTextPane createTextPane() |
---|
| 982 | + { |
---|
| 983 | +// TEXTAREA String[] initString = |
---|
| 984 | +// { |
---|
| 985 | +// "This is an editable JTextPane, ", //regular |
---|
| 986 | +// "another ", //italic |
---|
| 987 | +// "styled ", //bold |
---|
| 988 | +// "text ", //small |
---|
| 989 | +// "component, ", //large |
---|
| 990 | +// "which supports embedded components..." + newline,//regular |
---|
| 991 | +// " " + newline, //button |
---|
| 992 | +// "...and embedded icons..." + newline, //regular |
---|
| 993 | +// " ", //icon |
---|
| 994 | +// newline + "JTextPane is a subclass of JEditorPane that " |
---|
| 995 | +// + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
| 996 | +// + "cover methods for interacting with those objects." |
---|
| 997 | +// }; |
---|
| 998 | +// |
---|
| 999 | +// String[] initStyles = |
---|
| 1000 | +// { |
---|
| 1001 | +// "regular", "italic", "bold", "small", "large", |
---|
| 1002 | +// "regular", "button", "regular", "icon", |
---|
| 1003 | +// "regular" |
---|
| 1004 | +// }; |
---|
| 1005 | +// |
---|
| 1006 | +// JTextPane textPane = new JTextPane(); |
---|
| 1007 | +// textPane.setEditable(true); |
---|
| 1008 | +// /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
| 1009 | +// addStylesToDocument(doc); |
---|
| 1010 | +// |
---|
| 1011 | +// try |
---|
| 1012 | +// { |
---|
| 1013 | +// for (int j = 0; j < 2; j++) |
---|
| 1014 | +// { |
---|
| 1015 | +// for (int i = 0; i < initString.length; i++) |
---|
| 1016 | +// { |
---|
| 1017 | +// doc.insertString(doc.getLength(), initString[i], |
---|
| 1018 | +// doc.getStyle(initStyles[i])); |
---|
| 1019 | +// } |
---|
| 1020 | +// } |
---|
| 1021 | +// } catch (BadLocationException ble) |
---|
| 1022 | +// { |
---|
| 1023 | +// System.err.println("Couldn't insert initial text into text pane."); |
---|
| 1024 | +// } |
---|
645 | 1025 | |
---|
646 | | - JTextPane textPane = new JTextPane(); |
---|
647 | | - textPane.setEditable(true); |
---|
648 | | - /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
649 | | - addStylesToDocument(doc); |
---|
650 | | - |
---|
651 | | - try |
---|
652 | | - { |
---|
653 | | - for (int j = 0; j < 2; j++) |
---|
654 | | - { |
---|
655 | | - for (int i = 0; i < initString.length; i++) |
---|
656 | | - { |
---|
657 | | - doc.insertString(doc.getLength(), initString[i], |
---|
658 | | - doc.getStyle(initStyles[i])); |
---|
659 | | - } |
---|
660 | | - } |
---|
661 | | - } catch (BadLocationException ble) |
---|
662 | | - { |
---|
663 | | - System.err.println("Couldn't insert initial text into text pane."); |
---|
664 | | - } |
---|
665 | | - |
---|
666 | | - return new JTextArea(); // textPane; |
---|
| 1026 | + return new JTextPane(); // textPane; |
---|
667 | 1027 | } |
---|
668 | 1028 | |
---|
669 | 1029 | protected void addStylesToDocument(StyledDocument doc) |
---|
.. | .. |
---|
716 | 1076 | protected static ImageIcon createImageIcon(String path, |
---|
717 | 1077 | String description) |
---|
718 | 1078 | { |
---|
719 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 1079 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
720 | 1080 | if (imgURL != null) |
---|
721 | 1081 | { |
---|
722 | 1082 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
739 | 1099 | { |
---|
740 | 1100 | SetupMaterial(materialPanel); |
---|
741 | 1101 | } |
---|
| 1102 | + |
---|
742 | 1103 | //SetupName(); |
---|
743 | 1104 | //SetupViews(); |
---|
744 | 1105 | } |
---|
.. | .. |
---|
748 | 1109 | // NumberSlider vDivsField; |
---|
749 | 1110 | // JCheckBox endcaps; |
---|
750 | 1111 | JCheckBox liveCB; |
---|
| 1112 | + JCheckBox selectableCB; |
---|
751 | 1113 | JCheckBox hideCB; |
---|
752 | 1114 | JCheckBox link2masterCB; |
---|
753 | 1115 | JCheckBox markCB; |
---|
.. | .. |
---|
755 | 1117 | JCheckBox speedupCB; |
---|
756 | 1118 | JCheckBox rewindCB; |
---|
757 | 1119 | JCheckBox flipVCB; |
---|
| 1120 | + |
---|
| 1121 | + cCheckBox toggleTextureCB; |
---|
| 1122 | + cCheckBox toggleSwitchCB; |
---|
| 1123 | + |
---|
758 | 1124 | JComboBox texresMenu; |
---|
| 1125 | + |
---|
759 | 1126 | JButton resetButton; |
---|
760 | 1127 | JButton stepButton; |
---|
761 | 1128 | JButton stepAllButton; |
---|
.. | .. |
---|
763 | 1130 | JButton slowerButton; |
---|
764 | 1131 | JButton fasterButton; |
---|
765 | 1132 | JButton remarkButton; |
---|
| 1133 | + |
---|
| 1134 | + cGridBag editPanel; |
---|
| 1135 | + cGridBag editCommandsPanel; |
---|
| 1136 | + |
---|
| 1137 | + cGridBag namePanel; |
---|
| 1138 | + cGridBag setupPanel; |
---|
| 1139 | + cGridBag setupPanel2; |
---|
| 1140 | + cGridBag objectCommandsPanel; |
---|
| 1141 | + cGridBag pushPanel; |
---|
| 1142 | + cGridBag fillPanel; |
---|
766 | 1143 | |
---|
767 | | - JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on) |
---|
| 1144 | + JCheckBox AddCheckBox(cGridBag panel, String label, boolean on) |
---|
768 | 1145 | { |
---|
769 | 1146 | JCheckBox cb; |
---|
770 | 1147 | |
---|
771 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
772 | | - oe.aConstraints.gridwidth = 1; // 3; |
---|
773 | | -// oe.aConstraints.weightx = 1; |
---|
774 | | -// oe.aConstraints.anchor = GridBagConstraints.WEST; |
---|
775 | | - oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 1148 | + panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
776 | 1149 | cb.addItemListener(this); |
---|
777 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
778 | | - oe.aConstraints.gridwidth = 1; |
---|
779 | | - oe.aConstraints.gridx += 1; |
---|
780 | 1150 | |
---|
781 | 1151 | return cb; |
---|
782 | 1152 | } |
---|
783 | 1153 | |
---|
784 | | - cButton AddButton(ObjEditor oe, String label) |
---|
| 1154 | + cButton AddButton(cGridBag panel, String label) |
---|
785 | 1155 | { |
---|
786 | 1156 | cButton cb; |
---|
787 | 1157 | |
---|
788 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
789 | | - oe.aConstraints.gridwidth = 1; |
---|
790 | | -// oe.aConstraints.weightx = 1; |
---|
791 | | -// oe.aConstraints.anchor = GridBagConstraints.WEST; |
---|
792 | | - oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); |
---|
| 1158 | + panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); |
---|
793 | 1159 | cb.addActionListener(this); |
---|
794 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
795 | | - oe.aConstraints.gridwidth = 1; |
---|
796 | | - oe.aConstraints.gridx += 1; |
---|
797 | 1160 | |
---|
798 | 1161 | return cb; |
---|
799 | 1162 | } |
---|
800 | 1163 | |
---|
801 | | - JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item) |
---|
| 1164 | + JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item) |
---|
802 | 1165 | { |
---|
803 | 1166 | JComboBox combo; |
---|
804 | 1167 | |
---|
805 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
806 | | - oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
807 | | - oe.aConstraints.gridx += 1; |
---|
| 1168 | + panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
808 | 1169 | combo.addActionListener(this); |
---|
809 | 1170 | |
---|
810 | 1171 | return combo; |
---|
811 | 1172 | } |
---|
812 | 1173 | |
---|
813 | | - NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow) |
---|
| 1174 | + cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow) |
---|
814 | 1175 | { |
---|
815 | | - NumberSlider combo; |
---|
| 1176 | + cGridBag control = new cGridBag(); |
---|
| 1177 | + |
---|
| 1178 | + cNumberSlider combo; |
---|
816 | 1179 | |
---|
817 | 1180 | JLabel jlabel = new JLabel(label); |
---|
818 | | - |
---|
819 | | - aConstraints.fill = GridBagConstraints.VERTICAL; |
---|
820 | 1181 | jlabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
821 | | - aConstraints.gridwidth = 1; |
---|
822 | | - ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
823 | | - aConstraints.gridx += 1; |
---|
824 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
825 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
826 | | - ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
827 | | - aConstraints.gridx += 1; |
---|
828 | | - aConstraints.gridwidth = 1; |
---|
829 | | - |
---|
| 1182 | + control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 1183 | + control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
830 | 1184 | combo.setFloat(current); |
---|
831 | | - |
---|
832 | | - combo.label = jlabel; |
---|
833 | | - |
---|
834 | | - combo.addChangeListener(this); |
---|
835 | | - |
---|
836 | | - return combo; |
---|
| 1185 | + |
---|
| 1186 | + panel.add(control); |
---|
| 1187 | + |
---|
| 1188 | + return control; |
---|
837 | 1189 | } |
---|
838 | 1190 | |
---|
839 | | - NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current) |
---|
| 1191 | + cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current) |
---|
840 | 1192 | { |
---|
841 | | - NumberSlider combo; |
---|
| 1193 | + cGridBag control = new cGridBag(); |
---|
| 1194 | + |
---|
| 1195 | + cNumberSlider combo; |
---|
842 | 1196 | |
---|
843 | 1197 | JLabel jlabel = new JLabel(label); |
---|
844 | | - |
---|
845 | | - aConstraints.fill = GridBagConstraints.VERTICAL; |
---|
846 | 1198 | jlabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
847 | | - aConstraints.gridwidth = 2; |
---|
848 | | - ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
849 | | - aConstraints.gridx += 1; |
---|
850 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
851 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
852 | | - ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
853 | | - aConstraints.gridx += 1; |
---|
854 | | - aConstraints.gridwidth = 1; |
---|
855 | | - |
---|
| 1199 | + control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 1200 | + control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
856 | 1201 | combo.setInteger(current); |
---|
857 | 1202 | |
---|
858 | | - combo.label = jlabel; |
---|
859 | | - |
---|
860 | | - combo.addChangeListener(this); |
---|
861 | | - |
---|
862 | | - return combo; |
---|
| 1203 | + panel.add(control); |
---|
| 1204 | + |
---|
| 1205 | + return control; |
---|
863 | 1206 | } |
---|
864 | 1207 | |
---|
865 | | - JTextArea AddText(JPanel ctrlPanel, String name) |
---|
| 1208 | + JTextArea AddText(cGridBag ctrlPanel, String name) |
---|
866 | 1209 | { |
---|
867 | 1210 | JTextArea text; |
---|
868 | 1211 | |
---|
869 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
870 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
871 | | - ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 1212 | + ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
872 | 1213 | text.addCaretListener(this); |
---|
873 | | - aConstraints.gridx += 1; |
---|
874 | | - aConstraints.gridwidth = 1; |
---|
875 | 1214 | |
---|
876 | 1215 | return text; |
---|
877 | 1216 | } |
---|
.. | .. |
---|
901 | 1240 | objEditor.ctrlPanel.remove(j); |
---|
902 | 1241 | } |
---|
903 | 1242 | |
---|
| 1243 | + void Remove(cNumberSlider j) |
---|
| 1244 | + { |
---|
| 1245 | + j.removeChangeListener(this); |
---|
| 1246 | + //objEditor.ctrlPanel.remove(j.label); |
---|
| 1247 | + objEditor.ctrlPanel.remove(j); |
---|
| 1248 | + } |
---|
| 1249 | + |
---|
904 | 1250 | /* |
---|
905 | 1251 | */ |
---|
906 | | - void Return() // ObjEditor oe) |
---|
| 1252 | + void Return0() // ObjEditor oe) |
---|
907 | 1253 | { |
---|
908 | 1254 | aConstraints.gridy += 1; |
---|
909 | 1255 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
958 | 1304 | |
---|
959 | 1305 | void SetupUI2(ObjEditor oe) |
---|
960 | 1306 | { |
---|
961 | | -// oe.aConstraints.weightx = 0; |
---|
962 | | -// oe.aConstraints.weighty = 0; |
---|
963 | | -// oe.aConstraints.gridx = 0; |
---|
964 | | -// oe.aConstraints.gridy = 0; |
---|
965 | | - SetupName(oe); |
---|
| 1307 | + //SetupName(oe); |
---|
966 | 1308 | |
---|
967 | | - if (!GroupEditor.allparams) |
---|
| 1309 | + namePanel = new cGridBag(); |
---|
| 1310 | + |
---|
| 1311 | + //if (copy.pinned) |
---|
| 1312 | + { |
---|
| 1313 | + pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF); |
---|
| 1314 | + pinButton.setSelected(copy.pinned); |
---|
| 1315 | + cGridBag t = new cGridBag(); |
---|
| 1316 | + t.preferredWidth = 2; |
---|
| 1317 | + t.add(pinButton); |
---|
| 1318 | + namePanel.add(t); |
---|
| 1319 | + |
---|
| 1320 | + pinButton.addItemListener(this); |
---|
| 1321 | + } |
---|
| 1322 | + |
---|
| 1323 | + nameField = AddText(namePanel, copy.GetName()); |
---|
| 1324 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
| 1325 | + oe.ctrlPanel.add(namePanel); |
---|
| 1326 | + |
---|
| 1327 | + oe.ctrlPanel.Return(); |
---|
| 1328 | + |
---|
| 1329 | + if (!allparams) |
---|
968 | 1330 | return; |
---|
969 | 1331 | |
---|
970 | | - liveCB = AddCheckBox(oe, "Live", copy.live); |
---|
971 | | - link2masterCB = AddCheckBox(oe, "Supp", copy.link2master); |
---|
972 | | - hideCB = AddCheckBox(oe, "Hide", copy.hide); |
---|
| 1332 | + setupPanel = new cGridBag().setVertical(false); |
---|
| 1333 | + |
---|
| 1334 | + liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
| 1335 | + liveCB.setToolTipText("Animate object"); |
---|
| 1336 | + markCB = AddCheckBox(setupPanel, "Anim", copy.marked); |
---|
| 1337 | + markCB.setToolTipText("Set target transform"); |
---|
| 1338 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1339 | + selectableCB.setToolTipText("Make object selectable"); |
---|
973 | 1340 | // Return(); |
---|
974 | | - markCB = AddCheckBox(oe, "Mark", copy.marked); |
---|
975 | | - rewindCB = AddCheckBox(oe, "Rew", copy.rewind); |
---|
976 | | - randomCB = AddCheckBox(oe, "Rand", copy.random); |
---|
977 | | - Return(); |
---|
978 | | - resetButton = AddButton(oe, "Reset"); |
---|
979 | | - stepButton = AddButton(oe, "Step"); |
---|
| 1341 | + |
---|
| 1342 | + hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 1343 | + hideCB.setToolTipText("Hide object"); |
---|
| 1344 | + |
---|
| 1345 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
| 1346 | + |
---|
| 1347 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1348 | + |
---|
| 1349 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
| 1350 | + rewindCB.setToolTipText("Rewind animation"); |
---|
| 1351 | + |
---|
| 1352 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1353 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
| 1354 | + |
---|
| 1355 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1356 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1357 | + |
---|
| 1358 | + if (Globals.ADVANCED) |
---|
| 1359 | + { |
---|
| 1360 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
| 1361 | + speedupCB.setToolTipText("Option motion capture"); |
---|
| 1362 | + } |
---|
| 1363 | + |
---|
| 1364 | + oe.ctrlPanel.add(setupPanel); |
---|
| 1365 | + oe.ctrlPanel.Return(); |
---|
| 1366 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1367 | + oe.ctrlPanel.Return(); |
---|
| 1368 | + |
---|
| 1369 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
| 1370 | + |
---|
| 1371 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
| 1372 | + resetButton.setToolTipText("Jump to frame zero"); |
---|
| 1373 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
| 1374 | + stepButton.setToolTipText("Step one frame"); |
---|
980 | 1375 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
981 | 1376 | // stepAllButton = AddButton(oe, "Step All"); |
---|
982 | | - speedupCB = AddCheckBox(oe, "Speed", copy.speedup); |
---|
983 | 1377 | // Return(); |
---|
984 | | - slowerButton = AddButton(oe, "Slow"); |
---|
985 | | - fasterButton = AddButton(oe, "Fast"); |
---|
986 | | - remarkButton = AddButton(oe, "Rem"); |
---|
| 1378 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
| 1379 | + slowerButton.setToolTipText("Decrease animation speed"); |
---|
| 1380 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
| 1381 | + fasterButton.setToolTipText("Increase animation speed"); |
---|
| 1382 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
| 1383 | + remarkButton.setToolTipText("Set the current transform as the target"); |
---|
987 | 1384 | |
---|
988 | | - Return(); |
---|
| 1385 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
| 1386 | + oe.ctrlPanel.Return(); |
---|
989 | 1387 | |
---|
990 | | - normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1); |
---|
991 | | - Return(); |
---|
| 1388 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
| 1389 | + normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
| 1390 | + //Return(); |
---|
| 1391 | + |
---|
| 1392 | + oe.ctrlPanel.Return(); |
---|
992 | 1393 | |
---|
993 | 1394 | // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2); |
---|
994 | 1395 | // ObjEditor.aConstraints.gridx += 1; |
---|
.. | .. |
---|
1083 | 1484 | oe.aConstraints.gridwidth = 1; |
---|
1084 | 1485 | /**/ |
---|
1085 | 1486 | nameField = AddText(oe.ctrlPanel, copy.GetName()); |
---|
1086 | | - Return(); |
---|
| 1487 | + oe.ctrlPanel.Return(); |
---|
1087 | 1488 | |
---|
1088 | 1489 | //ctrlPanel.add(textureButton = new Button("Texture...")); |
---|
1089 | 1490 | //textureButton.setEnabled(false); |
---|
.. | .. |
---|
1141 | 1542 | |
---|
1142 | 1543 | if (cam == null || !(copy.get(0) instanceof cGroup)) |
---|
1143 | 1544 | { |
---|
| 1545 | + if (Globals.DEBUG) |
---|
1144 | 1546 | System.out.println("CREATE CAMERAS"); |
---|
1145 | 1547 | cams = new cTemplate(); |
---|
1146 | 1548 | cams.name = "Cameras"; |
---|
.. | .. |
---|
1185 | 1587 | //JPanel worldPanel = |
---|
1186 | 1588 | // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true); |
---|
1187 | 1589 | //worldPanel.setName("World"); |
---|
1188 | | - centralPanel = new JPanel(new BorderLayout()); |
---|
1189 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1190 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1590 | + centralPanel = new cGridBag(); |
---|
| 1591 | + centralPanel.preferredWidth = 20; |
---|
| 1592 | + |
---|
| 1593 | + if (Globals.ADVANCED) |
---|
| 1594 | + { |
---|
| 1595 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1596 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1191 | 1597 | |
---|
| 1598 | + cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
| 1599 | + cameraPanel.setContinuousLayout(true); |
---|
| 1600 | + cameraPanel.setOneTouchExpandable(true); |
---|
| 1601 | +// cameraPanel.setDividerLocation(0.9); |
---|
| 1602 | +// cameraPanel.setDividerSize(9); |
---|
| 1603 | + cameraPanel.setResizeWeight(1.0); |
---|
| 1604 | + |
---|
| 1605 | + } |
---|
| 1606 | + |
---|
1192 | 1607 | centralPanel.add(cameraView); |
---|
| 1608 | + centralPanel.setFocusable(true); |
---|
1193 | 1609 | //frame.setJMenuBar(timelineMenubar); |
---|
1194 | 1610 | //centralPanel.add(timelinePanel); |
---|
1195 | 1611 | |
---|
.. | .. |
---|
1208 | 1624 | //frontView.object = copy; |
---|
1209 | 1625 | //sideView.object = copy; |
---|
1210 | 1626 | |
---|
1211 | | - XYZPanel = new JPanel(); |
---|
1212 | | - XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); |
---|
| 1627 | + XYZPanel = new cGridBag().setVertical(true); |
---|
| 1628 | + //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); |
---|
1213 | 1629 | |
---|
1214 | | - XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1215 | | - XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1216 | | - XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1630 | + XYZPanel.preferredWidth = 5; |
---|
| 1631 | + XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
| 1632 | + XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
| 1633 | + XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1634 | + //XYZPanel.setName("XYZ"); |
---|
1217 | 1635 | |
---|
1218 | 1636 | /* |
---|
1219 | 1637 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1250 | 1668 | |
---|
1251 | 1669 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1252 | 1670 | //tmp.setName("Edit"); |
---|
1253 | | - objectPanel.add(materialPanel); |
---|
1254 | | - JPanel north = new JPanel(new BorderLayout()); |
---|
1255 | | - north.setName("Edit"); |
---|
1256 | | - north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1257 | | - objectPanel.add(north); |
---|
1258 | | - objectPanel.add(infoPanel); |
---|
| 1671 | + objectPanel.add(toolboxPanel); |
---|
| 1672 | + objectPanel.setIconAt(0, GetIcon("icons/primitives.png")); |
---|
| 1673 | + objectPanel.setToolTipTextAt(0, "Objects & textures"); |
---|
1259 | 1674 | |
---|
| 1675 | + objectPanel.add(materialPanel); |
---|
| 1676 | + objectPanel.setIconAt(1, GetIcon("icons/material.png")); |
---|
| 1677 | + objectPanel.setToolTipTextAt(1, "Material"); |
---|
| 1678 | + |
---|
| 1679 | + objectPanel.add(skyboxPanel); |
---|
| 1680 | + objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
| 1681 | + objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
| 1682 | + |
---|
| 1683 | +// JPanel north = new JPanel(new BorderLayout()); |
---|
| 1684 | +// north.setName("Edit"); |
---|
| 1685 | +// north.add(ctrlPanel, BorderLayout.NORTH); |
---|
| 1686 | +// objectPanel.add(north); |
---|
| 1687 | + objectPanel.add(editPanel); |
---|
| 1688 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1689 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
| 1690 | + |
---|
| 1691 | + objectPanel.add(XYZPanel); |
---|
| 1692 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1693 | + objectPanel.setToolTipTextAt(4, "XYZ/RGB transform"); |
---|
| 1694 | + |
---|
| 1695 | + patchMaterial = true; |
---|
| 1696 | + cameraView.patchMaterial = this; |
---|
| 1697 | + objectPanel.setSelectedIndex(1); |
---|
| 1698 | + |
---|
1260 | 1699 | /* |
---|
1261 | 1700 | aConstraints.gridx = 0; |
---|
1262 | 1701 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1264 | 1703 | aConstraints.gridy += 1; |
---|
1265 | 1704 | aConstraints.gridwidth = 1; |
---|
1266 | 1705 | mainPanel.add(objectPanel, aConstraints); |
---|
1267 | | - */ |
---|
| 1706 | + */ |
---|
1268 | 1707 | |
---|
1269 | 1708 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1270 | 1709 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1275 | 1714 | scrollpane.setWheelScrollingEnabled(true); |
---|
1276 | 1715 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1277 | 1716 | |
---|
1278 | | - /*JTabbedPane*/ scenePanel = new JTabbedPane(); |
---|
1279 | | - scenePanel.add(scrollpane); |
---|
| 1717 | + /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
| 1718 | + scenePanel.preferredWidth = 5; |
---|
| 1719 | + |
---|
| 1720 | + JTabbedPane tabbedPane = new JTabbedPane(); |
---|
| 1721 | + tabbedPane.add(scrollpane); |
---|
1280 | 1722 | |
---|
1281 | | - scenePanel.add(FSPane = new cFileSystemPane(this)); |
---|
1282 | | - |
---|
1283 | | - optionsPanel = new JPanel(new GridBagLayout()); |
---|
| 1723 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1284 | 1724 | |
---|
1285 | 1725 | optionsPanel.setName("Options"); |
---|
1286 | | - scenePanel.add(optionsPanel); |
---|
| 1726 | + |
---|
| 1727 | + AddOptions(optionsPanel); //, aConstraints); |
---|
| 1728 | + |
---|
| 1729 | + tabbedPane.add(optionsPanel); |
---|
| 1730 | + |
---|
| 1731 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1287 | 1732 | |
---|
| 1733 | + scenePanel.add(tabbedPane); |
---|
1288 | 1734 | |
---|
| 1735 | + //if (Globals.ADVANCED) |
---|
| 1736 | +// tabbedPane.add(infoPanel); |
---|
| 1737 | +// tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
| 1738 | +// tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1739 | + |
---|
1289 | 1740 | /* |
---|
1290 | 1741 | cTree jTree = new cTree(null); |
---|
1291 | 1742 | ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
.. | .. |
---|
1318 | 1769 | //bigPanel.setSize(new Dimension(10,10)); |
---|
1319 | 1770 | //bigPanel.add(ctrlPanel); |
---|
1320 | 1771 | //bigPanel.add(gridPanel); |
---|
| 1772 | + /** |
---|
1321 | 1773 | bigThree = new JPanel(); |
---|
1322 | 1774 | //big.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
1323 | 1775 | bigThree.setLayout(new GridBagLayout()); //1,3,5,5)); |
---|
.. | .. |
---|
1341 | 1793 | // aConstraints.gridheight = 3; |
---|
1342 | 1794 | aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
1343 | 1795 | bigThree.add(XYZPanel, aWindowConstraints); |
---|
| 1796 | + /**/ |
---|
1344 | 1797 | |
---|
| 1798 | + bigThree = new cGridBag(); |
---|
| 1799 | + bigThree.addComponent(scenePanel); |
---|
| 1800 | + bigThree.addComponent(centralPanel); |
---|
| 1801 | + //bigThree.addComponent(XYZPanel); |
---|
| 1802 | + |
---|
1345 | 1803 | // // SIDE EFFECT!!! |
---|
1346 | 1804 | // aConstraints.gridx = 0; |
---|
1347 | 1805 | // aConstraints.gridy = 0; |
---|
.. | .. |
---|
1349 | 1807 | // aConstraints.gridheight = 1; |
---|
1350 | 1808 | |
---|
1351 | 1809 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1352 | | - framePanel.setContinuousLayout(true); |
---|
1353 | | - framePanel.setOneTouchExpandable(true); |
---|
1354 | | - framePanel.setDividerLocation(0.8); |
---|
| 1810 | + |
---|
| 1811 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1812 | + new java.beans.PropertyChangeListener() |
---|
| 1813 | + { |
---|
| 1814 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1815 | + { |
---|
| 1816 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1817 | + { |
---|
| 1818 | + if (radio.layout != expandedLayout) |
---|
| 1819 | + { |
---|
| 1820 | + radio.layout = expandedLayout; |
---|
| 1821 | + radio.layout.doClick(); |
---|
| 1822 | + } |
---|
| 1823 | + } |
---|
| 1824 | + } |
---|
| 1825 | + }); |
---|
| 1826 | + |
---|
| 1827 | + framePanel.setContinuousLayout(false); |
---|
| 1828 | + framePanel.setOneTouchExpandable(false); |
---|
| 1829 | + //.setDividerLocation(0.8); |
---|
1355 | 1830 | //framePanel.setDividerSize(15); |
---|
1356 | 1831 | //framePanel.setResizeWeight(0.15); |
---|
1357 | 1832 | framePanel.setName("Frame"); |
---|
1358 | 1833 | |
---|
1359 | 1834 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1360 | 1835 | /**/ |
---|
1361 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1836 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1362 | 1837 | //worldPane.add(bigPanel); |
---|
1363 | 1838 | //worldPane.add(worldPanel); |
---|
1364 | 1839 | /**/ |
---|
1365 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 1840 | + //frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 1841 | + frame.add(/*"Center",*/framePanel); |
---|
1366 | 1842 | //frame.getContentPane().add(/*"Center",*/ worldPane); |
---|
1367 | 1843 | |
---|
1368 | 1844 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1369 | 1845 | |
---|
1370 | | - frame.setSize(1024, 768); |
---|
1371 | | - frame.show(); |
---|
1372 | | - |
---|
| 1846 | + frame.setSize(1280, 860); |
---|
| 1847 | + |
---|
| 1848 | + cameraView.requestFocusInWindow(); |
---|
| 1849 | + |
---|
1373 | 1850 | gridPanel.setDividerLocation(1.0); |
---|
| 1851 | + |
---|
| 1852 | + frame.validate(); |
---|
| 1853 | + |
---|
| 1854 | + frame.setVisible(true); |
---|
1374 | 1855 | |
---|
1375 | 1856 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1376 | 1857 | frame.addWindowListener(new WindowAdapter() |
---|
1377 | 1858 | { |
---|
1378 | | - |
---|
1379 | 1859 | public void windowClosing(WindowEvent e) |
---|
1380 | 1860 | { |
---|
1381 | 1861 | Close(); |
---|
.. | .. |
---|
1383 | 1863 | }); |
---|
1384 | 1864 | } |
---|
1385 | 1865 | |
---|
| 1866 | + void AddOptions(cGridBag panel) //, GridBagConstraints constraints) |
---|
| 1867 | + { |
---|
| 1868 | + } |
---|
| 1869 | + |
---|
1386 | 1870 | JTree GetTree() |
---|
1387 | 1871 | { |
---|
1388 | 1872 | return objEditor.jTree; |
---|
.. | .. |
---|
1394 | 1878 | ctrlPanel.removeAll(); |
---|
1395 | 1879 | } |
---|
1396 | 1880 | |
---|
1397 | | - void SetupMaterial(JPanel ctrlPanel) |
---|
| 1881 | + void SetupMaterial(cGridBag materialpanel) |
---|
1398 | 1882 | { |
---|
1399 | | - aConstraints.weighty = 0; |
---|
1400 | | - //aConstraints.weightx = 1; |
---|
1401 | | - /* |
---|
| 1883 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1884 | + |
---|
| 1885 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1886 | + skin.setToolTipText("Skin"); |
---|
| 1887 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1888 | + { |
---|
| 1889 | + public void mouseClicked(MouseEvent e) |
---|
| 1890 | + { |
---|
| 1891 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1892 | + cMaterial material = object.material; |
---|
| 1893 | + |
---|
| 1894 | + // Skin |
---|
| 1895 | + colorField.setFloat(material.color); |
---|
| 1896 | + float saturation = material.modulation; |
---|
| 1897 | + |
---|
| 1898 | + if (!cameraView.Skinshader) |
---|
| 1899 | + { |
---|
| 1900 | + saturation /= 1.5; |
---|
| 1901 | + } |
---|
| 1902 | + |
---|
| 1903 | + saturationField.setFloat(saturation); |
---|
| 1904 | + |
---|
| 1905 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1906 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1907 | + diffusenessField.setFloat(material.factor); |
---|
| 1908 | + shininessField.setFloat(material.shininess); |
---|
| 1909 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1910 | + diffuseField.setFloat(material.diffuse); |
---|
| 1911 | + specularField.setFloat(material.specular); |
---|
| 1912 | + |
---|
| 1913 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1914 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1915 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1916 | + |
---|
| 1917 | + materialtouched = true; |
---|
| 1918 | + applySelf(); |
---|
| 1919 | + } |
---|
| 1920 | + }); |
---|
| 1921 | + presetpanel.add(skin); |
---|
| 1922 | + |
---|
| 1923 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF); |
---|
| 1924 | + lambert.setToolTipText("Diffuse"); |
---|
| 1925 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 1926 | + { |
---|
| 1927 | + public void mouseClicked(MouseEvent e) |
---|
| 1928 | + { |
---|
| 1929 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 1930 | + cMaterial material = object.material; |
---|
| 1931 | + |
---|
| 1932 | + diffusenessField.setFloat(material.factor); |
---|
| 1933 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1934 | + |
---|
| 1935 | + materialtouched = true; |
---|
| 1936 | + applySelf(); |
---|
| 1937 | + } |
---|
| 1938 | + }); |
---|
| 1939 | + presetpanel.add(lambert); |
---|
| 1940 | + |
---|
| 1941 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF); |
---|
| 1942 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 1943 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 1944 | + { |
---|
| 1945 | + public void mouseClicked(MouseEvent e) |
---|
| 1946 | + { |
---|
| 1947 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 1948 | + cMaterial material = object.material; |
---|
| 1949 | + |
---|
| 1950 | + diffusenessField.setFloat(material.factor); |
---|
| 1951 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1952 | + |
---|
| 1953 | + materialtouched = true; |
---|
| 1954 | + applySelf(); |
---|
| 1955 | + } |
---|
| 1956 | + }); |
---|
| 1957 | + presetpanel.add(diffuse2); |
---|
| 1958 | + |
---|
| 1959 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF); |
---|
| 1960 | + diffusemoon.setToolTipText("Moon"); |
---|
| 1961 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 1962 | + { |
---|
| 1963 | + public void mouseClicked(MouseEvent e) |
---|
| 1964 | + { |
---|
| 1965 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 1966 | + cMaterial material = object.material; |
---|
| 1967 | + |
---|
| 1968 | + diffusenessField.setFloat(material.factor); |
---|
| 1969 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1970 | + |
---|
| 1971 | + materialtouched = true; |
---|
| 1972 | + applySelf(); |
---|
| 1973 | + } |
---|
| 1974 | + }); |
---|
| 1975 | + presetpanel.add(diffusemoon); |
---|
| 1976 | + |
---|
| 1977 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF); |
---|
| 1978 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 1979 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 1980 | + { |
---|
| 1981 | + public void mouseClicked(MouseEvent e) |
---|
| 1982 | + { |
---|
| 1983 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 1984 | + cMaterial material = object.material; |
---|
| 1985 | + |
---|
| 1986 | + diffusenessField.setFloat(material.factor); |
---|
| 1987 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1988 | + |
---|
| 1989 | + materialtouched = true; |
---|
| 1990 | + applySelf(); |
---|
| 1991 | + } |
---|
| 1992 | + }); |
---|
| 1993 | + presetpanel.add(diffusemoon2); |
---|
| 1994 | + |
---|
| 1995 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF); |
---|
| 1996 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 1997 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 1998 | + { |
---|
| 1999 | + public void mouseClicked(MouseEvent e) |
---|
| 2000 | + { |
---|
| 2001 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 2002 | + cMaterial material = object.material; |
---|
| 2003 | + |
---|
| 2004 | + diffusenessField.setFloat(material.factor); |
---|
| 2005 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2006 | + |
---|
| 2007 | + materialtouched = true; |
---|
| 2008 | + applySelf(); |
---|
| 2009 | + } |
---|
| 2010 | + }); |
---|
| 2011 | + presetpanel.add(diffusemoon3); |
---|
| 2012 | + |
---|
| 2013 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF); |
---|
| 2014 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 2015 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 2016 | + { |
---|
| 2017 | + public void mouseClicked(MouseEvent e) |
---|
| 2018 | + { |
---|
| 2019 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 2020 | + cMaterial material = object.material; |
---|
| 2021 | + |
---|
| 2022 | + sheenField.setFloat(material.sheen); |
---|
| 2023 | + |
---|
| 2024 | + materialtouched = true; |
---|
| 2025 | + applySelf(); |
---|
| 2026 | + } |
---|
| 2027 | + }); |
---|
| 2028 | + presetpanel.add(diffusesheen); |
---|
| 2029 | + |
---|
| 2030 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 2031 | + rough.setToolTipText("Rough metal"); |
---|
| 2032 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2033 | + { |
---|
| 2034 | + public void mouseClicked(MouseEvent e) |
---|
| 2035 | + { |
---|
| 2036 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2037 | + cMaterial material = object.material; |
---|
| 2038 | + |
---|
| 2039 | + shininessField.setFloat(material.shininess); |
---|
| 2040 | + velvetField.setFloat(material.velvet); |
---|
| 2041 | + |
---|
| 2042 | + materialtouched = true; |
---|
| 2043 | + applySelf(); |
---|
| 2044 | + } |
---|
| 2045 | + }); |
---|
| 2046 | + presetpanel.add(rough); |
---|
| 2047 | + |
---|
| 2048 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF); |
---|
| 2049 | + rough2.setToolTipText("Medium metal"); |
---|
| 2050 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2051 | + { |
---|
| 2052 | + public void mouseClicked(MouseEvent e) |
---|
| 2053 | + { |
---|
| 2054 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2055 | + cMaterial material = object.material; |
---|
| 2056 | + |
---|
| 2057 | + shininessField.setFloat(material.shininess); |
---|
| 2058 | + lightareaField.setFloat(material.lightarea); |
---|
| 2059 | + |
---|
| 2060 | + materialtouched = true; |
---|
| 2061 | + applySelf(); |
---|
| 2062 | + } |
---|
| 2063 | + }); |
---|
| 2064 | + presetpanel.add(rough2); |
---|
| 2065 | + |
---|
| 2066 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF); |
---|
| 2067 | + shini0.setToolTipText("Shiny"); |
---|
| 2068 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2069 | + { |
---|
| 2070 | + public void mouseClicked(MouseEvent e) |
---|
| 2071 | + { |
---|
| 2072 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2073 | + cMaterial material = object.material; |
---|
| 2074 | + |
---|
| 2075 | + shininessField.setFloat(material.shininess); |
---|
| 2076 | + lightareaField.setFloat(material.lightarea); |
---|
| 2077 | + |
---|
| 2078 | + materialtouched = true; |
---|
| 2079 | + applySelf(); |
---|
| 2080 | + } |
---|
| 2081 | + }); |
---|
| 2082 | + presetpanel.add(shini0); |
---|
| 2083 | + |
---|
| 2084 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF); |
---|
| 2085 | + shini1.setToolTipText("Shiny2"); |
---|
| 2086 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2087 | + { |
---|
| 2088 | + public void mouseClicked(MouseEvent e) |
---|
| 2089 | + { |
---|
| 2090 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2091 | + cMaterial material = object.material; |
---|
| 2092 | + |
---|
| 2093 | + shininessField.setFloat(material.shininess); |
---|
| 2094 | + lightareaField.setFloat(material.lightarea); |
---|
| 2095 | + |
---|
| 2096 | + materialtouched = true; |
---|
| 2097 | + applySelf(); |
---|
| 2098 | + } |
---|
| 2099 | + }); |
---|
| 2100 | + presetpanel.add(shini1); |
---|
| 2101 | + |
---|
| 2102 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF); |
---|
| 2103 | + shini2.setToolTipText("Shiny3"); |
---|
| 2104 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2105 | + { |
---|
| 2106 | + public void mouseClicked(MouseEvent e) |
---|
| 2107 | + { |
---|
| 2108 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2109 | + cMaterial material = object.material; |
---|
| 2110 | + |
---|
| 2111 | + shininessField.setFloat(material.shininess); |
---|
| 2112 | + lightareaField.setFloat(material.lightarea); |
---|
| 2113 | + |
---|
| 2114 | + materialtouched = true; |
---|
| 2115 | + applySelf(); |
---|
| 2116 | + } |
---|
| 2117 | + }); |
---|
| 2118 | + presetpanel.add(shini2); |
---|
| 2119 | + |
---|
| 2120 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF); |
---|
| 2121 | + aniso.setToolTipText("AnisoU"); |
---|
| 2122 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2123 | + { |
---|
| 2124 | + public void mouseClicked(MouseEvent e) |
---|
| 2125 | + { |
---|
| 2126 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2127 | + cMaterial material = object.material; |
---|
| 2128 | + |
---|
| 2129 | + anisoField.setFloat(material.aniso); |
---|
| 2130 | + anisoVField.setFloat(material.anisoV); |
---|
| 2131 | + |
---|
| 2132 | + materialtouched = true; |
---|
| 2133 | + applySelf(); |
---|
| 2134 | + } |
---|
| 2135 | + }); |
---|
| 2136 | + presetpanel.add(aniso); |
---|
| 2137 | + |
---|
| 2138 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF); |
---|
| 2139 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2140 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2141 | + { |
---|
| 2142 | + public void mouseClicked(MouseEvent e) |
---|
| 2143 | + { |
---|
| 2144 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2145 | + cMaterial material = object.material; |
---|
| 2146 | + |
---|
| 2147 | + anisoField.setFloat(material.aniso); |
---|
| 2148 | + anisoVField.setFloat(material.anisoV); |
---|
| 2149 | + |
---|
| 2150 | + materialtouched = true; |
---|
| 2151 | + applySelf(); |
---|
| 2152 | + } |
---|
| 2153 | + }); |
---|
| 2154 | + presetpanel.add(aniso2); |
---|
| 2155 | + |
---|
| 2156 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF); |
---|
| 2157 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2158 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2159 | + { |
---|
| 2160 | + public void mouseClicked(MouseEvent e) |
---|
| 2161 | + { |
---|
| 2162 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2163 | + cMaterial material = object.material; |
---|
| 2164 | + |
---|
| 2165 | + anisoField.setFloat(material.aniso); |
---|
| 2166 | + anisoVField.setFloat(material.anisoV); |
---|
| 2167 | + |
---|
| 2168 | + materialtouched = true; |
---|
| 2169 | + applySelf(); |
---|
| 2170 | + } |
---|
| 2171 | + }); |
---|
| 2172 | + presetpanel.add(aniso3); |
---|
| 2173 | + |
---|
| 2174 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF); |
---|
| 2175 | + velvet0.setToolTipText("Velvet"); |
---|
| 2176 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2177 | + { |
---|
| 2178 | + public void mouseClicked(MouseEvent e) |
---|
| 2179 | + { |
---|
| 2180 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2181 | + cMaterial material = object.material; |
---|
| 2182 | + |
---|
| 2183 | + diffusenessField.setFloat(material.factor); |
---|
| 2184 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2185 | + sheenField.setFloat(material.sheen); |
---|
| 2186 | + shininessField.setFloat(material.shininess); |
---|
| 2187 | + velvetField.setFloat(material.velvet); |
---|
| 2188 | + shiftField.setFloat(material.shift); |
---|
| 2189 | + |
---|
| 2190 | + materialtouched = true; |
---|
| 2191 | + applySelf(); |
---|
| 2192 | + } |
---|
| 2193 | + }); |
---|
| 2194 | + presetpanel.add(velvet0); |
---|
| 2195 | + |
---|
| 2196 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF); |
---|
| 2197 | + bump0.setToolTipText("Bump texture"); |
---|
| 2198 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2199 | + { |
---|
| 2200 | + public void mouseClicked(MouseEvent e) |
---|
| 2201 | + { |
---|
| 2202 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2203 | + cMaterial material = object.material; |
---|
| 2204 | + |
---|
| 2205 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2206 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2207 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2208 | + |
---|
| 2209 | + materialtouched = true; |
---|
| 2210 | + applySelf(); |
---|
| 2211 | + } |
---|
| 2212 | + }); |
---|
| 2213 | + presetpanel.add(bump0); |
---|
| 2214 | + |
---|
| 2215 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF); |
---|
| 2216 | + borderShader.setToolTipText("Border fade"); |
---|
| 2217 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2218 | + { |
---|
| 2219 | + public void mouseClicked(MouseEvent e) |
---|
| 2220 | + { |
---|
| 2221 | + borderfadeField.setFloat(0.5); |
---|
| 2222 | + opacityField.setFloat(0.75); |
---|
| 2223 | + |
---|
| 2224 | + materialtouched = true; |
---|
| 2225 | + applySelf(); |
---|
| 2226 | + } |
---|
| 2227 | + }); |
---|
| 2228 | + presetpanel.add(borderShader); |
---|
| 2229 | + |
---|
| 2230 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF); |
---|
| 2231 | + halo.setToolTipText("Halo"); |
---|
| 2232 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2233 | + { |
---|
| 2234 | + public void mouseClicked(MouseEvent e) |
---|
| 2235 | + { |
---|
| 2236 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2237 | + cMaterial material = object.material; |
---|
| 2238 | + |
---|
| 2239 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2240 | + |
---|
| 2241 | + materialtouched = true; |
---|
| 2242 | + applySelf(); |
---|
| 2243 | + } |
---|
| 2244 | + }); |
---|
| 2245 | + presetpanel.add(halo); |
---|
| 2246 | + |
---|
| 2247 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF); |
---|
| 2248 | + candle.setToolTipText("Candle"); |
---|
| 2249 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2250 | + { |
---|
| 2251 | + public void mouseClicked(MouseEvent e) |
---|
| 2252 | + { |
---|
| 2253 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2254 | + cMaterial material = object.material; |
---|
| 2255 | + |
---|
| 2256 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2257 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2258 | + ambientField.setFloat(material.ambient); |
---|
| 2259 | + specularField.setFloat(material.specular); |
---|
| 2260 | + lightareaField.setFloat(material.lightarea); |
---|
| 2261 | + shininessField.setFloat(material.shininess); |
---|
| 2262 | + |
---|
| 2263 | + materialtouched = true; |
---|
| 2264 | + applySelf(); |
---|
| 2265 | + } |
---|
| 2266 | + }); |
---|
| 2267 | + presetpanel.add(candle); |
---|
| 2268 | + |
---|
| 2269 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF); |
---|
| 2270 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2271 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2272 | + { |
---|
| 2273 | + public void mouseClicked(MouseEvent e) |
---|
| 2274 | + { |
---|
| 2275 | + diffuseField.setFloat(0.001); |
---|
| 2276 | + ambientField.setFloat(0.001); |
---|
| 2277 | + cameraField.setFloat(0.001); |
---|
| 2278 | + specularField.setFloat(0.001); |
---|
| 2279 | + fakedepthField.setFloat(0.001); |
---|
| 2280 | + opacityField.setFloat(0.6); |
---|
| 2281 | + |
---|
| 2282 | + materialtouched = true; |
---|
| 2283 | + applySelf(); |
---|
| 2284 | + } |
---|
| 2285 | + }); |
---|
| 2286 | + presetpanel.add(shadowShader); |
---|
| 2287 | + |
---|
| 2288 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2289 | + |
---|
| 2290 | + presetpanel.preferredWidth = 1; |
---|
| 2291 | + |
---|
| 2292 | + materialpanel.add(presetpanel); |
---|
| 2293 | + materialpanel.add(panel); |
---|
| 2294 | + |
---|
| 2295 | + panel.preferredWidth = 8; |
---|
| 2296 | + |
---|
| 2297 | + /* |
---|
1402 | 2298 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1403 | 2299 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1404 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1405 | | - aConstraints.gridx += 1; |
---|
1406 | | - */ |
---|
| 2300 | + */ |
---|
1407 | 2301 | |
---|
1408 | | - aConstraints.gridwidth = 1; |
---|
1409 | | - ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints); |
---|
1410 | | - aConstraints.gridx += 1; |
---|
1411 | | - aConstraints.weighty = 0; |
---|
1412 | | - aConstraints.gridwidth = 1; |
---|
| 2302 | + cGridBag editBar = new cGridBag().setVertical(false); |
---|
| 2303 | + |
---|
| 2304 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2305 | + createMaterialButton.setToolTipText("Create material"); |
---|
1413 | 2306 | |
---|
1414 | 2307 | /* |
---|
1415 | 2308 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1416 | | - aConstraints.gridx += 1; |
---|
1417 | | - aConstraints.weighty = 0; |
---|
1418 | | - aConstraints.gridwidth = 1; |
---|
1419 | 2309 | */ |
---|
1420 | 2310 | |
---|
1421 | | - ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints); |
---|
1422 | | - aConstraints.gridx += 1; |
---|
| 2311 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2312 | + clearMaterialButton.setToolTipText("Clear material"); |
---|
| 2313 | + |
---|
| 2314 | + if (Globals.ADVANCED) |
---|
| 2315 | + { |
---|
| 2316 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2317 | + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
| 2318 | + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 2319 | + } |
---|
1423 | 2320 | |
---|
1424 | | - ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints); |
---|
1425 | | - |
---|
1426 | | - aConstraints.gridx += 1; |
---|
1427 | | - |
---|
1428 | | - ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints); |
---|
1429 | | - |
---|
1430 | | - aConstraints.gridx += 1; |
---|
1431 | | - |
---|
1432 | | - ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints); |
---|
1433 | | - |
---|
1434 | | - aConstraints.gridx = 0; |
---|
1435 | | - aConstraints.gridy += 1; |
---|
1436 | | - aConstraints.weighty = 0; |
---|
1437 | | - aConstraints.gridwidth = 1; |
---|
| 2321 | + editBar.preferredHeight = 15; |
---|
| 2322 | + |
---|
| 2323 | + panel.add(editBar); |
---|
| 2324 | + |
---|
1438 | 2325 | /**/ |
---|
1439 | 2326 | //aConstraints.weighty = 0; |
---|
1440 | 2327 | ////aConstraints.weightx = 1; |
---|
1441 | 2328 | //aConstraints.weighty = 1; |
---|
1442 | 2329 | aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; |
---|
1443 | 2330 | //aConstraints.gridx += 1; |
---|
1444 | | - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); |
---|
1445 | | - aConstraints.weighty = 0; |
---|
1446 | | - aConstraints.gridx = 0; |
---|
1447 | | - aConstraints.gridy += 1; |
---|
1448 | | - aConstraints.gridwidth = 1; |
---|
| 2331 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1449 | 2332 | |
---|
1450 | | - ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints); |
---|
1451 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1452 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1453 | | - aConstraints.gridx += 1; |
---|
1454 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1455 | | - //aConstraints.weightx = 0; |
---|
1456 | | - ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints); |
---|
1457 | | - aConstraints.gridx = 0; |
---|
1458 | | - aConstraints.gridy += 1; |
---|
1459 | | - aConstraints.gridwidth = 1; |
---|
| 2333 | + cGridBag colorSection = new cGridBag().setVertical(true); |
---|
1460 | 2334 | |
---|
1461 | | - ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints); |
---|
1462 | | - modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1463 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1464 | | - aConstraints.gridx += 1; |
---|
1465 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1466 | | - ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints); |
---|
1467 | | - aConstraints.gridx = 0; |
---|
1468 | | - aConstraints.gridy += 1; |
---|
1469 | | - aConstraints.gridwidth = 1; |
---|
| 2335 | + cGridBag huepanel = new cGridBag(); |
---|
| 2336 | + cGridBag huelabel = new cGridBag(); |
---|
| 2337 | + cLabel hue = GetLabel("icons/hue.png", false); |
---|
| 2338 | + hue.fit = true; |
---|
| 2339 | + |
---|
| 2340 | + hue.addMouseListener(new MouseAdapter() |
---|
| 2341 | + { |
---|
| 2342 | + public void mousePressed(MouseEvent e) |
---|
| 2343 | + { |
---|
| 2344 | + int x = e.getX(); |
---|
| 2345 | + |
---|
| 2346 | + colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth()); |
---|
| 2347 | + } |
---|
| 2348 | + }); |
---|
| 2349 | + |
---|
| 2350 | + huelabel.add(hue); |
---|
| 2351 | + huelabel.preferredWidth = 20; |
---|
| 2352 | + huepanel.add(new cGridBag()); // Label |
---|
| 2353 | + huepanel.add(huelabel); // Field/slider |
---|
| 2354 | + |
---|
| 2355 | + huepanel.preferredHeight = 7; |
---|
1470 | 2356 | |
---|
1471 | | - ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints); |
---|
1472 | | - textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1473 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1474 | | - aConstraints.gridx += 1; |
---|
1475 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1476 | | - ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints); |
---|
1477 | | - aConstraints.gridx = 0; |
---|
1478 | | - aConstraints.gridy += 1; |
---|
1479 | | - aConstraints.gridwidth = 1; |
---|
| 2357 | + colorSection.add(huepanel); |
---|
| 2358 | + |
---|
| 2359 | + cGridBag color = new cGridBag(); |
---|
| 2360 | + |
---|
| 2361 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 2362 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2363 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1480 | 2364 | |
---|
1481 | | - ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints); |
---|
1482 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1483 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1484 | | - aConstraints.gridx += 1; |
---|
1485 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1486 | | - ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints); |
---|
1487 | | - aConstraints.gridx = 0; |
---|
1488 | | - aConstraints.gridy += 1; |
---|
1489 | | - aConstraints.gridwidth = 1; |
---|
| 2365 | + //colorField.preferredWidth = 200; |
---|
| 2366 | + colorSection.add(color); |
---|
1490 | 2367 | |
---|
1491 | | - ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints); |
---|
1492 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1493 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1494 | | - aConstraints.gridx += 1; |
---|
1495 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1496 | | - ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints); |
---|
1497 | | - aConstraints.gridx = 0; |
---|
1498 | | - aConstraints.gridy += 1; |
---|
1499 | | - aConstraints.gridwidth = 1; |
---|
| 2368 | + cGridBag modulation = new cGridBag(); |
---|
| 2369 | + modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
| 2370 | + modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2371 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2372 | + colorSection.add(modulation); |
---|
1500 | 2373 | |
---|
1501 | | - ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints); |
---|
1502 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1503 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1504 | | - aConstraints.gridx += 1; |
---|
1505 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1506 | | - ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1507 | | - aConstraints.gridx = 0; |
---|
1508 | | - aConstraints.gridy += 1; |
---|
1509 | | - aConstraints.gridwidth = 1; |
---|
| 2374 | + cGridBag opacity = new cGridBag(); |
---|
| 2375 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 2376 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2377 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2378 | + colorSection.add(opacity); |
---|
1510 | 2379 | |
---|
1511 | | - //aConstraints.weighty = 1; |
---|
1512 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; |
---|
1513 | | - //aConstraints.gridx += 1; |
---|
1514 | | - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); |
---|
1515 | | - aConstraints.weighty = 0; |
---|
1516 | | - aConstraints.gridx = 0; |
---|
1517 | | - aConstraints.gridy += 1; |
---|
1518 | | - aConstraints.gridwidth = 1; |
---|
| 2380 | + colorSection.add(GetSeparator()); |
---|
| 2381 | + |
---|
| 2382 | + cGridBag texture = new cGridBag(); |
---|
| 2383 | + texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
| 2384 | + textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2385 | + texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2386 | + colorSection.add(texture); |
---|
1519 | 2387 | |
---|
1520 | | - ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints); |
---|
1521 | | - diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1522 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1523 | | - aConstraints.gridx += 1; |
---|
1524 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1525 | | - ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1526 | | - aConstraints.gridx = 0; |
---|
1527 | | - aConstraints.gridy += 1; |
---|
1528 | | - aConstraints.gridwidth = 1; |
---|
| 2388 | + panel.add(GetSeparator()); |
---|
| 2389 | + |
---|
| 2390 | + panel.add(colorSection); |
---|
| 2391 | + |
---|
| 2392 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
| 2393 | + |
---|
| 2394 | + cGridBag diffuseSection = new cGridBag().setVertical(true); |
---|
| 2395 | + |
---|
| 2396 | + cGridBag diffuse = new cGridBag(); |
---|
| 2397 | + diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints); |
---|
| 2398 | + diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2399 | + diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2400 | + diffuseSection.add(diffuse); |
---|
1529 | 2401 | |
---|
1530 | | - ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints); |
---|
1531 | | - diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1532 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1533 | | - aConstraints.gridx += 1; |
---|
1534 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1535 | | - ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1536 | | - aConstraints.gridx = 0; |
---|
1537 | | - aConstraints.gridy += 1; |
---|
1538 | | - aConstraints.gridwidth = 1; |
---|
| 2402 | + cGridBag diffuseness = new cGridBag(); |
---|
| 2403 | + diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints); |
---|
| 2404 | + diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2405 | + diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2406 | + diffuseSection.add(diffuseness); |
---|
1539 | 2407 | |
---|
1540 | | - ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints); |
---|
1541 | | - selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1542 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1543 | | - aConstraints.gridx += 1; |
---|
1544 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1545 | | - ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1546 | | - aConstraints.gridx = 0; |
---|
1547 | | - aConstraints.gridy += 1; |
---|
1548 | | - aConstraints.gridwidth = 1; |
---|
| 2408 | + cGridBag selfshadow = new cGridBag(); |
---|
| 2409 | + selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints); |
---|
| 2410 | + selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2411 | + selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2412 | + diffuseSection.add(selfshadow); |
---|
1549 | 2413 | |
---|
1550 | | - ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints); |
---|
1551 | | - sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1552 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1553 | | - aConstraints.gridx += 1; |
---|
1554 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1555 | | - ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1556 | | - aConstraints.gridx = 0; |
---|
1557 | | - aConstraints.gridy += 1; |
---|
1558 | | - aConstraints.gridwidth = 1; |
---|
| 2414 | + cGridBag sheen = new cGridBag(); |
---|
| 2415 | + sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints); |
---|
| 2416 | + sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2417 | + sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2418 | + diffuseSection.add(sheen); |
---|
1559 | 2419 | |
---|
1560 | | - ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints); |
---|
1561 | | - subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1562 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1563 | | - aConstraints.gridx += 1; |
---|
1564 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1565 | | - ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints); |
---|
1566 | | - aConstraints.gridx = 0; |
---|
1567 | | - aConstraints.gridy += 1; |
---|
1568 | | - aConstraints.gridwidth = 1; |
---|
| 2420 | + cGridBag subsurface = new cGridBag(); |
---|
| 2421 | + subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints); |
---|
| 2422 | + subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2423 | + subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2424 | + diffuseSection.add(subsurface); |
---|
1569 | 2425 | |
---|
1570 | | - ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints); |
---|
1571 | | - shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1572 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1573 | | - aConstraints.gridx += 1; |
---|
1574 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1575 | | - ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1576 | | - aConstraints.gridx = 0; |
---|
1577 | | - aConstraints.gridy += 1; |
---|
1578 | | - aConstraints.gridwidth = 1; |
---|
| 2426 | + cGridBag shadow = new cGridBag(); |
---|
| 2427 | + shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints); |
---|
| 2428 | + shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2429 | + shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2430 | + diffuseSection.add(shadow); |
---|
1579 | 2431 | |
---|
1580 | | - ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints); |
---|
1581 | | - fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1582 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1583 | | - aConstraints.gridx += 1; |
---|
1584 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1585 | | - ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1586 | | - aConstraints.gridx = 0; |
---|
1587 | | - aConstraints.gridy += 1; |
---|
1588 | | - aConstraints.gridwidth = 1; |
---|
| 2432 | + cGridBag fakedepth = new cGridBag(); |
---|
| 2433 | + fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints); |
---|
| 2434 | + fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2435 | + fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2436 | + diffuseSection.add(fakedepth); |
---|
1589 | 2437 | |
---|
1590 | | - //aConstraints.weighty = 1; |
---|
1591 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; |
---|
1592 | | - //aConstraints.gridx += 1; |
---|
1593 | | - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); |
---|
1594 | | - aConstraints.weighty = 0; |
---|
1595 | | - aConstraints.gridx = 0; |
---|
1596 | | - aConstraints.gridy += 1; |
---|
1597 | | - aConstraints.gridwidth = 1; |
---|
| 2438 | + cGridBag shadowbias = new cGridBag(); |
---|
| 2439 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 2440 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2441 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2442 | + diffuseSection.add(shadowbias); |
---|
1598 | 2443 | |
---|
1599 | | - ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints); |
---|
1600 | | - specularLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1601 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1602 | | - aConstraints.gridx += 1; |
---|
1603 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1604 | | - ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1605 | | - aConstraints.gridx = 0; |
---|
1606 | | - aConstraints.gridy += 1; |
---|
1607 | | - aConstraints.gridwidth = 1; |
---|
| 2444 | + panel.add(GetSeparator()); |
---|
| 2445 | + |
---|
| 2446 | + panel.add(diffuseSection); |
---|
| 2447 | + |
---|
| 2448 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
| 2449 | + |
---|
| 2450 | + cGridBag specularSection = new cGridBag().setVertical(true); |
---|
1608 | 2451 | |
---|
1609 | | - ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints); |
---|
1610 | | - lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1611 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1612 | | - aConstraints.gridx += 1; |
---|
1613 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1614 | | - ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1615 | | - aConstraints.gridx = 0; |
---|
1616 | | - aConstraints.gridy += 1; |
---|
1617 | | - aConstraints.gridwidth = 1; |
---|
| 2452 | + cGridBag specular = new cGridBag(); |
---|
| 2453 | + specular.add(specularLabel = new JLabel("Specular")); // , aConstraints); |
---|
| 2454 | + specularLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2455 | + specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2456 | + specularSection.add(specular); |
---|
1618 | 2457 | |
---|
1619 | | - ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints); |
---|
1620 | | - shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1621 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1622 | | - aConstraints.gridx += 1; |
---|
1623 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1624 | | - ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1625 | | - aConstraints.gridx = 0; |
---|
1626 | | - aConstraints.gridy += 1; |
---|
1627 | | - aConstraints.gridwidth = 1; |
---|
| 2458 | + cGridBag lightarea = new cGridBag(); |
---|
| 2459 | + lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints); |
---|
| 2460 | + lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2461 | + lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2462 | + specularSection.add(lightarea); |
---|
1628 | 2463 | |
---|
1629 | | - ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints); |
---|
1630 | | - metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1631 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1632 | | - aConstraints.gridx += 1; |
---|
1633 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1634 | | - ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints); |
---|
1635 | | - aConstraints.gridx = 0; |
---|
1636 | | - aConstraints.gridy += 1; |
---|
1637 | | - aConstraints.gridwidth = 1; |
---|
| 2464 | + cGridBag shininess = new cGridBag(); |
---|
| 2465 | + shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints); |
---|
| 2466 | + shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2467 | + shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2468 | + specularSection.add(shininess); |
---|
1638 | 2469 | |
---|
1639 | | - ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints); |
---|
1640 | | - velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1641 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1642 | | - aConstraints.gridx += 1; |
---|
1643 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1644 | | - ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1645 | | - aConstraints.gridx = 0; |
---|
1646 | | - aConstraints.gridy += 1; |
---|
1647 | | - aConstraints.gridwidth = 1; |
---|
| 2470 | + cGridBag metalness = new cGridBag(); |
---|
| 2471 | + metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints); |
---|
| 2472 | + metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2473 | + metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2474 | + specularSection.add(metalness); |
---|
1648 | 2475 | |
---|
1649 | | - shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1); |
---|
1650 | | - Return(); |
---|
| 2476 | + cGridBag velvet = new cGridBag(); |
---|
| 2477 | + velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints); |
---|
| 2478 | + velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2479 | + velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2480 | + specularSection.add(velvet); |
---|
| 2481 | + |
---|
| 2482 | + shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1); |
---|
| 2483 | + //Return(); |
---|
1651 | 2484 | // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints); |
---|
1652 | 2485 | // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1653 | 2486 | // aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
.. | .. |
---|
1658 | 2491 | // aConstraints.gridy += 1; |
---|
1659 | 2492 | // aConstraints.gridwidth = 1; |
---|
1660 | 2493 | |
---|
1661 | | - //aConstraints.weighty = 1; |
---|
1662 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; |
---|
1663 | | - //aConstraints.gridx += 1; |
---|
1664 | | - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); |
---|
1665 | | - aConstraints.weighty = 0; |
---|
1666 | | - aConstraints.gridx = 0; |
---|
1667 | | - aConstraints.gridy += 1; |
---|
1668 | | - aConstraints.gridwidth = 1; |
---|
| 2494 | + cGridBag anisoU = new cGridBag(); |
---|
| 2495 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 2496 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2497 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2498 | + specularSection.add(anisoU); |
---|
1669 | 2499 | |
---|
1670 | | - ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints); |
---|
1671 | | - cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1672 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1673 | | - aConstraints.gridx += 1; |
---|
1674 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1675 | | - ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1676 | | - aConstraints.gridx = 0; |
---|
1677 | | - aConstraints.gridy += 1; |
---|
1678 | | - aConstraints.gridwidth = 1; |
---|
| 2500 | + cGridBag anisoV = new cGridBag(); |
---|
| 2501 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 2502 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2503 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2504 | + specularSection.add(anisoV); |
---|
1679 | 2505 | |
---|
1680 | | - ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints); |
---|
1681 | | - ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1682 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1683 | | - aConstraints.gridx += 1; |
---|
1684 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1685 | | - ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1686 | | - aConstraints.gridx = 0; |
---|
1687 | | - aConstraints.gridy += 1; |
---|
1688 | | - aConstraints.gridwidth = 1; |
---|
1689 | 2506 | |
---|
1690 | | - ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints); |
---|
1691 | | - backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1692 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1693 | | - aConstraints.gridx += 1; |
---|
1694 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1695 | | - ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1696 | | - aConstraints.gridx = 0; |
---|
1697 | | - aConstraints.gridy += 1; |
---|
1698 | | - aConstraints.gridwidth = 1; |
---|
| 2507 | + panel.add(GetSeparator()); |
---|
| 2508 | + |
---|
| 2509 | + panel.add(specularSection); |
---|
| 2510 | + |
---|
| 2511 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
| 2512 | + |
---|
| 2513 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1699 | 2514 | |
---|
1700 | | - ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints); |
---|
1701 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1702 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1703 | | - aConstraints.gridx += 1; |
---|
1704 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1705 | | - ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints); |
---|
1706 | | - aConstraints.gridx = 0; |
---|
1707 | | - aConstraints.gridy += 1; |
---|
1708 | | - aConstraints.gridwidth = 1; |
---|
1709 | | - aConstraints.weighty = 0; |
---|
| 2515 | + cGridBag camera = new cGridBag(); |
---|
| 2516 | + camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
| 2517 | + cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2518 | + camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2519 | + colorSection.add(camera); |
---|
1710 | 2520 | |
---|
1711 | | - ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints); |
---|
1712 | | - bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1713 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1714 | | - aConstraints.gridx += 1; |
---|
1715 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1716 | | - ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints); |
---|
1717 | | - aConstraints.gridx = 0; |
---|
1718 | | - aConstraints.gridy += 1; |
---|
1719 | | - aConstraints.gridwidth = 1; |
---|
| 2521 | + cGridBag ambient = new cGridBag(); |
---|
| 2522 | + ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
| 2523 | + ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2524 | + ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2525 | + colorSection.add(ambient); |
---|
1720 | 2526 | |
---|
1721 | | - ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints); |
---|
1722 | | - noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1723 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1724 | | - aConstraints.gridx += 1; |
---|
1725 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1726 | | - ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints); |
---|
1727 | | - aConstraints.gridx = 0; |
---|
1728 | | - aConstraints.gridy += 1; |
---|
1729 | | - aConstraints.gridwidth = 1; |
---|
| 2527 | + cGridBag backlit = new cGridBag(); |
---|
| 2528 | + backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
| 2529 | + backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2530 | + backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2531 | + colorSection.add(backlit); |
---|
1730 | 2532 | |
---|
1731 | | - ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints); |
---|
1732 | | - powerLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1733 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1734 | | - aConstraints.gridx += 1; |
---|
1735 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1736 | | - ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints); |
---|
1737 | | - aConstraints.gridx = 0; |
---|
1738 | | - aConstraints.gridy += 1; |
---|
1739 | | - aConstraints.gridwidth = 1; |
---|
| 2533 | + //panel.add(new JSeparator()); |
---|
| 2534 | + |
---|
| 2535 | + //panel.add(globalSection); |
---|
| 2536 | + |
---|
| 2537 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
| 2538 | + |
---|
| 2539 | + cGridBag textureSection = new cGridBag().setVertical(true); |
---|
1740 | 2540 | |
---|
1741 | | - ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints); |
---|
1742 | | - borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1743 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1744 | | - aConstraints.gridx += 1; |
---|
1745 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1746 | | - ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints); |
---|
1747 | | - aConstraints.gridx = 0; |
---|
1748 | | - aConstraints.gridy += 1; |
---|
1749 | | - aConstraints.gridwidth = 1; |
---|
| 2541 | + cGridBag bump = new cGridBag(); |
---|
| 2542 | + bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints); |
---|
| 2543 | + bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2544 | + bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints); |
---|
| 2545 | + textureSection.add(bump); |
---|
1750 | 2546 | |
---|
1751 | | - ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints); |
---|
1752 | | - fogLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1753 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1754 | | - aConstraints.gridx += 1; |
---|
1755 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1756 | | - ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints); |
---|
1757 | | - aConstraints.gridx = 0; |
---|
1758 | | - aConstraints.gridy += 1; |
---|
1759 | | - aConstraints.gridwidth = 1; |
---|
| 2547 | + cGridBag noise = new cGridBag(); |
---|
| 2548 | + noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints); |
---|
| 2549 | + noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2550 | + noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints); |
---|
| 2551 | + textureSection.add(noise); |
---|
1760 | 2552 | |
---|
1761 | | - ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints); |
---|
1762 | | - opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1763 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1764 | | - aConstraints.gridx += 1; |
---|
1765 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1766 | | - ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints); |
---|
1767 | | - aConstraints.gridx = 0; |
---|
1768 | | - aConstraints.gridy += 1; |
---|
1769 | | - aConstraints.gridwidth = 1; |
---|
| 2553 | + cGridBag power = new cGridBag(); |
---|
| 2554 | + power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints); |
---|
| 2555 | + powerLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2556 | + power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints); |
---|
| 2557 | + textureSection.add(power); |
---|
1770 | 2558 | |
---|
1771 | | - //aConstraints.weighty = 1; |
---|
1772 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; |
---|
1773 | | - //aConstraints.gridx += 1; |
---|
1774 | | - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); |
---|
1775 | | - aConstraints.weighty = 0; |
---|
| 2559 | + cGridBag borderfade = new cGridBag(); |
---|
| 2560 | + borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints); |
---|
| 2561 | + borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2562 | + borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints); |
---|
| 2563 | + textureSection.add(borderfade); |
---|
1776 | 2564 | |
---|
1777 | | - aConstraints.gridx = 0; |
---|
1778 | | - aConstraints.gridy = 0; |
---|
1779 | | - aConstraints.gridwidth = 1; |
---|
| 2565 | + cGridBag fog = new cGridBag(); |
---|
| 2566 | + fog.add(fogLabel = new JLabel("Punch")); // , aConstraints); |
---|
| 2567 | + fogLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2568 | + fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints); |
---|
| 2569 | + textureSection.add(fog); |
---|
| 2570 | + |
---|
| 2571 | + cGridBag opacityPower = new cGridBag(); |
---|
| 2572 | + opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints); |
---|
| 2573 | + opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2574 | + opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
| 2575 | + textureSection.add(opacityPower); |
---|
| 2576 | + |
---|
| 2577 | + panel.add(GetSeparator()); |
---|
| 2578 | + |
---|
| 2579 | + panel.add(textureSection); |
---|
| 2580 | + |
---|
| 2581 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1780 | 2582 | |
---|
1781 | 2583 | SetMaterial(copy); // .GetMaterial()); |
---|
1782 | 2584 | |
---|
1783 | | - colorField.addChangeListener(this); |
---|
1784 | | - modulationField.addChangeListener(this); |
---|
| 2585 | + //colorField.addChangeListener(this); |
---|
| 2586 | +// modulationField.addChangeListener(this); |
---|
1785 | 2587 | metalnessField.addChangeListener(this); |
---|
1786 | 2588 | diffuseField.addChangeListener(this); |
---|
1787 | 2589 | specularField.addChangeListener(this); |
---|
.. | .. |
---|
1811 | 2613 | opacityPowerField.addChangeListener(this); |
---|
1812 | 2614 | /**/ |
---|
1813 | 2615 | |
---|
1814 | | - resetSlidersButton.addActionListener(this); |
---|
1815 | 2616 | clearMaterialButton.addActionListener(this); |
---|
1816 | 2617 | createMaterialButton.addActionListener(this); |
---|
1817 | | - |
---|
1818 | | - propagateToggle.addItemListener(this); |
---|
1819 | | - multiplyToggle.addItemListener(this); |
---|
| 2618 | + |
---|
| 2619 | + if (Globals.ADVANCED) |
---|
| 2620 | + { |
---|
| 2621 | + resetSlidersButton.addActionListener(this); |
---|
| 2622 | + propagateToggle.addItemListener(this); |
---|
| 2623 | + multiplyToggle.addItemListener(this); |
---|
| 2624 | + } |
---|
1820 | 2625 | } |
---|
1821 | 2626 | |
---|
1822 | 2627 | void DropFile(java.io.File[] files, boolean textures) |
---|
.. | .. |
---|
1834 | 2639 | // 3D models |
---|
1835 | 2640 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1836 | 2641 | { |
---|
1837 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1838 | | - LoadFile(filename, lastConverter); |
---|
| 2642 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2643 | + //LoadFile(filename, lastConverter); |
---|
| 2644 | + LoadObjFile(filename); // New 3ds loader |
---|
1839 | 2645 | continue; |
---|
1840 | 2646 | } |
---|
1841 | 2647 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
1987 | 2793 | |
---|
1988 | 2794 | //? flashIt = false; |
---|
1989 | 2795 | CameraPane pane = (CameraPane) cameraView; |
---|
1990 | | - pane.clickStart(location.x, location.y, 0); |
---|
| 2796 | + pane.clickStart(location.x, location.y, 0, 0); |
---|
1991 | 2797 | pane.clickEnd(location.x, location.y, 0, true); |
---|
1992 | 2798 | |
---|
1993 | 2799 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
2036 | 2842 | e2.printStackTrace(); |
---|
2037 | 2843 | } |
---|
2038 | 2844 | } |
---|
| 2845 | + |
---|
2039 | 2846 | LoadJMEThread loadThread; |
---|
2040 | 2847 | |
---|
2041 | 2848 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
2093 | 2900 | //LoadFile0(filename, converter); |
---|
2094 | 2901 | } |
---|
2095 | 2902 | } |
---|
| 2903 | + |
---|
2096 | 2904 | LoadOBJThread loadObjThread; |
---|
2097 | 2905 | |
---|
2098 | 2906 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2171 | 2979 | |
---|
2172 | 2980 | void LoadObjFile(String fullname) |
---|
2173 | 2981 | { |
---|
2174 | | - /* |
---|
| 2982 | + System.out.println("Loading " + fullname); |
---|
| 2983 | + /**/ |
---|
2175 | 2984 | //lastFilename = fullname; |
---|
2176 | 2985 | if(loadObjThread == null) |
---|
2177 | 2986 | { |
---|
2178 | | - loadObjThread = new LoadOBJThread(); |
---|
2179 | | - loadObjThread.start(); |
---|
| 2987 | + loadObjThread = new LoadOBJThread(); |
---|
| 2988 | + loadObjThread.start(); |
---|
2180 | 2989 | } |
---|
2181 | 2990 | |
---|
2182 | 2991 | loadObjThread.add(fullname); |
---|
2183 | | - */ |
---|
| 2992 | + /**/ |
---|
2184 | 2993 | |
---|
2185 | | - System.out.println("Loading " + fullname); |
---|
2186 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2994 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2187 | 2995 | } |
---|
2188 | 2996 | |
---|
2189 | 2997 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2444 | 3252 | |
---|
2445 | 3253 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2446 | 3254 | { |
---|
2447 | | - if (GrafreeD.standAlone) |
---|
| 3255 | + if (Grafreed.standAlone) |
---|
2448 | 3256 | { |
---|
2449 | 3257 | /**/ |
---|
2450 | 3258 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2451 | | - browser.show(); |
---|
| 3259 | + browser.setVisible(true); |
---|
2452 | 3260 | String filename = browser.getFile(); |
---|
2453 | 3261 | if (filename != null && filename.length() > 0) |
---|
2454 | 3262 | { |
---|
.. | .. |
---|
2559 | 3367 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2560 | 3368 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2561 | 3369 | } |
---|
| 3370 | + |
---|
2562 | 3371 | //cJME.count++; |
---|
2563 | 3372 | //cJME.count %= 12; |
---|
2564 | 3373 | if (gc) |
---|
.. | .. |
---|
2593 | 3402 | } |
---|
2594 | 3403 | if (input == null) |
---|
2595 | 3404 | { |
---|
| 3405 | + new Exception().printStackTrace(); |
---|
2596 | 3406 | System.exit(0); |
---|
2597 | 3407 | } |
---|
2598 | 3408 | |
---|
.. | .. |
---|
2741 | 3551 | } |
---|
2742 | 3552 | } |
---|
2743 | 3553 | } |
---|
| 3554 | + |
---|
2744 | 3555 | cFileSystemPane FSPane; |
---|
2745 | 3556 | |
---|
2746 | 3557 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2750 | 3561 | |
---|
2751 | 3562 | freezematerial = true; |
---|
2752 | 3563 | colorField.setFloat(mat.color); |
---|
2753 | | - modulationField.setFloat(mat.modulation); |
---|
| 3564 | + saturationField.setFloat(mat.modulation); |
---|
2754 | 3565 | metalnessField.setFloat(mat.metalness); |
---|
2755 | 3566 | diffuseField.setFloat(mat.diffuse); |
---|
2756 | 3567 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
2794 | 3605 | } |
---|
2795 | 3606 | } |
---|
2796 | 3607 | } |
---|
| 3608 | + |
---|
2797 | 3609 | freezematerial = false; |
---|
2798 | 3610 | } |
---|
2799 | 3611 | |
---|
2800 | 3612 | void SetMaterial(Object3D object) |
---|
2801 | 3613 | { |
---|
| 3614 | + latestObject = object; |
---|
| 3615 | + |
---|
2802 | 3616 | cMaterial mat = object.material; |
---|
2803 | 3617 | |
---|
2804 | 3618 | if (mat == null) |
---|
.. | .. |
---|
2807 | 3621 | return; |
---|
2808 | 3622 | } |
---|
2809 | 3623 | |
---|
2810 | | - multiplyToggle.setSelected(mat.multiply); |
---|
2811 | | - |
---|
2812 | | - assert (object.projectedVertices != null); |
---|
2813 | | - |
---|
2814 | | - if (object.projectedVertices.length <= 2) |
---|
2815 | | - { |
---|
2816 | | - // Side effect... |
---|
2817 | | - Object3D.cVector2[] keep = object.projectedVertices; |
---|
2818 | | - object.projectedVertices = new Object3D.cVector2[3]; |
---|
2819 | | - for (int i = 0; i < 3; i++) |
---|
2820 | | - { |
---|
2821 | | - if (i < keep.length) |
---|
2822 | | - { |
---|
2823 | | - object.projectedVertices[i] = keep[i]; |
---|
2824 | | - } else |
---|
2825 | | - { |
---|
2826 | | - object.projectedVertices[i] = new Object3D.cVector2(); |
---|
2827 | | - } |
---|
2828 | | - /* |
---|
2829 | | - if(keep.length == 0) |
---|
2830 | | - object.projectedVertices[0] = new Object3D.cVector2(); |
---|
2831 | | - else |
---|
2832 | | - object.projectedVertices[0] = keep[0]; |
---|
2833 | | - object.projectedVertices[1] = new Object3D.cVector2(); |
---|
2834 | | - */ |
---|
2835 | | - } |
---|
2836 | | - } |
---|
| 3624 | + if (multiplyToggle != null) |
---|
| 3625 | + multiplyToggle.setSelected(mat.multiply); |
---|
| 3626 | + |
---|
| 3627 | + AllocProjectedVertices(object); |
---|
2837 | 3628 | |
---|
2838 | 3629 | SetMaterial(mat, object.projectedVertices); |
---|
2839 | 3630 | } |
---|
.. | .. |
---|
2909 | 3700 | // } |
---|
2910 | 3701 | |
---|
2911 | 3702 | /**/ |
---|
2912 | | - if (deselect) |
---|
| 3703 | + if (deselect || child == null) |
---|
2913 | 3704 | { |
---|
2914 | 3705 | //group.deselectAll(); |
---|
2915 | 3706 | //freeze = true; |
---|
2916 | 3707 | GetTree().clearSelection(); |
---|
2917 | 3708 | //freeze = false; |
---|
| 3709 | + |
---|
| 3710 | + if (child == null) |
---|
| 3711 | + { |
---|
| 3712 | + return; |
---|
| 3713 | + } |
---|
2918 | 3714 | } |
---|
2919 | 3715 | |
---|
2920 | 3716 | //group.addSelectee(child); |
---|
.. | .. |
---|
2948 | 3744 | public void itemStateChanged(ItemEvent event) |
---|
2949 | 3745 | { |
---|
2950 | 3746 | // System.out.println("Propagate = " + propagate); |
---|
| 3747 | + if (event.getSource() == pinButton) |
---|
| 3748 | + { |
---|
| 3749 | + copy.pinned ^= true; |
---|
| 3750 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3751 | + { |
---|
| 3752 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3753 | + copy.CloseUI(); |
---|
| 3754 | + //copy.editWindow.refreshContents(); |
---|
| 3755 | + } |
---|
| 3756 | + } |
---|
| 3757 | + else |
---|
2951 | 3758 | if (event.getSource() == propagateToggle) |
---|
2952 | 3759 | { |
---|
2953 | 3760 | propagate ^= true; |
---|
.. | .. |
---|
2983 | 3790 | cameraView.ToggleDL(); |
---|
2984 | 3791 | cameraView.repaint(); |
---|
2985 | 3792 | return; |
---|
2986 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3793 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2987 | 3794 | { |
---|
2988 | 3795 | cameraView.ToggleTexture(); |
---|
2989 | 3796 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2996 | 3803 | if (timeline) |
---|
2997 | 3804 | { |
---|
2998 | 3805 | centralPanel.remove(cameraView); |
---|
2999 | | - centralPanel.add(timelinePanel); |
---|
| 3806 | + cameraPanel.add(cameraView); |
---|
| 3807 | + centralPanel.add(cameraPanel); |
---|
3000 | 3808 | frame.setJMenuBar(timelineMenubar); |
---|
3001 | 3809 | wasFullScreen = CameraPane.FULLSCREEN; |
---|
3002 | 3810 | if (!CameraPane.FULLSCREEN) |
---|
.. | .. |
---|
3005 | 3813 | } |
---|
3006 | 3814 | else |
---|
3007 | 3815 | { |
---|
3008 | | - centralPanel.remove(timelinePanel); |
---|
| 3816 | + centralPanel.remove(cameraPanel); |
---|
3009 | 3817 | centralPanel.add(cameraView); |
---|
3010 | 3818 | frame.setJMenuBar(null); |
---|
3011 | 3819 | if (!wasFullScreen) |
---|
.. | .. |
---|
3021 | 3829 | frame.validate(); |
---|
3022 | 3830 | |
---|
3023 | 3831 | return; |
---|
3024 | | - } else if (event.getSource() == toggleRandomItem) |
---|
| 3832 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
3025 | 3833 | { |
---|
3026 | | - cameraView.ToggleRandom(); |
---|
| 3834 | + cameraView.ToggleSwitch(); |
---|
3027 | 3835 | cameraView.repaint(); |
---|
3028 | 3836 | return; |
---|
3029 | 3837 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
3051 | 3859 | } else if (event.getSource() == liveCB) |
---|
3052 | 3860 | { |
---|
3053 | 3861 | copy.live ^= true; |
---|
| 3862 | + objEditor.refreshContents(true); // To show item colors |
---|
| 3863 | + return; |
---|
| 3864 | + } else if (event.getSource() == selectableCB) |
---|
| 3865 | + { |
---|
| 3866 | + copy.dontselect ^= true; |
---|
3054 | 3867 | return; |
---|
3055 | 3868 | } else if (event.getSource() == hideCB) |
---|
3056 | 3869 | { |
---|
3057 | 3870 | copy.hide ^= true; |
---|
3058 | 3871 | copy.Touch(); // display list issue |
---|
3059 | | - objEditor.refreshContents(); |
---|
| 3872 | + objEditor.refreshContents(true); // To show item colors |
---|
3060 | 3873 | return; |
---|
3061 | 3874 | } else if (event.getSource() == link2masterCB) |
---|
3062 | 3875 | { |
---|
.. | .. |
---|
3066 | 3879 | if (event.getSource() == randomCB) |
---|
3067 | 3880 | { |
---|
3068 | 3881 | copy.random ^= true; |
---|
| 3882 | + objEditor.refreshContents(); |
---|
3069 | 3883 | return; |
---|
3070 | 3884 | } |
---|
3071 | 3885 | if (event.getSource() == speedupCB) |
---|
.. | .. |
---|
3089 | 3903 | |
---|
3090 | 3904 | public void actionPerformed(ActionEvent event) |
---|
3091 | 3905 | { |
---|
| 3906 | + Object source = event.getSource(); |
---|
3092 | 3907 | // SCRIPT DIALOG |
---|
3093 | | - if (event.getSource() == okbutton) |
---|
| 3908 | + if (source == okbutton) |
---|
3094 | 3909 | { |
---|
3095 | 3910 | textpanel.setVisible(false); |
---|
3096 | 3911 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3102 | 3917 | textarea = null; |
---|
3103 | 3918 | textpanel = null; |
---|
3104 | 3919 | } |
---|
3105 | | - if (event.getSource() == cancelbutton) |
---|
| 3920 | + if (source == cancelbutton) |
---|
3106 | 3921 | { |
---|
3107 | 3922 | textpanel.setVisible(false); |
---|
3108 | 3923 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3114 | 3929 | //applySelf(); |
---|
3115 | 3930 | //client.refreshEditWindow(); |
---|
3116 | 3931 | //refreshContents(); |
---|
3117 | | - if (event.getSource() == nameField) |
---|
| 3932 | + if (source == nameField) |
---|
3118 | 3933 | { |
---|
3119 | 3934 | //System.out.println("ObjEditor " + event); |
---|
3120 | 3935 | applySelf0(true); |
---|
3121 | 3936 | //parent.applySelf(); |
---|
3122 | | - objEditor.refreshContents(); |
---|
3123 | | - } else if (event.getSource() == resetButton) |
---|
| 3937 | + // conflicts with requestFocus objEditor.refreshContents(); |
---|
| 3938 | + } else if (source == resetButton) |
---|
3124 | 3939 | { |
---|
3125 | 3940 | CameraPane.fullreset = true; |
---|
3126 | 3941 | copy.Reset(); // ResetMeshes(); |
---|
3127 | 3942 | copy.Touch(); |
---|
3128 | 3943 | objEditor.refreshContents(); |
---|
3129 | | - } else if (event.getSource() == stepItem) |
---|
| 3944 | + } else if (source == stepItem) |
---|
3130 | 3945 | { |
---|
3131 | | - cameraView.ONESTEP = true; |
---|
| 3946 | + //cameraView.ONESTEP = true; |
---|
| 3947 | + Globals.ONESTEP = true; |
---|
3132 | 3948 | cameraView.repaint(); |
---|
3133 | 3949 | return; |
---|
3134 | | - } else if (event.getSource() == stepButton) |
---|
| 3950 | + } else if (source == stepButton) |
---|
3135 | 3951 | { |
---|
3136 | 3952 | copy.Step(); |
---|
3137 | 3953 | copy.Touch(); |
---|
3138 | 3954 | objEditor.refreshContents(); |
---|
3139 | | - } else if (event.getSource() == slowerButton) |
---|
| 3955 | + } else if (source == slowerButton) |
---|
3140 | 3956 | { |
---|
3141 | 3957 | copy.Slower(); |
---|
3142 | 3958 | copy.Touch(); |
---|
3143 | 3959 | objEditor.refreshContents(); |
---|
3144 | | - } else if (event.getSource() == fasterButton) |
---|
| 3960 | + } else if (source == fasterButton) |
---|
3145 | 3961 | { |
---|
3146 | 3962 | copy.Faster(); |
---|
3147 | 3963 | copy.Touch(); |
---|
3148 | 3964 | objEditor.refreshContents(); |
---|
3149 | | - } else if (event.getSource() == remarkButton) |
---|
| 3965 | + } else if (source == remarkButton) |
---|
3150 | 3966 | { |
---|
3151 | 3967 | copy.Remark(); |
---|
3152 | 3968 | copy.Touch(); |
---|
3153 | 3969 | objEditor.refreshContents(); |
---|
3154 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3970 | + } else if (source == stepAllButton) |
---|
3155 | 3971 | { |
---|
3156 | 3972 | copy.StepAll(); |
---|
3157 | 3973 | copy.Touch(); |
---|
3158 | 3974 | objEditor.refreshContents(); |
---|
3159 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3975 | + } else if (source == resetAllButton) |
---|
3160 | 3976 | { |
---|
3161 | 3977 | //CameraPane.fullreset = true; |
---|
3162 | 3978 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3189 | 4005 | // Close(); |
---|
3190 | 4006 | // } |
---|
3191 | 4007 | // else |
---|
3192 | | - if (event.getSource() == resetSlidersButton) |
---|
| 4008 | + if (source == resetSlidersButton) |
---|
3193 | 4009 | { |
---|
3194 | 4010 | ResetSliders(); |
---|
3195 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 4011 | + } else if (source == clearMaterialButton) |
---|
3196 | 4012 | { |
---|
3197 | 4013 | ClearMaterial(); |
---|
3198 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 4014 | + } else if (source == createMaterialButton) |
---|
3199 | 4015 | { |
---|
3200 | 4016 | CreateMaterial(); |
---|
3201 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 4017 | + } else if (source == clearPanelButton) |
---|
3202 | 4018 | { |
---|
3203 | 4019 | copy.ClearUI(); |
---|
3204 | 4020 | refreshContents(true); |
---|
3205 | | - } /* |
---|
3206 | | - } |
---|
3207 | | - |
---|
3208 | | - public boolean action(Event event, Object arg) |
---|
3209 | | - { |
---|
3210 | | - */ else if (event.getSource() == closeItem) |
---|
| 4021 | + } else if (source == importGFDItem) |
---|
| 4022 | + { |
---|
| 4023 | + ImportGFD(); |
---|
| 4024 | + } else |
---|
| 4025 | + if (source == importVRMLX3DItem) |
---|
| 4026 | + { |
---|
| 4027 | + ImportVRMLX3D(); |
---|
| 4028 | + } else |
---|
| 4029 | + if (source == import3DSItem) |
---|
| 4030 | + { |
---|
| 4031 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 4032 | + } else |
---|
| 4033 | + if (source == importOBJItem) |
---|
| 4034 | + { |
---|
| 4035 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 4036 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 4037 | + browser.setVisible(true); |
---|
| 4038 | + String filename = browser.getFile(); |
---|
| 4039 | + if (filename != null && filename.length() > 0) |
---|
| 4040 | + { |
---|
| 4041 | + String fullname = browser.getDirectory() + filename; |
---|
| 4042 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 4043 | + } |
---|
| 4044 | + } else |
---|
| 4045 | + if (source == closeItem) |
---|
3211 | 4046 | { |
---|
3212 | 4047 | Close(); |
---|
3213 | 4048 | //return true; |
---|
3214 | | - } else if (event.getSource() == loadItem) |
---|
| 4049 | + } else if (source == openItem) |
---|
3215 | 4050 | { |
---|
3216 | | - load(); |
---|
| 4051 | + Open(); |
---|
3217 | 4052 | //return true; |
---|
3218 | | - } else if (event.getSource() == saveItem) |
---|
| 4053 | + } else if (source == newItem) |
---|
| 4054 | + { |
---|
| 4055 | + New(); |
---|
| 4056 | + } else if (source == saveItem) |
---|
3219 | 4057 | { |
---|
3220 | 4058 | save(); |
---|
3221 | 4059 | //return true; |
---|
3222 | | - } else if (event.getSource() == saveAsItem) |
---|
| 4060 | + } else if (source == saveAsItem) |
---|
3223 | 4061 | { |
---|
3224 | 4062 | saveAs(); |
---|
3225 | 4063 | //return true; |
---|
3226 | | - } else if (event.getSource() == reexportItem) |
---|
| 4064 | + } else if (source == reexportItem) |
---|
3227 | 4065 | { |
---|
3228 | 4066 | reexport(); |
---|
3229 | 4067 | //return true; |
---|
3230 | | - } else if (event.getSource() == exportAsItem) |
---|
| 4068 | + } else if (source == exportAsItem) |
---|
3231 | 4069 | { |
---|
3232 | 4070 | export(); |
---|
3233 | 4071 | //return true; |
---|
3234 | | - } else if (event.getSource() == povItem) |
---|
| 4072 | + } else if (source == povItem) |
---|
3235 | 4073 | { |
---|
3236 | 4074 | generatePOV(); |
---|
3237 | 4075 | //return true; |
---|
3238 | | - } else if (event.getSource() == zBufferItem) |
---|
| 4076 | + } else if (event.getSource() == archiveItem) |
---|
| 4077 | + { |
---|
| 4078 | + cTools.Archive(frame); |
---|
| 4079 | + return; |
---|
| 4080 | + } else if (source == zBufferItem) |
---|
3239 | 4081 | { |
---|
3240 | 4082 | try |
---|
3241 | 4083 | { |
---|
.. | .. |
---|
3257 | 4099 | cameraView.repaint(); |
---|
3258 | 4100 | //return true; |
---|
3259 | 4101 | } |
---|
3260 | | - */ else if (event.getSource() == editCameraItem) |
---|
3261 | | - { |
---|
3262 | | - cameraView.ProtectCamera(); |
---|
3263 | | - cameraView.repaint(); |
---|
3264 | | - return; |
---|
3265 | | - } else if (event.getSource() == revertCameraItem) |
---|
3266 | | - { |
---|
3267 | | - cameraView.RevertCamera(); |
---|
3268 | | - cameraView.repaint(); |
---|
3269 | | - return; |
---|
3270 | | -// } else if (event.getSource() == textureButton) |
---|
3271 | | -// { |
---|
3272 | | -// return; // true; |
---|
3273 | | - } else // combos... |
---|
3274 | | - if (event.getSource() == texresMenu) |
---|
| 4102 | + */ else // combos... |
---|
| 4103 | + if (source == texresMenu) |
---|
3275 | 4104 | { |
---|
3276 | 4105 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3277 | 4106 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3283 | 4112 | } |
---|
3284 | 4113 | } |
---|
3285 | 4114 | |
---|
3286 | | - void ToggleAnimation() |
---|
| 4115 | + void New() |
---|
3287 | 4116 | { |
---|
3288 | | - if (!CameraPane.ANIMATION) |
---|
| 4117 | + while (copy.Size() > 1) |
---|
3289 | 4118 | { |
---|
3290 | | - FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); |
---|
| 4119 | + copy.remove(1); |
---|
| 4120 | + } |
---|
| 4121 | + |
---|
| 4122 | + ResetModel(); |
---|
| 4123 | + objEditor.refreshContents(); |
---|
| 4124 | + } |
---|
| 4125 | + |
---|
| 4126 | + static public byte[] Compress(Object3D o) |
---|
| 4127 | + { |
---|
| 4128 | + // Slower to actually compress. |
---|
| 4129 | + try |
---|
| 4130 | + { |
---|
| 4131 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 4132 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 4133 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
| 4134 | + |
---|
| 4135 | + Object3D parent = o.parent; |
---|
| 4136 | + o.parent = null; |
---|
| 4137 | + |
---|
| 4138 | + out.writeObject(o); |
---|
| 4139 | + |
---|
| 4140 | + o.parent = parent; |
---|
| 4141 | + |
---|
| 4142 | + out.flush(); |
---|
| 4143 | + |
---|
| 4144 | + baos //zstream |
---|
| 4145 | + .close(); |
---|
| 4146 | + out.close(); |
---|
| 4147 | + |
---|
| 4148 | + byte[] bytes = baos.toByteArray(); |
---|
| 4149 | + |
---|
| 4150 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 4151 | + return bytes; |
---|
| 4152 | + } catch (Exception e) |
---|
| 4153 | + { |
---|
| 4154 | + System.err.println(e); |
---|
| 4155 | + return null; |
---|
| 4156 | + } |
---|
| 4157 | + } |
---|
| 4158 | + |
---|
| 4159 | + static public Object Uncompress(byte[] bytes) |
---|
| 4160 | + { |
---|
| 4161 | + System.out.println("restore #bytes = " + bytes.length); |
---|
| 4162 | + try |
---|
| 4163 | + { |
---|
| 4164 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 4165 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 4166 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
| 4167 | + Object obj = in.readObject(); |
---|
| 4168 | + |
---|
| 4169 | + bais //istream |
---|
| 4170 | + .close(); |
---|
| 4171 | + in.close(); |
---|
| 4172 | + |
---|
| 4173 | + return obj; |
---|
| 4174 | + } catch (Exception e) |
---|
| 4175 | + { |
---|
| 4176 | + System.err.println(e); |
---|
| 4177 | + return null; |
---|
| 4178 | + } |
---|
| 4179 | + } |
---|
| 4180 | + |
---|
| 4181 | + static public Object clone(Object o) |
---|
| 4182 | + { |
---|
| 4183 | + try |
---|
| 4184 | + { |
---|
| 4185 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 4186 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 4187 | + |
---|
| 4188 | + out.writeObject(o); |
---|
| 4189 | + |
---|
| 4190 | + out.flush(); |
---|
| 4191 | + out.close(); |
---|
| 4192 | + |
---|
| 4193 | + byte[] bytes = baos.toByteArray(); |
---|
| 4194 | + |
---|
| 4195 | + System.out.println("clone = " + bytes.length); |
---|
| 4196 | + |
---|
| 4197 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 4198 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 4199 | + Object obj = in.readObject(); |
---|
| 4200 | + in.close(); |
---|
| 4201 | + |
---|
| 4202 | + return obj; |
---|
| 4203 | + } catch (Exception e) |
---|
| 4204 | + { |
---|
| 4205 | + System.err.println(e); |
---|
| 4206 | + return null; |
---|
| 4207 | + } |
---|
| 4208 | + } |
---|
| 4209 | + |
---|
| 4210 | + cRadio GetCurrentTab() |
---|
| 4211 | + { |
---|
| 4212 | + cRadio ab; |
---|
| 4213 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 4214 | + { |
---|
| 4215 | + ab = (cRadio)e.nextElement(); |
---|
| 4216 | + if(ab.GetObject() == copy) |
---|
| 4217 | + { |
---|
| 4218 | + return ab; |
---|
| 4219 | + } |
---|
| 4220 | + } |
---|
| 4221 | + |
---|
| 4222 | + return null; |
---|
| 4223 | + } |
---|
| 4224 | + |
---|
| 4225 | + |
---|
| 4226 | + public void Save() |
---|
| 4227 | + { |
---|
| 4228 | + //Save(true); |
---|
| 4229 | + Replace(); |
---|
| 4230 | + SetVersionStates(); |
---|
| 4231 | + } |
---|
| 4232 | + |
---|
| 4233 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 4234 | + { |
---|
| 4235 | + if (compress.length != name.length) |
---|
| 4236 | + { |
---|
| 4237 | + return false; |
---|
| 4238 | + } |
---|
| 4239 | + |
---|
| 4240 | + for (int i=compress.length; --i>=0;) |
---|
| 4241 | + { |
---|
| 4242 | + if (compress[i] != name[i]) |
---|
| 4243 | + return false; |
---|
| 4244 | + } |
---|
| 4245 | + |
---|
| 4246 | + return true; |
---|
| 4247 | + } |
---|
| 4248 | + |
---|
| 4249 | + void DeleteVersion() |
---|
| 4250 | + { |
---|
| 4251 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4252 | + { |
---|
| 4253 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4254 | + } |
---|
| 4255 | + |
---|
| 4256 | + if (copy.versionlist[copy.versionindex] == null) |
---|
| 4257 | + copy.versionindex -= 1; |
---|
| 4258 | + |
---|
| 4259 | + if (copy.versionindex != -1) |
---|
| 4260 | + CopyChanged(); |
---|
| 4261 | + |
---|
| 4262 | + SetVersionStates(); |
---|
| 4263 | + } |
---|
| 4264 | + |
---|
| 4265 | + public boolean Save(boolean user) |
---|
| 4266 | + { |
---|
| 4267 | + System.err.println("Save"); |
---|
| 4268 | + Replace(); |
---|
| 4269 | + |
---|
| 4270 | + //cRadio tab = GetCurrentTab(); |
---|
| 4271 | + |
---|
| 4272 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
| 4273 | + |
---|
| 4274 | + boolean thesame = false; |
---|
| 4275 | + |
---|
| 4276 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4277 | +// { |
---|
| 4278 | +// thesame = true; |
---|
| 4279 | +// } |
---|
| 4280 | + |
---|
| 4281 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 4282 | + if (!thesame) |
---|
| 4283 | + { |
---|
| 4284 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4285 | + { |
---|
| 4286 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4287 | + } |
---|
| 4288 | + |
---|
| 4289 | + //tab.user[tab.versionindex] = user; |
---|
| 4290 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 4291 | + |
---|
| 4292 | + copy.versionlist[++copy.versionindex] = compress; |
---|
| 4293 | + |
---|
| 4294 | + // if (increment) |
---|
| 4295 | + // tab.versionindex++; |
---|
| 4296 | + } |
---|
| 4297 | + |
---|
| 4298 | + //copy.RestoreBigData(versiontable); |
---|
| 4299 | + |
---|
| 4300 | + //assert(hashtable.isEmpty()); |
---|
| 4301 | + |
---|
| 4302 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4303 | +// { |
---|
| 4304 | +// //tab.user[i] = false; |
---|
| 4305 | +// copy.versionlist[i] = null; |
---|
| 4306 | +// } |
---|
| 4307 | + |
---|
| 4308 | + SetVersionStates(); |
---|
| 4309 | + |
---|
| 4310 | + // test save |
---|
| 4311 | + if (false) |
---|
| 4312 | + { |
---|
| 4313 | + try |
---|
| 4314 | + { |
---|
| 4315 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
| 4316 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4317 | + |
---|
| 4318 | + p.writeObject(copy); |
---|
| 4319 | + |
---|
| 4320 | + p.flush(); |
---|
| 4321 | + |
---|
| 4322 | + ostream.close(); |
---|
| 4323 | + } catch (Exception e) |
---|
| 4324 | + { |
---|
| 4325 | + e.printStackTrace(); |
---|
| 4326 | + } |
---|
| 4327 | + } |
---|
| 4328 | + |
---|
| 4329 | + return !thesame; |
---|
| 4330 | + } |
---|
| 4331 | + |
---|
| 4332 | + boolean flashIt = true; |
---|
| 4333 | + |
---|
| 4334 | + void RefreshSelection() |
---|
| 4335 | + { |
---|
| 4336 | + Object3D selection = new Object3D(); |
---|
| 4337 | + |
---|
| 4338 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4339 | + { |
---|
| 4340 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 4341 | + |
---|
| 4342 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4343 | + |
---|
| 4344 | + if (obj == null) |
---|
| 4345 | + { |
---|
| 4346 | + copy.selection.remove(i--); |
---|
| 4347 | + } |
---|
| 4348 | + else |
---|
| 4349 | + { |
---|
| 4350 | + selection.add(obj); |
---|
| 4351 | + copy.selection.setElementAt(obj, i); |
---|
| 4352 | + } |
---|
| 4353 | + } |
---|
| 4354 | + |
---|
| 4355 | + flashIt = false; |
---|
| 4356 | + GetTree().clearSelection(); |
---|
| 4357 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4358 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4359 | + flashIt = true; |
---|
| 4360 | + |
---|
| 4361 | + //refreshContents(false); |
---|
| 4362 | + } |
---|
| 4363 | + |
---|
| 4364 | + void CopyChanged() |
---|
| 4365 | + { |
---|
| 4366 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4367 | + |
---|
| 4368 | + SetVersionStates(); |
---|
| 4369 | + |
---|
| 4370 | + boolean temp = CameraPane.SWITCH; |
---|
| 4371 | + CameraPane.SWITCH = false; |
---|
| 4372 | + |
---|
| 4373 | + copy.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 4374 | + |
---|
| 4375 | + copy.clear(); |
---|
| 4376 | + |
---|
| 4377 | + copy.skyboxname = obj.skyboxname; |
---|
| 4378 | + copy.skyboxext = obj.skyboxext; |
---|
| 4379 | + |
---|
| 4380 | + for (int i=0; i<obj.Size(); i++) |
---|
| 4381 | + { |
---|
| 4382 | + copy.add(obj.get(i)); |
---|
| 4383 | + } |
---|
| 4384 | + |
---|
| 4385 | + copy.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 4386 | + |
---|
| 4387 | + CameraPane.SWITCH = temp; |
---|
| 4388 | + |
---|
| 4389 | + RefreshSelection(); |
---|
| 4390 | + //assert(hashtable.isEmpty()); |
---|
| 4391 | + |
---|
| 4392 | + copy.Touch(); |
---|
| 4393 | + |
---|
| 4394 | + ResetModel(); |
---|
| 4395 | + copy.HardTouch(); // recompile? |
---|
| 4396 | + |
---|
| 4397 | + cRadio ab; |
---|
| 4398 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 4399 | + { |
---|
| 4400 | + ab = (cRadio)e.nextElement(); |
---|
| 4401 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 4402 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 4403 | + if (test != null) |
---|
| 4404 | + { |
---|
| 4405 | + test.editWindow = ab.object.editWindow; |
---|
| 4406 | + ab.object = test; |
---|
| 4407 | + } |
---|
| 4408 | + } |
---|
| 4409 | + |
---|
| 4410 | + refreshContents(true); |
---|
| 4411 | + } |
---|
| 4412 | + |
---|
| 4413 | + cButton previousVersionButton; |
---|
| 4414 | + cButton restoreButton; |
---|
| 4415 | + cButton replaceButton; |
---|
| 4416 | + cButton nextVersionButton; |
---|
| 4417 | + cButton saveVersionButton; |
---|
| 4418 | + cButton deleteVersionButton; |
---|
| 4419 | + |
---|
| 4420 | + boolean muteSlider; |
---|
| 4421 | + |
---|
| 4422 | + int VersionCount() |
---|
| 4423 | + { |
---|
| 4424 | + int count = 0; |
---|
| 4425 | + |
---|
| 4426 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
| 4427 | + { |
---|
| 4428 | + if (copy.versionlist[i] != null) |
---|
| 4429 | + count++; |
---|
| 4430 | + } |
---|
| 4431 | + |
---|
| 4432 | + return count; |
---|
| 4433 | + } |
---|
| 4434 | + |
---|
| 4435 | + void SetVersionStates() |
---|
| 4436 | + { |
---|
| 4437 | + //if (true) |
---|
| 4438 | + // return; |
---|
| 4439 | + |
---|
| 4440 | + //cRadio tab = GetCurrentTab(); |
---|
| 4441 | + |
---|
| 4442 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 4443 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 4444 | + |
---|
| 4445 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4446 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4447 | + |
---|
| 4448 | + deleteVersionButton.setEnabled(copy.versionindex != -1); |
---|
| 4449 | + //copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4450 | + |
---|
| 4451 | + muteSlider = true; |
---|
| 4452 | + versionSlider.setMinimum(0); |
---|
| 4453 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4454 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4455 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
| 4456 | + muteSlider = false; |
---|
| 4457 | + } |
---|
| 4458 | + |
---|
| 4459 | + public boolean PreviousVersion() |
---|
| 4460 | + { |
---|
| 4461 | + // Option? |
---|
| 4462 | + Replace(); |
---|
| 4463 | + |
---|
| 4464 | + System.err.println("Undo"); |
---|
| 4465 | + |
---|
| 4466 | + //cRadio tab = GetCurrentTab(); |
---|
| 4467 | + |
---|
| 4468 | + if (copy.versionindex == 0) |
---|
| 4469 | + { |
---|
| 4470 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4471 | + return false; |
---|
| 4472 | + } |
---|
| 4473 | + |
---|
| 4474 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 4475 | +// { |
---|
| 4476 | +// if (Save(false)) |
---|
| 4477 | +// tab.versionindex -= 1; |
---|
| 4478 | +// else |
---|
| 4479 | +// { |
---|
| 4480 | +// if (tab.versionindex <= 0) |
---|
| 4481 | +// return false; |
---|
| 4482 | +// else |
---|
| 4483 | +// tab.versionindex -= 1; |
---|
| 4484 | +// } |
---|
| 4485 | +// } |
---|
| 4486 | + |
---|
| 4487 | + copy.versionindex -= 1; |
---|
| 4488 | + |
---|
| 4489 | + CopyChanged(); |
---|
| 4490 | + |
---|
| 4491 | + return true; |
---|
| 4492 | + } |
---|
| 4493 | + |
---|
| 4494 | + public boolean Restore() |
---|
| 4495 | + { |
---|
| 4496 | + System.err.println("Restore"); |
---|
| 4497 | + |
---|
| 4498 | + //cRadio tab = GetCurrentTab(); |
---|
| 4499 | + |
---|
| 4500 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4501 | + { |
---|
| 4502 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4503 | + return false; |
---|
| 4504 | + } |
---|
| 4505 | + |
---|
| 4506 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4507 | + CopyChanged(); |
---|
| 4508 | + |
---|
| 4509 | + return true; |
---|
| 4510 | + } |
---|
| 4511 | + |
---|
| 4512 | + public boolean Replace() |
---|
| 4513 | + { |
---|
| 4514 | + //System.err.println("Replace"); |
---|
| 4515 | + |
---|
| 4516 | + //cRadio tab = GetCurrentTab(); |
---|
| 4517 | + |
---|
| 4518 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4519 | + { |
---|
| 4520 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4521 | + return false; |
---|
| 4522 | + } |
---|
| 4523 | + |
---|
| 4524 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
| 4525 | + |
---|
| 4526 | + return true; |
---|
| 4527 | + } |
---|
| 4528 | + |
---|
| 4529 | + public void NextVersion() |
---|
| 4530 | + { |
---|
| 4531 | + // Option? |
---|
| 4532 | + Replace(); |
---|
| 4533 | + |
---|
| 4534 | + //cRadio tab = GetCurrentTab(); |
---|
| 4535 | + |
---|
| 4536 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
| 4537 | + { |
---|
| 4538 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4539 | + return; |
---|
| 4540 | + } |
---|
| 4541 | + |
---|
| 4542 | + copy.versionindex += 1; |
---|
| 4543 | + |
---|
| 4544 | + CopyChanged(); |
---|
| 4545 | + |
---|
| 4546 | + //if (!tab.user[tab.versionindex]) |
---|
| 4547 | + // tab.graphs[tab.versionindex] = null; |
---|
| 4548 | + } |
---|
| 4549 | + |
---|
| 4550 | + void ImportGFD() |
---|
| 4551 | + { |
---|
| 4552 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
3291 | 4553 | browser.show(); |
---|
3292 | 4554 | String filename = browser.getFile(); |
---|
3293 | 4555 | if (filename != null && filename.length() > 0) |
---|
3294 | 4556 | { |
---|
3295 | | - CameraPane.filename = browser.getDirectory() + filename; |
---|
| 4557 | + String fullname = browser.getDirectory() + filename; |
---|
| 4558 | + |
---|
| 4559 | + //Object3D readobj = |
---|
| 4560 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 4561 | + //makeSomething(readobj); |
---|
| 4562 | + } |
---|
| 4563 | + } |
---|
| 4564 | + |
---|
| 4565 | + void ImportVRMLX3D() |
---|
| 4566 | + { |
---|
| 4567 | + if (Grafreed.standAlone) |
---|
| 4568 | + { |
---|
| 4569 | + /**/ |
---|
| 4570 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 4571 | + browser.show(); |
---|
| 4572 | + String filename = browser.getFile(); |
---|
| 4573 | + if (filename != null && filename.length() > 0) |
---|
| 4574 | + { |
---|
| 4575 | + String fullname = browser.getDirectory() + filename; |
---|
| 4576 | + LoadVRMLX3D(fullname); |
---|
| 4577 | + } |
---|
| 4578 | + /**/ |
---|
| 4579 | + } |
---|
| 4580 | + } |
---|
| 4581 | + |
---|
| 4582 | + void ToggleAnimation() |
---|
| 4583 | + { |
---|
| 4584 | + if (!Globals.ANIMATION) |
---|
| 4585 | + { |
---|
| 4586 | + FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); |
---|
| 4587 | + browser.setVisible(true); |
---|
| 4588 | + String filename = browser.getFile(); |
---|
| 4589 | + if (filename != null && filename.length() > 0) |
---|
| 4590 | + { |
---|
| 4591 | + Globals.filename = browser.getDirectory() + filename; |
---|
3296 | 4592 | //CameraPane.framecount = 0; |
---|
3297 | | - CameraPane.imagecount = 0; |
---|
| 4593 | + Globals.imagecount = 0; |
---|
3298 | 4594 | |
---|
3299 | | - CameraPane.ANIMATION ^= true; |
---|
| 4595 | + Globals.ANIMATION ^= true; |
---|
3300 | 4596 | |
---|
3301 | | - GrafreeD.wav.cursor = 0; |
---|
3302 | | - GrafreeD.wav.loop = 0; |
---|
| 4597 | + Grafreed.wav.cursor = 0; |
---|
| 4598 | + Grafreed.wav.loop = 0; |
---|
3303 | 4599 | } |
---|
3304 | 4600 | } else |
---|
3305 | 4601 | { |
---|
3306 | | - CameraPane.ANIMATION ^= true; |
---|
| 4602 | + Globals.ANIMATION ^= true; |
---|
3307 | 4603 | } |
---|
3308 | 4604 | } |
---|
3309 | 4605 | |
---|
.. | .. |
---|
3349 | 4645 | void CreateMaterial() |
---|
3350 | 4646 | { |
---|
3351 | 4647 | //copy.ClearMaterial(); // PATCH |
---|
3352 | | - copy.CreateMaterialS(multiplyToggle.isSelected()); |
---|
| 4648 | + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); |
---|
3353 | 4649 | if (copy.selection.size() > 0) |
---|
3354 | 4650 | //SetMaterial(copy); |
---|
3355 | 4651 | { |
---|
.. | .. |
---|
3400 | 4696 | assert false; |
---|
3401 | 4697 | } |
---|
3402 | 4698 | |
---|
3403 | | - void EditSelection() |
---|
| 4699 | + void EditSelection(boolean newWindow) |
---|
3404 | 4700 | { |
---|
3405 | 4701 | } |
---|
3406 | 4702 | |
---|
.. | .. |
---|
3408 | 4704 | { |
---|
3409 | 4705 | copy.ResetBlockLoop(); // temporary problem |
---|
3410 | 4706 | |
---|
3411 | | - boolean random = CameraPane.RANDOM; |
---|
3412 | | - CameraPane.RANDOM = false; // parse everything |
---|
| 4707 | + boolean random = CameraPane.SWITCH; |
---|
| 4708 | + CameraPane.SWITCH = false; // parse everything |
---|
3413 | 4709 | copy.ResetDisplayList(); |
---|
3414 | 4710 | copy.HardTouch(); |
---|
3415 | | - CameraPane.RANDOM = random; |
---|
| 4711 | + CameraPane.SWITCH = random; |
---|
3416 | 4712 | } |
---|
3417 | 4713 | |
---|
3418 | 4714 | // public void applySelf() |
---|
.. | .. |
---|
3459 | 4755 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
3460 | 4756 | |
---|
3461 | 4757 | current.color = (float) colorField.getFloat(); |
---|
3462 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4758 | + current.modulation = (float) saturationField.getFloat(); |
---|
3463 | 4759 | current.metalness = (float) metalnessField.getFloat(); |
---|
3464 | 4760 | current.diffuse = (float) diffuseField.getFloat(); |
---|
3465 | 4761 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
3482 | 4778 | current.fakedepth = (float) fakedepthField.getFloat(); |
---|
3483 | 4779 | current.shadowbias = (float) shadowbiasField.getFloat(); |
---|
3484 | 4780 | |
---|
3485 | | - if (!NumberSlider.frozen) |
---|
| 4781 | + if (!cNumberSlider.frozen) |
---|
3486 | 4782 | { |
---|
3487 | 4783 | //System.out.println("Propagate = " + propagate); |
---|
3488 | 4784 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 4785 | + |
---|
| 4786 | + if (copy.material != null) |
---|
| 4787 | + { |
---|
| 4788 | + cMaterial mat = copy.material; |
---|
| 4789 | + |
---|
| 4790 | + colorField.SetToolTipValue((mat.color)); |
---|
| 4791 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
| 4792 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 4793 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 4794 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 4795 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 4796 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 4797 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 4798 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 4799 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 4800 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 4801 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 4802 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 4803 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 4804 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 4805 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 4806 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 4807 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 4808 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 4809 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 4810 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 4811 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 4812 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 4813 | + } |
---|
| 4814 | + |
---|
3489 | 4815 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3490 | 4816 | { |
---|
3491 | 4817 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3514 | 4840 | //copy.Touch(); |
---|
3515 | 4841 | } |
---|
3516 | 4842 | |
---|
| 4843 | + cNumberSlider versionSlider; |
---|
| 4844 | + |
---|
3517 | 4845 | public void stateChanged(ChangeEvent e) |
---|
3518 | 4846 | { |
---|
3519 | 4847 | // assert(false); |
---|
| 4848 | + if (e.getSource() == versionSlider) |
---|
| 4849 | + { |
---|
| 4850 | + if (muteSlider) |
---|
| 4851 | + return; |
---|
| 4852 | + |
---|
| 4853 | + Replace(); |
---|
| 4854 | + |
---|
| 4855 | + int version = versionSlider.getInteger(); |
---|
| 4856 | + |
---|
| 4857 | + if (version != -1 && copy.versionlist[version] != null) |
---|
| 4858 | + { |
---|
| 4859 | + copy.versionindex = version; |
---|
| 4860 | + CopyChanged(); |
---|
| 4861 | + } |
---|
| 4862 | + |
---|
| 4863 | + return; |
---|
| 4864 | + } |
---|
3520 | 4865 | |
---|
3521 | 4866 | if (freezematerial) |
---|
3522 | 4867 | { |
---|
.. | .. |
---|
3530 | 4875 | || e.getSource() == apertureField |
---|
3531 | 4876 | || e.getSource() == shadowblurField) |
---|
3532 | 4877 | { |
---|
| 4878 | + new Exception().printStackTrace(); |
---|
3533 | 4879 | System.exit(0); |
---|
3534 | 4880 | cameraView.options1[0] = (float) focusField.getFloat() * 10; |
---|
3535 | 4881 | cameraView.options1[1] = (float) apertureField.getFloat() / 1000; |
---|
.. | .. |
---|
3551 | 4897 | { |
---|
3552 | 4898 | //System.out.println("stateChanged = " + this); |
---|
3553 | 4899 | materialtouched = true; |
---|
| 4900 | + |
---|
| 4901 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4902 | + { |
---|
| 4903 | + saturationField.setFloat(1); |
---|
| 4904 | + } |
---|
| 4905 | + |
---|
3554 | 4906 | applySelf(); |
---|
3555 | 4907 | //System.out.println("this = " + this); |
---|
3556 | 4908 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
3600 | 4952 | } |
---|
3601 | 4953 | |
---|
3602 | 4954 | if (normalpushField != null) |
---|
3603 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 4955 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3604 | 4956 | } |
---|
3605 | 4957 | |
---|
3606 | 4958 | void SnapObject() |
---|
.. | .. |
---|
3850 | 5202 | { |
---|
3851 | 5203 | if (GetTree() != null) |
---|
3852 | 5204 | { |
---|
| 5205 | + GetTree().revalidate(); |
---|
3853 | 5206 | GetTree().repaint(); |
---|
3854 | 5207 | } |
---|
3855 | 5208 | |
---|
3856 | 5209 | radioPanel.revalidate(); |
---|
3857 | 5210 | radioPanel.repaint(); |
---|
3858 | | - ctrlPanel.revalidate(); // ? new |
---|
| 5211 | + ctrlPanel.validate(); // ? new |
---|
3859 | 5212 | ctrlPanel.repaint(); |
---|
3860 | 5213 | } |
---|
| 5214 | + |
---|
| 5215 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5216 | + SetVersionStates(); |
---|
| 5217 | + |
---|
| 5218 | + cameraView.requestFocusInWindow(); |
---|
3861 | 5219 | } |
---|
3862 | 5220 | |
---|
3863 | 5221 | static TweenManager tweenManager = new TweenManager(); |
---|
3864 | 5222 | |
---|
3865 | 5223 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3866 | 5224 | { |
---|
| 5225 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
| 5226 | + Save(); |
---|
3867 | 5227 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3868 | 5228 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3869 | 5229 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3887 | 5247 | // group = (Composite) group.get(0); |
---|
3888 | 5248 | // } |
---|
3889 | 5249 | |
---|
3890 | | - System.out.println("makeSomething of " + thing); |
---|
| 5250 | + //System.out.println("makeSomething of " + thing); |
---|
3891 | 5251 | |
---|
3892 | 5252 | /* |
---|
3893 | 5253 | if (deselect && jList != null) |
---|
.. | .. |
---|
3950 | 5310 | { |
---|
3951 | 5311 | ResetModel(); |
---|
3952 | 5312 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 5313 | + |
---|
| 5314 | + if (thing.Size() == 0) |
---|
| 5315 | + { |
---|
| 5316 | + //EditSelection(false); |
---|
| 5317 | + } |
---|
| 5318 | + |
---|
3953 | 5319 | refreshContents(); |
---|
3954 | 5320 | } |
---|
3955 | 5321 | |
---|
.. | .. |
---|
4067 | 5433 | } |
---|
4068 | 5434 | } |
---|
4069 | 5435 | } |
---|
| 5436 | + |
---|
4070 | 5437 | LoadGFDThread loadGFDThread; |
---|
4071 | 5438 | |
---|
4072 | 5439 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
4086 | 5453 | |
---|
4087 | 5454 | try |
---|
4088 | 5455 | { |
---|
| 5456 | + // Try compressed version first. |
---|
4089 | 5457 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4090 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 5458 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 5459 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
4091 | 5460 | |
---|
4092 | 5461 | readobj = (Object3D) p.readObject(); |
---|
4093 | 5462 | istream.close(); |
---|
.. | .. |
---|
4095 | 5464 | readobj.ResetDisplayList(); |
---|
4096 | 5465 | } catch (Exception e) |
---|
4097 | 5466 | { |
---|
4098 | | - e.printStackTrace(); |
---|
| 5467 | + if (!e.toString().contains("GZIP")) |
---|
| 5468 | + e.printStackTrace(); |
---|
| 5469 | + |
---|
| 5470 | + try |
---|
| 5471 | + { |
---|
| 5472 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 5473 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 5474 | + |
---|
| 5475 | + readobj = (Object3D) p.readObject(); |
---|
| 5476 | + istream.close(); |
---|
| 5477 | + |
---|
| 5478 | + readobj.ResetDisplayList(); |
---|
| 5479 | + } catch (Exception e2) |
---|
| 5480 | + { |
---|
| 5481 | + e2.printStackTrace(); |
---|
| 5482 | + } |
---|
4099 | 5483 | } |
---|
4100 | 5484 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4101 | 5485 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4141 | 5525 | |
---|
4142 | 5526 | void LoadIt(Object obj) |
---|
4143 | 5527 | { |
---|
| 5528 | + if (obj == null) |
---|
| 5529 | + { |
---|
| 5530 | + // Invalid file |
---|
| 5531 | + return; |
---|
| 5532 | + } |
---|
| 5533 | + |
---|
4144 | 5534 | System.out.println("Loaded " + obj); |
---|
4145 | 5535 | //new Exception().printStackTrace(); |
---|
4146 | 5536 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4150 | 5540 | |
---|
4151 | 5541 | if (readobj != null) |
---|
4152 | 5542 | { |
---|
| 5543 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 5544 | + // Save(); |
---|
4153 | 5545 | try |
---|
4154 | 5546 | { |
---|
4155 | 5547 | //readobj.deepCopySelf(copy); |
---|
4156 | 5548 | copy.clear(); // june 2014 |
---|
| 5549 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5550 | + copy.skyboxext = readobj.skyboxext; |
---|
4157 | 5551 | for (int i = 0; i < readobj.size(); i++) |
---|
4158 | 5552 | { |
---|
4159 | 5553 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4194 | 5588 | } |
---|
4195 | 5589 | } catch (ClassCastException e) |
---|
4196 | 5590 | { |
---|
| 5591 | + e.printStackTrace(); |
---|
4197 | 5592 | assert (false); |
---|
4198 | 5593 | Composite c = (Composite) copy; |
---|
4199 | 5594 | c.children.clear(); |
---|
.. | .. |
---|
4204 | 5599 | c.addChild(csg); |
---|
4205 | 5600 | } |
---|
4206 | 5601 | |
---|
| 5602 | + copy.versionlist = readobj.versionlist; |
---|
| 5603 | + copy.versionindex = readobj.versionindex; |
---|
| 5604 | + copy.versiontable = readobj.versiontable; |
---|
| 5605 | + |
---|
| 5606 | + if (copy.versionlist == null) |
---|
| 5607 | + { |
---|
| 5608 | + // Backward compatibility |
---|
| 5609 | + copy.versionlist = new Object3D[100]; |
---|
| 5610 | + copy.versionindex = -1; |
---|
| 5611 | + |
---|
| 5612 | + //Save(true); |
---|
| 5613 | + } |
---|
| 5614 | + |
---|
| 5615 | + //? SetUndoStates(); |
---|
| 5616 | + |
---|
4207 | 5617 | ResetModel(); |
---|
4208 | 5618 | copy.HardTouch(); // recompile? |
---|
4209 | 5619 | refreshContents(); |
---|
4210 | 5620 | } |
---|
4211 | 5621 | } |
---|
4212 | 5622 | |
---|
4213 | | - void load() // throws ClassNotFoundException |
---|
| 5623 | + void Open() // throws ClassNotFoundException |
---|
4214 | 5624 | { |
---|
4215 | | - if (GrafreeD.standAlone) |
---|
| 5625 | + if (Grafreed.standAlone) |
---|
4216 | 5626 | { |
---|
4217 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5627 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4218 | 5628 | browser.show(); |
---|
4219 | 5629 | String filename = browser.getFile(); |
---|
4220 | 5630 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4291 | 5701 | |
---|
4292 | 5702 | void save() |
---|
4293 | 5703 | { |
---|
| 5704 | + Replace(); |
---|
| 5705 | + |
---|
4294 | 5706 | if (lastname == null) |
---|
4295 | 5707 | { |
---|
4296 | 5708 | return; |
---|
.. | .. |
---|
4299 | 5711 | try |
---|
4300 | 5712 | { |
---|
4301 | 5713 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4302 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 5714 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5715 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4303 | 5716 | |
---|
4304 | 5717 | p.writeObject(copy); |
---|
4305 | 5718 | p.flush(); |
---|
4306 | 5719 | |
---|
| 5720 | + zstream.close(); |
---|
4307 | 5721 | ostream.close(); |
---|
4308 | 5722 | |
---|
4309 | 5723 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4311 | 5725 | //ps.print(buffer.toString()); |
---|
4312 | 5726 | } catch (IOException e) |
---|
4313 | 5727 | { |
---|
| 5728 | + e.printStackTrace(); |
---|
4314 | 5729 | } |
---|
4315 | 5730 | } |
---|
| 5731 | + |
---|
4316 | 5732 | String lastname; |
---|
4317 | 5733 | |
---|
4318 | 5734 | void saveAs() |
---|
4319 | 5735 | { |
---|
4320 | | - if (GrafreeD.standAlone) |
---|
| 5736 | + if (Grafreed.standAlone) |
---|
4321 | 5737 | { |
---|
4322 | 5738 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4323 | 5739 | browser.setVisible(true); |
---|
4324 | 5740 | String filename = browser.getFile(); |
---|
4325 | 5741 | if (filename != null && filename.length() > 0) |
---|
4326 | 5742 | { |
---|
| 5743 | + if (!filename.endsWith(".gfd")) |
---|
| 5744 | + filename += ".gfd"; |
---|
4327 | 5745 | lastname = browser.getDirectory() + filename; |
---|
4328 | 5746 | save(); |
---|
4329 | 5747 | } |
---|
.. | .. |
---|
4422 | 5840 | try |
---|
4423 | 5841 | { |
---|
4424 | 5842 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4425 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4426 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 5843 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5844 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4427 | 5845 | |
---|
4428 | 5846 | Object3D objectparent = obj.parent; |
---|
4429 | 5847 | obj.parent = null; |
---|
4430 | 5848 | |
---|
4431 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 5849 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4432 | 5850 | |
---|
4433 | 5851 | obj.parent = objectparent; |
---|
4434 | 5852 | |
---|
.. | .. |
---|
4440 | 5858 | p.writeObject(object); |
---|
4441 | 5859 | p.flush(); |
---|
4442 | 5860 | |
---|
| 5861 | + zstream.close(); |
---|
4443 | 5862 | ostream.close(); |
---|
4444 | | - // zstream.close(); |
---|
4445 | 5863 | |
---|
4446 | 5864 | // group.selection.get(0).parent = parent; |
---|
4447 | 5865 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4462 | 5880 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4463 | 5881 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4464 | 5882 | copy.generatePOV(buffer); |
---|
4465 | | - if (GrafreeD.standAlone) |
---|
| 5883 | + if (Grafreed.standAlone) |
---|
4466 | 5884 | { |
---|
4467 | 5885 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4468 | 5886 | browser.show(); |
---|
.. | .. |
---|
4488 | 5906 | Object3D client; |
---|
4489 | 5907 | Object3D copy; |
---|
4490 | 5908 | MenuBar menuBar; |
---|
4491 | | - Menu windowMenu; |
---|
4492 | | - MenuItem loadItem; |
---|
| 5909 | + Menu fileMenu; |
---|
| 5910 | + MenuItem newItem; |
---|
| 5911 | + MenuItem openItem; |
---|
4493 | 5912 | MenuItem saveItem; |
---|
4494 | 5913 | MenuItem saveAsItem; |
---|
4495 | 5914 | MenuItem exportAsItem; |
---|
4496 | 5915 | MenuItem reexportItem; |
---|
4497 | 5916 | MenuItem povItem; |
---|
4498 | 5917 | MenuItem closeItem; |
---|
4499 | | - Menu cameraMenu; |
---|
| 5918 | + |
---|
4500 | 5919 | CheckboxMenuItem zBufferItem; |
---|
4501 | 5920 | //MenuItem normalLensItem; |
---|
4502 | | - MenuItem editCameraItem; |
---|
4503 | | - MenuItem revertCameraItem; |
---|
4504 | | - CheckboxMenuItem toggleLiveItem; |
---|
4505 | 5921 | MenuItem stepItem; |
---|
| 5922 | + CheckboxMenuItem toggleLiveItem; |
---|
4506 | 5923 | CheckboxMenuItem toggleFullScreenItem; |
---|
4507 | 5924 | CheckboxMenuItem toggleTimelineItem; |
---|
4508 | 5925 | CheckboxMenuItem toggleRenderItem; |
---|
.. | .. |
---|
4511 | 5928 | CheckboxMenuItem toggleFootContactItem; |
---|
4512 | 5929 | CheckboxMenuItem toggleDLItem; |
---|
4513 | 5930 | CheckboxMenuItem toggleTextureItem; |
---|
4514 | | - CheckboxMenuItem toggleRandomItem; |
---|
| 5931 | + CheckboxMenuItem toggleSwitchItem; |
---|
4515 | 5932 | CheckboxMenuItem toggleRootItem; |
---|
4516 | 5933 | CheckboxMenuItem animationItem; |
---|
| 5934 | + MenuItem archiveItem; |
---|
4517 | 5935 | CheckboxMenuItem toggleHandleItem; |
---|
4518 | 5936 | CheckboxMenuItem togglePaintItem; |
---|
4519 | 5937 | JSplitPane mainPanel; |
---|
4520 | 5938 | JScrollPane scrollpane; |
---|
| 5939 | + |
---|
4521 | 5940 | JPanel toolbarPanel; |
---|
4522 | | - JPanel treePanel; |
---|
| 5941 | + |
---|
| 5942 | + cGridBag treePanel; |
---|
| 5943 | + |
---|
4523 | 5944 | JPanel radioPanel; |
---|
4524 | 5945 | ButtonGroup buttonGroup; |
---|
4525 | | - JPanel ctrlPanel; |
---|
4526 | | - JPanel materialPanel; |
---|
| 5946 | + |
---|
| 5947 | + cGridBag toolboxPanel; |
---|
| 5948 | + cGridBag skyboxPanel; |
---|
| 5949 | + cGridBag materialPanel; |
---|
| 5950 | + cGridBag ctrlPanel; |
---|
| 5951 | + |
---|
4527 | 5952 | JScrollPane infoPanel; |
---|
4528 | | - JPanel optionsPanel; |
---|
| 5953 | + |
---|
| 5954 | + cGridBag optionsPanel; |
---|
| 5955 | + |
---|
4529 | 5956 | JTabbedPane objectPanel; |
---|
4530 | | - JPanel XYZPanel; |
---|
| 5957 | + boolean materialFlushed; |
---|
| 5958 | + Object3D latestObject; |
---|
| 5959 | + |
---|
| 5960 | + cGridBag XYZPanel; |
---|
| 5961 | + |
---|
4531 | 5962 | JSplitPane gridPanel; |
---|
4532 | 5963 | JSplitPane bigPanel; |
---|
4533 | | - JPanel bigThree; |
---|
4534 | | - JTabbedPane scenePanel; |
---|
4535 | | - JPanel centralPanel; |
---|
| 5964 | + |
---|
| 5965 | + cGridBag bigThree; |
---|
| 5966 | + cGridBag scenePanel; |
---|
| 5967 | + cGridBag centralPanel; |
---|
| 5968 | + JSplitPane cameraPanel; |
---|
4536 | 5969 | JPanel timelinePanel; |
---|
4537 | 5970 | JMenuBar timelineMenubar; |
---|
4538 | 5971 | JSplitPane framePanel; |
---|
.. | .. |
---|
4584 | 6017 | // MATERIAL |
---|
4585 | 6018 | JLabel materialLabel; |
---|
4586 | 6019 | JLabel colorLabel; |
---|
4587 | | - NumberSlider colorField; |
---|
| 6020 | + cNumberSlider colorField; |
---|
4588 | 6021 | JLabel modulationLabel; |
---|
4589 | | - NumberSlider modulationField; |
---|
| 6022 | + cNumberSlider saturationField; |
---|
4590 | 6023 | JLabel metalnessLabel; |
---|
4591 | | - NumberSlider metalnessField; |
---|
| 6024 | + cNumberSlider metalnessField; |
---|
4592 | 6025 | JLabel diffuseLabel; |
---|
4593 | | - NumberSlider diffuseField; |
---|
| 6026 | + cNumberSlider diffuseField; |
---|
4594 | 6027 | JLabel specularLabel; |
---|
4595 | | - NumberSlider specularField; |
---|
| 6028 | + cNumberSlider specularField; |
---|
4596 | 6029 | JLabel shininessLabel; |
---|
4597 | | - NumberSlider shininessField; |
---|
| 6030 | + cNumberSlider shininessField; |
---|
4598 | 6031 | JLabel shiftLabel; |
---|
4599 | | - NumberSlider shiftField; |
---|
| 6032 | + cNumberSlider shiftField; |
---|
4600 | 6033 | JLabel ambientLabel; |
---|
4601 | | - NumberSlider ambientField; |
---|
| 6034 | + cNumberSlider ambientField; |
---|
4602 | 6035 | JLabel lightareaLabel; |
---|
4603 | | - NumberSlider lightareaField; |
---|
| 6036 | + cNumberSlider lightareaField; |
---|
4604 | 6037 | JLabel diffusenessLabel; |
---|
4605 | | - NumberSlider diffusenessField; |
---|
| 6038 | + cNumberSlider diffusenessField; |
---|
4606 | 6039 | JLabel velvetLabel; |
---|
4607 | | - NumberSlider velvetField; |
---|
| 6040 | + cNumberSlider velvetField; |
---|
4608 | 6041 | JLabel sheenLabel; |
---|
4609 | | - NumberSlider sheenField; |
---|
| 6042 | + cNumberSlider sheenField; |
---|
4610 | 6043 | JLabel subsurfaceLabel; |
---|
4611 | | - NumberSlider subsurfaceField; |
---|
| 6044 | + cNumberSlider subsurfaceField; |
---|
4612 | 6045 | //JLabel bumpLabel; |
---|
4613 | 6046 | //NumberSlider bumpField; |
---|
4614 | 6047 | JLabel backlitLabel; |
---|
4615 | | - NumberSlider backlitField; |
---|
| 6048 | + cNumberSlider backlitField; |
---|
4616 | 6049 | JLabel anisoLabel; |
---|
4617 | | - NumberSlider anisoField; |
---|
| 6050 | + cNumberSlider anisoField; |
---|
4618 | 6051 | JLabel anisoVLabel; |
---|
4619 | | - NumberSlider anisoVField; |
---|
| 6052 | + cNumberSlider anisoVField; |
---|
| 6053 | + |
---|
4620 | 6054 | JLabel cameraLabel; |
---|
4621 | | - NumberSlider cameraField; |
---|
| 6055 | + cNumberSlider cameraField; |
---|
4622 | 6056 | JLabel selfshadowLabel; |
---|
4623 | | - NumberSlider selfshadowField; |
---|
| 6057 | + cNumberSlider selfshadowField; |
---|
4624 | 6058 | JLabel shadowLabel; |
---|
4625 | | - NumberSlider shadowField; |
---|
| 6059 | + cNumberSlider shadowField; |
---|
4626 | 6060 | JLabel textureLabel; |
---|
4627 | | - NumberSlider textureField; |
---|
| 6061 | + cNumberSlider textureField; |
---|
4628 | 6062 | JLabel opacityLabel; |
---|
4629 | | - NumberSlider opacityField; |
---|
| 6063 | + cNumberSlider opacityField; |
---|
4630 | 6064 | JLabel fakedepthLabel; |
---|
4631 | | - NumberSlider fakedepthField; |
---|
| 6065 | + cNumberSlider fakedepthField; |
---|
4632 | 6066 | JLabel shadowbiasLabel; |
---|
4633 | | - NumberSlider shadowbiasField; |
---|
| 6067 | + cNumberSlider shadowbiasField; |
---|
| 6068 | + |
---|
4634 | 6069 | JLabel bumpLabel; |
---|
4635 | | - NumberSlider bumpField; |
---|
| 6070 | + cNumberSlider bumpField; |
---|
4636 | 6071 | JLabel noiseLabel; |
---|
4637 | | - NumberSlider noiseField; |
---|
| 6072 | + cNumberSlider noiseField; |
---|
4638 | 6073 | JLabel powerLabel; |
---|
4639 | | - NumberSlider powerField; |
---|
| 6074 | + cNumberSlider powerField; |
---|
4640 | 6075 | JLabel borderfadeLabel; |
---|
4641 | | - NumberSlider borderfadeField; |
---|
| 6076 | + cNumberSlider borderfadeField; |
---|
4642 | 6077 | JLabel fogLabel; |
---|
4643 | | - NumberSlider fogField; |
---|
| 6078 | + cNumberSlider fogField; |
---|
4644 | 6079 | JLabel opacityPowerLabel; |
---|
4645 | | - NumberSlider opacityPowerField; |
---|
4646 | | - JTree jTree; |
---|
| 6080 | + cNumberSlider opacityPowerField; |
---|
| 6081 | + cTree jTree; |
---|
4647 | 6082 | //ObjectUI parent; |
---|
4648 | 6083 | |
---|
4649 | | - NumberSlider normalpushField; |
---|
| 6084 | + cNumberSlider normalpushField; |
---|
| 6085 | + |
---|
| 6086 | + private MenuItem importGFDItem; |
---|
| 6087 | + private MenuItem importVRMLX3DItem; |
---|
| 6088 | + private MenuItem import3DSItem; |
---|
| 6089 | + private MenuItem importOBJItem; |
---|
4650 | 6090 | } |
---|