Normand Briere
2019-07-30 475f8cbdbd96fdbf8f5b216ffebb31a51f25c2f9
ObjEditor.java
....@@ -4,6 +4,7 @@
44
55 import java.awt.*;
66 import java.awt.event.*;
7
+import java.awt.image.BufferedImage;
78 import javax.swing.*;
89 import javax.swing.event.*;
910 import javax.swing.text.*;
....@@ -14,10 +15,15 @@
1415 //import javax.swing.plaf.ColorUIResource;
1516 //import javax.swing.plaf.metal.DefaultMetalTheme;
1617
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
20
+
1721 //import javax.media.opengl.GLCanvas;
1822
1923 import //weka.core.
2024 matrix.Matrix;
25
+
26
+import grafeme.ui.*;
2127
2228 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
2329 ActionListener, ChangeListener,
....@@ -28,7 +34,59 @@
2834 iSendInfo
2935 //KeyListener
3036 {
37
+ boolean timeline;
38
+ boolean wasFullScreen;
3139
40
+ GroupEditor callee;
41
+ JFrame frame;
42
+
43
+ static ObjEditor theFrame;
44
+
45
+ cButton GetButton(String name, boolean border)
46
+ {
47
+ ImageIcon icon = GetIcon(name);
48
+ return new cButton(icon, border);
49
+ }
50
+
51
+ cToggleButton GetToggleButton(String name, boolean border)
52
+ {
53
+ ImageIcon icon = GetIcon(name);
54
+ return new cToggleButton(icon, border);
55
+ }
56
+
57
+ cCheckBox GetCheckBox(String name, boolean border)
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cCheckBox(icon, border);
61
+ }
62
+
63
+ ImageIcon GetIcon(String name)
64
+ {
65
+ try
66
+ {
67
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
68
+
69
+// if (image.getWidth() > 48 && image.getHeight() > 48)
70
+// {
71
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
72
+// Graphics2D g = resized.createGraphics();
73
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
74
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
75
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
76
+// g.dispose();
77
+//
78
+// image = resized;
79
+// }
80
+
81
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
82
+ return icon;
83
+ }
84
+ catch (Exception e)
85
+ {
86
+ return null;
87
+ }
88
+ }
89
+
3290 // SCRIPT
3391
3492 transient JFrame textpanel = null;
....@@ -119,51 +177,62 @@
119177 void keyPressed(int key, int modifiers)
120178 {
121179 System.out.println("KEY PRESSED");
122
- CameraPane.theRenderer.keyPressed(key, modifiers);
180
+ Globals.theRenderer.keyPressed(key, modifiers);
123181 }
124182 */
125183
126184 static GridBagConstraints aConstraints;
127185 static GridBagConstraints aWindowConstraints;
128
- GroupEditor callee;
129
- JFrame frame;
186
+
130187 static int GRIDWIDTH = 100; // 4;
131188
132189 public void closeUI()
133190 {
134191 //new Exception().printStackTrace();
135
- System.out.println("this = " + this);
136
- System.out.println("objEditor = " + objEditor);
192
+// System.out.println("this = " + this);
193
+// System.out.println("objEditor = " + objEditor);
137194 //nameField.removeActionListener(this);
138
- objEditor.ctrlPanel.remove(nameField);
195
+// objEditor.ctrlPanel.remove(nameField);
139196
140
- if (!GroupEditor.allparams)
197
+ objEditor.ctrlPanel.remove(namePanel);
198
+
199
+ if (!allparams)
141200 return;
142201
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);
202
+// objEditor.ctrlPanel.remove(liveCB);
203
+// objEditor.ctrlPanel.remove(hideCB);
204
+// objEditor.ctrlPanel.remove(markCB);
205
+//
206
+// objEditor.ctrlPanel.remove(randomCB);
207
+// objEditor.ctrlPanel.remove(speedupCB);
208
+// objEditor.ctrlPanel.remove(rewindCB);
209
+//
210
+// objEditor.ctrlPanel.remove(resetButton);
211
+// objEditor.ctrlPanel.remove(stepButton);
212
+//// objEditor.ctrlPanel.remove(stepAllButton);
213
+//// objEditor.ctrlPanel.remove(resetAllButton);
214
+// objEditor.ctrlPanel.remove(link2masterCB);
215
+// //objEditor.ctrlPanel.remove(flipVCB);
216
+// //objEditor.ctrlPanel.remove(texresMenu);
217
+// objEditor.ctrlPanel.remove(slowerButton);
218
+// objEditor.ctrlPanel.remove(fasterButton);
219
+// objEditor.ctrlPanel.remove(remarkButton);
220
+
221
+ objEditor.ctrlPanel.remove(setupPanel);
222
+ objEditor.ctrlPanel.remove(setupPanel2);
223
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
224
+ objEditor.ctrlPanel.remove(pushPanel);
225
+ //objEditor.ctrlPanel.remove(fillPanel);
226
+
227
+ //Remove(normalpushField);
161228 }
162229
163230 public ObjEditor GetEditor()
164231 {
165232 return objEditor; //.GetEditor();
166233 }
234
+
235
+ // Sometimes myself, sometimes my callee's.
167236 ObjEditor objEditor;
168237
169238 /*
....@@ -199,6 +268,12 @@
199268 client = inClient;
200269 copy = client;
201270
271
+ if (copy.versions == null)
272
+ {
273
+ copy.versions = new byte[100][];
274
+ copy.versionindex = -1;
275
+ }
276
+
202277 // "this" is not called: SetupUI2(objEditor);
203278 }
204279
....@@ -212,6 +287,12 @@
212287 client = inClient;
213288 copy = client;
214289
290
+ if (copy.versions == null)
291
+ {
292
+ copy.versions = new byte[100][];
293
+ copy.versionindex = -1;
294
+ }
295
+
215296 SetupUI2(callee.GetEditor());
216297 }
217298
....@@ -226,6 +307,7 @@
226307 //localCopy.parent = null;
227308
228309 frame = new JFrame();
310
+ frame.setUndecorated(false);
229311 objEditor = this;
230312 this.callee = callee;
231313
....@@ -238,11 +320,17 @@
238320 //if (!isDisplayable())
239321 //setUndecorated(true);
240322
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
323
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242324 client = inClient;
243325 copy = localCopy;
244326 copy.editWindow = this;
245327
328
+ if (copy.versions == null)
329
+ {
330
+// copy.versions = new byte[100][];
331
+// copy.versionindex = -1;
332
+ }
333
+
246334 SetupMenu();
247335
248336 //SetupName(objEditor); // new
....@@ -256,28 +344,49 @@
256344 return frame.action(event, obj);
257345 }
258346
347
+ // Cannot work without static
348
+ static boolean allparams = true;
349
+
350
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
351
+
259352 void SetupMenu()
260353 {
261354 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..."));
355
+ menuBar.add(fileMenu = new Menu("File"));
356
+ fileMenu.add(newItem = new MenuItem("New"));
357
+ fileMenu.add(openItem = new MenuItem("Open..."));
358
+
359
+ //oe.menuBar.add(menu = new Menu("Include"));
360
+ Menu menu = new Menu("Import");
361
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
362
+ importOBJItem.addActionListener(this);
363
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
364
+ import3DSItem.addActionListener(this);
365
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
366
+ importVRMLX3DItem.addActionListener(this);
367
+ menu.add("-");
368
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
369
+ importGFDItem.addActionListener(this);
370
+ fileMenu.add(menu);
371
+ fileMenu.add("-");
372
+
373
+ fileMenu.add(saveItem = new MenuItem("Save"));
374
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267375 //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("-");
376
+ fileMenu.add("-");
377
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
378
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
379
+ fileMenu.add("-");
272380 if (client.parent != null)
273381 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
382
+ fileMenu.add(closeItem = new MenuItem("Close"));
275383 } else
276384 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
385
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278386 }
279387
280
- loadItem.addActionListener(this);
388
+ newItem.addActionListener(this);
389
+ openItem.addActionListener(this);
281390 saveItem.addActionListener(this);
282391 saveAsItem.addActionListener(this);
283392 exportAsItem.addActionListener(this);
....@@ -285,82 +394,69 @@
285394 //povItem.addActionListener(this);
286395 closeItem.addActionListener(this);
287396
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(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
296
- toggleFullScreenItem.addItemListener(this);
297
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
298
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
299
- toggleTimelineItem.addItemListener(this);
300
- cameraMenu.add("-");
301
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
302
- toggleTextureItem.addItemListener(this);
303
- toggleTextureItem.setState(CameraPane.textureon);
304
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
305
- toggleLiveItem.addItemListener(this);
306
- toggleLiveItem.setState(CameraPane.isLIVE());
307
- cameraMenu.add(stepItem = new MenuItem("Step"));
308
- stepItem.addActionListener(this);
309
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
310
-// toggleDLItem.addItemListener(this);
311
-// toggleDLItem.setState(false);
312
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
313
- toggleRenderItem.addItemListener(this);
314
- toggleRenderItem.setState(!CameraPane.frozen);
315
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
316
- toggleDebugItem.addItemListener(this);
317
- toggleDebugItem.setState(CameraPane.DEBUG);
318
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
319
- toggleFrustumItem.addItemListener(this);
320
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
321
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
322
- toggleFootContactItem.addItemListener(this);
323
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
324
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
325
- toggleRandomItem.addItemListener(this);
326
- toggleRandomItem.setState(CameraPane.RANDOM);
327
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
328
- toggleHandleItem.addItemListener(this);
329
- toggleHandleItem.setState(CameraPane.HANDLES);
330
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
331
- togglePaintItem.addItemListener(this);
332
- togglePaintItem.setState(CameraPane.PAINTMODE);
333
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
334
-// toggleRootItem.addItemListener(this);
335
-// toggleRootItem.setState(false);
336
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
337
-// animationItem.addItemListener(this);
338
-// animationItem.setState(CameraPane.ANIMATION);
339
- cameraMenu.add("-");
340
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
341
- editCameraItem.addActionListener(this);
342
-
343397 objectPanel = new JTabbedPane();
398
+
399
+ ChangeListener changeListener = new ChangeListener()
400
+ {
401
+ public void stateChanged(ChangeEvent changeEvent)
402
+ {
403
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
404
+// {
405
+// if (latestObject != null)
406
+// {
407
+// refreshContents(true);
408
+// SetMaterial(latestObject);
409
+// }
410
+//
411
+// materialFlushed = true;
412
+// }
413
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
414
+// {
415
+// if (listUI.size() == 0)
416
+// EditSelection(false);
417
+// }
418
+
419
+ refreshContents(false); // To refresh Info tab
420
+ }
421
+ };
422
+ objectPanel.addChangeListener(changeListener);
423
+
344424 toolbarPanel = new JPanel();
345425 toolbarPanel.setName("Toolbar");
346
- treePanel = new JPanel();
426
+
427
+ treePanel = new cGridBag();
347428 treePanel.setName("Tree");
348
- ctrlPanel = new JPanel(); // new GridBagLayout());
349
- ctrlPanel.setName("Edit");
350
- materialPanel = new JPanel();
351
- materialPanel.setName("Material");
429
+
430
+ editPanel = new cGridBag().setVertical(true);
431
+ //editPanel.setName("Edit");
432
+
433
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
434
+
435
+ editCommandsPanel = new cGridBag();
436
+ editPanel.add(editCommandsPanel);
437
+ editPanel.add(ctrlPanel);
438
+
439
+ toolboxPanel = new cGridBag().setVertical(true);
440
+ //toolboxPanel.setName("Toolbox");
441
+
442
+ materialPanel = new cGridBag().setVertical(true);
443
+ //materialPanel.setName("Material");
444
+
352445 /*JTextPane*/
353446 infoarea = createTextPane();
447
+ doc = infoarea.getStyledDocument();
448
+
354449 infoarea.setEditable(true);
355450 SetText();
451
+
356452 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
357453 // infoarea.setOpaque(false);
358454 // //infoarea.setForeground(textcolor);
359
- infoarea.setLineWrap(true);
360
- infoarea.setWrapStyleWord(true);
455
+// TEXTAREA infoarea.setLineWrap(true);
456
+// TEXTAREA infoarea.setWrapStyleWord(true);
361457 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
362
- infoPanel.setPreferredSize(new Dimension(50, 200));
363
- infoPanel.setName("Info");
458
+ infoPanel.setPreferredSize(new Dimension(1, 1));
459
+ //infoPanel.setName("Info");
364460 //infoPanel.setLayout(new BorderLayout());
365461 //infoPanel.add(createTextPane());
366462
....@@ -368,16 +464,23 @@
368464 mainPanel.setName("Main");
369465 mainPanel.setContinuousLayout(true);
370466 mainPanel.setOneTouchExpandable(true);
371
- mainPanel.setDividerLocation(1.0);
372467 mainPanel.setDividerSize(9);
373
- mainPanel.setResizeWeight(0);
374
-
468
+ mainPanel.setDividerLocation(0.5); //1.0);
469
+ mainPanel.setResizeWeight(0.5);
470
+
471
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
472
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
473
+ divider.setDividerSize(15);
474
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
475
+
476
+ mainPanel.setUI(new BasicSplitPaneUI());
477
+
375478 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
376479 //mainPanel.setLayout(new GridBagLayout());
377480 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
378
- treePanel.setLayout(new GridBagLayout());
379
- ctrlPanel.setLayout(new GridBagLayout());
380
- materialPanel.setLayout(new GridBagLayout());
481
+// treePanel.setLayout(new GridBagLayout());
482
+ //ctrlPanel.setLayout(new GridBagLayout());
483
+ //materialPanel.setLayout(new GridBagLayout());
381484
382485 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
383486 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -416,7 +519,7 @@
416519 static String newline = "\n";
417520 protected static final String buttonString = "JButton";
418521 StyledDocument doc;
419
- JTextArea infoarea;
522
+ JTextPane infoarea;
420523
421524 void ClearInfo()
422525 {
....@@ -439,10 +542,10 @@
439542 e.printStackTrace();
440543 }
441544
442
- String selection = infoarea.getText();
443
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
444
- java.awt.datatransfer.Clipboard clipboard =
445
- Toolkit.getDefaultToolkit().getSystemClipboard();
545
+// String selection = infoarea.getText();
546
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
547
+// java.awt.datatransfer.Clipboard clipboard =
548
+// Toolkit.getDefaultToolkit().getSystemClipboard();
446549 //clipboard.setContents(data, data);
447550 }
448551
....@@ -465,13 +568,13 @@
465568 //SendInfo("Name:", "bold");
466569 if (sel.GetTextures() != null || debug)
467570 {
468
- si.SendInfo(sel.toString(), "bold");
571
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
469572 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
470573 if (sel.Size() > 0)
471574 {
472575 si.SendInfo("#children = " + sel.Size(), "regular");
473576 }
474
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
577
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
475578 if (debug)
476579 {
477580 try
....@@ -483,7 +586,10 @@
483586 }
484587
485588 if (full)
486
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
589
+ {
590
+ si.SendInfo(" BBox min: " + minima, "regular");
591
+ si.SendInfo(" BBox max: " + maxima, "regular");
592
+ }
487593
488594 if (sel.bRep != null)
489595 {
....@@ -510,7 +616,7 @@
510616 }
511617 if (sel.support != null)
512618 {
513
- si.SendInfo(" support: " + sel.support, "regular");
619
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
514620 }
515621 if (sel.scriptnode != null)
516622 {
....@@ -581,6 +687,9 @@
581687 {
582688 CameraPane.pointflow = (PointFlow) sel;
583689 }
690
+
691
+ si.SendInfo("_____________________", "regular");
692
+ si.SendInfo("", "regular");
584693 }
585694 }
586695
....@@ -596,52 +705,191 @@
596705 }
597706 }
598707
599
- private JTextArea createTextPane()
600
- {
601
- String[] initString =
602
- {
603
- "This is an editable JTextPane, ", //regular
604
- "another ", //italic
605
- "styled ", //bold
606
- "text ", //small
607
- "component, ", //large
608
- "which supports embedded components..." + newline,//regular
609
- " " + newline, //button
610
- "...and embedded icons..." + newline, //regular
611
- " ", //icon
612
- newline + "JTextPane is a subclass of JEditorPane that "
613
- + "uses a StyledEditorKit and StyledDocument, and provides "
614
- + "cover methods for interacting with those objects."
615
- };
708
+//static GraphicsDevice device = GraphicsEnvironment
709
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
616710
617
- String[] initStyles =
618
- {
619
- "regular", "italic", "bold", "small", "large",
620
- "regular", "button", "regular", "icon",
621
- "regular"
622
- };
711
+ Rectangle keeprect;
712
+ cRadio radio;
713
+
714
+cButton keepButton;
715
+ cButton twoButton; // Full 3D
716
+ cButton sixButton;
717
+ cButton threeButton;
718
+ cButton sevenButton;
719
+ cButton fourButton; // full panel
720
+ cButton oneButton; // full XYZ
721
+ //cButton currentLayout;
722
+
723
+ boolean maximized;
724
+
725
+ cButton fullscreenLayout;
623726
624
- JTextPane textPane = new JTextPane();
625
- textPane.setEditable(true);
626
- /*StyledDocument*/ doc = textPane.getStyledDocument();
627
- addStylesToDocument(doc);
628
-
629
- try
727
+ void Minimize()
630728 {
631
- for (int j = 0; j < 2; j++)
729
+ frame.setState(Frame.ICONIFIED);
730
+ frame.validate();
731
+ }
732
+
733
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
734
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
735
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
736
+ void Maximize()
737
+ {
738
+ if (CameraPane.FULLSCREEN)
632739 {
633
- for (int i = 0; i < initString.length; i++)
634
- {
635
- doc.insertString(doc.getLength(), initString[i],
636
- doc.getStyle(initStyles[i]));
637
- }
740
+ ToggleFullScreen();
638741 }
639
- } catch (BadLocationException ble)
742
+
743
+ if (maximized)
744
+ {
745
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
746
+ }
747
+ else
748
+ {
749
+ keeprect = frame.getBounds();
750
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
751
+// Dimension rect2 = frame.getToolkit().getScreenSize();
752
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
753
+// frame.setState(Frame.MAXIMIZED_BOTH);
754
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
755
+ }
756
+
757
+ maximized ^= true;
758
+
759
+ frame.validate();
760
+ }
761
+
762
+ cButton minButton;
763
+ cButton maxButton;
764
+ cButton fullButton;
765
+
766
+ void ToggleFullScreen()
640767 {
641
- System.err.println("Couldn't insert initial text into text pane.");
768
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
769
+
770
+ cameraView.ToggleFullScreen();
771
+
772
+ if (!CameraPane.FULLSCREEN)
773
+ {
774
+ device.setFullScreenWindow(null);
775
+ frame.dispose();
776
+ frame.setUndecorated(false);
777
+ frame.validate();
778
+ frame.setVisible(true);
779
+
780
+ //frame.setVisible(false);
781
+// frame.removeNotify();
782
+// frame.setUndecorated(false);
783
+// frame.addNotify();
784
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
785
+
786
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
787
+// X framePanel.add(bigThree);
788
+// X frame.getContentPane().add(/*"Center",*/framePanel);
789
+ framePanel.setDividerLocation(46);
790
+
791
+ //frame.setVisible(true);
792
+ radio.layout = keepButton;
793
+ //theFrame = null;
794
+ keepButton = null;
795
+ radio.layout.doClick();
796
+
797
+ } else
798
+ {
799
+ keepButton = radio.layout;
800
+ //keeprect = frame.getBounds();
801
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
802
+// frame.getToolkit().getScreenSize().height);
803
+ //frame.setVisible(false);
804
+
805
+ frame.dispose();
806
+ frame.setUndecorated(true);
807
+ device.setFullScreenWindow(frame);
808
+ frame.validate();
809
+ frame.setVisible(true);
810
+// frame.removeNotify();
811
+// frame.setUndecorated(true);
812
+// frame.addNotify();
813
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
814
+// X framePanel.remove(bigThree);
815
+// X frame.getContentPane().add(/*"Center",*/bigThree);
816
+ framePanel.setDividerLocation(0);
817
+
818
+ radio.layout = fullscreenLayout;
819
+ radio.layout.doClick();
820
+ //frame.setVisible(true);
821
+ }
822
+ frame.validate();
642823 }
643824
644
- return new JTextArea(); // textPane;
825
+ private byte[] CompressCopy()
826
+ {
827
+ boolean temp = CameraPane.SWITCH;
828
+ CameraPane.SWITCH = false;
829
+
830
+ copy.ExtractBigData(versiontable);
831
+ // if (copy == client)
832
+
833
+ byte[] versions[] = copy.versions;
834
+ copy.versions = null;
835
+
836
+ byte[] compress = Compress(copy);
837
+
838
+ copy.versions = versions;
839
+
840
+ copy.RestoreBigData(versiontable);
841
+
842
+ CameraPane.SWITCH = temp;
843
+
844
+ return compress;
845
+ }
846
+
847
+ private JTextPane createTextPane()
848
+ {
849
+// TEXTAREA String[] initString =
850
+// {
851
+// "This is an editable JTextPane, ", //regular
852
+// "another ", //italic
853
+// "styled ", //bold
854
+// "text ", //small
855
+// "component, ", //large
856
+// "which supports embedded components..." + newline,//regular
857
+// " " + newline, //button
858
+// "...and embedded icons..." + newline, //regular
859
+// " ", //icon
860
+// newline + "JTextPane is a subclass of JEditorPane that "
861
+// + "uses a StyledEditorKit and StyledDocument, and provides "
862
+// + "cover methods for interacting with those objects."
863
+// };
864
+//
865
+// String[] initStyles =
866
+// {
867
+// "regular", "italic", "bold", "small", "large",
868
+// "regular", "button", "regular", "icon",
869
+// "regular"
870
+// };
871
+//
872
+// JTextPane textPane = new JTextPane();
873
+// textPane.setEditable(true);
874
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
875
+// addStylesToDocument(doc);
876
+//
877
+// try
878
+// {
879
+// for (int j = 0; j < 2; j++)
880
+// {
881
+// for (int i = 0; i < initString.length; i++)
882
+// {
883
+// doc.insertString(doc.getLength(), initString[i],
884
+// doc.getStyle(initStyles[i]));
885
+// }
886
+// }
887
+// } catch (BadLocationException ble)
888
+// {
889
+// System.err.println("Couldn't insert initial text into text pane.");
890
+// }
891
+
892
+ return new JTextPane(); // textPane;
645893 }
646894
647895 protected void addStylesToDocument(StyledDocument doc)
....@@ -694,7 +942,7 @@
694942 protected static ImageIcon createImageIcon(String path,
695943 String description)
696944 {
697
- java.net.URL imgURL = GrafreeD.class.getResource(path);
945
+ java.net.URL imgURL = Grafreed.class.getResource(path);
698946 if (imgURL != null)
699947 {
700948 return new ImageIcon(imgURL, description);
....@@ -726,6 +974,7 @@
726974 // NumberSlider vDivsField;
727975 // JCheckBox endcaps;
728976 JCheckBox liveCB;
977
+ JCheckBox selectableCB;
729978 JCheckBox hideCB;
730979 JCheckBox link2masterCB;
731980 JCheckBox markCB;
....@@ -733,7 +982,12 @@
733982 JCheckBox speedupCB;
734983 JCheckBox rewindCB;
735984 JCheckBox flipVCB;
985
+
986
+ cCheckBox toggleTextureCB;
987
+ cCheckBox toggleSwitchCB;
988
+
736989 JComboBox texresMenu;
990
+
737991 JButton resetButton;
738992 JButton stepButton;
739993 JButton stepAllButton;
....@@ -741,115 +995,87 @@
741995 JButton slowerButton;
742996 JButton fasterButton;
743997 JButton remarkButton;
998
+
999
+ cGridBag editPanel;
1000
+ cGridBag editCommandsPanel;
1001
+
1002
+ cGridBag namePanel;
1003
+ cGridBag setupPanel;
1004
+ cGridBag setupPanel2;
1005
+ cGridBag objectCommandsPanel;
1006
+ cGridBag pushPanel;
1007
+ cGridBag fillPanel;
7441008
745
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1009
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7461010 {
7471011 JCheckBox cb;
7481012
749
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
750
- oe.aConstraints.gridwidth = 1; // 3;
751
-// oe.aConstraints.weightx = 1;
752
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
753
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1013
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7541014 cb.addItemListener(this);
755
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
756
- oe.aConstraints.gridwidth = 1;
757
- oe.aConstraints.gridx += 1;
7581015
7591016 return cb;
7601017 }
7611018
762
- cButton AddButton(ObjEditor oe, String label)
1019
+ cButton AddButton(cGridBag panel, String label)
7631020 {
7641021 cButton cb;
7651022
766
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
767
- oe.aConstraints.gridwidth = 1;
768
-// oe.aConstraints.weightx = 1;
769
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
770
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1023
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7711024 cb.addActionListener(this);
772
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
773
- oe.aConstraints.gridwidth = 1;
774
- oe.aConstraints.gridx += 1;
7751025
7761026 return cb;
7771027 }
7781028
779
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1029
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
7801030 {
7811031 JComboBox combo;
7821032
783
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
784
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
785
- oe.aConstraints.gridx += 1;
1033
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7861034 combo.addActionListener(this);
7871035
7881036 return combo;
7891037 }
7901038
791
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
1039
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
7921040 {
793
- NumberSlider combo;
1041
+ cGridBag control = new cGridBag();
1042
+
1043
+ cNumberSlider combo;
7941044
7951045 JLabel jlabel = new JLabel(label);
796
-
797
- aConstraints.fill = GridBagConstraints.VERTICAL;
7981046 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
799
- aConstraints.gridwidth = 2;
800
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
801
- aConstraints.gridx += 1;
802
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
803
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
804
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
805
- aConstraints.gridx += 1;
806
- aConstraints.gridwidth = 1;
807
-
1047
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1048
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8081049 combo.setFloat(current);
809
-
810
- combo.label = jlabel;
811
-
812
- combo.addChangeListener(this);
813
-
814
- return combo;
1050
+
1051
+ panel.add(control);
1052
+
1053
+ return control;
8151054 }
8161055
817
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
1056
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8181057 {
819
- NumberSlider combo;
1058
+ cGridBag control = new cGridBag();
1059
+
1060
+ cNumberSlider combo;
8201061
8211062 JLabel jlabel = new JLabel(label);
822
-
823
- aConstraints.fill = GridBagConstraints.VERTICAL;
8241063 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
825
- aConstraints.gridwidth = 2;
826
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827
- aConstraints.gridx += 1;
828
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
829
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
830
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
831
- aConstraints.gridx += 1;
832
- aConstraints.gridwidth = 1;
833
-
1064
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1065
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8341066 combo.setInteger(current);
8351067
836
- combo.label = jlabel;
837
-
838
- combo.addChangeListener(this);
839
-
840
- return combo;
1068
+ panel.add(control);
1069
+
1070
+ return control;
8411071 }
8421072
843
- JTextArea AddText(JPanel ctrlPanel, String name)
1073
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8441074 {
8451075 JTextArea text;
8461076
847
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
848
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
849
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1077
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8501078 text.addCaretListener(this);
851
- aConstraints.gridx += 1;
852
- aConstraints.gridwidth = 1;
8531079
8541080 return text;
8551081 }
....@@ -879,9 +1105,16 @@
8791105 objEditor.ctrlPanel.remove(j);
8801106 }
8811107
1108
+ void Remove(cNumberSlider j)
1109
+ {
1110
+ j.removeChangeListener(this);
1111
+ //objEditor.ctrlPanel.remove(j.label);
1112
+ objEditor.ctrlPanel.remove(j);
1113
+ }
1114
+
8821115 /*
8831116 */
884
- void Return() // ObjEditor oe)
1117
+ void Return0() // ObjEditor oe)
8851118 {
8861119 aConstraints.gridy += 1;
8871120 aConstraints.gridx = 0;
....@@ -936,35 +1169,81 @@
9361169
9371170 void SetupUI2(ObjEditor oe)
9381171 {
939
-// oe.aConstraints.weightx = 0;
940
-// oe.aConstraints.weighty = 0;
941
-// oe.aConstraints.gridx = 0;
942
-// oe.aConstraints.gridy = 0;
943
- SetupName(oe);
1172
+ //SetupName(oe);
9441173
945
- if (!GroupEditor.allparams)
1174
+ namePanel = new cGridBag();
1175
+
1176
+ nameField = AddText(namePanel, copy.GetName());
1177
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
1178
+ oe.ctrlPanel.add(namePanel);
1179
+
1180
+ oe.ctrlPanel.Return();
1181
+
1182
+ if (!allparams)
9461183 return;
9471184
948
- liveCB = AddCheckBox(oe, "Live", copy.live);
949
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
950
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1185
+ setupPanel = new cGridBag().setVertical(false);
1186
+
1187
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1188
+ liveCB.setToolTipText("Animate object");
1189
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1190
+ selectableCB.setToolTipText("Make object selectable");
9511191 // Return();
952
- markCB = AddCheckBox(oe, "Mark", copy.marked);
953
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
954
- randomCB = AddCheckBox(oe, "Rand", copy.random);
955
- Return();
956
- resetButton = AddButton(oe, "Reset");
957
- stepButton = AddButton(oe, "Step");
1192
+
1193
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1194
+ hideCB.setToolTipText("Hide object");
1195
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1196
+ markCB.setToolTipText("As animation target transform");
1197
+
1198
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
1199
+
1200
+ setupPanel2 = new cGridBag().setVertical(false);
1201
+
1202
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1203
+ rewindCB.setToolTipText("Rewind animation");
1204
+
1205
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1206
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1207
+
1208
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1209
+ link2masterCB.setToolTipText("Attach to support");
1210
+
1211
+ if (Globals.ADVANCED)
1212
+ {
1213
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1214
+ speedupCB.setToolTipText("Option motion capture");
1215
+ }
1216
+
1217
+ oe.ctrlPanel.add(setupPanel);
1218
+ oe.ctrlPanel.Return();
1219
+ oe.ctrlPanel.add(setupPanel2);
1220
+ oe.ctrlPanel.Return();
1221
+
1222
+ objectCommandsPanel = new cGridBag().setVertical(false);
1223
+
1224
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1225
+ resetButton.setToolTipText("Jump to frame zero");
1226
+ stepButton = AddButton(objectCommandsPanel, "Step");
1227
+ stepButton.setToolTipText("Step one frame");
9581228 // resetAllButton = AddButton(oe, "Reset All");
9591229 // stepAllButton = AddButton(oe, "Step All");
960
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9611230 // Return();
962
- slowerButton = AddButton(oe, "Slow");
963
- fasterButton = AddButton(oe, "Fast");
964
- remarkButton = AddButton(oe, "Rem");
1231
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1232
+ slowerButton.setToolTipText("Decrease animation speed");
1233
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1234
+ fasterButton.setToolTipText("Increase animation speed");
1235
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1236
+ remarkButton.setToolTipText("Set the current transform as the target");
9651237
966
- Return();
1238
+ oe.ctrlPanel.add(objectCommandsPanel);
1239
+ oe.ctrlPanel.Return();
9671240
1241
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1242
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1243
+ //Return();
1244
+
1245
+ oe.ctrlPanel.Return();
1246
+
9681247 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9691248 // ObjEditor.aConstraints.gridx += 1;
9701249
....@@ -1058,7 +1337,7 @@
10581337 oe.aConstraints.gridwidth = 1;
10591338 /**/
10601339 nameField = AddText(oe.ctrlPanel, copy.GetName());
1061
- Return();
1340
+ oe.ctrlPanel.Return();
10621341
10631342 //ctrlPanel.add(textureButton = new Button("Texture..."));
10641343 //textureButton.setEnabled(false);
....@@ -1160,11 +1439,25 @@
11601439 //JPanel worldPanel =
11611440 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11621441 //worldPanel.setName("World");
1163
- centralPanel = new JPanel(new BorderLayout());
1164
- timelinePanel = new JPanel(new BorderLayout());
1165
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1442
+ centralPanel = new cGridBag();
1443
+ centralPanel.preferredWidth = 20;
1444
+
1445
+ if (Globals.ADVANCED)
1446
+ {
1447
+ timelinePanel = new JPanel(new BorderLayout());
1448
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11661449
1450
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1451
+ cameraPanel.setContinuousLayout(true);
1452
+ cameraPanel.setOneTouchExpandable(true);
1453
+// cameraPanel.setDividerLocation(0.9);
1454
+// cameraPanel.setDividerSize(9);
1455
+ cameraPanel.setResizeWeight(1.0);
1456
+
1457
+ }
1458
+
11671459 centralPanel.add(cameraView);
1460
+ centralPanel.setFocusable(true);
11681461 //frame.setJMenuBar(timelineMenubar);
11691462 //centralPanel.add(timelinePanel);
11701463
....@@ -1183,12 +1476,14 @@
11831476 //frontView.object = copy;
11841477 //sideView.object = copy;
11851478
1186
- XYZPanel = new JPanel();
1187
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1479
+ XYZPanel = new cGridBag().setVertical(true);
1480
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11881481
1189
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1190
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1191
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1482
+ XYZPanel.preferredWidth = 5;
1483
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1484
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1485
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1486
+ //XYZPanel.setName("XYZ");
11921487
11931488 /*
11941489 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1226,11 +1521,23 @@
12261521 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12271522 //tmp.setName("Edit");
12281523 objectPanel.add(materialPanel);
1229
- JPanel north = new JPanel(new BorderLayout());
1230
- north.setName("Edit");
1231
- north.add(ctrlPanel, BorderLayout.NORTH);
1232
- objectPanel.add(north);
1233
- objectPanel.add(infoPanel);
1524
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1525
+// JPanel north = new JPanel(new BorderLayout());
1526
+// north.setName("Edit");
1527
+// north.add(ctrlPanel, BorderLayout.NORTH);
1528
+// objectPanel.add(north);
1529
+ objectPanel.add(editPanel);
1530
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1531
+
1532
+ //if (Globals.ADVANCED)
1533
+ objectPanel.add(infoPanel);
1534
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1535
+
1536
+ objectPanel.add(XYZPanel);
1537
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1538
+
1539
+ objectPanel.add(toolboxPanel);
1540
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
12341541
12351542 /*
12361543 aConstraints.gridx = 0;
....@@ -1239,7 +1546,7 @@
12391546 aConstraints.gridy += 1;
12401547 aConstraints.gridwidth = 1;
12411548 mainPanel.add(objectPanel, aConstraints);
1242
- */
1549
+ */
12431550
12441551 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12451552 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1250,16 +1557,23 @@
12501557 scrollpane.setWheelScrollingEnabled(true);
12511558 scrollpane.addMouseWheelListener(this); // Default not fast enough
12521559
1253
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1254
- scenePanel.add(scrollpane);
1560
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1561
+ scenePanel.preferredWidth = 5;
1562
+
1563
+ JTabbedPane tabbedPane = new JTabbedPane();
1564
+ tabbedPane.add(scrollpane);
12551565
1256
- scenePanel.add(FSPane = new cFileSystemPane(this));
1257
-
1258
- optionsPanel = new JPanel(new GridBagLayout());
1566
+ optionsPanel = new cGridBag().setVertical(false);
12591567
12601568 optionsPanel.setName("Options");
1261
- scenePanel.add(optionsPanel);
1569
+
1570
+ AddOptions(optionsPanel); //, aConstraints);
1571
+
1572
+ tabbedPane.add(optionsPanel);
1573
+
1574
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12621575
1576
+ scenePanel.add(tabbedPane);
12631577
12641578 /*
12651579 cTree jTree = new cTree(null);
....@@ -1293,6 +1607,7 @@
12931607 //bigPanel.setSize(new Dimension(10,10));
12941608 //bigPanel.add(ctrlPanel);
12951609 //bigPanel.add(gridPanel);
1610
+ /**
12961611 bigThree = new JPanel();
12971612 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12981613 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1316,7 +1631,13 @@
13161631 // aConstraints.gridheight = 3;
13171632 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13181633 bigThree.add(XYZPanel, aWindowConstraints);
1634
+ /**/
13191635
1636
+ bigThree = new cGridBag();
1637
+ bigThree.addComponent(centralPanel);
1638
+ bigThree.addComponent(scenePanel);
1639
+ //bigThree.addComponent(XYZPanel);
1640
+
13201641 // // SIDE EFFECT!!!
13211642 // aConstraints.gridx = 0;
13221643 // aConstraints.gridy = 0;
....@@ -1324,9 +1645,9 @@
13241645 // aConstraints.gridheight = 1;
13251646
13261647 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1327
- framePanel.setContinuousLayout(true);
1328
- framePanel.setOneTouchExpandable(true);
1329
- framePanel.setDividerLocation(0.8);
1648
+ framePanel.setContinuousLayout(false);
1649
+ framePanel.setOneTouchExpandable(false);
1650
+ //.setDividerLocation(0.8);
13301651 //framePanel.setDividerSize(15);
13311652 //framePanel.setResizeWeight(0.15);
13321653 framePanel.setName("Frame");
....@@ -1337,15 +1658,21 @@
13371658 //worldPane.add(bigPanel);
13381659 //worldPane.add(worldPanel);
13391660 /**/
1340
- frame.getContentPane().add(/*"Center",*/framePanel);
1661
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1662
+ frame.add(/*"Center",*/framePanel);
13411663 //frame.getContentPane().add(/*"Center",*/ worldPane);
13421664
13431665 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13441666
1345
- frame.setSize(1024, 768);
1346
- frame.show();
1347
-
1667
+ frame.setSize(1280, 860);
1668
+
1669
+ cameraView.requestFocusInWindow();
1670
+
13481671 gridPanel.setDividerLocation(1.0);
1672
+
1673
+ frame.validate();
1674
+
1675
+ frame.setVisible(true);
13491676
13501677 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13511678 frame.addWindowListener(new WindowAdapter()
....@@ -1358,6 +1685,10 @@
13581685 });
13591686 }
13601687
1688
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1689
+ {
1690
+ }
1691
+
13611692 JTree GetTree()
13621693 {
13631694 return objEditor.jTree;
....@@ -1369,260 +1700,161 @@
13691700 ctrlPanel.removeAll();
13701701 }
13711702
1372
- void SetupMaterial(JPanel ctrlPanel)
1703
+ void SetupMaterial(cGridBag panel)
13731704 {
1374
- aConstraints.weighty = 0;
1375
- //aConstraints.weightx = 1;
1376
- /*
1705
+ /*
13771706 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13781707 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1379
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1380
- aConstraints.gridx += 1;
13811708 */
13821709
1383
- aConstraints.gridwidth = 1;
1384
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- aConstraints.gridwidth = 1;
1710
+ cGridBag editBar = new cGridBag().setVertical(false);
1711
+
1712
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1713
+ createMaterialButton.setToolTipText("Create material");
13881714
13891715 /*
13901716 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1391
- aConstraints.gridx += 1;
1392
- aConstraints.weighty = 0;
1393
- aConstraints.gridwidth = 1;
13941717 */
13951718
1396
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1397
- aConstraints.gridx += 1;
1719
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1720
+ clearMaterialButton.setToolTipText("Clear material");
1721
+
1722
+ if (Globals.ADVANCED)
1723
+ {
1724
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1725
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1726
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1727
+ }
13981728
1399
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1400
-
1401
- aConstraints.gridx += 1;
1402
-
1403
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1404
-
1405
- aConstraints.gridx += 1;
1406
-
1407
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1408
-
1409
- aConstraints.gridx = 0;
1410
- aConstraints.gridy += 1;
1411
- aConstraints.weighty = 0;
1412
- aConstraints.gridwidth = 1;
1729
+ editBar.preferredHeight = 15;
1730
+
1731
+ panel.add(editBar);
1732
+
14131733 /**/
14141734 //aConstraints.weighty = 0;
14151735 ////aConstraints.weightx = 1;
14161736 //aConstraints.weighty = 1;
14171737 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14181738 //aConstraints.gridx += 1;
1419
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1420
- aConstraints.weighty = 0;
1421
- aConstraints.gridx = 0;
1422
- aConstraints.gridy += 1;
1423
- aConstraints.gridwidth = 1;
1739
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14241740
1425
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1426
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1427
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1428
- aConstraints.gridx += 1;
1429
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1430
- //aConstraints.weightx = 0;
1431
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1432
- aConstraints.gridx = 0;
1433
- aConstraints.gridy += 1;
1434
- aConstraints.gridwidth = 1;
1741
+ cGridBag colorSection = new cGridBag().setVertical(true);
1742
+
1743
+ cGridBag color = new cGridBag();
1744
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1745
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1746
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1747
+ //colorField.preferredWidth = 200;
1748
+ colorSection.add(color);
14351749
1436
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1437
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1438
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1439
- aConstraints.gridx += 1;
1440
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1441
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1442
- aConstraints.gridx = 0;
1443
- aConstraints.gridy += 1;
1444
- aConstraints.gridwidth = 1;
1750
+ cGridBag modulation = new cGridBag();
1751
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1752
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1753
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1754
+ colorSection.add(modulation);
14451755
1446
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1447
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1448
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1449
- aConstraints.gridx += 1;
1450
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1451
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1452
- aConstraints.gridx = 0;
1453
- aConstraints.gridy += 1;
1454
- aConstraints.gridwidth = 1;
1756
+ cGridBag texture = new cGridBag();
1757
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1758
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1759
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1760
+ colorSection.add(texture);
14551761
1456
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1457
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1458
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1459
- aConstraints.gridx += 1;
1460
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1461
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1462
- aConstraints.gridx = 0;
1463
- aConstraints.gridy += 1;
1464
- aConstraints.gridwidth = 1;
1762
+ panel.add(new JSeparator());
1763
+
1764
+ panel.add(colorSection);
1765
+
1766
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1767
+
1768
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1769
+
1770
+ cGridBag diffuse = new cGridBag();
1771
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1772
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1773
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1774
+ diffuseSection.add(diffuse);
14651775
1466
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1467
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1468
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1469
- aConstraints.gridx += 1;
1470
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1471
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1472
- aConstraints.gridx = 0;
1473
- aConstraints.gridy += 1;
1474
- aConstraints.gridwidth = 1;
1776
+ cGridBag diffuseness = new cGridBag();
1777
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1778
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1779
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1780
+ diffuseSection.add(diffuseness);
14751781
1476
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1477
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1478
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1479
- aConstraints.gridx += 1;
1480
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1481
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1482
- aConstraints.gridx = 0;
1483
- aConstraints.gridy += 1;
1484
- aConstraints.gridwidth = 1;
1782
+ cGridBag selfshadow = new cGridBag();
1783
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1784
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1785
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1786
+ diffuseSection.add(selfshadow);
14851787
1486
- //aConstraints.weighty = 1;
1487
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1488
- //aConstraints.gridx += 1;
1489
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1490
- aConstraints.weighty = 0;
1491
- aConstraints.gridx = 0;
1492
- aConstraints.gridy += 1;
1493
- aConstraints.gridwidth = 1;
1788
+ cGridBag sheen = new cGridBag();
1789
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1790
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1791
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1792
+ diffuseSection.add(sheen);
14941793
1495
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1496
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1497
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1498
- aConstraints.gridx += 1;
1499
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1500
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1501
- aConstraints.gridx = 0;
1502
- aConstraints.gridy += 1;
1503
- aConstraints.gridwidth = 1;
1794
+ cGridBag subsurface = new cGridBag();
1795
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1796
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1797
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1798
+ diffuseSection.add(subsurface);
15041799
1505
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1506
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1507
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1508
- aConstraints.gridx += 1;
1509
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1510
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1511
- aConstraints.gridx = 0;
1512
- aConstraints.gridy += 1;
1513
- aConstraints.gridwidth = 1;
1800
+ cGridBag shadow = new cGridBag();
1801
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1802
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1803
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1804
+ diffuseSection.add(shadow);
15141805
1515
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1516
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1517
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1518
- aConstraints.gridx += 1;
1519
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1520
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1521
- aConstraints.gridx = 0;
1522
- aConstraints.gridy += 1;
1523
- aConstraints.gridwidth = 1;
1806
+ cGridBag fakedepth = new cGridBag();
1807
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1808
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1809
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1810
+ diffuseSection.add(fakedepth);
15241811
1525
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1526
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1527
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1528
- aConstraints.gridx += 1;
1529
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1530
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1531
- aConstraints.gridx = 0;
1532
- aConstraints.gridy += 1;
1533
- aConstraints.gridwidth = 1;
1812
+ cGridBag shadowbias = new cGridBag();
1813
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1814
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1815
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1816
+ diffuseSection.add(shadowbias);
15341817
1535
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1536
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1537
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1538
- aConstraints.gridx += 1;
1539
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1540
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1541
- aConstraints.gridx = 0;
1542
- aConstraints.gridy += 1;
1543
- aConstraints.gridwidth = 1;
1818
+ panel.add(new JSeparator());
1819
+
1820
+ panel.add(diffuseSection);
1821
+
1822
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1823
+
1824
+ cGridBag specularSection = new cGridBag().setVertical(true);
15441825
1545
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1546
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1547
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1548
- aConstraints.gridx += 1;
1549
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1550
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1551
- aConstraints.gridx = 0;
1552
- aConstraints.gridy += 1;
1553
- aConstraints.gridwidth = 1;
1826
+ cGridBag specular = new cGridBag();
1827
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1828
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1829
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1830
+ specularSection.add(specular);
15541831
1555
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1556
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1557
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1558
- aConstraints.gridx += 1;
1559
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1560
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1561
- aConstraints.gridx = 0;
1562
- aConstraints.gridy += 1;
1563
- aConstraints.gridwidth = 1;
1832
+ cGridBag lightarea = new cGridBag();
1833
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1834
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1835
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1836
+ specularSection.add(lightarea);
15641837
1565
- //aConstraints.weighty = 1;
1566
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1567
- //aConstraints.gridx += 1;
1568
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1569
- aConstraints.weighty = 0;
1570
- aConstraints.gridx = 0;
1571
- aConstraints.gridy += 1;
1572
- aConstraints.gridwidth = 1;
1838
+ cGridBag shininess = new cGridBag();
1839
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1840
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1841
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1842
+ specularSection.add(shininess);
15731843
1574
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1575
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1576
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1577
- aConstraints.gridx += 1;
1578
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1579
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1580
- aConstraints.gridx = 0;
1581
- aConstraints.gridy += 1;
1582
- aConstraints.gridwidth = 1;
1844
+ cGridBag metalness = new cGridBag();
1845
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1846
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1847
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1848
+ specularSection.add(metalness);
15831849
1584
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1585
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1586
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1587
- aConstraints.gridx += 1;
1588
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1589
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1590
- aConstraints.gridx = 0;
1591
- aConstraints.gridy += 1;
1592
- aConstraints.gridwidth = 1;
1850
+ cGridBag velvet = new cGridBag();
1851
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1852
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1853
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1854
+ specularSection.add(velvet);
15931855
1594
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1595
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1596
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1597
- aConstraints.gridx += 1;
1598
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1599
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1600
- aConstraints.gridx = 0;
1601
- aConstraints.gridy += 1;
1602
- aConstraints.gridwidth = 1;
1603
-
1604
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1605
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1606
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1607
- aConstraints.gridx += 1;
1608
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1609
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1610
- aConstraints.gridx = 0;
1611
- aConstraints.gridy += 1;
1612
- aConstraints.gridwidth = 1;
1613
-
1614
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1615
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1616
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1617
- aConstraints.gridx += 1;
1618
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1619
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1620
- aConstraints.gridx = 0;
1621
- aConstraints.gridy += 1;
1622
- aConstraints.gridwidth = 1;
1623
-
1624
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1625
- Return();
1856
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1857
+ //Return();
16261858 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16271859 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16281860 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1633,130 +1865,105 @@
16331865 // aConstraints.gridy += 1;
16341866 // aConstraints.gridwidth = 1;
16351867
1636
- //aConstraints.weighty = 1;
1637
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1638
- //aConstraints.gridx += 1;
1639
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1640
- aConstraints.weighty = 0;
1641
- aConstraints.gridx = 0;
1642
- aConstraints.gridy += 1;
1643
- aConstraints.gridwidth = 1;
1868
+ cGridBag anisoU = new cGridBag();
1869
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1870
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1871
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1872
+ specularSection.add(anisoU);
16441873
1645
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1646
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1647
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1648
- aConstraints.gridx += 1;
1649
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1650
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1651
- aConstraints.gridx = 0;
1652
- aConstraints.gridy += 1;
1653
- aConstraints.gridwidth = 1;
1874
+ cGridBag anisoV = new cGridBag();
1875
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1876
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1877
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1878
+ specularSection.add(anisoV);
16541879
1655
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1656
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1657
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1658
- aConstraints.gridx += 1;
1659
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1660
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1661
- aConstraints.gridx = 0;
1662
- aConstraints.gridy += 1;
1663
- aConstraints.gridwidth = 1;
16641880
1665
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1666
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1667
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1668
- aConstraints.gridx += 1;
1669
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1670
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1671
- aConstraints.gridx = 0;
1672
- aConstraints.gridy += 1;
1673
- aConstraints.gridwidth = 1;
1881
+ panel.add(new JSeparator());
1882
+
1883
+ panel.add(specularSection);
1884
+
1885
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1886
+
1887
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16741888
1675
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1676
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1677
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1678
- aConstraints.gridx += 1;
1679
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1680
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1681
- aConstraints.gridx = 0;
1682
- aConstraints.gridy += 1;
1683
- aConstraints.gridwidth = 1;
1684
- aConstraints.weighty = 0;
1889
+ cGridBag camera = new cGridBag();
1890
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1891
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1892
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1893
+ colorSection.add(camera);
16851894
1686
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1687
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1688
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1689
- aConstraints.gridx += 1;
1690
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1691
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1692
- aConstraints.gridx = 0;
1693
- aConstraints.gridy += 1;
1694
- aConstraints.gridwidth = 1;
1895
+ cGridBag ambient = new cGridBag();
1896
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1897
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1898
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1899
+ colorSection.add(ambient);
16951900
1696
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1697
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1698
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1699
- aConstraints.gridx += 1;
1700
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1701
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1702
- aConstraints.gridx = 0;
1703
- aConstraints.gridy += 1;
1704
- aConstraints.gridwidth = 1;
1901
+ cGridBag backlit = new cGridBag();
1902
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1903
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1904
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1905
+ colorSection.add(backlit);
17051906
1706
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1707
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1708
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1709
- aConstraints.gridx += 1;
1710
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1711
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1712
- aConstraints.gridx = 0;
1713
- aConstraints.gridy += 1;
1714
- aConstraints.gridwidth = 1;
1907
+ cGridBag opacity = new cGridBag();
1908
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1909
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1910
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1911
+ colorSection.add(opacity);
17151912
1716
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1717
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1718
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1719
- aConstraints.gridx += 1;
1720
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1721
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1722
- aConstraints.gridx = 0;
1723
- aConstraints.gridy += 1;
1724
- aConstraints.gridwidth = 1;
1913
+ //panel.add(new JSeparator());
1914
+
1915
+ //panel.add(globalSection);
1916
+
1917
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1918
+
1919
+ cGridBag textureSection = new cGridBag().setVertical(true);
17251920
1726
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1727
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1728
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1729
- aConstraints.gridx += 1;
1730
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1731
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1732
- aConstraints.gridx = 0;
1733
- aConstraints.gridy += 1;
1734
- aConstraints.gridwidth = 1;
1921
+ cGridBag bump = new cGridBag();
1922
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1923
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1924
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1925
+ textureSection.add(bump);
17351926
1736
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1737
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1738
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1739
- aConstraints.gridx += 1;
1740
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1741
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1742
- aConstraints.gridx = 0;
1743
- aConstraints.gridy += 1;
1744
- aConstraints.gridwidth = 1;
1927
+ cGridBag noise = new cGridBag();
1928
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1929
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1930
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1931
+ textureSection.add(noise);
17451932
1746
- //aConstraints.weighty = 1;
1747
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1748
- //aConstraints.gridx += 1;
1749
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1750
- aConstraints.weighty = 0;
1933
+ cGridBag power = new cGridBag();
1934
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1935
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1936
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1937
+ textureSection.add(power);
17511938
1752
- aConstraints.gridx = 0;
1753
- aConstraints.gridy = 0;
1754
- aConstraints.gridwidth = 1;
1939
+ cGridBag borderfade = new cGridBag();
1940
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1941
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1942
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1943
+ textureSection.add(borderfade);
1944
+
1945
+ cGridBag fog = new cGridBag();
1946
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1947
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1948
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1949
+ textureSection.add(fog);
1950
+
1951
+ cGridBag opacityPower = new cGridBag();
1952
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1953
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1954
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1955
+ textureSection.add(opacityPower);
1956
+
1957
+ panel.add(new JSeparator());
1958
+
1959
+ panel.add(textureSection);
1960
+
1961
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17551962
17561963 SetMaterial(copy); // .GetMaterial());
17571964
1758
- colorField.addChangeListener(this);
1759
- modulationField.addChangeListener(this);
1965
+ //colorField.addChangeListener(this);
1966
+// modulationField.addChangeListener(this);
17601967 metalnessField.addChangeListener(this);
17611968 diffuseField.addChangeListener(this);
17621969 specularField.addChangeListener(this);
....@@ -1786,12 +1993,15 @@
17861993 opacityPowerField.addChangeListener(this);
17871994 /**/
17881995
1789
- resetSlidersButton.addActionListener(this);
17901996 clearMaterialButton.addActionListener(this);
17911997 createMaterialButton.addActionListener(this);
1792
-
1793
- propagateToggle.addItemListener(this);
1794
- multiplyToggle.addItemListener(this);
1998
+
1999
+ if (Globals.ADVANCED)
2000
+ {
2001
+ resetSlidersButton.addActionListener(this);
2002
+ propagateToggle.addItemListener(this);
2003
+ multiplyToggle.addItemListener(this);
2004
+ }
17952005 }
17962006
17972007 void DropFile(java.io.File[] files, boolean textures)
....@@ -1809,8 +2019,9 @@
18092019 // 3D models
18102020 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18112021 {
1812
- lastConverter = new com.jmex.model.converters.MaxToJme();
1813
- LoadFile(filename, lastConverter);
2022
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2023
+ //LoadFile(filename, lastConverter);
2024
+ LoadObjFile(filename); // New 3ds loader
18142025 continue;
18152026 }
18162027 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1962,7 +2173,7 @@
19622173
19632174 //? flashIt = false;
19642175 CameraPane pane = (CameraPane) cameraView;
1965
- pane.clickStart(location.x, location.y, 0);
2176
+ pane.clickStart(location.x, location.y, 0, 0);
19662177 pane.clickEnd(location.x, location.y, 0, true);
19672178
19682179 if (group.selection.size() == 1)
....@@ -2011,6 +2222,7 @@
20112222 e2.printStackTrace();
20122223 }
20132224 }
2225
+
20142226 LoadJMEThread loadThread;
20152227
20162228 class LoadJMEThread extends Thread
....@@ -2068,6 +2280,7 @@
20682280 //LoadFile0(filename, converter);
20692281 }
20702282 }
2283
+
20712284 LoadOBJThread loadObjThread;
20722285
20732286 class LoadOBJThread extends Thread
....@@ -2146,19 +2359,19 @@
21462359
21472360 void LoadObjFile(String fullname)
21482361 {
2149
- /*
2362
+ System.out.println("Loading " + fullname);
2363
+ /**/
21502364 //lastFilename = fullname;
21512365 if(loadObjThread == null)
21522366 {
2153
- loadObjThread = new LoadOBJThread();
2154
- loadObjThread.start();
2367
+ loadObjThread = new LoadOBJThread();
2368
+ loadObjThread.start();
21552369 }
21562370
21572371 loadObjThread.add(fullname);
2158
- */
2372
+ /**/
21592373
2160
- System.out.println("Loading " + fullname);
2161
- makeSomething(new FileObject(fullname, true), true);
2374
+ //makeSomething(new FileObject(fullname, true), true);
21622375 }
21632376
21642377 void LoadGFDFile(String fullname)
....@@ -2419,11 +2632,11 @@
24192632
24202633 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24212634 {
2422
- if (GrafreeD.standAlone)
2635
+ if (Grafreed.standAlone)
24232636 {
24242637 /**/
24252638 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2426
- browser.show();
2639
+ browser.setVisible(true);
24272640 String filename = browser.getFile();
24282641 if (filename != null && filename.length() > 0)
24292642 {
....@@ -2534,6 +2747,7 @@
25342747 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25352748 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25362749 }
2750
+
25372751 //cJME.count++;
25382752 //cJME.count %= 12;
25392753 if (gc)
....@@ -2568,6 +2782,7 @@
25682782 }
25692783 if (input == null)
25702784 {
2785
+ new Exception().printStackTrace();
25712786 System.exit(0);
25722787 }
25732788
....@@ -2716,6 +2931,7 @@
27162931 }
27172932 }
27182933 }
2934
+
27192935 cFileSystemPane FSPane;
27202936
27212937 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2769,11 +2985,14 @@
27692985 }
27702986 }
27712987 }
2988
+
27722989 freezematerial = false;
27732990 }
27742991
27752992 void SetMaterial(Object3D object)
27762993 {
2994
+ latestObject = object;
2995
+
27772996 cMaterial mat = object.material;
27782997
27792998 if (mat == null)
....@@ -2782,7 +3001,8 @@
27823001 return;
27833002 }
27843003
2785
- multiplyToggle.setSelected(mat.multiply);
3004
+ if (multiplyToggle != null)
3005
+ multiplyToggle.setSelected(mat.multiply);
27863006
27873007 assert (object.projectedVertices != null);
27883008
....@@ -2884,12 +3104,17 @@
28843104 // }
28853105
28863106 /**/
2887
- if (deselect)
3107
+ if (deselect || child == null)
28883108 {
28893109 //group.deselectAll();
28903110 //freeze = true;
28913111 GetTree().clearSelection();
28923112 //freeze = false;
3113
+
3114
+ if (child == null)
3115
+ {
3116
+ return;
3117
+ }
28933118 }
28943119
28953120 //group.addSelectee(child);
....@@ -2958,7 +3183,7 @@
29583183 cameraView.ToggleDL();
29593184 cameraView.repaint();
29603185 return;
2961
- } else if (event.getSource() == toggleTextureItem)
3186
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29623187 {
29633188 cameraView.ToggleTexture();
29643189 // june 2013 copy.HardTouch();
....@@ -2966,42 +3191,40 @@
29663191 return;
29673192 } else if (event.getSource() == toggleTimelineItem)
29683193 {
2969
- copy.timeline ^= true;
3194
+ timeline ^= true;
29703195
2971
- if (copy.timeline)
3196
+ if (timeline)
29723197 {
29733198 centralPanel.remove(cameraView);
2974
- centralPanel.add(timelinePanel);
3199
+ cameraPanel.add(cameraView);
3200
+ centralPanel.add(cameraPanel);
29753201 frame.setJMenuBar(timelineMenubar);
3202
+ wasFullScreen = CameraPane.FULLSCREEN;
3203
+ if (!CameraPane.FULLSCREEN)
3204
+ ToggleFullScreen();
3205
+ toggleFullScreenItem.setEnabled(false);
29763206 }
29773207 else
29783208 {
2979
- centralPanel.remove(timelinePanel);
3209
+ centralPanel.remove(cameraPanel);
29803210 centralPanel.add(cameraView);
29813211 frame.setJMenuBar(null);
3212
+ if (!wasFullScreen)
3213
+ ToggleFullScreen();
3214
+ toggleFullScreenItem.setEnabled(true);
29823215 }
29833216
29843217 frame.validate();
29853218 return;
29863219 } else if (event.getSource() == toggleFullScreenItem)
29873220 {
2988
- if (CameraPane.FULLSCREEN)
2989
- {
2990
- frame.getContentPane().remove(/*"Center",*/bigThree);
2991
- framePanel.add(bigThree);
2992
- frame.getContentPane().add(/*"Center",*/framePanel);
2993
- } else
2994
- {
2995
- frame.getContentPane().remove(/*"Center",*/framePanel);
2996
- frame.getContentPane().add(/*"Center",*/bigThree);
2997
- }
3221
+ ToggleFullScreen();
29983222 frame.validate();
2999
- cameraView.ToggleFullScreen();
30003223
30013224 return;
3002
- } else if (event.getSource() == toggleRandomItem)
3225
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30033226 {
3004
- cameraView.ToggleRandom();
3227
+ cameraView.ToggleSwitch();
30053228 cameraView.repaint();
30063229 return;
30073230 } else if (event.getSource() == toggleHandleItem)
....@@ -3030,6 +3253,10 @@
30303253 {
30313254 copy.live ^= true;
30323255 return;
3256
+ } else if (event.getSource() == selectableCB)
3257
+ {
3258
+ copy.dontselect ^= true;
3259
+ return;
30333260 } else if (event.getSource() == hideCB)
30343261 {
30353262 copy.hide ^= true;
....@@ -3044,6 +3271,7 @@
30443271 if (event.getSource() == randomCB)
30453272 {
30463273 copy.random ^= true;
3274
+ objEditor.refreshContents();
30473275 return;
30483276 }
30493277 if (event.getSource() == speedupCB)
....@@ -3067,8 +3295,9 @@
30673295
30683296 public void actionPerformed(ActionEvent event)
30693297 {
3298
+ Object source = event.getSource();
30703299 // SCRIPT DIALOG
3071
- if (event.getSource() == okbutton)
3300
+ if (source == okbutton)
30723301 {
30733302 textpanel.setVisible(false);
30743303 textpanel.remove(textarea);
....@@ -3080,7 +3309,7 @@
30803309 textarea = null;
30813310 textpanel = null;
30823311 }
3083
- if (event.getSource() == cancelbutton)
3312
+ if (source == cancelbutton)
30843313 {
30853314 textpanel.setVisible(false);
30863315 textpanel.remove(textarea);
....@@ -3092,49 +3321,50 @@
30923321 //applySelf();
30933322 //client.refreshEditWindow();
30943323 //refreshContents();
3095
- if (event.getSource() == nameField)
3324
+ if (source == nameField)
30963325 {
30973326 //System.out.println("ObjEditor " + event);
30983327 applySelf0(true);
30993328 //parent.applySelf();
31003329 objEditor.refreshContents();
3101
- } else if (event.getSource() == resetButton)
3330
+ } else if (source == resetButton)
31023331 {
31033332 CameraPane.fullreset = true;
31043333 copy.Reset(); // ResetMeshes();
31053334 copy.Touch();
31063335 objEditor.refreshContents();
3107
- } else if (event.getSource() == stepItem)
3336
+ } else if (source == stepItem)
31083337 {
3109
- cameraView.ONESTEP = true;
3338
+ //cameraView.ONESTEP = true;
3339
+ Globals.ONESTEP = true;
31103340 cameraView.repaint();
31113341 return;
3112
- } else if (event.getSource() == stepButton)
3342
+ } else if (source == stepButton)
31133343 {
31143344 copy.Step();
31153345 copy.Touch();
31163346 objEditor.refreshContents();
3117
- } else if (event.getSource() == slowerButton)
3347
+ } else if (source == slowerButton)
31183348 {
31193349 copy.Slower();
31203350 copy.Touch();
31213351 objEditor.refreshContents();
3122
- } else if (event.getSource() == fasterButton)
3352
+ } else if (source == fasterButton)
31233353 {
31243354 copy.Faster();
31253355 copy.Touch();
31263356 objEditor.refreshContents();
3127
- } else if (event.getSource() == remarkButton)
3357
+ } else if (source == remarkButton)
31283358 {
31293359 copy.Remark();
31303360 copy.Touch();
31313361 objEditor.refreshContents();
3132
- } else if (event.getSource() == stepAllButton)
3362
+ } else if (source == stepAllButton)
31333363 {
31343364 copy.StepAll();
31353365 copy.Touch();
31363366 objEditor.refreshContents();
3137
- } else if (event.getSource() == resetAllButton)
3367
+ } else if (source == resetAllButton)
31383368 {
31393369 //CameraPane.fullreset = true;
31403370 copy.ResetAll(); // ResetMeshes();
....@@ -3167,53 +3397,79 @@
31673397 // Close();
31683398 // }
31693399 // else
3170
- if (event.getSource() == resetSlidersButton)
3400
+ if (source == resetSlidersButton)
31713401 {
31723402 ResetSliders();
3173
- } else if (event.getSource() == clearMaterialButton)
3403
+ } else if (source == clearMaterialButton)
31743404 {
31753405 ClearMaterial();
3176
- } else if (event.getSource() == createMaterialButton)
3406
+ } else if (source == createMaterialButton)
31773407 {
31783408 CreateMaterial();
3179
- } else if (event.getSource() == clearPanelButton)
3409
+ } else if (source == clearPanelButton)
31803410 {
31813411 copy.ClearUI();
31823412 refreshContents(true);
3183
- } /*
3184
- }
3185
-
3186
- public boolean action(Event event, Object arg)
3187
- {
3188
- */ else if (event.getSource() == closeItem)
3413
+ } else if (source == importGFDItem)
3414
+ {
3415
+ ImportGFD();
3416
+ } else
3417
+ if (source == importVRMLX3DItem)
3418
+ {
3419
+ ImportVRMLX3D();
3420
+ } else
3421
+ if (source == import3DSItem)
3422
+ {
3423
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3424
+ } else
3425
+ if (source == importOBJItem)
3426
+ {
3427
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3428
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3429
+ browser.setVisible(true);
3430
+ String filename = browser.getFile();
3431
+ if (filename != null && filename.length() > 0)
3432
+ {
3433
+ String fullname = browser.getDirectory() + filename;
3434
+ makeSomething(ReadOBJ(fullname), true);
3435
+ }
3436
+ } else
3437
+ if (source == closeItem)
31893438 {
31903439 Close();
31913440 //return true;
3192
- } else if (event.getSource() == loadItem)
3441
+ } else if (source == openItem)
31933442 {
3194
- load();
3443
+ Open();
31953444 //return true;
3196
- } else if (event.getSource() == saveItem)
3445
+ } else if (source == newItem)
3446
+ {
3447
+ New();
3448
+ } else if (source == saveItem)
31973449 {
31983450 save();
31993451 //return true;
3200
- } else if (event.getSource() == saveAsItem)
3452
+ } else if (source == saveAsItem)
32013453 {
32023454 saveAs();
32033455 //return true;
3204
- } else if (event.getSource() == reexportItem)
3456
+ } else if (source == reexportItem)
32053457 {
32063458 reexport();
32073459 //return true;
3208
- } else if (event.getSource() == exportAsItem)
3460
+ } else if (source == exportAsItem)
32093461 {
32103462 export();
32113463 //return true;
3212
- } else if (event.getSource() == povItem)
3464
+ } else if (source == povItem)
32133465 {
32143466 generatePOV();
32153467 //return true;
3216
- } else if (event.getSource() == zBufferItem)
3468
+ } else if (event.getSource() == archiveItem)
3469
+ {
3470
+ cTools.Archive(frame);
3471
+ return;
3472
+ } else if (source == zBufferItem)
32173473 {
32183474 try
32193475 {
....@@ -3235,21 +3491,8 @@
32353491 cameraView.repaint();
32363492 //return true;
32373493 }
3238
- */ else if (event.getSource() == editCameraItem)
3239
- {
3240
- cameraView.ProtectCamera();
3241
- cameraView.repaint();
3242
- return;
3243
- } else if (event.getSource() == revertCameraItem)
3244
- {
3245
- cameraView.RevertCamera();
3246
- cameraView.repaint();
3247
- return;
3248
-// } else if (event.getSource() == textureButton)
3249
-// {
3250
-// return; // true;
3251
- } else // combos...
3252
- if (event.getSource() == texresMenu)
3494
+ */ else // combos...
3495
+ if (source == texresMenu)
32533496 {
32543497 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32553498 copy.texres = texresMenu.getSelectedIndex();
....@@ -3261,27 +3504,424 @@
32613504 }
32623505 }
32633506
3264
- void ToggleAnimation()
3507
+ void New()
32653508 {
3266
- if (!CameraPane.ANIMATION)
3509
+ while (copy.Size() > 1)
32673510 {
3268
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3511
+ copy.remove(1);
3512
+ }
3513
+
3514
+ ResetModel();
3515
+ objEditor.refreshContents();
3516
+ }
3517
+
3518
+ static public byte[] Compress(Object3D o)
3519
+ {
3520
+ try
3521
+ {
3522
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3523
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3524
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
3525
+
3526
+ Object3D parent = o.parent;
3527
+ o.parent = null;
3528
+
3529
+ out.writeObject(o);
3530
+
3531
+ o.parent = parent;
3532
+
3533
+ out.flush();
3534
+
3535
+ baos //zstream
3536
+ .close();
3537
+ out.close();
3538
+
3539
+ byte[] bytes = baos.toByteArray();
3540
+
3541
+ System.out.println("save #bytes = " + bytes.length);
3542
+ return bytes;
3543
+ } catch (Exception e)
3544
+ {
3545
+ System.err.println(e);
3546
+ return null;
3547
+ }
3548
+ }
3549
+
3550
+ static public Object Uncompress(byte[] bytes)
3551
+ {
3552
+ System.out.println("restore #bytes = " + bytes.length);
3553
+ try
3554
+ {
3555
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3556
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3557
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
3558
+ Object obj = in.readObject();
3559
+
3560
+ bais //istream
3561
+ .close();
3562
+ in.close();
3563
+
3564
+ return obj;
3565
+ } catch (Exception e)
3566
+ {
3567
+ System.err.println(e);
3568
+ return null;
3569
+ }
3570
+ }
3571
+
3572
+ static public Object clone(Object o)
3573
+ {
3574
+ try
3575
+ {
3576
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3577
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3578
+
3579
+ out.writeObject(o);
3580
+
3581
+ out.flush();
3582
+ out.close();
3583
+
3584
+ byte[] bytes = baos.toByteArray();
3585
+
3586
+ System.out.println("clone = " + bytes.length);
3587
+
3588
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3589
+ ObjectInputStream in = new ObjectInputStream(bais);
3590
+ Object obj = in.readObject();
3591
+ in.close();
3592
+
3593
+ return obj;
3594
+ } catch (Exception e)
3595
+ {
3596
+ System.err.println(e);
3597
+ return null;
3598
+ }
3599
+ }
3600
+
3601
+ cRadio GetCurrentTab()
3602
+ {
3603
+ cRadio ab;
3604
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3605
+ {
3606
+ ab = (cRadio)e.nextElement();
3607
+ if(ab.GetObject() == copy)
3608
+ {
3609
+ return ab;
3610
+ }
3611
+ }
3612
+
3613
+ return null;
3614
+ }
3615
+
3616
+
3617
+ public void Save()
3618
+ {
3619
+ //Save(true);
3620
+ Replace();
3621
+ }
3622
+
3623
+ private boolean Equal(byte[] compress, byte[] name)
3624
+ {
3625
+ if (compress.length != name.length)
3626
+ {
3627
+ return false;
3628
+ }
3629
+
3630
+ for (int i=compress.length; --i>=0;)
3631
+ {
3632
+ if (compress[i] != name[i])
3633
+ return false;
3634
+ }
3635
+
3636
+ return true;
3637
+ }
3638
+
3639
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3640
+
3641
+ public boolean Save(boolean user)
3642
+ {
3643
+ System.err.println("Save");
3644
+
3645
+ cRadio tab = GetCurrentTab();
3646
+
3647
+ byte[] compress = CompressCopy();
3648
+
3649
+ boolean thesame = false;
3650
+
3651
+ // Quick heuristic using length. Works only when stream is compressed.
3652
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3653
+ {
3654
+ thesame = true;
3655
+ }
3656
+
3657
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3658
+ if (!thesame)
3659
+ {
3660
+ //tab.user[tab.versionindex] = user;
3661
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3662
+
3663
+ copy.versions[++copy.versionindex] = compress;
3664
+
3665
+ // if (increment)
3666
+ // tab.versionindex++;
3667
+ }
3668
+
3669
+ //copy.RestoreBigData(versiontable);
3670
+
3671
+ //assert(hashtable.isEmpty());
3672
+
3673
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3674
+ {
3675
+ //tab.user[i] = false;
3676
+ copy.versions[i] = null;
3677
+ }
3678
+
3679
+ SetUndoStates();
3680
+
3681
+ // test save
3682
+ if (false)
3683
+ {
3684
+ try
3685
+ {
3686
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
3687
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3688
+
3689
+ p.writeObject(copy);
3690
+
3691
+ p.flush();
3692
+
3693
+ ostream.close();
3694
+ } catch (Exception e)
3695
+ {
3696
+ e.printStackTrace();
3697
+ }
3698
+ }
3699
+
3700
+ return !thesame;
3701
+ }
3702
+
3703
+ void CopyChanged(Object3D obj)
3704
+ {
3705
+ SetUndoStates();
3706
+
3707
+ boolean temp = CameraPane.SWITCH;
3708
+ CameraPane.SWITCH = false;
3709
+
3710
+ copy.ExtractBigData(versiontable);
3711
+
3712
+ copy.clear();
3713
+
3714
+ for (int i=0; i<obj.Size(); i++)
3715
+ {
3716
+ copy.add(obj.get(i));
3717
+ }
3718
+
3719
+ copy.RestoreBigData(versiontable);
3720
+
3721
+ CameraPane.SWITCH = temp;
3722
+
3723
+ //assert(hashtable.isEmpty());
3724
+
3725
+ copy.Touch();
3726
+
3727
+ ResetModel();
3728
+ copy.HardTouch(); // recompile?
3729
+
3730
+ cRadio ab;
3731
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3732
+ {
3733
+ ab = (cRadio)e.nextElement();
3734
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3735
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3736
+ if (test != null)
3737
+ {
3738
+ test.editWindow = ab.object.editWindow;
3739
+ ab.object = test;
3740
+ }
3741
+ }
3742
+
3743
+ refreshContents();
3744
+ }
3745
+
3746
+ cButton undoButton;
3747
+ cButton restoreButton;
3748
+ cButton replaceButton;
3749
+ cButton redoButton;
3750
+
3751
+ boolean muteSlider;
3752
+
3753
+ int VersionCount()
3754
+ {
3755
+ int count = 0;
3756
+
3757
+ for (int i = copy.versions.length; --i >= 0;)
3758
+ {
3759
+ if (copy.versions[i] != null)
3760
+ count++;
3761
+ }
3762
+
3763
+ return count;
3764
+ }
3765
+
3766
+ void SetUndoStates()
3767
+ {
3768
+ cRadio tab = GetCurrentTab();
3769
+
3770
+ restoreButton.setEnabled(copy.versionindex != -1);
3771
+ replaceButton.setEnabled(copy.versionindex != -1);
3772
+
3773
+ undoButton.setEnabled(copy.versionindex > 0);
3774
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3775
+
3776
+ muteSlider = true;
3777
+ versionSlider.setMaximum(VersionCount() - 1);
3778
+ versionSlider.setInteger(copy.versionindex);
3779
+ muteSlider = false;
3780
+ }
3781
+
3782
+ public boolean Undo()
3783
+ {
3784
+ // Option?
3785
+ Replace();
3786
+
3787
+ System.err.println("Undo");
3788
+
3789
+ cRadio tab = GetCurrentTab();
3790
+
3791
+ if (copy.versionindex == 0)
3792
+ {
3793
+ java.awt.Toolkit.getDefaultToolkit().beep();
3794
+ return false;
3795
+ }
3796
+
3797
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3798
+// {
3799
+// if (Save(false))
3800
+// tab.versionindex -= 1;
3801
+// else
3802
+// {
3803
+// if (tab.versionindex <= 0)
3804
+// return false;
3805
+// else
3806
+// tab.versionindex -= 1;
3807
+// }
3808
+// }
3809
+
3810
+ copy.versionindex -= 1;
3811
+
3812
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3813
+
3814
+ return true;
3815
+ }
3816
+
3817
+ public boolean Restore()
3818
+ {
3819
+ System.err.println("Restore");
3820
+
3821
+ cRadio tab = GetCurrentTab();
3822
+
3823
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3824
+ {
3825
+ java.awt.Toolkit.getDefaultToolkit().beep();
3826
+ return false;
3827
+ }
3828
+
3829
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3830
+
3831
+ return true;
3832
+ }
3833
+
3834
+ public boolean Replace()
3835
+ {
3836
+ System.err.println("Replace");
3837
+
3838
+ cRadio tab = GetCurrentTab();
3839
+
3840
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3841
+ {
3842
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3843
+ return false;
3844
+ }
3845
+
3846
+ copy.versions[copy.versionindex] = CompressCopy();
3847
+
3848
+ return true;
3849
+ }
3850
+
3851
+ public void Redo()
3852
+ {
3853
+ // Option?
3854
+ Replace();
3855
+
3856
+ cRadio tab = GetCurrentTab();
3857
+
3858
+ if (copy.versions[copy.versionindex + 1] == null)
3859
+ {
3860
+ java.awt.Toolkit.getDefaultToolkit().beep();
3861
+ return;
3862
+ }
3863
+
3864
+ copy.versionindex += 1;
3865
+
3866
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3867
+
3868
+ //if (!tab.user[tab.versionindex])
3869
+ // tab.graphs[tab.versionindex] = null;
3870
+ }
3871
+
3872
+ void ImportGFD()
3873
+ {
3874
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32693875 browser.show();
32703876 String filename = browser.getFile();
32713877 if (filename != null && filename.length() > 0)
32723878 {
3273
- CameraPane.filename = browser.getDirectory() + filename;
3879
+ String fullname = browser.getDirectory() + filename;
3880
+
3881
+ //Object3D readobj =
3882
+ objEditor.ReadGFD(fullname, objEditor);
3883
+ //makeSomething(readobj);
3884
+ }
3885
+ }
3886
+
3887
+ void ImportVRMLX3D()
3888
+ {
3889
+ if (Grafreed.standAlone)
3890
+ {
3891
+ /**/
3892
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3893
+ browser.show();
3894
+ String filename = browser.getFile();
3895
+ if (filename != null && filename.length() > 0)
3896
+ {
3897
+ String fullname = browser.getDirectory() + filename;
3898
+ LoadVRMLX3D(fullname);
3899
+ }
3900
+ /**/
3901
+ }
3902
+ }
3903
+
3904
+ void ToggleAnimation()
3905
+ {
3906
+ if (!Globals.ANIMATION)
3907
+ {
3908
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3909
+ browser.setVisible(true);
3910
+ String filename = browser.getFile();
3911
+ if (filename != null && filename.length() > 0)
3912
+ {
3913
+ Globals.filename = browser.getDirectory() + filename;
32743914 //CameraPane.framecount = 0;
3275
- CameraPane.imagecount = 0;
3915
+ Globals.imagecount = 0;
32763916
3277
- CameraPane.ANIMATION ^= true;
3917
+ Globals.ANIMATION ^= true;
32783918
3279
- GrafreeD.wav.cursor = 0;
3280
- GrafreeD.wav.loop = 0;
3919
+ Grafreed.wav.cursor = 0;
3920
+ Grafreed.wav.loop = 0;
32813921 }
32823922 } else
32833923 {
3284
- CameraPane.ANIMATION ^= true;
3924
+ Globals.ANIMATION ^= true;
32853925 }
32863926 }
32873927
....@@ -3327,7 +3967,7 @@
33273967 void CreateMaterial()
33283968 {
33293969 //copy.ClearMaterial(); // PATCH
3330
- copy.CreateMaterialS(multiplyToggle.isSelected());
3970
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33313971 if (copy.selection.size() > 0)
33323972 //SetMaterial(copy);
33333973 {
....@@ -3378,7 +4018,7 @@
33784018 assert false;
33794019 }
33804020
3381
- void EditSelection()
4021
+ void EditSelection(boolean newWindow)
33824022 {
33834023 }
33844024
....@@ -3386,11 +4026,11 @@
33864026 {
33874027 copy.ResetBlockLoop(); // temporary problem
33884028
3389
- boolean random = CameraPane.RANDOM;
3390
- CameraPane.RANDOM = false; // parse everything
4029
+ boolean random = CameraPane.SWITCH;
4030
+ CameraPane.SWITCH = false; // parse everything
33914031 copy.ResetDisplayList();
33924032 copy.HardTouch();
3393
- CameraPane.RANDOM = random;
4033
+ CameraPane.SWITCH = random;
33944034 }
33954035
33964036 // public void applySelf()
....@@ -3460,10 +4100,40 @@
34604100 current.fakedepth = (float) fakedepthField.getFloat();
34614101 current.shadowbias = (float) shadowbiasField.getFloat();
34624102
3463
- if (!NumberSlider.frozen)
4103
+ if (!cNumberSlider.frozen)
34644104 {
34654105 //System.out.println("Propagate = " + propagate);
34664106 copy.UpdateMaterial(anchor, current, propagate);
4107
+
4108
+ if (copy.material != null)
4109
+ {
4110
+ cMaterial mat = copy.material;
4111
+
4112
+ colorField.SetToolTipValue((mat.color));
4113
+ modulationField.SetToolTipValue((mat.modulation));
4114
+ metalnessField.SetToolTipValue((mat.metalness));
4115
+ diffuseField.SetToolTipValue((mat.diffuse));
4116
+ specularField.SetToolTipValue((mat.specular));
4117
+ shininessField.SetToolTipValue((mat.shininess));
4118
+ shiftField.SetToolTipValue((mat.shift));
4119
+ ambientField.SetToolTipValue((mat.ambient));
4120
+ lightareaField.SetToolTipValue((mat.lightarea));
4121
+ diffusenessField.SetToolTipValue((mat.factor));
4122
+ velvetField.SetToolTipValue((mat.velvet));
4123
+ sheenField.SetToolTipValue((mat.sheen));
4124
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4125
+ backlitField.SetToolTipValue((mat.bump));
4126
+ anisoField.SetToolTipValue((mat.aniso));
4127
+ anisoVField.SetToolTipValue((mat.anisoV));
4128
+ cameraField.SetToolTipValue((mat.cameralight));
4129
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4130
+ shadowField.SetToolTipValue((mat.shadow));
4131
+ textureField.SetToolTipValue((mat.texture));
4132
+ opacityField.SetToolTipValue((mat.opacity));
4133
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4134
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4135
+ }
4136
+
34674137 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34684138 {
34694139 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3492,9 +4162,25 @@
34924162 //copy.Touch();
34934163 }
34944164
4165
+ cNumberSlider versionSlider;
4166
+
34954167 public void stateChanged(ChangeEvent e)
34964168 {
34974169 // assert(false);
4170
+ if (e.getSource() == versionSlider)
4171
+ {
4172
+ if (muteSlider)
4173
+ return;
4174
+
4175
+ int version = versionSlider.getInteger();
4176
+
4177
+ if (copy.versions[version] != null)
4178
+ {
4179
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4180
+ }
4181
+
4182
+ return;
4183
+ }
34984184
34994185 if (freezematerial)
35004186 {
....@@ -3508,6 +4194,7 @@
35084194 || e.getSource() == apertureField
35094195 || e.getSource() == shadowblurField)
35104196 {
4197
+ new Exception().printStackTrace();
35114198 System.exit(0);
35124199 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35134200 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3534,7 +4221,13 @@
35344221 //System.out.println("PARENT = " + parent);
35354222 //if (parent != null)
35364223 // parent.applySelf();
3537
- refreshContents();
4224
+ if (e.getSource() == normalpushField)
4225
+ {
4226
+ objEditor.refreshContents();
4227
+ //Refresh();
4228
+ }
4229
+ else
4230
+ refreshContents();
35384231 // ??? client.refreshEditWindow();
35394232 }
35404233 //else
....@@ -3546,7 +4239,7 @@
35464239 //group.name = nameField.getText();
35474240 //objEditor.applySelf();
35484241
3549
- assert (objEditor == this);
4242
+ // OCT2018: assert (objEditor == this);
35504243 if (copy.selection == null || copy.selection.size() == 0)
35514244 //super.applySelf()
35524245 ; else
....@@ -3570,12 +4263,18 @@
35704263 objEditor.copy = keep;
35714264 }
35724265 }
4266
+
4267
+ if (normalpushField != null)
4268
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35734269 }
35744270
35754271 void SnapObject()
35764272 {
3577
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3578
- SnapObject(obj);
4273
+ if (copy.selection.size() > 0)
4274
+ {
4275
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
4276
+ SnapObject(obj);
4277
+ }
35794278 }
35804279
35814280 void SnapObject(Object3D obj)
....@@ -3821,7 +4520,7 @@
38214520
38224521 radioPanel.revalidate();
38234522 radioPanel.repaint();
3824
- ctrlPanel.revalidate(); // ? new
4523
+ ctrlPanel.validate(); // ? new
38254524 ctrlPanel.repaint();
38264525 }
38274526 }
....@@ -3830,6 +4529,8 @@
38304529
38314530 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38324531 {
4532
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4533
+ Save();
38334534 //Tween.set(thing, 0).target(1).start(tweenManager);
38344535 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38354536 // if (thing instanceof GenericJointDemo)
....@@ -3916,6 +4617,12 @@
39164617 {
39174618 ResetModel();
39184619 Select(thing.GetTreePath(), true, false); // unselect... false);
4620
+
4621
+ if (thing.Size() == 0)
4622
+ {
4623
+ //EditSelection(false);
4624
+ }
4625
+
39194626 refreshContents();
39204627 }
39214628
....@@ -4033,6 +4740,7 @@
40334740 }
40344741 }
40354742 }
4743
+
40364744 LoadGFDThread loadGFDThread;
40374745
40384746 void ReadGFD(String fullname, iCallBack cb)
....@@ -4052,8 +4760,10 @@
40524760
40534761 try
40544762 {
4763
+ // Try compressed version first.
40554764 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4056
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4765
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4766
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40574767
40584768 readobj = (Object3D) p.readObject();
40594769 istream.close();
....@@ -4061,7 +4771,22 @@
40614771 readobj.ResetDisplayList();
40624772 } catch (Exception e)
40634773 {
4064
- e.printStackTrace();
4774
+ if (!e.toString().contains("GZIP"))
4775
+ e.printStackTrace();
4776
+
4777
+ try
4778
+ {
4779
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4780
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4781
+
4782
+ readobj = (Object3D) p.readObject();
4783
+ istream.close();
4784
+
4785
+ readobj.ResetDisplayList();
4786
+ } catch (Exception e2)
4787
+ {
4788
+ e2.printStackTrace();
4789
+ }
40654790 }
40664791 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40674792 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4107,6 +4832,12 @@
41074832
41084833 void LoadIt(Object obj)
41094834 {
4835
+ if (obj == null)
4836
+ {
4837
+ // Invalid file
4838
+ return;
4839
+ }
4840
+
41104841 System.out.println("Loaded " + obj);
41114842 //new Exception().printStackTrace();
41124843 Object3D readobj = (Object3D) obj;
....@@ -4116,10 +4847,14 @@
41164847
41174848 if (readobj != null)
41184849 {
4850
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4851
+ // Save();
41194852 try
41204853 {
41214854 //readobj.deepCopySelf(copy);
41224855 copy.clear(); // june 2014
4856
+ copy.skyboxname = readobj.skyboxname;
4857
+ copy.skyboxext = readobj.skyboxext;
41234858 for (int i = 0; i < readobj.size(); i++)
41244859 {
41254860 Object3D child = readobj.get(i); // reserve(i);
....@@ -4160,6 +4895,7 @@
41604895 }
41614896 } catch (ClassCastException e)
41624897 {
4898
+ e.printStackTrace();
41634899 assert (false);
41644900 Composite c = (Composite) copy;
41654901 c.children.clear();
....@@ -4170,15 +4906,26 @@
41704906 c.addChild(csg);
41714907 }
41724908
4909
+ copy.versions = readobj.versions;
4910
+ copy.versionindex = readobj.versionindex;
4911
+
4912
+ if (copy.versions == null)
4913
+ {
4914
+ copy.versions = new byte[100][];
4915
+ copy.versionindex = -1;
4916
+ }
4917
+
4918
+ //? SetUndoStates();
4919
+
41734920 ResetModel();
41744921 copy.HardTouch(); // recompile?
41754922 refreshContents();
41764923 }
41774924 }
41784925
4179
- void load() // throws ClassNotFoundException
4926
+ void Open() // throws ClassNotFoundException
41804927 {
4181
- if (GrafreeD.standAlone)
4928
+ if (Grafreed.standAlone)
41824929 {
41834930 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41844931 browser.show();
....@@ -4265,11 +5012,13 @@
42655012 try
42665013 {
42675014 FileOutputStream ostream = new FileOutputStream(lastname);
4268
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5015
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5016
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42695017
42705018 p.writeObject(copy);
42715019 p.flush();
42725020
5021
+ zstream.close();
42735022 ostream.close();
42745023
42755024 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4277,19 +5026,23 @@
42775026 //ps.print(buffer.toString());
42785027 } catch (IOException e)
42795028 {
5029
+ e.printStackTrace();
42805030 }
42815031 }
5032
+
42825033 String lastname;
42835034
42845035 void saveAs()
42855036 {
4286
- if (GrafreeD.standAlone)
5037
+ if (Grafreed.standAlone)
42875038 {
42885039 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42895040 browser.setVisible(true);
42905041 String filename = browser.getFile();
42915042 if (filename != null && filename.length() > 0)
42925043 {
5044
+ if (!filename.endsWith(".gfd"))
5045
+ filename += ".gfd";
42935046 lastname = browser.getDirectory() + filename;
42945047 save();
42955048 }
....@@ -4388,13 +5141,13 @@
43885141 try
43895142 {
43905143 FileOutputStream ostream = new FileOutputStream(filename);
4391
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4392
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5144
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5145
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43935146
43945147 Object3D objectparent = obj.parent;
43955148 obj.parent = null;
43965149
4397
- Object3D object = (Object3D) GrafreeD.clone(obj);
5150
+ Object3D object = (Object3D) Grafreed.clone(obj);
43985151
43995152 obj.parent = objectparent;
44005153
....@@ -4406,8 +5159,8 @@
44065159 p.writeObject(object);
44075160 p.flush();
44085161
5162
+ zstream.close();
44095163 ostream.close();
4410
- // zstream.close();
44115164
44125165 // group.selection.get(0).parent = parent;
44135166 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4428,7 +5181,7 @@
44285181 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44295182 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44305183 copy.generatePOV(buffer);
4431
- if (GrafreeD.standAlone)
5184
+ if (Grafreed.standAlone)
44325185 {
44335186 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44345187 browser.show();
....@@ -4454,21 +5207,20 @@
44545207 Object3D client;
44555208 Object3D copy;
44565209 MenuBar menuBar;
4457
- Menu windowMenu;
4458
- MenuItem loadItem;
5210
+ Menu fileMenu;
5211
+ MenuItem newItem;
5212
+ MenuItem openItem;
44595213 MenuItem saveItem;
44605214 MenuItem saveAsItem;
44615215 MenuItem exportAsItem;
44625216 MenuItem reexportItem;
44635217 MenuItem povItem;
44645218 MenuItem closeItem;
4465
- Menu cameraMenu;
5219
+
44665220 CheckboxMenuItem zBufferItem;
44675221 //MenuItem normalLensItem;
4468
- MenuItem editCameraItem;
4469
- MenuItem revertCameraItem;
4470
- CheckboxMenuItem toggleLiveItem;
44715222 MenuItem stepItem;
5223
+ CheckboxMenuItem toggleLiveItem;
44725224 CheckboxMenuItem toggleFullScreenItem;
44735225 CheckboxMenuItem toggleTimelineItem;
44745226 CheckboxMenuItem toggleRenderItem;
....@@ -4477,28 +5229,43 @@
44775229 CheckboxMenuItem toggleFootContactItem;
44785230 CheckboxMenuItem toggleDLItem;
44795231 CheckboxMenuItem toggleTextureItem;
4480
- CheckboxMenuItem toggleRandomItem;
5232
+ CheckboxMenuItem toggleSwitchItem;
44815233 CheckboxMenuItem toggleRootItem;
44825234 CheckboxMenuItem animationItem;
5235
+ MenuItem archiveItem;
44835236 CheckboxMenuItem toggleHandleItem;
44845237 CheckboxMenuItem togglePaintItem;
44855238 JSplitPane mainPanel;
44865239 JScrollPane scrollpane;
5240
+
44875241 JPanel toolbarPanel;
4488
- JPanel treePanel;
5242
+
5243
+ cGridBag treePanel;
5244
+
44895245 JPanel radioPanel;
44905246 ButtonGroup buttonGroup;
4491
- JPanel ctrlPanel;
4492
- JPanel materialPanel;
5247
+
5248
+ cGridBag toolboxPanel;
5249
+ cGridBag materialPanel;
5250
+ cGridBag ctrlPanel;
5251
+
44935252 JScrollPane infoPanel;
4494
- JPanel optionsPanel;
5253
+
5254
+ cGridBag optionsPanel;
5255
+
44955256 JTabbedPane objectPanel;
4496
- JPanel XYZPanel;
5257
+ boolean materialFlushed;
5258
+ Object3D latestObject;
5259
+
5260
+ cGridBag XYZPanel;
5261
+
44975262 JSplitPane gridPanel;
44985263 JSplitPane bigPanel;
4499
- JPanel bigThree;
4500
- JTabbedPane scenePanel;
4501
- JPanel centralPanel;
5264
+
5265
+ cGridBag bigThree;
5266
+ cGridBag scenePanel;
5267
+ cGridBag centralPanel;
5268
+ JSplitPane cameraPanel;
45025269 JPanel timelinePanel;
45035270 JMenuBar timelineMenubar;
45045271 JSplitPane framePanel;
....@@ -4550,65 +5317,72 @@
45505317 // MATERIAL
45515318 JLabel materialLabel;
45525319 JLabel colorLabel;
4553
- NumberSlider colorField;
5320
+ cNumberSlider colorField;
45545321 JLabel modulationLabel;
4555
- NumberSlider modulationField;
5322
+ cNumberSlider modulationField;
45565323 JLabel metalnessLabel;
4557
- NumberSlider metalnessField;
5324
+ cNumberSlider metalnessField;
45585325 JLabel diffuseLabel;
4559
- NumberSlider diffuseField;
5326
+ cNumberSlider diffuseField;
45605327 JLabel specularLabel;
4561
- NumberSlider specularField;
5328
+ cNumberSlider specularField;
45625329 JLabel shininessLabel;
4563
- NumberSlider shininessField;
5330
+ cNumberSlider shininessField;
45645331 JLabel shiftLabel;
4565
- NumberSlider shiftField;
5332
+ cNumberSlider shiftField;
45665333 JLabel ambientLabel;
4567
- NumberSlider ambientField;
5334
+ cNumberSlider ambientField;
45685335 JLabel lightareaLabel;
4569
- NumberSlider lightareaField;
5336
+ cNumberSlider lightareaField;
45705337 JLabel diffusenessLabel;
4571
- NumberSlider diffusenessField;
5338
+ cNumberSlider diffusenessField;
45725339 JLabel velvetLabel;
4573
- NumberSlider velvetField;
5340
+ cNumberSlider velvetField;
45745341 JLabel sheenLabel;
4575
- NumberSlider sheenField;
5342
+ cNumberSlider sheenField;
45765343 JLabel subsurfaceLabel;
4577
- NumberSlider subsurfaceField;
5344
+ cNumberSlider subsurfaceField;
45785345 //JLabel bumpLabel;
45795346 //NumberSlider bumpField;
45805347 JLabel backlitLabel;
4581
- NumberSlider backlitField;
5348
+ cNumberSlider backlitField;
45825349 JLabel anisoLabel;
4583
- NumberSlider anisoField;
5350
+ cNumberSlider anisoField;
45845351 JLabel anisoVLabel;
4585
- NumberSlider anisoVField;
5352
+ cNumberSlider anisoVField;
45865353 JLabel cameraLabel;
4587
- NumberSlider cameraField;
5354
+ cNumberSlider cameraField;
45885355 JLabel selfshadowLabel;
4589
- NumberSlider selfshadowField;
5356
+ cNumberSlider selfshadowField;
45905357 JLabel shadowLabel;
4591
- NumberSlider shadowField;
5358
+ cNumberSlider shadowField;
45925359 JLabel textureLabel;
4593
- NumberSlider textureField;
5360
+ cNumberSlider textureField;
45945361 JLabel opacityLabel;
4595
- NumberSlider opacityField;
5362
+ cNumberSlider opacityField;
45965363 JLabel fakedepthLabel;
4597
- NumberSlider fakedepthField;
5364
+ cNumberSlider fakedepthField;
45985365 JLabel shadowbiasLabel;
4599
- NumberSlider shadowbiasField;
5366
+ cNumberSlider shadowbiasField;
46005367 JLabel bumpLabel;
4601
- NumberSlider bumpField;
5368
+ cNumberSlider bumpField;
46025369 JLabel noiseLabel;
4603
- NumberSlider noiseField;
5370
+ cNumberSlider noiseField;
46045371 JLabel powerLabel;
4605
- NumberSlider powerField;
5372
+ cNumberSlider powerField;
46065373 JLabel borderfadeLabel;
4607
- NumberSlider borderfadeField;
5374
+ cNumberSlider borderfadeField;
46085375 JLabel fogLabel;
4609
- NumberSlider fogField;
5376
+ cNumberSlider fogField;
46105377 JLabel opacityPowerLabel;
4611
- NumberSlider opacityPowerField;
4612
- JTree jTree;
5378
+ cNumberSlider opacityPowerField;
5379
+ cTree jTree;
46135380 //ObjectUI parent;
5381
+
5382
+ cNumberSlider normalpushField;
5383
+
5384
+ private MenuItem importGFDItem;
5385
+ private MenuItem importVRMLX3DItem;
5386
+ private MenuItem import3DSItem;
5387
+ private MenuItem importOBJItem;
46145388 }