Normand Briere
2019-06-23 f1382bc839a74ef1d1534c61ea94e53cf54716df
ObjEditor.java
....@@ -19,6 +19,8 @@
1919 import //weka.core.
2020 matrix.Matrix;
2121
22
+import grafeme.ui.*;
23
+
2224 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
2325 ActionListener, ChangeListener,
2426 InputMethodListener,
....@@ -33,6 +35,8 @@
3335
3436 GroupEditor callee;
3537 JFrame frame;
38
+
39
+ static ObjEditor theFrame;
3640
3741 // SCRIPT
3842
....@@ -136,34 +140,42 @@
136140 public void closeUI()
137141 {
138142 //new Exception().printStackTrace();
139
- System.out.println("this = " + this);
140
- System.out.println("objEditor = " + objEditor);
143
+// System.out.println("this = " + this);
144
+// System.out.println("objEditor = " + objEditor);
141145 //nameField.removeActionListener(this);
142
- objEditor.ctrlPanel.remove(nameField);
146
+// objEditor.ctrlPanel.remove(nameField);
147
+
148
+ objEditor.ctrlPanel.remove(namePanel);
143149
144150 if (!GroupEditor.allparams)
145151 return;
146152
147
- objEditor.ctrlPanel.remove(liveCB);
148
- objEditor.ctrlPanel.remove(hideCB);
149
- objEditor.ctrlPanel.remove(markCB);
150
-
151
- objEditor.ctrlPanel.remove(randomCB);
152
- objEditor.ctrlPanel.remove(speedupCB);
153
- objEditor.ctrlPanel.remove(rewindCB);
154
-
155
- objEditor.ctrlPanel.remove(resetButton);
156
- objEditor.ctrlPanel.remove(stepButton);
157
-// objEditor.ctrlPanel.remove(stepAllButton);
158
-// objEditor.ctrlPanel.remove(resetAllButton);
159
- objEditor.ctrlPanel.remove(link2masterCB);
160
- //objEditor.ctrlPanel.remove(flipVCB);
161
- //objEditor.ctrlPanel.remove(texresMenu);
162
- objEditor.ctrlPanel.remove(slowerButton);
163
- objEditor.ctrlPanel.remove(fasterButton);
164
- objEditor.ctrlPanel.remove(remarkButton);
153
+// objEditor.ctrlPanel.remove(liveCB);
154
+// objEditor.ctrlPanel.remove(hideCB);
155
+// objEditor.ctrlPanel.remove(markCB);
156
+//
157
+// objEditor.ctrlPanel.remove(randomCB);
158
+// objEditor.ctrlPanel.remove(speedupCB);
159
+// objEditor.ctrlPanel.remove(rewindCB);
160
+//
161
+// objEditor.ctrlPanel.remove(resetButton);
162
+// objEditor.ctrlPanel.remove(stepButton);
163
+//// objEditor.ctrlPanel.remove(stepAllButton);
164
+//// objEditor.ctrlPanel.remove(resetAllButton);
165
+// objEditor.ctrlPanel.remove(link2masterCB);
166
+// //objEditor.ctrlPanel.remove(flipVCB);
167
+// //objEditor.ctrlPanel.remove(texresMenu);
168
+// objEditor.ctrlPanel.remove(slowerButton);
169
+// objEditor.ctrlPanel.remove(fasterButton);
170
+// objEditor.ctrlPanel.remove(remarkButton);
165171
166
- Remove(normalpushField);
172
+ objEditor.ctrlPanel.remove(setupPanel);
173
+ objEditor.ctrlPanel.remove(setupPanel2);
174
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
175
+ objEditor.ctrlPanel.remove(pushPanel);
176
+ //objEditor.ctrlPanel.remove(fillPanel);
177
+
178
+ //Remove(normalpushField);
167179 }
168180
169181 public ObjEditor GetEditor()
....@@ -234,6 +246,7 @@
234246 //localCopy.parent = null;
235247
236248 frame = new JFrame();
249
+ frame.setUndecorated(true);
237250 objEditor = this;
238251 this.callee = callee;
239252
....@@ -267,24 +280,40 @@
267280 void SetupMenu()
268281 {
269282 frame.setMenuBar(menuBar = new MenuBar());
270
- menuBar.add(windowMenu = new Menu("File"));
271
- windowMenu.add(loadItem = new MenuItem("Load..."));
272
- windowMenu.add("-");
273
- windowMenu.add(saveItem = new MenuItem("Save"));
274
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
283
+ menuBar.add(fileMenu = new Menu("File"));
284
+ fileMenu.add(newItem = new MenuItem("New"));
285
+ fileMenu.add(loadItem = new MenuItem("Open..."));
286
+
287
+ //oe.menuBar.add(menu = new Menu("Include"));
288
+ Menu menu = new Menu("Import");
289
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
290
+ importOBJItem.addActionListener(this);
291
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
292
+ import3DSItem.addActionListener(this);
293
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
294
+ importVRMLX3DItem.addActionListener(this);
295
+ menu.add("-");
296
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
297
+ importGFDItem.addActionListener(this);
298
+ fileMenu.add(menu);
299
+ fileMenu.add("-");
300
+
301
+ fileMenu.add(saveItem = new MenuItem("Save"));
302
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
275303 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
276
- windowMenu.add("-");
277
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
278
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
279
- windowMenu.add("-");
304
+ fileMenu.add("-");
305
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
306
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
307
+ fileMenu.add("-");
280308 if (client.parent != null)
281309 {
282
- windowMenu.add(closeItem = new MenuItem("Close"));
310
+ fileMenu.add(closeItem = new MenuItem("Close"));
283311 } else
284312 {
285
- windowMenu.add(closeItem = new MenuItem("Exit"));
313
+ fileMenu.add(closeItem = new MenuItem("Exit"));
286314 }
287315
316
+ newItem.addActionListener(this);
288317 loadItem.addActionListener(this);
289318 saveItem.addActionListener(this);
290319 saveAsItem.addActionListener(this);
....@@ -293,79 +322,35 @@
293322 //povItem.addActionListener(this);
294323 closeItem.addActionListener(this);
295324
296
- menuBar.add(cameraMenu = new Menu("View"));
297
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
298
- //zBufferItem.addActionListener(this);
299
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
300
- //normalLensItem.addActionListener(this);
301
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
302
- revertCameraItem.addActionListener(this);
303
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
304
- toggleTimelineItem.addItemListener(this);
305
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
306
- toggleFullScreenItem.addItemListener(this);
307
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
308
- cameraMenu.add("-");
309
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
310
- toggleTextureItem.addItemListener(this);
311
- toggleTextureItem.setState(CameraPane.textureon);
312
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
313
- toggleLiveItem.addItemListener(this);
314
- toggleLiveItem.setState(Globals.isLIVE());
315
- cameraMenu.add(stepItem = new MenuItem("Step"));
316
- stepItem.addActionListener(this);
317
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
318
-// toggleDLItem.addItemListener(this);
319
-// toggleDLItem.setState(false);
320
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
321
- toggleRenderItem.addItemListener(this);
322
- toggleRenderItem.setState(!CameraPane.frozen);
323
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
324
- toggleDebugItem.addItemListener(this);
325
- toggleDebugItem.setState(CameraPane.DEBUG);
326
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
327
- toggleFrustumItem.addItemListener(this);
328
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
329
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
330
- toggleFootContactItem.addItemListener(this);
331
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
332
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
333
- toggleRandomItem.addItemListener(this);
334
- toggleRandomItem.setState(CameraPane.RANDOM);
335
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
336
- toggleHandleItem.addItemListener(this);
337
- toggleHandleItem.setState(CameraPane.HANDLES);
338
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
339
- togglePaintItem.addItemListener(this);
340
- togglePaintItem.setState(CameraPane.PAINTMODE);
341
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
342
-// toggleRootItem.addItemListener(this);
343
-// toggleRootItem.setState(false);
344
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
345
-// animationItem.addItemListener(this);
346
-// animationItem.setState(CameraPane.ANIMATION);
347
- cameraMenu.add("-");
348
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
349
- editCameraItem.addActionListener(this);
350
-
351325 objectPanel = new JTabbedPane();
352326 toolbarPanel = new JPanel();
353327 toolbarPanel.setName("Toolbar");
354
- treePanel = new JPanel();
328
+ treePanel = new cGridBag();
355329 treePanel.setName("Tree");
356
- ctrlPanel = new JPanel(); // new GridBagLayout());
357
- ctrlPanel.setName("Edit");
358
- materialPanel = new JPanel();
330
+
331
+ editPanel = new cGridBag().setVertical(true);
332
+ editPanel.setName("Edit");
333
+
334
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
335
+
336
+ editCommandsPanel = new cGridBag();
337
+ editPanel.add(editCommandsPanel);
338
+ editPanel.add(ctrlPanel);
339
+
340
+ materialPanel = new cGridBag().setVertical(true);
341
+
359342 materialPanel.setName("Material");
360343 /*JTextPane*/
361344 infoarea = createTextPane();
345
+ doc = infoarea.getStyledDocument();
346
+
362347 infoarea.setEditable(true);
363348 SetText();
364349 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
365350 // infoarea.setOpaque(false);
366351 // //infoarea.setForeground(textcolor);
367
- infoarea.setLineWrap(true);
368
- infoarea.setWrapStyleWord(true);
352
+// TEXTAREA infoarea.setLineWrap(true);
353
+// TEXTAREA infoarea.setWrapStyleWord(true);
369354 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
370355 infoPanel.setPreferredSize(new Dimension(50, 200));
371356 infoPanel.setName("Info");
....@@ -376,16 +361,16 @@
376361 mainPanel.setName("Main");
377362 mainPanel.setContinuousLayout(true);
378363 mainPanel.setOneTouchExpandable(true);
379
- mainPanel.setDividerLocation(1.0);
380364 mainPanel.setDividerSize(9);
381
- mainPanel.setResizeWeight(0);
365
+ mainPanel.setDividerLocation(0.5); //1.0);
366
+ mainPanel.setResizeWeight(0.5);
382367
383368 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
384369 //mainPanel.setLayout(new GridBagLayout());
385370 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
386
- treePanel.setLayout(new GridBagLayout());
387
- ctrlPanel.setLayout(new GridBagLayout());
388
- materialPanel.setLayout(new GridBagLayout());
371
+// treePanel.setLayout(new GridBagLayout());
372
+ //ctrlPanel.setLayout(new GridBagLayout());
373
+ //materialPanel.setLayout(new GridBagLayout());
389374
390375 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
391376 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -424,7 +409,7 @@
424409 static String newline = "\n";
425410 protected static final String buttonString = "JButton";
426411 StyledDocument doc;
427
- JTextArea infoarea;
412
+ JTextPane infoarea;
428413
429414 void ClearInfo()
430415 {
....@@ -447,10 +432,10 @@
447432 e.printStackTrace();
448433 }
449434
450
- String selection = infoarea.getText();
451
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
452
- java.awt.datatransfer.Clipboard clipboard =
453
- Toolkit.getDefaultToolkit().getSystemClipboard();
435
+// String selection = infoarea.getText();
436
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
437
+// java.awt.datatransfer.Clipboard clipboard =
438
+// Toolkit.getDefaultToolkit().getSystemClipboard();
454439 //clipboard.setContents(data, data);
455440 }
456441
....@@ -473,13 +458,13 @@
473458 //SendInfo("Name:", "bold");
474459 if (sel.GetTextures() != null || debug)
475460 {
476
- si.SendInfo(sel.toString(), "bold");
461
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
477462 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
478463 if (sel.Size() > 0)
479464 {
480465 si.SendInfo("#children = " + sel.Size(), "regular");
481466 }
482
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
467
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
483468 if (debug)
484469 {
485470 try
....@@ -491,7 +476,10 @@
491476 }
492477
493478 if (full)
494
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
479
+ {
480
+ si.SendInfo(" BBox min: " + minima, "regular");
481
+ si.SendInfo(" BBox max: " + maxima, "regular");
482
+ }
495483
496484 if (sel.bRep != null)
497485 {
....@@ -518,7 +506,7 @@
518506 }
519507 if (sel.support != null)
520508 {
521
- si.SendInfo(" support: " + sel.support, "regular");
509
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
522510 }
523511 if (sel.scriptnode != null)
524512 {
....@@ -589,6 +577,9 @@
589577 {
590578 CameraPane.pointflow = (PointFlow) sel;
591579 }
580
+
581
+ si.SendInfo("_____________________", "regular");
582
+ si.SendInfo("", "regular");
592583 }
593584 }
594585
....@@ -604,68 +595,138 @@
604595 }
605596 }
606597
598
+static GraphicsDevice device = GraphicsEnvironment
599
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
600
+
601
+ Rectangle keeprect;
602
+ cRadio radio;
603
+
604
+cButton keepButton;
605
+ cButton twoButton; // Full 3D
606
+ cButton sixButton;
607
+ cButton threeButton;
608
+ cButton sevenButton;
609
+ cButton fourButton; // full panel
610
+ cButton oneButton; // full XYZ
611
+ //cButton currentLayout;
612
+
613
+ boolean maximized;
614
+
615
+ void Minimize()
616
+ {
617
+ frame.setState(Frame.ICONIFIED);
618
+ }
619
+
620
+ void Maximize()
621
+ {
622
+ if (maximized)
623
+ {
624
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
625
+ }
626
+ else
627
+ {
628
+ keeprect = frame.getBounds();
629
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
630
+ Dimension rect2 = frame.getToolkit().getScreenSize();
631
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
632
+// frame.setState(Frame.MAXIMIZED_BOTH);
633
+ }
634
+
635
+ maximized ^= true;
636
+ }
637
+
607638 void ToggleFullScreen()
608639 {
609640 if (CameraPane.FULLSCREEN)
610641 {
611
- frame.getContentPane().remove(/*"Center",*/bigThree);
612
- framePanel.add(bigThree);
613
- frame.getContentPane().add(/*"Center",*/framePanel);
642
+ device.setFullScreenWindow(null);
643
+ //frame.setVisible(false);
644
+// frame.removeNotify();
645
+// frame.setUndecorated(false);
646
+// frame.addNotify();
647
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
648
+
649
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
650
+// X framePanel.add(bigThree);
651
+// X frame.getContentPane().add(/*"Center",*/framePanel);
652
+ framePanel.setDividerLocation(1);
653
+
654
+ //frame.setVisible(true);
655
+ radio.layout = keepButton;
656
+ //theFrame = null;
657
+ keepButton = null;
658
+ radio.layout.doClick();
659
+
614660 } else
615661 {
616
- frame.getContentPane().remove(/*"Center",*/framePanel);
617
- framePanel.remove(bigThree);
618
- frame.getContentPane().add(/*"Center",*/bigThree);
662
+ keepButton = radio.layout;
663
+ //keeprect = frame.getBounds();
664
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
665
+// frame.getToolkit().getScreenSize().height);
666
+ //frame.setVisible(false);
667
+ device.setFullScreenWindow(frame);
668
+// frame.removeNotify();
669
+// frame.setUndecorated(true);
670
+// frame.addNotify();
671
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
672
+// X framePanel.remove(bigThree);
673
+// X frame.getContentPane().add(/*"Center",*/bigThree);
674
+ framePanel.setDividerLocation(0);
675
+
676
+ radio.layout = twoButton;
677
+ radio.layout.doClick();
678
+ //frame.setVisible(true);
619679 }
680
+
620681 cameraView.ToggleFullScreen();
621682 }
622683
623
- private JTextArea createTextPane()
684
+ private JTextPane createTextPane()
624685 {
625
- String[] initString =
626
- {
627
- "This is an editable JTextPane, ", //regular
628
- "another ", //italic
629
- "styled ", //bold
630
- "text ", //small
631
- "component, ", //large
632
- "which supports embedded components..." + newline,//regular
633
- " " + newline, //button
634
- "...and embedded icons..." + newline, //regular
635
- " ", //icon
636
- newline + "JTextPane is a subclass of JEditorPane that "
637
- + "uses a StyledEditorKit and StyledDocument, and provides "
638
- + "cover methods for interacting with those objects."
639
- };
686
+// TEXTAREA String[] initString =
687
+// {
688
+// "This is an editable JTextPane, ", //regular
689
+// "another ", //italic
690
+// "styled ", //bold
691
+// "text ", //small
692
+// "component, ", //large
693
+// "which supports embedded components..." + newline,//regular
694
+// " " + newline, //button
695
+// "...and embedded icons..." + newline, //regular
696
+// " ", //icon
697
+// newline + "JTextPane is a subclass of JEditorPane that "
698
+// + "uses a StyledEditorKit and StyledDocument, and provides "
699
+// + "cover methods for interacting with those objects."
700
+// };
701
+//
702
+// String[] initStyles =
703
+// {
704
+// "regular", "italic", "bold", "small", "large",
705
+// "regular", "button", "regular", "icon",
706
+// "regular"
707
+// };
708
+//
709
+// JTextPane textPane = new JTextPane();
710
+// textPane.setEditable(true);
711
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
712
+// addStylesToDocument(doc);
713
+//
714
+// try
715
+// {
716
+// for (int j = 0; j < 2; j++)
717
+// {
718
+// for (int i = 0; i < initString.length; i++)
719
+// {
720
+// doc.insertString(doc.getLength(), initString[i],
721
+// doc.getStyle(initStyles[i]));
722
+// }
723
+// }
724
+// } catch (BadLocationException ble)
725
+// {
726
+// System.err.println("Couldn't insert initial text into text pane.");
727
+// }
640728
641
- String[] initStyles =
642
- {
643
- "regular", "italic", "bold", "small", "large",
644
- "regular", "button", "regular", "icon",
645
- "regular"
646
- };
647
-
648
- JTextPane textPane = new JTextPane();
649
- textPane.setEditable(true);
650
- /*StyledDocument*/ doc = textPane.getStyledDocument();
651
- addStylesToDocument(doc);
652
-
653
- try
654
- {
655
- for (int j = 0; j < 2; j++)
656
- {
657
- for (int i = 0; i < initString.length; i++)
658
- {
659
- doc.insertString(doc.getLength(), initString[i],
660
- doc.getStyle(initStyles[i]));
661
- }
662
- }
663
- } catch (BadLocationException ble)
664
- {
665
- System.err.println("Couldn't insert initial text into text pane.");
666
- }
667
-
668
- return new JTextArea(); // textPane;
729
+ return new JTextPane(); // textPane;
669730 }
670731
671732 protected void addStylesToDocument(StyledDocument doc)
....@@ -718,7 +779,7 @@
718779 protected static ImageIcon createImageIcon(String path,
719780 String description)
720781 {
721
- java.net.URL imgURL = GrafreeD.class.getResource(path);
782
+ java.net.URL imgURL = Grafreed.class.getResource(path);
722783 if (imgURL != null)
723784 {
724785 return new ImageIcon(imgURL, description);
....@@ -750,6 +811,7 @@
750811 // NumberSlider vDivsField;
751812 // JCheckBox endcaps;
752813 JCheckBox liveCB;
814
+ JCheckBox selectCB;
753815 JCheckBox hideCB;
754816 JCheckBox link2masterCB;
755817 JCheckBox markCB;
....@@ -765,115 +827,87 @@
765827 JButton slowerButton;
766828 JButton fasterButton;
767829 JButton remarkButton;
830
+
831
+ cGridBag editPanel;
832
+ cGridBag editCommandsPanel;
833
+
834
+ cGridBag namePanel;
835
+ cGridBag setupPanel;
836
+ cGridBag setupPanel2;
837
+ cGridBag objectCommandsPanel;
838
+ cGridBag pushPanel;
839
+ cGridBag fillPanel;
768840
769
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
841
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
770842 {
771843 JCheckBox cb;
772844
773
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
774
- oe.aConstraints.gridwidth = 1; // 3;
775
-// oe.aConstraints.weightx = 1;
776
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
777
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
845
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
778846 cb.addItemListener(this);
779
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
780
- oe.aConstraints.gridwidth = 1;
781
- oe.aConstraints.gridx += 1;
782847
783848 return cb;
784849 }
785850
786
- cButton AddButton(ObjEditor oe, String label)
851
+ cButton AddButton(cGridBag panel, String label)
787852 {
788853 cButton cb;
789854
790
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
791
- oe.aConstraints.gridwidth = 1;
792
-// oe.aConstraints.weightx = 1;
793
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
794
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
855
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
795856 cb.addActionListener(this);
796
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
797
- oe.aConstraints.gridwidth = 1;
798
- oe.aConstraints.gridx += 1;
799857
800858 return cb;
801859 }
802860
803
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
861
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
804862 {
805863 JComboBox combo;
806864
807
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
808
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
809
- oe.aConstraints.gridx += 1;
865
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
810866 combo.addActionListener(this);
811867
812868 return combo;
813869 }
814870
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
871
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
816872 {
817
- NumberSlider combo;
873
+ cGridBag control = new cGridBag();
874
+
875
+ cNumberSlider combo;
818876
819877 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
822878 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
823
- aConstraints.gridwidth = 1;
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, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
829
- aConstraints.gridx += 1;
830
- aConstraints.gridwidth = 1;
831
-
879
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
880
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
832881 combo.setFloat(current);
833
-
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
882
+
883
+ panel.add(control);
884
+
885
+ return control;
839886 }
840887
841
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
888
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
842889 {
843
- NumberSlider combo;
890
+ cGridBag control = new cGridBag();
891
+
892
+ cNumberSlider combo;
844893
845894 JLabel jlabel = new JLabel(label);
846
-
847
- aConstraints.fill = GridBagConstraints.VERTICAL;
848895 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
849
- aConstraints.gridwidth = 2;
850
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
851
- aConstraints.gridx += 1;
852
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
853
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
854
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
855
- aConstraints.gridx += 1;
856
- aConstraints.gridwidth = 1;
857
-
896
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
897
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
858898 combo.setInteger(current);
859899
860
- combo.label = jlabel;
861
-
862
- combo.addChangeListener(this);
863
-
864
- return combo;
900
+ panel.add(control);
901
+
902
+ return control;
865903 }
866904
867
- JTextArea AddText(JPanel ctrlPanel, String name)
905
+ JTextArea AddText(cGridBag ctrlPanel, String name)
868906 {
869907 JTextArea text;
870908
871
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
872
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
873
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
909
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
874910 text.addCaretListener(this);
875
- aConstraints.gridx += 1;
876
- aConstraints.gridwidth = 1;
877911
878912 return text;
879913 }
....@@ -903,9 +937,16 @@
903937 objEditor.ctrlPanel.remove(j);
904938 }
905939
940
+ void Remove(cNumberSlider j)
941
+ {
942
+ j.removeChangeListener(this);
943
+ //objEditor.ctrlPanel.remove(j.label);
944
+ objEditor.ctrlPanel.remove(j);
945
+ }
946
+
906947 /*
907948 */
908
- void Return() // ObjEditor oe)
949
+ void Return0() // ObjEditor oe)
909950 {
910951 aConstraints.gridy += 1;
911952 aConstraints.gridx = 0;
....@@ -960,37 +1001,76 @@
9601001
9611002 void SetupUI2(ObjEditor oe)
9621003 {
963
-// oe.aConstraints.weightx = 0;
964
-// oe.aConstraints.weighty = 0;
965
-// oe.aConstraints.gridx = 0;
966
-// oe.aConstraints.gridy = 0;
967
- SetupName(oe);
1004
+ //SetupName(oe);
1005
+
1006
+ namePanel = new cGridBag();
1007
+
1008
+ nameField = AddText(namePanel, copy.GetName());
1009
+ namePanel.add(nameField);
1010
+ oe.ctrlPanel.add(namePanel);
1011
+
1012
+ oe.ctrlPanel.Return();
9681013
9691014 if (!GroupEditor.allparams)
9701015 return;
9711016
972
- liveCB = AddCheckBox(oe, "Live", copy.live);
973
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
974
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1017
+ setupPanel = new cGridBag().setVertical(false);
1018
+
1019
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1020
+ liveCB.setToolTipText("Animate object");
1021
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1022
+ selectCB.setToolTipText("Make object selectable");
9751023 // Return();
976
- markCB = AddCheckBox(oe, "Mark", copy.marked);
977
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
978
- randomCB = AddCheckBox(oe, "Rand", copy.random);
979
- Return();
980
- resetButton = AddButton(oe, "Reset");
981
- stepButton = AddButton(oe, "Step");
1024
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1025
+ hideCB.setToolTipText("Hide object");
1026
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1027
+ markCB.setToolTipText("Set the animation target transform");
1028
+
1029
+ setupPanel2 = new cGridBag().setVertical(false);
1030
+
1031
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1032
+ rewindCB.setToolTipText("Rewind animation");
1033
+
1034
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1035
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1036
+
1037
+ if (Globals.ADVANCED)
1038
+ {
1039
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1040
+ link2masterCB.setToolTipText("Attach to support");
1041
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1042
+ speedupCB.setToolTipText("Option motion capture");
1043
+ }
1044
+
1045
+ oe.ctrlPanel.add(setupPanel);
1046
+ oe.ctrlPanel.Return();
1047
+ oe.ctrlPanel.add(setupPanel2);
1048
+ oe.ctrlPanel.Return();
1049
+
1050
+ objectCommandsPanel = new cGridBag().setVertical(false);
1051
+
1052
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1053
+ resetButton.setToolTipText("Jump to frame zero");
1054
+ stepButton = AddButton(objectCommandsPanel, "Step");
1055
+ stepButton.setToolTipText("Step one frame");
9821056 // resetAllButton = AddButton(oe, "Reset All");
9831057 // stepAllButton = AddButton(oe, "Step All");
984
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9851058 // Return();
986
- slowerButton = AddButton(oe, "Slow");
987
- fasterButton = AddButton(oe, "Fast");
988
- remarkButton = AddButton(oe, "Rem");
1059
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1060
+ slowerButton.setToolTipText("Decrease animation speed");
1061
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1062
+ fasterButton.setToolTipText("Increase animation speed");
1063
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1064
+ remarkButton.setToolTipText("Set the current transform as the target");
9891065
990
- Return();
1066
+ oe.ctrlPanel.add(objectCommandsPanel);
1067
+ oe.ctrlPanel.Return();
9911068
992
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
993
- Return();
1069
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1070
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1071
+ //Return();
1072
+
1073
+ oe.ctrlPanel.Return();
9941074
9951075 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9961076 // ObjEditor.aConstraints.gridx += 1;
....@@ -1085,7 +1165,7 @@
10851165 oe.aConstraints.gridwidth = 1;
10861166 /**/
10871167 nameField = AddText(oe.ctrlPanel, copy.GetName());
1088
- Return();
1168
+ oe.ctrlPanel.Return();
10891169
10901170 //ctrlPanel.add(textureButton = new Button("Texture..."));
10911171 //textureButton.setEnabled(false);
....@@ -1187,9 +1267,13 @@
11871267 //JPanel worldPanel =
11881268 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11891269 //worldPanel.setName("World");
1190
- centralPanel = new JPanel(new BorderLayout());
1191
- timelinePanel = new JPanel(new BorderLayout());
1192
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1270
+ centralPanel = new cGridBag();
1271
+ centralPanel.preferredWidth = 20;
1272
+
1273
+ if (Globals.ADVANCED)
1274
+ {
1275
+ timelinePanel = new JPanel(new BorderLayout());
1276
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11931277
11941278 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11951279 cameraPanel.setContinuousLayout(true);
....@@ -1198,7 +1282,10 @@
11981282 // cameraPanel.setDividerSize(9);
11991283 cameraPanel.setResizeWeight(1.0);
12001284
1285
+ }
1286
+
12011287 centralPanel.add(cameraView);
1288
+ centralPanel.setFocusable(true);
12021289 //frame.setJMenuBar(timelineMenubar);
12031290 //centralPanel.add(timelinePanel);
12041291
....@@ -1217,12 +1304,13 @@
12171304 //frontView.object = copy;
12181305 //sideView.object = copy;
12191306
1220
- XYZPanel = new JPanel();
1221
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1307
+ XYZPanel = new cGridBag().setVertical(true);
1308
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12221309
1223
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1224
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1225
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1310
+ XYZPanel.preferredWidth = 5;
1311
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1312
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1313
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
12261314
12271315 /*
12281316 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1260,10 +1348,11 @@
12601348 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12611349 //tmp.setName("Edit");
12621350 objectPanel.add(materialPanel);
1263
- JPanel north = new JPanel(new BorderLayout());
1264
- north.setName("Edit");
1265
- north.add(ctrlPanel, BorderLayout.NORTH);
1266
- objectPanel.add(north);
1351
+// JPanel north = new JPanel(new BorderLayout());
1352
+// north.setName("Edit");
1353
+// north.add(ctrlPanel, BorderLayout.NORTH);
1354
+// objectPanel.add(north);
1355
+ objectPanel.add(editPanel);
12671356 objectPanel.add(infoPanel);
12681357
12691358 /*
....@@ -1284,19 +1373,23 @@
12841373 scrollpane.setWheelScrollingEnabled(true);
12851374 scrollpane.addMouseWheelListener(this); // Default not fast enough
12861375
1287
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1288
- scenePanel.add(scrollpane);
1376
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1377
+ scenePanel.preferredWidth = 6;
1378
+
1379
+ JTabbedPane tabbedPane = new JTabbedPane();
1380
+ tabbedPane.add(scrollpane);
12891381
1290
- scenePanel.add(FSPane = new cFileSystemPane(this));
1382
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12911383
1292
- optionsPanel = new JPanel(new GridBagLayout());
1384
+ optionsPanel = new cGridBag().setVertical(true);
12931385
12941386 optionsPanel.setName("Options");
12951387
1296
- AddOptions(optionsPanel, aConstraints);
1388
+ AddOptions(optionsPanel); //, aConstraints);
12971389
1298
- scenePanel.add(optionsPanel);
1299
-
1390
+ tabbedPane.add(optionsPanel);
1391
+
1392
+ scenePanel.add(tabbedPane);
13001393
13011394 /*
13021395 cTree jTree = new cTree(null);
....@@ -1330,6 +1423,7 @@
13301423 //bigPanel.setSize(new Dimension(10,10));
13311424 //bigPanel.add(ctrlPanel);
13321425 //bigPanel.add(gridPanel);
1426
+ /**
13331427 bigThree = new JPanel();
13341428 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
13351429 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1353,7 +1447,13 @@
13531447 // aConstraints.gridheight = 3;
13541448 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13551449 bigThree.add(XYZPanel, aWindowConstraints);
1450
+ /**/
13561451
1452
+ bigThree = new cGridBag();
1453
+ bigThree.addComponent(scenePanel);
1454
+ bigThree.addComponent(centralPanel);
1455
+ bigThree.addComponent(XYZPanel);
1456
+
13571457 // // SIDE EFFECT!!!
13581458 // aConstraints.gridx = 0;
13591459 // aConstraints.gridy = 0;
....@@ -1380,9 +1480,11 @@
13801480
13811481 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13821482
1383
- frame.setSize(1024, 768);
1384
- frame.show();
1483
+ frame.setSize(1280, 860);
1484
+ frame.setVisible(true);
13851485
1486
+ cameraView.requestFocusInWindow();
1487
+
13861488 gridPanel.setDividerLocation(1.0);
13871489
13881490 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1396,7 +1498,7 @@
13961498 });
13971499 }
13981500
1399
- void AddOptions(JPanel panel, GridBagConstraints constraints)
1501
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
14001502 {
14011503 }
14021504
....@@ -1411,260 +1513,173 @@
14111513 ctrlPanel.removeAll();
14121514 }
14131515
1414
- void SetupMaterial(JPanel ctrlPanel)
1516
+ void SetupMaterial(cGridBag panel)
14151517 {
1416
- aConstraints.weighty = 0;
1417
- //aConstraints.weightx = 1;
1418
- /*
1518
+ /*
14191519 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14201520 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1421
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1422
- aConstraints.gridx += 1;
14231521 */
14241522
1425
- aConstraints.gridwidth = 1;
1426
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1427
- aConstraints.gridx += 1;
1428
- aConstraints.weighty = 0;
1429
- aConstraints.gridwidth = 1;
1523
+ cGridBag editBar = new cGridBag().setVertical(false);
1524
+
1525
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1526
+ createMaterialButton.setToolTipText("Create material");
14301527
14311528 /*
14321529 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1433
- aConstraints.gridx += 1;
1434
- aConstraints.weighty = 0;
1435
- aConstraints.gridwidth = 1;
14361530 */
14371531
1438
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1439
- aConstraints.gridx += 1;
1532
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1533
+ clearMaterialButton.setToolTipText("Clear material");
1534
+
1535
+ if (Globals.ADVANCED)
1536
+ {
1537
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1538
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1539
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1540
+ }
14401541
1441
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1442
-
1443
- aConstraints.gridx += 1;
1444
-
1445
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1446
-
1447
- aConstraints.gridx += 1;
1448
-
1449
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1450
-
1451
- aConstraints.gridx = 0;
1452
- aConstraints.gridy += 1;
1453
- aConstraints.weighty = 0;
1454
- aConstraints.gridwidth = 1;
1542
+ editBar.preferredHeight = 15;
1543
+
1544
+ panel.add(editBar);
1545
+
14551546 /**/
14561547 //aConstraints.weighty = 0;
14571548 ////aConstraints.weightx = 1;
14581549 //aConstraints.weighty = 1;
14591550 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14601551 //aConstraints.gridx += 1;
1461
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1462
- aConstraints.weighty = 0;
1463
- aConstraints.gridx = 0;
1464
- aConstraints.gridy += 1;
1465
- aConstraints.gridwidth = 1;
1552
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14661553
1467
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1468
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1469
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1470
- aConstraints.gridx += 1;
1471
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1472
- //aConstraints.weightx = 0;
1473
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1474
- aConstraints.gridx = 0;
1475
- aConstraints.gridy += 1;
1476
- aConstraints.gridwidth = 1;
1554
+ cGridBag colorSection = new cGridBag().setVertical(true);
1555
+
1556
+ cGridBag color = new cGridBag();
1557
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1558
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1559
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1560
+ //colorField.preferredWidth = 200;
1561
+ colorSection.add(color);
14771562
1478
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1479
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1480
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1481
- aConstraints.gridx += 1;
1482
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1483
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1484
- aConstraints.gridx = 0;
1485
- aConstraints.gridy += 1;
1486
- aConstraints.gridwidth = 1;
1563
+ cGridBag modulation = new cGridBag();
1564
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1565
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1566
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1567
+ colorSection.add(modulation);
14871568
1488
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1489
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1490
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1491
- aConstraints.gridx += 1;
1492
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1493
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1494
- aConstraints.gridx = 0;
1495
- aConstraints.gridy += 1;
1496
- aConstraints.gridwidth = 1;
1569
+ cGridBag texture = new cGridBag();
1570
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1571
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1572
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1573
+ colorSection.add(texture);
14971574
1498
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1499
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1500
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1501
- aConstraints.gridx += 1;
1502
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1503
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1504
- aConstraints.gridx = 0;
1505
- aConstraints.gridy += 1;
1506
- aConstraints.gridwidth = 1;
1575
+ cGridBag anisoU = new cGridBag();
1576
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1577
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1578
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1579
+ colorSection.add(anisoU);
15071580
1508
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1509
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1510
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1511
- aConstraints.gridx += 1;
1512
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1513
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1514
- aConstraints.gridx = 0;
1515
- aConstraints.gridy += 1;
1516
- aConstraints.gridwidth = 1;
1581
+ cGridBag anisoV = new cGridBag();
1582
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1583
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1584
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1585
+ colorSection.add(anisoV);
15171586
1518
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1519
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1520
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1521
- aConstraints.gridx += 1;
1522
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1523
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1524
- aConstraints.gridx = 0;
1525
- aConstraints.gridy += 1;
1526
- aConstraints.gridwidth = 1;
1587
+ cGridBag shadowbias = new cGridBag();
1588
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1589
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1590
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1591
+ colorSection.add(shadowbias);
15271592
1528
- //aConstraints.weighty = 1;
1529
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1530
- //aConstraints.gridx += 1;
1531
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1532
- aConstraints.weighty = 0;
1533
- aConstraints.gridx = 0;
1534
- aConstraints.gridy += 1;
1535
- aConstraints.gridwidth = 1;
1593
+ panel.add(new JSeparator());
1594
+
1595
+ panel.add(colorSection);
1596
+
1597
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1598
+
1599
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1600
+
1601
+ cGridBag diffuse = new cGridBag();
1602
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1603
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1604
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1605
+ diffuseSection.add(diffuse);
15361606
1537
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1538
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1539
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1540
- aConstraints.gridx += 1;
1541
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1542
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1543
- aConstraints.gridx = 0;
1544
- aConstraints.gridy += 1;
1545
- aConstraints.gridwidth = 1;
1607
+ cGridBag diffuseness = new cGridBag();
1608
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1609
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1610
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1611
+ diffuseSection.add(diffuseness);
15461612
1547
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1548
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1549
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1550
- aConstraints.gridx += 1;
1551
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1552
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1553
- aConstraints.gridx = 0;
1554
- aConstraints.gridy += 1;
1555
- aConstraints.gridwidth = 1;
1613
+ cGridBag selfshadow = new cGridBag();
1614
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1615
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1616
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1617
+ diffuseSection.add(selfshadow);
15561618
1557
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1558
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1559
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1560
- aConstraints.gridx += 1;
1561
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1562
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1563
- aConstraints.gridx = 0;
1564
- aConstraints.gridy += 1;
1565
- aConstraints.gridwidth = 1;
1619
+ cGridBag sheen = new cGridBag();
1620
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1621
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1622
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1623
+ diffuseSection.add(sheen);
15661624
1567
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1568
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1569
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1570
- aConstraints.gridx += 1;
1571
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1572
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1573
- aConstraints.gridx = 0;
1574
- aConstraints.gridy += 1;
1575
- aConstraints.gridwidth = 1;
1625
+ cGridBag subsurface = new cGridBag();
1626
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1627
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1628
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1629
+ diffuseSection.add(subsurface);
15761630
1577
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1578
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1579
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1580
- aConstraints.gridx += 1;
1581
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1582
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1583
- aConstraints.gridx = 0;
1584
- aConstraints.gridy += 1;
1585
- aConstraints.gridwidth = 1;
1631
+ cGridBag shadow = new cGridBag();
1632
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1633
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1634
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1635
+ diffuseSection.add(shadow);
15861636
1587
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1588
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1589
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1590
- aConstraints.gridx += 1;
1591
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1592
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1593
- aConstraints.gridx = 0;
1594
- aConstraints.gridy += 1;
1595
- aConstraints.gridwidth = 1;
1637
+ cGridBag fakedepth = new cGridBag();
1638
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1639
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1640
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1641
+ diffuseSection.add(fakedepth);
15961642
1597
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1598
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1599
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1600
- aConstraints.gridx += 1;
1601
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1602
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1603
- aConstraints.gridx = 0;
1604
- aConstraints.gridy += 1;
1605
- aConstraints.gridwidth = 1;
1643
+ panel.add(new JSeparator());
1644
+
1645
+ panel.add(diffuseSection);
1646
+
1647
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1648
+
1649
+ cGridBag specularSection = new cGridBag().setVertical(true);
16061650
1607
- //aConstraints.weighty = 1;
1608
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1609
- //aConstraints.gridx += 1;
1610
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1611
- aConstraints.weighty = 0;
1612
- aConstraints.gridx = 0;
1613
- aConstraints.gridy += 1;
1614
- aConstraints.gridwidth = 1;
1651
+ cGridBag specular = new cGridBag();
1652
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1653
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1654
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1655
+ specularSection.add(specular);
16151656
1616
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1617
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1618
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1619
- aConstraints.gridx += 1;
1620
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1621
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1622
- aConstraints.gridx = 0;
1623
- aConstraints.gridy += 1;
1624
- aConstraints.gridwidth = 1;
1657
+ cGridBag lightarea = new cGridBag();
1658
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1659
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1660
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1661
+ specularSection.add(lightarea);
16251662
1626
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1627
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1628
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1629
- aConstraints.gridx += 1;
1630
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1631
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1632
- aConstraints.gridx = 0;
1633
- aConstraints.gridy += 1;
1634
- aConstraints.gridwidth = 1;
1663
+ cGridBag shininess = new cGridBag();
1664
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1665
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1666
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1667
+ specularSection.add(shininess);
16351668
1636
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1637
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1638
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1639
- aConstraints.gridx += 1;
1640
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1641
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1642
- aConstraints.gridx = 0;
1643
- aConstraints.gridy += 1;
1644
- aConstraints.gridwidth = 1;
1669
+ cGridBag metalness = new cGridBag();
1670
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1671
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1672
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1673
+ specularSection.add(metalness);
16451674
1646
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1647
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1648
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1649
- aConstraints.gridx += 1;
1650
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1651
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1652
- aConstraints.gridx = 0;
1653
- aConstraints.gridy += 1;
1654
- aConstraints.gridwidth = 1;
1675
+ cGridBag velvet = new cGridBag();
1676
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1677
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1678
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1679
+ specularSection.add(velvet);
16551680
1656
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1657
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1658
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1659
- aConstraints.gridx += 1;
1660
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1661
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1662
- aConstraints.gridx = 0;
1663
- aConstraints.gridy += 1;
1664
- aConstraints.gridwidth = 1;
1665
-
1666
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1667
- Return();
1681
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1682
+ //Return();
16681683 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16691684 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16701685 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1675,130 +1690,93 @@
16751690 // aConstraints.gridy += 1;
16761691 // aConstraints.gridwidth = 1;
16771692
1678
- //aConstraints.weighty = 1;
1679
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1680
- //aConstraints.gridx += 1;
1681
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1682
- aConstraints.weighty = 0;
1683
- aConstraints.gridx = 0;
1684
- aConstraints.gridy += 1;
1685
- aConstraints.gridwidth = 1;
16861693
1687
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1688
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1689
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1690
- aConstraints.gridx += 1;
1691
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1692
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1693
- aConstraints.gridx = 0;
1694
- aConstraints.gridy += 1;
1695
- aConstraints.gridwidth = 1;
1694
+ panel.add(new JSeparator());
1695
+
1696
+ panel.add(specularSection);
1697
+
1698
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1699
+
1700
+ cGridBag globalSection = new cGridBag().setVertical(true);
16961701
1697
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1698
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1699
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1700
- aConstraints.gridx += 1;
1701
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1702
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1703
- aConstraints.gridx = 0;
1704
- aConstraints.gridy += 1;
1705
- aConstraints.gridwidth = 1;
1702
+ cGridBag camera = new cGridBag();
1703
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1704
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1705
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1706
+ globalSection.add(camera);
17061707
1707
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1708
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1709
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1710
- aConstraints.gridx += 1;
1711
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1712
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1713
- aConstraints.gridx = 0;
1714
- aConstraints.gridy += 1;
1715
- aConstraints.gridwidth = 1;
1708
+ cGridBag ambient = new cGridBag();
1709
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1710
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1711
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1712
+ globalSection.add(ambient);
17161713
1717
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1718
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1719
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1720
- aConstraints.gridx += 1;
1721
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1722
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1723
- aConstraints.gridx = 0;
1724
- aConstraints.gridy += 1;
1725
- aConstraints.gridwidth = 1;
1726
- aConstraints.weighty = 0;
1714
+ cGridBag backlit = new cGridBag();
1715
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1716
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1717
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1718
+ globalSection.add(backlit);
17271719
1728
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1729
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1730
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1731
- aConstraints.gridx += 1;
1732
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1733
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1734
- aConstraints.gridx = 0;
1735
- aConstraints.gridy += 1;
1736
- aConstraints.gridwidth = 1;
1720
+ cGridBag opacity = new cGridBag();
1721
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1722
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1723
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1724
+ globalSection.add(opacity);
17371725
1738
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1739
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1740
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1741
- aConstraints.gridx += 1;
1742
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1743
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1744
- aConstraints.gridx = 0;
1745
- aConstraints.gridy += 1;
1746
- aConstraints.gridwidth = 1;
1726
+ panel.add(new JSeparator());
1727
+
1728
+ panel.add(globalSection);
1729
+
1730
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1731
+
1732
+ cGridBag textureSection = new cGridBag().setVertical(true);
17471733
1748
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1749
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1750
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1751
- aConstraints.gridx += 1;
1752
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1753
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1754
- aConstraints.gridx = 0;
1755
- aConstraints.gridy += 1;
1756
- aConstraints.gridwidth = 1;
1734
+ cGridBag bump = new cGridBag();
1735
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1736
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1737
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1738
+ textureSection.add(bump);
17571739
1758
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1759
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1760
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1761
- aConstraints.gridx += 1;
1762
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1763
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1764
- aConstraints.gridx = 0;
1765
- aConstraints.gridy += 1;
1766
- aConstraints.gridwidth = 1;
1740
+ cGridBag noise = new cGridBag();
1741
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1742
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1743
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1744
+ textureSection.add(noise);
17671745
1768
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1769
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1770
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1771
- aConstraints.gridx += 1;
1772
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1773
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1774
- aConstraints.gridx = 0;
1775
- aConstraints.gridy += 1;
1776
- aConstraints.gridwidth = 1;
1746
+ cGridBag power = new cGridBag();
1747
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1748
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1749
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1750
+ textureSection.add(power);
17771751
1778
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1779
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1780
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1781
- aConstraints.gridx += 1;
1782
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1783
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1784
- aConstraints.gridx = 0;
1785
- aConstraints.gridy += 1;
1786
- aConstraints.gridwidth = 1;
1752
+ cGridBag borderfade = new cGridBag();
1753
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1754
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1755
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1756
+ textureSection.add(borderfade);
17871757
1788
- //aConstraints.weighty = 1;
1789
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1790
- //aConstraints.gridx += 1;
1791
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1792
- aConstraints.weighty = 0;
1758
+ cGridBag fog = new cGridBag();
1759
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1760
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1761
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1762
+ textureSection.add(fog);
17931763
1794
- aConstraints.gridx = 0;
1795
- aConstraints.gridy = 0;
1796
- aConstraints.gridwidth = 1;
1764
+ cGridBag opacityPower = new cGridBag();
1765
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1766
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1767
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1768
+ textureSection.add(opacityPower);
1769
+
1770
+ panel.add(new JSeparator());
1771
+
1772
+ panel.add(textureSection);
1773
+
1774
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17971775
17981776 SetMaterial(copy); // .GetMaterial());
17991777
1800
- colorField.addChangeListener(this);
1801
- modulationField.addChangeListener(this);
1778
+ //colorField.addChangeListener(this);
1779
+// modulationField.addChangeListener(this);
18021780 metalnessField.addChangeListener(this);
18031781 diffuseField.addChangeListener(this);
18041782 specularField.addChangeListener(this);
....@@ -1828,12 +1806,15 @@
18281806 opacityPowerField.addChangeListener(this);
18291807 /**/
18301808
1831
- resetSlidersButton.addActionListener(this);
18321809 clearMaterialButton.addActionListener(this);
18331810 createMaterialButton.addActionListener(this);
1834
-
1835
- propagateToggle.addItemListener(this);
1836
- multiplyToggle.addItemListener(this);
1811
+
1812
+ if (Globals.ADVANCED)
1813
+ {
1814
+ resetSlidersButton.addActionListener(this);
1815
+ propagateToggle.addItemListener(this);
1816
+ multiplyToggle.addItemListener(this);
1817
+ }
18371818 }
18381819
18391820 void DropFile(java.io.File[] files, boolean textures)
....@@ -2004,7 +1985,7 @@
20041985
20051986 //? flashIt = false;
20061987 CameraPane pane = (CameraPane) cameraView;
2007
- pane.clickStart(location.x, location.y, 0);
1988
+ pane.clickStart(location.x, location.y, 0, 0);
20081989 pane.clickEnd(location.x, location.y, 0, true);
20091990
20101991 if (group.selection.size() == 1)
....@@ -2053,6 +2034,7 @@
20532034 e2.printStackTrace();
20542035 }
20552036 }
2037
+
20562038 LoadJMEThread loadThread;
20572039
20582040 class LoadJMEThread extends Thread
....@@ -2110,6 +2092,7 @@
21102092 //LoadFile0(filename, converter);
21112093 }
21122094 }
2095
+
21132096 LoadOBJThread loadObjThread;
21142097
21152098 class LoadOBJThread extends Thread
....@@ -2188,19 +2171,19 @@
21882171
21892172 void LoadObjFile(String fullname)
21902173 {
2191
- /*
2174
+ System.out.println("Loading " + fullname);
2175
+ /**/
21922176 //lastFilename = fullname;
21932177 if(loadObjThread == null)
21942178 {
2195
- loadObjThread = new LoadOBJThread();
2196
- loadObjThread.start();
2179
+ loadObjThread = new LoadOBJThread();
2180
+ loadObjThread.start();
21972181 }
21982182
21992183 loadObjThread.add(fullname);
2200
- */
2184
+ /**/
22012185
2202
- System.out.println("Loading " + fullname);
2203
- makeSomething(new FileObject(fullname, true), true);
2186
+ //makeSomething(new FileObject(fullname, true), true);
22042187 }
22052188
22062189 void LoadGFDFile(String fullname)
....@@ -2461,11 +2444,11 @@
24612444
24622445 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24632446 {
2464
- if (GrafreeD.standAlone)
2447
+ if (Grafreed.standAlone)
24652448 {
24662449 /**/
24672450 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2468
- browser.show();
2451
+ browser.setVisible(true);
24692452 String filename = browser.getFile();
24702453 if (filename != null && filename.length() > 0)
24712454 {
....@@ -2610,6 +2593,7 @@
26102593 }
26112594 if (input == null)
26122595 {
2596
+ new Exception().printStackTrace();
26132597 System.exit(0);
26142598 }
26152599
....@@ -2824,7 +2808,8 @@
28242808 return;
28252809 }
28262810
2827
- multiplyToggle.setSelected(mat.multiply);
2811
+ if (multiplyToggle != null)
2812
+ multiplyToggle.setSelected(mat.multiply);
28282813
28292814 assert (object.projectedVertices != null);
28302815
....@@ -3039,9 +3024,9 @@
30393024 frame.validate();
30403025
30413026 return;
3042
- } else if (event.getSource() == toggleRandomItem)
3027
+ } else if (event.getSource() == toggleSwitchItem)
30433028 {
3044
- cameraView.ToggleRandom();
3029
+ cameraView.ToggleSwitch();
30453030 cameraView.repaint();
30463031 return;
30473032 } else if (event.getSource() == toggleHandleItem)
....@@ -3070,6 +3055,10 @@
30703055 {
30713056 copy.live ^= true;
30723057 return;
3058
+ } else if (event.getSource() == selectCB)
3059
+ {
3060
+ copy.dontselect ^= true;
3061
+ return;
30733062 } else if (event.getSource() == hideCB)
30743063 {
30753064 copy.hide ^= true;
....@@ -3084,6 +3073,7 @@
30843073 if (event.getSource() == randomCB)
30853074 {
30863075 copy.random ^= true;
3076
+ objEditor.refreshContents();
30873077 return;
30883078 }
30893079 if (event.getSource() == speedupCB)
....@@ -3107,8 +3097,9 @@
31073097
31083098 public void actionPerformed(ActionEvent event)
31093099 {
3100
+ Object source = event.getSource();
31103101 // SCRIPT DIALOG
3111
- if (event.getSource() == okbutton)
3102
+ if (source == okbutton)
31123103 {
31133104 textpanel.setVisible(false);
31143105 textpanel.remove(textarea);
....@@ -3120,7 +3111,7 @@
31203111 textarea = null;
31213112 textpanel = null;
31223113 }
3123
- if (event.getSource() == cancelbutton)
3114
+ if (source == cancelbutton)
31243115 {
31253116 textpanel.setVisible(false);
31263117 textpanel.remove(textarea);
....@@ -3132,50 +3123,50 @@
31323123 //applySelf();
31333124 //client.refreshEditWindow();
31343125 //refreshContents();
3135
- if (event.getSource() == nameField)
3126
+ if (source == nameField)
31363127 {
31373128 //System.out.println("ObjEditor " + event);
31383129 applySelf0(true);
31393130 //parent.applySelf();
31403131 objEditor.refreshContents();
3141
- } else if (event.getSource() == resetButton)
3132
+ } else if (source == resetButton)
31423133 {
31433134 CameraPane.fullreset = true;
31443135 copy.Reset(); // ResetMeshes();
31453136 copy.Touch();
31463137 objEditor.refreshContents();
3147
- } else if (event.getSource() == stepItem)
3138
+ } else if (source == stepItem)
31483139 {
31493140 //cameraView.ONESTEP = true;
31503141 Globals.ONESTEP = true;
31513142 cameraView.repaint();
31523143 return;
3153
- } else if (event.getSource() == stepButton)
3144
+ } else if (source == stepButton)
31543145 {
31553146 copy.Step();
31563147 copy.Touch();
31573148 objEditor.refreshContents();
3158
- } else if (event.getSource() == slowerButton)
3149
+ } else if (source == slowerButton)
31593150 {
31603151 copy.Slower();
31613152 copy.Touch();
31623153 objEditor.refreshContents();
3163
- } else if (event.getSource() == fasterButton)
3154
+ } else if (source == fasterButton)
31643155 {
31653156 copy.Faster();
31663157 copy.Touch();
31673158 objEditor.refreshContents();
3168
- } else if (event.getSource() == remarkButton)
3159
+ } else if (source == remarkButton)
31693160 {
31703161 copy.Remark();
31713162 copy.Touch();
31723163 objEditor.refreshContents();
3173
- } else if (event.getSource() == stepAllButton)
3164
+ } else if (source == stepAllButton)
31743165 {
31753166 copy.StepAll();
31763167 copy.Touch();
31773168 objEditor.refreshContents();
3178
- } else if (event.getSource() == resetAllButton)
3169
+ } else if (source == resetAllButton)
31793170 {
31803171 //CameraPane.fullreset = true;
31813172 copy.ResetAll(); // ResetMeshes();
....@@ -3208,53 +3199,75 @@
32083199 // Close();
32093200 // }
32103201 // else
3211
- if (event.getSource() == resetSlidersButton)
3202
+ if (source == resetSlidersButton)
32123203 {
32133204 ResetSliders();
3214
- } else if (event.getSource() == clearMaterialButton)
3205
+ } else if (source == clearMaterialButton)
32153206 {
32163207 ClearMaterial();
3217
- } else if (event.getSource() == createMaterialButton)
3208
+ } else if (source == createMaterialButton)
32183209 {
32193210 CreateMaterial();
3220
- } else if (event.getSource() == clearPanelButton)
3211
+ } else if (source == clearPanelButton)
32213212 {
32223213 copy.ClearUI();
32233214 refreshContents(true);
3224
- } /*
3225
- }
3226
-
3227
- public boolean action(Event event, Object arg)
3228
- {
3229
- */ else if (event.getSource() == closeItem)
3215
+ } else if (source == importGFDItem)
3216
+ {
3217
+ ImportGFD();
3218
+ } else
3219
+ if (source == importVRMLX3DItem)
3220
+ {
3221
+ ImportVRMLX3D();
3222
+ } else
3223
+ if (source == import3DSItem)
3224
+ {
3225
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3226
+ } else
3227
+ if (source == importOBJItem)
3228
+ {
3229
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3230
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3231
+ browser.setVisible(true);
3232
+ String filename = browser.getFile();
3233
+ if (filename != null && filename.length() > 0)
3234
+ {
3235
+ String fullname = browser.getDirectory() + filename;
3236
+ makeSomething(ReadOBJ(fullname), true);
3237
+ }
3238
+ } else
3239
+ if (source == closeItem)
32303240 {
32313241 Close();
32323242 //return true;
3233
- } else if (event.getSource() == loadItem)
3243
+ } else if (source == loadItem)
32343244 {
32353245 load();
32363246 //return true;
3237
- } else if (event.getSource() == saveItem)
3247
+ } else if (source == newItem)
3248
+ {
3249
+ New();
3250
+ } else if (source == saveItem)
32383251 {
32393252 save();
32403253 //return true;
3241
- } else if (event.getSource() == saveAsItem)
3254
+ } else if (source == saveAsItem)
32423255 {
32433256 saveAs();
32443257 //return true;
3245
- } else if (event.getSource() == reexportItem)
3258
+ } else if (source == reexportItem)
32463259 {
32473260 reexport();
32483261 //return true;
3249
- } else if (event.getSource() == exportAsItem)
3262
+ } else if (source == exportAsItem)
32503263 {
32513264 export();
32523265 //return true;
3253
- } else if (event.getSource() == povItem)
3266
+ } else if (source == povItem)
32543267 {
32553268 generatePOV();
32563269 //return true;
3257
- } else if (event.getSource() == zBufferItem)
3270
+ } else if (source == zBufferItem)
32583271 {
32593272 try
32603273 {
....@@ -3276,21 +3289,8 @@
32763289 cameraView.repaint();
32773290 //return true;
32783291 }
3279
- */ else if (event.getSource() == editCameraItem)
3280
- {
3281
- cameraView.ProtectCamera();
3282
- cameraView.repaint();
3283
- return;
3284
- } else if (event.getSource() == revertCameraItem)
3285
- {
3286
- cameraView.RevertCamera();
3287
- cameraView.repaint();
3288
- return;
3289
-// } else if (event.getSource() == textureButton)
3290
-// {
3291
-// return; // true;
3292
- } else // combos...
3293
- if (event.getSource() == texresMenu)
3292
+ */ else // combos...
3293
+ if (source == texresMenu)
32943294 {
32953295 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32963296 copy.texres = texresMenu.getSelectedIndex();
....@@ -3302,12 +3302,268 @@
33023302 }
33033303 }
33043304
3305
+ void New()
3306
+ {
3307
+ while (copy.Size() > 1)
3308
+ {
3309
+ copy.remove(1);
3310
+ }
3311
+
3312
+ ResetModel();
3313
+ objEditor.refreshContents();
3314
+ }
3315
+
3316
+ static public byte[] Compress(Object3D o)
3317
+ {
3318
+ try
3319
+ {
3320
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3321
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3322
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3323
+
3324
+ Object3D parent = o.parent;
3325
+ o.parent = null;
3326
+
3327
+ out.writeObject(o);
3328
+
3329
+ o.parent = parent;
3330
+
3331
+ out.flush();
3332
+
3333
+ zstream.close();
3334
+ out.close();
3335
+
3336
+ return baos.toByteArray();
3337
+ } catch (Exception e)
3338
+ {
3339
+ System.err.println(e);
3340
+ return null;
3341
+ }
3342
+ }
3343
+
3344
+ static public Object Uncompress(byte[] bytes)
3345
+ {
3346
+ System.out.println("#bytes = " + bytes.length);
3347
+ try
3348
+ {
3349
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3350
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3351
+ ObjectInputStream in = new ObjectInputStream(istream);
3352
+ Object obj = in.readObject();
3353
+ in.close();
3354
+
3355
+ return obj;
3356
+ } catch (Exception e)
3357
+ {
3358
+ System.err.println(e);
3359
+ return null;
3360
+ }
3361
+ }
3362
+
3363
+ static public Object clone(Object o)
3364
+ {
3365
+ try
3366
+ {
3367
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3368
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3369
+
3370
+ out.writeObject(o);
3371
+
3372
+ out.flush();
3373
+ out.close();
3374
+
3375
+ byte[] bytes = baos.toByteArray();
3376
+
3377
+ System.out.println("clone = " + bytes.length);
3378
+
3379
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3380
+ ObjectInputStream in = new ObjectInputStream(bais);
3381
+ Object obj = in.readObject();
3382
+ in.close();
3383
+
3384
+ return obj;
3385
+ } catch (Exception e)
3386
+ {
3387
+ System.err.println(e);
3388
+ return null;
3389
+ }
3390
+ }
3391
+
3392
+ cRadio GetCurrentTab()
3393
+ {
3394
+ cRadio ab;
3395
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3396
+ {
3397
+ ab = (cRadio)e.nextElement();
3398
+ if(ab.GetObject() == copy)
3399
+ {
3400
+ return ab;
3401
+ }
3402
+ }
3403
+
3404
+ return null;
3405
+ }
3406
+
3407
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3408
+
3409
+ public void Save()
3410
+ {
3411
+ cRadio tab = GetCurrentTab();
3412
+
3413
+ boolean temp = CameraPane.SWITCH;
3414
+ CameraPane.SWITCH = false;
3415
+
3416
+ copy.ExtractBigData(hashtable);
3417
+
3418
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3419
+ tab.graphs[tab.undoindex++] = Compress(copy);
3420
+
3421
+ copy.RestoreBigData(hashtable);
3422
+
3423
+ CameraPane.SWITCH = temp;
3424
+
3425
+ //assert(hashtable.isEmpty());
3426
+
3427
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3428
+ {
3429
+ tab.graphs[i] = null;
3430
+ }
3431
+
3432
+ // test save
3433
+ if (false)
3434
+ {
3435
+ try
3436
+ {
3437
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3438
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3439
+
3440
+ p.writeObject(copy);
3441
+
3442
+ p.flush();
3443
+
3444
+ ostream.close();
3445
+ } catch (Exception e)
3446
+ {
3447
+ e.printStackTrace();
3448
+ }
3449
+ }
3450
+ }
3451
+
3452
+ void CopyChanged(Object3D obj)
3453
+ {
3454
+ boolean temp = CameraPane.SWITCH;
3455
+ CameraPane.SWITCH = false;
3456
+
3457
+ copy.ExtractBigData(hashtable);
3458
+
3459
+ copy.clear();
3460
+
3461
+ for (int i=0; i<obj.Size(); i++)
3462
+ {
3463
+ copy.add(obj.get(i));
3464
+ }
3465
+
3466
+ copy.RestoreBigData(hashtable);
3467
+
3468
+ CameraPane.SWITCH = temp;
3469
+
3470
+ //assert(hashtable.isEmpty());
3471
+
3472
+ copy.Touch();
3473
+
3474
+ ResetModel();
3475
+ copy.HardTouch(); // recompile?
3476
+
3477
+ cRadio ab;
3478
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3479
+ {
3480
+ ab = (cRadio)e.nextElement();
3481
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3482
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3483
+ if (test != null)
3484
+ {
3485
+ test.editWindow = ab.object.editWindow;
3486
+ ab.object = test;
3487
+ }
3488
+ }
3489
+
3490
+ refreshContents();
3491
+ }
3492
+
3493
+ public void Undo()
3494
+ {
3495
+ cRadio tab = GetCurrentTab();
3496
+
3497
+ if (tab.undoindex == 0)
3498
+ {
3499
+ java.awt.Toolkit.getDefaultToolkit().beep();
3500
+ return;
3501
+ }
3502
+
3503
+ if (tab.graphs[tab.undoindex] == null)
3504
+ {
3505
+ Save();
3506
+ tab.undoindex -= 1;
3507
+ }
3508
+
3509
+ tab.undoindex -= 1;
3510
+
3511
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3512
+ }
3513
+
3514
+ public void Redo()
3515
+ {
3516
+ cRadio tab = GetCurrentTab();
3517
+
3518
+ if (tab.graphs[tab.undoindex + 1] == null)
3519
+ {
3520
+ java.awt.Toolkit.getDefaultToolkit().beep();
3521
+ return;
3522
+ }
3523
+
3524
+ tab.undoindex += 1;
3525
+
3526
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3527
+ }
3528
+
3529
+ void ImportGFD()
3530
+ {
3531
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3532
+ browser.show();
3533
+ String filename = browser.getFile();
3534
+ if (filename != null && filename.length() > 0)
3535
+ {
3536
+ String fullname = browser.getDirectory() + filename;
3537
+
3538
+ //Object3D readobj =
3539
+ objEditor.ReadGFD(fullname, objEditor);
3540
+ //makeSomething(readobj);
3541
+ }
3542
+ }
3543
+
3544
+ void ImportVRMLX3D()
3545
+ {
3546
+ if (Grafreed.standAlone)
3547
+ {
3548
+ /**/
3549
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3550
+ browser.show();
3551
+ String filename = browser.getFile();
3552
+ if (filename != null && filename.length() > 0)
3553
+ {
3554
+ String fullname = browser.getDirectory() + filename;
3555
+ LoadVRMLX3D(fullname);
3556
+ }
3557
+ /**/
3558
+ }
3559
+ }
3560
+
33053561 void ToggleAnimation()
33063562 {
33073563 if (!Globals.ANIMATION)
33083564 {
33093565 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3310
- browser.show();
3566
+ browser.setVisible(true);
33113567 String filename = browser.getFile();
33123568 if (filename != null && filename.length() > 0)
33133569 {
....@@ -3317,8 +3573,8 @@
33173573
33183574 Globals.ANIMATION ^= true;
33193575
3320
- GrafreeD.wav.cursor = 0;
3321
- GrafreeD.wav.loop = 0;
3576
+ Grafreed.wav.cursor = 0;
3577
+ Grafreed.wav.loop = 0;
33223578 }
33233579 } else
33243580 {
....@@ -3368,7 +3624,7 @@
33683624 void CreateMaterial()
33693625 {
33703626 //copy.ClearMaterial(); // PATCH
3371
- copy.CreateMaterialS(multiplyToggle.isSelected());
3627
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33723628 if (copy.selection.size() > 0)
33733629 //SetMaterial(copy);
33743630 {
....@@ -3427,11 +3683,11 @@
34273683 {
34283684 copy.ResetBlockLoop(); // temporary problem
34293685
3430
- boolean random = CameraPane.RANDOM;
3431
- CameraPane.RANDOM = false; // parse everything
3686
+ boolean random = CameraPane.SWITCH;
3687
+ CameraPane.SWITCH = false; // parse everything
34323688 copy.ResetDisplayList();
34333689 copy.HardTouch();
3434
- CameraPane.RANDOM = random;
3690
+ CameraPane.SWITCH = random;
34353691 }
34363692
34373693 // public void applySelf()
....@@ -3501,10 +3757,40 @@
35013757 current.fakedepth = (float) fakedepthField.getFloat();
35023758 current.shadowbias = (float) shadowbiasField.getFloat();
35033759
3504
- if (!NumberSlider.frozen)
3760
+ if (!cNumberSlider.frozen)
35053761 {
35063762 //System.out.println("Propagate = " + propagate);
35073763 copy.UpdateMaterial(anchor, current, propagate);
3764
+
3765
+ if (copy.material != null)
3766
+ {
3767
+ cMaterial mat = copy.material;
3768
+
3769
+ colorField.SetToolTipValue((mat.color));
3770
+ modulationField.SetToolTipValue((mat.modulation));
3771
+ metalnessField.SetToolTipValue((mat.metalness));
3772
+ diffuseField.SetToolTipValue((mat.diffuse));
3773
+ specularField.SetToolTipValue((mat.specular));
3774
+ shininessField.SetToolTipValue((mat.shininess));
3775
+ shiftField.SetToolTipValue((mat.shift));
3776
+ ambientField.SetToolTipValue((mat.ambient));
3777
+ lightareaField.SetToolTipValue((mat.lightarea));
3778
+ diffusenessField.SetToolTipValue((mat.factor));
3779
+ velvetField.SetToolTipValue((mat.velvet));
3780
+ sheenField.SetToolTipValue((mat.sheen));
3781
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3782
+ backlitField.SetToolTipValue((mat.bump));
3783
+ anisoField.SetToolTipValue((mat.aniso));
3784
+ anisoVField.SetToolTipValue((mat.anisoV));
3785
+ cameraField.SetToolTipValue((mat.cameralight));
3786
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3787
+ shadowField.SetToolTipValue((mat.shadow));
3788
+ textureField.SetToolTipValue((mat.texture));
3789
+ opacityField.SetToolTipValue((mat.opacity));
3790
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3791
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3792
+ }
3793
+
35083794 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35093795 {
35103796 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3549,6 +3835,7 @@
35493835 || e.getSource() == apertureField
35503836 || e.getSource() == shadowblurField)
35513837 {
3838
+ new Exception().printStackTrace();
35523839 System.exit(0);
35533840 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35543841 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3619,7 +3906,7 @@
36193906 }
36203907
36213908 if (normalpushField != null)
3622
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3909
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36233910 }
36243911
36253912 void SnapObject()
....@@ -3874,7 +4161,7 @@
38744161
38754162 radioPanel.revalidate();
38764163 radioPanel.repaint();
3877
- ctrlPanel.revalidate(); // ? new
4164
+ ctrlPanel.validate(); // ? new
38784165 ctrlPanel.repaint();
38794166 }
38804167 }
....@@ -3883,6 +4170,7 @@
38834170
38844171 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38854172 {
4173
+ Save();
38864174 //Tween.set(thing, 0).target(1).start(tweenManager);
38874175 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38884176 // if (thing instanceof GenericJointDemo)
....@@ -4086,6 +4374,7 @@
40864374 }
40874375 }
40884376 }
4377
+
40894378 LoadGFDThread loadGFDThread;
40904379
40914380 void ReadGFD(String fullname, iCallBack cb)
....@@ -4105,8 +4394,10 @@
41054394
41064395 try
41074396 {
4397
+ // Try compressed version first.
41084398 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4109
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4399
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4400
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
41104401
41114402 readobj = (Object3D) p.readObject();
41124403 istream.close();
....@@ -4114,7 +4405,20 @@
41144405 readobj.ResetDisplayList();
41154406 } catch (Exception e)
41164407 {
4117
- e.printStackTrace();
4408
+ //e.printStackTrace();
4409
+ try
4410
+ {
4411
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4412
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4413
+
4414
+ readobj = (Object3D) p.readObject();
4415
+ istream.close();
4416
+
4417
+ readobj.ResetDisplayList();
4418
+ } catch (Exception e2)
4419
+ {
4420
+ e2.printStackTrace();
4421
+ }
41184422 }
41194423 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41204424 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4160,6 +4464,12 @@
41604464
41614465 void LoadIt(Object obj)
41624466 {
4467
+ if (obj == null)
4468
+ {
4469
+ // Invalid file
4470
+ return;
4471
+ }
4472
+
41634473 System.out.println("Loaded " + obj);
41644474 //new Exception().printStackTrace();
41654475 Object3D readobj = (Object3D) obj;
....@@ -4169,6 +4479,7 @@
41694479
41704480 if (readobj != null)
41714481 {
4482
+ Save();
41724483 try
41734484 {
41744485 //readobj.deepCopySelf(copy);
....@@ -4231,7 +4542,7 @@
42314542
42324543 void load() // throws ClassNotFoundException
42334544 {
4234
- if (GrafreeD.standAlone)
4545
+ if (Grafreed.standAlone)
42354546 {
42364547 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42374548 browser.show();
....@@ -4318,11 +4629,13 @@
43184629 try
43194630 {
43204631 FileOutputStream ostream = new FileOutputStream(lastname);
4321
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4632
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4633
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43224634
43234635 p.writeObject(copy);
43244636 p.flush();
43254637
4638
+ zstream.close();
43264639 ostream.close();
43274640
43284641 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4332,11 +4645,12 @@
43324645 {
43334646 }
43344647 }
4648
+
43354649 String lastname;
43364650
43374651 void saveAs()
43384652 {
4339
- if (GrafreeD.standAlone)
4653
+ if (Grafreed.standAlone)
43404654 {
43414655 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43424656 browser.setVisible(true);
....@@ -4441,13 +4755,13 @@
44414755 try
44424756 {
44434757 FileOutputStream ostream = new FileOutputStream(filename);
4444
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4445
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4758
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4759
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44464760
44474761 Object3D objectparent = obj.parent;
44484762 obj.parent = null;
44494763
4450
- Object3D object = (Object3D) GrafreeD.clone(obj);
4764
+ Object3D object = (Object3D) Grafreed.clone(obj);
44514765
44524766 obj.parent = objectparent;
44534767
....@@ -4459,8 +4773,8 @@
44594773 p.writeObject(object);
44604774 p.flush();
44614775
4776
+ zstream.close();
44624777 ostream.close();
4463
- // zstream.close();
44644778
44654779 // group.selection.get(0).parent = parent;
44664780 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4481,7 +4795,7 @@
44814795 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44824796 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44834797 copy.generatePOV(buffer);
4484
- if (GrafreeD.standAlone)
4798
+ if (Grafreed.standAlone)
44854799 {
44864800 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44874801 browser.show();
....@@ -4507,7 +4821,8 @@
45074821 Object3D client;
45084822 Object3D copy;
45094823 MenuBar menuBar;
4510
- Menu windowMenu;
4824
+ Menu fileMenu;
4825
+ MenuItem newItem;
45114826 MenuItem loadItem;
45124827 MenuItem saveItem;
45134828 MenuItem saveAsItem;
....@@ -4515,13 +4830,11 @@
45154830 MenuItem reexportItem;
45164831 MenuItem povItem;
45174832 MenuItem closeItem;
4518
- Menu cameraMenu;
4833
+
45194834 CheckboxMenuItem zBufferItem;
45204835 //MenuItem normalLensItem;
4521
- MenuItem editCameraItem;
4522
- MenuItem revertCameraItem;
4523
- CheckboxMenuItem toggleLiveItem;
45244836 MenuItem stepItem;
4837
+ CheckboxMenuItem toggleLiveItem;
45254838 CheckboxMenuItem toggleFullScreenItem;
45264839 CheckboxMenuItem toggleTimelineItem;
45274840 CheckboxMenuItem toggleRenderItem;
....@@ -4530,7 +4843,7 @@
45304843 CheckboxMenuItem toggleFootContactItem;
45314844 CheckboxMenuItem toggleDLItem;
45324845 CheckboxMenuItem toggleTextureItem;
4533
- CheckboxMenuItem toggleRandomItem;
4846
+ CheckboxMenuItem toggleSwitchItem;
45344847 CheckboxMenuItem toggleRootItem;
45354848 CheckboxMenuItem animationItem;
45364849 CheckboxMenuItem toggleHandleItem;
....@@ -4538,20 +4851,20 @@
45384851 JSplitPane mainPanel;
45394852 JScrollPane scrollpane;
45404853 JPanel toolbarPanel;
4541
- JPanel treePanel;
4854
+ cGridBag treePanel;
45424855 JPanel radioPanel;
45434856 ButtonGroup buttonGroup;
4544
- JPanel ctrlPanel;
4545
- JPanel materialPanel;
4857
+ cGridBag ctrlPanel;
4858
+ cGridBag materialPanel;
45464859 JScrollPane infoPanel;
4547
- JPanel optionsPanel;
4860
+ cGridBag optionsPanel;
45484861 JTabbedPane objectPanel;
4549
- JPanel XYZPanel;
4862
+ cGridBag XYZPanel;
45504863 JSplitPane gridPanel;
45514864 JSplitPane bigPanel;
4552
- JPanel bigThree;
4553
- JTabbedPane scenePanel;
4554
- JPanel centralPanel;
4865
+ cGridBag bigThree;
4866
+ cGridBag scenePanel;
4867
+ cGridBag centralPanel;
45554868 JSplitPane cameraPanel;
45564869 JPanel timelinePanel;
45574870 JMenuBar timelineMenubar;
....@@ -4604,67 +4917,72 @@
46044917 // MATERIAL
46054918 JLabel materialLabel;
46064919 JLabel colorLabel;
4607
- NumberSlider colorField;
4920
+ cNumberSlider colorField;
46084921 JLabel modulationLabel;
4609
- NumberSlider modulationField;
4922
+ cNumberSlider modulationField;
46104923 JLabel metalnessLabel;
4611
- NumberSlider metalnessField;
4924
+ cNumberSlider metalnessField;
46124925 JLabel diffuseLabel;
4613
- NumberSlider diffuseField;
4926
+ cNumberSlider diffuseField;
46144927 JLabel specularLabel;
4615
- NumberSlider specularField;
4928
+ cNumberSlider specularField;
46164929 JLabel shininessLabel;
4617
- NumberSlider shininessField;
4930
+ cNumberSlider shininessField;
46184931 JLabel shiftLabel;
4619
- NumberSlider shiftField;
4932
+ cNumberSlider shiftField;
46204933 JLabel ambientLabel;
4621
- NumberSlider ambientField;
4934
+ cNumberSlider ambientField;
46224935 JLabel lightareaLabel;
4623
- NumberSlider lightareaField;
4936
+ cNumberSlider lightareaField;
46244937 JLabel diffusenessLabel;
4625
- NumberSlider diffusenessField;
4938
+ cNumberSlider diffusenessField;
46264939 JLabel velvetLabel;
4627
- NumberSlider velvetField;
4940
+ cNumberSlider velvetField;
46284941 JLabel sheenLabel;
4629
- NumberSlider sheenField;
4942
+ cNumberSlider sheenField;
46304943 JLabel subsurfaceLabel;
4631
- NumberSlider subsurfaceField;
4944
+ cNumberSlider subsurfaceField;
46324945 //JLabel bumpLabel;
46334946 //NumberSlider bumpField;
46344947 JLabel backlitLabel;
4635
- NumberSlider backlitField;
4948
+ cNumberSlider backlitField;
46364949 JLabel anisoLabel;
4637
- NumberSlider anisoField;
4950
+ cNumberSlider anisoField;
46384951 JLabel anisoVLabel;
4639
- NumberSlider anisoVField;
4952
+ cNumberSlider anisoVField;
46404953 JLabel cameraLabel;
4641
- NumberSlider cameraField;
4954
+ cNumberSlider cameraField;
46424955 JLabel selfshadowLabel;
4643
- NumberSlider selfshadowField;
4956
+ cNumberSlider selfshadowField;
46444957 JLabel shadowLabel;
4645
- NumberSlider shadowField;
4958
+ cNumberSlider shadowField;
46464959 JLabel textureLabel;
4647
- NumberSlider textureField;
4960
+ cNumberSlider textureField;
46484961 JLabel opacityLabel;
4649
- NumberSlider opacityField;
4962
+ cNumberSlider opacityField;
46504963 JLabel fakedepthLabel;
4651
- NumberSlider fakedepthField;
4964
+ cNumberSlider fakedepthField;
46524965 JLabel shadowbiasLabel;
4653
- NumberSlider shadowbiasField;
4966
+ cNumberSlider shadowbiasField;
46544967 JLabel bumpLabel;
4655
- NumberSlider bumpField;
4968
+ cNumberSlider bumpField;
46564969 JLabel noiseLabel;
4657
- NumberSlider noiseField;
4970
+ cNumberSlider noiseField;
46584971 JLabel powerLabel;
4659
- NumberSlider powerField;
4972
+ cNumberSlider powerField;
46604973 JLabel borderfadeLabel;
4661
- NumberSlider borderfadeField;
4974
+ cNumberSlider borderfadeField;
46624975 JLabel fogLabel;
4663
- NumberSlider fogField;
4976
+ cNumberSlider fogField;
46644977 JLabel opacityPowerLabel;
4665
- NumberSlider opacityPowerField;
4978
+ cNumberSlider opacityPowerField;
46664979 JTree jTree;
46674980 //ObjectUI parent;
46684981
4669
- NumberSlider normalpushField;
4982
+ cNumberSlider normalpushField;
4983
+
4984
+ private MenuItem importGFDItem;
4985
+ private MenuItem importVRMLX3DItem;
4986
+ private MenuItem import3DSItem;
4987
+ private MenuItem importOBJItem;
46704988 }