Normand Briere
2019-07-27 1af7d3700724834e40ad8636bc9a56cdc3b19b15
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,51 +177,62 @@
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);
220
+
221
+ objEditor.ctrlPanel.remove(setupPanel);
222
+ objEditor.ctrlPanel.remove(setupPanel2);
223
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
224
+ objEditor.ctrlPanel.remove(pushPanel);
225
+ //objEditor.ctrlPanel.remove(fillPanel);
226
+
227
+ //Remove(normalpushField);
163228 }
164229
165230 public ObjEditor GetEditor()
166231 {
167232 return objEditor; //.GetEditor();
168233 }
234
+
235
+ // Sometimes myself, sometimes my callee's.
169236 ObjEditor objEditor;
170237
171238 /*
....@@ -201,6 +268,12 @@
201268 client = inClient;
202269 copy = client;
203270
271
+ if (copy.versions == null)
272
+ {
273
+ copy.versions = new byte[100][];
274
+ copy.versionindex = -1;
275
+ }
276
+
204277 // "this" is not called: SetupUI2(objEditor);
205278 }
206279
....@@ -214,6 +287,12 @@
214287 client = inClient;
215288 copy = client;
216289
290
+ if (copy.versions == null)
291
+ {
292
+ copy.versions = new byte[100][];
293
+ copy.versionindex = -1;
294
+ }
295
+
217296 SetupUI2(callee.GetEditor());
218297 }
219298
....@@ -228,6 +307,7 @@
228307 //localCopy.parent = null;
229308
230309 frame = new JFrame();
310
+ frame.setUndecorated(false);
231311 objEditor = this;
232312 this.callee = callee;
233313
....@@ -245,6 +325,12 @@
245325 copy = localCopy;
246326 copy.editWindow = this;
247327
328
+ if (copy.versions == null)
329
+ {
330
+// copy.versions = new byte[100][];
331
+// copy.versionindex = -1;
332
+ }
333
+
248334 SetupMenu();
249335
250336 //SetupName(objEditor); // new
....@@ -258,28 +344,49 @@
258344 return frame.action(event, obj);
259345 }
260346
347
+ // Cannot work without static
348
+ static boolean allparams = true;
349
+
350
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
351
+
261352 void SetupMenu()
262353 {
263354 frame.setMenuBar(menuBar = new MenuBar());
264
- menuBar.add(windowMenu = new Menu("File"));
265
- windowMenu.add(loadItem = new MenuItem("Load..."));
266
- windowMenu.add("-");
267
- windowMenu.add(saveItem = new MenuItem("Save"));
268
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
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..."));
269375 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
270
- windowMenu.add("-");
271
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
272
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
273
- windowMenu.add("-");
376
+ fileMenu.add("-");
377
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
378
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
379
+ fileMenu.add("-");
274380 if (client.parent != null)
275381 {
276
- windowMenu.add(closeItem = new MenuItem("Close"));
382
+ fileMenu.add(closeItem = new MenuItem("Close"));
277383 } else
278384 {
279
- windowMenu.add(closeItem = new MenuItem("Exit"));
385
+ fileMenu.add(closeItem = new MenuItem("Exit"));
280386 }
281387
282
- loadItem.addActionListener(this);
388
+ newItem.addActionListener(this);
389
+ openItem.addActionListener(this);
283390 saveItem.addActionListener(this);
284391 saveAsItem.addActionListener(this);
285392 exportAsItem.addActionListener(this);
....@@ -287,82 +394,69 @@
287394 //povItem.addActionListener(this);
288395 closeItem.addActionListener(this);
289396
290
- menuBar.add(cameraMenu = new Menu("View"));
291
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
292
- //zBufferItem.addActionListener(this);
293
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
294
- //normalLensItem.addActionListener(this);
295
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
296
- revertCameraItem.addActionListener(this);
297
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
298
- toggleTimelineItem.addItemListener(this);
299
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
300
- toggleFullScreenItem.addItemListener(this);
301
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
302
- cameraMenu.add("-");
303
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
304
- toggleTextureItem.addItemListener(this);
305
- toggleTextureItem.setState(CameraPane.textureon);
306
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
307
- toggleLiveItem.addItemListener(this);
308
- toggleLiveItem.setState(CameraPane.isLIVE());
309
- cameraMenu.add(stepItem = new MenuItem("Step"));
310
- stepItem.addActionListener(this);
311
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
312
-// toggleDLItem.addItemListener(this);
313
-// toggleDLItem.setState(false);
314
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
315
- toggleRenderItem.addItemListener(this);
316
- toggleRenderItem.setState(!CameraPane.frozen);
317
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
318
- toggleDebugItem.addItemListener(this);
319
- toggleDebugItem.setState(CameraPane.DEBUG);
320
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
321
- toggleFrustumItem.addItemListener(this);
322
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
323
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
324
- toggleFootContactItem.addItemListener(this);
325
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
326
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
327
- toggleRandomItem.addItemListener(this);
328
- toggleRandomItem.setState(CameraPane.RANDOM);
329
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
330
- toggleHandleItem.addItemListener(this);
331
- toggleHandleItem.setState(CameraPane.HANDLES);
332
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
333
- togglePaintItem.addItemListener(this);
334
- togglePaintItem.setState(CameraPane.PAINTMODE);
335
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
336
-// toggleRootItem.addItemListener(this);
337
-// toggleRootItem.setState(false);
338
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
339
-// animationItem.addItemListener(this);
340
-// animationItem.setState(CameraPane.ANIMATION);
341
- cameraMenu.add("-");
342
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
343
- editCameraItem.addActionListener(this);
344
-
345397 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
+
346424 toolbarPanel = new JPanel();
347425 toolbarPanel.setName("Toolbar");
348
- treePanel = new JPanel();
426
+
427
+ treePanel = new cGridBag();
349428 treePanel.setName("Tree");
350
- ctrlPanel = new JPanel(); // new GridBagLayout());
351
- ctrlPanel.setName("Edit");
352
- materialPanel = new JPanel();
353
- 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
+
354445 /*JTextPane*/
355446 infoarea = createTextPane();
447
+ doc = infoarea.getStyledDocument();
448
+
356449 infoarea.setEditable(true);
357450 SetText();
451
+
358452 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
359453 // infoarea.setOpaque(false);
360454 // //infoarea.setForeground(textcolor);
361
- infoarea.setLineWrap(true);
362
- infoarea.setWrapStyleWord(true);
455
+// TEXTAREA infoarea.setLineWrap(true);
456
+// TEXTAREA infoarea.setWrapStyleWord(true);
363457 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
364
- infoPanel.setPreferredSize(new Dimension(50, 200));
365
- infoPanel.setName("Info");
458
+ infoPanel.setPreferredSize(new Dimension(1, 1));
459
+ //infoPanel.setName("Info");
366460 //infoPanel.setLayout(new BorderLayout());
367461 //infoPanel.add(createTextPane());
368462
....@@ -370,16 +464,23 @@
370464 mainPanel.setName("Main");
371465 mainPanel.setContinuousLayout(true);
372466 mainPanel.setOneTouchExpandable(true);
373
- mainPanel.setDividerLocation(1.0);
374467 mainPanel.setDividerSize(9);
375
- mainPanel.setResizeWeight(0);
376
-
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
+
377478 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
378479 //mainPanel.setLayout(new GridBagLayout());
379480 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
380
- treePanel.setLayout(new GridBagLayout());
381
- ctrlPanel.setLayout(new GridBagLayout());
382
- materialPanel.setLayout(new GridBagLayout());
481
+// treePanel.setLayout(new GridBagLayout());
482
+ //ctrlPanel.setLayout(new GridBagLayout());
483
+ //materialPanel.setLayout(new GridBagLayout());
383484
384485 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
385486 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -418,7 +519,7 @@
418519 static String newline = "\n";
419520 protected static final String buttonString = "JButton";
420521 StyledDocument doc;
421
- JTextArea infoarea;
522
+ JTextPane infoarea;
422523
423524 void ClearInfo()
424525 {
....@@ -441,10 +542,10 @@
441542 e.printStackTrace();
442543 }
443544
444
- String selection = infoarea.getText();
445
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
446
- java.awt.datatransfer.Clipboard clipboard =
447
- Toolkit.getDefaultToolkit().getSystemClipboard();
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();
448549 //clipboard.setContents(data, data);
449550 }
450551
....@@ -467,13 +568,13 @@
467568 //SendInfo("Name:", "bold");
468569 if (sel.GetTextures() != null || debug)
469570 {
470
- si.SendInfo(sel.toString(), "bold");
571
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
471572 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
472573 if (sel.Size() > 0)
473574 {
474575 si.SendInfo("#children = " + sel.Size(), "regular");
475576 }
476
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
577
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
477578 if (debug)
478579 {
479580 try
....@@ -485,7 +586,10 @@
485586 }
486587
487588 if (full)
488
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
589
+ {
590
+ si.SendInfo(" BBox min: " + minima, "regular");
591
+ si.SendInfo(" BBox max: " + maxima, "regular");
592
+ }
489593
490594 if (sel.bRep != null)
491595 {
....@@ -512,7 +616,7 @@
512616 }
513617 if (sel.support != null)
514618 {
515
- si.SendInfo(" support: " + sel.support, "regular");
619
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
516620 }
517621 if (sel.scriptnode != null)
518622 {
....@@ -583,6 +687,9 @@
583687 {
584688 CameraPane.pointflow = (PointFlow) sel;
585689 }
690
+
691
+ si.SendInfo("_____________________", "regular");
692
+ si.SendInfo("", "regular");
586693 }
587694 }
588695
....@@ -598,68 +705,191 @@
598705 }
599706 }
600707
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
+
601766 void ToggleFullScreen()
602767 {
603
- if (CameraPane.FULLSCREEN)
768
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
769
+
770
+ cameraView.ToggleFullScreen();
771
+
772
+ if (!CameraPane.FULLSCREEN)
604773 {
605
- frame.getContentPane().remove(/*"Center",*/bigThree);
606
- framePanel.add(bigThree);
607
- 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
+
608797 } else
609798 {
610
- frame.getContentPane().remove(/*"Center",*/framePanel);
611
- framePanel.remove(bigThree);
612
- 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);
613821 }
614
- cameraView.ToggleFullScreen();
822
+ frame.validate();
615823 }
616824
617
- private JTextArea createTextPane()
825
+ private byte[] CompressCopy()
618826 {
619
- String[] initString =
620
- {
621
- "This is an editable JTextPane, ", //regular
622
- "another ", //italic
623
- "styled ", //bold
624
- "text ", //small
625
- "component, ", //large
626
- "which supports embedded components..." + newline,//regular
627
- " " + newline, //button
628
- "...and embedded icons..." + newline, //regular
629
- " ", //icon
630
- newline + "JTextPane is a subclass of JEditorPane that "
631
- + "uses a StyledEditorKit and StyledDocument, and provides "
632
- + "cover methods for interacting with those objects."
633
- };
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
+ }
634846
635
- String[] initStyles =
636
- {
637
- "regular", "italic", "bold", "small", "large",
638
- "regular", "button", "regular", "icon",
639
- "regular"
640
- };
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
+// }
641891
642
- JTextPane textPane = new JTextPane();
643
- textPane.setEditable(true);
644
- /*StyledDocument*/ doc = textPane.getStyledDocument();
645
- addStylesToDocument(doc);
646
-
647
- try
648
- {
649
- for (int j = 0; j < 2; j++)
650
- {
651
- for (int i = 0; i < initString.length; i++)
652
- {
653
- doc.insertString(doc.getLength(), initString[i],
654
- doc.getStyle(initStyles[i]));
655
- }
656
- }
657
- } catch (BadLocationException ble)
658
- {
659
- System.err.println("Couldn't insert initial text into text pane.");
660
- }
661
-
662
- return new JTextArea(); // textPane;
892
+ return new JTextPane(); // textPane;
663893 }
664894
665895 protected void addStylesToDocument(StyledDocument doc)
....@@ -712,7 +942,7 @@
712942 protected static ImageIcon createImageIcon(String path,
713943 String description)
714944 {
715
- java.net.URL imgURL = GrafreeD.class.getResource(path);
945
+ java.net.URL imgURL = Grafreed.class.getResource(path);
716946 if (imgURL != null)
717947 {
718948 return new ImageIcon(imgURL, description);
....@@ -744,6 +974,7 @@
744974 // NumberSlider vDivsField;
745975 // JCheckBox endcaps;
746976 JCheckBox liveCB;
977
+ JCheckBox selectableCB;
747978 JCheckBox hideCB;
748979 JCheckBox link2masterCB;
749980 JCheckBox markCB;
....@@ -751,7 +982,12 @@
751982 JCheckBox speedupCB;
752983 JCheckBox rewindCB;
753984 JCheckBox flipVCB;
985
+
986
+ cCheckBox toggleTextureCB;
987
+ cCheckBox toggleSwitchCB;
988
+
754989 JComboBox texresMenu;
990
+
755991 JButton resetButton;
756992 JButton stepButton;
757993 JButton stepAllButton;
....@@ -759,115 +995,87 @@
759995 JButton slowerButton;
760996 JButton fasterButton;
761997 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;
7621008
763
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1009
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7641010 {
7651011 JCheckBox cb;
7661012
767
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
768
- oe.aConstraints.gridwidth = 1; // 3;
769
-// oe.aConstraints.weightx = 1;
770
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
771
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1013
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7721014 cb.addItemListener(this);
773
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
774
- oe.aConstraints.gridwidth = 1;
775
- oe.aConstraints.gridx += 1;
7761015
7771016 return cb;
7781017 }
7791018
780
- cButton AddButton(ObjEditor oe, String label)
1019
+ cButton AddButton(cGridBag panel, String label)
7811020 {
7821021 cButton cb;
7831022
784
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
785
- oe.aConstraints.gridwidth = 1;
786
-// oe.aConstraints.weightx = 1;
787
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
788
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1023
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7891024 cb.addActionListener(this);
790
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
791
- oe.aConstraints.gridwidth = 1;
792
- oe.aConstraints.gridx += 1;
7931025
7941026 return cb;
7951027 }
7961028
797
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1029
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
7981030 {
7991031 JComboBox combo;
8001032
801
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
802
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
803
- oe.aConstraints.gridx += 1;
1033
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8041034 combo.addActionListener(this);
8051035
8061036 return combo;
8071037 }
8081038
809
- 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)
8101040 {
811
- NumberSlider combo;
1041
+ cGridBag control = new cGridBag();
1042
+
1043
+ cNumberSlider combo;
8121044
8131045 JLabel jlabel = new JLabel(label);
814
-
815
- aConstraints.fill = GridBagConstraints.VERTICAL;
8161046 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
817
- aConstraints.gridwidth = 2;
818
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
819
- aConstraints.gridx += 1;
820
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
821
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
822
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
823
- aConstraints.gridx += 1;
824
- aConstraints.gridwidth = 1;
825
-
1047
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1048
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8261049 combo.setFloat(current);
827
-
828
- combo.label = jlabel;
829
-
830
- combo.addChangeListener(this);
831
-
832
- return combo;
1050
+
1051
+ panel.add(control);
1052
+
1053
+ return control;
8331054 }
8341055
835
- 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)
8361057 {
837
- NumberSlider combo;
1058
+ cGridBag control = new cGridBag();
1059
+
1060
+ cNumberSlider combo;
8381061
8391062 JLabel jlabel = new JLabel(label);
840
-
841
- aConstraints.fill = GridBagConstraints.VERTICAL;
8421063 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
843
- aConstraints.gridwidth = 2;
844
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
845
- aConstraints.gridx += 1;
846
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
847
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
848
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
849
- aConstraints.gridx += 1;
850
- aConstraints.gridwidth = 1;
851
-
1064
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1065
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8521066 combo.setInteger(current);
8531067
854
- combo.label = jlabel;
855
-
856
- combo.addChangeListener(this);
857
-
858
- return combo;
1068
+ panel.add(control);
1069
+
1070
+ return control;
8591071 }
8601072
861
- JTextArea AddText(JPanel ctrlPanel, String name)
1073
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8621074 {
8631075 JTextArea text;
8641076
865
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
866
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
867
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1077
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8681078 text.addCaretListener(this);
869
- aConstraints.gridx += 1;
870
- aConstraints.gridwidth = 1;
8711079
8721080 return text;
8731081 }
....@@ -897,9 +1105,16 @@
8971105 objEditor.ctrlPanel.remove(j);
8981106 }
8991107
1108
+ void Remove(cNumberSlider j)
1109
+ {
1110
+ j.removeChangeListener(this);
1111
+ //objEditor.ctrlPanel.remove(j.label);
1112
+ objEditor.ctrlPanel.remove(j);
1113
+ }
1114
+
9001115 /*
9011116 */
902
- void Return() // ObjEditor oe)
1117
+ void Return0() // ObjEditor oe)
9031118 {
9041119 aConstraints.gridy += 1;
9051120 aConstraints.gridx = 0;
....@@ -954,35 +1169,79 @@
9541169
9551170 void SetupUI2(ObjEditor oe)
9561171 {
957
-// oe.aConstraints.weightx = 0;
958
-// oe.aConstraints.weighty = 0;
959
-// oe.aConstraints.gridx = 0;
960
-// oe.aConstraints.gridy = 0;
961
- SetupName(oe);
1172
+ //SetupName(oe);
9621173
963
- 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)
9641183 return;
9651184
966
- liveCB = AddCheckBox(oe, "Live", copy.live);
967
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
968
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1185
+ setupPanel = new cGridBag().setVertical(false);
1186
+
1187
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1188
+ liveCB.setToolTipText("Animate object");
1189
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1190
+ selectableCB.setToolTipText("Make object selectable");
9691191 // Return();
970
- markCB = AddCheckBox(oe, "Mark", copy.marked);
971
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
972
- randomCB = AddCheckBox(oe, "Rand", copy.random);
973
- Return();
974
- resetButton = AddButton(oe, "Reset");
975
- stepButton = AddButton(oe, "Step");
1192
+
1193
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1194
+ hideCB.setToolTipText("Hide object");
1195
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1196
+ markCB.setToolTipText("As animation target transform");
1197
+
1198
+ setupPanel2 = new cGridBag().setVertical(false);
1199
+
1200
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1201
+ rewindCB.setToolTipText("Rewind animation");
1202
+
1203
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1204
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1205
+
1206
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1207
+ link2masterCB.setToolTipText("Attach to support");
1208
+
1209
+ if (Globals.ADVANCED)
1210
+ {
1211
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1212
+ speedupCB.setToolTipText("Option motion capture");
1213
+ }
1214
+
1215
+ oe.ctrlPanel.add(setupPanel);
1216
+ oe.ctrlPanel.Return();
1217
+ oe.ctrlPanel.add(setupPanel2);
1218
+ oe.ctrlPanel.Return();
1219
+
1220
+ objectCommandsPanel = new cGridBag().setVertical(false);
1221
+
1222
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1223
+ resetButton.setToolTipText("Jump to frame zero");
1224
+ stepButton = AddButton(objectCommandsPanel, "Step");
1225
+ stepButton.setToolTipText("Step one frame");
9761226 // resetAllButton = AddButton(oe, "Reset All");
9771227 // stepAllButton = AddButton(oe, "Step All");
978
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9791228 // Return();
980
- slowerButton = AddButton(oe, "Slow");
981
- fasterButton = AddButton(oe, "Fast");
982
- remarkButton = AddButton(oe, "Rem");
1229
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1230
+ slowerButton.setToolTipText("Decrease animation speed");
1231
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1232
+ fasterButton.setToolTipText("Increase animation speed");
1233
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1234
+ remarkButton.setToolTipText("Set the current transform as the target");
9831235
984
- Return();
1236
+ oe.ctrlPanel.add(objectCommandsPanel);
1237
+ oe.ctrlPanel.Return();
9851238
1239
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1240
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1241
+ //Return();
1242
+
1243
+ oe.ctrlPanel.Return();
1244
+
9861245 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9871246 // ObjEditor.aConstraints.gridx += 1;
9881247
....@@ -1076,7 +1335,7 @@
10761335 oe.aConstraints.gridwidth = 1;
10771336 /**/
10781337 nameField = AddText(oe.ctrlPanel, copy.GetName());
1079
- Return();
1338
+ oe.ctrlPanel.Return();
10801339
10811340 //ctrlPanel.add(textureButton = new Button("Texture..."));
10821341 //textureButton.setEnabled(false);
....@@ -1178,11 +1437,25 @@
11781437 //JPanel worldPanel =
11791438 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11801439 //worldPanel.setName("World");
1181
- centralPanel = new JPanel(new BorderLayout());
1182
- timelinePanel = new JPanel(new BorderLayout());
1183
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1440
+ centralPanel = new cGridBag();
1441
+ centralPanel.preferredWidth = 20;
1442
+
1443
+ if (Globals.ADVANCED)
1444
+ {
1445
+ timelinePanel = new JPanel(new BorderLayout());
1446
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11841447
1448
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1449
+ cameraPanel.setContinuousLayout(true);
1450
+ cameraPanel.setOneTouchExpandable(true);
1451
+// cameraPanel.setDividerLocation(0.9);
1452
+// cameraPanel.setDividerSize(9);
1453
+ cameraPanel.setResizeWeight(1.0);
1454
+
1455
+ }
1456
+
11851457 centralPanel.add(cameraView);
1458
+ centralPanel.setFocusable(true);
11861459 //frame.setJMenuBar(timelineMenubar);
11871460 //centralPanel.add(timelinePanel);
11881461
....@@ -1201,12 +1474,14 @@
12011474 //frontView.object = copy;
12021475 //sideView.object = copy;
12031476
1204
- XYZPanel = new JPanel();
1205
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1477
+ XYZPanel = new cGridBag().setVertical(true);
1478
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12061479
1207
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1208
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1209
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1480
+ XYZPanel.preferredWidth = 5;
1481
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1482
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1483
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1484
+ //XYZPanel.setName("XYZ");
12101485
12111486 /*
12121487 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1244,11 +1519,23 @@
12441519 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12451520 //tmp.setName("Edit");
12461521 objectPanel.add(materialPanel);
1247
- JPanel north = new JPanel(new BorderLayout());
1248
- north.setName("Edit");
1249
- north.add(ctrlPanel, BorderLayout.NORTH);
1250
- objectPanel.add(north);
1251
- objectPanel.add(infoPanel);
1522
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1523
+// JPanel north = new JPanel(new BorderLayout());
1524
+// north.setName("Edit");
1525
+// north.add(ctrlPanel, BorderLayout.NORTH);
1526
+// objectPanel.add(north);
1527
+ objectPanel.add(editPanel);
1528
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1529
+
1530
+ //if (Globals.ADVANCED)
1531
+ objectPanel.add(infoPanel);
1532
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1533
+
1534
+ objectPanel.add(XYZPanel);
1535
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1536
+
1537
+ objectPanel.add(toolboxPanel);
1538
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
12521539
12531540 /*
12541541 aConstraints.gridx = 0;
....@@ -1257,7 +1544,7 @@
12571544 aConstraints.gridy += 1;
12581545 aConstraints.gridwidth = 1;
12591546 mainPanel.add(objectPanel, aConstraints);
1260
- */
1547
+ */
12611548
12621549 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12631550 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1268,16 +1555,23 @@
12681555 scrollpane.setWheelScrollingEnabled(true);
12691556 scrollpane.addMouseWheelListener(this); // Default not fast enough
12701557
1271
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1272
- scenePanel.add(scrollpane);
1558
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1559
+ scenePanel.preferredWidth = 5;
1560
+
1561
+ JTabbedPane tabbedPane = new JTabbedPane();
1562
+ tabbedPane.add(scrollpane);
12731563
1274
- scenePanel.add(FSPane = new cFileSystemPane(this));
1275
-
1276
- optionsPanel = new JPanel(new GridBagLayout());
1564
+ optionsPanel = new cGridBag().setVertical(false);
12771565
12781566 optionsPanel.setName("Options");
1279
- scenePanel.add(optionsPanel);
1567
+
1568
+ AddOptions(optionsPanel); //, aConstraints);
1569
+
1570
+ tabbedPane.add(optionsPanel);
1571
+
1572
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12801573
1574
+ scenePanel.add(tabbedPane);
12811575
12821576 /*
12831577 cTree jTree = new cTree(null);
....@@ -1311,6 +1605,7 @@
13111605 //bigPanel.setSize(new Dimension(10,10));
13121606 //bigPanel.add(ctrlPanel);
13131607 //bigPanel.add(gridPanel);
1608
+ /**
13141609 bigThree = new JPanel();
13151610 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
13161611 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1334,7 +1629,13 @@
13341629 // aConstraints.gridheight = 3;
13351630 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13361631 bigThree.add(XYZPanel, aWindowConstraints);
1632
+ /**/
13371633
1634
+ bigThree = new cGridBag();
1635
+ bigThree.addComponent(centralPanel);
1636
+ bigThree.addComponent(scenePanel);
1637
+ //bigThree.addComponent(XYZPanel);
1638
+
13381639 // // SIDE EFFECT!!!
13391640 // aConstraints.gridx = 0;
13401641 // aConstraints.gridy = 0;
....@@ -1342,9 +1643,9 @@
13421643 // aConstraints.gridheight = 1;
13431644
13441645 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1345
- framePanel.setContinuousLayout(true);
1346
- framePanel.setOneTouchExpandable(true);
1347
- framePanel.setDividerLocation(0.8);
1646
+ framePanel.setContinuousLayout(false);
1647
+ framePanel.setOneTouchExpandable(false);
1648
+ //.setDividerLocation(0.8);
13481649 //framePanel.setDividerSize(15);
13491650 //framePanel.setResizeWeight(0.15);
13501651 framePanel.setName("Frame");
....@@ -1355,15 +1656,21 @@
13551656 //worldPane.add(bigPanel);
13561657 //worldPane.add(worldPanel);
13571658 /**/
1358
- frame.getContentPane().add(/*"Center",*/framePanel);
1659
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1660
+ frame.add(/*"Center",*/framePanel);
13591661 //frame.getContentPane().add(/*"Center",*/ worldPane);
13601662
13611663 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13621664
1363
- frame.setSize(1024, 768);
1364
- frame.show();
1365
-
1665
+ frame.setSize(1280, 860);
1666
+
1667
+ cameraView.requestFocusInWindow();
1668
+
13661669 gridPanel.setDividerLocation(1.0);
1670
+
1671
+ frame.validate();
1672
+
1673
+ frame.setVisible(true);
13671674
13681675 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13691676 frame.addWindowListener(new WindowAdapter()
....@@ -1376,6 +1683,10 @@
13761683 });
13771684 }
13781685
1686
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1687
+ {
1688
+ }
1689
+
13791690 JTree GetTree()
13801691 {
13811692 return objEditor.jTree;
....@@ -1387,260 +1698,161 @@
13871698 ctrlPanel.removeAll();
13881699 }
13891700
1390
- void SetupMaterial(JPanel ctrlPanel)
1701
+ void SetupMaterial(cGridBag panel)
13911702 {
1392
- aConstraints.weighty = 0;
1393
- //aConstraints.weightx = 1;
1394
- /*
1703
+ /*
13951704 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13961705 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1397
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1398
- aConstraints.gridx += 1;
13991706 */
14001707
1401
- aConstraints.gridwidth = 1;
1402
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1403
- aConstraints.gridx += 1;
1404
- aConstraints.weighty = 0;
1405
- aConstraints.gridwidth = 1;
1708
+ cGridBag editBar = new cGridBag().setVertical(false);
1709
+
1710
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1711
+ createMaterialButton.setToolTipText("Create material");
14061712
14071713 /*
14081714 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1409
- aConstraints.gridx += 1;
1410
- aConstraints.weighty = 0;
1411
- aConstraints.gridwidth = 1;
14121715 */
14131716
1414
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1415
- aConstraints.gridx += 1;
1717
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1718
+ clearMaterialButton.setToolTipText("Clear material");
1719
+
1720
+ if (Globals.ADVANCED)
1721
+ {
1722
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1723
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1724
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1725
+ }
14161726
1417
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1418
-
1419
- aConstraints.gridx += 1;
1420
-
1421
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1422
-
1423
- aConstraints.gridx += 1;
1424
-
1425
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1426
-
1427
- aConstraints.gridx = 0;
1428
- aConstraints.gridy += 1;
1429
- aConstraints.weighty = 0;
1430
- aConstraints.gridwidth = 1;
1727
+ editBar.preferredHeight = 15;
1728
+
1729
+ panel.add(editBar);
1730
+
14311731 /**/
14321732 //aConstraints.weighty = 0;
14331733 ////aConstraints.weightx = 1;
14341734 //aConstraints.weighty = 1;
14351735 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14361736 //aConstraints.gridx += 1;
1437
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1438
- aConstraints.weighty = 0;
1439
- aConstraints.gridx = 0;
1440
- aConstraints.gridy += 1;
1441
- aConstraints.gridwidth = 1;
1737
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14421738
1443
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1444
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1445
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1446
- aConstraints.gridx += 1;
1447
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1448
- //aConstraints.weightx = 0;
1449
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1450
- aConstraints.gridx = 0;
1451
- aConstraints.gridy += 1;
1452
- aConstraints.gridwidth = 1;
1739
+ cGridBag colorSection = new cGridBag().setVertical(true);
1740
+
1741
+ cGridBag color = new cGridBag();
1742
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1743
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1744
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1745
+ //colorField.preferredWidth = 200;
1746
+ colorSection.add(color);
14531747
1454
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1455
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1456
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1457
- aConstraints.gridx += 1;
1458
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1459
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1460
- aConstraints.gridx = 0;
1461
- aConstraints.gridy += 1;
1462
- aConstraints.gridwidth = 1;
1748
+ cGridBag modulation = new cGridBag();
1749
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1750
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1751
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1752
+ colorSection.add(modulation);
14631753
1464
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1465
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1466
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1467
- aConstraints.gridx += 1;
1468
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1469
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1470
- aConstraints.gridx = 0;
1471
- aConstraints.gridy += 1;
1472
- aConstraints.gridwidth = 1;
1754
+ cGridBag texture = new cGridBag();
1755
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1756
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1757
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1758
+ colorSection.add(texture);
14731759
1474
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1475
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1476
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1477
- aConstraints.gridx += 1;
1478
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1479
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1480
- aConstraints.gridx = 0;
1481
- aConstraints.gridy += 1;
1482
- aConstraints.gridwidth = 1;
1760
+ panel.add(new JSeparator());
1761
+
1762
+ panel.add(colorSection);
1763
+
1764
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1765
+
1766
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1767
+
1768
+ cGridBag diffuse = new cGridBag();
1769
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1770
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1771
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1772
+ diffuseSection.add(diffuse);
14831773
1484
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1485
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1486
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1487
- aConstraints.gridx += 1;
1488
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1489
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1490
- aConstraints.gridx = 0;
1491
- aConstraints.gridy += 1;
1492
- aConstraints.gridwidth = 1;
1774
+ cGridBag diffuseness = new cGridBag();
1775
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1776
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1777
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1778
+ diffuseSection.add(diffuseness);
14931779
1494
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1495
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1496
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1497
- aConstraints.gridx += 1;
1498
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1499
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1500
- aConstraints.gridx = 0;
1501
- aConstraints.gridy += 1;
1502
- aConstraints.gridwidth = 1;
1780
+ cGridBag selfshadow = new cGridBag();
1781
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1782
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1783
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1784
+ diffuseSection.add(selfshadow);
15031785
1504
- //aConstraints.weighty = 1;
1505
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1506
- //aConstraints.gridx += 1;
1507
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1508
- aConstraints.weighty = 0;
1509
- aConstraints.gridx = 0;
1510
- aConstraints.gridy += 1;
1511
- aConstraints.gridwidth = 1;
1786
+ cGridBag sheen = new cGridBag();
1787
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1788
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1789
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1790
+ diffuseSection.add(sheen);
15121791
1513
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1514
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1515
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1516
- aConstraints.gridx += 1;
1517
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1518
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1519
- aConstraints.gridx = 0;
1520
- aConstraints.gridy += 1;
1521
- aConstraints.gridwidth = 1;
1792
+ cGridBag subsurface = new cGridBag();
1793
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1794
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1795
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1796
+ diffuseSection.add(subsurface);
15221797
1523
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1524
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1525
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1526
- aConstraints.gridx += 1;
1527
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1528
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1529
- aConstraints.gridx = 0;
1530
- aConstraints.gridy += 1;
1531
- aConstraints.gridwidth = 1;
1798
+ cGridBag shadow = new cGridBag();
1799
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1800
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1801
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1802
+ diffuseSection.add(shadow);
15321803
1533
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1534
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1535
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1536
- aConstraints.gridx += 1;
1537
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1538
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1539
- aConstraints.gridx = 0;
1540
- aConstraints.gridy += 1;
1541
- aConstraints.gridwidth = 1;
1804
+ cGridBag fakedepth = new cGridBag();
1805
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1806
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1807
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1808
+ diffuseSection.add(fakedepth);
15421809
1543
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1544
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1545
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1546
- aConstraints.gridx += 1;
1547
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1548
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1549
- aConstraints.gridx = 0;
1550
- aConstraints.gridy += 1;
1551
- aConstraints.gridwidth = 1;
1810
+ cGridBag shadowbias = new cGridBag();
1811
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1812
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1813
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1814
+ diffuseSection.add(shadowbias);
15521815
1553
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1554
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1555
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1556
- aConstraints.gridx += 1;
1557
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1558
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1559
- aConstraints.gridx = 0;
1560
- aConstraints.gridy += 1;
1561
- aConstraints.gridwidth = 1;
1816
+ panel.add(new JSeparator());
1817
+
1818
+ panel.add(diffuseSection);
1819
+
1820
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1821
+
1822
+ cGridBag specularSection = new cGridBag().setVertical(true);
15621823
1563
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1564
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1565
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1566
- aConstraints.gridx += 1;
1567
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1568
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1569
- aConstraints.gridx = 0;
1570
- aConstraints.gridy += 1;
1571
- aConstraints.gridwidth = 1;
1824
+ cGridBag specular = new cGridBag();
1825
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1826
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1827
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1828
+ specularSection.add(specular);
15721829
1573
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1574
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1575
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1576
- aConstraints.gridx += 1;
1577
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1578
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1579
- aConstraints.gridx = 0;
1580
- aConstraints.gridy += 1;
1581
- aConstraints.gridwidth = 1;
1830
+ cGridBag lightarea = new cGridBag();
1831
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1832
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1833
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1834
+ specularSection.add(lightarea);
15821835
1583
- //aConstraints.weighty = 1;
1584
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1585
- //aConstraints.gridx += 1;
1586
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1587
- aConstraints.weighty = 0;
1588
- aConstraints.gridx = 0;
1589
- aConstraints.gridy += 1;
1590
- aConstraints.gridwidth = 1;
1836
+ cGridBag shininess = new cGridBag();
1837
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1838
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1839
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1840
+ specularSection.add(shininess);
15911841
1592
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1593
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1594
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1595
- aConstraints.gridx += 1;
1596
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1597
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1598
- aConstraints.gridx = 0;
1599
- aConstraints.gridy += 1;
1600
- aConstraints.gridwidth = 1;
1842
+ cGridBag metalness = new cGridBag();
1843
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1844
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1845
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1846
+ specularSection.add(metalness);
16011847
1602
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1603
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1604
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1605
- aConstraints.gridx += 1;
1606
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1607
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1608
- aConstraints.gridx = 0;
1609
- aConstraints.gridy += 1;
1610
- aConstraints.gridwidth = 1;
1848
+ cGridBag velvet = new cGridBag();
1849
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1850
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1851
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1852
+ specularSection.add(velvet);
16111853
1612
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1613
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1614
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1615
- aConstraints.gridx += 1;
1616
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1617
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1618
- aConstraints.gridx = 0;
1619
- aConstraints.gridy += 1;
1620
- aConstraints.gridwidth = 1;
1621
-
1622
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1623
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1624
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1625
- aConstraints.gridx += 1;
1626
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1627
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1628
- aConstraints.gridx = 0;
1629
- aConstraints.gridy += 1;
1630
- aConstraints.gridwidth = 1;
1631
-
1632
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1633
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1634
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1635
- aConstraints.gridx += 1;
1636
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1637
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1638
- aConstraints.gridx = 0;
1639
- aConstraints.gridy += 1;
1640
- aConstraints.gridwidth = 1;
1641
-
1642
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1643
- Return();
1854
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1855
+ //Return();
16441856 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16451857 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16461858 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1651,130 +1863,105 @@
16511863 // aConstraints.gridy += 1;
16521864 // aConstraints.gridwidth = 1;
16531865
1654
- //aConstraints.weighty = 1;
1655
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1656
- //aConstraints.gridx += 1;
1657
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1658
- aConstraints.weighty = 0;
1659
- aConstraints.gridx = 0;
1660
- aConstraints.gridy += 1;
1661
- aConstraints.gridwidth = 1;
1866
+ cGridBag anisoU = new cGridBag();
1867
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1868
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1869
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1870
+ specularSection.add(anisoU);
16621871
1663
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1664
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1665
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1666
- aConstraints.gridx += 1;
1667
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1668
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1669
- aConstraints.gridx = 0;
1670
- aConstraints.gridy += 1;
1671
- aConstraints.gridwidth = 1;
1872
+ cGridBag anisoV = new cGridBag();
1873
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1874
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1875
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1876
+ specularSection.add(anisoV);
16721877
1673
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1674
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1675
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1676
- aConstraints.gridx += 1;
1677
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1678
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1679
- aConstraints.gridx = 0;
1680
- aConstraints.gridy += 1;
1681
- aConstraints.gridwidth = 1;
16821878
1683
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1684
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1685
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1686
- aConstraints.gridx += 1;
1687
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1688
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1689
- aConstraints.gridx = 0;
1690
- aConstraints.gridy += 1;
1691
- aConstraints.gridwidth = 1;
1879
+ panel.add(new JSeparator());
1880
+
1881
+ panel.add(specularSection);
1882
+
1883
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1884
+
1885
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16921886
1693
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1694
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1695
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1696
- aConstraints.gridx += 1;
1697
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1698
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1699
- aConstraints.gridx = 0;
1700
- aConstraints.gridy += 1;
1701
- aConstraints.gridwidth = 1;
1702
- aConstraints.weighty = 0;
1887
+ cGridBag camera = new cGridBag();
1888
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1889
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1890
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1891
+ colorSection.add(camera);
17031892
1704
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1705
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1706
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1707
- aConstraints.gridx += 1;
1708
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1709
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1710
- aConstraints.gridx = 0;
1711
- aConstraints.gridy += 1;
1712
- aConstraints.gridwidth = 1;
1893
+ cGridBag ambient = new cGridBag();
1894
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1895
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1896
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1897
+ colorSection.add(ambient);
17131898
1714
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1715
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1716
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1717
- aConstraints.gridx += 1;
1718
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1719
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1720
- aConstraints.gridx = 0;
1721
- aConstraints.gridy += 1;
1722
- aConstraints.gridwidth = 1;
1899
+ cGridBag backlit = new cGridBag();
1900
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1901
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1902
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1903
+ colorSection.add(backlit);
17231904
1724
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1725
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1726
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1727
- aConstraints.gridx += 1;
1728
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1729
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1730
- aConstraints.gridx = 0;
1731
- aConstraints.gridy += 1;
1732
- aConstraints.gridwidth = 1;
1905
+ cGridBag opacity = new cGridBag();
1906
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1907
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1908
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1909
+ colorSection.add(opacity);
17331910
1734
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1735
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1736
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1737
- aConstraints.gridx += 1;
1738
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1739
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1740
- aConstraints.gridx = 0;
1741
- aConstraints.gridy += 1;
1742
- aConstraints.gridwidth = 1;
1911
+ //panel.add(new JSeparator());
1912
+
1913
+ //panel.add(globalSection);
1914
+
1915
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1916
+
1917
+ cGridBag textureSection = new cGridBag().setVertical(true);
17431918
1744
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1745
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1746
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1747
- aConstraints.gridx += 1;
1748
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1749
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1750
- aConstraints.gridx = 0;
1751
- aConstraints.gridy += 1;
1752
- aConstraints.gridwidth = 1;
1919
+ cGridBag bump = new cGridBag();
1920
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1921
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1922
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1923
+ textureSection.add(bump);
17531924
1754
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1755
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1756
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1757
- aConstraints.gridx += 1;
1758
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1759
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1760
- aConstraints.gridx = 0;
1761
- aConstraints.gridy += 1;
1762
- aConstraints.gridwidth = 1;
1925
+ cGridBag noise = new cGridBag();
1926
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1927
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1928
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1929
+ textureSection.add(noise);
17631930
1764
- //aConstraints.weighty = 1;
1765
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1766
- //aConstraints.gridx += 1;
1767
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1768
- aConstraints.weighty = 0;
1931
+ cGridBag power = new cGridBag();
1932
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1933
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1934
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1935
+ textureSection.add(power);
17691936
1770
- aConstraints.gridx = 0;
1771
- aConstraints.gridy = 0;
1772
- aConstraints.gridwidth = 1;
1937
+ cGridBag borderfade = new cGridBag();
1938
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1939
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1940
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1941
+ textureSection.add(borderfade);
1942
+
1943
+ cGridBag fog = new cGridBag();
1944
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1945
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1946
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1947
+ textureSection.add(fog);
1948
+
1949
+ cGridBag opacityPower = new cGridBag();
1950
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1951
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1952
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1953
+ textureSection.add(opacityPower);
1954
+
1955
+ panel.add(new JSeparator());
1956
+
1957
+ panel.add(textureSection);
1958
+
1959
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17731960
17741961 SetMaterial(copy); // .GetMaterial());
17751962
1776
- colorField.addChangeListener(this);
1777
- modulationField.addChangeListener(this);
1963
+ //colorField.addChangeListener(this);
1964
+// modulationField.addChangeListener(this);
17781965 metalnessField.addChangeListener(this);
17791966 diffuseField.addChangeListener(this);
17801967 specularField.addChangeListener(this);
....@@ -1804,12 +1991,15 @@
18041991 opacityPowerField.addChangeListener(this);
18051992 /**/
18061993
1807
- resetSlidersButton.addActionListener(this);
18081994 clearMaterialButton.addActionListener(this);
18091995 createMaterialButton.addActionListener(this);
1810
-
1811
- propagateToggle.addItemListener(this);
1812
- multiplyToggle.addItemListener(this);
1996
+
1997
+ if (Globals.ADVANCED)
1998
+ {
1999
+ resetSlidersButton.addActionListener(this);
2000
+ propagateToggle.addItemListener(this);
2001
+ multiplyToggle.addItemListener(this);
2002
+ }
18132003 }
18142004
18152005 void DropFile(java.io.File[] files, boolean textures)
....@@ -1827,8 +2017,9 @@
18272017 // 3D models
18282018 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18292019 {
1830
- lastConverter = new com.jmex.model.converters.MaxToJme();
1831
- LoadFile(filename, lastConverter);
2020
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2021
+ //LoadFile(filename, lastConverter);
2022
+ LoadObjFile(filename); // New 3ds loader
18322023 continue;
18332024 }
18342025 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1980,7 +2171,7 @@
19802171
19812172 //? flashIt = false;
19822173 CameraPane pane = (CameraPane) cameraView;
1983
- pane.clickStart(location.x, location.y, 0);
2174
+ pane.clickStart(location.x, location.y, 0, 0);
19842175 pane.clickEnd(location.x, location.y, 0, true);
19852176
19862177 if (group.selection.size() == 1)
....@@ -2029,6 +2220,7 @@
20292220 e2.printStackTrace();
20302221 }
20312222 }
2223
+
20322224 LoadJMEThread loadThread;
20332225
20342226 class LoadJMEThread extends Thread
....@@ -2086,6 +2278,7 @@
20862278 //LoadFile0(filename, converter);
20872279 }
20882280 }
2281
+
20892282 LoadOBJThread loadObjThread;
20902283
20912284 class LoadOBJThread extends Thread
....@@ -2164,19 +2357,19 @@
21642357
21652358 void LoadObjFile(String fullname)
21662359 {
2167
- /*
2360
+ System.out.println("Loading " + fullname);
2361
+ /**/
21682362 //lastFilename = fullname;
21692363 if(loadObjThread == null)
21702364 {
2171
- loadObjThread = new LoadOBJThread();
2172
- loadObjThread.start();
2365
+ loadObjThread = new LoadOBJThread();
2366
+ loadObjThread.start();
21732367 }
21742368
21752369 loadObjThread.add(fullname);
2176
- */
2370
+ /**/
21772371
2178
- System.out.println("Loading " + fullname);
2179
- makeSomething(new FileObject(fullname, true), true);
2372
+ //makeSomething(new FileObject(fullname, true), true);
21802373 }
21812374
21822375 void LoadGFDFile(String fullname)
....@@ -2437,11 +2630,11 @@
24372630
24382631 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24392632 {
2440
- if (GrafreeD.standAlone)
2633
+ if (Grafreed.standAlone)
24412634 {
24422635 /**/
24432636 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2444
- browser.show();
2637
+ browser.setVisible(true);
24452638 String filename = browser.getFile();
24462639 if (filename != null && filename.length() > 0)
24472640 {
....@@ -2552,6 +2745,7 @@
25522745 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25532746 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25542747 }
2748
+
25552749 //cJME.count++;
25562750 //cJME.count %= 12;
25572751 if (gc)
....@@ -2586,6 +2780,7 @@
25862780 }
25872781 if (input == null)
25882782 {
2783
+ new Exception().printStackTrace();
25892784 System.exit(0);
25902785 }
25912786
....@@ -2734,6 +2929,7 @@
27342929 }
27352930 }
27362931 }
2932
+
27372933 cFileSystemPane FSPane;
27382934
27392935 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2787,11 +2983,14 @@
27872983 }
27882984 }
27892985 }
2986
+
27902987 freezematerial = false;
27912988 }
27922989
27932990 void SetMaterial(Object3D object)
27942991 {
2992
+ latestObject = object;
2993
+
27952994 cMaterial mat = object.material;
27962995
27972996 if (mat == null)
....@@ -2800,7 +2999,8 @@
28002999 return;
28013000 }
28023001
2803
- multiplyToggle.setSelected(mat.multiply);
3002
+ if (multiplyToggle != null)
3003
+ multiplyToggle.setSelected(mat.multiply);
28043004
28053005 assert (object.projectedVertices != null);
28063006
....@@ -2902,12 +3102,17 @@
29023102 // }
29033103
29043104 /**/
2905
- if (deselect)
3105
+ if (deselect || child == null)
29063106 {
29073107 //group.deselectAll();
29083108 //freeze = true;
29093109 GetTree().clearSelection();
29103110 //freeze = false;
3111
+
3112
+ if (child == null)
3113
+ {
3114
+ return;
3115
+ }
29113116 }
29123117
29133118 //group.addSelectee(child);
....@@ -2976,7 +3181,7 @@
29763181 cameraView.ToggleDL();
29773182 cameraView.repaint();
29783183 return;
2979
- } else if (event.getSource() == toggleTextureItem)
3184
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29803185 {
29813186 cameraView.ToggleTexture();
29823187 // june 2013 copy.HardTouch();
....@@ -2989,7 +3194,8 @@
29893194 if (timeline)
29903195 {
29913196 centralPanel.remove(cameraView);
2992
- centralPanel.add(timelinePanel);
3197
+ cameraPanel.add(cameraView);
3198
+ centralPanel.add(cameraPanel);
29933199 frame.setJMenuBar(timelineMenubar);
29943200 wasFullScreen = CameraPane.FULLSCREEN;
29953201 if (!CameraPane.FULLSCREEN)
....@@ -2998,7 +3204,7 @@
29983204 }
29993205 else
30003206 {
3001
- centralPanel.remove(timelinePanel);
3207
+ centralPanel.remove(cameraPanel);
30023208 centralPanel.add(cameraView);
30033209 frame.setJMenuBar(null);
30043210 if (!wasFullScreen)
....@@ -3014,9 +3220,9 @@
30143220 frame.validate();
30153221
30163222 return;
3017
- } else if (event.getSource() == toggleRandomItem)
3223
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30183224 {
3019
- cameraView.ToggleRandom();
3225
+ cameraView.ToggleSwitch();
30203226 cameraView.repaint();
30213227 return;
30223228 } else if (event.getSource() == toggleHandleItem)
....@@ -3045,6 +3251,10 @@
30453251 {
30463252 copy.live ^= true;
30473253 return;
3254
+ } else if (event.getSource() == selectableCB)
3255
+ {
3256
+ copy.dontselect ^= true;
3257
+ return;
30483258 } else if (event.getSource() == hideCB)
30493259 {
30503260 copy.hide ^= true;
....@@ -3059,6 +3269,7 @@
30593269 if (event.getSource() == randomCB)
30603270 {
30613271 copy.random ^= true;
3272
+ objEditor.refreshContents();
30623273 return;
30633274 }
30643275 if (event.getSource() == speedupCB)
....@@ -3082,8 +3293,9 @@
30823293
30833294 public void actionPerformed(ActionEvent event)
30843295 {
3296
+ Object source = event.getSource();
30853297 // SCRIPT DIALOG
3086
- if (event.getSource() == okbutton)
3298
+ if (source == okbutton)
30873299 {
30883300 textpanel.setVisible(false);
30893301 textpanel.remove(textarea);
....@@ -3095,7 +3307,7 @@
30953307 textarea = null;
30963308 textpanel = null;
30973309 }
3098
- if (event.getSource() == cancelbutton)
3310
+ if (source == cancelbutton)
30993311 {
31003312 textpanel.setVisible(false);
31013313 textpanel.remove(textarea);
....@@ -3107,49 +3319,50 @@
31073319 //applySelf();
31083320 //client.refreshEditWindow();
31093321 //refreshContents();
3110
- if (event.getSource() == nameField)
3322
+ if (source == nameField)
31113323 {
31123324 //System.out.println("ObjEditor " + event);
31133325 applySelf0(true);
31143326 //parent.applySelf();
31153327 objEditor.refreshContents();
3116
- } else if (event.getSource() == resetButton)
3328
+ } else if (source == resetButton)
31173329 {
31183330 CameraPane.fullreset = true;
31193331 copy.Reset(); // ResetMeshes();
31203332 copy.Touch();
31213333 objEditor.refreshContents();
3122
- } else if (event.getSource() == stepItem)
3334
+ } else if (source == stepItem)
31233335 {
3124
- cameraView.ONESTEP = true;
3336
+ //cameraView.ONESTEP = true;
3337
+ Globals.ONESTEP = true;
31253338 cameraView.repaint();
31263339 return;
3127
- } else if (event.getSource() == stepButton)
3340
+ } else if (source == stepButton)
31283341 {
31293342 copy.Step();
31303343 copy.Touch();
31313344 objEditor.refreshContents();
3132
- } else if (event.getSource() == slowerButton)
3345
+ } else if (source == slowerButton)
31333346 {
31343347 copy.Slower();
31353348 copy.Touch();
31363349 objEditor.refreshContents();
3137
- } else if (event.getSource() == fasterButton)
3350
+ } else if (source == fasterButton)
31383351 {
31393352 copy.Faster();
31403353 copy.Touch();
31413354 objEditor.refreshContents();
3142
- } else if (event.getSource() == remarkButton)
3355
+ } else if (source == remarkButton)
31433356 {
31443357 copy.Remark();
31453358 copy.Touch();
31463359 objEditor.refreshContents();
3147
- } else if (event.getSource() == stepAllButton)
3360
+ } else if (source == stepAllButton)
31483361 {
31493362 copy.StepAll();
31503363 copy.Touch();
31513364 objEditor.refreshContents();
3152
- } else if (event.getSource() == resetAllButton)
3365
+ } else if (source == resetAllButton)
31533366 {
31543367 //CameraPane.fullreset = true;
31553368 copy.ResetAll(); // ResetMeshes();
....@@ -3182,53 +3395,79 @@
31823395 // Close();
31833396 // }
31843397 // else
3185
- if (event.getSource() == resetSlidersButton)
3398
+ if (source == resetSlidersButton)
31863399 {
31873400 ResetSliders();
3188
- } else if (event.getSource() == clearMaterialButton)
3401
+ } else if (source == clearMaterialButton)
31893402 {
31903403 ClearMaterial();
3191
- } else if (event.getSource() == createMaterialButton)
3404
+ } else if (source == createMaterialButton)
31923405 {
31933406 CreateMaterial();
3194
- } else if (event.getSource() == clearPanelButton)
3407
+ } else if (source == clearPanelButton)
31953408 {
31963409 copy.ClearUI();
31973410 refreshContents(true);
3198
- } /*
3199
- }
3200
-
3201
- public boolean action(Event event, Object arg)
3202
- {
3203
- */ else if (event.getSource() == closeItem)
3411
+ } else if (source == importGFDItem)
3412
+ {
3413
+ ImportGFD();
3414
+ } else
3415
+ if (source == importVRMLX3DItem)
3416
+ {
3417
+ ImportVRMLX3D();
3418
+ } else
3419
+ if (source == import3DSItem)
3420
+ {
3421
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3422
+ } else
3423
+ if (source == importOBJItem)
3424
+ {
3425
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3426
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3427
+ browser.setVisible(true);
3428
+ String filename = browser.getFile();
3429
+ if (filename != null && filename.length() > 0)
3430
+ {
3431
+ String fullname = browser.getDirectory() + filename;
3432
+ makeSomething(ReadOBJ(fullname), true);
3433
+ }
3434
+ } else
3435
+ if (source == closeItem)
32043436 {
32053437 Close();
32063438 //return true;
3207
- } else if (event.getSource() == loadItem)
3439
+ } else if (source == openItem)
32083440 {
3209
- load();
3441
+ Open();
32103442 //return true;
3211
- } else if (event.getSource() == saveItem)
3443
+ } else if (source == newItem)
3444
+ {
3445
+ New();
3446
+ } else if (source == saveItem)
32123447 {
32133448 save();
32143449 //return true;
3215
- } else if (event.getSource() == saveAsItem)
3450
+ } else if (source == saveAsItem)
32163451 {
32173452 saveAs();
32183453 //return true;
3219
- } else if (event.getSource() == reexportItem)
3454
+ } else if (source == reexportItem)
32203455 {
32213456 reexport();
32223457 //return true;
3223
- } else if (event.getSource() == exportAsItem)
3458
+ } else if (source == exportAsItem)
32243459 {
32253460 export();
32263461 //return true;
3227
- } else if (event.getSource() == povItem)
3462
+ } else if (source == povItem)
32283463 {
32293464 generatePOV();
32303465 //return true;
3231
- } else if (event.getSource() == zBufferItem)
3466
+ } else if (event.getSource() == archiveItem)
3467
+ {
3468
+ cTools.Archive(frame);
3469
+ return;
3470
+ } else if (source == zBufferItem)
32323471 {
32333472 try
32343473 {
....@@ -3250,21 +3489,8 @@
32503489 cameraView.repaint();
32513490 //return true;
32523491 }
3253
- */ else if (event.getSource() == editCameraItem)
3254
- {
3255
- cameraView.ProtectCamera();
3256
- cameraView.repaint();
3257
- return;
3258
- } else if (event.getSource() == revertCameraItem)
3259
- {
3260
- cameraView.RevertCamera();
3261
- cameraView.repaint();
3262
- return;
3263
-// } else if (event.getSource() == textureButton)
3264
-// {
3265
-// return; // true;
3266
- } else // combos...
3267
- if (event.getSource() == texresMenu)
3492
+ */ else // combos...
3493
+ if (source == texresMenu)
32683494 {
32693495 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32703496 copy.texres = texresMenu.getSelectedIndex();
....@@ -3276,27 +3502,424 @@
32763502 }
32773503 }
32783504
3279
- void ToggleAnimation()
3505
+ void New()
32803506 {
3281
- if (!CameraPane.ANIMATION)
3507
+ while (copy.Size() > 1)
32823508 {
3283
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3509
+ copy.remove(1);
3510
+ }
3511
+
3512
+ ResetModel();
3513
+ objEditor.refreshContents();
3514
+ }
3515
+
3516
+ static public byte[] Compress(Object3D o)
3517
+ {
3518
+ try
3519
+ {
3520
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3521
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3522
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
3523
+
3524
+ Object3D parent = o.parent;
3525
+ o.parent = null;
3526
+
3527
+ out.writeObject(o);
3528
+
3529
+ o.parent = parent;
3530
+
3531
+ out.flush();
3532
+
3533
+ baos //zstream
3534
+ .close();
3535
+ out.close();
3536
+
3537
+ byte[] bytes = baos.toByteArray();
3538
+
3539
+ System.out.println("save #bytes = " + bytes.length);
3540
+ return bytes;
3541
+ } catch (Exception e)
3542
+ {
3543
+ System.err.println(e);
3544
+ return null;
3545
+ }
3546
+ }
3547
+
3548
+ static public Object Uncompress(byte[] bytes)
3549
+ {
3550
+ System.out.println("restore #bytes = " + bytes.length);
3551
+ try
3552
+ {
3553
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3554
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3555
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
3556
+ Object obj = in.readObject();
3557
+
3558
+ bais //istream
3559
+ .close();
3560
+ in.close();
3561
+
3562
+ return obj;
3563
+ } catch (Exception e)
3564
+ {
3565
+ System.err.println(e);
3566
+ return null;
3567
+ }
3568
+ }
3569
+
3570
+ static public Object clone(Object o)
3571
+ {
3572
+ try
3573
+ {
3574
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3575
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3576
+
3577
+ out.writeObject(o);
3578
+
3579
+ out.flush();
3580
+ out.close();
3581
+
3582
+ byte[] bytes = baos.toByteArray();
3583
+
3584
+ System.out.println("clone = " + bytes.length);
3585
+
3586
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3587
+ ObjectInputStream in = new ObjectInputStream(bais);
3588
+ Object obj = in.readObject();
3589
+ in.close();
3590
+
3591
+ return obj;
3592
+ } catch (Exception e)
3593
+ {
3594
+ System.err.println(e);
3595
+ return null;
3596
+ }
3597
+ }
3598
+
3599
+ cRadio GetCurrentTab()
3600
+ {
3601
+ cRadio ab;
3602
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3603
+ {
3604
+ ab = (cRadio)e.nextElement();
3605
+ if(ab.GetObject() == copy)
3606
+ {
3607
+ return ab;
3608
+ }
3609
+ }
3610
+
3611
+ return null;
3612
+ }
3613
+
3614
+
3615
+ public void Save()
3616
+ {
3617
+ //Save(true);
3618
+ Replace();
3619
+ }
3620
+
3621
+ private boolean Equal(byte[] compress, byte[] name)
3622
+ {
3623
+ if (compress.length != name.length)
3624
+ {
3625
+ return false;
3626
+ }
3627
+
3628
+ for (int i=compress.length; --i>=0;)
3629
+ {
3630
+ if (compress[i] != name[i])
3631
+ return false;
3632
+ }
3633
+
3634
+ return true;
3635
+ }
3636
+
3637
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3638
+
3639
+ public boolean Save(boolean user)
3640
+ {
3641
+ System.err.println("Save");
3642
+
3643
+ cRadio tab = GetCurrentTab();
3644
+
3645
+ byte[] compress = CompressCopy();
3646
+
3647
+ boolean thesame = false;
3648
+
3649
+ // Quick heuristic using length. Works only when stream is compressed.
3650
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3651
+ {
3652
+ thesame = true;
3653
+ }
3654
+
3655
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3656
+ if (!thesame)
3657
+ {
3658
+ //tab.user[tab.versionindex] = user;
3659
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3660
+
3661
+ copy.versions[++copy.versionindex] = compress;
3662
+
3663
+ // if (increment)
3664
+ // tab.versionindex++;
3665
+ }
3666
+
3667
+ //copy.RestoreBigData(versiontable);
3668
+
3669
+ //assert(hashtable.isEmpty());
3670
+
3671
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3672
+ {
3673
+ //tab.user[i] = false;
3674
+ copy.versions[i] = null;
3675
+ }
3676
+
3677
+ SetUndoStates();
3678
+
3679
+ // test save
3680
+ if (false)
3681
+ {
3682
+ try
3683
+ {
3684
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
3685
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3686
+
3687
+ p.writeObject(copy);
3688
+
3689
+ p.flush();
3690
+
3691
+ ostream.close();
3692
+ } catch (Exception e)
3693
+ {
3694
+ e.printStackTrace();
3695
+ }
3696
+ }
3697
+
3698
+ return !thesame;
3699
+ }
3700
+
3701
+ void CopyChanged(Object3D obj)
3702
+ {
3703
+ SetUndoStates();
3704
+
3705
+ boolean temp = CameraPane.SWITCH;
3706
+ CameraPane.SWITCH = false;
3707
+
3708
+ copy.ExtractBigData(versiontable);
3709
+
3710
+ copy.clear();
3711
+
3712
+ for (int i=0; i<obj.Size(); i++)
3713
+ {
3714
+ copy.add(obj.get(i));
3715
+ }
3716
+
3717
+ copy.RestoreBigData(versiontable);
3718
+
3719
+ CameraPane.SWITCH = temp;
3720
+
3721
+ //assert(hashtable.isEmpty());
3722
+
3723
+ copy.Touch();
3724
+
3725
+ ResetModel();
3726
+ copy.HardTouch(); // recompile?
3727
+
3728
+ cRadio ab;
3729
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3730
+ {
3731
+ ab = (cRadio)e.nextElement();
3732
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3733
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3734
+ if (test != null)
3735
+ {
3736
+ test.editWindow = ab.object.editWindow;
3737
+ ab.object = test;
3738
+ }
3739
+ }
3740
+
3741
+ refreshContents();
3742
+ }
3743
+
3744
+ cButton undoButton;
3745
+ cButton restoreButton;
3746
+ cButton replaceButton;
3747
+ cButton redoButton;
3748
+
3749
+ boolean muteSlider;
3750
+
3751
+ int VersionCount()
3752
+ {
3753
+ int count = 0;
3754
+
3755
+ for (int i = copy.versions.length; --i >= 0;)
3756
+ {
3757
+ if (copy.versions[i] != null)
3758
+ count++;
3759
+ }
3760
+
3761
+ return count;
3762
+ }
3763
+
3764
+ void SetUndoStates()
3765
+ {
3766
+ cRadio tab = GetCurrentTab();
3767
+
3768
+ restoreButton.setEnabled(copy.versionindex != -1);
3769
+ replaceButton.setEnabled(copy.versionindex != -1);
3770
+
3771
+ undoButton.setEnabled(copy.versionindex > 0);
3772
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3773
+
3774
+ muteSlider = true;
3775
+ versionSlider.setMaximum(VersionCount() - 1);
3776
+ versionSlider.setInteger(copy.versionindex);
3777
+ muteSlider = false;
3778
+ }
3779
+
3780
+ public boolean Undo()
3781
+ {
3782
+ // Option?
3783
+ Replace();
3784
+
3785
+ System.err.println("Undo");
3786
+
3787
+ cRadio tab = GetCurrentTab();
3788
+
3789
+ if (copy.versionindex == 0)
3790
+ {
3791
+ java.awt.Toolkit.getDefaultToolkit().beep();
3792
+ return false;
3793
+ }
3794
+
3795
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3796
+// {
3797
+// if (Save(false))
3798
+// tab.versionindex -= 1;
3799
+// else
3800
+// {
3801
+// if (tab.versionindex <= 0)
3802
+// return false;
3803
+// else
3804
+// tab.versionindex -= 1;
3805
+// }
3806
+// }
3807
+
3808
+ copy.versionindex -= 1;
3809
+
3810
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3811
+
3812
+ return true;
3813
+ }
3814
+
3815
+ public boolean Restore()
3816
+ {
3817
+ System.err.println("Restore");
3818
+
3819
+ cRadio tab = GetCurrentTab();
3820
+
3821
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3822
+ {
3823
+ java.awt.Toolkit.getDefaultToolkit().beep();
3824
+ return false;
3825
+ }
3826
+
3827
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3828
+
3829
+ return true;
3830
+ }
3831
+
3832
+ public boolean Replace()
3833
+ {
3834
+ System.err.println("Replace");
3835
+
3836
+ cRadio tab = GetCurrentTab();
3837
+
3838
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3839
+ {
3840
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3841
+ return false;
3842
+ }
3843
+
3844
+ copy.versions[copy.versionindex] = CompressCopy();
3845
+
3846
+ return true;
3847
+ }
3848
+
3849
+ public void Redo()
3850
+ {
3851
+ // Option?
3852
+ Replace();
3853
+
3854
+ cRadio tab = GetCurrentTab();
3855
+
3856
+ if (copy.versions[copy.versionindex + 1] == null)
3857
+ {
3858
+ java.awt.Toolkit.getDefaultToolkit().beep();
3859
+ return;
3860
+ }
3861
+
3862
+ copy.versionindex += 1;
3863
+
3864
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3865
+
3866
+ //if (!tab.user[tab.versionindex])
3867
+ // tab.graphs[tab.versionindex] = null;
3868
+ }
3869
+
3870
+ void ImportGFD()
3871
+ {
3872
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32843873 browser.show();
32853874 String filename = browser.getFile();
32863875 if (filename != null && filename.length() > 0)
32873876 {
3288
- CameraPane.filename = browser.getDirectory() + filename;
3877
+ String fullname = browser.getDirectory() + filename;
3878
+
3879
+ //Object3D readobj =
3880
+ objEditor.ReadGFD(fullname, objEditor);
3881
+ //makeSomething(readobj);
3882
+ }
3883
+ }
3884
+
3885
+ void ImportVRMLX3D()
3886
+ {
3887
+ if (Grafreed.standAlone)
3888
+ {
3889
+ /**/
3890
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3891
+ browser.show();
3892
+ String filename = browser.getFile();
3893
+ if (filename != null && filename.length() > 0)
3894
+ {
3895
+ String fullname = browser.getDirectory() + filename;
3896
+ LoadVRMLX3D(fullname);
3897
+ }
3898
+ /**/
3899
+ }
3900
+ }
3901
+
3902
+ void ToggleAnimation()
3903
+ {
3904
+ if (!Globals.ANIMATION)
3905
+ {
3906
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3907
+ browser.setVisible(true);
3908
+ String filename = browser.getFile();
3909
+ if (filename != null && filename.length() > 0)
3910
+ {
3911
+ Globals.filename = browser.getDirectory() + filename;
32893912 //CameraPane.framecount = 0;
3290
- CameraPane.imagecount = 0;
3913
+ Globals.imagecount = 0;
32913914
3292
- CameraPane.ANIMATION ^= true;
3915
+ Globals.ANIMATION ^= true;
32933916
3294
- GrafreeD.wav.cursor = 0;
3295
- GrafreeD.wav.loop = 0;
3917
+ Grafreed.wav.cursor = 0;
3918
+ Grafreed.wav.loop = 0;
32963919 }
32973920 } else
32983921 {
3299
- CameraPane.ANIMATION ^= true;
3922
+ Globals.ANIMATION ^= true;
33003923 }
33013924 }
33023925
....@@ -3342,7 +3965,7 @@
33423965 void CreateMaterial()
33433966 {
33443967 //copy.ClearMaterial(); // PATCH
3345
- copy.CreateMaterialS(multiplyToggle.isSelected());
3968
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33463969 if (copy.selection.size() > 0)
33473970 //SetMaterial(copy);
33483971 {
....@@ -3393,7 +4016,7 @@
33934016 assert false;
33944017 }
33954018
3396
- void EditSelection()
4019
+ void EditSelection(boolean newWindow)
33974020 {
33984021 }
33994022
....@@ -3401,11 +4024,11 @@
34014024 {
34024025 copy.ResetBlockLoop(); // temporary problem
34034026
3404
- boolean random = CameraPane.RANDOM;
3405
- CameraPane.RANDOM = false; // parse everything
4027
+ boolean random = CameraPane.SWITCH;
4028
+ CameraPane.SWITCH = false; // parse everything
34064029 copy.ResetDisplayList();
34074030 copy.HardTouch();
3408
- CameraPane.RANDOM = random;
4031
+ CameraPane.SWITCH = random;
34094032 }
34104033
34114034 // public void applySelf()
....@@ -3475,10 +4098,40 @@
34754098 current.fakedepth = (float) fakedepthField.getFloat();
34764099 current.shadowbias = (float) shadowbiasField.getFloat();
34774100
3478
- if (!NumberSlider.frozen)
4101
+ if (!cNumberSlider.frozen)
34794102 {
34804103 //System.out.println("Propagate = " + propagate);
34814104 copy.UpdateMaterial(anchor, current, propagate);
4105
+
4106
+ if (copy.material != null)
4107
+ {
4108
+ cMaterial mat = copy.material;
4109
+
4110
+ colorField.SetToolTipValue((mat.color));
4111
+ modulationField.SetToolTipValue((mat.modulation));
4112
+ metalnessField.SetToolTipValue((mat.metalness));
4113
+ diffuseField.SetToolTipValue((mat.diffuse));
4114
+ specularField.SetToolTipValue((mat.specular));
4115
+ shininessField.SetToolTipValue((mat.shininess));
4116
+ shiftField.SetToolTipValue((mat.shift));
4117
+ ambientField.SetToolTipValue((mat.ambient));
4118
+ lightareaField.SetToolTipValue((mat.lightarea));
4119
+ diffusenessField.SetToolTipValue((mat.factor));
4120
+ velvetField.SetToolTipValue((mat.velvet));
4121
+ sheenField.SetToolTipValue((mat.sheen));
4122
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4123
+ backlitField.SetToolTipValue((mat.bump));
4124
+ anisoField.SetToolTipValue((mat.aniso));
4125
+ anisoVField.SetToolTipValue((mat.anisoV));
4126
+ cameraField.SetToolTipValue((mat.cameralight));
4127
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4128
+ shadowField.SetToolTipValue((mat.shadow));
4129
+ textureField.SetToolTipValue((mat.texture));
4130
+ opacityField.SetToolTipValue((mat.opacity));
4131
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4132
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4133
+ }
4134
+
34824135 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34834136 {
34844137 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3507,9 +4160,25 @@
35074160 //copy.Touch();
35084161 }
35094162
4163
+ cNumberSlider versionSlider;
4164
+
35104165 public void stateChanged(ChangeEvent e)
35114166 {
35124167 // assert(false);
4168
+ if (e.getSource() == versionSlider)
4169
+ {
4170
+ if (muteSlider)
4171
+ return;
4172
+
4173
+ int version = versionSlider.getInteger();
4174
+
4175
+ if (copy.versions[version] != null)
4176
+ {
4177
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4178
+ }
4179
+
4180
+ return;
4181
+ }
35134182
35144183 if (freezematerial)
35154184 {
....@@ -3523,6 +4192,7 @@
35234192 || e.getSource() == apertureField
35244193 || e.getSource() == shadowblurField)
35254194 {
4195
+ new Exception().printStackTrace();
35264196 System.exit(0);
35274197 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35284198 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3549,7 +4219,13 @@
35494219 //System.out.println("PARENT = " + parent);
35504220 //if (parent != null)
35514221 // parent.applySelf();
3552
- refreshContents();
4222
+ if (e.getSource() == normalpushField)
4223
+ {
4224
+ objEditor.refreshContents();
4225
+ //Refresh();
4226
+ }
4227
+ else
4228
+ refreshContents();
35534229 // ??? client.refreshEditWindow();
35544230 }
35554231 //else
....@@ -3561,7 +4237,7 @@
35614237 //group.name = nameField.getText();
35624238 //objEditor.applySelf();
35634239
3564
- assert (objEditor == this);
4240
+ // OCT2018: assert (objEditor == this);
35654241 if (copy.selection == null || copy.selection.size() == 0)
35664242 //super.applySelf()
35674243 ; else
....@@ -3585,6 +4261,9 @@
35854261 objEditor.copy = keep;
35864262 }
35874263 }
4264
+
4265
+ if (normalpushField != null)
4266
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35884267 }
35894268
35904269 void SnapObject()
....@@ -3839,7 +4518,7 @@
38394518
38404519 radioPanel.revalidate();
38414520 radioPanel.repaint();
3842
- ctrlPanel.revalidate(); // ? new
4521
+ ctrlPanel.validate(); // ? new
38434522 ctrlPanel.repaint();
38444523 }
38454524 }
....@@ -3848,6 +4527,8 @@
38484527
38494528 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38504529 {
4530
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4531
+ Save();
38514532 //Tween.set(thing, 0).target(1).start(tweenManager);
38524533 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38534534 // if (thing instanceof GenericJointDemo)
....@@ -3934,6 +4615,12 @@
39344615 {
39354616 ResetModel();
39364617 Select(thing.GetTreePath(), true, false); // unselect... false);
4618
+
4619
+ if (thing.Size() == 0)
4620
+ {
4621
+ //EditSelection(false);
4622
+ }
4623
+
39374624 refreshContents();
39384625 }
39394626
....@@ -4051,6 +4738,7 @@
40514738 }
40524739 }
40534740 }
4741
+
40544742 LoadGFDThread loadGFDThread;
40554743
40564744 void ReadGFD(String fullname, iCallBack cb)
....@@ -4070,8 +4758,10 @@
40704758
40714759 try
40724760 {
4761
+ // Try compressed version first.
40734762 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4074
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4763
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4764
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40754765
40764766 readobj = (Object3D) p.readObject();
40774767 istream.close();
....@@ -4079,7 +4769,22 @@
40794769 readobj.ResetDisplayList();
40804770 } catch (Exception e)
40814771 {
4082
- e.printStackTrace();
4772
+ if (!e.toString().contains("GZIP"))
4773
+ e.printStackTrace();
4774
+
4775
+ try
4776
+ {
4777
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4778
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4779
+
4780
+ readobj = (Object3D) p.readObject();
4781
+ istream.close();
4782
+
4783
+ readobj.ResetDisplayList();
4784
+ } catch (Exception e2)
4785
+ {
4786
+ e2.printStackTrace();
4787
+ }
40834788 }
40844789 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40854790 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4125,6 +4830,12 @@
41254830
41264831 void LoadIt(Object obj)
41274832 {
4833
+ if (obj == null)
4834
+ {
4835
+ // Invalid file
4836
+ return;
4837
+ }
4838
+
41284839 System.out.println("Loaded " + obj);
41294840 //new Exception().printStackTrace();
41304841 Object3D readobj = (Object3D) obj;
....@@ -4134,6 +4845,8 @@
41344845
41354846 if (readobj != null)
41364847 {
4848
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4849
+ // Save();
41374850 try
41384851 {
41394852 //readobj.deepCopySelf(copy);
....@@ -4178,6 +4891,7 @@
41784891 }
41794892 } catch (ClassCastException e)
41804893 {
4894
+ e.printStackTrace();
41814895 assert (false);
41824896 Composite c = (Composite) copy;
41834897 c.children.clear();
....@@ -4188,15 +4902,26 @@
41884902 c.addChild(csg);
41894903 }
41904904
4905
+ copy.versions = readobj.versions;
4906
+ copy.versionindex = readobj.versionindex;
4907
+
4908
+ if (copy.versions == null)
4909
+ {
4910
+ copy.versions = new byte[100][];
4911
+ copy.versionindex = -1;
4912
+ }
4913
+
4914
+ //? SetUndoStates();
4915
+
41914916 ResetModel();
41924917 copy.HardTouch(); // recompile?
41934918 refreshContents();
41944919 }
41954920 }
41964921
4197
- void load() // throws ClassNotFoundException
4922
+ void Open() // throws ClassNotFoundException
41984923 {
4199
- if (GrafreeD.standAlone)
4924
+ if (Grafreed.standAlone)
42004925 {
42014926 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42024927 browser.show();
....@@ -4283,11 +5008,13 @@
42835008 try
42845009 {
42855010 FileOutputStream ostream = new FileOutputStream(lastname);
4286
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5011
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5012
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42875013
42885014 p.writeObject(copy);
42895015 p.flush();
42905016
5017
+ zstream.close();
42915018 ostream.close();
42925019
42935020 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4295,19 +5022,23 @@
42955022 //ps.print(buffer.toString());
42965023 } catch (IOException e)
42975024 {
5025
+ e.printStackTrace();
42985026 }
42995027 }
5028
+
43005029 String lastname;
43015030
43025031 void saveAs()
43035032 {
4304
- if (GrafreeD.standAlone)
5033
+ if (Grafreed.standAlone)
43055034 {
43065035 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43075036 browser.setVisible(true);
43085037 String filename = browser.getFile();
43095038 if (filename != null && filename.length() > 0)
43105039 {
5040
+ if (!filename.endsWith(".gfd"))
5041
+ filename += ".gfd";
43115042 lastname = browser.getDirectory() + filename;
43125043 save();
43135044 }
....@@ -4406,13 +5137,13 @@
44065137 try
44075138 {
44085139 FileOutputStream ostream = new FileOutputStream(filename);
4409
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4410
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5140
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5141
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44115142
44125143 Object3D objectparent = obj.parent;
44135144 obj.parent = null;
44145145
4415
- Object3D object = (Object3D) GrafreeD.clone(obj);
5146
+ Object3D object = (Object3D) Grafreed.clone(obj);
44165147
44175148 obj.parent = objectparent;
44185149
....@@ -4424,8 +5155,8 @@
44245155 p.writeObject(object);
44255156 p.flush();
44265157
5158
+ zstream.close();
44275159 ostream.close();
4428
- // zstream.close();
44295160
44305161 // group.selection.get(0).parent = parent;
44315162 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4446,7 +5177,7 @@
44465177 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44475178 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44485179 copy.generatePOV(buffer);
4449
- if (GrafreeD.standAlone)
5180
+ if (Grafreed.standAlone)
44505181 {
44515182 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44525183 browser.show();
....@@ -4472,21 +5203,20 @@
44725203 Object3D client;
44735204 Object3D copy;
44745205 MenuBar menuBar;
4475
- Menu windowMenu;
4476
- MenuItem loadItem;
5206
+ Menu fileMenu;
5207
+ MenuItem newItem;
5208
+ MenuItem openItem;
44775209 MenuItem saveItem;
44785210 MenuItem saveAsItem;
44795211 MenuItem exportAsItem;
44805212 MenuItem reexportItem;
44815213 MenuItem povItem;
44825214 MenuItem closeItem;
4483
- Menu cameraMenu;
5215
+
44845216 CheckboxMenuItem zBufferItem;
44855217 //MenuItem normalLensItem;
4486
- MenuItem editCameraItem;
4487
- MenuItem revertCameraItem;
4488
- CheckboxMenuItem toggleLiveItem;
44895218 MenuItem stepItem;
5219
+ CheckboxMenuItem toggleLiveItem;
44905220 CheckboxMenuItem toggleFullScreenItem;
44915221 CheckboxMenuItem toggleTimelineItem;
44925222 CheckboxMenuItem toggleRenderItem;
....@@ -4495,28 +5225,43 @@
44955225 CheckboxMenuItem toggleFootContactItem;
44965226 CheckboxMenuItem toggleDLItem;
44975227 CheckboxMenuItem toggleTextureItem;
4498
- CheckboxMenuItem toggleRandomItem;
5228
+ CheckboxMenuItem toggleSwitchItem;
44995229 CheckboxMenuItem toggleRootItem;
45005230 CheckboxMenuItem animationItem;
5231
+ MenuItem archiveItem;
45015232 CheckboxMenuItem toggleHandleItem;
45025233 CheckboxMenuItem togglePaintItem;
45035234 JSplitPane mainPanel;
45045235 JScrollPane scrollpane;
5236
+
45055237 JPanel toolbarPanel;
4506
- JPanel treePanel;
5238
+
5239
+ cGridBag treePanel;
5240
+
45075241 JPanel radioPanel;
45085242 ButtonGroup buttonGroup;
4509
- JPanel ctrlPanel;
4510
- JPanel materialPanel;
5243
+
5244
+ cGridBag toolboxPanel;
5245
+ cGridBag materialPanel;
5246
+ cGridBag ctrlPanel;
5247
+
45115248 JScrollPane infoPanel;
4512
- JPanel optionsPanel;
5249
+
5250
+ cGridBag optionsPanel;
5251
+
45135252 JTabbedPane objectPanel;
4514
- JPanel XYZPanel;
5253
+ boolean materialFlushed;
5254
+ Object3D latestObject;
5255
+
5256
+ cGridBag XYZPanel;
5257
+
45155258 JSplitPane gridPanel;
45165259 JSplitPane bigPanel;
4517
- JPanel bigThree;
4518
- JTabbedPane scenePanel;
4519
- JPanel centralPanel;
5260
+
5261
+ cGridBag bigThree;
5262
+ cGridBag scenePanel;
5263
+ cGridBag centralPanel;
5264
+ JSplitPane cameraPanel;
45205265 JPanel timelinePanel;
45215266 JMenuBar timelineMenubar;
45225267 JSplitPane framePanel;
....@@ -4568,65 +5313,72 @@
45685313 // MATERIAL
45695314 JLabel materialLabel;
45705315 JLabel colorLabel;
4571
- NumberSlider colorField;
5316
+ cNumberSlider colorField;
45725317 JLabel modulationLabel;
4573
- NumberSlider modulationField;
5318
+ cNumberSlider modulationField;
45745319 JLabel metalnessLabel;
4575
- NumberSlider metalnessField;
5320
+ cNumberSlider metalnessField;
45765321 JLabel diffuseLabel;
4577
- NumberSlider diffuseField;
5322
+ cNumberSlider diffuseField;
45785323 JLabel specularLabel;
4579
- NumberSlider specularField;
5324
+ cNumberSlider specularField;
45805325 JLabel shininessLabel;
4581
- NumberSlider shininessField;
5326
+ cNumberSlider shininessField;
45825327 JLabel shiftLabel;
4583
- NumberSlider shiftField;
5328
+ cNumberSlider shiftField;
45845329 JLabel ambientLabel;
4585
- NumberSlider ambientField;
5330
+ cNumberSlider ambientField;
45865331 JLabel lightareaLabel;
4587
- NumberSlider lightareaField;
5332
+ cNumberSlider lightareaField;
45885333 JLabel diffusenessLabel;
4589
- NumberSlider diffusenessField;
5334
+ cNumberSlider diffusenessField;
45905335 JLabel velvetLabel;
4591
- NumberSlider velvetField;
5336
+ cNumberSlider velvetField;
45925337 JLabel sheenLabel;
4593
- NumberSlider sheenField;
5338
+ cNumberSlider sheenField;
45945339 JLabel subsurfaceLabel;
4595
- NumberSlider subsurfaceField;
5340
+ cNumberSlider subsurfaceField;
45965341 //JLabel bumpLabel;
45975342 //NumberSlider bumpField;
45985343 JLabel backlitLabel;
4599
- NumberSlider backlitField;
5344
+ cNumberSlider backlitField;
46005345 JLabel anisoLabel;
4601
- NumberSlider anisoField;
5346
+ cNumberSlider anisoField;
46025347 JLabel anisoVLabel;
4603
- NumberSlider anisoVField;
5348
+ cNumberSlider anisoVField;
46045349 JLabel cameraLabel;
4605
- NumberSlider cameraField;
5350
+ cNumberSlider cameraField;
46065351 JLabel selfshadowLabel;
4607
- NumberSlider selfshadowField;
5352
+ cNumberSlider selfshadowField;
46085353 JLabel shadowLabel;
4609
- NumberSlider shadowField;
5354
+ cNumberSlider shadowField;
46105355 JLabel textureLabel;
4611
- NumberSlider textureField;
5356
+ cNumberSlider textureField;
46125357 JLabel opacityLabel;
4613
- NumberSlider opacityField;
5358
+ cNumberSlider opacityField;
46145359 JLabel fakedepthLabel;
4615
- NumberSlider fakedepthField;
5360
+ cNumberSlider fakedepthField;
46165361 JLabel shadowbiasLabel;
4617
- NumberSlider shadowbiasField;
5362
+ cNumberSlider shadowbiasField;
46185363 JLabel bumpLabel;
4619
- NumberSlider bumpField;
5364
+ cNumberSlider bumpField;
46205365 JLabel noiseLabel;
4621
- NumberSlider noiseField;
5366
+ cNumberSlider noiseField;
46225367 JLabel powerLabel;
4623
- NumberSlider powerField;
5368
+ cNumberSlider powerField;
46245369 JLabel borderfadeLabel;
4625
- NumberSlider borderfadeField;
5370
+ cNumberSlider borderfadeField;
46265371 JLabel fogLabel;
4627
- NumberSlider fogField;
5372
+ cNumberSlider fogField;
46285373 JLabel opacityPowerLabel;
4629
- NumberSlider opacityPowerField;
4630
- JTree jTree;
5374
+ cNumberSlider opacityPowerField;
5375
+ cTree jTree;
46315376 //ObjectUI parent;
5377
+
5378
+ cNumberSlider normalpushField;
5379
+
5380
+ private MenuItem importGFDItem;
5381
+ private MenuItem importVRMLX3DItem;
5382
+ private MenuItem import3DSItem;
5383
+ private MenuItem importOBJItem;
46325384 }