Normand Briere
2019-06-23 8088590686a45e71278f9a52bb9cc37943dc0c37
ObjEditor.java
....@@ -36,6 +36,8 @@
3636 GroupEditor callee;
3737 JFrame frame;
3838
39
+ static ObjEditor theFrame;
40
+
3941 // SCRIPT
4042
4143 transient JFrame textpanel = null;
....@@ -138,34 +140,42 @@
138140 public void closeUI()
139141 {
140142 //new Exception().printStackTrace();
141
- System.out.println("this = " + this);
142
- System.out.println("objEditor = " + objEditor);
143
+// System.out.println("this = " + this);
144
+// System.out.println("objEditor = " + objEditor);
143145 //nameField.removeActionListener(this);
144
- objEditor.ctrlPanel.remove(nameField);
146
+// objEditor.ctrlPanel.remove(nameField);
147
+
148
+ objEditor.ctrlPanel.remove(namePanel);
145149
146150 if (!GroupEditor.allparams)
147151 return;
148152
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);
153
+// objEditor.ctrlPanel.remove(liveCB);
154
+// objEditor.ctrlPanel.remove(hideCB);
155
+// objEditor.ctrlPanel.remove(markCB);
156
+//
157
+// objEditor.ctrlPanel.remove(randomCB);
158
+// objEditor.ctrlPanel.remove(speedupCB);
159
+// objEditor.ctrlPanel.remove(rewindCB);
160
+//
161
+// objEditor.ctrlPanel.remove(resetButton);
162
+// objEditor.ctrlPanel.remove(stepButton);
163
+//// objEditor.ctrlPanel.remove(stepAllButton);
164
+//// objEditor.ctrlPanel.remove(resetAllButton);
165
+// objEditor.ctrlPanel.remove(link2masterCB);
166
+// //objEditor.ctrlPanel.remove(flipVCB);
167
+// //objEditor.ctrlPanel.remove(texresMenu);
168
+// objEditor.ctrlPanel.remove(slowerButton);
169
+// objEditor.ctrlPanel.remove(fasterButton);
170
+// objEditor.ctrlPanel.remove(remarkButton);
167171
168
- Remove(normalpushField);
172
+ objEditor.ctrlPanel.remove(setupPanel);
173
+ objEditor.ctrlPanel.remove(setupPanel2);
174
+ objEditor.ctrlPanel.remove(commandsPanel);
175
+ objEditor.ctrlPanel.remove(pushPanel);
176
+ //objEditor.ctrlPanel.remove(fillPanel);
177
+
178
+ //Remove(normalpushField);
169179 }
170180
171181 public ObjEditor GetEditor()
....@@ -236,6 +246,7 @@
236246 //localCopy.parent = null;
237247
238248 frame = new JFrame();
249
+ frame.setUndecorated(true);
239250 objEditor = this;
240251 this.callee = callee;
241252
....@@ -269,24 +280,40 @@
269280 void SetupMenu()
270281 {
271282 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..."));
283
+ menuBar.add(fileMenu = new Menu("File"));
284
+ fileMenu.add(newItem = new MenuItem("New"));
285
+ fileMenu.add(loadItem = new MenuItem("Open..."));
286
+
287
+ //oe.menuBar.add(menu = new Menu("Include"));
288
+ Menu menu = new Menu("Import");
289
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
290
+ importOBJItem.addActionListener(this);
291
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
292
+ import3DSItem.addActionListener(this);
293
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
294
+ importVRMLX3DItem.addActionListener(this);
295
+ menu.add("-");
296
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
297
+ importGFDItem.addActionListener(this);
298
+ fileMenu.add(menu);
299
+ fileMenu.add("-");
300
+
301
+ fileMenu.add(saveItem = new MenuItem("Save"));
302
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
277303 //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("-");
304
+ fileMenu.add("-");
305
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
306
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
307
+ fileMenu.add("-");
282308 if (client.parent != null)
283309 {
284
- windowMenu.add(closeItem = new MenuItem("Close"));
310
+ fileMenu.add(closeItem = new MenuItem("Close"));
285311 } else
286312 {
287
- windowMenu.add(closeItem = new MenuItem("Exit"));
313
+ fileMenu.add(closeItem = new MenuItem("Exit"));
288314 }
289315
316
+ newItem.addActionListener(this);
290317 loadItem.addActionListener(this);
291318 saveItem.addActionListener(this);
292319 saveAsItem.addActionListener(this);
....@@ -295,79 +322,26 @@
295322 //povItem.addActionListener(this);
296323 closeItem.addActionListener(this);
297324
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
-
353325 objectPanel = new JTabbedPane();
354326 toolbarPanel = new JPanel();
355327 toolbarPanel.setName("Toolbar");
356
- treePanel = new JPanel();
328
+ treePanel = new cGridBag();
357329 treePanel.setName("Tree");
358
- ctrlPanel = new JPanel(); // new GridBagLayout());
330
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
359331 ctrlPanel.setName("Edit");
360
- materialPanel = new JPanel();
332
+ materialPanel = new cGridBag().setVertical(true);
361333 materialPanel.setName("Material");
362334 /*JTextPane*/
363335 infoarea = createTextPane();
336
+ doc = infoarea.getStyledDocument();
337
+
364338 infoarea.setEditable(true);
365339 SetText();
366340 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
367341 // infoarea.setOpaque(false);
368342 // //infoarea.setForeground(textcolor);
369
- infoarea.setLineWrap(true);
370
- infoarea.setWrapStyleWord(true);
343
+// TEXTAREA infoarea.setLineWrap(true);
344
+// TEXTAREA infoarea.setWrapStyleWord(true);
371345 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
372346 infoPanel.setPreferredSize(new Dimension(50, 200));
373347 infoPanel.setName("Info");
....@@ -378,16 +352,16 @@
378352 mainPanel.setName("Main");
379353 mainPanel.setContinuousLayout(true);
380354 mainPanel.setOneTouchExpandable(true);
381
- mainPanel.setDividerLocation(1.0);
382355 mainPanel.setDividerSize(9);
383
- mainPanel.setResizeWeight(0);
356
+ mainPanel.setDividerLocation(0.5); //1.0);
357
+ mainPanel.setResizeWeight(0.5);
384358
385359 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
386360 //mainPanel.setLayout(new GridBagLayout());
387361 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
388
- treePanel.setLayout(new GridBagLayout());
389
- ctrlPanel.setLayout(new GridBagLayout());
390
- materialPanel.setLayout(new GridBagLayout());
362
+// treePanel.setLayout(new GridBagLayout());
363
+ //ctrlPanel.setLayout(new GridBagLayout());
364
+ //materialPanel.setLayout(new GridBagLayout());
391365
392366 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
393367 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -426,7 +400,7 @@
426400 static String newline = "\n";
427401 protected static final String buttonString = "JButton";
428402 StyledDocument doc;
429
- JTextArea infoarea;
403
+ JTextPane infoarea;
430404
431405 void ClearInfo()
432406 {
....@@ -449,10 +423,10 @@
449423 e.printStackTrace();
450424 }
451425
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();
426
+// String selection = infoarea.getText();
427
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
428
+// java.awt.datatransfer.Clipboard clipboard =
429
+// Toolkit.getDefaultToolkit().getSystemClipboard();
456430 //clipboard.setContents(data, data);
457431 }
458432
....@@ -475,13 +449,13 @@
475449 //SendInfo("Name:", "bold");
476450 if (sel.GetTextures() != null || debug)
477451 {
478
- si.SendInfo(sel.toString(), "bold");
452
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
479453 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
480454 if (sel.Size() > 0)
481455 {
482456 si.SendInfo("#children = " + sel.Size(), "regular");
483457 }
484
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
458
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
485459 if (debug)
486460 {
487461 try
....@@ -493,7 +467,10 @@
493467 }
494468
495469 if (full)
496
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
470
+ {
471
+ si.SendInfo(" BBox min: " + minima, "regular");
472
+ si.SendInfo(" BBox max: " + maxima, "regular");
473
+ }
497474
498475 if (sel.bRep != null)
499476 {
....@@ -520,7 +497,7 @@
520497 }
521498 if (sel.support != null)
522499 {
523
- si.SendInfo(" support: " + sel.support, "regular");
500
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
524501 }
525502 if (sel.scriptnode != null)
526503 {
....@@ -591,6 +568,9 @@
591568 {
592569 CameraPane.pointflow = (PointFlow) sel;
593570 }
571
+
572
+ si.SendInfo("_____________________", "regular");
573
+ si.SendInfo("", "regular");
594574 }
595575 }
596576
....@@ -606,68 +586,138 @@
606586 }
607587 }
608588
589
+static GraphicsDevice device = GraphicsEnvironment
590
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
591
+
592
+ Rectangle keeprect;
593
+ cRadio radio;
594
+
595
+cButton keepButton;
596
+ cButton twoButton; // Full 3D
597
+ cButton sixButton;
598
+ cButton threeButton;
599
+ cButton sevenButton;
600
+ cButton fourButton; // full panel
601
+ cButton oneButton; // full XYZ
602
+ //cButton currentLayout;
603
+
604
+ boolean maximized;
605
+
606
+ void Minimize()
607
+ {
608
+ frame.setState(Frame.ICONIFIED);
609
+ }
610
+
611
+ void Maximize()
612
+ {
613
+ if (maximized)
614
+ {
615
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
616
+ }
617
+ else
618
+ {
619
+ keeprect = frame.getBounds();
620
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
621
+ Dimension rect2 = frame.getToolkit().getScreenSize();
622
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
623
+// frame.setState(Frame.MAXIMIZED_BOTH);
624
+ }
625
+
626
+ maximized ^= true;
627
+ }
628
+
609629 void ToggleFullScreen()
610630 {
611631 if (CameraPane.FULLSCREEN)
612632 {
613
- frame.getContentPane().remove(/*"Center",*/bigThree);
614
- framePanel.add(bigThree);
615
- frame.getContentPane().add(/*"Center",*/framePanel);
633
+ device.setFullScreenWindow(null);
634
+ //frame.setVisible(false);
635
+// frame.removeNotify();
636
+// frame.setUndecorated(false);
637
+// frame.addNotify();
638
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
639
+
640
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
641
+// X framePanel.add(bigThree);
642
+// X frame.getContentPane().add(/*"Center",*/framePanel);
643
+ framePanel.setDividerLocation(1);
644
+
645
+ //frame.setVisible(true);
646
+ radio.layout = keepButton;
647
+ //theFrame = null;
648
+ keepButton = null;
649
+ radio.layout.doClick();
650
+
616651 } else
617652 {
618
- frame.getContentPane().remove(/*"Center",*/framePanel);
619
- framePanel.remove(bigThree);
620
- frame.getContentPane().add(/*"Center",*/bigThree);
653
+ keepButton = radio.layout;
654
+ //keeprect = frame.getBounds();
655
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
656
+// frame.getToolkit().getScreenSize().height);
657
+ //frame.setVisible(false);
658
+ device.setFullScreenWindow(frame);
659
+// frame.removeNotify();
660
+// frame.setUndecorated(true);
661
+// frame.addNotify();
662
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
663
+// X framePanel.remove(bigThree);
664
+// X frame.getContentPane().add(/*"Center",*/bigThree);
665
+ framePanel.setDividerLocation(0);
666
+
667
+ radio.layout = twoButton;
668
+ radio.layout.doClick();
669
+ //frame.setVisible(true);
621670 }
671
+
622672 cameraView.ToggleFullScreen();
623673 }
624674
625
- private JTextArea createTextPane()
675
+ private JTextPane createTextPane()
626676 {
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
- };
677
+// TEXTAREA String[] initString =
678
+// {
679
+// "This is an editable JTextPane, ", //regular
680
+// "another ", //italic
681
+// "styled ", //bold
682
+// "text ", //small
683
+// "component, ", //large
684
+// "which supports embedded components..." + newline,//regular
685
+// " " + newline, //button
686
+// "...and embedded icons..." + newline, //regular
687
+// " ", //icon
688
+// newline + "JTextPane is a subclass of JEditorPane that "
689
+// + "uses a StyledEditorKit and StyledDocument, and provides "
690
+// + "cover methods for interacting with those objects."
691
+// };
692
+//
693
+// String[] initStyles =
694
+// {
695
+// "regular", "italic", "bold", "small", "large",
696
+// "regular", "button", "regular", "icon",
697
+// "regular"
698
+// };
699
+//
700
+// JTextPane textPane = new JTextPane();
701
+// textPane.setEditable(true);
702
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
703
+// addStylesToDocument(doc);
704
+//
705
+// try
706
+// {
707
+// for (int j = 0; j < 2; j++)
708
+// {
709
+// for (int i = 0; i < initString.length; i++)
710
+// {
711
+// doc.insertString(doc.getLength(), initString[i],
712
+// doc.getStyle(initStyles[i]));
713
+// }
714
+// }
715
+// } catch (BadLocationException ble)
716
+// {
717
+// System.err.println("Couldn't insert initial text into text pane.");
718
+// }
642719
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;
720
+ return new JTextPane(); // textPane;
671721 }
672722
673723 protected void addStylesToDocument(StyledDocument doc)
....@@ -720,7 +770,7 @@
720770 protected static ImageIcon createImageIcon(String path,
721771 String description)
722772 {
723
- java.net.URL imgURL = GrafreeD.class.getResource(path);
773
+ java.net.URL imgURL = Grafreed.class.getResource(path);
724774 if (imgURL != null)
725775 {
726776 return new ImageIcon(imgURL, description);
....@@ -752,6 +802,7 @@
752802 // NumberSlider vDivsField;
753803 // JCheckBox endcaps;
754804 JCheckBox liveCB;
805
+ JCheckBox selectCB;
755806 JCheckBox hideCB;
756807 JCheckBox link2masterCB;
757808 JCheckBox markCB;
....@@ -767,115 +818,84 @@
767818 JButton slowerButton;
768819 JButton fasterButton;
769820 JButton remarkButton;
821
+
822
+ cGridBag namePanel;
823
+ cGridBag setupPanel;
824
+ cGridBag setupPanel2;
825
+ cGridBag commandsPanel;
826
+ cGridBag pushPanel;
827
+ cGridBag fillPanel;
770828
771
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
829
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
772830 {
773831 JCheckBox cb;
774832
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);
833
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
780834 cb.addItemListener(this);
781
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
782
- oe.aConstraints.gridwidth = 1;
783
- oe.aConstraints.gridx += 1;
784835
785836 return cb;
786837 }
787838
788
- cButton AddButton(ObjEditor oe, String label)
839
+ cButton AddButton(cGridBag panel, String label)
789840 {
790841 cButton cb;
791842
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);
843
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
797844 cb.addActionListener(this);
798
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
799
- oe.aConstraints.gridwidth = 1;
800
- oe.aConstraints.gridx += 1;
801845
802846 return cb;
803847 }
804848
805
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
849
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
806850 {
807851 JComboBox combo;
808852
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;
853
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812854 combo.addActionListener(this);
813855
814856 return combo;
815857 }
816858
817
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
859
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
818860 {
819
- NumberSlider combo;
861
+ cGridBag control = new cGridBag();
862
+
863
+ cNumberSlider combo;
820864
821865 JLabel jlabel = new JLabel(label);
822
-
823
- aConstraints.fill = GridBagConstraints.VERTICAL;
824866 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
-
867
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
868
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
834869 combo.setFloat(current);
835
-
836
- combo.label = jlabel;
837
-
838
- combo.addChangeListener(this);
839
-
840
- return combo;
870
+
871
+ panel.add(control);
872
+
873
+ return control;
841874 }
842875
843
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
876
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
844877 {
845
- NumberSlider combo;
878
+ cGridBag control = new cGridBag();
879
+
880
+ cNumberSlider combo;
846881
847882 JLabel jlabel = new JLabel(label);
848
-
849
- aConstraints.fill = GridBagConstraints.VERTICAL;
850883 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
-
884
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
885
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
860886 combo.setInteger(current);
861887
862
- combo.label = jlabel;
863
-
864
- combo.addChangeListener(this);
865
-
866
- return combo;
888
+ panel.add(control);
889
+
890
+ return control;
867891 }
868892
869
- JTextArea AddText(JPanel ctrlPanel, String name)
893
+ JTextArea AddText(cGridBag ctrlPanel, String name)
870894 {
871895 JTextArea text;
872896
873
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
874
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
875
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
897
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
876898 text.addCaretListener(this);
877
- aConstraints.gridx += 1;
878
- aConstraints.gridwidth = 1;
879899
880900 return text;
881901 }
....@@ -905,9 +925,16 @@
905925 objEditor.ctrlPanel.remove(j);
906926 }
907927
928
+ void Remove(cNumberSlider j)
929
+ {
930
+ j.removeChangeListener(this);
931
+ //objEditor.ctrlPanel.remove(j.label);
932
+ objEditor.ctrlPanel.remove(j);
933
+ }
934
+
908935 /*
909936 */
910
- void Return() // ObjEditor oe)
937
+ void Return0() // ObjEditor oe)
911938 {
912939 aConstraints.gridy += 1;
913940 aConstraints.gridx = 0;
....@@ -962,37 +989,76 @@
962989
963990 void SetupUI2(ObjEditor oe)
964991 {
965
-// oe.aConstraints.weightx = 0;
966
-// oe.aConstraints.weighty = 0;
967
-// oe.aConstraints.gridx = 0;
968
-// oe.aConstraints.gridy = 0;
969
- SetupName(oe);
992
+ //SetupName(oe);
993
+
994
+ namePanel = new cGridBag();
995
+
996
+ nameField = AddText(namePanel, copy.GetName());
997
+ namePanel.add(nameField);
998
+ oe.ctrlPanel.add(namePanel);
999
+
1000
+ oe.ctrlPanel.Return();
9701001
9711002 if (!GroupEditor.allparams)
9721003 return;
9731004
974
- liveCB = AddCheckBox(oe, "Live", copy.live);
975
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
976
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1005
+ setupPanel = new cGridBag().setVertical(false);
1006
+
1007
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1008
+ liveCB.setToolTipText("Animate object");
1009
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1010
+ selectCB.setToolTipText("Make object selectable");
9771011 // 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");
1012
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1013
+ hideCB.setToolTipText("Hide object");
1014
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1015
+ markCB.setToolTipText("Set the animation target transform");
1016
+
1017
+ setupPanel2 = new cGridBag().setVertical(false);
1018
+
1019
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1020
+ rewindCB.setToolTipText("Rewind animation");
1021
+
1022
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1023
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1024
+
1025
+ if (Globals.ADVANCED)
1026
+ {
1027
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1028
+ link2masterCB.setToolTipText("Attach to support");
1029
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1030
+ speedupCB.setToolTipText("Option motion capture");
1031
+ }
1032
+
1033
+ oe.ctrlPanel.add(setupPanel);
1034
+ oe.ctrlPanel.Return();
1035
+ oe.ctrlPanel.add(setupPanel2);
1036
+ oe.ctrlPanel.Return();
1037
+
1038
+ commandsPanel = new cGridBag().setVertical(false);
1039
+
1040
+ resetButton = AddButton(commandsPanel, "Reset");
1041
+ resetButton.setToolTipText("Jump to frame zero");
1042
+ stepButton = AddButton(commandsPanel, "Step");
1043
+ stepButton.setToolTipText("Step one frame");
9841044 // resetAllButton = AddButton(oe, "Reset All");
9851045 // stepAllButton = AddButton(oe, "Step All");
986
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9871046 // Return();
988
- slowerButton = AddButton(oe, "Slow");
989
- fasterButton = AddButton(oe, "Fast");
990
- remarkButton = AddButton(oe, "Rem");
1047
+ slowerButton = AddButton(commandsPanel, "Slow");
1048
+ slowerButton.setToolTipText("Decrease animation speed");
1049
+ fasterButton = AddButton(commandsPanel, "Fast");
1050
+ fasterButton.setToolTipText("Increase animation speed");
1051
+ remarkButton = AddButton(commandsPanel, "Remark");
1052
+ remarkButton.setToolTipText("Set the current transform as the target");
9911053
992
- Return();
1054
+ oe.ctrlPanel.add(commandsPanel);
1055
+ oe.ctrlPanel.Return();
9931056
994
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
995
- Return();
1057
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1058
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1059
+ //Return();
1060
+
1061
+ oe.ctrlPanel.Return();
9961062
9971063 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9981064 // ObjEditor.aConstraints.gridx += 1;
....@@ -1087,7 +1153,7 @@
10871153 oe.aConstraints.gridwidth = 1;
10881154 /**/
10891155 nameField = AddText(oe.ctrlPanel, copy.GetName());
1090
- Return();
1156
+ oe.ctrlPanel.Return();
10911157
10921158 //ctrlPanel.add(textureButton = new Button("Texture..."));
10931159 //textureButton.setEnabled(false);
....@@ -1189,9 +1255,13 @@
11891255 //JPanel worldPanel =
11901256 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11911257 //worldPanel.setName("World");
1192
- centralPanel = new JPanel(new BorderLayout());
1193
- timelinePanel = new JPanel(new BorderLayout());
1194
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1258
+ centralPanel = new cGridBag();
1259
+ centralPanel.preferredWidth = 20;
1260
+
1261
+ if (Globals.ADVANCED)
1262
+ {
1263
+ timelinePanel = new JPanel(new BorderLayout());
1264
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11951265
11961266 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11971267 cameraPanel.setContinuousLayout(true);
....@@ -1200,7 +1270,10 @@
12001270 // cameraPanel.setDividerSize(9);
12011271 cameraPanel.setResizeWeight(1.0);
12021272
1273
+ }
1274
+
12031275 centralPanel.add(cameraView);
1276
+ centralPanel.setFocusable(true);
12041277 //frame.setJMenuBar(timelineMenubar);
12051278 //centralPanel.add(timelinePanel);
12061279
....@@ -1222,6 +1295,7 @@
12221295 XYZPanel = new cGridBag().setVertical(true);
12231296 //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12241297
1298
+ XYZPanel.preferredWidth = 5;
12251299 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
12261300 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
12271301 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
....@@ -1262,10 +1336,11 @@
12621336 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12631337 //tmp.setName("Edit");
12641338 objectPanel.add(materialPanel);
1265
- JPanel north = new JPanel(new BorderLayout());
1266
- north.setName("Edit");
1267
- north.add(ctrlPanel, BorderLayout.NORTH);
1268
- objectPanel.add(north);
1339
+// JPanel north = new JPanel(new BorderLayout());
1340
+// north.setName("Edit");
1341
+// north.add(ctrlPanel, BorderLayout.NORTH);
1342
+// objectPanel.add(north);
1343
+ objectPanel.add(ctrlPanel);
12691344 objectPanel.add(infoPanel);
12701345
12711346 /*
....@@ -1286,19 +1361,23 @@
12861361 scrollpane.setWheelScrollingEnabled(true);
12871362 scrollpane.addMouseWheelListener(this); // Default not fast enough
12881363
1289
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1290
- scenePanel.add(scrollpane);
1364
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1365
+ scenePanel.preferredWidth = 6;
1366
+
1367
+ JTabbedPane tabbedPane = new JTabbedPane();
1368
+ tabbedPane.add(scrollpane);
12911369
1292
- scenePanel.add(FSPane = new cFileSystemPane(this));
1370
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12931371
1294
- optionsPanel = new JPanel(new GridBagLayout());
1372
+ optionsPanel = new cGridBag().setVertical(true);
12951373
12961374 optionsPanel.setName("Options");
12971375
1298
- AddOptions(optionsPanel, aConstraints);
1376
+ AddOptions(optionsPanel); //, aConstraints);
12991377
1300
- scenePanel.add(optionsPanel);
1301
-
1378
+ tabbedPane.add(optionsPanel);
1379
+
1380
+ scenePanel.add(tabbedPane);
13021381
13031382 /*
13041383 cTree jTree = new cTree(null);
....@@ -1389,9 +1468,11 @@
13891468
13901469 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13911470
1392
- frame.setSize(1024, 768);
1393
- frame.show();
1471
+ frame.setSize(1280, 860);
1472
+ frame.setVisible(true);
13941473
1474
+ cameraView.requestFocusInWindow();
1475
+
13951476 gridPanel.setDividerLocation(1.0);
13961477
13971478 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1405,7 +1486,7 @@
14051486 });
14061487 }
14071488
1408
- void AddOptions(JPanel panel, GridBagConstraints constraints)
1489
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
14091490 {
14101491 }
14111492
....@@ -1420,260 +1501,173 @@
14201501 ctrlPanel.removeAll();
14211502 }
14221503
1423
- void SetupMaterial(JPanel ctrlPanel)
1504
+ void SetupMaterial(cGridBag panel)
14241505 {
1425
- aConstraints.weighty = 0;
1426
- //aConstraints.weightx = 1;
1427
- /*
1506
+ /*
14281507 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14291508 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1430
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1431
- aConstraints.gridx += 1;
14321509 */
14331510
1434
- aConstraints.gridwidth = 1;
1435
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1436
- aConstraints.gridx += 1;
1437
- aConstraints.weighty = 0;
1438
- aConstraints.gridwidth = 1;
1511
+ cGridBag editBar = new cGridBag().setVertical(false);
1512
+
1513
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1514
+ createMaterialButton.setToolTipText("Create material");
14391515
14401516 /*
14411517 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1442
- aConstraints.gridx += 1;
1443
- aConstraints.weighty = 0;
1444
- aConstraints.gridwidth = 1;
14451518 */
14461519
1447
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1448
- aConstraints.gridx += 1;
1520
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1521
+ clearMaterialButton.setToolTipText("Clear material");
1522
+
1523
+ if (Globals.ADVANCED)
1524
+ {
1525
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1526
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1527
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1528
+ }
14491529
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;
1530
+ editBar.preferredHeight = 15;
1531
+
1532
+ panel.add(editBar);
1533
+
14641534 /**/
14651535 //aConstraints.weighty = 0;
14661536 ////aConstraints.weightx = 1;
14671537 //aConstraints.weighty = 1;
14681538 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14691539 //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;
1540
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14751541
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;
1542
+ cGridBag colorSection = new cGridBag().setVertical(true);
1543
+
1544
+ cGridBag color = new cGridBag();
1545
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1546
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1547
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1548
+ //colorField.preferredWidth = 200;
1549
+ colorSection.add(color);
14861550
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;
1551
+ cGridBag modulation = new cGridBag();
1552
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1553
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1554
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1555
+ colorSection.add(modulation);
14961556
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;
1557
+ cGridBag texture = new cGridBag();
1558
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1559
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1560
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1561
+ colorSection.add(texture);
15061562
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;
1563
+ cGridBag anisoU = new cGridBag();
1564
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1565
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1566
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1567
+ colorSection.add(anisoU);
15161568
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;
1569
+ cGridBag anisoV = new cGridBag();
1570
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1571
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1572
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1573
+ colorSection.add(anisoV);
15261574
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;
1575
+ cGridBag shadowbias = new cGridBag();
1576
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1577
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1578
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1579
+ colorSection.add(shadowbias);
15361580
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;
1581
+ panel.add(new JSeparator());
1582
+
1583
+ panel.add(colorSection);
1584
+
1585
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1586
+
1587
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1588
+
1589
+ cGridBag diffuse = new cGridBag();
1590
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1591
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1592
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1593
+ diffuseSection.add(diffuse);
15451594
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;
1595
+ cGridBag diffuseness = new cGridBag();
1596
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1597
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1598
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1599
+ diffuseSection.add(diffuseness);
15551600
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;
1601
+ cGridBag selfshadow = new cGridBag();
1602
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1603
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1604
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1605
+ diffuseSection.add(selfshadow);
15651606
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;
1607
+ cGridBag sheen = new cGridBag();
1608
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1609
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1610
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1611
+ diffuseSection.add(sheen);
15751612
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;
1613
+ cGridBag subsurface = new cGridBag();
1614
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1615
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1616
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1617
+ diffuseSection.add(subsurface);
15851618
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;
1619
+ cGridBag shadow = new cGridBag();
1620
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1621
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1622
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1623
+ diffuseSection.add(shadow);
15951624
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;
1625
+ cGridBag fakedepth = new cGridBag();
1626
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1627
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1628
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1629
+ diffuseSection.add(fakedepth);
16051630
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;
1631
+ panel.add(new JSeparator());
1632
+
1633
+ panel.add(diffuseSection);
1634
+
1635
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1636
+
1637
+ cGridBag specularSection = new cGridBag().setVertical(true);
16151638
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;
1639
+ cGridBag specular = new cGridBag();
1640
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1641
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1642
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1643
+ specularSection.add(specular);
16241644
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;
1645
+ cGridBag lightarea = new cGridBag();
1646
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1647
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1648
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1649
+ specularSection.add(lightarea);
16341650
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;
1651
+ cGridBag shininess = new cGridBag();
1652
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1653
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1654
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1655
+ specularSection.add(shininess);
16441656
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;
1657
+ cGridBag metalness = new cGridBag();
1658
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1659
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1660
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1661
+ specularSection.add(metalness);
16541662
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;
1663
+ cGridBag velvet = new cGridBag();
1664
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1665
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1666
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1667
+ specularSection.add(velvet);
16641668
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();
1669
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1670
+ //Return();
16771671 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16781672 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16791673 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1684,130 +1678,93 @@
16841678 // aConstraints.gridy += 1;
16851679 // aConstraints.gridwidth = 1;
16861680
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;
16951681
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;
1682
+ panel.add(new JSeparator());
1683
+
1684
+ panel.add(specularSection);
1685
+
1686
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1687
+
1688
+ cGridBag globalSection = new cGridBag().setVertical(true);
17051689
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;
1690
+ cGridBag camera = new cGridBag();
1691
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1692
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1693
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1694
+ globalSection.add(camera);
17151695
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;
1696
+ cGridBag ambient = new cGridBag();
1697
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1698
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1699
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1700
+ globalSection.add(ambient);
17251701
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;
1702
+ cGridBag backlit = new cGridBag();
1703
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1704
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1705
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1706
+ globalSection.add(backlit);
17361707
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;
1708
+ cGridBag opacity = new cGridBag();
1709
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1710
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1711
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1712
+ globalSection.add(opacity);
17461713
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;
1714
+ panel.add(new JSeparator());
1715
+
1716
+ panel.add(globalSection);
1717
+
1718
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1719
+
1720
+ cGridBag textureSection = new cGridBag().setVertical(true);
17561721
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;
1722
+ cGridBag bump = new cGridBag();
1723
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1724
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1725
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1726
+ textureSection.add(bump);
17661727
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;
1728
+ cGridBag noise = new cGridBag();
1729
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1730
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1731
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1732
+ textureSection.add(noise);
17761733
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;
1734
+ cGridBag power = new cGridBag();
1735
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1736
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1737
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1738
+ textureSection.add(power);
17861739
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;
1740
+ cGridBag borderfade = new cGridBag();
1741
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1742
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1743
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1744
+ textureSection.add(borderfade);
17961745
1797
- //aConstraints.weighty = 1;
1798
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1799
- //aConstraints.gridx += 1;
1800
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1801
- aConstraints.weighty = 0;
1746
+ cGridBag fog = new cGridBag();
1747
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1748
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1749
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1750
+ textureSection.add(fog);
18021751
1803
- aConstraints.gridx = 0;
1804
- aConstraints.gridy = 0;
1805
- aConstraints.gridwidth = 1;
1752
+ cGridBag opacityPower = new cGridBag();
1753
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1754
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1755
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1756
+ textureSection.add(opacityPower);
1757
+
1758
+ panel.add(new JSeparator());
1759
+
1760
+ panel.add(textureSection);
1761
+
1762
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18061763
18071764 SetMaterial(copy); // .GetMaterial());
18081765
1809
- colorField.addChangeListener(this);
1810
- modulationField.addChangeListener(this);
1766
+ //colorField.addChangeListener(this);
1767
+// modulationField.addChangeListener(this);
18111768 metalnessField.addChangeListener(this);
18121769 diffuseField.addChangeListener(this);
18131770 specularField.addChangeListener(this);
....@@ -1837,12 +1794,15 @@
18371794 opacityPowerField.addChangeListener(this);
18381795 /**/
18391796
1840
- resetSlidersButton.addActionListener(this);
18411797 clearMaterialButton.addActionListener(this);
18421798 createMaterialButton.addActionListener(this);
1843
-
1844
- propagateToggle.addItemListener(this);
1845
- multiplyToggle.addItemListener(this);
1799
+
1800
+ if (Globals.ADVANCED)
1801
+ {
1802
+ resetSlidersButton.addActionListener(this);
1803
+ propagateToggle.addItemListener(this);
1804
+ multiplyToggle.addItemListener(this);
1805
+ }
18461806 }
18471807
18481808 void DropFile(java.io.File[] files, boolean textures)
....@@ -2013,7 +1973,7 @@
20131973
20141974 //? flashIt = false;
20151975 CameraPane pane = (CameraPane) cameraView;
2016
- pane.clickStart(location.x, location.y, 0);
1976
+ pane.clickStart(location.x, location.y, 0, 0);
20171977 pane.clickEnd(location.x, location.y, 0, true);
20181978
20191979 if (group.selection.size() == 1)
....@@ -2062,6 +2022,7 @@
20622022 e2.printStackTrace();
20632023 }
20642024 }
2025
+
20652026 LoadJMEThread loadThread;
20662027
20672028 class LoadJMEThread extends Thread
....@@ -2119,6 +2080,7 @@
21192080 //LoadFile0(filename, converter);
21202081 }
21212082 }
2083
+
21222084 LoadOBJThread loadObjThread;
21232085
21242086 class LoadOBJThread extends Thread
....@@ -2197,19 +2159,19 @@
21972159
21982160 void LoadObjFile(String fullname)
21992161 {
2200
- /*
2162
+ System.out.println("Loading " + fullname);
2163
+ /**/
22012164 //lastFilename = fullname;
22022165 if(loadObjThread == null)
22032166 {
2204
- loadObjThread = new LoadOBJThread();
2205
- loadObjThread.start();
2167
+ loadObjThread = new LoadOBJThread();
2168
+ loadObjThread.start();
22062169 }
22072170
22082171 loadObjThread.add(fullname);
2209
- */
2172
+ /**/
22102173
2211
- System.out.println("Loading " + fullname);
2212
- makeSomething(new FileObject(fullname, true), true);
2174
+ //makeSomething(new FileObject(fullname, true), true);
22132175 }
22142176
22152177 void LoadGFDFile(String fullname)
....@@ -2470,11 +2432,11 @@
24702432
24712433 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24722434 {
2473
- if (GrafreeD.standAlone)
2435
+ if (Grafreed.standAlone)
24742436 {
24752437 /**/
24762438 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2477
- browser.show();
2439
+ browser.setVisible(true);
24782440 String filename = browser.getFile();
24792441 if (filename != null && filename.length() > 0)
24802442 {
....@@ -2619,6 +2581,7 @@
26192581 }
26202582 if (input == null)
26212583 {
2584
+ new Exception().printStackTrace();
26222585 System.exit(0);
26232586 }
26242587
....@@ -2833,7 +2796,8 @@
28332796 return;
28342797 }
28352798
2836
- multiplyToggle.setSelected(mat.multiply);
2799
+ if (multiplyToggle != null)
2800
+ multiplyToggle.setSelected(mat.multiply);
28372801
28382802 assert (object.projectedVertices != null);
28392803
....@@ -3048,9 +3012,9 @@
30483012 frame.validate();
30493013
30503014 return;
3051
- } else if (event.getSource() == toggleRandomItem)
3015
+ } else if (event.getSource() == toggleSwitchItem)
30523016 {
3053
- cameraView.ToggleRandom();
3017
+ cameraView.ToggleSwitch();
30543018 cameraView.repaint();
30553019 return;
30563020 } else if (event.getSource() == toggleHandleItem)
....@@ -3079,6 +3043,10 @@
30793043 {
30803044 copy.live ^= true;
30813045 return;
3046
+ } else if (event.getSource() == selectCB)
3047
+ {
3048
+ copy.dontselect ^= true;
3049
+ return;
30823050 } else if (event.getSource() == hideCB)
30833051 {
30843052 copy.hide ^= true;
....@@ -3093,6 +3061,7 @@
30933061 if (event.getSource() == randomCB)
30943062 {
30953063 copy.random ^= true;
3064
+ objEditor.refreshContents();
30963065 return;
30973066 }
30983067 if (event.getSource() == speedupCB)
....@@ -3116,8 +3085,9 @@
31163085
31173086 public void actionPerformed(ActionEvent event)
31183087 {
3088
+ Object source = event.getSource();
31193089 // SCRIPT DIALOG
3120
- if (event.getSource() == okbutton)
3090
+ if (source == okbutton)
31213091 {
31223092 textpanel.setVisible(false);
31233093 textpanel.remove(textarea);
....@@ -3129,7 +3099,7 @@
31293099 textarea = null;
31303100 textpanel = null;
31313101 }
3132
- if (event.getSource() == cancelbutton)
3102
+ if (source == cancelbutton)
31333103 {
31343104 textpanel.setVisible(false);
31353105 textpanel.remove(textarea);
....@@ -3141,50 +3111,50 @@
31413111 //applySelf();
31423112 //client.refreshEditWindow();
31433113 //refreshContents();
3144
- if (event.getSource() == nameField)
3114
+ if (source == nameField)
31453115 {
31463116 //System.out.println("ObjEditor " + event);
31473117 applySelf0(true);
31483118 //parent.applySelf();
31493119 objEditor.refreshContents();
3150
- } else if (event.getSource() == resetButton)
3120
+ } else if (source == resetButton)
31513121 {
31523122 CameraPane.fullreset = true;
31533123 copy.Reset(); // ResetMeshes();
31543124 copy.Touch();
31553125 objEditor.refreshContents();
3156
- } else if (event.getSource() == stepItem)
3126
+ } else if (source == stepItem)
31573127 {
31583128 //cameraView.ONESTEP = true;
31593129 Globals.ONESTEP = true;
31603130 cameraView.repaint();
31613131 return;
3162
- } else if (event.getSource() == stepButton)
3132
+ } else if (source == stepButton)
31633133 {
31643134 copy.Step();
31653135 copy.Touch();
31663136 objEditor.refreshContents();
3167
- } else if (event.getSource() == slowerButton)
3137
+ } else if (source == slowerButton)
31683138 {
31693139 copy.Slower();
31703140 copy.Touch();
31713141 objEditor.refreshContents();
3172
- } else if (event.getSource() == fasterButton)
3142
+ } else if (source == fasterButton)
31733143 {
31743144 copy.Faster();
31753145 copy.Touch();
31763146 objEditor.refreshContents();
3177
- } else if (event.getSource() == remarkButton)
3147
+ } else if (source == remarkButton)
31783148 {
31793149 copy.Remark();
31803150 copy.Touch();
31813151 objEditor.refreshContents();
3182
- } else if (event.getSource() == stepAllButton)
3152
+ } else if (source == stepAllButton)
31833153 {
31843154 copy.StepAll();
31853155 copy.Touch();
31863156 objEditor.refreshContents();
3187
- } else if (event.getSource() == resetAllButton)
3157
+ } else if (source == resetAllButton)
31883158 {
31893159 //CameraPane.fullreset = true;
31903160 copy.ResetAll(); // ResetMeshes();
....@@ -3217,53 +3187,75 @@
32173187 // Close();
32183188 // }
32193189 // else
3220
- if (event.getSource() == resetSlidersButton)
3190
+ if (source == resetSlidersButton)
32213191 {
32223192 ResetSliders();
3223
- } else if (event.getSource() == clearMaterialButton)
3193
+ } else if (source == clearMaterialButton)
32243194 {
32253195 ClearMaterial();
3226
- } else if (event.getSource() == createMaterialButton)
3196
+ } else if (source == createMaterialButton)
32273197 {
32283198 CreateMaterial();
3229
- } else if (event.getSource() == clearPanelButton)
3199
+ } else if (source == clearPanelButton)
32303200 {
32313201 copy.ClearUI();
32323202 refreshContents(true);
3233
- } /*
3234
- }
3235
-
3236
- public boolean action(Event event, Object arg)
3237
- {
3238
- */ else if (event.getSource() == closeItem)
3203
+ } else if (source == importGFDItem)
3204
+ {
3205
+ ImportGFD();
3206
+ } else
3207
+ if (source == importVRMLX3DItem)
3208
+ {
3209
+ ImportVRMLX3D();
3210
+ } else
3211
+ if (source == import3DSItem)
3212
+ {
3213
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3214
+ } else
3215
+ if (source == importOBJItem)
3216
+ {
3217
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3218
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3219
+ browser.setVisible(true);
3220
+ String filename = browser.getFile();
3221
+ if (filename != null && filename.length() > 0)
3222
+ {
3223
+ String fullname = browser.getDirectory() + filename;
3224
+ makeSomething(ReadOBJ(fullname), true);
3225
+ }
3226
+ } else
3227
+ if (source == closeItem)
32393228 {
32403229 Close();
32413230 //return true;
3242
- } else if (event.getSource() == loadItem)
3231
+ } else if (source == loadItem)
32433232 {
32443233 load();
32453234 //return true;
3246
- } else if (event.getSource() == saveItem)
3235
+ } else if (source == newItem)
3236
+ {
3237
+ New();
3238
+ } else if (source == saveItem)
32473239 {
32483240 save();
32493241 //return true;
3250
- } else if (event.getSource() == saveAsItem)
3242
+ } else if (source == saveAsItem)
32513243 {
32523244 saveAs();
32533245 //return true;
3254
- } else if (event.getSource() == reexportItem)
3246
+ } else if (source == reexportItem)
32553247 {
32563248 reexport();
32573249 //return true;
3258
- } else if (event.getSource() == exportAsItem)
3250
+ } else if (source == exportAsItem)
32593251 {
32603252 export();
32613253 //return true;
3262
- } else if (event.getSource() == povItem)
3254
+ } else if (source == povItem)
32633255 {
32643256 generatePOV();
32653257 //return true;
3266
- } else if (event.getSource() == zBufferItem)
3258
+ } else if (source == zBufferItem)
32673259 {
32683260 try
32693261 {
....@@ -3285,21 +3277,8 @@
32853277 cameraView.repaint();
32863278 //return true;
32873279 }
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)
3280
+ */ else // combos...
3281
+ if (source == texresMenu)
33033282 {
33043283 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
33053284 copy.texres = texresMenu.getSelectedIndex();
....@@ -3311,12 +3290,268 @@
33113290 }
33123291 }
33133292
3293
+ void New()
3294
+ {
3295
+ while (copy.Size() > 1)
3296
+ {
3297
+ copy.remove(1);
3298
+ }
3299
+
3300
+ ResetModel();
3301
+ objEditor.refreshContents();
3302
+ }
3303
+
3304
+ static public byte[] Compress(Object3D o)
3305
+ {
3306
+ try
3307
+ {
3308
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3309
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3310
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3311
+
3312
+ Object3D parent = o.parent;
3313
+ o.parent = null;
3314
+
3315
+ out.writeObject(o);
3316
+
3317
+ o.parent = parent;
3318
+
3319
+ out.flush();
3320
+
3321
+ zstream.close();
3322
+ out.close();
3323
+
3324
+ return baos.toByteArray();
3325
+ } catch (Exception e)
3326
+ {
3327
+ System.err.println(e);
3328
+ return null;
3329
+ }
3330
+ }
3331
+
3332
+ static public Object Uncompress(byte[] bytes)
3333
+ {
3334
+ System.out.println("#bytes = " + bytes.length);
3335
+ try
3336
+ {
3337
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3338
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3339
+ ObjectInputStream in = new ObjectInputStream(istream);
3340
+ Object obj = in.readObject();
3341
+ in.close();
3342
+
3343
+ return obj;
3344
+ } catch (Exception e)
3345
+ {
3346
+ System.err.println(e);
3347
+ return null;
3348
+ }
3349
+ }
3350
+
3351
+ static public Object clone(Object o)
3352
+ {
3353
+ try
3354
+ {
3355
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3356
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3357
+
3358
+ out.writeObject(o);
3359
+
3360
+ out.flush();
3361
+ out.close();
3362
+
3363
+ byte[] bytes = baos.toByteArray();
3364
+
3365
+ System.out.println("clone = " + bytes.length);
3366
+
3367
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3368
+ ObjectInputStream in = new ObjectInputStream(bais);
3369
+ Object obj = in.readObject();
3370
+ in.close();
3371
+
3372
+ return obj;
3373
+ } catch (Exception e)
3374
+ {
3375
+ System.err.println(e);
3376
+ return null;
3377
+ }
3378
+ }
3379
+
3380
+ cRadio GetCurrentTab()
3381
+ {
3382
+ cRadio ab;
3383
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3384
+ {
3385
+ ab = (cRadio)e.nextElement();
3386
+ if(ab.GetObject() == copy)
3387
+ {
3388
+ return ab;
3389
+ }
3390
+ }
3391
+
3392
+ return null;
3393
+ }
3394
+
3395
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3396
+
3397
+ public void Save()
3398
+ {
3399
+ cRadio tab = GetCurrentTab();
3400
+
3401
+ boolean temp = CameraPane.SWITCH;
3402
+ CameraPane.SWITCH = false;
3403
+
3404
+ copy.ExtractBigData(hashtable);
3405
+
3406
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3407
+ tab.graphs[tab.undoindex++] = Compress(copy);
3408
+
3409
+ copy.RestoreBigData(hashtable);
3410
+
3411
+ CameraPane.SWITCH = temp;
3412
+
3413
+ //assert(hashtable.isEmpty());
3414
+
3415
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3416
+ {
3417
+ tab.graphs[i] = null;
3418
+ }
3419
+
3420
+ // test save
3421
+ if (false)
3422
+ {
3423
+ try
3424
+ {
3425
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3426
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3427
+
3428
+ p.writeObject(copy);
3429
+
3430
+ p.flush();
3431
+
3432
+ ostream.close();
3433
+ } catch (Exception e)
3434
+ {
3435
+ e.printStackTrace();
3436
+ }
3437
+ }
3438
+ }
3439
+
3440
+ void CopyChanged(Object3D obj)
3441
+ {
3442
+ boolean temp = CameraPane.SWITCH;
3443
+ CameraPane.SWITCH = false;
3444
+
3445
+ copy.ExtractBigData(hashtable);
3446
+
3447
+ copy.clear();
3448
+
3449
+ for (int i=0; i<obj.Size(); i++)
3450
+ {
3451
+ copy.add(obj.get(i));
3452
+ }
3453
+
3454
+ copy.RestoreBigData(hashtable);
3455
+
3456
+ CameraPane.SWITCH = temp;
3457
+
3458
+ //assert(hashtable.isEmpty());
3459
+
3460
+ copy.Touch();
3461
+
3462
+ ResetModel();
3463
+ copy.HardTouch(); // recompile?
3464
+
3465
+ cRadio ab;
3466
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3467
+ {
3468
+ ab = (cRadio)e.nextElement();
3469
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3470
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3471
+ if (test != null)
3472
+ {
3473
+ test.editWindow = ab.object.editWindow;
3474
+ ab.object = test;
3475
+ }
3476
+ }
3477
+
3478
+ refreshContents();
3479
+ }
3480
+
3481
+ public void Undo()
3482
+ {
3483
+ cRadio tab = GetCurrentTab();
3484
+
3485
+ if (tab.undoindex == 0)
3486
+ {
3487
+ java.awt.Toolkit.getDefaultToolkit().beep();
3488
+ return;
3489
+ }
3490
+
3491
+ if (tab.graphs[tab.undoindex] == null)
3492
+ {
3493
+ Save();
3494
+ tab.undoindex -= 1;
3495
+ }
3496
+
3497
+ tab.undoindex -= 1;
3498
+
3499
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3500
+ }
3501
+
3502
+ public void Redo()
3503
+ {
3504
+ cRadio tab = GetCurrentTab();
3505
+
3506
+ if (tab.graphs[tab.undoindex + 1] == null)
3507
+ {
3508
+ java.awt.Toolkit.getDefaultToolkit().beep();
3509
+ return;
3510
+ }
3511
+
3512
+ tab.undoindex += 1;
3513
+
3514
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3515
+ }
3516
+
3517
+ void ImportGFD()
3518
+ {
3519
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3520
+ browser.show();
3521
+ String filename = browser.getFile();
3522
+ if (filename != null && filename.length() > 0)
3523
+ {
3524
+ String fullname = browser.getDirectory() + filename;
3525
+
3526
+ //Object3D readobj =
3527
+ objEditor.ReadGFD(fullname, objEditor);
3528
+ //makeSomething(readobj);
3529
+ }
3530
+ }
3531
+
3532
+ void ImportVRMLX3D()
3533
+ {
3534
+ if (Grafreed.standAlone)
3535
+ {
3536
+ /**/
3537
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3538
+ browser.show();
3539
+ String filename = browser.getFile();
3540
+ if (filename != null && filename.length() > 0)
3541
+ {
3542
+ String fullname = browser.getDirectory() + filename;
3543
+ LoadVRMLX3D(fullname);
3544
+ }
3545
+ /**/
3546
+ }
3547
+ }
3548
+
33143549 void ToggleAnimation()
33153550 {
33163551 if (!Globals.ANIMATION)
33173552 {
33183553 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3319
- browser.show();
3554
+ browser.setVisible(true);
33203555 String filename = browser.getFile();
33213556 if (filename != null && filename.length() > 0)
33223557 {
....@@ -3326,8 +3561,8 @@
33263561
33273562 Globals.ANIMATION ^= true;
33283563
3329
- GrafreeD.wav.cursor = 0;
3330
- GrafreeD.wav.loop = 0;
3564
+ Grafreed.wav.cursor = 0;
3565
+ Grafreed.wav.loop = 0;
33313566 }
33323567 } else
33333568 {
....@@ -3377,7 +3612,7 @@
33773612 void CreateMaterial()
33783613 {
33793614 //copy.ClearMaterial(); // PATCH
3380
- copy.CreateMaterialS(multiplyToggle.isSelected());
3615
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33813616 if (copy.selection.size() > 0)
33823617 //SetMaterial(copy);
33833618 {
....@@ -3436,11 +3671,11 @@
34363671 {
34373672 copy.ResetBlockLoop(); // temporary problem
34383673
3439
- boolean random = CameraPane.RANDOM;
3440
- CameraPane.RANDOM = false; // parse everything
3674
+ boolean random = CameraPane.SWITCH;
3675
+ CameraPane.SWITCH = false; // parse everything
34413676 copy.ResetDisplayList();
34423677 copy.HardTouch();
3443
- CameraPane.RANDOM = random;
3678
+ CameraPane.SWITCH = random;
34443679 }
34453680
34463681 // public void applySelf()
....@@ -3510,10 +3745,40 @@
35103745 current.fakedepth = (float) fakedepthField.getFloat();
35113746 current.shadowbias = (float) shadowbiasField.getFloat();
35123747
3513
- if (!NumberSlider.frozen)
3748
+ if (!cNumberSlider.frozen)
35143749 {
35153750 //System.out.println("Propagate = " + propagate);
35163751 copy.UpdateMaterial(anchor, current, propagate);
3752
+
3753
+ if (copy.material != null)
3754
+ {
3755
+ cMaterial mat = copy.material;
3756
+
3757
+ colorField.SetToolTipValue((mat.color));
3758
+ modulationField.SetToolTipValue((mat.modulation));
3759
+ metalnessField.SetToolTipValue((mat.metalness));
3760
+ diffuseField.SetToolTipValue((mat.diffuse));
3761
+ specularField.SetToolTipValue((mat.specular));
3762
+ shininessField.SetToolTipValue((mat.shininess));
3763
+ shiftField.SetToolTipValue((mat.shift));
3764
+ ambientField.SetToolTipValue((mat.ambient));
3765
+ lightareaField.SetToolTipValue((mat.lightarea));
3766
+ diffusenessField.SetToolTipValue((mat.factor));
3767
+ velvetField.SetToolTipValue((mat.velvet));
3768
+ sheenField.SetToolTipValue((mat.sheen));
3769
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3770
+ backlitField.SetToolTipValue((mat.bump));
3771
+ anisoField.SetToolTipValue((mat.aniso));
3772
+ anisoVField.SetToolTipValue((mat.anisoV));
3773
+ cameraField.SetToolTipValue((mat.cameralight));
3774
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3775
+ shadowField.SetToolTipValue((mat.shadow));
3776
+ textureField.SetToolTipValue((mat.texture));
3777
+ opacityField.SetToolTipValue((mat.opacity));
3778
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3779
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3780
+ }
3781
+
35173782 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35183783 {
35193784 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3558,6 +3823,7 @@
35583823 || e.getSource() == apertureField
35593824 || e.getSource() == shadowblurField)
35603825 {
3826
+ new Exception().printStackTrace();
35613827 System.exit(0);
35623828 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35633829 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3628,7 +3894,7 @@
36283894 }
36293895
36303896 if (normalpushField != null)
3631
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3897
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36323898 }
36333899
36343900 void SnapObject()
....@@ -3883,7 +4149,7 @@
38834149
38844150 radioPanel.revalidate();
38854151 radioPanel.repaint();
3886
- ctrlPanel.revalidate(); // ? new
4152
+ ctrlPanel.validate(); // ? new
38874153 ctrlPanel.repaint();
38884154 }
38894155 }
....@@ -3892,6 +4158,7 @@
38924158
38934159 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38944160 {
4161
+ Save();
38954162 //Tween.set(thing, 0).target(1).start(tweenManager);
38964163 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38974164 // if (thing instanceof GenericJointDemo)
....@@ -4095,6 +4362,7 @@
40954362 }
40964363 }
40974364 }
4365
+
40984366 LoadGFDThread loadGFDThread;
40994367
41004368 void ReadGFD(String fullname, iCallBack cb)
....@@ -4114,8 +4382,10 @@
41144382
41154383 try
41164384 {
4385
+ // Try compressed version first.
41174386 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4118
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4387
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4388
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
41194389
41204390 readobj = (Object3D) p.readObject();
41214391 istream.close();
....@@ -4123,7 +4393,20 @@
41234393 readobj.ResetDisplayList();
41244394 } catch (Exception e)
41254395 {
4126
- e.printStackTrace();
4396
+ //e.printStackTrace();
4397
+ try
4398
+ {
4399
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4400
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4401
+
4402
+ readobj = (Object3D) p.readObject();
4403
+ istream.close();
4404
+
4405
+ readobj.ResetDisplayList();
4406
+ } catch (Exception e2)
4407
+ {
4408
+ e2.printStackTrace();
4409
+ }
41274410 }
41284411 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41294412 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4169,6 +4452,12 @@
41694452
41704453 void LoadIt(Object obj)
41714454 {
4455
+ if (obj == null)
4456
+ {
4457
+ // Invalid file
4458
+ return;
4459
+ }
4460
+
41724461 System.out.println("Loaded " + obj);
41734462 //new Exception().printStackTrace();
41744463 Object3D readobj = (Object3D) obj;
....@@ -4178,6 +4467,7 @@
41784467
41794468 if (readobj != null)
41804469 {
4470
+ Save();
41814471 try
41824472 {
41834473 //readobj.deepCopySelf(copy);
....@@ -4240,7 +4530,7 @@
42404530
42414531 void load() // throws ClassNotFoundException
42424532 {
4243
- if (GrafreeD.standAlone)
4533
+ if (Grafreed.standAlone)
42444534 {
42454535 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42464536 browser.show();
....@@ -4327,11 +4617,13 @@
43274617 try
43284618 {
43294619 FileOutputStream ostream = new FileOutputStream(lastname);
4330
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4620
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4621
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43314622
43324623 p.writeObject(copy);
43334624 p.flush();
43344625
4626
+ zstream.close();
43354627 ostream.close();
43364628
43374629 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4341,11 +4633,12 @@
43414633 {
43424634 }
43434635 }
4636
+
43444637 String lastname;
43454638
43464639 void saveAs()
43474640 {
4348
- if (GrafreeD.standAlone)
4641
+ if (Grafreed.standAlone)
43494642 {
43504643 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43514644 browser.setVisible(true);
....@@ -4450,13 +4743,13 @@
44504743 try
44514744 {
44524745 FileOutputStream ostream = new FileOutputStream(filename);
4453
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4454
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4746
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4747
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44554748
44564749 Object3D objectparent = obj.parent;
44574750 obj.parent = null;
44584751
4459
- Object3D object = (Object3D) GrafreeD.clone(obj);
4752
+ Object3D object = (Object3D) Grafreed.clone(obj);
44604753
44614754 obj.parent = objectparent;
44624755
....@@ -4468,8 +4761,8 @@
44684761 p.writeObject(object);
44694762 p.flush();
44704763
4764
+ zstream.close();
44714765 ostream.close();
4472
- // zstream.close();
44734766
44744767 // group.selection.get(0).parent = parent;
44754768 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4490,7 +4783,7 @@
44904783 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44914784 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44924785 copy.generatePOV(buffer);
4493
- if (GrafreeD.standAlone)
4786
+ if (Grafreed.standAlone)
44944787 {
44954788 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44964789 browser.show();
....@@ -4516,7 +4809,8 @@
45164809 Object3D client;
45174810 Object3D copy;
45184811 MenuBar menuBar;
4519
- Menu windowMenu;
4812
+ Menu fileMenu;
4813
+ MenuItem newItem;
45204814 MenuItem loadItem;
45214815 MenuItem saveItem;
45224816 MenuItem saveAsItem;
....@@ -4524,13 +4818,11 @@
45244818 MenuItem reexportItem;
45254819 MenuItem povItem;
45264820 MenuItem closeItem;
4527
- Menu cameraMenu;
4821
+
45284822 CheckboxMenuItem zBufferItem;
45294823 //MenuItem normalLensItem;
4530
- MenuItem editCameraItem;
4531
- MenuItem revertCameraItem;
4532
- CheckboxMenuItem toggleLiveItem;
45334824 MenuItem stepItem;
4825
+ CheckboxMenuItem toggleLiveItem;
45344826 CheckboxMenuItem toggleFullScreenItem;
45354827 CheckboxMenuItem toggleTimelineItem;
45364828 CheckboxMenuItem toggleRenderItem;
....@@ -4539,7 +4831,7 @@
45394831 CheckboxMenuItem toggleFootContactItem;
45404832 CheckboxMenuItem toggleDLItem;
45414833 CheckboxMenuItem toggleTextureItem;
4542
- CheckboxMenuItem toggleRandomItem;
4834
+ CheckboxMenuItem toggleSwitchItem;
45434835 CheckboxMenuItem toggleRootItem;
45444836 CheckboxMenuItem animationItem;
45454837 CheckboxMenuItem toggleHandleItem;
....@@ -4547,20 +4839,20 @@
45474839 JSplitPane mainPanel;
45484840 JScrollPane scrollpane;
45494841 JPanel toolbarPanel;
4550
- JPanel treePanel;
4842
+ cGridBag treePanel;
45514843 JPanel radioPanel;
45524844 ButtonGroup buttonGroup;
4553
- JPanel ctrlPanel;
4554
- JPanel materialPanel;
4845
+ cGridBag ctrlPanel;
4846
+ cGridBag materialPanel;
45554847 JScrollPane infoPanel;
4556
- JPanel optionsPanel;
4848
+ cGridBag optionsPanel;
45574849 JTabbedPane objectPanel;
45584850 cGridBag XYZPanel;
45594851 JSplitPane gridPanel;
45604852 JSplitPane bigPanel;
45614853 cGridBag bigThree;
4562
- JTabbedPane scenePanel;
4563
- JPanel centralPanel;
4854
+ cGridBag scenePanel;
4855
+ cGridBag centralPanel;
45644856 JSplitPane cameraPanel;
45654857 JPanel timelinePanel;
45664858 JMenuBar timelineMenubar;
....@@ -4613,67 +4905,72 @@
46134905 // MATERIAL
46144906 JLabel materialLabel;
46154907 JLabel colorLabel;
4616
- NumberSlider colorField;
4908
+ cNumberSlider colorField;
46174909 JLabel modulationLabel;
4618
- NumberSlider modulationField;
4910
+ cNumberSlider modulationField;
46194911 JLabel metalnessLabel;
4620
- NumberSlider metalnessField;
4912
+ cNumberSlider metalnessField;
46214913 JLabel diffuseLabel;
4622
- NumberSlider diffuseField;
4914
+ cNumberSlider diffuseField;
46234915 JLabel specularLabel;
4624
- NumberSlider specularField;
4916
+ cNumberSlider specularField;
46254917 JLabel shininessLabel;
4626
- NumberSlider shininessField;
4918
+ cNumberSlider shininessField;
46274919 JLabel shiftLabel;
4628
- NumberSlider shiftField;
4920
+ cNumberSlider shiftField;
46294921 JLabel ambientLabel;
4630
- NumberSlider ambientField;
4922
+ cNumberSlider ambientField;
46314923 JLabel lightareaLabel;
4632
- NumberSlider lightareaField;
4924
+ cNumberSlider lightareaField;
46334925 JLabel diffusenessLabel;
4634
- NumberSlider diffusenessField;
4926
+ cNumberSlider diffusenessField;
46354927 JLabel velvetLabel;
4636
- NumberSlider velvetField;
4928
+ cNumberSlider velvetField;
46374929 JLabel sheenLabel;
4638
- NumberSlider sheenField;
4930
+ cNumberSlider sheenField;
46394931 JLabel subsurfaceLabel;
4640
- NumberSlider subsurfaceField;
4932
+ cNumberSlider subsurfaceField;
46414933 //JLabel bumpLabel;
46424934 //NumberSlider bumpField;
46434935 JLabel backlitLabel;
4644
- NumberSlider backlitField;
4936
+ cNumberSlider backlitField;
46454937 JLabel anisoLabel;
4646
- NumberSlider anisoField;
4938
+ cNumberSlider anisoField;
46474939 JLabel anisoVLabel;
4648
- NumberSlider anisoVField;
4940
+ cNumberSlider anisoVField;
46494941 JLabel cameraLabel;
4650
- NumberSlider cameraField;
4942
+ cNumberSlider cameraField;
46514943 JLabel selfshadowLabel;
4652
- NumberSlider selfshadowField;
4944
+ cNumberSlider selfshadowField;
46534945 JLabel shadowLabel;
4654
- NumberSlider shadowField;
4946
+ cNumberSlider shadowField;
46554947 JLabel textureLabel;
4656
- NumberSlider textureField;
4948
+ cNumberSlider textureField;
46574949 JLabel opacityLabel;
4658
- NumberSlider opacityField;
4950
+ cNumberSlider opacityField;
46594951 JLabel fakedepthLabel;
4660
- NumberSlider fakedepthField;
4952
+ cNumberSlider fakedepthField;
46614953 JLabel shadowbiasLabel;
4662
- NumberSlider shadowbiasField;
4954
+ cNumberSlider shadowbiasField;
46634955 JLabel bumpLabel;
4664
- NumberSlider bumpField;
4956
+ cNumberSlider bumpField;
46654957 JLabel noiseLabel;
4666
- NumberSlider noiseField;
4958
+ cNumberSlider noiseField;
46674959 JLabel powerLabel;
4668
- NumberSlider powerField;
4960
+ cNumberSlider powerField;
46694961 JLabel borderfadeLabel;
4670
- NumberSlider borderfadeField;
4962
+ cNumberSlider borderfadeField;
46714963 JLabel fogLabel;
4672
- NumberSlider fogField;
4964
+ cNumberSlider fogField;
46734965 JLabel opacityPowerLabel;
4674
- NumberSlider opacityPowerField;
4966
+ cNumberSlider opacityPowerField;
46754967 JTree jTree;
46764968 //ObjectUI parent;
46774969
4678
- NumberSlider normalpushField;
4970
+ cNumberSlider normalpushField;
4971
+
4972
+ private MenuItem importGFDItem;
4973
+ private MenuItem importVRMLX3DItem;
4974
+ private MenuItem import3DSItem;
4975
+ private MenuItem importOBJItem;
46794976 }