Normand Briere
2019-05-01 504890a7b930ab6b853c49de825ae848e0535339
ObjEditor.java
....@@ -138,34 +138,40 @@
138138 public void closeUI()
139139 {
140140 //new Exception().printStackTrace();
141
- System.out.println("this = " + this);
142
- System.out.println("objEditor = " + objEditor);
141
+// System.out.println("this = " + this);
142
+// System.out.println("objEditor = " + objEditor);
143143 //nameField.removeActionListener(this);
144
- objEditor.ctrlPanel.remove(nameField);
144
+// objEditor.ctrlPanel.remove(nameField);
145145
146146 if (!GroupEditor.allparams)
147147 return;
148148
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);
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);
167167
168
- Remove(normalpushField);
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);
169175 }
170176
171177 public ObjEditor GetEditor()
....@@ -355,7 +361,7 @@
355361 toolbarPanel.setName("Toolbar");
356362 treePanel = new JPanel();
357363 treePanel.setName("Tree");
358
- ctrlPanel = new cGridBag(); // new GridBagLayout());
364
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
359365 ctrlPanel.setName("Edit");
360366 materialPanel = new cGridBag().setVertical(true);
361367 materialPanel.setName("Material");
....@@ -386,7 +392,7 @@
386392 //mainPanel.setLayout(new GridBagLayout());
387393 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
388394 treePanel.setLayout(new GridBagLayout());
389
- ctrlPanel.setLayout(new GridBagLayout());
395
+ //ctrlPanel.setLayout(new GridBagLayout());
390396 //materialPanel.setLayout(new GridBagLayout());
391397
392398 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
....@@ -767,54 +773,44 @@
767773 JButton slowerButton;
768774 JButton fasterButton;
769775 JButton remarkButton;
776
+
777
+ cGridBag namePanel;
778
+ cGridBag setupPanel;
779
+ cGridBag commandsPanel;
780
+ cGridBag pushPanel;
781
+ cGridBag fillPanel;
770782
771
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
783
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
772784 {
773785 JCheckBox cb;
774786
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);
787
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
780788 cb.addItemListener(this);
781
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
782
- oe.aConstraints.gridwidth = 1;
783
- oe.aConstraints.gridx += 1;
784789
785790 return cb;
786791 }
787792
788
- cButton AddButton(ObjEditor oe, String label)
793
+ cButton AddButton(cGridBag panel, String label)
789794 {
790795 cButton cb;
791796
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);
797
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
797798 cb.addActionListener(this);
798
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
799
- oe.aConstraints.gridwidth = 1;
800
- oe.aConstraints.gridx += 1;
801799
802800 return cb;
803801 }
804802
805
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
803
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
806804 {
807805 JComboBox combo;
808806
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;
807
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812808 combo.addActionListener(this);
813809
814810 return combo;
815811 }
816812
817
- cNumberSlider AddSlider(cGridBag 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)
818814 {
819815 cGridBag control = new cGridBag();
820816
....@@ -826,12 +822,12 @@
826822 control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827823 combo.setFloat(current);
828824
829
- ctrlPanel.add(control);
825
+ panel.add(control);
830826
831
- return combo;
827
+ return control;
832828 }
833829
834
- cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current)
830
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
835831 {
836832 cGridBag control = new cGridBag();
837833
....@@ -839,25 +835,21 @@
839835
840836 JLabel jlabel = new JLabel(label);
841837 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
842
- ctrlPanel.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
843
- ctrlPanel.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
838
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
839
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
844840 combo.setInteger(current);
845841
846
- ctrlPanel.add(control);
842
+ panel.add(control);
847843
848
- return combo;
844
+ return control;
849845 }
850846
851847 JTextArea AddText(cGridBag ctrlPanel, String name)
852848 {
853849 JTextArea text;
854850
855
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
856
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
857851 ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
858852 text.addCaretListener(this);
859
- aConstraints.gridx += 1;
860
- aConstraints.gridwidth = 1;
861853
862854 return text;
863855 }
....@@ -896,7 +888,7 @@
896888
897889 /*
898890 */
899
- void Return() // ObjEditor oe)
891
+ void Return0() // ObjEditor oe)
900892 {
901893 aConstraints.gridy += 1;
902894 aConstraints.gridx = 0;
....@@ -955,33 +947,52 @@
955947 // oe.aConstraints.weighty = 0;
956948 // oe.aConstraints.gridx = 0;
957949 // oe.aConstraints.gridy = 0;
958
- 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();
959959
960960 if (!GroupEditor.allparams)
961961 return;
962962
963
- liveCB = AddCheckBox(oe, "Live", copy.live);
964
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
965
- 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);
966968 // Return();
967
- markCB = AddCheckBox(oe, "Mark", copy.marked);
968
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
969
- randomCB = AddCheckBox(oe, "Rand", copy.random);
970
- Return();
971
- resetButton = AddButton(oe, "Reset");
972
- 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");
973980 // resetAllButton = AddButton(oe, "Reset All");
974981 // stepAllButton = AddButton(oe, "Step All");
975
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
982
+ speedupCB = AddCheckBox(commandsPanel, "Speed", copy.speedup);
976983 // Return();
977
- slowerButton = AddButton(oe, "Slow");
978
- fasterButton = AddButton(oe, "Fast");
979
- remarkButton = AddButton(oe, "Rem");
984
+ slowerButton = AddButton(commandsPanel, "Slow");
985
+ fasterButton = AddButton(commandsPanel, "Fast");
986
+ remarkButton = AddButton(commandsPanel, "Remark");
980987
981
- //Return();
988
+ oe.ctrlPanel.add(commandsPanel);
989
+ oe.ctrlPanel.Return();
982990
983
- //normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
991
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1);
992
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
984993 //Return();
994
+
995
+ oe.ctrlPanel.Return();
985996
986997 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
987998 // ObjEditor.aConstraints.gridx += 1;
....@@ -1076,7 +1087,7 @@
10761087 oe.aConstraints.gridwidth = 1;
10771088 /**/
10781089 nameField = AddText(oe.ctrlPanel, copy.GetName());
1079
- Return();
1090
+ oe.ctrlPanel.Return();
10801091
10811092 //ctrlPanel.add(textureButton = new Button("Texture..."));
10821093 //textureButton.setEnabled(false);
....@@ -1253,10 +1264,11 @@
12531264 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12541265 //tmp.setName("Edit");
12551266 objectPanel.add(materialPanel);
1256
- JPanel north = new JPanel(new BorderLayout());
1257
- north.setName("Edit");
1258
- north.add(ctrlPanel, BorderLayout.NORTH);
1259
- 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);
12601272 objectPanel.add(infoPanel);
12611273
12621274 /*
....@@ -1415,7 +1427,7 @@
14151427 ctrlPanel.removeAll();
14161428 }
14171429
1418
- void SetupMaterial(cGridBag ctrlPanel)
1430
+ void SetupMaterial(cGridBag panel)
14191431 {
14201432 /*
14211433 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
....@@ -1435,7 +1447,7 @@
14351447 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
14361448 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
14371449
1438
- ctrlPanel.add(editBar);
1450
+ panel.add(editBar);
14391451
14401452 /**/
14411453 //aConstraints.weighty = 0;
....@@ -1484,9 +1496,9 @@
14841496 shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
14851497 colorSection.add(shadowbias);
14861498
1487
- ctrlPanel.add(new JSeparator());
1499
+ panel.add(new JSeparator());
14881500
1489
- ctrlPanel.add(colorSection);
1501
+ panel.add(colorSection);
14901502
14911503 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14921504
....@@ -1534,9 +1546,9 @@
15341546 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15351547 diffuseSection.add(fakedepth);
15361548
1537
- ctrlPanel.add(new JSeparator());
1549
+ panel.add(new JSeparator());
15381550
1539
- ctrlPanel.add(diffuseSection);
1551
+ panel.add(diffuseSection);
15401552
15411553 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15421554
....@@ -1572,7 +1584,7 @@
15721584 velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15731585 specularSection.add(velvet);
15741586
1575
- shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1);
1587
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
15761588 //Return();
15771589 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
15781590 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
....@@ -1585,9 +1597,9 @@
15851597 // aConstraints.gridwidth = 1;
15861598
15871599
1588
- ctrlPanel.add(new JSeparator());
1600
+ panel.add(new JSeparator());
15891601
1590
- ctrlPanel.add(specularSection);
1602
+ panel.add(specularSection);
15911603
15921604 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15931605
....@@ -1617,9 +1629,9 @@
16171629 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
16181630 globalSection.add(opacity);
16191631
1620
- ctrlPanel.add(new JSeparator());
1632
+ panel.add(new JSeparator());
16211633
1622
- ctrlPanel.add(globalSection);
1634
+ panel.add(globalSection);
16231635
16241636 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16251637
....@@ -1661,9 +1673,9 @@
16611673 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
16621674 textureSection.add(opacityPower);
16631675
1664
- ctrlPanel.add(new JSeparator());
1676
+ panel.add(new JSeparator());
16651677
1666
- ctrlPanel.add(textureSection);
1678
+ panel.add(textureSection);
16671679
16681680 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16691681
....@@ -2482,6 +2494,7 @@
24822494 }
24832495 if (input == null)
24842496 {
2497
+ new Exception().printStackTrace();
24852498 System.exit(0);
24862499 }
24872500
....@@ -3211,6 +3224,7 @@
32113224 callee.refreshContents();
32123225 } else
32133226 {
3227
+ new Exception().printStackTrace();
32143228 System.exit(0);
32153229 }
32163230 }
....@@ -3421,6 +3435,7 @@
34213435 || e.getSource() == apertureField
34223436 || e.getSource() == shadowblurField)
34233437 {
3438
+ new Exception().printStackTrace();
34243439 System.exit(0);
34253440 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34263441 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -4392,8 +4407,8 @@
43924407 //MenuItem normalLensItem;
43934408 MenuItem editCameraItem;
43944409 MenuItem revertCameraItem;
4395
- CheckboxMenuItem toggleLiveItem;
43964410 MenuItem stepItem;
4411
+ CheckboxMenuItem toggleLiveItem;
43974412 CheckboxMenuItem toggleFullScreenItem;
43984413 CheckboxMenuItem toggleTimelineItem;
43994414 CheckboxMenuItem toggleRenderItem;