Normand Briere
2019-07-19 e79247ef52a0bbb3864d46bb1e2c716005b3ecf3
ObjEditor.java
....@@ -4,6 +4,7 @@
44
55 import java.awt.*;
66 import java.awt.event.*;
7
+import java.awt.image.BufferedImage;
78 import javax.swing.*;
89 import javax.swing.event.*;
910 import javax.swing.text.*;
....@@ -14,10 +15,15 @@
1415 //import javax.swing.plaf.ColorUIResource;
1516 //import javax.swing.plaf.metal.DefaultMetalTheme;
1617
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
20
+
1721 //import javax.media.opengl.GLCanvas;
1822
1923 import //weka.core.
2024 matrix.Matrix;
25
+
26
+import grafeme.ui.*;
2127
2228 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
2329 ActionListener, ChangeListener,
....@@ -28,7 +34,59 @@
2834 iSendInfo
2935 //KeyListener
3036 {
37
+ boolean timeline;
38
+ boolean wasFullScreen;
3139
40
+ GroupEditor callee;
41
+ JFrame frame;
42
+
43
+ static ObjEditor theFrame;
44
+
45
+ cButton GetButton(String name, boolean border)
46
+ {
47
+ ImageIcon icon = GetIcon(name);
48
+ return new cButton(icon, border);
49
+ }
50
+
51
+ cToggleButton GetToggleButton(String name, boolean border)
52
+ {
53
+ ImageIcon icon = GetIcon(name);
54
+ return new cToggleButton(icon, border);
55
+ }
56
+
57
+ cCheckBox GetCheckBox(String name, boolean border)
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cCheckBox(icon, border);
61
+ }
62
+
63
+ private ImageIcon GetIcon(String name)
64
+ {
65
+ try
66
+ {
67
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
68
+
69
+ if (image.getWidth() != 24 && image.getHeight() != 24)
70
+ {
71
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
72
+ Graphics2D g = resized.createGraphics();
73
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
74
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
75
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
76
+ g.dispose();
77
+
78
+ image = resized;
79
+ }
80
+
81
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
82
+ return icon;
83
+ }
84
+ catch (Exception e)
85
+ {
86
+ return null;
87
+ }
88
+ }
89
+
3290 // SCRIPT
3391
3492 transient JFrame textpanel = null;
....@@ -119,51 +177,62 @@
119177 void keyPressed(int key, int modifiers)
120178 {
121179 System.out.println("KEY PRESSED");
122
- CameraPane.theRenderer.keyPressed(key, modifiers);
180
+ Globals.theRenderer.keyPressed(key, modifiers);
123181 }
124182 */
125183
126184 static GridBagConstraints aConstraints;
127185 static GridBagConstraints aWindowConstraints;
128
- GroupEditor callee;
129
- JFrame frame;
186
+
130187 static int GRIDWIDTH = 100; // 4;
131188
132189 public void closeUI()
133190 {
134191 //new Exception().printStackTrace();
135
- System.out.println("this = " + this);
136
- System.out.println("objEditor = " + objEditor);
192
+// System.out.println("this = " + this);
193
+// System.out.println("objEditor = " + objEditor);
137194 //nameField.removeActionListener(this);
138
- objEditor.ctrlPanel.remove(nameField);
195
+// objEditor.ctrlPanel.remove(nameField);
139196
140
- if (!GroupEditor.allparams)
197
+ objEditor.ctrlPanel.remove(namePanel);
198
+
199
+ if (!allparams)
141200 return;
142201
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);
202
+// objEditor.ctrlPanel.remove(liveCB);
203
+// objEditor.ctrlPanel.remove(hideCB);
204
+// objEditor.ctrlPanel.remove(markCB);
205
+//
206
+// objEditor.ctrlPanel.remove(randomCB);
207
+// objEditor.ctrlPanel.remove(speedupCB);
208
+// objEditor.ctrlPanel.remove(rewindCB);
209
+//
210
+// objEditor.ctrlPanel.remove(resetButton);
211
+// objEditor.ctrlPanel.remove(stepButton);
212
+//// objEditor.ctrlPanel.remove(stepAllButton);
213
+//// objEditor.ctrlPanel.remove(resetAllButton);
214
+// objEditor.ctrlPanel.remove(link2masterCB);
215
+// //objEditor.ctrlPanel.remove(flipVCB);
216
+// //objEditor.ctrlPanel.remove(texresMenu);
217
+// objEditor.ctrlPanel.remove(slowerButton);
218
+// objEditor.ctrlPanel.remove(fasterButton);
219
+// objEditor.ctrlPanel.remove(remarkButton);
220
+
221
+ objEditor.ctrlPanel.remove(setupPanel);
222
+ objEditor.ctrlPanel.remove(setupPanel2);
223
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
224
+ objEditor.ctrlPanel.remove(pushPanel);
225
+ //objEditor.ctrlPanel.remove(fillPanel);
226
+
227
+ //Remove(normalpushField);
161228 }
162229
163230 public ObjEditor GetEditor()
164231 {
165232 return objEditor; //.GetEditor();
166233 }
234
+
235
+ // Sometimes myself, sometimes my callee's.
167236 ObjEditor objEditor;
168237
169238 /*
....@@ -199,6 +268,12 @@
199268 client = inClient;
200269 copy = client;
201270
271
+ if (copy.versions == null)
272
+ {
273
+ copy.versions = new byte[100][];
274
+ copy.versionindex = -1;
275
+ }
276
+
202277 // "this" is not called: SetupUI2(objEditor);
203278 }
204279
....@@ -212,6 +287,12 @@
212287 client = inClient;
213288 copy = client;
214289
290
+ if (copy.versions == null)
291
+ {
292
+ copy.versions = new byte[100][];
293
+ copy.versionindex = -1;
294
+ }
295
+
215296 SetupUI2(callee.GetEditor());
216297 }
217298
....@@ -226,6 +307,7 @@
226307 //localCopy.parent = null;
227308
228309 frame = new JFrame();
310
+ frame.setUndecorated(false);
229311 objEditor = this;
230312 this.callee = callee;
231313
....@@ -238,11 +320,17 @@
238320 //if (!isDisplayable())
239321 //setUndecorated(true);
240322
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
323
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242324 client = inClient;
243325 copy = localCopy;
244326 copy.editWindow = this;
245327
328
+ if (copy.versions == null)
329
+ {
330
+ copy.versions = new byte[100][];
331
+ copy.versionindex = -1;
332
+ }
333
+
246334 SetupMenu();
247335
248336 //SetupName(objEditor); // new
....@@ -256,28 +344,49 @@
256344 return frame.action(event, obj);
257345 }
258346
347
+ // Cannot work without static
348
+ static boolean allparams = true;
349
+
350
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
351
+
259352 void SetupMenu()
260353 {
261354 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..."));
355
+ menuBar.add(fileMenu = new Menu("File"));
356
+ fileMenu.add(newItem = new MenuItem("New"));
357
+ fileMenu.add(openItem = new MenuItem("Open..."));
358
+
359
+ //oe.menuBar.add(menu = new Menu("Include"));
360
+ Menu menu = new Menu("Import");
361
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
362
+ importOBJItem.addActionListener(this);
363
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
364
+ import3DSItem.addActionListener(this);
365
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
366
+ importVRMLX3DItem.addActionListener(this);
367
+ menu.add("-");
368
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
369
+ importGFDItem.addActionListener(this);
370
+ fileMenu.add(menu);
371
+ fileMenu.add("-");
372
+
373
+ fileMenu.add(saveItem = new MenuItem("Save"));
374
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267375 //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("-");
376
+ fileMenu.add("-");
377
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
378
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
379
+ fileMenu.add("-");
272380 if (client.parent != null)
273381 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
382
+ fileMenu.add(closeItem = new MenuItem("Close"));
275383 } else
276384 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
385
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278386 }
279387
280
- loadItem.addActionListener(this);
388
+ newItem.addActionListener(this);
389
+ openItem.addActionListener(this);
281390 saveItem.addActionListener(this);
282391 saveAsItem.addActionListener(this);
283392 exportAsItem.addActionListener(this);
....@@ -285,80 +394,69 @@
285394 //povItem.addActionListener(this);
286395 closeItem.addActionListener(this);
287396
288
- menuBar.add(cameraMenu = new Menu("View"));
289
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
290
- //zBufferItem.addActionListener(this);
291
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
292
- //normalLensItem.addActionListener(this);
293
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
294
- revertCameraItem.addActionListener(this);
295
- cameraMenu.add(toggleFullItem = new CheckboxMenuItem("Full Screen"));
296
- toggleFullItem.addItemListener(this);
297
- toggleFullItem.setState(CameraPane.FULLSCREEN);
298
- cameraMenu.add("-");
299
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
300
- toggleTextureItem.addItemListener(this);
301
- toggleTextureItem.setState(CameraPane.textureon);
302
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
303
- toggleLiveItem.addItemListener(this);
304
- toggleLiveItem.setState(CameraPane.isLIVE());
305
- cameraMenu.add(stepItem = new MenuItem("Step"));
306
- stepItem.addActionListener(this);
307
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
308
-// toggleDLItem.addItemListener(this);
309
-// toggleDLItem.setState(false);
310
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
311
- toggleRenderItem.addItemListener(this);
312
- toggleRenderItem.setState(!CameraPane.frozen);
313
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
314
- toggleDebugItem.addItemListener(this);
315
- toggleDebugItem.setState(CameraPane.DEBUG);
316
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
317
- toggleFrustumItem.addItemListener(this);
318
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
319
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
320
- toggleFootContactItem.addItemListener(this);
321
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
322
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
323
- toggleRandomItem.addItemListener(this);
324
- toggleRandomItem.setState(CameraPane.RANDOM);
325
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
326
- toggleHandleItem.addItemListener(this);
327
- toggleHandleItem.setState(CameraPane.HANDLES);
328
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
329
- togglePaintItem.addItemListener(this);
330
- togglePaintItem.setState(CameraPane.PAINTMODE);
331
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
332
-// toggleRootItem.addItemListener(this);
333
-// toggleRootItem.setState(false);
334
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
335
-// animationItem.addItemListener(this);
336
-// animationItem.setState(CameraPane.ANIMATION);
337
- cameraMenu.add("-");
338
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
339
- editCameraItem.addActionListener(this);
340
-
341397 objectPanel = new JTabbedPane();
398
+
399
+ ChangeListener changeListener = new ChangeListener()
400
+ {
401
+ public void stateChanged(ChangeEvent changeEvent)
402
+ {
403
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
404
+// {
405
+// if (latestObject != null)
406
+// {
407
+// refreshContents(true);
408
+// SetMaterial(latestObject);
409
+// }
410
+//
411
+// materialFlushed = true;
412
+// }
413
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
414
+// {
415
+// if (listUI.size() == 0)
416
+// EditSelection(false);
417
+// }
418
+
419
+ refreshContents(false); // To refresh Info tab
420
+ }
421
+ };
422
+ objectPanel.addChangeListener(changeListener);
423
+
342424 toolbarPanel = new JPanel();
343425 toolbarPanel.setName("Toolbar");
344
- treePanel = new JPanel();
426
+
427
+ treePanel = new cGridBag();
345428 treePanel.setName("Tree");
346
- ctrlPanel = new JPanel(); // new GridBagLayout());
347
- ctrlPanel.setName("Edit");
348
- materialPanel = new JPanel();
349
- materialPanel.setName("Material");
429
+
430
+ editPanel = new cGridBag().setVertical(true);
431
+ //editPanel.setName("Edit");
432
+
433
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
434
+
435
+ editCommandsPanel = new cGridBag();
436
+ editPanel.add(editCommandsPanel);
437
+ editPanel.add(ctrlPanel);
438
+
439
+ toolboxPanel = new cGridBag().setVertical(false);
440
+ //toolboxPanel.setName("Toolbox");
441
+
442
+ materialPanel = new cGridBag().setVertical(true);
443
+ //materialPanel.setName("Material");
444
+
350445 /*JTextPane*/
351446 infoarea = createTextPane();
447
+ doc = infoarea.getStyledDocument();
448
+
352449 infoarea.setEditable(true);
353450 SetText();
451
+
354452 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
355453 // infoarea.setOpaque(false);
356454 // //infoarea.setForeground(textcolor);
357
- infoarea.setLineWrap(true);
358
- infoarea.setWrapStyleWord(true);
455
+// TEXTAREA infoarea.setLineWrap(true);
456
+// TEXTAREA infoarea.setWrapStyleWord(true);
359457 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
360
- infoPanel.setPreferredSize(new Dimension(50, 200));
361
- infoPanel.setName("Info");
458
+ infoPanel.setPreferredSize(new Dimension(1, 1));
459
+ //infoPanel.setName("Info");
362460 //infoPanel.setLayout(new BorderLayout());
363461 //infoPanel.add(createTextPane());
364462
....@@ -366,16 +464,23 @@
366464 mainPanel.setName("Main");
367465 mainPanel.setContinuousLayout(true);
368466 mainPanel.setOneTouchExpandable(true);
369
- mainPanel.setDividerLocation(1.0);
370467 mainPanel.setDividerSize(9);
371
- mainPanel.setResizeWeight(0);
372
-
468
+ mainPanel.setDividerLocation(0.5); //1.0);
469
+ mainPanel.setResizeWeight(0.5);
470
+
471
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
472
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
473
+ divider.setDividerSize(15);
474
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
475
+
476
+ mainPanel.setUI(new BasicSplitPaneUI());
477
+
373478 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
374479 //mainPanel.setLayout(new GridBagLayout());
375480 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
376
- treePanel.setLayout(new GridBagLayout());
377
- ctrlPanel.setLayout(new GridBagLayout());
378
- materialPanel.setLayout(new GridBagLayout());
481
+// treePanel.setLayout(new GridBagLayout());
482
+ //ctrlPanel.setLayout(new GridBagLayout());
483
+ //materialPanel.setLayout(new GridBagLayout());
379484
380485 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
381486 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -414,7 +519,7 @@
414519 static String newline = "\n";
415520 protected static final String buttonString = "JButton";
416521 StyledDocument doc;
417
- JTextArea infoarea;
522
+ JTextPane infoarea;
418523
419524 void ClearInfo()
420525 {
....@@ -437,10 +542,10 @@
437542 e.printStackTrace();
438543 }
439544
440
- String selection = infoarea.getText();
441
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
442
- java.awt.datatransfer.Clipboard clipboard =
443
- Toolkit.getDefaultToolkit().getSystemClipboard();
545
+// String selection = infoarea.getText();
546
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
547
+// java.awt.datatransfer.Clipboard clipboard =
548
+// Toolkit.getDefaultToolkit().getSystemClipboard();
444549 //clipboard.setContents(data, data);
445550 }
446551
....@@ -463,13 +568,13 @@
463568 //SendInfo("Name:", "bold");
464569 if (sel.GetTextures() != null || debug)
465570 {
466
- si.SendInfo(sel.toString(), "bold");
571
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
467572 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
468573 if (sel.Size() > 0)
469574 {
470575 si.SendInfo("#children = " + sel.Size(), "regular");
471576 }
472
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
577
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
473578 if (debug)
474579 {
475580 try
....@@ -481,7 +586,10 @@
481586 }
482587
483588 if (full)
484
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
589
+ {
590
+ si.SendInfo(" BBox min: " + minima, "regular");
591
+ si.SendInfo(" BBox max: " + maxima, "regular");
592
+ }
485593
486594 if (sel.bRep != null)
487595 {
....@@ -508,7 +616,7 @@
508616 }
509617 if (sel.support != null)
510618 {
511
- si.SendInfo(" support: " + sel.support, "regular");
619
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
512620 }
513621 if (sel.scriptnode != null)
514622 {
....@@ -579,6 +687,9 @@
579687 {
580688 CameraPane.pointflow = (PointFlow) sel;
581689 }
690
+
691
+ si.SendInfo("_____________________", "regular");
692
+ si.SendInfo("", "regular");
582693 }
583694 }
584695
....@@ -594,52 +705,191 @@
594705 }
595706 }
596707
597
- private JTextArea createTextPane()
598
- {
599
- String[] initString =
600
- {
601
- "This is an editable JTextPane, ", //regular
602
- "another ", //italic
603
- "styled ", //bold
604
- "text ", //small
605
- "component, ", //large
606
- "which supports embedded components..." + newline,//regular
607
- " " + newline, //button
608
- "...and embedded icons..." + newline, //regular
609
- " ", //icon
610
- newline + "JTextPane is a subclass of JEditorPane that "
611
- + "uses a StyledEditorKit and StyledDocument, and provides "
612
- + "cover methods for interacting with those objects."
613
- };
708
+//static GraphicsDevice device = GraphicsEnvironment
709
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
614710
615
- String[] initStyles =
616
- {
617
- "regular", "italic", "bold", "small", "large",
618
- "regular", "button", "regular", "icon",
619
- "regular"
620
- };
711
+ Rectangle keeprect;
712
+ cRadio radio;
713
+
714
+cButton keepButton;
715
+ cButton twoButton; // Full 3D
716
+ cButton sixButton;
717
+ cButton threeButton;
718
+ cButton sevenButton;
719
+ cButton fourButton; // full panel
720
+ cButton oneButton; // full XYZ
721
+ //cButton currentLayout;
722
+
723
+ boolean maximized;
724
+
725
+ cButton fullscreenLayout;
621726
622
- JTextPane textPane = new JTextPane();
623
- textPane.setEditable(true);
624
- /*StyledDocument*/ doc = textPane.getStyledDocument();
625
- addStylesToDocument(doc);
626
-
627
- try
727
+ void Minimize()
628728 {
629
- for (int j = 0; j < 2; j++)
729
+ frame.setState(Frame.ICONIFIED);
730
+ frame.validate();
731
+ }
732
+
733
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
734
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
735
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
736
+ void Maximize()
737
+ {
738
+ if (CameraPane.FULLSCREEN)
630739 {
631
- for (int i = 0; i < initString.length; i++)
632
- {
633
- doc.insertString(doc.getLength(), initString[i],
634
- doc.getStyle(initStyles[i]));
635
- }
740
+ ToggleFullScreen();
636741 }
637
- } catch (BadLocationException ble)
742
+
743
+ if (maximized)
744
+ {
745
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
746
+ }
747
+ else
748
+ {
749
+ keeprect = frame.getBounds();
750
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
751
+// Dimension rect2 = frame.getToolkit().getScreenSize();
752
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
753
+// frame.setState(Frame.MAXIMIZED_BOTH);
754
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
755
+ }
756
+
757
+ maximized ^= true;
758
+
759
+ frame.validate();
760
+ }
761
+
762
+ cButton minButton;
763
+ cButton maxButton;
764
+ cButton fullButton;
765
+
766
+ void ToggleFullScreen()
638767 {
639
- System.err.println("Couldn't insert initial text into text pane.");
768
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
769
+
770
+ cameraView.ToggleFullScreen();
771
+
772
+ if (!CameraPane.FULLSCREEN)
773
+ {
774
+ device.setFullScreenWindow(null);
775
+ frame.dispose();
776
+ frame.setUndecorated(false);
777
+ frame.validate();
778
+ frame.setVisible(true);
779
+
780
+ //frame.setVisible(false);
781
+// frame.removeNotify();
782
+// frame.setUndecorated(false);
783
+// frame.addNotify();
784
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
785
+
786
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
787
+// X framePanel.add(bigThree);
788
+// X frame.getContentPane().add(/*"Center",*/framePanel);
789
+ framePanel.setDividerLocation(46);
790
+
791
+ //frame.setVisible(true);
792
+ radio.layout = keepButton;
793
+ //theFrame = null;
794
+ keepButton = null;
795
+ radio.layout.doClick();
796
+
797
+ } else
798
+ {
799
+ keepButton = radio.layout;
800
+ //keeprect = frame.getBounds();
801
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
802
+// frame.getToolkit().getScreenSize().height);
803
+ //frame.setVisible(false);
804
+
805
+ frame.dispose();
806
+ frame.setUndecorated(true);
807
+ device.setFullScreenWindow(frame);
808
+ frame.validate();
809
+ frame.setVisible(true);
810
+// frame.removeNotify();
811
+// frame.setUndecorated(true);
812
+// frame.addNotify();
813
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
814
+// X framePanel.remove(bigThree);
815
+// X frame.getContentPane().add(/*"Center",*/bigThree);
816
+ framePanel.setDividerLocation(0);
817
+
818
+ radio.layout = fullscreenLayout;
819
+ radio.layout.doClick();
820
+ //frame.setVisible(true);
821
+ }
822
+ frame.validate();
640823 }
641824
642
- return new JTextArea(); // textPane;
825
+ private byte[] CompressCopy()
826
+ {
827
+ boolean temp = CameraPane.SWITCH;
828
+ CameraPane.SWITCH = false;
829
+
830
+ copy.ExtractBigData(versiontable);
831
+ // if (copy == client)
832
+
833
+ byte[] versions[] = copy.versions;
834
+ copy.versions = null;
835
+
836
+ byte[] compress = Compress(copy);
837
+
838
+ copy.versions = versions;
839
+
840
+ copy.RestoreBigData(versiontable);
841
+
842
+ CameraPane.SWITCH = temp;
843
+
844
+ return compress;
845
+ }
846
+
847
+ private JTextPane createTextPane()
848
+ {
849
+// TEXTAREA String[] initString =
850
+// {
851
+// "This is an editable JTextPane, ", //regular
852
+// "another ", //italic
853
+// "styled ", //bold
854
+// "text ", //small
855
+// "component, ", //large
856
+// "which supports embedded components..." + newline,//regular
857
+// " " + newline, //button
858
+// "...and embedded icons..." + newline, //regular
859
+// " ", //icon
860
+// newline + "JTextPane is a subclass of JEditorPane that "
861
+// + "uses a StyledEditorKit and StyledDocument, and provides "
862
+// + "cover methods for interacting with those objects."
863
+// };
864
+//
865
+// String[] initStyles =
866
+// {
867
+// "regular", "italic", "bold", "small", "large",
868
+// "regular", "button", "regular", "icon",
869
+// "regular"
870
+// };
871
+//
872
+// JTextPane textPane = new JTextPane();
873
+// textPane.setEditable(true);
874
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
875
+// addStylesToDocument(doc);
876
+//
877
+// try
878
+// {
879
+// for (int j = 0; j < 2; j++)
880
+// {
881
+// for (int i = 0; i < initString.length; i++)
882
+// {
883
+// doc.insertString(doc.getLength(), initString[i],
884
+// doc.getStyle(initStyles[i]));
885
+// }
886
+// }
887
+// } catch (BadLocationException ble)
888
+// {
889
+// System.err.println("Couldn't insert initial text into text pane.");
890
+// }
891
+
892
+ return new JTextPane(); // textPane;
643893 }
644894
645895 protected void addStylesToDocument(StyledDocument doc)
....@@ -692,7 +942,7 @@
692942 protected static ImageIcon createImageIcon(String path,
693943 String description)
694944 {
695
- java.net.URL imgURL = GrafreeD.class.getResource(path);
945
+ java.net.URL imgURL = Grafreed.class.getResource(path);
696946 if (imgURL != null)
697947 {
698948 return new ImageIcon(imgURL, description);
....@@ -724,6 +974,7 @@
724974 // NumberSlider vDivsField;
725975 // JCheckBox endcaps;
726976 JCheckBox liveCB;
977
+ JCheckBox selectCB;
727978 JCheckBox hideCB;
728979 JCheckBox link2masterCB;
729980 JCheckBox markCB;
....@@ -731,7 +982,12 @@
731982 JCheckBox speedupCB;
732983 JCheckBox rewindCB;
733984 JCheckBox flipVCB;
985
+
986
+ cCheckBox toggleTextureCB;
987
+ cCheckBox toggleSwitchCB;
988
+
734989 JComboBox texresMenu;
990
+
735991 JButton resetButton;
736992 JButton stepButton;
737993 JButton stepAllButton;
....@@ -739,115 +995,87 @@
739995 JButton slowerButton;
740996 JButton fasterButton;
741997 JButton remarkButton;
998
+
999
+ cGridBag editPanel;
1000
+ cGridBag editCommandsPanel;
1001
+
1002
+ cGridBag namePanel;
1003
+ cGridBag setupPanel;
1004
+ cGridBag setupPanel2;
1005
+ cGridBag objectCommandsPanel;
1006
+ cGridBag pushPanel;
1007
+ cGridBag fillPanel;
7421008
743
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1009
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7441010 {
7451011 JCheckBox cb;
7461012
747
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
748
- oe.aConstraints.gridwidth = 1; // 3;
749
-// oe.aConstraints.weightx = 1;
750
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
751
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1013
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7521014 cb.addItemListener(this);
753
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
754
- oe.aConstraints.gridwidth = 1;
755
- oe.aConstraints.gridx += 1;
7561015
7571016 return cb;
7581017 }
7591018
760
- cButton AddButton(ObjEditor oe, String label)
1019
+ cButton AddButton(cGridBag panel, String label)
7611020 {
7621021 cButton cb;
7631022
764
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
765
- oe.aConstraints.gridwidth = 1;
766
-// oe.aConstraints.weightx = 1;
767
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
768
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1023
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7691024 cb.addActionListener(this);
770
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
771
- oe.aConstraints.gridwidth = 1;
772
- oe.aConstraints.gridx += 1;
7731025
7741026 return cb;
7751027 }
7761028
777
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1029
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
7781030 {
7791031 JComboBox combo;
7801032
781
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
782
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
783
- oe.aConstraints.gridx += 1;
1033
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7841034 combo.addActionListener(this);
7851035
7861036 return combo;
7871037 }
7881038
789
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
1039
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
7901040 {
791
- NumberSlider combo;
1041
+ cGridBag control = new cGridBag();
1042
+
1043
+ cNumberSlider combo;
7921044
7931045 JLabel jlabel = new JLabel(label);
794
-
795
- aConstraints.fill = GridBagConstraints.VERTICAL;
7961046 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
797
- aConstraints.gridwidth = 2;
798
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
799
- aConstraints.gridx += 1;
800
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
801
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
802
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
803
- aConstraints.gridx += 1;
804
- aConstraints.gridwidth = 1;
805
-
1047
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1048
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8061049 combo.setFloat(current);
807
-
808
- combo.label = jlabel;
809
-
810
- combo.addChangeListener(this);
811
-
812
- return combo;
1050
+
1051
+ panel.add(control);
1052
+
1053
+ return control;
8131054 }
8141055
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
1056
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8161057 {
817
- NumberSlider combo;
1058
+ cGridBag control = new cGridBag();
1059
+
1060
+ cNumberSlider combo;
8181061
8191062 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
8221063 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
823
- aConstraints.gridwidth = 2;
824
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
825
- aConstraints.gridx += 1;
826
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
827
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
828
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
829
- aConstraints.gridx += 1;
830
- aConstraints.gridwidth = 1;
831
-
1064
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1065
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8321066 combo.setInteger(current);
8331067
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
1068
+ panel.add(control);
1069
+
1070
+ return control;
8391071 }
8401072
841
- JTextArea AddText(JPanel ctrlPanel, String name)
1073
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8421074 {
8431075 JTextArea text;
8441076
845
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
846
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
847
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1077
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8481078 text.addCaretListener(this);
849
- aConstraints.gridx += 1;
850
- aConstraints.gridwidth = 1;
8511079
8521080 return text;
8531081 }
....@@ -877,9 +1105,16 @@
8771105 objEditor.ctrlPanel.remove(j);
8781106 }
8791107
1108
+ void Remove(cNumberSlider j)
1109
+ {
1110
+ j.removeChangeListener(this);
1111
+ //objEditor.ctrlPanel.remove(j.label);
1112
+ objEditor.ctrlPanel.remove(j);
1113
+ }
1114
+
8801115 /*
8811116 */
882
- void Return() // ObjEditor oe)
1117
+ void Return0() // ObjEditor oe)
8831118 {
8841119 aConstraints.gridy += 1;
8851120 aConstraints.gridx = 0;
....@@ -934,35 +1169,78 @@
9341169
9351170 void SetupUI2(ObjEditor oe)
9361171 {
937
-// oe.aConstraints.weightx = 0;
938
-// oe.aConstraints.weighty = 0;
939
-// oe.aConstraints.gridx = 0;
940
-// oe.aConstraints.gridy = 0;
941
- SetupName(oe);
1172
+ //SetupName(oe);
9421173
943
- if (!GroupEditor.allparams)
1174
+ namePanel = new cGridBag();
1175
+
1176
+ nameField = AddText(namePanel, copy.GetName());
1177
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
1178
+ oe.ctrlPanel.add(namePanel);
1179
+
1180
+ oe.ctrlPanel.Return();
1181
+
1182
+ if (!allparams)
9441183 return;
9451184
946
- liveCB = AddCheckBox(oe, "Live", copy.live);
947
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
948
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1185
+ setupPanel = new cGridBag().setVertical(false);
1186
+
1187
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1188
+ liveCB.setToolTipText("Animate object");
1189
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1190
+ selectCB.setToolTipText("Make object selectable");
9491191 // Return();
950
- markCB = AddCheckBox(oe, "Mark", copy.marked);
951
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
952
- randomCB = AddCheckBox(oe, "Rand", copy.random);
953
- Return();
954
- resetButton = AddButton(oe, "Reset");
955
- stepButton = AddButton(oe, "Step");
1192
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1193
+ hideCB.setToolTipText("Hide object");
1194
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1195
+ markCB.setToolTipText("As animation target transform");
1196
+
1197
+ setupPanel2 = new cGridBag().setVertical(false);
1198
+
1199
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1200
+ rewindCB.setToolTipText("Rewind animation");
1201
+
1202
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1203
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1204
+
1205
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1206
+ link2masterCB.setToolTipText("Attach to support");
1207
+
1208
+ if (Globals.ADVANCED)
1209
+ {
1210
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1211
+ speedupCB.setToolTipText("Option motion capture");
1212
+ }
1213
+
1214
+ oe.ctrlPanel.add(setupPanel);
1215
+ oe.ctrlPanel.Return();
1216
+ oe.ctrlPanel.add(setupPanel2);
1217
+ oe.ctrlPanel.Return();
1218
+
1219
+ objectCommandsPanel = new cGridBag().setVertical(false);
1220
+
1221
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1222
+ resetButton.setToolTipText("Jump to frame zero");
1223
+ stepButton = AddButton(objectCommandsPanel, "Step");
1224
+ stepButton.setToolTipText("Step one frame");
9561225 // resetAllButton = AddButton(oe, "Reset All");
9571226 // stepAllButton = AddButton(oe, "Step All");
958
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9591227 // Return();
960
- slowerButton = AddButton(oe, "Slow");
961
- fasterButton = AddButton(oe, "Fast");
962
- remarkButton = AddButton(oe, "Rem");
1228
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1229
+ slowerButton.setToolTipText("Decrease animation speed");
1230
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1231
+ fasterButton.setToolTipText("Increase animation speed");
1232
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1233
+ remarkButton.setToolTipText("Set the current transform as the target");
9631234
964
- Return();
1235
+ oe.ctrlPanel.add(objectCommandsPanel);
1236
+ oe.ctrlPanel.Return();
9651237
1238
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1239
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1240
+ //Return();
1241
+
1242
+ oe.ctrlPanel.Return();
1243
+
9661244 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9671245 // ObjEditor.aConstraints.gridx += 1;
9681246
....@@ -1056,7 +1334,7 @@
10561334 oe.aConstraints.gridwidth = 1;
10571335 /**/
10581336 nameField = AddText(oe.ctrlPanel, copy.GetName());
1059
- Return();
1337
+ oe.ctrlPanel.Return();
10601338
10611339 //ctrlPanel.add(textureButton = new Button("Texture..."));
10621340 //textureButton.setEnabled(false);
....@@ -1158,10 +1436,28 @@
11581436 //JPanel worldPanel =
11591437 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11601438 //worldPanel.setName("World");
1161
- /*JPanel*/ cameraPanel =
1162
- new JPanel(new BorderLayout());
1163
- cameraPanel.add(cameraView);
1439
+ centralPanel = new cGridBag();
1440
+ centralPanel.preferredWidth = 20;
1441
+
1442
+ if (Globals.ADVANCED)
1443
+ {
1444
+ timelinePanel = new JPanel(new BorderLayout());
1445
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11641446
1447
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1448
+ cameraPanel.setContinuousLayout(true);
1449
+ cameraPanel.setOneTouchExpandable(true);
1450
+// cameraPanel.setDividerLocation(0.9);
1451
+// cameraPanel.setDividerSize(9);
1452
+ cameraPanel.setResizeWeight(1.0);
1453
+
1454
+ }
1455
+
1456
+ centralPanel.add(cameraView);
1457
+ centralPanel.setFocusable(true);
1458
+ //frame.setJMenuBar(timelineMenubar);
1459
+ //centralPanel.add(timelinePanel);
1460
+
11651461 //topView.camera = ;
11661462 //frontView.camera = new Camera(2);
11671463 //sideView.camera = new Camera(3);
....@@ -1177,12 +1473,14 @@
11771473 //frontView.object = copy;
11781474 //sideView.object = copy;
11791475
1180
- XYZPanel = new JPanel();
1181
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1476
+ XYZPanel = new cGridBag().setVertical(true);
1477
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11821478
1183
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1184
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1185
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1479
+ XYZPanel.preferredWidth = 5;
1480
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1481
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1482
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1483
+ //XYZPanel.setName("XYZ");
11861484
11871485 /*
11881486 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1191,7 +1489,7 @@
11911489 gridPanel.add(cameraView);
11921490 gridPanel.add(XYZPanel);
11931491 */
1194
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout());
1492
+ gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
11951493 gridPanel.setContinuousLayout(true);
11961494 gridPanel.setOneTouchExpandable(true);
11971495 gridPanel.setDividerLocation(1.0);
....@@ -1220,11 +1518,23 @@
12201518 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12211519 //tmp.setName("Edit");
12221520 objectPanel.add(materialPanel);
1223
- JPanel north = new JPanel(new BorderLayout());
1224
- north.setName("Edit");
1225
- north.add(ctrlPanel, BorderLayout.NORTH);
1226
- objectPanel.add(north);
1227
- objectPanel.add(infoPanel);
1521
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1522
+// JPanel north = new JPanel(new BorderLayout());
1523
+// north.setName("Edit");
1524
+// north.add(ctrlPanel, BorderLayout.NORTH);
1525
+// objectPanel.add(north);
1526
+ objectPanel.add(editPanel);
1527
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1528
+
1529
+ //if (Globals.ADVANCED)
1530
+ objectPanel.add(infoPanel);
1531
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1532
+
1533
+ objectPanel.add(XYZPanel);
1534
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1535
+
1536
+ objectPanel.add(toolboxPanel);
1537
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
12281538
12291539 /*
12301540 aConstraints.gridx = 0;
....@@ -1233,7 +1543,7 @@
12331543 aConstraints.gridy += 1;
12341544 aConstraints.gridwidth = 1;
12351545 mainPanel.add(objectPanel, aConstraints);
1236
- */
1546
+ */
12371547
12381548 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12391549 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1244,16 +1554,23 @@
12441554 scrollpane.setWheelScrollingEnabled(true);
12451555 scrollpane.addMouseWheelListener(this); // Default not fast enough
12461556
1247
- /*JTabbedPane*/ jtp = new JTabbedPane();
1248
- jtp.add(scrollpane);
1557
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1558
+ scenePanel.preferredWidth = 5;
1559
+
1560
+ JTabbedPane tabbedPane = new JTabbedPane();
1561
+ tabbedPane.add(scrollpane);
12491562
1250
- jtp.add(FSPane = new cFileSystemPane(this));
1251
-
1252
- optionsPanel = new JPanel(new GridBagLayout());
1563
+ optionsPanel = new cGridBag().setVertical(false);
12531564
12541565 optionsPanel.setName("Options");
1255
- jtp.add(optionsPanel);
1566
+
1567
+ AddOptions(optionsPanel); //, aConstraints);
1568
+
1569
+ tabbedPane.add(optionsPanel);
1570
+
1571
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12561572
1573
+ scenePanel.add(tabbedPane);
12571574
12581575 /*
12591576 cTree jTree = new cTree(null);
....@@ -1275,7 +1592,7 @@
12751592 jtp.add(tree);
12761593 */
12771594
1278
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel);
1595
+ bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
12791596 bigPanel.setContinuousLayout(true);
12801597 bigPanel.setOneTouchExpandable(true);
12811598 bigPanel.setDividerLocation(0.8);
....@@ -1287,6 +1604,7 @@
12871604 //bigPanel.setSize(new Dimension(10,10));
12881605 //bigPanel.add(ctrlPanel);
12891606 //bigPanel.add(gridPanel);
1607
+ /**
12901608 bigThree = new JPanel();
12911609 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12921610 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1297,20 +1615,26 @@
12971615 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
12981616 aWindowConstraints.weightx = 0;
12991617 aWindowConstraints.weighty = 1;
1300
- bigThree.add(jtp, aWindowConstraints);
1618
+ bigThree.add(scenePanel, aWindowConstraints);
13011619 aWindowConstraints.weightx = 1;
13021620 aWindowConstraints.gridwidth = 3;
13031621 // aConstraints.gridheight = 3;
13041622 aWindowConstraints.gridx = 1;
13051623 aWindowConstraints.fill = GridBagConstraints.BOTH;
1306
- bigThree.add(cameraPanel, aWindowConstraints);
1624
+ bigThree.add(centralPanel, aWindowConstraints);
13071625 aWindowConstraints.weightx = 0;
13081626 aWindowConstraints.gridx = 4;
13091627 aWindowConstraints.gridwidth = 1;
13101628 // aConstraints.gridheight = 3;
13111629 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13121630 bigThree.add(XYZPanel, aWindowConstraints);
1631
+ /**/
13131632
1633
+ bigThree = new cGridBag();
1634
+ bigThree.addComponent(scenePanel);
1635
+ bigThree.addComponent(centralPanel);
1636
+ //bigThree.addComponent(XYZPanel);
1637
+
13141638 // // SIDE EFFECT!!!
13151639 // aConstraints.gridx = 0;
13161640 // aConstraints.gridy = 0;
....@@ -1318,9 +1642,9 @@
13181642 // aConstraints.gridheight = 1;
13191643
13201644 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1321
- framePanel.setContinuousLayout(true);
1322
- framePanel.setOneTouchExpandable(true);
1323
- framePanel.setDividerLocation(0.8);
1645
+ framePanel.setContinuousLayout(false);
1646
+ framePanel.setOneTouchExpandable(false);
1647
+ //.setDividerLocation(0.8);
13241648 //framePanel.setDividerSize(15);
13251649 //framePanel.setResizeWeight(0.15);
13261650 framePanel.setName("Frame");
....@@ -1331,15 +1655,21 @@
13311655 //worldPane.add(bigPanel);
13321656 //worldPane.add(worldPanel);
13331657 /**/
1334
- frame.getContentPane().add(/*"Center",*/framePanel);
1658
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1659
+ frame.add(/*"Center",*/framePanel);
13351660 //frame.getContentPane().add(/*"Center",*/ worldPane);
13361661
13371662 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13381663
1339
- frame.setSize(1024, 768);
1340
- frame.show();
1341
-
1664
+ frame.setSize(1280, 860);
1665
+
1666
+ cameraView.requestFocusInWindow();
1667
+
13421668 gridPanel.setDividerLocation(1.0);
1669
+
1670
+ frame.validate();
1671
+
1672
+ frame.setVisible(true);
13431673
13441674 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13451675 frame.addWindowListener(new WindowAdapter()
....@@ -1352,6 +1682,10 @@
13521682 });
13531683 }
13541684
1685
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1686
+ {
1687
+ }
1688
+
13551689 JTree GetTree()
13561690 {
13571691 return objEditor.jTree;
....@@ -1363,260 +1697,161 @@
13631697 ctrlPanel.removeAll();
13641698 }
13651699
1366
- void SetupMaterial(JPanel ctrlPanel)
1700
+ void SetupMaterial(cGridBag panel)
13671701 {
1368
- aConstraints.weighty = 0;
1369
- //aConstraints.weightx = 1;
1370
- /*
1702
+ /*
13711703 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13721704 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1373
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1374
- aConstraints.gridx += 1;
13751705 */
13761706
1377
- aConstraints.gridwidth = 1;
1378
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1379
- aConstraints.gridx += 1;
1380
- aConstraints.weighty = 0;
1381
- aConstraints.gridwidth = 1;
1707
+ cGridBag editBar = new cGridBag().setVertical(false);
1708
+
1709
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1710
+ createMaterialButton.setToolTipText("Create material");
13821711
13831712 /*
13841713 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- aConstraints.gridwidth = 1;
13881714 */
13891715
1390
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1391
- aConstraints.gridx += 1;
1716
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1717
+ clearMaterialButton.setToolTipText("Clear material");
1718
+
1719
+ if (Globals.ADVANCED)
1720
+ {
1721
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1722
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1723
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1724
+ }
13921725
1393
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1394
-
1395
- aConstraints.gridx += 1;
1396
-
1397
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1398
-
1399
- aConstraints.gridx += 1;
1400
-
1401
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1402
-
1403
- aConstraints.gridx = 0;
1404
- aConstraints.gridy += 1;
1405
- aConstraints.weighty = 0;
1406
- aConstraints.gridwidth = 1;
1726
+ editBar.preferredHeight = 15;
1727
+
1728
+ panel.add(editBar);
1729
+
14071730 /**/
14081731 //aConstraints.weighty = 0;
14091732 ////aConstraints.weightx = 1;
14101733 //aConstraints.weighty = 1;
14111734 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14121735 //aConstraints.gridx += 1;
1413
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1414
- aConstraints.weighty = 0;
1415
- aConstraints.gridx = 0;
1416
- aConstraints.gridy += 1;
1417
- aConstraints.gridwidth = 1;
1736
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14181737
1419
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1420
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1421
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1422
- aConstraints.gridx += 1;
1423
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1424
- //aConstraints.weightx = 0;
1425
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1426
- aConstraints.gridx = 0;
1427
- aConstraints.gridy += 1;
1428
- aConstraints.gridwidth = 1;
1738
+ cGridBag colorSection = new cGridBag().setVertical(true);
1739
+
1740
+ cGridBag color = new cGridBag();
1741
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1742
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1743
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1744
+ //colorField.preferredWidth = 200;
1745
+ colorSection.add(color);
14291746
1430
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1431
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1432
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1433
- aConstraints.gridx += 1;
1434
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1435
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1436
- aConstraints.gridx = 0;
1437
- aConstraints.gridy += 1;
1438
- aConstraints.gridwidth = 1;
1747
+ cGridBag modulation = new cGridBag();
1748
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1749
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1750
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1751
+ colorSection.add(modulation);
14391752
1440
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1441
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1442
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1443
- aConstraints.gridx += 1;
1444
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1445
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1446
- aConstraints.gridx = 0;
1447
- aConstraints.gridy += 1;
1448
- aConstraints.gridwidth = 1;
1753
+ cGridBag texture = new cGridBag();
1754
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1755
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1756
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1757
+ colorSection.add(texture);
14491758
1450
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1451
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1452
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1453
- aConstraints.gridx += 1;
1454
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1455
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1456
- aConstraints.gridx = 0;
1457
- aConstraints.gridy += 1;
1458
- aConstraints.gridwidth = 1;
1759
+ panel.add(new JSeparator());
1760
+
1761
+ panel.add(colorSection);
1762
+
1763
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1764
+
1765
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1766
+
1767
+ cGridBag diffuse = new cGridBag();
1768
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1769
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1770
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1771
+ diffuseSection.add(diffuse);
14591772
1460
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1461
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1462
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1463
- aConstraints.gridx += 1;
1464
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1465
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1466
- aConstraints.gridx = 0;
1467
- aConstraints.gridy += 1;
1468
- aConstraints.gridwidth = 1;
1773
+ cGridBag diffuseness = new cGridBag();
1774
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1775
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1776
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1777
+ diffuseSection.add(diffuseness);
14691778
1470
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1471
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1472
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1473
- aConstraints.gridx += 1;
1474
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1475
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1476
- aConstraints.gridx = 0;
1477
- aConstraints.gridy += 1;
1478
- aConstraints.gridwidth = 1;
1779
+ cGridBag selfshadow = new cGridBag();
1780
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1781
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1782
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1783
+ diffuseSection.add(selfshadow);
14791784
1480
- //aConstraints.weighty = 1;
1481
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1482
- //aConstraints.gridx += 1;
1483
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1484
- aConstraints.weighty = 0;
1485
- aConstraints.gridx = 0;
1486
- aConstraints.gridy += 1;
1487
- aConstraints.gridwidth = 1;
1785
+ cGridBag sheen = new cGridBag();
1786
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1787
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1788
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1789
+ diffuseSection.add(sheen);
14881790
1489
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1490
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1492
- aConstraints.gridx += 1;
1493
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1494
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1495
- aConstraints.gridx = 0;
1496
- aConstraints.gridy += 1;
1497
- aConstraints.gridwidth = 1;
1791
+ cGridBag subsurface = new cGridBag();
1792
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1793
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1794
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1795
+ diffuseSection.add(subsurface);
14981796
1499
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1500
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1501
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1502
- aConstraints.gridx += 1;
1503
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1504
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1505
- aConstraints.gridx = 0;
1506
- aConstraints.gridy += 1;
1507
- aConstraints.gridwidth = 1;
1797
+ cGridBag shadow = new cGridBag();
1798
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1799
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1800
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1801
+ diffuseSection.add(shadow);
15081802
1509
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1510
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1511
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1512
- aConstraints.gridx += 1;
1513
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1514
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1515
- aConstraints.gridx = 0;
1516
- aConstraints.gridy += 1;
1517
- aConstraints.gridwidth = 1;
1803
+ cGridBag fakedepth = new cGridBag();
1804
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1805
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1806
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1807
+ diffuseSection.add(fakedepth);
15181808
1519
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1520
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1521
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1522
- aConstraints.gridx += 1;
1523
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1524
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1525
- aConstraints.gridx = 0;
1526
- aConstraints.gridy += 1;
1527
- aConstraints.gridwidth = 1;
1809
+ cGridBag shadowbias = new cGridBag();
1810
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1811
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1812
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1813
+ diffuseSection.add(shadowbias);
15281814
1529
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1530
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1531
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1532
- aConstraints.gridx += 1;
1533
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1534
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1535
- aConstraints.gridx = 0;
1536
- aConstraints.gridy += 1;
1537
- aConstraints.gridwidth = 1;
1815
+ panel.add(new JSeparator());
1816
+
1817
+ panel.add(diffuseSection);
1818
+
1819
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1820
+
1821
+ cGridBag specularSection = new cGridBag().setVertical(true);
15381822
1539
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1540
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1541
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1542
- aConstraints.gridx += 1;
1543
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1544
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1545
- aConstraints.gridx = 0;
1546
- aConstraints.gridy += 1;
1547
- aConstraints.gridwidth = 1;
1823
+ cGridBag specular = new cGridBag();
1824
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1825
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1826
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1827
+ specularSection.add(specular);
15481828
1549
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1550
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1551
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1552
- aConstraints.gridx += 1;
1553
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1554
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1555
- aConstraints.gridx = 0;
1556
- aConstraints.gridy += 1;
1557
- aConstraints.gridwidth = 1;
1829
+ cGridBag lightarea = new cGridBag();
1830
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1831
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1832
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1833
+ specularSection.add(lightarea);
15581834
1559
- //aConstraints.weighty = 1;
1560
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1561
- //aConstraints.gridx += 1;
1562
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1563
- aConstraints.weighty = 0;
1564
- aConstraints.gridx = 0;
1565
- aConstraints.gridy += 1;
1566
- aConstraints.gridwidth = 1;
1835
+ cGridBag shininess = new cGridBag();
1836
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1837
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1838
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1839
+ specularSection.add(shininess);
15671840
1568
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1569
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1570
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1571
- aConstraints.gridx += 1;
1572
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1573
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1574
- aConstraints.gridx = 0;
1575
- aConstraints.gridy += 1;
1576
- aConstraints.gridwidth = 1;
1841
+ cGridBag metalness = new cGridBag();
1842
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1843
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1844
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1845
+ specularSection.add(metalness);
15771846
1578
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1579
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1580
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1581
- aConstraints.gridx += 1;
1582
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1583
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1584
- aConstraints.gridx = 0;
1585
- aConstraints.gridy += 1;
1586
- aConstraints.gridwidth = 1;
1847
+ cGridBag velvet = new cGridBag();
1848
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1849
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1850
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1851
+ specularSection.add(velvet);
15871852
1588
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1589
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1590
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1591
- aConstraints.gridx += 1;
1592
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1593
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1594
- aConstraints.gridx = 0;
1595
- aConstraints.gridy += 1;
1596
- aConstraints.gridwidth = 1;
1597
-
1598
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1599
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1600
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1601
- aConstraints.gridx += 1;
1602
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1603
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1604
- aConstraints.gridx = 0;
1605
- aConstraints.gridy += 1;
1606
- aConstraints.gridwidth = 1;
1607
-
1608
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1609
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1610
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1611
- aConstraints.gridx += 1;
1612
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1613
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1614
- aConstraints.gridx = 0;
1615
- aConstraints.gridy += 1;
1616
- aConstraints.gridwidth = 1;
1617
-
1618
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1619
- Return();
1853
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1854
+ //Return();
16201855 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16211856 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16221857 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1627,130 +1862,105 @@
16271862 // aConstraints.gridy += 1;
16281863 // aConstraints.gridwidth = 1;
16291864
1630
- //aConstraints.weighty = 1;
1631
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1632
- //aConstraints.gridx += 1;
1633
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1634
- aConstraints.weighty = 0;
1635
- aConstraints.gridx = 0;
1636
- aConstraints.gridy += 1;
1637
- aConstraints.gridwidth = 1;
1865
+ cGridBag anisoU = new cGridBag();
1866
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1867
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1868
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1869
+ specularSection.add(anisoU);
16381870
1639
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1640
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1641
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1642
- aConstraints.gridx += 1;
1643
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1644
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1645
- aConstraints.gridx = 0;
1646
- aConstraints.gridy += 1;
1647
- aConstraints.gridwidth = 1;
1871
+ cGridBag anisoV = new cGridBag();
1872
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1873
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1874
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1875
+ specularSection.add(anisoV);
16481876
1649
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1650
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1651
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1652
- aConstraints.gridx += 1;
1653
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1654
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1655
- aConstraints.gridx = 0;
1656
- aConstraints.gridy += 1;
1657
- aConstraints.gridwidth = 1;
16581877
1659
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1660
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1661
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1662
- aConstraints.gridx += 1;
1663
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1664
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1665
- aConstraints.gridx = 0;
1666
- aConstraints.gridy += 1;
1667
- aConstraints.gridwidth = 1;
1878
+ panel.add(new JSeparator());
1879
+
1880
+ panel.add(specularSection);
1881
+
1882
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1883
+
1884
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16681885
1669
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1670
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1671
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1672
- aConstraints.gridx += 1;
1673
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1674
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1675
- aConstraints.gridx = 0;
1676
- aConstraints.gridy += 1;
1677
- aConstraints.gridwidth = 1;
1678
- aConstraints.weighty = 0;
1886
+ cGridBag camera = new cGridBag();
1887
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1888
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1889
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1890
+ colorSection.add(camera);
16791891
1680
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1681
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1683
- aConstraints.gridx += 1;
1684
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1685
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1686
- aConstraints.gridx = 0;
1687
- aConstraints.gridy += 1;
1688
- aConstraints.gridwidth = 1;
1892
+ cGridBag ambient = new cGridBag();
1893
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1894
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1895
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1896
+ colorSection.add(ambient);
16891897
1690
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1691
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1692
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1693
- aConstraints.gridx += 1;
1694
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1695
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1696
- aConstraints.gridx = 0;
1697
- aConstraints.gridy += 1;
1698
- aConstraints.gridwidth = 1;
1898
+ cGridBag backlit = new cGridBag();
1899
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1900
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1901
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1902
+ colorSection.add(backlit);
16991903
1700
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1701
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1702
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1703
- aConstraints.gridx += 1;
1704
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1705
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1706
- aConstraints.gridx = 0;
1707
- aConstraints.gridy += 1;
1708
- aConstraints.gridwidth = 1;
1904
+ cGridBag opacity = new cGridBag();
1905
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1906
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1907
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1908
+ colorSection.add(opacity);
17091909
1710
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1711
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1712
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1713
- aConstraints.gridx += 1;
1714
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1715
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1716
- aConstraints.gridx = 0;
1717
- aConstraints.gridy += 1;
1718
- aConstraints.gridwidth = 1;
1910
+ //panel.add(new JSeparator());
1911
+
1912
+ //panel.add(globalSection);
1913
+
1914
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1915
+
1916
+ cGridBag textureSection = new cGridBag().setVertical(true);
17191917
1720
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1721
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1722
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1723
- aConstraints.gridx += 1;
1724
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1725
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1726
- aConstraints.gridx = 0;
1727
- aConstraints.gridy += 1;
1728
- aConstraints.gridwidth = 1;
1918
+ cGridBag bump = new cGridBag();
1919
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1920
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1921
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1922
+ textureSection.add(bump);
17291923
1730
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1731
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1732
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1733
- aConstraints.gridx += 1;
1734
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1735
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1736
- aConstraints.gridx = 0;
1737
- aConstraints.gridy += 1;
1738
- aConstraints.gridwidth = 1;
1924
+ cGridBag noise = new cGridBag();
1925
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1926
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1927
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1928
+ textureSection.add(noise);
17391929
1740
- //aConstraints.weighty = 1;
1741
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1742
- //aConstraints.gridx += 1;
1743
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1744
- aConstraints.weighty = 0;
1930
+ cGridBag power = new cGridBag();
1931
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1932
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1933
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1934
+ textureSection.add(power);
17451935
1746
- aConstraints.gridx = 0;
1747
- aConstraints.gridy = 0;
1748
- aConstraints.gridwidth = 1;
1936
+ cGridBag borderfade = new cGridBag();
1937
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1938
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1939
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1940
+ textureSection.add(borderfade);
1941
+
1942
+ cGridBag fog = new cGridBag();
1943
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1944
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1945
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1946
+ textureSection.add(fog);
1947
+
1948
+ cGridBag opacityPower = new cGridBag();
1949
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1950
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1951
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1952
+ textureSection.add(opacityPower);
1953
+
1954
+ panel.add(new JSeparator());
1955
+
1956
+ panel.add(textureSection);
1957
+
1958
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17491959
17501960 SetMaterial(copy); // .GetMaterial());
17511961
1752
- colorField.addChangeListener(this);
1753
- modulationField.addChangeListener(this);
1962
+ //colorField.addChangeListener(this);
1963
+// modulationField.addChangeListener(this);
17541964 metalnessField.addChangeListener(this);
17551965 diffuseField.addChangeListener(this);
17561966 specularField.addChangeListener(this);
....@@ -1780,12 +1990,15 @@
17801990 opacityPowerField.addChangeListener(this);
17811991 /**/
17821992
1783
- resetSlidersButton.addActionListener(this);
17841993 clearMaterialButton.addActionListener(this);
17851994 createMaterialButton.addActionListener(this);
1786
-
1787
- propagateToggle.addItemListener(this);
1788
- multiplyToggle.addItemListener(this);
1995
+
1996
+ if (Globals.ADVANCED)
1997
+ {
1998
+ resetSlidersButton.addActionListener(this);
1999
+ propagateToggle.addItemListener(this);
2000
+ multiplyToggle.addItemListener(this);
2001
+ }
17892002 }
17902003
17912004 void DropFile(java.io.File[] files, boolean textures)
....@@ -1803,8 +2016,9 @@
18032016 // 3D models
18042017 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18052018 {
1806
- lastConverter = new com.jmex.model.converters.MaxToJme();
1807
- LoadFile(filename, lastConverter);
2019
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2020
+ //LoadFile(filename, lastConverter);
2021
+ LoadObjFile(filename); // New 3ds loader
18082022 continue;
18092023 }
18102024 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1956,7 +2170,7 @@
19562170
19572171 //? flashIt = false;
19582172 CameraPane pane = (CameraPane) cameraView;
1959
- pane.clickStart(location.x, location.y, 0);
2173
+ pane.clickStart(location.x, location.y, 0, 0);
19602174 pane.clickEnd(location.x, location.y, 0, true);
19612175
19622176 if (group.selection.size() == 1)
....@@ -2005,6 +2219,7 @@
20052219 e2.printStackTrace();
20062220 }
20072221 }
2222
+
20082223 LoadJMEThread loadThread;
20092224
20102225 class LoadJMEThread extends Thread
....@@ -2062,6 +2277,7 @@
20622277 //LoadFile0(filename, converter);
20632278 }
20642279 }
2280
+
20652281 LoadOBJThread loadObjThread;
20662282
20672283 class LoadOBJThread extends Thread
....@@ -2140,19 +2356,19 @@
21402356
21412357 void LoadObjFile(String fullname)
21422358 {
2143
- /*
2359
+ System.out.println("Loading " + fullname);
2360
+ /**/
21442361 //lastFilename = fullname;
21452362 if(loadObjThread == null)
21462363 {
2147
- loadObjThread = new LoadOBJThread();
2148
- loadObjThread.start();
2364
+ loadObjThread = new LoadOBJThread();
2365
+ loadObjThread.start();
21492366 }
21502367
21512368 loadObjThread.add(fullname);
2152
- */
2369
+ /**/
21532370
2154
- System.out.println("Loading " + fullname);
2155
- makeSomething(new FileObject(fullname, true), true);
2371
+ //makeSomething(new FileObject(fullname, true), true);
21562372 }
21572373
21582374 void LoadGFDFile(String fullname)
....@@ -2194,6 +2410,8 @@
21942410 {
21952411 Mocap sel = (Mocap) copy.selection.get(0);
21962412
2413
+ sel.SetCurrentBones(sel.frame);
2414
+
21972415 sel.fullname = fullname;
21982416
21992417 if (changename)
....@@ -2245,6 +2463,8 @@
22452463 {
22462464 Mocap sel = (Mocap) select;
22472465
2466
+ sel.SetCurrentBones(sel.frame);
2467
+
22482468 File file = new File(fullname);
22492469
22502470 // Mocap mocap = new Mocap("Mocap" + file.getName());
....@@ -2409,11 +2629,11 @@
24092629
24102630 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24112631 {
2412
- if (GrafreeD.standAlone)
2632
+ if (Grafreed.standAlone)
24132633 {
24142634 /**/
24152635 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2416
- browser.show();
2636
+ browser.setVisible(true);
24172637 String filename = browser.getFile();
24182638 if (filename != null && filename.length() > 0)
24192639 {
....@@ -2524,6 +2744,7 @@
25242744 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25252745 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25262746 }
2747
+
25272748 //cJME.count++;
25282749 //cJME.count %= 12;
25292750 if (gc)
....@@ -2558,6 +2779,7 @@
25582779 }
25592780 if (input == null)
25602781 {
2782
+ new Exception().printStackTrace();
25612783 System.exit(0);
25622784 }
25632785
....@@ -2706,6 +2928,7 @@
27062928 }
27072929 }
27082930 }
2931
+
27092932 cFileSystemPane FSPane;
27102933
27112934 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2759,11 +2982,14 @@
27592982 }
27602983 }
27612984 }
2985
+
27622986 freezematerial = false;
27632987 }
27642988
27652989 void SetMaterial(Object3D object)
27662990 {
2991
+ latestObject = object;
2992
+
27672993 cMaterial mat = object.material;
27682994
27692995 if (mat == null)
....@@ -2772,7 +2998,8 @@
27722998 return;
27732999 }
27743000
2775
- multiplyToggle.setSelected(mat.multiply);
3001
+ if (multiplyToggle != null)
3002
+ multiplyToggle.setSelected(mat.multiply);
27763003
27773004 assert (object.projectedVertices != null);
27783005
....@@ -2874,12 +3101,17 @@
28743101 // }
28753102
28763103 /**/
2877
- if (deselect)
3104
+ if (deselect || child == null)
28783105 {
28793106 //group.deselectAll();
28803107 //freeze = true;
28813108 GetTree().clearSelection();
28823109 //freeze = false;
3110
+
3111
+ if (child == null)
3112
+ {
3113
+ return;
3114
+ }
28833115 }
28843116
28853117 //group.addSelectee(child);
....@@ -2948,31 +3180,48 @@
29483180 cameraView.ToggleDL();
29493181 cameraView.repaint();
29503182 return;
2951
- } else if (event.getSource() == toggleTextureItem)
3183
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29523184 {
29533185 cameraView.ToggleTexture();
29543186 // june 2013 copy.HardTouch();
29553187 cameraView.repaint();
29563188 return;
2957
- } else if (event.getSource() == toggleFullItem)
3189
+ } else if (event.getSource() == toggleTimelineItem)
29583190 {
2959
- if (CameraPane.FULLSCREEN)
3191
+ timeline ^= true;
3192
+
3193
+ if (timeline)
29603194 {
2961
- frame.getContentPane().remove(/*"Center",*/bigThree);
2962
- framePanel.add(bigThree);
2963
- frame.getContentPane().add(/*"Center",*/framePanel);
2964
- } else
2965
- {
2966
- frame.getContentPane().remove(/*"Center",*/framePanel);
2967
- frame.getContentPane().add(/*"Center",*/bigThree);
3195
+ centralPanel.remove(cameraView);
3196
+ cameraPanel.add(cameraView);
3197
+ centralPanel.add(cameraPanel);
3198
+ frame.setJMenuBar(timelineMenubar);
3199
+ wasFullScreen = CameraPane.FULLSCREEN;
3200
+ if (!CameraPane.FULLSCREEN)
3201
+ ToggleFullScreen();
3202
+ toggleFullScreenItem.setEnabled(false);
29683203 }
3204
+ else
3205
+ {
3206
+ centralPanel.remove(cameraPanel);
3207
+ centralPanel.add(cameraView);
3208
+ frame.setJMenuBar(null);
3209
+ if (!wasFullScreen)
3210
+ ToggleFullScreen();
3211
+ toggleFullScreenItem.setEnabled(true);
3212
+ }
3213
+
29693214 frame.validate();
2970
- cameraView.ToggleFullScreen();
3215
+ return;
3216
+ } else if (event.getSource() == toggleFullScreenItem)
3217
+ {
3218
+ ToggleFullScreen();
3219
+ frame.validate();
29713220
29723221 return;
2973
- } else if (event.getSource() == toggleRandomItem)
3222
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
29743223 {
2975
- cameraView.ToggleRandom();
3224
+ cameraView.ToggleSwitch();
29763225 cameraView.repaint();
29773226 return;
29783227 } else if (event.getSource() == toggleHandleItem)
....@@ -3001,6 +3250,10 @@
30013250 {
30023251 copy.live ^= true;
30033252 return;
3253
+ } else if (event.getSource() == selectCB)
3254
+ {
3255
+ copy.dontselect ^= true;
3256
+ return;
30043257 } else if (event.getSource() == hideCB)
30053258 {
30063259 copy.hide ^= true;
....@@ -3015,6 +3268,7 @@
30153268 if (event.getSource() == randomCB)
30163269 {
30173270 copy.random ^= true;
3271
+ objEditor.refreshContents();
30183272 return;
30193273 }
30203274 if (event.getSource() == speedupCB)
....@@ -3038,8 +3292,9 @@
30383292
30393293 public void actionPerformed(ActionEvent event)
30403294 {
3295
+ Object source = event.getSource();
30413296 // SCRIPT DIALOG
3042
- if (event.getSource() == okbutton)
3297
+ if (source == okbutton)
30433298 {
30443299 textpanel.setVisible(false);
30453300 textpanel.remove(textarea);
....@@ -3051,7 +3306,7 @@
30513306 textarea = null;
30523307 textpanel = null;
30533308 }
3054
- if (event.getSource() == cancelbutton)
3309
+ if (source == cancelbutton)
30553310 {
30563311 textpanel.setVisible(false);
30573312 textpanel.remove(textarea);
....@@ -3063,49 +3318,50 @@
30633318 //applySelf();
30643319 //client.refreshEditWindow();
30653320 //refreshContents();
3066
- if (event.getSource() == nameField)
3321
+ if (source == nameField)
30673322 {
30683323 //System.out.println("ObjEditor " + event);
30693324 applySelf0(true);
30703325 //parent.applySelf();
30713326 objEditor.refreshContents();
3072
- } else if (event.getSource() == resetButton)
3327
+ } else if (source == resetButton)
30733328 {
30743329 CameraPane.fullreset = true;
30753330 copy.Reset(); // ResetMeshes();
30763331 copy.Touch();
30773332 objEditor.refreshContents();
3078
- } else if (event.getSource() == stepItem)
3333
+ } else if (source == stepItem)
30793334 {
3080
- cameraView.ONESTEP = true;
3335
+ //cameraView.ONESTEP = true;
3336
+ Globals.ONESTEP = true;
30813337 cameraView.repaint();
30823338 return;
3083
- } else if (event.getSource() == stepButton)
3339
+ } else if (source == stepButton)
30843340 {
30853341 copy.Step();
30863342 copy.Touch();
30873343 objEditor.refreshContents();
3088
- } else if (event.getSource() == slowerButton)
3344
+ } else if (source == slowerButton)
30893345 {
30903346 copy.Slower();
30913347 copy.Touch();
30923348 objEditor.refreshContents();
3093
- } else if (event.getSource() == fasterButton)
3349
+ } else if (source == fasterButton)
30943350 {
30953351 copy.Faster();
30963352 copy.Touch();
30973353 objEditor.refreshContents();
3098
- } else if (event.getSource() == remarkButton)
3354
+ } else if (source == remarkButton)
30993355 {
31003356 copy.Remark();
31013357 copy.Touch();
31023358 objEditor.refreshContents();
3103
- } else if (event.getSource() == stepAllButton)
3359
+ } else if (source == stepAllButton)
31043360 {
31053361 copy.StepAll();
31063362 copy.Touch();
31073363 objEditor.refreshContents();
3108
- } else if (event.getSource() == resetAllButton)
3364
+ } else if (source == resetAllButton)
31093365 {
31103366 //CameraPane.fullreset = true;
31113367 copy.ResetAll(); // ResetMeshes();
....@@ -3138,53 +3394,79 @@
31383394 // Close();
31393395 // }
31403396 // else
3141
- if (event.getSource() == resetSlidersButton)
3397
+ if (source == resetSlidersButton)
31423398 {
31433399 ResetSliders();
3144
- } else if (event.getSource() == clearMaterialButton)
3400
+ } else if (source == clearMaterialButton)
31453401 {
31463402 ClearMaterial();
3147
- } else if (event.getSource() == createMaterialButton)
3403
+ } else if (source == createMaterialButton)
31483404 {
31493405 CreateMaterial();
3150
- } else if (event.getSource() == clearPanelButton)
3406
+ } else if (source == clearPanelButton)
31513407 {
31523408 copy.ClearUI();
31533409 refreshContents(true);
3154
- } /*
3155
- }
3156
-
3157
- public boolean action(Event event, Object arg)
3158
- {
3159
- */ else if (event.getSource() == closeItem)
3410
+ } else if (source == importGFDItem)
3411
+ {
3412
+ ImportGFD();
3413
+ } else
3414
+ if (source == importVRMLX3DItem)
3415
+ {
3416
+ ImportVRMLX3D();
3417
+ } else
3418
+ if (source == import3DSItem)
3419
+ {
3420
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3421
+ } else
3422
+ if (source == importOBJItem)
3423
+ {
3424
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3425
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3426
+ browser.setVisible(true);
3427
+ String filename = browser.getFile();
3428
+ if (filename != null && filename.length() > 0)
3429
+ {
3430
+ String fullname = browser.getDirectory() + filename;
3431
+ makeSomething(ReadOBJ(fullname), true);
3432
+ }
3433
+ } else
3434
+ if (source == closeItem)
31603435 {
31613436 Close();
31623437 //return true;
3163
- } else if (event.getSource() == loadItem)
3438
+ } else if (source == openItem)
31643439 {
3165
- load();
3440
+ Open();
31663441 //return true;
3167
- } else if (event.getSource() == saveItem)
3442
+ } else if (source == newItem)
3443
+ {
3444
+ New();
3445
+ } else if (source == saveItem)
31683446 {
31693447 save();
31703448 //return true;
3171
- } else if (event.getSource() == saveAsItem)
3449
+ } else if (source == saveAsItem)
31723450 {
31733451 saveAs();
31743452 //return true;
3175
- } else if (event.getSource() == reexportItem)
3453
+ } else if (source == reexportItem)
31763454 {
31773455 reexport();
31783456 //return true;
3179
- } else if (event.getSource() == exportAsItem)
3457
+ } else if (source == exportAsItem)
31803458 {
31813459 export();
31823460 //return true;
3183
- } else if (event.getSource() == povItem)
3461
+ } else if (source == povItem)
31843462 {
31853463 generatePOV();
31863464 //return true;
3187
- } else if (event.getSource() == zBufferItem)
3465
+ } else if (event.getSource() == archiveItem)
3466
+ {
3467
+ cTools.Archive(frame);
3468
+ return;
3469
+ } else if (source == zBufferItem)
31883470 {
31893471 try
31903472 {
....@@ -3206,21 +3488,8 @@
32063488 cameraView.repaint();
32073489 //return true;
32083490 }
3209
- */ else if (event.getSource() == editCameraItem)
3210
- {
3211
- cameraView.ProtectCamera();
3212
- cameraView.repaint();
3213
- return;
3214
- } else if (event.getSource() == revertCameraItem)
3215
- {
3216
- cameraView.RevertCamera();
3217
- cameraView.repaint();
3218
- return;
3219
- } else if (event.getSource() == textureButton)
3220
- {
3221
- return; // true;
3222
- } else // combos...
3223
- if (event.getSource() == texresMenu)
3491
+ */ else // combos...
3492
+ if (source == texresMenu)
32243493 {
32253494 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32263495 copy.texres = texresMenu.getSelectedIndex();
....@@ -3232,27 +3501,424 @@
32323501 }
32333502 }
32343503
3235
- void ToggleAnimation()
3504
+ void New()
32363505 {
3237
- if (!CameraPane.ANIMATION)
3506
+ while (copy.Size() > 1)
32383507 {
3239
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3508
+ copy.remove(1);
3509
+ }
3510
+
3511
+ ResetModel();
3512
+ objEditor.refreshContents();
3513
+ }
3514
+
3515
+ static public byte[] Compress(Object3D o)
3516
+ {
3517
+ try
3518
+ {
3519
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3520
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3521
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
3522
+
3523
+ Object3D parent = o.parent;
3524
+ o.parent = null;
3525
+
3526
+ out.writeObject(o);
3527
+
3528
+ o.parent = parent;
3529
+
3530
+ out.flush();
3531
+
3532
+ baos //zstream
3533
+ .close();
3534
+ out.close();
3535
+
3536
+ byte[] bytes = baos.toByteArray();
3537
+
3538
+ System.out.println("save #bytes = " + bytes.length);
3539
+ return bytes;
3540
+ } catch (Exception e)
3541
+ {
3542
+ System.err.println(e);
3543
+ return null;
3544
+ }
3545
+ }
3546
+
3547
+ static public Object Uncompress(byte[] bytes)
3548
+ {
3549
+ System.out.println("restore #bytes = " + bytes.length);
3550
+ try
3551
+ {
3552
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3553
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3554
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
3555
+ Object obj = in.readObject();
3556
+
3557
+ bais //istream
3558
+ .close();
3559
+ in.close();
3560
+
3561
+ return obj;
3562
+ } catch (Exception e)
3563
+ {
3564
+ System.err.println(e);
3565
+ return null;
3566
+ }
3567
+ }
3568
+
3569
+ static public Object clone(Object o)
3570
+ {
3571
+ try
3572
+ {
3573
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3574
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3575
+
3576
+ out.writeObject(o);
3577
+
3578
+ out.flush();
3579
+ out.close();
3580
+
3581
+ byte[] bytes = baos.toByteArray();
3582
+
3583
+ System.out.println("clone = " + bytes.length);
3584
+
3585
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3586
+ ObjectInputStream in = new ObjectInputStream(bais);
3587
+ Object obj = in.readObject();
3588
+ in.close();
3589
+
3590
+ return obj;
3591
+ } catch (Exception e)
3592
+ {
3593
+ System.err.println(e);
3594
+ return null;
3595
+ }
3596
+ }
3597
+
3598
+ cRadio GetCurrentTab()
3599
+ {
3600
+ cRadio ab;
3601
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3602
+ {
3603
+ ab = (cRadio)e.nextElement();
3604
+ if(ab.GetObject() == copy)
3605
+ {
3606
+ return ab;
3607
+ }
3608
+ }
3609
+
3610
+ return null;
3611
+ }
3612
+
3613
+
3614
+ public void Save()
3615
+ {
3616
+ //Save(true);
3617
+ Replace();
3618
+ }
3619
+
3620
+ private boolean Equal(byte[] compress, byte[] name)
3621
+ {
3622
+ if (compress.length != name.length)
3623
+ {
3624
+ return false;
3625
+ }
3626
+
3627
+ for (int i=compress.length; --i>=0;)
3628
+ {
3629
+ if (compress[i] != name[i])
3630
+ return false;
3631
+ }
3632
+
3633
+ return true;
3634
+ }
3635
+
3636
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3637
+
3638
+ public boolean Save(boolean user)
3639
+ {
3640
+ System.err.println("Save");
3641
+
3642
+ cRadio tab = GetCurrentTab();
3643
+
3644
+ byte[] compress = CompressCopy();
3645
+
3646
+ boolean thesame = false;
3647
+
3648
+ // Quick heuristic using length. Works only when stream is compressed.
3649
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3650
+ {
3651
+ thesame = true;
3652
+ }
3653
+
3654
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3655
+ if (!thesame)
3656
+ {
3657
+ //tab.user[tab.versionindex] = user;
3658
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3659
+
3660
+ copy.versions[++copy.versionindex] = compress;
3661
+
3662
+ // if (increment)
3663
+ // tab.versionindex++;
3664
+ }
3665
+
3666
+ //copy.RestoreBigData(versiontable);
3667
+
3668
+ //assert(hashtable.isEmpty());
3669
+
3670
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3671
+ {
3672
+ //tab.user[i] = false;
3673
+ copy.versions[i] = null;
3674
+ }
3675
+
3676
+ SetUndoStates();
3677
+
3678
+ // test save
3679
+ if (false)
3680
+ {
3681
+ try
3682
+ {
3683
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
3684
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3685
+
3686
+ p.writeObject(copy);
3687
+
3688
+ p.flush();
3689
+
3690
+ ostream.close();
3691
+ } catch (Exception e)
3692
+ {
3693
+ e.printStackTrace();
3694
+ }
3695
+ }
3696
+
3697
+ return !thesame;
3698
+ }
3699
+
3700
+ void CopyChanged(Object3D obj)
3701
+ {
3702
+ SetUndoStates();
3703
+
3704
+ boolean temp = CameraPane.SWITCH;
3705
+ CameraPane.SWITCH = false;
3706
+
3707
+ copy.ExtractBigData(versiontable);
3708
+
3709
+ copy.clear();
3710
+
3711
+ for (int i=0; i<obj.Size(); i++)
3712
+ {
3713
+ copy.add(obj.get(i));
3714
+ }
3715
+
3716
+ copy.RestoreBigData(versiontable);
3717
+
3718
+ CameraPane.SWITCH = temp;
3719
+
3720
+ //assert(hashtable.isEmpty());
3721
+
3722
+ copy.Touch();
3723
+
3724
+ ResetModel();
3725
+ copy.HardTouch(); // recompile?
3726
+
3727
+ cRadio ab;
3728
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3729
+ {
3730
+ ab = (cRadio)e.nextElement();
3731
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3732
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3733
+ if (test != null)
3734
+ {
3735
+ test.editWindow = ab.object.editWindow;
3736
+ ab.object = test;
3737
+ }
3738
+ }
3739
+
3740
+ refreshContents();
3741
+ }
3742
+
3743
+ cButton undoButton;
3744
+ cButton restoreButton;
3745
+ cButton replaceButton;
3746
+ cButton redoButton;
3747
+
3748
+ boolean muteSlider;
3749
+
3750
+ int VersionCount()
3751
+ {
3752
+ int count = 0;
3753
+
3754
+ for (int i = copy.versions.length; --i >= 0;)
3755
+ {
3756
+ if (copy.versions[i] != null)
3757
+ count++;
3758
+ }
3759
+
3760
+ return count;
3761
+ }
3762
+
3763
+ void SetUndoStates()
3764
+ {
3765
+ cRadio tab = GetCurrentTab();
3766
+
3767
+ restoreButton.setEnabled(copy.versionindex != -1);
3768
+ replaceButton.setEnabled(copy.versionindex != -1);
3769
+
3770
+ undoButton.setEnabled(copy.versionindex > 0);
3771
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3772
+
3773
+ muteSlider = true;
3774
+ versionSlider.setMaximum(VersionCount() - 1);
3775
+ versionSlider.setInteger(copy.versionindex);
3776
+ muteSlider = false;
3777
+ }
3778
+
3779
+ public boolean Undo()
3780
+ {
3781
+ // Option?
3782
+ Replace();
3783
+
3784
+ System.err.println("Undo");
3785
+
3786
+ cRadio tab = GetCurrentTab();
3787
+
3788
+ if (copy.versionindex == 0)
3789
+ {
3790
+ java.awt.Toolkit.getDefaultToolkit().beep();
3791
+ return false;
3792
+ }
3793
+
3794
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3795
+// {
3796
+// if (Save(false))
3797
+// tab.versionindex -= 1;
3798
+// else
3799
+// {
3800
+// if (tab.versionindex <= 0)
3801
+// return false;
3802
+// else
3803
+// tab.versionindex -= 1;
3804
+// }
3805
+// }
3806
+
3807
+ copy.versionindex -= 1;
3808
+
3809
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3810
+
3811
+ return true;
3812
+ }
3813
+
3814
+ public boolean Restore()
3815
+ {
3816
+ System.err.println("Restore");
3817
+
3818
+ cRadio tab = GetCurrentTab();
3819
+
3820
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3821
+ {
3822
+ java.awt.Toolkit.getDefaultToolkit().beep();
3823
+ return false;
3824
+ }
3825
+
3826
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3827
+
3828
+ return true;
3829
+ }
3830
+
3831
+ public boolean Replace()
3832
+ {
3833
+ System.err.println("Replace");
3834
+
3835
+ cRadio tab = GetCurrentTab();
3836
+
3837
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3838
+ {
3839
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3840
+ return false;
3841
+ }
3842
+
3843
+ copy.versions[copy.versionindex] = CompressCopy();
3844
+
3845
+ return true;
3846
+ }
3847
+
3848
+ public void Redo()
3849
+ {
3850
+ // Option?
3851
+ Replace();
3852
+
3853
+ cRadio tab = GetCurrentTab();
3854
+
3855
+ if (copy.versions[copy.versionindex + 1] == null)
3856
+ {
3857
+ java.awt.Toolkit.getDefaultToolkit().beep();
3858
+ return;
3859
+ }
3860
+
3861
+ copy.versionindex += 1;
3862
+
3863
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3864
+
3865
+ //if (!tab.user[tab.versionindex])
3866
+ // tab.graphs[tab.versionindex] = null;
3867
+ }
3868
+
3869
+ void ImportGFD()
3870
+ {
3871
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32403872 browser.show();
32413873 String filename = browser.getFile();
32423874 if (filename != null && filename.length() > 0)
32433875 {
3244
- CameraPane.filename = browser.getDirectory() + filename;
3876
+ String fullname = browser.getDirectory() + filename;
3877
+
3878
+ //Object3D readobj =
3879
+ objEditor.ReadGFD(fullname, objEditor);
3880
+ //makeSomething(readobj);
3881
+ }
3882
+ }
3883
+
3884
+ void ImportVRMLX3D()
3885
+ {
3886
+ if (Grafreed.standAlone)
3887
+ {
3888
+ /**/
3889
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3890
+ browser.show();
3891
+ String filename = browser.getFile();
3892
+ if (filename != null && filename.length() > 0)
3893
+ {
3894
+ String fullname = browser.getDirectory() + filename;
3895
+ LoadVRMLX3D(fullname);
3896
+ }
3897
+ /**/
3898
+ }
3899
+ }
3900
+
3901
+ void ToggleAnimation()
3902
+ {
3903
+ if (!Globals.ANIMATION)
3904
+ {
3905
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3906
+ browser.setVisible(true);
3907
+ String filename = browser.getFile();
3908
+ if (filename != null && filename.length() > 0)
3909
+ {
3910
+ Globals.filename = browser.getDirectory() + filename;
32453911 //CameraPane.framecount = 0;
3246
- CameraPane.imagecount = 0;
3912
+ Globals.imagecount = 0;
32473913
3248
- CameraPane.ANIMATION ^= true;
3914
+ Globals.ANIMATION ^= true;
32493915
3250
- GrafreeD.wav.cursor = 0;
3251
- GrafreeD.wav.loop = 0;
3916
+ Grafreed.wav.cursor = 0;
3917
+ Grafreed.wav.loop = 0;
32523918 }
32533919 } else
32543920 {
3255
- CameraPane.ANIMATION ^= true;
3921
+ Globals.ANIMATION ^= true;
32563922 }
32573923 }
32583924
....@@ -3298,7 +3964,7 @@
32983964 void CreateMaterial()
32993965 {
33003966 //copy.ClearMaterial(); // PATCH
3301
- copy.CreateMaterialS(multiplyToggle.isSelected());
3967
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33023968 if (copy.selection.size() > 0)
33033969 //SetMaterial(copy);
33043970 {
....@@ -3349,7 +4015,7 @@
33494015 assert false;
33504016 }
33514017
3352
- void EditSelection()
4018
+ void EditSelection(boolean newWindow)
33534019 {
33544020 }
33554021
....@@ -3357,11 +4023,11 @@
33574023 {
33584024 copy.ResetBlockLoop(); // temporary problem
33594025
3360
- boolean random = CameraPane.RANDOM;
3361
- CameraPane.RANDOM = false; // parse everything
4026
+ boolean random = CameraPane.SWITCH;
4027
+ CameraPane.SWITCH = false; // parse everything
33624028 copy.ResetDisplayList();
33634029 copy.HardTouch();
3364
- CameraPane.RANDOM = random;
4030
+ CameraPane.SWITCH = random;
33654031 }
33664032
33674033 // public void applySelf()
....@@ -3431,10 +4097,40 @@
34314097 current.fakedepth = (float) fakedepthField.getFloat();
34324098 current.shadowbias = (float) shadowbiasField.getFloat();
34334099
3434
- if (!NumberSlider.frozen)
4100
+ if (!cNumberSlider.frozen)
34354101 {
34364102 //System.out.println("Propagate = " + propagate);
34374103 copy.UpdateMaterial(anchor, current, propagate);
4104
+
4105
+ if (copy.material != null)
4106
+ {
4107
+ cMaterial mat = copy.material;
4108
+
4109
+ colorField.SetToolTipValue((mat.color));
4110
+ modulationField.SetToolTipValue((mat.modulation));
4111
+ metalnessField.SetToolTipValue((mat.metalness));
4112
+ diffuseField.SetToolTipValue((mat.diffuse));
4113
+ specularField.SetToolTipValue((mat.specular));
4114
+ shininessField.SetToolTipValue((mat.shininess));
4115
+ shiftField.SetToolTipValue((mat.shift));
4116
+ ambientField.SetToolTipValue((mat.ambient));
4117
+ lightareaField.SetToolTipValue((mat.lightarea));
4118
+ diffusenessField.SetToolTipValue((mat.factor));
4119
+ velvetField.SetToolTipValue((mat.velvet));
4120
+ sheenField.SetToolTipValue((mat.sheen));
4121
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4122
+ backlitField.SetToolTipValue((mat.bump));
4123
+ anisoField.SetToolTipValue((mat.aniso));
4124
+ anisoVField.SetToolTipValue((mat.anisoV));
4125
+ cameraField.SetToolTipValue((mat.cameralight));
4126
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4127
+ shadowField.SetToolTipValue((mat.shadow));
4128
+ textureField.SetToolTipValue((mat.texture));
4129
+ opacityField.SetToolTipValue((mat.opacity));
4130
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4131
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4132
+ }
4133
+
34384134 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34394135 {
34404136 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3463,9 +4159,25 @@
34634159 //copy.Touch();
34644160 }
34654161
4162
+ cNumberSlider versionSlider;
4163
+
34664164 public void stateChanged(ChangeEvent e)
34674165 {
34684166 // assert(false);
4167
+ if (e.getSource() == versionSlider)
4168
+ {
4169
+ if (muteSlider)
4170
+ return;
4171
+
4172
+ int version = versionSlider.getInteger();
4173
+
4174
+ if (copy.versions[version] != null)
4175
+ {
4176
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4177
+ }
4178
+
4179
+ return;
4180
+ }
34694181
34704182 if (freezematerial)
34714183 {
....@@ -3479,6 +4191,7 @@
34794191 || e.getSource() == apertureField
34804192 || e.getSource() == shadowblurField)
34814193 {
4194
+ new Exception().printStackTrace();
34824195 System.exit(0);
34834196 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34844197 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3505,7 +4218,13 @@
35054218 //System.out.println("PARENT = " + parent);
35064219 //if (parent != null)
35074220 // parent.applySelf();
3508
- refreshContents();
4221
+ if (e.getSource() == normalpushField)
4222
+ {
4223
+ objEditor.refreshContents();
4224
+ //Refresh();
4225
+ }
4226
+ else
4227
+ refreshContents();
35094228 // ??? client.refreshEditWindow();
35104229 }
35114230 //else
....@@ -3517,7 +4236,7 @@
35174236 //group.name = nameField.getText();
35184237 //objEditor.applySelf();
35194238
3520
- assert (objEditor == this);
4239
+ // OCT2018: assert (objEditor == this);
35214240 if (copy.selection == null || copy.selection.size() == 0)
35224241 //super.applySelf()
35234242 ; else
....@@ -3541,12 +4260,18 @@
35414260 objEditor.copy = keep;
35424261 }
35434262 }
4263
+
4264
+ if (normalpushField != null)
4265
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35444266 }
35454267
35464268 void SnapObject()
35474269 {
3548
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3549
- SnapObject(obj);
4270
+ if (copy.selection.size() > 0)
4271
+ {
4272
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
4273
+ SnapObject(obj);
4274
+ }
35504275 }
35514276
35524277 void SnapObject(Object3D obj)
....@@ -3660,7 +4385,7 @@
36604385
36614386 if (obj.parent != null)
36624387 {
3663
- obj.parent.TransformToWorld(interest);
4388
+// obj.parent.TransformToWorld(interest);
36644389 }
36654390
36664391 if (!CameraPane.TRACK)
....@@ -3792,7 +4517,7 @@
37924517
37934518 radioPanel.revalidate();
37944519 radioPanel.repaint();
3795
- ctrlPanel.revalidate(); // ? new
4520
+ ctrlPanel.validate(); // ? new
37964521 ctrlPanel.repaint();
37974522 }
37984523 }
....@@ -3801,6 +4526,8 @@
38014526
38024527 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38034528 {
4529
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4530
+ Save();
38044531 //Tween.set(thing, 0).target(1).start(tweenManager);
38054532 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38064533 // if (thing instanceof GenericJointDemo)
....@@ -3887,6 +4614,12 @@
38874614 {
38884615 ResetModel();
38894616 Select(thing.GetTreePath(), true, false); // unselect... false);
4617
+
4618
+ if (thing.Size() == 0)
4619
+ {
4620
+ //EditSelection(false);
4621
+ }
4622
+
38904623 refreshContents();
38914624 }
38924625
....@@ -4004,6 +4737,7 @@
40044737 }
40054738 }
40064739 }
4740
+
40074741 LoadGFDThread loadGFDThread;
40084742
40094743 void ReadGFD(String fullname, iCallBack cb)
....@@ -4023,8 +4757,10 @@
40234757
40244758 try
40254759 {
4760
+ // Try compressed version first.
40264761 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4027
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4762
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4763
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40284764
40294765 readobj = (Object3D) p.readObject();
40304766 istream.close();
....@@ -4032,7 +4768,20 @@
40324768 readobj.ResetDisplayList();
40334769 } catch (Exception e)
40344770 {
4035
- e.printStackTrace();
4771
+ //e.printStackTrace();
4772
+ try
4773
+ {
4774
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4775
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4776
+
4777
+ readobj = (Object3D) p.readObject();
4778
+ istream.close();
4779
+
4780
+ readobj.ResetDisplayList();
4781
+ } catch (Exception e2)
4782
+ {
4783
+ e2.printStackTrace();
4784
+ }
40364785 }
40374786 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40384787 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4078,6 +4827,12 @@
40784827
40794828 void LoadIt(Object obj)
40804829 {
4830
+ if (obj == null)
4831
+ {
4832
+ // Invalid file
4833
+ return;
4834
+ }
4835
+
40814836 System.out.println("Loaded " + obj);
40824837 //new Exception().printStackTrace();
40834838 Object3D readobj = (Object3D) obj;
....@@ -4087,6 +4842,8 @@
40874842
40884843 if (readobj != null)
40894844 {
4845
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4846
+ // Save();
40904847 try
40914848 {
40924849 //readobj.deepCopySelf(copy);
....@@ -4141,15 +4898,26 @@
41414898 c.addChild(csg);
41424899 }
41434900
4901
+ copy.versions = readobj.versions;
4902
+ copy.versionindex = readobj.versionindex;
4903
+
4904
+ if (copy.versions == null)
4905
+ {
4906
+ copy.versions = new byte[100][];
4907
+ copy.versionindex = -1;
4908
+ }
4909
+
4910
+ //? SetUndoStates();
4911
+
41444912 ResetModel();
41454913 copy.HardTouch(); // recompile?
41464914 refreshContents();
41474915 }
41484916 }
41494917
4150
- void load() // throws ClassNotFoundException
4918
+ void Open() // throws ClassNotFoundException
41514919 {
4152
- if (GrafreeD.standAlone)
4920
+ if (Grafreed.standAlone)
41534921 {
41544922 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41554923 browser.show();
....@@ -4236,11 +5004,13 @@
42365004 try
42375005 {
42385006 FileOutputStream ostream = new FileOutputStream(lastname);
4239
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5007
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5008
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42405009
42415010 p.writeObject(copy);
42425011 p.flush();
42435012
5013
+ zstream.close();
42445014 ostream.close();
42455015
42465016 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4250,17 +5020,20 @@
42505020 {
42515021 }
42525022 }
5023
+
42535024 String lastname;
42545025
42555026 void saveAs()
42565027 {
4257
- if (GrafreeD.standAlone)
5028
+ if (Grafreed.standAlone)
42585029 {
42595030 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42605031 browser.setVisible(true);
42615032 String filename = browser.getFile();
42625033 if (filename != null && filename.length() > 0)
42635034 {
5035
+ if (!filename.endsWith(".gfd"))
5036
+ filename += ".gfd";
42645037 lastname = browser.getDirectory() + filename;
42655038 save();
42665039 }
....@@ -4359,13 +5132,13 @@
43595132 try
43605133 {
43615134 FileOutputStream ostream = new FileOutputStream(filename);
4362
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4363
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5135
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5136
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43645137
43655138 Object3D objectparent = obj.parent;
43665139 obj.parent = null;
43675140
4368
- Object3D object = (Object3D) GrafreeD.clone(obj);
5141
+ Object3D object = (Object3D) Grafreed.clone(obj);
43695142
43705143 obj.parent = objectparent;
43715144
....@@ -4377,8 +5150,8 @@
43775150 p.writeObject(object);
43785151 p.flush();
43795152
5153
+ zstream.close();
43805154 ostream.close();
4381
- // zstream.close();
43825155
43835156 // group.selection.get(0).parent = parent;
43845157 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4399,7 +5172,7 @@
43995172 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44005173 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44015174 copy.generatePOV(buffer);
4402
- if (GrafreeD.standAlone)
5175
+ if (Grafreed.standAlone)
44035176 {
44045177 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44055178 browser.show();
....@@ -4425,53 +5198,70 @@
44255198 Object3D client;
44265199 Object3D copy;
44275200 MenuBar menuBar;
4428
- Menu windowMenu;
4429
- MenuItem loadItem;
5201
+ Menu fileMenu;
5202
+ MenuItem newItem;
5203
+ MenuItem openItem;
44305204 MenuItem saveItem;
44315205 MenuItem saveAsItem;
44325206 MenuItem exportAsItem;
44335207 MenuItem reexportItem;
44345208 MenuItem povItem;
44355209 MenuItem closeItem;
4436
- Menu cameraMenu;
5210
+
44375211 CheckboxMenuItem zBufferItem;
44385212 //MenuItem normalLensItem;
4439
- MenuItem editCameraItem;
4440
- MenuItem revertCameraItem;
4441
- CheckboxMenuItem toggleLiveItem;
44425213 MenuItem stepItem;
4443
- CheckboxMenuItem toggleFullItem;
5214
+ CheckboxMenuItem toggleLiveItem;
5215
+ CheckboxMenuItem toggleFullScreenItem;
5216
+ CheckboxMenuItem toggleTimelineItem;
44445217 CheckboxMenuItem toggleRenderItem;
44455218 CheckboxMenuItem toggleDebugItem;
44465219 CheckboxMenuItem toggleFrustumItem;
44475220 CheckboxMenuItem toggleFootContactItem;
44485221 CheckboxMenuItem toggleDLItem;
44495222 CheckboxMenuItem toggleTextureItem;
4450
- CheckboxMenuItem toggleRandomItem;
5223
+ CheckboxMenuItem toggleSwitchItem;
44515224 CheckboxMenuItem toggleRootItem;
44525225 CheckboxMenuItem animationItem;
5226
+ MenuItem archiveItem;
44535227 CheckboxMenuItem toggleHandleItem;
44545228 CheckboxMenuItem togglePaintItem;
44555229 JSplitPane mainPanel;
44565230 JScrollPane scrollpane;
5231
+
44575232 JPanel toolbarPanel;
4458
- JPanel treePanel;
5233
+
5234
+ cGridBag treePanel;
5235
+
44595236 JPanel radioPanel;
44605237 ButtonGroup buttonGroup;
4461
- JPanel ctrlPanel;
4462
- JPanel materialPanel;
5238
+
5239
+ cGridBag toolboxPanel;
5240
+ cGridBag materialPanel;
5241
+ cGridBag ctrlPanel;
5242
+
44635243 JScrollPane infoPanel;
4464
- JPanel optionsPanel;
5244
+
5245
+ cGridBag optionsPanel;
5246
+
44655247 JTabbedPane objectPanel;
4466
- JPanel XYZPanel;
5248
+ boolean materialFlushed;
5249
+ Object3D latestObject;
5250
+
5251
+ cGridBag XYZPanel;
5252
+
44675253 JSplitPane gridPanel;
44685254 JSplitPane bigPanel;
4469
- JPanel bigThree;
4470
- JTabbedPane jtp;
4471
- JPanel cameraPanel;
5255
+
5256
+ cGridBag bigThree;
5257
+ cGridBag scenePanel;
5258
+ cGridBag centralPanel;
5259
+ JSplitPane cameraPanel;
5260
+ JPanel timelinePanel;
5261
+ JMenuBar timelineMenubar;
44725262 JSplitPane framePanel;
44735263 JTextArea/*Field*/ nameField;
4474
- cButton textureButton;
5264
+ //cButton textureButton;
44755265 cButton okButton;
44765266 cButton applyButton;
44775267 cButton cancelButton;
....@@ -4518,65 +5308,72 @@
45185308 // MATERIAL
45195309 JLabel materialLabel;
45205310 JLabel colorLabel;
4521
- NumberSlider colorField;
5311
+ cNumberSlider colorField;
45225312 JLabel modulationLabel;
4523
- NumberSlider modulationField;
5313
+ cNumberSlider modulationField;
45245314 JLabel metalnessLabel;
4525
- NumberSlider metalnessField;
5315
+ cNumberSlider metalnessField;
45265316 JLabel diffuseLabel;
4527
- NumberSlider diffuseField;
5317
+ cNumberSlider diffuseField;
45285318 JLabel specularLabel;
4529
- NumberSlider specularField;
5319
+ cNumberSlider specularField;
45305320 JLabel shininessLabel;
4531
- NumberSlider shininessField;
5321
+ cNumberSlider shininessField;
45325322 JLabel shiftLabel;
4533
- NumberSlider shiftField;
5323
+ cNumberSlider shiftField;
45345324 JLabel ambientLabel;
4535
- NumberSlider ambientField;
5325
+ cNumberSlider ambientField;
45365326 JLabel lightareaLabel;
4537
- NumberSlider lightareaField;
5327
+ cNumberSlider lightareaField;
45385328 JLabel diffusenessLabel;
4539
- NumberSlider diffusenessField;
5329
+ cNumberSlider diffusenessField;
45405330 JLabel velvetLabel;
4541
- NumberSlider velvetField;
5331
+ cNumberSlider velvetField;
45425332 JLabel sheenLabel;
4543
- NumberSlider sheenField;
5333
+ cNumberSlider sheenField;
45445334 JLabel subsurfaceLabel;
4545
- NumberSlider subsurfaceField;
5335
+ cNumberSlider subsurfaceField;
45465336 //JLabel bumpLabel;
45475337 //NumberSlider bumpField;
45485338 JLabel backlitLabel;
4549
- NumberSlider backlitField;
5339
+ cNumberSlider backlitField;
45505340 JLabel anisoLabel;
4551
- NumberSlider anisoField;
5341
+ cNumberSlider anisoField;
45525342 JLabel anisoVLabel;
4553
- NumberSlider anisoVField;
5343
+ cNumberSlider anisoVField;
45545344 JLabel cameraLabel;
4555
- NumberSlider cameraField;
5345
+ cNumberSlider cameraField;
45565346 JLabel selfshadowLabel;
4557
- NumberSlider selfshadowField;
5347
+ cNumberSlider selfshadowField;
45585348 JLabel shadowLabel;
4559
- NumberSlider shadowField;
5349
+ cNumberSlider shadowField;
45605350 JLabel textureLabel;
4561
- NumberSlider textureField;
5351
+ cNumberSlider textureField;
45625352 JLabel opacityLabel;
4563
- NumberSlider opacityField;
5353
+ cNumberSlider opacityField;
45645354 JLabel fakedepthLabel;
4565
- NumberSlider fakedepthField;
5355
+ cNumberSlider fakedepthField;
45665356 JLabel shadowbiasLabel;
4567
- NumberSlider shadowbiasField;
5357
+ cNumberSlider shadowbiasField;
45685358 JLabel bumpLabel;
4569
- NumberSlider bumpField;
5359
+ cNumberSlider bumpField;
45705360 JLabel noiseLabel;
4571
- NumberSlider noiseField;
5361
+ cNumberSlider noiseField;
45725362 JLabel powerLabel;
4573
- NumberSlider powerField;
5363
+ cNumberSlider powerField;
45745364 JLabel borderfadeLabel;
4575
- NumberSlider borderfadeField;
5365
+ cNumberSlider borderfadeField;
45765366 JLabel fogLabel;
4577
- NumberSlider fogField;
5367
+ cNumberSlider fogField;
45785368 JLabel opacityPowerLabel;
4579
- NumberSlider opacityPowerField;
4580
- JTree jTree;
5369
+ cNumberSlider opacityPowerField;
5370
+ cTree jTree;
45815371 //ObjectUI parent;
5372
+
5373
+ cNumberSlider normalpushField;
5374
+
5375
+ private MenuItem importGFDItem;
5376
+ private MenuItem importVRMLX3DItem;
5377
+ private MenuItem import3DSItem;
5378
+ private MenuItem importOBJItem;
45825379 }