Normand Briere
2019-06-11 4113164b3be1e50251ac40d6fd65660f0a6c2e63
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(CameraPane.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,9 +2925,9 @@
30322925 frame.validate();
30332926
30342927 return;
3035
- } else if (event.getSource() == toggleRandomItem)
2928
+ } else if (event.getSource() == toggleSwitchItem)
30362929 {
3037
- cameraView.ToggleRandom();
2930
+ cameraView.ToggleSwitch();
30382931 cameraView.repaint();
30392932 return;
30402933 } else if (event.getSource() == toggleHandleItem)
....@@ -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,49 +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 {
3142
- cameraView.ONESTEP = true;
3041
+ //cameraView.ONESTEP = true;
3042
+ Globals.ONESTEP = true;
31433043 cameraView.repaint();
31443044 return;
3145
- } else if (event.getSource() == stepButton)
3045
+ } else if (source == stepButton)
31463046 {
31473047 copy.Step();
31483048 copy.Touch();
31493049 objEditor.refreshContents();
3150
- } else if (event.getSource() == slowerButton)
3050
+ } else if (source == slowerButton)
31513051 {
31523052 copy.Slower();
31533053 copy.Touch();
31543054 objEditor.refreshContents();
3155
- } else if (event.getSource() == fasterButton)
3055
+ } else if (source == fasterButton)
31563056 {
31573057 copy.Faster();
31583058 copy.Touch();
31593059 objEditor.refreshContents();
3160
- } else if (event.getSource() == remarkButton)
3060
+ } else if (source == remarkButton)
31613061 {
31623062 copy.Remark();
31633063 copy.Touch();
31643064 objEditor.refreshContents();
3165
- } else if (event.getSource() == stepAllButton)
3065
+ } else if (source == stepAllButton)
31663066 {
31673067 copy.StepAll();
31683068 copy.Touch();
31693069 objEditor.refreshContents();
3170
- } else if (event.getSource() == resetAllButton)
3070
+ } else if (source == resetAllButton)
31713071 {
31723072 //CameraPane.fullreset = true;
31733073 copy.ResetAll(); // ResetMeshes();
....@@ -3200,53 +3100,75 @@
32003100 // Close();
32013101 // }
32023102 // else
3203
- if (event.getSource() == resetSlidersButton)
3103
+ if (source == resetSlidersButton)
32043104 {
32053105 ResetSliders();
3206
- } else if (event.getSource() == clearMaterialButton)
3106
+ } else if (source == clearMaterialButton)
32073107 {
32083108 ClearMaterial();
3209
- } else if (event.getSource() == createMaterialButton)
3109
+ } else if (source == createMaterialButton)
32103110 {
32113111 CreateMaterial();
3212
- } else if (event.getSource() == clearPanelButton)
3112
+ } else if (source == clearPanelButton)
32133113 {
32143114 copy.ClearUI();
32153115 refreshContents(true);
3216
- } /*
3217
- }
3218
-
3219
- public boolean action(Event event, Object arg)
3220
- {
3221
- */ 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)
32223141 {
32233142 Close();
32243143 //return true;
3225
- } else if (event.getSource() == loadItem)
3144
+ } else if (source == loadItem)
32263145 {
32273146 load();
32283147 //return true;
3229
- } else if (event.getSource() == saveItem)
3148
+ } else if (source == newItem)
3149
+ {
3150
+ New();
3151
+ } else if (source == saveItem)
32303152 {
32313153 save();
32323154 //return true;
3233
- } else if (event.getSource() == saveAsItem)
3155
+ } else if (source == saveAsItem)
32343156 {
32353157 saveAs();
32363158 //return true;
3237
- } else if (event.getSource() == reexportItem)
3159
+ } else if (source == reexportItem)
32383160 {
32393161 reexport();
32403162 //return true;
3241
- } else if (event.getSource() == exportAsItem)
3163
+ } else if (source == exportAsItem)
32423164 {
32433165 export();
32443166 //return true;
3245
- } else if (event.getSource() == povItem)
3167
+ } else if (source == povItem)
32463168 {
32473169 generatePOV();
32483170 //return true;
3249
- } else if (event.getSource() == zBufferItem)
3171
+ } else if (source == zBufferItem)
32503172 {
32513173 try
32523174 {
....@@ -3268,21 +3190,8 @@
32683190 cameraView.repaint();
32693191 //return true;
32703192 }
3271
- */ else if (event.getSource() == editCameraItem)
3272
- {
3273
- cameraView.ProtectCamera();
3274
- cameraView.repaint();
3275
- return;
3276
- } else if (event.getSource() == revertCameraItem)
3277
- {
3278
- cameraView.RevertCamera();
3279
- cameraView.repaint();
3280
- return;
3281
-// } else if (event.getSource() == textureButton)
3282
-// {
3283
-// return; // true;
3284
- } else // combos...
3285
- if (event.getSource() == texresMenu)
3193
+ */ else // combos...
3194
+ if (source == texresMenu)
32863195 {
32873196 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32883197 copy.texres = texresMenu.getSelectedIndex();
....@@ -3294,27 +3203,268 @@
32943203 }
32953204 }
32963205
3297
- void ToggleAnimation()
3206
+ void New()
32983207 {
3299
- if (!CameraPane.ANIMATION)
3208
+ while (copy.Size() > 1)
33003209 {
3301
- 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 byte[] Compress(Object o)
3218
+ {
3219
+ try
3220
+ {
3221
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3222
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3223
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3224
+
3225
+ out.writeObject(o);
3226
+
3227
+ out.flush();
3228
+
3229
+ zstream.close();
3230
+ out.close();
3231
+
3232
+ return baos.toByteArray();
3233
+ } catch (Exception e)
3234
+ {
3235
+ System.err.println(e);
3236
+ return null;
3237
+ }
3238
+ }
3239
+
3240
+ static public Object Uncompress(byte[] bytes)
3241
+ {
3242
+ System.out.println("#bytes = " + bytes.length);
3243
+ try
3244
+ {
3245
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3246
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3247
+ ObjectInputStream in = new ObjectInputStream(istream);
3248
+ Object obj = in.readObject();
3249
+ in.close();
3250
+
3251
+ return obj;
3252
+ } catch (Exception e)
3253
+ {
3254
+ System.err.println(e);
3255
+ return null;
3256
+ }
3257
+ }
3258
+
3259
+ static public Object clone(Object o)
3260
+ {
3261
+ try
3262
+ {
3263
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3264
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3265
+
3266
+ out.writeObject(o);
3267
+
3268
+ out.flush();
3269
+ out.close();
3270
+
3271
+ byte[] bytes = baos.toByteArray();
3272
+
3273
+ System.out.println("clone = " + bytes.length);
3274
+
3275
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3276
+ ObjectInputStream in = new ObjectInputStream(bais);
3277
+ Object obj = in.readObject();
3278
+ in.close();
3279
+
3280
+ return obj;
3281
+ } catch (Exception e)
3282
+ {
3283
+ System.err.println(e);
3284
+ return null;
3285
+ }
3286
+ }
3287
+
3288
+ cRadio GetCurrentTab()
3289
+ {
3290
+ cRadio ab;
3291
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3292
+ {
3293
+ ab = (cRadio)e.nextElement();
3294
+ if(ab.GetObject() == copy)
3295
+ {
3296
+ return ab;
3297
+ }
3298
+ }
3299
+
3300
+ return null;
3301
+ }
3302
+
3303
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3304
+
3305
+ public void Save()
3306
+ {
3307
+ cRadio tab = GetCurrentTab();
3308
+
3309
+ copy.ExtractBigData(hashtable);
3310
+
3311
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3312
+ tab.graphs[tab.undoindex++] = Compress(copy);
3313
+
3314
+ copy.RestoreBigData(hashtable);
3315
+
3316
+ //assert(hashtable.isEmpty());
3317
+
3318
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3319
+ {
3320
+ tab.graphs[i] = null;
3321
+ }
3322
+
3323
+ // test save
3324
+ if (false)
3325
+ {
3326
+ try
3327
+ {
3328
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3329
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3330
+
3331
+ p.writeObject(copy);
3332
+
3333
+ p.flush();
3334
+
3335
+ ostream.close();
3336
+ } catch (Exception e)
3337
+ {
3338
+ e.printStackTrace();
3339
+ }
3340
+ }
3341
+ }
3342
+
3343
+ void CopyChanged(Object3D obj)
3344
+ {
3345
+ copy.ExtractBigData(hashtable);
3346
+
3347
+ copy.clear();
3348
+
3349
+ for (int i=0; i<obj.Size(); i++)
3350
+ {
3351
+ copy.add(obj.get(i));
3352
+ }
3353
+
3354
+ copy.RestoreBigData(hashtable);
3355
+
3356
+ //assert(hashtable.isEmpty());
3357
+
3358
+ copy.Touch();
3359
+
3360
+ ResetModel();
3361
+ copy.HardTouch(); // recompile?
3362
+
3363
+ cRadio ab;
3364
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3365
+ {
3366
+ ab = (cRadio)e.nextElement();
3367
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3368
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3369
+ if (test != null)
3370
+ {
3371
+ test.editWindow = ab.object.editWindow;
3372
+ ab.object = test;
3373
+ }
3374
+ }
3375
+
3376
+ refreshContents();
3377
+ }
3378
+
3379
+ public void Undo()
3380
+ {
3381
+ cRadio tab = GetCurrentTab();
3382
+
3383
+ if (tab.undoindex == 0)
3384
+ {
3385
+ java.awt.Toolkit.getDefaultToolkit().beep();
3386
+ return;
3387
+ }
3388
+
3389
+ if (tab.graphs[tab.undoindex] == null)
3390
+ {
3391
+ Save();
3392
+ tab.undoindex -= 1;
3393
+ }
3394
+
3395
+ tab.undoindex -= 1;
3396
+
3397
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3398
+ }
3399
+
3400
+ public void Redo()
3401
+ {
3402
+ cRadio tab = GetCurrentTab();
3403
+
3404
+ if (tab.graphs[tab.undoindex + 1] == null)
3405
+ {
3406
+ java.awt.Toolkit.getDefaultToolkit().beep();
3407
+ return;
3408
+ }
3409
+
3410
+ tab.undoindex += 1;
3411
+
3412
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3413
+ }
3414
+
3415
+ void ImportGFD()
3416
+ {
3417
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
33023418 browser.show();
33033419 String filename = browser.getFile();
33043420 if (filename != null && filename.length() > 0)
33053421 {
3306
- CameraPane.filename = browser.getDirectory() + filename;
3422
+ String fullname = browser.getDirectory() + filename;
3423
+
3424
+ //Object3D readobj =
3425
+ objEditor.ReadGFD(fullname, objEditor);
3426
+ //makeSomething(readobj);
3427
+ }
3428
+ }
3429
+
3430
+ void ImportVRMLX3D()
3431
+ {
3432
+ if (Grafreed.standAlone)
3433
+ {
3434
+ /**/
3435
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3436
+ browser.show();
3437
+ String filename = browser.getFile();
3438
+ if (filename != null && filename.length() > 0)
3439
+ {
3440
+ String fullname = browser.getDirectory() + filename;
3441
+ LoadVRMLX3D(fullname);
3442
+ }
3443
+ /**/
3444
+ }
3445
+ }
3446
+
3447
+ void ToggleAnimation()
3448
+ {
3449
+ if (!Globals.ANIMATION)
3450
+ {
3451
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3452
+ browser.setVisible(true);
3453
+ String filename = browser.getFile();
3454
+ if (filename != null && filename.length() > 0)
3455
+ {
3456
+ Globals.filename = browser.getDirectory() + filename;
33073457 //CameraPane.framecount = 0;
3308
- CameraPane.imagecount = 0;
3458
+ Globals.imagecount = 0;
33093459
3310
- CameraPane.ANIMATION ^= true;
3460
+ Globals.ANIMATION ^= true;
33113461
3312
- GrafreeD.wav.cursor = 0;
3313
- GrafreeD.wav.loop = 0;
3462
+ Grafreed.wav.cursor = 0;
3463
+ Grafreed.wav.loop = 0;
33143464 }
33153465 } else
33163466 {
3317
- CameraPane.ANIMATION ^= true;
3467
+ Globals.ANIMATION ^= true;
33183468 }
33193469 }
33203470
....@@ -3360,7 +3510,7 @@
33603510 void CreateMaterial()
33613511 {
33623512 //copy.ClearMaterial(); // PATCH
3363
- copy.CreateMaterialS(multiplyToggle.isSelected());
3513
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33643514 if (copy.selection.size() > 0)
33653515 //SetMaterial(copy);
33663516 {
....@@ -3419,11 +3569,11 @@
34193569 {
34203570 copy.ResetBlockLoop(); // temporary problem
34213571
3422
- boolean random = CameraPane.RANDOM;
3423
- CameraPane.RANDOM = false; // parse everything
3572
+ boolean random = CameraPane.SWITCH;
3573
+ CameraPane.SWITCH = false; // parse everything
34243574 copy.ResetDisplayList();
34253575 copy.HardTouch();
3426
- CameraPane.RANDOM = random;
3576
+ CameraPane.SWITCH = random;
34273577 }
34283578
34293579 // public void applySelf()
....@@ -3493,10 +3643,40 @@
34933643 current.fakedepth = (float) fakedepthField.getFloat();
34943644 current.shadowbias = (float) shadowbiasField.getFloat();
34953645
3496
- if (!NumberSlider.frozen)
3646
+ if (!cNumberSlider.frozen)
34973647 {
34983648 //System.out.println("Propagate = " + propagate);
34993649 copy.UpdateMaterial(anchor, current, propagate);
3650
+
3651
+ if (copy.material != null)
3652
+ {
3653
+ cMaterial mat = copy.material;
3654
+
3655
+ colorField.SetToolTipValue((mat.color));
3656
+ modulationField.SetToolTipValue((mat.modulation));
3657
+ metalnessField.SetToolTipValue((mat.metalness));
3658
+ diffuseField.SetToolTipValue((mat.diffuse));
3659
+ specularField.SetToolTipValue((mat.specular));
3660
+ shininessField.SetToolTipValue((mat.shininess));
3661
+ shiftField.SetToolTipValue((mat.shift));
3662
+ ambientField.SetToolTipValue((mat.ambient));
3663
+ lightareaField.SetToolTipValue((mat.lightarea));
3664
+ diffusenessField.SetToolTipValue((mat.factor));
3665
+ velvetField.SetToolTipValue((mat.velvet));
3666
+ sheenField.SetToolTipValue((mat.sheen));
3667
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3668
+ backlitField.SetToolTipValue((mat.bump));
3669
+ anisoField.SetToolTipValue((mat.aniso));
3670
+ anisoVField.SetToolTipValue((mat.anisoV));
3671
+ cameraField.SetToolTipValue((mat.cameralight));
3672
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3673
+ shadowField.SetToolTipValue((mat.shadow));
3674
+ textureField.SetToolTipValue((mat.texture));
3675
+ opacityField.SetToolTipValue((mat.opacity));
3676
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3677
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3678
+ }
3679
+
35003680 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35013681 {
35023682 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3541,6 +3721,7 @@
35413721 || e.getSource() == apertureField
35423722 || e.getSource() == shadowblurField)
35433723 {
3724
+ new Exception().printStackTrace();
35443725 System.exit(0);
35453726 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35463727 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3611,7 +3792,7 @@
36113792 }
36123793
36133794 if (normalpushField != null)
3614
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3795
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36153796 }
36163797
36173798 void SnapObject()
....@@ -3866,7 +4047,7 @@
38664047
38674048 radioPanel.revalidate();
38684049 radioPanel.repaint();
3869
- ctrlPanel.revalidate(); // ? new
4050
+ ctrlPanel.validate(); // ? new
38704051 ctrlPanel.repaint();
38714052 }
38724053 }
....@@ -3875,6 +4056,7 @@
38754056
38764057 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38774058 {
4059
+ Save();
38784060 //Tween.set(thing, 0).target(1).start(tweenManager);
38794061 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38804062 // if (thing instanceof GenericJointDemo)
....@@ -4078,6 +4260,7 @@
40784260 }
40794261 }
40804262 }
4263
+
40814264 LoadGFDThread loadGFDThread;
40824265
40834266 void ReadGFD(String fullname, iCallBack cb)
....@@ -4098,7 +4281,8 @@
40984281 try
40994282 {
41004283 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4101
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4284
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4285
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
41024286
41034287 readobj = (Object3D) p.readObject();
41044288 istream.close();
....@@ -4106,7 +4290,20 @@
41064290 readobj.ResetDisplayList();
41074291 } catch (Exception e)
41084292 {
4109
- e.printStackTrace();
4293
+ //e.printStackTrace();
4294
+ try
4295
+ {
4296
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4297
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4298
+
4299
+ readobj = (Object3D) p.readObject();
4300
+ istream.close();
4301
+
4302
+ readobj.ResetDisplayList();
4303
+ } catch (Exception e2)
4304
+ {
4305
+ e2.printStackTrace();
4306
+ }
41104307 }
41114308 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41124309 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4161,6 +4358,7 @@
41614358
41624359 if (readobj != null)
41634360 {
4361
+ Save();
41644362 try
41654363 {
41664364 //readobj.deepCopySelf(copy);
....@@ -4223,7 +4421,7 @@
42234421
42244422 void load() // throws ClassNotFoundException
42254423 {
4226
- if (GrafreeD.standAlone)
4424
+ if (Grafreed.standAlone)
42274425 {
42284426 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42294427 browser.show();
....@@ -4310,11 +4508,13 @@
43104508 try
43114509 {
43124510 FileOutputStream ostream = new FileOutputStream(lastname);
4313
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4511
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4512
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43144513
43154514 p.writeObject(copy);
43164515 p.flush();
43174516
4517
+ zstream.close();
43184518 ostream.close();
43194519
43204520 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4324,11 +4524,12 @@
43244524 {
43254525 }
43264526 }
4527
+
43274528 String lastname;
43284529
43294530 void saveAs()
43304531 {
4331
- if (GrafreeD.standAlone)
4532
+ if (Grafreed.standAlone)
43324533 {
43334534 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43344535 browser.setVisible(true);
....@@ -4433,13 +4634,13 @@
44334634 try
44344635 {
44354636 FileOutputStream ostream = new FileOutputStream(filename);
4436
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4437
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4637
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4638
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44384639
44394640 Object3D objectparent = obj.parent;
44404641 obj.parent = null;
44414642
4442
- Object3D object = (Object3D) GrafreeD.clone(obj);
4643
+ Object3D object = (Object3D) Grafreed.clone(obj);
44434644
44444645 obj.parent = objectparent;
44454646
....@@ -4451,8 +4652,8 @@
44514652 p.writeObject(object);
44524653 p.flush();
44534654
4655
+ zstream.close();
44544656 ostream.close();
4455
- // zstream.close();
44564657
44574658 // group.selection.get(0).parent = parent;
44584659 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4473,7 +4674,7 @@
44734674 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44744675 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44754676 copy.generatePOV(buffer);
4476
- if (GrafreeD.standAlone)
4677
+ if (Grafreed.standAlone)
44774678 {
44784679 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44794680 browser.show();
....@@ -4499,7 +4700,8 @@
44994700 Object3D client;
45004701 Object3D copy;
45014702 MenuBar menuBar;
4502
- Menu windowMenu;
4703
+ Menu fileMenu;
4704
+ MenuItem newItem;
45034705 MenuItem loadItem;
45044706 MenuItem saveItem;
45054707 MenuItem saveAsItem;
....@@ -4507,13 +4709,11 @@
45074709 MenuItem reexportItem;
45084710 MenuItem povItem;
45094711 MenuItem closeItem;
4510
- Menu cameraMenu;
4712
+
45114713 CheckboxMenuItem zBufferItem;
45124714 //MenuItem normalLensItem;
4513
- MenuItem editCameraItem;
4514
- MenuItem revertCameraItem;
4515
- CheckboxMenuItem toggleLiveItem;
45164715 MenuItem stepItem;
4716
+ CheckboxMenuItem toggleLiveItem;
45174717 CheckboxMenuItem toggleFullScreenItem;
45184718 CheckboxMenuItem toggleTimelineItem;
45194719 CheckboxMenuItem toggleRenderItem;
....@@ -4522,7 +4722,7 @@
45224722 CheckboxMenuItem toggleFootContactItem;
45234723 CheckboxMenuItem toggleDLItem;
45244724 CheckboxMenuItem toggleTextureItem;
4525
- CheckboxMenuItem toggleRandomItem;
4725
+ CheckboxMenuItem toggleSwitchItem;
45264726 CheckboxMenuItem toggleRootItem;
45274727 CheckboxMenuItem animationItem;
45284728 CheckboxMenuItem toggleHandleItem;
....@@ -4530,20 +4730,20 @@
45304730 JSplitPane mainPanel;
45314731 JScrollPane scrollpane;
45324732 JPanel toolbarPanel;
4533
- JPanel treePanel;
4733
+ cGridBag treePanel;
45344734 JPanel radioPanel;
45354735 ButtonGroup buttonGroup;
4536
- JPanel ctrlPanel;
4537
- JPanel materialPanel;
4736
+ cGridBag ctrlPanel;
4737
+ cGridBag materialPanel;
45384738 JScrollPane infoPanel;
4539
- JPanel optionsPanel;
4739
+ cGridBag optionsPanel;
45404740 JTabbedPane objectPanel;
4541
- JPanel XYZPanel;
4741
+ cGridBag XYZPanel;
45424742 JSplitPane gridPanel;
45434743 JSplitPane bigPanel;
4544
- JPanel bigThree;
4545
- JTabbedPane scenePanel;
4546
- JPanel centralPanel;
4744
+ cGridBag bigThree;
4745
+ cGridBag scenePanel;
4746
+ cGridBag centralPanel;
45474747 JSplitPane cameraPanel;
45484748 JPanel timelinePanel;
45494749 JMenuBar timelineMenubar;
....@@ -4596,67 +4796,72 @@
45964796 // MATERIAL
45974797 JLabel materialLabel;
45984798 JLabel colorLabel;
4599
- NumberSlider colorField;
4799
+ cNumberSlider colorField;
46004800 JLabel modulationLabel;
4601
- NumberSlider modulationField;
4801
+ cNumberSlider modulationField;
46024802 JLabel metalnessLabel;
4603
- NumberSlider metalnessField;
4803
+ cNumberSlider metalnessField;
46044804 JLabel diffuseLabel;
4605
- NumberSlider diffuseField;
4805
+ cNumberSlider diffuseField;
46064806 JLabel specularLabel;
4607
- NumberSlider specularField;
4807
+ cNumberSlider specularField;
46084808 JLabel shininessLabel;
4609
- NumberSlider shininessField;
4809
+ cNumberSlider shininessField;
46104810 JLabel shiftLabel;
4611
- NumberSlider shiftField;
4811
+ cNumberSlider shiftField;
46124812 JLabel ambientLabel;
4613
- NumberSlider ambientField;
4813
+ cNumberSlider ambientField;
46144814 JLabel lightareaLabel;
4615
- NumberSlider lightareaField;
4815
+ cNumberSlider lightareaField;
46164816 JLabel diffusenessLabel;
4617
- NumberSlider diffusenessField;
4817
+ cNumberSlider diffusenessField;
46184818 JLabel velvetLabel;
4619
- NumberSlider velvetField;
4819
+ cNumberSlider velvetField;
46204820 JLabel sheenLabel;
4621
- NumberSlider sheenField;
4821
+ cNumberSlider sheenField;
46224822 JLabel subsurfaceLabel;
4623
- NumberSlider subsurfaceField;
4823
+ cNumberSlider subsurfaceField;
46244824 //JLabel bumpLabel;
46254825 //NumberSlider bumpField;
46264826 JLabel backlitLabel;
4627
- NumberSlider backlitField;
4827
+ cNumberSlider backlitField;
46284828 JLabel anisoLabel;
4629
- NumberSlider anisoField;
4829
+ cNumberSlider anisoField;
46304830 JLabel anisoVLabel;
4631
- NumberSlider anisoVField;
4831
+ cNumberSlider anisoVField;
46324832 JLabel cameraLabel;
4633
- NumberSlider cameraField;
4833
+ cNumberSlider cameraField;
46344834 JLabel selfshadowLabel;
4635
- NumberSlider selfshadowField;
4835
+ cNumberSlider selfshadowField;
46364836 JLabel shadowLabel;
4637
- NumberSlider shadowField;
4837
+ cNumberSlider shadowField;
46384838 JLabel textureLabel;
4639
- NumberSlider textureField;
4839
+ cNumberSlider textureField;
46404840 JLabel opacityLabel;
4641
- NumberSlider opacityField;
4841
+ cNumberSlider opacityField;
46424842 JLabel fakedepthLabel;
4643
- NumberSlider fakedepthField;
4843
+ cNumberSlider fakedepthField;
46444844 JLabel shadowbiasLabel;
4645
- NumberSlider shadowbiasField;
4845
+ cNumberSlider shadowbiasField;
46464846 JLabel bumpLabel;
4647
- NumberSlider bumpField;
4847
+ cNumberSlider bumpField;
46484848 JLabel noiseLabel;
4649
- NumberSlider noiseField;
4849
+ cNumberSlider noiseField;
46504850 JLabel powerLabel;
4651
- NumberSlider powerField;
4851
+ cNumberSlider powerField;
46524852 JLabel borderfadeLabel;
4653
- NumberSlider borderfadeField;
4853
+ cNumberSlider borderfadeField;
46544854 JLabel fogLabel;
4655
- NumberSlider fogField;
4855
+ cNumberSlider fogField;
46564856 JLabel opacityPowerLabel;
4657
- NumberSlider opacityPowerField;
4857
+ cNumberSlider opacityPowerField;
46584858 JTree jTree;
46594859 //ObjectUI parent;
46604860
4661
- NumberSlider normalpushField;
4861
+ cNumberSlider normalpushField;
4862
+
4863
+ private MenuItem importGFDItem;
4864
+ private MenuItem importVRMLX3DItem;
4865
+ private MenuItem import3DSItem;
4866
+ private MenuItem importOBJItem;
46624867 }