Normand Briere
2019-07-19 e79247ef52a0bbb3864d46bb1e2c716005b3ecf3
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,56 @@
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
+ ImageIcon icon = GetIcon(name);
48
+ return new cButton(icon, border);
49
+ }
50
+
51
+ cToggleButton GetToggleButton(String name, boolean border)
52
+ {
53
+ ImageIcon icon = GetIcon(name);
54
+ return new cToggleButton(icon, border);
55
+ }
56
+
57
+ cCheckBox GetCheckBox(String name, boolean border)
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cCheckBox(icon, border);
61
+ }
62
+
63
+ private ImageIcon GetIcon(String name)
64
+ {
65
+ try
66
+ {
67
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
68
+
69
+ if (image.getWidth() != 24 && image.getHeight() != 24)
70
+ {
71
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
72
+ Graphics2D g = resized.createGraphics();
73
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
74
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
75
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
76
+ g.dispose();
77
+
78
+ image = resized;
79
+ }
80
+
81
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
82
+ return icon;
83
+ }
84
+ catch (Exception e)
85
+ {
86
+ return null;
87
+ }
88
+ }
89
+
3490 // SCRIPT
3591
3692 transient JFrame textpanel = null;
....@@ -121,47 +177,54 @@
121177 void keyPressed(int key, int modifiers)
122178 {
123179 System.out.println("KEY PRESSED");
124
- CameraPane.theRenderer.keyPressed(key, modifiers);
180
+ Globals.theRenderer.keyPressed(key, modifiers);
125181 }
126182 */
127183
128184 static GridBagConstraints aConstraints;
129185 static GridBagConstraints aWindowConstraints;
130
- GroupEditor callee;
131
- JFrame frame;
186
+
132187 static int GRIDWIDTH = 100; // 4;
133188
134189 public void closeUI()
135190 {
136191 //new Exception().printStackTrace();
137
- System.out.println("this = " + this);
138
- System.out.println("objEditor = " + objEditor);
192
+// System.out.println("this = " + this);
193
+// System.out.println("objEditor = " + objEditor);
139194 //nameField.removeActionListener(this);
140
- objEditor.ctrlPanel.remove(nameField);
195
+// objEditor.ctrlPanel.remove(nameField);
141196
142
- if (!GroupEditor.allparams)
197
+ objEditor.ctrlPanel.remove(namePanel);
198
+
199
+ if (!allparams)
143200 return;
144201
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);
202
+// objEditor.ctrlPanel.remove(liveCB);
203
+// objEditor.ctrlPanel.remove(hideCB);
204
+// objEditor.ctrlPanel.remove(markCB);
205
+//
206
+// objEditor.ctrlPanel.remove(randomCB);
207
+// objEditor.ctrlPanel.remove(speedupCB);
208
+// objEditor.ctrlPanel.remove(rewindCB);
209
+//
210
+// objEditor.ctrlPanel.remove(resetButton);
211
+// objEditor.ctrlPanel.remove(stepButton);
212
+//// objEditor.ctrlPanel.remove(stepAllButton);
213
+//// objEditor.ctrlPanel.remove(resetAllButton);
214
+// objEditor.ctrlPanel.remove(link2masterCB);
215
+// //objEditor.ctrlPanel.remove(flipVCB);
216
+// //objEditor.ctrlPanel.remove(texresMenu);
217
+// objEditor.ctrlPanel.remove(slowerButton);
218
+// objEditor.ctrlPanel.remove(fasterButton);
219
+// objEditor.ctrlPanel.remove(remarkButton);
163220
164
- Remove(normalpushField);
221
+ objEditor.ctrlPanel.remove(setupPanel);
222
+ objEditor.ctrlPanel.remove(setupPanel2);
223
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
224
+ objEditor.ctrlPanel.remove(pushPanel);
225
+ //objEditor.ctrlPanel.remove(fillPanel);
226
+
227
+ //Remove(normalpushField);
165228 }
166229
167230 public ObjEditor GetEditor()
....@@ -205,6 +268,12 @@
205268 client = inClient;
206269 copy = client;
207270
271
+ if (copy.versions == null)
272
+ {
273
+ copy.versions = new byte[100][];
274
+ copy.versionindex = -1;
275
+ }
276
+
208277 // "this" is not called: SetupUI2(objEditor);
209278 }
210279
....@@ -218,6 +287,12 @@
218287 client = inClient;
219288 copy = client;
220289
290
+ if (copy.versions == null)
291
+ {
292
+ copy.versions = new byte[100][];
293
+ copy.versionindex = -1;
294
+ }
295
+
221296 SetupUI2(callee.GetEditor());
222297 }
223298
....@@ -232,6 +307,7 @@
232307 //localCopy.parent = null;
233308
234309 frame = new JFrame();
310
+ frame.setUndecorated(false);
235311 objEditor = this;
236312 this.callee = callee;
237313
....@@ -249,6 +325,12 @@
249325 copy = localCopy;
250326 copy.editWindow = this;
251327
328
+ if (copy.versions == null)
329
+ {
330
+ copy.versions = new byte[100][];
331
+ copy.versionindex = -1;
332
+ }
333
+
252334 SetupMenu();
253335
254336 //SetupName(objEditor); // new
....@@ -262,28 +344,49 @@
262344 return frame.action(event, obj);
263345 }
264346
347
+ // Cannot work without static
348
+ static boolean allparams = true;
349
+
350
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
351
+
265352 void SetupMenu()
266353 {
267354 frame.setMenuBar(menuBar = new MenuBar());
268
- menuBar.add(windowMenu = new Menu("File"));
269
- windowMenu.add(loadItem = new MenuItem("Load..."));
270
- windowMenu.add("-");
271
- windowMenu.add(saveItem = new MenuItem("Save"));
272
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
355
+ menuBar.add(fileMenu = new Menu("File"));
356
+ fileMenu.add(newItem = new MenuItem("New"));
357
+ fileMenu.add(openItem = new MenuItem("Open..."));
358
+
359
+ //oe.menuBar.add(menu = new Menu("Include"));
360
+ Menu menu = new Menu("Import");
361
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
362
+ importOBJItem.addActionListener(this);
363
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
364
+ import3DSItem.addActionListener(this);
365
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
366
+ importVRMLX3DItem.addActionListener(this);
367
+ menu.add("-");
368
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
369
+ importGFDItem.addActionListener(this);
370
+ fileMenu.add(menu);
371
+ fileMenu.add("-");
372
+
373
+ fileMenu.add(saveItem = new MenuItem("Save"));
374
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
273375 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
274
- windowMenu.add("-");
275
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
276
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
277
- windowMenu.add("-");
376
+ fileMenu.add("-");
377
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
378
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
379
+ fileMenu.add("-");
278380 if (client.parent != null)
279381 {
280
- windowMenu.add(closeItem = new MenuItem("Close"));
382
+ fileMenu.add(closeItem = new MenuItem("Close"));
281383 } else
282384 {
283
- windowMenu.add(closeItem = new MenuItem("Exit"));
385
+ fileMenu.add(closeItem = new MenuItem("Exit"));
284386 }
285387
286
- loadItem.addActionListener(this);
388
+ newItem.addActionListener(this);
389
+ openItem.addActionListener(this);
287390 saveItem.addActionListener(this);
288391 saveAsItem.addActionListener(this);
289392 exportAsItem.addActionListener(this);
....@@ -291,82 +394,69 @@
291394 //povItem.addActionListener(this);
292395 closeItem.addActionListener(this);
293396
294
- menuBar.add(cameraMenu = new Menu("View"));
295
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
296
- //zBufferItem.addActionListener(this);
297
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
298
- //normalLensItem.addActionListener(this);
299
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
300
- revertCameraItem.addActionListener(this);
301
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
302
- toggleTimelineItem.addItemListener(this);
303
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
304
- toggleFullScreenItem.addItemListener(this);
305
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
306
- cameraMenu.add("-");
307
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
308
- toggleTextureItem.addItemListener(this);
309
- toggleTextureItem.setState(CameraPane.textureon);
310
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
311
- toggleLiveItem.addItemListener(this);
312
- toggleLiveItem.setState(CameraPane.isLIVE());
313
- cameraMenu.add(stepItem = new MenuItem("Step"));
314
- stepItem.addActionListener(this);
315
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
316
-// toggleDLItem.addItemListener(this);
317
-// toggleDLItem.setState(false);
318
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
319
- toggleRenderItem.addItemListener(this);
320
- toggleRenderItem.setState(!CameraPane.frozen);
321
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
322
- toggleDebugItem.addItemListener(this);
323
- toggleDebugItem.setState(CameraPane.DEBUG);
324
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
325
- toggleFrustumItem.addItemListener(this);
326
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
327
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
328
- toggleFootContactItem.addItemListener(this);
329
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
330
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
331
- toggleRandomItem.addItemListener(this);
332
- toggleRandomItem.setState(CameraPane.RANDOM);
333
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
334
- toggleHandleItem.addItemListener(this);
335
- toggleHandleItem.setState(CameraPane.HANDLES);
336
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
337
- togglePaintItem.addItemListener(this);
338
- togglePaintItem.setState(CameraPane.PAINTMODE);
339
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
340
-// toggleRootItem.addItemListener(this);
341
-// toggleRootItem.setState(false);
342
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
343
-// animationItem.addItemListener(this);
344
-// animationItem.setState(CameraPane.ANIMATION);
345
- cameraMenu.add("-");
346
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
347
- editCameraItem.addActionListener(this);
348
-
349397 objectPanel = new JTabbedPane();
398
+
399
+ ChangeListener changeListener = new ChangeListener()
400
+ {
401
+ public void stateChanged(ChangeEvent changeEvent)
402
+ {
403
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
404
+// {
405
+// if (latestObject != null)
406
+// {
407
+// refreshContents(true);
408
+// SetMaterial(latestObject);
409
+// }
410
+//
411
+// materialFlushed = true;
412
+// }
413
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
414
+// {
415
+// if (listUI.size() == 0)
416
+// EditSelection(false);
417
+// }
418
+
419
+ refreshContents(false); // To refresh Info tab
420
+ }
421
+ };
422
+ objectPanel.addChangeListener(changeListener);
423
+
350424 toolbarPanel = new JPanel();
351425 toolbarPanel.setName("Toolbar");
352
- treePanel = new JPanel();
426
+
427
+ treePanel = new cGridBag();
353428 treePanel.setName("Tree");
354
- ctrlPanel = new JPanel(); // new GridBagLayout());
355
- ctrlPanel.setName("Edit");
356
- materialPanel = new JPanel();
357
- materialPanel.setName("Material");
429
+
430
+ editPanel = new cGridBag().setVertical(true);
431
+ //editPanel.setName("Edit");
432
+
433
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
434
+
435
+ editCommandsPanel = new cGridBag();
436
+ editPanel.add(editCommandsPanel);
437
+ editPanel.add(ctrlPanel);
438
+
439
+ toolboxPanel = new cGridBag().setVertical(false);
440
+ //toolboxPanel.setName("Toolbox");
441
+
442
+ materialPanel = new cGridBag().setVertical(true);
443
+ //materialPanel.setName("Material");
444
+
358445 /*JTextPane*/
359446 infoarea = createTextPane();
447
+ doc = infoarea.getStyledDocument();
448
+
360449 infoarea.setEditable(true);
361450 SetText();
451
+
362452 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
363453 // infoarea.setOpaque(false);
364454 // //infoarea.setForeground(textcolor);
365
- infoarea.setLineWrap(true);
366
- infoarea.setWrapStyleWord(true);
455
+// TEXTAREA infoarea.setLineWrap(true);
456
+// TEXTAREA infoarea.setWrapStyleWord(true);
367457 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
368
- infoPanel.setPreferredSize(new Dimension(50, 200));
369
- infoPanel.setName("Info");
458
+ infoPanel.setPreferredSize(new Dimension(1, 1));
459
+ //infoPanel.setName("Info");
370460 //infoPanel.setLayout(new BorderLayout());
371461 //infoPanel.add(createTextPane());
372462
....@@ -374,16 +464,23 @@
374464 mainPanel.setName("Main");
375465 mainPanel.setContinuousLayout(true);
376466 mainPanel.setOneTouchExpandable(true);
377
- mainPanel.setDividerLocation(1.0);
378467 mainPanel.setDividerSize(9);
379
- mainPanel.setResizeWeight(0);
380
-
468
+ mainPanel.setDividerLocation(0.5); //1.0);
469
+ mainPanel.setResizeWeight(0.5);
470
+
471
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
472
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
473
+ divider.setDividerSize(15);
474
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
475
+
476
+ mainPanel.setUI(new BasicSplitPaneUI());
477
+
381478 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
382479 //mainPanel.setLayout(new GridBagLayout());
383480 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
384
- treePanel.setLayout(new GridBagLayout());
385
- ctrlPanel.setLayout(new GridBagLayout());
386
- materialPanel.setLayout(new GridBagLayout());
481
+// treePanel.setLayout(new GridBagLayout());
482
+ //ctrlPanel.setLayout(new GridBagLayout());
483
+ //materialPanel.setLayout(new GridBagLayout());
387484
388485 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
389486 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -422,7 +519,7 @@
422519 static String newline = "\n";
423520 protected static final String buttonString = "JButton";
424521 StyledDocument doc;
425
- JTextArea infoarea;
522
+ JTextPane infoarea;
426523
427524 void ClearInfo()
428525 {
....@@ -445,10 +542,10 @@
445542 e.printStackTrace();
446543 }
447544
448
- String selection = infoarea.getText();
449
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
450
- java.awt.datatransfer.Clipboard clipboard =
451
- Toolkit.getDefaultToolkit().getSystemClipboard();
545
+// String selection = infoarea.getText();
546
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
547
+// java.awt.datatransfer.Clipboard clipboard =
548
+// Toolkit.getDefaultToolkit().getSystemClipboard();
452549 //clipboard.setContents(data, data);
453550 }
454551
....@@ -471,13 +568,13 @@
471568 //SendInfo("Name:", "bold");
472569 if (sel.GetTextures() != null || debug)
473570 {
474
- si.SendInfo(sel.toString(), "bold");
571
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
475572 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
476573 if (sel.Size() > 0)
477574 {
478575 si.SendInfo("#children = " + sel.Size(), "regular");
479576 }
480
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
577
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
481578 if (debug)
482579 {
483580 try
....@@ -489,7 +586,10 @@
489586 }
490587
491588 if (full)
492
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
589
+ {
590
+ si.SendInfo(" BBox min: " + minima, "regular");
591
+ si.SendInfo(" BBox max: " + maxima, "regular");
592
+ }
493593
494594 if (sel.bRep != null)
495595 {
....@@ -516,7 +616,7 @@
516616 }
517617 if (sel.support != null)
518618 {
519
- si.SendInfo(" support: " + sel.support, "regular");
619
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
520620 }
521621 if (sel.scriptnode != null)
522622 {
....@@ -587,6 +687,9 @@
587687 {
588688 CameraPane.pointflow = (PointFlow) sel;
589689 }
690
+
691
+ si.SendInfo("_____________________", "regular");
692
+ si.SendInfo("", "regular");
590693 }
591694 }
592695
....@@ -602,68 +705,191 @@
602705 }
603706 }
604707
708
+//static GraphicsDevice device = GraphicsEnvironment
709
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
710
+
711
+ Rectangle keeprect;
712
+ cRadio radio;
713
+
714
+cButton keepButton;
715
+ cButton twoButton; // Full 3D
716
+ cButton sixButton;
717
+ cButton threeButton;
718
+ cButton sevenButton;
719
+ cButton fourButton; // full panel
720
+ cButton oneButton; // full XYZ
721
+ //cButton currentLayout;
722
+
723
+ boolean maximized;
724
+
725
+ cButton fullscreenLayout;
726
+
727
+ void Minimize()
728
+ {
729
+ frame.setState(Frame.ICONIFIED);
730
+ frame.validate();
731
+ }
732
+
733
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
734
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
735
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
736
+ void Maximize()
737
+ {
738
+ if (CameraPane.FULLSCREEN)
739
+ {
740
+ ToggleFullScreen();
741
+ }
742
+
743
+ if (maximized)
744
+ {
745
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
746
+ }
747
+ else
748
+ {
749
+ keeprect = frame.getBounds();
750
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
751
+// Dimension rect2 = frame.getToolkit().getScreenSize();
752
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
753
+// frame.setState(Frame.MAXIMIZED_BOTH);
754
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
755
+ }
756
+
757
+ maximized ^= true;
758
+
759
+ frame.validate();
760
+ }
761
+
762
+ cButton minButton;
763
+ cButton maxButton;
764
+ cButton fullButton;
765
+
605766 void ToggleFullScreen()
606767 {
607
- if (CameraPane.FULLSCREEN)
768
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
769
+
770
+ cameraView.ToggleFullScreen();
771
+
772
+ if (!CameraPane.FULLSCREEN)
608773 {
609
- frame.getContentPane().remove(/*"Center",*/bigThree);
610
- framePanel.add(bigThree);
611
- frame.getContentPane().add(/*"Center",*/framePanel);
774
+ device.setFullScreenWindow(null);
775
+ frame.dispose();
776
+ frame.setUndecorated(false);
777
+ frame.validate();
778
+ frame.setVisible(true);
779
+
780
+ //frame.setVisible(false);
781
+// frame.removeNotify();
782
+// frame.setUndecorated(false);
783
+// frame.addNotify();
784
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
785
+
786
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
787
+// X framePanel.add(bigThree);
788
+// X frame.getContentPane().add(/*"Center",*/framePanel);
789
+ framePanel.setDividerLocation(46);
790
+
791
+ //frame.setVisible(true);
792
+ radio.layout = keepButton;
793
+ //theFrame = null;
794
+ keepButton = null;
795
+ radio.layout.doClick();
796
+
612797 } else
613798 {
614
- frame.getContentPane().remove(/*"Center",*/framePanel);
615
- framePanel.remove(bigThree);
616
- frame.getContentPane().add(/*"Center",*/bigThree);
799
+ keepButton = radio.layout;
800
+ //keeprect = frame.getBounds();
801
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
802
+// frame.getToolkit().getScreenSize().height);
803
+ //frame.setVisible(false);
804
+
805
+ frame.dispose();
806
+ frame.setUndecorated(true);
807
+ device.setFullScreenWindow(frame);
808
+ frame.validate();
809
+ frame.setVisible(true);
810
+// frame.removeNotify();
811
+// frame.setUndecorated(true);
812
+// frame.addNotify();
813
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
814
+// X framePanel.remove(bigThree);
815
+// X frame.getContentPane().add(/*"Center",*/bigThree);
816
+ framePanel.setDividerLocation(0);
817
+
818
+ radio.layout = fullscreenLayout;
819
+ radio.layout.doClick();
820
+ //frame.setVisible(true);
617821 }
618
- cameraView.ToggleFullScreen();
822
+ frame.validate();
619823 }
620824
621
- private JTextArea createTextPane()
825
+ private byte[] CompressCopy()
622826 {
623
- String[] initString =
624
- {
625
- "This is an editable JTextPane, ", //regular
626
- "another ", //italic
627
- "styled ", //bold
628
- "text ", //small
629
- "component, ", //large
630
- "which supports embedded components..." + newline,//regular
631
- " " + newline, //button
632
- "...and embedded icons..." + newline, //regular
633
- " ", //icon
634
- newline + "JTextPane is a subclass of JEditorPane that "
635
- + "uses a StyledEditorKit and StyledDocument, and provides "
636
- + "cover methods for interacting with those objects."
637
- };
827
+ boolean temp = CameraPane.SWITCH;
828
+ CameraPane.SWITCH = false;
829
+
830
+ copy.ExtractBigData(versiontable);
831
+ // if (copy == client)
832
+
833
+ byte[] versions[] = copy.versions;
834
+ copy.versions = null;
835
+
836
+ byte[] compress = Compress(copy);
837
+
838
+ copy.versions = versions;
839
+
840
+ copy.RestoreBigData(versiontable);
841
+
842
+ CameraPane.SWITCH = temp;
843
+
844
+ return compress;
845
+ }
638846
639
- String[] initStyles =
640
- {
641
- "regular", "italic", "bold", "small", "large",
642
- "regular", "button", "regular", "icon",
643
- "regular"
644
- };
847
+ private JTextPane createTextPane()
848
+ {
849
+// TEXTAREA String[] initString =
850
+// {
851
+// "This is an editable JTextPane, ", //regular
852
+// "another ", //italic
853
+// "styled ", //bold
854
+// "text ", //small
855
+// "component, ", //large
856
+// "which supports embedded components..." + newline,//regular
857
+// " " + newline, //button
858
+// "...and embedded icons..." + newline, //regular
859
+// " ", //icon
860
+// newline + "JTextPane is a subclass of JEditorPane that "
861
+// + "uses a StyledEditorKit and StyledDocument, and provides "
862
+// + "cover methods for interacting with those objects."
863
+// };
864
+//
865
+// String[] initStyles =
866
+// {
867
+// "regular", "italic", "bold", "small", "large",
868
+// "regular", "button", "regular", "icon",
869
+// "regular"
870
+// };
871
+//
872
+// JTextPane textPane = new JTextPane();
873
+// textPane.setEditable(true);
874
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
875
+// addStylesToDocument(doc);
876
+//
877
+// try
878
+// {
879
+// for (int j = 0; j < 2; j++)
880
+// {
881
+// for (int i = 0; i < initString.length; i++)
882
+// {
883
+// doc.insertString(doc.getLength(), initString[i],
884
+// doc.getStyle(initStyles[i]));
885
+// }
886
+// }
887
+// } catch (BadLocationException ble)
888
+// {
889
+// System.err.println("Couldn't insert initial text into text pane.");
890
+// }
645891
646
- JTextPane textPane = new JTextPane();
647
- textPane.setEditable(true);
648
- /*StyledDocument*/ doc = textPane.getStyledDocument();
649
- addStylesToDocument(doc);
650
-
651
- try
652
- {
653
- for (int j = 0; j < 2; j++)
654
- {
655
- for (int i = 0; i < initString.length; i++)
656
- {
657
- doc.insertString(doc.getLength(), initString[i],
658
- doc.getStyle(initStyles[i]));
659
- }
660
- }
661
- } catch (BadLocationException ble)
662
- {
663
- System.err.println("Couldn't insert initial text into text pane.");
664
- }
665
-
666
- return new JTextArea(); // textPane;
892
+ return new JTextPane(); // textPane;
667893 }
668894
669895 protected void addStylesToDocument(StyledDocument doc)
....@@ -716,7 +942,7 @@
716942 protected static ImageIcon createImageIcon(String path,
717943 String description)
718944 {
719
- java.net.URL imgURL = GrafreeD.class.getResource(path);
945
+ java.net.URL imgURL = Grafreed.class.getResource(path);
720946 if (imgURL != null)
721947 {
722948 return new ImageIcon(imgURL, description);
....@@ -748,6 +974,7 @@
748974 // NumberSlider vDivsField;
749975 // JCheckBox endcaps;
750976 JCheckBox liveCB;
977
+ JCheckBox selectCB;
751978 JCheckBox hideCB;
752979 JCheckBox link2masterCB;
753980 JCheckBox markCB;
....@@ -755,7 +982,12 @@
755982 JCheckBox speedupCB;
756983 JCheckBox rewindCB;
757984 JCheckBox flipVCB;
985
+
986
+ cCheckBox toggleTextureCB;
987
+ cCheckBox toggleSwitchCB;
988
+
758989 JComboBox texresMenu;
990
+
759991 JButton resetButton;
760992 JButton stepButton;
761993 JButton stepAllButton;
....@@ -763,115 +995,87 @@
763995 JButton slowerButton;
764996 JButton fasterButton;
765997 JButton remarkButton;
998
+
999
+ cGridBag editPanel;
1000
+ cGridBag editCommandsPanel;
1001
+
1002
+ cGridBag namePanel;
1003
+ cGridBag setupPanel;
1004
+ cGridBag setupPanel2;
1005
+ cGridBag objectCommandsPanel;
1006
+ cGridBag pushPanel;
1007
+ cGridBag fillPanel;
7661008
767
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1009
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7681010 {
7691011 JCheckBox cb;
7701012
771
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
772
- oe.aConstraints.gridwidth = 1; // 3;
773
-// oe.aConstraints.weightx = 1;
774
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
775
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1013
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7761014 cb.addItemListener(this);
777
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
778
- oe.aConstraints.gridwidth = 1;
779
- oe.aConstraints.gridx += 1;
7801015
7811016 return cb;
7821017 }
7831018
784
- cButton AddButton(ObjEditor oe, String label)
1019
+ cButton AddButton(cGridBag panel, String label)
7851020 {
7861021 cButton cb;
7871022
788
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
789
- oe.aConstraints.gridwidth = 1;
790
-// oe.aConstraints.weightx = 1;
791
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
792
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1023
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7931024 cb.addActionListener(this);
794
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
795
- oe.aConstraints.gridwidth = 1;
796
- oe.aConstraints.gridx += 1;
7971025
7981026 return cb;
7991027 }
8001028
801
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1029
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
8021030 {
8031031 JComboBox combo;
8041032
805
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
806
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
807
- oe.aConstraints.gridx += 1;
1033
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8081034 combo.addActionListener(this);
8091035
8101036 return combo;
8111037 }
8121038
813
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
1039
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
8141040 {
815
- NumberSlider combo;
1041
+ cGridBag control = new cGridBag();
1042
+
1043
+ cNumberSlider combo;
8161044
8171045 JLabel jlabel = new JLabel(label);
818
-
819
- aConstraints.fill = GridBagConstraints.VERTICAL;
8201046 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
821
- aConstraints.gridwidth = 1;
822
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
823
- aConstraints.gridx += 1;
824
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
825
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
826
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827
- aConstraints.gridx += 1;
828
- aConstraints.gridwidth = 1;
829
-
1047
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1048
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8301049 combo.setFloat(current);
831
-
832
- combo.label = jlabel;
833
-
834
- combo.addChangeListener(this);
835
-
836
- return combo;
1050
+
1051
+ panel.add(control);
1052
+
1053
+ return control;
8371054 }
8381055
839
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
1056
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8401057 {
841
- NumberSlider combo;
1058
+ cGridBag control = new cGridBag();
1059
+
1060
+ cNumberSlider combo;
8421061
8431062 JLabel jlabel = new JLabel(label);
844
-
845
- aConstraints.fill = GridBagConstraints.VERTICAL;
8461063 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
847
- aConstraints.gridwidth = 2;
848
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
849
- aConstraints.gridx += 1;
850
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
851
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
852
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
853
- aConstraints.gridx += 1;
854
- aConstraints.gridwidth = 1;
855
-
1064
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1065
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8561066 combo.setInteger(current);
8571067
858
- combo.label = jlabel;
859
-
860
- combo.addChangeListener(this);
861
-
862
- return combo;
1068
+ panel.add(control);
1069
+
1070
+ return control;
8631071 }
8641072
865
- JTextArea AddText(JPanel ctrlPanel, String name)
1073
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8661074 {
8671075 JTextArea text;
8681076
869
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
870
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
871
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1077
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8721078 text.addCaretListener(this);
873
- aConstraints.gridx += 1;
874
- aConstraints.gridwidth = 1;
8751079
8761080 return text;
8771081 }
....@@ -901,9 +1105,16 @@
9011105 objEditor.ctrlPanel.remove(j);
9021106 }
9031107
1108
+ void Remove(cNumberSlider j)
1109
+ {
1110
+ j.removeChangeListener(this);
1111
+ //objEditor.ctrlPanel.remove(j.label);
1112
+ objEditor.ctrlPanel.remove(j);
1113
+ }
1114
+
9041115 /*
9051116 */
906
- void Return() // ObjEditor oe)
1117
+ void Return0() // ObjEditor oe)
9071118 {
9081119 aConstraints.gridy += 1;
9091120 aConstraints.gridx = 0;
....@@ -958,37 +1169,77 @@
9581169
9591170 void SetupUI2(ObjEditor oe)
9601171 {
961
-// oe.aConstraints.weightx = 0;
962
-// oe.aConstraints.weighty = 0;
963
-// oe.aConstraints.gridx = 0;
964
-// oe.aConstraints.gridy = 0;
965
- SetupName(oe);
1172
+ //SetupName(oe);
9661173
967
- if (!GroupEditor.allparams)
1174
+ namePanel = new cGridBag();
1175
+
1176
+ nameField = AddText(namePanel, copy.GetName());
1177
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
1178
+ oe.ctrlPanel.add(namePanel);
1179
+
1180
+ oe.ctrlPanel.Return();
1181
+
1182
+ if (!allparams)
9681183 return;
9691184
970
- liveCB = AddCheckBox(oe, "Live", copy.live);
971
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
972
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1185
+ setupPanel = new cGridBag().setVertical(false);
1186
+
1187
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1188
+ liveCB.setToolTipText("Animate object");
1189
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1190
+ selectCB.setToolTipText("Make object selectable");
9731191 // Return();
974
- markCB = AddCheckBox(oe, "Mark", copy.marked);
975
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
976
- randomCB = AddCheckBox(oe, "Rand", copy.random);
977
- Return();
978
- resetButton = AddButton(oe, "Reset");
979
- stepButton = AddButton(oe, "Step");
1192
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1193
+ hideCB.setToolTipText("Hide object");
1194
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1195
+ markCB.setToolTipText("As animation target transform");
1196
+
1197
+ setupPanel2 = new cGridBag().setVertical(false);
1198
+
1199
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1200
+ rewindCB.setToolTipText("Rewind animation");
1201
+
1202
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1203
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1204
+
1205
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1206
+ link2masterCB.setToolTipText("Attach to support");
1207
+
1208
+ if (Globals.ADVANCED)
1209
+ {
1210
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1211
+ speedupCB.setToolTipText("Option motion capture");
1212
+ }
1213
+
1214
+ oe.ctrlPanel.add(setupPanel);
1215
+ oe.ctrlPanel.Return();
1216
+ oe.ctrlPanel.add(setupPanel2);
1217
+ oe.ctrlPanel.Return();
1218
+
1219
+ objectCommandsPanel = new cGridBag().setVertical(false);
1220
+
1221
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1222
+ resetButton.setToolTipText("Jump to frame zero");
1223
+ stepButton = AddButton(objectCommandsPanel, "Step");
1224
+ stepButton.setToolTipText("Step one frame");
9801225 // resetAllButton = AddButton(oe, "Reset All");
9811226 // stepAllButton = AddButton(oe, "Step All");
982
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9831227 // Return();
984
- slowerButton = AddButton(oe, "Slow");
985
- fasterButton = AddButton(oe, "Fast");
986
- remarkButton = AddButton(oe, "Rem");
1228
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1229
+ slowerButton.setToolTipText("Decrease animation speed");
1230
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1231
+ fasterButton.setToolTipText("Increase animation speed");
1232
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1233
+ remarkButton.setToolTipText("Set the current transform as the target");
9871234
988
- Return();
1235
+ oe.ctrlPanel.add(objectCommandsPanel);
1236
+ oe.ctrlPanel.Return();
9891237
990
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
991
- Return();
1238
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1239
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1240
+ //Return();
1241
+
1242
+ oe.ctrlPanel.Return();
9921243
9931244 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9941245 // ObjEditor.aConstraints.gridx += 1;
....@@ -1083,7 +1334,7 @@
10831334 oe.aConstraints.gridwidth = 1;
10841335 /**/
10851336 nameField = AddText(oe.ctrlPanel, copy.GetName());
1086
- Return();
1337
+ oe.ctrlPanel.Return();
10871338
10881339 //ctrlPanel.add(textureButton = new Button("Texture..."));
10891340 //textureButton.setEnabled(false);
....@@ -1185,11 +1436,25 @@
11851436 //JPanel worldPanel =
11861437 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11871438 //worldPanel.setName("World");
1188
- centralPanel = new JPanel(new BorderLayout());
1189
- timelinePanel = new JPanel(new BorderLayout());
1190
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1439
+ centralPanel = new cGridBag();
1440
+ centralPanel.preferredWidth = 20;
1441
+
1442
+ if (Globals.ADVANCED)
1443
+ {
1444
+ timelinePanel = new JPanel(new BorderLayout());
1445
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11911446
1447
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1448
+ cameraPanel.setContinuousLayout(true);
1449
+ cameraPanel.setOneTouchExpandable(true);
1450
+// cameraPanel.setDividerLocation(0.9);
1451
+// cameraPanel.setDividerSize(9);
1452
+ cameraPanel.setResizeWeight(1.0);
1453
+
1454
+ }
1455
+
11921456 centralPanel.add(cameraView);
1457
+ centralPanel.setFocusable(true);
11931458 //frame.setJMenuBar(timelineMenubar);
11941459 //centralPanel.add(timelinePanel);
11951460
....@@ -1208,12 +1473,14 @@
12081473 //frontView.object = copy;
12091474 //sideView.object = copy;
12101475
1211
- XYZPanel = new JPanel();
1212
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1476
+ XYZPanel = new cGridBag().setVertical(true);
1477
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12131478
1214
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1215
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1216
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1479
+ XYZPanel.preferredWidth = 5;
1480
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1481
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1482
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1483
+ //XYZPanel.setName("XYZ");
12171484
12181485 /*
12191486 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1251,11 +1518,23 @@
12511518 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12521519 //tmp.setName("Edit");
12531520 objectPanel.add(materialPanel);
1254
- JPanel north = new JPanel(new BorderLayout());
1255
- north.setName("Edit");
1256
- north.add(ctrlPanel, BorderLayout.NORTH);
1257
- objectPanel.add(north);
1258
- objectPanel.add(infoPanel);
1521
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1522
+// JPanel north = new JPanel(new BorderLayout());
1523
+// north.setName("Edit");
1524
+// north.add(ctrlPanel, BorderLayout.NORTH);
1525
+// objectPanel.add(north);
1526
+ objectPanel.add(editPanel);
1527
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1528
+
1529
+ //if (Globals.ADVANCED)
1530
+ objectPanel.add(infoPanel);
1531
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1532
+
1533
+ objectPanel.add(XYZPanel);
1534
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1535
+
1536
+ objectPanel.add(toolboxPanel);
1537
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
12591538
12601539 /*
12611540 aConstraints.gridx = 0;
....@@ -1264,7 +1543,7 @@
12641543 aConstraints.gridy += 1;
12651544 aConstraints.gridwidth = 1;
12661545 mainPanel.add(objectPanel, aConstraints);
1267
- */
1546
+ */
12681547
12691548 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12701549 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1275,16 +1554,23 @@
12751554 scrollpane.setWheelScrollingEnabled(true);
12761555 scrollpane.addMouseWheelListener(this); // Default not fast enough
12771556
1278
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1279
- scenePanel.add(scrollpane);
1557
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1558
+ scenePanel.preferredWidth = 5;
1559
+
1560
+ JTabbedPane tabbedPane = new JTabbedPane();
1561
+ tabbedPane.add(scrollpane);
12801562
1281
- scenePanel.add(FSPane = new cFileSystemPane(this));
1282
-
1283
- optionsPanel = new JPanel(new GridBagLayout());
1563
+ optionsPanel = new cGridBag().setVertical(false);
12841564
12851565 optionsPanel.setName("Options");
1286
- scenePanel.add(optionsPanel);
1566
+
1567
+ AddOptions(optionsPanel); //, aConstraints);
1568
+
1569
+ tabbedPane.add(optionsPanel);
1570
+
1571
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12871572
1573
+ scenePanel.add(tabbedPane);
12881574
12891575 /*
12901576 cTree jTree = new cTree(null);
....@@ -1318,6 +1604,7 @@
13181604 //bigPanel.setSize(new Dimension(10,10));
13191605 //bigPanel.add(ctrlPanel);
13201606 //bigPanel.add(gridPanel);
1607
+ /**
13211608 bigThree = new JPanel();
13221609 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
13231610 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1341,7 +1628,13 @@
13411628 // aConstraints.gridheight = 3;
13421629 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13431630 bigThree.add(XYZPanel, aWindowConstraints);
1631
+ /**/
13441632
1633
+ bigThree = new cGridBag();
1634
+ bigThree.addComponent(scenePanel);
1635
+ bigThree.addComponent(centralPanel);
1636
+ //bigThree.addComponent(XYZPanel);
1637
+
13451638 // // SIDE EFFECT!!!
13461639 // aConstraints.gridx = 0;
13471640 // aConstraints.gridy = 0;
....@@ -1349,9 +1642,9 @@
13491642 // aConstraints.gridheight = 1;
13501643
13511644 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1352
- framePanel.setContinuousLayout(true);
1353
- framePanel.setOneTouchExpandable(true);
1354
- framePanel.setDividerLocation(0.8);
1645
+ framePanel.setContinuousLayout(false);
1646
+ framePanel.setOneTouchExpandable(false);
1647
+ //.setDividerLocation(0.8);
13551648 //framePanel.setDividerSize(15);
13561649 //framePanel.setResizeWeight(0.15);
13571650 framePanel.setName("Frame");
....@@ -1362,15 +1655,21 @@
13621655 //worldPane.add(bigPanel);
13631656 //worldPane.add(worldPanel);
13641657 /**/
1365
- frame.getContentPane().add(/*"Center",*/framePanel);
1658
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1659
+ frame.add(/*"Center",*/framePanel);
13661660 //frame.getContentPane().add(/*"Center",*/ worldPane);
13671661
13681662 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13691663
1370
- frame.setSize(1024, 768);
1371
- frame.show();
1372
-
1664
+ frame.setSize(1280, 860);
1665
+
1666
+ cameraView.requestFocusInWindow();
1667
+
13731668 gridPanel.setDividerLocation(1.0);
1669
+
1670
+ frame.validate();
1671
+
1672
+ frame.setVisible(true);
13741673
13751674 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13761675 frame.addWindowListener(new WindowAdapter()
....@@ -1383,6 +1682,10 @@
13831682 });
13841683 }
13851684
1685
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1686
+ {
1687
+ }
1688
+
13861689 JTree GetTree()
13871690 {
13881691 return objEditor.jTree;
....@@ -1394,260 +1697,161 @@
13941697 ctrlPanel.removeAll();
13951698 }
13961699
1397
- void SetupMaterial(JPanel ctrlPanel)
1700
+ void SetupMaterial(cGridBag panel)
13981701 {
1399
- aConstraints.weighty = 0;
1400
- //aConstraints.weightx = 1;
1401
- /*
1702
+ /*
14021703 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14031704 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1404
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1405
- aConstraints.gridx += 1;
14061705 */
14071706
1408
- aConstraints.gridwidth = 1;
1409
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1410
- aConstraints.gridx += 1;
1411
- aConstraints.weighty = 0;
1412
- aConstraints.gridwidth = 1;
1707
+ cGridBag editBar = new cGridBag().setVertical(false);
1708
+
1709
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1710
+ createMaterialButton.setToolTipText("Create material");
14131711
14141712 /*
14151713 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1416
- aConstraints.gridx += 1;
1417
- aConstraints.weighty = 0;
1418
- aConstraints.gridwidth = 1;
14191714 */
14201715
1421
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1422
- aConstraints.gridx += 1;
1716
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1717
+ clearMaterialButton.setToolTipText("Clear material");
1718
+
1719
+ if (Globals.ADVANCED)
1720
+ {
1721
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1722
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1723
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1724
+ }
14231725
1424
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1425
-
1426
- aConstraints.gridx += 1;
1427
-
1428
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1429
-
1430
- aConstraints.gridx += 1;
1431
-
1432
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1433
-
1434
- aConstraints.gridx = 0;
1435
- aConstraints.gridy += 1;
1436
- aConstraints.weighty = 0;
1437
- aConstraints.gridwidth = 1;
1726
+ editBar.preferredHeight = 15;
1727
+
1728
+ panel.add(editBar);
1729
+
14381730 /**/
14391731 //aConstraints.weighty = 0;
14401732 ////aConstraints.weightx = 1;
14411733 //aConstraints.weighty = 1;
14421734 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14431735 //aConstraints.gridx += 1;
1444
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1445
- aConstraints.weighty = 0;
1446
- aConstraints.gridx = 0;
1447
- aConstraints.gridy += 1;
1448
- aConstraints.gridwidth = 1;
1736
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14491737
1450
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1451
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1452
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1453
- aConstraints.gridx += 1;
1454
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1455
- //aConstraints.weightx = 0;
1456
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1457
- aConstraints.gridx = 0;
1458
- aConstraints.gridy += 1;
1459
- aConstraints.gridwidth = 1;
1738
+ cGridBag colorSection = new cGridBag().setVertical(true);
1739
+
1740
+ cGridBag color = new cGridBag();
1741
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1742
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1743
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1744
+ //colorField.preferredWidth = 200;
1745
+ colorSection.add(color);
14601746
1461
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1462
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1463
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1464
- aConstraints.gridx += 1;
1465
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1466
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1467
- aConstraints.gridx = 0;
1468
- aConstraints.gridy += 1;
1469
- aConstraints.gridwidth = 1;
1747
+ cGridBag modulation = new cGridBag();
1748
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1749
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1750
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1751
+ colorSection.add(modulation);
14701752
1471
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1472
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1473
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1474
- aConstraints.gridx += 1;
1475
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1476
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1477
- aConstraints.gridx = 0;
1478
- aConstraints.gridy += 1;
1479
- aConstraints.gridwidth = 1;
1753
+ cGridBag texture = new cGridBag();
1754
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1755
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1756
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1757
+ colorSection.add(texture);
14801758
1481
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1482
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1483
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1484
- aConstraints.gridx += 1;
1485
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1486
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1487
- aConstraints.gridx = 0;
1488
- aConstraints.gridy += 1;
1489
- aConstraints.gridwidth = 1;
1759
+ panel.add(new JSeparator());
1760
+
1761
+ panel.add(colorSection);
1762
+
1763
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1764
+
1765
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1766
+
1767
+ cGridBag diffuse = new cGridBag();
1768
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1769
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1770
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1771
+ diffuseSection.add(diffuse);
14901772
1491
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1492
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1493
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1494
- aConstraints.gridx += 1;
1495
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1496
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1497
- aConstraints.gridx = 0;
1498
- aConstraints.gridy += 1;
1499
- aConstraints.gridwidth = 1;
1773
+ cGridBag diffuseness = new cGridBag();
1774
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1775
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1776
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1777
+ diffuseSection.add(diffuseness);
15001778
1501
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1502
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1503
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1504
- aConstraints.gridx += 1;
1505
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1506
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1507
- aConstraints.gridx = 0;
1508
- aConstraints.gridy += 1;
1509
- aConstraints.gridwidth = 1;
1779
+ cGridBag selfshadow = new cGridBag();
1780
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1781
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1782
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1783
+ diffuseSection.add(selfshadow);
15101784
1511
- //aConstraints.weighty = 1;
1512
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1513
- //aConstraints.gridx += 1;
1514
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1515
- aConstraints.weighty = 0;
1516
- aConstraints.gridx = 0;
1517
- aConstraints.gridy += 1;
1518
- aConstraints.gridwidth = 1;
1785
+ cGridBag sheen = new cGridBag();
1786
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1787
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1788
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1789
+ diffuseSection.add(sheen);
15191790
1520
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1521
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1522
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1523
- aConstraints.gridx += 1;
1524
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1525
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1526
- aConstraints.gridx = 0;
1527
- aConstraints.gridy += 1;
1528
- aConstraints.gridwidth = 1;
1791
+ cGridBag subsurface = new cGridBag();
1792
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1793
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1794
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1795
+ diffuseSection.add(subsurface);
15291796
1530
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1531
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1532
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1533
- aConstraints.gridx += 1;
1534
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1535
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1536
- aConstraints.gridx = 0;
1537
- aConstraints.gridy += 1;
1538
- aConstraints.gridwidth = 1;
1797
+ cGridBag shadow = new cGridBag();
1798
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1799
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1800
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1801
+ diffuseSection.add(shadow);
15391802
1540
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1541
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1542
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1543
- aConstraints.gridx += 1;
1544
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1545
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1546
- aConstraints.gridx = 0;
1547
- aConstraints.gridy += 1;
1548
- aConstraints.gridwidth = 1;
1803
+ cGridBag fakedepth = new cGridBag();
1804
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1805
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1806
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1807
+ diffuseSection.add(fakedepth);
15491808
1550
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1551
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1552
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1553
- aConstraints.gridx += 1;
1554
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1555
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1556
- aConstraints.gridx = 0;
1557
- aConstraints.gridy += 1;
1558
- aConstraints.gridwidth = 1;
1809
+ cGridBag shadowbias = new cGridBag();
1810
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1811
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1812
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1813
+ diffuseSection.add(shadowbias);
15591814
1560
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1561
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1562
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1563
- aConstraints.gridx += 1;
1564
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1565
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1566
- aConstraints.gridx = 0;
1567
- aConstraints.gridy += 1;
1568
- aConstraints.gridwidth = 1;
1815
+ panel.add(new JSeparator());
1816
+
1817
+ panel.add(diffuseSection);
1818
+
1819
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1820
+
1821
+ cGridBag specularSection = new cGridBag().setVertical(true);
15691822
1570
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1571
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1572
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1573
- aConstraints.gridx += 1;
1574
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1575
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1576
- aConstraints.gridx = 0;
1577
- aConstraints.gridy += 1;
1578
- aConstraints.gridwidth = 1;
1823
+ cGridBag specular = new cGridBag();
1824
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1825
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1826
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1827
+ specularSection.add(specular);
15791828
1580
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1581
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1582
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1583
- aConstraints.gridx += 1;
1584
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1585
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1586
- aConstraints.gridx = 0;
1587
- aConstraints.gridy += 1;
1588
- aConstraints.gridwidth = 1;
1829
+ cGridBag lightarea = new cGridBag();
1830
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1831
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1832
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1833
+ specularSection.add(lightarea);
15891834
1590
- //aConstraints.weighty = 1;
1591
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1592
- //aConstraints.gridx += 1;
1593
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1594
- aConstraints.weighty = 0;
1595
- aConstraints.gridx = 0;
1596
- aConstraints.gridy += 1;
1597
- aConstraints.gridwidth = 1;
1835
+ cGridBag shininess = new cGridBag();
1836
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1837
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1838
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1839
+ specularSection.add(shininess);
15981840
1599
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1600
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1601
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1602
- aConstraints.gridx += 1;
1603
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1604
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1605
- aConstraints.gridx = 0;
1606
- aConstraints.gridy += 1;
1607
- aConstraints.gridwidth = 1;
1841
+ cGridBag metalness = new cGridBag();
1842
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1843
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1844
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1845
+ specularSection.add(metalness);
16081846
1609
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1610
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1611
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1612
- aConstraints.gridx += 1;
1613
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1614
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1615
- aConstraints.gridx = 0;
1616
- aConstraints.gridy += 1;
1617
- aConstraints.gridwidth = 1;
1847
+ cGridBag velvet = new cGridBag();
1848
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1849
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1850
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1851
+ specularSection.add(velvet);
16181852
1619
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1620
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1621
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1622
- aConstraints.gridx += 1;
1623
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1624
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1625
- aConstraints.gridx = 0;
1626
- aConstraints.gridy += 1;
1627
- aConstraints.gridwidth = 1;
1628
-
1629
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1630
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1631
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1632
- aConstraints.gridx += 1;
1633
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1634
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1635
- aConstraints.gridx = 0;
1636
- aConstraints.gridy += 1;
1637
- aConstraints.gridwidth = 1;
1638
-
1639
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1640
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1641
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1642
- aConstraints.gridx += 1;
1643
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1644
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1645
- aConstraints.gridx = 0;
1646
- aConstraints.gridy += 1;
1647
- aConstraints.gridwidth = 1;
1648
-
1649
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1650
- Return();
1853
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1854
+ //Return();
16511855 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16521856 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16531857 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1658,130 +1862,105 @@
16581862 // aConstraints.gridy += 1;
16591863 // aConstraints.gridwidth = 1;
16601864
1661
- //aConstraints.weighty = 1;
1662
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1663
- //aConstraints.gridx += 1;
1664
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1665
- aConstraints.weighty = 0;
1666
- aConstraints.gridx = 0;
1667
- aConstraints.gridy += 1;
1668
- aConstraints.gridwidth = 1;
1865
+ cGridBag anisoU = new cGridBag();
1866
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1867
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1868
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1869
+ specularSection.add(anisoU);
16691870
1670
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1671
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1672
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1673
- aConstraints.gridx += 1;
1674
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1675
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1676
- aConstraints.gridx = 0;
1677
- aConstraints.gridy += 1;
1678
- aConstraints.gridwidth = 1;
1871
+ cGridBag anisoV = new cGridBag();
1872
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1873
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1874
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1875
+ specularSection.add(anisoV);
16791876
1680
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1681
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1683
- aConstraints.gridx += 1;
1684
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1685
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1686
- aConstraints.gridx = 0;
1687
- aConstraints.gridy += 1;
1688
- aConstraints.gridwidth = 1;
16891877
1690
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1691
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1692
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1693
- aConstraints.gridx += 1;
1694
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1695
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1696
- aConstraints.gridx = 0;
1697
- aConstraints.gridy += 1;
1698
- aConstraints.gridwidth = 1;
1878
+ panel.add(new JSeparator());
1879
+
1880
+ panel.add(specularSection);
1881
+
1882
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1883
+
1884
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16991885
1700
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1701
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1702
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1703
- aConstraints.gridx += 1;
1704
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1705
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1706
- aConstraints.gridx = 0;
1707
- aConstraints.gridy += 1;
1708
- aConstraints.gridwidth = 1;
1709
- aConstraints.weighty = 0;
1886
+ cGridBag camera = new cGridBag();
1887
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1888
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1889
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1890
+ colorSection.add(camera);
17101891
1711
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1712
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1713
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1714
- aConstraints.gridx += 1;
1715
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1716
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1717
- aConstraints.gridx = 0;
1718
- aConstraints.gridy += 1;
1719
- aConstraints.gridwidth = 1;
1892
+ cGridBag ambient = new cGridBag();
1893
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1894
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1895
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1896
+ colorSection.add(ambient);
17201897
1721
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1722
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1723
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1724
- aConstraints.gridx += 1;
1725
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1726
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1727
- aConstraints.gridx = 0;
1728
- aConstraints.gridy += 1;
1729
- aConstraints.gridwidth = 1;
1898
+ cGridBag backlit = new cGridBag();
1899
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1900
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1901
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1902
+ colorSection.add(backlit);
17301903
1731
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1732
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1733
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1734
- aConstraints.gridx += 1;
1735
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1736
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1737
- aConstraints.gridx = 0;
1738
- aConstraints.gridy += 1;
1739
- aConstraints.gridwidth = 1;
1904
+ cGridBag opacity = new cGridBag();
1905
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1906
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1907
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1908
+ colorSection.add(opacity);
17401909
1741
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1742
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1743
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1744
- aConstraints.gridx += 1;
1745
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1746
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1747
- aConstraints.gridx = 0;
1748
- aConstraints.gridy += 1;
1749
- aConstraints.gridwidth = 1;
1910
+ //panel.add(new JSeparator());
1911
+
1912
+ //panel.add(globalSection);
1913
+
1914
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1915
+
1916
+ cGridBag textureSection = new cGridBag().setVertical(true);
17501917
1751
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1752
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1753
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1754
- aConstraints.gridx += 1;
1755
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1756
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1757
- aConstraints.gridx = 0;
1758
- aConstraints.gridy += 1;
1759
- aConstraints.gridwidth = 1;
1918
+ cGridBag bump = new cGridBag();
1919
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1920
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1921
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1922
+ textureSection.add(bump);
17601923
1761
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1762
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1763
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1764
- aConstraints.gridx += 1;
1765
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1766
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1767
- aConstraints.gridx = 0;
1768
- aConstraints.gridy += 1;
1769
- aConstraints.gridwidth = 1;
1924
+ cGridBag noise = new cGridBag();
1925
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1926
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1927
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1928
+ textureSection.add(noise);
17701929
1771
- //aConstraints.weighty = 1;
1772
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1773
- //aConstraints.gridx += 1;
1774
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1775
- aConstraints.weighty = 0;
1930
+ cGridBag power = new cGridBag();
1931
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1932
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1933
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1934
+ textureSection.add(power);
17761935
1777
- aConstraints.gridx = 0;
1778
- aConstraints.gridy = 0;
1779
- aConstraints.gridwidth = 1;
1936
+ cGridBag borderfade = new cGridBag();
1937
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1938
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1939
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1940
+ textureSection.add(borderfade);
1941
+
1942
+ cGridBag fog = new cGridBag();
1943
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1944
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1945
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1946
+ textureSection.add(fog);
1947
+
1948
+ cGridBag opacityPower = new cGridBag();
1949
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1950
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1951
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1952
+ textureSection.add(opacityPower);
1953
+
1954
+ panel.add(new JSeparator());
1955
+
1956
+ panel.add(textureSection);
1957
+
1958
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17801959
17811960 SetMaterial(copy); // .GetMaterial());
17821961
1783
- colorField.addChangeListener(this);
1784
- modulationField.addChangeListener(this);
1962
+ //colorField.addChangeListener(this);
1963
+// modulationField.addChangeListener(this);
17851964 metalnessField.addChangeListener(this);
17861965 diffuseField.addChangeListener(this);
17871966 specularField.addChangeListener(this);
....@@ -1811,12 +1990,15 @@
18111990 opacityPowerField.addChangeListener(this);
18121991 /**/
18131992
1814
- resetSlidersButton.addActionListener(this);
18151993 clearMaterialButton.addActionListener(this);
18161994 createMaterialButton.addActionListener(this);
1817
-
1818
- propagateToggle.addItemListener(this);
1819
- multiplyToggle.addItemListener(this);
1995
+
1996
+ if (Globals.ADVANCED)
1997
+ {
1998
+ resetSlidersButton.addActionListener(this);
1999
+ propagateToggle.addItemListener(this);
2000
+ multiplyToggle.addItemListener(this);
2001
+ }
18202002 }
18212003
18222004 void DropFile(java.io.File[] files, boolean textures)
....@@ -1834,8 +2016,9 @@
18342016 // 3D models
18352017 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18362018 {
1837
- lastConverter = new com.jmex.model.converters.MaxToJme();
1838
- LoadFile(filename, lastConverter);
2019
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2020
+ //LoadFile(filename, lastConverter);
2021
+ LoadObjFile(filename); // New 3ds loader
18392022 continue;
18402023 }
18412024 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1987,7 +2170,7 @@
19872170
19882171 //? flashIt = false;
19892172 CameraPane pane = (CameraPane) cameraView;
1990
- pane.clickStart(location.x, location.y, 0);
2173
+ pane.clickStart(location.x, location.y, 0, 0);
19912174 pane.clickEnd(location.x, location.y, 0, true);
19922175
19932176 if (group.selection.size() == 1)
....@@ -2036,6 +2219,7 @@
20362219 e2.printStackTrace();
20372220 }
20382221 }
2222
+
20392223 LoadJMEThread loadThread;
20402224
20412225 class LoadJMEThread extends Thread
....@@ -2093,6 +2277,7 @@
20932277 //LoadFile0(filename, converter);
20942278 }
20952279 }
2280
+
20962281 LoadOBJThread loadObjThread;
20972282
20982283 class LoadOBJThread extends Thread
....@@ -2171,19 +2356,19 @@
21712356
21722357 void LoadObjFile(String fullname)
21732358 {
2174
- /*
2359
+ System.out.println("Loading " + fullname);
2360
+ /**/
21752361 //lastFilename = fullname;
21762362 if(loadObjThread == null)
21772363 {
2178
- loadObjThread = new LoadOBJThread();
2179
- loadObjThread.start();
2364
+ loadObjThread = new LoadOBJThread();
2365
+ loadObjThread.start();
21802366 }
21812367
21822368 loadObjThread.add(fullname);
2183
- */
2369
+ /**/
21842370
2185
- System.out.println("Loading " + fullname);
2186
- makeSomething(new FileObject(fullname, true), true);
2371
+ //makeSomething(new FileObject(fullname, true), true);
21872372 }
21882373
21892374 void LoadGFDFile(String fullname)
....@@ -2444,11 +2629,11 @@
24442629
24452630 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24462631 {
2447
- if (GrafreeD.standAlone)
2632
+ if (Grafreed.standAlone)
24482633 {
24492634 /**/
24502635 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2451
- browser.show();
2636
+ browser.setVisible(true);
24522637 String filename = browser.getFile();
24532638 if (filename != null && filename.length() > 0)
24542639 {
....@@ -2559,6 +2744,7 @@
25592744 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25602745 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25612746 }
2747
+
25622748 //cJME.count++;
25632749 //cJME.count %= 12;
25642750 if (gc)
....@@ -2593,6 +2779,7 @@
25932779 }
25942780 if (input == null)
25952781 {
2782
+ new Exception().printStackTrace();
25962783 System.exit(0);
25972784 }
25982785
....@@ -2741,6 +2928,7 @@
27412928 }
27422929 }
27432930 }
2931
+
27442932 cFileSystemPane FSPane;
27452933
27462934 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2794,11 +2982,14 @@
27942982 }
27952983 }
27962984 }
2985
+
27972986 freezematerial = false;
27982987 }
27992988
28002989 void SetMaterial(Object3D object)
28012990 {
2991
+ latestObject = object;
2992
+
28022993 cMaterial mat = object.material;
28032994
28042995 if (mat == null)
....@@ -2807,7 +2998,8 @@
28072998 return;
28082999 }
28093000
2810
- multiplyToggle.setSelected(mat.multiply);
3001
+ if (multiplyToggle != null)
3002
+ multiplyToggle.setSelected(mat.multiply);
28113003
28123004 assert (object.projectedVertices != null);
28133005
....@@ -2909,12 +3101,17 @@
29093101 // }
29103102
29113103 /**/
2912
- if (deselect)
3104
+ if (deselect || child == null)
29133105 {
29143106 //group.deselectAll();
29153107 //freeze = true;
29163108 GetTree().clearSelection();
29173109 //freeze = false;
3110
+
3111
+ if (child == null)
3112
+ {
3113
+ return;
3114
+ }
29183115 }
29193116
29203117 //group.addSelectee(child);
....@@ -2983,7 +3180,7 @@
29833180 cameraView.ToggleDL();
29843181 cameraView.repaint();
29853182 return;
2986
- } else if (event.getSource() == toggleTextureItem)
3183
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29873184 {
29883185 cameraView.ToggleTexture();
29893186 // june 2013 copy.HardTouch();
....@@ -2996,7 +3193,8 @@
29963193 if (timeline)
29973194 {
29983195 centralPanel.remove(cameraView);
2999
- centralPanel.add(timelinePanel);
3196
+ cameraPanel.add(cameraView);
3197
+ centralPanel.add(cameraPanel);
30003198 frame.setJMenuBar(timelineMenubar);
30013199 wasFullScreen = CameraPane.FULLSCREEN;
30023200 if (!CameraPane.FULLSCREEN)
....@@ -3005,7 +3203,7 @@
30053203 }
30063204 else
30073205 {
3008
- centralPanel.remove(timelinePanel);
3206
+ centralPanel.remove(cameraPanel);
30093207 centralPanel.add(cameraView);
30103208 frame.setJMenuBar(null);
30113209 if (!wasFullScreen)
....@@ -3021,9 +3219,9 @@
30213219 frame.validate();
30223220
30233221 return;
3024
- } else if (event.getSource() == toggleRandomItem)
3222
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30253223 {
3026
- cameraView.ToggleRandom();
3224
+ cameraView.ToggleSwitch();
30273225 cameraView.repaint();
30283226 return;
30293227 } else if (event.getSource() == toggleHandleItem)
....@@ -3052,6 +3250,10 @@
30523250 {
30533251 copy.live ^= true;
30543252 return;
3253
+ } else if (event.getSource() == selectCB)
3254
+ {
3255
+ copy.dontselect ^= true;
3256
+ return;
30553257 } else if (event.getSource() == hideCB)
30563258 {
30573259 copy.hide ^= true;
....@@ -3066,6 +3268,7 @@
30663268 if (event.getSource() == randomCB)
30673269 {
30683270 copy.random ^= true;
3271
+ objEditor.refreshContents();
30693272 return;
30703273 }
30713274 if (event.getSource() == speedupCB)
....@@ -3089,8 +3292,9 @@
30893292
30903293 public void actionPerformed(ActionEvent event)
30913294 {
3295
+ Object source = event.getSource();
30923296 // SCRIPT DIALOG
3093
- if (event.getSource() == okbutton)
3297
+ if (source == okbutton)
30943298 {
30953299 textpanel.setVisible(false);
30963300 textpanel.remove(textarea);
....@@ -3102,7 +3306,7 @@
31023306 textarea = null;
31033307 textpanel = null;
31043308 }
3105
- if (event.getSource() == cancelbutton)
3309
+ if (source == cancelbutton)
31063310 {
31073311 textpanel.setVisible(false);
31083312 textpanel.remove(textarea);
....@@ -3114,49 +3318,50 @@
31143318 //applySelf();
31153319 //client.refreshEditWindow();
31163320 //refreshContents();
3117
- if (event.getSource() == nameField)
3321
+ if (source == nameField)
31183322 {
31193323 //System.out.println("ObjEditor " + event);
31203324 applySelf0(true);
31213325 //parent.applySelf();
31223326 objEditor.refreshContents();
3123
- } else if (event.getSource() == resetButton)
3327
+ } else if (source == resetButton)
31243328 {
31253329 CameraPane.fullreset = true;
31263330 copy.Reset(); // ResetMeshes();
31273331 copy.Touch();
31283332 objEditor.refreshContents();
3129
- } else if (event.getSource() == stepItem)
3333
+ } else if (source == stepItem)
31303334 {
3131
- cameraView.ONESTEP = true;
3335
+ //cameraView.ONESTEP = true;
3336
+ Globals.ONESTEP = true;
31323337 cameraView.repaint();
31333338 return;
3134
- } else if (event.getSource() == stepButton)
3339
+ } else if (source == stepButton)
31353340 {
31363341 copy.Step();
31373342 copy.Touch();
31383343 objEditor.refreshContents();
3139
- } else if (event.getSource() == slowerButton)
3344
+ } else if (source == slowerButton)
31403345 {
31413346 copy.Slower();
31423347 copy.Touch();
31433348 objEditor.refreshContents();
3144
- } else if (event.getSource() == fasterButton)
3349
+ } else if (source == fasterButton)
31453350 {
31463351 copy.Faster();
31473352 copy.Touch();
31483353 objEditor.refreshContents();
3149
- } else if (event.getSource() == remarkButton)
3354
+ } else if (source == remarkButton)
31503355 {
31513356 copy.Remark();
31523357 copy.Touch();
31533358 objEditor.refreshContents();
3154
- } else if (event.getSource() == stepAllButton)
3359
+ } else if (source == stepAllButton)
31553360 {
31563361 copy.StepAll();
31573362 copy.Touch();
31583363 objEditor.refreshContents();
3159
- } else if (event.getSource() == resetAllButton)
3364
+ } else if (source == resetAllButton)
31603365 {
31613366 //CameraPane.fullreset = true;
31623367 copy.ResetAll(); // ResetMeshes();
....@@ -3189,53 +3394,79 @@
31893394 // Close();
31903395 // }
31913396 // else
3192
- if (event.getSource() == resetSlidersButton)
3397
+ if (source == resetSlidersButton)
31933398 {
31943399 ResetSliders();
3195
- } else if (event.getSource() == clearMaterialButton)
3400
+ } else if (source == clearMaterialButton)
31963401 {
31973402 ClearMaterial();
3198
- } else if (event.getSource() == createMaterialButton)
3403
+ } else if (source == createMaterialButton)
31993404 {
32003405 CreateMaterial();
3201
- } else if (event.getSource() == clearPanelButton)
3406
+ } else if (source == clearPanelButton)
32023407 {
32033408 copy.ClearUI();
32043409 refreshContents(true);
3205
- } /*
3206
- }
3207
-
3208
- public boolean action(Event event, Object arg)
3209
- {
3210
- */ else if (event.getSource() == closeItem)
3410
+ } else if (source == importGFDItem)
3411
+ {
3412
+ ImportGFD();
3413
+ } else
3414
+ if (source == importVRMLX3DItem)
3415
+ {
3416
+ ImportVRMLX3D();
3417
+ } else
3418
+ if (source == import3DSItem)
3419
+ {
3420
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3421
+ } else
3422
+ if (source == importOBJItem)
3423
+ {
3424
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3425
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3426
+ browser.setVisible(true);
3427
+ String filename = browser.getFile();
3428
+ if (filename != null && filename.length() > 0)
3429
+ {
3430
+ String fullname = browser.getDirectory() + filename;
3431
+ makeSomething(ReadOBJ(fullname), true);
3432
+ }
3433
+ } else
3434
+ if (source == closeItem)
32113435 {
32123436 Close();
32133437 //return true;
3214
- } else if (event.getSource() == loadItem)
3438
+ } else if (source == openItem)
32153439 {
3216
- load();
3440
+ Open();
32173441 //return true;
3218
- } else if (event.getSource() == saveItem)
3442
+ } else if (source == newItem)
3443
+ {
3444
+ New();
3445
+ } else if (source == saveItem)
32193446 {
32203447 save();
32213448 //return true;
3222
- } else if (event.getSource() == saveAsItem)
3449
+ } else if (source == saveAsItem)
32233450 {
32243451 saveAs();
32253452 //return true;
3226
- } else if (event.getSource() == reexportItem)
3453
+ } else if (source == reexportItem)
32273454 {
32283455 reexport();
32293456 //return true;
3230
- } else if (event.getSource() == exportAsItem)
3457
+ } else if (source == exportAsItem)
32313458 {
32323459 export();
32333460 //return true;
3234
- } else if (event.getSource() == povItem)
3461
+ } else if (source == povItem)
32353462 {
32363463 generatePOV();
32373464 //return true;
3238
- } else if (event.getSource() == zBufferItem)
3465
+ } else if (event.getSource() == archiveItem)
3466
+ {
3467
+ cTools.Archive(frame);
3468
+ return;
3469
+ } else if (source == zBufferItem)
32393470 {
32403471 try
32413472 {
....@@ -3257,21 +3488,8 @@
32573488 cameraView.repaint();
32583489 //return true;
32593490 }
3260
- */ else if (event.getSource() == editCameraItem)
3261
- {
3262
- cameraView.ProtectCamera();
3263
- cameraView.repaint();
3264
- return;
3265
- } else if (event.getSource() == revertCameraItem)
3266
- {
3267
- cameraView.RevertCamera();
3268
- cameraView.repaint();
3269
- return;
3270
-// } else if (event.getSource() == textureButton)
3271
-// {
3272
-// return; // true;
3273
- } else // combos...
3274
- if (event.getSource() == texresMenu)
3491
+ */ else // combos...
3492
+ if (source == texresMenu)
32753493 {
32763494 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32773495 copy.texres = texresMenu.getSelectedIndex();
....@@ -3283,27 +3501,424 @@
32833501 }
32843502 }
32853503
3286
- void ToggleAnimation()
3504
+ void New()
32873505 {
3288
- if (!CameraPane.ANIMATION)
3506
+ while (copy.Size() > 1)
32893507 {
3290
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3508
+ copy.remove(1);
3509
+ }
3510
+
3511
+ ResetModel();
3512
+ objEditor.refreshContents();
3513
+ }
3514
+
3515
+ static public byte[] Compress(Object3D o)
3516
+ {
3517
+ try
3518
+ {
3519
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3520
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3521
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
3522
+
3523
+ Object3D parent = o.parent;
3524
+ o.parent = null;
3525
+
3526
+ out.writeObject(o);
3527
+
3528
+ o.parent = parent;
3529
+
3530
+ out.flush();
3531
+
3532
+ baos //zstream
3533
+ .close();
3534
+ out.close();
3535
+
3536
+ byte[] bytes = baos.toByteArray();
3537
+
3538
+ System.out.println("save #bytes = " + bytes.length);
3539
+ return bytes;
3540
+ } catch (Exception e)
3541
+ {
3542
+ System.err.println(e);
3543
+ return null;
3544
+ }
3545
+ }
3546
+
3547
+ static public Object Uncompress(byte[] bytes)
3548
+ {
3549
+ System.out.println("restore #bytes = " + bytes.length);
3550
+ try
3551
+ {
3552
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3553
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3554
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
3555
+ Object obj = in.readObject();
3556
+
3557
+ bais //istream
3558
+ .close();
3559
+ in.close();
3560
+
3561
+ return obj;
3562
+ } catch (Exception e)
3563
+ {
3564
+ System.err.println(e);
3565
+ return null;
3566
+ }
3567
+ }
3568
+
3569
+ static public Object clone(Object o)
3570
+ {
3571
+ try
3572
+ {
3573
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3574
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3575
+
3576
+ out.writeObject(o);
3577
+
3578
+ out.flush();
3579
+ out.close();
3580
+
3581
+ byte[] bytes = baos.toByteArray();
3582
+
3583
+ System.out.println("clone = " + bytes.length);
3584
+
3585
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3586
+ ObjectInputStream in = new ObjectInputStream(bais);
3587
+ Object obj = in.readObject();
3588
+ in.close();
3589
+
3590
+ return obj;
3591
+ } catch (Exception e)
3592
+ {
3593
+ System.err.println(e);
3594
+ return null;
3595
+ }
3596
+ }
3597
+
3598
+ cRadio GetCurrentTab()
3599
+ {
3600
+ cRadio ab;
3601
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3602
+ {
3603
+ ab = (cRadio)e.nextElement();
3604
+ if(ab.GetObject() == copy)
3605
+ {
3606
+ return ab;
3607
+ }
3608
+ }
3609
+
3610
+ return null;
3611
+ }
3612
+
3613
+
3614
+ public void Save()
3615
+ {
3616
+ //Save(true);
3617
+ Replace();
3618
+ }
3619
+
3620
+ private boolean Equal(byte[] compress, byte[] name)
3621
+ {
3622
+ if (compress.length != name.length)
3623
+ {
3624
+ return false;
3625
+ }
3626
+
3627
+ for (int i=compress.length; --i>=0;)
3628
+ {
3629
+ if (compress[i] != name[i])
3630
+ return false;
3631
+ }
3632
+
3633
+ return true;
3634
+ }
3635
+
3636
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3637
+
3638
+ public boolean Save(boolean user)
3639
+ {
3640
+ System.err.println("Save");
3641
+
3642
+ cRadio tab = GetCurrentTab();
3643
+
3644
+ byte[] compress = CompressCopy();
3645
+
3646
+ boolean thesame = false;
3647
+
3648
+ // Quick heuristic using length. Works only when stream is compressed.
3649
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3650
+ {
3651
+ thesame = true;
3652
+ }
3653
+
3654
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3655
+ if (!thesame)
3656
+ {
3657
+ //tab.user[tab.versionindex] = user;
3658
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3659
+
3660
+ copy.versions[++copy.versionindex] = compress;
3661
+
3662
+ // if (increment)
3663
+ // tab.versionindex++;
3664
+ }
3665
+
3666
+ //copy.RestoreBigData(versiontable);
3667
+
3668
+ //assert(hashtable.isEmpty());
3669
+
3670
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3671
+ {
3672
+ //tab.user[i] = false;
3673
+ copy.versions[i] = null;
3674
+ }
3675
+
3676
+ SetUndoStates();
3677
+
3678
+ // test save
3679
+ if (false)
3680
+ {
3681
+ try
3682
+ {
3683
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
3684
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3685
+
3686
+ p.writeObject(copy);
3687
+
3688
+ p.flush();
3689
+
3690
+ ostream.close();
3691
+ } catch (Exception e)
3692
+ {
3693
+ e.printStackTrace();
3694
+ }
3695
+ }
3696
+
3697
+ return !thesame;
3698
+ }
3699
+
3700
+ void CopyChanged(Object3D obj)
3701
+ {
3702
+ SetUndoStates();
3703
+
3704
+ boolean temp = CameraPane.SWITCH;
3705
+ CameraPane.SWITCH = false;
3706
+
3707
+ copy.ExtractBigData(versiontable);
3708
+
3709
+ copy.clear();
3710
+
3711
+ for (int i=0; i<obj.Size(); i++)
3712
+ {
3713
+ copy.add(obj.get(i));
3714
+ }
3715
+
3716
+ copy.RestoreBigData(versiontable);
3717
+
3718
+ CameraPane.SWITCH = temp;
3719
+
3720
+ //assert(hashtable.isEmpty());
3721
+
3722
+ copy.Touch();
3723
+
3724
+ ResetModel();
3725
+ copy.HardTouch(); // recompile?
3726
+
3727
+ cRadio ab;
3728
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3729
+ {
3730
+ ab = (cRadio)e.nextElement();
3731
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3732
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3733
+ if (test != null)
3734
+ {
3735
+ test.editWindow = ab.object.editWindow;
3736
+ ab.object = test;
3737
+ }
3738
+ }
3739
+
3740
+ refreshContents();
3741
+ }
3742
+
3743
+ cButton undoButton;
3744
+ cButton restoreButton;
3745
+ cButton replaceButton;
3746
+ cButton redoButton;
3747
+
3748
+ boolean muteSlider;
3749
+
3750
+ int VersionCount()
3751
+ {
3752
+ int count = 0;
3753
+
3754
+ for (int i = copy.versions.length; --i >= 0;)
3755
+ {
3756
+ if (copy.versions[i] != null)
3757
+ count++;
3758
+ }
3759
+
3760
+ return count;
3761
+ }
3762
+
3763
+ void SetUndoStates()
3764
+ {
3765
+ cRadio tab = GetCurrentTab();
3766
+
3767
+ restoreButton.setEnabled(copy.versionindex != -1);
3768
+ replaceButton.setEnabled(copy.versionindex != -1);
3769
+
3770
+ undoButton.setEnabled(copy.versionindex > 0);
3771
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3772
+
3773
+ muteSlider = true;
3774
+ versionSlider.setMaximum(VersionCount() - 1);
3775
+ versionSlider.setInteger(copy.versionindex);
3776
+ muteSlider = false;
3777
+ }
3778
+
3779
+ public boolean Undo()
3780
+ {
3781
+ // Option?
3782
+ Replace();
3783
+
3784
+ System.err.println("Undo");
3785
+
3786
+ cRadio tab = GetCurrentTab();
3787
+
3788
+ if (copy.versionindex == 0)
3789
+ {
3790
+ java.awt.Toolkit.getDefaultToolkit().beep();
3791
+ return false;
3792
+ }
3793
+
3794
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3795
+// {
3796
+// if (Save(false))
3797
+// tab.versionindex -= 1;
3798
+// else
3799
+// {
3800
+// if (tab.versionindex <= 0)
3801
+// return false;
3802
+// else
3803
+// tab.versionindex -= 1;
3804
+// }
3805
+// }
3806
+
3807
+ copy.versionindex -= 1;
3808
+
3809
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3810
+
3811
+ return true;
3812
+ }
3813
+
3814
+ public boolean Restore()
3815
+ {
3816
+ System.err.println("Restore");
3817
+
3818
+ cRadio tab = GetCurrentTab();
3819
+
3820
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3821
+ {
3822
+ java.awt.Toolkit.getDefaultToolkit().beep();
3823
+ return false;
3824
+ }
3825
+
3826
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3827
+
3828
+ return true;
3829
+ }
3830
+
3831
+ public boolean Replace()
3832
+ {
3833
+ System.err.println("Replace");
3834
+
3835
+ cRadio tab = GetCurrentTab();
3836
+
3837
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3838
+ {
3839
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3840
+ return false;
3841
+ }
3842
+
3843
+ copy.versions[copy.versionindex] = CompressCopy();
3844
+
3845
+ return true;
3846
+ }
3847
+
3848
+ public void Redo()
3849
+ {
3850
+ // Option?
3851
+ Replace();
3852
+
3853
+ cRadio tab = GetCurrentTab();
3854
+
3855
+ if (copy.versions[copy.versionindex + 1] == null)
3856
+ {
3857
+ java.awt.Toolkit.getDefaultToolkit().beep();
3858
+ return;
3859
+ }
3860
+
3861
+ copy.versionindex += 1;
3862
+
3863
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3864
+
3865
+ //if (!tab.user[tab.versionindex])
3866
+ // tab.graphs[tab.versionindex] = null;
3867
+ }
3868
+
3869
+ void ImportGFD()
3870
+ {
3871
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32913872 browser.show();
32923873 String filename = browser.getFile();
32933874 if (filename != null && filename.length() > 0)
32943875 {
3295
- CameraPane.filename = browser.getDirectory() + filename;
3876
+ String fullname = browser.getDirectory() + filename;
3877
+
3878
+ //Object3D readobj =
3879
+ objEditor.ReadGFD(fullname, objEditor);
3880
+ //makeSomething(readobj);
3881
+ }
3882
+ }
3883
+
3884
+ void ImportVRMLX3D()
3885
+ {
3886
+ if (Grafreed.standAlone)
3887
+ {
3888
+ /**/
3889
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3890
+ browser.show();
3891
+ String filename = browser.getFile();
3892
+ if (filename != null && filename.length() > 0)
3893
+ {
3894
+ String fullname = browser.getDirectory() + filename;
3895
+ LoadVRMLX3D(fullname);
3896
+ }
3897
+ /**/
3898
+ }
3899
+ }
3900
+
3901
+ void ToggleAnimation()
3902
+ {
3903
+ if (!Globals.ANIMATION)
3904
+ {
3905
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3906
+ browser.setVisible(true);
3907
+ String filename = browser.getFile();
3908
+ if (filename != null && filename.length() > 0)
3909
+ {
3910
+ Globals.filename = browser.getDirectory() + filename;
32963911 //CameraPane.framecount = 0;
3297
- CameraPane.imagecount = 0;
3912
+ Globals.imagecount = 0;
32983913
3299
- CameraPane.ANIMATION ^= true;
3914
+ Globals.ANIMATION ^= true;
33003915
3301
- GrafreeD.wav.cursor = 0;
3302
- GrafreeD.wav.loop = 0;
3916
+ Grafreed.wav.cursor = 0;
3917
+ Grafreed.wav.loop = 0;
33033918 }
33043919 } else
33053920 {
3306
- CameraPane.ANIMATION ^= true;
3921
+ Globals.ANIMATION ^= true;
33073922 }
33083923 }
33093924
....@@ -3349,7 +3964,7 @@
33493964 void CreateMaterial()
33503965 {
33513966 //copy.ClearMaterial(); // PATCH
3352
- copy.CreateMaterialS(multiplyToggle.isSelected());
3967
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33533968 if (copy.selection.size() > 0)
33543969 //SetMaterial(copy);
33553970 {
....@@ -3400,7 +4015,7 @@
34004015 assert false;
34014016 }
34024017
3403
- void EditSelection()
4018
+ void EditSelection(boolean newWindow)
34044019 {
34054020 }
34064021
....@@ -3408,11 +4023,11 @@
34084023 {
34094024 copy.ResetBlockLoop(); // temporary problem
34104025
3411
- boolean random = CameraPane.RANDOM;
3412
- CameraPane.RANDOM = false; // parse everything
4026
+ boolean random = CameraPane.SWITCH;
4027
+ CameraPane.SWITCH = false; // parse everything
34134028 copy.ResetDisplayList();
34144029 copy.HardTouch();
3415
- CameraPane.RANDOM = random;
4030
+ CameraPane.SWITCH = random;
34164031 }
34174032
34184033 // public void applySelf()
....@@ -3482,10 +4097,40 @@
34824097 current.fakedepth = (float) fakedepthField.getFloat();
34834098 current.shadowbias = (float) shadowbiasField.getFloat();
34844099
3485
- if (!NumberSlider.frozen)
4100
+ if (!cNumberSlider.frozen)
34864101 {
34874102 //System.out.println("Propagate = " + propagate);
34884103 copy.UpdateMaterial(anchor, current, propagate);
4104
+
4105
+ if (copy.material != null)
4106
+ {
4107
+ cMaterial mat = copy.material;
4108
+
4109
+ colorField.SetToolTipValue((mat.color));
4110
+ modulationField.SetToolTipValue((mat.modulation));
4111
+ metalnessField.SetToolTipValue((mat.metalness));
4112
+ diffuseField.SetToolTipValue((mat.diffuse));
4113
+ specularField.SetToolTipValue((mat.specular));
4114
+ shininessField.SetToolTipValue((mat.shininess));
4115
+ shiftField.SetToolTipValue((mat.shift));
4116
+ ambientField.SetToolTipValue((mat.ambient));
4117
+ lightareaField.SetToolTipValue((mat.lightarea));
4118
+ diffusenessField.SetToolTipValue((mat.factor));
4119
+ velvetField.SetToolTipValue((mat.velvet));
4120
+ sheenField.SetToolTipValue((mat.sheen));
4121
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4122
+ backlitField.SetToolTipValue((mat.bump));
4123
+ anisoField.SetToolTipValue((mat.aniso));
4124
+ anisoVField.SetToolTipValue((mat.anisoV));
4125
+ cameraField.SetToolTipValue((mat.cameralight));
4126
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4127
+ shadowField.SetToolTipValue((mat.shadow));
4128
+ textureField.SetToolTipValue((mat.texture));
4129
+ opacityField.SetToolTipValue((mat.opacity));
4130
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4131
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4132
+ }
4133
+
34894134 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34904135 {
34914136 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3514,9 +4159,25 @@
35144159 //copy.Touch();
35154160 }
35164161
4162
+ cNumberSlider versionSlider;
4163
+
35174164 public void stateChanged(ChangeEvent e)
35184165 {
35194166 // assert(false);
4167
+ if (e.getSource() == versionSlider)
4168
+ {
4169
+ if (muteSlider)
4170
+ return;
4171
+
4172
+ int version = versionSlider.getInteger();
4173
+
4174
+ if (copy.versions[version] != null)
4175
+ {
4176
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4177
+ }
4178
+
4179
+ return;
4180
+ }
35204181
35214182 if (freezematerial)
35224183 {
....@@ -3530,6 +4191,7 @@
35304191 || e.getSource() == apertureField
35314192 || e.getSource() == shadowblurField)
35324193 {
4194
+ new Exception().printStackTrace();
35334195 System.exit(0);
35344196 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35354197 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3600,7 +4262,7 @@
36004262 }
36014263
36024264 if (normalpushField != null)
3603
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
4265
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36044266 }
36054267
36064268 void SnapObject()
....@@ -3855,7 +4517,7 @@
38554517
38564518 radioPanel.revalidate();
38574519 radioPanel.repaint();
3858
- ctrlPanel.revalidate(); // ? new
4520
+ ctrlPanel.validate(); // ? new
38594521 ctrlPanel.repaint();
38604522 }
38614523 }
....@@ -3864,6 +4526,8 @@
38644526
38654527 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38664528 {
4529
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4530
+ Save();
38674531 //Tween.set(thing, 0).target(1).start(tweenManager);
38684532 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38694533 // if (thing instanceof GenericJointDemo)
....@@ -3950,6 +4614,12 @@
39504614 {
39514615 ResetModel();
39524616 Select(thing.GetTreePath(), true, false); // unselect... false);
4617
+
4618
+ if (thing.Size() == 0)
4619
+ {
4620
+ //EditSelection(false);
4621
+ }
4622
+
39534623 refreshContents();
39544624 }
39554625
....@@ -4067,6 +4737,7 @@
40674737 }
40684738 }
40694739 }
4740
+
40704741 LoadGFDThread loadGFDThread;
40714742
40724743 void ReadGFD(String fullname, iCallBack cb)
....@@ -4086,8 +4757,10 @@
40864757
40874758 try
40884759 {
4760
+ // Try compressed version first.
40894761 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4090
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4762
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4763
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40914764
40924765 readobj = (Object3D) p.readObject();
40934766 istream.close();
....@@ -4095,7 +4768,20 @@
40954768 readobj.ResetDisplayList();
40964769 } catch (Exception e)
40974770 {
4098
- e.printStackTrace();
4771
+ //e.printStackTrace();
4772
+ try
4773
+ {
4774
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4775
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4776
+
4777
+ readobj = (Object3D) p.readObject();
4778
+ istream.close();
4779
+
4780
+ readobj.ResetDisplayList();
4781
+ } catch (Exception e2)
4782
+ {
4783
+ e2.printStackTrace();
4784
+ }
40994785 }
41004786 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41014787 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4141,6 +4827,12 @@
41414827
41424828 void LoadIt(Object obj)
41434829 {
4830
+ if (obj == null)
4831
+ {
4832
+ // Invalid file
4833
+ return;
4834
+ }
4835
+
41444836 System.out.println("Loaded " + obj);
41454837 //new Exception().printStackTrace();
41464838 Object3D readobj = (Object3D) obj;
....@@ -4150,6 +4842,8 @@
41504842
41514843 if (readobj != null)
41524844 {
4845
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4846
+ // Save();
41534847 try
41544848 {
41554849 //readobj.deepCopySelf(copy);
....@@ -4204,15 +4898,26 @@
42044898 c.addChild(csg);
42054899 }
42064900
4901
+ copy.versions = readobj.versions;
4902
+ copy.versionindex = readobj.versionindex;
4903
+
4904
+ if (copy.versions == null)
4905
+ {
4906
+ copy.versions = new byte[100][];
4907
+ copy.versionindex = -1;
4908
+ }
4909
+
4910
+ //? SetUndoStates();
4911
+
42074912 ResetModel();
42084913 copy.HardTouch(); // recompile?
42094914 refreshContents();
42104915 }
42114916 }
42124917
4213
- void load() // throws ClassNotFoundException
4918
+ void Open() // throws ClassNotFoundException
42144919 {
4215
- if (GrafreeD.standAlone)
4920
+ if (Grafreed.standAlone)
42164921 {
42174922 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42184923 browser.show();
....@@ -4299,11 +5004,13 @@
42995004 try
43005005 {
43015006 FileOutputStream ostream = new FileOutputStream(lastname);
4302
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5007
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5008
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43035009
43045010 p.writeObject(copy);
43055011 p.flush();
43065012
5013
+ zstream.close();
43075014 ostream.close();
43085015
43095016 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4313,17 +5020,20 @@
43135020 {
43145021 }
43155022 }
5023
+
43165024 String lastname;
43175025
43185026 void saveAs()
43195027 {
4320
- if (GrafreeD.standAlone)
5028
+ if (Grafreed.standAlone)
43215029 {
43225030 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43235031 browser.setVisible(true);
43245032 String filename = browser.getFile();
43255033 if (filename != null && filename.length() > 0)
43265034 {
5035
+ if (!filename.endsWith(".gfd"))
5036
+ filename += ".gfd";
43275037 lastname = browser.getDirectory() + filename;
43285038 save();
43295039 }
....@@ -4422,13 +5132,13 @@
44225132 try
44235133 {
44245134 FileOutputStream ostream = new FileOutputStream(filename);
4425
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4426
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5135
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5136
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44275137
44285138 Object3D objectparent = obj.parent;
44295139 obj.parent = null;
44305140
4431
- Object3D object = (Object3D) GrafreeD.clone(obj);
5141
+ Object3D object = (Object3D) Grafreed.clone(obj);
44325142
44335143 obj.parent = objectparent;
44345144
....@@ -4440,8 +5150,8 @@
44405150 p.writeObject(object);
44415151 p.flush();
44425152
5153
+ zstream.close();
44435154 ostream.close();
4444
- // zstream.close();
44455155
44465156 // group.selection.get(0).parent = parent;
44475157 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4462,7 +5172,7 @@
44625172 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44635173 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44645174 copy.generatePOV(buffer);
4465
- if (GrafreeD.standAlone)
5175
+ if (Grafreed.standAlone)
44665176 {
44675177 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44685178 browser.show();
....@@ -4488,21 +5198,20 @@
44885198 Object3D client;
44895199 Object3D copy;
44905200 MenuBar menuBar;
4491
- Menu windowMenu;
4492
- MenuItem loadItem;
5201
+ Menu fileMenu;
5202
+ MenuItem newItem;
5203
+ MenuItem openItem;
44935204 MenuItem saveItem;
44945205 MenuItem saveAsItem;
44955206 MenuItem exportAsItem;
44965207 MenuItem reexportItem;
44975208 MenuItem povItem;
44985209 MenuItem closeItem;
4499
- Menu cameraMenu;
5210
+
45005211 CheckboxMenuItem zBufferItem;
45015212 //MenuItem normalLensItem;
4502
- MenuItem editCameraItem;
4503
- MenuItem revertCameraItem;
4504
- CheckboxMenuItem toggleLiveItem;
45055213 MenuItem stepItem;
5214
+ CheckboxMenuItem toggleLiveItem;
45065215 CheckboxMenuItem toggleFullScreenItem;
45075216 CheckboxMenuItem toggleTimelineItem;
45085217 CheckboxMenuItem toggleRenderItem;
....@@ -4511,28 +5220,43 @@
45115220 CheckboxMenuItem toggleFootContactItem;
45125221 CheckboxMenuItem toggleDLItem;
45135222 CheckboxMenuItem toggleTextureItem;
4514
- CheckboxMenuItem toggleRandomItem;
5223
+ CheckboxMenuItem toggleSwitchItem;
45155224 CheckboxMenuItem toggleRootItem;
45165225 CheckboxMenuItem animationItem;
5226
+ MenuItem archiveItem;
45175227 CheckboxMenuItem toggleHandleItem;
45185228 CheckboxMenuItem togglePaintItem;
45195229 JSplitPane mainPanel;
45205230 JScrollPane scrollpane;
5231
+
45215232 JPanel toolbarPanel;
4522
- JPanel treePanel;
5233
+
5234
+ cGridBag treePanel;
5235
+
45235236 JPanel radioPanel;
45245237 ButtonGroup buttonGroup;
4525
- JPanel ctrlPanel;
4526
- JPanel materialPanel;
5238
+
5239
+ cGridBag toolboxPanel;
5240
+ cGridBag materialPanel;
5241
+ cGridBag ctrlPanel;
5242
+
45275243 JScrollPane infoPanel;
4528
- JPanel optionsPanel;
5244
+
5245
+ cGridBag optionsPanel;
5246
+
45295247 JTabbedPane objectPanel;
4530
- JPanel XYZPanel;
5248
+ boolean materialFlushed;
5249
+ Object3D latestObject;
5250
+
5251
+ cGridBag XYZPanel;
5252
+
45315253 JSplitPane gridPanel;
45325254 JSplitPane bigPanel;
4533
- JPanel bigThree;
4534
- JTabbedPane scenePanel;
4535
- JPanel centralPanel;
5255
+
5256
+ cGridBag bigThree;
5257
+ cGridBag scenePanel;
5258
+ cGridBag centralPanel;
5259
+ JSplitPane cameraPanel;
45365260 JPanel timelinePanel;
45375261 JMenuBar timelineMenubar;
45385262 JSplitPane framePanel;
....@@ -4584,67 +5308,72 @@
45845308 // MATERIAL
45855309 JLabel materialLabel;
45865310 JLabel colorLabel;
4587
- NumberSlider colorField;
5311
+ cNumberSlider colorField;
45885312 JLabel modulationLabel;
4589
- NumberSlider modulationField;
5313
+ cNumberSlider modulationField;
45905314 JLabel metalnessLabel;
4591
- NumberSlider metalnessField;
5315
+ cNumberSlider metalnessField;
45925316 JLabel diffuseLabel;
4593
- NumberSlider diffuseField;
5317
+ cNumberSlider diffuseField;
45945318 JLabel specularLabel;
4595
- NumberSlider specularField;
5319
+ cNumberSlider specularField;
45965320 JLabel shininessLabel;
4597
- NumberSlider shininessField;
5321
+ cNumberSlider shininessField;
45985322 JLabel shiftLabel;
4599
- NumberSlider shiftField;
5323
+ cNumberSlider shiftField;
46005324 JLabel ambientLabel;
4601
- NumberSlider ambientField;
5325
+ cNumberSlider ambientField;
46025326 JLabel lightareaLabel;
4603
- NumberSlider lightareaField;
5327
+ cNumberSlider lightareaField;
46045328 JLabel diffusenessLabel;
4605
- NumberSlider diffusenessField;
5329
+ cNumberSlider diffusenessField;
46065330 JLabel velvetLabel;
4607
- NumberSlider velvetField;
5331
+ cNumberSlider velvetField;
46085332 JLabel sheenLabel;
4609
- NumberSlider sheenField;
5333
+ cNumberSlider sheenField;
46105334 JLabel subsurfaceLabel;
4611
- NumberSlider subsurfaceField;
5335
+ cNumberSlider subsurfaceField;
46125336 //JLabel bumpLabel;
46135337 //NumberSlider bumpField;
46145338 JLabel backlitLabel;
4615
- NumberSlider backlitField;
5339
+ cNumberSlider backlitField;
46165340 JLabel anisoLabel;
4617
- NumberSlider anisoField;
5341
+ cNumberSlider anisoField;
46185342 JLabel anisoVLabel;
4619
- NumberSlider anisoVField;
5343
+ cNumberSlider anisoVField;
46205344 JLabel cameraLabel;
4621
- NumberSlider cameraField;
5345
+ cNumberSlider cameraField;
46225346 JLabel selfshadowLabel;
4623
- NumberSlider selfshadowField;
5347
+ cNumberSlider selfshadowField;
46245348 JLabel shadowLabel;
4625
- NumberSlider shadowField;
5349
+ cNumberSlider shadowField;
46265350 JLabel textureLabel;
4627
- NumberSlider textureField;
5351
+ cNumberSlider textureField;
46285352 JLabel opacityLabel;
4629
- NumberSlider opacityField;
5353
+ cNumberSlider opacityField;
46305354 JLabel fakedepthLabel;
4631
- NumberSlider fakedepthField;
5355
+ cNumberSlider fakedepthField;
46325356 JLabel shadowbiasLabel;
4633
- NumberSlider shadowbiasField;
5357
+ cNumberSlider shadowbiasField;
46345358 JLabel bumpLabel;
4635
- NumberSlider bumpField;
5359
+ cNumberSlider bumpField;
46365360 JLabel noiseLabel;
4637
- NumberSlider noiseField;
5361
+ cNumberSlider noiseField;
46385362 JLabel powerLabel;
4639
- NumberSlider powerField;
5363
+ cNumberSlider powerField;
46405364 JLabel borderfadeLabel;
4641
- NumberSlider borderfadeField;
5365
+ cNumberSlider borderfadeField;
46425366 JLabel fogLabel;
4643
- NumberSlider fogField;
5367
+ cNumberSlider fogField;
46445368 JLabel opacityPowerLabel;
4645
- NumberSlider opacityPowerField;
4646
- JTree jTree;
5369
+ cNumberSlider opacityPowerField;
5370
+ cTree jTree;
46475371 //ObjectUI parent;
46485372
4649
- NumberSlider normalpushField;
5373
+ cNumberSlider normalpushField;
5374
+
5375
+ private MenuItem importGFDItem;
5376
+ private MenuItem importVRMLX3DItem;
5377
+ private MenuItem import3DSItem;
5378
+ private MenuItem importOBJItem;
46505379 }