Normand Briere
2019-06-09 3ae9b1de47e51e7c150412f2bb14383cb6a5f8f8
ObjEditor.java
....@@ -138,34 +138,41 @@
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);
145
+
146
+ objEditor.ctrlPanel.remove(namePanel);
145147
146148 if (!GroupEditor.allparams)
147149 return;
148150
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);
151
+// objEditor.ctrlPanel.remove(liveCB);
152
+// objEditor.ctrlPanel.remove(hideCB);
153
+// objEditor.ctrlPanel.remove(markCB);
154
+//
155
+// objEditor.ctrlPanel.remove(randomCB);
156
+// objEditor.ctrlPanel.remove(speedupCB);
157
+// objEditor.ctrlPanel.remove(rewindCB);
158
+//
159
+// objEditor.ctrlPanel.remove(resetButton);
160
+// objEditor.ctrlPanel.remove(stepButton);
161
+//// objEditor.ctrlPanel.remove(stepAllButton);
162
+//// objEditor.ctrlPanel.remove(resetAllButton);
163
+// objEditor.ctrlPanel.remove(link2masterCB);
164
+// //objEditor.ctrlPanel.remove(flipVCB);
165
+// //objEditor.ctrlPanel.remove(texresMenu);
166
+// objEditor.ctrlPanel.remove(slowerButton);
167
+// objEditor.ctrlPanel.remove(fasterButton);
168
+// objEditor.ctrlPanel.remove(remarkButton);
167169
168
- Remove(normalpushField);
170
+ objEditor.ctrlPanel.remove(setupPanel);
171
+ objEditor.ctrlPanel.remove(commandsPanel);
172
+ objEditor.ctrlPanel.remove(pushPanel);
173
+ //objEditor.ctrlPanel.remove(fillPanel);
174
+
175
+ //Remove(normalpushField);
169176 }
170177
171178 public ObjEditor GetEditor()
....@@ -302,44 +309,61 @@
302309 //normalLensItem.addActionListener(this);
303310 cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
304311 revertCameraItem.addActionListener(this);
305
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
306
- toggleTimelineItem.addItemListener(this);
312
+
307313 cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
308314 toggleFullScreenItem.addItemListener(this);
309315 toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
310316 cameraMenu.add("-");
317
+
311318 cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
312319 toggleTextureItem.addItemListener(this);
313320 toggleTextureItem.setState(CameraPane.textureon);
314
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
315
- toggleLiveItem.addItemListener(this);
316
- toggleLiveItem.setState(Globals.isLIVE());
317
- cameraMenu.add(stepItem = new MenuItem("Step"));
318
- stepItem.addActionListener(this);
319
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
320
-// toggleDLItem.addItemListener(this);
321
-// toggleDLItem.setState(false);
322
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
323
- toggleRenderItem.addItemListener(this);
324
- toggleRenderItem.setState(!CameraPane.frozen);
325
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
326
- toggleDebugItem.addItemListener(this);
327
- toggleDebugItem.setState(CameraPane.DEBUG);
328
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
329
- toggleFrustumItem.addItemListener(this);
330
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
331
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
332
- toggleFootContactItem.addItemListener(this);
333
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
334
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
335
- toggleRandomItem.addItemListener(this);
336
- toggleRandomItem.setState(CameraPane.RANDOM);
321
+
322
+ cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
323
+ toggleSwitchItem.addItemListener(this);
324
+ toggleSwitchItem.setState(CameraPane.SWITCH);
325
+
337326 cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
338327 toggleHandleItem.addItemListener(this);
339328 toggleHandleItem.setState(CameraPane.HANDLES);
329
+
340330 cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
341331 togglePaintItem.addItemListener(this);
342332 togglePaintItem.setState(CameraPane.PAINTMODE);
333
+
334
+ if (Globals.ADVANCED)
335
+ {
336
+ cameraMenu.add("-");
337
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
338
+ toggleLiveItem.addItemListener(this);
339
+ toggleLiveItem.setState(Globals.isLIVE());
340
+
341
+ cameraMenu.add(stepItem = new MenuItem("Step"));
342
+ stepItem.addActionListener(this);
343
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
344
+ // toggleDLItem.addItemListener(this);
345
+ // toggleDLItem.setState(false);
346
+
347
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
348
+ toggleRenderItem.addItemListener(this);
349
+ toggleRenderItem.setState(!CameraPane.frozen);
350
+
351
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
352
+ toggleDebugItem.addItemListener(this);
353
+ toggleDebugItem.setState(CameraPane.DEBUG);
354
+
355
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
356
+ toggleFrustumItem.addItemListener(this);
357
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
358
+
359
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
360
+ toggleFootContactItem.addItemListener(this);
361
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
362
+
363
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
364
+ toggleTimelineItem.addItemListener(this);
365
+ }
366
+
343367 // cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
344368 // toggleRootItem.addItemListener(this);
345369 // toggleRootItem.setState(false);
....@@ -353,21 +377,23 @@
353377 objectPanel = new JTabbedPane();
354378 toolbarPanel = new JPanel();
355379 toolbarPanel.setName("Toolbar");
356
- treePanel = new JPanel();
380
+ treePanel = new cGridBag();
357381 treePanel.setName("Tree");
358
- ctrlPanel = new cGridBag(); // new GridBagLayout());
382
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
359383 ctrlPanel.setName("Edit");
360384 materialPanel = new cGridBag().setVertical(true);
361385 materialPanel.setName("Material");
362386 /*JTextPane*/
363387 infoarea = createTextPane();
388
+ doc = infoarea.getStyledDocument();
389
+
364390 infoarea.setEditable(true);
365391 SetText();
366392 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
367393 // infoarea.setOpaque(false);
368394 // //infoarea.setForeground(textcolor);
369
- infoarea.setLineWrap(true);
370
- infoarea.setWrapStyleWord(true);
395
+// TEXTAREA infoarea.setLineWrap(true);
396
+// TEXTAREA infoarea.setWrapStyleWord(true);
371397 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
372398 infoPanel.setPreferredSize(new Dimension(50, 200));
373399 infoPanel.setName("Info");
....@@ -378,15 +404,15 @@
378404 mainPanel.setName("Main");
379405 mainPanel.setContinuousLayout(true);
380406 mainPanel.setOneTouchExpandable(true);
381
- mainPanel.setDividerLocation(1.0);
382407 mainPanel.setDividerSize(9);
383
- mainPanel.setResizeWeight(0);
408
+ mainPanel.setDividerLocation(0.5); //1.0);
409
+ mainPanel.setResizeWeight(0.5);
384410
385411 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
386412 //mainPanel.setLayout(new GridBagLayout());
387413 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
388
- treePanel.setLayout(new GridBagLayout());
389
- ctrlPanel.setLayout(new GridBagLayout());
414
+// treePanel.setLayout(new GridBagLayout());
415
+ //ctrlPanel.setLayout(new GridBagLayout());
390416 //materialPanel.setLayout(new GridBagLayout());
391417
392418 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
....@@ -426,7 +452,7 @@
426452 static String newline = "\n";
427453 protected static final String buttonString = "JButton";
428454 StyledDocument doc;
429
- JTextArea infoarea;
455
+ JTextPane infoarea;
430456
431457 void ClearInfo()
432458 {
....@@ -475,13 +501,13 @@
475501 //SendInfo("Name:", "bold");
476502 if (sel.GetTextures() != null || debug)
477503 {
478
- si.SendInfo(sel.toString(), "bold");
504
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
479505 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
480506 if (sel.Size() > 0)
481507 {
482508 si.SendInfo("#children = " + sel.Size(), "regular");
483509 }
484
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
510
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
485511 if (debug)
486512 {
487513 try
....@@ -493,7 +519,10 @@
493519 }
494520
495521 if (full)
496
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
522
+ {
523
+ si.SendInfo(" BBox min: " + minima, "regular");
524
+ si.SendInfo(" BBox max: " + maxima, "regular");
525
+ }
497526
498527 if (sel.bRep != null)
499528 {
....@@ -520,7 +549,7 @@
520549 }
521550 if (sel.support != null)
522551 {
523
- si.SendInfo(" support: " + sel.support, "regular");
552
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
524553 }
525554 if (sel.scriptnode != null)
526555 {
....@@ -591,6 +620,9 @@
591620 {
592621 CameraPane.pointflow = (PointFlow) sel;
593622 }
623
+
624
+ si.SendInfo("_____________________", "regular");
625
+ si.SendInfo("", "regular");
594626 }
595627 }
596628
....@@ -622,52 +654,52 @@
622654 cameraView.ToggleFullScreen();
623655 }
624656
625
- private JTextArea createTextPane()
657
+ private JTextPane createTextPane()
626658 {
627
- String[] initString =
628
- {
629
- "This is an editable JTextPane, ", //regular
630
- "another ", //italic
631
- "styled ", //bold
632
- "text ", //small
633
- "component, ", //large
634
- "which supports embedded components..." + newline,//regular
635
- " " + newline, //button
636
- "...and embedded icons..." + newline, //regular
637
- " ", //icon
638
- newline + "JTextPane is a subclass of JEditorPane that "
639
- + "uses a StyledEditorKit and StyledDocument, and provides "
640
- + "cover methods for interacting with those objects."
641
- };
659
+// TEXTAREA String[] initString =
660
+// {
661
+// "This is an editable JTextPane, ", //regular
662
+// "another ", //italic
663
+// "styled ", //bold
664
+// "text ", //small
665
+// "component, ", //large
666
+// "which supports embedded components..." + newline,//regular
667
+// " " + newline, //button
668
+// "...and embedded icons..." + newline, //regular
669
+// " ", //icon
670
+// newline + "JTextPane is a subclass of JEditorPane that "
671
+// + "uses a StyledEditorKit and StyledDocument, and provides "
672
+// + "cover methods for interacting with those objects."
673
+// };
674
+//
675
+// String[] initStyles =
676
+// {
677
+// "regular", "italic", "bold", "small", "large",
678
+// "regular", "button", "regular", "icon",
679
+// "regular"
680
+// };
681
+//
682
+// JTextPane textPane = new JTextPane();
683
+// textPane.setEditable(true);
684
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
685
+// addStylesToDocument(doc);
686
+//
687
+// try
688
+// {
689
+// for (int j = 0; j < 2; j++)
690
+// {
691
+// for (int i = 0; i < initString.length; i++)
692
+// {
693
+// doc.insertString(doc.getLength(), initString[i],
694
+// doc.getStyle(initStyles[i]));
695
+// }
696
+// }
697
+// } catch (BadLocationException ble)
698
+// {
699
+// System.err.println("Couldn't insert initial text into text pane.");
700
+// }
642701
643
- String[] initStyles =
644
- {
645
- "regular", "italic", "bold", "small", "large",
646
- "regular", "button", "regular", "icon",
647
- "regular"
648
- };
649
-
650
- JTextPane textPane = new JTextPane();
651
- textPane.setEditable(true);
652
- /*StyledDocument*/ doc = textPane.getStyledDocument();
653
- addStylesToDocument(doc);
654
-
655
- try
656
- {
657
- for (int j = 0; j < 2; j++)
658
- {
659
- for (int i = 0; i < initString.length; i++)
660
- {
661
- doc.insertString(doc.getLength(), initString[i],
662
- doc.getStyle(initStyles[i]));
663
- }
664
- }
665
- } catch (BadLocationException ble)
666
- {
667
- System.err.println("Couldn't insert initial text into text pane.");
668
- }
669
-
670
- return new JTextArea(); // textPane;
702
+ return new JTextPane(); // textPane;
671703 }
672704
673705 protected void addStylesToDocument(StyledDocument doc)
....@@ -720,7 +752,7 @@
720752 protected static ImageIcon createImageIcon(String path,
721753 String description)
722754 {
723
- java.net.URL imgURL = GrafreeD.class.getResource(path);
755
+ java.net.URL imgURL = Grafreed.class.getResource(path);
724756 if (imgURL != null)
725757 {
726758 return new ImageIcon(imgURL, description);
....@@ -752,6 +784,7 @@
752784 // NumberSlider vDivsField;
753785 // JCheckBox endcaps;
754786 JCheckBox liveCB;
787
+ JCheckBox selectCB;
755788 JCheckBox hideCB;
756789 JCheckBox link2masterCB;
757790 JCheckBox markCB;
....@@ -767,54 +800,44 @@
767800 JButton slowerButton;
768801 JButton fasterButton;
769802 JButton remarkButton;
803
+
804
+ cGridBag namePanel;
805
+ cGridBag setupPanel;
806
+ cGridBag commandsPanel;
807
+ cGridBag pushPanel;
808
+ cGridBag fillPanel;
770809
771
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
810
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
772811 {
773812 JCheckBox cb;
774813
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);
814
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
780815 cb.addItemListener(this);
781
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
782
- oe.aConstraints.gridwidth = 1;
783
- oe.aConstraints.gridx += 1;
784816
785817 return cb;
786818 }
787819
788
- cButton AddButton(ObjEditor oe, String label)
820
+ cButton AddButton(cGridBag panel, String label)
789821 {
790822 cButton cb;
791823
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);
824
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
797825 cb.addActionListener(this);
798
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
799
- oe.aConstraints.gridwidth = 1;
800
- oe.aConstraints.gridx += 1;
801826
802827 return cb;
803828 }
804829
805
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
830
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
806831 {
807832 JComboBox combo;
808833
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;
834
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812835 combo.addActionListener(this);
813836
814837 return combo;
815838 }
816839
817
- cNumberSlider AddSlider(cGridBag ctrlPanel, String label, double min, double max, double current, double pow)
840
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
818841 {
819842 cGridBag control = new cGridBag();
820843
....@@ -826,12 +849,12 @@
826849 control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827850 combo.setFloat(current);
828851
829
- ctrlPanel.add(control);
852
+ panel.add(control);
830853
831
- return combo;
854
+ return control;
832855 }
833856
834
- cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current)
857
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
835858 {
836859 cGridBag control = new cGridBag();
837860
....@@ -839,25 +862,21 @@
839862
840863 JLabel jlabel = new JLabel(label);
841864 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);
865
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
866
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
844867 combo.setInteger(current);
845868
846
- ctrlPanel.add(control);
869
+ panel.add(control);
847870
848
- return combo;
871
+ return control;
849872 }
850873
851874 JTextArea AddText(cGridBag ctrlPanel, String name)
852875 {
853876 JTextArea text;
854877
855
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
856
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
857878 ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
858879 text.addCaretListener(this);
859
- aConstraints.gridx += 1;
860
- aConstraints.gridwidth = 1;
861880
862881 return text;
863882 }
....@@ -896,7 +915,7 @@
896915
897916 /*
898917 */
899
- void Return() // ObjEditor oe)
918
+ void Return0() // ObjEditor oe)
900919 {
901920 aConstraints.gridy += 1;
902921 aConstraints.gridx = 0;
....@@ -951,37 +970,72 @@
951970
952971 void SetupUI2(ObjEditor oe)
953972 {
954
-// oe.aConstraints.weightx = 0;
955
-// oe.aConstraints.weighty = 0;
956
-// oe.aConstraints.gridx = 0;
957
-// oe.aConstraints.gridy = 0;
958
- SetupName(oe);
973
+ //SetupName(oe);
974
+
975
+ namePanel = new cGridBag();
976
+
977
+ nameField = AddText(namePanel, copy.GetName());
978
+ namePanel.add(nameField);
979
+ oe.ctrlPanel.add(namePanel);
980
+
981
+ oe.ctrlPanel.Return();
959982
960983 if (!GroupEditor.allparams)
961984 return;
962985
963
- liveCB = AddCheckBox(oe, "Live", copy.live);
964
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
965
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
986
+ setupPanel = new cGridBag().setVertical(false);
987
+
988
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
989
+ liveCB.setToolTipText("Animate object");
990
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
991
+ selectCB.setToolTipText("Make object selectable");
966992 // 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");
993
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
994
+ hideCB.setToolTipText("Hide object");
995
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
996
+ markCB.setToolTipText("Set the animation target transform");
997
+
998
+ rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind);
999
+ rewindCB.setToolTipText("Rewind animation");
1000
+
1001
+ randomCB = AddCheckBox(setupPanel, "Random", copy.random);
1002
+ randomCB.setToolTipText("Option for switch node");
1003
+
1004
+ if (Globals.ADVANCED)
1005
+ {
1006
+ link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master);
1007
+ link2masterCB.setToolTipText("Attach to support");
1008
+ speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup);
1009
+ speedupCB.setToolTipText("Option motion capture");
1010
+ }
1011
+
1012
+ oe.ctrlPanel.add(setupPanel);
1013
+ oe.ctrlPanel.Return();
1014
+
1015
+ commandsPanel = new cGridBag().setVertical(false);
1016
+
1017
+ resetButton = AddButton(commandsPanel, "Reset");
1018
+ resetButton.setToolTipText("Jump to frame zero");
1019
+ stepButton = AddButton(commandsPanel, "Step");
1020
+ stepButton.setToolTipText("Step one frame");
9731021 // resetAllButton = AddButton(oe, "Reset All");
9741022 // stepAllButton = AddButton(oe, "Step All");
975
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9761023 // Return();
977
- slowerButton = AddButton(oe, "Slow");
978
- fasterButton = AddButton(oe, "Fast");
979
- remarkButton = AddButton(oe, "Rem");
1024
+ slowerButton = AddButton(commandsPanel, "Slow");
1025
+ slowerButton.setToolTipText("Decrease animation speed");
1026
+ fasterButton = AddButton(commandsPanel, "Fast");
1027
+ fasterButton.setToolTipText("Increase animation speed");
1028
+ remarkButton = AddButton(commandsPanel, "Remark");
1029
+ remarkButton.setToolTipText("Set the current transform as the target");
9801030
981
- //Return();
1031
+ oe.ctrlPanel.add(commandsPanel);
1032
+ oe.ctrlPanel.Return();
9821033
983
- //normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
1034
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1035
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
9841036 //Return();
1037
+
1038
+ oe.ctrlPanel.Return();
9851039
9861040 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9871041 // ObjEditor.aConstraints.gridx += 1;
....@@ -1076,7 +1130,7 @@
10761130 oe.aConstraints.gridwidth = 1;
10771131 /**/
10781132 nameField = AddText(oe.ctrlPanel, copy.GetName());
1079
- Return();
1133
+ oe.ctrlPanel.Return();
10801134
10811135 //ctrlPanel.add(textureButton = new Button("Texture..."));
10821136 //textureButton.setEnabled(false);
....@@ -1253,10 +1307,11 @@
12531307 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12541308 //tmp.setName("Edit");
12551309 objectPanel.add(materialPanel);
1256
- JPanel north = new JPanel(new BorderLayout());
1257
- north.setName("Edit");
1258
- north.add(ctrlPanel, BorderLayout.NORTH);
1259
- objectPanel.add(north);
1310
+// JPanel north = new JPanel(new BorderLayout());
1311
+// north.setName("Edit");
1312
+// north.add(ctrlPanel, BorderLayout.NORTH);
1313
+// objectPanel.add(north);
1314
+ objectPanel.add(ctrlPanel);
12601315 objectPanel.add(infoPanel);
12611316
12621317 /*
....@@ -1278,7 +1333,7 @@
12781333 scrollpane.addMouseWheelListener(this); // Default not fast enough
12791334
12801335 /*JTabbedPane*/ scenePanel = new cGridBag();
1281
- scenePanel.preferredWidth = 7;
1336
+ scenePanel.preferredWidth = 6;
12821337
12831338 JTabbedPane tabbedPane = new JTabbedPane();
12841339 tabbedPane.add(scrollpane);
....@@ -1384,8 +1439,8 @@
13841439
13851440 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13861441
1387
- frame.setSize(1024, 768);
1388
- frame.show();
1442
+ frame.setSize(1280, 860);
1443
+ frame.setVisible(true);
13891444
13901445 gridPanel.setDividerLocation(1.0);
13911446
....@@ -1415,7 +1470,7 @@
14151470 ctrlPanel.removeAll();
14161471 }
14171472
1418
- void SetupMaterial(cGridBag ctrlPanel)
1473
+ void SetupMaterial(cGridBag panel)
14191474 {
14201475 /*
14211476 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
....@@ -1424,18 +1479,26 @@
14241479
14251480 cGridBag editBar = new cGridBag().setVertical(false);
14261481
1427
- editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints);
1482
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1483
+ createMaterialButton.setToolTipText("Create material");
14281484
14291485 /*
14301486 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
14311487 */
14321488
1433
- editBar.add(clearMaterialButton = new cButton("Clear")); // , aConstraints);
1434
- editBar.add(resetSlidersButton = new cButton("Reset")); // , aConstraints);
1435
- editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1436
- editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1489
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1490
+ clearMaterialButton.setToolTipText("Clear material");
1491
+
1492
+ if (Globals.ADVANCED)
1493
+ {
1494
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1495
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1496
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1497
+ }
14371498
1438
- ctrlPanel.add(editBar);
1499
+ editBar.preferredHeight = 15;
1500
+
1501
+ panel.add(editBar);
14391502
14401503 /**/
14411504 //aConstraints.weighty = 0;
....@@ -1484,9 +1547,9 @@
14841547 shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
14851548 colorSection.add(shadowbias);
14861549
1487
- ctrlPanel.add(new JSeparator());
1550
+ panel.add(new JSeparator());
14881551
1489
- ctrlPanel.add(colorSection);
1552
+ panel.add(colorSection);
14901553
14911554 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14921555
....@@ -1534,9 +1597,9 @@
15341597 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15351598 diffuseSection.add(fakedepth);
15361599
1537
- ctrlPanel.add(new JSeparator());
1600
+ panel.add(new JSeparator());
15381601
1539
- ctrlPanel.add(diffuseSection);
1602
+ panel.add(diffuseSection);
15401603
15411604 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15421605
....@@ -1572,7 +1635,7 @@
15721635 velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15731636 specularSection.add(velvet);
15741637
1575
- shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1);
1638
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
15761639 //Return();
15771640 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
15781641 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
....@@ -1585,9 +1648,9 @@
15851648 // aConstraints.gridwidth = 1;
15861649
15871650
1588
- ctrlPanel.add(new JSeparator());
1651
+ panel.add(new JSeparator());
15891652
1590
- ctrlPanel.add(specularSection);
1653
+ panel.add(specularSection);
15911654
15921655 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15931656
....@@ -1617,9 +1680,9 @@
16171680 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
16181681 globalSection.add(opacity);
16191682
1620
- ctrlPanel.add(new JSeparator());
1683
+ panel.add(new JSeparator());
16211684
1622
- ctrlPanel.add(globalSection);
1685
+ panel.add(globalSection);
16231686
16241687 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16251688
....@@ -1661,9 +1724,9 @@
16611724 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
16621725 textureSection.add(opacityPower);
16631726
1664
- ctrlPanel.add(new JSeparator());
1727
+ panel.add(new JSeparator());
16651728
1666
- ctrlPanel.add(textureSection);
1729
+ panel.add(textureSection);
16671730
16681731 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16691732
....@@ -1700,12 +1763,15 @@
17001763 opacityPowerField.addChangeListener(this);
17011764 /**/
17021765
1703
- resetSlidersButton.addActionListener(this);
17041766 clearMaterialButton.addActionListener(this);
17051767 createMaterialButton.addActionListener(this);
1706
-
1707
- propagateToggle.addItemListener(this);
1708
- multiplyToggle.addItemListener(this);
1768
+
1769
+ if (Globals.ADVANCED)
1770
+ {
1771
+ resetSlidersButton.addActionListener(this);
1772
+ propagateToggle.addItemListener(this);
1773
+ multiplyToggle.addItemListener(this);
1774
+ }
17091775 }
17101776
17111777 void DropFile(java.io.File[] files, boolean textures)
....@@ -1876,7 +1942,7 @@
18761942
18771943 //? flashIt = false;
18781944 CameraPane pane = (CameraPane) cameraView;
1879
- pane.clickStart(location.x, location.y, 0);
1945
+ pane.clickStart(location.x, location.y, 0, 0);
18801946 pane.clickEnd(location.x, location.y, 0, true);
18811947
18821948 if (group.selection.size() == 1)
....@@ -2333,11 +2399,11 @@
23332399
23342400 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23352401 {
2336
- if (GrafreeD.standAlone)
2402
+ if (Grafreed.standAlone)
23372403 {
23382404 /**/
23392405 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2340
- browser.show();
2406
+ browser.setVisible(true);
23412407 String filename = browser.getFile();
23422408 if (filename != null && filename.length() > 0)
23432409 {
....@@ -2482,6 +2548,7 @@
24822548 }
24832549 if (input == null)
24842550 {
2551
+ new Exception().printStackTrace();
24852552 System.exit(0);
24862553 }
24872554
....@@ -2696,7 +2763,8 @@
26962763 return;
26972764 }
26982765
2699
- multiplyToggle.setSelected(mat.multiply);
2766
+ if (multiplyToggle != null)
2767
+ multiplyToggle.setSelected(mat.multiply);
27002768
27012769 assert (object.projectedVertices != null);
27022770
....@@ -2911,7 +2979,7 @@
29112979 frame.validate();
29122980
29132981 return;
2914
- } else if (event.getSource() == toggleRandomItem)
2982
+ } else if (event.getSource() == toggleSwitchItem)
29152983 {
29162984 cameraView.ToggleRandom();
29172985 cameraView.repaint();
....@@ -2942,6 +3010,10 @@
29423010 {
29433011 copy.live ^= true;
29443012 return;
3013
+ } else if (event.getSource() == selectCB)
3014
+ {
3015
+ copy.dontselect ^= true;
3016
+ return;
29453017 } else if (event.getSource() == hideCB)
29463018 {
29473019 copy.hide ^= true;
....@@ -2956,6 +3028,7 @@
29563028 if (event.getSource() == randomCB)
29573029 {
29583030 copy.random ^= true;
3031
+ objEditor.refreshContents();
29593032 return;
29603033 }
29613034 if (event.getSource() == speedupCB)
....@@ -3179,7 +3252,7 @@
31793252 if (!Globals.ANIMATION)
31803253 {
31813254 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3182
- browser.show();
3255
+ browser.setVisible(true);
31833256 String filename = browser.getFile();
31843257 if (filename != null && filename.length() > 0)
31853258 {
....@@ -3189,8 +3262,8 @@
31893262
31903263 Globals.ANIMATION ^= true;
31913264
3192
- GrafreeD.wav.cursor = 0;
3193
- GrafreeD.wav.loop = 0;
3265
+ Grafreed.wav.cursor = 0;
3266
+ Grafreed.wav.loop = 0;
31943267 }
31953268 } else
31963269 {
....@@ -3240,7 +3313,7 @@
32403313 void CreateMaterial()
32413314 {
32423315 //copy.ClearMaterial(); // PATCH
3243
- copy.CreateMaterialS(multiplyToggle.isSelected());
3316
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
32443317 if (copy.selection.size() > 0)
32453318 //SetMaterial(copy);
32463319 {
....@@ -3299,11 +3372,11 @@
32993372 {
33003373 copy.ResetBlockLoop(); // temporary problem
33013374
3302
- boolean random = CameraPane.RANDOM;
3303
- CameraPane.RANDOM = false; // parse everything
3375
+ boolean random = CameraPane.SWITCH;
3376
+ CameraPane.SWITCH = false; // parse everything
33043377 copy.ResetDisplayList();
33053378 copy.HardTouch();
3306
- CameraPane.RANDOM = random;
3379
+ CameraPane.SWITCH = random;
33073380 }
33083381
33093382 // public void applySelf()
....@@ -3377,6 +3450,36 @@
33773450 {
33783451 //System.out.println("Propagate = " + propagate);
33793452 copy.UpdateMaterial(anchor, current, propagate);
3453
+
3454
+ if (copy.material != null)
3455
+ {
3456
+ cMaterial mat = copy.material;
3457
+
3458
+ colorField.SetToolTipValue((mat.color));
3459
+ modulationField.SetToolTipValue((mat.modulation));
3460
+ metalnessField.SetToolTipValue((mat.metalness));
3461
+ diffuseField.SetToolTipValue((mat.diffuse));
3462
+ specularField.SetToolTipValue((mat.specular));
3463
+ shininessField.SetToolTipValue((mat.shininess));
3464
+ shiftField.SetToolTipValue((mat.shift));
3465
+ ambientField.SetToolTipValue((mat.ambient));
3466
+ lightareaField.SetToolTipValue((mat.lightarea));
3467
+ diffusenessField.SetToolTipValue((mat.factor));
3468
+ velvetField.SetToolTipValue((mat.velvet));
3469
+ sheenField.SetToolTipValue((mat.sheen));
3470
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3471
+ backlitField.SetToolTipValue((mat.bump));
3472
+ anisoField.SetToolTipValue((mat.aniso));
3473
+ anisoVField.SetToolTipValue((mat.anisoV));
3474
+ cameraField.SetToolTipValue((mat.cameralight));
3475
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3476
+ shadowField.SetToolTipValue((mat.shadow));
3477
+ textureField.SetToolTipValue((mat.texture));
3478
+ opacityField.SetToolTipValue((mat.opacity));
3479
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3480
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3481
+ }
3482
+
33803483 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
33813484 {
33823485 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3421,6 +3524,7 @@
34213524 || e.getSource() == apertureField
34223525 || e.getSource() == shadowblurField)
34233526 {
3527
+ new Exception().printStackTrace();
34243528 System.exit(0);
34253529 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34263530 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3491,7 +3595,7 @@
34913595 }
34923596
34933597 if (normalpushField != null)
3494
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3598
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
34953599 }
34963600
34973601 void SnapObject()
....@@ -4103,7 +4207,7 @@
41034207
41044208 void load() // throws ClassNotFoundException
41054209 {
4106
- if (GrafreeD.standAlone)
4210
+ if (Grafreed.standAlone)
41074211 {
41084212 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41094213 browser.show();
....@@ -4208,7 +4312,7 @@
42084312
42094313 void saveAs()
42104314 {
4211
- if (GrafreeD.standAlone)
4315
+ if (Grafreed.standAlone)
42124316 {
42134317 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42144318 browser.setVisible(true);
....@@ -4319,7 +4423,7 @@
43194423 Object3D objectparent = obj.parent;
43204424 obj.parent = null;
43214425
4322
- Object3D object = (Object3D) GrafreeD.clone(obj);
4426
+ Object3D object = (Object3D) Grafreed.clone(obj);
43234427
43244428 obj.parent = objectparent;
43254429
....@@ -4353,7 +4457,7 @@
43534457 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43544458 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43554459 copy.generatePOV(buffer);
4356
- if (GrafreeD.standAlone)
4460
+ if (Grafreed.standAlone)
43574461 {
43584462 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43594463 browser.show();
....@@ -4392,8 +4496,8 @@
43924496 //MenuItem normalLensItem;
43934497 MenuItem editCameraItem;
43944498 MenuItem revertCameraItem;
4395
- CheckboxMenuItem toggleLiveItem;
43964499 MenuItem stepItem;
4500
+ CheckboxMenuItem toggleLiveItem;
43974501 CheckboxMenuItem toggleFullScreenItem;
43984502 CheckboxMenuItem toggleTimelineItem;
43994503 CheckboxMenuItem toggleRenderItem;
....@@ -4402,7 +4506,7 @@
44024506 CheckboxMenuItem toggleFootContactItem;
44034507 CheckboxMenuItem toggleDLItem;
44044508 CheckboxMenuItem toggleTextureItem;
4405
- CheckboxMenuItem toggleRandomItem;
4509
+ CheckboxMenuItem toggleSwitchItem;
44064510 CheckboxMenuItem toggleRootItem;
44074511 CheckboxMenuItem animationItem;
44084512 CheckboxMenuItem toggleHandleItem;
....@@ -4410,7 +4514,7 @@
44104514 JSplitPane mainPanel;
44114515 JScrollPane scrollpane;
44124516 JPanel toolbarPanel;
4413
- JPanel treePanel;
4517
+ cGridBag treePanel;
44144518 JPanel radioPanel;
44154519 ButtonGroup buttonGroup;
44164520 cGridBag ctrlPanel;