.. | .. |
---|
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; |
---|
| 38 | + boolean timeline; |
---|
| 39 | + boolean wasFullScreen; |
---|
31 | 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 | + if (icon != null || name.contains("/")) |
---|
| 87 | + return new cButton(icon, border); |
---|
| 88 | + else |
---|
| 89 | + return new cButton(name, border); |
---|
| 90 | + } |
---|
| 91 | + |
---|
| 92 | + cLabel GetLabel(String name, boolean border) |
---|
| 93 | + { |
---|
| 94 | + //ImageIcon icon = GetIcon(name); |
---|
| 95 | + return new cLabel(GetImage(name), border); |
---|
| 96 | + } |
---|
| 97 | + |
---|
| 98 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 99 | + { |
---|
| 100 | + ImageIcon icon = GetIcon(name); |
---|
| 101 | + return new cToggleButton(icon, border); |
---|
| 102 | + } |
---|
| 103 | + |
---|
| 104 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 105 | + { |
---|
| 106 | + ImageIcon icon = GetIcon(name); |
---|
| 107 | + return new cCheckBox(icon, border); |
---|
| 108 | + } |
---|
| 109 | + |
---|
| 110 | + static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>(); |
---|
| 111 | + |
---|
| 112 | + static ImageIcon GetIcon(String name) |
---|
| 113 | + { |
---|
| 114 | + javax.swing.ImageIcon iconCache = icons.get(name); |
---|
| 115 | + if (iconCache != null) |
---|
| 116 | + { |
---|
| 117 | + return iconCache; |
---|
| 118 | + } |
---|
| 119 | + |
---|
| 120 | + try |
---|
| 121 | + { |
---|
| 122 | + BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
| 123 | + |
---|
| 124 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 125 | +// { |
---|
| 126 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 127 | +// Graphics2D g = resized.createGraphics(); |
---|
| 128 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 129 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 130 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 131 | +// g.dispose(); |
---|
| 132 | +// |
---|
| 133 | +// image = resized; |
---|
| 134 | +// } |
---|
| 135 | + |
---|
| 136 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 137 | + |
---|
| 138 | + icons.put(name, icon); |
---|
| 139 | + |
---|
| 140 | + return icon; |
---|
| 141 | + } |
---|
| 142 | + catch (Exception e) |
---|
| 143 | + { |
---|
| 144 | + //icons.put(name, null); |
---|
| 145 | + return null; |
---|
| 146 | + } |
---|
| 147 | + } |
---|
| 148 | + |
---|
| 149 | + BufferedImage GetImage(String name) |
---|
| 150 | + { |
---|
| 151 | + try |
---|
| 152 | + { |
---|
| 153 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 154 | + |
---|
| 155 | + return image; |
---|
| 156 | + } |
---|
| 157 | + catch (Exception e) |
---|
| 158 | + { |
---|
| 159 | + return null; |
---|
| 160 | + } |
---|
| 161 | + } |
---|
| 162 | + |
---|
32 | 163 | // SCRIPT |
---|
33 | 164 | |
---|
34 | 165 | transient JFrame textpanel = null; |
---|
.. | .. |
---|
119 | 250 | void keyPressed(int key, int modifiers) |
---|
120 | 251 | { |
---|
121 | 252 | System.out.println("KEY PRESSED"); |
---|
122 | | - CameraPane.theRenderer.keyPressed(key, modifiers); |
---|
| 253 | + Globals.theRenderer.keyPressed(key, modifiers); |
---|
123 | 254 | } |
---|
124 | 255 | */ |
---|
125 | 256 | |
---|
126 | 257 | static GridBagConstraints aConstraints; |
---|
127 | 258 | static GridBagConstraints aWindowConstraints; |
---|
128 | | - GroupEditor callee; |
---|
129 | | - JFrame frame; |
---|
| 259 | + |
---|
130 | 260 | static int GRIDWIDTH = 100; // 4; |
---|
131 | 261 | |
---|
132 | 262 | public void closeUI() |
---|
133 | 263 | { |
---|
134 | 264 | //new Exception().printStackTrace(); |
---|
135 | | - System.out.println("this = " + this); |
---|
136 | | - System.out.println("objEditor = " + objEditor); |
---|
| 265 | +// System.out.println("this = " + this); |
---|
| 266 | +// System.out.println("objEditor = " + objEditor); |
---|
137 | 267 | //nameField.removeActionListener(this); |
---|
138 | | - objEditor.ctrlPanel.remove(nameField); |
---|
| 268 | +// objEditor.ctrlPanel.remove(nameField); |
---|
139 | 269 | |
---|
140 | | - if (!GroupEditor.allparams) |
---|
| 270 | + objEditor.ctrlPanel.remove(namePanel); |
---|
| 271 | + |
---|
| 272 | + if (!allparams) |
---|
141 | 273 | return; |
---|
142 | 274 | |
---|
143 | | - objEditor.ctrlPanel.remove(liveCB); |
---|
144 | | - objEditor.ctrlPanel.remove(hideCB); |
---|
145 | | - objEditor.ctrlPanel.remove(markCB); |
---|
146 | | - |
---|
147 | | - objEditor.ctrlPanel.remove(randomCB); |
---|
148 | | - objEditor.ctrlPanel.remove(speedupCB); |
---|
149 | | - objEditor.ctrlPanel.remove(rewindCB); |
---|
150 | | - |
---|
151 | | - objEditor.ctrlPanel.remove(resetButton); |
---|
152 | | - objEditor.ctrlPanel.remove(stepButton); |
---|
153 | | -// objEditor.ctrlPanel.remove(stepAllButton); |
---|
154 | | -// objEditor.ctrlPanel.remove(resetAllButton); |
---|
155 | | - objEditor.ctrlPanel.remove(link2masterCB); |
---|
156 | | - //objEditor.ctrlPanel.remove(flipVCB); |
---|
157 | | - //objEditor.ctrlPanel.remove(texresMenu); |
---|
158 | | - objEditor.ctrlPanel.remove(slowerButton); |
---|
159 | | - objEditor.ctrlPanel.remove(fasterButton); |
---|
160 | | - objEditor.ctrlPanel.remove(remarkButton); |
---|
| 275 | +// objEditor.ctrlPanel.remove(liveCB); |
---|
| 276 | +// objEditor.ctrlPanel.remove(hideCB); |
---|
| 277 | +// objEditor.ctrlPanel.remove(markCB); |
---|
| 278 | +// |
---|
| 279 | +// objEditor.ctrlPanel.remove(randomCB); |
---|
| 280 | +// objEditor.ctrlPanel.remove(speedupCB); |
---|
| 281 | +// objEditor.ctrlPanel.remove(rewindCB); |
---|
| 282 | +// |
---|
| 283 | +// objEditor.ctrlPanel.remove(resetButton); |
---|
| 284 | +// objEditor.ctrlPanel.remove(stepButton); |
---|
| 285 | +//// objEditor.ctrlPanel.remove(stepAllButton); |
---|
| 286 | +//// objEditor.ctrlPanel.remove(resetAllButton); |
---|
| 287 | +// objEditor.ctrlPanel.remove(link2masterCB); |
---|
| 288 | +// //objEditor.ctrlPanel.remove(flipVCB); |
---|
| 289 | +// //objEditor.ctrlPanel.remove(texresMenu); |
---|
| 290 | +// objEditor.ctrlPanel.remove(slowerButton); |
---|
| 291 | +// objEditor.ctrlPanel.remove(fasterButton); |
---|
| 292 | +// objEditor.ctrlPanel.remove(remarkButton); |
---|
| 293 | + |
---|
| 294 | + objEditor.ctrlPanel.remove(setupPanel); |
---|
| 295 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 296 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
| 297 | + objEditor.ctrlPanel.remove(pushPanel); |
---|
| 298 | + //objEditor.ctrlPanel.remove(fillPanel); |
---|
| 299 | + |
---|
| 300 | + //Remove(normalpushField); |
---|
161 | 301 | } |
---|
162 | 302 | |
---|
163 | 303 | public ObjEditor GetEditor() |
---|
164 | 304 | { |
---|
165 | 305 | return objEditor; //.GetEditor(); |
---|
166 | 306 | } |
---|
| 307 | + |
---|
| 308 | + // Sometimes myself, sometimes my callee's. |
---|
167 | 309 | ObjEditor objEditor; |
---|
168 | 310 | |
---|
169 | 311 | /* |
---|
.. | .. |
---|
199 | 341 | client = inClient; |
---|
200 | 342 | copy = client; |
---|
201 | 343 | |
---|
| 344 | +// if (copy.versionlist == null) |
---|
| 345 | +// { |
---|
| 346 | +// copy.versionlist = new Object3D[100]; |
---|
| 347 | +// copy.versionindex = -1; |
---|
| 348 | +// |
---|
| 349 | +// callee.Save(true); |
---|
| 350 | +// } |
---|
| 351 | + |
---|
202 | 352 | // "this" is not called: SetupUI2(objEditor); |
---|
203 | 353 | } |
---|
204 | 354 | |
---|
.. | .. |
---|
212 | 362 | client = inClient; |
---|
213 | 363 | copy = client; |
---|
214 | 364 | |
---|
| 365 | + if (copy.versionlist == null) |
---|
| 366 | + { |
---|
| 367 | + copy.versionlist = new Object3D[100]; |
---|
| 368 | + copy.versionindex = -1; |
---|
| 369 | + |
---|
| 370 | +// Save(true); |
---|
| 371 | + } |
---|
| 372 | + |
---|
215 | 373 | SetupUI2(callee.GetEditor()); |
---|
216 | 374 | } |
---|
217 | 375 | |
---|
.. | .. |
---|
226 | 384 | //localCopy.parent = null; |
---|
227 | 385 | |
---|
228 | 386 | frame = new JFrame(); |
---|
| 387 | + frame.setUndecorated(false); |
---|
229 | 388 | objEditor = this; |
---|
230 | 389 | this.callee = callee; |
---|
231 | 390 | |
---|
232 | 391 | //parent = p; |
---|
233 | 392 | |
---|
234 | 393 | GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
---|
235 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 394 | + if (Globals.DEBUG) |
---|
| 395 | + System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
236 | 396 | //gd.setFullScreenWindow(this); |
---|
237 | 397 | //setResizable(false); |
---|
238 | 398 | //if (!isDisplayable()) |
---|
239 | 399 | //setUndecorated(true); |
---|
240 | 400 | |
---|
241 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 401 | + //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
242 | 402 | client = inClient; |
---|
243 | 403 | copy = localCopy; |
---|
244 | 404 | copy.editWindow = this; |
---|
245 | 405 | |
---|
| 406 | +// if (copy.versionlist == null) |
---|
| 407 | +// { |
---|
| 408 | +// copy.versionlist = new Object3D[100]; |
---|
| 409 | +// copy.versionindex = -1; |
---|
| 410 | +// |
---|
| 411 | +// Save(true); |
---|
| 412 | +// } |
---|
| 413 | + |
---|
246 | 414 | SetupMenu(); |
---|
247 | 415 | |
---|
248 | 416 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
256 | 424 | return frame.action(event, obj); |
---|
257 | 425 | } |
---|
258 | 426 | |
---|
| 427 | + // Cannot work without static |
---|
| 428 | + static boolean allparams = true; |
---|
| 429 | + |
---|
| 430 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 431 | + |
---|
| 432 | + // This is to refresh the UI of the material panel. |
---|
| 433 | + boolean patchMaterial; |
---|
| 434 | + |
---|
259 | 435 | void SetupMenu() |
---|
260 | 436 | { |
---|
261 | 437 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
262 | | - menuBar.add(windowMenu = new Menu("File")); |
---|
263 | | - windowMenu.add(loadItem = new MenuItem("Load...")); |
---|
264 | | - windowMenu.add("-"); |
---|
265 | | - windowMenu.add(saveItem = new MenuItem("Save")); |
---|
266 | | - windowMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
| 438 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 439 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 440 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
| 441 | + |
---|
| 442 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 443 | + Menu menu = new Menu("Import"); |
---|
| 444 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 445 | + importOBJItem.addActionListener(this); |
---|
| 446 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 447 | + import3DSItem.addActionListener(this); |
---|
| 448 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 449 | + importVRMLX3DItem.addActionListener(this); |
---|
| 450 | + menu.add("-"); |
---|
| 451 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 452 | + importGFDItem.addActionListener(this); |
---|
| 453 | + fileMenu.add(menu); |
---|
| 454 | + fileMenu.add("-"); |
---|
| 455 | + |
---|
| 456 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 457 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
267 | 458 | //windowMenu.add(povItem = new MenuItem("Emit POV-Ray...")); |
---|
268 | | - windowMenu.add("-"); |
---|
269 | | - windowMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
270 | | - windowMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
271 | | - windowMenu.add("-"); |
---|
| 459 | + fileMenu.add("-"); |
---|
| 460 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 461 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 462 | + fileMenu.add("-"); |
---|
272 | 463 | if (client.parent != null) |
---|
273 | 464 | { |
---|
274 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 465 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
275 | 466 | } else |
---|
276 | 467 | { |
---|
277 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 468 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
278 | 469 | } |
---|
279 | 470 | |
---|
280 | | - loadItem.addActionListener(this); |
---|
| 471 | + newItem.addActionListener(this); |
---|
| 472 | + openItem.addActionListener(this); |
---|
281 | 473 | saveItem.addActionListener(this); |
---|
282 | 474 | saveAsItem.addActionListener(this); |
---|
283 | 475 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
285 | 477 | //povItem.addActionListener(this); |
---|
286 | 478 | closeItem.addActionListener(this); |
---|
287 | 479 | |
---|
288 | | - menuBar.add(cameraMenu = new Menu("View")); |
---|
289 | | - //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer")); |
---|
290 | | - //zBufferItem.addActionListener(this); |
---|
291 | | - //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens")); |
---|
292 | | - //normalLensItem.addActionListener(this); |
---|
293 | | - cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera")); |
---|
294 | | - revertCameraItem.addActionListener(this); |
---|
295 | | - cameraMenu.add(toggleFullItem = new CheckboxMenuItem("Full Screen")); |
---|
296 | | - toggleFullItem.addItemListener(this); |
---|
297 | | - toggleFullItem.setState(CameraPane.FULLSCREEN); |
---|
298 | | - cameraMenu.add("-"); |
---|
299 | | - cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); |
---|
300 | | - toggleTextureItem.addItemListener(this); |
---|
301 | | - toggleTextureItem.setState(CameraPane.textureon); |
---|
302 | | - cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); |
---|
303 | | - toggleLiveItem.addItemListener(this); |
---|
304 | | - toggleLiveItem.setState(CameraPane.isLIVE()); |
---|
305 | | - cameraMenu.add(stepItem = new MenuItem("Step")); |
---|
306 | | - stepItem.addActionListener(this); |
---|
307 | | -// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); |
---|
308 | | -// toggleDLItem.addItemListener(this); |
---|
309 | | -// toggleDLItem.setState(false); |
---|
310 | | - cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render")); |
---|
311 | | - toggleRenderItem.addItemListener(this); |
---|
312 | | - toggleRenderItem.setState(!CameraPane.frozen); |
---|
313 | | - cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); |
---|
314 | | - toggleDebugItem.addItemListener(this); |
---|
315 | | - toggleDebugItem.setState(CameraPane.DEBUG); |
---|
316 | | - cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); |
---|
317 | | - toggleFrustumItem.addItemListener(this); |
---|
318 | | - toggleFrustumItem.setState(CameraPane.FRUSTUM); |
---|
319 | | - cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact")); |
---|
320 | | - toggleFootContactItem.addItemListener(this); |
---|
321 | | - toggleFootContactItem.setState(CameraPane.FOOTCONTACT); |
---|
322 | | - cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random")); |
---|
323 | | - toggleRandomItem.addItemListener(this); |
---|
324 | | - toggleRandomItem.setState(CameraPane.RANDOM); |
---|
325 | | - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); |
---|
326 | | - toggleHandleItem.addItemListener(this); |
---|
327 | | - toggleHandleItem.setState(CameraPane.HANDLES); |
---|
328 | | - cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode")); |
---|
329 | | - togglePaintItem.addItemListener(this); |
---|
330 | | - togglePaintItem.setState(CameraPane.PAINTMODE); |
---|
331 | | -// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root")); |
---|
332 | | -// toggleRootItem.addItemListener(this); |
---|
333 | | -// toggleRootItem.setState(false); |
---|
334 | | -// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation")); |
---|
335 | | -// animationItem.addItemListener(this); |
---|
336 | | -// animationItem.setState(CameraPane.ANIMATION); |
---|
337 | | - cameraMenu.add("-"); |
---|
338 | | - cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera")); |
---|
339 | | - editCameraItem.addActionListener(this); |
---|
340 | | - |
---|
341 | 480 | objectPanel = new JTabbedPane(); |
---|
| 481 | + |
---|
| 482 | + ChangeListener changeListener = new ChangeListener() |
---|
| 483 | + { |
---|
| 484 | + //String name; |
---|
| 485 | + |
---|
| 486 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 487 | + { |
---|
| 488 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 489 | +// { |
---|
| 490 | +// if (latestObject != null) |
---|
| 491 | +// { |
---|
| 492 | +// refreshContents(true); |
---|
| 493 | +// SetMaterial(latestObject); |
---|
| 494 | +// } |
---|
| 495 | +// |
---|
| 496 | +// materialFlushed = true; |
---|
| 497 | +// } |
---|
| 498 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 499 | +// { |
---|
| 500 | +// if (listUI.size() == 0) |
---|
| 501 | +// EditSelection(false); |
---|
| 502 | +// } |
---|
| 503 | + |
---|
| 504 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 505 | +// { |
---|
| 506 | +// name = copy.skyboxname; |
---|
| 507 | +// |
---|
| 508 | +// if (name == null) |
---|
| 509 | +// { |
---|
| 510 | +// name = ""; |
---|
| 511 | +// } |
---|
| 512 | +// |
---|
| 513 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 514 | +// copy.skyboxext = "jpg"; |
---|
| 515 | +// } |
---|
| 516 | +// else |
---|
| 517 | +// { |
---|
| 518 | +// if (name != null) |
---|
| 519 | +// { |
---|
| 520 | +// if (name.equals("")) |
---|
| 521 | +// { |
---|
| 522 | +// copy.skyboxname = null; |
---|
| 523 | +// copy.skyboxext = null; |
---|
| 524 | +// } |
---|
| 525 | +// else |
---|
| 526 | +// { |
---|
| 527 | +// copy.skyboxname = name; |
---|
| 528 | +// } |
---|
| 529 | +// } |
---|
| 530 | +// } |
---|
| 531 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 532 | + |
---|
| 533 | +// refreshContents(false); // To refresh Info tab |
---|
| 534 | + cameraView.repaint(); |
---|
| 535 | + } |
---|
| 536 | + }; |
---|
| 537 | + objectPanel.addChangeListener(changeListener); |
---|
| 538 | + |
---|
342 | 539 | toolbarPanel = new JPanel(); |
---|
343 | 540 | toolbarPanel.setName("Toolbar"); |
---|
344 | | - treePanel = new JPanel(); |
---|
| 541 | + |
---|
| 542 | + treePanel = new cGridBag(); |
---|
345 | 543 | treePanel.setName("Tree"); |
---|
346 | | - ctrlPanel = new JPanel(); // new GridBagLayout()); |
---|
347 | | - ctrlPanel.setName("Edit"); |
---|
348 | | - materialPanel = new JPanel(); |
---|
349 | | - materialPanel.setName("Material"); |
---|
| 544 | + |
---|
| 545 | + editPanel = new cGridBag().setVertical(true); |
---|
| 546 | + //editPanel.setName("Edit"); |
---|
| 547 | + |
---|
| 548 | + ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
| 549 | + |
---|
| 550 | + editCommandsPanel = new cGridBag(); |
---|
| 551 | + editPanel.add(editCommandsPanel); |
---|
| 552 | + editPanel.add(ctrlPanel); |
---|
| 553 | + |
---|
| 554 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 555 | + //toolboxPanel.setName("Toolbox"); |
---|
| 556 | + |
---|
| 557 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 558 | + |
---|
| 559 | + materialPanel = new cGridBag().setVertical(false); |
---|
| 560 | + //materialPanel.setName("Material"); |
---|
| 561 | + |
---|
350 | 562 | /*JTextPane*/ |
---|
351 | 563 | infoarea = createTextPane(); |
---|
| 564 | + doc = infoarea.getStyledDocument(); |
---|
| 565 | + |
---|
352 | 566 | infoarea.setEditable(true); |
---|
353 | 567 | SetText(); |
---|
| 568 | + |
---|
354 | 569 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
355 | 570 | // infoarea.setOpaque(false); |
---|
356 | 571 | // //infoarea.setForeground(textcolor); |
---|
357 | | - infoarea.setLineWrap(true); |
---|
358 | | - infoarea.setWrapStyleWord(true); |
---|
| 572 | +// TEXTAREA infoarea.setLineWrap(true); |
---|
| 573 | +// TEXTAREA infoarea.setWrapStyleWord(true); |
---|
359 | 574 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
360 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
361 | | - infoPanel.setName("Info"); |
---|
| 575 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
| 576 | + //infoPanel.setName("Info"); |
---|
362 | 577 | //infoPanel.setLayout(new BorderLayout()); |
---|
363 | 578 | //infoPanel.add(createTextPane()); |
---|
364 | 579 | |
---|
.. | .. |
---|
366 | 581 | mainPanel.setName("Main"); |
---|
367 | 582 | mainPanel.setContinuousLayout(true); |
---|
368 | 583 | mainPanel.setOneTouchExpandable(true); |
---|
369 | | - mainPanel.setDividerLocation(1.0); |
---|
370 | 584 | mainPanel.setDividerSize(9); |
---|
371 | | - mainPanel.setResizeWeight(0); |
---|
372 | | - |
---|
| 585 | + mainPanel.setDividerLocation(0.5); //1.0); |
---|
| 586 | + mainPanel.setResizeWeight(0.5); |
---|
| 587 | + |
---|
| 588 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 589 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 590 | + divider.setDividerSize(15); |
---|
| 591 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 592 | + |
---|
| 593 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 594 | + |
---|
373 | 595 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
374 | 596 | //mainPanel.setLayout(new GridBagLayout()); |
---|
375 | 597 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
376 | | - treePanel.setLayout(new GridBagLayout()); |
---|
377 | | - ctrlPanel.setLayout(new GridBagLayout()); |
---|
378 | | - materialPanel.setLayout(new GridBagLayout()); |
---|
| 598 | +// treePanel.setLayout(new GridBagLayout()); |
---|
| 599 | + //ctrlPanel.setLayout(new GridBagLayout()); |
---|
| 600 | + //materialPanel.setLayout(new GridBagLayout()); |
---|
379 | 601 | |
---|
380 | 602 | aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, |
---|
381 | 603 | GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0); |
---|
.. | .. |
---|
414 | 636 | static String newline = "\n"; |
---|
415 | 637 | protected static final String buttonString = "JButton"; |
---|
416 | 638 | StyledDocument doc; |
---|
417 | | - JTextArea infoarea; |
---|
| 639 | + JTextPane infoarea; |
---|
418 | 640 | |
---|
419 | 641 | void ClearInfo() |
---|
420 | 642 | { |
---|
.. | .. |
---|
437 | 659 | e.printStackTrace(); |
---|
438 | 660 | } |
---|
439 | 661 | |
---|
440 | | - String selection = infoarea.getText(); |
---|
441 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
442 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
443 | | - Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
| 662 | +// String selection = infoarea.getText(); |
---|
| 663 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 664 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 665 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
444 | 666 | //clipboard.setContents(data, data); |
---|
445 | 667 | } |
---|
446 | 668 | |
---|
.. | .. |
---|
463 | 685 | //SendInfo("Name:", "bold"); |
---|
464 | 686 | if (sel.GetTextures() != null || debug) |
---|
465 | 687 | { |
---|
466 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 688 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
467 | 689 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
468 | 690 | if (sel.Size() > 0) |
---|
469 | 691 | { |
---|
470 | 692 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
471 | 693 | } |
---|
472 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 694 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
473 | 695 | if (debug) |
---|
474 | 696 | { |
---|
475 | 697 | try |
---|
.. | .. |
---|
481 | 703 | } |
---|
482 | 704 | |
---|
483 | 705 | if (full) |
---|
484 | | - si.SendInfo(" BBox: " + minima + " - " + maxima, "regular"); |
---|
| 706 | + { |
---|
| 707 | + si.SendInfo(" BBox min: " + minima, "regular"); |
---|
| 708 | + si.SendInfo(" BBox max: " + maxima, "regular"); |
---|
| 709 | + } |
---|
485 | 710 | |
---|
486 | 711 | if (sel.bRep != null) |
---|
487 | 712 | { |
---|
.. | .. |
---|
508 | 733 | } |
---|
509 | 734 | if (sel.support != null) |
---|
510 | 735 | { |
---|
511 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 736 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
512 | 737 | } |
---|
513 | 738 | if (sel.scriptnode != null) |
---|
514 | 739 | { |
---|
.. | .. |
---|
522 | 747 | maxima.y = sel.toParent[3][1]; |
---|
523 | 748 | maxima.z = sel.toParent[3][2]; |
---|
524 | 749 | si.SendInfo(" Orig: " + maxima, "regular"); |
---|
525 | | - maxima.x = sel.globalTransform[3][0]; |
---|
526 | | - maxima.y = sel.globalTransform[3][1]; |
---|
527 | | - maxima.z = sel.globalTransform[3][2]; |
---|
528 | | - if (full) |
---|
529 | | - si.SendInfo(" Global Orig: " + maxima, "regular"); |
---|
530 | 750 | maxima.x = sel.toParent[0][0]; |
---|
531 | 751 | maxima.y = sel.toParent[1][1]; |
---|
532 | 752 | maxima.z = sel.toParent[2][2]; |
---|
533 | 753 | si.SendInfo(" Scale: " + maxima, "regular"); |
---|
534 | | - maxima.x = sel.globalTransform[0][0]; |
---|
535 | | - maxima.y = sel.globalTransform[1][1]; |
---|
536 | | - maxima.z = sel.globalTransform[2][2]; |
---|
| 754 | + maxima.x = sel.globalTransform[3][0]; |
---|
| 755 | + maxima.y = sel.globalTransform[3][1]; |
---|
| 756 | + maxima.z = sel.globalTransform[3][2]; |
---|
| 757 | + if (full) |
---|
| 758 | + si.SendInfo(" Global Orig: " + maxima, "regular"); |
---|
| 759 | + maxima.x = sel.globalTransform[0][0]; |
---|
| 760 | + maxima.y = sel.globalTransform[1][1]; |
---|
| 761 | + maxima.z = sel.globalTransform[2][2]; |
---|
537 | 762 | if (full) |
---|
538 | 763 | si.SendInfo(" Global Scale: " + maxima, "regular"); |
---|
539 | 764 | } |
---|
.. | .. |
---|
579 | 804 | { |
---|
580 | 805 | CameraPane.pointflow = (PointFlow) sel; |
---|
581 | 806 | } |
---|
| 807 | + |
---|
| 808 | + si.SendInfo("_____________________", "regular"); |
---|
| 809 | + si.SendInfo("", "regular"); |
---|
582 | 810 | } |
---|
583 | 811 | } |
---|
584 | 812 | |
---|
.. | .. |
---|
594 | 822 | } |
---|
595 | 823 | } |
---|
596 | 824 | |
---|
597 | | - private JTextArea createTextPane() |
---|
598 | | - { |
---|
599 | | - String[] initString = |
---|
600 | | - { |
---|
601 | | - "This is an editable JTextPane, ", //regular |
---|
602 | | - "another ", //italic |
---|
603 | | - "styled ", //bold |
---|
604 | | - "text ", //small |
---|
605 | | - "component, ", //large |
---|
606 | | - "which supports embedded components..." + newline,//regular |
---|
607 | | - " " + newline, //button |
---|
608 | | - "...and embedded icons..." + newline, //regular |
---|
609 | | - " ", //icon |
---|
610 | | - newline + "JTextPane is a subclass of JEditorPane that " |
---|
611 | | - + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
612 | | - + "cover methods for interacting with those objects." |
---|
613 | | - }; |
---|
| 825 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 826 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
614 | 827 | |
---|
615 | | - String[] initStyles = |
---|
616 | | - { |
---|
617 | | - "regular", "italic", "bold", "small", "large", |
---|
618 | | - "regular", "button", "regular", "icon", |
---|
619 | | - "regular" |
---|
620 | | - }; |
---|
| 828 | + Rectangle keeprect; |
---|
| 829 | + cRadio radio; |
---|
| 830 | + |
---|
| 831 | +cButton keepButton; |
---|
| 832 | + cButton twoButton; // Full 3D |
---|
| 833 | + cButton sixButton; |
---|
| 834 | + cButton threeButton; |
---|
| 835 | + cButton sevenButton; |
---|
| 836 | + cButton fourButton; // full panel |
---|
| 837 | + cButton oneButton; // full XYZ |
---|
| 838 | + //cButton currentLayout; |
---|
| 839 | + |
---|
| 840 | + boolean maximized; |
---|
| 841 | + |
---|
| 842 | + cButton fullscreenLayout; |
---|
| 843 | + cButton expandedLayout; |
---|
621 | 844 | |
---|
622 | | - JTextPane textPane = new JTextPane(); |
---|
623 | | - textPane.setEditable(true); |
---|
624 | | - /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
625 | | - addStylesToDocument(doc); |
---|
626 | | - |
---|
627 | | - try |
---|
| 845 | + void Minimize() |
---|
628 | 846 | { |
---|
629 | | - for (int j = 0; j < 2; j++) |
---|
| 847 | + frame.setState(Frame.ICONIFIED); |
---|
| 848 | + frame.validate(); |
---|
| 849 | + } |
---|
| 850 | + |
---|
| 851 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 852 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 853 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
| 854 | + void Maximize() |
---|
| 855 | + { |
---|
| 856 | + if (CameraPane.FULLSCREEN) |
---|
630 | 857 | { |
---|
631 | | - for (int i = 0; i < initString.length; i++) |
---|
632 | | - { |
---|
633 | | - doc.insertString(doc.getLength(), initString[i], |
---|
634 | | - doc.getStyle(initStyles[i])); |
---|
635 | | - } |
---|
| 858 | + ToggleFullScreen(); |
---|
636 | 859 | } |
---|
637 | | - } catch (BadLocationException ble) |
---|
| 860 | + |
---|
| 861 | + if (maximized) |
---|
| 862 | + { |
---|
| 863 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 864 | + } |
---|
| 865 | + else |
---|
| 866 | + { |
---|
| 867 | + keeprect = frame.getBounds(); |
---|
| 868 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 869 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 870 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 871 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 872 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
| 873 | + } |
---|
| 874 | + |
---|
| 875 | + maximized ^= true; |
---|
| 876 | + |
---|
| 877 | + frame.validate(); |
---|
| 878 | + } |
---|
| 879 | + |
---|
| 880 | + cButton minButton; |
---|
| 881 | + cButton maxButton; |
---|
| 882 | + cButton fullButton; |
---|
| 883 | + cButton collapseButton; |
---|
| 884 | + cButton maximize3DButton; |
---|
| 885 | + |
---|
| 886 | + void ToggleFullScreen() |
---|
638 | 887 | { |
---|
639 | | - System.err.println("Couldn't insert initial text into text pane."); |
---|
| 888 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 889 | + |
---|
| 890 | + cameraView.ToggleFullScreen(); |
---|
| 891 | + |
---|
| 892 | + if (!CameraPane.FULLSCREEN) |
---|
| 893 | + { |
---|
| 894 | + device.setFullScreenWindow(null); |
---|
| 895 | + frame.dispose(); |
---|
| 896 | + frame.setUndecorated(false); |
---|
| 897 | + frame.validate(); |
---|
| 898 | + frame.setVisible(true); |
---|
| 899 | + |
---|
| 900 | + //frame.setVisible(false); |
---|
| 901 | +// frame.removeNotify(); |
---|
| 902 | +// frame.setUndecorated(false); |
---|
| 903 | +// frame.addNotify(); |
---|
| 904 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 905 | + |
---|
| 906 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 907 | +// X framePanel.add(bigThree); |
---|
| 908 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 909 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
| 910 | + |
---|
| 911 | + //frame.setVisible(true); |
---|
| 912 | +// radio.layout = keepButton; |
---|
| 913 | + //theFrame = null; |
---|
| 914 | + keepButton = null; |
---|
| 915 | +// radio.layout.doClick(); |
---|
| 916 | + |
---|
| 917 | + } else |
---|
| 918 | + { |
---|
| 919 | + keepButton = radio.layout; |
---|
| 920 | + //keeprect = frame.getBounds(); |
---|
| 921 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 922 | +// frame.getToolkit().getScreenSize().height); |
---|
| 923 | + //frame.setVisible(false); |
---|
| 924 | + |
---|
| 925 | + frame.dispose(); |
---|
| 926 | + frame.setUndecorated(true); |
---|
| 927 | + device.setFullScreenWindow(frame); |
---|
| 928 | + frame.validate(); |
---|
| 929 | + frame.setVisible(true); |
---|
| 930 | +// frame.removeNotify(); |
---|
| 931 | +// frame.setUndecorated(true); |
---|
| 932 | +// frame.addNotify(); |
---|
| 933 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 934 | +// X framePanel.remove(bigThree); |
---|
| 935 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 936 | +// framePanel.setDividerLocation(0); |
---|
| 937 | + |
---|
| 938 | +// radio.layout = fullscreenLayout; |
---|
| 939 | +// radio.layout.doClick(); |
---|
| 940 | + //frame.setVisible(true); |
---|
| 941 | + } |
---|
| 942 | + frame.validate(); |
---|
| 943 | + |
---|
| 944 | + cameraView.requestFocusInWindow(); |
---|
640 | 945 | } |
---|
641 | 946 | |
---|
642 | | - return new JTextArea(); // textPane; |
---|
| 947 | + void CollapseToolbar() |
---|
| 948 | + { |
---|
| 949 | + framePanel.setDividerLocation(0); |
---|
| 950 | + //frame.validate(); |
---|
| 951 | + |
---|
| 952 | + cameraView.requestFocusInWindow(); |
---|
| 953 | + } |
---|
| 954 | + |
---|
| 955 | + private Object3D Duplicate(Object3D object) |
---|
| 956 | + { |
---|
| 957 | + boolean temp = CameraPane.SWITCH; |
---|
| 958 | + CameraPane.SWITCH = false; |
---|
| 959 | + |
---|
| 960 | + if (Grafreed.grafreed.universe.versiontable == null) |
---|
| 961 | + Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 962 | + |
---|
| 963 | + object.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 964 | + // if (copy == client) |
---|
| 965 | + |
---|
| 966 | + Object3D versions[] = object.versionlist; |
---|
| 967 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe |
---|
| 968 | + object.versionlist = null; |
---|
| 969 | + object.versiontable = null; |
---|
| 970 | + |
---|
| 971 | + Object3D parent = object.parent; |
---|
| 972 | + object.parent = null; |
---|
| 973 | + |
---|
| 974 | + //byte[] compress = Compress(copy); |
---|
| 975 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
| 976 | + |
---|
| 977 | + object.parent = parent; |
---|
| 978 | + |
---|
| 979 | + object.versionlist = versions; |
---|
| 980 | + object.versiontable = versiontable; // if Grafreed.grafreed.universe |
---|
| 981 | + |
---|
| 982 | + object.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 983 | + |
---|
| 984 | + CameraPane.SWITCH = temp; |
---|
| 985 | + |
---|
| 986 | + return compress; |
---|
| 987 | + } |
---|
| 988 | + |
---|
| 989 | + private JTextPane createTextPane() |
---|
| 990 | + { |
---|
| 991 | +// TEXTAREA String[] initString = |
---|
| 992 | +// { |
---|
| 993 | +// "This is an editable JTextPane, ", //regular |
---|
| 994 | +// "another ", //italic |
---|
| 995 | +// "styled ", //bold |
---|
| 996 | +// "text ", //small |
---|
| 997 | +// "component, ", //large |
---|
| 998 | +// "which supports embedded components..." + newline,//regular |
---|
| 999 | +// " " + newline, //button |
---|
| 1000 | +// "...and embedded icons..." + newline, //regular |
---|
| 1001 | +// " ", //icon |
---|
| 1002 | +// newline + "JTextPane is a subclass of JEditorPane that " |
---|
| 1003 | +// + "uses a StyledEditorKit and StyledDocument, and provides " |
---|
| 1004 | +// + "cover methods for interacting with those objects." |
---|
| 1005 | +// }; |
---|
| 1006 | +// |
---|
| 1007 | +// String[] initStyles = |
---|
| 1008 | +// { |
---|
| 1009 | +// "regular", "italic", "bold", "small", "large", |
---|
| 1010 | +// "regular", "button", "regular", "icon", |
---|
| 1011 | +// "regular" |
---|
| 1012 | +// }; |
---|
| 1013 | +// |
---|
| 1014 | +// JTextPane textPane = new JTextPane(); |
---|
| 1015 | +// textPane.setEditable(true); |
---|
| 1016 | +// /*StyledDocument*/ doc = textPane.getStyledDocument(); |
---|
| 1017 | +// addStylesToDocument(doc); |
---|
| 1018 | +// |
---|
| 1019 | +// try |
---|
| 1020 | +// { |
---|
| 1021 | +// for (int j = 0; j < 2; j++) |
---|
| 1022 | +// { |
---|
| 1023 | +// for (int i = 0; i < initString.length; i++) |
---|
| 1024 | +// { |
---|
| 1025 | +// doc.insertString(doc.getLength(), initString[i], |
---|
| 1026 | +// doc.getStyle(initStyles[i])); |
---|
| 1027 | +// } |
---|
| 1028 | +// } |
---|
| 1029 | +// } catch (BadLocationException ble) |
---|
| 1030 | +// { |
---|
| 1031 | +// System.err.println("Couldn't insert initial text into text pane."); |
---|
| 1032 | +// } |
---|
| 1033 | + |
---|
| 1034 | + return new JTextPane(); // textPane; |
---|
643 | 1035 | } |
---|
644 | 1036 | |
---|
645 | 1037 | protected void addStylesToDocument(StyledDocument doc) |
---|
.. | .. |
---|
692 | 1084 | protected static ImageIcon createImageIcon(String path, |
---|
693 | 1085 | String description) |
---|
694 | 1086 | { |
---|
695 | | - java.net.URL imgURL = GraphreeD.class.getResource(path); |
---|
| 1087 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
696 | 1088 | if (imgURL != null) |
---|
697 | 1089 | { |
---|
698 | 1090 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
715 | 1107 | { |
---|
716 | 1108 | SetupMaterial(materialPanel); |
---|
717 | 1109 | } |
---|
| 1110 | + |
---|
718 | 1111 | //SetupName(); |
---|
719 | 1112 | //SetupViews(); |
---|
720 | 1113 | } |
---|
.. | .. |
---|
724 | 1117 | // NumberSlider vDivsField; |
---|
725 | 1118 | // JCheckBox endcaps; |
---|
726 | 1119 | JCheckBox liveCB; |
---|
| 1120 | + JCheckBox selectableCB; |
---|
727 | 1121 | JCheckBox hideCB; |
---|
728 | 1122 | JCheckBox link2masterCB; |
---|
729 | 1123 | JCheckBox markCB; |
---|
.. | .. |
---|
731 | 1125 | JCheckBox speedupCB; |
---|
732 | 1126 | JCheckBox rewindCB; |
---|
733 | 1127 | JCheckBox flipVCB; |
---|
| 1128 | + |
---|
| 1129 | + cCheckBox toggleTextureCB; |
---|
| 1130 | + cCheckBox toggleSwitchCB; |
---|
| 1131 | + |
---|
734 | 1132 | JComboBox texresMenu; |
---|
| 1133 | + |
---|
735 | 1134 | JButton resetButton; |
---|
736 | 1135 | JButton stepButton; |
---|
737 | 1136 | JButton stepAllButton; |
---|
.. | .. |
---|
739 | 1138 | JButton slowerButton; |
---|
740 | 1139 | JButton fasterButton; |
---|
741 | 1140 | JButton remarkButton; |
---|
| 1141 | + |
---|
| 1142 | + cGridBag editPanel; |
---|
| 1143 | + cGridBag editCommandsPanel; |
---|
| 1144 | + |
---|
| 1145 | + cGridBag namePanel; |
---|
| 1146 | + cGridBag setupPanel; |
---|
| 1147 | + cGridBag setupPanel2; |
---|
| 1148 | + cGridBag objectCommandsPanel; |
---|
| 1149 | + cGridBag pushPanel; |
---|
| 1150 | + cGridBag fillPanel; |
---|
742 | 1151 | |
---|
743 | | - JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on) |
---|
| 1152 | + JCheckBox AddCheckBox(cGridBag panel, String label, boolean on) |
---|
744 | 1153 | { |
---|
745 | 1154 | JCheckBox cb; |
---|
746 | 1155 | |
---|
747 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
748 | | - oe.aConstraints.gridwidth = 1; // 3; |
---|
749 | | -// oe.aConstraints.weightx = 1; |
---|
750 | | -// oe.aConstraints.anchor = GridBagConstraints.WEST; |
---|
751 | | - oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 1156 | + panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
752 | 1157 | cb.addItemListener(this); |
---|
753 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
754 | | - oe.aConstraints.gridwidth = 1; |
---|
755 | | - oe.aConstraints.gridx += 1; |
---|
756 | 1158 | |
---|
757 | 1159 | return cb; |
---|
758 | 1160 | } |
---|
759 | 1161 | |
---|
760 | | - cButton AddButton(ObjEditor oe, String label) |
---|
| 1162 | + cButton AddButton(cGridBag panel, String label) |
---|
761 | 1163 | { |
---|
762 | 1164 | cButton cb; |
---|
763 | 1165 | |
---|
764 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
765 | | - oe.aConstraints.gridwidth = 1; |
---|
766 | | -// oe.aConstraints.weightx = 1; |
---|
767 | | -// oe.aConstraints.anchor = GridBagConstraints.WEST; |
---|
768 | | - oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); |
---|
| 1166 | + panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); |
---|
769 | 1167 | cb.addActionListener(this); |
---|
770 | | -// oe.aConstraints.anchor = GridBagConstraints.EAST; |
---|
771 | | - oe.aConstraints.gridwidth = 1; |
---|
772 | | - oe.aConstraints.gridx += 1; |
---|
773 | 1168 | |
---|
774 | 1169 | return cb; |
---|
775 | 1170 | } |
---|
776 | 1171 | |
---|
777 | | - JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item) |
---|
| 1172 | + JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item) |
---|
778 | 1173 | { |
---|
779 | 1174 | JComboBox combo; |
---|
780 | 1175 | |
---|
781 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
782 | | - oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
783 | | - oe.aConstraints.gridx += 1; |
---|
| 1176 | + panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
784 | 1177 | combo.addActionListener(this); |
---|
785 | 1178 | |
---|
786 | 1179 | return combo; |
---|
787 | 1180 | } |
---|
788 | 1181 | |
---|
789 | | - NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow) |
---|
| 1182 | + cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow) |
---|
790 | 1183 | { |
---|
791 | | - NumberSlider combo; |
---|
| 1184 | + cGridBag control = new cGridBag(); |
---|
| 1185 | + |
---|
| 1186 | + cNumberSlider combo; |
---|
792 | 1187 | |
---|
793 | 1188 | JLabel jlabel = new JLabel(label); |
---|
794 | | - |
---|
795 | | - aConstraints.fill = GridBagConstraints.VERTICAL; |
---|
796 | 1189 | jlabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
797 | | - aConstraints.gridwidth = 2; |
---|
798 | | - ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
799 | | - aConstraints.gridx += 1; |
---|
800 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
801 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
802 | | - ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
803 | | - aConstraints.gridx += 1; |
---|
804 | | - aConstraints.gridwidth = 1; |
---|
805 | | - |
---|
| 1190 | + control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 1191 | + control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
806 | 1192 | combo.setFloat(current); |
---|
807 | | - |
---|
808 | | - combo.label = jlabel; |
---|
809 | | - |
---|
810 | | - combo.addChangeListener(this); |
---|
811 | | - |
---|
812 | | - return combo; |
---|
| 1193 | + |
---|
| 1194 | + panel.add(control); |
---|
| 1195 | + |
---|
| 1196 | + return control; |
---|
813 | 1197 | } |
---|
814 | 1198 | |
---|
815 | | - NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current) |
---|
| 1199 | + cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current) |
---|
816 | 1200 | { |
---|
817 | | - NumberSlider combo; |
---|
| 1201 | + cGridBag control = new cGridBag(); |
---|
| 1202 | + |
---|
| 1203 | + cNumberSlider combo; |
---|
818 | 1204 | |
---|
819 | 1205 | JLabel jlabel = new JLabel(label); |
---|
820 | | - |
---|
821 | | - aConstraints.fill = GridBagConstraints.VERTICAL; |
---|
822 | 1206 | jlabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
823 | | - aConstraints.gridwidth = 2; |
---|
824 | | - ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
825 | | - aConstraints.gridx += 1; |
---|
826 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
827 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
828 | | - ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
829 | | - aConstraints.gridx += 1; |
---|
830 | | - aConstraints.gridwidth = 1; |
---|
831 | | - |
---|
| 1207 | + control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 1208 | + control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
832 | 1209 | combo.setInteger(current); |
---|
833 | 1210 | |
---|
834 | | - combo.label = jlabel; |
---|
835 | | - |
---|
836 | | - combo.addChangeListener(this); |
---|
837 | | - |
---|
838 | | - return combo; |
---|
| 1211 | + panel.add(control); |
---|
| 1212 | + |
---|
| 1213 | + return control; |
---|
839 | 1214 | } |
---|
840 | 1215 | |
---|
841 | | - JTextArea AddText(JPanel ctrlPanel, String name) |
---|
| 1216 | + JTextArea AddText(cGridBag ctrlPanel, String name) |
---|
842 | 1217 | { |
---|
843 | 1218 | JTextArea text; |
---|
844 | 1219 | |
---|
845 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
846 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
847 | | - ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
| 1220 | + ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); |
---|
848 | 1221 | text.addCaretListener(this); |
---|
849 | | - aConstraints.gridx += 1; |
---|
850 | | - aConstraints.gridwidth = 1; |
---|
851 | 1222 | |
---|
852 | 1223 | return text; |
---|
853 | 1224 | } |
---|
.. | .. |
---|
877 | 1248 | objEditor.ctrlPanel.remove(j); |
---|
878 | 1249 | } |
---|
879 | 1250 | |
---|
| 1251 | + void Remove(cNumberSlider j) |
---|
| 1252 | + { |
---|
| 1253 | + j.removeChangeListener(this); |
---|
| 1254 | + //objEditor.ctrlPanel.remove(j.label); |
---|
| 1255 | + objEditor.ctrlPanel.remove(j); |
---|
| 1256 | + } |
---|
| 1257 | + |
---|
880 | 1258 | /* |
---|
881 | 1259 | */ |
---|
882 | | - void Return() // ObjEditor oe) |
---|
| 1260 | + void Return0() // ObjEditor oe) |
---|
883 | 1261 | { |
---|
884 | 1262 | aConstraints.gridy += 1; |
---|
885 | 1263 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
934 | 1312 | |
---|
935 | 1313 | void SetupUI2(ObjEditor oe) |
---|
936 | 1314 | { |
---|
937 | | -// oe.aConstraints.weightx = 0; |
---|
938 | | -// oe.aConstraints.weighty = 0; |
---|
939 | | -// oe.aConstraints.gridx = 0; |
---|
940 | | -// oe.aConstraints.gridy = 0; |
---|
941 | | - SetupName(oe); |
---|
| 1315 | + //SetupName(oe); |
---|
942 | 1316 | |
---|
943 | | - if (!GroupEditor.allparams) |
---|
| 1317 | + namePanel = new cGridBag(); |
---|
| 1318 | + |
---|
| 1319 | + //if (copy.pinned) |
---|
| 1320 | + { |
---|
| 1321 | + pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF); |
---|
| 1322 | + pinButton.setSelected(copy.pinned); |
---|
| 1323 | + cGridBag t = new cGridBag(); |
---|
| 1324 | + t.preferredWidth = 2; |
---|
| 1325 | + t.add(pinButton); |
---|
| 1326 | + namePanel.add(t); |
---|
| 1327 | + |
---|
| 1328 | + pinButton.addItemListener(this); |
---|
| 1329 | + } |
---|
| 1330 | + |
---|
| 1331 | + nameField = AddText(namePanel, copy.GetName()); |
---|
| 1332 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
| 1333 | + oe.ctrlPanel.add(namePanel); |
---|
| 1334 | + |
---|
| 1335 | + oe.ctrlPanel.Return(); |
---|
| 1336 | + |
---|
| 1337 | + if (!allparams) |
---|
944 | 1338 | return; |
---|
945 | 1339 | |
---|
946 | | - liveCB = AddCheckBox(oe, "Live", copy.live); |
---|
947 | | - link2masterCB = AddCheckBox(oe, "Supp", copy.link2master); |
---|
948 | | - hideCB = AddCheckBox(oe, "Hide", copy.hide); |
---|
| 1340 | + setupPanel = new cGridBag().setVertical(false); |
---|
| 1341 | + |
---|
| 1342 | + liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
| 1343 | + liveCB.setToolTipText("Animate object"); |
---|
| 1344 | + markCB = AddCheckBox(setupPanel, "Anim", copy.marked); |
---|
| 1345 | + markCB.setToolTipText("Set target transform"); |
---|
| 1346 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1347 | + selectableCB.setToolTipText("Make object selectable"); |
---|
949 | 1348 | // Return(); |
---|
950 | | - markCB = AddCheckBox(oe, "Mark", copy.marked); |
---|
951 | | - rewindCB = AddCheckBox(oe, "Rew", copy.rewind); |
---|
952 | | - randomCB = AddCheckBox(oe, "Rand", copy.random); |
---|
953 | | - Return(); |
---|
954 | | - resetButton = AddButton(oe, "Reset"); |
---|
955 | | - stepButton = AddButton(oe, "Step"); |
---|
| 1349 | + |
---|
| 1350 | + hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
| 1351 | + hideCB.setToolTipText("Hide object"); |
---|
| 1352 | + |
---|
| 1353 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
| 1354 | + |
---|
| 1355 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1356 | + |
---|
| 1357 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
| 1358 | + rewindCB.setToolTipText("Rewind animation"); |
---|
| 1359 | + |
---|
| 1360 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1361 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
| 1362 | + |
---|
| 1363 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1364 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1365 | + |
---|
| 1366 | + if (Globals.ADVANCED) |
---|
| 1367 | + { |
---|
| 1368 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
| 1369 | + speedupCB.setToolTipText("Option motion capture"); |
---|
| 1370 | + } |
---|
| 1371 | + |
---|
| 1372 | + oe.ctrlPanel.add(setupPanel); |
---|
| 1373 | + oe.ctrlPanel.Return(); |
---|
| 1374 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1375 | + oe.ctrlPanel.Return(); |
---|
| 1376 | + |
---|
| 1377 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
| 1378 | + |
---|
| 1379 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
| 1380 | + resetButton.setToolTipText("Jump to frame zero"); |
---|
| 1381 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
| 1382 | + stepButton.setToolTipText("Step one frame"); |
---|
956 | 1383 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
957 | 1384 | // stepAllButton = AddButton(oe, "Step All"); |
---|
958 | | - speedupCB = AddCheckBox(oe, "Speed", copy.speedup); |
---|
959 | 1385 | // Return(); |
---|
960 | | - slowerButton = AddButton(oe, "Slow"); |
---|
961 | | - fasterButton = AddButton(oe, "Fast"); |
---|
962 | | - remarkButton = AddButton(oe, "Rem"); |
---|
| 1386 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
| 1387 | + slowerButton.setToolTipText("Decrease animation speed"); |
---|
| 1388 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
| 1389 | + fasterButton.setToolTipText("Increase animation speed"); |
---|
| 1390 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
| 1391 | + remarkButton.setToolTipText("Set the current transform as the target"); |
---|
963 | 1392 | |
---|
964 | | - Return(); |
---|
| 1393 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
| 1394 | + oe.ctrlPanel.Return(); |
---|
965 | 1395 | |
---|
| 1396 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
| 1397 | + normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
| 1398 | + //Return(); |
---|
| 1399 | + |
---|
| 1400 | + oe.ctrlPanel.Return(); |
---|
| 1401 | + |
---|
966 | 1402 | // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2); |
---|
967 | 1403 | // ObjEditor.aConstraints.gridx += 1; |
---|
968 | 1404 | |
---|
.. | .. |
---|
1056 | 1492 | oe.aConstraints.gridwidth = 1; |
---|
1057 | 1493 | /**/ |
---|
1058 | 1494 | nameField = AddText(oe.ctrlPanel, copy.GetName()); |
---|
1059 | | - Return(); |
---|
| 1495 | + oe.ctrlPanel.Return(); |
---|
1060 | 1496 | |
---|
1061 | 1497 | //ctrlPanel.add(textureButton = new Button("Texture...")); |
---|
1062 | 1498 | //textureButton.setEnabled(false); |
---|
.. | .. |
---|
1107 | 1543 | //frontScroll.setLabel("------------------------------ XZ (front) ---------------------------------------------------"); |
---|
1108 | 1544 | //sideScroll.setLabel("------------------------------- YZ (side) ---------------------------------------------------"); |
---|
1109 | 1545 | |
---|
1110 | | -// GridBagConstraints gbc = (GridBagConstraints) GraphreeD.clone(aConstraints); |
---|
| 1546 | +// GridBagConstraints gbc = (GridBagConstraints) GrafreeD.clone(aConstraints); |
---|
1111 | 1547 | Camera cam = GetCamera(copy, 0); |
---|
1112 | 1548 | |
---|
1113 | 1549 | Composite cams = null; |
---|
1114 | 1550 | |
---|
1115 | 1551 | if (cam == null || !(copy.get(0) instanceof cGroup)) |
---|
1116 | 1552 | { |
---|
| 1553 | + if (Globals.DEBUG) |
---|
1117 | 1554 | System.out.println("CREATE CAMERAS"); |
---|
1118 | 1555 | cams = new cTemplate(); |
---|
1119 | 1556 | cams.name = "Cameras"; |
---|
.. | .. |
---|
1158 | 1595 | //JPanel worldPanel = |
---|
1159 | 1596 | // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true); |
---|
1160 | 1597 | //worldPanel.setName("World"); |
---|
1161 | | - /*JPanel*/ cameraPanel = |
---|
1162 | | - new JPanel(new BorderLayout()); |
---|
1163 | | - cameraPanel.add(cameraView); |
---|
| 1598 | + centralPanel = new cGridBag(); |
---|
| 1599 | + centralPanel.preferredWidth = 20; |
---|
| 1600 | + |
---|
| 1601 | + if (Globals.ADVANCED) |
---|
| 1602 | + { |
---|
| 1603 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1604 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1164 | 1605 | |
---|
| 1606 | + cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
| 1607 | + cameraPanel.setContinuousLayout(true); |
---|
| 1608 | + cameraPanel.setOneTouchExpandable(true); |
---|
| 1609 | +// cameraPanel.setDividerLocation(0.9); |
---|
| 1610 | +// cameraPanel.setDividerSize(9); |
---|
| 1611 | + cameraPanel.setResizeWeight(1.0); |
---|
| 1612 | + |
---|
| 1613 | + } |
---|
| 1614 | + |
---|
| 1615 | + centralPanel.add(cameraView); |
---|
| 1616 | + centralPanel.setFocusable(true); |
---|
| 1617 | + //frame.setJMenuBar(timelineMenubar); |
---|
| 1618 | + //centralPanel.add(timelinePanel); |
---|
| 1619 | + |
---|
1165 | 1620 | //topView.camera = ; |
---|
1166 | 1621 | //frontView.camera = new Camera(2); |
---|
1167 | 1622 | //sideView.camera = new Camera(3); |
---|
.. | .. |
---|
1177 | 1632 | //frontView.object = copy; |
---|
1178 | 1633 | //sideView.object = copy; |
---|
1179 | 1634 | |
---|
1180 | | - XYZPanel = new JPanel(); |
---|
1181 | | - XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); |
---|
| 1635 | + transformPanel = new cGridBag().setVertical(true); |
---|
| 1636 | + |
---|
| 1637 | + cGridBag resetTransformPanel = new cGridBag(); |
---|
| 1638 | + |
---|
| 1639 | + resetTransformPanel.preferredHeight = 2; |
---|
| 1640 | + |
---|
| 1641 | + cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF); |
---|
| 1642 | + resetTransform.setToolTipText("Reset Translation, Rotation and Scale"); |
---|
| 1643 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1644 | + { |
---|
| 1645 | + public void mouseClicked(MouseEvent e) |
---|
| 1646 | + { |
---|
| 1647 | + ResetTransform(); |
---|
| 1648 | + } |
---|
| 1649 | + }); |
---|
| 1650 | + resetTransformPanel.add(resetTransform); |
---|
| 1651 | + |
---|
| 1652 | + resetTransform = GetButton("T only", !Globals.NIMBUSLAF); |
---|
| 1653 | + resetTransform.setToolTipText("Reset Translation only"); |
---|
| 1654 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1655 | + { |
---|
| 1656 | + public void mouseClicked(MouseEvent e) |
---|
| 1657 | + { |
---|
| 1658 | + ResetTransform(1); |
---|
| 1659 | + } |
---|
| 1660 | + }); |
---|
| 1661 | + resetTransformPanel.add(resetTransform); |
---|
| 1662 | + |
---|
| 1663 | + resetTransform = GetButton("RS only", !Globals.NIMBUSLAF); |
---|
| 1664 | + resetTransform.setToolTipText("Reset Rotation and Scale only"); |
---|
| 1665 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1666 | + { |
---|
| 1667 | + public void mouseClicked(MouseEvent e) |
---|
| 1668 | + { |
---|
| 1669 | + ResetTransform(2); |
---|
| 1670 | + } |
---|
| 1671 | + }); |
---|
| 1672 | + resetTransformPanel.add(resetTransform); |
---|
| 1673 | + |
---|
| 1674 | + XYZPanel = new cGridBag().setVertical(true); |
---|
| 1675 | + //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); |
---|
1182 | 1676 | |
---|
1183 | | - XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1184 | | - XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1185 | | - XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1677 | + XYZPanel.preferredWidth = 5; |
---|
| 1678 | + XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
| 1679 | + XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
| 1680 | + XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1681 | + //XYZPanel.setName("XYZ"); |
---|
1186 | 1682 | |
---|
| 1683 | + transformPanel.add(resetTransformPanel); |
---|
| 1684 | + transformPanel.add(XYZPanel); |
---|
| 1685 | + |
---|
1187 | 1686 | /* |
---|
1188 | 1687 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
1189 | 1688 | gridPanel.setLayout(new GridLayout(1, 2)); |
---|
.. | .. |
---|
1191 | 1690 | gridPanel.add(cameraView); |
---|
1192 | 1691 | gridPanel.add(XYZPanel); |
---|
1193 | 1692 | */ |
---|
1194 | | - gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout()); |
---|
1195 | | - gridPanel.setContinuousLayout(true); |
---|
1196 | | - gridPanel.setOneTouchExpandable(true); |
---|
1197 | | - gridPanel.setDividerLocation(1.0); |
---|
1198 | | - gridPanel.setDividerSize(9); |
---|
1199 | | - gridPanel.setResizeWeight(0.85); |
---|
| 1693 | +// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout()); |
---|
| 1694 | +// gridPanel.setContinuousLayout(true); |
---|
| 1695 | +// gridPanel.setOneTouchExpandable(true); |
---|
| 1696 | +// gridPanel.setDividerLocation(1.0); |
---|
| 1697 | +// gridPanel.setDividerSize(9); |
---|
| 1698 | +// gridPanel.setResizeWeight(0.85); |
---|
1200 | 1699 | |
---|
1201 | 1700 | // aConstraints.weighty = 0; |
---|
1202 | 1701 | //System.out.println("THIS = " + this); |
---|
.. | .. |
---|
1219 | 1718 | |
---|
1220 | 1719 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1221 | 1720 | //tmp.setName("Edit"); |
---|
1222 | | - objectPanel.add(materialPanel); |
---|
1223 | | - JPanel north = new JPanel(new BorderLayout()); |
---|
1224 | | - north.setName("Edit"); |
---|
1225 | | - north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1226 | | - objectPanel.add(north); |
---|
1227 | | - objectPanel.add(infoPanel); |
---|
| 1721 | + objectPanel.add(toolboxPanel); |
---|
| 1722 | + objectPanel.setIconAt(0, GetIcon("icons/primitives.png")); |
---|
| 1723 | + objectPanel.setToolTipTextAt(0, "Objects & textures"); |
---|
1228 | 1724 | |
---|
| 1725 | + objectPanel.add(materialPanel); |
---|
| 1726 | + objectPanel.setIconAt(1, GetIcon("icons/material.png")); |
---|
| 1727 | + objectPanel.setToolTipTextAt(1, "Material"); |
---|
| 1728 | + |
---|
| 1729 | + objectPanel.add(skyboxPanel); |
---|
| 1730 | + objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
| 1731 | + objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
| 1732 | + |
---|
| 1733 | +// JPanel north = new JPanel(new BorderLayout()); |
---|
| 1734 | +// north.setName("Edit"); |
---|
| 1735 | +// north.add(ctrlPanel, BorderLayout.NORTH); |
---|
| 1736 | +// objectPanel.add(north); |
---|
| 1737 | + objectPanel.add(editPanel); |
---|
| 1738 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1739 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
| 1740 | + |
---|
| 1741 | + objectPanel.add(transformPanel); |
---|
| 1742 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1743 | + objectPanel.setToolTipTextAt(4, "TRS transform"); |
---|
| 1744 | + |
---|
| 1745 | + patchMaterial = true; |
---|
| 1746 | + cameraView.patchMaterial = this; |
---|
| 1747 | + objectPanel.setSelectedIndex(1); |
---|
| 1748 | + |
---|
1229 | 1749 | /* |
---|
1230 | 1750 | aConstraints.gridx = 0; |
---|
1231 | 1751 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1233 | 1753 | aConstraints.gridy += 1; |
---|
1234 | 1754 | aConstraints.gridwidth = 1; |
---|
1235 | 1755 | mainPanel.add(objectPanel, aConstraints); |
---|
1236 | | - */ |
---|
| 1756 | + */ |
---|
1237 | 1757 | |
---|
1238 | 1758 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1239 | 1759 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1244 | 1764 | scrollpane.setWheelScrollingEnabled(true); |
---|
1245 | 1765 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1246 | 1766 | |
---|
1247 | | - /*JTabbedPane*/ jtp = new JTabbedPane(); |
---|
1248 | | - jtp.add(scrollpane); |
---|
| 1767 | + /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
| 1768 | + scenePanel.preferredWidth = 6; |
---|
| 1769 | + |
---|
| 1770 | + JTabbedPane tabbedPane = new JTabbedPane(); |
---|
| 1771 | + tabbedPane.add(scrollpane); |
---|
1249 | 1772 | |
---|
1250 | | - jtp.add(FSPane = new cFileSystemPane(this)); |
---|
1251 | | - |
---|
1252 | | - optionsPanel = new JPanel(new GridBagLayout()); |
---|
| 1773 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1253 | 1774 | |
---|
1254 | 1775 | optionsPanel.setName("Options"); |
---|
1255 | | - jtp.add(optionsPanel); |
---|
| 1776 | + |
---|
| 1777 | + AddOptions(optionsPanel); //, aConstraints); |
---|
| 1778 | + |
---|
| 1779 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1256 | 1780 | |
---|
| 1781 | + tabbedPane.add(optionsPanel); |
---|
| 1782 | + |
---|
| 1783 | + scenePanel.add(tabbedPane); |
---|
| 1784 | + |
---|
| 1785 | + cGridBag creditsPanel = new cGridBag().setVertical(true); |
---|
| 1786 | + creditsPanel.setName("Credits"); |
---|
| 1787 | + |
---|
| 1788 | + cLabel ogaLabel = new cLabel(" Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF); |
---|
| 1789 | + creditsPanel.add(ogaLabel); |
---|
| 1790 | + |
---|
| 1791 | + cButton opengameartButton; |
---|
| 1792 | + creditsPanel.add(opengameartButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF)); |
---|
| 1793 | + opengameartButton.setToolTipText("https://opengameart.org"); |
---|
| 1794 | + |
---|
| 1795 | + opengameartButton.addMouseListener(new MouseAdapter() |
---|
| 1796 | + { |
---|
| 1797 | + public void mouseClicked(MouseEvent e) |
---|
| 1798 | + { |
---|
| 1799 | + try |
---|
| 1800 | + { |
---|
| 1801 | + Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/")); |
---|
| 1802 | + } catch (Exception e1) |
---|
| 1803 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1804 | + { |
---|
| 1805 | + e1.printStackTrace(); |
---|
| 1806 | + } |
---|
| 1807 | + } |
---|
| 1808 | + }); |
---|
| 1809 | + |
---|
| 1810 | + for (int i=10; --i>=0;) |
---|
| 1811 | + { |
---|
| 1812 | + creditsPanel.add(new cGridBag()); |
---|
| 1813 | + } |
---|
| 1814 | + |
---|
| 1815 | + tabbedPane.add(creditsPanel); |
---|
| 1816 | + tabbedPane.setToolTipTextAt(3, "Credits"); |
---|
| 1817 | + |
---|
| 1818 | + if (Globals.ADVANCED) |
---|
| 1819 | + { |
---|
| 1820 | + tabbedPane.add(infoPanel); |
---|
| 1821 | + tabbedPane.setIconAt(4, GetIcon("icons/info.png")); |
---|
| 1822 | + tabbedPane.setToolTipTextAt(4, "Information"); |
---|
| 1823 | + } |
---|
1257 | 1824 | |
---|
1258 | 1825 | /* |
---|
1259 | 1826 | cTree jTree = new cTree(null); |
---|
.. | .. |
---|
1275 | 1842 | jtp.add(tree); |
---|
1276 | 1843 | */ |
---|
1277 | 1844 | |
---|
1278 | | - bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel); |
---|
1279 | | - bigPanel.setContinuousLayout(true); |
---|
1280 | | - bigPanel.setOneTouchExpandable(true); |
---|
1281 | | - bigPanel.setDividerLocation(0.8); |
---|
1282 | | - bigPanel.setDividerSize(15); |
---|
1283 | | - bigPanel.setResizeWeight(0.15); |
---|
1284 | | - bigPanel.setName("Scene"); |
---|
| 1845 | +// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel); |
---|
| 1846 | +// bigPanel.setContinuousLayout(true); |
---|
| 1847 | +// bigPanel.setOneTouchExpandable(true); |
---|
| 1848 | +// bigPanel.setDividerLocation(0.8); |
---|
| 1849 | +// bigPanel.setDividerSize(15); |
---|
| 1850 | +// bigPanel.setResizeWeight(0.15); |
---|
| 1851 | +// bigPanel.setName("Scene"); |
---|
1285 | 1852 | |
---|
1286 | 1853 | //bigPanel.setLayout(new BorderLayout()); |
---|
1287 | 1854 | //bigPanel.setSize(new Dimension(10,10)); |
---|
1288 | 1855 | //bigPanel.add(ctrlPanel); |
---|
1289 | 1856 | //bigPanel.add(gridPanel); |
---|
| 1857 | + /** |
---|
1290 | 1858 | bigThree = new JPanel(); |
---|
1291 | 1859 | //big.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
1292 | 1860 | bigThree.setLayout(new GridBagLayout()); //1,3,5,5)); |
---|
.. | .. |
---|
1297 | 1865 | aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
1298 | 1866 | aWindowConstraints.weightx = 0; |
---|
1299 | 1867 | aWindowConstraints.weighty = 1; |
---|
1300 | | - bigThree.add(jtp, aWindowConstraints); |
---|
| 1868 | + bigThree.add(scenePanel, aWindowConstraints); |
---|
1301 | 1869 | aWindowConstraints.weightx = 1; |
---|
1302 | 1870 | aWindowConstraints.gridwidth = 3; |
---|
1303 | 1871 | // aConstraints.gridheight = 3; |
---|
1304 | 1872 | aWindowConstraints.gridx = 1; |
---|
1305 | 1873 | aWindowConstraints.fill = GridBagConstraints.BOTH; |
---|
1306 | | - bigThree.add(cameraPanel, aWindowConstraints); |
---|
| 1874 | + bigThree.add(centralPanel, aWindowConstraints); |
---|
1307 | 1875 | aWindowConstraints.weightx = 0; |
---|
1308 | 1876 | aWindowConstraints.gridx = 4; |
---|
1309 | 1877 | aWindowConstraints.gridwidth = 1; |
---|
1310 | 1878 | // aConstraints.gridheight = 3; |
---|
1311 | 1879 | aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
1312 | 1880 | bigThree.add(XYZPanel, aWindowConstraints); |
---|
| 1881 | + /**/ |
---|
1313 | 1882 | |
---|
| 1883 | + bigThree = new cGridBag(); |
---|
| 1884 | + bigThree.addComponent(scenePanel); |
---|
| 1885 | + bigThree.addComponent(centralPanel); |
---|
| 1886 | + //bigThree.addComponent(XYZPanel); |
---|
| 1887 | + |
---|
1314 | 1888 | // // SIDE EFFECT!!! |
---|
1315 | 1889 | // aConstraints.gridx = 0; |
---|
1316 | 1890 | // aConstraints.gridy = 0; |
---|
.. | .. |
---|
1318 | 1892 | // aConstraints.gridheight = 1; |
---|
1319 | 1893 | |
---|
1320 | 1894 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1321 | | - framePanel.setContinuousLayout(true); |
---|
1322 | | - framePanel.setOneTouchExpandable(true); |
---|
1323 | | - framePanel.setDividerLocation(0.8); |
---|
| 1895 | + |
---|
| 1896 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1897 | + new java.beans.PropertyChangeListener() |
---|
| 1898 | + { |
---|
| 1899 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1900 | + { |
---|
| 1901 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1902 | + { |
---|
| 1903 | + if (radio.layout != expandedLayout) |
---|
| 1904 | + { |
---|
| 1905 | + radio.layout = expandedLayout; |
---|
| 1906 | + radio.layout.doClick(); |
---|
| 1907 | + } |
---|
| 1908 | + } |
---|
| 1909 | + } |
---|
| 1910 | + }); |
---|
| 1911 | + |
---|
| 1912 | + framePanel.setContinuousLayout(false); |
---|
| 1913 | + framePanel.setOneTouchExpandable(false); |
---|
| 1914 | + //.setDividerLocation(0.8); |
---|
1324 | 1915 | //framePanel.setDividerSize(15); |
---|
1325 | 1916 | //framePanel.setResizeWeight(0.15); |
---|
1326 | 1917 | framePanel.setName("Frame"); |
---|
1327 | 1918 | |
---|
1328 | 1919 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1329 | 1920 | /**/ |
---|
1330 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1921 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1331 | 1922 | //worldPane.add(bigPanel); |
---|
1332 | 1923 | //worldPane.add(worldPanel); |
---|
1333 | 1924 | /**/ |
---|
1334 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 1925 | + //frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 1926 | + frame.add(/*"Center",*/framePanel); |
---|
1335 | 1927 | //frame.getContentPane().add(/*"Center",*/ worldPane); |
---|
1336 | 1928 | |
---|
1337 | | -// aConstraints = gbc; // (GridBagConstraints) GraphreeD.clone(gbc); |
---|
| 1929 | +// aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1338 | 1930 | |
---|
1339 | | - frame.setSize(800, 600); |
---|
1340 | | - frame.show(); |
---|
| 1931 | + frame.setSize(1280, 860); |
---|
| 1932 | + |
---|
| 1933 | + cameraView.requestFocusInWindow(); |
---|
| 1934 | + |
---|
| 1935 | +// gridPanel.setDividerLocation(1.0); |
---|
| 1936 | + |
---|
| 1937 | + frame.validate(); |
---|
1341 | 1938 | |
---|
1342 | | - gridPanel.setDividerLocation(1.0); |
---|
| 1939 | + frame.setVisible(true); |
---|
1343 | 1940 | |
---|
1344 | 1941 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1345 | 1942 | frame.addWindowListener(new WindowAdapter() |
---|
1346 | 1943 | { |
---|
1347 | | - |
---|
1348 | 1944 | public void windowClosing(WindowEvent e) |
---|
1349 | 1945 | { |
---|
1350 | 1946 | Close(); |
---|
.. | .. |
---|
1352 | 1948 | }); |
---|
1353 | 1949 | } |
---|
1354 | 1950 | |
---|
| 1951 | + void AddOptions(cGridBag panel) //, GridBagConstraints constraints) |
---|
| 1952 | + { |
---|
| 1953 | + } |
---|
| 1954 | + |
---|
1355 | 1955 | JTree GetTree() |
---|
1356 | 1956 | { |
---|
1357 | 1957 | return objEditor.jTree; |
---|
.. | .. |
---|
1363 | 1963 | ctrlPanel.removeAll(); |
---|
1364 | 1964 | } |
---|
1365 | 1965 | |
---|
1366 | | - void SetupMaterial(JPanel ctrlPanel) |
---|
| 1966 | + void SetupMaterial(cGridBag materialpanel) |
---|
1367 | 1967 | { |
---|
1368 | | - aConstraints.weighty = 0; |
---|
1369 | | - //aConstraints.weightx = 1; |
---|
1370 | | - /* |
---|
| 1968 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1969 | + |
---|
| 1970 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF); |
---|
| 1971 | + skin.setToolTipText("Skin"); |
---|
| 1972 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1973 | + { |
---|
| 1974 | + public void mouseClicked(MouseEvent e) |
---|
| 1975 | + { |
---|
| 1976 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1977 | + cMaterial material = object.material; |
---|
| 1978 | + |
---|
| 1979 | + // Skin |
---|
| 1980 | + colorField.setFloat(material.color); |
---|
| 1981 | + float saturation = material.modulation; |
---|
| 1982 | + |
---|
| 1983 | + if (!cameraView.Skinshader) |
---|
| 1984 | + { |
---|
| 1985 | + saturation /= 1.5; |
---|
| 1986 | + } |
---|
| 1987 | + |
---|
| 1988 | + saturationField.setFloat(saturation); |
---|
| 1989 | + |
---|
| 1990 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1991 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1992 | + diffusenessField.setFloat(material.factor); |
---|
| 1993 | + shininessField.setFloat(material.shininess); |
---|
| 1994 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1995 | + diffuseField.setFloat(material.diffuse); |
---|
| 1996 | + specularField.setFloat(material.specular); |
---|
| 1997 | + |
---|
| 1998 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1999 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2000 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2001 | + |
---|
| 2002 | + materialtouched = true; |
---|
| 2003 | + applySelf(); |
---|
| 2004 | + } |
---|
| 2005 | + }); |
---|
| 2006 | + presetpanel.add(skin); |
---|
| 2007 | + |
---|
| 2008 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF); |
---|
| 2009 | + lambert.setToolTipText("Diffuse"); |
---|
| 2010 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 2011 | + { |
---|
| 2012 | + public void mouseClicked(MouseEvent e) |
---|
| 2013 | + { |
---|
| 2014 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 2015 | + cMaterial material = object.material; |
---|
| 2016 | + |
---|
| 2017 | + diffusenessField.setFloat(material.factor); |
---|
| 2018 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2019 | + |
---|
| 2020 | + materialtouched = true; |
---|
| 2021 | + applySelf(); |
---|
| 2022 | + } |
---|
| 2023 | + }); |
---|
| 2024 | + presetpanel.add(lambert); |
---|
| 2025 | + |
---|
| 2026 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF); |
---|
| 2027 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 2028 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 2029 | + { |
---|
| 2030 | + public void mouseClicked(MouseEvent e) |
---|
| 2031 | + { |
---|
| 2032 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 2033 | + cMaterial material = object.material; |
---|
| 2034 | + |
---|
| 2035 | + diffusenessField.setFloat(material.factor); |
---|
| 2036 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2037 | + |
---|
| 2038 | + materialtouched = true; |
---|
| 2039 | + applySelf(); |
---|
| 2040 | + } |
---|
| 2041 | + }); |
---|
| 2042 | + presetpanel.add(diffuse2); |
---|
| 2043 | + |
---|
| 2044 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF); |
---|
| 2045 | + diffusemoon.setToolTipText("Moon"); |
---|
| 2046 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 2047 | + { |
---|
| 2048 | + public void mouseClicked(MouseEvent e) |
---|
| 2049 | + { |
---|
| 2050 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 2051 | + cMaterial material = object.material; |
---|
| 2052 | + |
---|
| 2053 | + diffusenessField.setFloat(material.factor); |
---|
| 2054 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2055 | + |
---|
| 2056 | + materialtouched = true; |
---|
| 2057 | + applySelf(); |
---|
| 2058 | + } |
---|
| 2059 | + }); |
---|
| 2060 | + presetpanel.add(diffusemoon); |
---|
| 2061 | + |
---|
| 2062 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF); |
---|
| 2063 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 2064 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 2065 | + { |
---|
| 2066 | + public void mouseClicked(MouseEvent e) |
---|
| 2067 | + { |
---|
| 2068 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 2069 | + cMaterial material = object.material; |
---|
| 2070 | + |
---|
| 2071 | + diffusenessField.setFloat(material.factor); |
---|
| 2072 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2073 | + |
---|
| 2074 | + materialtouched = true; |
---|
| 2075 | + applySelf(); |
---|
| 2076 | + } |
---|
| 2077 | + }); |
---|
| 2078 | + presetpanel.add(diffusemoon2); |
---|
| 2079 | + |
---|
| 2080 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF); |
---|
| 2081 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 2082 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 2083 | + { |
---|
| 2084 | + public void mouseClicked(MouseEvent e) |
---|
| 2085 | + { |
---|
| 2086 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 2087 | + cMaterial material = object.material; |
---|
| 2088 | + |
---|
| 2089 | + diffusenessField.setFloat(material.factor); |
---|
| 2090 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2091 | + |
---|
| 2092 | + materialtouched = true; |
---|
| 2093 | + applySelf(); |
---|
| 2094 | + } |
---|
| 2095 | + }); |
---|
| 2096 | + presetpanel.add(diffusemoon3); |
---|
| 2097 | + |
---|
| 2098 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF); |
---|
| 2099 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 2100 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 2101 | + { |
---|
| 2102 | + public void mouseClicked(MouseEvent e) |
---|
| 2103 | + { |
---|
| 2104 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 2105 | + cMaterial material = object.material; |
---|
| 2106 | + |
---|
| 2107 | + sheenField.setFloat(material.sheen); |
---|
| 2108 | + |
---|
| 2109 | + materialtouched = true; |
---|
| 2110 | + applySelf(); |
---|
| 2111 | + } |
---|
| 2112 | + }); |
---|
| 2113 | + presetpanel.add(diffusesheen); |
---|
| 2114 | + |
---|
| 2115 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF); |
---|
| 2116 | + rough.setToolTipText("Rough metal"); |
---|
| 2117 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2118 | + { |
---|
| 2119 | + public void mouseClicked(MouseEvent e) |
---|
| 2120 | + { |
---|
| 2121 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2122 | + cMaterial material = object.material; |
---|
| 2123 | + |
---|
| 2124 | + shininessField.setFloat(material.shininess); |
---|
| 2125 | + velvetField.setFloat(material.velvet); |
---|
| 2126 | + |
---|
| 2127 | + materialtouched = true; |
---|
| 2128 | + applySelf(); |
---|
| 2129 | + } |
---|
| 2130 | + }); |
---|
| 2131 | + presetpanel.add(rough); |
---|
| 2132 | + |
---|
| 2133 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF); |
---|
| 2134 | + rough2.setToolTipText("Medium metal"); |
---|
| 2135 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2136 | + { |
---|
| 2137 | + public void mouseClicked(MouseEvent e) |
---|
| 2138 | + { |
---|
| 2139 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2140 | + cMaterial material = object.material; |
---|
| 2141 | + |
---|
| 2142 | + shininessField.setFloat(material.shininess); |
---|
| 2143 | + lightareaField.setFloat(material.lightarea); |
---|
| 2144 | + |
---|
| 2145 | + materialtouched = true; |
---|
| 2146 | + applySelf(); |
---|
| 2147 | + } |
---|
| 2148 | + }); |
---|
| 2149 | + presetpanel.add(rough2); |
---|
| 2150 | + |
---|
| 2151 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF); |
---|
| 2152 | + shini0.setToolTipText("Shiny"); |
---|
| 2153 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2154 | + { |
---|
| 2155 | + public void mouseClicked(MouseEvent e) |
---|
| 2156 | + { |
---|
| 2157 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2158 | + cMaterial material = object.material; |
---|
| 2159 | + |
---|
| 2160 | + shininessField.setFloat(material.shininess); |
---|
| 2161 | + lightareaField.setFloat(material.lightarea); |
---|
| 2162 | + |
---|
| 2163 | + materialtouched = true; |
---|
| 2164 | + applySelf(); |
---|
| 2165 | + } |
---|
| 2166 | + }); |
---|
| 2167 | + presetpanel.add(shini0); |
---|
| 2168 | + |
---|
| 2169 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF); |
---|
| 2170 | + shini1.setToolTipText("Shiny2"); |
---|
| 2171 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2172 | + { |
---|
| 2173 | + public void mouseClicked(MouseEvent e) |
---|
| 2174 | + { |
---|
| 2175 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2176 | + cMaterial material = object.material; |
---|
| 2177 | + |
---|
| 2178 | + shininessField.setFloat(material.shininess); |
---|
| 2179 | + lightareaField.setFloat(material.lightarea); |
---|
| 2180 | + |
---|
| 2181 | + materialtouched = true; |
---|
| 2182 | + applySelf(); |
---|
| 2183 | + } |
---|
| 2184 | + }); |
---|
| 2185 | + presetpanel.add(shini1); |
---|
| 2186 | + |
---|
| 2187 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF); |
---|
| 2188 | + shini2.setToolTipText("Shiny3"); |
---|
| 2189 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2190 | + { |
---|
| 2191 | + public void mouseClicked(MouseEvent e) |
---|
| 2192 | + { |
---|
| 2193 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2194 | + cMaterial material = object.material; |
---|
| 2195 | + |
---|
| 2196 | + shininessField.setFloat(material.shininess); |
---|
| 2197 | + lightareaField.setFloat(material.lightarea); |
---|
| 2198 | + |
---|
| 2199 | + materialtouched = true; |
---|
| 2200 | + applySelf(); |
---|
| 2201 | + } |
---|
| 2202 | + }); |
---|
| 2203 | + presetpanel.add(shini2); |
---|
| 2204 | + |
---|
| 2205 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF); |
---|
| 2206 | + aniso.setToolTipText("AnisoU"); |
---|
| 2207 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2208 | + { |
---|
| 2209 | + public void mouseClicked(MouseEvent e) |
---|
| 2210 | + { |
---|
| 2211 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2212 | + cMaterial material = object.material; |
---|
| 2213 | + |
---|
| 2214 | + anisoField.setFloat(material.aniso); |
---|
| 2215 | + anisoVField.setFloat(material.anisoV); |
---|
| 2216 | + |
---|
| 2217 | + materialtouched = true; |
---|
| 2218 | + applySelf(); |
---|
| 2219 | + } |
---|
| 2220 | + }); |
---|
| 2221 | + presetpanel.add(aniso); |
---|
| 2222 | + |
---|
| 2223 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF); |
---|
| 2224 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2225 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2226 | + { |
---|
| 2227 | + public void mouseClicked(MouseEvent e) |
---|
| 2228 | + { |
---|
| 2229 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2230 | + cMaterial material = object.material; |
---|
| 2231 | + |
---|
| 2232 | + anisoField.setFloat(material.aniso); |
---|
| 2233 | + anisoVField.setFloat(material.anisoV); |
---|
| 2234 | + |
---|
| 2235 | + materialtouched = true; |
---|
| 2236 | + applySelf(); |
---|
| 2237 | + } |
---|
| 2238 | + }); |
---|
| 2239 | + presetpanel.add(aniso2); |
---|
| 2240 | + |
---|
| 2241 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF); |
---|
| 2242 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2243 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2244 | + { |
---|
| 2245 | + public void mouseClicked(MouseEvent e) |
---|
| 2246 | + { |
---|
| 2247 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2248 | + cMaterial material = object.material; |
---|
| 2249 | + |
---|
| 2250 | + anisoField.setFloat(material.aniso); |
---|
| 2251 | + anisoVField.setFloat(material.anisoV); |
---|
| 2252 | + |
---|
| 2253 | + materialtouched = true; |
---|
| 2254 | + applySelf(); |
---|
| 2255 | + } |
---|
| 2256 | + }); |
---|
| 2257 | + presetpanel.add(aniso3); |
---|
| 2258 | + |
---|
| 2259 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF); |
---|
| 2260 | + velvet0.setToolTipText("Velvet"); |
---|
| 2261 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2262 | + { |
---|
| 2263 | + public void mouseClicked(MouseEvent e) |
---|
| 2264 | + { |
---|
| 2265 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2266 | + cMaterial material = object.material; |
---|
| 2267 | + |
---|
| 2268 | + diffusenessField.setFloat(material.factor); |
---|
| 2269 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2270 | + sheenField.setFloat(material.sheen); |
---|
| 2271 | + shininessField.setFloat(material.shininess); |
---|
| 2272 | + velvetField.setFloat(material.velvet); |
---|
| 2273 | + shiftField.setFloat(material.shift); |
---|
| 2274 | + |
---|
| 2275 | + materialtouched = true; |
---|
| 2276 | + applySelf(); |
---|
| 2277 | + } |
---|
| 2278 | + }); |
---|
| 2279 | + presetpanel.add(velvet0); |
---|
| 2280 | + |
---|
| 2281 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF); |
---|
| 2282 | + bump0.setToolTipText("Bump texture"); |
---|
| 2283 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2284 | + { |
---|
| 2285 | + public void mouseClicked(MouseEvent e) |
---|
| 2286 | + { |
---|
| 2287 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2288 | + cMaterial material = object.material; |
---|
| 2289 | + |
---|
| 2290 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2291 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2292 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2293 | + |
---|
| 2294 | + materialtouched = true; |
---|
| 2295 | + applySelf(); |
---|
| 2296 | + } |
---|
| 2297 | + }); |
---|
| 2298 | + presetpanel.add(bump0); |
---|
| 2299 | + |
---|
| 2300 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF); |
---|
| 2301 | + borderShader.setToolTipText("Border fade"); |
---|
| 2302 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2303 | + { |
---|
| 2304 | + public void mouseClicked(MouseEvent e) |
---|
| 2305 | + { |
---|
| 2306 | + borderfadeField.setFloat(0.5); |
---|
| 2307 | + opacityField.setFloat(0.75); |
---|
| 2308 | + |
---|
| 2309 | + materialtouched = true; |
---|
| 2310 | + applySelf(); |
---|
| 2311 | + } |
---|
| 2312 | + }); |
---|
| 2313 | + presetpanel.add(borderShader); |
---|
| 2314 | + |
---|
| 2315 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF); |
---|
| 2316 | + halo.setToolTipText("Halo"); |
---|
| 2317 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2318 | + { |
---|
| 2319 | + public void mouseClicked(MouseEvent e) |
---|
| 2320 | + { |
---|
| 2321 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2322 | + cMaterial material = object.material; |
---|
| 2323 | + |
---|
| 2324 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2325 | + |
---|
| 2326 | + materialtouched = true; |
---|
| 2327 | + applySelf(); |
---|
| 2328 | + } |
---|
| 2329 | + }); |
---|
| 2330 | + presetpanel.add(halo); |
---|
| 2331 | + |
---|
| 2332 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF); |
---|
| 2333 | + candle.setToolTipText("Candle"); |
---|
| 2334 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2335 | + { |
---|
| 2336 | + public void mouseClicked(MouseEvent e) |
---|
| 2337 | + { |
---|
| 2338 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2339 | + cMaterial material = object.material; |
---|
| 2340 | + |
---|
| 2341 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2342 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2343 | + ambientField.setFloat(material.ambient); |
---|
| 2344 | + specularField.setFloat(material.specular); |
---|
| 2345 | + lightareaField.setFloat(material.lightarea); |
---|
| 2346 | + shininessField.setFloat(material.shininess); |
---|
| 2347 | + |
---|
| 2348 | + materialtouched = true; |
---|
| 2349 | + applySelf(); |
---|
| 2350 | + } |
---|
| 2351 | + }); |
---|
| 2352 | + presetpanel.add(candle); |
---|
| 2353 | + |
---|
| 2354 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF); |
---|
| 2355 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2356 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2357 | + { |
---|
| 2358 | + public void mouseClicked(MouseEvent e) |
---|
| 2359 | + { |
---|
| 2360 | + diffuseField.setFloat(0.001); |
---|
| 2361 | + ambientField.setFloat(0.001); |
---|
| 2362 | + cameraField.setFloat(0.001); |
---|
| 2363 | + specularField.setFloat(0.001); |
---|
| 2364 | + fakedepthField.setFloat(0.001); |
---|
| 2365 | + opacityField.setFloat(0.6); |
---|
| 2366 | + |
---|
| 2367 | + materialtouched = true; |
---|
| 2368 | + applySelf(); |
---|
| 2369 | + } |
---|
| 2370 | + }); |
---|
| 2371 | + presetpanel.add(shadowShader); |
---|
| 2372 | + |
---|
| 2373 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2374 | + |
---|
| 2375 | + presetpanel.preferredWidth = 1; |
---|
| 2376 | + |
---|
| 2377 | + materialpanel.add(presetpanel); |
---|
| 2378 | + materialpanel.add(panel); |
---|
| 2379 | + |
---|
| 2380 | + panel.preferredWidth = 8; |
---|
| 2381 | + |
---|
| 2382 | + /* |
---|
1371 | 2383 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1372 | 2384 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1373 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1374 | | - aConstraints.gridx += 1; |
---|
1375 | | - */ |
---|
| 2385 | + */ |
---|
1376 | 2386 | |
---|
1377 | | - aConstraints.gridwidth = 1; |
---|
1378 | | - ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints); |
---|
1379 | | - aConstraints.gridx += 1; |
---|
1380 | | - aConstraints.weighty = 0; |
---|
1381 | | - aConstraints.gridwidth = 1; |
---|
| 2387 | + cGridBag editBar = new cGridBag().setVertical(false); |
---|
| 2388 | + |
---|
| 2389 | + editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
| 2390 | + createMaterialButton.setToolTipText("Create material"); |
---|
1382 | 2391 | |
---|
1383 | 2392 | /* |
---|
1384 | 2393 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1385 | | - aConstraints.gridx += 1; |
---|
1386 | | - aConstraints.weighty = 0; |
---|
1387 | | - aConstraints.gridwidth = 1; |
---|
1388 | 2394 | */ |
---|
1389 | 2395 | |
---|
1390 | | - ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints); |
---|
1391 | | - aConstraints.gridx += 1; |
---|
| 2396 | + editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
| 2397 | + clearMaterialButton.setToolTipText("Clear material"); |
---|
| 2398 | + |
---|
| 2399 | + if (Globals.ADVANCED) |
---|
| 2400 | + { |
---|
| 2401 | + editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
| 2402 | + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
| 2403 | + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
| 2404 | + } |
---|
1392 | 2405 | |
---|
1393 | | - ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints); |
---|
1394 | | - |
---|
1395 | | - aConstraints.gridx += 1; |
---|
1396 | | - |
---|
1397 | | - ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints); |
---|
1398 | | - |
---|
1399 | | - aConstraints.gridx += 1; |
---|
1400 | | - |
---|
1401 | | - ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints); |
---|
1402 | | - |
---|
1403 | | - aConstraints.gridx = 0; |
---|
1404 | | - aConstraints.gridy += 1; |
---|
1405 | | - aConstraints.weighty = 0; |
---|
1406 | | - aConstraints.gridwidth = 1; |
---|
| 2406 | + editBar.preferredHeight = 15; |
---|
| 2407 | + |
---|
| 2408 | + panel.add(editBar); |
---|
| 2409 | + |
---|
1407 | 2410 | /**/ |
---|
1408 | 2411 | //aConstraints.weighty = 0; |
---|
1409 | 2412 | ////aConstraints.weightx = 1; |
---|
1410 | 2413 | //aConstraints.weighty = 1; |
---|
1411 | 2414 | aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; |
---|
1412 | 2415 | //aConstraints.gridx += 1; |
---|
1413 | | - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); |
---|
1414 | | - aConstraints.weighty = 0; |
---|
1415 | | - aConstraints.gridx = 0; |
---|
1416 | | - aConstraints.gridy += 1; |
---|
1417 | | - aConstraints.gridwidth = 1; |
---|
| 2416 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1418 | 2417 | |
---|
1419 | | - ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints); |
---|
1420 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1421 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1422 | | - aConstraints.gridx += 1; |
---|
1423 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1424 | | - //aConstraints.weightx = 0; |
---|
1425 | | - ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints); |
---|
1426 | | - aConstraints.gridx = 0; |
---|
1427 | | - aConstraints.gridy += 1; |
---|
1428 | | - aConstraints.gridwidth = 1; |
---|
| 2418 | + cGridBag colorSection = new cGridBag().setVertical(true); |
---|
1429 | 2419 | |
---|
1430 | | - ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints); |
---|
1431 | | - modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1432 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1433 | | - aConstraints.gridx += 1; |
---|
1434 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1435 | | - ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints); |
---|
1436 | | - aConstraints.gridx = 0; |
---|
1437 | | - aConstraints.gridy += 1; |
---|
1438 | | - aConstraints.gridwidth = 1; |
---|
| 2420 | + cGridBag huepanel = new cGridBag(); |
---|
| 2421 | + cGridBag huelabel = new cGridBag(); |
---|
| 2422 | + cLabel hue = GetLabel("icons/hue.png", false); |
---|
| 2423 | + hue.fit = true; |
---|
| 2424 | + |
---|
| 2425 | + hue.addMouseListener(new MouseAdapter() |
---|
| 2426 | + { |
---|
| 2427 | + public void mousePressed(MouseEvent e) |
---|
| 2428 | + { |
---|
| 2429 | + int x = e.getX(); |
---|
| 2430 | + |
---|
| 2431 | + colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth()); |
---|
| 2432 | + } |
---|
| 2433 | + }); |
---|
| 2434 | + |
---|
| 2435 | + huelabel.add(hue); |
---|
| 2436 | + huelabel.preferredWidth = 20; |
---|
| 2437 | + huepanel.add(new cGridBag()); // Label |
---|
| 2438 | + huepanel.add(huelabel); // Field/slider |
---|
| 2439 | + |
---|
| 2440 | + huepanel.preferredHeight = 7; |
---|
1439 | 2441 | |
---|
1440 | | - ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints); |
---|
1441 | | - textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1442 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1443 | | - aConstraints.gridx += 1; |
---|
1444 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1445 | | - ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints); |
---|
1446 | | - aConstraints.gridx = 0; |
---|
1447 | | - aConstraints.gridy += 1; |
---|
1448 | | - aConstraints.gridwidth = 1; |
---|
| 2442 | + colorSection.add(huepanel); |
---|
| 2443 | + |
---|
| 2444 | + cGridBag color = new cGridBag(); |
---|
| 2445 | + |
---|
| 2446 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 2447 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2448 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1449 | 2449 | |
---|
1450 | | - ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints); |
---|
1451 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1452 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1453 | | - aConstraints.gridx += 1; |
---|
1454 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1455 | | - ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints); |
---|
1456 | | - aConstraints.gridx = 0; |
---|
1457 | | - aConstraints.gridy += 1; |
---|
1458 | | - aConstraints.gridwidth = 1; |
---|
| 2450 | + //colorField.preferredWidth = 200; |
---|
| 2451 | + colorSection.add(color); |
---|
1459 | 2452 | |
---|
1460 | | - ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints); |
---|
1461 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1462 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1463 | | - aConstraints.gridx += 1; |
---|
1464 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1465 | | - ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints); |
---|
1466 | | - aConstraints.gridx = 0; |
---|
1467 | | - aConstraints.gridy += 1; |
---|
1468 | | - aConstraints.gridwidth = 1; |
---|
| 2453 | + cGridBag modulation = new cGridBag(); |
---|
| 2454 | + modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
| 2455 | + modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2456 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2457 | + colorSection.add(modulation); |
---|
1469 | 2458 | |
---|
1470 | | - ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints); |
---|
1471 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1472 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1473 | | - aConstraints.gridx += 1; |
---|
1474 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1475 | | - ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1476 | | - aConstraints.gridx = 0; |
---|
1477 | | - aConstraints.gridy += 1; |
---|
1478 | | - aConstraints.gridwidth = 1; |
---|
| 2459 | + cGridBag opacity = new cGridBag(); |
---|
| 2460 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 2461 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2462 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2463 | + colorSection.add(opacity); |
---|
1479 | 2464 | |
---|
1480 | | - //aConstraints.weighty = 1; |
---|
1481 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; |
---|
1482 | | - //aConstraints.gridx += 1; |
---|
1483 | | - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); |
---|
1484 | | - aConstraints.weighty = 0; |
---|
1485 | | - aConstraints.gridx = 0; |
---|
1486 | | - aConstraints.gridy += 1; |
---|
1487 | | - aConstraints.gridwidth = 1; |
---|
| 2465 | + colorSection.add(GetSeparator()); |
---|
| 2466 | + |
---|
| 2467 | + cGridBag texture = new cGridBag(); |
---|
| 2468 | + texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
| 2469 | + textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2470 | + texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2471 | + colorSection.add(texture); |
---|
1488 | 2472 | |
---|
1489 | | - ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints); |
---|
1490 | | - diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1491 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1492 | | - aConstraints.gridx += 1; |
---|
1493 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1494 | | - ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1495 | | - aConstraints.gridx = 0; |
---|
1496 | | - aConstraints.gridy += 1; |
---|
1497 | | - aConstraints.gridwidth = 1; |
---|
| 2473 | + panel.add(GetSeparator()); |
---|
| 2474 | + |
---|
| 2475 | + panel.add(colorSection); |
---|
| 2476 | + |
---|
| 2477 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
| 2478 | + |
---|
| 2479 | + cGridBag diffuseSection = new cGridBag().setVertical(true); |
---|
| 2480 | + |
---|
| 2481 | + cGridBag diffuse = new cGridBag(); |
---|
| 2482 | + diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints); |
---|
| 2483 | + diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2484 | + diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2485 | + diffuseSection.add(diffuse); |
---|
1498 | 2486 | |
---|
1499 | | - ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints); |
---|
1500 | | - diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1501 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1502 | | - aConstraints.gridx += 1; |
---|
1503 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1504 | | - ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1505 | | - aConstraints.gridx = 0; |
---|
1506 | | - aConstraints.gridy += 1; |
---|
1507 | | - aConstraints.gridwidth = 1; |
---|
| 2487 | + cGridBag diffuseness = new cGridBag(); |
---|
| 2488 | + diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints); |
---|
| 2489 | + diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2490 | + diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2491 | + diffuseSection.add(diffuseness); |
---|
1508 | 2492 | |
---|
1509 | | - ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints); |
---|
1510 | | - selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1511 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1512 | | - aConstraints.gridx += 1; |
---|
1513 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1514 | | - ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1515 | | - aConstraints.gridx = 0; |
---|
1516 | | - aConstraints.gridy += 1; |
---|
1517 | | - aConstraints.gridwidth = 1; |
---|
| 2493 | + cGridBag selfshadow = new cGridBag(); |
---|
| 2494 | + selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints); |
---|
| 2495 | + selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2496 | + selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2497 | + diffuseSection.add(selfshadow); |
---|
1518 | 2498 | |
---|
1519 | | - ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints); |
---|
1520 | | - sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1521 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1522 | | - aConstraints.gridx += 1; |
---|
1523 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1524 | | - ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1525 | | - aConstraints.gridx = 0; |
---|
1526 | | - aConstraints.gridy += 1; |
---|
1527 | | - aConstraints.gridwidth = 1; |
---|
| 2499 | + cGridBag sheen = new cGridBag(); |
---|
| 2500 | + sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints); |
---|
| 2501 | + sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2502 | + sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2503 | + diffuseSection.add(sheen); |
---|
1528 | 2504 | |
---|
1529 | | - ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints); |
---|
1530 | | - subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1531 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1532 | | - aConstraints.gridx += 1; |
---|
1533 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1534 | | - ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints); |
---|
1535 | | - aConstraints.gridx = 0; |
---|
1536 | | - aConstraints.gridy += 1; |
---|
1537 | | - aConstraints.gridwidth = 1; |
---|
| 2505 | + cGridBag subsurface = new cGridBag(); |
---|
| 2506 | + subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints); |
---|
| 2507 | + subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2508 | + subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2509 | + diffuseSection.add(subsurface); |
---|
1538 | 2510 | |
---|
1539 | | - ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints); |
---|
1540 | | - shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1541 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1542 | | - aConstraints.gridx += 1; |
---|
1543 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1544 | | - ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1545 | | - aConstraints.gridx = 0; |
---|
1546 | | - aConstraints.gridy += 1; |
---|
1547 | | - aConstraints.gridwidth = 1; |
---|
| 2511 | + cGridBag shadow = new cGridBag(); |
---|
| 2512 | + shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints); |
---|
| 2513 | + shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2514 | + shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2515 | + diffuseSection.add(shadow); |
---|
1548 | 2516 | |
---|
1549 | | - ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints); |
---|
1550 | | - fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1551 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1552 | | - aConstraints.gridx += 1; |
---|
1553 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1554 | | - ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1555 | | - aConstraints.gridx = 0; |
---|
1556 | | - aConstraints.gridy += 1; |
---|
1557 | | - aConstraints.gridwidth = 1; |
---|
| 2517 | + cGridBag fakedepth = new cGridBag(); |
---|
| 2518 | + fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints); |
---|
| 2519 | + fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2520 | + fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2521 | + diffuseSection.add(fakedepth); |
---|
1558 | 2522 | |
---|
1559 | | - //aConstraints.weighty = 1; |
---|
1560 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; |
---|
1561 | | - //aConstraints.gridx += 1; |
---|
1562 | | - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); |
---|
1563 | | - aConstraints.weighty = 0; |
---|
1564 | | - aConstraints.gridx = 0; |
---|
1565 | | - aConstraints.gridy += 1; |
---|
1566 | | - aConstraints.gridwidth = 1; |
---|
| 2523 | + cGridBag shadowbias = new cGridBag(); |
---|
| 2524 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 2525 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2526 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2527 | + diffuseSection.add(shadowbias); |
---|
1567 | 2528 | |
---|
1568 | | - ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints); |
---|
1569 | | - specularLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1570 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1571 | | - aConstraints.gridx += 1; |
---|
1572 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1573 | | - ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1574 | | - aConstraints.gridx = 0; |
---|
1575 | | - aConstraints.gridy += 1; |
---|
1576 | | - aConstraints.gridwidth = 1; |
---|
| 2529 | + panel.add(GetSeparator()); |
---|
| 2530 | + |
---|
| 2531 | + panel.add(diffuseSection); |
---|
| 2532 | + |
---|
| 2533 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
| 2534 | + |
---|
| 2535 | + cGridBag specularSection = new cGridBag().setVertical(true); |
---|
1577 | 2536 | |
---|
1578 | | - ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints); |
---|
1579 | | - lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1580 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1581 | | - aConstraints.gridx += 1; |
---|
1582 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1583 | | - ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1584 | | - aConstraints.gridx = 0; |
---|
1585 | | - aConstraints.gridy += 1; |
---|
1586 | | - aConstraints.gridwidth = 1; |
---|
| 2537 | + cGridBag specular = new cGridBag(); |
---|
| 2538 | + specular.add(specularLabel = new JLabel("Specular")); // , aConstraints); |
---|
| 2539 | + specularLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2540 | + specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2541 | + specularSection.add(specular); |
---|
1587 | 2542 | |
---|
1588 | | - ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints); |
---|
1589 | | - shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1590 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1591 | | - aConstraints.gridx += 1; |
---|
1592 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1593 | | - ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1594 | | - aConstraints.gridx = 0; |
---|
1595 | | - aConstraints.gridy += 1; |
---|
1596 | | - aConstraints.gridwidth = 1; |
---|
| 2543 | + cGridBag lightarea = new cGridBag(); |
---|
| 2544 | + lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints); |
---|
| 2545 | + lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2546 | + lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2547 | + specularSection.add(lightarea); |
---|
1597 | 2548 | |
---|
1598 | | - ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints); |
---|
1599 | | - metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1600 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1601 | | - aConstraints.gridx += 1; |
---|
1602 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1603 | | - ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints); |
---|
1604 | | - aConstraints.gridx = 0; |
---|
1605 | | - aConstraints.gridy += 1; |
---|
1606 | | - aConstraints.gridwidth = 1; |
---|
| 2549 | + cGridBag shininess = new cGridBag(); |
---|
| 2550 | + shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints); |
---|
| 2551 | + shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2552 | + shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2553 | + specularSection.add(shininess); |
---|
1607 | 2554 | |
---|
1608 | | - ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints); |
---|
1609 | | - velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1610 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1611 | | - aConstraints.gridx += 1; |
---|
1612 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1613 | | - ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1614 | | - aConstraints.gridx = 0; |
---|
1615 | | - aConstraints.gridy += 1; |
---|
1616 | | - aConstraints.gridwidth = 1; |
---|
| 2555 | + cGridBag metalness = new cGridBag(); |
---|
| 2556 | + metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints); |
---|
| 2557 | + metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2558 | + metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2559 | + specularSection.add(metalness); |
---|
1617 | 2560 | |
---|
1618 | | - shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1); |
---|
1619 | | - Return(); |
---|
| 2561 | + cGridBag velvet = new cGridBag(); |
---|
| 2562 | + velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints); |
---|
| 2563 | + velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2564 | + velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2565 | + specularSection.add(velvet); |
---|
| 2566 | + |
---|
| 2567 | + shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1); |
---|
| 2568 | + //Return(); |
---|
1620 | 2569 | // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints); |
---|
1621 | 2570 | // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1622 | 2571 | // aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
.. | .. |
---|
1627 | 2576 | // aConstraints.gridy += 1; |
---|
1628 | 2577 | // aConstraints.gridwidth = 1; |
---|
1629 | 2578 | |
---|
1630 | | - //aConstraints.weighty = 1; |
---|
1631 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; |
---|
1632 | | - //aConstraints.gridx += 1; |
---|
1633 | | - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); |
---|
1634 | | - aConstraints.weighty = 0; |
---|
1635 | | - aConstraints.gridx = 0; |
---|
1636 | | - aConstraints.gridy += 1; |
---|
1637 | | - aConstraints.gridwidth = 1; |
---|
| 2579 | + cGridBag anisoU = new cGridBag(); |
---|
| 2580 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 2581 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2582 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2583 | + specularSection.add(anisoU); |
---|
1638 | 2584 | |
---|
1639 | | - ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints); |
---|
1640 | | - cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1641 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1642 | | - aConstraints.gridx += 1; |
---|
1643 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1644 | | - ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1645 | | - aConstraints.gridx = 0; |
---|
1646 | | - aConstraints.gridy += 1; |
---|
1647 | | - aConstraints.gridwidth = 1; |
---|
| 2585 | + cGridBag anisoV = new cGridBag(); |
---|
| 2586 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 2587 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2588 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2589 | + specularSection.add(anisoV); |
---|
1648 | 2590 | |
---|
1649 | | - ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints); |
---|
1650 | | - ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1651 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1652 | | - aConstraints.gridx += 1; |
---|
1653 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1654 | | - ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1655 | | - aConstraints.gridx = 0; |
---|
1656 | | - aConstraints.gridy += 1; |
---|
1657 | | - aConstraints.gridwidth = 1; |
---|
1658 | 2591 | |
---|
1659 | | - ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints); |
---|
1660 | | - backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1661 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1662 | | - aConstraints.gridx += 1; |
---|
1663 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1664 | | - ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints); |
---|
1665 | | - aConstraints.gridx = 0; |
---|
1666 | | - aConstraints.gridy += 1; |
---|
1667 | | - aConstraints.gridwidth = 1; |
---|
| 2592 | + panel.add(GetSeparator()); |
---|
| 2593 | + |
---|
| 2594 | + panel.add(specularSection); |
---|
| 2595 | + |
---|
| 2596 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
| 2597 | + |
---|
| 2598 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1668 | 2599 | |
---|
1669 | | - ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints); |
---|
1670 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1671 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1672 | | - aConstraints.gridx += 1; |
---|
1673 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1674 | | - ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints); |
---|
1675 | | - aConstraints.gridx = 0; |
---|
1676 | | - aConstraints.gridy += 1; |
---|
1677 | | - aConstraints.gridwidth = 1; |
---|
1678 | | - aConstraints.weighty = 0; |
---|
| 2600 | + cGridBag camera = new cGridBag(); |
---|
| 2601 | + camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
| 2602 | + cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2603 | + camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2604 | + colorSection.add(camera); |
---|
1679 | 2605 | |
---|
1680 | | - ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints); |
---|
1681 | | - bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1682 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1683 | | - aConstraints.gridx += 1; |
---|
1684 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1685 | | - ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints); |
---|
1686 | | - aConstraints.gridx = 0; |
---|
1687 | | - aConstraints.gridy += 1; |
---|
1688 | | - aConstraints.gridwidth = 1; |
---|
| 2606 | + cGridBag ambient = new cGridBag(); |
---|
| 2607 | + ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
| 2608 | + ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2609 | + ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2610 | + colorSection.add(ambient); |
---|
1689 | 2611 | |
---|
1690 | | - ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints); |
---|
1691 | | - noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1692 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1693 | | - aConstraints.gridx += 1; |
---|
1694 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1695 | | - ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints); |
---|
1696 | | - aConstraints.gridx = 0; |
---|
1697 | | - aConstraints.gridy += 1; |
---|
1698 | | - aConstraints.gridwidth = 1; |
---|
| 2612 | + cGridBag backlit = new cGridBag(); |
---|
| 2613 | + backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
| 2614 | + backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2615 | + backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2616 | + colorSection.add(backlit); |
---|
1699 | 2617 | |
---|
1700 | | - ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints); |
---|
1701 | | - powerLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1702 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1703 | | - aConstraints.gridx += 1; |
---|
1704 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1705 | | - ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints); |
---|
1706 | | - aConstraints.gridx = 0; |
---|
1707 | | - aConstraints.gridy += 1; |
---|
1708 | | - aConstraints.gridwidth = 1; |
---|
| 2618 | + //panel.add(new JSeparator()); |
---|
| 2619 | + |
---|
| 2620 | + //panel.add(globalSection); |
---|
| 2621 | + |
---|
| 2622 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
| 2623 | + |
---|
| 2624 | + cGridBag textureSection = new cGridBag().setVertical(true); |
---|
1709 | 2625 | |
---|
1710 | | - ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints); |
---|
1711 | | - borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1712 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1713 | | - aConstraints.gridx += 1; |
---|
1714 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1715 | | - ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints); |
---|
1716 | | - aConstraints.gridx = 0; |
---|
1717 | | - aConstraints.gridy += 1; |
---|
1718 | | - aConstraints.gridwidth = 1; |
---|
| 2626 | + cGridBag bump = new cGridBag(); |
---|
| 2627 | + bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints); |
---|
| 2628 | + bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2629 | + bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints); |
---|
| 2630 | + textureSection.add(bump); |
---|
1719 | 2631 | |
---|
1720 | | - ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints); |
---|
1721 | | - fogLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1722 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1723 | | - aConstraints.gridx += 1; |
---|
1724 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1725 | | - ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints); |
---|
1726 | | - aConstraints.gridx = 0; |
---|
1727 | | - aConstraints.gridy += 1; |
---|
1728 | | - aConstraints.gridwidth = 1; |
---|
| 2632 | + cGridBag noise = new cGridBag(); |
---|
| 2633 | + noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints); |
---|
| 2634 | + noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2635 | + noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints); |
---|
| 2636 | + textureSection.add(noise); |
---|
1729 | 2637 | |
---|
1730 | | - ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints); |
---|
1731 | | - opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1732 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
1733 | | - aConstraints.gridx += 1; |
---|
1734 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
1735 | | - ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints); |
---|
1736 | | - aConstraints.gridx = 0; |
---|
1737 | | - aConstraints.gridy += 1; |
---|
1738 | | - aConstraints.gridwidth = 1; |
---|
| 2638 | + cGridBag power = new cGridBag(); |
---|
| 2639 | + power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints); |
---|
| 2640 | + powerLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2641 | + power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints); |
---|
| 2642 | + textureSection.add(power); |
---|
1739 | 2643 | |
---|
1740 | | - //aConstraints.weighty = 1; |
---|
1741 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; |
---|
1742 | | - //aConstraints.gridx += 1; |
---|
1743 | | - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); |
---|
1744 | | - aConstraints.weighty = 0; |
---|
| 2644 | + cGridBag borderfade = new cGridBag(); |
---|
| 2645 | + borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints); |
---|
| 2646 | + borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2647 | + borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints); |
---|
| 2648 | + textureSection.add(borderfade); |
---|
1745 | 2649 | |
---|
1746 | | - aConstraints.gridx = 0; |
---|
1747 | | - aConstraints.gridy = 0; |
---|
1748 | | - aConstraints.gridwidth = 1; |
---|
| 2650 | + cGridBag fog = new cGridBag(); |
---|
| 2651 | + fog.add(fogLabel = new JLabel("Punch")); // , aConstraints); |
---|
| 2652 | + fogLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2653 | + fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints); |
---|
| 2654 | + textureSection.add(fog); |
---|
| 2655 | + |
---|
| 2656 | + cGridBag opacityPower = new cGridBag(); |
---|
| 2657 | + opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints); |
---|
| 2658 | + opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2659 | + opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
| 2660 | + textureSection.add(opacityPower); |
---|
| 2661 | + |
---|
| 2662 | + panel.add(GetSeparator()); |
---|
| 2663 | + |
---|
| 2664 | + panel.add(textureSection); |
---|
| 2665 | + |
---|
| 2666 | + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1749 | 2667 | |
---|
1750 | 2668 | SetMaterial(copy); // .GetMaterial()); |
---|
1751 | 2669 | |
---|
1752 | | - colorField.addChangeListener(this); |
---|
1753 | | - modulationField.addChangeListener(this); |
---|
| 2670 | + //colorField.addChangeListener(this); |
---|
| 2671 | +// modulationField.addChangeListener(this); |
---|
1754 | 2672 | metalnessField.addChangeListener(this); |
---|
1755 | 2673 | diffuseField.addChangeListener(this); |
---|
1756 | 2674 | specularField.addChangeListener(this); |
---|
.. | .. |
---|
1780 | 2698 | opacityPowerField.addChangeListener(this); |
---|
1781 | 2699 | /**/ |
---|
1782 | 2700 | |
---|
1783 | | - resetSlidersButton.addActionListener(this); |
---|
1784 | 2701 | clearMaterialButton.addActionListener(this); |
---|
1785 | 2702 | createMaterialButton.addActionListener(this); |
---|
1786 | | - |
---|
1787 | | - propagateToggle.addItemListener(this); |
---|
1788 | | - multiplyToggle.addItemListener(this); |
---|
| 2703 | + |
---|
| 2704 | + if (Globals.ADVANCED) |
---|
| 2705 | + { |
---|
| 2706 | + resetSlidersButton.addActionListener(this); |
---|
| 2707 | + propagateToggle.addItemListener(this); |
---|
| 2708 | + multiplyToggle.addItemListener(this); |
---|
| 2709 | + } |
---|
1789 | 2710 | } |
---|
1790 | 2711 | |
---|
1791 | 2712 | void DropFile(java.io.File[] files, boolean textures) |
---|
.. | .. |
---|
1803 | 2724 | // 3D models |
---|
1804 | 2725 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1805 | 2726 | { |
---|
1806 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1807 | | - LoadFile(filename, lastConverter); |
---|
| 2727 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2728 | + //LoadFile(filename, lastConverter); |
---|
| 2729 | + LoadObjFile(filename); // New 3ds loader |
---|
1808 | 2730 | continue; |
---|
1809 | 2731 | } |
---|
1810 | 2732 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
1859 | 2781 | } |
---|
1860 | 2782 | |
---|
1861 | 2783 | // Images/textures |
---|
1862 | | - if (textures |
---|
1863 | | - && (filename.toLowerCase().endsWith(".jpg") |
---|
1864 | | - || filename.toLowerCase().endsWith(".jpeg") |
---|
1865 | | - || filename.toLowerCase().endsWith(".gif") |
---|
1866 | | - || filename.toLowerCase().endsWith(".png") |
---|
1867 | | - || filename.toLowerCase().endsWith(".tre") |
---|
1868 | | - || filename.toLowerCase().endsWith(".bmp") |
---|
1869 | | - || filename.toLowerCase().endsWith(".tga") |
---|
1870 | | - || filename.toLowerCase().endsWith(".sgi") |
---|
1871 | | - || filename.toLowerCase().endsWith(".tif") |
---|
1872 | | - || filename.toLowerCase().endsWith(".tiff"))) |
---|
| 2784 | + if (filename.toLowerCase().endsWith(".jpg") |
---|
| 2785 | + || filename.toLowerCase().endsWith(".jpeg") |
---|
| 2786 | + || filename.toLowerCase().endsWith(".gif") |
---|
| 2787 | + || filename.toLowerCase().endsWith(".png") |
---|
| 2788 | + || filename.toLowerCase().endsWith(".tre") |
---|
| 2789 | + || filename.toLowerCase().endsWith(".bmp") |
---|
| 2790 | + || filename.toLowerCase().endsWith(".tga") |
---|
| 2791 | + || filename.toLowerCase().endsWith(".sgi") |
---|
| 2792 | + || filename.toLowerCase().endsWith(".tif") |
---|
| 2793 | + || filename.toLowerCase().endsWith(".tiff")) |
---|
1873 | 2794 | { |
---|
1874 | | - DropTexture(filename); |
---|
| 2795 | + if (textures) |
---|
| 2796 | + DropTexture(filename); |
---|
| 2797 | + else |
---|
| 2798 | + CreateBillboard(filename); |
---|
1875 | 2799 | continue; |
---|
1876 | 2800 | } |
---|
1877 | 2801 | |
---|
.. | .. |
---|
1880 | 2804 | } |
---|
1881 | 2805 | |
---|
1882 | 2806 | ResetModel(); |
---|
| 2807 | + } |
---|
| 2808 | + |
---|
| 2809 | + void CreateBillboard(String filename) |
---|
| 2810 | + { |
---|
| 2811 | + Object3D source = null; |
---|
| 2812 | + Object3D group = copy; |
---|
| 2813 | + |
---|
| 2814 | + if (group.selection.size() > 0) |
---|
| 2815 | + { |
---|
| 2816 | + source = group.selection.get(0); |
---|
| 2817 | + } |
---|
| 2818 | + |
---|
| 2819 | + Grid grid = new Grid(1,1); |
---|
| 2820 | + grid.material = null; |
---|
| 2821 | + |
---|
| 2822 | + grid.toParent = LA.newMatrix(); |
---|
| 2823 | + grid.fromParent = LA.newMatrix(); |
---|
| 2824 | + LA.matYRotate(grid.toParent, Math.PI/2); |
---|
| 2825 | + LA.matXRotate(grid.toParent, -Math.PI/2); |
---|
| 2826 | + LA.matXRotate(grid.fromParent, Math.PI/2); |
---|
| 2827 | + LA.matYRotate(grid.fromParent, -Math.PI/2); |
---|
| 2828 | + |
---|
| 2829 | + BillboardNode bb = new BillboardNode(); |
---|
| 2830 | + bb.addChild(grid); |
---|
| 2831 | + |
---|
| 2832 | + Object3D newgroup = new Object3D(); |
---|
| 2833 | + newgroup.CreateMaterial(); |
---|
| 2834 | + |
---|
| 2835 | + File file = new File(filename); |
---|
| 2836 | + newgroup.name = file.getName(); |
---|
| 2837 | + newgroup.addChild(bb); |
---|
| 2838 | + |
---|
| 2839 | + Object3D main = newgroup; |
---|
| 2840 | + |
---|
| 2841 | + main.SetPigmentTexture(filename); |
---|
| 2842 | + |
---|
| 2843 | + if (source != null) |
---|
| 2844 | + { |
---|
| 2845 | + main.material = new cMaterial(source.material); |
---|
| 2846 | + if (main.projectedVertices.length < source.projectedVertices.length) |
---|
| 2847 | + { |
---|
| 2848 | + main.projectedVertices = new Object3D.cVector2[source.projectedVertices.length]; |
---|
| 2849 | + } |
---|
| 2850 | + |
---|
| 2851 | + for (int i=0; i<source.projectedVertices.length; i++) |
---|
| 2852 | + { |
---|
| 2853 | + main.projectedVertices[i].x = source.projectedVertices[i].x; |
---|
| 2854 | + main.projectedVertices[i].y = source.projectedVertices[i].y; |
---|
| 2855 | + } |
---|
| 2856 | + |
---|
| 2857 | + main.texres = source.texres; |
---|
| 2858 | + } |
---|
| 2859 | + |
---|
| 2860 | + makeSomething(newgroup, false); |
---|
1883 | 2861 | } |
---|
1884 | 2862 | |
---|
1885 | 2863 | Point location; |
---|
.. | .. |
---|
1900 | 2878 | |
---|
1901 | 2879 | //? flashIt = false; |
---|
1902 | 2880 | CameraPane pane = (CameraPane) cameraView; |
---|
1903 | | - pane.clickStart(location.x, location.y, 0); |
---|
| 2881 | + pane.clickStart(location.x, location.y, 0, 0); |
---|
1904 | 2882 | pane.clickEnd(location.x, location.y, 0, true); |
---|
1905 | 2883 | |
---|
1906 | 2884 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
1949 | 2927 | e2.printStackTrace(); |
---|
1950 | 2928 | } |
---|
1951 | 2929 | } |
---|
| 2930 | + |
---|
1952 | 2931 | LoadJMEThread loadThread; |
---|
1953 | 2932 | |
---|
1954 | 2933 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
2006 | 2985 | //LoadFile0(filename, converter); |
---|
2007 | 2986 | } |
---|
2008 | 2987 | } |
---|
| 2988 | + |
---|
2009 | 2989 | LoadOBJThread loadObjThread; |
---|
2010 | 2990 | |
---|
2011 | 2991 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2084 | 3064 | |
---|
2085 | 3065 | void LoadObjFile(String fullname) |
---|
2086 | 3066 | { |
---|
2087 | | - /* |
---|
| 3067 | + System.out.println("Loading " + fullname); |
---|
| 3068 | + /**/ |
---|
2088 | 3069 | //lastFilename = fullname; |
---|
2089 | 3070 | if(loadObjThread == null) |
---|
2090 | 3071 | { |
---|
2091 | | - loadObjThread = new LoadOBJThread(); |
---|
2092 | | - loadObjThread.start(); |
---|
| 3072 | + loadObjThread = new LoadOBJThread(); |
---|
| 3073 | + loadObjThread.start(); |
---|
2093 | 3074 | } |
---|
2094 | 3075 | |
---|
2095 | 3076 | loadObjThread.add(fullname); |
---|
2096 | | - */ |
---|
| 3077 | + /**/ |
---|
2097 | 3078 | |
---|
2098 | | - System.out.println("Loading " + fullname); |
---|
2099 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 3079 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2100 | 3080 | } |
---|
2101 | 3081 | |
---|
2102 | 3082 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2138 | 3118 | { |
---|
2139 | 3119 | Mocap sel = (Mocap) copy.selection.get(0); |
---|
2140 | 3120 | |
---|
| 3121 | + sel.SetCurrentBones(sel.frame); |
---|
| 3122 | + |
---|
2141 | 3123 | sel.fullname = fullname; |
---|
2142 | 3124 | |
---|
2143 | 3125 | if (changename) |
---|
.. | .. |
---|
2151 | 3133 | sel.smoothed = false; |
---|
2152 | 3134 | |
---|
2153 | 3135 | // if (!changename) |
---|
2154 | | - sel.SetPositionDelta(false, true, true, true/*?*/); // false |
---|
| 3136 | + //sel.SetPositionDelta(false, true, true, true/*?*/); // false |
---|
| 3137 | + sel.SetGlobalTransform(); |
---|
| 3138 | + sel.LoadData(); |
---|
| 3139 | + sel.Rewind(); |
---|
| 3140 | + sel.Fade(); |
---|
2155 | 3141 | // sel.setPose(0); |
---|
2156 | 3142 | refreshContents(); |
---|
2157 | 3143 | } else |
---|
2158 | 3144 | { |
---|
2159 | 3145 | mocap.Reset(); |
---|
2160 | 3146 | // new skeleton |
---|
2161 | | - makeSomething(mocap, false); // true); |
---|
| 3147 | + makeSomething(mocap, true); // true); |
---|
2162 | 3148 | } |
---|
2163 | 3149 | } catch (Exception e) |
---|
2164 | 3150 | { |
---|
.. | .. |
---|
2185 | 3171 | { |
---|
2186 | 3172 | Mocap sel = (Mocap) select; |
---|
2187 | 3173 | |
---|
| 3174 | + sel.SetCurrentBones(sel.frame); |
---|
| 3175 | + |
---|
2188 | 3176 | File file = new File(fullname); |
---|
2189 | 3177 | |
---|
2190 | 3178 | // Mocap mocap = new Mocap("Mocap" + file.getName()); |
---|
.. | .. |
---|
2251 | 3239 | |
---|
2252 | 3240 | if (!changename) |
---|
2253 | 3241 | { |
---|
2254 | | - sel.SetPositionDelta(false, true, true, true/*?*/); |
---|
| 3242 | + //sel.SetPositionDelta(false, true, true, true/*?*/); |
---|
| 3243 | + sel.SetGlobalTransform(); |
---|
| 3244 | + sel.LoadData(); |
---|
| 3245 | + sel.Rewind(); |
---|
| 3246 | + sel.Fade(); |
---|
2255 | 3247 | } |
---|
2256 | 3248 | |
---|
2257 | 3249 | // sel.setPose(0); |
---|
.. | .. |
---|
2345 | 3337 | |
---|
2346 | 3338 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2347 | 3339 | { |
---|
2348 | | - if (GraphreeD.standAlone) |
---|
| 3340 | + if (Grafreed.standAlone) |
---|
2349 | 3341 | { |
---|
2350 | 3342 | /**/ |
---|
2351 | 3343 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
2352 | | - browser.show(); |
---|
| 3344 | + browser.setVisible(true); |
---|
2353 | 3345 | String filename = browser.getFile(); |
---|
2354 | 3346 | if (filename != null && filename.length() > 0) |
---|
2355 | 3347 | { |
---|
.. | .. |
---|
2460 | 3452 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2461 | 3453 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2462 | 3454 | } |
---|
| 3455 | + |
---|
2463 | 3456 | //cJME.count++; |
---|
2464 | 3457 | //cJME.count %= 12; |
---|
2465 | 3458 | if (gc) |
---|
.. | .. |
---|
2494 | 3487 | } |
---|
2495 | 3488 | if (input == null) |
---|
2496 | 3489 | { |
---|
| 3490 | + new Exception().printStackTrace(); |
---|
2497 | 3491 | System.exit(0); |
---|
2498 | 3492 | } |
---|
2499 | 3493 | |
---|
.. | .. |
---|
2642 | 3636 | } |
---|
2643 | 3637 | } |
---|
2644 | 3638 | } |
---|
| 3639 | + |
---|
2645 | 3640 | cFileSystemPane FSPane; |
---|
2646 | 3641 | |
---|
2647 | 3642 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2651 | 3646 | |
---|
2652 | 3647 | freezematerial = true; |
---|
2653 | 3648 | colorField.setFloat(mat.color); |
---|
2654 | | - modulationField.setFloat(mat.modulation); |
---|
| 3649 | + saturationField.setFloat(mat.modulation); |
---|
2655 | 3650 | metalnessField.setFloat(mat.metalness); |
---|
2656 | 3651 | diffuseField.setFloat(mat.diffuse); |
---|
2657 | 3652 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
2695 | 3690 | } |
---|
2696 | 3691 | } |
---|
2697 | 3692 | } |
---|
| 3693 | + |
---|
2698 | 3694 | freezematerial = false; |
---|
2699 | 3695 | } |
---|
2700 | 3696 | |
---|
2701 | 3697 | void SetMaterial(Object3D object) |
---|
2702 | 3698 | { |
---|
| 3699 | + latestObject = object; |
---|
| 3700 | + |
---|
2703 | 3701 | cMaterial mat = object.material; |
---|
2704 | 3702 | |
---|
2705 | 3703 | if (mat == null) |
---|
.. | .. |
---|
2708 | 3706 | return; |
---|
2709 | 3707 | } |
---|
2710 | 3708 | |
---|
2711 | | - multiplyToggle.setSelected(mat.multiply); |
---|
2712 | | - |
---|
2713 | | - assert (object.projectedVertices != null); |
---|
2714 | | - |
---|
2715 | | - if (object.projectedVertices.length <= 2) |
---|
2716 | | - { |
---|
2717 | | - // Side effect... |
---|
2718 | | - Object3D.cVector2[] keep = object.projectedVertices; |
---|
2719 | | - object.projectedVertices = new Object3D.cVector2[3]; |
---|
2720 | | - for (int i = 0; i < 3; i++) |
---|
2721 | | - { |
---|
2722 | | - if (i < keep.length) |
---|
2723 | | - { |
---|
2724 | | - object.projectedVertices[i] = keep[i]; |
---|
2725 | | - } else |
---|
2726 | | - { |
---|
2727 | | - object.projectedVertices[i] = new Object3D.cVector2(); |
---|
2728 | | - } |
---|
2729 | | - /* |
---|
2730 | | - if(keep.length == 0) |
---|
2731 | | - object.projectedVertices[0] = new Object3D.cVector2(); |
---|
2732 | | - else |
---|
2733 | | - object.projectedVertices[0] = keep[0]; |
---|
2734 | | - object.projectedVertices[1] = new Object3D.cVector2(); |
---|
2735 | | - */ |
---|
2736 | | - } |
---|
2737 | | - } |
---|
| 3709 | + if (multiplyToggle != null) |
---|
| 3710 | + multiplyToggle.setSelected(mat.multiply); |
---|
| 3711 | + |
---|
| 3712 | + AllocProjectedVertices(object); |
---|
2738 | 3713 | |
---|
2739 | 3714 | SetMaterial(mat, object.projectedVertices); |
---|
2740 | 3715 | } |
---|
.. | .. |
---|
2810 | 3785 | // } |
---|
2811 | 3786 | |
---|
2812 | 3787 | /**/ |
---|
2813 | | - if (deselect) |
---|
| 3788 | + if (deselect || child == null) |
---|
2814 | 3789 | { |
---|
2815 | 3790 | //group.deselectAll(); |
---|
2816 | 3791 | //freeze = true; |
---|
2817 | 3792 | GetTree().clearSelection(); |
---|
2818 | 3793 | //freeze = false; |
---|
| 3794 | + |
---|
| 3795 | + if (child == null) |
---|
| 3796 | + { |
---|
| 3797 | + return; |
---|
| 3798 | + } |
---|
2819 | 3799 | } |
---|
2820 | 3800 | |
---|
2821 | 3801 | //group.addSelectee(child); |
---|
.. | .. |
---|
2849 | 3829 | public void itemStateChanged(ItemEvent event) |
---|
2850 | 3830 | { |
---|
2851 | 3831 | // System.out.println("Propagate = " + propagate); |
---|
| 3832 | + if (event.getSource() == pinButton) |
---|
| 3833 | + { |
---|
| 3834 | + copy.pinned ^= true; |
---|
| 3835 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3836 | + { |
---|
| 3837 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3838 | + copy.CloseUI(); |
---|
| 3839 | + //copy.editWindow.refreshContents(); |
---|
| 3840 | + } |
---|
| 3841 | + } |
---|
| 3842 | + else |
---|
2852 | 3843 | if (event.getSource() == propagateToggle) |
---|
2853 | 3844 | { |
---|
2854 | 3845 | propagate ^= true; |
---|
.. | .. |
---|
2884 | 3875 | cameraView.ToggleDL(); |
---|
2885 | 3876 | cameraView.repaint(); |
---|
2886 | 3877 | return; |
---|
2887 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3878 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2888 | 3879 | { |
---|
2889 | 3880 | cameraView.ToggleTexture(); |
---|
2890 | 3881 | // june 2013 copy.HardTouch(); |
---|
2891 | 3882 | cameraView.repaint(); |
---|
2892 | 3883 | return; |
---|
2893 | | - } else if (event.getSource() == toggleFullItem) |
---|
| 3884 | + } else if (event.getSource() == toggleTimelineItem) |
---|
2894 | 3885 | { |
---|
2895 | | - if (CameraPane.FULLSCREEN) |
---|
| 3886 | + timeline ^= true; |
---|
| 3887 | + |
---|
| 3888 | + if (timeline) |
---|
2896 | 3889 | { |
---|
2897 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
2898 | | - framePanel.add(bigThree); |
---|
2899 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
2900 | | - } else |
---|
2901 | | - { |
---|
2902 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
2903 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 3890 | + centralPanel.remove(cameraView); |
---|
| 3891 | + cameraPanel.add(cameraView); |
---|
| 3892 | + centralPanel.add(cameraPanel); |
---|
| 3893 | + frame.setJMenuBar(timelineMenubar); |
---|
| 3894 | + wasFullScreen = CameraPane.FULLSCREEN; |
---|
| 3895 | + if (!CameraPane.FULLSCREEN) |
---|
| 3896 | + ToggleFullScreen(); |
---|
| 3897 | + toggleFullScreenItem.setEnabled(false); |
---|
2904 | 3898 | } |
---|
| 3899 | + else |
---|
| 3900 | + { |
---|
| 3901 | + centralPanel.remove(cameraPanel); |
---|
| 3902 | + centralPanel.add(cameraView); |
---|
| 3903 | + frame.setJMenuBar(null); |
---|
| 3904 | + if (!wasFullScreen) |
---|
| 3905 | + ToggleFullScreen(); |
---|
| 3906 | + toggleFullScreenItem.setEnabled(true); |
---|
| 3907 | + } |
---|
| 3908 | + |
---|
2905 | 3909 | frame.validate(); |
---|
2906 | | - cameraView.ToggleFullScreen(); |
---|
| 3910 | + return; |
---|
| 3911 | + } else if (event.getSource() == toggleFullScreenItem) |
---|
| 3912 | + { |
---|
| 3913 | + ToggleFullScreen(); |
---|
| 3914 | + frame.validate(); |
---|
2907 | 3915 | |
---|
2908 | 3916 | return; |
---|
2909 | | - } else if (event.getSource() == toggleRandomItem) |
---|
| 3917 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2910 | 3918 | { |
---|
2911 | | - cameraView.ToggleRandom(); |
---|
| 3919 | + cameraView.ToggleSwitch(); |
---|
2912 | 3920 | cameraView.repaint(); |
---|
2913 | 3921 | return; |
---|
2914 | 3922 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
2936 | 3944 | } else if (event.getSource() == liveCB) |
---|
2937 | 3945 | { |
---|
2938 | 3946 | copy.live ^= true; |
---|
| 3947 | + objEditor.refreshContents(true); // To show item colors |
---|
| 3948 | + return; |
---|
| 3949 | + } else if (event.getSource() == selectableCB) |
---|
| 3950 | + { |
---|
| 3951 | + copy.dontselect ^= true; |
---|
2939 | 3952 | return; |
---|
2940 | 3953 | } else if (event.getSource() == hideCB) |
---|
2941 | 3954 | { |
---|
2942 | 3955 | copy.hide ^= true; |
---|
2943 | 3956 | copy.Touch(); // display list issue |
---|
2944 | | - objEditor.refreshContents(); |
---|
| 3957 | + objEditor.refreshContents(true); // To show item colors |
---|
2945 | 3958 | return; |
---|
2946 | 3959 | } else if (event.getSource() == link2masterCB) |
---|
2947 | 3960 | { |
---|
.. | .. |
---|
2951 | 3964 | if (event.getSource() == randomCB) |
---|
2952 | 3965 | { |
---|
2953 | 3966 | copy.random ^= true; |
---|
| 3967 | + objEditor.refreshContents(); |
---|
2954 | 3968 | return; |
---|
2955 | 3969 | } |
---|
2956 | 3970 | if (event.getSource() == speedupCB) |
---|
.. | .. |
---|
2974 | 3988 | |
---|
2975 | 3989 | public void actionPerformed(ActionEvent event) |
---|
2976 | 3990 | { |
---|
| 3991 | + Object source = event.getSource(); |
---|
2977 | 3992 | // SCRIPT DIALOG |
---|
2978 | | - if (event.getSource() == okbutton) |
---|
| 3993 | + if (source == okbutton) |
---|
2979 | 3994 | { |
---|
2980 | 3995 | textpanel.setVisible(false); |
---|
2981 | 3996 | textpanel.remove(textarea); |
---|
.. | .. |
---|
2987 | 4002 | textarea = null; |
---|
2988 | 4003 | textpanel = null; |
---|
2989 | 4004 | } |
---|
2990 | | - if (event.getSource() == cancelbutton) |
---|
| 4005 | + if (source == cancelbutton) |
---|
2991 | 4006 | { |
---|
2992 | 4007 | textpanel.setVisible(false); |
---|
2993 | 4008 | textpanel.remove(textarea); |
---|
.. | .. |
---|
2999 | 4014 | //applySelf(); |
---|
3000 | 4015 | //client.refreshEditWindow(); |
---|
3001 | 4016 | //refreshContents(); |
---|
3002 | | - if (event.getSource() == nameField) |
---|
| 4017 | + if (source == nameField) |
---|
3003 | 4018 | { |
---|
3004 | 4019 | //System.out.println("ObjEditor " + event); |
---|
3005 | 4020 | applySelf0(true); |
---|
3006 | 4021 | //parent.applySelf(); |
---|
3007 | | - objEditor.refreshContents(); |
---|
3008 | | - } else if (event.getSource() == resetButton) |
---|
| 4022 | + // conflicts with requestFocus objEditor.refreshContents(); |
---|
| 4023 | + } else if (source == resetButton) |
---|
3009 | 4024 | { |
---|
3010 | 4025 | CameraPane.fullreset = true; |
---|
3011 | 4026 | copy.Reset(); // ResetMeshes(); |
---|
3012 | 4027 | copy.Touch(); |
---|
3013 | 4028 | objEditor.refreshContents(); |
---|
3014 | | - } else if (event.getSource() == stepItem) |
---|
| 4029 | + } else if (source == stepItem) |
---|
3015 | 4030 | { |
---|
3016 | | - cameraView.ONESTEP = true; |
---|
| 4031 | + //cameraView.ONESTEP = true; |
---|
| 4032 | + Globals.ONESTEP = true; |
---|
3017 | 4033 | cameraView.repaint(); |
---|
3018 | 4034 | return; |
---|
3019 | | - } else if (event.getSource() == stepButton) |
---|
| 4035 | + } else if (source == stepButton) |
---|
3020 | 4036 | { |
---|
3021 | 4037 | copy.Step(); |
---|
3022 | 4038 | copy.Touch(); |
---|
3023 | 4039 | objEditor.refreshContents(); |
---|
3024 | | - } else if (event.getSource() == slowerButton) |
---|
| 4040 | + } else if (source == slowerButton) |
---|
3025 | 4041 | { |
---|
3026 | 4042 | copy.Slower(); |
---|
3027 | 4043 | copy.Touch(); |
---|
3028 | 4044 | objEditor.refreshContents(); |
---|
3029 | | - } else if (event.getSource() == fasterButton) |
---|
| 4045 | + } else if (source == fasterButton) |
---|
3030 | 4046 | { |
---|
3031 | 4047 | copy.Faster(); |
---|
3032 | 4048 | copy.Touch(); |
---|
3033 | 4049 | objEditor.refreshContents(); |
---|
3034 | | - } else if (event.getSource() == remarkButton) |
---|
| 4050 | + } else if (source == remarkButton) |
---|
3035 | 4051 | { |
---|
3036 | 4052 | copy.Remark(); |
---|
3037 | 4053 | copy.Touch(); |
---|
3038 | 4054 | objEditor.refreshContents(); |
---|
3039 | | - } else if (event.getSource() == stepAllButton) |
---|
| 4055 | + } else if (source == stepAllButton) |
---|
3040 | 4056 | { |
---|
3041 | 4057 | copy.StepAll(); |
---|
3042 | 4058 | copy.Touch(); |
---|
3043 | 4059 | objEditor.refreshContents(); |
---|
3044 | | - } else if (event.getSource() == resetAllButton) |
---|
| 4060 | + } else if (source == resetAllButton) |
---|
3045 | 4061 | { |
---|
3046 | 4062 | //CameraPane.fullreset = true; |
---|
3047 | 4063 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3074 | 4090 | // Close(); |
---|
3075 | 4091 | // } |
---|
3076 | 4092 | // else |
---|
3077 | | - if (event.getSource() == resetSlidersButton) |
---|
| 4093 | + if (source == resetSlidersButton) |
---|
3078 | 4094 | { |
---|
3079 | 4095 | ResetSliders(); |
---|
3080 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 4096 | + } else if (source == clearMaterialButton) |
---|
3081 | 4097 | { |
---|
3082 | 4098 | ClearMaterial(); |
---|
3083 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 4099 | + } else if (source == createMaterialButton) |
---|
3084 | 4100 | { |
---|
3085 | 4101 | CreateMaterial(); |
---|
3086 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 4102 | + } else if (source == clearPanelButton) |
---|
3087 | 4103 | { |
---|
3088 | 4104 | copy.ClearUI(); |
---|
3089 | 4105 | refreshContents(true); |
---|
3090 | | - } /* |
---|
3091 | | - } |
---|
3092 | | - |
---|
3093 | | - public boolean action(Event event, Object arg) |
---|
3094 | | - { |
---|
3095 | | - */ else if (event.getSource() == closeItem) |
---|
| 4106 | + } else if (source == importGFDItem) |
---|
| 4107 | + { |
---|
| 4108 | + ImportGFD(); |
---|
| 4109 | + } else |
---|
| 4110 | + if (source == importVRMLX3DItem) |
---|
| 4111 | + { |
---|
| 4112 | + ImportVRMLX3D(); |
---|
| 4113 | + } else |
---|
| 4114 | + if (source == import3DSItem) |
---|
| 4115 | + { |
---|
| 4116 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 4117 | + } else |
---|
| 4118 | + if (source == importOBJItem) |
---|
| 4119 | + { |
---|
| 4120 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 4121 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 4122 | + browser.setVisible(true); |
---|
| 4123 | + String filename = browser.getFile(); |
---|
| 4124 | + if (filename != null && filename.length() > 0) |
---|
| 4125 | + { |
---|
| 4126 | + String fullname = browser.getDirectory() + filename; |
---|
| 4127 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 4128 | + } |
---|
| 4129 | + } else |
---|
| 4130 | + if (source == closeItem) |
---|
3096 | 4131 | { |
---|
3097 | 4132 | Close(); |
---|
3098 | 4133 | //return true; |
---|
3099 | | - } else if (event.getSource() == loadItem) |
---|
| 4134 | + } else if (source == openItem) |
---|
3100 | 4135 | { |
---|
3101 | | - load(); |
---|
| 4136 | + Open(); |
---|
3102 | 4137 | //return true; |
---|
3103 | | - } else if (event.getSource() == saveItem) |
---|
| 4138 | + } else if (source == newItem) |
---|
| 4139 | + { |
---|
| 4140 | + New(); |
---|
| 4141 | + } else if (source == saveItem) |
---|
3104 | 4142 | { |
---|
3105 | 4143 | save(); |
---|
3106 | 4144 | //return true; |
---|
3107 | | - } else if (event.getSource() == saveAsItem) |
---|
| 4145 | + } else if (source == saveAsItem) |
---|
3108 | 4146 | { |
---|
3109 | 4147 | saveAs(); |
---|
3110 | 4148 | //return true; |
---|
3111 | | - } else if (event.getSource() == reexportItem) |
---|
| 4149 | + } else if (source == reexportItem) |
---|
3112 | 4150 | { |
---|
3113 | 4151 | reexport(); |
---|
3114 | 4152 | //return true; |
---|
3115 | | - } else if (event.getSource() == exportAsItem) |
---|
| 4153 | + } else if (source == exportAsItem) |
---|
3116 | 4154 | { |
---|
3117 | 4155 | export(); |
---|
3118 | 4156 | //return true; |
---|
3119 | | - } else if (event.getSource() == povItem) |
---|
| 4157 | + } else if (source == povItem) |
---|
3120 | 4158 | { |
---|
3121 | 4159 | generatePOV(); |
---|
3122 | 4160 | //return true; |
---|
3123 | | - } else if (event.getSource() == zBufferItem) |
---|
| 4161 | + } else if (event.getSource() == archiveItem) |
---|
| 4162 | + { |
---|
| 4163 | + cTools.Archive(frame); |
---|
| 4164 | + return; |
---|
| 4165 | + } else if (source == zBufferItem) |
---|
3124 | 4166 | { |
---|
3125 | 4167 | try |
---|
3126 | 4168 | { |
---|
.. | .. |
---|
3142 | 4184 | cameraView.repaint(); |
---|
3143 | 4185 | //return true; |
---|
3144 | 4186 | } |
---|
3145 | | - */ else if (event.getSource() == editCameraItem) |
---|
3146 | | - { |
---|
3147 | | - cameraView.ProtectCamera(); |
---|
3148 | | - cameraView.repaint(); |
---|
3149 | | - return; |
---|
3150 | | - } else if (event.getSource() == revertCameraItem) |
---|
3151 | | - { |
---|
3152 | | - cameraView.RevertCamera(); |
---|
3153 | | - cameraView.repaint(); |
---|
3154 | | - return; |
---|
3155 | | - } else if (event.getSource() == textureButton) |
---|
3156 | | - { |
---|
3157 | | - return; // true; |
---|
3158 | | - } else // combos... |
---|
3159 | | - if (event.getSource() == texresMenu) |
---|
| 4187 | + */ else // combos... |
---|
| 4188 | + if (source == texresMenu) |
---|
3160 | 4189 | { |
---|
3161 | 4190 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3162 | 4191 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3168 | 4197 | } |
---|
3169 | 4198 | } |
---|
3170 | 4199 | |
---|
3171 | | - void ToggleAnimation() |
---|
| 4200 | + void New() |
---|
3172 | 4201 | { |
---|
3173 | | - if (!CameraPane.ANIMATION) |
---|
| 4202 | + while (copy.Size() > 0) |
---|
3174 | 4203 | { |
---|
3175 | | - FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); |
---|
| 4204 | + copy.remove(0); |
---|
| 4205 | + } |
---|
| 4206 | + |
---|
| 4207 | + copy.selection.clear(); |
---|
| 4208 | + |
---|
| 4209 | + ResetModel(); |
---|
| 4210 | + SetupViews(); |
---|
| 4211 | + objEditor.refreshContents(); |
---|
| 4212 | + } |
---|
| 4213 | + |
---|
| 4214 | + static public byte[] Compress(Object3D o) |
---|
| 4215 | + { |
---|
| 4216 | + // Slower to actually compress. |
---|
| 4217 | + try |
---|
| 4218 | + { |
---|
| 4219 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 4220 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 4221 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
| 4222 | + |
---|
| 4223 | + Object3D parent = o.parent; |
---|
| 4224 | + o.parent = null; |
---|
| 4225 | + |
---|
| 4226 | + out.writeObject(o); |
---|
| 4227 | + |
---|
| 4228 | + o.parent = parent; |
---|
| 4229 | + |
---|
| 4230 | + out.flush(); |
---|
| 4231 | + |
---|
| 4232 | + baos //zstream |
---|
| 4233 | + .close(); |
---|
| 4234 | + out.close(); |
---|
| 4235 | + |
---|
| 4236 | + byte[] bytes = baos.toByteArray(); |
---|
| 4237 | + |
---|
| 4238 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 4239 | + return bytes; |
---|
| 4240 | + } catch (Exception e) |
---|
| 4241 | + { |
---|
| 4242 | + System.err.println(e); |
---|
| 4243 | + return null; |
---|
| 4244 | + } |
---|
| 4245 | + } |
---|
| 4246 | + |
---|
| 4247 | + static public Object Uncompress(byte[] bytes) |
---|
| 4248 | + { |
---|
| 4249 | + System.out.println("restore #bytes = " + bytes.length); |
---|
| 4250 | + try |
---|
| 4251 | + { |
---|
| 4252 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 4253 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 4254 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
| 4255 | + Object obj = in.readObject(); |
---|
| 4256 | + |
---|
| 4257 | + bais //istream |
---|
| 4258 | + .close(); |
---|
| 4259 | + in.close(); |
---|
| 4260 | + |
---|
| 4261 | + return obj; |
---|
| 4262 | + } catch (Exception e) |
---|
| 4263 | + { |
---|
| 4264 | + System.err.println(e); |
---|
| 4265 | + return null; |
---|
| 4266 | + } |
---|
| 4267 | + } |
---|
| 4268 | + |
---|
| 4269 | + static public Object clone(Object o) |
---|
| 4270 | + { |
---|
| 4271 | + try |
---|
| 4272 | + { |
---|
| 4273 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 4274 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 4275 | + |
---|
| 4276 | + out.writeObject(o); |
---|
| 4277 | + |
---|
| 4278 | + out.flush(); |
---|
| 4279 | + out.close(); |
---|
| 4280 | + |
---|
| 4281 | + byte[] bytes = baos.toByteArray(); |
---|
| 4282 | + |
---|
| 4283 | + System.out.println("clone = " + bytes.length); |
---|
| 4284 | + |
---|
| 4285 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 4286 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 4287 | + Object obj = in.readObject(); |
---|
| 4288 | + in.close(); |
---|
| 4289 | + |
---|
| 4290 | + return obj; |
---|
| 4291 | + } catch (Exception e) |
---|
| 4292 | + { |
---|
| 4293 | + System.err.println(e); |
---|
| 4294 | + return null; |
---|
| 4295 | + } |
---|
| 4296 | + } |
---|
| 4297 | + |
---|
| 4298 | + cRadio GetCurrentTab() |
---|
| 4299 | + { |
---|
| 4300 | + cRadio ab; |
---|
| 4301 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 4302 | + { |
---|
| 4303 | + ab = (cRadio)e.nextElement(); |
---|
| 4304 | + if(ab.GetObject() == copy) |
---|
| 4305 | + { |
---|
| 4306 | + return ab; |
---|
| 4307 | + } |
---|
| 4308 | + } |
---|
| 4309 | + |
---|
| 4310 | + return null; |
---|
| 4311 | + } |
---|
| 4312 | + |
---|
| 4313 | + |
---|
| 4314 | + public void Save() |
---|
| 4315 | + { |
---|
| 4316 | + //Save(true); |
---|
| 4317 | + Replace(); |
---|
| 4318 | + SetVersionStates(); |
---|
| 4319 | + } |
---|
| 4320 | + |
---|
| 4321 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 4322 | + { |
---|
| 4323 | + if (compress.length != name.length) |
---|
| 4324 | + { |
---|
| 4325 | + return false; |
---|
| 4326 | + } |
---|
| 4327 | + |
---|
| 4328 | + for (int i=compress.length; --i>=0;) |
---|
| 4329 | + { |
---|
| 4330 | + if (compress[i] != name[i]) |
---|
| 4331 | + return false; |
---|
| 4332 | + } |
---|
| 4333 | + |
---|
| 4334 | + return true; |
---|
| 4335 | + } |
---|
| 4336 | + |
---|
| 4337 | + void DeleteVersion() |
---|
| 4338 | + { |
---|
| 4339 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4340 | + { |
---|
| 4341 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4342 | + } |
---|
| 4343 | + |
---|
| 4344 | + if (copy.versionlist[copy.versionindex] == null) |
---|
| 4345 | + copy.versionindex -= 1; |
---|
| 4346 | + |
---|
| 4347 | + if (copy.versionindex != -1) |
---|
| 4348 | + CopyChanged(); |
---|
| 4349 | + |
---|
| 4350 | + SetVersionStates(); |
---|
| 4351 | + } |
---|
| 4352 | + |
---|
| 4353 | + public boolean Save(boolean user) |
---|
| 4354 | + { |
---|
| 4355 | + System.err.println("Save"); |
---|
| 4356 | + Replace(); |
---|
| 4357 | + |
---|
| 4358 | + //cRadio tab = GetCurrentTab(); |
---|
| 4359 | + |
---|
| 4360 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
| 4361 | + |
---|
| 4362 | + boolean thesame = false; |
---|
| 4363 | + |
---|
| 4364 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4365 | +// { |
---|
| 4366 | +// thesame = true; |
---|
| 4367 | +// } |
---|
| 4368 | + |
---|
| 4369 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 4370 | + if (!thesame) |
---|
| 4371 | + { |
---|
| 4372 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4373 | + { |
---|
| 4374 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4375 | + } |
---|
| 4376 | + |
---|
| 4377 | + //tab.user[tab.versionindex] = user; |
---|
| 4378 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 4379 | + |
---|
| 4380 | + copy.versionlist[++copy.versionindex] = compress; |
---|
| 4381 | + |
---|
| 4382 | + // if (increment) |
---|
| 4383 | + // tab.versionindex++; |
---|
| 4384 | + } |
---|
| 4385 | + |
---|
| 4386 | + //copy.RestoreBigData(versiontable); |
---|
| 4387 | + |
---|
| 4388 | + //assert(hashtable.isEmpty()); |
---|
| 4389 | + |
---|
| 4390 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4391 | +// { |
---|
| 4392 | +// //tab.user[i] = false; |
---|
| 4393 | +// copy.versionlist[i] = null; |
---|
| 4394 | +// } |
---|
| 4395 | + |
---|
| 4396 | + SetVersionStates(); |
---|
| 4397 | + |
---|
| 4398 | + // test save |
---|
| 4399 | + if (false) |
---|
| 4400 | + { |
---|
| 4401 | + try |
---|
| 4402 | + { |
---|
| 4403 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
| 4404 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4405 | + |
---|
| 4406 | + p.writeObject(copy); |
---|
| 4407 | + |
---|
| 4408 | + p.flush(); |
---|
| 4409 | + |
---|
| 4410 | + ostream.close(); |
---|
| 4411 | + } catch (Exception e) |
---|
| 4412 | + { |
---|
| 4413 | + e.printStackTrace(); |
---|
| 4414 | + } |
---|
| 4415 | + } |
---|
| 4416 | + |
---|
| 4417 | + return !thesame; |
---|
| 4418 | + } |
---|
| 4419 | + |
---|
| 4420 | + boolean flashIt = true; |
---|
| 4421 | + |
---|
| 4422 | + void RefreshSelection() |
---|
| 4423 | + { |
---|
| 4424 | + Object3D selection = new Object3D(); |
---|
| 4425 | + |
---|
| 4426 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4427 | + { |
---|
| 4428 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 4429 | + |
---|
| 4430 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4431 | + |
---|
| 4432 | + if (obj == null) |
---|
| 4433 | + { |
---|
| 4434 | + copy.selection.remove(i--); |
---|
| 4435 | + } |
---|
| 4436 | + else |
---|
| 4437 | + { |
---|
| 4438 | + selection.add(obj); |
---|
| 4439 | + copy.selection.setElementAt(obj, i); |
---|
| 4440 | + } |
---|
| 4441 | + } |
---|
| 4442 | + |
---|
| 4443 | + flashIt = false; |
---|
| 4444 | + GetTree().clearSelection(); |
---|
| 4445 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4446 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4447 | + flashIt = true; |
---|
| 4448 | + |
---|
| 4449 | + //refreshContents(false); |
---|
| 4450 | + } |
---|
| 4451 | + |
---|
| 4452 | + void CopyChanged() |
---|
| 4453 | + { |
---|
| 4454 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4455 | + |
---|
| 4456 | + SetVersionStates(); |
---|
| 4457 | + |
---|
| 4458 | + boolean temp = CameraPane.SWITCH; |
---|
| 4459 | + CameraPane.SWITCH = false; |
---|
| 4460 | + |
---|
| 4461 | + copy.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 4462 | + |
---|
| 4463 | + copy.clear(); |
---|
| 4464 | + |
---|
| 4465 | + copy.skyboxname = obj.skyboxname; |
---|
| 4466 | + copy.skyboxext = obj.skyboxext; |
---|
| 4467 | + |
---|
| 4468 | + for (int i=0; i<obj.Size(); i++) |
---|
| 4469 | + { |
---|
| 4470 | + copy.add(obj.get(i)); |
---|
| 4471 | + } |
---|
| 4472 | + |
---|
| 4473 | + copy.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 4474 | + |
---|
| 4475 | + CameraPane.SWITCH = temp; |
---|
| 4476 | + |
---|
| 4477 | + RefreshSelection(); |
---|
| 4478 | + //assert(hashtable.isEmpty()); |
---|
| 4479 | + |
---|
| 4480 | + copy.Touch(); |
---|
| 4481 | + |
---|
| 4482 | + ResetModel(); |
---|
| 4483 | + copy.HardTouch(); // recompile? |
---|
| 4484 | + |
---|
| 4485 | + cRadio ab; |
---|
| 4486 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 4487 | + { |
---|
| 4488 | + ab = (cRadio)e.nextElement(); |
---|
| 4489 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 4490 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 4491 | + if (test != null) |
---|
| 4492 | + { |
---|
| 4493 | + test.editWindow = ab.object.editWindow; |
---|
| 4494 | + ab.object = test; |
---|
| 4495 | + } |
---|
| 4496 | + } |
---|
| 4497 | + |
---|
| 4498 | + refreshContents(true); |
---|
| 4499 | + } |
---|
| 4500 | + |
---|
| 4501 | + cButton previousVersionButton; |
---|
| 4502 | + cButton restoreButton; |
---|
| 4503 | + cButton replaceButton; |
---|
| 4504 | + cButton nextVersionButton; |
---|
| 4505 | + cButton saveVersionButton; |
---|
| 4506 | + cButton deleteVersionButton; |
---|
| 4507 | + |
---|
| 4508 | + boolean muteSlider; |
---|
| 4509 | + |
---|
| 4510 | + int VersionCount() |
---|
| 4511 | + { |
---|
| 4512 | + int count = 0; |
---|
| 4513 | + |
---|
| 4514 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
| 4515 | + { |
---|
| 4516 | + if (copy.versionlist[i] != null) |
---|
| 4517 | + count++; |
---|
| 4518 | + } |
---|
| 4519 | + |
---|
| 4520 | + return count; |
---|
| 4521 | + } |
---|
| 4522 | + |
---|
| 4523 | + public cGridBag versionSliderPane; |
---|
| 4524 | + |
---|
| 4525 | + void SetVersionStates() |
---|
| 4526 | + { |
---|
| 4527 | + //if (true) |
---|
| 4528 | + // return; |
---|
| 4529 | + |
---|
| 4530 | + //cRadio tab = GetCurrentTab(); |
---|
| 4531 | + |
---|
| 4532 | + if (copy.versionlist == null) |
---|
| 4533 | + { |
---|
| 4534 | + saveVersionButton.setEnabled(false); |
---|
| 4535 | + restoreButton.setEnabled(false); |
---|
| 4536 | + replaceButton.setEnabled(false); |
---|
| 4537 | + previousVersionButton.setEnabled(false); |
---|
| 4538 | + nextVersionButton.setEnabled(false); |
---|
| 4539 | + deleteVersionButton.setEnabled(false); |
---|
| 4540 | + versionSliderPane.setVisible(false); |
---|
| 4541 | + } |
---|
| 4542 | + else |
---|
| 4543 | + { |
---|
| 4544 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 4545 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 4546 | + |
---|
| 4547 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4548 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4549 | + |
---|
| 4550 | + deleteVersionButton.setEnabled(copy.versionindex != -1); |
---|
| 4551 | + //copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4552 | + |
---|
| 4553 | + muteSlider = true; |
---|
| 4554 | + versionSlider.setMinimum(0); |
---|
| 4555 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4556 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4557 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
| 4558 | + muteSlider = false; |
---|
| 4559 | + |
---|
| 4560 | + versionSliderPane.setVisible(true); |
---|
| 4561 | + } |
---|
| 4562 | + } |
---|
| 4563 | + |
---|
| 4564 | + public boolean PreviousVersion() |
---|
| 4565 | + { |
---|
| 4566 | + // Option? |
---|
| 4567 | + Replace(); |
---|
| 4568 | + |
---|
| 4569 | + System.err.println("Undo"); |
---|
| 4570 | + |
---|
| 4571 | + //cRadio tab = GetCurrentTab(); |
---|
| 4572 | + |
---|
| 4573 | + if (copy.versionindex == 0) |
---|
| 4574 | + { |
---|
| 4575 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4576 | + return false; |
---|
| 4577 | + } |
---|
| 4578 | + |
---|
| 4579 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 4580 | +// { |
---|
| 4581 | +// if (Save(false)) |
---|
| 4582 | +// tab.versionindex -= 1; |
---|
| 4583 | +// else |
---|
| 4584 | +// { |
---|
| 4585 | +// if (tab.versionindex <= 0) |
---|
| 4586 | +// return false; |
---|
| 4587 | +// else |
---|
| 4588 | +// tab.versionindex -= 1; |
---|
| 4589 | +// } |
---|
| 4590 | +// } |
---|
| 4591 | + |
---|
| 4592 | + copy.versionindex -= 1; |
---|
| 4593 | + |
---|
| 4594 | + CopyChanged(); |
---|
| 4595 | + |
---|
| 4596 | + return true; |
---|
| 4597 | + } |
---|
| 4598 | + |
---|
| 4599 | + public boolean Restore() |
---|
| 4600 | + { |
---|
| 4601 | + System.err.println("Restore"); |
---|
| 4602 | + |
---|
| 4603 | + //cRadio tab = GetCurrentTab(); |
---|
| 4604 | + |
---|
| 4605 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4606 | + { |
---|
| 4607 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4608 | + return false; |
---|
| 4609 | + } |
---|
| 4610 | + |
---|
| 4611 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4612 | + CopyChanged(); |
---|
| 4613 | + |
---|
| 4614 | + return true; |
---|
| 4615 | + } |
---|
| 4616 | + |
---|
| 4617 | + public boolean Replace() |
---|
| 4618 | + { |
---|
| 4619 | + //System.err.println("Replace"); |
---|
| 4620 | + |
---|
| 4621 | + //cRadio tab = GetCurrentTab(); |
---|
| 4622 | + |
---|
| 4623 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4624 | + { |
---|
| 4625 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4626 | + return false; |
---|
| 4627 | + } |
---|
| 4628 | + |
---|
| 4629 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
| 4630 | + |
---|
| 4631 | + return true; |
---|
| 4632 | + } |
---|
| 4633 | + |
---|
| 4634 | + public void NextVersion() |
---|
| 4635 | + { |
---|
| 4636 | + // Option? |
---|
| 4637 | + Replace(); |
---|
| 4638 | + |
---|
| 4639 | + //cRadio tab = GetCurrentTab(); |
---|
| 4640 | + |
---|
| 4641 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
| 4642 | + { |
---|
| 4643 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4644 | + return; |
---|
| 4645 | + } |
---|
| 4646 | + |
---|
| 4647 | + copy.versionindex += 1; |
---|
| 4648 | + |
---|
| 4649 | + CopyChanged(); |
---|
| 4650 | + |
---|
| 4651 | + //if (!tab.user[tab.versionindex]) |
---|
| 4652 | + // tab.graphs[tab.versionindex] = null; |
---|
| 4653 | + } |
---|
| 4654 | + |
---|
| 4655 | + void ImportGFD() |
---|
| 4656 | + { |
---|
| 4657 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
3176 | 4658 | browser.show(); |
---|
3177 | 4659 | String filename = browser.getFile(); |
---|
3178 | 4660 | if (filename != null && filename.length() > 0) |
---|
3179 | 4661 | { |
---|
3180 | | - CameraPane.filename = browser.getDirectory() + filename; |
---|
| 4662 | + String fullname = browser.getDirectory() + filename; |
---|
| 4663 | + |
---|
| 4664 | + //Object3D readobj = |
---|
| 4665 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 4666 | + //makeSomething(readobj); |
---|
| 4667 | + } |
---|
| 4668 | + } |
---|
| 4669 | + |
---|
| 4670 | + void ImportVRMLX3D() |
---|
| 4671 | + { |
---|
| 4672 | + if (Grafreed.standAlone) |
---|
| 4673 | + { |
---|
| 4674 | + /**/ |
---|
| 4675 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 4676 | + browser.show(); |
---|
| 4677 | + String filename = browser.getFile(); |
---|
| 4678 | + if (filename != null && filename.length() > 0) |
---|
| 4679 | + { |
---|
| 4680 | + String fullname = browser.getDirectory() + filename; |
---|
| 4681 | + LoadVRMLX3D(fullname); |
---|
| 4682 | + } |
---|
| 4683 | + /**/ |
---|
| 4684 | + } |
---|
| 4685 | + } |
---|
| 4686 | + |
---|
| 4687 | + void ToggleAnimation() |
---|
| 4688 | + { |
---|
| 4689 | + if (!Globals.ANIMATION) |
---|
| 4690 | + { |
---|
| 4691 | + FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); |
---|
| 4692 | + browser.setVisible(true); |
---|
| 4693 | + String filename = browser.getFile(); |
---|
| 4694 | + if (filename != null && filename.length() > 0) |
---|
| 4695 | + { |
---|
| 4696 | + Globals.filename = browser.getDirectory() + filename; |
---|
3181 | 4697 | //CameraPane.framecount = 0; |
---|
3182 | | - CameraPane.imagecount = 0; |
---|
| 4698 | + Globals.imagecount = 0; |
---|
3183 | 4699 | |
---|
3184 | | - CameraPane.ANIMATION ^= true; |
---|
| 4700 | + Globals.ANIMATION ^= true; |
---|
3185 | 4701 | |
---|
3186 | | - GraphreeD.wav.cursor = 0; |
---|
3187 | | - GraphreeD.wav.loop = 0; |
---|
| 4702 | + Grafreed.wav.cursor = 0; |
---|
| 4703 | + Grafreed.wav.loop = 0; |
---|
3188 | 4704 | } |
---|
3189 | 4705 | } else |
---|
3190 | 4706 | { |
---|
3191 | | - CameraPane.ANIMATION ^= true; |
---|
| 4707 | + Globals.ANIMATION ^= true; |
---|
3192 | 4708 | } |
---|
3193 | 4709 | } |
---|
3194 | 4710 | |
---|
.. | .. |
---|
3234 | 4750 | void CreateMaterial() |
---|
3235 | 4751 | { |
---|
3236 | 4752 | //copy.ClearMaterial(); // PATCH |
---|
3237 | | - copy.CreateMaterialS(multiplyToggle.isSelected()); |
---|
| 4753 | + copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected()); |
---|
3238 | 4754 | if (copy.selection.size() > 0) |
---|
3239 | 4755 | //SetMaterial(copy); |
---|
3240 | 4756 | { |
---|
.. | .. |
---|
3285 | 4801 | assert false; |
---|
3286 | 4802 | } |
---|
3287 | 4803 | |
---|
3288 | | - void EditSelection() |
---|
| 4804 | + void EditSelection(boolean newWindow) |
---|
3289 | 4805 | { |
---|
3290 | 4806 | } |
---|
3291 | 4807 | |
---|
.. | .. |
---|
3293 | 4809 | { |
---|
3294 | 4810 | copy.ResetBlockLoop(); // temporary problem |
---|
3295 | 4811 | |
---|
3296 | | - boolean random = CameraPane.RANDOM; |
---|
3297 | | - CameraPane.RANDOM = false; // parse everything |
---|
| 4812 | + boolean random = CameraPane.SWITCH; |
---|
| 4813 | + CameraPane.SWITCH = false; // parse everything |
---|
3298 | 4814 | copy.ResetDisplayList(); |
---|
3299 | 4815 | copy.HardTouch(); |
---|
3300 | | - CameraPane.RANDOM = random; |
---|
| 4816 | + CameraPane.SWITCH = random; |
---|
3301 | 4817 | } |
---|
3302 | 4818 | |
---|
3303 | 4819 | // public void applySelf() |
---|
.. | .. |
---|
3327 | 4843 | // else |
---|
3328 | 4844 | // applySelf(true); |
---|
3329 | 4845 | // } |
---|
| 4846 | + |
---|
| 4847 | + boolean Equal(double a, double b) |
---|
| 4848 | + { |
---|
| 4849 | + return Math.abs(a - b) < 0.001; |
---|
| 4850 | + } |
---|
| 4851 | + |
---|
3330 | 4852 | void applySelf0(boolean name) |
---|
3331 | 4853 | { |
---|
3332 | 4854 | if (name) |
---|
.. | .. |
---|
3344 | 4866 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
3345 | 4867 | |
---|
3346 | 4868 | current.color = (float) colorField.getFloat(); |
---|
3347 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4869 | + current.modulation = (float) saturationField.getFloat(); |
---|
3348 | 4870 | current.metalness = (float) metalnessField.getFloat(); |
---|
3349 | 4871 | current.diffuse = (float) diffuseField.getFloat(); |
---|
3350 | 4872 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
3367 | 4889 | current.fakedepth = (float) fakedepthField.getFloat(); |
---|
3368 | 4890 | current.shadowbias = (float) shadowbiasField.getFloat(); |
---|
3369 | 4891 | |
---|
3370 | | - if (!NumberSlider.frozen) |
---|
| 4892 | + if (!cNumberSlider.frozen) |
---|
3371 | 4893 | { |
---|
3372 | 4894 | //System.out.println("Propagate = " + propagate); |
---|
3373 | 4895 | copy.UpdateMaterial(anchor, current, propagate); |
---|
| 4896 | + |
---|
| 4897 | + if (copy.material != null) |
---|
| 4898 | + { |
---|
| 4899 | + cMaterial mat = copy.material; |
---|
| 4900 | + |
---|
| 4901 | + if (!Equal(colorField.getFloat(), mat.color)) |
---|
| 4902 | + colorField.SetToolTipValue((mat.color)); |
---|
| 4903 | + if (!Equal(saturationField.getFloat(), mat.modulation)) |
---|
| 4904 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
| 4905 | + if (!Equal(metalnessField.getFloat(), mat.metalness)) |
---|
| 4906 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 4907 | + if (!Equal(diffuseField.getFloat(), mat.diffuse)) |
---|
| 4908 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 4909 | + if (!Equal(specularField.getFloat(), mat.specular)) |
---|
| 4910 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 4911 | + if (!Equal(shininessField.getFloat(), mat.shininess)) |
---|
| 4912 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 4913 | + if (!Equal(shiftField.getFloat(), mat.shift)) |
---|
| 4914 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 4915 | + if (!Equal(ambientField.getFloat(), mat.ambient)) |
---|
| 4916 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 4917 | + if (!Equal(lightareaField.getFloat(), mat.lightarea)) |
---|
| 4918 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 4919 | + if (!Equal(diffusenessField.getFloat(), mat.factor)) |
---|
| 4920 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 4921 | + if (!Equal(velvetField.getFloat(), mat.velvet)) |
---|
| 4922 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 4923 | + if (!Equal(sheenField.getFloat(), mat.sheen)) |
---|
| 4924 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 4925 | + if (!Equal(subsurfaceField.getFloat(), mat.subsurface)) |
---|
| 4926 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 4927 | + if (!Equal(backlitField.getFloat(), mat.bump)) |
---|
| 4928 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 4929 | + if (!Equal(anisoField.getFloat(), mat.aniso)) |
---|
| 4930 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 4931 | + if (!Equal(anisoVField.getFloat(), mat.anisoV)) |
---|
| 4932 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 4933 | + if (!Equal(cameraField.getFloat(), mat.cameralight)) |
---|
| 4934 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 4935 | + if (!Equal(selfshadowField.getFloat(), mat.diffuseness)) |
---|
| 4936 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 4937 | + if (!Equal(shadowField.getFloat(), mat.shadow)) |
---|
| 4938 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 4939 | + if (!Equal(textureField.getFloat(), mat.texture)) |
---|
| 4940 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 4941 | + if (!Equal(opacityField.getFloat(), mat.opacity)) |
---|
| 4942 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 4943 | + if (!Equal(fakedepthField.getFloat(), mat.fakedepth)) |
---|
| 4944 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 4945 | + if (!Equal(shadowbiasField.getFloat(), mat.shadowbias)) |
---|
| 4946 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 4947 | + } |
---|
| 4948 | + |
---|
3374 | 4949 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
3375 | 4950 | { |
---|
3376 | 4951 | copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000); |
---|
.. | .. |
---|
3399 | 4974 | //copy.Touch(); |
---|
3400 | 4975 | } |
---|
3401 | 4976 | |
---|
| 4977 | + cNumberSlider versionSlider; |
---|
| 4978 | + |
---|
3402 | 4979 | public void stateChanged(ChangeEvent e) |
---|
3403 | 4980 | { |
---|
3404 | | - // assert(false); |
---|
| 4981 | + // assert(false); |
---|
| 4982 | + if (e.getSource() == versionSlider) |
---|
| 4983 | + { |
---|
| 4984 | + if (muteSlider) |
---|
| 4985 | + return; |
---|
| 4986 | + |
---|
| 4987 | + Replace(); |
---|
| 4988 | + |
---|
| 4989 | + int version = versionSlider.getInteger(); |
---|
| 4990 | + |
---|
| 4991 | + if (version != -1 && copy.versionlist[version] != null) |
---|
| 4992 | + { |
---|
| 4993 | + copy.versionindex = version; |
---|
| 4994 | + CopyChanged(); |
---|
| 4995 | + } |
---|
| 4996 | + |
---|
| 4997 | + return; |
---|
| 4998 | + } |
---|
3405 | 4999 | |
---|
3406 | 5000 | if (freezematerial) |
---|
3407 | 5001 | { |
---|
.. | .. |
---|
3415 | 5009 | || e.getSource() == apertureField |
---|
3416 | 5010 | || e.getSource() == shadowblurField) |
---|
3417 | 5011 | { |
---|
| 5012 | + new Exception().printStackTrace(); |
---|
3418 | 5013 | System.exit(0); |
---|
3419 | 5014 | cameraView.options1[0] = (float) focusField.getFloat() * 10; |
---|
3420 | 5015 | cameraView.options1[1] = (float) apertureField.getFloat() / 1000; |
---|
.. | .. |
---|
3436 | 5031 | { |
---|
3437 | 5032 | //System.out.println("stateChanged = " + this); |
---|
3438 | 5033 | materialtouched = true; |
---|
| 5034 | + |
---|
| 5035 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 5036 | + { |
---|
| 5037 | + saturationField.setFloat(1); |
---|
| 5038 | + } |
---|
| 5039 | + |
---|
3439 | 5040 | applySelf(); |
---|
3440 | 5041 | //System.out.println("this = " + this); |
---|
3441 | 5042 | //System.out.println("PARENT = " + parent); |
---|
3442 | 5043 | //if (parent != null) |
---|
3443 | 5044 | // parent.applySelf(); |
---|
3444 | | - refreshContents(); |
---|
| 5045 | + if (e.getSource() == normalpushField) |
---|
| 5046 | + { |
---|
| 5047 | + objEditor.refreshContents(); |
---|
| 5048 | + //Refresh(); |
---|
| 5049 | + } |
---|
| 5050 | + else |
---|
| 5051 | + refreshContents(); |
---|
3445 | 5052 | // ??? client.refreshEditWindow(); |
---|
3446 | 5053 | } |
---|
3447 | 5054 | //else |
---|
.. | .. |
---|
3453 | 5060 | //group.name = nameField.getText(); |
---|
3454 | 5061 | //objEditor.applySelf(); |
---|
3455 | 5062 | |
---|
3456 | | - assert (objEditor == this); |
---|
| 5063 | + // OCT2018: assert (objEditor == this); |
---|
3457 | 5064 | if (copy.selection == null || copy.selection.size() == 0) |
---|
3458 | 5065 | //super.applySelf() |
---|
3459 | 5066 | ; else |
---|
.. | .. |
---|
3477 | 5084 | objEditor.copy = keep; |
---|
3478 | 5085 | } |
---|
3479 | 5086 | } |
---|
| 5087 | + |
---|
| 5088 | + if (normalpushField != null) |
---|
| 5089 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3480 | 5090 | } |
---|
3481 | 5091 | |
---|
3482 | 5092 | void SnapObject() |
---|
3483 | 5093 | { |
---|
3484 | | - Object3D obj = (Object3D)copy.selection.elementAt(0); |
---|
3485 | | - SnapObject(obj); |
---|
| 5094 | + if (copy.selection.size() > 0) |
---|
| 5095 | + { |
---|
| 5096 | + Object3D obj = (Object3D)copy.selection.elementAt(0); |
---|
| 5097 | + SnapObject(obj); |
---|
| 5098 | + } |
---|
3486 | 5099 | } |
---|
3487 | 5100 | |
---|
3488 | 5101 | void SnapObject(Object3D obj) |
---|
.. | .. |
---|
3596 | 5209 | |
---|
3597 | 5210 | if (obj.parent != null) |
---|
3598 | 5211 | { |
---|
3599 | | - obj.parent.TransformToWorld(interest); |
---|
| 5212 | +// obj.parent.TransformToWorld(interest); |
---|
3600 | 5213 | } |
---|
3601 | 5214 | |
---|
3602 | 5215 | if (!CameraPane.TRACK) |
---|
.. | .. |
---|
3723 | 5336 | { |
---|
3724 | 5337 | if (GetTree() != null) |
---|
3725 | 5338 | { |
---|
| 5339 | + GetTree().revalidate(); |
---|
3726 | 5340 | GetTree().repaint(); |
---|
3727 | 5341 | } |
---|
3728 | 5342 | |
---|
3729 | 5343 | radioPanel.revalidate(); |
---|
3730 | 5344 | radioPanel.repaint(); |
---|
3731 | | - ctrlPanel.revalidate(); // ? new |
---|
| 5345 | + ctrlPanel.validate(); // ? new |
---|
3732 | 5346 | ctrlPanel.repaint(); |
---|
3733 | 5347 | } |
---|
| 5348 | + |
---|
| 5349 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5350 | + SetVersionStates(); |
---|
| 5351 | + |
---|
| 5352 | + cameraView.requestFocusInWindow(); |
---|
3734 | 5353 | } |
---|
3735 | 5354 | |
---|
3736 | 5355 | static TweenManager tweenManager = new TweenManager(); |
---|
3737 | 5356 | |
---|
3738 | 5357 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3739 | 5358 | { |
---|
| 5359 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
| 5360 | + Save(); |
---|
3740 | 5361 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3741 | 5362 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3742 | 5363 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
3760 | 5381 | // group = (Composite) group.get(0); |
---|
3761 | 5382 | // } |
---|
3762 | 5383 | |
---|
3763 | | - System.out.println("makeSomething of " + thing); |
---|
| 5384 | + //System.out.println("makeSomething of " + thing); |
---|
3764 | 5385 | |
---|
3765 | 5386 | /* |
---|
3766 | 5387 | if (deselect && jList != null) |
---|
.. | .. |
---|
3823 | 5444 | { |
---|
3824 | 5445 | ResetModel(); |
---|
3825 | 5446 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 5447 | + |
---|
| 5448 | + if (thing.Size() == 0) |
---|
| 5449 | + { |
---|
| 5450 | + //EditSelection(false); |
---|
| 5451 | + } |
---|
| 5452 | + |
---|
3826 | 5453 | refreshContents(); |
---|
3827 | 5454 | } |
---|
3828 | 5455 | |
---|
.. | .. |
---|
3940 | 5567 | } |
---|
3941 | 5568 | } |
---|
3942 | 5569 | } |
---|
| 5570 | + |
---|
3943 | 5571 | LoadGFDThread loadGFDThread; |
---|
3944 | 5572 | |
---|
3945 | 5573 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
3959 | 5587 | |
---|
3960 | 5588 | try |
---|
3961 | 5589 | { |
---|
| 5590 | + // Try compressed version first. |
---|
3962 | 5591 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
3963 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 5592 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 5593 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
3964 | 5594 | |
---|
3965 | 5595 | readobj = (Object3D) p.readObject(); |
---|
3966 | 5596 | istream.close(); |
---|
.. | .. |
---|
3968 | 5598 | readobj.ResetDisplayList(); |
---|
3969 | 5599 | } catch (Exception e) |
---|
3970 | 5600 | { |
---|
3971 | | - e.printStackTrace(); |
---|
| 5601 | + if (!e.toString().contains("GZIP")) |
---|
| 5602 | + e.printStackTrace(); |
---|
| 5603 | + |
---|
| 5604 | + try |
---|
| 5605 | + { |
---|
| 5606 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 5607 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 5608 | + |
---|
| 5609 | + readobj = (Object3D) p.readObject(); |
---|
| 5610 | + istream.close(); |
---|
| 5611 | + |
---|
| 5612 | + readobj.ResetDisplayList(); |
---|
| 5613 | + } catch (Exception e2) |
---|
| 5614 | + { |
---|
| 5615 | + e2.printStackTrace(); |
---|
| 5616 | + } |
---|
3972 | 5617 | } |
---|
3973 | 5618 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
3974 | 5619 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4014 | 5659 | |
---|
4015 | 5660 | void LoadIt(Object obj) |
---|
4016 | 5661 | { |
---|
| 5662 | + if (obj == null) |
---|
| 5663 | + { |
---|
| 5664 | + // Invalid file |
---|
| 5665 | + return; |
---|
| 5666 | + } |
---|
| 5667 | + |
---|
4017 | 5668 | System.out.println("Loaded " + obj); |
---|
4018 | 5669 | //new Exception().printStackTrace(); |
---|
4019 | 5670 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4023 | 5674 | |
---|
4024 | 5675 | if (readobj != null) |
---|
4025 | 5676 | { |
---|
| 5677 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 5678 | + // Save(); |
---|
4026 | 5679 | try |
---|
4027 | 5680 | { |
---|
4028 | 5681 | //readobj.deepCopySelf(copy); |
---|
4029 | 5682 | copy.clear(); // june 2014 |
---|
| 5683 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5684 | + copy.skyboxext = readobj.skyboxext; |
---|
4030 | 5685 | for (int i = 0; i < readobj.size(); i++) |
---|
4031 | 5686 | { |
---|
4032 | 5687 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4067 | 5722 | } |
---|
4068 | 5723 | } catch (ClassCastException e) |
---|
4069 | 5724 | { |
---|
| 5725 | + e.printStackTrace(); |
---|
4070 | 5726 | assert (false); |
---|
4071 | 5727 | Composite c = (Composite) copy; |
---|
4072 | 5728 | c.children.clear(); |
---|
.. | .. |
---|
4077 | 5733 | c.addChild(csg); |
---|
4078 | 5734 | } |
---|
4079 | 5735 | |
---|
| 5736 | + copy.versionlist = readobj.versionlist; |
---|
| 5737 | + copy.versionindex = readobj.versionindex; |
---|
| 5738 | + copy.versiontable = readobj.versiontable; |
---|
| 5739 | + |
---|
| 5740 | + if (copy.versionlist == null) |
---|
| 5741 | + { |
---|
| 5742 | + // Backward compatibility |
---|
| 5743 | + copy.versionlist = new Object3D[100]; |
---|
| 5744 | + copy.versionindex = -1; |
---|
| 5745 | + |
---|
| 5746 | + //Save(true); |
---|
| 5747 | + } |
---|
| 5748 | + |
---|
| 5749 | + //? SetUndoStates(); |
---|
| 5750 | + |
---|
4080 | 5751 | ResetModel(); |
---|
4081 | 5752 | copy.HardTouch(); // recompile? |
---|
4082 | 5753 | refreshContents(); |
---|
4083 | 5754 | } |
---|
4084 | 5755 | } |
---|
4085 | 5756 | |
---|
4086 | | - void load() // throws ClassNotFoundException |
---|
| 5757 | + void Open() // throws ClassNotFoundException |
---|
4087 | 5758 | { |
---|
4088 | | - if (GraphreeD.standAlone) |
---|
| 5759 | + if (Grafreed.standAlone) |
---|
4089 | 5760 | { |
---|
4090 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5761 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4091 | 5762 | browser.show(); |
---|
4092 | 5763 | String filename = browser.getFile(); |
---|
4093 | 5764 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4164 | 5835 | |
---|
4165 | 5836 | void save() |
---|
4166 | 5837 | { |
---|
| 5838 | + Replace(); |
---|
| 5839 | + |
---|
4167 | 5840 | if (lastname == null) |
---|
4168 | 5841 | { |
---|
4169 | 5842 | return; |
---|
.. | .. |
---|
4172 | 5845 | try |
---|
4173 | 5846 | { |
---|
4174 | 5847 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4175 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 5848 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5849 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4176 | 5850 | |
---|
4177 | 5851 | p.writeObject(copy); |
---|
4178 | 5852 | p.flush(); |
---|
4179 | 5853 | |
---|
| 5854 | + zstream.close(); |
---|
4180 | 5855 | ostream.close(); |
---|
4181 | 5856 | |
---|
4182 | 5857 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4184 | 5859 | //ps.print(buffer.toString()); |
---|
4185 | 5860 | } catch (IOException e) |
---|
4186 | 5861 | { |
---|
| 5862 | + e.printStackTrace(); |
---|
4187 | 5863 | } |
---|
4188 | 5864 | } |
---|
| 5865 | + |
---|
4189 | 5866 | String lastname; |
---|
4190 | 5867 | |
---|
4191 | 5868 | void saveAs() |
---|
4192 | 5869 | { |
---|
4193 | | - if (GraphreeD.standAlone) |
---|
| 5870 | + if (Grafreed.standAlone) |
---|
4194 | 5871 | { |
---|
4195 | 5872 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4196 | 5873 | browser.setVisible(true); |
---|
4197 | 5874 | String filename = browser.getFile(); |
---|
4198 | 5875 | if (filename != null && filename.length() > 0) |
---|
4199 | 5876 | { |
---|
| 5877 | + if (!filename.endsWith(".gfd")) |
---|
| 5878 | + filename += ".gfd"; |
---|
4200 | 5879 | lastname = browser.getDirectory() + filename; |
---|
4201 | 5880 | save(); |
---|
4202 | 5881 | } |
---|
.. | .. |
---|
4213 | 5892 | |
---|
4214 | 5893 | Object3D object = copy.selection.get(0); |
---|
4215 | 5894 | |
---|
| 5895 | + FileObject fileobj = null; |
---|
| 5896 | + |
---|
| 5897 | + if (object instanceof FileObject) |
---|
| 5898 | + fileobj = (FileObject)object; |
---|
| 5899 | + |
---|
4216 | 5900 | if (object.fileparent != null) |
---|
4217 | 5901 | { |
---|
4218 | | - FileObject fileobj = (FileObject) object.fileparent; |
---|
| 5902 | + assert(fileobj == null); |
---|
4219 | 5903 | |
---|
| 5904 | + fileobj = (FileObject) object.fileparent; |
---|
| 5905 | + } |
---|
| 5906 | + |
---|
| 5907 | + if (fileobj != null) |
---|
| 5908 | + { |
---|
4220 | 5909 | System.out.println("WriteObject " + object + " : " + fileobj.name); |
---|
4221 | 5910 | WriteObject(object, fileobj.name); |
---|
4222 | 5911 | } |
---|
.. | .. |
---|
4259 | 5948 | } |
---|
4260 | 5949 | } |
---|
4261 | 5950 | else |
---|
4262 | | - //if (GraphreeD.standAlone) |
---|
| 5951 | + //if (GrafreeD.standAlone) |
---|
4263 | 5952 | { |
---|
4264 | 5953 | FileDialog browser = new FileDialog(frame, "Export", FileDialog.SAVE); |
---|
4265 | 5954 | browser.setVisible(true); |
---|
.. | .. |
---|
4285 | 5974 | try |
---|
4286 | 5975 | { |
---|
4287 | 5976 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4288 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4289 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 5977 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 5978 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4290 | 5979 | |
---|
4291 | 5980 | Object3D objectparent = obj.parent; |
---|
4292 | 5981 | obj.parent = null; |
---|
4293 | 5982 | |
---|
4294 | | - Object3D object = (Object3D) GraphreeD.clone(obj); |
---|
| 5983 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4295 | 5984 | |
---|
4296 | 5985 | obj.parent = objectparent; |
---|
4297 | 5986 | |
---|
.. | .. |
---|
4303 | 5992 | p.writeObject(object); |
---|
4304 | 5993 | p.flush(); |
---|
4305 | 5994 | |
---|
| 5995 | + zstream.close(); |
---|
4306 | 5996 | ostream.close(); |
---|
4307 | | - // zstream.close(); |
---|
4308 | 5997 | |
---|
4309 | 5998 | // group.selection.get(0).parent = parent; |
---|
4310 | 5999 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4325 | 6014 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4326 | 6015 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4327 | 6016 | copy.generatePOV(buffer); |
---|
4328 | | - if (GraphreeD.standAlone) |
---|
| 6017 | + if (Grafreed.standAlone) |
---|
4329 | 6018 | { |
---|
4330 | 6019 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4331 | 6020 | browser.show(); |
---|
.. | .. |
---|
4351 | 6040 | Object3D client; |
---|
4352 | 6041 | Object3D copy; |
---|
4353 | 6042 | MenuBar menuBar; |
---|
4354 | | - Menu windowMenu; |
---|
4355 | | - MenuItem loadItem; |
---|
| 6043 | + Menu fileMenu; |
---|
| 6044 | + MenuItem newItem; |
---|
| 6045 | + MenuItem openItem; |
---|
4356 | 6046 | MenuItem saveItem; |
---|
4357 | 6047 | MenuItem saveAsItem; |
---|
4358 | 6048 | MenuItem exportAsItem; |
---|
4359 | 6049 | MenuItem reexportItem; |
---|
4360 | 6050 | MenuItem povItem; |
---|
4361 | 6051 | MenuItem closeItem; |
---|
4362 | | - Menu cameraMenu; |
---|
| 6052 | + |
---|
4363 | 6053 | CheckboxMenuItem zBufferItem; |
---|
4364 | 6054 | //MenuItem normalLensItem; |
---|
4365 | | - MenuItem editCameraItem; |
---|
4366 | | - MenuItem revertCameraItem; |
---|
4367 | | - CheckboxMenuItem toggleLiveItem; |
---|
4368 | 6055 | MenuItem stepItem; |
---|
4369 | | - CheckboxMenuItem toggleFullItem; |
---|
| 6056 | + CheckboxMenuItem toggleLiveItem; |
---|
| 6057 | + CheckboxMenuItem toggleFullScreenItem; |
---|
| 6058 | + CheckboxMenuItem toggleTimelineItem; |
---|
4370 | 6059 | CheckboxMenuItem toggleRenderItem; |
---|
4371 | 6060 | CheckboxMenuItem toggleDebugItem; |
---|
4372 | 6061 | CheckboxMenuItem toggleFrustumItem; |
---|
4373 | 6062 | CheckboxMenuItem toggleFootContactItem; |
---|
4374 | 6063 | CheckboxMenuItem toggleDLItem; |
---|
4375 | 6064 | CheckboxMenuItem toggleTextureItem; |
---|
4376 | | - CheckboxMenuItem toggleRandomItem; |
---|
| 6065 | + CheckboxMenuItem toggleSwitchItem; |
---|
4377 | 6066 | CheckboxMenuItem toggleRootItem; |
---|
4378 | 6067 | CheckboxMenuItem animationItem; |
---|
| 6068 | + MenuItem archiveItem; |
---|
4379 | 6069 | CheckboxMenuItem toggleHandleItem; |
---|
4380 | 6070 | CheckboxMenuItem togglePaintItem; |
---|
4381 | 6071 | JSplitPane mainPanel; |
---|
4382 | 6072 | JScrollPane scrollpane; |
---|
| 6073 | + |
---|
4383 | 6074 | JPanel toolbarPanel; |
---|
4384 | | - JPanel treePanel; |
---|
| 6075 | + |
---|
| 6076 | + cGridBag treePanel; |
---|
| 6077 | + |
---|
4385 | 6078 | JPanel radioPanel; |
---|
4386 | 6079 | ButtonGroup buttonGroup; |
---|
4387 | | - JPanel ctrlPanel; |
---|
4388 | | - JPanel materialPanel; |
---|
| 6080 | + |
---|
| 6081 | + cGridBag toolboxPanel; |
---|
| 6082 | + cGridBag skyboxPanel; |
---|
| 6083 | + cGridBag materialPanel; |
---|
| 6084 | + cGridBag ctrlPanel; |
---|
| 6085 | + |
---|
4389 | 6086 | JScrollPane infoPanel; |
---|
4390 | | - JPanel optionsPanel; |
---|
| 6087 | + |
---|
| 6088 | + cGridBag optionsPanel; |
---|
| 6089 | + |
---|
4391 | 6090 | JTabbedPane objectPanel; |
---|
4392 | | - JPanel XYZPanel; |
---|
| 6091 | + boolean materialFlushed; |
---|
| 6092 | + Object3D latestObject; |
---|
| 6093 | + |
---|
| 6094 | + cGridBag transformPanel; |
---|
| 6095 | + cGridBag XYZPanel; |
---|
| 6096 | + |
---|
4393 | 6097 | JSplitPane gridPanel; |
---|
4394 | 6098 | JSplitPane bigPanel; |
---|
4395 | | - JPanel bigThree; |
---|
4396 | | - JTabbedPane jtp; |
---|
4397 | | - JPanel cameraPanel; |
---|
| 6099 | + |
---|
| 6100 | + cGridBag bigThree; |
---|
| 6101 | + cGridBag scenePanel; |
---|
| 6102 | + cGridBag centralPanel; |
---|
| 6103 | + JSplitPane cameraPanel; |
---|
| 6104 | + JPanel timelinePanel; |
---|
| 6105 | + JMenuBar timelineMenubar; |
---|
4398 | 6106 | JSplitPane framePanel; |
---|
4399 | 6107 | JTextArea/*Field*/ nameField; |
---|
4400 | | - cButton textureButton; |
---|
| 6108 | + //cButton textureButton; |
---|
4401 | 6109 | cButton okButton; |
---|
4402 | 6110 | cButton applyButton; |
---|
4403 | 6111 | cButton cancelButton; |
---|
.. | .. |
---|
4444 | 6152 | // MATERIAL |
---|
4445 | 6153 | JLabel materialLabel; |
---|
4446 | 6154 | JLabel colorLabel; |
---|
4447 | | - NumberSlider colorField; |
---|
| 6155 | + cNumberSlider colorField; |
---|
4448 | 6156 | JLabel modulationLabel; |
---|
4449 | | - NumberSlider modulationField; |
---|
| 6157 | + cNumberSlider saturationField; |
---|
4450 | 6158 | JLabel metalnessLabel; |
---|
4451 | | - NumberSlider metalnessField; |
---|
| 6159 | + cNumberSlider metalnessField; |
---|
4452 | 6160 | JLabel diffuseLabel; |
---|
4453 | | - NumberSlider diffuseField; |
---|
| 6161 | + cNumberSlider diffuseField; |
---|
4454 | 6162 | JLabel specularLabel; |
---|
4455 | | - NumberSlider specularField; |
---|
| 6163 | + cNumberSlider specularField; |
---|
4456 | 6164 | JLabel shininessLabel; |
---|
4457 | | - NumberSlider shininessField; |
---|
| 6165 | + cNumberSlider shininessField; |
---|
4458 | 6166 | JLabel shiftLabel; |
---|
4459 | | - NumberSlider shiftField; |
---|
| 6167 | + cNumberSlider shiftField; |
---|
4460 | 6168 | JLabel ambientLabel; |
---|
4461 | | - NumberSlider ambientField; |
---|
| 6169 | + cNumberSlider ambientField; |
---|
4462 | 6170 | JLabel lightareaLabel; |
---|
4463 | | - NumberSlider lightareaField; |
---|
| 6171 | + cNumberSlider lightareaField; |
---|
4464 | 6172 | JLabel diffusenessLabel; |
---|
4465 | | - NumberSlider diffusenessField; |
---|
| 6173 | + cNumberSlider diffusenessField; |
---|
4466 | 6174 | JLabel velvetLabel; |
---|
4467 | | - NumberSlider velvetField; |
---|
| 6175 | + cNumberSlider velvetField; |
---|
4468 | 6176 | JLabel sheenLabel; |
---|
4469 | | - NumberSlider sheenField; |
---|
| 6177 | + cNumberSlider sheenField; |
---|
4470 | 6178 | JLabel subsurfaceLabel; |
---|
4471 | | - NumberSlider subsurfaceField; |
---|
| 6179 | + cNumberSlider subsurfaceField; |
---|
4472 | 6180 | //JLabel bumpLabel; |
---|
4473 | 6181 | //NumberSlider bumpField; |
---|
4474 | 6182 | JLabel backlitLabel; |
---|
4475 | | - NumberSlider backlitField; |
---|
| 6183 | + cNumberSlider backlitField; |
---|
4476 | 6184 | JLabel anisoLabel; |
---|
4477 | | - NumberSlider anisoField; |
---|
| 6185 | + cNumberSlider anisoField; |
---|
4478 | 6186 | JLabel anisoVLabel; |
---|
4479 | | - NumberSlider anisoVField; |
---|
| 6187 | + cNumberSlider anisoVField; |
---|
| 6188 | + |
---|
4480 | 6189 | JLabel cameraLabel; |
---|
4481 | | - NumberSlider cameraField; |
---|
| 6190 | + cNumberSlider cameraField; |
---|
4482 | 6191 | JLabel selfshadowLabel; |
---|
4483 | | - NumberSlider selfshadowField; |
---|
| 6192 | + cNumberSlider selfshadowField; |
---|
4484 | 6193 | JLabel shadowLabel; |
---|
4485 | | - NumberSlider shadowField; |
---|
| 6194 | + cNumberSlider shadowField; |
---|
4486 | 6195 | JLabel textureLabel; |
---|
4487 | | - NumberSlider textureField; |
---|
| 6196 | + cNumberSlider textureField; |
---|
4488 | 6197 | JLabel opacityLabel; |
---|
4489 | | - NumberSlider opacityField; |
---|
| 6198 | + cNumberSlider opacityField; |
---|
4490 | 6199 | JLabel fakedepthLabel; |
---|
4491 | | - NumberSlider fakedepthField; |
---|
| 6200 | + cNumberSlider fakedepthField; |
---|
4492 | 6201 | JLabel shadowbiasLabel; |
---|
4493 | | - NumberSlider shadowbiasField; |
---|
| 6202 | + cNumberSlider shadowbiasField; |
---|
| 6203 | + |
---|
4494 | 6204 | JLabel bumpLabel; |
---|
4495 | | - NumberSlider bumpField; |
---|
| 6205 | + cNumberSlider bumpField; |
---|
4496 | 6206 | JLabel noiseLabel; |
---|
4497 | | - NumberSlider noiseField; |
---|
| 6207 | + cNumberSlider noiseField; |
---|
4498 | 6208 | JLabel powerLabel; |
---|
4499 | | - NumberSlider powerField; |
---|
| 6209 | + cNumberSlider powerField; |
---|
4500 | 6210 | JLabel borderfadeLabel; |
---|
4501 | | - NumberSlider borderfadeField; |
---|
| 6211 | + cNumberSlider borderfadeField; |
---|
4502 | 6212 | JLabel fogLabel; |
---|
4503 | | - NumberSlider fogField; |
---|
| 6213 | + cNumberSlider fogField; |
---|
4504 | 6214 | JLabel opacityPowerLabel; |
---|
4505 | | - NumberSlider opacityPowerField; |
---|
4506 | | - JTree jTree; |
---|
| 6215 | + cNumberSlider opacityPowerField; |
---|
| 6216 | + cTree jTree; |
---|
4507 | 6217 | //ObjectUI parent; |
---|
| 6218 | + |
---|
| 6219 | + cNumberSlider normalpushField; |
---|
| 6220 | + |
---|
| 6221 | + private MenuItem importGFDItem; |
---|
| 6222 | + private MenuItem importVRMLX3DItem; |
---|
| 6223 | + private MenuItem import3DSItem; |
---|
| 6224 | + private MenuItem importOBJItem; |
---|
4508 | 6225 | } |
---|