Normand Briere
2019-07-18 d7a17c35c443e2cb6c09eaa3cfeaf590a571faa1
ObjEditor.java
....@@ -4,6 +4,7 @@
44
55 import java.awt.*;
66 import java.awt.event.*;
7
+import java.awt.image.BufferedImage;
78 import javax.swing.*;
89 import javax.swing.event.*;
910 import javax.swing.text.*;
....@@ -14,10 +15,15 @@
1415 //import javax.swing.plaf.ColorUIResource;
1516 //import javax.swing.plaf.metal.DefaultMetalTheme;
1617
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
20
+
1721 //import javax.media.opengl.GLCanvas;
1822
1923 import //weka.core.
2024 matrix.Matrix;
25
+
26
+import grafeme.ui.*;
2127
2228 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
2329 ActionListener, ChangeListener,
....@@ -28,7 +34,73 @@
2834 iSendInfo
2935 //KeyListener
3036 {
37
+ boolean timeline;
38
+ boolean wasFullScreen;
3139
40
+ GroupEditor callee;
41
+ JFrame frame;
42
+
43
+ static ObjEditor theFrame;
44
+
45
+ cButton GetButton(String name, boolean border)
46
+ {
47
+ try
48
+ {
49
+ ImageIcon icon = GetIcon(name);
50
+ return new cButton(icon, border);
51
+ }
52
+ catch (Exception e)
53
+ {
54
+ return new cButton(name, border);
55
+ }
56
+ }
57
+
58
+ cToggleButton GetToggleButton(String name, boolean border)
59
+ {
60
+ try
61
+ {
62
+ ImageIcon icon = GetIcon(name);
63
+ return new cToggleButton(icon, border);
64
+ }
65
+ catch (Exception e)
66
+ {
67
+ return new cToggleButton(name, border);
68
+ }
69
+ }
70
+
71
+ cCheckBox GetCheckBox(String name, boolean border)
72
+ {
73
+ try
74
+ {
75
+ ImageIcon icon = GetIcon(name);
76
+ return new cCheckBox(icon, border);
77
+ }
78
+ catch (Exception e)
79
+ {
80
+ return new cCheckBox(name, border);
81
+ }
82
+ }
83
+
84
+ private ImageIcon GetIcon(String name) throws IOException
85
+ {
86
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
87
+
88
+ if (image.getWidth() != 24 && image.getHeight() != 24)
89
+ {
90
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
91
+ Graphics2D g = resized.createGraphics();
92
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
93
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
94
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
95
+ g.dispose();
96
+
97
+ image = resized;
98
+ }
99
+
100
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
101
+ return icon;
102
+ }
103
+
32104 // SCRIPT
33105
34106 transient JFrame textpanel = null;
....@@ -119,51 +191,62 @@
119191 void keyPressed(int key, int modifiers)
120192 {
121193 System.out.println("KEY PRESSED");
122
- CameraPane.theRenderer.keyPressed(key, modifiers);
194
+ Globals.theRenderer.keyPressed(key, modifiers);
123195 }
124196 */
125197
126198 static GridBagConstraints aConstraints;
127199 static GridBagConstraints aWindowConstraints;
128
- GroupEditor callee;
129
- JFrame frame;
200
+
130201 static int GRIDWIDTH = 100; // 4;
131202
132203 public void closeUI()
133204 {
134205 //new Exception().printStackTrace();
135
- System.out.println("this = " + this);
136
- System.out.println("objEditor = " + objEditor);
206
+// System.out.println("this = " + this);
207
+// System.out.println("objEditor = " + objEditor);
137208 //nameField.removeActionListener(this);
138
- objEditor.ctrlPanel.remove(nameField);
209
+// objEditor.ctrlPanel.remove(nameField);
139210
140
- if (!GroupEditor.allparams)
211
+ objEditor.ctrlPanel.remove(namePanel);
212
+
213
+ if (!allparams)
141214 return;
142215
143
- objEditor.ctrlPanel.remove(liveCB);
144
- objEditor.ctrlPanel.remove(hideCB);
145
- objEditor.ctrlPanel.remove(markCB);
146
-
147
- objEditor.ctrlPanel.remove(randomCB);
148
- objEditor.ctrlPanel.remove(speedupCB);
149
- objEditor.ctrlPanel.remove(rewindCB);
150
-
151
- objEditor.ctrlPanel.remove(resetButton);
152
- objEditor.ctrlPanel.remove(stepButton);
153
-// objEditor.ctrlPanel.remove(stepAllButton);
154
-// objEditor.ctrlPanel.remove(resetAllButton);
155
- objEditor.ctrlPanel.remove(link2masterCB);
156
- //objEditor.ctrlPanel.remove(flipVCB);
157
- //objEditor.ctrlPanel.remove(texresMenu);
158
- objEditor.ctrlPanel.remove(slowerButton);
159
- objEditor.ctrlPanel.remove(fasterButton);
160
- objEditor.ctrlPanel.remove(remarkButton);
216
+// objEditor.ctrlPanel.remove(liveCB);
217
+// objEditor.ctrlPanel.remove(hideCB);
218
+// objEditor.ctrlPanel.remove(markCB);
219
+//
220
+// objEditor.ctrlPanel.remove(randomCB);
221
+// objEditor.ctrlPanel.remove(speedupCB);
222
+// objEditor.ctrlPanel.remove(rewindCB);
223
+//
224
+// objEditor.ctrlPanel.remove(resetButton);
225
+// objEditor.ctrlPanel.remove(stepButton);
226
+//// objEditor.ctrlPanel.remove(stepAllButton);
227
+//// objEditor.ctrlPanel.remove(resetAllButton);
228
+// objEditor.ctrlPanel.remove(link2masterCB);
229
+// //objEditor.ctrlPanel.remove(flipVCB);
230
+// //objEditor.ctrlPanel.remove(texresMenu);
231
+// objEditor.ctrlPanel.remove(slowerButton);
232
+// objEditor.ctrlPanel.remove(fasterButton);
233
+// objEditor.ctrlPanel.remove(remarkButton);
234
+
235
+ objEditor.ctrlPanel.remove(setupPanel);
236
+ objEditor.ctrlPanel.remove(setupPanel2);
237
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
238
+ objEditor.ctrlPanel.remove(pushPanel);
239
+ //objEditor.ctrlPanel.remove(fillPanel);
240
+
241
+ //Remove(normalpushField);
161242 }
162243
163244 public ObjEditor GetEditor()
164245 {
165246 return objEditor; //.GetEditor();
166247 }
248
+
249
+ // Sometimes myself, sometimes my callee's.
167250 ObjEditor objEditor;
168251
169252 /*
....@@ -199,6 +282,12 @@
199282 client = inClient;
200283 copy = client;
201284
285
+ if (copy.versions == null)
286
+ {
287
+ copy.versions = new byte[100][];
288
+ copy.versionindex = -1;
289
+ }
290
+
202291 // "this" is not called: SetupUI2(objEditor);
203292 }
204293
....@@ -212,6 +301,12 @@
212301 client = inClient;
213302 copy = client;
214303
304
+ if (copy.versions == null)
305
+ {
306
+ copy.versions = new byte[100][];
307
+ copy.versionindex = -1;
308
+ }
309
+
215310 SetupUI2(callee.GetEditor());
216311 }
217312
....@@ -226,6 +321,7 @@
226321 //localCopy.parent = null;
227322
228323 frame = new JFrame();
324
+ frame.setUndecorated(false);
229325 objEditor = this;
230326 this.callee = callee;
231327
....@@ -238,11 +334,17 @@
238334 //if (!isDisplayable())
239335 //setUndecorated(true);
240336
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
337
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242338 client = inClient;
243339 copy = localCopy;
244340 copy.editWindow = this;
245341
342
+ if (copy.versions == null)
343
+ {
344
+ copy.versions = new byte[100][];
345
+ copy.versionindex = -1;
346
+ }
347
+
246348 SetupMenu();
247349
248350 //SetupName(objEditor); // new
....@@ -256,28 +358,49 @@
256358 return frame.action(event, obj);
257359 }
258360
361
+ // Cannot work without static
362
+ static boolean allparams = true;
363
+
364
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
365
+
259366 void SetupMenu()
260367 {
261368 frame.setMenuBar(menuBar = new MenuBar());
262
- menuBar.add(windowMenu = new Menu("File"));
263
- windowMenu.add(loadItem = new MenuItem("Load..."));
264
- windowMenu.add("-");
265
- windowMenu.add(saveItem = new MenuItem("Save"));
266
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
369
+ menuBar.add(fileMenu = new Menu("File"));
370
+ fileMenu.add(newItem = new MenuItem("New"));
371
+ fileMenu.add(openItem = new MenuItem("Open..."));
372
+
373
+ //oe.menuBar.add(menu = new Menu("Include"));
374
+ Menu menu = new Menu("Import");
375
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
376
+ importOBJItem.addActionListener(this);
377
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
378
+ import3DSItem.addActionListener(this);
379
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
380
+ importVRMLX3DItem.addActionListener(this);
381
+ menu.add("-");
382
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
383
+ importGFDItem.addActionListener(this);
384
+ fileMenu.add(menu);
385
+ fileMenu.add("-");
386
+
387
+ fileMenu.add(saveItem = new MenuItem("Save"));
388
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267389 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
268
- windowMenu.add("-");
269
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
270
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
271
- windowMenu.add("-");
390
+ fileMenu.add("-");
391
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
392
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
393
+ fileMenu.add("-");
272394 if (client.parent != null)
273395 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
396
+ fileMenu.add(closeItem = new MenuItem("Close"));
275397 } else
276398 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
399
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278400 }
279401
280
- loadItem.addActionListener(this);
402
+ newItem.addActionListener(this);
403
+ openItem.addActionListener(this);
281404 saveItem.addActionListener(this);
282405 saveAsItem.addActionListener(this);
283406 exportAsItem.addActionListener(this);
....@@ -285,79 +408,66 @@
285408 //povItem.addActionListener(this);
286409 closeItem.addActionListener(this);
287410
288
- menuBar.add(cameraMenu = new Menu("View"));
289
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
290
- //zBufferItem.addActionListener(this);
291
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
292
- //normalLensItem.addActionListener(this);
293
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
294
- revertCameraItem.addActionListener(this);
295
- cameraMenu.add(toggleFullItem = new CheckboxMenuItem("Full Screen"));
296
- toggleFullItem.addItemListener(this);
297
- toggleFullItem.setState(CameraPane.FULLSCREEN);
298
- cameraMenu.add("-");
299
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
300
- toggleTextureItem.addItemListener(this);
301
- toggleTextureItem.setState(CameraPane.textureon);
302
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
303
- toggleLiveItem.addItemListener(this);
304
- toggleLiveItem.setState(CameraPane.isLIVE());
305
- cameraMenu.add(stepItem = new MenuItem("Step"));
306
- stepItem.addActionListener(this);
307
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
308
-// toggleDLItem.addItemListener(this);
309
-// toggleDLItem.setState(false);
310
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
311
- toggleRenderItem.addItemListener(this);
312
- toggleRenderItem.setState(!CameraPane.frozen);
313
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
314
- toggleDebugItem.addItemListener(this);
315
- toggleDebugItem.setState(CameraPane.DEBUG);
316
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
317
- toggleFrustumItem.addItemListener(this);
318
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
319
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
320
- toggleFootContactItem.addItemListener(this);
321
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
322
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
323
- toggleRandomItem.addItemListener(this);
324
- toggleRandomItem.setState(CameraPane.RANDOM);
325
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
326
- toggleHandleItem.addItemListener(this);
327
- toggleHandleItem.setState(CameraPane.HANDLES);
328
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
329
- togglePaintItem.addItemListener(this);
330
- togglePaintItem.setState(CameraPane.PAINTMODE);
331
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
332
-// toggleRootItem.addItemListener(this);
333
-// toggleRootItem.setState(false);
334
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
335
-// animationItem.addItemListener(this);
336
-// animationItem.setState(CameraPane.ANIMATION);
337
- cameraMenu.add("-");
338
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
339
- editCameraItem.addActionListener(this);
340
-
341411 objectPanel = new JTabbedPane();
412
+
413
+ ChangeListener changeListener = new ChangeListener()
414
+ {
415
+ public void stateChanged(ChangeEvent changeEvent)
416
+ {
417
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
418
+// {
419
+// if (latestObject != null)
420
+// {
421
+// refreshContents(true);
422
+// SetMaterial(latestObject);
423
+// }
424
+//
425
+// materialFlushed = true;
426
+// }
427
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
428
+// {
429
+// if (listUI.size() == 0)
430
+// EditSelection(false);
431
+// }
432
+
433
+ refreshContents(false); // To refresh Info tab
434
+ }
435
+ };
436
+ objectPanel.addChangeListener(changeListener);
437
+
342438 toolbarPanel = new JPanel();
343439 toolbarPanel.setName("Toolbar");
344
- treePanel = new JPanel();
440
+ treePanel = new cGridBag();
345441 treePanel.setName("Tree");
346
- ctrlPanel = new JPanel(); // new GridBagLayout());
347
- ctrlPanel.setName("Edit");
348
- materialPanel = new JPanel();
442
+
443
+ editPanel = new cGridBag().setVertical(true);
444
+ editPanel.setName("Edit");
445
+
446
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
447
+
448
+ editCommandsPanel = new cGridBag();
449
+ editPanel.add(editCommandsPanel);
450
+ editPanel.add(ctrlPanel);
451
+
452
+ toolboxPanel = new cGridBag().setVertical(false);
453
+ toolboxPanel.setName("Toolbox");
454
+
455
+ materialPanel = new cGridBag().setVertical(true);
349456 materialPanel.setName("Material");
457
+
350458 /*JTextPane*/
351459 infoarea = createTextPane();
460
+ doc = infoarea.getStyledDocument();
461
+
352462 infoarea.setEditable(true);
353463 SetText();
354464 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
355465 // infoarea.setOpaque(false);
356466 // //infoarea.setForeground(textcolor);
357
- infoarea.setLineWrap(true);
358
- infoarea.setWrapStyleWord(true);
467
+// TEXTAREA infoarea.setLineWrap(true);
468
+// TEXTAREA infoarea.setWrapStyleWord(true);
359469 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
360
- infoPanel.setPreferredSize(new Dimension(50, 200));
470
+ infoPanel.setPreferredSize(new Dimension(1, 1));
361471 infoPanel.setName("Info");
362472 //infoPanel.setLayout(new BorderLayout());
363473 //infoPanel.add(createTextPane());
....@@ -366,16 +476,23 @@
366476 mainPanel.setName("Main");
367477 mainPanel.setContinuousLayout(true);
368478 mainPanel.setOneTouchExpandable(true);
369
- mainPanel.setDividerLocation(1.0);
370479 mainPanel.setDividerSize(9);
371
- mainPanel.setResizeWeight(0);
372
-
480
+ mainPanel.setDividerLocation(0.5); //1.0);
481
+ mainPanel.setResizeWeight(0.5);
482
+
483
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
484
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
485
+ divider.setDividerSize(15);
486
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
487
+
488
+ mainPanel.setUI(new BasicSplitPaneUI());
489
+
373490 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
374491 //mainPanel.setLayout(new GridBagLayout());
375492 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
376
- treePanel.setLayout(new GridBagLayout());
377
- ctrlPanel.setLayout(new GridBagLayout());
378
- materialPanel.setLayout(new GridBagLayout());
493
+// treePanel.setLayout(new GridBagLayout());
494
+ //ctrlPanel.setLayout(new GridBagLayout());
495
+ //materialPanel.setLayout(new GridBagLayout());
379496
380497 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
381498 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -414,7 +531,7 @@
414531 static String newline = "\n";
415532 protected static final String buttonString = "JButton";
416533 StyledDocument doc;
417
- JTextArea infoarea;
534
+ JTextPane infoarea;
418535
419536 void ClearInfo()
420537 {
....@@ -437,10 +554,10 @@
437554 e.printStackTrace();
438555 }
439556
440
- String selection = infoarea.getText();
441
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
442
- java.awt.datatransfer.Clipboard clipboard =
443
- Toolkit.getDefaultToolkit().getSystemClipboard();
557
+// String selection = infoarea.getText();
558
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
559
+// java.awt.datatransfer.Clipboard clipboard =
560
+// Toolkit.getDefaultToolkit().getSystemClipboard();
444561 //clipboard.setContents(data, data);
445562 }
446563
....@@ -463,13 +580,13 @@
463580 //SendInfo("Name:", "bold");
464581 if (sel.GetTextures() != null || debug)
465582 {
466
- si.SendInfo(sel.toString(), "bold");
583
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
467584 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
468585 if (sel.Size() > 0)
469586 {
470587 si.SendInfo("#children = " + sel.Size(), "regular");
471588 }
472
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
589
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
473590 if (debug)
474591 {
475592 try
....@@ -481,7 +598,10 @@
481598 }
482599
483600 if (full)
484
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
601
+ {
602
+ si.SendInfo(" BBox min: " + minima, "regular");
603
+ si.SendInfo(" BBox max: " + maxima, "regular");
604
+ }
485605
486606 if (sel.bRep != null)
487607 {
....@@ -508,7 +628,7 @@
508628 }
509629 if (sel.support != null)
510630 {
511
- si.SendInfo(" support: " + sel.support, "regular");
631
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
512632 }
513633 if (sel.scriptnode != null)
514634 {
....@@ -579,6 +699,9 @@
579699 {
580700 CameraPane.pointflow = (PointFlow) sel;
581701 }
702
+
703
+ si.SendInfo("_____________________", "regular");
704
+ si.SendInfo("", "regular");
582705 }
583706 }
584707
....@@ -594,52 +717,191 @@
594717 }
595718 }
596719
597
- private JTextArea createTextPane()
598
- {
599
- String[] initString =
600
- {
601
- "This is an editable JTextPane, ", //regular
602
- "another ", //italic
603
- "styled ", //bold
604
- "text ", //small
605
- "component, ", //large
606
- "which supports embedded components..." + newline,//regular
607
- " " + newline, //button
608
- "...and embedded icons..." + newline, //regular
609
- " ", //icon
610
- newline + "JTextPane is a subclass of JEditorPane that "
611
- + "uses a StyledEditorKit and StyledDocument, and provides "
612
- + "cover methods for interacting with those objects."
613
- };
720
+//static GraphicsDevice device = GraphicsEnvironment
721
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
614722
615
- String[] initStyles =
616
- {
617
- "regular", "italic", "bold", "small", "large",
618
- "regular", "button", "regular", "icon",
619
- "regular"
620
- };
723
+ Rectangle keeprect;
724
+ cRadio radio;
725
+
726
+cButton keepButton;
727
+ cButton twoButton; // Full 3D
728
+ cButton sixButton;
729
+ cButton threeButton;
730
+ cButton sevenButton;
731
+ cButton fourButton; // full panel
732
+ cButton oneButton; // full XYZ
733
+ //cButton currentLayout;
734
+
735
+ boolean maximized;
736
+
737
+ cButton fullscreenLayout;
621738
622
- JTextPane textPane = new JTextPane();
623
- textPane.setEditable(true);
624
- /*StyledDocument*/ doc = textPane.getStyledDocument();
625
- addStylesToDocument(doc);
626
-
627
- try
739
+ void Minimize()
628740 {
629
- for (int j = 0; j < 2; j++)
741
+ frame.setState(Frame.ICONIFIED);
742
+ frame.validate();
743
+ }
744
+
745
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
746
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
747
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
748
+ void Maximize()
749
+ {
750
+ if (CameraPane.FULLSCREEN)
630751 {
631
- for (int i = 0; i < initString.length; i++)
632
- {
633
- doc.insertString(doc.getLength(), initString[i],
634
- doc.getStyle(initStyles[i]));
635
- }
752
+ ToggleFullScreen();
636753 }
637
- } catch (BadLocationException ble)
754
+
755
+ if (maximized)
756
+ {
757
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
758
+ }
759
+ else
760
+ {
761
+ keeprect = frame.getBounds();
762
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
763
+// Dimension rect2 = frame.getToolkit().getScreenSize();
764
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
765
+// frame.setState(Frame.MAXIMIZED_BOTH);
766
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
767
+ }
768
+
769
+ maximized ^= true;
770
+
771
+ frame.validate();
772
+ }
773
+
774
+ cButton minButton;
775
+ cButton maxButton;
776
+ cButton fullButton;
777
+
778
+ void ToggleFullScreen()
638779 {
639
- System.err.println("Couldn't insert initial text into text pane.");
780
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
781
+
782
+ cameraView.ToggleFullScreen();
783
+
784
+ if (!CameraPane.FULLSCREEN)
785
+ {
786
+ device.setFullScreenWindow(null);
787
+ frame.dispose();
788
+ frame.setUndecorated(false);
789
+ frame.validate();
790
+ frame.setVisible(true);
791
+
792
+ //frame.setVisible(false);
793
+// frame.removeNotify();
794
+// frame.setUndecorated(false);
795
+// frame.addNotify();
796
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
797
+
798
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
799
+// X framePanel.add(bigThree);
800
+// X frame.getContentPane().add(/*"Center",*/framePanel);
801
+ framePanel.setDividerLocation(46);
802
+
803
+ //frame.setVisible(true);
804
+ radio.layout = keepButton;
805
+ //theFrame = null;
806
+ keepButton = null;
807
+ radio.layout.doClick();
808
+
809
+ } else
810
+ {
811
+ keepButton = radio.layout;
812
+ //keeprect = frame.getBounds();
813
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
814
+// frame.getToolkit().getScreenSize().height);
815
+ //frame.setVisible(false);
816
+
817
+ frame.dispose();
818
+ frame.setUndecorated(true);
819
+ device.setFullScreenWindow(frame);
820
+ frame.validate();
821
+ frame.setVisible(true);
822
+// frame.removeNotify();
823
+// frame.setUndecorated(true);
824
+// frame.addNotify();
825
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
826
+// X framePanel.remove(bigThree);
827
+// X frame.getContentPane().add(/*"Center",*/bigThree);
828
+ framePanel.setDividerLocation(0);
829
+
830
+ radio.layout = fullscreenLayout;
831
+ radio.layout.doClick();
832
+ //frame.setVisible(true);
833
+ }
834
+ frame.validate();
640835 }
641836
642
- return new JTextArea(); // textPane;
837
+ private byte[] CompressCopy()
838
+ {
839
+ boolean temp = CameraPane.SWITCH;
840
+ CameraPane.SWITCH = false;
841
+
842
+ copy.ExtractBigData(versiontable);
843
+ // if (copy == client)
844
+
845
+ byte[] versions[] = copy.versions;
846
+ copy.versions = null;
847
+
848
+ byte[] compress = Compress(copy);
849
+
850
+ copy.versions = versions;
851
+
852
+ copy.RestoreBigData(versiontable);
853
+
854
+ CameraPane.SWITCH = temp;
855
+
856
+ return compress;
857
+ }
858
+
859
+ private JTextPane createTextPane()
860
+ {
861
+// TEXTAREA String[] initString =
862
+// {
863
+// "This is an editable JTextPane, ", //regular
864
+// "another ", //italic
865
+// "styled ", //bold
866
+// "text ", //small
867
+// "component, ", //large
868
+// "which supports embedded components..." + newline,//regular
869
+// " " + newline, //button
870
+// "...and embedded icons..." + newline, //regular
871
+// " ", //icon
872
+// newline + "JTextPane is a subclass of JEditorPane that "
873
+// + "uses a StyledEditorKit and StyledDocument, and provides "
874
+// + "cover methods for interacting with those objects."
875
+// };
876
+//
877
+// String[] initStyles =
878
+// {
879
+// "regular", "italic", "bold", "small", "large",
880
+// "regular", "button", "regular", "icon",
881
+// "regular"
882
+// };
883
+//
884
+// JTextPane textPane = new JTextPane();
885
+// textPane.setEditable(true);
886
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
887
+// addStylesToDocument(doc);
888
+//
889
+// try
890
+// {
891
+// for (int j = 0; j < 2; j++)
892
+// {
893
+// for (int i = 0; i < initString.length; i++)
894
+// {
895
+// doc.insertString(doc.getLength(), initString[i],
896
+// doc.getStyle(initStyles[i]));
897
+// }
898
+// }
899
+// } catch (BadLocationException ble)
900
+// {
901
+// System.err.println("Couldn't insert initial text into text pane.");
902
+// }
903
+
904
+ return new JTextPane(); // textPane;
643905 }
644906
645907 protected void addStylesToDocument(StyledDocument doc)
....@@ -692,7 +954,7 @@
692954 protected static ImageIcon createImageIcon(String path,
693955 String description)
694956 {
695
- java.net.URL imgURL = GrafreeD.class.getResource(path);
957
+ java.net.URL imgURL = Grafreed.class.getResource(path);
696958 if (imgURL != null)
697959 {
698960 return new ImageIcon(imgURL, description);
....@@ -724,6 +986,7 @@
724986 // NumberSlider vDivsField;
725987 // JCheckBox endcaps;
726988 JCheckBox liveCB;
989
+ JCheckBox selectCB;
727990 JCheckBox hideCB;
728991 JCheckBox link2masterCB;
729992 JCheckBox markCB;
....@@ -731,7 +994,12 @@
731994 JCheckBox speedupCB;
732995 JCheckBox rewindCB;
733996 JCheckBox flipVCB;
997
+
998
+ cCheckBox toggleTextureCB;
999
+ cCheckBox toggleSwitchCB;
1000
+
7341001 JComboBox texresMenu;
1002
+
7351003 JButton resetButton;
7361004 JButton stepButton;
7371005 JButton stepAllButton;
....@@ -739,115 +1007,87 @@
7391007 JButton slowerButton;
7401008 JButton fasterButton;
7411009 JButton remarkButton;
1010
+
1011
+ cGridBag editPanel;
1012
+ cGridBag editCommandsPanel;
1013
+
1014
+ cGridBag namePanel;
1015
+ cGridBag setupPanel;
1016
+ cGridBag setupPanel2;
1017
+ cGridBag objectCommandsPanel;
1018
+ cGridBag pushPanel;
1019
+ cGridBag fillPanel;
7421020
743
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1021
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7441022 {
7451023 JCheckBox cb;
7461024
747
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
748
- oe.aConstraints.gridwidth = 1; // 3;
749
-// oe.aConstraints.weightx = 1;
750
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
751
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1025
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7521026 cb.addItemListener(this);
753
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
754
- oe.aConstraints.gridwidth = 1;
755
- oe.aConstraints.gridx += 1;
7561027
7571028 return cb;
7581029 }
7591030
760
- cButton AddButton(ObjEditor oe, String label)
1031
+ cButton AddButton(cGridBag panel, String label)
7611032 {
7621033 cButton cb;
7631034
764
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
765
- oe.aConstraints.gridwidth = 1;
766
-// oe.aConstraints.weightx = 1;
767
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
768
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1035
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7691036 cb.addActionListener(this);
770
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
771
- oe.aConstraints.gridwidth = 1;
772
- oe.aConstraints.gridx += 1;
7731037
7741038 return cb;
7751039 }
7761040
777
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1041
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
7781042 {
7791043 JComboBox combo;
7801044
781
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
782
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
783
- oe.aConstraints.gridx += 1;
1045
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7841046 combo.addActionListener(this);
7851047
7861048 return combo;
7871049 }
7881050
789
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
1051
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
7901052 {
791
- NumberSlider combo;
1053
+ cGridBag control = new cGridBag();
1054
+
1055
+ cNumberSlider combo;
7921056
7931057 JLabel jlabel = new JLabel(label);
794
-
795
- aConstraints.fill = GridBagConstraints.VERTICAL;
7961058 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
797
- aConstraints.gridwidth = 2;
798
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
799
- aConstraints.gridx += 1;
800
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
801
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
802
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
803
- aConstraints.gridx += 1;
804
- aConstraints.gridwidth = 1;
805
-
1059
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1060
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8061061 combo.setFloat(current);
807
-
808
- combo.label = jlabel;
809
-
810
- combo.addChangeListener(this);
811
-
812
- return combo;
1062
+
1063
+ panel.add(control);
1064
+
1065
+ return control;
8131066 }
8141067
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
1068
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8161069 {
817
- NumberSlider combo;
1070
+ cGridBag control = new cGridBag();
1071
+
1072
+ cNumberSlider combo;
8181073
8191074 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
8221075 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
823
- aConstraints.gridwidth = 2;
824
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
825
- aConstraints.gridx += 1;
826
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
827
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
828
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
829
- aConstraints.gridx += 1;
830
- aConstraints.gridwidth = 1;
831
-
1076
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1077
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8321078 combo.setInteger(current);
8331079
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
1080
+ panel.add(control);
1081
+
1082
+ return control;
8391083 }
8401084
841
- JTextArea AddText(JPanel ctrlPanel, String name)
1085
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8421086 {
8431087 JTextArea text;
8441088
845
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
846
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
847
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1089
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8481090 text.addCaretListener(this);
849
- aConstraints.gridx += 1;
850
- aConstraints.gridwidth = 1;
8511091
8521092 return text;
8531093 }
....@@ -877,9 +1117,16 @@
8771117 objEditor.ctrlPanel.remove(j);
8781118 }
8791119
1120
+ void Remove(cNumberSlider j)
1121
+ {
1122
+ j.removeChangeListener(this);
1123
+ //objEditor.ctrlPanel.remove(j.label);
1124
+ objEditor.ctrlPanel.remove(j);
1125
+ }
1126
+
8801127 /*
8811128 */
882
- void Return() // ObjEditor oe)
1129
+ void Return0() // ObjEditor oe)
8831130 {
8841131 aConstraints.gridy += 1;
8851132 aConstraints.gridx = 0;
....@@ -934,35 +1181,78 @@
9341181
9351182 void SetupUI2(ObjEditor oe)
9361183 {
937
-// oe.aConstraints.weightx = 0;
938
-// oe.aConstraints.weighty = 0;
939
-// oe.aConstraints.gridx = 0;
940
-// oe.aConstraints.gridy = 0;
941
- SetupName(oe);
1184
+ //SetupName(oe);
9421185
943
- if (!GroupEditor.allparams)
1186
+ namePanel = new cGridBag();
1187
+
1188
+ nameField = AddText(namePanel, copy.GetName());
1189
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
1190
+ oe.ctrlPanel.add(namePanel);
1191
+
1192
+ oe.ctrlPanel.Return();
1193
+
1194
+ if (!allparams)
9441195 return;
9451196
946
- liveCB = AddCheckBox(oe, "Live", copy.live);
947
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
948
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1197
+ setupPanel = new cGridBag().setVertical(false);
1198
+
1199
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1200
+ liveCB.setToolTipText("Animate object");
1201
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1202
+ selectCB.setToolTipText("Make object selectable");
9491203 // Return();
950
- markCB = AddCheckBox(oe, "Mark", copy.marked);
951
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
952
- randomCB = AddCheckBox(oe, "Rand", copy.random);
953
- Return();
954
- resetButton = AddButton(oe, "Reset");
955
- stepButton = AddButton(oe, "Step");
1204
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1205
+ hideCB.setToolTipText("Hide object");
1206
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1207
+ markCB.setToolTipText("As animation target transform");
1208
+
1209
+ setupPanel2 = new cGridBag().setVertical(false);
1210
+
1211
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1212
+ rewindCB.setToolTipText("Rewind animation");
1213
+
1214
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1215
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1216
+
1217
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1218
+ link2masterCB.setToolTipText("Attach to support");
1219
+
1220
+ if (Globals.ADVANCED)
1221
+ {
1222
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1223
+ speedupCB.setToolTipText("Option motion capture");
1224
+ }
1225
+
1226
+ oe.ctrlPanel.add(setupPanel);
1227
+ oe.ctrlPanel.Return();
1228
+ oe.ctrlPanel.add(setupPanel2);
1229
+ oe.ctrlPanel.Return();
1230
+
1231
+ objectCommandsPanel = new cGridBag().setVertical(false);
1232
+
1233
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1234
+ resetButton.setToolTipText("Jump to frame zero");
1235
+ stepButton = AddButton(objectCommandsPanel, "Step");
1236
+ stepButton.setToolTipText("Step one frame");
9561237 // resetAllButton = AddButton(oe, "Reset All");
9571238 // stepAllButton = AddButton(oe, "Step All");
958
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9591239 // Return();
960
- slowerButton = AddButton(oe, "Slow");
961
- fasterButton = AddButton(oe, "Fast");
962
- remarkButton = AddButton(oe, "Rem");
1240
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1241
+ slowerButton.setToolTipText("Decrease animation speed");
1242
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1243
+ fasterButton.setToolTipText("Increase animation speed");
1244
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1245
+ remarkButton.setToolTipText("Set the current transform as the target");
9631246
964
- Return();
1247
+ oe.ctrlPanel.add(objectCommandsPanel);
1248
+ oe.ctrlPanel.Return();
9651249
1250
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1251
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1252
+ //Return();
1253
+
1254
+ oe.ctrlPanel.Return();
1255
+
9661256 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9671257 // ObjEditor.aConstraints.gridx += 1;
9681258
....@@ -1056,7 +1346,7 @@
10561346 oe.aConstraints.gridwidth = 1;
10571347 /**/
10581348 nameField = AddText(oe.ctrlPanel, copy.GetName());
1059
- Return();
1349
+ oe.ctrlPanel.Return();
10601350
10611351 //ctrlPanel.add(textureButton = new Button("Texture..."));
10621352 //textureButton.setEnabled(false);
....@@ -1158,10 +1448,28 @@
11581448 //JPanel worldPanel =
11591449 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11601450 //worldPanel.setName("World");
1161
- /*JPanel*/ cameraPanel =
1162
- new JPanel(new BorderLayout());
1163
- cameraPanel.add(cameraView);
1451
+ centralPanel = new cGridBag();
1452
+ centralPanel.preferredWidth = 20;
1453
+
1454
+ if (Globals.ADVANCED)
1455
+ {
1456
+ timelinePanel = new JPanel(new BorderLayout());
1457
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11641458
1459
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1460
+ cameraPanel.setContinuousLayout(true);
1461
+ cameraPanel.setOneTouchExpandable(true);
1462
+// cameraPanel.setDividerLocation(0.9);
1463
+// cameraPanel.setDividerSize(9);
1464
+ cameraPanel.setResizeWeight(1.0);
1465
+
1466
+ }
1467
+
1468
+ centralPanel.add(cameraView);
1469
+ centralPanel.setFocusable(true);
1470
+ //frame.setJMenuBar(timelineMenubar);
1471
+ //centralPanel.add(timelinePanel);
1472
+
11651473 //topView.camera = ;
11661474 //frontView.camera = new Camera(2);
11671475 //sideView.camera = new Camera(3);
....@@ -1177,12 +1485,13 @@
11771485 //frontView.object = copy;
11781486 //sideView.object = copy;
11791487
1180
- XYZPanel = new JPanel();
1181
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1488
+ XYZPanel = new cGridBag().setVertical(true);
1489
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11821490
1183
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1184
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1185
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1491
+ XYZPanel.preferredWidth = 5;
1492
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1493
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1494
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
11861495
11871496 /*
11881497 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1191,7 +1500,7 @@
11911500 gridPanel.add(cameraView);
11921501 gridPanel.add(XYZPanel);
11931502 */
1194
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout());
1503
+ gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
11951504 gridPanel.setContinuousLayout(true);
11961505 gridPanel.setOneTouchExpandable(true);
11971506 gridPanel.setDividerLocation(1.0);
....@@ -1220,11 +1529,16 @@
12201529 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12211530 //tmp.setName("Edit");
12221531 objectPanel.add(materialPanel);
1223
- JPanel north = new JPanel(new BorderLayout());
1224
- north.setName("Edit");
1225
- north.add(ctrlPanel, BorderLayout.NORTH);
1226
- objectPanel.add(north);
1227
- objectPanel.add(infoPanel);
1532
+// JPanel north = new JPanel(new BorderLayout());
1533
+// north.setName("Edit");
1534
+// north.add(ctrlPanel, BorderLayout.NORTH);
1535
+// objectPanel.add(north);
1536
+ objectPanel.add(editPanel);
1537
+
1538
+ //if (Globals.ADVANCED)
1539
+ objectPanel.add(infoPanel);
1540
+
1541
+ objectPanel.add(toolboxPanel);
12281542
12291543 /*
12301544 aConstraints.gridx = 0;
....@@ -1233,7 +1547,7 @@
12331547 aConstraints.gridy += 1;
12341548 aConstraints.gridwidth = 1;
12351549 mainPanel.add(objectPanel, aConstraints);
1236
- */
1550
+ */
12371551
12381552 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12391553 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1244,16 +1558,23 @@
12441558 scrollpane.setWheelScrollingEnabled(true);
12451559 scrollpane.addMouseWheelListener(this); // Default not fast enough
12461560
1247
- /*JTabbedPane*/ jtp = new JTabbedPane();
1248
- jtp.add(scrollpane);
1561
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1562
+ scenePanel.preferredWidth = 6;
1563
+
1564
+ JTabbedPane tabbedPane = new JTabbedPane();
1565
+ tabbedPane.add(scrollpane);
12491566
1250
- jtp.add(FSPane = new cFileSystemPane(this));
1251
-
1252
- optionsPanel = new JPanel(new GridBagLayout());
1567
+ optionsPanel = new cGridBag().setVertical(false);
12531568
12541569 optionsPanel.setName("Options");
1255
- jtp.add(optionsPanel);
1570
+
1571
+ AddOptions(optionsPanel); //, aConstraints);
1572
+
1573
+ tabbedPane.add(optionsPanel);
1574
+
1575
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12561576
1577
+ scenePanel.add(tabbedPane);
12571578
12581579 /*
12591580 cTree jTree = new cTree(null);
....@@ -1275,7 +1596,7 @@
12751596 jtp.add(tree);
12761597 */
12771598
1278
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel);
1599
+ bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
12791600 bigPanel.setContinuousLayout(true);
12801601 bigPanel.setOneTouchExpandable(true);
12811602 bigPanel.setDividerLocation(0.8);
....@@ -1287,6 +1608,7 @@
12871608 //bigPanel.setSize(new Dimension(10,10));
12881609 //bigPanel.add(ctrlPanel);
12891610 //bigPanel.add(gridPanel);
1611
+ /**
12901612 bigThree = new JPanel();
12911613 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12921614 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1297,20 +1619,26 @@
12971619 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
12981620 aWindowConstraints.weightx = 0;
12991621 aWindowConstraints.weighty = 1;
1300
- bigThree.add(jtp, aWindowConstraints);
1622
+ bigThree.add(scenePanel, aWindowConstraints);
13011623 aWindowConstraints.weightx = 1;
13021624 aWindowConstraints.gridwidth = 3;
13031625 // aConstraints.gridheight = 3;
13041626 aWindowConstraints.gridx = 1;
13051627 aWindowConstraints.fill = GridBagConstraints.BOTH;
1306
- bigThree.add(cameraPanel, aWindowConstraints);
1628
+ bigThree.add(centralPanel, aWindowConstraints);
13071629 aWindowConstraints.weightx = 0;
13081630 aWindowConstraints.gridx = 4;
13091631 aWindowConstraints.gridwidth = 1;
13101632 // aConstraints.gridheight = 3;
13111633 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13121634 bigThree.add(XYZPanel, aWindowConstraints);
1635
+ /**/
13131636
1637
+ bigThree = new cGridBag();
1638
+ bigThree.addComponent(scenePanel);
1639
+ bigThree.addComponent(centralPanel);
1640
+ bigThree.addComponent(XYZPanel);
1641
+
13141642 // // SIDE EFFECT!!!
13151643 // aConstraints.gridx = 0;
13161644 // aConstraints.gridy = 0;
....@@ -1318,9 +1646,9 @@
13181646 // aConstraints.gridheight = 1;
13191647
13201648 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1321
- framePanel.setContinuousLayout(true);
1322
- framePanel.setOneTouchExpandable(true);
1323
- framePanel.setDividerLocation(0.8);
1649
+ framePanel.setContinuousLayout(false);
1650
+ framePanel.setOneTouchExpandable(false);
1651
+ //.setDividerLocation(0.8);
13241652 //framePanel.setDividerSize(15);
13251653 //framePanel.setResizeWeight(0.15);
13261654 framePanel.setName("Frame");
....@@ -1331,15 +1659,21 @@
13311659 //worldPane.add(bigPanel);
13321660 //worldPane.add(worldPanel);
13331661 /**/
1334
- frame.getContentPane().add(/*"Center",*/framePanel);
1662
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1663
+ frame.add(/*"Center",*/framePanel);
13351664 //frame.getContentPane().add(/*"Center",*/ worldPane);
13361665
13371666 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13381667
1339
- frame.setSize(1024, 768);
1340
- frame.show();
1341
-
1668
+ frame.setSize(1280, 860);
1669
+
1670
+ cameraView.requestFocusInWindow();
1671
+
13421672 gridPanel.setDividerLocation(1.0);
1673
+
1674
+ frame.validate();
1675
+
1676
+ frame.setVisible(true);
13431677
13441678 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13451679 frame.addWindowListener(new WindowAdapter()
....@@ -1352,6 +1686,10 @@
13521686 });
13531687 }
13541688
1689
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1690
+ {
1691
+ }
1692
+
13551693 JTree GetTree()
13561694 {
13571695 return objEditor.jTree;
....@@ -1363,260 +1701,161 @@
13631701 ctrlPanel.removeAll();
13641702 }
13651703
1366
- void SetupMaterial(JPanel ctrlPanel)
1704
+ void SetupMaterial(cGridBag panel)
13671705 {
1368
- aConstraints.weighty = 0;
1369
- //aConstraints.weightx = 1;
1370
- /*
1706
+ /*
13711707 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13721708 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1373
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1374
- aConstraints.gridx += 1;
13751709 */
13761710
1377
- aConstraints.gridwidth = 1;
1378
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1379
- aConstraints.gridx += 1;
1380
- aConstraints.weighty = 0;
1381
- aConstraints.gridwidth = 1;
1711
+ cGridBag editBar = new cGridBag().setVertical(false);
1712
+
1713
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1714
+ createMaterialButton.setToolTipText("Create material");
13821715
13831716 /*
13841717 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- aConstraints.gridwidth = 1;
13881718 */
13891719
1390
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1391
- aConstraints.gridx += 1;
1720
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1721
+ clearMaterialButton.setToolTipText("Clear material");
1722
+
1723
+ if (Globals.ADVANCED)
1724
+ {
1725
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1726
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1727
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1728
+ }
13921729
1393
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1394
-
1395
- aConstraints.gridx += 1;
1396
-
1397
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1398
-
1399
- aConstraints.gridx += 1;
1400
-
1401
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1402
-
1403
- aConstraints.gridx = 0;
1404
- aConstraints.gridy += 1;
1405
- aConstraints.weighty = 0;
1406
- aConstraints.gridwidth = 1;
1730
+ editBar.preferredHeight = 15;
1731
+
1732
+ panel.add(editBar);
1733
+
14071734 /**/
14081735 //aConstraints.weighty = 0;
14091736 ////aConstraints.weightx = 1;
14101737 //aConstraints.weighty = 1;
14111738 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14121739 //aConstraints.gridx += 1;
1413
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1414
- aConstraints.weighty = 0;
1415
- aConstraints.gridx = 0;
1416
- aConstraints.gridy += 1;
1417
- aConstraints.gridwidth = 1;
1740
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14181741
1419
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1420
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1421
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1422
- aConstraints.gridx += 1;
1423
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1424
- //aConstraints.weightx = 0;
1425
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1426
- aConstraints.gridx = 0;
1427
- aConstraints.gridy += 1;
1428
- aConstraints.gridwidth = 1;
1742
+ cGridBag colorSection = new cGridBag().setVertical(true);
1743
+
1744
+ cGridBag color = new cGridBag();
1745
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1746
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1747
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1748
+ //colorField.preferredWidth = 200;
1749
+ colorSection.add(color);
14291750
1430
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1431
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1432
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1433
- aConstraints.gridx += 1;
1434
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1435
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1436
- aConstraints.gridx = 0;
1437
- aConstraints.gridy += 1;
1438
- aConstraints.gridwidth = 1;
1751
+ cGridBag modulation = new cGridBag();
1752
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1753
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1754
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1755
+ colorSection.add(modulation);
14391756
1440
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1441
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1442
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1443
- aConstraints.gridx += 1;
1444
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1445
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1446
- aConstraints.gridx = 0;
1447
- aConstraints.gridy += 1;
1448
- aConstraints.gridwidth = 1;
1757
+ cGridBag texture = new cGridBag();
1758
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1759
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1760
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1761
+ colorSection.add(texture);
14491762
1450
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1451
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1452
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1453
- aConstraints.gridx += 1;
1454
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1455
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1456
- aConstraints.gridx = 0;
1457
- aConstraints.gridy += 1;
1458
- aConstraints.gridwidth = 1;
1763
+ panel.add(new JSeparator());
1764
+
1765
+ panel.add(colorSection);
1766
+
1767
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1768
+
1769
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1770
+
1771
+ cGridBag diffuse = new cGridBag();
1772
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1773
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1774
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1775
+ diffuseSection.add(diffuse);
14591776
1460
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1461
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1462
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1463
- aConstraints.gridx += 1;
1464
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1465
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1466
- aConstraints.gridx = 0;
1467
- aConstraints.gridy += 1;
1468
- aConstraints.gridwidth = 1;
1777
+ cGridBag diffuseness = new cGridBag();
1778
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1779
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1780
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1781
+ diffuseSection.add(diffuseness);
14691782
1470
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1471
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1472
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1473
- aConstraints.gridx += 1;
1474
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1475
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1476
- aConstraints.gridx = 0;
1477
- aConstraints.gridy += 1;
1478
- aConstraints.gridwidth = 1;
1783
+ cGridBag selfshadow = new cGridBag();
1784
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1785
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1786
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1787
+ diffuseSection.add(selfshadow);
14791788
1480
- //aConstraints.weighty = 1;
1481
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1482
- //aConstraints.gridx += 1;
1483
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1484
- aConstraints.weighty = 0;
1485
- aConstraints.gridx = 0;
1486
- aConstraints.gridy += 1;
1487
- aConstraints.gridwidth = 1;
1789
+ cGridBag sheen = new cGridBag();
1790
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1791
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1792
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1793
+ diffuseSection.add(sheen);
14881794
1489
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1490
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1492
- aConstraints.gridx += 1;
1493
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1494
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1495
- aConstraints.gridx = 0;
1496
- aConstraints.gridy += 1;
1497
- aConstraints.gridwidth = 1;
1795
+ cGridBag subsurface = new cGridBag();
1796
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1797
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1798
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1799
+ diffuseSection.add(subsurface);
14981800
1499
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1500
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1501
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1502
- aConstraints.gridx += 1;
1503
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1504
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1505
- aConstraints.gridx = 0;
1506
- aConstraints.gridy += 1;
1507
- aConstraints.gridwidth = 1;
1801
+ cGridBag shadow = new cGridBag();
1802
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1803
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1804
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1805
+ diffuseSection.add(shadow);
15081806
1509
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1510
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1511
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1512
- aConstraints.gridx += 1;
1513
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1514
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1515
- aConstraints.gridx = 0;
1516
- aConstraints.gridy += 1;
1517
- aConstraints.gridwidth = 1;
1807
+ cGridBag fakedepth = new cGridBag();
1808
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1809
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1810
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1811
+ diffuseSection.add(fakedepth);
15181812
1519
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1520
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1521
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1522
- aConstraints.gridx += 1;
1523
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1524
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1525
- aConstraints.gridx = 0;
1526
- aConstraints.gridy += 1;
1527
- aConstraints.gridwidth = 1;
1813
+ cGridBag shadowbias = new cGridBag();
1814
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1815
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1816
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1817
+ diffuseSection.add(shadowbias);
15281818
1529
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1530
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1531
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1532
- aConstraints.gridx += 1;
1533
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1534
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1535
- aConstraints.gridx = 0;
1536
- aConstraints.gridy += 1;
1537
- aConstraints.gridwidth = 1;
1819
+ panel.add(new JSeparator());
1820
+
1821
+ panel.add(diffuseSection);
1822
+
1823
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1824
+
1825
+ cGridBag specularSection = new cGridBag().setVertical(true);
15381826
1539
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1540
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1541
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1542
- aConstraints.gridx += 1;
1543
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1544
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1545
- aConstraints.gridx = 0;
1546
- aConstraints.gridy += 1;
1547
- aConstraints.gridwidth = 1;
1827
+ cGridBag specular = new cGridBag();
1828
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1829
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1830
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1831
+ specularSection.add(specular);
15481832
1549
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1550
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1551
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1552
- aConstraints.gridx += 1;
1553
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1554
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1555
- aConstraints.gridx = 0;
1556
- aConstraints.gridy += 1;
1557
- aConstraints.gridwidth = 1;
1833
+ cGridBag lightarea = new cGridBag();
1834
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1835
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1836
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1837
+ specularSection.add(lightarea);
15581838
1559
- //aConstraints.weighty = 1;
1560
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1561
- //aConstraints.gridx += 1;
1562
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1563
- aConstraints.weighty = 0;
1564
- aConstraints.gridx = 0;
1565
- aConstraints.gridy += 1;
1566
- aConstraints.gridwidth = 1;
1839
+ cGridBag shininess = new cGridBag();
1840
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1841
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1842
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1843
+ specularSection.add(shininess);
15671844
1568
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1569
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1570
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1571
- aConstraints.gridx += 1;
1572
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1573
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1574
- aConstraints.gridx = 0;
1575
- aConstraints.gridy += 1;
1576
- aConstraints.gridwidth = 1;
1845
+ cGridBag metalness = new cGridBag();
1846
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1847
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1848
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1849
+ specularSection.add(metalness);
15771850
1578
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1579
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1580
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1581
- aConstraints.gridx += 1;
1582
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1583
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1584
- aConstraints.gridx = 0;
1585
- aConstraints.gridy += 1;
1586
- aConstraints.gridwidth = 1;
1851
+ cGridBag velvet = new cGridBag();
1852
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1853
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1854
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1855
+ specularSection.add(velvet);
15871856
1588
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1589
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1590
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1591
- aConstraints.gridx += 1;
1592
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1593
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1594
- aConstraints.gridx = 0;
1595
- aConstraints.gridy += 1;
1596
- aConstraints.gridwidth = 1;
1597
-
1598
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1599
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1600
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1601
- aConstraints.gridx += 1;
1602
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1603
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1604
- aConstraints.gridx = 0;
1605
- aConstraints.gridy += 1;
1606
- aConstraints.gridwidth = 1;
1607
-
1608
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1609
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1610
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1611
- aConstraints.gridx += 1;
1612
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1613
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1614
- aConstraints.gridx = 0;
1615
- aConstraints.gridy += 1;
1616
- aConstraints.gridwidth = 1;
1617
-
1618
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1619
- Return();
1857
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1858
+ //Return();
16201859 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16211860 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16221861 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1627,130 +1866,105 @@
16271866 // aConstraints.gridy += 1;
16281867 // aConstraints.gridwidth = 1;
16291868
1630
- //aConstraints.weighty = 1;
1631
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1632
- //aConstraints.gridx += 1;
1633
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1634
- aConstraints.weighty = 0;
1635
- aConstraints.gridx = 0;
1636
- aConstraints.gridy += 1;
1637
- aConstraints.gridwidth = 1;
1869
+ cGridBag anisoU = new cGridBag();
1870
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1871
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1872
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1873
+ specularSection.add(anisoU);
16381874
1639
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1640
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1641
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1642
- aConstraints.gridx += 1;
1643
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1644
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1645
- aConstraints.gridx = 0;
1646
- aConstraints.gridy += 1;
1647
- aConstraints.gridwidth = 1;
1875
+ cGridBag anisoV = new cGridBag();
1876
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1877
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1878
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1879
+ specularSection.add(anisoV);
16481880
1649
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1650
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1651
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1652
- aConstraints.gridx += 1;
1653
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1654
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1655
- aConstraints.gridx = 0;
1656
- aConstraints.gridy += 1;
1657
- aConstraints.gridwidth = 1;
16581881
1659
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1660
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1661
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1662
- aConstraints.gridx += 1;
1663
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1664
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1665
- aConstraints.gridx = 0;
1666
- aConstraints.gridy += 1;
1667
- aConstraints.gridwidth = 1;
1882
+ panel.add(new JSeparator());
1883
+
1884
+ panel.add(specularSection);
1885
+
1886
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1887
+
1888
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16681889
1669
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1670
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1671
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1672
- aConstraints.gridx += 1;
1673
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1674
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1675
- aConstraints.gridx = 0;
1676
- aConstraints.gridy += 1;
1677
- aConstraints.gridwidth = 1;
1678
- aConstraints.weighty = 0;
1890
+ cGridBag camera = new cGridBag();
1891
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1892
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1893
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1894
+ colorSection.add(camera);
16791895
1680
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1681
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1683
- aConstraints.gridx += 1;
1684
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1685
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1686
- aConstraints.gridx = 0;
1687
- aConstraints.gridy += 1;
1688
- aConstraints.gridwidth = 1;
1896
+ cGridBag ambient = new cGridBag();
1897
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1898
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1899
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1900
+ colorSection.add(ambient);
16891901
1690
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1691
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1692
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1693
- aConstraints.gridx += 1;
1694
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1695
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1696
- aConstraints.gridx = 0;
1697
- aConstraints.gridy += 1;
1698
- aConstraints.gridwidth = 1;
1902
+ cGridBag backlit = new cGridBag();
1903
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1904
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1905
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1906
+ colorSection.add(backlit);
16991907
1700
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1701
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1702
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1703
- aConstraints.gridx += 1;
1704
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1705
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1706
- aConstraints.gridx = 0;
1707
- aConstraints.gridy += 1;
1708
- aConstraints.gridwidth = 1;
1908
+ cGridBag opacity = new cGridBag();
1909
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1910
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1911
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1912
+ colorSection.add(opacity);
17091913
1710
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1711
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1712
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1713
- aConstraints.gridx += 1;
1714
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1715
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1716
- aConstraints.gridx = 0;
1717
- aConstraints.gridy += 1;
1718
- aConstraints.gridwidth = 1;
1914
+ //panel.add(new JSeparator());
1915
+
1916
+ //panel.add(globalSection);
1917
+
1918
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1919
+
1920
+ cGridBag textureSection = new cGridBag().setVertical(true);
17191921
1720
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1721
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1722
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1723
- aConstraints.gridx += 1;
1724
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1725
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1726
- aConstraints.gridx = 0;
1727
- aConstraints.gridy += 1;
1728
- aConstraints.gridwidth = 1;
1922
+ cGridBag bump = new cGridBag();
1923
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1924
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1925
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1926
+ textureSection.add(bump);
17291927
1730
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1731
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1732
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1733
- aConstraints.gridx += 1;
1734
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1735
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1736
- aConstraints.gridx = 0;
1737
- aConstraints.gridy += 1;
1738
- aConstraints.gridwidth = 1;
1928
+ cGridBag noise = new cGridBag();
1929
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1930
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1931
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1932
+ textureSection.add(noise);
17391933
1740
- //aConstraints.weighty = 1;
1741
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1742
- //aConstraints.gridx += 1;
1743
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1744
- aConstraints.weighty = 0;
1934
+ cGridBag power = new cGridBag();
1935
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1936
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1937
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1938
+ textureSection.add(power);
17451939
1746
- aConstraints.gridx = 0;
1747
- aConstraints.gridy = 0;
1748
- aConstraints.gridwidth = 1;
1940
+ cGridBag borderfade = new cGridBag();
1941
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1942
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1943
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1944
+ textureSection.add(borderfade);
1945
+
1946
+ cGridBag fog = new cGridBag();
1947
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1948
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1949
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1950
+ textureSection.add(fog);
1951
+
1952
+ cGridBag opacityPower = new cGridBag();
1953
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1954
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1955
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1956
+ textureSection.add(opacityPower);
1957
+
1958
+ panel.add(new JSeparator());
1959
+
1960
+ panel.add(textureSection);
1961
+
1962
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17491963
17501964 SetMaterial(copy); // .GetMaterial());
17511965
1752
- colorField.addChangeListener(this);
1753
- modulationField.addChangeListener(this);
1966
+ //colorField.addChangeListener(this);
1967
+// modulationField.addChangeListener(this);
17541968 metalnessField.addChangeListener(this);
17551969 diffuseField.addChangeListener(this);
17561970 specularField.addChangeListener(this);
....@@ -1780,12 +1994,15 @@
17801994 opacityPowerField.addChangeListener(this);
17811995 /**/
17821996
1783
- resetSlidersButton.addActionListener(this);
17841997 clearMaterialButton.addActionListener(this);
17851998 createMaterialButton.addActionListener(this);
1786
-
1787
- propagateToggle.addItemListener(this);
1788
- multiplyToggle.addItemListener(this);
1999
+
2000
+ if (Globals.ADVANCED)
2001
+ {
2002
+ resetSlidersButton.addActionListener(this);
2003
+ propagateToggle.addItemListener(this);
2004
+ multiplyToggle.addItemListener(this);
2005
+ }
17892006 }
17902007
17912008 void DropFile(java.io.File[] files, boolean textures)
....@@ -1803,8 +2020,9 @@
18032020 // 3D models
18042021 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18052022 {
1806
- lastConverter = new com.jmex.model.converters.MaxToJme();
1807
- LoadFile(filename, lastConverter);
2023
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2024
+ //LoadFile(filename, lastConverter);
2025
+ LoadObjFile(filename); // New 3ds loader
18082026 continue;
18092027 }
18102028 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1956,7 +2174,7 @@
19562174
19572175 //? flashIt = false;
19582176 CameraPane pane = (CameraPane) cameraView;
1959
- pane.clickStart(location.x, location.y, 0);
2177
+ pane.clickStart(location.x, location.y, 0, 0);
19602178 pane.clickEnd(location.x, location.y, 0, true);
19612179
19622180 if (group.selection.size() == 1)
....@@ -2005,6 +2223,7 @@
20052223 e2.printStackTrace();
20062224 }
20072225 }
2226
+
20082227 LoadJMEThread loadThread;
20092228
20102229 class LoadJMEThread extends Thread
....@@ -2062,6 +2281,7 @@
20622281 //LoadFile0(filename, converter);
20632282 }
20642283 }
2284
+
20652285 LoadOBJThread loadObjThread;
20662286
20672287 class LoadOBJThread extends Thread
....@@ -2140,19 +2360,19 @@
21402360
21412361 void LoadObjFile(String fullname)
21422362 {
2143
- /*
2363
+ System.out.println("Loading " + fullname);
2364
+ /**/
21442365 //lastFilename = fullname;
21452366 if(loadObjThread == null)
21462367 {
2147
- loadObjThread = new LoadOBJThread();
2148
- loadObjThread.start();
2368
+ loadObjThread = new LoadOBJThread();
2369
+ loadObjThread.start();
21492370 }
21502371
21512372 loadObjThread.add(fullname);
2152
- */
2373
+ /**/
21532374
2154
- System.out.println("Loading " + fullname);
2155
- makeSomething(new FileObject(fullname, true), true);
2375
+ //makeSomething(new FileObject(fullname, true), true);
21562376 }
21572377
21582378 void LoadGFDFile(String fullname)
....@@ -2194,6 +2414,8 @@
21942414 {
21952415 Mocap sel = (Mocap) copy.selection.get(0);
21962416
2417
+ sel.SetCurrentBones(sel.frame);
2418
+
21972419 sel.fullname = fullname;
21982420
21992421 if (changename)
....@@ -2245,6 +2467,8 @@
22452467 {
22462468 Mocap sel = (Mocap) select;
22472469
2470
+ sel.SetCurrentBones(sel.frame);
2471
+
22482472 File file = new File(fullname);
22492473
22502474 // Mocap mocap = new Mocap("Mocap" + file.getName());
....@@ -2409,11 +2633,11 @@
24092633
24102634 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24112635 {
2412
- if (GrafreeD.standAlone)
2636
+ if (Grafreed.standAlone)
24132637 {
24142638 /**/
24152639 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2416
- browser.show();
2640
+ browser.setVisible(true);
24172641 String filename = browser.getFile();
24182642 if (filename != null && filename.length() > 0)
24192643 {
....@@ -2524,6 +2748,7 @@
25242748 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25252749 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25262750 }
2751
+
25272752 //cJME.count++;
25282753 //cJME.count %= 12;
25292754 if (gc)
....@@ -2558,6 +2783,7 @@
25582783 }
25592784 if (input == null)
25602785 {
2786
+ new Exception().printStackTrace();
25612787 System.exit(0);
25622788 }
25632789
....@@ -2706,6 +2932,7 @@
27062932 }
27072933 }
27082934 }
2935
+
27092936 cFileSystemPane FSPane;
27102937
27112938 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2759,11 +2986,14 @@
27592986 }
27602987 }
27612988 }
2989
+
27622990 freezematerial = false;
27632991 }
27642992
27652993 void SetMaterial(Object3D object)
27662994 {
2995
+ latestObject = object;
2996
+
27672997 cMaterial mat = object.material;
27682998
27692999 if (mat == null)
....@@ -2772,7 +3002,8 @@
27723002 return;
27733003 }
27743004
2775
- multiplyToggle.setSelected(mat.multiply);
3005
+ if (multiplyToggle != null)
3006
+ multiplyToggle.setSelected(mat.multiply);
27763007
27773008 assert (object.projectedVertices != null);
27783009
....@@ -2874,12 +3105,17 @@
28743105 // }
28753106
28763107 /**/
2877
- if (deselect)
3108
+ if (deselect || child == null)
28783109 {
28793110 //group.deselectAll();
28803111 //freeze = true;
28813112 GetTree().clearSelection();
28823113 //freeze = false;
3114
+
3115
+ if (child == null)
3116
+ {
3117
+ return;
3118
+ }
28833119 }
28843120
28853121 //group.addSelectee(child);
....@@ -2948,31 +3184,48 @@
29483184 cameraView.ToggleDL();
29493185 cameraView.repaint();
29503186 return;
2951
- } else if (event.getSource() == toggleTextureItem)
3187
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29523188 {
29533189 cameraView.ToggleTexture();
29543190 // june 2013 copy.HardTouch();
29553191 cameraView.repaint();
29563192 return;
2957
- } else if (event.getSource() == toggleFullItem)
3193
+ } else if (event.getSource() == toggleTimelineItem)
29583194 {
2959
- if (CameraPane.FULLSCREEN)
3195
+ timeline ^= true;
3196
+
3197
+ if (timeline)
29603198 {
2961
- frame.getContentPane().remove(/*"Center",*/bigThree);
2962
- framePanel.add(bigThree);
2963
- frame.getContentPane().add(/*"Center",*/framePanel);
2964
- } else
2965
- {
2966
- frame.getContentPane().remove(/*"Center",*/framePanel);
2967
- frame.getContentPane().add(/*"Center",*/bigThree);
3199
+ centralPanel.remove(cameraView);
3200
+ cameraPanel.add(cameraView);
3201
+ centralPanel.add(cameraPanel);
3202
+ frame.setJMenuBar(timelineMenubar);
3203
+ wasFullScreen = CameraPane.FULLSCREEN;
3204
+ if (!CameraPane.FULLSCREEN)
3205
+ ToggleFullScreen();
3206
+ toggleFullScreenItem.setEnabled(false);
29683207 }
3208
+ else
3209
+ {
3210
+ centralPanel.remove(cameraPanel);
3211
+ centralPanel.add(cameraView);
3212
+ frame.setJMenuBar(null);
3213
+ if (!wasFullScreen)
3214
+ ToggleFullScreen();
3215
+ toggleFullScreenItem.setEnabled(true);
3216
+ }
3217
+
29693218 frame.validate();
2970
- cameraView.ToggleFullScreen();
3219
+ return;
3220
+ } else if (event.getSource() == toggleFullScreenItem)
3221
+ {
3222
+ ToggleFullScreen();
3223
+ frame.validate();
29713224
29723225 return;
2973
- } else if (event.getSource() == toggleRandomItem)
3226
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
29743227 {
2975
- cameraView.ToggleRandom();
3228
+ cameraView.ToggleSwitch();
29763229 cameraView.repaint();
29773230 return;
29783231 } else if (event.getSource() == toggleHandleItem)
....@@ -3001,6 +3254,10 @@
30013254 {
30023255 copy.live ^= true;
30033256 return;
3257
+ } else if (event.getSource() == selectCB)
3258
+ {
3259
+ copy.dontselect ^= true;
3260
+ return;
30043261 } else if (event.getSource() == hideCB)
30053262 {
30063263 copy.hide ^= true;
....@@ -3015,6 +3272,7 @@
30153272 if (event.getSource() == randomCB)
30163273 {
30173274 copy.random ^= true;
3275
+ objEditor.refreshContents();
30183276 return;
30193277 }
30203278 if (event.getSource() == speedupCB)
....@@ -3038,8 +3296,9 @@
30383296
30393297 public void actionPerformed(ActionEvent event)
30403298 {
3299
+ Object source = event.getSource();
30413300 // SCRIPT DIALOG
3042
- if (event.getSource() == okbutton)
3301
+ if (source == okbutton)
30433302 {
30443303 textpanel.setVisible(false);
30453304 textpanel.remove(textarea);
....@@ -3051,7 +3310,7 @@
30513310 textarea = null;
30523311 textpanel = null;
30533312 }
3054
- if (event.getSource() == cancelbutton)
3313
+ if (source == cancelbutton)
30553314 {
30563315 textpanel.setVisible(false);
30573316 textpanel.remove(textarea);
....@@ -3063,49 +3322,50 @@
30633322 //applySelf();
30643323 //client.refreshEditWindow();
30653324 //refreshContents();
3066
- if (event.getSource() == nameField)
3325
+ if (source == nameField)
30673326 {
30683327 //System.out.println("ObjEditor " + event);
30693328 applySelf0(true);
30703329 //parent.applySelf();
30713330 objEditor.refreshContents();
3072
- } else if (event.getSource() == resetButton)
3331
+ } else if (source == resetButton)
30733332 {
30743333 CameraPane.fullreset = true;
30753334 copy.Reset(); // ResetMeshes();
30763335 copy.Touch();
30773336 objEditor.refreshContents();
3078
- } else if (event.getSource() == stepItem)
3337
+ } else if (source == stepItem)
30793338 {
3080
- cameraView.ONESTEP = true;
3339
+ //cameraView.ONESTEP = true;
3340
+ Globals.ONESTEP = true;
30813341 cameraView.repaint();
30823342 return;
3083
- } else if (event.getSource() == stepButton)
3343
+ } else if (source == stepButton)
30843344 {
30853345 copy.Step();
30863346 copy.Touch();
30873347 objEditor.refreshContents();
3088
- } else if (event.getSource() == slowerButton)
3348
+ } else if (source == slowerButton)
30893349 {
30903350 copy.Slower();
30913351 copy.Touch();
30923352 objEditor.refreshContents();
3093
- } else if (event.getSource() == fasterButton)
3353
+ } else if (source == fasterButton)
30943354 {
30953355 copy.Faster();
30963356 copy.Touch();
30973357 objEditor.refreshContents();
3098
- } else if (event.getSource() == remarkButton)
3358
+ } else if (source == remarkButton)
30993359 {
31003360 copy.Remark();
31013361 copy.Touch();
31023362 objEditor.refreshContents();
3103
- } else if (event.getSource() == stepAllButton)
3363
+ } else if (source == stepAllButton)
31043364 {
31053365 copy.StepAll();
31063366 copy.Touch();
31073367 objEditor.refreshContents();
3108
- } else if (event.getSource() == resetAllButton)
3368
+ } else if (source == resetAllButton)
31093369 {
31103370 //CameraPane.fullreset = true;
31113371 copy.ResetAll(); // ResetMeshes();
....@@ -3138,53 +3398,79 @@
31383398 // Close();
31393399 // }
31403400 // else
3141
- if (event.getSource() == resetSlidersButton)
3401
+ if (source == resetSlidersButton)
31423402 {
31433403 ResetSliders();
3144
- } else if (event.getSource() == clearMaterialButton)
3404
+ } else if (source == clearMaterialButton)
31453405 {
31463406 ClearMaterial();
3147
- } else if (event.getSource() == createMaterialButton)
3407
+ } else if (source == createMaterialButton)
31483408 {
31493409 CreateMaterial();
3150
- } else if (event.getSource() == clearPanelButton)
3410
+ } else if (source == clearPanelButton)
31513411 {
31523412 copy.ClearUI();
31533413 refreshContents(true);
3154
- } /*
3155
- }
3156
-
3157
- public boolean action(Event event, Object arg)
3158
- {
3159
- */ else if (event.getSource() == closeItem)
3414
+ } else if (source == importGFDItem)
3415
+ {
3416
+ ImportGFD();
3417
+ } else
3418
+ if (source == importVRMLX3DItem)
3419
+ {
3420
+ ImportVRMLX3D();
3421
+ } else
3422
+ if (source == import3DSItem)
3423
+ {
3424
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3425
+ } else
3426
+ if (source == importOBJItem)
3427
+ {
3428
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3429
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3430
+ browser.setVisible(true);
3431
+ String filename = browser.getFile();
3432
+ if (filename != null && filename.length() > 0)
3433
+ {
3434
+ String fullname = browser.getDirectory() + filename;
3435
+ makeSomething(ReadOBJ(fullname), true);
3436
+ }
3437
+ } else
3438
+ if (source == closeItem)
31603439 {
31613440 Close();
31623441 //return true;
3163
- } else if (event.getSource() == loadItem)
3442
+ } else if (source == openItem)
31643443 {
3165
- load();
3444
+ Open();
31663445 //return true;
3167
- } else if (event.getSource() == saveItem)
3446
+ } else if (source == newItem)
3447
+ {
3448
+ New();
3449
+ } else if (source == saveItem)
31683450 {
31693451 save();
31703452 //return true;
3171
- } else if (event.getSource() == saveAsItem)
3453
+ } else if (source == saveAsItem)
31723454 {
31733455 saveAs();
31743456 //return true;
3175
- } else if (event.getSource() == reexportItem)
3457
+ } else if (source == reexportItem)
31763458 {
31773459 reexport();
31783460 //return true;
3179
- } else if (event.getSource() == exportAsItem)
3461
+ } else if (source == exportAsItem)
31803462 {
31813463 export();
31823464 //return true;
3183
- } else if (event.getSource() == povItem)
3465
+ } else if (source == povItem)
31843466 {
31853467 generatePOV();
31863468 //return true;
3187
- } else if (event.getSource() == zBufferItem)
3469
+ } else if (event.getSource() == archiveItem)
3470
+ {
3471
+ cTools.Archive(frame);
3472
+ return;
3473
+ } else if (source == zBufferItem)
31883474 {
31893475 try
31903476 {
....@@ -3206,21 +3492,8 @@
32063492 cameraView.repaint();
32073493 //return true;
32083494 }
3209
- */ else if (event.getSource() == editCameraItem)
3210
- {
3211
- cameraView.ProtectCamera();
3212
- cameraView.repaint();
3213
- return;
3214
- } else if (event.getSource() == revertCameraItem)
3215
- {
3216
- cameraView.RevertCamera();
3217
- cameraView.repaint();
3218
- return;
3219
- } else if (event.getSource() == textureButton)
3220
- {
3221
- return; // true;
3222
- } else // combos...
3223
- if (event.getSource() == texresMenu)
3495
+ */ else // combos...
3496
+ if (source == texresMenu)
32243497 {
32253498 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32263499 copy.texres = texresMenu.getSelectedIndex();
....@@ -3232,27 +3505,424 @@
32323505 }
32333506 }
32343507
3235
- void ToggleAnimation()
3508
+ void New()
32363509 {
3237
- if (!CameraPane.ANIMATION)
3510
+ while (copy.Size() > 1)
32383511 {
3239
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3512
+ copy.remove(1);
3513
+ }
3514
+
3515
+ ResetModel();
3516
+ objEditor.refreshContents();
3517
+ }
3518
+
3519
+ static public byte[] Compress(Object3D o)
3520
+ {
3521
+ try
3522
+ {
3523
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3524
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3525
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
3526
+
3527
+ Object3D parent = o.parent;
3528
+ o.parent = null;
3529
+
3530
+ out.writeObject(o);
3531
+
3532
+ o.parent = parent;
3533
+
3534
+ out.flush();
3535
+
3536
+ baos //zstream
3537
+ .close();
3538
+ out.close();
3539
+
3540
+ byte[] bytes = baos.toByteArray();
3541
+
3542
+ System.out.println("save #bytes = " + bytes.length);
3543
+ return bytes;
3544
+ } catch (Exception e)
3545
+ {
3546
+ System.err.println(e);
3547
+ return null;
3548
+ }
3549
+ }
3550
+
3551
+ static public Object Uncompress(byte[] bytes)
3552
+ {
3553
+ System.out.println("restore #bytes = " + bytes.length);
3554
+ try
3555
+ {
3556
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3557
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3558
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
3559
+ Object obj = in.readObject();
3560
+
3561
+ bais //istream
3562
+ .close();
3563
+ in.close();
3564
+
3565
+ return obj;
3566
+ } catch (Exception e)
3567
+ {
3568
+ System.err.println(e);
3569
+ return null;
3570
+ }
3571
+ }
3572
+
3573
+ static public Object clone(Object o)
3574
+ {
3575
+ try
3576
+ {
3577
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3578
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3579
+
3580
+ out.writeObject(o);
3581
+
3582
+ out.flush();
3583
+ out.close();
3584
+
3585
+ byte[] bytes = baos.toByteArray();
3586
+
3587
+ System.out.println("clone = " + bytes.length);
3588
+
3589
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3590
+ ObjectInputStream in = new ObjectInputStream(bais);
3591
+ Object obj = in.readObject();
3592
+ in.close();
3593
+
3594
+ return obj;
3595
+ } catch (Exception e)
3596
+ {
3597
+ System.err.println(e);
3598
+ return null;
3599
+ }
3600
+ }
3601
+
3602
+ cRadio GetCurrentTab()
3603
+ {
3604
+ cRadio ab;
3605
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3606
+ {
3607
+ ab = (cRadio)e.nextElement();
3608
+ if(ab.GetObject() == copy)
3609
+ {
3610
+ return ab;
3611
+ }
3612
+ }
3613
+
3614
+ return null;
3615
+ }
3616
+
3617
+
3618
+ public void Save()
3619
+ {
3620
+ //Save(true);
3621
+ Replace();
3622
+ }
3623
+
3624
+ private boolean Equal(byte[] compress, byte[] name)
3625
+ {
3626
+ if (compress.length != name.length)
3627
+ {
3628
+ return false;
3629
+ }
3630
+
3631
+ for (int i=compress.length; --i>=0;)
3632
+ {
3633
+ if (compress[i] != name[i])
3634
+ return false;
3635
+ }
3636
+
3637
+ return true;
3638
+ }
3639
+
3640
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3641
+
3642
+ public boolean Save(boolean user)
3643
+ {
3644
+ System.err.println("Save");
3645
+
3646
+ cRadio tab = GetCurrentTab();
3647
+
3648
+ byte[] compress = CompressCopy();
3649
+
3650
+ boolean thesame = false;
3651
+
3652
+ // Quick heuristic using length. Works only when stream is compressed.
3653
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3654
+ {
3655
+ thesame = true;
3656
+ }
3657
+
3658
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3659
+ if (!thesame)
3660
+ {
3661
+ //tab.user[tab.versionindex] = user;
3662
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3663
+
3664
+ copy.versions[++copy.versionindex] = compress;
3665
+
3666
+ // if (increment)
3667
+ // tab.versionindex++;
3668
+ }
3669
+
3670
+ //copy.RestoreBigData(versiontable);
3671
+
3672
+ //assert(hashtable.isEmpty());
3673
+
3674
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3675
+ {
3676
+ //tab.user[i] = false;
3677
+ copy.versions[i] = null;
3678
+ }
3679
+
3680
+ SetUndoStates();
3681
+
3682
+ // test save
3683
+ if (false)
3684
+ {
3685
+ try
3686
+ {
3687
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
3688
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3689
+
3690
+ p.writeObject(copy);
3691
+
3692
+ p.flush();
3693
+
3694
+ ostream.close();
3695
+ } catch (Exception e)
3696
+ {
3697
+ e.printStackTrace();
3698
+ }
3699
+ }
3700
+
3701
+ return !thesame;
3702
+ }
3703
+
3704
+ void CopyChanged(Object3D obj)
3705
+ {
3706
+ SetUndoStates();
3707
+
3708
+ boolean temp = CameraPane.SWITCH;
3709
+ CameraPane.SWITCH = false;
3710
+
3711
+ copy.ExtractBigData(versiontable);
3712
+
3713
+ copy.clear();
3714
+
3715
+ for (int i=0; i<obj.Size(); i++)
3716
+ {
3717
+ copy.add(obj.get(i));
3718
+ }
3719
+
3720
+ copy.RestoreBigData(versiontable);
3721
+
3722
+ CameraPane.SWITCH = temp;
3723
+
3724
+ //assert(hashtable.isEmpty());
3725
+
3726
+ copy.Touch();
3727
+
3728
+ ResetModel();
3729
+ copy.HardTouch(); // recompile?
3730
+
3731
+ cRadio ab;
3732
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3733
+ {
3734
+ ab = (cRadio)e.nextElement();
3735
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3736
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3737
+ if (test != null)
3738
+ {
3739
+ test.editWindow = ab.object.editWindow;
3740
+ ab.object = test;
3741
+ }
3742
+ }
3743
+
3744
+ refreshContents();
3745
+ }
3746
+
3747
+ cButton undoButton;
3748
+ cButton restoreButton;
3749
+ cButton replaceButton;
3750
+ cButton redoButton;
3751
+
3752
+ boolean muteSlider;
3753
+
3754
+ int VersionCount()
3755
+ {
3756
+ int count = 0;
3757
+
3758
+ for (int i = copy.versions.length; --i >= 0;)
3759
+ {
3760
+ if (copy.versions[i] != null)
3761
+ count++;
3762
+ }
3763
+
3764
+ return count;
3765
+ }
3766
+
3767
+ void SetUndoStates()
3768
+ {
3769
+ cRadio tab = GetCurrentTab();
3770
+
3771
+ restoreButton.setEnabled(copy.versionindex != -1);
3772
+ replaceButton.setEnabled(copy.versionindex != -1);
3773
+
3774
+ undoButton.setEnabled(copy.versionindex > 0);
3775
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3776
+
3777
+ muteSlider = true;
3778
+ versionSlider.setMaximum(VersionCount() - 1);
3779
+ versionSlider.setInteger(copy.versionindex);
3780
+ muteSlider = false;
3781
+ }
3782
+
3783
+ public boolean Undo()
3784
+ {
3785
+ // Option?
3786
+ Replace();
3787
+
3788
+ System.err.println("Undo");
3789
+
3790
+ cRadio tab = GetCurrentTab();
3791
+
3792
+ if (copy.versionindex == 0)
3793
+ {
3794
+ java.awt.Toolkit.getDefaultToolkit().beep();
3795
+ return false;
3796
+ }
3797
+
3798
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3799
+// {
3800
+// if (Save(false))
3801
+// tab.versionindex -= 1;
3802
+// else
3803
+// {
3804
+// if (tab.versionindex <= 0)
3805
+// return false;
3806
+// else
3807
+// tab.versionindex -= 1;
3808
+// }
3809
+// }
3810
+
3811
+ copy.versionindex -= 1;
3812
+
3813
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3814
+
3815
+ return true;
3816
+ }
3817
+
3818
+ public boolean Restore()
3819
+ {
3820
+ System.err.println("Restore");
3821
+
3822
+ cRadio tab = GetCurrentTab();
3823
+
3824
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3825
+ {
3826
+ java.awt.Toolkit.getDefaultToolkit().beep();
3827
+ return false;
3828
+ }
3829
+
3830
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3831
+
3832
+ return true;
3833
+ }
3834
+
3835
+ public boolean Replace()
3836
+ {
3837
+ System.err.println("Replace");
3838
+
3839
+ cRadio tab = GetCurrentTab();
3840
+
3841
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3842
+ {
3843
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3844
+ return false;
3845
+ }
3846
+
3847
+ copy.versions[copy.versionindex] = CompressCopy();
3848
+
3849
+ return true;
3850
+ }
3851
+
3852
+ public void Redo()
3853
+ {
3854
+ // Option?
3855
+ Replace();
3856
+
3857
+ cRadio tab = GetCurrentTab();
3858
+
3859
+ if (copy.versions[copy.versionindex + 1] == null)
3860
+ {
3861
+ java.awt.Toolkit.getDefaultToolkit().beep();
3862
+ return;
3863
+ }
3864
+
3865
+ copy.versionindex += 1;
3866
+
3867
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3868
+
3869
+ //if (!tab.user[tab.versionindex])
3870
+ // tab.graphs[tab.versionindex] = null;
3871
+ }
3872
+
3873
+ void ImportGFD()
3874
+ {
3875
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32403876 browser.show();
32413877 String filename = browser.getFile();
32423878 if (filename != null && filename.length() > 0)
32433879 {
3244
- CameraPane.filename = browser.getDirectory() + filename;
3880
+ String fullname = browser.getDirectory() + filename;
3881
+
3882
+ //Object3D readobj =
3883
+ objEditor.ReadGFD(fullname, objEditor);
3884
+ //makeSomething(readobj);
3885
+ }
3886
+ }
3887
+
3888
+ void ImportVRMLX3D()
3889
+ {
3890
+ if (Grafreed.standAlone)
3891
+ {
3892
+ /**/
3893
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3894
+ browser.show();
3895
+ String filename = browser.getFile();
3896
+ if (filename != null && filename.length() > 0)
3897
+ {
3898
+ String fullname = browser.getDirectory() + filename;
3899
+ LoadVRMLX3D(fullname);
3900
+ }
3901
+ /**/
3902
+ }
3903
+ }
3904
+
3905
+ void ToggleAnimation()
3906
+ {
3907
+ if (!Globals.ANIMATION)
3908
+ {
3909
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3910
+ browser.setVisible(true);
3911
+ String filename = browser.getFile();
3912
+ if (filename != null && filename.length() > 0)
3913
+ {
3914
+ Globals.filename = browser.getDirectory() + filename;
32453915 //CameraPane.framecount = 0;
3246
- CameraPane.imagecount = 0;
3916
+ Globals.imagecount = 0;
32473917
3248
- CameraPane.ANIMATION ^= true;
3918
+ Globals.ANIMATION ^= true;
32493919
3250
- GrafreeD.wav.cursor = 0;
3251
- GrafreeD.wav.loop = 0;
3920
+ Grafreed.wav.cursor = 0;
3921
+ Grafreed.wav.loop = 0;
32523922 }
32533923 } else
32543924 {
3255
- CameraPane.ANIMATION ^= true;
3925
+ Globals.ANIMATION ^= true;
32563926 }
32573927 }
32583928
....@@ -3298,7 +3968,7 @@
32983968 void CreateMaterial()
32993969 {
33003970 //copy.ClearMaterial(); // PATCH
3301
- copy.CreateMaterialS(multiplyToggle.isSelected());
3971
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33023972 if (copy.selection.size() > 0)
33033973 //SetMaterial(copy);
33043974 {
....@@ -3349,7 +4019,7 @@
33494019 assert false;
33504020 }
33514021
3352
- void EditSelection()
4022
+ void EditSelection(boolean newWindow)
33534023 {
33544024 }
33554025
....@@ -3357,11 +4027,11 @@
33574027 {
33584028 copy.ResetBlockLoop(); // temporary problem
33594029
3360
- boolean random = CameraPane.RANDOM;
3361
- CameraPane.RANDOM = false; // parse everything
4030
+ boolean random = CameraPane.SWITCH;
4031
+ CameraPane.SWITCH = false; // parse everything
33624032 copy.ResetDisplayList();
33634033 copy.HardTouch();
3364
- CameraPane.RANDOM = random;
4034
+ CameraPane.SWITCH = random;
33654035 }
33664036
33674037 // public void applySelf()
....@@ -3431,10 +4101,40 @@
34314101 current.fakedepth = (float) fakedepthField.getFloat();
34324102 current.shadowbias = (float) shadowbiasField.getFloat();
34334103
3434
- if (!NumberSlider.frozen)
4104
+ if (!cNumberSlider.frozen)
34354105 {
34364106 //System.out.println("Propagate = " + propagate);
34374107 copy.UpdateMaterial(anchor, current, propagate);
4108
+
4109
+ if (copy.material != null)
4110
+ {
4111
+ cMaterial mat = copy.material;
4112
+
4113
+ colorField.SetToolTipValue((mat.color));
4114
+ modulationField.SetToolTipValue((mat.modulation));
4115
+ metalnessField.SetToolTipValue((mat.metalness));
4116
+ diffuseField.SetToolTipValue((mat.diffuse));
4117
+ specularField.SetToolTipValue((mat.specular));
4118
+ shininessField.SetToolTipValue((mat.shininess));
4119
+ shiftField.SetToolTipValue((mat.shift));
4120
+ ambientField.SetToolTipValue((mat.ambient));
4121
+ lightareaField.SetToolTipValue((mat.lightarea));
4122
+ diffusenessField.SetToolTipValue((mat.factor));
4123
+ velvetField.SetToolTipValue((mat.velvet));
4124
+ sheenField.SetToolTipValue((mat.sheen));
4125
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4126
+ backlitField.SetToolTipValue((mat.bump));
4127
+ anisoField.SetToolTipValue((mat.aniso));
4128
+ anisoVField.SetToolTipValue((mat.anisoV));
4129
+ cameraField.SetToolTipValue((mat.cameralight));
4130
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4131
+ shadowField.SetToolTipValue((mat.shadow));
4132
+ textureField.SetToolTipValue((mat.texture));
4133
+ opacityField.SetToolTipValue((mat.opacity));
4134
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4135
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4136
+ }
4137
+
34384138 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34394139 {
34404140 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3463,9 +4163,25 @@
34634163 //copy.Touch();
34644164 }
34654165
4166
+ cNumberSlider versionSlider;
4167
+
34664168 public void stateChanged(ChangeEvent e)
34674169 {
34684170 // assert(false);
4171
+ if (e.getSource() == versionSlider)
4172
+ {
4173
+ if (muteSlider)
4174
+ return;
4175
+
4176
+ int version = versionSlider.getInteger();
4177
+
4178
+ if (copy.versions[version] != null)
4179
+ {
4180
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4181
+ }
4182
+
4183
+ return;
4184
+ }
34694185
34704186 if (freezematerial)
34714187 {
....@@ -3479,6 +4195,7 @@
34794195 || e.getSource() == apertureField
34804196 || e.getSource() == shadowblurField)
34814197 {
4198
+ new Exception().printStackTrace();
34824199 System.exit(0);
34834200 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34844201 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3505,7 +4222,13 @@
35054222 //System.out.println("PARENT = " + parent);
35064223 //if (parent != null)
35074224 // parent.applySelf();
3508
- refreshContents();
4225
+ if (e.getSource() == normalpushField)
4226
+ {
4227
+ objEditor.refreshContents();
4228
+ //Refresh();
4229
+ }
4230
+ else
4231
+ refreshContents();
35094232 // ??? client.refreshEditWindow();
35104233 }
35114234 //else
....@@ -3517,7 +4240,7 @@
35174240 //group.name = nameField.getText();
35184241 //objEditor.applySelf();
35194242
3520
- assert (objEditor == this);
4243
+ // OCT2018: assert (objEditor == this);
35214244 if (copy.selection == null || copy.selection.size() == 0)
35224245 //super.applySelf()
35234246 ; else
....@@ -3541,12 +4264,18 @@
35414264 objEditor.copy = keep;
35424265 }
35434266 }
4267
+
4268
+ if (normalpushField != null)
4269
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35444270 }
35454271
35464272 void SnapObject()
35474273 {
3548
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3549
- SnapObject(obj);
4274
+ if (copy.selection.size() > 0)
4275
+ {
4276
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
4277
+ SnapObject(obj);
4278
+ }
35504279 }
35514280
35524281 void SnapObject(Object3D obj)
....@@ -3660,7 +4389,7 @@
36604389
36614390 if (obj.parent != null)
36624391 {
3663
- obj.parent.TransformToWorld(interest);
4392
+// obj.parent.TransformToWorld(interest);
36644393 }
36654394
36664395 if (!CameraPane.TRACK)
....@@ -3792,7 +4521,7 @@
37924521
37934522 radioPanel.revalidate();
37944523 radioPanel.repaint();
3795
- ctrlPanel.revalidate(); // ? new
4524
+ ctrlPanel.validate(); // ? new
37964525 ctrlPanel.repaint();
37974526 }
37984527 }
....@@ -3801,6 +4530,8 @@
38014530
38024531 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38034532 {
4533
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4534
+ Save();
38044535 //Tween.set(thing, 0).target(1).start(tweenManager);
38054536 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38064537 // if (thing instanceof GenericJointDemo)
....@@ -3887,6 +4618,12 @@
38874618 {
38884619 ResetModel();
38894620 Select(thing.GetTreePath(), true, false); // unselect... false);
4621
+
4622
+ if (thing.Size() == 0)
4623
+ {
4624
+ //EditSelection(false);
4625
+ }
4626
+
38904627 refreshContents();
38914628 }
38924629
....@@ -4004,6 +4741,7 @@
40044741 }
40054742 }
40064743 }
4744
+
40074745 LoadGFDThread loadGFDThread;
40084746
40094747 void ReadGFD(String fullname, iCallBack cb)
....@@ -4023,8 +4761,10 @@
40234761
40244762 try
40254763 {
4764
+ // Try compressed version first.
40264765 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4027
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4766
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4767
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40284768
40294769 readobj = (Object3D) p.readObject();
40304770 istream.close();
....@@ -4032,7 +4772,20 @@
40324772 readobj.ResetDisplayList();
40334773 } catch (Exception e)
40344774 {
4035
- e.printStackTrace();
4775
+ //e.printStackTrace();
4776
+ try
4777
+ {
4778
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4779
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4780
+
4781
+ readobj = (Object3D) p.readObject();
4782
+ istream.close();
4783
+
4784
+ readobj.ResetDisplayList();
4785
+ } catch (Exception e2)
4786
+ {
4787
+ e2.printStackTrace();
4788
+ }
40364789 }
40374790 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40384791 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4078,6 +4831,12 @@
40784831
40794832 void LoadIt(Object obj)
40804833 {
4834
+ if (obj == null)
4835
+ {
4836
+ // Invalid file
4837
+ return;
4838
+ }
4839
+
40814840 System.out.println("Loaded " + obj);
40824841 //new Exception().printStackTrace();
40834842 Object3D readobj = (Object3D) obj;
....@@ -4087,6 +4846,8 @@
40874846
40884847 if (readobj != null)
40894848 {
4849
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4850
+ // Save();
40904851 try
40914852 {
40924853 //readobj.deepCopySelf(copy);
....@@ -4141,15 +4902,26 @@
41414902 c.addChild(csg);
41424903 }
41434904
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
+
41444916 ResetModel();
41454917 copy.HardTouch(); // recompile?
41464918 refreshContents();
41474919 }
41484920 }
41494921
4150
- void load() // throws ClassNotFoundException
4922
+ void Open() // throws ClassNotFoundException
41514923 {
4152
- if (GrafreeD.standAlone)
4924
+ if (Grafreed.standAlone)
41534925 {
41544926 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41554927 browser.show();
....@@ -4236,11 +5008,13 @@
42365008 try
42375009 {
42385010 FileOutputStream ostream = new FileOutputStream(lastname);
4239
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5011
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5012
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42405013
42415014 p.writeObject(copy);
42425015 p.flush();
42435016
5017
+ zstream.close();
42445018 ostream.close();
42455019
42465020 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4250,17 +5024,20 @@
42505024 {
42515025 }
42525026 }
5027
+
42535028 String lastname;
42545029
42555030 void saveAs()
42565031 {
4257
- if (GrafreeD.standAlone)
5032
+ if (Grafreed.standAlone)
42585033 {
42595034 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42605035 browser.setVisible(true);
42615036 String filename = browser.getFile();
42625037 if (filename != null && filename.length() > 0)
42635038 {
5039
+ if (!filename.endsWith(".gfd"))
5040
+ filename += ".gfd";
42645041 lastname = browser.getDirectory() + filename;
42655042 save();
42665043 }
....@@ -4359,13 +5136,13 @@
43595136 try
43605137 {
43615138 FileOutputStream ostream = new FileOutputStream(filename);
4362
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4363
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5139
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5140
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43645141
43655142 Object3D objectparent = obj.parent;
43665143 obj.parent = null;
43675144
4368
- Object3D object = (Object3D) GrafreeD.clone(obj);
5145
+ Object3D object = (Object3D) Grafreed.clone(obj);
43695146
43705147 obj.parent = objectparent;
43715148
....@@ -4377,8 +5154,8 @@
43775154 p.writeObject(object);
43785155 p.flush();
43795156
5157
+ zstream.close();
43805158 ostream.close();
4381
- // zstream.close();
43825159
43835160 // group.selection.get(0).parent = parent;
43845161 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4399,7 +5176,7 @@
43995176 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44005177 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44015178 copy.generatePOV(buffer);
4402
- if (GrafreeD.standAlone)
5179
+ if (Grafreed.standAlone)
44035180 {
44045181 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44055182 browser.show();
....@@ -4425,53 +5202,70 @@
44255202 Object3D client;
44265203 Object3D copy;
44275204 MenuBar menuBar;
4428
- Menu windowMenu;
4429
- MenuItem loadItem;
5205
+ Menu fileMenu;
5206
+ MenuItem newItem;
5207
+ MenuItem openItem;
44305208 MenuItem saveItem;
44315209 MenuItem saveAsItem;
44325210 MenuItem exportAsItem;
44335211 MenuItem reexportItem;
44345212 MenuItem povItem;
44355213 MenuItem closeItem;
4436
- Menu cameraMenu;
5214
+
44375215 CheckboxMenuItem zBufferItem;
44385216 //MenuItem normalLensItem;
4439
- MenuItem editCameraItem;
4440
- MenuItem revertCameraItem;
4441
- CheckboxMenuItem toggleLiveItem;
44425217 MenuItem stepItem;
4443
- CheckboxMenuItem toggleFullItem;
5218
+ CheckboxMenuItem toggleLiveItem;
5219
+ CheckboxMenuItem toggleFullScreenItem;
5220
+ CheckboxMenuItem toggleTimelineItem;
44445221 CheckboxMenuItem toggleRenderItem;
44455222 CheckboxMenuItem toggleDebugItem;
44465223 CheckboxMenuItem toggleFrustumItem;
44475224 CheckboxMenuItem toggleFootContactItem;
44485225 CheckboxMenuItem toggleDLItem;
44495226 CheckboxMenuItem toggleTextureItem;
4450
- CheckboxMenuItem toggleRandomItem;
5227
+ CheckboxMenuItem toggleSwitchItem;
44515228 CheckboxMenuItem toggleRootItem;
44525229 CheckboxMenuItem animationItem;
5230
+ MenuItem archiveItem;
44535231 CheckboxMenuItem toggleHandleItem;
44545232 CheckboxMenuItem togglePaintItem;
44555233 JSplitPane mainPanel;
44565234 JScrollPane scrollpane;
5235
+
44575236 JPanel toolbarPanel;
4458
- JPanel treePanel;
5237
+
5238
+ cGridBag treePanel;
5239
+
44595240 JPanel radioPanel;
44605241 ButtonGroup buttonGroup;
4461
- JPanel ctrlPanel;
4462
- JPanel materialPanel;
5242
+
5243
+ cGridBag toolboxPanel;
5244
+ cGridBag materialPanel;
5245
+ cGridBag ctrlPanel;
5246
+
44635247 JScrollPane infoPanel;
4464
- JPanel optionsPanel;
5248
+
5249
+ cGridBag optionsPanel;
5250
+
44655251 JTabbedPane objectPanel;
4466
- JPanel XYZPanel;
5252
+ boolean materialFlushed;
5253
+ Object3D latestObject;
5254
+
5255
+ cGridBag XYZPanel;
5256
+
44675257 JSplitPane gridPanel;
44685258 JSplitPane bigPanel;
4469
- JPanel bigThree;
4470
- JTabbedPane jtp;
4471
- JPanel cameraPanel;
5259
+
5260
+ cGridBag bigThree;
5261
+ cGridBag scenePanel;
5262
+ cGridBag centralPanel;
5263
+ JSplitPane cameraPanel;
5264
+ JPanel timelinePanel;
5265
+ JMenuBar timelineMenubar;
44725266 JSplitPane framePanel;
44735267 JTextArea/*Field*/ nameField;
4474
- cButton textureButton;
5268
+ //cButton textureButton;
44755269 cButton okButton;
44765270 cButton applyButton;
44775271 cButton cancelButton;
....@@ -4518,65 +5312,72 @@
45185312 // MATERIAL
45195313 JLabel materialLabel;
45205314 JLabel colorLabel;
4521
- NumberSlider colorField;
5315
+ cNumberSlider colorField;
45225316 JLabel modulationLabel;
4523
- NumberSlider modulationField;
5317
+ cNumberSlider modulationField;
45245318 JLabel metalnessLabel;
4525
- NumberSlider metalnessField;
5319
+ cNumberSlider metalnessField;
45265320 JLabel diffuseLabel;
4527
- NumberSlider diffuseField;
5321
+ cNumberSlider diffuseField;
45285322 JLabel specularLabel;
4529
- NumberSlider specularField;
5323
+ cNumberSlider specularField;
45305324 JLabel shininessLabel;
4531
- NumberSlider shininessField;
5325
+ cNumberSlider shininessField;
45325326 JLabel shiftLabel;
4533
- NumberSlider shiftField;
5327
+ cNumberSlider shiftField;
45345328 JLabel ambientLabel;
4535
- NumberSlider ambientField;
5329
+ cNumberSlider ambientField;
45365330 JLabel lightareaLabel;
4537
- NumberSlider lightareaField;
5331
+ cNumberSlider lightareaField;
45385332 JLabel diffusenessLabel;
4539
- NumberSlider diffusenessField;
5333
+ cNumberSlider diffusenessField;
45405334 JLabel velvetLabel;
4541
- NumberSlider velvetField;
5335
+ cNumberSlider velvetField;
45425336 JLabel sheenLabel;
4543
- NumberSlider sheenField;
5337
+ cNumberSlider sheenField;
45445338 JLabel subsurfaceLabel;
4545
- NumberSlider subsurfaceField;
5339
+ cNumberSlider subsurfaceField;
45465340 //JLabel bumpLabel;
45475341 //NumberSlider bumpField;
45485342 JLabel backlitLabel;
4549
- NumberSlider backlitField;
5343
+ cNumberSlider backlitField;
45505344 JLabel anisoLabel;
4551
- NumberSlider anisoField;
5345
+ cNumberSlider anisoField;
45525346 JLabel anisoVLabel;
4553
- NumberSlider anisoVField;
5347
+ cNumberSlider anisoVField;
45545348 JLabel cameraLabel;
4555
- NumberSlider cameraField;
5349
+ cNumberSlider cameraField;
45565350 JLabel selfshadowLabel;
4557
- NumberSlider selfshadowField;
5351
+ cNumberSlider selfshadowField;
45585352 JLabel shadowLabel;
4559
- NumberSlider shadowField;
5353
+ cNumberSlider shadowField;
45605354 JLabel textureLabel;
4561
- NumberSlider textureField;
5355
+ cNumberSlider textureField;
45625356 JLabel opacityLabel;
4563
- NumberSlider opacityField;
5357
+ cNumberSlider opacityField;
45645358 JLabel fakedepthLabel;
4565
- NumberSlider fakedepthField;
5359
+ cNumberSlider fakedepthField;
45665360 JLabel shadowbiasLabel;
4567
- NumberSlider shadowbiasField;
5361
+ cNumberSlider shadowbiasField;
45685362 JLabel bumpLabel;
4569
- NumberSlider bumpField;
5363
+ cNumberSlider bumpField;
45705364 JLabel noiseLabel;
4571
- NumberSlider noiseField;
5365
+ cNumberSlider noiseField;
45725366 JLabel powerLabel;
4573
- NumberSlider powerField;
5367
+ cNumberSlider powerField;
45745368 JLabel borderfadeLabel;
4575
- NumberSlider borderfadeField;
5369
+ cNumberSlider borderfadeField;
45765370 JLabel fogLabel;
4577
- NumberSlider fogField;
5371
+ cNumberSlider fogField;
45785372 JLabel opacityPowerLabel;
4579
- NumberSlider opacityPowerField;
4580
- JTree jTree;
5373
+ cNumberSlider opacityPowerField;
5374
+ cTree jTree;
45815375 //ObjectUI parent;
5376
+
5377
+ cNumberSlider normalpushField;
5378
+
5379
+ private MenuItem importGFDItem;
5380
+ private MenuItem importVRMLX3DItem;
5381
+ private MenuItem import3DSItem;
5382
+ private MenuItem importOBJItem;
45825383 }