Normand Briere
2019-06-24 c67da2e5d8655704601d6d06e8bc60aabe212253
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(objectCommandsPanel);
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,35 @@
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());
359
- ctrlPanel.setName("Edit");
360
- materialPanel = new JPanel();
330
+
331
+ editPanel = new cGridBag().setVertical(true);
332
+ editPanel.setName("Edit");
333
+
334
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
335
+
336
+ editCommandsPanel = new cGridBag();
337
+ editPanel.add(editCommandsPanel);
338
+ editPanel.add(ctrlPanel);
339
+
340
+ materialPanel = new cGridBag().setVertical(true);
341
+
361342 materialPanel.setName("Material");
362343 /*JTextPane*/
363344 infoarea = createTextPane();
345
+ doc = infoarea.getStyledDocument();
346
+
364347 infoarea.setEditable(true);
365348 SetText();
366349 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
367350 // infoarea.setOpaque(false);
368351 // //infoarea.setForeground(textcolor);
369
- infoarea.setLineWrap(true);
370
- infoarea.setWrapStyleWord(true);
352
+// TEXTAREA infoarea.setLineWrap(true);
353
+// TEXTAREA infoarea.setWrapStyleWord(true);
371354 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
372355 infoPanel.setPreferredSize(new Dimension(50, 200));
373356 infoPanel.setName("Info");
....@@ -378,16 +361,16 @@
378361 mainPanel.setName("Main");
379362 mainPanel.setContinuousLayout(true);
380363 mainPanel.setOneTouchExpandable(true);
381
- mainPanel.setDividerLocation(1.0);
382364 mainPanel.setDividerSize(9);
383
- mainPanel.setResizeWeight(0);
365
+ mainPanel.setDividerLocation(0.5); //1.0);
366
+ mainPanel.setResizeWeight(0.5);
384367
385368 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
386369 //mainPanel.setLayout(new GridBagLayout());
387370 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
388
- treePanel.setLayout(new GridBagLayout());
389
- ctrlPanel.setLayout(new GridBagLayout());
390
- materialPanel.setLayout(new GridBagLayout());
371
+// treePanel.setLayout(new GridBagLayout());
372
+ //ctrlPanel.setLayout(new GridBagLayout());
373
+ //materialPanel.setLayout(new GridBagLayout());
391374
392375 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
393376 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -426,7 +409,7 @@
426409 static String newline = "\n";
427410 protected static final String buttonString = "JButton";
428411 StyledDocument doc;
429
- JTextArea infoarea;
412
+ JTextPane infoarea;
430413
431414 void ClearInfo()
432415 {
....@@ -449,10 +432,10 @@
449432 e.printStackTrace();
450433 }
451434
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();
435
+// String selection = infoarea.getText();
436
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
437
+// java.awt.datatransfer.Clipboard clipboard =
438
+// Toolkit.getDefaultToolkit().getSystemClipboard();
456439 //clipboard.setContents(data, data);
457440 }
458441
....@@ -475,13 +458,13 @@
475458 //SendInfo("Name:", "bold");
476459 if (sel.GetTextures() != null || debug)
477460 {
478
- si.SendInfo(sel.toString(), "bold");
461
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
479462 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
480463 if (sel.Size() > 0)
481464 {
482465 si.SendInfo("#children = " + sel.Size(), "regular");
483466 }
484
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
467
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
485468 if (debug)
486469 {
487470 try
....@@ -493,7 +476,10 @@
493476 }
494477
495478 if (full)
496
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
479
+ {
480
+ si.SendInfo(" BBox min: " + minima, "regular");
481
+ si.SendInfo(" BBox max: " + maxima, "regular");
482
+ }
497483
498484 if (sel.bRep != null)
499485 {
....@@ -520,7 +506,7 @@
520506 }
521507 if (sel.support != null)
522508 {
523
- si.SendInfo(" support: " + sel.support, "regular");
509
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
524510 }
525511 if (sel.scriptnode != null)
526512 {
....@@ -591,6 +577,9 @@
591577 {
592578 CameraPane.pointflow = (PointFlow) sel;
593579 }
580
+
581
+ si.SendInfo("_____________________", "regular");
582
+ si.SendInfo("", "regular");
594583 }
595584 }
596585
....@@ -606,68 +595,138 @@
606595 }
607596 }
608597
598
+static GraphicsDevice device = GraphicsEnvironment
599
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
600
+
601
+ Rectangle keeprect;
602
+ cRadio radio;
603
+
604
+cButton keepButton;
605
+ cButton twoButton; // Full 3D
606
+ cButton sixButton;
607
+ cButton threeButton;
608
+ cButton sevenButton;
609
+ cButton fourButton; // full panel
610
+ cButton oneButton; // full XYZ
611
+ //cButton currentLayout;
612
+
613
+ boolean maximized;
614
+
615
+ void Minimize()
616
+ {
617
+ frame.setState(Frame.ICONIFIED);
618
+ }
619
+
620
+ void Maximize()
621
+ {
622
+ if (maximized)
623
+ {
624
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
625
+ }
626
+ else
627
+ {
628
+ keeprect = frame.getBounds();
629
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
630
+ Dimension rect2 = frame.getToolkit().getScreenSize();
631
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
632
+// frame.setState(Frame.MAXIMIZED_BOTH);
633
+ }
634
+
635
+ maximized ^= true;
636
+ }
637
+
609638 void ToggleFullScreen()
610639 {
611640 if (CameraPane.FULLSCREEN)
612641 {
613
- frame.getContentPane().remove(/*"Center",*/bigThree);
614
- framePanel.add(bigThree);
615
- frame.getContentPane().add(/*"Center",*/framePanel);
642
+ device.setFullScreenWindow(null);
643
+ //frame.setVisible(false);
644
+// frame.removeNotify();
645
+// frame.setUndecorated(false);
646
+// frame.addNotify();
647
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
648
+
649
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
650
+// X framePanel.add(bigThree);
651
+// X frame.getContentPane().add(/*"Center",*/framePanel);
652
+ framePanel.setDividerLocation(1);
653
+
654
+ //frame.setVisible(true);
655
+ radio.layout = keepButton;
656
+ //theFrame = null;
657
+ keepButton = null;
658
+ radio.layout.doClick();
659
+
616660 } else
617661 {
618
- frame.getContentPane().remove(/*"Center",*/framePanel);
619
- framePanel.remove(bigThree);
620
- frame.getContentPane().add(/*"Center",*/bigThree);
662
+ keepButton = radio.layout;
663
+ //keeprect = frame.getBounds();
664
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
665
+// frame.getToolkit().getScreenSize().height);
666
+ //frame.setVisible(false);
667
+ device.setFullScreenWindow(frame);
668
+// frame.removeNotify();
669
+// frame.setUndecorated(true);
670
+// frame.addNotify();
671
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
672
+// X framePanel.remove(bigThree);
673
+// X frame.getContentPane().add(/*"Center",*/bigThree);
674
+ framePanel.setDividerLocation(0);
675
+
676
+ radio.layout = twoButton;
677
+ radio.layout.doClick();
678
+ //frame.setVisible(true);
621679 }
680
+
622681 cameraView.ToggleFullScreen();
623682 }
624683
625
- private JTextArea createTextPane()
684
+ private JTextPane createTextPane()
626685 {
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
- };
686
+// TEXTAREA String[] initString =
687
+// {
688
+// "This is an editable JTextPane, ", //regular
689
+// "another ", //italic
690
+// "styled ", //bold
691
+// "text ", //small
692
+// "component, ", //large
693
+// "which supports embedded components..." + newline,//regular
694
+// " " + newline, //button
695
+// "...and embedded icons..." + newline, //regular
696
+// " ", //icon
697
+// newline + "JTextPane is a subclass of JEditorPane that "
698
+// + "uses a StyledEditorKit and StyledDocument, and provides "
699
+// + "cover methods for interacting with those objects."
700
+// };
701
+//
702
+// String[] initStyles =
703
+// {
704
+// "regular", "italic", "bold", "small", "large",
705
+// "regular", "button", "regular", "icon",
706
+// "regular"
707
+// };
708
+//
709
+// JTextPane textPane = new JTextPane();
710
+// textPane.setEditable(true);
711
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
712
+// addStylesToDocument(doc);
713
+//
714
+// try
715
+// {
716
+// for (int j = 0; j < 2; j++)
717
+// {
718
+// for (int i = 0; i < initString.length; i++)
719
+// {
720
+// doc.insertString(doc.getLength(), initString[i],
721
+// doc.getStyle(initStyles[i]));
722
+// }
723
+// }
724
+// } catch (BadLocationException ble)
725
+// {
726
+// System.err.println("Couldn't insert initial text into text pane.");
727
+// }
642728
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;
729
+ return new JTextPane(); // textPane;
671730 }
672731
673732 protected void addStylesToDocument(StyledDocument doc)
....@@ -720,7 +779,7 @@
720779 protected static ImageIcon createImageIcon(String path,
721780 String description)
722781 {
723
- java.net.URL imgURL = GrafreeD.class.getResource(path);
782
+ java.net.URL imgURL = Grafreed.class.getResource(path);
724783 if (imgURL != null)
725784 {
726785 return new ImageIcon(imgURL, description);
....@@ -752,6 +811,7 @@
752811 // NumberSlider vDivsField;
753812 // JCheckBox endcaps;
754813 JCheckBox liveCB;
814
+ JCheckBox selectCB;
755815 JCheckBox hideCB;
756816 JCheckBox link2masterCB;
757817 JCheckBox markCB;
....@@ -767,115 +827,87 @@
767827 JButton slowerButton;
768828 JButton fasterButton;
769829 JButton remarkButton;
830
+
831
+ cGridBag editPanel;
832
+ cGridBag editCommandsPanel;
833
+
834
+ cGridBag namePanel;
835
+ cGridBag setupPanel;
836
+ cGridBag setupPanel2;
837
+ cGridBag objectCommandsPanel;
838
+ cGridBag pushPanel;
839
+ cGridBag fillPanel;
770840
771
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
841
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
772842 {
773843 JCheckBox cb;
774844
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);
845
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
780846 cb.addItemListener(this);
781
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
782
- oe.aConstraints.gridwidth = 1;
783
- oe.aConstraints.gridx += 1;
784847
785848 return cb;
786849 }
787850
788
- cButton AddButton(ObjEditor oe, String label)
851
+ cButton AddButton(cGridBag panel, String label)
789852 {
790853 cButton cb;
791854
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);
855
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
797856 cb.addActionListener(this);
798
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
799
- oe.aConstraints.gridwidth = 1;
800
- oe.aConstraints.gridx += 1;
801857
802858 return cb;
803859 }
804860
805
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
861
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
806862 {
807863 JComboBox combo;
808864
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;
865
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812866 combo.addActionListener(this);
813867
814868 return combo;
815869 }
816870
817
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
871
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
818872 {
819
- NumberSlider combo;
873
+ cGridBag control = new cGridBag();
874
+
875
+ cNumberSlider combo;
820876
821877 JLabel jlabel = new JLabel(label);
822
-
823
- aConstraints.fill = GridBagConstraints.VERTICAL;
824878 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
-
879
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
880
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
834881 combo.setFloat(current);
835
-
836
- combo.label = jlabel;
837
-
838
- combo.addChangeListener(this);
839
-
840
- return combo;
882
+
883
+ panel.add(control);
884
+
885
+ return control;
841886 }
842887
843
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
888
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
844889 {
845
- NumberSlider combo;
890
+ cGridBag control = new cGridBag();
891
+
892
+ cNumberSlider combo;
846893
847894 JLabel jlabel = new JLabel(label);
848
-
849
- aConstraints.fill = GridBagConstraints.VERTICAL;
850895 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
-
896
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
897
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
860898 combo.setInteger(current);
861899
862
- combo.label = jlabel;
863
-
864
- combo.addChangeListener(this);
865
-
866
- return combo;
900
+ panel.add(control);
901
+
902
+ return control;
867903 }
868904
869
- JTextArea AddText(JPanel ctrlPanel, String name)
905
+ JTextArea AddText(cGridBag ctrlPanel, String name)
870906 {
871907 JTextArea text;
872908
873
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
874
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
875
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
909
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
876910 text.addCaretListener(this);
877
- aConstraints.gridx += 1;
878
- aConstraints.gridwidth = 1;
879911
880912 return text;
881913 }
....@@ -905,9 +937,16 @@
905937 objEditor.ctrlPanel.remove(j);
906938 }
907939
940
+ void Remove(cNumberSlider j)
941
+ {
942
+ j.removeChangeListener(this);
943
+ //objEditor.ctrlPanel.remove(j.label);
944
+ objEditor.ctrlPanel.remove(j);
945
+ }
946
+
908947 /*
909948 */
910
- void Return() // ObjEditor oe)
949
+ void Return0() // ObjEditor oe)
911950 {
912951 aConstraints.gridy += 1;
913952 aConstraints.gridx = 0;
....@@ -962,37 +1001,76 @@
9621001
9631002 void SetupUI2(ObjEditor oe)
9641003 {
965
-// oe.aConstraints.weightx = 0;
966
-// oe.aConstraints.weighty = 0;
967
-// oe.aConstraints.gridx = 0;
968
-// oe.aConstraints.gridy = 0;
969
- SetupName(oe);
1004
+ //SetupName(oe);
1005
+
1006
+ namePanel = new cGridBag();
1007
+
1008
+ nameField = AddText(namePanel, copy.GetName());
1009
+ namePanel.add(nameField);
1010
+ oe.ctrlPanel.add(namePanel);
1011
+
1012
+ oe.ctrlPanel.Return();
9701013
9711014 if (!GroupEditor.allparams)
9721015 return;
9731016
974
- liveCB = AddCheckBox(oe, "Live", copy.live);
975
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
976
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1017
+ setupPanel = new cGridBag().setVertical(false);
1018
+
1019
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1020
+ liveCB.setToolTipText("Animate object");
1021
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1022
+ selectCB.setToolTipText("Make object selectable");
9771023 // 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");
1024
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1025
+ hideCB.setToolTipText("Hide object");
1026
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1027
+ markCB.setToolTipText("Set the animation target transform");
1028
+
1029
+ setupPanel2 = new cGridBag().setVertical(false);
1030
+
1031
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1032
+ rewindCB.setToolTipText("Rewind animation");
1033
+
1034
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1035
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1036
+
1037
+ if (Globals.ADVANCED)
1038
+ {
1039
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1040
+ link2masterCB.setToolTipText("Attach to support");
1041
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1042
+ speedupCB.setToolTipText("Option motion capture");
1043
+ }
1044
+
1045
+ oe.ctrlPanel.add(setupPanel);
1046
+ oe.ctrlPanel.Return();
1047
+ oe.ctrlPanel.add(setupPanel2);
1048
+ oe.ctrlPanel.Return();
1049
+
1050
+ objectCommandsPanel = new cGridBag().setVertical(false);
1051
+
1052
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1053
+ resetButton.setToolTipText("Jump to frame zero");
1054
+ stepButton = AddButton(objectCommandsPanel, "Step");
1055
+ stepButton.setToolTipText("Step one frame");
9841056 // resetAllButton = AddButton(oe, "Reset All");
9851057 // stepAllButton = AddButton(oe, "Step All");
986
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9871058 // Return();
988
- slowerButton = AddButton(oe, "Slow");
989
- fasterButton = AddButton(oe, "Fast");
990
- remarkButton = AddButton(oe, "Rem");
1059
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1060
+ slowerButton.setToolTipText("Decrease animation speed");
1061
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1062
+ fasterButton.setToolTipText("Increase animation speed");
1063
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1064
+ remarkButton.setToolTipText("Set the current transform as the target");
9911065
992
- Return();
1066
+ oe.ctrlPanel.add(objectCommandsPanel);
1067
+ oe.ctrlPanel.Return();
9931068
994
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
995
- Return();
1069
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1070
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1071
+ //Return();
1072
+
1073
+ oe.ctrlPanel.Return();
9961074
9971075 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9981076 // ObjEditor.aConstraints.gridx += 1;
....@@ -1087,7 +1165,7 @@
10871165 oe.aConstraints.gridwidth = 1;
10881166 /**/
10891167 nameField = AddText(oe.ctrlPanel, copy.GetName());
1090
- Return();
1168
+ oe.ctrlPanel.Return();
10911169
10921170 //ctrlPanel.add(textureButton = new Button("Texture..."));
10931171 //textureButton.setEnabled(false);
....@@ -1189,9 +1267,13 @@
11891267 //JPanel worldPanel =
11901268 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11911269 //worldPanel.setName("World");
1192
- centralPanel = new JPanel(new BorderLayout());
1193
- timelinePanel = new JPanel(new BorderLayout());
1194
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1270
+ centralPanel = new cGridBag();
1271
+ centralPanel.preferredWidth = 20;
1272
+
1273
+ if (Globals.ADVANCED)
1274
+ {
1275
+ timelinePanel = new JPanel(new BorderLayout());
1276
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11951277
11961278 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11971279 cameraPanel.setContinuousLayout(true);
....@@ -1200,7 +1282,10 @@
12001282 // cameraPanel.setDividerSize(9);
12011283 cameraPanel.setResizeWeight(1.0);
12021284
1285
+ }
1286
+
12031287 centralPanel.add(cameraView);
1288
+ centralPanel.setFocusable(true);
12041289 //frame.setJMenuBar(timelineMenubar);
12051290 //centralPanel.add(timelinePanel);
12061291
....@@ -1222,6 +1307,7 @@
12221307 XYZPanel = new cGridBag().setVertical(true);
12231308 //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12241309
1310
+ XYZPanel.preferredWidth = 5;
12251311 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
12261312 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
12271313 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
....@@ -1262,10 +1348,11 @@
12621348 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12631349 //tmp.setName("Edit");
12641350 objectPanel.add(materialPanel);
1265
- JPanel north = new JPanel(new BorderLayout());
1266
- north.setName("Edit");
1267
- north.add(ctrlPanel, BorderLayout.NORTH);
1268
- objectPanel.add(north);
1351
+// JPanel north = new JPanel(new BorderLayout());
1352
+// north.setName("Edit");
1353
+// north.add(ctrlPanel, BorderLayout.NORTH);
1354
+// objectPanel.add(north);
1355
+ objectPanel.add(editPanel);
12691356 objectPanel.add(infoPanel);
12701357
12711358 /*
....@@ -1286,19 +1373,23 @@
12861373 scrollpane.setWheelScrollingEnabled(true);
12871374 scrollpane.addMouseWheelListener(this); // Default not fast enough
12881375
1289
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1290
- scenePanel.add(scrollpane);
1376
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1377
+ scenePanel.preferredWidth = 6;
1378
+
1379
+ JTabbedPane tabbedPane = new JTabbedPane();
1380
+ tabbedPane.add(scrollpane);
12911381
1292
- scenePanel.add(FSPane = new cFileSystemPane(this));
1382
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12931383
1294
- optionsPanel = new JPanel(new GridBagLayout());
1384
+ optionsPanel = new cGridBag().setVertical(true);
12951385
12961386 optionsPanel.setName("Options");
12971387
1298
- AddOptions(optionsPanel, aConstraints);
1388
+ AddOptions(optionsPanel); //, aConstraints);
12991389
1300
- scenePanel.add(optionsPanel);
1301
-
1390
+ tabbedPane.add(optionsPanel);
1391
+
1392
+ scenePanel.add(tabbedPane);
13021393
13031394 /*
13041395 cTree jTree = new cTree(null);
....@@ -1389,9 +1480,11 @@
13891480
13901481 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13911482
1392
- frame.setSize(1024, 768);
1393
- frame.show();
1483
+ frame.setSize(1280, 860);
1484
+ frame.setVisible(true);
13941485
1486
+ cameraView.requestFocusInWindow();
1487
+
13951488 gridPanel.setDividerLocation(1.0);
13961489
13971490 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1405,7 +1498,7 @@
14051498 });
14061499 }
14071500
1408
- void AddOptions(JPanel panel, GridBagConstraints constraints)
1501
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
14091502 {
14101503 }
14111504
....@@ -1420,260 +1513,173 @@
14201513 ctrlPanel.removeAll();
14211514 }
14221515
1423
- void SetupMaterial(JPanel ctrlPanel)
1516
+ void SetupMaterial(cGridBag panel)
14241517 {
1425
- aConstraints.weighty = 0;
1426
- //aConstraints.weightx = 1;
1427
- /*
1518
+ /*
14281519 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14291520 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1430
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1431
- aConstraints.gridx += 1;
14321521 */
14331522
1434
- aConstraints.gridwidth = 1;
1435
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1436
- aConstraints.gridx += 1;
1437
- aConstraints.weighty = 0;
1438
- aConstraints.gridwidth = 1;
1523
+ cGridBag editBar = new cGridBag().setVertical(false);
1524
+
1525
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1526
+ createMaterialButton.setToolTipText("Create material");
14391527
14401528 /*
14411529 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1442
- aConstraints.gridx += 1;
1443
- aConstraints.weighty = 0;
1444
- aConstraints.gridwidth = 1;
14451530 */
14461531
1447
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1448
- aConstraints.gridx += 1;
1532
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1533
+ clearMaterialButton.setToolTipText("Clear material");
1534
+
1535
+ if (Globals.ADVANCED)
1536
+ {
1537
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1538
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1539
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1540
+ }
14491541
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;
1542
+ editBar.preferredHeight = 15;
1543
+
1544
+ panel.add(editBar);
1545
+
14641546 /**/
14651547 //aConstraints.weighty = 0;
14661548 ////aConstraints.weightx = 1;
14671549 //aConstraints.weighty = 1;
14681550 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14691551 //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;
1552
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14751553
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;
1554
+ cGridBag colorSection = new cGridBag().setVertical(true);
1555
+
1556
+ cGridBag color = new cGridBag();
1557
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1558
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1559
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1560
+ //colorField.preferredWidth = 200;
1561
+ colorSection.add(color);
14861562
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;
1563
+ cGridBag modulation = new cGridBag();
1564
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1565
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1566
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1567
+ colorSection.add(modulation);
14961568
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;
1569
+ cGridBag texture = new cGridBag();
1570
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1571
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1572
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1573
+ colorSection.add(texture);
15061574
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;
1575
+ cGridBag anisoU = new cGridBag();
1576
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1577
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1578
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1579
+ colorSection.add(anisoU);
15161580
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;
1581
+ cGridBag anisoV = new cGridBag();
1582
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1583
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1584
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1585
+ colorSection.add(anisoV);
15261586
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;
1587
+ cGridBag shadowbias = new cGridBag();
1588
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1589
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1590
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1591
+ colorSection.add(shadowbias);
15361592
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;
1593
+ panel.add(new JSeparator());
1594
+
1595
+ panel.add(colorSection);
1596
+
1597
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1598
+
1599
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1600
+
1601
+ cGridBag diffuse = new cGridBag();
1602
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1603
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1604
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1605
+ diffuseSection.add(diffuse);
15451606
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;
1607
+ cGridBag diffuseness = new cGridBag();
1608
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1609
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1610
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1611
+ diffuseSection.add(diffuseness);
15551612
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;
1613
+ cGridBag selfshadow = new cGridBag();
1614
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1615
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1616
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1617
+ diffuseSection.add(selfshadow);
15651618
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;
1619
+ cGridBag sheen = new cGridBag();
1620
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1621
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1622
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1623
+ diffuseSection.add(sheen);
15751624
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;
1625
+ cGridBag subsurface = new cGridBag();
1626
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1627
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1628
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1629
+ diffuseSection.add(subsurface);
15851630
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;
1631
+ cGridBag shadow = new cGridBag();
1632
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1633
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1634
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1635
+ diffuseSection.add(shadow);
15951636
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;
1637
+ cGridBag fakedepth = new cGridBag();
1638
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1639
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1640
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1641
+ diffuseSection.add(fakedepth);
16051642
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;
1643
+ panel.add(new JSeparator());
1644
+
1645
+ panel.add(diffuseSection);
1646
+
1647
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1648
+
1649
+ cGridBag specularSection = new cGridBag().setVertical(true);
16151650
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;
1651
+ cGridBag specular = new cGridBag();
1652
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1653
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1654
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1655
+ specularSection.add(specular);
16241656
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;
1657
+ cGridBag lightarea = new cGridBag();
1658
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1659
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1660
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1661
+ specularSection.add(lightarea);
16341662
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;
1663
+ cGridBag shininess = new cGridBag();
1664
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1665
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1666
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1667
+ specularSection.add(shininess);
16441668
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;
1669
+ cGridBag metalness = new cGridBag();
1670
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1671
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1672
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1673
+ specularSection.add(metalness);
16541674
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;
1675
+ cGridBag velvet = new cGridBag();
1676
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1677
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1678
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1679
+ specularSection.add(velvet);
16641680
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();
1681
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1682
+ //Return();
16771683 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16781684 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16791685 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1684,130 +1690,93 @@
16841690 // aConstraints.gridy += 1;
16851691 // aConstraints.gridwidth = 1;
16861692
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;
16951693
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;
1694
+ panel.add(new JSeparator());
1695
+
1696
+ panel.add(specularSection);
1697
+
1698
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1699
+
1700
+ cGridBag globalSection = new cGridBag().setVertical(true);
17051701
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;
1702
+ cGridBag camera = new cGridBag();
1703
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1704
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1705
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1706
+ globalSection.add(camera);
17151707
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;
1708
+ cGridBag ambient = new cGridBag();
1709
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1710
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1711
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1712
+ globalSection.add(ambient);
17251713
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;
1714
+ cGridBag backlit = new cGridBag();
1715
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1716
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1717
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1718
+ globalSection.add(backlit);
17361719
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;
1720
+ cGridBag opacity = new cGridBag();
1721
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1722
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1723
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1724
+ globalSection.add(opacity);
17461725
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;
1726
+ panel.add(new JSeparator());
1727
+
1728
+ panel.add(globalSection);
1729
+
1730
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1731
+
1732
+ cGridBag textureSection = new cGridBag().setVertical(true);
17561733
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;
1734
+ cGridBag bump = new cGridBag();
1735
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1736
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1737
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1738
+ textureSection.add(bump);
17661739
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;
1740
+ cGridBag noise = new cGridBag();
1741
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1742
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1743
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1744
+ textureSection.add(noise);
17761745
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;
1746
+ cGridBag power = new cGridBag();
1747
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1748
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1749
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1750
+ textureSection.add(power);
17861751
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;
1752
+ cGridBag borderfade = new cGridBag();
1753
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1754
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1755
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1756
+ textureSection.add(borderfade);
17961757
1797
- //aConstraints.weighty = 1;
1798
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1799
- //aConstraints.gridx += 1;
1800
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1801
- aConstraints.weighty = 0;
1758
+ cGridBag fog = new cGridBag();
1759
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1760
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1761
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1762
+ textureSection.add(fog);
18021763
1803
- aConstraints.gridx = 0;
1804
- aConstraints.gridy = 0;
1805
- aConstraints.gridwidth = 1;
1764
+ cGridBag opacityPower = new cGridBag();
1765
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1766
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1767
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1768
+ textureSection.add(opacityPower);
1769
+
1770
+ panel.add(new JSeparator());
1771
+
1772
+ panel.add(textureSection);
1773
+
1774
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18061775
18071776 SetMaterial(copy); // .GetMaterial());
18081777
1809
- colorField.addChangeListener(this);
1810
- modulationField.addChangeListener(this);
1778
+ //colorField.addChangeListener(this);
1779
+// modulationField.addChangeListener(this);
18111780 metalnessField.addChangeListener(this);
18121781 diffuseField.addChangeListener(this);
18131782 specularField.addChangeListener(this);
....@@ -1837,12 +1806,15 @@
18371806 opacityPowerField.addChangeListener(this);
18381807 /**/
18391808
1840
- resetSlidersButton.addActionListener(this);
18411809 clearMaterialButton.addActionListener(this);
18421810 createMaterialButton.addActionListener(this);
1843
-
1844
- propagateToggle.addItemListener(this);
1845
- multiplyToggle.addItemListener(this);
1811
+
1812
+ if (Globals.ADVANCED)
1813
+ {
1814
+ resetSlidersButton.addActionListener(this);
1815
+ propagateToggle.addItemListener(this);
1816
+ multiplyToggle.addItemListener(this);
1817
+ }
18461818 }
18471819
18481820 void DropFile(java.io.File[] files, boolean textures)
....@@ -2013,7 +1985,7 @@
20131985
20141986 //? flashIt = false;
20151987 CameraPane pane = (CameraPane) cameraView;
2016
- pane.clickStart(location.x, location.y, 0);
1988
+ pane.clickStart(location.x, location.y, 0, 0);
20171989 pane.clickEnd(location.x, location.y, 0, true);
20181990
20191991 if (group.selection.size() == 1)
....@@ -2062,6 +2034,7 @@
20622034 e2.printStackTrace();
20632035 }
20642036 }
2037
+
20652038 LoadJMEThread loadThread;
20662039
20672040 class LoadJMEThread extends Thread
....@@ -2119,6 +2092,7 @@
21192092 //LoadFile0(filename, converter);
21202093 }
21212094 }
2095
+
21222096 LoadOBJThread loadObjThread;
21232097
21242098 class LoadOBJThread extends Thread
....@@ -2197,19 +2171,19 @@
21972171
21982172 void LoadObjFile(String fullname)
21992173 {
2200
- /*
2174
+ System.out.println("Loading " + fullname);
2175
+ /**/
22012176 //lastFilename = fullname;
22022177 if(loadObjThread == null)
22032178 {
2204
- loadObjThread = new LoadOBJThread();
2205
- loadObjThread.start();
2179
+ loadObjThread = new LoadOBJThread();
2180
+ loadObjThread.start();
22062181 }
22072182
22082183 loadObjThread.add(fullname);
2209
- */
2184
+ /**/
22102185
2211
- System.out.println("Loading " + fullname);
2212
- makeSomething(new FileObject(fullname, true), true);
2186
+ //makeSomething(new FileObject(fullname, true), true);
22132187 }
22142188
22152189 void LoadGFDFile(String fullname)
....@@ -2470,11 +2444,11 @@
24702444
24712445 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24722446 {
2473
- if (GrafreeD.standAlone)
2447
+ if (Grafreed.standAlone)
24742448 {
24752449 /**/
24762450 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2477
- browser.show();
2451
+ browser.setVisible(true);
24782452 String filename = browser.getFile();
24792453 if (filename != null && filename.length() > 0)
24802454 {
....@@ -2619,6 +2593,7 @@
26192593 }
26202594 if (input == null)
26212595 {
2596
+ new Exception().printStackTrace();
26222597 System.exit(0);
26232598 }
26242599
....@@ -2833,7 +2808,8 @@
28332808 return;
28342809 }
28352810
2836
- multiplyToggle.setSelected(mat.multiply);
2811
+ if (multiplyToggle != null)
2812
+ multiplyToggle.setSelected(mat.multiply);
28372813
28382814 assert (object.projectedVertices != null);
28392815
....@@ -3048,9 +3024,9 @@
30483024 frame.validate();
30493025
30503026 return;
3051
- } else if (event.getSource() == toggleRandomItem)
3027
+ } else if (event.getSource() == toggleSwitchItem)
30523028 {
3053
- cameraView.ToggleRandom();
3029
+ cameraView.ToggleSwitch();
30543030 cameraView.repaint();
30553031 return;
30563032 } else if (event.getSource() == toggleHandleItem)
....@@ -3079,6 +3055,10 @@
30793055 {
30803056 copy.live ^= true;
30813057 return;
3058
+ } else if (event.getSource() == selectCB)
3059
+ {
3060
+ copy.dontselect ^= true;
3061
+ return;
30823062 } else if (event.getSource() == hideCB)
30833063 {
30843064 copy.hide ^= true;
....@@ -3093,6 +3073,7 @@
30933073 if (event.getSource() == randomCB)
30943074 {
30953075 copy.random ^= true;
3076
+ objEditor.refreshContents();
30963077 return;
30973078 }
30983079 if (event.getSource() == speedupCB)
....@@ -3116,8 +3097,9 @@
31163097
31173098 public void actionPerformed(ActionEvent event)
31183099 {
3100
+ Object source = event.getSource();
31193101 // SCRIPT DIALOG
3120
- if (event.getSource() == okbutton)
3102
+ if (source == okbutton)
31213103 {
31223104 textpanel.setVisible(false);
31233105 textpanel.remove(textarea);
....@@ -3129,7 +3111,7 @@
31293111 textarea = null;
31303112 textpanel = null;
31313113 }
3132
- if (event.getSource() == cancelbutton)
3114
+ if (source == cancelbutton)
31333115 {
31343116 textpanel.setVisible(false);
31353117 textpanel.remove(textarea);
....@@ -3141,50 +3123,50 @@
31413123 //applySelf();
31423124 //client.refreshEditWindow();
31433125 //refreshContents();
3144
- if (event.getSource() == nameField)
3126
+ if (source == nameField)
31453127 {
31463128 //System.out.println("ObjEditor " + event);
31473129 applySelf0(true);
31483130 //parent.applySelf();
31493131 objEditor.refreshContents();
3150
- } else if (event.getSource() == resetButton)
3132
+ } else if (source == resetButton)
31513133 {
31523134 CameraPane.fullreset = true;
31533135 copy.Reset(); // ResetMeshes();
31543136 copy.Touch();
31553137 objEditor.refreshContents();
3156
- } else if (event.getSource() == stepItem)
3138
+ } else if (source == stepItem)
31573139 {
31583140 //cameraView.ONESTEP = true;
31593141 Globals.ONESTEP = true;
31603142 cameraView.repaint();
31613143 return;
3162
- } else if (event.getSource() == stepButton)
3144
+ } else if (source == stepButton)
31633145 {
31643146 copy.Step();
31653147 copy.Touch();
31663148 objEditor.refreshContents();
3167
- } else if (event.getSource() == slowerButton)
3149
+ } else if (source == slowerButton)
31683150 {
31693151 copy.Slower();
31703152 copy.Touch();
31713153 objEditor.refreshContents();
3172
- } else if (event.getSource() == fasterButton)
3154
+ } else if (source == fasterButton)
31733155 {
31743156 copy.Faster();
31753157 copy.Touch();
31763158 objEditor.refreshContents();
3177
- } else if (event.getSource() == remarkButton)
3159
+ } else if (source == remarkButton)
31783160 {
31793161 copy.Remark();
31803162 copy.Touch();
31813163 objEditor.refreshContents();
3182
- } else if (event.getSource() == stepAllButton)
3164
+ } else if (source == stepAllButton)
31833165 {
31843166 copy.StepAll();
31853167 copy.Touch();
31863168 objEditor.refreshContents();
3187
- } else if (event.getSource() == resetAllButton)
3169
+ } else if (source == resetAllButton)
31883170 {
31893171 //CameraPane.fullreset = true;
31903172 copy.ResetAll(); // ResetMeshes();
....@@ -3217,53 +3199,75 @@
32173199 // Close();
32183200 // }
32193201 // else
3220
- if (event.getSource() == resetSlidersButton)
3202
+ if (source == resetSlidersButton)
32213203 {
32223204 ResetSliders();
3223
- } else if (event.getSource() == clearMaterialButton)
3205
+ } else if (source == clearMaterialButton)
32243206 {
32253207 ClearMaterial();
3226
- } else if (event.getSource() == createMaterialButton)
3208
+ } else if (source == createMaterialButton)
32273209 {
32283210 CreateMaterial();
3229
- } else if (event.getSource() == clearPanelButton)
3211
+ } else if (source == clearPanelButton)
32303212 {
32313213 copy.ClearUI();
32323214 refreshContents(true);
3233
- } /*
3234
- }
3235
-
3236
- public boolean action(Event event, Object arg)
3237
- {
3238
- */ else if (event.getSource() == closeItem)
3215
+ } else if (source == importGFDItem)
3216
+ {
3217
+ ImportGFD();
3218
+ } else
3219
+ if (source == importVRMLX3DItem)
3220
+ {
3221
+ ImportVRMLX3D();
3222
+ } else
3223
+ if (source == import3DSItem)
3224
+ {
3225
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3226
+ } else
3227
+ if (source == importOBJItem)
3228
+ {
3229
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3230
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3231
+ browser.setVisible(true);
3232
+ String filename = browser.getFile();
3233
+ if (filename != null && filename.length() > 0)
3234
+ {
3235
+ String fullname = browser.getDirectory() + filename;
3236
+ makeSomething(ReadOBJ(fullname), true);
3237
+ }
3238
+ } else
3239
+ if (source == closeItem)
32393240 {
32403241 Close();
32413242 //return true;
3242
- } else if (event.getSource() == loadItem)
3243
+ } else if (source == loadItem)
32433244 {
32443245 load();
32453246 //return true;
3246
- } else if (event.getSource() == saveItem)
3247
+ } else if (source == newItem)
3248
+ {
3249
+ New();
3250
+ } else if (source == saveItem)
32473251 {
32483252 save();
32493253 //return true;
3250
- } else if (event.getSource() == saveAsItem)
3254
+ } else if (source == saveAsItem)
32513255 {
32523256 saveAs();
32533257 //return true;
3254
- } else if (event.getSource() == reexportItem)
3258
+ } else if (source == reexportItem)
32553259 {
32563260 reexport();
32573261 //return true;
3258
- } else if (event.getSource() == exportAsItem)
3262
+ } else if (source == exportAsItem)
32593263 {
32603264 export();
32613265 //return true;
3262
- } else if (event.getSource() == povItem)
3266
+ } else if (source == povItem)
32633267 {
32643268 generatePOV();
32653269 //return true;
3266
- } else if (event.getSource() == zBufferItem)
3270
+ } else if (source == zBufferItem)
32673271 {
32683272 try
32693273 {
....@@ -3285,21 +3289,8 @@
32853289 cameraView.repaint();
32863290 //return true;
32873291 }
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)
3292
+ */ else // combos...
3293
+ if (source == texresMenu)
33033294 {
33043295 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
33053296 copy.texres = texresMenu.getSelectedIndex();
....@@ -3311,12 +3302,268 @@
33113302 }
33123303 }
33133304
3305
+ void New()
3306
+ {
3307
+ while (copy.Size() > 1)
3308
+ {
3309
+ copy.remove(1);
3310
+ }
3311
+
3312
+ ResetModel();
3313
+ objEditor.refreshContents();
3314
+ }
3315
+
3316
+ static public byte[] Compress(Object3D o)
3317
+ {
3318
+ try
3319
+ {
3320
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3321
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3322
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3323
+
3324
+ Object3D parent = o.parent;
3325
+ o.parent = null;
3326
+
3327
+ out.writeObject(o);
3328
+
3329
+ o.parent = parent;
3330
+
3331
+ out.flush();
3332
+
3333
+ zstream.close();
3334
+ out.close();
3335
+
3336
+ return baos.toByteArray();
3337
+ } catch (Exception e)
3338
+ {
3339
+ System.err.println(e);
3340
+ return null;
3341
+ }
3342
+ }
3343
+
3344
+ static public Object Uncompress(byte[] bytes)
3345
+ {
3346
+ System.out.println("#bytes = " + bytes.length);
3347
+ try
3348
+ {
3349
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3350
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3351
+ ObjectInputStream in = new ObjectInputStream(istream);
3352
+ Object obj = in.readObject();
3353
+ in.close();
3354
+
3355
+ return obj;
3356
+ } catch (Exception e)
3357
+ {
3358
+ System.err.println(e);
3359
+ return null;
3360
+ }
3361
+ }
3362
+
3363
+ static public Object clone(Object o)
3364
+ {
3365
+ try
3366
+ {
3367
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3368
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3369
+
3370
+ out.writeObject(o);
3371
+
3372
+ out.flush();
3373
+ out.close();
3374
+
3375
+ byte[] bytes = baos.toByteArray();
3376
+
3377
+ System.out.println("clone = " + bytes.length);
3378
+
3379
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3380
+ ObjectInputStream in = new ObjectInputStream(bais);
3381
+ Object obj = in.readObject();
3382
+ in.close();
3383
+
3384
+ return obj;
3385
+ } catch (Exception e)
3386
+ {
3387
+ System.err.println(e);
3388
+ return null;
3389
+ }
3390
+ }
3391
+
3392
+ cRadio GetCurrentTab()
3393
+ {
3394
+ cRadio ab;
3395
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3396
+ {
3397
+ ab = (cRadio)e.nextElement();
3398
+ if(ab.GetObject() == copy)
3399
+ {
3400
+ return ab;
3401
+ }
3402
+ }
3403
+
3404
+ return null;
3405
+ }
3406
+
3407
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3408
+
3409
+ public void Save()
3410
+ {
3411
+ cRadio tab = GetCurrentTab();
3412
+
3413
+ boolean temp = CameraPane.SWITCH;
3414
+ CameraPane.SWITCH = false;
3415
+
3416
+ copy.ExtractBigData(hashtable);
3417
+
3418
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3419
+ tab.graphs[tab.undoindex++] = Compress(copy);
3420
+
3421
+ copy.RestoreBigData(hashtable);
3422
+
3423
+ CameraPane.SWITCH = temp;
3424
+
3425
+ //assert(hashtable.isEmpty());
3426
+
3427
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3428
+ {
3429
+ tab.graphs[i] = null;
3430
+ }
3431
+
3432
+ // test save
3433
+ if (false)
3434
+ {
3435
+ try
3436
+ {
3437
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3438
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3439
+
3440
+ p.writeObject(copy);
3441
+
3442
+ p.flush();
3443
+
3444
+ ostream.close();
3445
+ } catch (Exception e)
3446
+ {
3447
+ e.printStackTrace();
3448
+ }
3449
+ }
3450
+ }
3451
+
3452
+ void CopyChanged(Object3D obj)
3453
+ {
3454
+ boolean temp = CameraPane.SWITCH;
3455
+ CameraPane.SWITCH = false;
3456
+
3457
+ copy.ExtractBigData(hashtable);
3458
+
3459
+ copy.clear();
3460
+
3461
+ for (int i=0; i<obj.Size(); i++)
3462
+ {
3463
+ copy.add(obj.get(i));
3464
+ }
3465
+
3466
+ copy.RestoreBigData(hashtable);
3467
+
3468
+ CameraPane.SWITCH = temp;
3469
+
3470
+ //assert(hashtable.isEmpty());
3471
+
3472
+ copy.Touch();
3473
+
3474
+ ResetModel();
3475
+ copy.HardTouch(); // recompile?
3476
+
3477
+ cRadio ab;
3478
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3479
+ {
3480
+ ab = (cRadio)e.nextElement();
3481
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3482
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3483
+ if (test != null)
3484
+ {
3485
+ test.editWindow = ab.object.editWindow;
3486
+ ab.object = test;
3487
+ }
3488
+ }
3489
+
3490
+ refreshContents();
3491
+ }
3492
+
3493
+ public void Undo()
3494
+ {
3495
+ cRadio tab = GetCurrentTab();
3496
+
3497
+ if (tab.undoindex == 0)
3498
+ {
3499
+ java.awt.Toolkit.getDefaultToolkit().beep();
3500
+ return;
3501
+ }
3502
+
3503
+ if (tab.graphs[tab.undoindex] == null)
3504
+ {
3505
+ Save();
3506
+ tab.undoindex -= 1;
3507
+ }
3508
+
3509
+ tab.undoindex -= 1;
3510
+
3511
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3512
+ }
3513
+
3514
+ public void Redo()
3515
+ {
3516
+ cRadio tab = GetCurrentTab();
3517
+
3518
+ if (tab.graphs[tab.undoindex + 1] == null)
3519
+ {
3520
+ java.awt.Toolkit.getDefaultToolkit().beep();
3521
+ return;
3522
+ }
3523
+
3524
+ tab.undoindex += 1;
3525
+
3526
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3527
+ }
3528
+
3529
+ void ImportGFD()
3530
+ {
3531
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3532
+ browser.show();
3533
+ String filename = browser.getFile();
3534
+ if (filename != null && filename.length() > 0)
3535
+ {
3536
+ String fullname = browser.getDirectory() + filename;
3537
+
3538
+ //Object3D readobj =
3539
+ objEditor.ReadGFD(fullname, objEditor);
3540
+ //makeSomething(readobj);
3541
+ }
3542
+ }
3543
+
3544
+ void ImportVRMLX3D()
3545
+ {
3546
+ if (Grafreed.standAlone)
3547
+ {
3548
+ /**/
3549
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3550
+ browser.show();
3551
+ String filename = browser.getFile();
3552
+ if (filename != null && filename.length() > 0)
3553
+ {
3554
+ String fullname = browser.getDirectory() + filename;
3555
+ LoadVRMLX3D(fullname);
3556
+ }
3557
+ /**/
3558
+ }
3559
+ }
3560
+
33143561 void ToggleAnimation()
33153562 {
33163563 if (!Globals.ANIMATION)
33173564 {
33183565 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3319
- browser.show();
3566
+ browser.setVisible(true);
33203567 String filename = browser.getFile();
33213568 if (filename != null && filename.length() > 0)
33223569 {
....@@ -3326,8 +3573,8 @@
33263573
33273574 Globals.ANIMATION ^= true;
33283575
3329
- GrafreeD.wav.cursor = 0;
3330
- GrafreeD.wav.loop = 0;
3576
+ Grafreed.wav.cursor = 0;
3577
+ Grafreed.wav.loop = 0;
33313578 }
33323579 } else
33333580 {
....@@ -3377,7 +3624,7 @@
33773624 void CreateMaterial()
33783625 {
33793626 //copy.ClearMaterial(); // PATCH
3380
- copy.CreateMaterialS(multiplyToggle.isSelected());
3627
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33813628 if (copy.selection.size() > 0)
33823629 //SetMaterial(copy);
33833630 {
....@@ -3436,11 +3683,11 @@
34363683 {
34373684 copy.ResetBlockLoop(); // temporary problem
34383685
3439
- boolean random = CameraPane.RANDOM;
3440
- CameraPane.RANDOM = false; // parse everything
3686
+ boolean random = CameraPane.SWITCH;
3687
+ CameraPane.SWITCH = false; // parse everything
34413688 copy.ResetDisplayList();
34423689 copy.HardTouch();
3443
- CameraPane.RANDOM = random;
3690
+ CameraPane.SWITCH = random;
34443691 }
34453692
34463693 // public void applySelf()
....@@ -3510,10 +3757,40 @@
35103757 current.fakedepth = (float) fakedepthField.getFloat();
35113758 current.shadowbias = (float) shadowbiasField.getFloat();
35123759
3513
- if (!NumberSlider.frozen)
3760
+ if (!cNumberSlider.frozen)
35143761 {
35153762 //System.out.println("Propagate = " + propagate);
35163763 copy.UpdateMaterial(anchor, current, propagate);
3764
+
3765
+ if (copy.material != null)
3766
+ {
3767
+ cMaterial mat = copy.material;
3768
+
3769
+ colorField.SetToolTipValue((mat.color));
3770
+ modulationField.SetToolTipValue((mat.modulation));
3771
+ metalnessField.SetToolTipValue((mat.metalness));
3772
+ diffuseField.SetToolTipValue((mat.diffuse));
3773
+ specularField.SetToolTipValue((mat.specular));
3774
+ shininessField.SetToolTipValue((mat.shininess));
3775
+ shiftField.SetToolTipValue((mat.shift));
3776
+ ambientField.SetToolTipValue((mat.ambient));
3777
+ lightareaField.SetToolTipValue((mat.lightarea));
3778
+ diffusenessField.SetToolTipValue((mat.factor));
3779
+ velvetField.SetToolTipValue((mat.velvet));
3780
+ sheenField.SetToolTipValue((mat.sheen));
3781
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3782
+ backlitField.SetToolTipValue((mat.bump));
3783
+ anisoField.SetToolTipValue((mat.aniso));
3784
+ anisoVField.SetToolTipValue((mat.anisoV));
3785
+ cameraField.SetToolTipValue((mat.cameralight));
3786
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3787
+ shadowField.SetToolTipValue((mat.shadow));
3788
+ textureField.SetToolTipValue((mat.texture));
3789
+ opacityField.SetToolTipValue((mat.opacity));
3790
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3791
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3792
+ }
3793
+
35173794 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35183795 {
35193796 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3558,6 +3835,7 @@
35583835 || e.getSource() == apertureField
35593836 || e.getSource() == shadowblurField)
35603837 {
3838
+ new Exception().printStackTrace();
35613839 System.exit(0);
35623840 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35633841 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3628,7 +3906,7 @@
36283906 }
36293907
36303908 if (normalpushField != null)
3631
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3909
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36323910 }
36333911
36343912 void SnapObject()
....@@ -3883,7 +4161,7 @@
38834161
38844162 radioPanel.revalidate();
38854163 radioPanel.repaint();
3886
- ctrlPanel.revalidate(); // ? new
4164
+ ctrlPanel.validate(); // ? new
38874165 ctrlPanel.repaint();
38884166 }
38894167 }
....@@ -3892,6 +4170,7 @@
38924170
38934171 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38944172 {
4173
+ Save();
38954174 //Tween.set(thing, 0).target(1).start(tweenManager);
38964175 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38974176 // if (thing instanceof GenericJointDemo)
....@@ -4095,6 +4374,7 @@
40954374 }
40964375 }
40974376 }
4377
+
40984378 LoadGFDThread loadGFDThread;
40994379
41004380 void ReadGFD(String fullname, iCallBack cb)
....@@ -4114,8 +4394,10 @@
41144394
41154395 try
41164396 {
4397
+ // Try compressed version first.
41174398 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4118
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4399
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4400
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
41194401
41204402 readobj = (Object3D) p.readObject();
41214403 istream.close();
....@@ -4123,7 +4405,20 @@
41234405 readobj.ResetDisplayList();
41244406 } catch (Exception e)
41254407 {
4126
- e.printStackTrace();
4408
+ //e.printStackTrace();
4409
+ try
4410
+ {
4411
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4412
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4413
+
4414
+ readobj = (Object3D) p.readObject();
4415
+ istream.close();
4416
+
4417
+ readobj.ResetDisplayList();
4418
+ } catch (Exception e2)
4419
+ {
4420
+ e2.printStackTrace();
4421
+ }
41274422 }
41284423 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41294424 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4169,6 +4464,12 @@
41694464
41704465 void LoadIt(Object obj)
41714466 {
4467
+ if (obj == null)
4468
+ {
4469
+ // Invalid file
4470
+ return;
4471
+ }
4472
+
41724473 System.out.println("Loaded " + obj);
41734474 //new Exception().printStackTrace();
41744475 Object3D readobj = (Object3D) obj;
....@@ -4178,6 +4479,7 @@
41784479
41794480 if (readobj != null)
41804481 {
4482
+ Save();
41814483 try
41824484 {
41834485 //readobj.deepCopySelf(copy);
....@@ -4240,7 +4542,7 @@
42404542
42414543 void load() // throws ClassNotFoundException
42424544 {
4243
- if (GrafreeD.standAlone)
4545
+ if (Grafreed.standAlone)
42444546 {
42454547 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42464548 browser.show();
....@@ -4327,11 +4629,13 @@
43274629 try
43284630 {
43294631 FileOutputStream ostream = new FileOutputStream(lastname);
4330
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4632
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4633
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43314634
43324635 p.writeObject(copy);
43334636 p.flush();
43344637
4638
+ zstream.close();
43354639 ostream.close();
43364640
43374641 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4341,11 +4645,12 @@
43414645 {
43424646 }
43434647 }
4648
+
43444649 String lastname;
43454650
43464651 void saveAs()
43474652 {
4348
- if (GrafreeD.standAlone)
4653
+ if (Grafreed.standAlone)
43494654 {
43504655 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43514656 browser.setVisible(true);
....@@ -4450,13 +4755,13 @@
44504755 try
44514756 {
44524757 FileOutputStream ostream = new FileOutputStream(filename);
4453
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4454
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4758
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4759
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44554760
44564761 Object3D objectparent = obj.parent;
44574762 obj.parent = null;
44584763
4459
- Object3D object = (Object3D) GrafreeD.clone(obj);
4764
+ Object3D object = (Object3D) Grafreed.clone(obj);
44604765
44614766 obj.parent = objectparent;
44624767
....@@ -4468,8 +4773,8 @@
44684773 p.writeObject(object);
44694774 p.flush();
44704775
4776
+ zstream.close();
44714777 ostream.close();
4472
- // zstream.close();
44734778
44744779 // group.selection.get(0).parent = parent;
44754780 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4490,7 +4795,7 @@
44904795 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44914796 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44924797 copy.generatePOV(buffer);
4493
- if (GrafreeD.standAlone)
4798
+ if (Grafreed.standAlone)
44944799 {
44954800 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44964801 browser.show();
....@@ -4516,7 +4821,8 @@
45164821 Object3D client;
45174822 Object3D copy;
45184823 MenuBar menuBar;
4519
- Menu windowMenu;
4824
+ Menu fileMenu;
4825
+ MenuItem newItem;
45204826 MenuItem loadItem;
45214827 MenuItem saveItem;
45224828 MenuItem saveAsItem;
....@@ -4524,13 +4830,11 @@
45244830 MenuItem reexportItem;
45254831 MenuItem povItem;
45264832 MenuItem closeItem;
4527
- Menu cameraMenu;
4833
+
45284834 CheckboxMenuItem zBufferItem;
45294835 //MenuItem normalLensItem;
4530
- MenuItem editCameraItem;
4531
- MenuItem revertCameraItem;
4532
- CheckboxMenuItem toggleLiveItem;
45334836 MenuItem stepItem;
4837
+ CheckboxMenuItem toggleLiveItem;
45344838 CheckboxMenuItem toggleFullScreenItem;
45354839 CheckboxMenuItem toggleTimelineItem;
45364840 CheckboxMenuItem toggleRenderItem;
....@@ -4539,7 +4843,7 @@
45394843 CheckboxMenuItem toggleFootContactItem;
45404844 CheckboxMenuItem toggleDLItem;
45414845 CheckboxMenuItem toggleTextureItem;
4542
- CheckboxMenuItem toggleRandomItem;
4846
+ CheckboxMenuItem toggleSwitchItem;
45434847 CheckboxMenuItem toggleRootItem;
45444848 CheckboxMenuItem animationItem;
45454849 CheckboxMenuItem toggleHandleItem;
....@@ -4547,20 +4851,20 @@
45474851 JSplitPane mainPanel;
45484852 JScrollPane scrollpane;
45494853 JPanel toolbarPanel;
4550
- JPanel treePanel;
4854
+ cGridBag treePanel;
45514855 JPanel radioPanel;
45524856 ButtonGroup buttonGroup;
4553
- JPanel ctrlPanel;
4554
- JPanel materialPanel;
4857
+ cGridBag ctrlPanel;
4858
+ cGridBag materialPanel;
45554859 JScrollPane infoPanel;
4556
- JPanel optionsPanel;
4860
+ cGridBag optionsPanel;
45574861 JTabbedPane objectPanel;
45584862 cGridBag XYZPanel;
45594863 JSplitPane gridPanel;
45604864 JSplitPane bigPanel;
45614865 cGridBag bigThree;
4562
- JTabbedPane scenePanel;
4563
- JPanel centralPanel;
4866
+ cGridBag scenePanel;
4867
+ cGridBag centralPanel;
45644868 JSplitPane cameraPanel;
45654869 JPanel timelinePanel;
45664870 JMenuBar timelineMenubar;
....@@ -4613,67 +4917,72 @@
46134917 // MATERIAL
46144918 JLabel materialLabel;
46154919 JLabel colorLabel;
4616
- NumberSlider colorField;
4920
+ cNumberSlider colorField;
46174921 JLabel modulationLabel;
4618
- NumberSlider modulationField;
4922
+ cNumberSlider modulationField;
46194923 JLabel metalnessLabel;
4620
- NumberSlider metalnessField;
4924
+ cNumberSlider metalnessField;
46214925 JLabel diffuseLabel;
4622
- NumberSlider diffuseField;
4926
+ cNumberSlider diffuseField;
46234927 JLabel specularLabel;
4624
- NumberSlider specularField;
4928
+ cNumberSlider specularField;
46254929 JLabel shininessLabel;
4626
- NumberSlider shininessField;
4930
+ cNumberSlider shininessField;
46274931 JLabel shiftLabel;
4628
- NumberSlider shiftField;
4932
+ cNumberSlider shiftField;
46294933 JLabel ambientLabel;
4630
- NumberSlider ambientField;
4934
+ cNumberSlider ambientField;
46314935 JLabel lightareaLabel;
4632
- NumberSlider lightareaField;
4936
+ cNumberSlider lightareaField;
46334937 JLabel diffusenessLabel;
4634
- NumberSlider diffusenessField;
4938
+ cNumberSlider diffusenessField;
46354939 JLabel velvetLabel;
4636
- NumberSlider velvetField;
4940
+ cNumberSlider velvetField;
46374941 JLabel sheenLabel;
4638
- NumberSlider sheenField;
4942
+ cNumberSlider sheenField;
46394943 JLabel subsurfaceLabel;
4640
- NumberSlider subsurfaceField;
4944
+ cNumberSlider subsurfaceField;
46414945 //JLabel bumpLabel;
46424946 //NumberSlider bumpField;
46434947 JLabel backlitLabel;
4644
- NumberSlider backlitField;
4948
+ cNumberSlider backlitField;
46454949 JLabel anisoLabel;
4646
- NumberSlider anisoField;
4950
+ cNumberSlider anisoField;
46474951 JLabel anisoVLabel;
4648
- NumberSlider anisoVField;
4952
+ cNumberSlider anisoVField;
46494953 JLabel cameraLabel;
4650
- NumberSlider cameraField;
4954
+ cNumberSlider cameraField;
46514955 JLabel selfshadowLabel;
4652
- NumberSlider selfshadowField;
4956
+ cNumberSlider selfshadowField;
46534957 JLabel shadowLabel;
4654
- NumberSlider shadowField;
4958
+ cNumberSlider shadowField;
46554959 JLabel textureLabel;
4656
- NumberSlider textureField;
4960
+ cNumberSlider textureField;
46574961 JLabel opacityLabel;
4658
- NumberSlider opacityField;
4962
+ cNumberSlider opacityField;
46594963 JLabel fakedepthLabel;
4660
- NumberSlider fakedepthField;
4964
+ cNumberSlider fakedepthField;
46614965 JLabel shadowbiasLabel;
4662
- NumberSlider shadowbiasField;
4966
+ cNumberSlider shadowbiasField;
46634967 JLabel bumpLabel;
4664
- NumberSlider bumpField;
4968
+ cNumberSlider bumpField;
46654969 JLabel noiseLabel;
4666
- NumberSlider noiseField;
4970
+ cNumberSlider noiseField;
46674971 JLabel powerLabel;
4668
- NumberSlider powerField;
4972
+ cNumberSlider powerField;
46694973 JLabel borderfadeLabel;
4670
- NumberSlider borderfadeField;
4974
+ cNumberSlider borderfadeField;
46714975 JLabel fogLabel;
4672
- NumberSlider fogField;
4976
+ cNumberSlider fogField;
46734977 JLabel opacityPowerLabel;
4674
- NumberSlider opacityPowerField;
4978
+ cNumberSlider opacityPowerField;
46754979 JTree jTree;
46764980 //ObjectUI parent;
46774981
4678
- NumberSlider normalpushField;
4982
+ cNumberSlider normalpushField;
4983
+
4984
+ private MenuItem importGFDItem;
4985
+ private MenuItem importVRMLX3DItem;
4986
+ private MenuItem import3DSItem;
4987
+ private MenuItem importOBJItem;
46794988 }