Normand Briere
2019-06-11 1d909ffa0c2beb51d453b53b845c4f3a749ca5f0
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,
....@@ -124,7 +126,7 @@
124126 void keyPressed(int key, int modifiers)
125127 {
126128 System.out.println("KEY PRESSED");
127
- CameraPane.theRenderer.keyPressed(key, modifiers);
129
+ Globals.theRenderer.keyPressed(key, modifiers);
128130 }
129131 */
130132
....@@ -136,34 +138,41 @@
136138 public void closeUI()
137139 {
138140 //new Exception().printStackTrace();
139
- System.out.println("this = " + this);
140
- System.out.println("objEditor = " + objEditor);
141
+// System.out.println("this = " + this);
142
+// System.out.println("objEditor = " + objEditor);
141143 //nameField.removeActionListener(this);
142
- objEditor.ctrlPanel.remove(nameField);
144
+// objEditor.ctrlPanel.remove(nameField);
145
+
146
+ objEditor.ctrlPanel.remove(namePanel);
143147
144148 if (!GroupEditor.allparams)
145149 return;
146150
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);
151
+// objEditor.ctrlPanel.remove(liveCB);
152
+// objEditor.ctrlPanel.remove(hideCB);
153
+// objEditor.ctrlPanel.remove(markCB);
154
+//
155
+// objEditor.ctrlPanel.remove(randomCB);
156
+// objEditor.ctrlPanel.remove(speedupCB);
157
+// objEditor.ctrlPanel.remove(rewindCB);
158
+//
159
+// objEditor.ctrlPanel.remove(resetButton);
160
+// objEditor.ctrlPanel.remove(stepButton);
161
+//// objEditor.ctrlPanel.remove(stepAllButton);
162
+//// objEditor.ctrlPanel.remove(resetAllButton);
163
+// objEditor.ctrlPanel.remove(link2masterCB);
164
+// //objEditor.ctrlPanel.remove(flipVCB);
165
+// //objEditor.ctrlPanel.remove(texresMenu);
166
+// objEditor.ctrlPanel.remove(slowerButton);
167
+// objEditor.ctrlPanel.remove(fasterButton);
168
+// objEditor.ctrlPanel.remove(remarkButton);
165169
166
- Remove(normalpushField);
170
+ objEditor.ctrlPanel.remove(setupPanel);
171
+ objEditor.ctrlPanel.remove(commandsPanel);
172
+ objEditor.ctrlPanel.remove(pushPanel);
173
+ //objEditor.ctrlPanel.remove(fillPanel);
174
+
175
+ //Remove(normalpushField);
167176 }
168177
169178 public ObjEditor GetEditor()
....@@ -267,24 +276,40 @@
267276 void SetupMenu()
268277 {
269278 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..."));
279
+ menuBar.add(fileMenu = new Menu("File"));
280
+ fileMenu.add(newItem = new MenuItem("New"));
281
+ fileMenu.add(loadItem = new MenuItem("Load..."));
282
+
283
+ //oe.menuBar.add(menu = new Menu("Include"));
284
+ Menu menu = new Menu("Import");
285
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
286
+ importOBJItem.addActionListener(this);
287
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
288
+ import3DSItem.addActionListener(this);
289
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
290
+ importVRMLX3DItem.addActionListener(this);
291
+ menu.add("-");
292
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
293
+ importGFDItem.addActionListener(this);
294
+ fileMenu.add(menu);
295
+ fileMenu.add("-");
296
+
297
+ fileMenu.add(saveItem = new MenuItem("Save"));
298
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
275299 //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("-");
300
+ fileMenu.add("-");
301
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
302
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
303
+ fileMenu.add("-");
280304 if (client.parent != null)
281305 {
282
- windowMenu.add(closeItem = new MenuItem("Close"));
306
+ fileMenu.add(closeItem = new MenuItem("Close"));
283307 } else
284308 {
285
- windowMenu.add(closeItem = new MenuItem("Exit"));
309
+ fileMenu.add(closeItem = new MenuItem("Exit"));
286310 }
287311
312
+ newItem.addActionListener(this);
288313 loadItem.addActionListener(this);
289314 saveItem.addActionListener(this);
290315 saveAsItem.addActionListener(this);
....@@ -293,79 +318,26 @@
293318 //povItem.addActionListener(this);
294319 closeItem.addActionListener(this);
295320
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
-
351321 objectPanel = new JTabbedPane();
352322 toolbarPanel = new JPanel();
353323 toolbarPanel.setName("Toolbar");
354
- treePanel = new JPanel();
324
+ treePanel = new cGridBag();
355325 treePanel.setName("Tree");
356
- ctrlPanel = new JPanel(); // new GridBagLayout());
326
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
357327 ctrlPanel.setName("Edit");
358
- materialPanel = new JPanel();
328
+ materialPanel = new cGridBag().setVertical(true);
359329 materialPanel.setName("Material");
360330 /*JTextPane*/
361331 infoarea = createTextPane();
332
+ doc = infoarea.getStyledDocument();
333
+
362334 infoarea.setEditable(true);
363335 SetText();
364336 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
365337 // infoarea.setOpaque(false);
366338 // //infoarea.setForeground(textcolor);
367
- infoarea.setLineWrap(true);
368
- infoarea.setWrapStyleWord(true);
339
+// TEXTAREA infoarea.setLineWrap(true);
340
+// TEXTAREA infoarea.setWrapStyleWord(true);
369341 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
370342 infoPanel.setPreferredSize(new Dimension(50, 200));
371343 infoPanel.setName("Info");
....@@ -376,16 +348,16 @@
376348 mainPanel.setName("Main");
377349 mainPanel.setContinuousLayout(true);
378350 mainPanel.setOneTouchExpandable(true);
379
- mainPanel.setDividerLocation(1.0);
380351 mainPanel.setDividerSize(9);
381
- mainPanel.setResizeWeight(0);
352
+ mainPanel.setDividerLocation(0.5); //1.0);
353
+ mainPanel.setResizeWeight(0.5);
382354
383355 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
384356 //mainPanel.setLayout(new GridBagLayout());
385357 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
386
- treePanel.setLayout(new GridBagLayout());
387
- ctrlPanel.setLayout(new GridBagLayout());
388
- materialPanel.setLayout(new GridBagLayout());
358
+// treePanel.setLayout(new GridBagLayout());
359
+ //ctrlPanel.setLayout(new GridBagLayout());
360
+ //materialPanel.setLayout(new GridBagLayout());
389361
390362 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
391363 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -424,7 +396,7 @@
424396 static String newline = "\n";
425397 protected static final String buttonString = "JButton";
426398 StyledDocument doc;
427
- JTextArea infoarea;
399
+ JTextPane infoarea;
428400
429401 void ClearInfo()
430402 {
....@@ -473,13 +445,13 @@
473445 //SendInfo("Name:", "bold");
474446 if (sel.GetTextures() != null || debug)
475447 {
476
- si.SendInfo(sel.toString(), "bold");
448
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
477449 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
478450 if (sel.Size() > 0)
479451 {
480452 si.SendInfo("#children = " + sel.Size(), "regular");
481453 }
482
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
454
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
483455 if (debug)
484456 {
485457 try
....@@ -491,7 +463,10 @@
491463 }
492464
493465 if (full)
494
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
466
+ {
467
+ si.SendInfo(" BBox min: " + minima, "regular");
468
+ si.SendInfo(" BBox max: " + maxima, "regular");
469
+ }
495470
496471 if (sel.bRep != null)
497472 {
....@@ -518,7 +493,7 @@
518493 }
519494 if (sel.support != null)
520495 {
521
- si.SendInfo(" support: " + sel.support, "regular");
496
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
522497 }
523498 if (sel.scriptnode != null)
524499 {
....@@ -589,6 +564,9 @@
589564 {
590565 CameraPane.pointflow = (PointFlow) sel;
591566 }
567
+
568
+ si.SendInfo("_____________________", "regular");
569
+ si.SendInfo("", "regular");
592570 }
593571 }
594572
....@@ -620,52 +598,52 @@
620598 cameraView.ToggleFullScreen();
621599 }
622600
623
- private JTextArea createTextPane()
601
+ private JTextPane createTextPane()
624602 {
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
- };
603
+// TEXTAREA String[] initString =
604
+// {
605
+// "This is an editable JTextPane, ", //regular
606
+// "another ", //italic
607
+// "styled ", //bold
608
+// "text ", //small
609
+// "component, ", //large
610
+// "which supports embedded components..." + newline,//regular
611
+// " " + newline, //button
612
+// "...and embedded icons..." + newline, //regular
613
+// " ", //icon
614
+// newline + "JTextPane is a subclass of JEditorPane that "
615
+// + "uses a StyledEditorKit and StyledDocument, and provides "
616
+// + "cover methods for interacting with those objects."
617
+// };
618
+//
619
+// String[] initStyles =
620
+// {
621
+// "regular", "italic", "bold", "small", "large",
622
+// "regular", "button", "regular", "icon",
623
+// "regular"
624
+// };
625
+//
626
+// JTextPane textPane = new JTextPane();
627
+// textPane.setEditable(true);
628
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
629
+// addStylesToDocument(doc);
630
+//
631
+// try
632
+// {
633
+// for (int j = 0; j < 2; j++)
634
+// {
635
+// for (int i = 0; i < initString.length; i++)
636
+// {
637
+// doc.insertString(doc.getLength(), initString[i],
638
+// doc.getStyle(initStyles[i]));
639
+// }
640
+// }
641
+// } catch (BadLocationException ble)
642
+// {
643
+// System.err.println("Couldn't insert initial text into text pane.");
644
+// }
640645
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;
646
+ return new JTextPane(); // textPane;
669647 }
670648
671649 protected void addStylesToDocument(StyledDocument doc)
....@@ -718,7 +696,7 @@
718696 protected static ImageIcon createImageIcon(String path,
719697 String description)
720698 {
721
- java.net.URL imgURL = GrafreeD.class.getResource(path);
699
+ java.net.URL imgURL = Grafreed.class.getResource(path);
722700 if (imgURL != null)
723701 {
724702 return new ImageIcon(imgURL, description);
....@@ -750,6 +728,7 @@
750728 // NumberSlider vDivsField;
751729 // JCheckBox endcaps;
752730 JCheckBox liveCB;
731
+ JCheckBox selectCB;
753732 JCheckBox hideCB;
754733 JCheckBox link2masterCB;
755734 JCheckBox markCB;
....@@ -765,115 +744,83 @@
765744 JButton slowerButton;
766745 JButton fasterButton;
767746 JButton remarkButton;
747
+
748
+ cGridBag namePanel;
749
+ cGridBag setupPanel;
750
+ cGridBag commandsPanel;
751
+ cGridBag pushPanel;
752
+ cGridBag fillPanel;
768753
769
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
754
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
770755 {
771756 JCheckBox cb;
772757
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);
758
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
778759 cb.addItemListener(this);
779
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
780
- oe.aConstraints.gridwidth = 1;
781
- oe.aConstraints.gridx += 1;
782760
783761 return cb;
784762 }
785763
786
- cButton AddButton(ObjEditor oe, String label)
764
+ cButton AddButton(cGridBag panel, String label)
787765 {
788766 cButton cb;
789767
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);
768
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
795769 cb.addActionListener(this);
796
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
797
- oe.aConstraints.gridwidth = 1;
798
- oe.aConstraints.gridx += 1;
799770
800771 return cb;
801772 }
802773
803
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
774
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
804775 {
805776 JComboBox combo;
806777
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;
778
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
810779 combo.addActionListener(this);
811780
812781 return combo;
813782 }
814783
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
784
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
816785 {
817
- NumberSlider combo;
786
+ cGridBag control = new cGridBag();
787
+
788
+ cNumberSlider combo;
818789
819790 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
822791 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
-
792
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
793
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
832794 combo.setFloat(current);
833
-
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
795
+
796
+ panel.add(control);
797
+
798
+ return control;
839799 }
840800
841
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
801
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
842802 {
843
- NumberSlider combo;
803
+ cGridBag control = new cGridBag();
804
+
805
+ cNumberSlider combo;
844806
845807 JLabel jlabel = new JLabel(label);
846
-
847
- aConstraints.fill = GridBagConstraints.VERTICAL;
848808 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
-
809
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
810
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
858811 combo.setInteger(current);
859812
860
- combo.label = jlabel;
861
-
862
- combo.addChangeListener(this);
863
-
864
- return combo;
813
+ panel.add(control);
814
+
815
+ return control;
865816 }
866817
867
- JTextArea AddText(JPanel ctrlPanel, String name)
818
+ JTextArea AddText(cGridBag ctrlPanel, String name)
868819 {
869820 JTextArea text;
870821
871
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
872
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
873
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
822
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
874823 text.addCaretListener(this);
875
- aConstraints.gridx += 1;
876
- aConstraints.gridwidth = 1;
877824
878825 return text;
879826 }
....@@ -903,9 +850,16 @@
903850 objEditor.ctrlPanel.remove(j);
904851 }
905852
853
+ void Remove(cNumberSlider j)
854
+ {
855
+ j.removeChangeListener(this);
856
+ //objEditor.ctrlPanel.remove(j.label);
857
+ objEditor.ctrlPanel.remove(j);
858
+ }
859
+
906860 /*
907861 */
908
- void Return() // ObjEditor oe)
862
+ void Return0() // ObjEditor oe)
909863 {
910864 aConstraints.gridy += 1;
911865 aConstraints.gridx = 0;
....@@ -960,37 +914,72 @@
960914
961915 void SetupUI2(ObjEditor oe)
962916 {
963
-// oe.aConstraints.weightx = 0;
964
-// oe.aConstraints.weighty = 0;
965
-// oe.aConstraints.gridx = 0;
966
-// oe.aConstraints.gridy = 0;
967
- SetupName(oe);
917
+ //SetupName(oe);
918
+
919
+ namePanel = new cGridBag();
920
+
921
+ nameField = AddText(namePanel, copy.GetName());
922
+ namePanel.add(nameField);
923
+ oe.ctrlPanel.add(namePanel);
924
+
925
+ oe.ctrlPanel.Return();
968926
969927 if (!GroupEditor.allparams)
970928 return;
971929
972
- liveCB = AddCheckBox(oe, "Live", copy.live);
973
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
974
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
930
+ setupPanel = new cGridBag().setVertical(false);
931
+
932
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
933
+ liveCB.setToolTipText("Animate object");
934
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
935
+ selectCB.setToolTipText("Make object selectable");
975936 // 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");
937
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
938
+ hideCB.setToolTipText("Hide object");
939
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
940
+ markCB.setToolTipText("Set the animation target transform");
941
+
942
+ rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind);
943
+ rewindCB.setToolTipText("Rewind animation");
944
+
945
+ randomCB = AddCheckBox(setupPanel, "Random", copy.random);
946
+ randomCB.setToolTipText("Option for switch node");
947
+
948
+ if (Globals.ADVANCED)
949
+ {
950
+ link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master);
951
+ link2masterCB.setToolTipText("Attach to support");
952
+ speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup);
953
+ speedupCB.setToolTipText("Option motion capture");
954
+ }
955
+
956
+ oe.ctrlPanel.add(setupPanel);
957
+ oe.ctrlPanel.Return();
958
+
959
+ commandsPanel = new cGridBag().setVertical(false);
960
+
961
+ resetButton = AddButton(commandsPanel, "Reset");
962
+ resetButton.setToolTipText("Jump to frame zero");
963
+ stepButton = AddButton(commandsPanel, "Step");
964
+ stepButton.setToolTipText("Step one frame");
982965 // resetAllButton = AddButton(oe, "Reset All");
983966 // stepAllButton = AddButton(oe, "Step All");
984
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
985967 // Return();
986
- slowerButton = AddButton(oe, "Slow");
987
- fasterButton = AddButton(oe, "Fast");
988
- remarkButton = AddButton(oe, "Rem");
968
+ slowerButton = AddButton(commandsPanel, "Slow");
969
+ slowerButton.setToolTipText("Decrease animation speed");
970
+ fasterButton = AddButton(commandsPanel, "Fast");
971
+ fasterButton.setToolTipText("Increase animation speed");
972
+ remarkButton = AddButton(commandsPanel, "Remark");
973
+ remarkButton.setToolTipText("Set the current transform as the target");
989974
990
- Return();
975
+ oe.ctrlPanel.add(commandsPanel);
976
+ oe.ctrlPanel.Return();
991977
992
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
993
- Return();
978
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
979
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
980
+ //Return();
981
+
982
+ oe.ctrlPanel.Return();
994983
995984 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
996985 // ObjEditor.aConstraints.gridx += 1;
....@@ -1085,7 +1074,7 @@
10851074 oe.aConstraints.gridwidth = 1;
10861075 /**/
10871076 nameField = AddText(oe.ctrlPanel, copy.GetName());
1088
- Return();
1077
+ oe.ctrlPanel.Return();
10891078
10901079 //ctrlPanel.add(textureButton = new Button("Texture..."));
10911080 //textureButton.setEnabled(false);
....@@ -1187,7 +1176,8 @@
11871176 //JPanel worldPanel =
11881177 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11891178 //worldPanel.setName("World");
1190
- centralPanel = new JPanel(new BorderLayout());
1179
+ centralPanel = new cGridBag();
1180
+ centralPanel.preferredWidth = 20;
11911181 timelinePanel = new JPanel(new BorderLayout());
11921182 timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11931183
....@@ -1217,12 +1207,13 @@
12171207 //frontView.object = copy;
12181208 //sideView.object = copy;
12191209
1220
- XYZPanel = new JPanel();
1221
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1210
+ XYZPanel = new cGridBag().setVertical(true);
1211
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12221212
1223
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1224
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1225
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1213
+ XYZPanel.preferredWidth = 5;
1214
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1215
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1216
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
12261217
12271218 /*
12281219 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1260,10 +1251,11 @@
12601251 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12611252 //tmp.setName("Edit");
12621253 objectPanel.add(materialPanel);
1263
- JPanel north = new JPanel(new BorderLayout());
1264
- north.setName("Edit");
1265
- north.add(ctrlPanel, BorderLayout.NORTH);
1266
- objectPanel.add(north);
1254
+// JPanel north = new JPanel(new BorderLayout());
1255
+// north.setName("Edit");
1256
+// north.add(ctrlPanel, BorderLayout.NORTH);
1257
+// objectPanel.add(north);
1258
+ objectPanel.add(ctrlPanel);
12671259 objectPanel.add(infoPanel);
12681260
12691261 /*
....@@ -1284,16 +1276,23 @@
12841276 scrollpane.setWheelScrollingEnabled(true);
12851277 scrollpane.addMouseWheelListener(this); // Default not fast enough
12861278
1287
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1288
- scenePanel.add(scrollpane);
1279
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1280
+ scenePanel.preferredWidth = 6;
1281
+
1282
+ JTabbedPane tabbedPane = new JTabbedPane();
1283
+ tabbedPane.add(scrollpane);
12891284
1290
- scenePanel.add(FSPane = new cFileSystemPane(this));
1285
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12911286
1292
- optionsPanel = new JPanel(new GridBagLayout());
1287
+ optionsPanel = new cGridBag().setVertical(true);
12931288
12941289 optionsPanel.setName("Options");
1295
- scenePanel.add(optionsPanel);
1296
-
1290
+
1291
+ AddOptions(optionsPanel); //, aConstraints);
1292
+
1293
+ tabbedPane.add(optionsPanel);
1294
+
1295
+ scenePanel.add(tabbedPane);
12971296
12981297 /*
12991298 cTree jTree = new cTree(null);
....@@ -1327,6 +1326,7 @@
13271326 //bigPanel.setSize(new Dimension(10,10));
13281327 //bigPanel.add(ctrlPanel);
13291328 //bigPanel.add(gridPanel);
1329
+ /**
13301330 bigThree = new JPanel();
13311331 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
13321332 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1350,7 +1350,13 @@
13501350 // aConstraints.gridheight = 3;
13511351 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13521352 bigThree.add(XYZPanel, aWindowConstraints);
1353
+ /**/
13531354
1355
+ bigThree = new cGridBag();
1356
+ bigThree.addComponent(scenePanel);
1357
+ bigThree.addComponent(centralPanel);
1358
+ bigThree.addComponent(XYZPanel);
1359
+
13541360 // // SIDE EFFECT!!!
13551361 // aConstraints.gridx = 0;
13561362 // aConstraints.gridy = 0;
....@@ -1377,8 +1383,8 @@
13771383
13781384 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13791385
1380
- frame.setSize(1024, 768);
1381
- frame.show();
1386
+ frame.setSize(1280, 860);
1387
+ frame.setVisible(true);
13821388
13831389 gridPanel.setDividerLocation(1.0);
13841390
....@@ -1393,6 +1399,10 @@
13931399 });
13941400 }
13951401
1402
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1403
+ {
1404
+ }
1405
+
13961406 JTree GetTree()
13971407 {
13981408 return objEditor.jTree;
....@@ -1404,260 +1414,173 @@
14041414 ctrlPanel.removeAll();
14051415 }
14061416
1407
- void SetupMaterial(JPanel ctrlPanel)
1417
+ void SetupMaterial(cGridBag panel)
14081418 {
1409
- aConstraints.weighty = 0;
1410
- //aConstraints.weightx = 1;
1411
- /*
1419
+ /*
14121420 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14131421 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1414
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1415
- aConstraints.gridx += 1;
14161422 */
14171423
1418
- aConstraints.gridwidth = 1;
1419
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1420
- aConstraints.gridx += 1;
1421
- aConstraints.weighty = 0;
1422
- aConstraints.gridwidth = 1;
1424
+ cGridBag editBar = new cGridBag().setVertical(false);
1425
+
1426
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1427
+ createMaterialButton.setToolTipText("Create material");
14231428
14241429 /*
14251430 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1426
- aConstraints.gridx += 1;
1427
- aConstraints.weighty = 0;
1428
- aConstraints.gridwidth = 1;
14291431 */
14301432
1431
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1432
- aConstraints.gridx += 1;
1433
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1434
+ clearMaterialButton.setToolTipText("Clear material");
1435
+
1436
+ if (Globals.ADVANCED)
1437
+ {
1438
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1439
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1440
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1441
+ }
14331442
1434
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1435
-
1436
- aConstraints.gridx += 1;
1437
-
1438
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1439
-
1440
- aConstraints.gridx += 1;
1441
-
1442
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1443
-
1444
- aConstraints.gridx = 0;
1445
- aConstraints.gridy += 1;
1446
- aConstraints.weighty = 0;
1447
- aConstraints.gridwidth = 1;
1443
+ editBar.preferredHeight = 15;
1444
+
1445
+ panel.add(editBar);
1446
+
14481447 /**/
14491448 //aConstraints.weighty = 0;
14501449 ////aConstraints.weightx = 1;
14511450 //aConstraints.weighty = 1;
14521451 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14531452 //aConstraints.gridx += 1;
1454
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1455
- aConstraints.weighty = 0;
1456
- aConstraints.gridx = 0;
1457
- aConstraints.gridy += 1;
1458
- aConstraints.gridwidth = 1;
1453
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14591454
1460
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1461
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1462
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1463
- aConstraints.gridx += 1;
1464
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1465
- //aConstraints.weightx = 0;
1466
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1467
- aConstraints.gridx = 0;
1468
- aConstraints.gridy += 1;
1469
- aConstraints.gridwidth = 1;
1455
+ cGridBag colorSection = new cGridBag().setVertical(true);
1456
+
1457
+ cGridBag color = new cGridBag();
1458
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1459
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1460
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1461
+ //colorField.preferredWidth = 200;
1462
+ colorSection.add(color);
14701463
1471
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1472
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1473
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1474
- aConstraints.gridx += 1;
1475
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1476
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1477
- aConstraints.gridx = 0;
1478
- aConstraints.gridy += 1;
1479
- aConstraints.gridwidth = 1;
1464
+ cGridBag modulation = new cGridBag();
1465
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1466
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1467
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1468
+ colorSection.add(modulation);
14801469
1481
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1482
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1483
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1484
- aConstraints.gridx += 1;
1485
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1486
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1487
- aConstraints.gridx = 0;
1488
- aConstraints.gridy += 1;
1489
- aConstraints.gridwidth = 1;
1470
+ cGridBag texture = new cGridBag();
1471
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1472
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1473
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1474
+ colorSection.add(texture);
14901475
1491
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1492
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1493
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1494
- aConstraints.gridx += 1;
1495
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1496
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1497
- aConstraints.gridx = 0;
1498
- aConstraints.gridy += 1;
1499
- aConstraints.gridwidth = 1;
1476
+ cGridBag anisoU = new cGridBag();
1477
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1478
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1479
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1480
+ colorSection.add(anisoU);
15001481
1501
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1502
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1503
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1504
- aConstraints.gridx += 1;
1505
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1506
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1507
- aConstraints.gridx = 0;
1508
- aConstraints.gridy += 1;
1509
- aConstraints.gridwidth = 1;
1482
+ cGridBag anisoV = new cGridBag();
1483
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1484
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1485
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1486
+ colorSection.add(anisoV);
15101487
1511
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1512
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1513
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1514
- aConstraints.gridx += 1;
1515
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1516
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1517
- aConstraints.gridx = 0;
1518
- aConstraints.gridy += 1;
1519
- aConstraints.gridwidth = 1;
1488
+ cGridBag shadowbias = new cGridBag();
1489
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1490
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1492
+ colorSection.add(shadowbias);
15201493
1521
- //aConstraints.weighty = 1;
1522
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1523
- //aConstraints.gridx += 1;
1524
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1525
- aConstraints.weighty = 0;
1526
- aConstraints.gridx = 0;
1527
- aConstraints.gridy += 1;
1528
- aConstraints.gridwidth = 1;
1494
+ panel.add(new JSeparator());
1495
+
1496
+ panel.add(colorSection);
1497
+
1498
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1499
+
1500
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1501
+
1502
+ cGridBag diffuse = new cGridBag();
1503
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1504
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1505
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1506
+ diffuseSection.add(diffuse);
15291507
1530
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1531
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1532
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1533
- aConstraints.gridx += 1;
1534
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1535
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1536
- aConstraints.gridx = 0;
1537
- aConstraints.gridy += 1;
1538
- aConstraints.gridwidth = 1;
1508
+ cGridBag diffuseness = new cGridBag();
1509
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1510
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1511
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1512
+ diffuseSection.add(diffuseness);
15391513
1540
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1541
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1542
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1543
- aConstraints.gridx += 1;
1544
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1545
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1546
- aConstraints.gridx = 0;
1547
- aConstraints.gridy += 1;
1548
- aConstraints.gridwidth = 1;
1514
+ cGridBag selfshadow = new cGridBag();
1515
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1516
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1517
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1518
+ diffuseSection.add(selfshadow);
15491519
1550
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1551
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1552
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1553
- aConstraints.gridx += 1;
1554
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1555
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1556
- aConstraints.gridx = 0;
1557
- aConstraints.gridy += 1;
1558
- aConstraints.gridwidth = 1;
1520
+ cGridBag sheen = new cGridBag();
1521
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1522
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1523
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1524
+ diffuseSection.add(sheen);
15591525
1560
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1561
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1562
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1563
- aConstraints.gridx += 1;
1564
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1565
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1566
- aConstraints.gridx = 0;
1567
- aConstraints.gridy += 1;
1568
- aConstraints.gridwidth = 1;
1526
+ cGridBag subsurface = new cGridBag();
1527
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1528
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1529
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1530
+ diffuseSection.add(subsurface);
15691531
1570
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1571
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1572
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1573
- aConstraints.gridx += 1;
1574
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1575
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1576
- aConstraints.gridx = 0;
1577
- aConstraints.gridy += 1;
1578
- aConstraints.gridwidth = 1;
1532
+ cGridBag shadow = new cGridBag();
1533
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1534
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1535
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1536
+ diffuseSection.add(shadow);
15791537
1580
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1581
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1582
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1583
- aConstraints.gridx += 1;
1584
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1585
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1586
- aConstraints.gridx = 0;
1587
- aConstraints.gridy += 1;
1588
- aConstraints.gridwidth = 1;
1538
+ cGridBag fakedepth = new cGridBag();
1539
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1540
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1541
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1542
+ diffuseSection.add(fakedepth);
15891543
1590
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1591
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1592
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1593
- aConstraints.gridx += 1;
1594
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1595
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1596
- aConstraints.gridx = 0;
1597
- aConstraints.gridy += 1;
1598
- aConstraints.gridwidth = 1;
1544
+ panel.add(new JSeparator());
1545
+
1546
+ panel.add(diffuseSection);
1547
+
1548
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1549
+
1550
+ cGridBag specularSection = new cGridBag().setVertical(true);
15991551
1600
- //aConstraints.weighty = 1;
1601
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1602
- //aConstraints.gridx += 1;
1603
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1604
- aConstraints.weighty = 0;
1605
- aConstraints.gridx = 0;
1606
- aConstraints.gridy += 1;
1607
- aConstraints.gridwidth = 1;
1552
+ cGridBag specular = new cGridBag();
1553
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1554
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1555
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1556
+ specularSection.add(specular);
16081557
1609
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1610
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1611
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1612
- aConstraints.gridx += 1;
1613
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1614
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1615
- aConstraints.gridx = 0;
1616
- aConstraints.gridy += 1;
1617
- aConstraints.gridwidth = 1;
1558
+ cGridBag lightarea = new cGridBag();
1559
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1560
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1561
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1562
+ specularSection.add(lightarea);
16181563
1619
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1620
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1621
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1622
- aConstraints.gridx += 1;
1623
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1624
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1625
- aConstraints.gridx = 0;
1626
- aConstraints.gridy += 1;
1627
- aConstraints.gridwidth = 1;
1564
+ cGridBag shininess = new cGridBag();
1565
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1566
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1567
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1568
+ specularSection.add(shininess);
16281569
1629
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1630
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1631
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1632
- aConstraints.gridx += 1;
1633
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1634
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1635
- aConstraints.gridx = 0;
1636
- aConstraints.gridy += 1;
1637
- aConstraints.gridwidth = 1;
1570
+ cGridBag metalness = new cGridBag();
1571
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1572
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1573
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1574
+ specularSection.add(metalness);
16381575
1639
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1640
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1641
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1642
- aConstraints.gridx += 1;
1643
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1644
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1645
- aConstraints.gridx = 0;
1646
- aConstraints.gridy += 1;
1647
- aConstraints.gridwidth = 1;
1576
+ cGridBag velvet = new cGridBag();
1577
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1578
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1579
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1580
+ specularSection.add(velvet);
16481581
1649
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1650
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1651
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1652
- aConstraints.gridx += 1;
1653
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1654
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1655
- aConstraints.gridx = 0;
1656
- aConstraints.gridy += 1;
1657
- aConstraints.gridwidth = 1;
1658
-
1659
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1660
- Return();
1582
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1583
+ //Return();
16611584 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16621585 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16631586 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1668,130 +1591,93 @@
16681591 // aConstraints.gridy += 1;
16691592 // aConstraints.gridwidth = 1;
16701593
1671
- //aConstraints.weighty = 1;
1672
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1673
- //aConstraints.gridx += 1;
1674
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1675
- aConstraints.weighty = 0;
1676
- aConstraints.gridx = 0;
1677
- aConstraints.gridy += 1;
1678
- aConstraints.gridwidth = 1;
16791594
1680
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1681
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1683
- aConstraints.gridx += 1;
1684
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1685
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1686
- aConstraints.gridx = 0;
1687
- aConstraints.gridy += 1;
1688
- aConstraints.gridwidth = 1;
1595
+ panel.add(new JSeparator());
1596
+
1597
+ panel.add(specularSection);
1598
+
1599
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1600
+
1601
+ cGridBag globalSection = new cGridBag().setVertical(true);
16891602
1690
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1691
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1692
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1693
- aConstraints.gridx += 1;
1694
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1695
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1696
- aConstraints.gridx = 0;
1697
- aConstraints.gridy += 1;
1698
- aConstraints.gridwidth = 1;
1603
+ cGridBag camera = new cGridBag();
1604
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1605
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1606
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1607
+ globalSection.add(camera);
16991608
1700
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1701
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1702
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1703
- aConstraints.gridx += 1;
1704
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1705
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1706
- aConstraints.gridx = 0;
1707
- aConstraints.gridy += 1;
1708
- aConstraints.gridwidth = 1;
1609
+ cGridBag ambient = new cGridBag();
1610
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1611
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1612
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1613
+ globalSection.add(ambient);
17091614
1710
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1711
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1712
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1713
- aConstraints.gridx += 1;
1714
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1715
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1716
- aConstraints.gridx = 0;
1717
- aConstraints.gridy += 1;
1718
- aConstraints.gridwidth = 1;
1719
- aConstraints.weighty = 0;
1615
+ cGridBag backlit = new cGridBag();
1616
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1617
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1618
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1619
+ globalSection.add(backlit);
17201620
1721
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1722
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1723
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1724
- aConstraints.gridx += 1;
1725
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1726
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1727
- aConstraints.gridx = 0;
1728
- aConstraints.gridy += 1;
1729
- aConstraints.gridwidth = 1;
1621
+ cGridBag opacity = new cGridBag();
1622
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1623
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1624
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1625
+ globalSection.add(opacity);
17301626
1731
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1732
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1733
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1734
- aConstraints.gridx += 1;
1735
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1736
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1737
- aConstraints.gridx = 0;
1738
- aConstraints.gridy += 1;
1739
- aConstraints.gridwidth = 1;
1627
+ panel.add(new JSeparator());
1628
+
1629
+ panel.add(globalSection);
1630
+
1631
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1632
+
1633
+ cGridBag textureSection = new cGridBag().setVertical(true);
17401634
1741
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1742
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1743
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1744
- aConstraints.gridx += 1;
1745
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1746
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1747
- aConstraints.gridx = 0;
1748
- aConstraints.gridy += 1;
1749
- aConstraints.gridwidth = 1;
1635
+ cGridBag bump = new cGridBag();
1636
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1637
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1638
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1639
+ textureSection.add(bump);
17501640
1751
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1752
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1753
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1754
- aConstraints.gridx += 1;
1755
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1756
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1757
- aConstraints.gridx = 0;
1758
- aConstraints.gridy += 1;
1759
- aConstraints.gridwidth = 1;
1641
+ cGridBag noise = new cGridBag();
1642
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1643
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1644
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1645
+ textureSection.add(noise);
17601646
1761
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1762
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1763
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1764
- aConstraints.gridx += 1;
1765
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1766
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1767
- aConstraints.gridx = 0;
1768
- aConstraints.gridy += 1;
1769
- aConstraints.gridwidth = 1;
1647
+ cGridBag power = new cGridBag();
1648
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1649
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1650
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1651
+ textureSection.add(power);
17701652
1771
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1772
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1773
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1774
- aConstraints.gridx += 1;
1775
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1776
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1777
- aConstraints.gridx = 0;
1778
- aConstraints.gridy += 1;
1779
- aConstraints.gridwidth = 1;
1653
+ cGridBag borderfade = new cGridBag();
1654
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1655
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1656
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1657
+ textureSection.add(borderfade);
17801658
1781
- //aConstraints.weighty = 1;
1782
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1783
- //aConstraints.gridx += 1;
1784
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1785
- aConstraints.weighty = 0;
1659
+ cGridBag fog = new cGridBag();
1660
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1661
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1662
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1663
+ textureSection.add(fog);
17861664
1787
- aConstraints.gridx = 0;
1788
- aConstraints.gridy = 0;
1789
- aConstraints.gridwidth = 1;
1665
+ cGridBag opacityPower = new cGridBag();
1666
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1667
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1668
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1669
+ textureSection.add(opacityPower);
1670
+
1671
+ panel.add(new JSeparator());
1672
+
1673
+ panel.add(textureSection);
1674
+
1675
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17901676
17911677 SetMaterial(copy); // .GetMaterial());
17921678
1793
- colorField.addChangeListener(this);
1794
- modulationField.addChangeListener(this);
1679
+ //colorField.addChangeListener(this);
1680
+// modulationField.addChangeListener(this);
17951681 metalnessField.addChangeListener(this);
17961682 diffuseField.addChangeListener(this);
17971683 specularField.addChangeListener(this);
....@@ -1821,12 +1707,15 @@
18211707 opacityPowerField.addChangeListener(this);
18221708 /**/
18231709
1824
- resetSlidersButton.addActionListener(this);
18251710 clearMaterialButton.addActionListener(this);
18261711 createMaterialButton.addActionListener(this);
1827
-
1828
- propagateToggle.addItemListener(this);
1829
- multiplyToggle.addItemListener(this);
1712
+
1713
+ if (Globals.ADVANCED)
1714
+ {
1715
+ resetSlidersButton.addActionListener(this);
1716
+ propagateToggle.addItemListener(this);
1717
+ multiplyToggle.addItemListener(this);
1718
+ }
18301719 }
18311720
18321721 void DropFile(java.io.File[] files, boolean textures)
....@@ -1997,7 +1886,7 @@
19971886
19981887 //? flashIt = false;
19991888 CameraPane pane = (CameraPane) cameraView;
2000
- pane.clickStart(location.x, location.y, 0);
1889
+ pane.clickStart(location.x, location.y, 0, 0);
20011890 pane.clickEnd(location.x, location.y, 0, true);
20021891
20031892 if (group.selection.size() == 1)
....@@ -2046,6 +1935,7 @@
20461935 e2.printStackTrace();
20471936 }
20481937 }
1938
+
20491939 LoadJMEThread loadThread;
20501940
20511941 class LoadJMEThread extends Thread
....@@ -2103,6 +1993,7 @@
21031993 //LoadFile0(filename, converter);
21041994 }
21051995 }
1996
+
21061997 LoadOBJThread loadObjThread;
21071998
21081999 class LoadOBJThread extends Thread
....@@ -2454,11 +2345,11 @@
24542345
24552346 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24562347 {
2457
- if (GrafreeD.standAlone)
2348
+ if (Grafreed.standAlone)
24582349 {
24592350 /**/
24602351 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2461
- browser.show();
2352
+ browser.setVisible(true);
24622353 String filename = browser.getFile();
24632354 if (filename != null && filename.length() > 0)
24642355 {
....@@ -2603,6 +2494,7 @@
26032494 }
26042495 if (input == null)
26052496 {
2497
+ new Exception().printStackTrace();
26062498 System.exit(0);
26072499 }
26082500
....@@ -2817,7 +2709,8 @@
28172709 return;
28182710 }
28192711
2820
- multiplyToggle.setSelected(mat.multiply);
2712
+ if (multiplyToggle != null)
2713
+ multiplyToggle.setSelected(mat.multiply);
28212714
28222715 assert (object.projectedVertices != null);
28232716
....@@ -3032,7 +2925,7 @@
30322925 frame.validate();
30332926
30342927 return;
3035
- } else if (event.getSource() == toggleRandomItem)
2928
+ } else if (event.getSource() == toggleSwitchItem)
30362929 {
30372930 cameraView.ToggleRandom();
30382931 cameraView.repaint();
....@@ -3063,6 +2956,10 @@
30632956 {
30642957 copy.live ^= true;
30652958 return;
2959
+ } else if (event.getSource() == selectCB)
2960
+ {
2961
+ copy.dontselect ^= true;
2962
+ return;
30662963 } else if (event.getSource() == hideCB)
30672964 {
30682965 copy.hide ^= true;
....@@ -3077,6 +2974,7 @@
30772974 if (event.getSource() == randomCB)
30782975 {
30792976 copy.random ^= true;
2977
+ objEditor.refreshContents();
30802978 return;
30812979 }
30822980 if (event.getSource() == speedupCB)
....@@ -3100,8 +2998,9 @@
31002998
31012999 public void actionPerformed(ActionEvent event)
31023000 {
3001
+ Object source = event.getSource();
31033002 // SCRIPT DIALOG
3104
- if (event.getSource() == okbutton)
3003
+ if (source == okbutton)
31053004 {
31063005 textpanel.setVisible(false);
31073006 textpanel.remove(textarea);
....@@ -3113,7 +3012,7 @@
31133012 textarea = null;
31143013 textpanel = null;
31153014 }
3116
- if (event.getSource() == cancelbutton)
3015
+ if (source == cancelbutton)
31173016 {
31183017 textpanel.setVisible(false);
31193018 textpanel.remove(textarea);
....@@ -3125,50 +3024,50 @@
31253024 //applySelf();
31263025 //client.refreshEditWindow();
31273026 //refreshContents();
3128
- if (event.getSource() == nameField)
3027
+ if (source == nameField)
31293028 {
31303029 //System.out.println("ObjEditor " + event);
31313030 applySelf0(true);
31323031 //parent.applySelf();
31333032 objEditor.refreshContents();
3134
- } else if (event.getSource() == resetButton)
3033
+ } else if (source == resetButton)
31353034 {
31363035 CameraPane.fullreset = true;
31373036 copy.Reset(); // ResetMeshes();
31383037 copy.Touch();
31393038 objEditor.refreshContents();
3140
- } else if (event.getSource() == stepItem)
3039
+ } else if (source == stepItem)
31413040 {
31423041 //cameraView.ONESTEP = true;
31433042 Globals.ONESTEP = true;
31443043 cameraView.repaint();
31453044 return;
3146
- } else if (event.getSource() == stepButton)
3045
+ } else if (source == stepButton)
31473046 {
31483047 copy.Step();
31493048 copy.Touch();
31503049 objEditor.refreshContents();
3151
- } else if (event.getSource() == slowerButton)
3050
+ } else if (source == slowerButton)
31523051 {
31533052 copy.Slower();
31543053 copy.Touch();
31553054 objEditor.refreshContents();
3156
- } else if (event.getSource() == fasterButton)
3055
+ } else if (source == fasterButton)
31573056 {
31583057 copy.Faster();
31593058 copy.Touch();
31603059 objEditor.refreshContents();
3161
- } else if (event.getSource() == remarkButton)
3060
+ } else if (source == remarkButton)
31623061 {
31633062 copy.Remark();
31643063 copy.Touch();
31653064 objEditor.refreshContents();
3166
- } else if (event.getSource() == stepAllButton)
3065
+ } else if (source == stepAllButton)
31673066 {
31683067 copy.StepAll();
31693068 copy.Touch();
31703069 objEditor.refreshContents();
3171
- } else if (event.getSource() == resetAllButton)
3070
+ } else if (source == resetAllButton)
31723071 {
31733072 //CameraPane.fullreset = true;
31743073 copy.ResetAll(); // ResetMeshes();
....@@ -3201,53 +3100,75 @@
32013100 // Close();
32023101 // }
32033102 // else
3204
- if (event.getSource() == resetSlidersButton)
3103
+ if (source == resetSlidersButton)
32053104 {
32063105 ResetSliders();
3207
- } else if (event.getSource() == clearMaterialButton)
3106
+ } else if (source == clearMaterialButton)
32083107 {
32093108 ClearMaterial();
3210
- } else if (event.getSource() == createMaterialButton)
3109
+ } else if (source == createMaterialButton)
32113110 {
32123111 CreateMaterial();
3213
- } else if (event.getSource() == clearPanelButton)
3112
+ } else if (source == clearPanelButton)
32143113 {
32153114 copy.ClearUI();
32163115 refreshContents(true);
3217
- } /*
3218
- }
3219
-
3220
- public boolean action(Event event, Object arg)
3221
- {
3222
- */ else if (event.getSource() == closeItem)
3116
+ } else if (source == importGFDItem)
3117
+ {
3118
+ ImportGFD();
3119
+ } else
3120
+ if (source == importVRMLX3DItem)
3121
+ {
3122
+ ImportVRMLX3D();
3123
+ } else
3124
+ if (source == import3DSItem)
3125
+ {
3126
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3127
+ } else
3128
+ if (source == importOBJItem)
3129
+ {
3130
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3131
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3132
+ browser.setVisible(true);
3133
+ String filename = browser.getFile();
3134
+ if (filename != null && filename.length() > 0)
3135
+ {
3136
+ String fullname = browser.getDirectory() + filename;
3137
+ makeSomething(ReadOBJ(fullname), true);
3138
+ }
3139
+ } else
3140
+ if (source == closeItem)
32233141 {
32243142 Close();
32253143 //return true;
3226
- } else if (event.getSource() == loadItem)
3144
+ } else if (source == loadItem)
32273145 {
32283146 load();
32293147 //return true;
3230
- } else if (event.getSource() == saveItem)
3148
+ } else if (source == newItem)
3149
+ {
3150
+ New();
3151
+ } else if (source == saveItem)
32313152 {
32323153 save();
32333154 //return true;
3234
- } else if (event.getSource() == saveAsItem)
3155
+ } else if (source == saveAsItem)
32353156 {
32363157 saveAs();
32373158 //return true;
3238
- } else if (event.getSource() == reexportItem)
3159
+ } else if (source == reexportItem)
32393160 {
32403161 reexport();
32413162 //return true;
3242
- } else if (event.getSource() == exportAsItem)
3163
+ } else if (source == exportAsItem)
32433164 {
32443165 export();
32453166 //return true;
3246
- } else if (event.getSource() == povItem)
3167
+ } else if (source == povItem)
32473168 {
32483169 generatePOV();
32493170 //return true;
3250
- } else if (event.getSource() == zBufferItem)
3171
+ } else if (source == zBufferItem)
32513172 {
32523173 try
32533174 {
....@@ -3269,21 +3190,8 @@
32693190 cameraView.repaint();
32703191 //return true;
32713192 }
3272
- */ else if (event.getSource() == editCameraItem)
3273
- {
3274
- cameraView.ProtectCamera();
3275
- cameraView.repaint();
3276
- return;
3277
- } else if (event.getSource() == revertCameraItem)
3278
- {
3279
- cameraView.RevertCamera();
3280
- cameraView.repaint();
3281
- return;
3282
-// } else if (event.getSource() == textureButton)
3283
-// {
3284
-// return; // true;
3285
- } else // combos...
3286
- if (event.getSource() == texresMenu)
3193
+ */ else // combos...
3194
+ if (source == texresMenu)
32873195 {
32883196 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32893197 copy.texres = texresMenu.getSelectedIndex();
....@@ -3295,27 +3203,205 @@
32953203 }
32963204 }
32973205
3298
- void ToggleAnimation()
3206
+ void New()
32993207 {
3300
- if (!CameraPane.ANIMATION)
3208
+ while (copy.Size() > 1)
33013209 {
3302
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3210
+ copy.remove(1);
3211
+ }
3212
+
3213
+ ResetModel();
3214
+ objEditor.refreshContents();
3215
+ }
3216
+
3217
+ static public Object clone(Object o)
3218
+ {
3219
+ try
3220
+ {
3221
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3222
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3223
+
3224
+ out.writeObject(o);
3225
+
3226
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
3227
+ ObjectInputStream in = new ObjectInputStream(bais);
3228
+ Object obj = in.readObject();
3229
+ in.close();
3230
+ out.close();
3231
+ return obj;
3232
+ } catch (Exception e)
3233
+ {
3234
+ System.err.println(e);
3235
+ return null;
3236
+ }
3237
+ }
3238
+
3239
+ cRadio GetCurrentTab()
3240
+ {
3241
+ cRadio ab;
3242
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3243
+ {
3244
+ ab = (cRadio)e.nextElement();
3245
+ if(ab.GetObject() == copy)
3246
+ {
3247
+ return ab;
3248
+ }
3249
+ }
3250
+
3251
+ return null;
3252
+ }
3253
+
3254
+ public void Save()
3255
+ {
3256
+ cRadio tab = GetCurrentTab();
3257
+
3258
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3259
+ tab.graphs[tab.undoindex++] = (Object3D)clone(copy);
3260
+
3261
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3262
+ {
3263
+ tab.graphs[i] = null;
3264
+ }
3265
+
3266
+ // test save
3267
+ if (false)
3268
+ {
3269
+ try
3270
+ {
3271
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3272
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3273
+
3274
+ p.writeObject(copy);
3275
+
3276
+ p.flush();
3277
+
3278
+ ostream.close();
3279
+ } catch (Exception e)
3280
+ {
3281
+ e.printStackTrace();
3282
+ }
3283
+ }
3284
+ }
3285
+
3286
+ void CopyChanged(Object3D obj)
3287
+ {
3288
+ copy.clear();
3289
+
3290
+ for (int i=0; i<obj.Size(); i++)
3291
+ {
3292
+ copy.add(obj.get(i));
3293
+ }
3294
+
3295
+ copy.Touch();
3296
+
3297
+ ResetModel();
3298
+ copy.HardTouch(); // recompile?
3299
+
3300
+ cRadio ab;
3301
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3302
+ {
3303
+ ab = (cRadio)e.nextElement();
3304
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3305
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3306
+ if (test != null)
3307
+ {
3308
+ test.editWindow = ab.object.editWindow;
3309
+ ab.object = test;
3310
+ }
3311
+ }
3312
+
3313
+ refreshContents();
3314
+ }
3315
+
3316
+ public void Undo()
3317
+ {
3318
+ cRadio tab = GetCurrentTab();
3319
+
3320
+ if (tab.undoindex == 0)
3321
+ {
3322
+ java.awt.Toolkit.getDefaultToolkit().beep();
3323
+ return;
3324
+ }
3325
+
3326
+ if (tab.graphs[tab.undoindex] == null)
3327
+ {
3328
+ Save();
3329
+ tab.undoindex -= 1;
3330
+ }
3331
+
3332
+ tab.undoindex -= 1;
3333
+
3334
+ CopyChanged(tab.graphs[tab.undoindex]);
3335
+ }
3336
+
3337
+ public void Redo()
3338
+ {
3339
+ cRadio tab = GetCurrentTab();
3340
+
3341
+ if (tab.graphs[tab.undoindex + 1] == null)
3342
+ {
3343
+ java.awt.Toolkit.getDefaultToolkit().beep();
3344
+ return;
3345
+ }
3346
+
3347
+ tab.undoindex += 1;
3348
+
3349
+ CopyChanged(tab.graphs[tab.undoindex]);
3350
+ }
3351
+
3352
+ void ImportGFD()
3353
+ {
3354
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
33033355 browser.show();
33043356 String filename = browser.getFile();
33053357 if (filename != null && filename.length() > 0)
33063358 {
3307
- CameraPane.filename = browser.getDirectory() + filename;
3359
+ String fullname = browser.getDirectory() + filename;
3360
+
3361
+ //Object3D readobj =
3362
+ objEditor.ReadGFD(fullname, objEditor);
3363
+ //makeSomething(readobj);
3364
+ }
3365
+ }
3366
+
3367
+ void ImportVRMLX3D()
3368
+ {
3369
+ if (Grafreed.standAlone)
3370
+ {
3371
+ /**/
3372
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3373
+ browser.show();
3374
+ String filename = browser.getFile();
3375
+ if (filename != null && filename.length() > 0)
3376
+ {
3377
+ String fullname = browser.getDirectory() + filename;
3378
+ LoadVRMLX3D(fullname);
3379
+ }
3380
+ /**/
3381
+ }
3382
+ }
3383
+
3384
+ void ToggleAnimation()
3385
+ {
3386
+ if (!Globals.ANIMATION)
3387
+ {
3388
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3389
+ browser.setVisible(true);
3390
+ String filename = browser.getFile();
3391
+ if (filename != null && filename.length() > 0)
3392
+ {
3393
+ Globals.filename = browser.getDirectory() + filename;
33083394 //CameraPane.framecount = 0;
3309
- CameraPane.imagecount = 0;
3395
+ Globals.imagecount = 0;
33103396
3311
- CameraPane.ANIMATION ^= true;
3397
+ Globals.ANIMATION ^= true;
33123398
3313
- GrafreeD.wav.cursor = 0;
3314
- GrafreeD.wav.loop = 0;
3399
+ Grafreed.wav.cursor = 0;
3400
+ Grafreed.wav.loop = 0;
33153401 }
33163402 } else
33173403 {
3318
- CameraPane.ANIMATION ^= true;
3404
+ Globals.ANIMATION ^= true;
33193405 }
33203406 }
33213407
....@@ -3361,7 +3447,7 @@
33613447 void CreateMaterial()
33623448 {
33633449 //copy.ClearMaterial(); // PATCH
3364
- copy.CreateMaterialS(multiplyToggle.isSelected());
3450
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33653451 if (copy.selection.size() > 0)
33663452 //SetMaterial(copy);
33673453 {
....@@ -3420,11 +3506,11 @@
34203506 {
34213507 copy.ResetBlockLoop(); // temporary problem
34223508
3423
- boolean random = CameraPane.RANDOM;
3424
- CameraPane.RANDOM = false; // parse everything
3509
+ boolean random = CameraPane.SWITCH;
3510
+ CameraPane.SWITCH = false; // parse everything
34253511 copy.ResetDisplayList();
34263512 copy.HardTouch();
3427
- CameraPane.RANDOM = random;
3513
+ CameraPane.SWITCH = random;
34283514 }
34293515
34303516 // public void applySelf()
....@@ -3494,10 +3580,40 @@
34943580 current.fakedepth = (float) fakedepthField.getFloat();
34953581 current.shadowbias = (float) shadowbiasField.getFloat();
34963582
3497
- if (!NumberSlider.frozen)
3583
+ if (!cNumberSlider.frozen)
34983584 {
34993585 //System.out.println("Propagate = " + propagate);
35003586 copy.UpdateMaterial(anchor, current, propagate);
3587
+
3588
+ if (copy.material != null)
3589
+ {
3590
+ cMaterial mat = copy.material;
3591
+
3592
+ colorField.SetToolTipValue((mat.color));
3593
+ modulationField.SetToolTipValue((mat.modulation));
3594
+ metalnessField.SetToolTipValue((mat.metalness));
3595
+ diffuseField.SetToolTipValue((mat.diffuse));
3596
+ specularField.SetToolTipValue((mat.specular));
3597
+ shininessField.SetToolTipValue((mat.shininess));
3598
+ shiftField.SetToolTipValue((mat.shift));
3599
+ ambientField.SetToolTipValue((mat.ambient));
3600
+ lightareaField.SetToolTipValue((mat.lightarea));
3601
+ diffusenessField.SetToolTipValue((mat.factor));
3602
+ velvetField.SetToolTipValue((mat.velvet));
3603
+ sheenField.SetToolTipValue((mat.sheen));
3604
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3605
+ backlitField.SetToolTipValue((mat.bump));
3606
+ anisoField.SetToolTipValue((mat.aniso));
3607
+ anisoVField.SetToolTipValue((mat.anisoV));
3608
+ cameraField.SetToolTipValue((mat.cameralight));
3609
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3610
+ shadowField.SetToolTipValue((mat.shadow));
3611
+ textureField.SetToolTipValue((mat.texture));
3612
+ opacityField.SetToolTipValue((mat.opacity));
3613
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3614
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3615
+ }
3616
+
35013617 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35023618 {
35033619 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3542,6 +3658,7 @@
35423658 || e.getSource() == apertureField
35433659 || e.getSource() == shadowblurField)
35443660 {
3661
+ new Exception().printStackTrace();
35453662 System.exit(0);
35463663 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35473664 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3612,7 +3729,7 @@
36123729 }
36133730
36143731 if (normalpushField != null)
3615
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3732
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36163733 }
36173734
36183735 void SnapObject()
....@@ -3867,7 +3984,7 @@
38673984
38683985 radioPanel.revalidate();
38693986 radioPanel.repaint();
3870
- ctrlPanel.revalidate(); // ? new
3987
+ ctrlPanel.validate(); // ? new
38713988 ctrlPanel.repaint();
38723989 }
38733990 }
....@@ -3876,6 +3993,7 @@
38763993
38773994 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38783995 {
3996
+ Save();
38793997 //Tween.set(thing, 0).target(1).start(tweenManager);
38803998 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38813999 // if (thing instanceof GenericJointDemo)
....@@ -4079,6 +4197,7 @@
40794197 }
40804198 }
40814199 }
4200
+
40824201 LoadGFDThread loadGFDThread;
40834202
40844203 void ReadGFD(String fullname, iCallBack cb)
....@@ -4099,7 +4218,8 @@
40994218 try
41004219 {
41014220 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4102
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4221
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4222
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
41034223
41044224 readobj = (Object3D) p.readObject();
41054225 istream.close();
....@@ -4107,7 +4227,20 @@
41074227 readobj.ResetDisplayList();
41084228 } catch (Exception e)
41094229 {
4110
- e.printStackTrace();
4230
+ //e.printStackTrace();
4231
+ try
4232
+ {
4233
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4234
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4235
+
4236
+ readobj = (Object3D) p.readObject();
4237
+ istream.close();
4238
+
4239
+ readobj.ResetDisplayList();
4240
+ } catch (Exception e2)
4241
+ {
4242
+ e2.printStackTrace();
4243
+ }
41114244 }
41124245 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41134246 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4224,7 +4357,7 @@
42244357
42254358 void load() // throws ClassNotFoundException
42264359 {
4227
- if (GrafreeD.standAlone)
4360
+ if (Grafreed.standAlone)
42284361 {
42294362 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42304363 browser.show();
....@@ -4311,11 +4444,13 @@
43114444 try
43124445 {
43134446 FileOutputStream ostream = new FileOutputStream(lastname);
4314
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4447
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4448
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43154449
43164450 p.writeObject(copy);
43174451 p.flush();
43184452
4453
+ zstream.close();
43194454 ostream.close();
43204455
43214456 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4325,11 +4460,12 @@
43254460 {
43264461 }
43274462 }
4463
+
43284464 String lastname;
43294465
43304466 void saveAs()
43314467 {
4332
- if (GrafreeD.standAlone)
4468
+ if (Grafreed.standAlone)
43334469 {
43344470 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43354471 browser.setVisible(true);
....@@ -4434,13 +4570,13 @@
44344570 try
44354571 {
44364572 FileOutputStream ostream = new FileOutputStream(filename);
4437
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4438
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4573
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4574
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44394575
44404576 Object3D objectparent = obj.parent;
44414577 obj.parent = null;
44424578
4443
- Object3D object = (Object3D) GrafreeD.clone(obj);
4579
+ Object3D object = (Object3D) Grafreed.clone(obj);
44444580
44454581 obj.parent = objectparent;
44464582
....@@ -4452,8 +4588,8 @@
44524588 p.writeObject(object);
44534589 p.flush();
44544590
4591
+ zstream.close();
44554592 ostream.close();
4456
- // zstream.close();
44574593
44584594 // group.selection.get(0).parent = parent;
44594595 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4474,7 +4610,7 @@
44744610 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44754611 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44764612 copy.generatePOV(buffer);
4477
- if (GrafreeD.standAlone)
4613
+ if (Grafreed.standAlone)
44784614 {
44794615 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44804616 browser.show();
....@@ -4500,7 +4636,8 @@
45004636 Object3D client;
45014637 Object3D copy;
45024638 MenuBar menuBar;
4503
- Menu windowMenu;
4639
+ Menu fileMenu;
4640
+ MenuItem newItem;
45044641 MenuItem loadItem;
45054642 MenuItem saveItem;
45064643 MenuItem saveAsItem;
....@@ -4508,13 +4645,11 @@
45084645 MenuItem reexportItem;
45094646 MenuItem povItem;
45104647 MenuItem closeItem;
4511
- Menu cameraMenu;
4648
+
45124649 CheckboxMenuItem zBufferItem;
45134650 //MenuItem normalLensItem;
4514
- MenuItem editCameraItem;
4515
- MenuItem revertCameraItem;
4516
- CheckboxMenuItem toggleLiveItem;
45174651 MenuItem stepItem;
4652
+ CheckboxMenuItem toggleLiveItem;
45184653 CheckboxMenuItem toggleFullScreenItem;
45194654 CheckboxMenuItem toggleTimelineItem;
45204655 CheckboxMenuItem toggleRenderItem;
....@@ -4523,7 +4658,7 @@
45234658 CheckboxMenuItem toggleFootContactItem;
45244659 CheckboxMenuItem toggleDLItem;
45254660 CheckboxMenuItem toggleTextureItem;
4526
- CheckboxMenuItem toggleRandomItem;
4661
+ CheckboxMenuItem toggleSwitchItem;
45274662 CheckboxMenuItem toggleRootItem;
45284663 CheckboxMenuItem animationItem;
45294664 CheckboxMenuItem toggleHandleItem;
....@@ -4531,20 +4666,20 @@
45314666 JSplitPane mainPanel;
45324667 JScrollPane scrollpane;
45334668 JPanel toolbarPanel;
4534
- JPanel treePanel;
4669
+ cGridBag treePanel;
45354670 JPanel radioPanel;
45364671 ButtonGroup buttonGroup;
4537
- JPanel ctrlPanel;
4538
- JPanel materialPanel;
4672
+ cGridBag ctrlPanel;
4673
+ cGridBag materialPanel;
45394674 JScrollPane infoPanel;
4540
- JPanel optionsPanel;
4675
+ cGridBag optionsPanel;
45414676 JTabbedPane objectPanel;
4542
- JPanel XYZPanel;
4677
+ cGridBag XYZPanel;
45434678 JSplitPane gridPanel;
45444679 JSplitPane bigPanel;
4545
- JPanel bigThree;
4546
- JTabbedPane scenePanel;
4547
- JPanel centralPanel;
4680
+ cGridBag bigThree;
4681
+ cGridBag scenePanel;
4682
+ cGridBag centralPanel;
45484683 JSplitPane cameraPanel;
45494684 JPanel timelinePanel;
45504685 JMenuBar timelineMenubar;
....@@ -4597,67 +4732,72 @@
45974732 // MATERIAL
45984733 JLabel materialLabel;
45994734 JLabel colorLabel;
4600
- NumberSlider colorField;
4735
+ cNumberSlider colorField;
46014736 JLabel modulationLabel;
4602
- NumberSlider modulationField;
4737
+ cNumberSlider modulationField;
46034738 JLabel metalnessLabel;
4604
- NumberSlider metalnessField;
4739
+ cNumberSlider metalnessField;
46054740 JLabel diffuseLabel;
4606
- NumberSlider diffuseField;
4741
+ cNumberSlider diffuseField;
46074742 JLabel specularLabel;
4608
- NumberSlider specularField;
4743
+ cNumberSlider specularField;
46094744 JLabel shininessLabel;
4610
- NumberSlider shininessField;
4745
+ cNumberSlider shininessField;
46114746 JLabel shiftLabel;
4612
- NumberSlider shiftField;
4747
+ cNumberSlider shiftField;
46134748 JLabel ambientLabel;
4614
- NumberSlider ambientField;
4749
+ cNumberSlider ambientField;
46154750 JLabel lightareaLabel;
4616
- NumberSlider lightareaField;
4751
+ cNumberSlider lightareaField;
46174752 JLabel diffusenessLabel;
4618
- NumberSlider diffusenessField;
4753
+ cNumberSlider diffusenessField;
46194754 JLabel velvetLabel;
4620
- NumberSlider velvetField;
4755
+ cNumberSlider velvetField;
46214756 JLabel sheenLabel;
4622
- NumberSlider sheenField;
4757
+ cNumberSlider sheenField;
46234758 JLabel subsurfaceLabel;
4624
- NumberSlider subsurfaceField;
4759
+ cNumberSlider subsurfaceField;
46254760 //JLabel bumpLabel;
46264761 //NumberSlider bumpField;
46274762 JLabel backlitLabel;
4628
- NumberSlider backlitField;
4763
+ cNumberSlider backlitField;
46294764 JLabel anisoLabel;
4630
- NumberSlider anisoField;
4765
+ cNumberSlider anisoField;
46314766 JLabel anisoVLabel;
4632
- NumberSlider anisoVField;
4767
+ cNumberSlider anisoVField;
46334768 JLabel cameraLabel;
4634
- NumberSlider cameraField;
4769
+ cNumberSlider cameraField;
46354770 JLabel selfshadowLabel;
4636
- NumberSlider selfshadowField;
4771
+ cNumberSlider selfshadowField;
46374772 JLabel shadowLabel;
4638
- NumberSlider shadowField;
4773
+ cNumberSlider shadowField;
46394774 JLabel textureLabel;
4640
- NumberSlider textureField;
4775
+ cNumberSlider textureField;
46414776 JLabel opacityLabel;
4642
- NumberSlider opacityField;
4777
+ cNumberSlider opacityField;
46434778 JLabel fakedepthLabel;
4644
- NumberSlider fakedepthField;
4779
+ cNumberSlider fakedepthField;
46454780 JLabel shadowbiasLabel;
4646
- NumberSlider shadowbiasField;
4781
+ cNumberSlider shadowbiasField;
46474782 JLabel bumpLabel;
4648
- NumberSlider bumpField;
4783
+ cNumberSlider bumpField;
46494784 JLabel noiseLabel;
4650
- NumberSlider noiseField;
4785
+ cNumberSlider noiseField;
46514786 JLabel powerLabel;
4652
- NumberSlider powerField;
4787
+ cNumberSlider powerField;
46534788 JLabel borderfadeLabel;
4654
- NumberSlider borderfadeField;
4789
+ cNumberSlider borderfadeField;
46554790 JLabel fogLabel;
4656
- NumberSlider fogField;
4791
+ cNumberSlider fogField;
46574792 JLabel opacityPowerLabel;
4658
- NumberSlider opacityPowerField;
4793
+ cNumberSlider opacityPowerField;
46594794 JTree jTree;
46604795 //ObjectUI parent;
46614796
4662
- NumberSlider normalpushField;
4797
+ cNumberSlider normalpushField;
4798
+
4799
+ private MenuItem importGFDItem;
4800
+ private MenuItem importVRMLX3DItem;
4801
+ private MenuItem import3DSItem;
4802
+ private MenuItem importOBJItem;
46634803 }