Normand Briere
2019-07-18 d7a17c35c443e2cb6c09eaa3cfeaf590a571faa1
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,
....@@ -31,6 +37,70 @@
3137 boolean timeline;
3238 boolean wasFullScreen;
3339
40
+ GroupEditor callee;
41
+ JFrame frame;
42
+
43
+ static ObjEditor theFrame;
44
+
45
+ cButton GetButton(String name, boolean border)
46
+ {
47
+ try
48
+ {
49
+ ImageIcon icon = GetIcon(name);
50
+ return new cButton(icon, border);
51
+ }
52
+ catch (Exception e)
53
+ {
54
+ return new cButton(name, border);
55
+ }
56
+ }
57
+
58
+ cToggleButton GetToggleButton(String name, boolean border)
59
+ {
60
+ try
61
+ {
62
+ ImageIcon icon = GetIcon(name);
63
+ return new cToggleButton(icon, border);
64
+ }
65
+ catch (Exception e)
66
+ {
67
+ return new cToggleButton(name, border);
68
+ }
69
+ }
70
+
71
+ cCheckBox GetCheckBox(String name, boolean border)
72
+ {
73
+ try
74
+ {
75
+ ImageIcon icon = GetIcon(name);
76
+ return new cCheckBox(icon, border);
77
+ }
78
+ catch (Exception e)
79
+ {
80
+ return new cCheckBox(name, border);
81
+ }
82
+ }
83
+
84
+ private ImageIcon GetIcon(String name) throws IOException
85
+ {
86
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
87
+
88
+ if (image.getWidth() != 24 && image.getHeight() != 24)
89
+ {
90
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
91
+ Graphics2D g = resized.createGraphics();
92
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
93
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
94
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
95
+ g.dispose();
96
+
97
+ image = resized;
98
+ }
99
+
100
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
101
+ return icon;
102
+ }
103
+
34104 // SCRIPT
35105
36106 transient JFrame textpanel = null;
....@@ -121,51 +191,62 @@
121191 void keyPressed(int key, int modifiers)
122192 {
123193 System.out.println("KEY PRESSED");
124
- CameraPane.theRenderer.keyPressed(key, modifiers);
194
+ Globals.theRenderer.keyPressed(key, modifiers);
125195 }
126196 */
127197
128198 static GridBagConstraints aConstraints;
129199 static GridBagConstraints aWindowConstraints;
130
- GroupEditor callee;
131
- JFrame frame;
200
+
132201 static int GRIDWIDTH = 100; // 4;
133202
134203 public void closeUI()
135204 {
136205 //new Exception().printStackTrace();
137
- System.out.println("this = " + this);
138
- System.out.println("objEditor = " + objEditor);
206
+// System.out.println("this = " + this);
207
+// System.out.println("objEditor = " + objEditor);
139208 //nameField.removeActionListener(this);
140
- objEditor.ctrlPanel.remove(nameField);
209
+// objEditor.ctrlPanel.remove(nameField);
141210
142
- if (!GroupEditor.allparams)
211
+ objEditor.ctrlPanel.remove(namePanel);
212
+
213
+ if (!allparams)
143214 return;
144215
145
- objEditor.ctrlPanel.remove(liveCB);
146
- objEditor.ctrlPanel.remove(hideCB);
147
- objEditor.ctrlPanel.remove(markCB);
148
-
149
- objEditor.ctrlPanel.remove(randomCB);
150
- objEditor.ctrlPanel.remove(speedupCB);
151
- objEditor.ctrlPanel.remove(rewindCB);
152
-
153
- objEditor.ctrlPanel.remove(resetButton);
154
- objEditor.ctrlPanel.remove(stepButton);
155
-// objEditor.ctrlPanel.remove(stepAllButton);
156
-// objEditor.ctrlPanel.remove(resetAllButton);
157
- objEditor.ctrlPanel.remove(link2masterCB);
158
- //objEditor.ctrlPanel.remove(flipVCB);
159
- //objEditor.ctrlPanel.remove(texresMenu);
160
- objEditor.ctrlPanel.remove(slowerButton);
161
- objEditor.ctrlPanel.remove(fasterButton);
162
- objEditor.ctrlPanel.remove(remarkButton);
216
+// objEditor.ctrlPanel.remove(liveCB);
217
+// objEditor.ctrlPanel.remove(hideCB);
218
+// objEditor.ctrlPanel.remove(markCB);
219
+//
220
+// objEditor.ctrlPanel.remove(randomCB);
221
+// objEditor.ctrlPanel.remove(speedupCB);
222
+// objEditor.ctrlPanel.remove(rewindCB);
223
+//
224
+// objEditor.ctrlPanel.remove(resetButton);
225
+// objEditor.ctrlPanel.remove(stepButton);
226
+//// objEditor.ctrlPanel.remove(stepAllButton);
227
+//// objEditor.ctrlPanel.remove(resetAllButton);
228
+// objEditor.ctrlPanel.remove(link2masterCB);
229
+// //objEditor.ctrlPanel.remove(flipVCB);
230
+// //objEditor.ctrlPanel.remove(texresMenu);
231
+// objEditor.ctrlPanel.remove(slowerButton);
232
+// objEditor.ctrlPanel.remove(fasterButton);
233
+// objEditor.ctrlPanel.remove(remarkButton);
234
+
235
+ objEditor.ctrlPanel.remove(setupPanel);
236
+ objEditor.ctrlPanel.remove(setupPanel2);
237
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
238
+ objEditor.ctrlPanel.remove(pushPanel);
239
+ //objEditor.ctrlPanel.remove(fillPanel);
240
+
241
+ //Remove(normalpushField);
163242 }
164243
165244 public ObjEditor GetEditor()
166245 {
167246 return objEditor; //.GetEditor();
168247 }
248
+
249
+ // Sometimes myself, sometimes my callee's.
169250 ObjEditor objEditor;
170251
171252 /*
....@@ -201,6 +282,12 @@
201282 client = inClient;
202283 copy = client;
203284
285
+ if (copy.versions == null)
286
+ {
287
+ copy.versions = new byte[100][];
288
+ copy.versionindex = -1;
289
+ }
290
+
204291 // "this" is not called: SetupUI2(objEditor);
205292 }
206293
....@@ -214,6 +301,12 @@
214301 client = inClient;
215302 copy = client;
216303
304
+ if (copy.versions == null)
305
+ {
306
+ copy.versions = new byte[100][];
307
+ copy.versionindex = -1;
308
+ }
309
+
217310 SetupUI2(callee.GetEditor());
218311 }
219312
....@@ -228,6 +321,7 @@
228321 //localCopy.parent = null;
229322
230323 frame = new JFrame();
324
+ frame.setUndecorated(false);
231325 objEditor = this;
232326 this.callee = callee;
233327
....@@ -245,6 +339,12 @@
245339 copy = localCopy;
246340 copy.editWindow = this;
247341
342
+ if (copy.versions == null)
343
+ {
344
+ copy.versions = new byte[100][];
345
+ copy.versionindex = -1;
346
+ }
347
+
248348 SetupMenu();
249349
250350 //SetupName(objEditor); // new
....@@ -258,28 +358,49 @@
258358 return frame.action(event, obj);
259359 }
260360
361
+ // Cannot work without static
362
+ static boolean allparams = true;
363
+
364
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
365
+
261366 void SetupMenu()
262367 {
263368 frame.setMenuBar(menuBar = new MenuBar());
264
- menuBar.add(windowMenu = new Menu("File"));
265
- windowMenu.add(loadItem = new MenuItem("Load..."));
266
- windowMenu.add("-");
267
- windowMenu.add(saveItem = new MenuItem("Save"));
268
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
369
+ menuBar.add(fileMenu = new Menu("File"));
370
+ fileMenu.add(newItem = new MenuItem("New"));
371
+ fileMenu.add(openItem = new MenuItem("Open..."));
372
+
373
+ //oe.menuBar.add(menu = new Menu("Include"));
374
+ Menu menu = new Menu("Import");
375
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
376
+ importOBJItem.addActionListener(this);
377
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
378
+ import3DSItem.addActionListener(this);
379
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
380
+ importVRMLX3DItem.addActionListener(this);
381
+ menu.add("-");
382
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
383
+ importGFDItem.addActionListener(this);
384
+ fileMenu.add(menu);
385
+ fileMenu.add("-");
386
+
387
+ fileMenu.add(saveItem = new MenuItem("Save"));
388
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
269389 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
270
- windowMenu.add("-");
271
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
272
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
273
- windowMenu.add("-");
390
+ fileMenu.add("-");
391
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
392
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
393
+ fileMenu.add("-");
274394 if (client.parent != null)
275395 {
276
- windowMenu.add(closeItem = new MenuItem("Close"));
396
+ fileMenu.add(closeItem = new MenuItem("Close"));
277397 } else
278398 {
279
- windowMenu.add(closeItem = new MenuItem("Exit"));
399
+ fileMenu.add(closeItem = new MenuItem("Exit"));
280400 }
281401
282
- loadItem.addActionListener(this);
402
+ newItem.addActionListener(this);
403
+ openItem.addActionListener(this);
283404 saveItem.addActionListener(this);
284405 saveAsItem.addActionListener(this);
285406 exportAsItem.addActionListener(this);
....@@ -287,81 +408,66 @@
287408 //povItem.addActionListener(this);
288409 closeItem.addActionListener(this);
289410
290
- menuBar.add(cameraMenu = new Menu("View"));
291
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
292
- //zBufferItem.addActionListener(this);
293
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
294
- //normalLensItem.addActionListener(this);
295
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
296
- revertCameraItem.addActionListener(this);
297
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
298
- toggleTimelineItem.addItemListener(this);
299
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
300
- toggleFullScreenItem.addItemListener(this);
301
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
302
- cameraMenu.add("-");
303
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
304
- toggleTextureItem.addItemListener(this);
305
- toggleTextureItem.setState(CameraPane.textureon);
306
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
307
- toggleLiveItem.addItemListener(this);
308
- toggleLiveItem.setState(CameraPane.isLIVE());
309
- cameraMenu.add(stepItem = new MenuItem("Step"));
310
- stepItem.addActionListener(this);
311
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
312
-// toggleDLItem.addItemListener(this);
313
-// toggleDLItem.setState(false);
314
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
315
- toggleRenderItem.addItemListener(this);
316
- toggleRenderItem.setState(!CameraPane.frozen);
317
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
318
- toggleDebugItem.addItemListener(this);
319
- toggleDebugItem.setState(CameraPane.DEBUG);
320
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
321
- toggleFrustumItem.addItemListener(this);
322
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
323
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
324
- toggleFootContactItem.addItemListener(this);
325
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
326
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
327
- toggleRandomItem.addItemListener(this);
328
- toggleRandomItem.setState(CameraPane.RANDOM);
329
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
330
- toggleHandleItem.addItemListener(this);
331
- toggleHandleItem.setState(CameraPane.HANDLES);
332
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
333
- togglePaintItem.addItemListener(this);
334
- togglePaintItem.setState(CameraPane.PAINTMODE);
335
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
336
-// toggleRootItem.addItemListener(this);
337
-// toggleRootItem.setState(false);
338
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
339
-// animationItem.addItemListener(this);
340
-// animationItem.setState(CameraPane.ANIMATION);
341
- cameraMenu.add("-");
342
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
343
- editCameraItem.addActionListener(this);
344
-
345411 objectPanel = new JTabbedPane();
412
+
413
+ ChangeListener changeListener = new ChangeListener()
414
+ {
415
+ public void stateChanged(ChangeEvent changeEvent)
416
+ {
417
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
418
+// {
419
+// if (latestObject != null)
420
+// {
421
+// refreshContents(true);
422
+// SetMaterial(latestObject);
423
+// }
424
+//
425
+// materialFlushed = true;
426
+// }
427
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
428
+// {
429
+// if (listUI.size() == 0)
430
+// EditSelection(false);
431
+// }
432
+
433
+ refreshContents(false); // To refresh Info tab
434
+ }
435
+ };
436
+ objectPanel.addChangeListener(changeListener);
437
+
346438 toolbarPanel = new JPanel();
347439 toolbarPanel.setName("Toolbar");
348
- treePanel = new JPanel();
440
+ treePanel = new cGridBag();
349441 treePanel.setName("Tree");
350
- ctrlPanel = new JPanel(); // new GridBagLayout());
351
- ctrlPanel.setName("Edit");
352
- materialPanel = new JPanel();
442
+
443
+ editPanel = new cGridBag().setVertical(true);
444
+ editPanel.setName("Edit");
445
+
446
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
447
+
448
+ editCommandsPanel = new cGridBag();
449
+ editPanel.add(editCommandsPanel);
450
+ editPanel.add(ctrlPanel);
451
+
452
+ toolboxPanel = new cGridBag().setVertical(false);
453
+ toolboxPanel.setName("Toolbox");
454
+
455
+ materialPanel = new cGridBag().setVertical(true);
353456 materialPanel.setName("Material");
457
+
354458 /*JTextPane*/
355459 infoarea = createTextPane();
460
+ doc = infoarea.getStyledDocument();
461
+
356462 infoarea.setEditable(true);
357463 SetText();
358464 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
359465 // infoarea.setOpaque(false);
360466 // //infoarea.setForeground(textcolor);
361
- infoarea.setLineWrap(true);
362
- infoarea.setWrapStyleWord(true);
467
+// TEXTAREA infoarea.setLineWrap(true);
468
+// TEXTAREA infoarea.setWrapStyleWord(true);
363469 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
364
- infoPanel.setPreferredSize(new Dimension(50, 200));
470
+ infoPanel.setPreferredSize(new Dimension(1, 1));
365471 infoPanel.setName("Info");
366472 //infoPanel.setLayout(new BorderLayout());
367473 //infoPanel.add(createTextPane());
....@@ -370,16 +476,23 @@
370476 mainPanel.setName("Main");
371477 mainPanel.setContinuousLayout(true);
372478 mainPanel.setOneTouchExpandable(true);
373
- mainPanel.setDividerLocation(1.0);
374479 mainPanel.setDividerSize(9);
375
- mainPanel.setResizeWeight(0);
376
-
480
+ mainPanel.setDividerLocation(0.5); //1.0);
481
+ mainPanel.setResizeWeight(0.5);
482
+
483
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
484
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
485
+ divider.setDividerSize(15);
486
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
487
+
488
+ mainPanel.setUI(new BasicSplitPaneUI());
489
+
377490 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
378491 //mainPanel.setLayout(new GridBagLayout());
379492 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
380
- treePanel.setLayout(new GridBagLayout());
381
- ctrlPanel.setLayout(new GridBagLayout());
382
- materialPanel.setLayout(new GridBagLayout());
493
+// treePanel.setLayout(new GridBagLayout());
494
+ //ctrlPanel.setLayout(new GridBagLayout());
495
+ //materialPanel.setLayout(new GridBagLayout());
383496
384497 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
385498 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -418,7 +531,7 @@
418531 static String newline = "\n";
419532 protected static final String buttonString = "JButton";
420533 StyledDocument doc;
421
- JTextArea infoarea;
534
+ JTextPane infoarea;
422535
423536 void ClearInfo()
424537 {
....@@ -441,10 +554,10 @@
441554 e.printStackTrace();
442555 }
443556
444
- String selection = infoarea.getText();
445
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
446
- java.awt.datatransfer.Clipboard clipboard =
447
- Toolkit.getDefaultToolkit().getSystemClipboard();
557
+// String selection = infoarea.getText();
558
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
559
+// java.awt.datatransfer.Clipboard clipboard =
560
+// Toolkit.getDefaultToolkit().getSystemClipboard();
448561 //clipboard.setContents(data, data);
449562 }
450563
....@@ -467,13 +580,13 @@
467580 //SendInfo("Name:", "bold");
468581 if (sel.GetTextures() != null || debug)
469582 {
470
- si.SendInfo(sel.toString(), "bold");
583
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
471584 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
472585 if (sel.Size() > 0)
473586 {
474587 si.SendInfo("#children = " + sel.Size(), "regular");
475588 }
476
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
589
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
477590 if (debug)
478591 {
479592 try
....@@ -485,7 +598,10 @@
485598 }
486599
487600 if (full)
488
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
601
+ {
602
+ si.SendInfo(" BBox min: " + minima, "regular");
603
+ si.SendInfo(" BBox max: " + maxima, "regular");
604
+ }
489605
490606 if (sel.bRep != null)
491607 {
....@@ -512,7 +628,7 @@
512628 }
513629 if (sel.support != null)
514630 {
515
- si.SendInfo(" support: " + sel.support, "regular");
631
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
516632 }
517633 if (sel.scriptnode != null)
518634 {
....@@ -583,6 +699,9 @@
583699 {
584700 CameraPane.pointflow = (PointFlow) sel;
585701 }
702
+
703
+ si.SendInfo("_____________________", "regular");
704
+ si.SendInfo("", "regular");
586705 }
587706 }
588707
....@@ -598,68 +717,191 @@
598717 }
599718 }
600719
720
+//static GraphicsDevice device = GraphicsEnvironment
721
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
722
+
723
+ Rectangle keeprect;
724
+ cRadio radio;
725
+
726
+cButton keepButton;
727
+ cButton twoButton; // Full 3D
728
+ cButton sixButton;
729
+ cButton threeButton;
730
+ cButton sevenButton;
731
+ cButton fourButton; // full panel
732
+ cButton oneButton; // full XYZ
733
+ //cButton currentLayout;
734
+
735
+ boolean maximized;
736
+
737
+ cButton fullscreenLayout;
738
+
739
+ void Minimize()
740
+ {
741
+ frame.setState(Frame.ICONIFIED);
742
+ frame.validate();
743
+ }
744
+
745
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
746
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
747
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
748
+ void Maximize()
749
+ {
750
+ if (CameraPane.FULLSCREEN)
751
+ {
752
+ ToggleFullScreen();
753
+ }
754
+
755
+ if (maximized)
756
+ {
757
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
758
+ }
759
+ else
760
+ {
761
+ keeprect = frame.getBounds();
762
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
763
+// Dimension rect2 = frame.getToolkit().getScreenSize();
764
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
765
+// frame.setState(Frame.MAXIMIZED_BOTH);
766
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
767
+ }
768
+
769
+ maximized ^= true;
770
+
771
+ frame.validate();
772
+ }
773
+
774
+ cButton minButton;
775
+ cButton maxButton;
776
+ cButton fullButton;
777
+
601778 void ToggleFullScreen()
602779 {
603
- if (CameraPane.FULLSCREEN)
780
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
781
+
782
+ cameraView.ToggleFullScreen();
783
+
784
+ if (!CameraPane.FULLSCREEN)
604785 {
605
- frame.getContentPane().remove(/*"Center",*/bigThree);
606
- framePanel.add(bigThree);
607
- frame.getContentPane().add(/*"Center",*/framePanel);
786
+ device.setFullScreenWindow(null);
787
+ frame.dispose();
788
+ frame.setUndecorated(false);
789
+ frame.validate();
790
+ frame.setVisible(true);
791
+
792
+ //frame.setVisible(false);
793
+// frame.removeNotify();
794
+// frame.setUndecorated(false);
795
+// frame.addNotify();
796
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
797
+
798
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
799
+// X framePanel.add(bigThree);
800
+// X frame.getContentPane().add(/*"Center",*/framePanel);
801
+ framePanel.setDividerLocation(46);
802
+
803
+ //frame.setVisible(true);
804
+ radio.layout = keepButton;
805
+ //theFrame = null;
806
+ keepButton = null;
807
+ radio.layout.doClick();
808
+
608809 } else
609810 {
610
- frame.getContentPane().remove(/*"Center",*/framePanel);
611
- framePanel.remove(bigThree);
612
- frame.getContentPane().add(/*"Center",*/bigThree);
811
+ keepButton = radio.layout;
812
+ //keeprect = frame.getBounds();
813
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
814
+// frame.getToolkit().getScreenSize().height);
815
+ //frame.setVisible(false);
816
+
817
+ frame.dispose();
818
+ frame.setUndecorated(true);
819
+ device.setFullScreenWindow(frame);
820
+ frame.validate();
821
+ frame.setVisible(true);
822
+// frame.removeNotify();
823
+// frame.setUndecorated(true);
824
+// frame.addNotify();
825
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
826
+// X framePanel.remove(bigThree);
827
+// X frame.getContentPane().add(/*"Center",*/bigThree);
828
+ framePanel.setDividerLocation(0);
829
+
830
+ radio.layout = fullscreenLayout;
831
+ radio.layout.doClick();
832
+ //frame.setVisible(true);
613833 }
614
- cameraView.ToggleFullScreen();
834
+ frame.validate();
615835 }
616836
617
- private JTextArea createTextPane()
837
+ private byte[] CompressCopy()
618838 {
619
- String[] initString =
620
- {
621
- "This is an editable JTextPane, ", //regular
622
- "another ", //italic
623
- "styled ", //bold
624
- "text ", //small
625
- "component, ", //large
626
- "which supports embedded components..." + newline,//regular
627
- " " + newline, //button
628
- "...and embedded icons..." + newline, //regular
629
- " ", //icon
630
- newline + "JTextPane is a subclass of JEditorPane that "
631
- + "uses a StyledEditorKit and StyledDocument, and provides "
632
- + "cover methods for interacting with those objects."
633
- };
839
+ boolean temp = CameraPane.SWITCH;
840
+ CameraPane.SWITCH = false;
841
+
842
+ copy.ExtractBigData(versiontable);
843
+ // if (copy == client)
844
+
845
+ byte[] versions[] = copy.versions;
846
+ copy.versions = null;
847
+
848
+ byte[] compress = Compress(copy);
849
+
850
+ copy.versions = versions;
851
+
852
+ copy.RestoreBigData(versiontable);
853
+
854
+ CameraPane.SWITCH = temp;
855
+
856
+ return compress;
857
+ }
634858
635
- String[] initStyles =
636
- {
637
- "regular", "italic", "bold", "small", "large",
638
- "regular", "button", "regular", "icon",
639
- "regular"
640
- };
859
+ private JTextPane createTextPane()
860
+ {
861
+// TEXTAREA String[] initString =
862
+// {
863
+// "This is an editable JTextPane, ", //regular
864
+// "another ", //italic
865
+// "styled ", //bold
866
+// "text ", //small
867
+// "component, ", //large
868
+// "which supports embedded components..." + newline,//regular
869
+// " " + newline, //button
870
+// "...and embedded icons..." + newline, //regular
871
+// " ", //icon
872
+// newline + "JTextPane is a subclass of JEditorPane that "
873
+// + "uses a StyledEditorKit and StyledDocument, and provides "
874
+// + "cover methods for interacting with those objects."
875
+// };
876
+//
877
+// String[] initStyles =
878
+// {
879
+// "regular", "italic", "bold", "small", "large",
880
+// "regular", "button", "regular", "icon",
881
+// "regular"
882
+// };
883
+//
884
+// JTextPane textPane = new JTextPane();
885
+// textPane.setEditable(true);
886
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
887
+// addStylesToDocument(doc);
888
+//
889
+// try
890
+// {
891
+// for (int j = 0; j < 2; j++)
892
+// {
893
+// for (int i = 0; i < initString.length; i++)
894
+// {
895
+// doc.insertString(doc.getLength(), initString[i],
896
+// doc.getStyle(initStyles[i]));
897
+// }
898
+// }
899
+// } catch (BadLocationException ble)
900
+// {
901
+// System.err.println("Couldn't insert initial text into text pane.");
902
+// }
641903
642
- JTextPane textPane = new JTextPane();
643
- textPane.setEditable(true);
644
- /*StyledDocument*/ doc = textPane.getStyledDocument();
645
- addStylesToDocument(doc);
646
-
647
- try
648
- {
649
- for (int j = 0; j < 2; j++)
650
- {
651
- for (int i = 0; i < initString.length; i++)
652
- {
653
- doc.insertString(doc.getLength(), initString[i],
654
- doc.getStyle(initStyles[i]));
655
- }
656
- }
657
- } catch (BadLocationException ble)
658
- {
659
- System.err.println("Couldn't insert initial text into text pane.");
660
- }
661
-
662
- return new JTextArea(); // textPane;
904
+ return new JTextPane(); // textPane;
663905 }
664906
665907 protected void addStylesToDocument(StyledDocument doc)
....@@ -712,7 +954,7 @@
712954 protected static ImageIcon createImageIcon(String path,
713955 String description)
714956 {
715
- java.net.URL imgURL = GrafreeD.class.getResource(path);
957
+ java.net.URL imgURL = Grafreed.class.getResource(path);
716958 if (imgURL != null)
717959 {
718960 return new ImageIcon(imgURL, description);
....@@ -744,6 +986,7 @@
744986 // NumberSlider vDivsField;
745987 // JCheckBox endcaps;
746988 JCheckBox liveCB;
989
+ JCheckBox selectCB;
747990 JCheckBox hideCB;
748991 JCheckBox link2masterCB;
749992 JCheckBox markCB;
....@@ -751,7 +994,12 @@
751994 JCheckBox speedupCB;
752995 JCheckBox rewindCB;
753996 JCheckBox flipVCB;
997
+
998
+ cCheckBox toggleTextureCB;
999
+ cCheckBox toggleSwitchCB;
1000
+
7541001 JComboBox texresMenu;
1002
+
7551003 JButton resetButton;
7561004 JButton stepButton;
7571005 JButton stepAllButton;
....@@ -759,115 +1007,87 @@
7591007 JButton slowerButton;
7601008 JButton fasterButton;
7611009 JButton remarkButton;
1010
+
1011
+ cGridBag editPanel;
1012
+ cGridBag editCommandsPanel;
1013
+
1014
+ cGridBag namePanel;
1015
+ cGridBag setupPanel;
1016
+ cGridBag setupPanel2;
1017
+ cGridBag objectCommandsPanel;
1018
+ cGridBag pushPanel;
1019
+ cGridBag fillPanel;
7621020
763
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1021
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7641022 {
7651023 JCheckBox cb;
7661024
767
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
768
- oe.aConstraints.gridwidth = 1; // 3;
769
-// oe.aConstraints.weightx = 1;
770
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
771
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1025
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7721026 cb.addItemListener(this);
773
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
774
- oe.aConstraints.gridwidth = 1;
775
- oe.aConstraints.gridx += 1;
7761027
7771028 return cb;
7781029 }
7791030
780
- cButton AddButton(ObjEditor oe, String label)
1031
+ cButton AddButton(cGridBag panel, String label)
7811032 {
7821033 cButton cb;
7831034
784
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
785
- oe.aConstraints.gridwidth = 1;
786
-// oe.aConstraints.weightx = 1;
787
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
788
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1035
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7891036 cb.addActionListener(this);
790
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
791
- oe.aConstraints.gridwidth = 1;
792
- oe.aConstraints.gridx += 1;
7931037
7941038 return cb;
7951039 }
7961040
797
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1041
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
7981042 {
7991043 JComboBox combo;
8001044
801
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
802
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
803
- oe.aConstraints.gridx += 1;
1045
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8041046 combo.addActionListener(this);
8051047
8061048 return combo;
8071049 }
8081050
809
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
1051
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
8101052 {
811
- NumberSlider combo;
1053
+ cGridBag control = new cGridBag();
1054
+
1055
+ cNumberSlider combo;
8121056
8131057 JLabel jlabel = new JLabel(label);
814
-
815
- aConstraints.fill = GridBagConstraints.VERTICAL;
8161058 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
817
- aConstraints.gridwidth = 2;
818
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
819
- aConstraints.gridx += 1;
820
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
821
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
822
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
823
- aConstraints.gridx += 1;
824
- aConstraints.gridwidth = 1;
825
-
1059
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1060
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8261061 combo.setFloat(current);
827
-
828
- combo.label = jlabel;
829
-
830
- combo.addChangeListener(this);
831
-
832
- return combo;
1062
+
1063
+ panel.add(control);
1064
+
1065
+ return control;
8331066 }
8341067
835
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
1068
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8361069 {
837
- NumberSlider combo;
1070
+ cGridBag control = new cGridBag();
1071
+
1072
+ cNumberSlider combo;
8381073
8391074 JLabel jlabel = new JLabel(label);
840
-
841
- aConstraints.fill = GridBagConstraints.VERTICAL;
8421075 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
843
- aConstraints.gridwidth = 2;
844
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
845
- aConstraints.gridx += 1;
846
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
847
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
848
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
849
- aConstraints.gridx += 1;
850
- aConstraints.gridwidth = 1;
851
-
1076
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1077
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8521078 combo.setInteger(current);
8531079
854
- combo.label = jlabel;
855
-
856
- combo.addChangeListener(this);
857
-
858
- return combo;
1080
+ panel.add(control);
1081
+
1082
+ return control;
8591083 }
8601084
861
- JTextArea AddText(JPanel ctrlPanel, String name)
1085
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8621086 {
8631087 JTextArea text;
8641088
865
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
866
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
867
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1089
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8681090 text.addCaretListener(this);
869
- aConstraints.gridx += 1;
870
- aConstraints.gridwidth = 1;
8711091
8721092 return text;
8731093 }
....@@ -897,9 +1117,16 @@
8971117 objEditor.ctrlPanel.remove(j);
8981118 }
8991119
1120
+ void Remove(cNumberSlider j)
1121
+ {
1122
+ j.removeChangeListener(this);
1123
+ //objEditor.ctrlPanel.remove(j.label);
1124
+ objEditor.ctrlPanel.remove(j);
1125
+ }
1126
+
9001127 /*
9011128 */
902
- void Return() // ObjEditor oe)
1129
+ void Return0() // ObjEditor oe)
9031130 {
9041131 aConstraints.gridy += 1;
9051132 aConstraints.gridx = 0;
....@@ -954,35 +1181,78 @@
9541181
9551182 void SetupUI2(ObjEditor oe)
9561183 {
957
-// oe.aConstraints.weightx = 0;
958
-// oe.aConstraints.weighty = 0;
959
-// oe.aConstraints.gridx = 0;
960
-// oe.aConstraints.gridy = 0;
961
- SetupName(oe);
1184
+ //SetupName(oe);
9621185
963
- if (!GroupEditor.allparams)
1186
+ namePanel = new cGridBag();
1187
+
1188
+ nameField = AddText(namePanel, copy.GetName());
1189
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
1190
+ oe.ctrlPanel.add(namePanel);
1191
+
1192
+ oe.ctrlPanel.Return();
1193
+
1194
+ if (!allparams)
9641195 return;
9651196
966
- liveCB = AddCheckBox(oe, "Live", copy.live);
967
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
968
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1197
+ setupPanel = new cGridBag().setVertical(false);
1198
+
1199
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1200
+ liveCB.setToolTipText("Animate object");
1201
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1202
+ selectCB.setToolTipText("Make object selectable");
9691203 // Return();
970
- markCB = AddCheckBox(oe, "Mark", copy.marked);
971
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
972
- randomCB = AddCheckBox(oe, "Rand", copy.random);
973
- Return();
974
- resetButton = AddButton(oe, "Reset");
975
- stepButton = AddButton(oe, "Step");
1204
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1205
+ hideCB.setToolTipText("Hide object");
1206
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1207
+ markCB.setToolTipText("As animation target transform");
1208
+
1209
+ setupPanel2 = new cGridBag().setVertical(false);
1210
+
1211
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1212
+ rewindCB.setToolTipText("Rewind animation");
1213
+
1214
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1215
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1216
+
1217
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1218
+ link2masterCB.setToolTipText("Attach to support");
1219
+
1220
+ if (Globals.ADVANCED)
1221
+ {
1222
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1223
+ speedupCB.setToolTipText("Option motion capture");
1224
+ }
1225
+
1226
+ oe.ctrlPanel.add(setupPanel);
1227
+ oe.ctrlPanel.Return();
1228
+ oe.ctrlPanel.add(setupPanel2);
1229
+ oe.ctrlPanel.Return();
1230
+
1231
+ objectCommandsPanel = new cGridBag().setVertical(false);
1232
+
1233
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1234
+ resetButton.setToolTipText("Jump to frame zero");
1235
+ stepButton = AddButton(objectCommandsPanel, "Step");
1236
+ stepButton.setToolTipText("Step one frame");
9761237 // resetAllButton = AddButton(oe, "Reset All");
9771238 // stepAllButton = AddButton(oe, "Step All");
978
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9791239 // Return();
980
- slowerButton = AddButton(oe, "Slow");
981
- fasterButton = AddButton(oe, "Fast");
982
- remarkButton = AddButton(oe, "Rem");
1240
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1241
+ slowerButton.setToolTipText("Decrease animation speed");
1242
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1243
+ fasterButton.setToolTipText("Increase animation speed");
1244
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1245
+ remarkButton.setToolTipText("Set the current transform as the target");
9831246
984
- Return();
1247
+ oe.ctrlPanel.add(objectCommandsPanel);
1248
+ oe.ctrlPanel.Return();
9851249
1250
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1251
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1252
+ //Return();
1253
+
1254
+ oe.ctrlPanel.Return();
1255
+
9861256 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9871257 // ObjEditor.aConstraints.gridx += 1;
9881258
....@@ -1076,7 +1346,7 @@
10761346 oe.aConstraints.gridwidth = 1;
10771347 /**/
10781348 nameField = AddText(oe.ctrlPanel, copy.GetName());
1079
- Return();
1349
+ oe.ctrlPanel.Return();
10801350
10811351 //ctrlPanel.add(textureButton = new Button("Texture..."));
10821352 //textureButton.setEnabled(false);
....@@ -1178,11 +1448,25 @@
11781448 //JPanel worldPanel =
11791449 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11801450 //worldPanel.setName("World");
1181
- centralPanel = new JPanel(new BorderLayout());
1182
- timelinePanel = new JPanel(new BorderLayout());
1183
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1451
+ centralPanel = new cGridBag();
1452
+ centralPanel.preferredWidth = 20;
1453
+
1454
+ if (Globals.ADVANCED)
1455
+ {
1456
+ timelinePanel = new JPanel(new BorderLayout());
1457
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11841458
1459
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1460
+ cameraPanel.setContinuousLayout(true);
1461
+ cameraPanel.setOneTouchExpandable(true);
1462
+// cameraPanel.setDividerLocation(0.9);
1463
+// cameraPanel.setDividerSize(9);
1464
+ cameraPanel.setResizeWeight(1.0);
1465
+
1466
+ }
1467
+
11851468 centralPanel.add(cameraView);
1469
+ centralPanel.setFocusable(true);
11861470 //frame.setJMenuBar(timelineMenubar);
11871471 //centralPanel.add(timelinePanel);
11881472
....@@ -1201,12 +1485,13 @@
12011485 //frontView.object = copy;
12021486 //sideView.object = copy;
12031487
1204
- XYZPanel = new JPanel();
1205
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1488
+ XYZPanel = new cGridBag().setVertical(true);
1489
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12061490
1207
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1208
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1209
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1491
+ XYZPanel.preferredWidth = 5;
1492
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1493
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1494
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
12101495
12111496 /*
12121497 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1244,11 +1529,16 @@
12441529 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12451530 //tmp.setName("Edit");
12461531 objectPanel.add(materialPanel);
1247
- JPanel north = new JPanel(new BorderLayout());
1248
- north.setName("Edit");
1249
- north.add(ctrlPanel, BorderLayout.NORTH);
1250
- objectPanel.add(north);
1251
- objectPanel.add(infoPanel);
1532
+// JPanel north = new JPanel(new BorderLayout());
1533
+// north.setName("Edit");
1534
+// north.add(ctrlPanel, BorderLayout.NORTH);
1535
+// objectPanel.add(north);
1536
+ objectPanel.add(editPanel);
1537
+
1538
+ //if (Globals.ADVANCED)
1539
+ objectPanel.add(infoPanel);
1540
+
1541
+ objectPanel.add(toolboxPanel);
12521542
12531543 /*
12541544 aConstraints.gridx = 0;
....@@ -1257,7 +1547,7 @@
12571547 aConstraints.gridy += 1;
12581548 aConstraints.gridwidth = 1;
12591549 mainPanel.add(objectPanel, aConstraints);
1260
- */
1550
+ */
12611551
12621552 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12631553 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1268,16 +1558,23 @@
12681558 scrollpane.setWheelScrollingEnabled(true);
12691559 scrollpane.addMouseWheelListener(this); // Default not fast enough
12701560
1271
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1272
- scenePanel.add(scrollpane);
1561
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1562
+ scenePanel.preferredWidth = 6;
1563
+
1564
+ JTabbedPane tabbedPane = new JTabbedPane();
1565
+ tabbedPane.add(scrollpane);
12731566
1274
- scenePanel.add(FSPane = new cFileSystemPane(this));
1275
-
1276
- optionsPanel = new JPanel(new GridBagLayout());
1567
+ optionsPanel = new cGridBag().setVertical(false);
12771568
12781569 optionsPanel.setName("Options");
1279
- scenePanel.add(optionsPanel);
1570
+
1571
+ AddOptions(optionsPanel); //, aConstraints);
1572
+
1573
+ tabbedPane.add(optionsPanel);
1574
+
1575
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12801576
1577
+ scenePanel.add(tabbedPane);
12811578
12821579 /*
12831580 cTree jTree = new cTree(null);
....@@ -1311,6 +1608,7 @@
13111608 //bigPanel.setSize(new Dimension(10,10));
13121609 //bigPanel.add(ctrlPanel);
13131610 //bigPanel.add(gridPanel);
1611
+ /**
13141612 bigThree = new JPanel();
13151613 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
13161614 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1334,7 +1632,13 @@
13341632 // aConstraints.gridheight = 3;
13351633 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13361634 bigThree.add(XYZPanel, aWindowConstraints);
1635
+ /**/
13371636
1637
+ bigThree = new cGridBag();
1638
+ bigThree.addComponent(scenePanel);
1639
+ bigThree.addComponent(centralPanel);
1640
+ bigThree.addComponent(XYZPanel);
1641
+
13381642 // // SIDE EFFECT!!!
13391643 // aConstraints.gridx = 0;
13401644 // aConstraints.gridy = 0;
....@@ -1342,9 +1646,9 @@
13421646 // aConstraints.gridheight = 1;
13431647
13441648 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1345
- framePanel.setContinuousLayout(true);
1346
- framePanel.setOneTouchExpandable(true);
1347
- framePanel.setDividerLocation(0.8);
1649
+ framePanel.setContinuousLayout(false);
1650
+ framePanel.setOneTouchExpandable(false);
1651
+ //.setDividerLocation(0.8);
13481652 //framePanel.setDividerSize(15);
13491653 //framePanel.setResizeWeight(0.15);
13501654 framePanel.setName("Frame");
....@@ -1355,15 +1659,21 @@
13551659 //worldPane.add(bigPanel);
13561660 //worldPane.add(worldPanel);
13571661 /**/
1358
- frame.getContentPane().add(/*"Center",*/framePanel);
1662
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1663
+ frame.add(/*"Center",*/framePanel);
13591664 //frame.getContentPane().add(/*"Center",*/ worldPane);
13601665
13611666 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13621667
1363
- frame.setSize(1024, 768);
1364
- frame.show();
1365
-
1668
+ frame.setSize(1280, 860);
1669
+
1670
+ cameraView.requestFocusInWindow();
1671
+
13661672 gridPanel.setDividerLocation(1.0);
1673
+
1674
+ frame.validate();
1675
+
1676
+ frame.setVisible(true);
13671677
13681678 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13691679 frame.addWindowListener(new WindowAdapter()
....@@ -1376,6 +1686,10 @@
13761686 });
13771687 }
13781688
1689
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1690
+ {
1691
+ }
1692
+
13791693 JTree GetTree()
13801694 {
13811695 return objEditor.jTree;
....@@ -1387,260 +1701,161 @@
13871701 ctrlPanel.removeAll();
13881702 }
13891703
1390
- void SetupMaterial(JPanel ctrlPanel)
1704
+ void SetupMaterial(cGridBag panel)
13911705 {
1392
- aConstraints.weighty = 0;
1393
- //aConstraints.weightx = 1;
1394
- /*
1706
+ /*
13951707 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13961708 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1397
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1398
- aConstraints.gridx += 1;
13991709 */
14001710
1401
- aConstraints.gridwidth = 1;
1402
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1403
- aConstraints.gridx += 1;
1404
- aConstraints.weighty = 0;
1405
- aConstraints.gridwidth = 1;
1711
+ cGridBag editBar = new cGridBag().setVertical(false);
1712
+
1713
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1714
+ createMaterialButton.setToolTipText("Create material");
14061715
14071716 /*
14081717 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1409
- aConstraints.gridx += 1;
1410
- aConstraints.weighty = 0;
1411
- aConstraints.gridwidth = 1;
14121718 */
14131719
1414
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1415
- aConstraints.gridx += 1;
1720
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1721
+ clearMaterialButton.setToolTipText("Clear material");
1722
+
1723
+ if (Globals.ADVANCED)
1724
+ {
1725
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1726
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1727
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1728
+ }
14161729
1417
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1418
-
1419
- aConstraints.gridx += 1;
1420
-
1421
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1422
-
1423
- aConstraints.gridx += 1;
1424
-
1425
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1426
-
1427
- aConstraints.gridx = 0;
1428
- aConstraints.gridy += 1;
1429
- aConstraints.weighty = 0;
1430
- aConstraints.gridwidth = 1;
1730
+ editBar.preferredHeight = 15;
1731
+
1732
+ panel.add(editBar);
1733
+
14311734 /**/
14321735 //aConstraints.weighty = 0;
14331736 ////aConstraints.weightx = 1;
14341737 //aConstraints.weighty = 1;
14351738 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14361739 //aConstraints.gridx += 1;
1437
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1438
- aConstraints.weighty = 0;
1439
- aConstraints.gridx = 0;
1440
- aConstraints.gridy += 1;
1441
- aConstraints.gridwidth = 1;
1740
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14421741
1443
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1444
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1445
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1446
- aConstraints.gridx += 1;
1447
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1448
- //aConstraints.weightx = 0;
1449
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1450
- aConstraints.gridx = 0;
1451
- aConstraints.gridy += 1;
1452
- aConstraints.gridwidth = 1;
1742
+ cGridBag colorSection = new cGridBag().setVertical(true);
1743
+
1744
+ cGridBag color = new cGridBag();
1745
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1746
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1747
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1748
+ //colorField.preferredWidth = 200;
1749
+ colorSection.add(color);
14531750
1454
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1455
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1456
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1457
- aConstraints.gridx += 1;
1458
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1459
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1460
- aConstraints.gridx = 0;
1461
- aConstraints.gridy += 1;
1462
- aConstraints.gridwidth = 1;
1751
+ cGridBag modulation = new cGridBag();
1752
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1753
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1754
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1755
+ colorSection.add(modulation);
14631756
1464
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1465
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1466
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1467
- aConstraints.gridx += 1;
1468
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1469
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1470
- aConstraints.gridx = 0;
1471
- aConstraints.gridy += 1;
1472
- aConstraints.gridwidth = 1;
1757
+ cGridBag texture = new cGridBag();
1758
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1759
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1760
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1761
+ colorSection.add(texture);
14731762
1474
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1475
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1476
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1477
- aConstraints.gridx += 1;
1478
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1479
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1480
- aConstraints.gridx = 0;
1481
- aConstraints.gridy += 1;
1482
- aConstraints.gridwidth = 1;
1763
+ panel.add(new JSeparator());
1764
+
1765
+ panel.add(colorSection);
1766
+
1767
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1768
+
1769
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1770
+
1771
+ cGridBag diffuse = new cGridBag();
1772
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1773
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1774
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1775
+ diffuseSection.add(diffuse);
14831776
1484
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1485
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1486
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1487
- aConstraints.gridx += 1;
1488
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1489
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1490
- aConstraints.gridx = 0;
1491
- aConstraints.gridy += 1;
1492
- aConstraints.gridwidth = 1;
1777
+ cGridBag diffuseness = new cGridBag();
1778
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1779
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1780
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1781
+ diffuseSection.add(diffuseness);
14931782
1494
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1495
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1496
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1497
- aConstraints.gridx += 1;
1498
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1499
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1500
- aConstraints.gridx = 0;
1501
- aConstraints.gridy += 1;
1502
- aConstraints.gridwidth = 1;
1783
+ cGridBag selfshadow = new cGridBag();
1784
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1785
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1786
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1787
+ diffuseSection.add(selfshadow);
15031788
1504
- //aConstraints.weighty = 1;
1505
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1506
- //aConstraints.gridx += 1;
1507
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1508
- aConstraints.weighty = 0;
1509
- aConstraints.gridx = 0;
1510
- aConstraints.gridy += 1;
1511
- aConstraints.gridwidth = 1;
1789
+ cGridBag sheen = new cGridBag();
1790
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1791
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1792
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1793
+ diffuseSection.add(sheen);
15121794
1513
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1514
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1515
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1516
- aConstraints.gridx += 1;
1517
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1518
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1519
- aConstraints.gridx = 0;
1520
- aConstraints.gridy += 1;
1521
- aConstraints.gridwidth = 1;
1795
+ cGridBag subsurface = new cGridBag();
1796
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1797
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1798
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1799
+ diffuseSection.add(subsurface);
15221800
1523
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1524
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1525
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1526
- aConstraints.gridx += 1;
1527
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1528
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1529
- aConstraints.gridx = 0;
1530
- aConstraints.gridy += 1;
1531
- aConstraints.gridwidth = 1;
1801
+ cGridBag shadow = new cGridBag();
1802
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1803
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1804
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1805
+ diffuseSection.add(shadow);
15321806
1533
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1534
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1535
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1536
- aConstraints.gridx += 1;
1537
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1538
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1539
- aConstraints.gridx = 0;
1540
- aConstraints.gridy += 1;
1541
- aConstraints.gridwidth = 1;
1807
+ cGridBag fakedepth = new cGridBag();
1808
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1809
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1810
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1811
+ diffuseSection.add(fakedepth);
15421812
1543
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1544
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1545
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1546
- aConstraints.gridx += 1;
1547
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1548
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1549
- aConstraints.gridx = 0;
1550
- aConstraints.gridy += 1;
1551
- aConstraints.gridwidth = 1;
1813
+ cGridBag shadowbias = new cGridBag();
1814
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1815
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1816
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1817
+ diffuseSection.add(shadowbias);
15521818
1553
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1554
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1555
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1556
- aConstraints.gridx += 1;
1557
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1558
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1559
- aConstraints.gridx = 0;
1560
- aConstraints.gridy += 1;
1561
- aConstraints.gridwidth = 1;
1819
+ panel.add(new JSeparator());
1820
+
1821
+ panel.add(diffuseSection);
1822
+
1823
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1824
+
1825
+ cGridBag specularSection = new cGridBag().setVertical(true);
15621826
1563
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1564
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1565
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1566
- aConstraints.gridx += 1;
1567
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1568
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1569
- aConstraints.gridx = 0;
1570
- aConstraints.gridy += 1;
1571
- aConstraints.gridwidth = 1;
1827
+ cGridBag specular = new cGridBag();
1828
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1829
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1830
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1831
+ specularSection.add(specular);
15721832
1573
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1574
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1575
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1576
- aConstraints.gridx += 1;
1577
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1578
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1579
- aConstraints.gridx = 0;
1580
- aConstraints.gridy += 1;
1581
- aConstraints.gridwidth = 1;
1833
+ cGridBag lightarea = new cGridBag();
1834
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1835
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1836
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1837
+ specularSection.add(lightarea);
15821838
1583
- //aConstraints.weighty = 1;
1584
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1585
- //aConstraints.gridx += 1;
1586
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1587
- aConstraints.weighty = 0;
1588
- aConstraints.gridx = 0;
1589
- aConstraints.gridy += 1;
1590
- aConstraints.gridwidth = 1;
1839
+ cGridBag shininess = new cGridBag();
1840
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1841
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1842
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1843
+ specularSection.add(shininess);
15911844
1592
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1593
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1594
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1595
- aConstraints.gridx += 1;
1596
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1597
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1598
- aConstraints.gridx = 0;
1599
- aConstraints.gridy += 1;
1600
- aConstraints.gridwidth = 1;
1845
+ cGridBag metalness = new cGridBag();
1846
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1847
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1848
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1849
+ specularSection.add(metalness);
16011850
1602
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1603
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1604
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1605
- aConstraints.gridx += 1;
1606
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1607
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1608
- aConstraints.gridx = 0;
1609
- aConstraints.gridy += 1;
1610
- aConstraints.gridwidth = 1;
1851
+ cGridBag velvet = new cGridBag();
1852
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1853
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1854
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1855
+ specularSection.add(velvet);
16111856
1612
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1613
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1614
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1615
- aConstraints.gridx += 1;
1616
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1617
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1618
- aConstraints.gridx = 0;
1619
- aConstraints.gridy += 1;
1620
- aConstraints.gridwidth = 1;
1621
-
1622
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1623
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1624
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1625
- aConstraints.gridx += 1;
1626
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1627
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1628
- aConstraints.gridx = 0;
1629
- aConstraints.gridy += 1;
1630
- aConstraints.gridwidth = 1;
1631
-
1632
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1633
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1634
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1635
- aConstraints.gridx += 1;
1636
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1637
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1638
- aConstraints.gridx = 0;
1639
- aConstraints.gridy += 1;
1640
- aConstraints.gridwidth = 1;
1641
-
1642
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1643
- Return();
1857
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1858
+ //Return();
16441859 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16451860 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16461861 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1651,130 +1866,105 @@
16511866 // aConstraints.gridy += 1;
16521867 // aConstraints.gridwidth = 1;
16531868
1654
- //aConstraints.weighty = 1;
1655
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1656
- //aConstraints.gridx += 1;
1657
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1658
- aConstraints.weighty = 0;
1659
- aConstraints.gridx = 0;
1660
- aConstraints.gridy += 1;
1661
- aConstraints.gridwidth = 1;
1869
+ cGridBag anisoU = new cGridBag();
1870
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1871
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1872
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1873
+ specularSection.add(anisoU);
16621874
1663
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1664
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1665
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1666
- aConstraints.gridx += 1;
1667
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1668
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1669
- aConstraints.gridx = 0;
1670
- aConstraints.gridy += 1;
1671
- aConstraints.gridwidth = 1;
1875
+ cGridBag anisoV = new cGridBag();
1876
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1877
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1878
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1879
+ specularSection.add(anisoV);
16721880
1673
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1674
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1675
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1676
- aConstraints.gridx += 1;
1677
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1678
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1679
- aConstraints.gridx = 0;
1680
- aConstraints.gridy += 1;
1681
- aConstraints.gridwidth = 1;
16821881
1683
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1684
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1685
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1686
- aConstraints.gridx += 1;
1687
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1688
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1689
- aConstraints.gridx = 0;
1690
- aConstraints.gridy += 1;
1691
- aConstraints.gridwidth = 1;
1882
+ panel.add(new JSeparator());
1883
+
1884
+ panel.add(specularSection);
1885
+
1886
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1887
+
1888
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16921889
1693
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1694
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1695
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1696
- aConstraints.gridx += 1;
1697
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1698
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1699
- aConstraints.gridx = 0;
1700
- aConstraints.gridy += 1;
1701
- aConstraints.gridwidth = 1;
1702
- aConstraints.weighty = 0;
1890
+ cGridBag camera = new cGridBag();
1891
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1892
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1893
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1894
+ colorSection.add(camera);
17031895
1704
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1705
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1706
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1707
- aConstraints.gridx += 1;
1708
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1709
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1710
- aConstraints.gridx = 0;
1711
- aConstraints.gridy += 1;
1712
- aConstraints.gridwidth = 1;
1896
+ cGridBag ambient = new cGridBag();
1897
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1898
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1899
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1900
+ colorSection.add(ambient);
17131901
1714
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1715
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1716
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1717
- aConstraints.gridx += 1;
1718
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1719
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1720
- aConstraints.gridx = 0;
1721
- aConstraints.gridy += 1;
1722
- aConstraints.gridwidth = 1;
1902
+ cGridBag backlit = new cGridBag();
1903
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1904
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1905
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1906
+ colorSection.add(backlit);
17231907
1724
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1725
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1726
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1727
- aConstraints.gridx += 1;
1728
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1729
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1730
- aConstraints.gridx = 0;
1731
- aConstraints.gridy += 1;
1732
- aConstraints.gridwidth = 1;
1908
+ cGridBag opacity = new cGridBag();
1909
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1910
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1911
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1912
+ colorSection.add(opacity);
17331913
1734
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1735
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1736
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1737
- aConstraints.gridx += 1;
1738
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1739
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1740
- aConstraints.gridx = 0;
1741
- aConstraints.gridy += 1;
1742
- aConstraints.gridwidth = 1;
1914
+ //panel.add(new JSeparator());
1915
+
1916
+ //panel.add(globalSection);
1917
+
1918
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1919
+
1920
+ cGridBag textureSection = new cGridBag().setVertical(true);
17431921
1744
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1745
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1746
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1747
- aConstraints.gridx += 1;
1748
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1749
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1750
- aConstraints.gridx = 0;
1751
- aConstraints.gridy += 1;
1752
- aConstraints.gridwidth = 1;
1922
+ cGridBag bump = new cGridBag();
1923
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1924
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1925
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1926
+ textureSection.add(bump);
17531927
1754
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1755
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1756
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1757
- aConstraints.gridx += 1;
1758
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1759
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1760
- aConstraints.gridx = 0;
1761
- aConstraints.gridy += 1;
1762
- aConstraints.gridwidth = 1;
1928
+ cGridBag noise = new cGridBag();
1929
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1930
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1931
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1932
+ textureSection.add(noise);
17631933
1764
- //aConstraints.weighty = 1;
1765
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1766
- //aConstraints.gridx += 1;
1767
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1768
- aConstraints.weighty = 0;
1934
+ cGridBag power = new cGridBag();
1935
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1936
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1937
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1938
+ textureSection.add(power);
17691939
1770
- aConstraints.gridx = 0;
1771
- aConstraints.gridy = 0;
1772
- aConstraints.gridwidth = 1;
1940
+ cGridBag borderfade = new cGridBag();
1941
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1942
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1943
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1944
+ textureSection.add(borderfade);
1945
+
1946
+ cGridBag fog = new cGridBag();
1947
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1948
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1949
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1950
+ textureSection.add(fog);
1951
+
1952
+ cGridBag opacityPower = new cGridBag();
1953
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1954
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1955
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1956
+ textureSection.add(opacityPower);
1957
+
1958
+ panel.add(new JSeparator());
1959
+
1960
+ panel.add(textureSection);
1961
+
1962
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17731963
17741964 SetMaterial(copy); // .GetMaterial());
17751965
1776
- colorField.addChangeListener(this);
1777
- modulationField.addChangeListener(this);
1966
+ //colorField.addChangeListener(this);
1967
+// modulationField.addChangeListener(this);
17781968 metalnessField.addChangeListener(this);
17791969 diffuseField.addChangeListener(this);
17801970 specularField.addChangeListener(this);
....@@ -1804,12 +1994,15 @@
18041994 opacityPowerField.addChangeListener(this);
18051995 /**/
18061996
1807
- resetSlidersButton.addActionListener(this);
18081997 clearMaterialButton.addActionListener(this);
18091998 createMaterialButton.addActionListener(this);
1810
-
1811
- propagateToggle.addItemListener(this);
1812
- multiplyToggle.addItemListener(this);
1999
+
2000
+ if (Globals.ADVANCED)
2001
+ {
2002
+ resetSlidersButton.addActionListener(this);
2003
+ propagateToggle.addItemListener(this);
2004
+ multiplyToggle.addItemListener(this);
2005
+ }
18132006 }
18142007
18152008 void DropFile(java.io.File[] files, boolean textures)
....@@ -1827,8 +2020,9 @@
18272020 // 3D models
18282021 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18292022 {
1830
- lastConverter = new com.jmex.model.converters.MaxToJme();
1831
- LoadFile(filename, lastConverter);
2023
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2024
+ //LoadFile(filename, lastConverter);
2025
+ LoadObjFile(filename); // New 3ds loader
18322026 continue;
18332027 }
18342028 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1980,7 +2174,7 @@
19802174
19812175 //? flashIt = false;
19822176 CameraPane pane = (CameraPane) cameraView;
1983
- pane.clickStart(location.x, location.y, 0);
2177
+ pane.clickStart(location.x, location.y, 0, 0);
19842178 pane.clickEnd(location.x, location.y, 0, true);
19852179
19862180 if (group.selection.size() == 1)
....@@ -2029,6 +2223,7 @@
20292223 e2.printStackTrace();
20302224 }
20312225 }
2226
+
20322227 LoadJMEThread loadThread;
20332228
20342229 class LoadJMEThread extends Thread
....@@ -2086,6 +2281,7 @@
20862281 //LoadFile0(filename, converter);
20872282 }
20882283 }
2284
+
20892285 LoadOBJThread loadObjThread;
20902286
20912287 class LoadOBJThread extends Thread
....@@ -2164,19 +2360,19 @@
21642360
21652361 void LoadObjFile(String fullname)
21662362 {
2167
- /*
2363
+ System.out.println("Loading " + fullname);
2364
+ /**/
21682365 //lastFilename = fullname;
21692366 if(loadObjThread == null)
21702367 {
2171
- loadObjThread = new LoadOBJThread();
2172
- loadObjThread.start();
2368
+ loadObjThread = new LoadOBJThread();
2369
+ loadObjThread.start();
21732370 }
21742371
21752372 loadObjThread.add(fullname);
2176
- */
2373
+ /**/
21772374
2178
- System.out.println("Loading " + fullname);
2179
- makeSomething(new FileObject(fullname, true), true);
2375
+ //makeSomething(new FileObject(fullname, true), true);
21802376 }
21812377
21822378 void LoadGFDFile(String fullname)
....@@ -2437,11 +2633,11 @@
24372633
24382634 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24392635 {
2440
- if (GrafreeD.standAlone)
2636
+ if (Grafreed.standAlone)
24412637 {
24422638 /**/
24432639 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2444
- browser.show();
2640
+ browser.setVisible(true);
24452641 String filename = browser.getFile();
24462642 if (filename != null && filename.length() > 0)
24472643 {
....@@ -2552,6 +2748,7 @@
25522748 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25532749 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25542750 }
2751
+
25552752 //cJME.count++;
25562753 //cJME.count %= 12;
25572754 if (gc)
....@@ -2586,6 +2783,7 @@
25862783 }
25872784 if (input == null)
25882785 {
2786
+ new Exception().printStackTrace();
25892787 System.exit(0);
25902788 }
25912789
....@@ -2734,6 +2932,7 @@
27342932 }
27352933 }
27362934 }
2935
+
27372936 cFileSystemPane FSPane;
27382937
27392938 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2787,11 +2986,14 @@
27872986 }
27882987 }
27892988 }
2989
+
27902990 freezematerial = false;
27912991 }
27922992
27932993 void SetMaterial(Object3D object)
27942994 {
2995
+ latestObject = object;
2996
+
27952997 cMaterial mat = object.material;
27962998
27972999 if (mat == null)
....@@ -2800,7 +3002,8 @@
28003002 return;
28013003 }
28023004
2803
- multiplyToggle.setSelected(mat.multiply);
3005
+ if (multiplyToggle != null)
3006
+ multiplyToggle.setSelected(mat.multiply);
28043007
28053008 assert (object.projectedVertices != null);
28063009
....@@ -2902,12 +3105,17 @@
29023105 // }
29033106
29043107 /**/
2905
- if (deselect)
3108
+ if (deselect || child == null)
29063109 {
29073110 //group.deselectAll();
29083111 //freeze = true;
29093112 GetTree().clearSelection();
29103113 //freeze = false;
3114
+
3115
+ if (child == null)
3116
+ {
3117
+ return;
3118
+ }
29113119 }
29123120
29133121 //group.addSelectee(child);
....@@ -2976,7 +3184,7 @@
29763184 cameraView.ToggleDL();
29773185 cameraView.repaint();
29783186 return;
2979
- } else if (event.getSource() == toggleTextureItem)
3187
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29803188 {
29813189 cameraView.ToggleTexture();
29823190 // june 2013 copy.HardTouch();
....@@ -2989,7 +3197,8 @@
29893197 if (timeline)
29903198 {
29913199 centralPanel.remove(cameraView);
2992
- centralPanel.add(timelinePanel);
3200
+ cameraPanel.add(cameraView);
3201
+ centralPanel.add(cameraPanel);
29933202 frame.setJMenuBar(timelineMenubar);
29943203 wasFullScreen = CameraPane.FULLSCREEN;
29953204 if (!CameraPane.FULLSCREEN)
....@@ -2998,7 +3207,7 @@
29983207 }
29993208 else
30003209 {
3001
- centralPanel.remove(timelinePanel);
3210
+ centralPanel.remove(cameraPanel);
30023211 centralPanel.add(cameraView);
30033212 frame.setJMenuBar(null);
30043213 if (!wasFullScreen)
....@@ -3014,9 +3223,9 @@
30143223 frame.validate();
30153224
30163225 return;
3017
- } else if (event.getSource() == toggleRandomItem)
3226
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30183227 {
3019
- cameraView.ToggleRandom();
3228
+ cameraView.ToggleSwitch();
30203229 cameraView.repaint();
30213230 return;
30223231 } else if (event.getSource() == toggleHandleItem)
....@@ -3045,6 +3254,10 @@
30453254 {
30463255 copy.live ^= true;
30473256 return;
3257
+ } else if (event.getSource() == selectCB)
3258
+ {
3259
+ copy.dontselect ^= true;
3260
+ return;
30483261 } else if (event.getSource() == hideCB)
30493262 {
30503263 copy.hide ^= true;
....@@ -3059,6 +3272,7 @@
30593272 if (event.getSource() == randomCB)
30603273 {
30613274 copy.random ^= true;
3275
+ objEditor.refreshContents();
30623276 return;
30633277 }
30643278 if (event.getSource() == speedupCB)
....@@ -3082,8 +3296,9 @@
30823296
30833297 public void actionPerformed(ActionEvent event)
30843298 {
3299
+ Object source = event.getSource();
30853300 // SCRIPT DIALOG
3086
- if (event.getSource() == okbutton)
3301
+ if (source == okbutton)
30873302 {
30883303 textpanel.setVisible(false);
30893304 textpanel.remove(textarea);
....@@ -3095,7 +3310,7 @@
30953310 textarea = null;
30963311 textpanel = null;
30973312 }
3098
- if (event.getSource() == cancelbutton)
3313
+ if (source == cancelbutton)
30993314 {
31003315 textpanel.setVisible(false);
31013316 textpanel.remove(textarea);
....@@ -3107,49 +3322,50 @@
31073322 //applySelf();
31083323 //client.refreshEditWindow();
31093324 //refreshContents();
3110
- if (event.getSource() == nameField)
3325
+ if (source == nameField)
31113326 {
31123327 //System.out.println("ObjEditor " + event);
31133328 applySelf0(true);
31143329 //parent.applySelf();
31153330 objEditor.refreshContents();
3116
- } else if (event.getSource() == resetButton)
3331
+ } else if (source == resetButton)
31173332 {
31183333 CameraPane.fullreset = true;
31193334 copy.Reset(); // ResetMeshes();
31203335 copy.Touch();
31213336 objEditor.refreshContents();
3122
- } else if (event.getSource() == stepItem)
3337
+ } else if (source == stepItem)
31233338 {
3124
- cameraView.ONESTEP = true;
3339
+ //cameraView.ONESTEP = true;
3340
+ Globals.ONESTEP = true;
31253341 cameraView.repaint();
31263342 return;
3127
- } else if (event.getSource() == stepButton)
3343
+ } else if (source == stepButton)
31283344 {
31293345 copy.Step();
31303346 copy.Touch();
31313347 objEditor.refreshContents();
3132
- } else if (event.getSource() == slowerButton)
3348
+ } else if (source == slowerButton)
31333349 {
31343350 copy.Slower();
31353351 copy.Touch();
31363352 objEditor.refreshContents();
3137
- } else if (event.getSource() == fasterButton)
3353
+ } else if (source == fasterButton)
31383354 {
31393355 copy.Faster();
31403356 copy.Touch();
31413357 objEditor.refreshContents();
3142
- } else if (event.getSource() == remarkButton)
3358
+ } else if (source == remarkButton)
31433359 {
31443360 copy.Remark();
31453361 copy.Touch();
31463362 objEditor.refreshContents();
3147
- } else if (event.getSource() == stepAllButton)
3363
+ } else if (source == stepAllButton)
31483364 {
31493365 copy.StepAll();
31503366 copy.Touch();
31513367 objEditor.refreshContents();
3152
- } else if (event.getSource() == resetAllButton)
3368
+ } else if (source == resetAllButton)
31533369 {
31543370 //CameraPane.fullreset = true;
31553371 copy.ResetAll(); // ResetMeshes();
....@@ -3182,53 +3398,79 @@
31823398 // Close();
31833399 // }
31843400 // else
3185
- if (event.getSource() == resetSlidersButton)
3401
+ if (source == resetSlidersButton)
31863402 {
31873403 ResetSliders();
3188
- } else if (event.getSource() == clearMaterialButton)
3404
+ } else if (source == clearMaterialButton)
31893405 {
31903406 ClearMaterial();
3191
- } else if (event.getSource() == createMaterialButton)
3407
+ } else if (source == createMaterialButton)
31923408 {
31933409 CreateMaterial();
3194
- } else if (event.getSource() == clearPanelButton)
3410
+ } else if (source == clearPanelButton)
31953411 {
31963412 copy.ClearUI();
31973413 refreshContents(true);
3198
- } /*
3199
- }
3200
-
3201
- public boolean action(Event event, Object arg)
3202
- {
3203
- */ else if (event.getSource() == closeItem)
3414
+ } else if (source == importGFDItem)
3415
+ {
3416
+ ImportGFD();
3417
+ } else
3418
+ if (source == importVRMLX3DItem)
3419
+ {
3420
+ ImportVRMLX3D();
3421
+ } else
3422
+ if (source == import3DSItem)
3423
+ {
3424
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3425
+ } else
3426
+ if (source == importOBJItem)
3427
+ {
3428
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3429
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3430
+ browser.setVisible(true);
3431
+ String filename = browser.getFile();
3432
+ if (filename != null && filename.length() > 0)
3433
+ {
3434
+ String fullname = browser.getDirectory() + filename;
3435
+ makeSomething(ReadOBJ(fullname), true);
3436
+ }
3437
+ } else
3438
+ if (source == closeItem)
32043439 {
32053440 Close();
32063441 //return true;
3207
- } else if (event.getSource() == loadItem)
3442
+ } else if (source == openItem)
32083443 {
3209
- load();
3444
+ Open();
32103445 //return true;
3211
- } else if (event.getSource() == saveItem)
3446
+ } else if (source == newItem)
3447
+ {
3448
+ New();
3449
+ } else if (source == saveItem)
32123450 {
32133451 save();
32143452 //return true;
3215
- } else if (event.getSource() == saveAsItem)
3453
+ } else if (source == saveAsItem)
32163454 {
32173455 saveAs();
32183456 //return true;
3219
- } else if (event.getSource() == reexportItem)
3457
+ } else if (source == reexportItem)
32203458 {
32213459 reexport();
32223460 //return true;
3223
- } else if (event.getSource() == exportAsItem)
3461
+ } else if (source == exportAsItem)
32243462 {
32253463 export();
32263464 //return true;
3227
- } else if (event.getSource() == povItem)
3465
+ } else if (source == povItem)
32283466 {
32293467 generatePOV();
32303468 //return true;
3231
- } else if (event.getSource() == zBufferItem)
3469
+ } else if (event.getSource() == archiveItem)
3470
+ {
3471
+ cTools.Archive(frame);
3472
+ return;
3473
+ } else if (source == zBufferItem)
32323474 {
32333475 try
32343476 {
....@@ -3250,21 +3492,8 @@
32503492 cameraView.repaint();
32513493 //return true;
32523494 }
3253
- */ else if (event.getSource() == editCameraItem)
3254
- {
3255
- cameraView.ProtectCamera();
3256
- cameraView.repaint();
3257
- return;
3258
- } else if (event.getSource() == revertCameraItem)
3259
- {
3260
- cameraView.RevertCamera();
3261
- cameraView.repaint();
3262
- return;
3263
-// } else if (event.getSource() == textureButton)
3264
-// {
3265
-// return; // true;
3266
- } else // combos...
3267
- if (event.getSource() == texresMenu)
3495
+ */ else // combos...
3496
+ if (source == texresMenu)
32683497 {
32693498 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32703499 copy.texres = texresMenu.getSelectedIndex();
....@@ -3276,27 +3505,424 @@
32763505 }
32773506 }
32783507
3279
- void ToggleAnimation()
3508
+ void New()
32803509 {
3281
- if (!CameraPane.ANIMATION)
3510
+ while (copy.Size() > 1)
32823511 {
3283
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3512
+ copy.remove(1);
3513
+ }
3514
+
3515
+ ResetModel();
3516
+ objEditor.refreshContents();
3517
+ }
3518
+
3519
+ static public byte[] Compress(Object3D o)
3520
+ {
3521
+ try
3522
+ {
3523
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3524
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3525
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
3526
+
3527
+ Object3D parent = o.parent;
3528
+ o.parent = null;
3529
+
3530
+ out.writeObject(o);
3531
+
3532
+ o.parent = parent;
3533
+
3534
+ out.flush();
3535
+
3536
+ baos //zstream
3537
+ .close();
3538
+ out.close();
3539
+
3540
+ byte[] bytes = baos.toByteArray();
3541
+
3542
+ System.out.println("save #bytes = " + bytes.length);
3543
+ return bytes;
3544
+ } catch (Exception e)
3545
+ {
3546
+ System.err.println(e);
3547
+ return null;
3548
+ }
3549
+ }
3550
+
3551
+ static public Object Uncompress(byte[] bytes)
3552
+ {
3553
+ System.out.println("restore #bytes = " + bytes.length);
3554
+ try
3555
+ {
3556
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3557
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3558
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
3559
+ Object obj = in.readObject();
3560
+
3561
+ bais //istream
3562
+ .close();
3563
+ in.close();
3564
+
3565
+ return obj;
3566
+ } catch (Exception e)
3567
+ {
3568
+ System.err.println(e);
3569
+ return null;
3570
+ }
3571
+ }
3572
+
3573
+ static public Object clone(Object o)
3574
+ {
3575
+ try
3576
+ {
3577
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3578
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3579
+
3580
+ out.writeObject(o);
3581
+
3582
+ out.flush();
3583
+ out.close();
3584
+
3585
+ byte[] bytes = baos.toByteArray();
3586
+
3587
+ System.out.println("clone = " + bytes.length);
3588
+
3589
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3590
+ ObjectInputStream in = new ObjectInputStream(bais);
3591
+ Object obj = in.readObject();
3592
+ in.close();
3593
+
3594
+ return obj;
3595
+ } catch (Exception e)
3596
+ {
3597
+ System.err.println(e);
3598
+ return null;
3599
+ }
3600
+ }
3601
+
3602
+ cRadio GetCurrentTab()
3603
+ {
3604
+ cRadio ab;
3605
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3606
+ {
3607
+ ab = (cRadio)e.nextElement();
3608
+ if(ab.GetObject() == copy)
3609
+ {
3610
+ return ab;
3611
+ }
3612
+ }
3613
+
3614
+ return null;
3615
+ }
3616
+
3617
+
3618
+ public void Save()
3619
+ {
3620
+ //Save(true);
3621
+ Replace();
3622
+ }
3623
+
3624
+ private boolean Equal(byte[] compress, byte[] name)
3625
+ {
3626
+ if (compress.length != name.length)
3627
+ {
3628
+ return false;
3629
+ }
3630
+
3631
+ for (int i=compress.length; --i>=0;)
3632
+ {
3633
+ if (compress[i] != name[i])
3634
+ return false;
3635
+ }
3636
+
3637
+ return true;
3638
+ }
3639
+
3640
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3641
+
3642
+ public boolean Save(boolean user)
3643
+ {
3644
+ System.err.println("Save");
3645
+
3646
+ cRadio tab = GetCurrentTab();
3647
+
3648
+ byte[] compress = CompressCopy();
3649
+
3650
+ boolean thesame = false;
3651
+
3652
+ // Quick heuristic using length. Works only when stream is compressed.
3653
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3654
+ {
3655
+ thesame = true;
3656
+ }
3657
+
3658
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3659
+ if (!thesame)
3660
+ {
3661
+ //tab.user[tab.versionindex] = user;
3662
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3663
+
3664
+ copy.versions[++copy.versionindex] = compress;
3665
+
3666
+ // if (increment)
3667
+ // tab.versionindex++;
3668
+ }
3669
+
3670
+ //copy.RestoreBigData(versiontable);
3671
+
3672
+ //assert(hashtable.isEmpty());
3673
+
3674
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3675
+ {
3676
+ //tab.user[i] = false;
3677
+ copy.versions[i] = null;
3678
+ }
3679
+
3680
+ SetUndoStates();
3681
+
3682
+ // test save
3683
+ if (false)
3684
+ {
3685
+ try
3686
+ {
3687
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
3688
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3689
+
3690
+ p.writeObject(copy);
3691
+
3692
+ p.flush();
3693
+
3694
+ ostream.close();
3695
+ } catch (Exception e)
3696
+ {
3697
+ e.printStackTrace();
3698
+ }
3699
+ }
3700
+
3701
+ return !thesame;
3702
+ }
3703
+
3704
+ void CopyChanged(Object3D obj)
3705
+ {
3706
+ SetUndoStates();
3707
+
3708
+ boolean temp = CameraPane.SWITCH;
3709
+ CameraPane.SWITCH = false;
3710
+
3711
+ copy.ExtractBigData(versiontable);
3712
+
3713
+ copy.clear();
3714
+
3715
+ for (int i=0; i<obj.Size(); i++)
3716
+ {
3717
+ copy.add(obj.get(i));
3718
+ }
3719
+
3720
+ copy.RestoreBigData(versiontable);
3721
+
3722
+ CameraPane.SWITCH = temp;
3723
+
3724
+ //assert(hashtable.isEmpty());
3725
+
3726
+ copy.Touch();
3727
+
3728
+ ResetModel();
3729
+ copy.HardTouch(); // recompile?
3730
+
3731
+ cRadio ab;
3732
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3733
+ {
3734
+ ab = (cRadio)e.nextElement();
3735
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3736
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3737
+ if (test != null)
3738
+ {
3739
+ test.editWindow = ab.object.editWindow;
3740
+ ab.object = test;
3741
+ }
3742
+ }
3743
+
3744
+ refreshContents();
3745
+ }
3746
+
3747
+ cButton undoButton;
3748
+ cButton restoreButton;
3749
+ cButton replaceButton;
3750
+ cButton redoButton;
3751
+
3752
+ boolean muteSlider;
3753
+
3754
+ int VersionCount()
3755
+ {
3756
+ int count = 0;
3757
+
3758
+ for (int i = copy.versions.length; --i >= 0;)
3759
+ {
3760
+ if (copy.versions[i] != null)
3761
+ count++;
3762
+ }
3763
+
3764
+ return count;
3765
+ }
3766
+
3767
+ void SetUndoStates()
3768
+ {
3769
+ cRadio tab = GetCurrentTab();
3770
+
3771
+ restoreButton.setEnabled(copy.versionindex != -1);
3772
+ replaceButton.setEnabled(copy.versionindex != -1);
3773
+
3774
+ undoButton.setEnabled(copy.versionindex > 0);
3775
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3776
+
3777
+ muteSlider = true;
3778
+ versionSlider.setMaximum(VersionCount() - 1);
3779
+ versionSlider.setInteger(copy.versionindex);
3780
+ muteSlider = false;
3781
+ }
3782
+
3783
+ public boolean Undo()
3784
+ {
3785
+ // Option?
3786
+ Replace();
3787
+
3788
+ System.err.println("Undo");
3789
+
3790
+ cRadio tab = GetCurrentTab();
3791
+
3792
+ if (copy.versionindex == 0)
3793
+ {
3794
+ java.awt.Toolkit.getDefaultToolkit().beep();
3795
+ return false;
3796
+ }
3797
+
3798
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3799
+// {
3800
+// if (Save(false))
3801
+// tab.versionindex -= 1;
3802
+// else
3803
+// {
3804
+// if (tab.versionindex <= 0)
3805
+// return false;
3806
+// else
3807
+// tab.versionindex -= 1;
3808
+// }
3809
+// }
3810
+
3811
+ copy.versionindex -= 1;
3812
+
3813
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3814
+
3815
+ return true;
3816
+ }
3817
+
3818
+ public boolean Restore()
3819
+ {
3820
+ System.err.println("Restore");
3821
+
3822
+ cRadio tab = GetCurrentTab();
3823
+
3824
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3825
+ {
3826
+ java.awt.Toolkit.getDefaultToolkit().beep();
3827
+ return false;
3828
+ }
3829
+
3830
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3831
+
3832
+ return true;
3833
+ }
3834
+
3835
+ public boolean Replace()
3836
+ {
3837
+ System.err.println("Replace");
3838
+
3839
+ cRadio tab = GetCurrentTab();
3840
+
3841
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3842
+ {
3843
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3844
+ return false;
3845
+ }
3846
+
3847
+ copy.versions[copy.versionindex] = CompressCopy();
3848
+
3849
+ return true;
3850
+ }
3851
+
3852
+ public void Redo()
3853
+ {
3854
+ // Option?
3855
+ Replace();
3856
+
3857
+ cRadio tab = GetCurrentTab();
3858
+
3859
+ if (copy.versions[copy.versionindex + 1] == null)
3860
+ {
3861
+ java.awt.Toolkit.getDefaultToolkit().beep();
3862
+ return;
3863
+ }
3864
+
3865
+ copy.versionindex += 1;
3866
+
3867
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3868
+
3869
+ //if (!tab.user[tab.versionindex])
3870
+ // tab.graphs[tab.versionindex] = null;
3871
+ }
3872
+
3873
+ void ImportGFD()
3874
+ {
3875
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32843876 browser.show();
32853877 String filename = browser.getFile();
32863878 if (filename != null && filename.length() > 0)
32873879 {
3288
- CameraPane.filename = browser.getDirectory() + filename;
3880
+ String fullname = browser.getDirectory() + filename;
3881
+
3882
+ //Object3D readobj =
3883
+ objEditor.ReadGFD(fullname, objEditor);
3884
+ //makeSomething(readobj);
3885
+ }
3886
+ }
3887
+
3888
+ void ImportVRMLX3D()
3889
+ {
3890
+ if (Grafreed.standAlone)
3891
+ {
3892
+ /**/
3893
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3894
+ browser.show();
3895
+ String filename = browser.getFile();
3896
+ if (filename != null && filename.length() > 0)
3897
+ {
3898
+ String fullname = browser.getDirectory() + filename;
3899
+ LoadVRMLX3D(fullname);
3900
+ }
3901
+ /**/
3902
+ }
3903
+ }
3904
+
3905
+ void ToggleAnimation()
3906
+ {
3907
+ if (!Globals.ANIMATION)
3908
+ {
3909
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3910
+ browser.setVisible(true);
3911
+ String filename = browser.getFile();
3912
+ if (filename != null && filename.length() > 0)
3913
+ {
3914
+ Globals.filename = browser.getDirectory() + filename;
32893915 //CameraPane.framecount = 0;
3290
- CameraPane.imagecount = 0;
3916
+ Globals.imagecount = 0;
32913917
3292
- CameraPane.ANIMATION ^= true;
3918
+ Globals.ANIMATION ^= true;
32933919
3294
- GrafreeD.wav.cursor = 0;
3295
- GrafreeD.wav.loop = 0;
3920
+ Grafreed.wav.cursor = 0;
3921
+ Grafreed.wav.loop = 0;
32963922 }
32973923 } else
32983924 {
3299
- CameraPane.ANIMATION ^= true;
3925
+ Globals.ANIMATION ^= true;
33003926 }
33013927 }
33023928
....@@ -3342,7 +3968,7 @@
33423968 void CreateMaterial()
33433969 {
33443970 //copy.ClearMaterial(); // PATCH
3345
- copy.CreateMaterialS(multiplyToggle.isSelected());
3971
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33463972 if (copy.selection.size() > 0)
33473973 //SetMaterial(copy);
33483974 {
....@@ -3393,7 +4019,7 @@
33934019 assert false;
33944020 }
33954021
3396
- void EditSelection()
4022
+ void EditSelection(boolean newWindow)
33974023 {
33984024 }
33994025
....@@ -3401,11 +4027,11 @@
34014027 {
34024028 copy.ResetBlockLoop(); // temporary problem
34034029
3404
- boolean random = CameraPane.RANDOM;
3405
- CameraPane.RANDOM = false; // parse everything
4030
+ boolean random = CameraPane.SWITCH;
4031
+ CameraPane.SWITCH = false; // parse everything
34064032 copy.ResetDisplayList();
34074033 copy.HardTouch();
3408
- CameraPane.RANDOM = random;
4034
+ CameraPane.SWITCH = random;
34094035 }
34104036
34114037 // public void applySelf()
....@@ -3475,10 +4101,40 @@
34754101 current.fakedepth = (float) fakedepthField.getFloat();
34764102 current.shadowbias = (float) shadowbiasField.getFloat();
34774103
3478
- if (!NumberSlider.frozen)
4104
+ if (!cNumberSlider.frozen)
34794105 {
34804106 //System.out.println("Propagate = " + propagate);
34814107 copy.UpdateMaterial(anchor, current, propagate);
4108
+
4109
+ if (copy.material != null)
4110
+ {
4111
+ cMaterial mat = copy.material;
4112
+
4113
+ colorField.SetToolTipValue((mat.color));
4114
+ modulationField.SetToolTipValue((mat.modulation));
4115
+ metalnessField.SetToolTipValue((mat.metalness));
4116
+ diffuseField.SetToolTipValue((mat.diffuse));
4117
+ specularField.SetToolTipValue((mat.specular));
4118
+ shininessField.SetToolTipValue((mat.shininess));
4119
+ shiftField.SetToolTipValue((mat.shift));
4120
+ ambientField.SetToolTipValue((mat.ambient));
4121
+ lightareaField.SetToolTipValue((mat.lightarea));
4122
+ diffusenessField.SetToolTipValue((mat.factor));
4123
+ velvetField.SetToolTipValue((mat.velvet));
4124
+ sheenField.SetToolTipValue((mat.sheen));
4125
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4126
+ backlitField.SetToolTipValue((mat.bump));
4127
+ anisoField.SetToolTipValue((mat.aniso));
4128
+ anisoVField.SetToolTipValue((mat.anisoV));
4129
+ cameraField.SetToolTipValue((mat.cameralight));
4130
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4131
+ shadowField.SetToolTipValue((mat.shadow));
4132
+ textureField.SetToolTipValue((mat.texture));
4133
+ opacityField.SetToolTipValue((mat.opacity));
4134
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4135
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4136
+ }
4137
+
34824138 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34834139 {
34844140 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3507,9 +4163,25 @@
35074163 //copy.Touch();
35084164 }
35094165
4166
+ cNumberSlider versionSlider;
4167
+
35104168 public void stateChanged(ChangeEvent e)
35114169 {
35124170 // assert(false);
4171
+ if (e.getSource() == versionSlider)
4172
+ {
4173
+ if (muteSlider)
4174
+ return;
4175
+
4176
+ int version = versionSlider.getInteger();
4177
+
4178
+ if (copy.versions[version] != null)
4179
+ {
4180
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4181
+ }
4182
+
4183
+ return;
4184
+ }
35134185
35144186 if (freezematerial)
35154187 {
....@@ -3523,6 +4195,7 @@
35234195 || e.getSource() == apertureField
35244196 || e.getSource() == shadowblurField)
35254197 {
4198
+ new Exception().printStackTrace();
35264199 System.exit(0);
35274200 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35284201 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3549,7 +4222,13 @@
35494222 //System.out.println("PARENT = " + parent);
35504223 //if (parent != null)
35514224 // parent.applySelf();
3552
- refreshContents();
4225
+ if (e.getSource() == normalpushField)
4226
+ {
4227
+ objEditor.refreshContents();
4228
+ //Refresh();
4229
+ }
4230
+ else
4231
+ refreshContents();
35534232 // ??? client.refreshEditWindow();
35544233 }
35554234 //else
....@@ -3561,7 +4240,7 @@
35614240 //group.name = nameField.getText();
35624241 //objEditor.applySelf();
35634242
3564
- assert (objEditor == this);
4243
+ // OCT2018: assert (objEditor == this);
35654244 if (copy.selection == null || copy.selection.size() == 0)
35664245 //super.applySelf()
35674246 ; else
....@@ -3585,6 +4264,9 @@
35854264 objEditor.copy = keep;
35864265 }
35874266 }
4267
+
4268
+ if (normalpushField != null)
4269
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35884270 }
35894271
35904272 void SnapObject()
....@@ -3839,7 +4521,7 @@
38394521
38404522 radioPanel.revalidate();
38414523 radioPanel.repaint();
3842
- ctrlPanel.revalidate(); // ? new
4524
+ ctrlPanel.validate(); // ? new
38434525 ctrlPanel.repaint();
38444526 }
38454527 }
....@@ -3848,6 +4530,8 @@
38484530
38494531 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38504532 {
4533
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4534
+ Save();
38514535 //Tween.set(thing, 0).target(1).start(tweenManager);
38524536 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38534537 // if (thing instanceof GenericJointDemo)
....@@ -3934,6 +4618,12 @@
39344618 {
39354619 ResetModel();
39364620 Select(thing.GetTreePath(), true, false); // unselect... false);
4621
+
4622
+ if (thing.Size() == 0)
4623
+ {
4624
+ //EditSelection(false);
4625
+ }
4626
+
39374627 refreshContents();
39384628 }
39394629
....@@ -4051,6 +4741,7 @@
40514741 }
40524742 }
40534743 }
4744
+
40544745 LoadGFDThread loadGFDThread;
40554746
40564747 void ReadGFD(String fullname, iCallBack cb)
....@@ -4070,8 +4761,10 @@
40704761
40714762 try
40724763 {
4764
+ // Try compressed version first.
40734765 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4074
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4766
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4767
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40754768
40764769 readobj = (Object3D) p.readObject();
40774770 istream.close();
....@@ -4079,7 +4772,20 @@
40794772 readobj.ResetDisplayList();
40804773 } catch (Exception e)
40814774 {
4082
- e.printStackTrace();
4775
+ //e.printStackTrace();
4776
+ try
4777
+ {
4778
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4779
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4780
+
4781
+ readobj = (Object3D) p.readObject();
4782
+ istream.close();
4783
+
4784
+ readobj.ResetDisplayList();
4785
+ } catch (Exception e2)
4786
+ {
4787
+ e2.printStackTrace();
4788
+ }
40834789 }
40844790 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40854791 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4125,6 +4831,12 @@
41254831
41264832 void LoadIt(Object obj)
41274833 {
4834
+ if (obj == null)
4835
+ {
4836
+ // Invalid file
4837
+ return;
4838
+ }
4839
+
41284840 System.out.println("Loaded " + obj);
41294841 //new Exception().printStackTrace();
41304842 Object3D readobj = (Object3D) obj;
....@@ -4134,6 +4846,8 @@
41344846
41354847 if (readobj != null)
41364848 {
4849
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4850
+ // Save();
41374851 try
41384852 {
41394853 //readobj.deepCopySelf(copy);
....@@ -4188,15 +4902,26 @@
41884902 c.addChild(csg);
41894903 }
41904904
4905
+ copy.versions = readobj.versions;
4906
+ copy.versionindex = readobj.versionindex;
4907
+
4908
+ if (copy.versions == null)
4909
+ {
4910
+ copy.versions = new byte[100][];
4911
+ copy.versionindex = -1;
4912
+ }
4913
+
4914
+ //? SetUndoStates();
4915
+
41914916 ResetModel();
41924917 copy.HardTouch(); // recompile?
41934918 refreshContents();
41944919 }
41954920 }
41964921
4197
- void load() // throws ClassNotFoundException
4922
+ void Open() // throws ClassNotFoundException
41984923 {
4199
- if (GrafreeD.standAlone)
4924
+ if (Grafreed.standAlone)
42004925 {
42014926 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42024927 browser.show();
....@@ -4283,11 +5008,13 @@
42835008 try
42845009 {
42855010 FileOutputStream ostream = new FileOutputStream(lastname);
4286
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5011
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5012
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42875013
42885014 p.writeObject(copy);
42895015 p.flush();
42905016
5017
+ zstream.close();
42915018 ostream.close();
42925019
42935020 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4297,17 +5024,20 @@
42975024 {
42985025 }
42995026 }
5027
+
43005028 String lastname;
43015029
43025030 void saveAs()
43035031 {
4304
- if (GrafreeD.standAlone)
5032
+ if (Grafreed.standAlone)
43055033 {
43065034 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43075035 browser.setVisible(true);
43085036 String filename = browser.getFile();
43095037 if (filename != null && filename.length() > 0)
43105038 {
5039
+ if (!filename.endsWith(".gfd"))
5040
+ filename += ".gfd";
43115041 lastname = browser.getDirectory() + filename;
43125042 save();
43135043 }
....@@ -4406,13 +5136,13 @@
44065136 try
44075137 {
44085138 FileOutputStream ostream = new FileOutputStream(filename);
4409
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4410
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5139
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5140
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44115141
44125142 Object3D objectparent = obj.parent;
44135143 obj.parent = null;
44145144
4415
- Object3D object = (Object3D) GrafreeD.clone(obj);
5145
+ Object3D object = (Object3D) Grafreed.clone(obj);
44165146
44175147 obj.parent = objectparent;
44185148
....@@ -4424,8 +5154,8 @@
44245154 p.writeObject(object);
44255155 p.flush();
44265156
5157
+ zstream.close();
44275158 ostream.close();
4428
- // zstream.close();
44295159
44305160 // group.selection.get(0).parent = parent;
44315161 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4446,7 +5176,7 @@
44465176 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44475177 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44485178 copy.generatePOV(buffer);
4449
- if (GrafreeD.standAlone)
5179
+ if (Grafreed.standAlone)
44505180 {
44515181 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44525182 browser.show();
....@@ -4472,21 +5202,20 @@
44725202 Object3D client;
44735203 Object3D copy;
44745204 MenuBar menuBar;
4475
- Menu windowMenu;
4476
- MenuItem loadItem;
5205
+ Menu fileMenu;
5206
+ MenuItem newItem;
5207
+ MenuItem openItem;
44775208 MenuItem saveItem;
44785209 MenuItem saveAsItem;
44795210 MenuItem exportAsItem;
44805211 MenuItem reexportItem;
44815212 MenuItem povItem;
44825213 MenuItem closeItem;
4483
- Menu cameraMenu;
5214
+
44845215 CheckboxMenuItem zBufferItem;
44855216 //MenuItem normalLensItem;
4486
- MenuItem editCameraItem;
4487
- MenuItem revertCameraItem;
4488
- CheckboxMenuItem toggleLiveItem;
44895217 MenuItem stepItem;
5218
+ CheckboxMenuItem toggleLiveItem;
44905219 CheckboxMenuItem toggleFullScreenItem;
44915220 CheckboxMenuItem toggleTimelineItem;
44925221 CheckboxMenuItem toggleRenderItem;
....@@ -4495,28 +5224,43 @@
44955224 CheckboxMenuItem toggleFootContactItem;
44965225 CheckboxMenuItem toggleDLItem;
44975226 CheckboxMenuItem toggleTextureItem;
4498
- CheckboxMenuItem toggleRandomItem;
5227
+ CheckboxMenuItem toggleSwitchItem;
44995228 CheckboxMenuItem toggleRootItem;
45005229 CheckboxMenuItem animationItem;
5230
+ MenuItem archiveItem;
45015231 CheckboxMenuItem toggleHandleItem;
45025232 CheckboxMenuItem togglePaintItem;
45035233 JSplitPane mainPanel;
45045234 JScrollPane scrollpane;
5235
+
45055236 JPanel toolbarPanel;
4506
- JPanel treePanel;
5237
+
5238
+ cGridBag treePanel;
5239
+
45075240 JPanel radioPanel;
45085241 ButtonGroup buttonGroup;
4509
- JPanel ctrlPanel;
4510
- JPanel materialPanel;
5242
+
5243
+ cGridBag toolboxPanel;
5244
+ cGridBag materialPanel;
5245
+ cGridBag ctrlPanel;
5246
+
45115247 JScrollPane infoPanel;
4512
- JPanel optionsPanel;
5248
+
5249
+ cGridBag optionsPanel;
5250
+
45135251 JTabbedPane objectPanel;
4514
- JPanel XYZPanel;
5252
+ boolean materialFlushed;
5253
+ Object3D latestObject;
5254
+
5255
+ cGridBag XYZPanel;
5256
+
45155257 JSplitPane gridPanel;
45165258 JSplitPane bigPanel;
4517
- JPanel bigThree;
4518
- JTabbedPane scenePanel;
4519
- JPanel centralPanel;
5259
+
5260
+ cGridBag bigThree;
5261
+ cGridBag scenePanel;
5262
+ cGridBag centralPanel;
5263
+ JSplitPane cameraPanel;
45205264 JPanel timelinePanel;
45215265 JMenuBar timelineMenubar;
45225266 JSplitPane framePanel;
....@@ -4568,65 +5312,72 @@
45685312 // MATERIAL
45695313 JLabel materialLabel;
45705314 JLabel colorLabel;
4571
- NumberSlider colorField;
5315
+ cNumberSlider colorField;
45725316 JLabel modulationLabel;
4573
- NumberSlider modulationField;
5317
+ cNumberSlider modulationField;
45745318 JLabel metalnessLabel;
4575
- NumberSlider metalnessField;
5319
+ cNumberSlider metalnessField;
45765320 JLabel diffuseLabel;
4577
- NumberSlider diffuseField;
5321
+ cNumberSlider diffuseField;
45785322 JLabel specularLabel;
4579
- NumberSlider specularField;
5323
+ cNumberSlider specularField;
45805324 JLabel shininessLabel;
4581
- NumberSlider shininessField;
5325
+ cNumberSlider shininessField;
45825326 JLabel shiftLabel;
4583
- NumberSlider shiftField;
5327
+ cNumberSlider shiftField;
45845328 JLabel ambientLabel;
4585
- NumberSlider ambientField;
5329
+ cNumberSlider ambientField;
45865330 JLabel lightareaLabel;
4587
- NumberSlider lightareaField;
5331
+ cNumberSlider lightareaField;
45885332 JLabel diffusenessLabel;
4589
- NumberSlider diffusenessField;
5333
+ cNumberSlider diffusenessField;
45905334 JLabel velvetLabel;
4591
- NumberSlider velvetField;
5335
+ cNumberSlider velvetField;
45925336 JLabel sheenLabel;
4593
- NumberSlider sheenField;
5337
+ cNumberSlider sheenField;
45945338 JLabel subsurfaceLabel;
4595
- NumberSlider subsurfaceField;
5339
+ cNumberSlider subsurfaceField;
45965340 //JLabel bumpLabel;
45975341 //NumberSlider bumpField;
45985342 JLabel backlitLabel;
4599
- NumberSlider backlitField;
5343
+ cNumberSlider backlitField;
46005344 JLabel anisoLabel;
4601
- NumberSlider anisoField;
5345
+ cNumberSlider anisoField;
46025346 JLabel anisoVLabel;
4603
- NumberSlider anisoVField;
5347
+ cNumberSlider anisoVField;
46045348 JLabel cameraLabel;
4605
- NumberSlider cameraField;
5349
+ cNumberSlider cameraField;
46065350 JLabel selfshadowLabel;
4607
- NumberSlider selfshadowField;
5351
+ cNumberSlider selfshadowField;
46085352 JLabel shadowLabel;
4609
- NumberSlider shadowField;
5353
+ cNumberSlider shadowField;
46105354 JLabel textureLabel;
4611
- NumberSlider textureField;
5355
+ cNumberSlider textureField;
46125356 JLabel opacityLabel;
4613
- NumberSlider opacityField;
5357
+ cNumberSlider opacityField;
46145358 JLabel fakedepthLabel;
4615
- NumberSlider fakedepthField;
5359
+ cNumberSlider fakedepthField;
46165360 JLabel shadowbiasLabel;
4617
- NumberSlider shadowbiasField;
5361
+ cNumberSlider shadowbiasField;
46185362 JLabel bumpLabel;
4619
- NumberSlider bumpField;
5363
+ cNumberSlider bumpField;
46205364 JLabel noiseLabel;
4621
- NumberSlider noiseField;
5365
+ cNumberSlider noiseField;
46225366 JLabel powerLabel;
4623
- NumberSlider powerField;
5367
+ cNumberSlider powerField;
46245368 JLabel borderfadeLabel;
4625
- NumberSlider borderfadeField;
5369
+ cNumberSlider borderfadeField;
46265370 JLabel fogLabel;
4627
- NumberSlider fogField;
5371
+ cNumberSlider fogField;
46285372 JLabel opacityPowerLabel;
4629
- NumberSlider opacityPowerField;
4630
- JTree jTree;
5373
+ cNumberSlider opacityPowerField;
5374
+ cTree jTree;
46315375 //ObjectUI parent;
5376
+
5377
+ cNumberSlider normalpushField;
5378
+
5379
+ private MenuItem importGFDItem;
5380
+ private MenuItem importVRMLX3DItem;
5381
+ private MenuItem import3DSItem;
5382
+ private MenuItem importOBJItem;
46325383 }