Normand Briere
2019-08-01 c99d954f5e2bffa601c599142371cfeb45630f40
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,87 @@
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
+ public cGridBag GetSeparator()
46
+ {
47
+ cGridBag separator = new cGridBag();
48
+ separator.add(new JSeparator());
49
+ separator.preferredHeight = 5;
50
+ return separator;
51
+ }
52
+
53
+ cButton GetButton(String name, boolean border)
54
+ {
55
+ ImageIcon icon = GetIcon(name);
56
+ return new cButton(icon, border);
57
+ }
58
+
59
+ cLabel GetLabel(String name, boolean border)
60
+ {
61
+ //ImageIcon icon = GetIcon(name);
62
+ return new cLabel(GetImage(name), border);
63
+ }
64
+
65
+ cToggleButton GetToggleButton(String name, boolean border)
66
+ {
67
+ ImageIcon icon = GetIcon(name);
68
+ return new cToggleButton(icon, border);
69
+ }
70
+
71
+ cCheckBox GetCheckBox(String name, boolean border)
72
+ {
73
+ ImageIcon icon = GetIcon(name);
74
+ return new cCheckBox(icon, border);
75
+ }
76
+
77
+ ImageIcon GetIcon(String name)
78
+ {
79
+ try
80
+ {
81
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
82
+
83
+// if (image.getWidth() > 48 && image.getHeight() > 48)
84
+// {
85
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
86
+// Graphics2D g = resized.createGraphics();
87
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
88
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
89
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
90
+// g.dispose();
91
+//
92
+// image = resized;
93
+// }
94
+
95
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
96
+ return icon;
97
+ }
98
+ catch (Exception e)
99
+ {
100
+ return null;
101
+ }
102
+ }
103
+
104
+ BufferedImage GetImage(String name)
105
+ {
106
+ try
107
+ {
108
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
109
+
110
+ return image;
111
+ }
112
+ catch (Exception e)
113
+ {
114
+ return null;
115
+ }
116
+ }
117
+
32118 // SCRIPT
33119
34120 transient JFrame textpanel = null;
....@@ -119,51 +205,62 @@
119205 void keyPressed(int key, int modifiers)
120206 {
121207 System.out.println("KEY PRESSED");
122
- CameraPane.theRenderer.keyPressed(key, modifiers);
208
+ Globals.theRenderer.keyPressed(key, modifiers);
123209 }
124210 */
125211
126212 static GridBagConstraints aConstraints;
127213 static GridBagConstraints aWindowConstraints;
128
- GroupEditor callee;
129
- JFrame frame;
214
+
130215 static int GRIDWIDTH = 100; // 4;
131216
132217 public void closeUI()
133218 {
134219 //new Exception().printStackTrace();
135
- System.out.println("this = " + this);
136
- System.out.println("objEditor = " + objEditor);
220
+// System.out.println("this = " + this);
221
+// System.out.println("objEditor = " + objEditor);
137222 //nameField.removeActionListener(this);
138
- objEditor.ctrlPanel.remove(nameField);
223
+// objEditor.ctrlPanel.remove(nameField);
139224
140
- if (!GroupEditor.allparams)
225
+ objEditor.ctrlPanel.remove(namePanel);
226
+
227
+ if (!allparams)
141228 return;
142229
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);
230
+// objEditor.ctrlPanel.remove(liveCB);
231
+// objEditor.ctrlPanel.remove(hideCB);
232
+// objEditor.ctrlPanel.remove(markCB);
233
+//
234
+// objEditor.ctrlPanel.remove(randomCB);
235
+// objEditor.ctrlPanel.remove(speedupCB);
236
+// objEditor.ctrlPanel.remove(rewindCB);
237
+//
238
+// objEditor.ctrlPanel.remove(resetButton);
239
+// objEditor.ctrlPanel.remove(stepButton);
240
+//// objEditor.ctrlPanel.remove(stepAllButton);
241
+//// objEditor.ctrlPanel.remove(resetAllButton);
242
+// objEditor.ctrlPanel.remove(link2masterCB);
243
+// //objEditor.ctrlPanel.remove(flipVCB);
244
+// //objEditor.ctrlPanel.remove(texresMenu);
245
+// objEditor.ctrlPanel.remove(slowerButton);
246
+// objEditor.ctrlPanel.remove(fasterButton);
247
+// objEditor.ctrlPanel.remove(remarkButton);
248
+
249
+ objEditor.ctrlPanel.remove(setupPanel);
250
+ objEditor.ctrlPanel.remove(setupPanel2);
251
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
252
+ objEditor.ctrlPanel.remove(pushPanel);
253
+ //objEditor.ctrlPanel.remove(fillPanel);
254
+
255
+ //Remove(normalpushField);
161256 }
162257
163258 public ObjEditor GetEditor()
164259 {
165260 return objEditor; //.GetEditor();
166261 }
262
+
263
+ // Sometimes myself, sometimes my callee's.
167264 ObjEditor objEditor;
168265
169266 /*
....@@ -199,6 +296,12 @@
199296 client = inClient;
200297 copy = client;
201298
299
+ if (copy.versions == null)
300
+ {
301
+ copy.versions = new byte[100][];
302
+ copy.versionindex = -1;
303
+ }
304
+
202305 // "this" is not called: SetupUI2(objEditor);
203306 }
204307
....@@ -212,6 +315,12 @@
212315 client = inClient;
213316 copy = client;
214317
318
+ if (copy.versions == null)
319
+ {
320
+ copy.versions = new byte[100][];
321
+ copy.versionindex = -1;
322
+ }
323
+
215324 SetupUI2(callee.GetEditor());
216325 }
217326
....@@ -226,6 +335,7 @@
226335 //localCopy.parent = null;
227336
228337 frame = new JFrame();
338
+ frame.setUndecorated(false);
229339 objEditor = this;
230340 this.callee = callee;
231341
....@@ -238,11 +348,17 @@
238348 //if (!isDisplayable())
239349 //setUndecorated(true);
240350
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
351
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242352 client = inClient;
243353 copy = localCopy;
244354 copy.editWindow = this;
245355
356
+ if (copy.versions == null)
357
+ {
358
+// copy.versions = new byte[100][];
359
+// copy.versionindex = -1;
360
+ }
361
+
246362 SetupMenu();
247363
248364 //SetupName(objEditor); // new
....@@ -256,28 +372,49 @@
256372 return frame.action(event, obj);
257373 }
258374
375
+ // Cannot work without static
376
+ static boolean allparams = true;
377
+
378
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
379
+
259380 void SetupMenu()
260381 {
261382 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..."));
383
+ menuBar.add(fileMenu = new Menu("File"));
384
+ fileMenu.add(newItem = new MenuItem("New"));
385
+ fileMenu.add(openItem = new MenuItem("Open..."));
386
+
387
+ //oe.menuBar.add(menu = new Menu("Include"));
388
+ Menu menu = new Menu("Import");
389
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
390
+ importOBJItem.addActionListener(this);
391
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
392
+ import3DSItem.addActionListener(this);
393
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
394
+ importVRMLX3DItem.addActionListener(this);
395
+ menu.add("-");
396
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
397
+ importGFDItem.addActionListener(this);
398
+ fileMenu.add(menu);
399
+ fileMenu.add("-");
400
+
401
+ fileMenu.add(saveItem = new MenuItem("Save"));
402
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267403 //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("-");
404
+ fileMenu.add("-");
405
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
406
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
407
+ fileMenu.add("-");
272408 if (client.parent != null)
273409 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
410
+ fileMenu.add(closeItem = new MenuItem("Close"));
275411 } else
276412 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
413
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278414 }
279415
280
- loadItem.addActionListener(this);
416
+ newItem.addActionListener(this);
417
+ openItem.addActionListener(this);
281418 saveItem.addActionListener(this);
282419 saveAsItem.addActionListener(this);
283420 exportAsItem.addActionListener(this);
....@@ -285,82 +422,69 @@
285422 //povItem.addActionListener(this);
286423 closeItem.addActionListener(this);
287424
288
- menuBar.add(cameraMenu = new Menu("View"));
289
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
290
- //zBufferItem.addActionListener(this);
291
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
292
- //normalLensItem.addActionListener(this);
293
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
294
- revertCameraItem.addActionListener(this);
295
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
296
- toggleFullScreenItem.addItemListener(this);
297
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
298
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
299
- toggleTimelineItem.addItemListener(this);
300
- cameraMenu.add("-");
301
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
302
- toggleTextureItem.addItemListener(this);
303
- toggleTextureItem.setState(CameraPane.textureon);
304
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
305
- toggleLiveItem.addItemListener(this);
306
- toggleLiveItem.setState(CameraPane.isLIVE());
307
- cameraMenu.add(stepItem = new MenuItem("Step"));
308
- stepItem.addActionListener(this);
309
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
310
-// toggleDLItem.addItemListener(this);
311
-// toggleDLItem.setState(false);
312
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
313
- toggleRenderItem.addItemListener(this);
314
- toggleRenderItem.setState(!CameraPane.frozen);
315
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
316
- toggleDebugItem.addItemListener(this);
317
- toggleDebugItem.setState(CameraPane.DEBUG);
318
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
319
- toggleFrustumItem.addItemListener(this);
320
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
321
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
322
- toggleFootContactItem.addItemListener(this);
323
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
324
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
325
- toggleRandomItem.addItemListener(this);
326
- toggleRandomItem.setState(CameraPane.RANDOM);
327
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
328
- toggleHandleItem.addItemListener(this);
329
- toggleHandleItem.setState(CameraPane.HANDLES);
330
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
331
- togglePaintItem.addItemListener(this);
332
- togglePaintItem.setState(CameraPane.PAINTMODE);
333
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
334
-// toggleRootItem.addItemListener(this);
335
-// toggleRootItem.setState(false);
336
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
337
-// animationItem.addItemListener(this);
338
-// animationItem.setState(CameraPane.ANIMATION);
339
- cameraMenu.add("-");
340
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
341
- editCameraItem.addActionListener(this);
342
-
343425 objectPanel = new JTabbedPane();
426
+
427
+ ChangeListener changeListener = new ChangeListener()
428
+ {
429
+ public void stateChanged(ChangeEvent changeEvent)
430
+ {
431
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
432
+// {
433
+// if (latestObject != null)
434
+// {
435
+// refreshContents(true);
436
+// SetMaterial(latestObject);
437
+// }
438
+//
439
+// materialFlushed = true;
440
+// }
441
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
442
+// {
443
+// if (listUI.size() == 0)
444
+// EditSelection(false);
445
+// }
446
+
447
+ refreshContents(false); // To refresh Info tab
448
+ }
449
+ };
450
+ objectPanel.addChangeListener(changeListener);
451
+
344452 toolbarPanel = new JPanel();
345453 toolbarPanel.setName("Toolbar");
346
- treePanel = new JPanel();
454
+
455
+ treePanel = new cGridBag();
347456 treePanel.setName("Tree");
348
- ctrlPanel = new JPanel(); // new GridBagLayout());
349
- ctrlPanel.setName("Edit");
350
- materialPanel = new JPanel();
351
- materialPanel.setName("Material");
457
+
458
+ editPanel = new cGridBag().setVertical(true);
459
+ //editPanel.setName("Edit");
460
+
461
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
462
+
463
+ editCommandsPanel = new cGridBag();
464
+ editPanel.add(editCommandsPanel);
465
+ editPanel.add(ctrlPanel);
466
+
467
+ toolboxPanel = new cGridBag().setVertical(true);
468
+ //toolboxPanel.setName("Toolbox");
469
+
470
+ materialPanel = new cGridBag().setVertical(true);
471
+ //materialPanel.setName("Material");
472
+
352473 /*JTextPane*/
353474 infoarea = createTextPane();
475
+ doc = infoarea.getStyledDocument();
476
+
354477 infoarea.setEditable(true);
355478 SetText();
479
+
356480 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
357481 // infoarea.setOpaque(false);
358482 // //infoarea.setForeground(textcolor);
359
- infoarea.setLineWrap(true);
360
- infoarea.setWrapStyleWord(true);
483
+// TEXTAREA infoarea.setLineWrap(true);
484
+// TEXTAREA infoarea.setWrapStyleWord(true);
361485 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
362
- infoPanel.setPreferredSize(new Dimension(50, 200));
363
- infoPanel.setName("Info");
486
+ infoPanel.setPreferredSize(new Dimension(1, 1));
487
+ //infoPanel.setName("Info");
364488 //infoPanel.setLayout(new BorderLayout());
365489 //infoPanel.add(createTextPane());
366490
....@@ -368,16 +492,23 @@
368492 mainPanel.setName("Main");
369493 mainPanel.setContinuousLayout(true);
370494 mainPanel.setOneTouchExpandable(true);
371
- mainPanel.setDividerLocation(1.0);
372495 mainPanel.setDividerSize(9);
373
- mainPanel.setResizeWeight(0);
374
-
496
+ mainPanel.setDividerLocation(0.5); //1.0);
497
+ mainPanel.setResizeWeight(0.5);
498
+
499
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
500
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
501
+ divider.setDividerSize(15);
502
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
503
+
504
+ mainPanel.setUI(new BasicSplitPaneUI());
505
+
375506 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
376507 //mainPanel.setLayout(new GridBagLayout());
377508 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
378
- treePanel.setLayout(new GridBagLayout());
379
- ctrlPanel.setLayout(new GridBagLayout());
380
- materialPanel.setLayout(new GridBagLayout());
509
+// treePanel.setLayout(new GridBagLayout());
510
+ //ctrlPanel.setLayout(new GridBagLayout());
511
+ //materialPanel.setLayout(new GridBagLayout());
381512
382513 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
383514 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -416,7 +547,7 @@
416547 static String newline = "\n";
417548 protected static final String buttonString = "JButton";
418549 StyledDocument doc;
419
- JTextArea infoarea;
550
+ JTextPane infoarea;
420551
421552 void ClearInfo()
422553 {
....@@ -439,10 +570,10 @@
439570 e.printStackTrace();
440571 }
441572
442
- String selection = infoarea.getText();
443
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
444
- java.awt.datatransfer.Clipboard clipboard =
445
- Toolkit.getDefaultToolkit().getSystemClipboard();
573
+// String selection = infoarea.getText();
574
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
575
+// java.awt.datatransfer.Clipboard clipboard =
576
+// Toolkit.getDefaultToolkit().getSystemClipboard();
446577 //clipboard.setContents(data, data);
447578 }
448579
....@@ -465,13 +596,13 @@
465596 //SendInfo("Name:", "bold");
466597 if (sel.GetTextures() != null || debug)
467598 {
468
- si.SendInfo(sel.toString(), "bold");
599
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
469600 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
470601 if (sel.Size() > 0)
471602 {
472603 si.SendInfo("#children = " + sel.Size(), "regular");
473604 }
474
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
605
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
475606 if (debug)
476607 {
477608 try
....@@ -483,7 +614,10 @@
483614 }
484615
485616 if (full)
486
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
617
+ {
618
+ si.SendInfo(" BBox min: " + minima, "regular");
619
+ si.SendInfo(" BBox max: " + maxima, "regular");
620
+ }
487621
488622 if (sel.bRep != null)
489623 {
....@@ -510,7 +644,7 @@
510644 }
511645 if (sel.support != null)
512646 {
513
- si.SendInfo(" support: " + sel.support, "regular");
647
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
514648 }
515649 if (sel.scriptnode != null)
516650 {
....@@ -581,6 +715,9 @@
581715 {
582716 CameraPane.pointflow = (PointFlow) sel;
583717 }
718
+
719
+ si.SendInfo("_____________________", "regular");
720
+ si.SendInfo("", "regular");
584721 }
585722 }
586723
....@@ -596,52 +733,191 @@
596733 }
597734 }
598735
599
- private JTextArea createTextPane()
600
- {
601
- String[] initString =
602
- {
603
- "This is an editable JTextPane, ", //regular
604
- "another ", //italic
605
- "styled ", //bold
606
- "text ", //small
607
- "component, ", //large
608
- "which supports embedded components..." + newline,//regular
609
- " " + newline, //button
610
- "...and embedded icons..." + newline, //regular
611
- " ", //icon
612
- newline + "JTextPane is a subclass of JEditorPane that "
613
- + "uses a StyledEditorKit and StyledDocument, and provides "
614
- + "cover methods for interacting with those objects."
615
- };
736
+//static GraphicsDevice device = GraphicsEnvironment
737
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
616738
617
- String[] initStyles =
618
- {
619
- "regular", "italic", "bold", "small", "large",
620
- "regular", "button", "regular", "icon",
621
- "regular"
622
- };
739
+ Rectangle keeprect;
740
+ cRadio radio;
741
+
742
+cButton keepButton;
743
+ cButton twoButton; // Full 3D
744
+ cButton sixButton;
745
+ cButton threeButton;
746
+ cButton sevenButton;
747
+ cButton fourButton; // full panel
748
+ cButton oneButton; // full XYZ
749
+ //cButton currentLayout;
750
+
751
+ boolean maximized;
752
+
753
+ cButton fullscreenLayout;
623754
624
- JTextPane textPane = new JTextPane();
625
- textPane.setEditable(true);
626
- /*StyledDocument*/ doc = textPane.getStyledDocument();
627
- addStylesToDocument(doc);
628
-
629
- try
755
+ void Minimize()
630756 {
631
- for (int j = 0; j < 2; j++)
757
+ frame.setState(Frame.ICONIFIED);
758
+ frame.validate();
759
+ }
760
+
761
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
762
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
763
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
764
+ void Maximize()
765
+ {
766
+ if (CameraPane.FULLSCREEN)
632767 {
633
- for (int i = 0; i < initString.length; i++)
634
- {
635
- doc.insertString(doc.getLength(), initString[i],
636
- doc.getStyle(initStyles[i]));
637
- }
768
+ ToggleFullScreen();
638769 }
639
- } catch (BadLocationException ble)
770
+
771
+ if (maximized)
772
+ {
773
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
774
+ }
775
+ else
776
+ {
777
+ keeprect = frame.getBounds();
778
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
779
+// Dimension rect2 = frame.getToolkit().getScreenSize();
780
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
781
+// frame.setState(Frame.MAXIMIZED_BOTH);
782
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
783
+ }
784
+
785
+ maximized ^= true;
786
+
787
+ frame.validate();
788
+ }
789
+
790
+ cButton minButton;
791
+ cButton maxButton;
792
+ cButton fullButton;
793
+
794
+ void ToggleFullScreen()
640795 {
641
- System.err.println("Couldn't insert initial text into text pane.");
796
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
797
+
798
+ cameraView.ToggleFullScreen();
799
+
800
+ if (!CameraPane.FULLSCREEN)
801
+ {
802
+ device.setFullScreenWindow(null);
803
+ frame.dispose();
804
+ frame.setUndecorated(false);
805
+ frame.validate();
806
+ frame.setVisible(true);
807
+
808
+ //frame.setVisible(false);
809
+// frame.removeNotify();
810
+// frame.setUndecorated(false);
811
+// frame.addNotify();
812
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
813
+
814
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
815
+// X framePanel.add(bigThree);
816
+// X frame.getContentPane().add(/*"Center",*/framePanel);
817
+ framePanel.setDividerLocation(46);
818
+
819
+ //frame.setVisible(true);
820
+ radio.layout = keepButton;
821
+ //theFrame = null;
822
+ keepButton = null;
823
+ radio.layout.doClick();
824
+
825
+ } else
826
+ {
827
+ keepButton = radio.layout;
828
+ //keeprect = frame.getBounds();
829
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
830
+// frame.getToolkit().getScreenSize().height);
831
+ //frame.setVisible(false);
832
+
833
+ frame.dispose();
834
+ frame.setUndecorated(true);
835
+ device.setFullScreenWindow(frame);
836
+ frame.validate();
837
+ frame.setVisible(true);
838
+// frame.removeNotify();
839
+// frame.setUndecorated(true);
840
+// frame.addNotify();
841
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
842
+// X framePanel.remove(bigThree);
843
+// X frame.getContentPane().add(/*"Center",*/bigThree);
844
+ framePanel.setDividerLocation(0);
845
+
846
+ radio.layout = fullscreenLayout;
847
+ radio.layout.doClick();
848
+ //frame.setVisible(true);
849
+ }
850
+ frame.validate();
642851 }
643852
644
- return new JTextArea(); // textPane;
853
+ private byte[] CompressCopy()
854
+ {
855
+ boolean temp = CameraPane.SWITCH;
856
+ CameraPane.SWITCH = false;
857
+
858
+ copy.ExtractBigData(versiontable);
859
+ // if (copy == client)
860
+
861
+ byte[] versions[] = copy.versions;
862
+ copy.versions = null;
863
+
864
+ byte[] compress = Compress(copy);
865
+
866
+ copy.versions = versions;
867
+
868
+ copy.RestoreBigData(versiontable);
869
+
870
+ CameraPane.SWITCH = temp;
871
+
872
+ return compress;
873
+ }
874
+
875
+ private JTextPane createTextPane()
876
+ {
877
+// TEXTAREA String[] initString =
878
+// {
879
+// "This is an editable JTextPane, ", //regular
880
+// "another ", //italic
881
+// "styled ", //bold
882
+// "text ", //small
883
+// "component, ", //large
884
+// "which supports embedded components..." + newline,//regular
885
+// " " + newline, //button
886
+// "...and embedded icons..." + newline, //regular
887
+// " ", //icon
888
+// newline + "JTextPane is a subclass of JEditorPane that "
889
+// + "uses a StyledEditorKit and StyledDocument, and provides "
890
+// + "cover methods for interacting with those objects."
891
+// };
892
+//
893
+// String[] initStyles =
894
+// {
895
+// "regular", "italic", "bold", "small", "large",
896
+// "regular", "button", "regular", "icon",
897
+// "regular"
898
+// };
899
+//
900
+// JTextPane textPane = new JTextPane();
901
+// textPane.setEditable(true);
902
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
903
+// addStylesToDocument(doc);
904
+//
905
+// try
906
+// {
907
+// for (int j = 0; j < 2; j++)
908
+// {
909
+// for (int i = 0; i < initString.length; i++)
910
+// {
911
+// doc.insertString(doc.getLength(), initString[i],
912
+// doc.getStyle(initStyles[i]));
913
+// }
914
+// }
915
+// } catch (BadLocationException ble)
916
+// {
917
+// System.err.println("Couldn't insert initial text into text pane.");
918
+// }
919
+
920
+ return new JTextPane(); // textPane;
645921 }
646922
647923 protected void addStylesToDocument(StyledDocument doc)
....@@ -694,7 +970,7 @@
694970 protected static ImageIcon createImageIcon(String path,
695971 String description)
696972 {
697
- java.net.URL imgURL = GrafreeD.class.getResource(path);
973
+ java.net.URL imgURL = Grafreed.class.getResource(path);
698974 if (imgURL != null)
699975 {
700976 return new ImageIcon(imgURL, description);
....@@ -726,6 +1002,7 @@
7261002 // NumberSlider vDivsField;
7271003 // JCheckBox endcaps;
7281004 JCheckBox liveCB;
1005
+ JCheckBox selectableCB;
7291006 JCheckBox hideCB;
7301007 JCheckBox link2masterCB;
7311008 JCheckBox markCB;
....@@ -733,7 +1010,12 @@
7331010 JCheckBox speedupCB;
7341011 JCheckBox rewindCB;
7351012 JCheckBox flipVCB;
1013
+
1014
+ cCheckBox toggleTextureCB;
1015
+ cCheckBox toggleSwitchCB;
1016
+
7361017 JComboBox texresMenu;
1018
+
7371019 JButton resetButton;
7381020 JButton stepButton;
7391021 JButton stepAllButton;
....@@ -741,115 +1023,87 @@
7411023 JButton slowerButton;
7421024 JButton fasterButton;
7431025 JButton remarkButton;
1026
+
1027
+ cGridBag editPanel;
1028
+ cGridBag editCommandsPanel;
1029
+
1030
+ cGridBag namePanel;
1031
+ cGridBag setupPanel;
1032
+ cGridBag setupPanel2;
1033
+ cGridBag objectCommandsPanel;
1034
+ cGridBag pushPanel;
1035
+ cGridBag fillPanel;
7441036
745
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1037
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7461038 {
7471039 JCheckBox cb;
7481040
749
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
750
- oe.aConstraints.gridwidth = 1; // 3;
751
-// oe.aConstraints.weightx = 1;
752
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
753
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1041
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7541042 cb.addItemListener(this);
755
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
756
- oe.aConstraints.gridwidth = 1;
757
- oe.aConstraints.gridx += 1;
7581043
7591044 return cb;
7601045 }
7611046
762
- cButton AddButton(ObjEditor oe, String label)
1047
+ cButton AddButton(cGridBag panel, String label)
7631048 {
7641049 cButton cb;
7651050
766
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
767
- oe.aConstraints.gridwidth = 1;
768
-// oe.aConstraints.weightx = 1;
769
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
770
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1051
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7711052 cb.addActionListener(this);
772
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
773
- oe.aConstraints.gridwidth = 1;
774
- oe.aConstraints.gridx += 1;
7751053
7761054 return cb;
7771055 }
7781056
779
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1057
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
7801058 {
7811059 JComboBox combo;
7821060
783
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
784
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
785
- oe.aConstraints.gridx += 1;
1061
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7861062 combo.addActionListener(this);
7871063
7881064 return combo;
7891065 }
7901066
791
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
1067
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
7921068 {
793
- NumberSlider combo;
1069
+ cGridBag control = new cGridBag();
1070
+
1071
+ cNumberSlider combo;
7941072
7951073 JLabel jlabel = new JLabel(label);
796
-
797
- aConstraints.fill = GridBagConstraints.VERTICAL;
7981074 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
799
- aConstraints.gridwidth = 2;
800
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
801
- aConstraints.gridx += 1;
802
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
803
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
804
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
805
- aConstraints.gridx += 1;
806
- aConstraints.gridwidth = 1;
807
-
1075
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1076
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8081077 combo.setFloat(current);
809
-
810
- combo.label = jlabel;
811
-
812
- combo.addChangeListener(this);
813
-
814
- return combo;
1078
+
1079
+ panel.add(control);
1080
+
1081
+ return control;
8151082 }
8161083
817
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
1084
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8181085 {
819
- NumberSlider combo;
1086
+ cGridBag control = new cGridBag();
1087
+
1088
+ cNumberSlider combo;
8201089
8211090 JLabel jlabel = new JLabel(label);
822
-
823
- aConstraints.fill = GridBagConstraints.VERTICAL;
8241091 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
825
- aConstraints.gridwidth = 2;
826
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827
- aConstraints.gridx += 1;
828
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
829
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
830
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
831
- aConstraints.gridx += 1;
832
- aConstraints.gridwidth = 1;
833
-
1092
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1093
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8341094 combo.setInteger(current);
8351095
836
- combo.label = jlabel;
837
-
838
- combo.addChangeListener(this);
839
-
840
- return combo;
1096
+ panel.add(control);
1097
+
1098
+ return control;
8411099 }
8421100
843
- JTextArea AddText(JPanel ctrlPanel, String name)
1101
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8441102 {
8451103 JTextArea text;
8461104
847
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
848
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
849
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1105
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8501106 text.addCaretListener(this);
851
- aConstraints.gridx += 1;
852
- aConstraints.gridwidth = 1;
8531107
8541108 return text;
8551109 }
....@@ -879,9 +1133,16 @@
8791133 objEditor.ctrlPanel.remove(j);
8801134 }
8811135
1136
+ void Remove(cNumberSlider j)
1137
+ {
1138
+ j.removeChangeListener(this);
1139
+ //objEditor.ctrlPanel.remove(j.label);
1140
+ objEditor.ctrlPanel.remove(j);
1141
+ }
1142
+
8821143 /*
8831144 */
884
- void Return() // ObjEditor oe)
1145
+ void Return0() // ObjEditor oe)
8851146 {
8861147 aConstraints.gridy += 1;
8871148 aConstraints.gridx = 0;
....@@ -936,35 +1197,81 @@
9361197
9371198 void SetupUI2(ObjEditor oe)
9381199 {
939
-// oe.aConstraints.weightx = 0;
940
-// oe.aConstraints.weighty = 0;
941
-// oe.aConstraints.gridx = 0;
942
-// oe.aConstraints.gridy = 0;
943
- SetupName(oe);
1200
+ //SetupName(oe);
9441201
945
- if (!GroupEditor.allparams)
1202
+ namePanel = new cGridBag();
1203
+
1204
+ nameField = AddText(namePanel, copy.GetName());
1205
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
1206
+ oe.ctrlPanel.add(namePanel);
1207
+
1208
+ oe.ctrlPanel.Return();
1209
+
1210
+ if (!allparams)
9461211 return;
9471212
948
- liveCB = AddCheckBox(oe, "Live", copy.live);
949
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
950
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1213
+ setupPanel = new cGridBag().setVertical(false);
1214
+
1215
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1216
+ liveCB.setToolTipText("Animate object");
1217
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1218
+ selectableCB.setToolTipText("Make object selectable");
9511219 // Return();
952
- markCB = AddCheckBox(oe, "Mark", copy.marked);
953
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
954
- randomCB = AddCheckBox(oe, "Rand", copy.random);
955
- Return();
956
- resetButton = AddButton(oe, "Reset");
957
- stepButton = AddButton(oe, "Step");
1220
+
1221
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1222
+ hideCB.setToolTipText("Hide object");
1223
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1224
+ markCB.setToolTipText("As animation target transform");
1225
+
1226
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
1227
+
1228
+ setupPanel2 = new cGridBag().setVertical(false);
1229
+
1230
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1231
+ rewindCB.setToolTipText("Rewind animation");
1232
+
1233
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1234
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1235
+
1236
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1237
+ link2masterCB.setToolTipText("Attach to support");
1238
+
1239
+ if (Globals.ADVANCED)
1240
+ {
1241
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1242
+ speedupCB.setToolTipText("Option motion capture");
1243
+ }
1244
+
1245
+ oe.ctrlPanel.add(setupPanel);
1246
+ oe.ctrlPanel.Return();
1247
+ oe.ctrlPanel.add(setupPanel2);
1248
+ oe.ctrlPanel.Return();
1249
+
1250
+ objectCommandsPanel = new cGridBag().setVertical(false);
1251
+
1252
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1253
+ resetButton.setToolTipText("Jump to frame zero");
1254
+ stepButton = AddButton(objectCommandsPanel, "Step");
1255
+ stepButton.setToolTipText("Step one frame");
9581256 // resetAllButton = AddButton(oe, "Reset All");
9591257 // stepAllButton = AddButton(oe, "Step All");
960
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9611258 // Return();
962
- slowerButton = AddButton(oe, "Slow");
963
- fasterButton = AddButton(oe, "Fast");
964
- remarkButton = AddButton(oe, "Rem");
1259
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1260
+ slowerButton.setToolTipText("Decrease animation speed");
1261
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1262
+ fasterButton.setToolTipText("Increase animation speed");
1263
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1264
+ remarkButton.setToolTipText("Set the current transform as the target");
9651265
966
- Return();
1266
+ oe.ctrlPanel.add(objectCommandsPanel);
1267
+ oe.ctrlPanel.Return();
9671268
1269
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1270
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1271
+ //Return();
1272
+
1273
+ oe.ctrlPanel.Return();
1274
+
9681275 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9691276 // ObjEditor.aConstraints.gridx += 1;
9701277
....@@ -1058,7 +1365,7 @@
10581365 oe.aConstraints.gridwidth = 1;
10591366 /**/
10601367 nameField = AddText(oe.ctrlPanel, copy.GetName());
1061
- Return();
1368
+ oe.ctrlPanel.Return();
10621369
10631370 //ctrlPanel.add(textureButton = new Button("Texture..."));
10641371 //textureButton.setEnabled(false);
....@@ -1160,11 +1467,25 @@
11601467 //JPanel worldPanel =
11611468 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11621469 //worldPanel.setName("World");
1163
- centralPanel = new JPanel(new BorderLayout());
1164
- timelinePanel = new JPanel(new BorderLayout());
1165
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1470
+ centralPanel = new cGridBag();
1471
+ centralPanel.preferredWidth = 20;
1472
+
1473
+ if (Globals.ADVANCED)
1474
+ {
1475
+ timelinePanel = new JPanel(new BorderLayout());
1476
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11661477
1478
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1479
+ cameraPanel.setContinuousLayout(true);
1480
+ cameraPanel.setOneTouchExpandable(true);
1481
+// cameraPanel.setDividerLocation(0.9);
1482
+// cameraPanel.setDividerSize(9);
1483
+ cameraPanel.setResizeWeight(1.0);
1484
+
1485
+ }
1486
+
11671487 centralPanel.add(cameraView);
1488
+ centralPanel.setFocusable(true);
11681489 //frame.setJMenuBar(timelineMenubar);
11691490 //centralPanel.add(timelinePanel);
11701491
....@@ -1183,12 +1504,14 @@
11831504 //frontView.object = copy;
11841505 //sideView.object = copy;
11851506
1186
- XYZPanel = new JPanel();
1187
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1507
+ XYZPanel = new cGridBag().setVertical(true);
1508
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11881509
1189
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1190
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1191
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1510
+ XYZPanel.preferredWidth = 5;
1511
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1512
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1513
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1514
+ //XYZPanel.setName("XYZ");
11921515
11931516 /*
11941517 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1226,11 +1549,29 @@
12261549 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12271550 //tmp.setName("Edit");
12281551 objectPanel.add(materialPanel);
1229
- JPanel north = new JPanel(new BorderLayout());
1230
- north.setName("Edit");
1231
- north.add(ctrlPanel, BorderLayout.NORTH);
1232
- objectPanel.add(north);
1233
- objectPanel.add(infoPanel);
1552
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1553
+ objectPanel.setToolTipTextAt(0, "Material panel");
1554
+
1555
+// JPanel north = new JPanel(new BorderLayout());
1556
+// north.setName("Edit");
1557
+// north.add(ctrlPanel, BorderLayout.NORTH);
1558
+// objectPanel.add(north);
1559
+ objectPanel.add(editPanel);
1560
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1561
+ objectPanel.setToolTipTextAt(1, "Edit panel");
1562
+
1563
+ //if (Globals.ADVANCED)
1564
+ objectPanel.add(infoPanel);
1565
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1566
+ objectPanel.setToolTipTextAt(2, "Info panel");
1567
+
1568
+ objectPanel.add(XYZPanel);
1569
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1570
+ objectPanel.setToolTipTextAt(3, "XYZ/RGB panel");
1571
+
1572
+ objectPanel.add(toolboxPanel);
1573
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
1574
+ objectPanel.setToolTipTextAt(4, "Objects/backgrounds panel");
12341575
12351576 /*
12361577 aConstraints.gridx = 0;
....@@ -1239,7 +1580,7 @@
12391580 aConstraints.gridy += 1;
12401581 aConstraints.gridwidth = 1;
12411582 mainPanel.add(objectPanel, aConstraints);
1242
- */
1583
+ */
12431584
12441585 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12451586 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1250,16 +1591,23 @@
12501591 scrollpane.setWheelScrollingEnabled(true);
12511592 scrollpane.addMouseWheelListener(this); // Default not fast enough
12521593
1253
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1254
- scenePanel.add(scrollpane);
1594
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1595
+ scenePanel.preferredWidth = 5;
1596
+
1597
+ JTabbedPane tabbedPane = new JTabbedPane();
1598
+ tabbedPane.add(scrollpane);
12551599
1256
- scenePanel.add(FSPane = new cFileSystemPane(this));
1257
-
1258
- optionsPanel = new JPanel(new GridBagLayout());
1600
+ optionsPanel = new cGridBag().setVertical(false);
12591601
12601602 optionsPanel.setName("Options");
1261
- scenePanel.add(optionsPanel);
1603
+
1604
+ AddOptions(optionsPanel); //, aConstraints);
1605
+
1606
+ tabbedPane.add(optionsPanel);
1607
+
1608
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12621609
1610
+ scenePanel.add(tabbedPane);
12631611
12641612 /*
12651613 cTree jTree = new cTree(null);
....@@ -1293,6 +1641,7 @@
12931641 //bigPanel.setSize(new Dimension(10,10));
12941642 //bigPanel.add(ctrlPanel);
12951643 //bigPanel.add(gridPanel);
1644
+ /**
12961645 bigThree = new JPanel();
12971646 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12981647 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1316,7 +1665,13 @@
13161665 // aConstraints.gridheight = 3;
13171666 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13181667 bigThree.add(XYZPanel, aWindowConstraints);
1668
+ /**/
13191669
1670
+ bigThree = new cGridBag();
1671
+ bigThree.addComponent(scenePanel);
1672
+ bigThree.addComponent(centralPanel);
1673
+ //bigThree.addComponent(XYZPanel);
1674
+
13201675 // // SIDE EFFECT!!!
13211676 // aConstraints.gridx = 0;
13221677 // aConstraints.gridy = 0;
....@@ -1324,9 +1679,9 @@
13241679 // aConstraints.gridheight = 1;
13251680
13261681 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1327
- framePanel.setContinuousLayout(true);
1328
- framePanel.setOneTouchExpandable(true);
1329
- framePanel.setDividerLocation(0.8);
1682
+ framePanel.setContinuousLayout(false);
1683
+ framePanel.setOneTouchExpandable(false);
1684
+ //.setDividerLocation(0.8);
13301685 //framePanel.setDividerSize(15);
13311686 //framePanel.setResizeWeight(0.15);
13321687 framePanel.setName("Frame");
....@@ -1337,20 +1692,25 @@
13371692 //worldPane.add(bigPanel);
13381693 //worldPane.add(worldPanel);
13391694 /**/
1340
- frame.getContentPane().add(/*"Center",*/framePanel);
1695
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1696
+ frame.add(/*"Center",*/framePanel);
13411697 //frame.getContentPane().add(/*"Center",*/ worldPane);
13421698
13431699 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13441700
1345
- frame.setSize(1024, 768);
1346
- frame.show();
1347
-
1701
+ frame.setSize(1280, 860);
1702
+
1703
+ cameraView.requestFocusInWindow();
1704
+
13481705 gridPanel.setDividerLocation(1.0);
1706
+
1707
+ frame.validate();
1708
+
1709
+ frame.setVisible(true);
13491710
13501711 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13511712 frame.addWindowListener(new WindowAdapter()
13521713 {
1353
-
13541714 public void windowClosing(WindowEvent e)
13551715 {
13561716 Close();
....@@ -1358,6 +1718,10 @@
13581718 });
13591719 }
13601720
1721
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1722
+ {
1723
+ }
1724
+
13611725 JTree GetTree()
13621726 {
13631727 return objEditor.jTree;
....@@ -1369,260 +1733,182 @@
13691733 ctrlPanel.removeAll();
13701734 }
13711735
1372
- void SetupMaterial(JPanel ctrlPanel)
1736
+ void SetupMaterial(cGridBag panel)
13731737 {
1374
- aConstraints.weighty = 0;
1375
- //aConstraints.weightx = 1;
1376
- /*
1738
+ /*
13771739 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13781740 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1379
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1380
- aConstraints.gridx += 1;
13811741 */
13821742
1383
- aConstraints.gridwidth = 1;
1384
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- aConstraints.gridwidth = 1;
1743
+ cGridBag editBar = new cGridBag().setVertical(false);
1744
+
1745
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1746
+ createMaterialButton.setToolTipText("Create material");
13881747
13891748 /*
13901749 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1391
- aConstraints.gridx += 1;
1392
- aConstraints.weighty = 0;
1393
- aConstraints.gridwidth = 1;
13941750 */
13951751
1396
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1397
- aConstraints.gridx += 1;
1752
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1753
+ clearMaterialButton.setToolTipText("Clear material");
1754
+
1755
+ if (Globals.ADVANCED)
1756
+ {
1757
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1758
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1759
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1760
+ }
13981761
1399
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1400
-
1401
- aConstraints.gridx += 1;
1402
-
1403
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1404
-
1405
- aConstraints.gridx += 1;
1406
-
1407
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1408
-
1409
- aConstraints.gridx = 0;
1410
- aConstraints.gridy += 1;
1411
- aConstraints.weighty = 0;
1412
- aConstraints.gridwidth = 1;
1762
+ editBar.preferredHeight = 15;
1763
+
1764
+ panel.add(editBar);
1765
+
14131766 /**/
14141767 //aConstraints.weighty = 0;
14151768 ////aConstraints.weightx = 1;
14161769 //aConstraints.weighty = 1;
14171770 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14181771 //aConstraints.gridx += 1;
1419
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1420
- aConstraints.weighty = 0;
1421
- aConstraints.gridx = 0;
1422
- aConstraints.gridy += 1;
1423
- aConstraints.gridwidth = 1;
1772
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14241773
1425
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1426
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1427
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1428
- aConstraints.gridx += 1;
1429
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1430
- //aConstraints.weightx = 0;
1431
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1432
- aConstraints.gridx = 0;
1433
- aConstraints.gridy += 1;
1434
- aConstraints.gridwidth = 1;
1774
+ cGridBag colorSection = new cGridBag().setVertical(true);
14351775
1436
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1437
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1438
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1439
- aConstraints.gridx += 1;
1440
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1441
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1442
- aConstraints.gridx = 0;
1443
- aConstraints.gridy += 1;
1444
- aConstraints.gridwidth = 1;
1776
+ cGridBag huepanel = new cGridBag();
1777
+ cGridBag huelabel = new cGridBag();
1778
+ huelabel.add(GetLabel("icons/hue.png", false));
1779
+ huelabel.preferredWidth = 20;
1780
+ huepanel.add(new cGridBag()); // Label
1781
+ huepanel.add(huelabel); // Field/slider
1782
+
1783
+ huepanel.preferredHeight = 7;
14451784
1446
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1447
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1448
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1449
- aConstraints.gridx += 1;
1450
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1451
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1452
- aConstraints.gridx = 0;
1453
- aConstraints.gridy += 1;
1454
- aConstraints.gridwidth = 1;
1785
+ colorSection.add(huepanel);
1786
+
1787
+ cGridBag color = new cGridBag();
1788
+
1789
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1790
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1791
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
14551792
1456
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1457
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1458
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1459
- aConstraints.gridx += 1;
1460
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1461
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1462
- aConstraints.gridx = 0;
1463
- aConstraints.gridy += 1;
1464
- aConstraints.gridwidth = 1;
1793
+ //colorField.preferredWidth = 200;
1794
+ colorSection.add(color);
14651795
1466
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1467
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1468
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1469
- aConstraints.gridx += 1;
1470
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1471
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1472
- aConstraints.gridx = 0;
1473
- aConstraints.gridy += 1;
1474
- aConstraints.gridwidth = 1;
1796
+ cGridBag modulation = new cGridBag();
1797
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1798
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1799
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
1800
+ colorSection.add(modulation);
14751801
1476
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1477
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1478
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1479
- aConstraints.gridx += 1;
1480
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1481
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1482
- aConstraints.gridx = 0;
1483
- aConstraints.gridy += 1;
1484
- aConstraints.gridwidth = 1;
1802
+ cGridBag opacity = new cGridBag();
1803
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1804
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1805
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
1806
+ colorSection.add(opacity);
14851807
1486
- //aConstraints.weighty = 1;
1487
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1488
- //aConstraints.gridx += 1;
1489
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1490
- aConstraints.weighty = 0;
1491
- aConstraints.gridx = 0;
1492
- aConstraints.gridy += 1;
1493
- aConstraints.gridwidth = 1;
1808
+ colorSection.add(GetSeparator());
1809
+
1810
+ cGridBag texture = new cGridBag();
1811
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1812
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1813
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1814
+ colorSection.add(texture);
14941815
1495
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1496
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1497
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1498
- aConstraints.gridx += 1;
1499
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1500
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1501
- aConstraints.gridx = 0;
1502
- aConstraints.gridy += 1;
1503
- aConstraints.gridwidth = 1;
1816
+ panel.add(GetSeparator());
1817
+
1818
+ panel.add(colorSection);
1819
+
1820
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1821
+
1822
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1823
+
1824
+ cGridBag diffuse = new cGridBag();
1825
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1826
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1827
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1828
+ diffuseSection.add(diffuse);
15041829
1505
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1506
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1507
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1508
- aConstraints.gridx += 1;
1509
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1510
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1511
- aConstraints.gridx = 0;
1512
- aConstraints.gridy += 1;
1513
- aConstraints.gridwidth = 1;
1830
+ cGridBag diffuseness = new cGridBag();
1831
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1832
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1833
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1834
+ diffuseSection.add(diffuseness);
15141835
1515
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1516
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1517
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1518
- aConstraints.gridx += 1;
1519
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1520
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1521
- aConstraints.gridx = 0;
1522
- aConstraints.gridy += 1;
1523
- aConstraints.gridwidth = 1;
1836
+ cGridBag selfshadow = new cGridBag();
1837
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1838
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1839
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1840
+ diffuseSection.add(selfshadow);
15241841
1525
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1526
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1527
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1528
- aConstraints.gridx += 1;
1529
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1530
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1531
- aConstraints.gridx = 0;
1532
- aConstraints.gridy += 1;
1533
- aConstraints.gridwidth = 1;
1842
+ cGridBag sheen = new cGridBag();
1843
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1844
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1845
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1846
+ diffuseSection.add(sheen);
15341847
1535
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1536
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1537
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1538
- aConstraints.gridx += 1;
1539
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1540
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1541
- aConstraints.gridx = 0;
1542
- aConstraints.gridy += 1;
1543
- aConstraints.gridwidth = 1;
1848
+ cGridBag subsurface = new cGridBag();
1849
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1850
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1851
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1852
+ diffuseSection.add(subsurface);
15441853
1545
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1546
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1547
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1548
- aConstraints.gridx += 1;
1549
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1550
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1551
- aConstraints.gridx = 0;
1552
- aConstraints.gridy += 1;
1553
- aConstraints.gridwidth = 1;
1854
+ cGridBag shadow = new cGridBag();
1855
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1856
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1857
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1858
+ diffuseSection.add(shadow);
15541859
1555
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1556
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1557
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1558
- aConstraints.gridx += 1;
1559
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1560
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1561
- aConstraints.gridx = 0;
1562
- aConstraints.gridy += 1;
1563
- aConstraints.gridwidth = 1;
1860
+ cGridBag fakedepth = new cGridBag();
1861
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1862
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1863
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1864
+ diffuseSection.add(fakedepth);
15641865
1565
- //aConstraints.weighty = 1;
1566
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1567
- //aConstraints.gridx += 1;
1568
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1569
- aConstraints.weighty = 0;
1570
- aConstraints.gridx = 0;
1571
- aConstraints.gridy += 1;
1572
- aConstraints.gridwidth = 1;
1866
+ cGridBag shadowbias = new cGridBag();
1867
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1868
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1869
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1870
+ diffuseSection.add(shadowbias);
15731871
1574
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1575
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1576
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1577
- aConstraints.gridx += 1;
1578
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1579
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1580
- aConstraints.gridx = 0;
1581
- aConstraints.gridy += 1;
1582
- aConstraints.gridwidth = 1;
1872
+ panel.add(GetSeparator());
1873
+
1874
+ panel.add(diffuseSection);
1875
+
1876
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1877
+
1878
+ cGridBag specularSection = new cGridBag().setVertical(true);
15831879
1584
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1585
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1586
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1587
- aConstraints.gridx += 1;
1588
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1589
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1590
- aConstraints.gridx = 0;
1591
- aConstraints.gridy += 1;
1592
- aConstraints.gridwidth = 1;
1880
+ cGridBag specular = new cGridBag();
1881
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1882
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1883
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1884
+ specularSection.add(specular);
15931885
1594
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1595
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1596
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1597
- aConstraints.gridx += 1;
1598
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1599
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1600
- aConstraints.gridx = 0;
1601
- aConstraints.gridy += 1;
1602
- aConstraints.gridwidth = 1;
1886
+ cGridBag lightarea = new cGridBag();
1887
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1888
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1889
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1890
+ specularSection.add(lightarea);
16031891
1604
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1605
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1606
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1607
- aConstraints.gridx += 1;
1608
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1609
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1610
- aConstraints.gridx = 0;
1611
- aConstraints.gridy += 1;
1612
- aConstraints.gridwidth = 1;
1892
+ cGridBag shininess = new cGridBag();
1893
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1894
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1895
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1896
+ specularSection.add(shininess);
16131897
1614
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1615
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1616
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1617
- aConstraints.gridx += 1;
1618
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1619
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1620
- aConstraints.gridx = 0;
1621
- aConstraints.gridy += 1;
1622
- aConstraints.gridwidth = 1;
1898
+ cGridBag metalness = new cGridBag();
1899
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1900
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1901
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1902
+ specularSection.add(metalness);
16231903
1624
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1625
- Return();
1904
+ cGridBag velvet = new cGridBag();
1905
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1906
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1907
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1908
+ specularSection.add(velvet);
1909
+
1910
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1911
+ //Return();
16261912 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16271913 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16281914 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1633,130 +1919,99 @@
16331919 // aConstraints.gridy += 1;
16341920 // aConstraints.gridwidth = 1;
16351921
1636
- //aConstraints.weighty = 1;
1637
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1638
- //aConstraints.gridx += 1;
1639
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1640
- aConstraints.weighty = 0;
1641
- aConstraints.gridx = 0;
1642
- aConstraints.gridy += 1;
1643
- aConstraints.gridwidth = 1;
1922
+ cGridBag anisoU = new cGridBag();
1923
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1924
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1925
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1926
+ specularSection.add(anisoU);
16441927
1645
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1646
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1647
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1648
- aConstraints.gridx += 1;
1649
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1650
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1651
- aConstraints.gridx = 0;
1652
- aConstraints.gridy += 1;
1653
- aConstraints.gridwidth = 1;
1928
+ cGridBag anisoV = new cGridBag();
1929
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1930
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1931
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1932
+ specularSection.add(anisoV);
16541933
1655
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1656
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1657
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1658
- aConstraints.gridx += 1;
1659
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1660
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1661
- aConstraints.gridx = 0;
1662
- aConstraints.gridy += 1;
1663
- aConstraints.gridwidth = 1;
16641934
1665
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1666
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1667
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1668
- aConstraints.gridx += 1;
1669
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1670
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1671
- aConstraints.gridx = 0;
1672
- aConstraints.gridy += 1;
1673
- aConstraints.gridwidth = 1;
1935
+ panel.add(GetSeparator());
1936
+
1937
+ panel.add(specularSection);
1938
+
1939
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1940
+
1941
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16741942
1675
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1676
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1677
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1678
- aConstraints.gridx += 1;
1679
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1680
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1681
- aConstraints.gridx = 0;
1682
- aConstraints.gridy += 1;
1683
- aConstraints.gridwidth = 1;
1684
- aConstraints.weighty = 0;
1943
+ cGridBag camera = new cGridBag();
1944
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1945
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1946
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1947
+ colorSection.add(camera);
16851948
1686
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1687
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1688
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1689
- aConstraints.gridx += 1;
1690
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1691
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1692
- aConstraints.gridx = 0;
1693
- aConstraints.gridy += 1;
1694
- aConstraints.gridwidth = 1;
1949
+ cGridBag ambient = new cGridBag();
1950
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1951
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1952
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1953
+ colorSection.add(ambient);
16951954
1696
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1697
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1698
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1699
- aConstraints.gridx += 1;
1700
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1701
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1702
- aConstraints.gridx = 0;
1703
- aConstraints.gridy += 1;
1704
- aConstraints.gridwidth = 1;
1955
+ cGridBag backlit = new cGridBag();
1956
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1957
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1958
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1959
+ colorSection.add(backlit);
17051960
1706
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1707
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1708
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1709
- aConstraints.gridx += 1;
1710
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1711
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1712
- aConstraints.gridx = 0;
1713
- aConstraints.gridy += 1;
1714
- aConstraints.gridwidth = 1;
1961
+ //panel.add(new JSeparator());
1962
+
1963
+ //panel.add(globalSection);
1964
+
1965
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1966
+
1967
+ cGridBag textureSection = new cGridBag().setVertical(true);
17151968
1716
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1717
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1718
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1719
- aConstraints.gridx += 1;
1720
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1721
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1722
- aConstraints.gridx = 0;
1723
- aConstraints.gridy += 1;
1724
- aConstraints.gridwidth = 1;
1969
+ cGridBag bump = new cGridBag();
1970
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1971
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1972
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1973
+ textureSection.add(bump);
17251974
1726
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1727
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1728
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1729
- aConstraints.gridx += 1;
1730
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1731
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1732
- aConstraints.gridx = 0;
1733
- aConstraints.gridy += 1;
1734
- aConstraints.gridwidth = 1;
1975
+ cGridBag noise = new cGridBag();
1976
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1977
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1978
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1979
+ textureSection.add(noise);
17351980
1736
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1737
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1738
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1739
- aConstraints.gridx += 1;
1740
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1741
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1742
- aConstraints.gridx = 0;
1743
- aConstraints.gridy += 1;
1744
- aConstraints.gridwidth = 1;
1981
+ cGridBag power = new cGridBag();
1982
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1983
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1984
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1985
+ textureSection.add(power);
17451986
1746
- //aConstraints.weighty = 1;
1747
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1748
- //aConstraints.gridx += 1;
1749
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1750
- aConstraints.weighty = 0;
1987
+ cGridBag borderfade = new cGridBag();
1988
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1989
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1990
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1991
+ textureSection.add(borderfade);
17511992
1752
- aConstraints.gridx = 0;
1753
- aConstraints.gridy = 0;
1754
- aConstraints.gridwidth = 1;
1993
+ cGridBag fog = new cGridBag();
1994
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1995
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1996
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1997
+ textureSection.add(fog);
1998
+
1999
+ cGridBag opacityPower = new cGridBag();
2000
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
2001
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2002
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
2003
+ textureSection.add(opacityPower);
2004
+
2005
+ panel.add(GetSeparator());
2006
+
2007
+ panel.add(textureSection);
2008
+
2009
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17552010
17562011 SetMaterial(copy); // .GetMaterial());
17572012
1758
- colorField.addChangeListener(this);
1759
- modulationField.addChangeListener(this);
2013
+ //colorField.addChangeListener(this);
2014
+// modulationField.addChangeListener(this);
17602015 metalnessField.addChangeListener(this);
17612016 diffuseField.addChangeListener(this);
17622017 specularField.addChangeListener(this);
....@@ -1786,12 +2041,15 @@
17862041 opacityPowerField.addChangeListener(this);
17872042 /**/
17882043
1789
- resetSlidersButton.addActionListener(this);
17902044 clearMaterialButton.addActionListener(this);
17912045 createMaterialButton.addActionListener(this);
1792
-
1793
- propagateToggle.addItemListener(this);
1794
- multiplyToggle.addItemListener(this);
2046
+
2047
+ if (Globals.ADVANCED)
2048
+ {
2049
+ resetSlidersButton.addActionListener(this);
2050
+ propagateToggle.addItemListener(this);
2051
+ multiplyToggle.addItemListener(this);
2052
+ }
17952053 }
17962054
17972055 void DropFile(java.io.File[] files, boolean textures)
....@@ -1809,8 +2067,9 @@
18092067 // 3D models
18102068 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18112069 {
1812
- lastConverter = new com.jmex.model.converters.MaxToJme();
1813
- LoadFile(filename, lastConverter);
2070
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2071
+ //LoadFile(filename, lastConverter);
2072
+ LoadObjFile(filename); // New 3ds loader
18142073 continue;
18152074 }
18162075 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1962,7 +2221,7 @@
19622221
19632222 //? flashIt = false;
19642223 CameraPane pane = (CameraPane) cameraView;
1965
- pane.clickStart(location.x, location.y, 0);
2224
+ pane.clickStart(location.x, location.y, 0, 0);
19662225 pane.clickEnd(location.x, location.y, 0, true);
19672226
19682227 if (group.selection.size() == 1)
....@@ -2011,6 +2270,7 @@
20112270 e2.printStackTrace();
20122271 }
20132272 }
2273
+
20142274 LoadJMEThread loadThread;
20152275
20162276 class LoadJMEThread extends Thread
....@@ -2068,6 +2328,7 @@
20682328 //LoadFile0(filename, converter);
20692329 }
20702330 }
2331
+
20712332 LoadOBJThread loadObjThread;
20722333
20732334 class LoadOBJThread extends Thread
....@@ -2146,19 +2407,19 @@
21462407
21472408 void LoadObjFile(String fullname)
21482409 {
2149
- /*
2410
+ System.out.println("Loading " + fullname);
2411
+ /**/
21502412 //lastFilename = fullname;
21512413 if(loadObjThread == null)
21522414 {
2153
- loadObjThread = new LoadOBJThread();
2154
- loadObjThread.start();
2415
+ loadObjThread = new LoadOBJThread();
2416
+ loadObjThread.start();
21552417 }
21562418
21572419 loadObjThread.add(fullname);
2158
- */
2420
+ /**/
21592421
2160
- System.out.println("Loading " + fullname);
2161
- makeSomething(new FileObject(fullname, true), true);
2422
+ //makeSomething(new FileObject(fullname, true), true);
21622423 }
21632424
21642425 void LoadGFDFile(String fullname)
....@@ -2419,11 +2680,11 @@
24192680
24202681 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24212682 {
2422
- if (GrafreeD.standAlone)
2683
+ if (Grafreed.standAlone)
24232684 {
24242685 /**/
24252686 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2426
- browser.show();
2687
+ browser.setVisible(true);
24272688 String filename = browser.getFile();
24282689 if (filename != null && filename.length() > 0)
24292690 {
....@@ -2534,6 +2795,7 @@
25342795 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25352796 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25362797 }
2798
+
25372799 //cJME.count++;
25382800 //cJME.count %= 12;
25392801 if (gc)
....@@ -2568,6 +2830,7 @@
25682830 }
25692831 if (input == null)
25702832 {
2833
+ new Exception().printStackTrace();
25712834 System.exit(0);
25722835 }
25732836
....@@ -2716,6 +2979,7 @@
27162979 }
27172980 }
27182981 }
2982
+
27192983 cFileSystemPane FSPane;
27202984
27212985 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2769,11 +3033,14 @@
27693033 }
27703034 }
27713035 }
3036
+
27723037 freezematerial = false;
27733038 }
27743039
27753040 void SetMaterial(Object3D object)
27763041 {
3042
+ latestObject = object;
3043
+
27773044 cMaterial mat = object.material;
27783045
27793046 if (mat == null)
....@@ -2782,7 +3049,8 @@
27823049 return;
27833050 }
27843051
2785
- multiplyToggle.setSelected(mat.multiply);
3052
+ if (multiplyToggle != null)
3053
+ multiplyToggle.setSelected(mat.multiply);
27863054
27873055 assert (object.projectedVertices != null);
27883056
....@@ -2884,12 +3152,17 @@
28843152 // }
28853153
28863154 /**/
2887
- if (deselect)
3155
+ if (deselect || child == null)
28883156 {
28893157 //group.deselectAll();
28903158 //freeze = true;
28913159 GetTree().clearSelection();
28923160 //freeze = false;
3161
+
3162
+ if (child == null)
3163
+ {
3164
+ return;
3165
+ }
28933166 }
28943167
28953168 //group.addSelectee(child);
....@@ -2958,7 +3231,7 @@
29583231 cameraView.ToggleDL();
29593232 cameraView.repaint();
29603233 return;
2961
- } else if (event.getSource() == toggleTextureItem)
3234
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29623235 {
29633236 cameraView.ToggleTexture();
29643237 // june 2013 copy.HardTouch();
....@@ -2966,42 +3239,40 @@
29663239 return;
29673240 } else if (event.getSource() == toggleTimelineItem)
29683241 {
2969
- copy.timeline ^= true;
3242
+ timeline ^= true;
29703243
2971
- if (copy.timeline)
3244
+ if (timeline)
29723245 {
29733246 centralPanel.remove(cameraView);
2974
- centralPanel.add(timelinePanel);
3247
+ cameraPanel.add(cameraView);
3248
+ centralPanel.add(cameraPanel);
29753249 frame.setJMenuBar(timelineMenubar);
3250
+ wasFullScreen = CameraPane.FULLSCREEN;
3251
+ if (!CameraPane.FULLSCREEN)
3252
+ ToggleFullScreen();
3253
+ toggleFullScreenItem.setEnabled(false);
29763254 }
29773255 else
29783256 {
2979
- centralPanel.remove(timelinePanel);
3257
+ centralPanel.remove(cameraPanel);
29803258 centralPanel.add(cameraView);
29813259 frame.setJMenuBar(null);
3260
+ if (!wasFullScreen)
3261
+ ToggleFullScreen();
3262
+ toggleFullScreenItem.setEnabled(true);
29823263 }
29833264
29843265 frame.validate();
29853266 return;
29863267 } else if (event.getSource() == toggleFullScreenItem)
29873268 {
2988
- if (CameraPane.FULLSCREEN)
2989
- {
2990
- frame.getContentPane().remove(/*"Center",*/bigThree);
2991
- framePanel.add(bigThree);
2992
- frame.getContentPane().add(/*"Center",*/framePanel);
2993
- } else
2994
- {
2995
- frame.getContentPane().remove(/*"Center",*/framePanel);
2996
- frame.getContentPane().add(/*"Center",*/bigThree);
2997
- }
3269
+ ToggleFullScreen();
29983270 frame.validate();
2999
- cameraView.ToggleFullScreen();
30003271
30013272 return;
3002
- } else if (event.getSource() == toggleRandomItem)
3273
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30033274 {
3004
- cameraView.ToggleRandom();
3275
+ cameraView.ToggleSwitch();
30053276 cameraView.repaint();
30063277 return;
30073278 } else if (event.getSource() == toggleHandleItem)
....@@ -3030,6 +3301,10 @@
30303301 {
30313302 copy.live ^= true;
30323303 return;
3304
+ } else if (event.getSource() == selectableCB)
3305
+ {
3306
+ copy.dontselect ^= true;
3307
+ return;
30333308 } else if (event.getSource() == hideCB)
30343309 {
30353310 copy.hide ^= true;
....@@ -3044,6 +3319,7 @@
30443319 if (event.getSource() == randomCB)
30453320 {
30463321 copy.random ^= true;
3322
+ objEditor.refreshContents();
30473323 return;
30483324 }
30493325 if (event.getSource() == speedupCB)
....@@ -3067,8 +3343,9 @@
30673343
30683344 public void actionPerformed(ActionEvent event)
30693345 {
3346
+ Object source = event.getSource();
30703347 // SCRIPT DIALOG
3071
- if (event.getSource() == okbutton)
3348
+ if (source == okbutton)
30723349 {
30733350 textpanel.setVisible(false);
30743351 textpanel.remove(textarea);
....@@ -3080,7 +3357,7 @@
30803357 textarea = null;
30813358 textpanel = null;
30823359 }
3083
- if (event.getSource() == cancelbutton)
3360
+ if (source == cancelbutton)
30843361 {
30853362 textpanel.setVisible(false);
30863363 textpanel.remove(textarea);
....@@ -3092,49 +3369,50 @@
30923369 //applySelf();
30933370 //client.refreshEditWindow();
30943371 //refreshContents();
3095
- if (event.getSource() == nameField)
3372
+ if (source == nameField)
30963373 {
30973374 //System.out.println("ObjEditor " + event);
30983375 applySelf0(true);
30993376 //parent.applySelf();
31003377 objEditor.refreshContents();
3101
- } else if (event.getSource() == resetButton)
3378
+ } else if (source == resetButton)
31023379 {
31033380 CameraPane.fullreset = true;
31043381 copy.Reset(); // ResetMeshes();
31053382 copy.Touch();
31063383 objEditor.refreshContents();
3107
- } else if (event.getSource() == stepItem)
3384
+ } else if (source == stepItem)
31083385 {
3109
- cameraView.ONESTEP = true;
3386
+ //cameraView.ONESTEP = true;
3387
+ Globals.ONESTEP = true;
31103388 cameraView.repaint();
31113389 return;
3112
- } else if (event.getSource() == stepButton)
3390
+ } else if (source == stepButton)
31133391 {
31143392 copy.Step();
31153393 copy.Touch();
31163394 objEditor.refreshContents();
3117
- } else if (event.getSource() == slowerButton)
3395
+ } else if (source == slowerButton)
31183396 {
31193397 copy.Slower();
31203398 copy.Touch();
31213399 objEditor.refreshContents();
3122
- } else if (event.getSource() == fasterButton)
3400
+ } else if (source == fasterButton)
31233401 {
31243402 copy.Faster();
31253403 copy.Touch();
31263404 objEditor.refreshContents();
3127
- } else if (event.getSource() == remarkButton)
3405
+ } else if (source == remarkButton)
31283406 {
31293407 copy.Remark();
31303408 copy.Touch();
31313409 objEditor.refreshContents();
3132
- } else if (event.getSource() == stepAllButton)
3410
+ } else if (source == stepAllButton)
31333411 {
31343412 copy.StepAll();
31353413 copy.Touch();
31363414 objEditor.refreshContents();
3137
- } else if (event.getSource() == resetAllButton)
3415
+ } else if (source == resetAllButton)
31383416 {
31393417 //CameraPane.fullreset = true;
31403418 copy.ResetAll(); // ResetMeshes();
....@@ -3167,53 +3445,79 @@
31673445 // Close();
31683446 // }
31693447 // else
3170
- if (event.getSource() == resetSlidersButton)
3448
+ if (source == resetSlidersButton)
31713449 {
31723450 ResetSliders();
3173
- } else if (event.getSource() == clearMaterialButton)
3451
+ } else if (source == clearMaterialButton)
31743452 {
31753453 ClearMaterial();
3176
- } else if (event.getSource() == createMaterialButton)
3454
+ } else if (source == createMaterialButton)
31773455 {
31783456 CreateMaterial();
3179
- } else if (event.getSource() == clearPanelButton)
3457
+ } else if (source == clearPanelButton)
31803458 {
31813459 copy.ClearUI();
31823460 refreshContents(true);
3183
- } /*
3184
- }
3185
-
3186
- public boolean action(Event event, Object arg)
3187
- {
3188
- */ else if (event.getSource() == closeItem)
3461
+ } else if (source == importGFDItem)
3462
+ {
3463
+ ImportGFD();
3464
+ } else
3465
+ if (source == importVRMLX3DItem)
3466
+ {
3467
+ ImportVRMLX3D();
3468
+ } else
3469
+ if (source == import3DSItem)
3470
+ {
3471
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3472
+ } else
3473
+ if (source == importOBJItem)
3474
+ {
3475
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3476
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3477
+ browser.setVisible(true);
3478
+ String filename = browser.getFile();
3479
+ if (filename != null && filename.length() > 0)
3480
+ {
3481
+ String fullname = browser.getDirectory() + filename;
3482
+ makeSomething(ReadOBJ(fullname), true);
3483
+ }
3484
+ } else
3485
+ if (source == closeItem)
31893486 {
31903487 Close();
31913488 //return true;
3192
- } else if (event.getSource() == loadItem)
3489
+ } else if (source == openItem)
31933490 {
3194
- load();
3491
+ Open();
31953492 //return true;
3196
- } else if (event.getSource() == saveItem)
3493
+ } else if (source == newItem)
3494
+ {
3495
+ New();
3496
+ } else if (source == saveItem)
31973497 {
31983498 save();
31993499 //return true;
3200
- } else if (event.getSource() == saveAsItem)
3500
+ } else if (source == saveAsItem)
32013501 {
32023502 saveAs();
32033503 //return true;
3204
- } else if (event.getSource() == reexportItem)
3504
+ } else if (source == reexportItem)
32053505 {
32063506 reexport();
32073507 //return true;
3208
- } else if (event.getSource() == exportAsItem)
3508
+ } else if (source == exportAsItem)
32093509 {
32103510 export();
32113511 //return true;
3212
- } else if (event.getSource() == povItem)
3512
+ } else if (source == povItem)
32133513 {
32143514 generatePOV();
32153515 //return true;
3216
- } else if (event.getSource() == zBufferItem)
3516
+ } else if (event.getSource() == archiveItem)
3517
+ {
3518
+ cTools.Archive(frame);
3519
+ return;
3520
+ } else if (source == zBufferItem)
32173521 {
32183522 try
32193523 {
....@@ -3235,21 +3539,8 @@
32353539 cameraView.repaint();
32363540 //return true;
32373541 }
3238
- */ else if (event.getSource() == editCameraItem)
3239
- {
3240
- cameraView.ProtectCamera();
3241
- cameraView.repaint();
3242
- return;
3243
- } else if (event.getSource() == revertCameraItem)
3244
- {
3245
- cameraView.RevertCamera();
3246
- cameraView.repaint();
3247
- return;
3248
-// } else if (event.getSource() == textureButton)
3249
-// {
3250
-// return; // true;
3251
- } else // combos...
3252
- if (event.getSource() == texresMenu)
3542
+ */ else // combos...
3543
+ if (source == texresMenu)
32533544 {
32543545 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32553546 copy.texres = texresMenu.getSelectedIndex();
....@@ -3261,27 +3552,427 @@
32613552 }
32623553 }
32633554
3264
- void ToggleAnimation()
3555
+ void New()
32653556 {
3266
- if (!CameraPane.ANIMATION)
3557
+ while (copy.Size() > 1)
32673558 {
3268
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3559
+ copy.remove(1);
3560
+ }
3561
+
3562
+ ResetModel();
3563
+ objEditor.refreshContents();
3564
+ }
3565
+
3566
+ static public byte[] Compress(Object3D o)
3567
+ {
3568
+ try
3569
+ {
3570
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3571
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3572
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
3573
+
3574
+ Object3D parent = o.parent;
3575
+ o.parent = null;
3576
+
3577
+ out.writeObject(o);
3578
+
3579
+ o.parent = parent;
3580
+
3581
+ out.flush();
3582
+
3583
+ baos //zstream
3584
+ .close();
3585
+ out.close();
3586
+
3587
+ byte[] bytes = baos.toByteArray();
3588
+
3589
+ System.out.println("save #bytes = " + bytes.length);
3590
+ return bytes;
3591
+ } catch (Exception e)
3592
+ {
3593
+ System.err.println(e);
3594
+ return null;
3595
+ }
3596
+ }
3597
+
3598
+ static public Object Uncompress(byte[] bytes)
3599
+ {
3600
+ System.out.println("restore #bytes = " + bytes.length);
3601
+ try
3602
+ {
3603
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3604
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3605
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
3606
+ Object obj = in.readObject();
3607
+
3608
+ bais //istream
3609
+ .close();
3610
+ in.close();
3611
+
3612
+ return obj;
3613
+ } catch (Exception e)
3614
+ {
3615
+ System.err.println(e);
3616
+ return null;
3617
+ }
3618
+ }
3619
+
3620
+ static public Object clone(Object o)
3621
+ {
3622
+ try
3623
+ {
3624
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3625
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3626
+
3627
+ out.writeObject(o);
3628
+
3629
+ out.flush();
3630
+ out.close();
3631
+
3632
+ byte[] bytes = baos.toByteArray();
3633
+
3634
+ System.out.println("clone = " + bytes.length);
3635
+
3636
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3637
+ ObjectInputStream in = new ObjectInputStream(bais);
3638
+ Object obj = in.readObject();
3639
+ in.close();
3640
+
3641
+ return obj;
3642
+ } catch (Exception e)
3643
+ {
3644
+ System.err.println(e);
3645
+ return null;
3646
+ }
3647
+ }
3648
+
3649
+ cRadio GetCurrentTab()
3650
+ {
3651
+ cRadio ab;
3652
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3653
+ {
3654
+ ab = (cRadio)e.nextElement();
3655
+ if(ab.GetObject() == copy)
3656
+ {
3657
+ return ab;
3658
+ }
3659
+ }
3660
+
3661
+ return null;
3662
+ }
3663
+
3664
+
3665
+ public void Save()
3666
+ {
3667
+ //Save(true);
3668
+ Replace();
3669
+ }
3670
+
3671
+ private boolean Equal(byte[] compress, byte[] name)
3672
+ {
3673
+ if (compress.length != name.length)
3674
+ {
3675
+ return false;
3676
+ }
3677
+
3678
+ for (int i=compress.length; --i>=0;)
3679
+ {
3680
+ if (compress[i] != name[i])
3681
+ return false;
3682
+ }
3683
+
3684
+ return true;
3685
+ }
3686
+
3687
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3688
+
3689
+ public boolean Save(boolean user)
3690
+ {
3691
+ System.err.println("Save");
3692
+
3693
+ cRadio tab = GetCurrentTab();
3694
+
3695
+ byte[] compress = CompressCopy(); // Saved version. No need for "Replace".
3696
+
3697
+ boolean thesame = false;
3698
+
3699
+ // Quick heuristic using length. Works only when stream is compressed.
3700
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3701
+ {
3702
+ thesame = true;
3703
+ }
3704
+
3705
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3706
+ if (!thesame)
3707
+ {
3708
+ //tab.user[tab.versionindex] = user;
3709
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3710
+
3711
+ copy.versions[++copy.versionindex] = compress;
3712
+
3713
+ // if (increment)
3714
+ // tab.versionindex++;
3715
+ }
3716
+
3717
+ //copy.RestoreBigData(versiontable);
3718
+
3719
+ //assert(hashtable.isEmpty());
3720
+
3721
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3722
+ {
3723
+ //tab.user[i] = false;
3724
+ copy.versions[i] = null;
3725
+ }
3726
+
3727
+ SetUndoStates();
3728
+
3729
+ // test save
3730
+ if (false)
3731
+ {
3732
+ try
3733
+ {
3734
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
3735
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3736
+
3737
+ p.writeObject(copy);
3738
+
3739
+ p.flush();
3740
+
3741
+ ostream.close();
3742
+ } catch (Exception e)
3743
+ {
3744
+ e.printStackTrace();
3745
+ }
3746
+ }
3747
+
3748
+ return !thesame;
3749
+ }
3750
+
3751
+ void CopyChanged(Object3D obj)
3752
+ {
3753
+ SetUndoStates();
3754
+
3755
+ boolean temp = CameraPane.SWITCH;
3756
+ CameraPane.SWITCH = false;
3757
+
3758
+ copy.ExtractBigData(versiontable);
3759
+
3760
+ copy.clear();
3761
+
3762
+ copy.skyboxname = obj.skyboxname;
3763
+ copy.skyboxext = obj.skyboxext;
3764
+
3765
+ for (int i=0; i<obj.Size(); i++)
3766
+ {
3767
+ copy.add(obj.get(i));
3768
+ }
3769
+
3770
+ copy.RestoreBigData(versiontable);
3771
+
3772
+ CameraPane.SWITCH = temp;
3773
+
3774
+ //assert(hashtable.isEmpty());
3775
+
3776
+ copy.Touch();
3777
+
3778
+ ResetModel();
3779
+ copy.HardTouch(); // recompile?
3780
+
3781
+ cRadio ab;
3782
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3783
+ {
3784
+ ab = (cRadio)e.nextElement();
3785
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3786
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3787
+ if (test != null)
3788
+ {
3789
+ test.editWindow = ab.object.editWindow;
3790
+ ab.object = test;
3791
+ }
3792
+ }
3793
+
3794
+ refreshContents();
3795
+ }
3796
+
3797
+ cButton undoButton;
3798
+ cButton restoreButton;
3799
+ cButton replaceButton;
3800
+ cButton redoButton;
3801
+
3802
+ boolean muteSlider;
3803
+
3804
+ int VersionCount()
3805
+ {
3806
+ int count = 0;
3807
+
3808
+ for (int i = copy.versions.length; --i >= 0;)
3809
+ {
3810
+ if (copy.versions[i] != null)
3811
+ count++;
3812
+ }
3813
+
3814
+ return count;
3815
+ }
3816
+
3817
+ void SetUndoStates()
3818
+ {
3819
+ cRadio tab = GetCurrentTab();
3820
+
3821
+ restoreButton.setEnabled(copy.versionindex != -1);
3822
+ replaceButton.setEnabled(copy.versionindex != -1);
3823
+
3824
+ undoButton.setEnabled(copy.versionindex > 0);
3825
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3826
+
3827
+ muteSlider = true;
3828
+ versionSlider.setMaximum(VersionCount() - 1);
3829
+ versionSlider.setInteger(copy.versionindex);
3830
+ muteSlider = false;
3831
+ }
3832
+
3833
+ public boolean Undo()
3834
+ {
3835
+ // Option?
3836
+ Replace();
3837
+
3838
+ System.err.println("Undo");
3839
+
3840
+ cRadio tab = GetCurrentTab();
3841
+
3842
+ if (copy.versionindex == 0)
3843
+ {
3844
+ java.awt.Toolkit.getDefaultToolkit().beep();
3845
+ return false;
3846
+ }
3847
+
3848
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3849
+// {
3850
+// if (Save(false))
3851
+// tab.versionindex -= 1;
3852
+// else
3853
+// {
3854
+// if (tab.versionindex <= 0)
3855
+// return false;
3856
+// else
3857
+// tab.versionindex -= 1;
3858
+// }
3859
+// }
3860
+
3861
+ copy.versionindex -= 1;
3862
+
3863
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3864
+
3865
+ return true;
3866
+ }
3867
+
3868
+ public boolean Restore()
3869
+ {
3870
+ System.err.println("Restore");
3871
+
3872
+ cRadio tab = GetCurrentTab();
3873
+
3874
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3875
+ {
3876
+ java.awt.Toolkit.getDefaultToolkit().beep();
3877
+ return false;
3878
+ }
3879
+
3880
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3881
+
3882
+ return true;
3883
+ }
3884
+
3885
+ public boolean Replace()
3886
+ {
3887
+ System.err.println("Replace");
3888
+
3889
+ cRadio tab = GetCurrentTab();
3890
+
3891
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3892
+ {
3893
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3894
+ return false;
3895
+ }
3896
+
3897
+ copy.versions[copy.versionindex] = CompressCopy();
3898
+
3899
+ return true;
3900
+ }
3901
+
3902
+ public void Redo()
3903
+ {
3904
+ // Option?
3905
+ Replace();
3906
+
3907
+ cRadio tab = GetCurrentTab();
3908
+
3909
+ if (copy.versions[copy.versionindex + 1] == null)
3910
+ {
3911
+ java.awt.Toolkit.getDefaultToolkit().beep();
3912
+ return;
3913
+ }
3914
+
3915
+ copy.versionindex += 1;
3916
+
3917
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3918
+
3919
+ //if (!tab.user[tab.versionindex])
3920
+ // tab.graphs[tab.versionindex] = null;
3921
+ }
3922
+
3923
+ void ImportGFD()
3924
+ {
3925
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32693926 browser.show();
32703927 String filename = browser.getFile();
32713928 if (filename != null && filename.length() > 0)
32723929 {
3273
- CameraPane.filename = browser.getDirectory() + filename;
3930
+ String fullname = browser.getDirectory() + filename;
3931
+
3932
+ //Object3D readobj =
3933
+ objEditor.ReadGFD(fullname, objEditor);
3934
+ //makeSomething(readobj);
3935
+ }
3936
+ }
3937
+
3938
+ void ImportVRMLX3D()
3939
+ {
3940
+ if (Grafreed.standAlone)
3941
+ {
3942
+ /**/
3943
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3944
+ browser.show();
3945
+ String filename = browser.getFile();
3946
+ if (filename != null && filename.length() > 0)
3947
+ {
3948
+ String fullname = browser.getDirectory() + filename;
3949
+ LoadVRMLX3D(fullname);
3950
+ }
3951
+ /**/
3952
+ }
3953
+ }
3954
+
3955
+ void ToggleAnimation()
3956
+ {
3957
+ if (!Globals.ANIMATION)
3958
+ {
3959
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3960
+ browser.setVisible(true);
3961
+ String filename = browser.getFile();
3962
+ if (filename != null && filename.length() > 0)
3963
+ {
3964
+ Globals.filename = browser.getDirectory() + filename;
32743965 //CameraPane.framecount = 0;
3275
- CameraPane.imagecount = 0;
3966
+ Globals.imagecount = 0;
32763967
3277
- CameraPane.ANIMATION ^= true;
3968
+ Globals.ANIMATION ^= true;
32783969
3279
- GrafreeD.wav.cursor = 0;
3280
- GrafreeD.wav.loop = 0;
3970
+ Grafreed.wav.cursor = 0;
3971
+ Grafreed.wav.loop = 0;
32813972 }
32823973 } else
32833974 {
3284
- CameraPane.ANIMATION ^= true;
3975
+ Globals.ANIMATION ^= true;
32853976 }
32863977 }
32873978
....@@ -3327,7 +4018,7 @@
33274018 void CreateMaterial()
33284019 {
33294020 //copy.ClearMaterial(); // PATCH
3330
- copy.CreateMaterialS(multiplyToggle.isSelected());
4021
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33314022 if (copy.selection.size() > 0)
33324023 //SetMaterial(copy);
33334024 {
....@@ -3378,7 +4069,7 @@
33784069 assert false;
33794070 }
33804071
3381
- void EditSelection()
4072
+ void EditSelection(boolean newWindow)
33824073 {
33834074 }
33844075
....@@ -3386,11 +4077,11 @@
33864077 {
33874078 copy.ResetBlockLoop(); // temporary problem
33884079
3389
- boolean random = CameraPane.RANDOM;
3390
- CameraPane.RANDOM = false; // parse everything
4080
+ boolean random = CameraPane.SWITCH;
4081
+ CameraPane.SWITCH = false; // parse everything
33914082 copy.ResetDisplayList();
33924083 copy.HardTouch();
3393
- CameraPane.RANDOM = random;
4084
+ CameraPane.SWITCH = random;
33944085 }
33954086
33964087 // public void applySelf()
....@@ -3460,10 +4151,40 @@
34604151 current.fakedepth = (float) fakedepthField.getFloat();
34614152 current.shadowbias = (float) shadowbiasField.getFloat();
34624153
3463
- if (!NumberSlider.frozen)
4154
+ if (!cNumberSlider.frozen)
34644155 {
34654156 //System.out.println("Propagate = " + propagate);
34664157 copy.UpdateMaterial(anchor, current, propagate);
4158
+
4159
+ if (copy.material != null)
4160
+ {
4161
+ cMaterial mat = copy.material;
4162
+
4163
+ colorField.SetToolTipValue((mat.color));
4164
+ modulationField.SetToolTipValue((mat.modulation));
4165
+ metalnessField.SetToolTipValue((mat.metalness));
4166
+ diffuseField.SetToolTipValue((mat.diffuse));
4167
+ specularField.SetToolTipValue((mat.specular));
4168
+ shininessField.SetToolTipValue((mat.shininess));
4169
+ shiftField.SetToolTipValue((mat.shift));
4170
+ ambientField.SetToolTipValue((mat.ambient));
4171
+ lightareaField.SetToolTipValue((mat.lightarea));
4172
+ diffusenessField.SetToolTipValue((mat.factor));
4173
+ velvetField.SetToolTipValue((mat.velvet));
4174
+ sheenField.SetToolTipValue((mat.sheen));
4175
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4176
+ backlitField.SetToolTipValue((mat.bump));
4177
+ anisoField.SetToolTipValue((mat.aniso));
4178
+ anisoVField.SetToolTipValue((mat.anisoV));
4179
+ cameraField.SetToolTipValue((mat.cameralight));
4180
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4181
+ shadowField.SetToolTipValue((mat.shadow));
4182
+ textureField.SetToolTipValue((mat.texture));
4183
+ opacityField.SetToolTipValue((mat.opacity));
4184
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4185
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4186
+ }
4187
+
34674188 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34684189 {
34694190 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3492,9 +4213,25 @@
34924213 //copy.Touch();
34934214 }
34944215
4216
+ cNumberSlider versionSlider;
4217
+
34954218 public void stateChanged(ChangeEvent e)
34964219 {
34974220 // assert(false);
4221
+ if (e.getSource() == versionSlider)
4222
+ {
4223
+ if (muteSlider)
4224
+ return;
4225
+
4226
+ int version = versionSlider.getInteger();
4227
+
4228
+ if (copy.versions[version] != null)
4229
+ {
4230
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4231
+ }
4232
+
4233
+ return;
4234
+ }
34984235
34994236 if (freezematerial)
35004237 {
....@@ -3508,6 +4245,7 @@
35084245 || e.getSource() == apertureField
35094246 || e.getSource() == shadowblurField)
35104247 {
4248
+ new Exception().printStackTrace();
35114249 System.exit(0);
35124250 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35134251 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3534,7 +4272,13 @@
35344272 //System.out.println("PARENT = " + parent);
35354273 //if (parent != null)
35364274 // parent.applySelf();
3537
- refreshContents();
4275
+ if (e.getSource() == normalpushField)
4276
+ {
4277
+ objEditor.refreshContents();
4278
+ //Refresh();
4279
+ }
4280
+ else
4281
+ refreshContents();
35384282 // ??? client.refreshEditWindow();
35394283 }
35404284 //else
....@@ -3546,7 +4290,7 @@
35464290 //group.name = nameField.getText();
35474291 //objEditor.applySelf();
35484292
3549
- assert (objEditor == this);
4293
+ // OCT2018: assert (objEditor == this);
35504294 if (copy.selection == null || copy.selection.size() == 0)
35514295 //super.applySelf()
35524296 ; else
....@@ -3570,12 +4314,18 @@
35704314 objEditor.copy = keep;
35714315 }
35724316 }
4317
+
4318
+ if (normalpushField != null)
4319
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35734320 }
35744321
35754322 void SnapObject()
35764323 {
3577
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3578
- SnapObject(obj);
4324
+ if (copy.selection.size() > 0)
4325
+ {
4326
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
4327
+ SnapObject(obj);
4328
+ }
35794329 }
35804330
35814331 void SnapObject(Object3D obj)
....@@ -3821,7 +4571,7 @@
38214571
38224572 radioPanel.revalidate();
38234573 radioPanel.repaint();
3824
- ctrlPanel.revalidate(); // ? new
4574
+ ctrlPanel.validate(); // ? new
38254575 ctrlPanel.repaint();
38264576 }
38274577 }
....@@ -3830,6 +4580,8 @@
38304580
38314581 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38324582 {
4583
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4584
+ Save();
38334585 //Tween.set(thing, 0).target(1).start(tweenManager);
38344586 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38354587 // if (thing instanceof GenericJointDemo)
....@@ -3916,6 +4668,12 @@
39164668 {
39174669 ResetModel();
39184670 Select(thing.GetTreePath(), true, false); // unselect... false);
4671
+
4672
+ if (thing.Size() == 0)
4673
+ {
4674
+ //EditSelection(false);
4675
+ }
4676
+
39194677 refreshContents();
39204678 }
39214679
....@@ -4033,6 +4791,7 @@
40334791 }
40344792 }
40354793 }
4794
+
40364795 LoadGFDThread loadGFDThread;
40374796
40384797 void ReadGFD(String fullname, iCallBack cb)
....@@ -4052,8 +4811,10 @@
40524811
40534812 try
40544813 {
4814
+ // Try compressed version first.
40554815 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4056
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4816
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4817
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40574818
40584819 readobj = (Object3D) p.readObject();
40594820 istream.close();
....@@ -4061,7 +4822,22 @@
40614822 readobj.ResetDisplayList();
40624823 } catch (Exception e)
40634824 {
4064
- e.printStackTrace();
4825
+ if (!e.toString().contains("GZIP"))
4826
+ e.printStackTrace();
4827
+
4828
+ try
4829
+ {
4830
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4831
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4832
+
4833
+ readobj = (Object3D) p.readObject();
4834
+ istream.close();
4835
+
4836
+ readobj.ResetDisplayList();
4837
+ } catch (Exception e2)
4838
+ {
4839
+ e2.printStackTrace();
4840
+ }
40654841 }
40664842 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40674843 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4107,6 +4883,12 @@
41074883
41084884 void LoadIt(Object obj)
41094885 {
4886
+ if (obj == null)
4887
+ {
4888
+ // Invalid file
4889
+ return;
4890
+ }
4891
+
41104892 System.out.println("Loaded " + obj);
41114893 //new Exception().printStackTrace();
41124894 Object3D readobj = (Object3D) obj;
....@@ -4116,10 +4898,14 @@
41164898
41174899 if (readobj != null)
41184900 {
4901
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4902
+ // Save();
41194903 try
41204904 {
41214905 //readobj.deepCopySelf(copy);
41224906 copy.clear(); // june 2014
4907
+ copy.skyboxname = readobj.skyboxname;
4908
+ copy.skyboxext = readobj.skyboxext;
41234909 for (int i = 0; i < readobj.size(); i++)
41244910 {
41254911 Object3D child = readobj.get(i); // reserve(i);
....@@ -4160,6 +4946,7 @@
41604946 }
41614947 } catch (ClassCastException e)
41624948 {
4949
+ e.printStackTrace();
41634950 assert (false);
41644951 Composite c = (Composite) copy;
41654952 c.children.clear();
....@@ -4170,15 +4957,26 @@
41704957 c.addChild(csg);
41714958 }
41724959
4960
+ copy.versions = readobj.versions;
4961
+ copy.versionindex = readobj.versionindex;
4962
+
4963
+ if (copy.versions == null)
4964
+ {
4965
+ copy.versions = new byte[100][];
4966
+ copy.versionindex = -1;
4967
+ }
4968
+
4969
+ //? SetUndoStates();
4970
+
41734971 ResetModel();
41744972 copy.HardTouch(); // recompile?
41754973 refreshContents();
41764974 }
41774975 }
41784976
4179
- void load() // throws ClassNotFoundException
4977
+ void Open() // throws ClassNotFoundException
41804978 {
4181
- if (GrafreeD.standAlone)
4979
+ if (Grafreed.standAlone)
41824980 {
41834981 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41844982 browser.show();
....@@ -4265,11 +5063,13 @@
42655063 try
42665064 {
42675065 FileOutputStream ostream = new FileOutputStream(lastname);
4268
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5066
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5067
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42695068
42705069 p.writeObject(copy);
42715070 p.flush();
42725071
5072
+ zstream.close();
42735073 ostream.close();
42745074
42755075 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4277,19 +5077,23 @@
42775077 //ps.print(buffer.toString());
42785078 } catch (IOException e)
42795079 {
5080
+ e.printStackTrace();
42805081 }
42815082 }
5083
+
42825084 String lastname;
42835085
42845086 void saveAs()
42855087 {
4286
- if (GrafreeD.standAlone)
5088
+ if (Grafreed.standAlone)
42875089 {
42885090 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42895091 browser.setVisible(true);
42905092 String filename = browser.getFile();
42915093 if (filename != null && filename.length() > 0)
42925094 {
5095
+ if (!filename.endsWith(".gfd"))
5096
+ filename += ".gfd";
42935097 lastname = browser.getDirectory() + filename;
42945098 save();
42955099 }
....@@ -4388,13 +5192,13 @@
43885192 try
43895193 {
43905194 FileOutputStream ostream = new FileOutputStream(filename);
4391
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4392
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5195
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5196
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43935197
43945198 Object3D objectparent = obj.parent;
43955199 obj.parent = null;
43965200
4397
- Object3D object = (Object3D) GrafreeD.clone(obj);
5201
+ Object3D object = (Object3D) Grafreed.clone(obj);
43985202
43995203 obj.parent = objectparent;
44005204
....@@ -4406,8 +5210,8 @@
44065210 p.writeObject(object);
44075211 p.flush();
44085212
5213
+ zstream.close();
44095214 ostream.close();
4410
- // zstream.close();
44115215
44125216 // group.selection.get(0).parent = parent;
44135217 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4428,7 +5232,7 @@
44285232 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44295233 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44305234 copy.generatePOV(buffer);
4431
- if (GrafreeD.standAlone)
5235
+ if (Grafreed.standAlone)
44325236 {
44335237 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44345238 browser.show();
....@@ -4454,21 +5258,20 @@
44545258 Object3D client;
44555259 Object3D copy;
44565260 MenuBar menuBar;
4457
- Menu windowMenu;
4458
- MenuItem loadItem;
5261
+ Menu fileMenu;
5262
+ MenuItem newItem;
5263
+ MenuItem openItem;
44595264 MenuItem saveItem;
44605265 MenuItem saveAsItem;
44615266 MenuItem exportAsItem;
44625267 MenuItem reexportItem;
44635268 MenuItem povItem;
44645269 MenuItem closeItem;
4465
- Menu cameraMenu;
5270
+
44665271 CheckboxMenuItem zBufferItem;
44675272 //MenuItem normalLensItem;
4468
- MenuItem editCameraItem;
4469
- MenuItem revertCameraItem;
4470
- CheckboxMenuItem toggleLiveItem;
44715273 MenuItem stepItem;
5274
+ CheckboxMenuItem toggleLiveItem;
44725275 CheckboxMenuItem toggleFullScreenItem;
44735276 CheckboxMenuItem toggleTimelineItem;
44745277 CheckboxMenuItem toggleRenderItem;
....@@ -4477,28 +5280,43 @@
44775280 CheckboxMenuItem toggleFootContactItem;
44785281 CheckboxMenuItem toggleDLItem;
44795282 CheckboxMenuItem toggleTextureItem;
4480
- CheckboxMenuItem toggleRandomItem;
5283
+ CheckboxMenuItem toggleSwitchItem;
44815284 CheckboxMenuItem toggleRootItem;
44825285 CheckboxMenuItem animationItem;
5286
+ MenuItem archiveItem;
44835287 CheckboxMenuItem toggleHandleItem;
44845288 CheckboxMenuItem togglePaintItem;
44855289 JSplitPane mainPanel;
44865290 JScrollPane scrollpane;
5291
+
44875292 JPanel toolbarPanel;
4488
- JPanel treePanel;
5293
+
5294
+ cGridBag treePanel;
5295
+
44895296 JPanel radioPanel;
44905297 ButtonGroup buttonGroup;
4491
- JPanel ctrlPanel;
4492
- JPanel materialPanel;
5298
+
5299
+ cGridBag toolboxPanel;
5300
+ cGridBag materialPanel;
5301
+ cGridBag ctrlPanel;
5302
+
44935303 JScrollPane infoPanel;
4494
- JPanel optionsPanel;
5304
+
5305
+ cGridBag optionsPanel;
5306
+
44955307 JTabbedPane objectPanel;
4496
- JPanel XYZPanel;
5308
+ boolean materialFlushed;
5309
+ Object3D latestObject;
5310
+
5311
+ cGridBag XYZPanel;
5312
+
44975313 JSplitPane gridPanel;
44985314 JSplitPane bigPanel;
4499
- JPanel bigThree;
4500
- JTabbedPane scenePanel;
4501
- JPanel centralPanel;
5315
+
5316
+ cGridBag bigThree;
5317
+ cGridBag scenePanel;
5318
+ cGridBag centralPanel;
5319
+ JSplitPane cameraPanel;
45025320 JPanel timelinePanel;
45035321 JMenuBar timelineMenubar;
45045322 JSplitPane framePanel;
....@@ -4550,65 +5368,72 @@
45505368 // MATERIAL
45515369 JLabel materialLabel;
45525370 JLabel colorLabel;
4553
- NumberSlider colorField;
5371
+ cNumberSlider colorField;
45545372 JLabel modulationLabel;
4555
- NumberSlider modulationField;
5373
+ cNumberSlider modulationField;
45565374 JLabel metalnessLabel;
4557
- NumberSlider metalnessField;
5375
+ cNumberSlider metalnessField;
45585376 JLabel diffuseLabel;
4559
- NumberSlider diffuseField;
5377
+ cNumberSlider diffuseField;
45605378 JLabel specularLabel;
4561
- NumberSlider specularField;
5379
+ cNumberSlider specularField;
45625380 JLabel shininessLabel;
4563
- NumberSlider shininessField;
5381
+ cNumberSlider shininessField;
45645382 JLabel shiftLabel;
4565
- NumberSlider shiftField;
5383
+ cNumberSlider shiftField;
45665384 JLabel ambientLabel;
4567
- NumberSlider ambientField;
5385
+ cNumberSlider ambientField;
45685386 JLabel lightareaLabel;
4569
- NumberSlider lightareaField;
5387
+ cNumberSlider lightareaField;
45705388 JLabel diffusenessLabel;
4571
- NumberSlider diffusenessField;
5389
+ cNumberSlider diffusenessField;
45725390 JLabel velvetLabel;
4573
- NumberSlider velvetField;
5391
+ cNumberSlider velvetField;
45745392 JLabel sheenLabel;
4575
- NumberSlider sheenField;
5393
+ cNumberSlider sheenField;
45765394 JLabel subsurfaceLabel;
4577
- NumberSlider subsurfaceField;
5395
+ cNumberSlider subsurfaceField;
45785396 //JLabel bumpLabel;
45795397 //NumberSlider bumpField;
45805398 JLabel backlitLabel;
4581
- NumberSlider backlitField;
5399
+ cNumberSlider backlitField;
45825400 JLabel anisoLabel;
4583
- NumberSlider anisoField;
5401
+ cNumberSlider anisoField;
45845402 JLabel anisoVLabel;
4585
- NumberSlider anisoVField;
5403
+ cNumberSlider anisoVField;
45865404 JLabel cameraLabel;
4587
- NumberSlider cameraField;
5405
+ cNumberSlider cameraField;
45885406 JLabel selfshadowLabel;
4589
- NumberSlider selfshadowField;
5407
+ cNumberSlider selfshadowField;
45905408 JLabel shadowLabel;
4591
- NumberSlider shadowField;
5409
+ cNumberSlider shadowField;
45925410 JLabel textureLabel;
4593
- NumberSlider textureField;
5411
+ cNumberSlider textureField;
45945412 JLabel opacityLabel;
4595
- NumberSlider opacityField;
5413
+ cNumberSlider opacityField;
45965414 JLabel fakedepthLabel;
4597
- NumberSlider fakedepthField;
5415
+ cNumberSlider fakedepthField;
45985416 JLabel shadowbiasLabel;
4599
- NumberSlider shadowbiasField;
5417
+ cNumberSlider shadowbiasField;
46005418 JLabel bumpLabel;
4601
- NumberSlider bumpField;
5419
+ cNumberSlider bumpField;
46025420 JLabel noiseLabel;
4603
- NumberSlider noiseField;
5421
+ cNumberSlider noiseField;
46045422 JLabel powerLabel;
4605
- NumberSlider powerField;
5423
+ cNumberSlider powerField;
46065424 JLabel borderfadeLabel;
4607
- NumberSlider borderfadeField;
5425
+ cNumberSlider borderfadeField;
46085426 JLabel fogLabel;
4609
- NumberSlider fogField;
5427
+ cNumberSlider fogField;
46105428 JLabel opacityPowerLabel;
4611
- NumberSlider opacityPowerField;
4612
- JTree jTree;
5429
+ cNumberSlider opacityPowerField;
5430
+ cTree jTree;
46135431 //ObjectUI parent;
5432
+
5433
+ cNumberSlider normalpushField;
5434
+
5435
+ private MenuItem importGFDItem;
5436
+ private MenuItem importVRMLX3DItem;
5437
+ private MenuItem import3DSItem;
5438
+ private MenuItem importOBJItem;
46145439 }