Normand Briere
2019-05-01 504890a7b930ab6b853c49de825ae848e0535339
ObjEditor.java
....@@ -19,6 +19,8 @@
1919 import //weka.core.
2020 matrix.Matrix;
2121
22
+import grafeme.ui.*;
23
+
2224 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
2325 ActionListener, ChangeListener,
2426 InputMethodListener,
....@@ -28,7 +30,12 @@
2830 iSendInfo
2931 //KeyListener
3032 {
33
+ boolean timeline;
34
+ boolean wasFullScreen;
3135
36
+ GroupEditor callee;
37
+ JFrame frame;
38
+
3239 // SCRIPT
3340
3441 transient JFrame textpanel = null;
....@@ -119,51 +126,60 @@
119126 void keyPressed(int key, int modifiers)
120127 {
121128 System.out.println("KEY PRESSED");
122
- CameraPane.theRenderer.keyPressed(key, modifiers);
129
+ Globals.theRenderer.keyPressed(key, modifiers);
123130 }
124131 */
125132
126133 static GridBagConstraints aConstraints;
127134 static GridBagConstraints aWindowConstraints;
128
- GroupEditor callee;
129
- JFrame frame;
135
+
130136 static int GRIDWIDTH = 100; // 4;
131137
132138 public void closeUI()
133139 {
134140 //new Exception().printStackTrace();
135
- System.out.println("this = " + this);
136
- System.out.println("objEditor = " + objEditor);
141
+// System.out.println("this = " + this);
142
+// System.out.println("objEditor = " + objEditor);
137143 //nameField.removeActionListener(this);
138
- objEditor.ctrlPanel.remove(nameField);
144
+// objEditor.ctrlPanel.remove(nameField);
139145
140146 if (!GroupEditor.allparams)
141147 return;
142148
143
- objEditor.ctrlPanel.remove(liveCB);
144
- objEditor.ctrlPanel.remove(hideCB);
145
- objEditor.ctrlPanel.remove(markCB);
146
-
147
- objEditor.ctrlPanel.remove(randomCB);
148
- objEditor.ctrlPanel.remove(speedupCB);
149
- objEditor.ctrlPanel.remove(rewindCB);
150
-
151
- objEditor.ctrlPanel.remove(resetButton);
152
- objEditor.ctrlPanel.remove(stepButton);
153
-// objEditor.ctrlPanel.remove(stepAllButton);
154
-// objEditor.ctrlPanel.remove(resetAllButton);
155
- objEditor.ctrlPanel.remove(link2masterCB);
156
- //objEditor.ctrlPanel.remove(flipVCB);
157
- //objEditor.ctrlPanel.remove(texresMenu);
158
- objEditor.ctrlPanel.remove(slowerButton);
159
- objEditor.ctrlPanel.remove(fasterButton);
160
- objEditor.ctrlPanel.remove(remarkButton);
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);
167
+
168
+ objEditor.ctrlPanel.remove(namePanel);
169
+ objEditor.ctrlPanel.remove(setupPanel);
170
+ objEditor.ctrlPanel.remove(commandsPanel);
171
+ objEditor.ctrlPanel.remove(pushPanel);
172
+ //objEditor.ctrlPanel.remove(fillPanel);
173
+
174
+ //Remove(normalpushField);
161175 }
162176
163177 public ObjEditor GetEditor()
164178 {
165179 return objEditor; //.GetEditor();
166180 }
181
+
182
+ // Sometimes myself, sometimes my callee's.
167183 ObjEditor objEditor;
168184
169185 /*
....@@ -238,7 +254,7 @@
238254 //if (!isDisplayable())
239255 //setUndecorated(true);
240256
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
257
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242258 client = inClient;
243259 copy = localCopy;
244260 copy.editWindow = this;
....@@ -292,16 +308,18 @@
292308 //normalLensItem.addActionListener(this);
293309 cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
294310 revertCameraItem.addActionListener(this);
295
- cameraMenu.add(toggleFullItem = new CheckboxMenuItem("Full Screen"));
296
- toggleFullItem.addItemListener(this);
297
- toggleFullItem.setState(CameraPane.FULLSCREEN);
311
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
312
+ toggleTimelineItem.addItemListener(this);
313
+ cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
314
+ toggleFullScreenItem.addItemListener(this);
315
+ toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
298316 cameraMenu.add("-");
299317 cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
300318 toggleTextureItem.addItemListener(this);
301319 toggleTextureItem.setState(CameraPane.textureon);
302320 cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
303321 toggleLiveItem.addItemListener(this);
304
- toggleLiveItem.setState(CameraPane.isLIVE());
322
+ toggleLiveItem.setState(Globals.isLIVE());
305323 cameraMenu.add(stepItem = new MenuItem("Step"));
306324 stepItem.addActionListener(this);
307325 // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
....@@ -343,9 +361,9 @@
343361 toolbarPanel.setName("Toolbar");
344362 treePanel = new JPanel();
345363 treePanel.setName("Tree");
346
- ctrlPanel = new JPanel(); // new GridBagLayout());
364
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
347365 ctrlPanel.setName("Edit");
348
- materialPanel = new JPanel();
366
+ materialPanel = new cGridBag().setVertical(true);
349367 materialPanel.setName("Material");
350368 /*JTextPane*/
351369 infoarea = createTextPane();
....@@ -374,8 +392,8 @@
374392 //mainPanel.setLayout(new GridBagLayout());
375393 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
376394 treePanel.setLayout(new GridBagLayout());
377
- ctrlPanel.setLayout(new GridBagLayout());
378
- materialPanel.setLayout(new GridBagLayout());
395
+ //ctrlPanel.setLayout(new GridBagLayout());
396
+ //materialPanel.setLayout(new GridBagLayout());
379397
380398 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
381399 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -522,18 +540,18 @@
522540 maxima.y = sel.toParent[3][1];
523541 maxima.z = sel.toParent[3][2];
524542 si.SendInfo(" Orig: " + maxima, "regular");
525
- maxima.x = sel.globalTransform[3][0];
526
- maxima.y = sel.globalTransform[3][1];
527
- maxima.z = sel.globalTransform[3][2];
528
- if (full)
529
- si.SendInfo(" Global Orig: " + maxima, "regular");
530543 maxima.x = sel.toParent[0][0];
531544 maxima.y = sel.toParent[1][1];
532545 maxima.z = sel.toParent[2][2];
533546 si.SendInfo(" Scale: " + maxima, "regular");
534
- maxima.x = sel.globalTransform[0][0];
535
- maxima.y = sel.globalTransform[1][1];
536
- maxima.z = sel.globalTransform[2][2];
547
+ maxima.x = sel.globalTransform[3][0];
548
+ maxima.y = sel.globalTransform[3][1];
549
+ maxima.z = sel.globalTransform[3][2];
550
+ if (full)
551
+ si.SendInfo(" Global Orig: " + maxima, "regular");
552
+ maxima.x = sel.globalTransform[0][0];
553
+ maxima.y = sel.globalTransform[1][1];
554
+ maxima.z = sel.globalTransform[2][2];
537555 if (full)
538556 si.SendInfo(" Global Scale: " + maxima, "regular");
539557 }
....@@ -593,6 +611,22 @@
593611 System.err.println("Couldn't insert initial text into text pane.");
594612 }
595613 }
614
+
615
+ void ToggleFullScreen()
616
+ {
617
+ if (CameraPane.FULLSCREEN)
618
+ {
619
+ frame.getContentPane().remove(/*"Center",*/bigThree);
620
+ framePanel.add(bigThree);
621
+ frame.getContentPane().add(/*"Center",*/framePanel);
622
+ } else
623
+ {
624
+ frame.getContentPane().remove(/*"Center",*/framePanel);
625
+ framePanel.remove(bigThree);
626
+ frame.getContentPane().add(/*"Center",*/bigThree);
627
+ }
628
+ cameraView.ToggleFullScreen();
629
+ }
596630
597631 private JTextArea createTextPane()
598632 {
....@@ -692,7 +726,7 @@
692726 protected static ImageIcon createImageIcon(String path,
693727 String description)
694728 {
695
- java.net.URL imgURL = GraphreeD.class.getResource(path);
729
+ java.net.URL imgURL = GrafreeD.class.getResource(path);
696730 if (imgURL != null)
697731 {
698732 return new ImageIcon(imgURL, description);
....@@ -739,115 +773,83 @@
739773 JButton slowerButton;
740774 JButton fasterButton;
741775 JButton remarkButton;
776
+
777
+ cGridBag namePanel;
778
+ cGridBag setupPanel;
779
+ cGridBag commandsPanel;
780
+ cGridBag pushPanel;
781
+ cGridBag fillPanel;
742782
743
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
783
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
744784 {
745785 JCheckBox cb;
746786
747
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
748
- oe.aConstraints.gridwidth = 1; // 3;
749
-// oe.aConstraints.weightx = 1;
750
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
751
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
787
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
752788 cb.addItemListener(this);
753
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
754
- oe.aConstraints.gridwidth = 1;
755
- oe.aConstraints.gridx += 1;
756789
757790 return cb;
758791 }
759792
760
- cButton AddButton(ObjEditor oe, String label)
793
+ cButton AddButton(cGridBag panel, String label)
761794 {
762795 cButton cb;
763796
764
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
765
- oe.aConstraints.gridwidth = 1;
766
-// oe.aConstraints.weightx = 1;
767
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
768
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
797
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
769798 cb.addActionListener(this);
770
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
771
- oe.aConstraints.gridwidth = 1;
772
- oe.aConstraints.gridx += 1;
773799
774800 return cb;
775801 }
776802
777
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
803
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
778804 {
779805 JComboBox combo;
780806
781
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
782
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
783
- oe.aConstraints.gridx += 1;
807
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
784808 combo.addActionListener(this);
785809
786810 return combo;
787811 }
788812
789
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
813
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
790814 {
791
- NumberSlider combo;
815
+ cGridBag control = new cGridBag();
816
+
817
+ cNumberSlider combo;
792818
793819 JLabel jlabel = new JLabel(label);
794
-
795
- aConstraints.fill = GridBagConstraints.VERTICAL;
796820 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
797
- aConstraints.gridwidth = 2;
798
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
799
- aConstraints.gridx += 1;
800
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
801
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
802
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
803
- aConstraints.gridx += 1;
804
- aConstraints.gridwidth = 1;
805
-
821
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
822
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
806823 combo.setFloat(current);
807
-
808
- combo.label = jlabel;
809
-
810
- combo.addChangeListener(this);
811
-
812
- return combo;
824
+
825
+ panel.add(control);
826
+
827
+ return control;
813828 }
814829
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
830
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
816831 {
817
- NumberSlider combo;
832
+ cGridBag control = new cGridBag();
833
+
834
+ cNumberSlider combo;
818835
819836 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
822837 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
823
- aConstraints.gridwidth = 2;
824
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
825
- aConstraints.gridx += 1;
826
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
827
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
828
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
829
- aConstraints.gridx += 1;
830
- aConstraints.gridwidth = 1;
831
-
838
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
839
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
832840 combo.setInteger(current);
833841
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
842
+ panel.add(control);
843
+
844
+ return control;
839845 }
840846
841
- JTextArea AddText(JPanel ctrlPanel, String name)
847
+ JTextArea AddText(cGridBag ctrlPanel, String name)
842848 {
843849 JTextArea text;
844850
845
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
846
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
847
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
851
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
848852 text.addCaretListener(this);
849
- aConstraints.gridx += 1;
850
- aConstraints.gridwidth = 1;
851853
852854 return text;
853855 }
....@@ -877,9 +879,16 @@
877879 objEditor.ctrlPanel.remove(j);
878880 }
879881
882
+ void Remove(cNumberSlider j)
883
+ {
884
+ j.removeChangeListener(this);
885
+ //objEditor.ctrlPanel.remove(j.label);
886
+ objEditor.ctrlPanel.remove(j);
887
+ }
888
+
880889 /*
881890 */
882
- void Return() // ObjEditor oe)
891
+ void Return0() // ObjEditor oe)
883892 {
884893 aConstraints.gridy += 1;
885894 aConstraints.gridx = 0;
....@@ -938,31 +947,53 @@
938947 // oe.aConstraints.weighty = 0;
939948 // oe.aConstraints.gridx = 0;
940949 // oe.aConstraints.gridy = 0;
941
- SetupName(oe);
950
+ //SetupName(oe);
951
+
952
+ namePanel = new cGridBag();
953
+
954
+ nameField = AddText(namePanel, copy.GetName());
955
+ namePanel.add(nameField);
956
+ oe.ctrlPanel.add(namePanel);
957
+
958
+ oe.ctrlPanel.Return();
942959
943960 if (!GroupEditor.allparams)
944961 return;
945962
946
- liveCB = AddCheckBox(oe, "Live", copy.live);
947
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
948
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
963
+ setupPanel = new cGridBag().setVertical(false);
964
+
965
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
966
+ link2masterCB = AddCheckBox(setupPanel, "Supp", copy.link2master);
967
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
949968 // Return();
950
- markCB = AddCheckBox(oe, "Mark", copy.marked);
951
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
952
- randomCB = AddCheckBox(oe, "Rand", copy.random);
953
- Return();
954
- resetButton = AddButton(oe, "Reset");
955
- stepButton = AddButton(oe, "Step");
969
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
970
+ rewindCB = AddCheckBox(setupPanel, "Rew", copy.rewind);
971
+ randomCB = AddCheckBox(setupPanel, "Rand", copy.random);
972
+
973
+ oe.ctrlPanel.add(setupPanel);
974
+ oe.ctrlPanel.Return();
975
+
976
+ commandsPanel = new cGridBag().setVertical(false);
977
+
978
+ resetButton = AddButton(commandsPanel, "Reset");
979
+ stepButton = AddButton(commandsPanel, "Step");
956980 // resetAllButton = AddButton(oe, "Reset All");
957981 // stepAllButton = AddButton(oe, "Step All");
958
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
982
+ speedupCB = AddCheckBox(commandsPanel, "Speed", copy.speedup);
959983 // Return();
960
- slowerButton = AddButton(oe, "Slow");
961
- fasterButton = AddButton(oe, "Fast");
962
- remarkButton = AddButton(oe, "Rem");
984
+ slowerButton = AddButton(commandsPanel, "Slow");
985
+ fasterButton = AddButton(commandsPanel, "Fast");
986
+ remarkButton = AddButton(commandsPanel, "Remark");
963987
964
- Return();
988
+ oe.ctrlPanel.add(commandsPanel);
989
+ oe.ctrlPanel.Return();
965990
991
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1);
992
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
993
+ //Return();
994
+
995
+ oe.ctrlPanel.Return();
996
+
966997 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
967998 // ObjEditor.aConstraints.gridx += 1;
968999
....@@ -1056,7 +1087,7 @@
10561087 oe.aConstraints.gridwidth = 1;
10571088 /**/
10581089 nameField = AddText(oe.ctrlPanel, copy.GetName());
1059
- Return();
1090
+ oe.ctrlPanel.Return();
10601091
10611092 //ctrlPanel.add(textureButton = new Button("Texture..."));
10621093 //textureButton.setEnabled(false);
....@@ -1107,7 +1138,7 @@
11071138 //frontScroll.setLabel("------------------------------ XZ (front) ---------------------------------------------------");
11081139 //sideScroll.setLabel("------------------------------- YZ (side) ---------------------------------------------------");
11091140
1110
-// GridBagConstraints gbc = (GridBagConstraints) GraphreeD.clone(aConstraints);
1141
+// GridBagConstraints gbc = (GridBagConstraints) GrafreeD.clone(aConstraints);
11111142 Camera cam = GetCamera(copy, 0);
11121143
11131144 Composite cams = null;
....@@ -1158,10 +1189,22 @@
11581189 //JPanel worldPanel =
11591190 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11601191 //worldPanel.setName("World");
1161
- /*JPanel*/ cameraPanel =
1162
- new JPanel(new BorderLayout());
1163
- cameraPanel.add(cameraView);
1192
+ centralPanel = new cGridBag();
1193
+ centralPanel.preferredWidth = 20;
1194
+ timelinePanel = new JPanel(new BorderLayout());
1195
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11641196
1197
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1198
+ cameraPanel.setContinuousLayout(true);
1199
+ cameraPanel.setOneTouchExpandable(true);
1200
+// cameraPanel.setDividerLocation(0.9);
1201
+// cameraPanel.setDividerSize(9);
1202
+ cameraPanel.setResizeWeight(1.0);
1203
+
1204
+ centralPanel.add(cameraView);
1205
+ //frame.setJMenuBar(timelineMenubar);
1206
+ //centralPanel.add(timelinePanel);
1207
+
11651208 //topView.camera = ;
11661209 //frontView.camera = new Camera(2);
11671210 //sideView.camera = new Camera(3);
....@@ -1177,12 +1220,13 @@
11771220 //frontView.object = copy;
11781221 //sideView.object = copy;
11791222
1180
- XYZPanel = new JPanel();
1181
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1223
+ XYZPanel = new cGridBag().setVertical(true);
1224
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11821225
1183
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1184
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1185
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1226
+ XYZPanel.preferredWidth = 5;
1227
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1228
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1229
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
11861230
11871231 /*
11881232 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1191,7 +1235,7 @@
11911235 gridPanel.add(cameraView);
11921236 gridPanel.add(XYZPanel);
11931237 */
1194
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout());
1238
+ gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
11951239 gridPanel.setContinuousLayout(true);
11961240 gridPanel.setOneTouchExpandable(true);
11971241 gridPanel.setDividerLocation(1.0);
....@@ -1220,10 +1264,11 @@
12201264 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12211265 //tmp.setName("Edit");
12221266 objectPanel.add(materialPanel);
1223
- JPanel north = new JPanel(new BorderLayout());
1224
- north.setName("Edit");
1225
- north.add(ctrlPanel, BorderLayout.NORTH);
1226
- objectPanel.add(north);
1267
+// JPanel north = new JPanel(new BorderLayout());
1268
+// north.setName("Edit");
1269
+// north.add(ctrlPanel, BorderLayout.NORTH);
1270
+// objectPanel.add(north);
1271
+ objectPanel.add(ctrlPanel);
12271272 objectPanel.add(infoPanel);
12281273
12291274 /*
....@@ -1244,16 +1289,23 @@
12441289 scrollpane.setWheelScrollingEnabled(true);
12451290 scrollpane.addMouseWheelListener(this); // Default not fast enough
12461291
1247
- /*JTabbedPane*/ jtp = new JTabbedPane();
1248
- jtp.add(scrollpane);
1292
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1293
+ scenePanel.preferredWidth = 7;
1294
+
1295
+ JTabbedPane tabbedPane = new JTabbedPane();
1296
+ tabbedPane.add(scrollpane);
12491297
1250
- jtp.add(FSPane = new cFileSystemPane(this));
1298
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12511299
1252
- optionsPanel = new JPanel(new GridBagLayout());
1300
+ optionsPanel = new cGridBag().setVertical(true);
12531301
12541302 optionsPanel.setName("Options");
1255
- jtp.add(optionsPanel);
1256
-
1303
+
1304
+ AddOptions(optionsPanel); //, aConstraints);
1305
+
1306
+ tabbedPane.add(optionsPanel);
1307
+
1308
+ scenePanel.add(tabbedPane);
12571309
12581310 /*
12591311 cTree jTree = new cTree(null);
....@@ -1275,7 +1327,7 @@
12751327 jtp.add(tree);
12761328 */
12771329
1278
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel);
1330
+ bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
12791331 bigPanel.setContinuousLayout(true);
12801332 bigPanel.setOneTouchExpandable(true);
12811333 bigPanel.setDividerLocation(0.8);
....@@ -1287,6 +1339,7 @@
12871339 //bigPanel.setSize(new Dimension(10,10));
12881340 //bigPanel.add(ctrlPanel);
12891341 //bigPanel.add(gridPanel);
1342
+ /**
12901343 bigThree = new JPanel();
12911344 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12921345 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1297,20 +1350,26 @@
12971350 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
12981351 aWindowConstraints.weightx = 0;
12991352 aWindowConstraints.weighty = 1;
1300
- bigThree.add(jtp, aWindowConstraints);
1353
+ bigThree.add(scenePanel, aWindowConstraints);
13011354 aWindowConstraints.weightx = 1;
13021355 aWindowConstraints.gridwidth = 3;
13031356 // aConstraints.gridheight = 3;
13041357 aWindowConstraints.gridx = 1;
13051358 aWindowConstraints.fill = GridBagConstraints.BOTH;
1306
- bigThree.add(cameraPanel, aWindowConstraints);
1359
+ bigThree.add(centralPanel, aWindowConstraints);
13071360 aWindowConstraints.weightx = 0;
13081361 aWindowConstraints.gridx = 4;
13091362 aWindowConstraints.gridwidth = 1;
13101363 // aConstraints.gridheight = 3;
13111364 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13121365 bigThree.add(XYZPanel, aWindowConstraints);
1366
+ /**/
13131367
1368
+ bigThree = new cGridBag();
1369
+ bigThree.addComponent(scenePanel);
1370
+ bigThree.addComponent(centralPanel);
1371
+ bigThree.addComponent(XYZPanel);
1372
+
13141373 // // SIDE EFFECT!!!
13151374 // aConstraints.gridx = 0;
13161375 // aConstraints.gridy = 0;
....@@ -1331,10 +1390,11 @@
13311390 //worldPane.add(bigPanel);
13321391 //worldPane.add(worldPanel);
13331392 /**/
1334
- frame.getContentPane().add(/*"Center",*/framePanel);
1393
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1394
+ frame.add(/*"Center",*/framePanel);
13351395 //frame.getContentPane().add(/*"Center",*/ worldPane);
13361396
1337
-// aConstraints = gbc; // (GridBagConstraints) GraphreeD.clone(gbc);
1397
+// aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13381398
13391399 frame.setSize(1024, 768);
13401400 frame.show();
....@@ -1352,6 +1412,10 @@
13521412 });
13531413 }
13541414
1415
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1416
+ {
1417
+ }
1418
+
13551419 JTree GetTree()
13561420 {
13571421 return objEditor.jTree;
....@@ -1363,260 +1427,165 @@
13631427 ctrlPanel.removeAll();
13641428 }
13651429
1366
- void SetupMaterial(JPanel ctrlPanel)
1430
+ void SetupMaterial(cGridBag panel)
13671431 {
1368
- aConstraints.weighty = 0;
1369
- //aConstraints.weightx = 1;
1370
- /*
1432
+ /*
13711433 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13721434 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1373
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1374
- aConstraints.gridx += 1;
13751435 */
13761436
1377
- aConstraints.gridwidth = 1;
1378
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1379
- aConstraints.gridx += 1;
1380
- aConstraints.weighty = 0;
1381
- aConstraints.gridwidth = 1;
1437
+ cGridBag editBar = new cGridBag().setVertical(false);
1438
+
1439
+ editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints);
13821440
13831441 /*
13841442 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- aConstraints.gridwidth = 1;
13881443 */
13891444
1390
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1391
- aConstraints.gridx += 1;
1445
+ editBar.add(clearMaterialButton = new cButton("Clear")); // , aConstraints);
1446
+ editBar.add(resetSlidersButton = new cButton("Reset")); // , aConstraints);
1447
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1448
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
13921449
1393
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1394
-
1395
- aConstraints.gridx += 1;
1396
-
1397
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1398
-
1399
- aConstraints.gridx += 1;
1400
-
1401
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1402
-
1403
- aConstraints.gridx = 0;
1404
- aConstraints.gridy += 1;
1405
- aConstraints.weighty = 0;
1406
- aConstraints.gridwidth = 1;
1450
+ panel.add(editBar);
1451
+
14071452 /**/
14081453 //aConstraints.weighty = 0;
14091454 ////aConstraints.weightx = 1;
14101455 //aConstraints.weighty = 1;
14111456 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14121457 //aConstraints.gridx += 1;
1413
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1414
- aConstraints.weighty = 0;
1415
- aConstraints.gridx = 0;
1416
- aConstraints.gridy += 1;
1417
- aConstraints.gridwidth = 1;
1458
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14181459
1419
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1420
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1421
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1422
- aConstraints.gridx += 1;
1423
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1424
- //aConstraints.weightx = 0;
1425
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1426
- aConstraints.gridx = 0;
1427
- aConstraints.gridy += 1;
1428
- aConstraints.gridwidth = 1;
1460
+ cGridBag colorSection = new cGridBag().setVertical(true);
1461
+
1462
+ cGridBag color = new cGridBag();
1463
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1464
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1465
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1466
+ //colorField.preferredWidth = 200;
1467
+ colorSection.add(color);
14291468
1430
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1431
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1432
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1433
- aConstraints.gridx += 1;
1434
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1435
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1436
- aConstraints.gridx = 0;
1437
- aConstraints.gridy += 1;
1438
- aConstraints.gridwidth = 1;
1469
+ cGridBag modulation = new cGridBag();
1470
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1471
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1472
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1473
+ colorSection.add(modulation);
14391474
1440
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1441
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1442
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1443
- aConstraints.gridx += 1;
1444
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1445
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1446
- aConstraints.gridx = 0;
1447
- aConstraints.gridy += 1;
1448
- aConstraints.gridwidth = 1;
1475
+ cGridBag texture = new cGridBag();
1476
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1477
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1478
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1479
+ colorSection.add(texture);
14491480
1450
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1451
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1452
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1453
- aConstraints.gridx += 1;
1454
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1455
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1456
- aConstraints.gridx = 0;
1457
- aConstraints.gridy += 1;
1458
- aConstraints.gridwidth = 1;
1481
+ cGridBag anisoU = new cGridBag();
1482
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1483
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1484
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1485
+ colorSection.add(anisoU);
14591486
1460
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1461
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1462
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1463
- aConstraints.gridx += 1;
1464
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1465
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1466
- aConstraints.gridx = 0;
1467
- aConstraints.gridy += 1;
1468
- aConstraints.gridwidth = 1;
1487
+ cGridBag anisoV = new cGridBag();
1488
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1489
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1490
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1491
+ colorSection.add(anisoV);
14691492
1470
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1471
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1472
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1473
- aConstraints.gridx += 1;
1474
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1475
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1476
- aConstraints.gridx = 0;
1477
- aConstraints.gridy += 1;
1478
- aConstraints.gridwidth = 1;
1493
+ cGridBag shadowbias = new cGridBag();
1494
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1495
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1496
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1497
+ colorSection.add(shadowbias);
14791498
1480
- //aConstraints.weighty = 1;
1481
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1482
- //aConstraints.gridx += 1;
1483
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1484
- aConstraints.weighty = 0;
1485
- aConstraints.gridx = 0;
1486
- aConstraints.gridy += 1;
1487
- aConstraints.gridwidth = 1;
1499
+ panel.add(new JSeparator());
1500
+
1501
+ panel.add(colorSection);
1502
+
1503
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1504
+
1505
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1506
+
1507
+ cGridBag diffuse = new cGridBag();
1508
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1509
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1510
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1511
+ diffuseSection.add(diffuse);
14881512
1489
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1490
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1492
- aConstraints.gridx += 1;
1493
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1494
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1495
- aConstraints.gridx = 0;
1496
- aConstraints.gridy += 1;
1497
- aConstraints.gridwidth = 1;
1513
+ cGridBag diffuseness = new cGridBag();
1514
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1515
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1516
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1517
+ diffuseSection.add(diffuseness);
14981518
1499
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1500
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1501
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1502
- aConstraints.gridx += 1;
1503
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1504
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1505
- aConstraints.gridx = 0;
1506
- aConstraints.gridy += 1;
1507
- aConstraints.gridwidth = 1;
1519
+ cGridBag selfshadow = new cGridBag();
1520
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1521
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1522
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1523
+ diffuseSection.add(selfshadow);
15081524
1509
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1510
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1511
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1512
- aConstraints.gridx += 1;
1513
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1514
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1515
- aConstraints.gridx = 0;
1516
- aConstraints.gridy += 1;
1517
- aConstraints.gridwidth = 1;
1525
+ cGridBag sheen = new cGridBag();
1526
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1527
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1528
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1529
+ diffuseSection.add(sheen);
15181530
1519
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1520
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1521
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1522
- aConstraints.gridx += 1;
1523
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1524
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1525
- aConstraints.gridx = 0;
1526
- aConstraints.gridy += 1;
1527
- aConstraints.gridwidth = 1;
1531
+ cGridBag subsurface = new cGridBag();
1532
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1533
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1534
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1535
+ diffuseSection.add(subsurface);
15281536
1529
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1530
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1531
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1532
- aConstraints.gridx += 1;
1533
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1534
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1535
- aConstraints.gridx = 0;
1536
- aConstraints.gridy += 1;
1537
- aConstraints.gridwidth = 1;
1537
+ cGridBag shadow = new cGridBag();
1538
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1539
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1540
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1541
+ diffuseSection.add(shadow);
15381542
1539
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1540
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1541
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1542
- aConstraints.gridx += 1;
1543
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1544
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1545
- aConstraints.gridx = 0;
1546
- aConstraints.gridy += 1;
1547
- aConstraints.gridwidth = 1;
1543
+ cGridBag fakedepth = new cGridBag();
1544
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1545
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1546
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1547
+ diffuseSection.add(fakedepth);
15481548
1549
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1550
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1551
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1552
- aConstraints.gridx += 1;
1553
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1554
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1555
- aConstraints.gridx = 0;
1556
- aConstraints.gridy += 1;
1557
- aConstraints.gridwidth = 1;
1549
+ panel.add(new JSeparator());
1550
+
1551
+ panel.add(diffuseSection);
1552
+
1553
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1554
+
1555
+ cGridBag specularSection = new cGridBag().setVertical(true);
15581556
1559
- //aConstraints.weighty = 1;
1560
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1561
- //aConstraints.gridx += 1;
1562
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1563
- aConstraints.weighty = 0;
1564
- aConstraints.gridx = 0;
1565
- aConstraints.gridy += 1;
1566
- aConstraints.gridwidth = 1;
1557
+ cGridBag specular = new cGridBag();
1558
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1559
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1560
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1561
+ specularSection.add(specular);
15671562
1568
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1569
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1570
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1571
- aConstraints.gridx += 1;
1572
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1573
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1574
- aConstraints.gridx = 0;
1575
- aConstraints.gridy += 1;
1576
- aConstraints.gridwidth = 1;
1563
+ cGridBag lightarea = new cGridBag();
1564
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1565
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1566
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1567
+ specularSection.add(lightarea);
15771568
1578
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1579
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1580
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1581
- aConstraints.gridx += 1;
1582
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1583
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1584
- aConstraints.gridx = 0;
1585
- aConstraints.gridy += 1;
1586
- aConstraints.gridwidth = 1;
1569
+ cGridBag shininess = new cGridBag();
1570
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1571
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1572
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1573
+ specularSection.add(shininess);
15871574
1588
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1589
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1590
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1591
- aConstraints.gridx += 1;
1592
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1593
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1594
- aConstraints.gridx = 0;
1595
- aConstraints.gridy += 1;
1596
- aConstraints.gridwidth = 1;
1575
+ cGridBag metalness = new cGridBag();
1576
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1577
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1578
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1579
+ specularSection.add(metalness);
15971580
1598
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1599
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1600
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1601
- aConstraints.gridx += 1;
1602
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1603
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1604
- aConstraints.gridx = 0;
1605
- aConstraints.gridy += 1;
1606
- aConstraints.gridwidth = 1;
1581
+ cGridBag velvet = new cGridBag();
1582
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1583
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1584
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1585
+ specularSection.add(velvet);
16071586
1608
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1609
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1610
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1611
- aConstraints.gridx += 1;
1612
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1613
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1614
- aConstraints.gridx = 0;
1615
- aConstraints.gridy += 1;
1616
- aConstraints.gridwidth = 1;
1617
-
1618
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1619
- Return();
1587
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1588
+ //Return();
16201589 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16211590 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16221591 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1627,130 +1596,93 @@
16271596 // aConstraints.gridy += 1;
16281597 // aConstraints.gridwidth = 1;
16291598
1630
- //aConstraints.weighty = 1;
1631
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1632
- //aConstraints.gridx += 1;
1633
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1634
- aConstraints.weighty = 0;
1635
- aConstraints.gridx = 0;
1636
- aConstraints.gridy += 1;
1637
- aConstraints.gridwidth = 1;
16381599
1639
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1640
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1641
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1642
- aConstraints.gridx += 1;
1643
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1644
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1645
- aConstraints.gridx = 0;
1646
- aConstraints.gridy += 1;
1647
- aConstraints.gridwidth = 1;
1600
+ panel.add(new JSeparator());
1601
+
1602
+ panel.add(specularSection);
1603
+
1604
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1605
+
1606
+ cGridBag globalSection = new cGridBag().setVertical(true);
16481607
1649
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1650
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1651
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1652
- aConstraints.gridx += 1;
1653
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1654
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1655
- aConstraints.gridx = 0;
1656
- aConstraints.gridy += 1;
1657
- aConstraints.gridwidth = 1;
1608
+ cGridBag camera = new cGridBag();
1609
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1610
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1611
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1612
+ globalSection.add(camera);
16581613
1659
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1660
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1661
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1662
- aConstraints.gridx += 1;
1663
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1664
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1665
- aConstraints.gridx = 0;
1666
- aConstraints.gridy += 1;
1667
- aConstraints.gridwidth = 1;
1614
+ cGridBag ambient = new cGridBag();
1615
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1616
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1617
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1618
+ globalSection.add(ambient);
16681619
1669
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1670
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1671
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1672
- aConstraints.gridx += 1;
1673
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1674
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1675
- aConstraints.gridx = 0;
1676
- aConstraints.gridy += 1;
1677
- aConstraints.gridwidth = 1;
1678
- aConstraints.weighty = 0;
1620
+ cGridBag backlit = new cGridBag();
1621
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1622
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1623
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1624
+ globalSection.add(backlit);
16791625
1680
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1681
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1683
- aConstraints.gridx += 1;
1684
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1685
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1686
- aConstraints.gridx = 0;
1687
- aConstraints.gridy += 1;
1688
- aConstraints.gridwidth = 1;
1626
+ cGridBag opacity = new cGridBag();
1627
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1628
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1629
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1630
+ globalSection.add(opacity);
16891631
1690
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1691
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1692
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1693
- aConstraints.gridx += 1;
1694
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1695
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1696
- aConstraints.gridx = 0;
1697
- aConstraints.gridy += 1;
1698
- aConstraints.gridwidth = 1;
1632
+ panel.add(new JSeparator());
1633
+
1634
+ panel.add(globalSection);
1635
+
1636
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1637
+
1638
+ cGridBag textureSection = new cGridBag().setVertical(true);
16991639
1700
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1701
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1702
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1703
- aConstraints.gridx += 1;
1704
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1705
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1706
- aConstraints.gridx = 0;
1707
- aConstraints.gridy += 1;
1708
- aConstraints.gridwidth = 1;
1640
+ cGridBag bump = new cGridBag();
1641
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1642
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1643
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1644
+ textureSection.add(bump);
17091645
1710
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1711
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1712
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1713
- aConstraints.gridx += 1;
1714
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1715
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1716
- aConstraints.gridx = 0;
1717
- aConstraints.gridy += 1;
1718
- aConstraints.gridwidth = 1;
1646
+ cGridBag noise = new cGridBag();
1647
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1648
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1649
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1650
+ textureSection.add(noise);
17191651
1720
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1721
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1722
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1723
- aConstraints.gridx += 1;
1724
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1725
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1726
- aConstraints.gridx = 0;
1727
- aConstraints.gridy += 1;
1728
- aConstraints.gridwidth = 1;
1652
+ cGridBag power = new cGridBag();
1653
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1654
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1655
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1656
+ textureSection.add(power);
17291657
1730
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1731
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1732
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1733
- aConstraints.gridx += 1;
1734
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1735
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1736
- aConstraints.gridx = 0;
1737
- aConstraints.gridy += 1;
1738
- aConstraints.gridwidth = 1;
1658
+ cGridBag borderfade = new cGridBag();
1659
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1660
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1661
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1662
+ textureSection.add(borderfade);
17391663
1740
- //aConstraints.weighty = 1;
1741
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1742
- //aConstraints.gridx += 1;
1743
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1744
- aConstraints.weighty = 0;
1664
+ cGridBag fog = new cGridBag();
1665
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1666
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1667
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1668
+ textureSection.add(fog);
17451669
1746
- aConstraints.gridx = 0;
1747
- aConstraints.gridy = 0;
1748
- aConstraints.gridwidth = 1;
1670
+ cGridBag opacityPower = new cGridBag();
1671
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1672
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1673
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1674
+ textureSection.add(opacityPower);
1675
+
1676
+ panel.add(new JSeparator());
1677
+
1678
+ panel.add(textureSection);
1679
+
1680
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17491681
17501682 SetMaterial(copy); // .GetMaterial());
17511683
1752
- colorField.addChangeListener(this);
1753
- modulationField.addChangeListener(this);
1684
+ //colorField.addChangeListener(this);
1685
+// modulationField.addChangeListener(this);
17541686 metalnessField.addChangeListener(this);
17551687 diffuseField.addChangeListener(this);
17561688 specularField.addChangeListener(this);
....@@ -1859,19 +1791,21 @@
18591791 }
18601792
18611793 // Images/textures
1862
- if (textures
1863
- && (filename.toLowerCase().endsWith(".jpg")
1864
- || filename.toLowerCase().endsWith(".jpeg")
1865
- || filename.toLowerCase().endsWith(".gif")
1866
- || filename.toLowerCase().endsWith(".png")
1867
- || filename.toLowerCase().endsWith(".tre")
1868
- || filename.toLowerCase().endsWith(".bmp")
1869
- || filename.toLowerCase().endsWith(".tga")
1870
- || filename.toLowerCase().endsWith(".sgi")
1871
- || filename.toLowerCase().endsWith(".tif")
1872
- || filename.toLowerCase().endsWith(".tiff")))
1794
+ if (filename.toLowerCase().endsWith(".jpg")
1795
+ || filename.toLowerCase().endsWith(".jpeg")
1796
+ || filename.toLowerCase().endsWith(".gif")
1797
+ || filename.toLowerCase().endsWith(".png")
1798
+ || filename.toLowerCase().endsWith(".tre")
1799
+ || filename.toLowerCase().endsWith(".bmp")
1800
+ || filename.toLowerCase().endsWith(".tga")
1801
+ || filename.toLowerCase().endsWith(".sgi")
1802
+ || filename.toLowerCase().endsWith(".tif")
1803
+ || filename.toLowerCase().endsWith(".tiff"))
18731804 {
1874
- DropTexture(filename);
1805
+ if (textures)
1806
+ DropTexture(filename);
1807
+ else
1808
+ CreateBillboard(filename);
18751809 continue;
18761810 }
18771811
....@@ -1880,6 +1814,60 @@
18801814 }
18811815
18821816 ResetModel();
1817
+ }
1818
+
1819
+ void CreateBillboard(String filename)
1820
+ {
1821
+ Object3D source = null;
1822
+ Object3D group = copy;
1823
+
1824
+ if (group.selection.size() > 0)
1825
+ {
1826
+ source = group.selection.get(0);
1827
+ }
1828
+
1829
+ Grid grid = new Grid(1,1);
1830
+ grid.material = null;
1831
+
1832
+ grid.toParent = LA.newMatrix();
1833
+ grid.fromParent = LA.newMatrix();
1834
+ LA.matYRotate(grid.toParent, Math.PI/2);
1835
+ LA.matXRotate(grid.toParent, -Math.PI/2);
1836
+ LA.matXRotate(grid.fromParent, Math.PI/2);
1837
+ LA.matYRotate(grid.fromParent, -Math.PI/2);
1838
+
1839
+ BillboardNode bb = new BillboardNode();
1840
+ bb.addChild(grid);
1841
+
1842
+ Object3D newgroup = new Object3D();
1843
+ newgroup.CreateMaterial();
1844
+
1845
+ File file = new File(filename);
1846
+ newgroup.name = file.getName();
1847
+ newgroup.addChild(bb);
1848
+
1849
+ Object3D main = newgroup;
1850
+
1851
+ main.SetPigmentTexture(filename);
1852
+
1853
+ if (source != null)
1854
+ {
1855
+ main.material = new cMaterial(source.material);
1856
+ if (main.projectedVertices.length < source.projectedVertices.length)
1857
+ {
1858
+ main.projectedVertices = new Object3D.cVector2[source.projectedVertices.length];
1859
+ }
1860
+
1861
+ for (int i=0; i<source.projectedVertices.length; i++)
1862
+ {
1863
+ main.projectedVertices[i].x = source.projectedVertices[i].x;
1864
+ main.projectedVertices[i].y = source.projectedVertices[i].y;
1865
+ }
1866
+
1867
+ main.texres = source.texres;
1868
+ }
1869
+
1870
+ makeSomething(newgroup, false);
18831871 }
18841872
18851873 Point location;
....@@ -2138,6 +2126,8 @@
21382126 {
21392127 Mocap sel = (Mocap) copy.selection.get(0);
21402128
2129
+ sel.SetCurrentBones(sel.frame);
2130
+
21412131 sel.fullname = fullname;
21422132
21432133 if (changename)
....@@ -2151,14 +2141,18 @@
21512141 sel.smoothed = false;
21522142
21532143 // if (!changename)
2154
- sel.SetPositionDelta(false, true, true, true/*?*/); // false
2144
+ //sel.SetPositionDelta(false, true, true, true/*?*/); // false
2145
+ sel.SetGlobalTransform();
2146
+ sel.LoadData();
2147
+ sel.Rewind();
2148
+ sel.Fade();
21552149 // sel.setPose(0);
21562150 refreshContents();
21572151 } else
21582152 {
21592153 mocap.Reset();
21602154 // new skeleton
2161
- makeSomething(mocap, false); // true);
2155
+ makeSomething(mocap, true); // true);
21622156 }
21632157 } catch (Exception e)
21642158 {
....@@ -2185,6 +2179,8 @@
21852179 {
21862180 Mocap sel = (Mocap) select;
21872181
2182
+ sel.SetCurrentBones(sel.frame);
2183
+
21882184 File file = new File(fullname);
21892185
21902186 // Mocap mocap = new Mocap("Mocap" + file.getName());
....@@ -2251,7 +2247,11 @@
22512247
22522248 if (!changename)
22532249 {
2254
- sel.SetPositionDelta(false, true, true, true/*?*/);
2250
+ //sel.SetPositionDelta(false, true, true, true/*?*/);
2251
+ sel.SetGlobalTransform();
2252
+ sel.LoadData();
2253
+ sel.Rewind();
2254
+ sel.Fade();
22552255 }
22562256
22572257 // sel.setPose(0);
....@@ -2345,7 +2345,7 @@
23452345
23462346 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23472347 {
2348
- if (GraphreeD.standAlone)
2348
+ if (GrafreeD.standAlone)
23492349 {
23502350 /**/
23512351 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
....@@ -2494,6 +2494,7 @@
24942494 }
24952495 if (input == null)
24962496 {
2497
+ new Exception().printStackTrace();
24972498 System.exit(0);
24982499 }
24992500
....@@ -2890,20 +2891,37 @@
28902891 // june 2013 copy.HardTouch();
28912892 cameraView.repaint();
28922893 return;
2893
- } else if (event.getSource() == toggleFullItem)
2894
+ } else if (event.getSource() == toggleTimelineItem)
28942895 {
2895
- if (CameraPane.FULLSCREEN)
2896
+ timeline ^= true;
2897
+
2898
+ if (timeline)
28962899 {
2897
- frame.getContentPane().remove(/*"Center",*/bigThree);
2898
- framePanel.add(bigThree);
2899
- frame.getContentPane().add(/*"Center",*/framePanel);
2900
- } else
2901
- {
2902
- frame.getContentPane().remove(/*"Center",*/framePanel);
2903
- frame.getContentPane().add(/*"Center",*/bigThree);
2900
+ centralPanel.remove(cameraView);
2901
+ cameraPanel.add(cameraView);
2902
+ centralPanel.add(cameraPanel);
2903
+ frame.setJMenuBar(timelineMenubar);
2904
+ wasFullScreen = CameraPane.FULLSCREEN;
2905
+ if (!CameraPane.FULLSCREEN)
2906
+ ToggleFullScreen();
2907
+ toggleFullScreenItem.setEnabled(false);
29042908 }
2909
+ else
2910
+ {
2911
+ centralPanel.remove(cameraPanel);
2912
+ centralPanel.add(cameraView);
2913
+ frame.setJMenuBar(null);
2914
+ if (!wasFullScreen)
2915
+ ToggleFullScreen();
2916
+ toggleFullScreenItem.setEnabled(true);
2917
+ }
2918
+
29052919 frame.validate();
2906
- cameraView.ToggleFullScreen();
2920
+ return;
2921
+ } else if (event.getSource() == toggleFullScreenItem)
2922
+ {
2923
+ ToggleFullScreen();
2924
+ frame.validate();
29072925
29082926 return;
29092927 } else if (event.getSource() == toggleRandomItem)
....@@ -3013,7 +3031,8 @@
30133031 objEditor.refreshContents();
30143032 } else if (event.getSource() == stepItem)
30153033 {
3016
- cameraView.ONESTEP = true;
3034
+ //cameraView.ONESTEP = true;
3035
+ Globals.ONESTEP = true;
30173036 cameraView.repaint();
30183037 return;
30193038 } else if (event.getSource() == stepButton)
....@@ -3152,9 +3171,9 @@
31523171 cameraView.RevertCamera();
31533172 cameraView.repaint();
31543173 return;
3155
- } else if (event.getSource() == textureButton)
3156
- {
3157
- return; // true;
3174
+// } else if (event.getSource() == textureButton)
3175
+// {
3176
+// return; // true;
31583177 } else // combos...
31593178 if (event.getSource() == texresMenu)
31603179 {
....@@ -3170,25 +3189,25 @@
31703189
31713190 void ToggleAnimation()
31723191 {
3173
- if (!CameraPane.ANIMATION)
3192
+ if (!Globals.ANIMATION)
31743193 {
31753194 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
31763195 browser.show();
31773196 String filename = browser.getFile();
31783197 if (filename != null && filename.length() > 0)
31793198 {
3180
- CameraPane.filename = browser.getDirectory() + filename;
3199
+ Globals.filename = browser.getDirectory() + filename;
31813200 //CameraPane.framecount = 0;
3182
- CameraPane.imagecount = 0;
3201
+ Globals.imagecount = 0;
31833202
3184
- CameraPane.ANIMATION ^= true;
3203
+ Globals.ANIMATION ^= true;
31853204
3186
- GraphreeD.wav.cursor = 0;
3187
- GraphreeD.wav.loop = 0;
3205
+ GrafreeD.wav.cursor = 0;
3206
+ GrafreeD.wav.loop = 0;
31883207 }
31893208 } else
31903209 {
3191
- CameraPane.ANIMATION ^= true;
3210
+ Globals.ANIMATION ^= true;
31923211 }
31933212 }
31943213
....@@ -3205,6 +3224,7 @@
32053224 callee.refreshContents();
32063225 } else
32073226 {
3227
+ new Exception().printStackTrace();
32083228 System.exit(0);
32093229 }
32103230 }
....@@ -3367,7 +3387,7 @@
33673387 current.fakedepth = (float) fakedepthField.getFloat();
33683388 current.shadowbias = (float) shadowbiasField.getFloat();
33693389
3370
- if (!NumberSlider.frozen)
3390
+ if (!cNumberSlider.frozen)
33713391 {
33723392 //System.out.println("Propagate = " + propagate);
33733393 copy.UpdateMaterial(anchor, current, propagate);
....@@ -3415,6 +3435,7 @@
34153435 || e.getSource() == apertureField
34163436 || e.getSource() == shadowblurField)
34173437 {
3438
+ new Exception().printStackTrace();
34183439 System.exit(0);
34193440 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34203441 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3441,7 +3462,13 @@
34413462 //System.out.println("PARENT = " + parent);
34423463 //if (parent != null)
34433464 // parent.applySelf();
3444
- refreshContents();
3465
+ if (e.getSource() == normalpushField)
3466
+ {
3467
+ objEditor.refreshContents();
3468
+ //Refresh();
3469
+ }
3470
+ else
3471
+ refreshContents();
34453472 // ??? client.refreshEditWindow();
34463473 }
34473474 //else
....@@ -3453,7 +3480,7 @@
34533480 //group.name = nameField.getText();
34543481 //objEditor.applySelf();
34553482
3456
- assert (objEditor == this);
3483
+ // OCT2018: assert (objEditor == this);
34573484 if (copy.selection == null || copy.selection.size() == 0)
34583485 //super.applySelf()
34593486 ; else
....@@ -3477,12 +3504,18 @@
34773504 objEditor.copy = keep;
34783505 }
34793506 }
3507
+
3508
+ if (normalpushField != null)
3509
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
34803510 }
34813511
34823512 void SnapObject()
34833513 {
3484
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3485
- SnapObject(obj);
3514
+ if (copy.selection.size() > 0)
3515
+ {
3516
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
3517
+ SnapObject(obj);
3518
+ }
34863519 }
34873520
34883521 void SnapObject(Object3D obj)
....@@ -3596,7 +3629,7 @@
35963629
35973630 if (obj.parent != null)
35983631 {
3599
- obj.parent.TransformToWorld(interest);
3632
+// obj.parent.TransformToWorld(interest);
36003633 }
36013634
36023635 if (!CameraPane.TRACK)
....@@ -3728,7 +3761,7 @@
37283761
37293762 radioPanel.revalidate();
37303763 radioPanel.repaint();
3731
- ctrlPanel.revalidate(); // ? new
3764
+ ctrlPanel.validate(); // ? new
37323765 ctrlPanel.repaint();
37333766 }
37343767 }
....@@ -4085,7 +4118,7 @@
40854118
40864119 void load() // throws ClassNotFoundException
40874120 {
4088
- if (GraphreeD.standAlone)
4121
+ if (GrafreeD.standAlone)
40894122 {
40904123 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
40914124 browser.show();
....@@ -4190,7 +4223,7 @@
41904223
41914224 void saveAs()
41924225 {
4193
- if (GraphreeD.standAlone)
4226
+ if (GrafreeD.standAlone)
41944227 {
41954228 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
41964229 browser.setVisible(true);
....@@ -4213,10 +4246,20 @@
42134246
42144247 Object3D object = copy.selection.get(0);
42154248
4249
+ FileObject fileobj = null;
4250
+
4251
+ if (object instanceof FileObject)
4252
+ fileobj = (FileObject)object;
4253
+
42164254 if (object.fileparent != null)
42174255 {
4218
- FileObject fileobj = (FileObject) object.fileparent;
4256
+ assert(fileobj == null);
42194257
4258
+ fileobj = (FileObject) object.fileparent;
4259
+ }
4260
+
4261
+ if (fileobj != null)
4262
+ {
42204263 System.out.println("WriteObject " + object + " : " + fileobj.name);
42214264 WriteObject(object, fileobj.name);
42224265 }
....@@ -4259,7 +4302,7 @@
42594302 }
42604303 }
42614304 else
4262
- //if (GraphreeD.standAlone)
4305
+ //if (GrafreeD.standAlone)
42634306 {
42644307 FileDialog browser = new FileDialog(frame, "Export", FileDialog.SAVE);
42654308 browser.setVisible(true);
....@@ -4291,7 +4334,7 @@
42914334 Object3D objectparent = obj.parent;
42924335 obj.parent = null;
42934336
4294
- Object3D object = (Object3D) GraphreeD.clone(obj);
4337
+ Object3D object = (Object3D) GrafreeD.clone(obj);
42954338
42964339 obj.parent = objectparent;
42974340
....@@ -4325,7 +4368,7 @@
43254368 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43264369 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43274370 copy.generatePOV(buffer);
4328
- if (GraphreeD.standAlone)
4371
+ if (GrafreeD.standAlone)
43294372 {
43304373 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43314374 browser.show();
....@@ -4364,9 +4407,10 @@
43644407 //MenuItem normalLensItem;
43654408 MenuItem editCameraItem;
43664409 MenuItem revertCameraItem;
4367
- CheckboxMenuItem toggleLiveItem;
43684410 MenuItem stepItem;
4369
- CheckboxMenuItem toggleFullItem;
4411
+ CheckboxMenuItem toggleLiveItem;
4412
+ CheckboxMenuItem toggleFullScreenItem;
4413
+ CheckboxMenuItem toggleTimelineItem;
43704414 CheckboxMenuItem toggleRenderItem;
43714415 CheckboxMenuItem toggleDebugItem;
43724416 CheckboxMenuItem toggleFrustumItem;
....@@ -4384,20 +4428,23 @@
43844428 JPanel treePanel;
43854429 JPanel radioPanel;
43864430 ButtonGroup buttonGroup;
4387
- JPanel ctrlPanel;
4388
- JPanel materialPanel;
4431
+ cGridBag ctrlPanel;
4432
+ cGridBag materialPanel;
43894433 JScrollPane infoPanel;
4390
- JPanel optionsPanel;
4434
+ cGridBag optionsPanel;
43914435 JTabbedPane objectPanel;
4392
- JPanel XYZPanel;
4436
+ cGridBag XYZPanel;
43934437 JSplitPane gridPanel;
43944438 JSplitPane bigPanel;
4395
- JPanel bigThree;
4396
- JTabbedPane jtp;
4397
- JPanel cameraPanel;
4439
+ cGridBag bigThree;
4440
+ cGridBag scenePanel;
4441
+ cGridBag centralPanel;
4442
+ JSplitPane cameraPanel;
4443
+ JPanel timelinePanel;
4444
+ JMenuBar timelineMenubar;
43984445 JSplitPane framePanel;
43994446 JTextArea/*Field*/ nameField;
4400
- cButton textureButton;
4447
+ //cButton textureButton;
44014448 cButton okButton;
44024449 cButton applyButton;
44034450 cButton cancelButton;
....@@ -4444,65 +4491,67 @@
44444491 // MATERIAL
44454492 JLabel materialLabel;
44464493 JLabel colorLabel;
4447
- NumberSlider colorField;
4494
+ cNumberSlider colorField;
44484495 JLabel modulationLabel;
4449
- NumberSlider modulationField;
4496
+ cNumberSlider modulationField;
44504497 JLabel metalnessLabel;
4451
- NumberSlider metalnessField;
4498
+ cNumberSlider metalnessField;
44524499 JLabel diffuseLabel;
4453
- NumberSlider diffuseField;
4500
+ cNumberSlider diffuseField;
44544501 JLabel specularLabel;
4455
- NumberSlider specularField;
4502
+ cNumberSlider specularField;
44564503 JLabel shininessLabel;
4457
- NumberSlider shininessField;
4504
+ cNumberSlider shininessField;
44584505 JLabel shiftLabel;
4459
- NumberSlider shiftField;
4506
+ cNumberSlider shiftField;
44604507 JLabel ambientLabel;
4461
- NumberSlider ambientField;
4508
+ cNumberSlider ambientField;
44624509 JLabel lightareaLabel;
4463
- NumberSlider lightareaField;
4510
+ cNumberSlider lightareaField;
44644511 JLabel diffusenessLabel;
4465
- NumberSlider diffusenessField;
4512
+ cNumberSlider diffusenessField;
44664513 JLabel velvetLabel;
4467
- NumberSlider velvetField;
4514
+ cNumberSlider velvetField;
44684515 JLabel sheenLabel;
4469
- NumberSlider sheenField;
4516
+ cNumberSlider sheenField;
44704517 JLabel subsurfaceLabel;
4471
- NumberSlider subsurfaceField;
4518
+ cNumberSlider subsurfaceField;
44724519 //JLabel bumpLabel;
44734520 //NumberSlider bumpField;
44744521 JLabel backlitLabel;
4475
- NumberSlider backlitField;
4522
+ cNumberSlider backlitField;
44764523 JLabel anisoLabel;
4477
- NumberSlider anisoField;
4524
+ cNumberSlider anisoField;
44784525 JLabel anisoVLabel;
4479
- NumberSlider anisoVField;
4526
+ cNumberSlider anisoVField;
44804527 JLabel cameraLabel;
4481
- NumberSlider cameraField;
4528
+ cNumberSlider cameraField;
44824529 JLabel selfshadowLabel;
4483
- NumberSlider selfshadowField;
4530
+ cNumberSlider selfshadowField;
44844531 JLabel shadowLabel;
4485
- NumberSlider shadowField;
4532
+ cNumberSlider shadowField;
44864533 JLabel textureLabel;
4487
- NumberSlider textureField;
4534
+ cNumberSlider textureField;
44884535 JLabel opacityLabel;
4489
- NumberSlider opacityField;
4536
+ cNumberSlider opacityField;
44904537 JLabel fakedepthLabel;
4491
- NumberSlider fakedepthField;
4538
+ cNumberSlider fakedepthField;
44924539 JLabel shadowbiasLabel;
4493
- NumberSlider shadowbiasField;
4540
+ cNumberSlider shadowbiasField;
44944541 JLabel bumpLabel;
4495
- NumberSlider bumpField;
4542
+ cNumberSlider bumpField;
44964543 JLabel noiseLabel;
4497
- NumberSlider noiseField;
4544
+ cNumberSlider noiseField;
44984545 JLabel powerLabel;
4499
- NumberSlider powerField;
4546
+ cNumberSlider powerField;
45004547 JLabel borderfadeLabel;
4501
- NumberSlider borderfadeField;
4548
+ cNumberSlider borderfadeField;
45024549 JLabel fogLabel;
4503
- NumberSlider fogField;
4550
+ cNumberSlider fogField;
45044551 JLabel opacityPowerLabel;
4505
- NumberSlider opacityPowerField;
4552
+ cNumberSlider opacityPowerField;
45064553 JTree jTree;
45074554 //ObjectUI parent;
4555
+
4556
+ cNumberSlider normalpushField;
45084557 }