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);
984
- Return();
991
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1);
992
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
993
+ //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;
....@@ -1445,17 +1457,13 @@
14451457 //aConstraints.gridx += 1;
14461458 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14471459
1448
- JPanel colorPanel = new JPanel(new BorderLayout());
1449
- colorPanel.setBorder(BorderFactory.createLineBorder(Color.black));
1450
-
14511460 cGridBag colorSection = new cGridBag().setVertical(true);
1452
-
1453
- colorPanel.add(colorSection);
14541461
14551462 cGridBag color = new cGridBag();
14561463 color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
14571464 colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
14581465 color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1466
+ //colorField.preferredWidth = 200;
14591467 colorSection.add(color);
14601468
14611469 cGridBag modulation = new cGridBag();
....@@ -1488,16 +1496,13 @@
14881496 shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
14891497 colorSection.add(shadowbias);
14901498
1491
- ctrlPanel.add(colorPanel);
1499
+ panel.add(new JSeparator());
1500
+
1501
+ panel.add(colorSection);
14921502
14931503 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14941504
1495
- JPanel diffusePanel = new JPanel(new BorderLayout());
1496
- diffusePanel.setBorder(BorderFactory.createLineBorder(Color.black));
1497
-
14981505 cGridBag diffuseSection = new cGridBag().setVertical(true);
1499
-
1500
- diffusePanel.add(diffuseSection);
15011506
15021507 cGridBag diffuse = new cGridBag();
15031508 diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
....@@ -1541,16 +1546,13 @@
15411546 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15421547 diffuseSection.add(fakedepth);
15431548
1544
- ctrlPanel.add(diffusePanel);
1549
+ panel.add(new JSeparator());
1550
+
1551
+ panel.add(diffuseSection);
15451552
15461553 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15471554
1548
- JPanel specularPanel = new JPanel(new BorderLayout());
1549
- specularPanel.setBorder(BorderFactory.createLineBorder(Color.black));
1550
-
15511555 cGridBag specularSection = new cGridBag().setVertical(true);
1552
-
1553
- specularPanel.add(specularSection);
15541556
15551557 cGridBag specular = new cGridBag();
15561558 specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
....@@ -1582,7 +1584,7 @@
15821584 velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15831585 specularSection.add(velvet);
15841586
1585
- 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);
15861588 //Return();
15871589 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
15881590 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
....@@ -1595,16 +1597,13 @@
15951597 // aConstraints.gridwidth = 1;
15961598
15971599
1598
- ctrlPanel.add(specularPanel);
1600
+ panel.add(new JSeparator());
1601
+
1602
+ panel.add(specularSection);
15991603
16001604 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16011605
1602
- JPanel globalPanel = new JPanel(new BorderLayout());
1603
- globalPanel.setBorder(BorderFactory.createLineBorder(Color.black));
1604
-
16051606 cGridBag globalSection = new cGridBag().setVertical(true);
1606
-
1607
- globalPanel.add(globalSection);
16081607
16091608 cGridBag camera = new cGridBag();
16101609 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
....@@ -1630,16 +1629,13 @@
16301629 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
16311630 globalSection.add(opacity);
16321631
1633
- ctrlPanel.add(globalPanel);
1632
+ panel.add(new JSeparator());
1633
+
1634
+ panel.add(globalSection);
16341635
16351636 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16361637
1637
- JPanel texturePanel = new JPanel(new BorderLayout());
1638
- texturePanel.setBorder(BorderFactory.createLineBorder(Color.black));
1639
-
16401638 cGridBag textureSection = new cGridBag().setVertical(true);
1641
-
1642
- texturePanel.add(textureSection);
16431639
16441640 cGridBag bump = new cGridBag();
16451641 bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
....@@ -1677,7 +1673,9 @@
16771673 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
16781674 textureSection.add(opacityPower);
16791675
1680
- ctrlPanel.add(texturePanel);
1676
+ panel.add(new JSeparator());
1677
+
1678
+ panel.add(textureSection);
16811679
16821680 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16831681
....@@ -2496,6 +2494,7 @@
24962494 }
24972495 if (input == null)
24982496 {
2497
+ new Exception().printStackTrace();
24992498 System.exit(0);
25002499 }
25012500
....@@ -3225,6 +3224,7 @@
32253224 callee.refreshContents();
32263225 } else
32273226 {
3227
+ new Exception().printStackTrace();
32283228 System.exit(0);
32293229 }
32303230 }
....@@ -3435,6 +3435,7 @@
34353435 || e.getSource() == apertureField
34363436 || e.getSource() == shadowblurField)
34373437 {
3438
+ new Exception().printStackTrace();
34383439 System.exit(0);
34393440 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34403441 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -4406,8 +4407,8 @@
44064407 //MenuItem normalLensItem;
44074408 MenuItem editCameraItem;
44084409 MenuItem revertCameraItem;
4409
- CheckboxMenuItem toggleLiveItem;
44104410 MenuItem stepItem;
4411
+ CheckboxMenuItem toggleLiveItem;
44114412 CheckboxMenuItem toggleFullScreenItem;
44124413 CheckboxMenuItem toggleTimelineItem;
44134414 CheckboxMenuItem toggleRenderItem;