Normand Briere
2019-06-21 15123b19e7bc8da2869429b07f0fbaa0598e945e
ObjEditor.java
....@@ -138,34 +138,42 @@
138138 public void closeUI()
139139 {
140140 //new Exception().printStackTrace();
141
- System.out.println("this = " + this);
142
- System.out.println("objEditor = " + objEditor);
141
+// System.out.println("this = " + this);
142
+// System.out.println("objEditor = " + objEditor);
143143 //nameField.removeActionListener(this);
144
- objEditor.ctrlPanel.remove(nameField);
144
+// objEditor.ctrlPanel.remove(nameField);
145
+
146
+ objEditor.ctrlPanel.remove(namePanel);
145147
146148 if (!GroupEditor.allparams)
147149 return;
148150
149
- objEditor.ctrlPanel.remove(liveCB);
150
- objEditor.ctrlPanel.remove(hideCB);
151
- objEditor.ctrlPanel.remove(markCB);
152
-
153
- objEditor.ctrlPanel.remove(randomCB);
154
- objEditor.ctrlPanel.remove(speedupCB);
155
- objEditor.ctrlPanel.remove(rewindCB);
156
-
157
- objEditor.ctrlPanel.remove(resetButton);
158
- objEditor.ctrlPanel.remove(stepButton);
159
-// objEditor.ctrlPanel.remove(stepAllButton);
160
-// objEditor.ctrlPanel.remove(resetAllButton);
161
- objEditor.ctrlPanel.remove(link2masterCB);
162
- //objEditor.ctrlPanel.remove(flipVCB);
163
- //objEditor.ctrlPanel.remove(texresMenu);
164
- objEditor.ctrlPanel.remove(slowerButton);
165
- objEditor.ctrlPanel.remove(fasterButton);
166
- 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);
167169
168
- Remove(normalpushField);
170
+ objEditor.ctrlPanel.remove(setupPanel);
171
+ objEditor.ctrlPanel.remove(setupPanel2);
172
+ objEditor.ctrlPanel.remove(commandsPanel);
173
+ objEditor.ctrlPanel.remove(pushPanel);
174
+ //objEditor.ctrlPanel.remove(fillPanel);
175
+
176
+ //Remove(normalpushField);
169177 }
170178
171179 public ObjEditor GetEditor()
....@@ -269,24 +277,40 @@
269277 void SetupMenu()
270278 {
271279 frame.setMenuBar(menuBar = new MenuBar());
272
- menuBar.add(windowMenu = new Menu("File"));
273
- windowMenu.add(loadItem = new MenuItem("Load..."));
274
- windowMenu.add("-");
275
- windowMenu.add(saveItem = new MenuItem("Save"));
276
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
280
+ menuBar.add(fileMenu = new Menu("File"));
281
+ fileMenu.add(newItem = new MenuItem("New"));
282
+ fileMenu.add(loadItem = new MenuItem("Open..."));
283
+
284
+ //oe.menuBar.add(menu = new Menu("Include"));
285
+ Menu menu = new Menu("Import");
286
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
287
+ importOBJItem.addActionListener(this);
288
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
289
+ import3DSItem.addActionListener(this);
290
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
291
+ importVRMLX3DItem.addActionListener(this);
292
+ menu.add("-");
293
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
294
+ importGFDItem.addActionListener(this);
295
+ fileMenu.add(menu);
296
+ fileMenu.add("-");
297
+
298
+ fileMenu.add(saveItem = new MenuItem("Save"));
299
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
277300 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
278
- windowMenu.add("-");
279
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
280
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
281
- windowMenu.add("-");
301
+ fileMenu.add("-");
302
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
303
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
304
+ fileMenu.add("-");
282305 if (client.parent != null)
283306 {
284
- windowMenu.add(closeItem = new MenuItem("Close"));
307
+ fileMenu.add(closeItem = new MenuItem("Close"));
285308 } else
286309 {
287
- windowMenu.add(closeItem = new MenuItem("Exit"));
310
+ fileMenu.add(closeItem = new MenuItem("Exit"));
288311 }
289312
313
+ newItem.addActionListener(this);
290314 loadItem.addActionListener(this);
291315 saveItem.addActionListener(this);
292316 saveAsItem.addActionListener(this);
....@@ -295,79 +319,26 @@
295319 //povItem.addActionListener(this);
296320 closeItem.addActionListener(this);
297321
298
- menuBar.add(cameraMenu = new Menu("View"));
299
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
300
- //zBufferItem.addActionListener(this);
301
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
302
- //normalLensItem.addActionListener(this);
303
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
304
- revertCameraItem.addActionListener(this);
305
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
306
- toggleTimelineItem.addItemListener(this);
307
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
308
- toggleFullScreenItem.addItemListener(this);
309
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
310
- cameraMenu.add("-");
311
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
312
- toggleTextureItem.addItemListener(this);
313
- toggleTextureItem.setState(CameraPane.textureon);
314
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
315
- toggleLiveItem.addItemListener(this);
316
- toggleLiveItem.setState(Globals.isLIVE());
317
- cameraMenu.add(stepItem = new MenuItem("Step"));
318
- stepItem.addActionListener(this);
319
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
320
-// toggleDLItem.addItemListener(this);
321
-// toggleDLItem.setState(false);
322
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
323
- toggleRenderItem.addItemListener(this);
324
- toggleRenderItem.setState(!CameraPane.frozen);
325
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
326
- toggleDebugItem.addItemListener(this);
327
- toggleDebugItem.setState(CameraPane.DEBUG);
328
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
329
- toggleFrustumItem.addItemListener(this);
330
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
331
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
332
- toggleFootContactItem.addItemListener(this);
333
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
334
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
335
- toggleRandomItem.addItemListener(this);
336
- toggleRandomItem.setState(CameraPane.RANDOM);
337
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
338
- toggleHandleItem.addItemListener(this);
339
- toggleHandleItem.setState(CameraPane.HANDLES);
340
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
341
- togglePaintItem.addItemListener(this);
342
- togglePaintItem.setState(CameraPane.PAINTMODE);
343
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
344
-// toggleRootItem.addItemListener(this);
345
-// toggleRootItem.setState(false);
346
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
347
-// animationItem.addItemListener(this);
348
-// animationItem.setState(CameraPane.ANIMATION);
349
- cameraMenu.add("-");
350
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
351
- editCameraItem.addActionListener(this);
352
-
353322 objectPanel = new JTabbedPane();
354323 toolbarPanel = new JPanel();
355324 toolbarPanel.setName("Toolbar");
356
- treePanel = new JPanel();
325
+ treePanel = new cGridBag();
357326 treePanel.setName("Tree");
358
- ctrlPanel = new JPanel(); // new GridBagLayout());
327
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
359328 ctrlPanel.setName("Edit");
360
- materialPanel = new JPanel();
329
+ materialPanel = new cGridBag().setVertical(true);
361330 materialPanel.setName("Material");
362331 /*JTextPane*/
363332 infoarea = createTextPane();
333
+ doc = infoarea.getStyledDocument();
334
+
364335 infoarea.setEditable(true);
365336 SetText();
366337 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
367338 // infoarea.setOpaque(false);
368339 // //infoarea.setForeground(textcolor);
369
- infoarea.setLineWrap(true);
370
- infoarea.setWrapStyleWord(true);
340
+// TEXTAREA infoarea.setLineWrap(true);
341
+// TEXTAREA infoarea.setWrapStyleWord(true);
371342 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
372343 infoPanel.setPreferredSize(new Dimension(50, 200));
373344 infoPanel.setName("Info");
....@@ -378,16 +349,16 @@
378349 mainPanel.setName("Main");
379350 mainPanel.setContinuousLayout(true);
380351 mainPanel.setOneTouchExpandable(true);
381
- mainPanel.setDividerLocation(1.0);
382352 mainPanel.setDividerSize(9);
383
- mainPanel.setResizeWeight(0);
353
+ mainPanel.setDividerLocation(0.5); //1.0);
354
+ mainPanel.setResizeWeight(0.5);
384355
385356 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
386357 //mainPanel.setLayout(new GridBagLayout());
387358 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
388
- treePanel.setLayout(new GridBagLayout());
389
- ctrlPanel.setLayout(new GridBagLayout());
390
- materialPanel.setLayout(new GridBagLayout());
359
+// treePanel.setLayout(new GridBagLayout());
360
+ //ctrlPanel.setLayout(new GridBagLayout());
361
+ //materialPanel.setLayout(new GridBagLayout());
391362
392363 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
393364 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -426,7 +397,7 @@
426397 static String newline = "\n";
427398 protected static final String buttonString = "JButton";
428399 StyledDocument doc;
429
- JTextArea infoarea;
400
+ JTextPane infoarea;
430401
431402 void ClearInfo()
432403 {
....@@ -449,10 +420,10 @@
449420 e.printStackTrace();
450421 }
451422
452
- String selection = infoarea.getText();
453
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
454
- java.awt.datatransfer.Clipboard clipboard =
455
- Toolkit.getDefaultToolkit().getSystemClipboard();
423
+// String selection = infoarea.getText();
424
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
425
+// java.awt.datatransfer.Clipboard clipboard =
426
+// Toolkit.getDefaultToolkit().getSystemClipboard();
456427 //clipboard.setContents(data, data);
457428 }
458429
....@@ -475,13 +446,13 @@
475446 //SendInfo("Name:", "bold");
476447 if (sel.GetTextures() != null || debug)
477448 {
478
- si.SendInfo(sel.toString(), "bold");
449
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
479450 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
480451 if (sel.Size() > 0)
481452 {
482453 si.SendInfo("#children = " + sel.Size(), "regular");
483454 }
484
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
455
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
485456 if (debug)
486457 {
487458 try
....@@ -493,7 +464,10 @@
493464 }
494465
495466 if (full)
496
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
467
+ {
468
+ si.SendInfo(" BBox min: " + minima, "regular");
469
+ si.SendInfo(" BBox max: " + maxima, "regular");
470
+ }
497471
498472 if (sel.bRep != null)
499473 {
....@@ -520,7 +494,7 @@
520494 }
521495 if (sel.support != null)
522496 {
523
- si.SendInfo(" support: " + sel.support, "regular");
497
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
524498 }
525499 if (sel.scriptnode != null)
526500 {
....@@ -591,6 +565,9 @@
591565 {
592566 CameraPane.pointflow = (PointFlow) sel;
593567 }
568
+
569
+ si.SendInfo("_____________________", "regular");
570
+ si.SendInfo("", "regular");
594571 }
595572 }
596573
....@@ -622,52 +599,52 @@
622599 cameraView.ToggleFullScreen();
623600 }
624601
625
- private JTextArea createTextPane()
602
+ private JTextPane createTextPane()
626603 {
627
- String[] initString =
628
- {
629
- "This is an editable JTextPane, ", //regular
630
- "another ", //italic
631
- "styled ", //bold
632
- "text ", //small
633
- "component, ", //large
634
- "which supports embedded components..." + newline,//regular
635
- " " + newline, //button
636
- "...and embedded icons..." + newline, //regular
637
- " ", //icon
638
- newline + "JTextPane is a subclass of JEditorPane that "
639
- + "uses a StyledEditorKit and StyledDocument, and provides "
640
- + "cover methods for interacting with those objects."
641
- };
604
+// TEXTAREA String[] initString =
605
+// {
606
+// "This is an editable JTextPane, ", //regular
607
+// "another ", //italic
608
+// "styled ", //bold
609
+// "text ", //small
610
+// "component, ", //large
611
+// "which supports embedded components..." + newline,//regular
612
+// " " + newline, //button
613
+// "...and embedded icons..." + newline, //regular
614
+// " ", //icon
615
+// newline + "JTextPane is a subclass of JEditorPane that "
616
+// + "uses a StyledEditorKit and StyledDocument, and provides "
617
+// + "cover methods for interacting with those objects."
618
+// };
619
+//
620
+// String[] initStyles =
621
+// {
622
+// "regular", "italic", "bold", "small", "large",
623
+// "regular", "button", "regular", "icon",
624
+// "regular"
625
+// };
626
+//
627
+// JTextPane textPane = new JTextPane();
628
+// textPane.setEditable(true);
629
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
630
+// addStylesToDocument(doc);
631
+//
632
+// try
633
+// {
634
+// for (int j = 0; j < 2; j++)
635
+// {
636
+// for (int i = 0; i < initString.length; i++)
637
+// {
638
+// doc.insertString(doc.getLength(), initString[i],
639
+// doc.getStyle(initStyles[i]));
640
+// }
641
+// }
642
+// } catch (BadLocationException ble)
643
+// {
644
+// System.err.println("Couldn't insert initial text into text pane.");
645
+// }
642646
643
- String[] initStyles =
644
- {
645
- "regular", "italic", "bold", "small", "large",
646
- "regular", "button", "regular", "icon",
647
- "regular"
648
- };
649
-
650
- JTextPane textPane = new JTextPane();
651
- textPane.setEditable(true);
652
- /*StyledDocument*/ doc = textPane.getStyledDocument();
653
- addStylesToDocument(doc);
654
-
655
- try
656
- {
657
- for (int j = 0; j < 2; j++)
658
- {
659
- for (int i = 0; i < initString.length; i++)
660
- {
661
- doc.insertString(doc.getLength(), initString[i],
662
- doc.getStyle(initStyles[i]));
663
- }
664
- }
665
- } catch (BadLocationException ble)
666
- {
667
- System.err.println("Couldn't insert initial text into text pane.");
668
- }
669
-
670
- return new JTextArea(); // textPane;
647
+ return new JTextPane(); // textPane;
671648 }
672649
673650 protected void addStylesToDocument(StyledDocument doc)
....@@ -720,7 +697,7 @@
720697 protected static ImageIcon createImageIcon(String path,
721698 String description)
722699 {
723
- java.net.URL imgURL = GrafreeD.class.getResource(path);
700
+ java.net.URL imgURL = Grafreed.class.getResource(path);
724701 if (imgURL != null)
725702 {
726703 return new ImageIcon(imgURL, description);
....@@ -752,6 +729,7 @@
752729 // NumberSlider vDivsField;
753730 // JCheckBox endcaps;
754731 JCheckBox liveCB;
732
+ JCheckBox selectCB;
755733 JCheckBox hideCB;
756734 JCheckBox link2masterCB;
757735 JCheckBox markCB;
....@@ -767,115 +745,84 @@
767745 JButton slowerButton;
768746 JButton fasterButton;
769747 JButton remarkButton;
748
+
749
+ cGridBag namePanel;
750
+ cGridBag setupPanel;
751
+ cGridBag setupPanel2;
752
+ cGridBag commandsPanel;
753
+ cGridBag pushPanel;
754
+ cGridBag fillPanel;
770755
771
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
756
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
772757 {
773758 JCheckBox cb;
774759
775
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
776
- oe.aConstraints.gridwidth = 1; // 3;
777
-// oe.aConstraints.weightx = 1;
778
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
779
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
760
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
780761 cb.addItemListener(this);
781
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
782
- oe.aConstraints.gridwidth = 1;
783
- oe.aConstraints.gridx += 1;
784762
785763 return cb;
786764 }
787765
788
- cButton AddButton(ObjEditor oe, String label)
766
+ cButton AddButton(cGridBag panel, String label)
789767 {
790768 cButton cb;
791769
792
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
793
- oe.aConstraints.gridwidth = 1;
794
-// oe.aConstraints.weightx = 1;
795
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
796
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
770
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
797771 cb.addActionListener(this);
798
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
799
- oe.aConstraints.gridwidth = 1;
800
- oe.aConstraints.gridx += 1;
801772
802773 return cb;
803774 }
804775
805
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
776
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
806777 {
807778 JComboBox combo;
808779
809
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
810
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
811
- oe.aConstraints.gridx += 1;
780
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812781 combo.addActionListener(this);
813782
814783 return combo;
815784 }
816785
817
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
786
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
818787 {
819
- NumberSlider combo;
788
+ cGridBag control = new cGridBag();
789
+
790
+ cNumberSlider combo;
820791
821792 JLabel jlabel = new JLabel(label);
822
-
823
- aConstraints.fill = GridBagConstraints.VERTICAL;
824793 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
825
- aConstraints.gridwidth = 1;
826
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827
- aConstraints.gridx += 1;
828
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
829
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
830
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
831
- aConstraints.gridx += 1;
832
- aConstraints.gridwidth = 1;
833
-
794
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
795
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
834796 combo.setFloat(current);
835
-
836
- combo.label = jlabel;
837
-
838
- combo.addChangeListener(this);
839
-
840
- return combo;
797
+
798
+ panel.add(control);
799
+
800
+ return control;
841801 }
842802
843
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
803
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
844804 {
845
- NumberSlider combo;
805
+ cGridBag control = new cGridBag();
806
+
807
+ cNumberSlider combo;
846808
847809 JLabel jlabel = new JLabel(label);
848
-
849
- aConstraints.fill = GridBagConstraints.VERTICAL;
850810 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
851
- aConstraints.gridwidth = 2;
852
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
853
- aConstraints.gridx += 1;
854
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
855
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
856
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
857
- aConstraints.gridx += 1;
858
- aConstraints.gridwidth = 1;
859
-
811
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
860813 combo.setInteger(current);
861814
862
- combo.label = jlabel;
863
-
864
- combo.addChangeListener(this);
865
-
866
- return combo;
815
+ panel.add(control);
816
+
817
+ return control;
867818 }
868819
869
- JTextArea AddText(JPanel ctrlPanel, String name)
820
+ JTextArea AddText(cGridBag ctrlPanel, String name)
870821 {
871822 JTextArea text;
872823
873
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
874
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
875
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
824
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
876825 text.addCaretListener(this);
877
- aConstraints.gridx += 1;
878
- aConstraints.gridwidth = 1;
879826
880827 return text;
881828 }
....@@ -905,9 +852,16 @@
905852 objEditor.ctrlPanel.remove(j);
906853 }
907854
855
+ void Remove(cNumberSlider j)
856
+ {
857
+ j.removeChangeListener(this);
858
+ //objEditor.ctrlPanel.remove(j.label);
859
+ objEditor.ctrlPanel.remove(j);
860
+ }
861
+
908862 /*
909863 */
910
- void Return() // ObjEditor oe)
864
+ void Return0() // ObjEditor oe)
911865 {
912866 aConstraints.gridy += 1;
913867 aConstraints.gridx = 0;
....@@ -962,37 +916,76 @@
962916
963917 void SetupUI2(ObjEditor oe)
964918 {
965
-// oe.aConstraints.weightx = 0;
966
-// oe.aConstraints.weighty = 0;
967
-// oe.aConstraints.gridx = 0;
968
-// oe.aConstraints.gridy = 0;
969
- SetupName(oe);
919
+ //SetupName(oe);
920
+
921
+ namePanel = new cGridBag();
922
+
923
+ nameField = AddText(namePanel, copy.GetName());
924
+ namePanel.add(nameField);
925
+ oe.ctrlPanel.add(namePanel);
926
+
927
+ oe.ctrlPanel.Return();
970928
971929 if (!GroupEditor.allparams)
972930 return;
973931
974
- liveCB = AddCheckBox(oe, "Live", copy.live);
975
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
976
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
932
+ setupPanel = new cGridBag().setVertical(false);
933
+
934
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
935
+ liveCB.setToolTipText("Animate object");
936
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
937
+ selectCB.setToolTipText("Make object selectable");
977938 // Return();
978
- markCB = AddCheckBox(oe, "Mark", copy.marked);
979
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
980
- randomCB = AddCheckBox(oe, "Rand", copy.random);
981
- Return();
982
- resetButton = AddButton(oe, "Reset");
983
- stepButton = AddButton(oe, "Step");
939
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
940
+ hideCB.setToolTipText("Hide object");
941
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
942
+ markCB.setToolTipText("Set the animation target transform");
943
+
944
+ setupPanel2 = new cGridBag().setVertical(false);
945
+
946
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
947
+ rewindCB.setToolTipText("Rewind animation");
948
+
949
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
950
+ randomCB.setToolTipText("Rewind or Go back and forth randomly");
951
+
952
+ if (Globals.ADVANCED)
953
+ {
954
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
955
+ link2masterCB.setToolTipText("Attach to support");
956
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
957
+ speedupCB.setToolTipText("Option motion capture");
958
+ }
959
+
960
+ oe.ctrlPanel.add(setupPanel);
961
+ oe.ctrlPanel.Return();
962
+ oe.ctrlPanel.add(setupPanel2);
963
+ oe.ctrlPanel.Return();
964
+
965
+ commandsPanel = new cGridBag().setVertical(false);
966
+
967
+ resetButton = AddButton(commandsPanel, "Reset");
968
+ resetButton.setToolTipText("Jump to frame zero");
969
+ stepButton = AddButton(commandsPanel, "Step");
970
+ stepButton.setToolTipText("Step one frame");
984971 // resetAllButton = AddButton(oe, "Reset All");
985972 // stepAllButton = AddButton(oe, "Step All");
986
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
987973 // Return();
988
- slowerButton = AddButton(oe, "Slow");
989
- fasterButton = AddButton(oe, "Fast");
990
- remarkButton = AddButton(oe, "Rem");
974
+ slowerButton = AddButton(commandsPanel, "Slow");
975
+ slowerButton.setToolTipText("Decrease animation speed");
976
+ fasterButton = AddButton(commandsPanel, "Fast");
977
+ fasterButton.setToolTipText("Increase animation speed");
978
+ remarkButton = AddButton(commandsPanel, "Remark");
979
+ remarkButton.setToolTipText("Set the current transform as the target");
991980
992
- Return();
981
+ oe.ctrlPanel.add(commandsPanel);
982
+ oe.ctrlPanel.Return();
993983
994
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
995
- Return();
984
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
985
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
986
+ //Return();
987
+
988
+ oe.ctrlPanel.Return();
996989
997990 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
998991 // ObjEditor.aConstraints.gridx += 1;
....@@ -1087,7 +1080,7 @@
10871080 oe.aConstraints.gridwidth = 1;
10881081 /**/
10891082 nameField = AddText(oe.ctrlPanel, copy.GetName());
1090
- Return();
1083
+ oe.ctrlPanel.Return();
10911084
10921085 //ctrlPanel.add(textureButton = new Button("Texture..."));
10931086 //textureButton.setEnabled(false);
....@@ -1189,7 +1182,8 @@
11891182 //JPanel worldPanel =
11901183 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11911184 //worldPanel.setName("World");
1192
- centralPanel = new JPanel(new BorderLayout());
1185
+ centralPanel = new cGridBag();
1186
+ centralPanel.preferredWidth = 20;
11931187 timelinePanel = new JPanel(new BorderLayout());
11941188 timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11951189
....@@ -1222,6 +1216,7 @@
12221216 XYZPanel = new cGridBag().setVertical(true);
12231217 //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12241218
1219
+ XYZPanel.preferredWidth = 5;
12251220 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
12261221 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
12271222 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
....@@ -1262,10 +1257,11 @@
12621257 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12631258 //tmp.setName("Edit");
12641259 objectPanel.add(materialPanel);
1265
- JPanel north = new JPanel(new BorderLayout());
1266
- north.setName("Edit");
1267
- north.add(ctrlPanel, BorderLayout.NORTH);
1268
- objectPanel.add(north);
1260
+// JPanel north = new JPanel(new BorderLayout());
1261
+// north.setName("Edit");
1262
+// north.add(ctrlPanel, BorderLayout.NORTH);
1263
+// objectPanel.add(north);
1264
+ objectPanel.add(ctrlPanel);
12691265 objectPanel.add(infoPanel);
12701266
12711267 /*
....@@ -1286,19 +1282,23 @@
12861282 scrollpane.setWheelScrollingEnabled(true);
12871283 scrollpane.addMouseWheelListener(this); // Default not fast enough
12881284
1289
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1290
- scenePanel.add(scrollpane);
1285
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1286
+ scenePanel.preferredWidth = 6;
1287
+
1288
+ JTabbedPane tabbedPane = new JTabbedPane();
1289
+ tabbedPane.add(scrollpane);
12911290
1292
- scenePanel.add(FSPane = new cFileSystemPane(this));
1291
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12931292
1294
- optionsPanel = new JPanel(new GridBagLayout());
1293
+ optionsPanel = new cGridBag().setVertical(true);
12951294
12961295 optionsPanel.setName("Options");
12971296
1298
- AddOptions(optionsPanel, aConstraints);
1297
+ AddOptions(optionsPanel); //, aConstraints);
12991298
1300
- scenePanel.add(optionsPanel);
1301
-
1299
+ tabbedPane.add(optionsPanel);
1300
+
1301
+ scenePanel.add(tabbedPane);
13021302
13031303 /*
13041304 cTree jTree = new cTree(null);
....@@ -1389,8 +1389,8 @@
13891389
13901390 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13911391
1392
- frame.setSize(1024, 768);
1393
- frame.show();
1392
+ frame.setSize(1280, 860);
1393
+ frame.setVisible(true);
13941394
13951395 gridPanel.setDividerLocation(1.0);
13961396
....@@ -1405,7 +1405,7 @@
14051405 });
14061406 }
14071407
1408
- void AddOptions(JPanel panel, GridBagConstraints constraints)
1408
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
14091409 {
14101410 }
14111411
....@@ -1420,260 +1420,173 @@
14201420 ctrlPanel.removeAll();
14211421 }
14221422
1423
- void SetupMaterial(JPanel ctrlPanel)
1423
+ void SetupMaterial(cGridBag panel)
14241424 {
1425
- aConstraints.weighty = 0;
1426
- //aConstraints.weightx = 1;
1427
- /*
1425
+ /*
14281426 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14291427 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1430
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1431
- aConstraints.gridx += 1;
14321428 */
14331429
1434
- aConstraints.gridwidth = 1;
1435
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1436
- aConstraints.gridx += 1;
1437
- aConstraints.weighty = 0;
1438
- aConstraints.gridwidth = 1;
1430
+ cGridBag editBar = new cGridBag().setVertical(false);
1431
+
1432
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1433
+ createMaterialButton.setToolTipText("Create material");
14391434
14401435 /*
14411436 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1442
- aConstraints.gridx += 1;
1443
- aConstraints.weighty = 0;
1444
- aConstraints.gridwidth = 1;
14451437 */
14461438
1447
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1448
- aConstraints.gridx += 1;
1439
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1440
+ clearMaterialButton.setToolTipText("Clear material");
1441
+
1442
+ if (Globals.ADVANCED)
1443
+ {
1444
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1445
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1446
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1447
+ }
14491448
1450
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1451
-
1452
- aConstraints.gridx += 1;
1453
-
1454
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1455
-
1456
- aConstraints.gridx += 1;
1457
-
1458
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1459
-
1460
- aConstraints.gridx = 0;
1461
- aConstraints.gridy += 1;
1462
- aConstraints.weighty = 0;
1463
- aConstraints.gridwidth = 1;
1449
+ editBar.preferredHeight = 15;
1450
+
1451
+ panel.add(editBar);
1452
+
14641453 /**/
14651454 //aConstraints.weighty = 0;
14661455 ////aConstraints.weightx = 1;
14671456 //aConstraints.weighty = 1;
14681457 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14691458 //aConstraints.gridx += 1;
1470
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1471
- aConstraints.weighty = 0;
1472
- aConstraints.gridx = 0;
1473
- aConstraints.gridy += 1;
1474
- aConstraints.gridwidth = 1;
1459
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14751460
1476
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1477
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1478
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1479
- aConstraints.gridx += 1;
1480
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1481
- //aConstraints.weightx = 0;
1482
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1483
- aConstraints.gridx = 0;
1484
- aConstraints.gridy += 1;
1485
- aConstraints.gridwidth = 1;
1461
+ cGridBag colorSection = new cGridBag().setVertical(true);
1462
+
1463
+ cGridBag color = new cGridBag();
1464
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1465
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1466
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1467
+ //colorField.preferredWidth = 200;
1468
+ colorSection.add(color);
14861469
1487
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1488
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1489
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1490
- aConstraints.gridx += 1;
1491
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1492
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1493
- aConstraints.gridx = 0;
1494
- aConstraints.gridy += 1;
1495
- aConstraints.gridwidth = 1;
1470
+ cGridBag modulation = new cGridBag();
1471
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1472
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1473
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1474
+ colorSection.add(modulation);
14961475
1497
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1498
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1499
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1500
- aConstraints.gridx += 1;
1501
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1502
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1503
- aConstraints.gridx = 0;
1504
- aConstraints.gridy += 1;
1505
- aConstraints.gridwidth = 1;
1476
+ cGridBag texture = new cGridBag();
1477
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1478
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1479
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1480
+ colorSection.add(texture);
15061481
1507
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1508
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1509
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1510
- aConstraints.gridx += 1;
1511
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1512
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1513
- aConstraints.gridx = 0;
1514
- aConstraints.gridy += 1;
1515
- aConstraints.gridwidth = 1;
1482
+ cGridBag anisoU = new cGridBag();
1483
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1484
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1485
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1486
+ colorSection.add(anisoU);
15161487
1517
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1518
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1519
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1520
- aConstraints.gridx += 1;
1521
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1522
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1523
- aConstraints.gridx = 0;
1524
- aConstraints.gridy += 1;
1525
- aConstraints.gridwidth = 1;
1488
+ cGridBag anisoV = new cGridBag();
1489
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1490
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1492
+ colorSection.add(anisoV);
15261493
1527
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1528
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1529
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1530
- aConstraints.gridx += 1;
1531
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1532
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1533
- aConstraints.gridx = 0;
1534
- aConstraints.gridy += 1;
1535
- aConstraints.gridwidth = 1;
1494
+ cGridBag shadowbias = new cGridBag();
1495
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1496
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1497
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1498
+ colorSection.add(shadowbias);
15361499
1537
- //aConstraints.weighty = 1;
1538
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1539
- //aConstraints.gridx += 1;
1540
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1541
- aConstraints.weighty = 0;
1542
- aConstraints.gridx = 0;
1543
- aConstraints.gridy += 1;
1544
- aConstraints.gridwidth = 1;
1500
+ panel.add(new JSeparator());
1501
+
1502
+ panel.add(colorSection);
1503
+
1504
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1505
+
1506
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1507
+
1508
+ cGridBag diffuse = new cGridBag();
1509
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1510
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1511
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1512
+ diffuseSection.add(diffuse);
15451513
1546
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1547
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1548
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1549
- aConstraints.gridx += 1;
1550
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1551
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1552
- aConstraints.gridx = 0;
1553
- aConstraints.gridy += 1;
1554
- aConstraints.gridwidth = 1;
1514
+ cGridBag diffuseness = new cGridBag();
1515
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1516
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1517
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1518
+ diffuseSection.add(diffuseness);
15551519
1556
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1557
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1558
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1559
- aConstraints.gridx += 1;
1560
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1561
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1562
- aConstraints.gridx = 0;
1563
- aConstraints.gridy += 1;
1564
- aConstraints.gridwidth = 1;
1520
+ cGridBag selfshadow = new cGridBag();
1521
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1522
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1523
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1524
+ diffuseSection.add(selfshadow);
15651525
1566
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1567
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1568
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1569
- aConstraints.gridx += 1;
1570
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1571
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1572
- aConstraints.gridx = 0;
1573
- aConstraints.gridy += 1;
1574
- aConstraints.gridwidth = 1;
1526
+ cGridBag sheen = new cGridBag();
1527
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1528
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1529
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1530
+ diffuseSection.add(sheen);
15751531
1576
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1577
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1578
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1579
- aConstraints.gridx += 1;
1580
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1581
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1582
- aConstraints.gridx = 0;
1583
- aConstraints.gridy += 1;
1584
- aConstraints.gridwidth = 1;
1532
+ cGridBag subsurface = new cGridBag();
1533
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1534
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1535
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1536
+ diffuseSection.add(subsurface);
15851537
1586
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1587
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1588
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1589
- aConstraints.gridx += 1;
1590
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1591
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1592
- aConstraints.gridx = 0;
1593
- aConstraints.gridy += 1;
1594
- aConstraints.gridwidth = 1;
1538
+ cGridBag shadow = new cGridBag();
1539
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1540
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1541
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1542
+ diffuseSection.add(shadow);
15951543
1596
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1597
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1598
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1599
- aConstraints.gridx += 1;
1600
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1601
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1602
- aConstraints.gridx = 0;
1603
- aConstraints.gridy += 1;
1604
- aConstraints.gridwidth = 1;
1544
+ cGridBag fakedepth = new cGridBag();
1545
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1546
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1547
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1548
+ diffuseSection.add(fakedepth);
16051549
1606
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1607
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1608
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1609
- aConstraints.gridx += 1;
1610
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1611
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1612
- aConstraints.gridx = 0;
1613
- aConstraints.gridy += 1;
1614
- aConstraints.gridwidth = 1;
1550
+ panel.add(new JSeparator());
1551
+
1552
+ panel.add(diffuseSection);
1553
+
1554
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1555
+
1556
+ cGridBag specularSection = new cGridBag().setVertical(true);
16151557
1616
- //aConstraints.weighty = 1;
1617
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1618
- //aConstraints.gridx += 1;
1619
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1620
- aConstraints.weighty = 0;
1621
- aConstraints.gridx = 0;
1622
- aConstraints.gridy += 1;
1623
- aConstraints.gridwidth = 1;
1558
+ cGridBag specular = new cGridBag();
1559
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1560
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1561
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1562
+ specularSection.add(specular);
16241563
1625
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1626
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1627
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1628
- aConstraints.gridx += 1;
1629
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1630
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1631
- aConstraints.gridx = 0;
1632
- aConstraints.gridy += 1;
1633
- aConstraints.gridwidth = 1;
1564
+ cGridBag lightarea = new cGridBag();
1565
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1566
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1567
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1568
+ specularSection.add(lightarea);
16341569
1635
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1636
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1637
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1638
- aConstraints.gridx += 1;
1639
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1640
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1641
- aConstraints.gridx = 0;
1642
- aConstraints.gridy += 1;
1643
- aConstraints.gridwidth = 1;
1570
+ cGridBag shininess = new cGridBag();
1571
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1572
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1573
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1574
+ specularSection.add(shininess);
16441575
1645
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1646
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1647
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1648
- aConstraints.gridx += 1;
1649
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1650
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1651
- aConstraints.gridx = 0;
1652
- aConstraints.gridy += 1;
1653
- aConstraints.gridwidth = 1;
1576
+ cGridBag metalness = new cGridBag();
1577
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1578
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1579
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1580
+ specularSection.add(metalness);
16541581
1655
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1656
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1657
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1658
- aConstraints.gridx += 1;
1659
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1660
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1661
- aConstraints.gridx = 0;
1662
- aConstraints.gridy += 1;
1663
- aConstraints.gridwidth = 1;
1582
+ cGridBag velvet = new cGridBag();
1583
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1584
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1585
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1586
+ specularSection.add(velvet);
16641587
1665
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1666
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1667
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1668
- aConstraints.gridx += 1;
1669
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1670
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1671
- aConstraints.gridx = 0;
1672
- aConstraints.gridy += 1;
1673
- aConstraints.gridwidth = 1;
1674
-
1675
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1676
- Return();
1588
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1589
+ //Return();
16771590 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16781591 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16791592 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1684,130 +1597,93 @@
16841597 // aConstraints.gridy += 1;
16851598 // aConstraints.gridwidth = 1;
16861599
1687
- //aConstraints.weighty = 1;
1688
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1689
- //aConstraints.gridx += 1;
1690
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1691
- aConstraints.weighty = 0;
1692
- aConstraints.gridx = 0;
1693
- aConstraints.gridy += 1;
1694
- aConstraints.gridwidth = 1;
16951600
1696
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1697
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1698
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1699
- aConstraints.gridx += 1;
1700
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1701
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1702
- aConstraints.gridx = 0;
1703
- aConstraints.gridy += 1;
1704
- aConstraints.gridwidth = 1;
1601
+ panel.add(new JSeparator());
1602
+
1603
+ panel.add(specularSection);
1604
+
1605
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1606
+
1607
+ cGridBag globalSection = new cGridBag().setVertical(true);
17051608
1706
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1707
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1708
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1709
- aConstraints.gridx += 1;
1710
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1711
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1712
- aConstraints.gridx = 0;
1713
- aConstraints.gridy += 1;
1714
- aConstraints.gridwidth = 1;
1609
+ cGridBag camera = new cGridBag();
1610
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1611
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1612
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1613
+ globalSection.add(camera);
17151614
1716
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1717
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1718
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1719
- aConstraints.gridx += 1;
1720
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1721
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1722
- aConstraints.gridx = 0;
1723
- aConstraints.gridy += 1;
1724
- aConstraints.gridwidth = 1;
1615
+ cGridBag ambient = new cGridBag();
1616
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1617
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1618
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1619
+ globalSection.add(ambient);
17251620
1726
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1727
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1728
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1729
- aConstraints.gridx += 1;
1730
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1731
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1732
- aConstraints.gridx = 0;
1733
- aConstraints.gridy += 1;
1734
- aConstraints.gridwidth = 1;
1735
- aConstraints.weighty = 0;
1621
+ cGridBag backlit = new cGridBag();
1622
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1623
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1624
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1625
+ globalSection.add(backlit);
17361626
1737
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1738
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1739
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1740
- aConstraints.gridx += 1;
1741
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1742
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1743
- aConstraints.gridx = 0;
1744
- aConstraints.gridy += 1;
1745
- aConstraints.gridwidth = 1;
1627
+ cGridBag opacity = new cGridBag();
1628
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1629
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1630
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1631
+ globalSection.add(opacity);
17461632
1747
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1748
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1749
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1750
- aConstraints.gridx += 1;
1751
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1752
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1753
- aConstraints.gridx = 0;
1754
- aConstraints.gridy += 1;
1755
- aConstraints.gridwidth = 1;
1633
+ panel.add(new JSeparator());
1634
+
1635
+ panel.add(globalSection);
1636
+
1637
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1638
+
1639
+ cGridBag textureSection = new cGridBag().setVertical(true);
17561640
1757
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1758
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1759
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1760
- aConstraints.gridx += 1;
1761
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1762
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1763
- aConstraints.gridx = 0;
1764
- aConstraints.gridy += 1;
1765
- aConstraints.gridwidth = 1;
1641
+ cGridBag bump = new cGridBag();
1642
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1643
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1644
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1645
+ textureSection.add(bump);
17661646
1767
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1768
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1769
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1770
- aConstraints.gridx += 1;
1771
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1772
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1773
- aConstraints.gridx = 0;
1774
- aConstraints.gridy += 1;
1775
- aConstraints.gridwidth = 1;
1647
+ cGridBag noise = new cGridBag();
1648
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1649
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1650
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1651
+ textureSection.add(noise);
17761652
1777
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1778
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1779
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1780
- aConstraints.gridx += 1;
1781
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1782
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1783
- aConstraints.gridx = 0;
1784
- aConstraints.gridy += 1;
1785
- aConstraints.gridwidth = 1;
1653
+ cGridBag power = new cGridBag();
1654
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1655
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1656
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1657
+ textureSection.add(power);
17861658
1787
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1788
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1789
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1790
- aConstraints.gridx += 1;
1791
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1792
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1793
- aConstraints.gridx = 0;
1794
- aConstraints.gridy += 1;
1795
- aConstraints.gridwidth = 1;
1659
+ cGridBag borderfade = new cGridBag();
1660
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1661
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1662
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1663
+ textureSection.add(borderfade);
17961664
1797
- //aConstraints.weighty = 1;
1798
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1799
- //aConstraints.gridx += 1;
1800
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1801
- aConstraints.weighty = 0;
1665
+ cGridBag fog = new cGridBag();
1666
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1667
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1668
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1669
+ textureSection.add(fog);
18021670
1803
- aConstraints.gridx = 0;
1804
- aConstraints.gridy = 0;
1805
- aConstraints.gridwidth = 1;
1671
+ cGridBag opacityPower = new cGridBag();
1672
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1673
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1674
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1675
+ textureSection.add(opacityPower);
1676
+
1677
+ panel.add(new JSeparator());
1678
+
1679
+ panel.add(textureSection);
1680
+
1681
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18061682
18071683 SetMaterial(copy); // .GetMaterial());
18081684
1809
- colorField.addChangeListener(this);
1810
- modulationField.addChangeListener(this);
1685
+ //colorField.addChangeListener(this);
1686
+// modulationField.addChangeListener(this);
18111687 metalnessField.addChangeListener(this);
18121688 diffuseField.addChangeListener(this);
18131689 specularField.addChangeListener(this);
....@@ -1837,12 +1713,15 @@
18371713 opacityPowerField.addChangeListener(this);
18381714 /**/
18391715
1840
- resetSlidersButton.addActionListener(this);
18411716 clearMaterialButton.addActionListener(this);
18421717 createMaterialButton.addActionListener(this);
1843
-
1844
- propagateToggle.addItemListener(this);
1845
- multiplyToggle.addItemListener(this);
1718
+
1719
+ if (Globals.ADVANCED)
1720
+ {
1721
+ resetSlidersButton.addActionListener(this);
1722
+ propagateToggle.addItemListener(this);
1723
+ multiplyToggle.addItemListener(this);
1724
+ }
18461725 }
18471726
18481727 void DropFile(java.io.File[] files, boolean textures)
....@@ -2013,7 +1892,7 @@
20131892
20141893 //? flashIt = false;
20151894 CameraPane pane = (CameraPane) cameraView;
2016
- pane.clickStart(location.x, location.y, 0);
1895
+ pane.clickStart(location.x, location.y, 0, 0);
20171896 pane.clickEnd(location.x, location.y, 0, true);
20181897
20191898 if (group.selection.size() == 1)
....@@ -2062,6 +1941,7 @@
20621941 e2.printStackTrace();
20631942 }
20641943 }
1944
+
20651945 LoadJMEThread loadThread;
20661946
20671947 class LoadJMEThread extends Thread
....@@ -2119,6 +1999,7 @@
21191999 //LoadFile0(filename, converter);
21202000 }
21212001 }
2002
+
21222003 LoadOBJThread loadObjThread;
21232004
21242005 class LoadOBJThread extends Thread
....@@ -2197,19 +2078,19 @@
21972078
21982079 void LoadObjFile(String fullname)
21992080 {
2200
- /*
2081
+ System.out.println("Loading " + fullname);
2082
+ /**/
22012083 //lastFilename = fullname;
22022084 if(loadObjThread == null)
22032085 {
2204
- loadObjThread = new LoadOBJThread();
2205
- loadObjThread.start();
2086
+ loadObjThread = new LoadOBJThread();
2087
+ loadObjThread.start();
22062088 }
22072089
22082090 loadObjThread.add(fullname);
2209
- */
2091
+ /**/
22102092
2211
- System.out.println("Loading " + fullname);
2212
- makeSomething(new FileObject(fullname, true), true);
2093
+ //makeSomething(new FileObject(fullname, true), true);
22132094 }
22142095
22152096 void LoadGFDFile(String fullname)
....@@ -2470,11 +2351,11 @@
24702351
24712352 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24722353 {
2473
- if (GrafreeD.standAlone)
2354
+ if (Grafreed.standAlone)
24742355 {
24752356 /**/
24762357 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2477
- browser.show();
2358
+ browser.setVisible(true);
24782359 String filename = browser.getFile();
24792360 if (filename != null && filename.length() > 0)
24802361 {
....@@ -2619,6 +2500,7 @@
26192500 }
26202501 if (input == null)
26212502 {
2503
+ new Exception().printStackTrace();
26222504 System.exit(0);
26232505 }
26242506
....@@ -2833,7 +2715,8 @@
28332715 return;
28342716 }
28352717
2836
- multiplyToggle.setSelected(mat.multiply);
2718
+ if (multiplyToggle != null)
2719
+ multiplyToggle.setSelected(mat.multiply);
28372720
28382721 assert (object.projectedVertices != null);
28392722
....@@ -3048,9 +2931,9 @@
30482931 frame.validate();
30492932
30502933 return;
3051
- } else if (event.getSource() == toggleRandomItem)
2934
+ } else if (event.getSource() == toggleSwitchItem)
30522935 {
3053
- cameraView.ToggleRandom();
2936
+ cameraView.ToggleSwitch();
30542937 cameraView.repaint();
30552938 return;
30562939 } else if (event.getSource() == toggleHandleItem)
....@@ -3079,6 +2962,10 @@
30792962 {
30802963 copy.live ^= true;
30812964 return;
2965
+ } else if (event.getSource() == selectCB)
2966
+ {
2967
+ copy.dontselect ^= true;
2968
+ return;
30822969 } else if (event.getSource() == hideCB)
30832970 {
30842971 copy.hide ^= true;
....@@ -3093,6 +2980,7 @@
30932980 if (event.getSource() == randomCB)
30942981 {
30952982 copy.random ^= true;
2983
+ objEditor.refreshContents();
30962984 return;
30972985 }
30982986 if (event.getSource() == speedupCB)
....@@ -3116,8 +3004,9 @@
31163004
31173005 public void actionPerformed(ActionEvent event)
31183006 {
3007
+ Object source = event.getSource();
31193008 // SCRIPT DIALOG
3120
- if (event.getSource() == okbutton)
3009
+ if (source == okbutton)
31213010 {
31223011 textpanel.setVisible(false);
31233012 textpanel.remove(textarea);
....@@ -3129,7 +3018,7 @@
31293018 textarea = null;
31303019 textpanel = null;
31313020 }
3132
- if (event.getSource() == cancelbutton)
3021
+ if (source == cancelbutton)
31333022 {
31343023 textpanel.setVisible(false);
31353024 textpanel.remove(textarea);
....@@ -3141,50 +3030,50 @@
31413030 //applySelf();
31423031 //client.refreshEditWindow();
31433032 //refreshContents();
3144
- if (event.getSource() == nameField)
3033
+ if (source == nameField)
31453034 {
31463035 //System.out.println("ObjEditor " + event);
31473036 applySelf0(true);
31483037 //parent.applySelf();
31493038 objEditor.refreshContents();
3150
- } else if (event.getSource() == resetButton)
3039
+ } else if (source == resetButton)
31513040 {
31523041 CameraPane.fullreset = true;
31533042 copy.Reset(); // ResetMeshes();
31543043 copy.Touch();
31553044 objEditor.refreshContents();
3156
- } else if (event.getSource() == stepItem)
3045
+ } else if (source == stepItem)
31573046 {
31583047 //cameraView.ONESTEP = true;
31593048 Globals.ONESTEP = true;
31603049 cameraView.repaint();
31613050 return;
3162
- } else if (event.getSource() == stepButton)
3051
+ } else if (source == stepButton)
31633052 {
31643053 copy.Step();
31653054 copy.Touch();
31663055 objEditor.refreshContents();
3167
- } else if (event.getSource() == slowerButton)
3056
+ } else if (source == slowerButton)
31683057 {
31693058 copy.Slower();
31703059 copy.Touch();
31713060 objEditor.refreshContents();
3172
- } else if (event.getSource() == fasterButton)
3061
+ } else if (source == fasterButton)
31733062 {
31743063 copy.Faster();
31753064 copy.Touch();
31763065 objEditor.refreshContents();
3177
- } else if (event.getSource() == remarkButton)
3066
+ } else if (source == remarkButton)
31783067 {
31793068 copy.Remark();
31803069 copy.Touch();
31813070 objEditor.refreshContents();
3182
- } else if (event.getSource() == stepAllButton)
3071
+ } else if (source == stepAllButton)
31833072 {
31843073 copy.StepAll();
31853074 copy.Touch();
31863075 objEditor.refreshContents();
3187
- } else if (event.getSource() == resetAllButton)
3076
+ } else if (source == resetAllButton)
31883077 {
31893078 //CameraPane.fullreset = true;
31903079 copy.ResetAll(); // ResetMeshes();
....@@ -3217,53 +3106,75 @@
32173106 // Close();
32183107 // }
32193108 // else
3220
- if (event.getSource() == resetSlidersButton)
3109
+ if (source == resetSlidersButton)
32213110 {
32223111 ResetSliders();
3223
- } else if (event.getSource() == clearMaterialButton)
3112
+ } else if (source == clearMaterialButton)
32243113 {
32253114 ClearMaterial();
3226
- } else if (event.getSource() == createMaterialButton)
3115
+ } else if (source == createMaterialButton)
32273116 {
32283117 CreateMaterial();
3229
- } else if (event.getSource() == clearPanelButton)
3118
+ } else if (source == clearPanelButton)
32303119 {
32313120 copy.ClearUI();
32323121 refreshContents(true);
3233
- } /*
3234
- }
3235
-
3236
- public boolean action(Event event, Object arg)
3237
- {
3238
- */ else if (event.getSource() == closeItem)
3122
+ } else if (source == importGFDItem)
3123
+ {
3124
+ ImportGFD();
3125
+ } else
3126
+ if (source == importVRMLX3DItem)
3127
+ {
3128
+ ImportVRMLX3D();
3129
+ } else
3130
+ if (source == import3DSItem)
3131
+ {
3132
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3133
+ } else
3134
+ if (source == importOBJItem)
3135
+ {
3136
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3137
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3138
+ browser.setVisible(true);
3139
+ String filename = browser.getFile();
3140
+ if (filename != null && filename.length() > 0)
3141
+ {
3142
+ String fullname = browser.getDirectory() + filename;
3143
+ makeSomething(ReadOBJ(fullname), true);
3144
+ }
3145
+ } else
3146
+ if (source == closeItem)
32393147 {
32403148 Close();
32413149 //return true;
3242
- } else if (event.getSource() == loadItem)
3150
+ } else if (source == loadItem)
32433151 {
32443152 load();
32453153 //return true;
3246
- } else if (event.getSource() == saveItem)
3154
+ } else if (source == newItem)
3155
+ {
3156
+ New();
3157
+ } else if (source == saveItem)
32473158 {
32483159 save();
32493160 //return true;
3250
- } else if (event.getSource() == saveAsItem)
3161
+ } else if (source == saveAsItem)
32513162 {
32523163 saveAs();
32533164 //return true;
3254
- } else if (event.getSource() == reexportItem)
3165
+ } else if (source == reexportItem)
32553166 {
32563167 reexport();
32573168 //return true;
3258
- } else if (event.getSource() == exportAsItem)
3169
+ } else if (source == exportAsItem)
32593170 {
32603171 export();
32613172 //return true;
3262
- } else if (event.getSource() == povItem)
3173
+ } else if (source == povItem)
32633174 {
32643175 generatePOV();
32653176 //return true;
3266
- } else if (event.getSource() == zBufferItem)
3177
+ } else if (source == zBufferItem)
32673178 {
32683179 try
32693180 {
....@@ -3285,21 +3196,8 @@
32853196 cameraView.repaint();
32863197 //return true;
32873198 }
3288
- */ else if (event.getSource() == editCameraItem)
3289
- {
3290
- cameraView.ProtectCamera();
3291
- cameraView.repaint();
3292
- return;
3293
- } else if (event.getSource() == revertCameraItem)
3294
- {
3295
- cameraView.RevertCamera();
3296
- cameraView.repaint();
3297
- return;
3298
-// } else if (event.getSource() == textureButton)
3299
-// {
3300
-// return; // true;
3301
- } else // combos...
3302
- if (event.getSource() == texresMenu)
3199
+ */ else // combos...
3200
+ if (source == texresMenu)
33033201 {
33043202 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
33053203 copy.texres = texresMenu.getSelectedIndex();
....@@ -3311,12 +3209,268 @@
33113209 }
33123210 }
33133211
3212
+ void New()
3213
+ {
3214
+ while (copy.Size() > 1)
3215
+ {
3216
+ copy.remove(1);
3217
+ }
3218
+
3219
+ ResetModel();
3220
+ objEditor.refreshContents();
3221
+ }
3222
+
3223
+ static public byte[] Compress(Object3D o)
3224
+ {
3225
+ try
3226
+ {
3227
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3228
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3229
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3230
+
3231
+ Object3D parent = o.parent;
3232
+ o.parent = null;
3233
+
3234
+ out.writeObject(o);
3235
+
3236
+ o.parent = parent;
3237
+
3238
+ out.flush();
3239
+
3240
+ zstream.close();
3241
+ out.close();
3242
+
3243
+ return baos.toByteArray();
3244
+ } catch (Exception e)
3245
+ {
3246
+ System.err.println(e);
3247
+ return null;
3248
+ }
3249
+ }
3250
+
3251
+ static public Object Uncompress(byte[] bytes)
3252
+ {
3253
+ System.out.println("#bytes = " + bytes.length);
3254
+ try
3255
+ {
3256
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3257
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3258
+ ObjectInputStream in = new ObjectInputStream(istream);
3259
+ Object obj = in.readObject();
3260
+ in.close();
3261
+
3262
+ return obj;
3263
+ } catch (Exception e)
3264
+ {
3265
+ System.err.println(e);
3266
+ return null;
3267
+ }
3268
+ }
3269
+
3270
+ static public Object clone(Object o)
3271
+ {
3272
+ try
3273
+ {
3274
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3275
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3276
+
3277
+ out.writeObject(o);
3278
+
3279
+ out.flush();
3280
+ out.close();
3281
+
3282
+ byte[] bytes = baos.toByteArray();
3283
+
3284
+ System.out.println("clone = " + bytes.length);
3285
+
3286
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3287
+ ObjectInputStream in = new ObjectInputStream(bais);
3288
+ Object obj = in.readObject();
3289
+ in.close();
3290
+
3291
+ return obj;
3292
+ } catch (Exception e)
3293
+ {
3294
+ System.err.println(e);
3295
+ return null;
3296
+ }
3297
+ }
3298
+
3299
+ cRadio GetCurrentTab()
3300
+ {
3301
+ cRadio ab;
3302
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3303
+ {
3304
+ ab = (cRadio)e.nextElement();
3305
+ if(ab.GetObject() == copy)
3306
+ {
3307
+ return ab;
3308
+ }
3309
+ }
3310
+
3311
+ return null;
3312
+ }
3313
+
3314
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3315
+
3316
+ public void Save()
3317
+ {
3318
+ cRadio tab = GetCurrentTab();
3319
+
3320
+ boolean temp = CameraPane.SWITCH;
3321
+ CameraPane.SWITCH = false;
3322
+
3323
+ copy.ExtractBigData(hashtable);
3324
+
3325
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3326
+ tab.graphs[tab.undoindex++] = Compress(copy);
3327
+
3328
+ copy.RestoreBigData(hashtable);
3329
+
3330
+ CameraPane.SWITCH = temp;
3331
+
3332
+ //assert(hashtable.isEmpty());
3333
+
3334
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3335
+ {
3336
+ tab.graphs[i] = null;
3337
+ }
3338
+
3339
+ // test save
3340
+ if (false)
3341
+ {
3342
+ try
3343
+ {
3344
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3345
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3346
+
3347
+ p.writeObject(copy);
3348
+
3349
+ p.flush();
3350
+
3351
+ ostream.close();
3352
+ } catch (Exception e)
3353
+ {
3354
+ e.printStackTrace();
3355
+ }
3356
+ }
3357
+ }
3358
+
3359
+ void CopyChanged(Object3D obj)
3360
+ {
3361
+ boolean temp = CameraPane.SWITCH;
3362
+ CameraPane.SWITCH = false;
3363
+
3364
+ copy.ExtractBigData(hashtable);
3365
+
3366
+ copy.clear();
3367
+
3368
+ for (int i=0; i<obj.Size(); i++)
3369
+ {
3370
+ copy.add(obj.get(i));
3371
+ }
3372
+
3373
+ copy.RestoreBigData(hashtable);
3374
+
3375
+ CameraPane.SWITCH = temp;
3376
+
3377
+ //assert(hashtable.isEmpty());
3378
+
3379
+ copy.Touch();
3380
+
3381
+ ResetModel();
3382
+ copy.HardTouch(); // recompile?
3383
+
3384
+ cRadio ab;
3385
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3386
+ {
3387
+ ab = (cRadio)e.nextElement();
3388
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3389
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3390
+ if (test != null)
3391
+ {
3392
+ test.editWindow = ab.object.editWindow;
3393
+ ab.object = test;
3394
+ }
3395
+ }
3396
+
3397
+ refreshContents();
3398
+ }
3399
+
3400
+ public void Undo()
3401
+ {
3402
+ cRadio tab = GetCurrentTab();
3403
+
3404
+ if (tab.undoindex == 0)
3405
+ {
3406
+ java.awt.Toolkit.getDefaultToolkit().beep();
3407
+ return;
3408
+ }
3409
+
3410
+ if (tab.graphs[tab.undoindex] == null)
3411
+ {
3412
+ Save();
3413
+ tab.undoindex -= 1;
3414
+ }
3415
+
3416
+ tab.undoindex -= 1;
3417
+
3418
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3419
+ }
3420
+
3421
+ public void Redo()
3422
+ {
3423
+ cRadio tab = GetCurrentTab();
3424
+
3425
+ if (tab.graphs[tab.undoindex + 1] == null)
3426
+ {
3427
+ java.awt.Toolkit.getDefaultToolkit().beep();
3428
+ return;
3429
+ }
3430
+
3431
+ tab.undoindex += 1;
3432
+
3433
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3434
+ }
3435
+
3436
+ void ImportGFD()
3437
+ {
3438
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3439
+ browser.show();
3440
+ String filename = browser.getFile();
3441
+ if (filename != null && filename.length() > 0)
3442
+ {
3443
+ String fullname = browser.getDirectory() + filename;
3444
+
3445
+ //Object3D readobj =
3446
+ objEditor.ReadGFD(fullname, objEditor);
3447
+ //makeSomething(readobj);
3448
+ }
3449
+ }
3450
+
3451
+ void ImportVRMLX3D()
3452
+ {
3453
+ if (Grafreed.standAlone)
3454
+ {
3455
+ /**/
3456
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3457
+ browser.show();
3458
+ String filename = browser.getFile();
3459
+ if (filename != null && filename.length() > 0)
3460
+ {
3461
+ String fullname = browser.getDirectory() + filename;
3462
+ LoadVRMLX3D(fullname);
3463
+ }
3464
+ /**/
3465
+ }
3466
+ }
3467
+
33143468 void ToggleAnimation()
33153469 {
33163470 if (!Globals.ANIMATION)
33173471 {
33183472 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3319
- browser.show();
3473
+ browser.setVisible(true);
33203474 String filename = browser.getFile();
33213475 if (filename != null && filename.length() > 0)
33223476 {
....@@ -3326,8 +3480,8 @@
33263480
33273481 Globals.ANIMATION ^= true;
33283482
3329
- GrafreeD.wav.cursor = 0;
3330
- GrafreeD.wav.loop = 0;
3483
+ Grafreed.wav.cursor = 0;
3484
+ Grafreed.wav.loop = 0;
33313485 }
33323486 } else
33333487 {
....@@ -3377,7 +3531,7 @@
33773531 void CreateMaterial()
33783532 {
33793533 //copy.ClearMaterial(); // PATCH
3380
- copy.CreateMaterialS(multiplyToggle.isSelected());
3534
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33813535 if (copy.selection.size() > 0)
33823536 //SetMaterial(copy);
33833537 {
....@@ -3436,11 +3590,11 @@
34363590 {
34373591 copy.ResetBlockLoop(); // temporary problem
34383592
3439
- boolean random = CameraPane.RANDOM;
3440
- CameraPane.RANDOM = false; // parse everything
3593
+ boolean random = CameraPane.SWITCH;
3594
+ CameraPane.SWITCH = false; // parse everything
34413595 copy.ResetDisplayList();
34423596 copy.HardTouch();
3443
- CameraPane.RANDOM = random;
3597
+ CameraPane.SWITCH = random;
34443598 }
34453599
34463600 // public void applySelf()
....@@ -3510,10 +3664,40 @@
35103664 current.fakedepth = (float) fakedepthField.getFloat();
35113665 current.shadowbias = (float) shadowbiasField.getFloat();
35123666
3513
- if (!NumberSlider.frozen)
3667
+ if (!cNumberSlider.frozen)
35143668 {
35153669 //System.out.println("Propagate = " + propagate);
35163670 copy.UpdateMaterial(anchor, current, propagate);
3671
+
3672
+ if (copy.material != null)
3673
+ {
3674
+ cMaterial mat = copy.material;
3675
+
3676
+ colorField.SetToolTipValue((mat.color));
3677
+ modulationField.SetToolTipValue((mat.modulation));
3678
+ metalnessField.SetToolTipValue((mat.metalness));
3679
+ diffuseField.SetToolTipValue((mat.diffuse));
3680
+ specularField.SetToolTipValue((mat.specular));
3681
+ shininessField.SetToolTipValue((mat.shininess));
3682
+ shiftField.SetToolTipValue((mat.shift));
3683
+ ambientField.SetToolTipValue((mat.ambient));
3684
+ lightareaField.SetToolTipValue((mat.lightarea));
3685
+ diffusenessField.SetToolTipValue((mat.factor));
3686
+ velvetField.SetToolTipValue((mat.velvet));
3687
+ sheenField.SetToolTipValue((mat.sheen));
3688
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3689
+ backlitField.SetToolTipValue((mat.bump));
3690
+ anisoField.SetToolTipValue((mat.aniso));
3691
+ anisoVField.SetToolTipValue((mat.anisoV));
3692
+ cameraField.SetToolTipValue((mat.cameralight));
3693
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3694
+ shadowField.SetToolTipValue((mat.shadow));
3695
+ textureField.SetToolTipValue((mat.texture));
3696
+ opacityField.SetToolTipValue((mat.opacity));
3697
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3698
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3699
+ }
3700
+
35173701 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35183702 {
35193703 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3558,6 +3742,7 @@
35583742 || e.getSource() == apertureField
35593743 || e.getSource() == shadowblurField)
35603744 {
3745
+ new Exception().printStackTrace();
35613746 System.exit(0);
35623747 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35633748 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3628,7 +3813,7 @@
36283813 }
36293814
36303815 if (normalpushField != null)
3631
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3816
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36323817 }
36333818
36343819 void SnapObject()
....@@ -3883,7 +4068,7 @@
38834068
38844069 radioPanel.revalidate();
38854070 radioPanel.repaint();
3886
- ctrlPanel.revalidate(); // ? new
4071
+ ctrlPanel.validate(); // ? new
38874072 ctrlPanel.repaint();
38884073 }
38894074 }
....@@ -3892,6 +4077,7 @@
38924077
38934078 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38944079 {
4080
+ Save();
38954081 //Tween.set(thing, 0).target(1).start(tweenManager);
38964082 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38974083 // if (thing instanceof GenericJointDemo)
....@@ -4095,6 +4281,7 @@
40954281 }
40964282 }
40974283 }
4284
+
40984285 LoadGFDThread loadGFDThread;
40994286
41004287 void ReadGFD(String fullname, iCallBack cb)
....@@ -4114,8 +4301,10 @@
41144301
41154302 try
41164303 {
4304
+ // Try compressed version first.
41174305 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4118
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4306
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4307
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
41194308
41204309 readobj = (Object3D) p.readObject();
41214310 istream.close();
....@@ -4123,7 +4312,20 @@
41234312 readobj.ResetDisplayList();
41244313 } catch (Exception e)
41254314 {
4126
- e.printStackTrace();
4315
+ //e.printStackTrace();
4316
+ try
4317
+ {
4318
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4319
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4320
+
4321
+ readobj = (Object3D) p.readObject();
4322
+ istream.close();
4323
+
4324
+ readobj.ResetDisplayList();
4325
+ } catch (Exception e2)
4326
+ {
4327
+ e2.printStackTrace();
4328
+ }
41274329 }
41284330 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41294331 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4169,6 +4371,12 @@
41694371
41704372 void LoadIt(Object obj)
41714373 {
4374
+ if (obj == null)
4375
+ {
4376
+ // Invalid file
4377
+ return;
4378
+ }
4379
+
41724380 System.out.println("Loaded " + obj);
41734381 //new Exception().printStackTrace();
41744382 Object3D readobj = (Object3D) obj;
....@@ -4178,6 +4386,7 @@
41784386
41794387 if (readobj != null)
41804388 {
4389
+ Save();
41814390 try
41824391 {
41834392 //readobj.deepCopySelf(copy);
....@@ -4240,7 +4449,7 @@
42404449
42414450 void load() // throws ClassNotFoundException
42424451 {
4243
- if (GrafreeD.standAlone)
4452
+ if (Grafreed.standAlone)
42444453 {
42454454 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42464455 browser.show();
....@@ -4327,11 +4536,13 @@
43274536 try
43284537 {
43294538 FileOutputStream ostream = new FileOutputStream(lastname);
4330
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4539
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4540
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43314541
43324542 p.writeObject(copy);
43334543 p.flush();
43344544
4545
+ zstream.close();
43354546 ostream.close();
43364547
43374548 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4341,11 +4552,12 @@
43414552 {
43424553 }
43434554 }
4555
+
43444556 String lastname;
43454557
43464558 void saveAs()
43474559 {
4348
- if (GrafreeD.standAlone)
4560
+ if (Grafreed.standAlone)
43494561 {
43504562 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43514563 browser.setVisible(true);
....@@ -4450,13 +4662,13 @@
44504662 try
44514663 {
44524664 FileOutputStream ostream = new FileOutputStream(filename);
4453
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4454
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4665
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4666
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44554667
44564668 Object3D objectparent = obj.parent;
44574669 obj.parent = null;
44584670
4459
- Object3D object = (Object3D) GrafreeD.clone(obj);
4671
+ Object3D object = (Object3D) Grafreed.clone(obj);
44604672
44614673 obj.parent = objectparent;
44624674
....@@ -4468,8 +4680,8 @@
44684680 p.writeObject(object);
44694681 p.flush();
44704682
4683
+ zstream.close();
44714684 ostream.close();
4472
- // zstream.close();
44734685
44744686 // group.selection.get(0).parent = parent;
44754687 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4490,7 +4702,7 @@
44904702 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44914703 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44924704 copy.generatePOV(buffer);
4493
- if (GrafreeD.standAlone)
4705
+ if (Grafreed.standAlone)
44944706 {
44954707 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44964708 browser.show();
....@@ -4516,7 +4728,8 @@
45164728 Object3D client;
45174729 Object3D copy;
45184730 MenuBar menuBar;
4519
- Menu windowMenu;
4731
+ Menu fileMenu;
4732
+ MenuItem newItem;
45204733 MenuItem loadItem;
45214734 MenuItem saveItem;
45224735 MenuItem saveAsItem;
....@@ -4524,13 +4737,11 @@
45244737 MenuItem reexportItem;
45254738 MenuItem povItem;
45264739 MenuItem closeItem;
4527
- Menu cameraMenu;
4740
+
45284741 CheckboxMenuItem zBufferItem;
45294742 //MenuItem normalLensItem;
4530
- MenuItem editCameraItem;
4531
- MenuItem revertCameraItem;
4532
- CheckboxMenuItem toggleLiveItem;
45334743 MenuItem stepItem;
4744
+ CheckboxMenuItem toggleLiveItem;
45344745 CheckboxMenuItem toggleFullScreenItem;
45354746 CheckboxMenuItem toggleTimelineItem;
45364747 CheckboxMenuItem toggleRenderItem;
....@@ -4539,7 +4750,7 @@
45394750 CheckboxMenuItem toggleFootContactItem;
45404751 CheckboxMenuItem toggleDLItem;
45414752 CheckboxMenuItem toggleTextureItem;
4542
- CheckboxMenuItem toggleRandomItem;
4753
+ CheckboxMenuItem toggleSwitchItem;
45434754 CheckboxMenuItem toggleRootItem;
45444755 CheckboxMenuItem animationItem;
45454756 CheckboxMenuItem toggleHandleItem;
....@@ -4547,20 +4758,20 @@
45474758 JSplitPane mainPanel;
45484759 JScrollPane scrollpane;
45494760 JPanel toolbarPanel;
4550
- JPanel treePanel;
4761
+ cGridBag treePanel;
45514762 JPanel radioPanel;
45524763 ButtonGroup buttonGroup;
4553
- JPanel ctrlPanel;
4554
- JPanel materialPanel;
4764
+ cGridBag ctrlPanel;
4765
+ cGridBag materialPanel;
45554766 JScrollPane infoPanel;
4556
- JPanel optionsPanel;
4767
+ cGridBag optionsPanel;
45574768 JTabbedPane objectPanel;
45584769 cGridBag XYZPanel;
45594770 JSplitPane gridPanel;
45604771 JSplitPane bigPanel;
45614772 cGridBag bigThree;
4562
- JTabbedPane scenePanel;
4563
- JPanel centralPanel;
4773
+ cGridBag scenePanel;
4774
+ cGridBag centralPanel;
45644775 JSplitPane cameraPanel;
45654776 JPanel timelinePanel;
45664777 JMenuBar timelineMenubar;
....@@ -4613,67 +4824,72 @@
46134824 // MATERIAL
46144825 JLabel materialLabel;
46154826 JLabel colorLabel;
4616
- NumberSlider colorField;
4827
+ cNumberSlider colorField;
46174828 JLabel modulationLabel;
4618
- NumberSlider modulationField;
4829
+ cNumberSlider modulationField;
46194830 JLabel metalnessLabel;
4620
- NumberSlider metalnessField;
4831
+ cNumberSlider metalnessField;
46214832 JLabel diffuseLabel;
4622
- NumberSlider diffuseField;
4833
+ cNumberSlider diffuseField;
46234834 JLabel specularLabel;
4624
- NumberSlider specularField;
4835
+ cNumberSlider specularField;
46254836 JLabel shininessLabel;
4626
- NumberSlider shininessField;
4837
+ cNumberSlider shininessField;
46274838 JLabel shiftLabel;
4628
- NumberSlider shiftField;
4839
+ cNumberSlider shiftField;
46294840 JLabel ambientLabel;
4630
- NumberSlider ambientField;
4841
+ cNumberSlider ambientField;
46314842 JLabel lightareaLabel;
4632
- NumberSlider lightareaField;
4843
+ cNumberSlider lightareaField;
46334844 JLabel diffusenessLabel;
4634
- NumberSlider diffusenessField;
4845
+ cNumberSlider diffusenessField;
46354846 JLabel velvetLabel;
4636
- NumberSlider velvetField;
4847
+ cNumberSlider velvetField;
46374848 JLabel sheenLabel;
4638
- NumberSlider sheenField;
4849
+ cNumberSlider sheenField;
46394850 JLabel subsurfaceLabel;
4640
- NumberSlider subsurfaceField;
4851
+ cNumberSlider subsurfaceField;
46414852 //JLabel bumpLabel;
46424853 //NumberSlider bumpField;
46434854 JLabel backlitLabel;
4644
- NumberSlider backlitField;
4855
+ cNumberSlider backlitField;
46454856 JLabel anisoLabel;
4646
- NumberSlider anisoField;
4857
+ cNumberSlider anisoField;
46474858 JLabel anisoVLabel;
4648
- NumberSlider anisoVField;
4859
+ cNumberSlider anisoVField;
46494860 JLabel cameraLabel;
4650
- NumberSlider cameraField;
4861
+ cNumberSlider cameraField;
46514862 JLabel selfshadowLabel;
4652
- NumberSlider selfshadowField;
4863
+ cNumberSlider selfshadowField;
46534864 JLabel shadowLabel;
4654
- NumberSlider shadowField;
4865
+ cNumberSlider shadowField;
46554866 JLabel textureLabel;
4656
- NumberSlider textureField;
4867
+ cNumberSlider textureField;
46574868 JLabel opacityLabel;
4658
- NumberSlider opacityField;
4869
+ cNumberSlider opacityField;
46594870 JLabel fakedepthLabel;
4660
- NumberSlider fakedepthField;
4871
+ cNumberSlider fakedepthField;
46614872 JLabel shadowbiasLabel;
4662
- NumberSlider shadowbiasField;
4873
+ cNumberSlider shadowbiasField;
46634874 JLabel bumpLabel;
4664
- NumberSlider bumpField;
4875
+ cNumberSlider bumpField;
46654876 JLabel noiseLabel;
4666
- NumberSlider noiseField;
4877
+ cNumberSlider noiseField;
46674878 JLabel powerLabel;
4668
- NumberSlider powerField;
4879
+ cNumberSlider powerField;
46694880 JLabel borderfadeLabel;
4670
- NumberSlider borderfadeField;
4881
+ cNumberSlider borderfadeField;
46714882 JLabel fogLabel;
4672
- NumberSlider fogField;
4883
+ cNumberSlider fogField;
46734884 JLabel opacityPowerLabel;
4674
- NumberSlider opacityPowerField;
4885
+ cNumberSlider opacityPowerField;
46754886 JTree jTree;
46764887 //ObjectUI parent;
46774888
4678
- NumberSlider normalpushField;
4889
+ cNumberSlider normalpushField;
4890
+
4891
+ private MenuItem importGFDItem;
4892
+ private MenuItem importVRMLX3DItem;
4893
+ private MenuItem import3DSItem;
4894
+ private MenuItem importOBJItem;
46794895 }