Normand Briere
2019-06-17 13e9febe94aaeebad9c97f6d3e2aa4d73b2495c8
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,61 @@
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);
145
+
146
+ objEditor.ctrlPanel.remove(namePanel);
139147
140148 if (!GroupEditor.allparams)
141149 return;
142150
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);
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);
169
+
170
+ objEditor.ctrlPanel.remove(setupPanel);
171
+ objEditor.ctrlPanel.remove(commandsPanel);
172
+ objEditor.ctrlPanel.remove(pushPanel);
173
+ //objEditor.ctrlPanel.remove(fillPanel);
174
+
175
+ //Remove(normalpushField);
161176 }
162177
163178 public ObjEditor GetEditor()
164179 {
165180 return objEditor; //.GetEditor();
166181 }
182
+
183
+ // Sometimes myself, sometimes my callee's.
167184 ObjEditor objEditor;
168185
169186 /*
....@@ -238,7 +255,7 @@
238255 //if (!isDisplayable())
239256 //setUndecorated(true);
240257
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
258
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242259 client = inClient;
243260 copy = localCopy;
244261 copy.editWindow = this;
....@@ -259,24 +276,40 @@
259276 void SetupMenu()
260277 {
261278 frame.setMenuBar(menuBar = new MenuBar());
262
- menuBar.add(windowMenu = new Menu("File"));
263
- windowMenu.add(loadItem = new MenuItem("Load..."));
264
- windowMenu.add("-");
265
- windowMenu.add(saveItem = new MenuItem("Save"));
266
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
279
+ menuBar.add(fileMenu = new Menu("File"));
280
+ fileMenu.add(newItem = new MenuItem("New"));
281
+ fileMenu.add(loadItem = new MenuItem("Open..."));
282
+
283
+ //oe.menuBar.add(menu = new Menu("Include"));
284
+ Menu menu = new Menu("Import");
285
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
286
+ importOBJItem.addActionListener(this);
287
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
288
+ import3DSItem.addActionListener(this);
289
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
290
+ importVRMLX3DItem.addActionListener(this);
291
+ menu.add("-");
292
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
293
+ importGFDItem.addActionListener(this);
294
+ fileMenu.add(menu);
295
+ fileMenu.add("-");
296
+
297
+ fileMenu.add(saveItem = new MenuItem("Save"));
298
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267299 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
268
- windowMenu.add("-");
269
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
270
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
271
- windowMenu.add("-");
300
+ fileMenu.add("-");
301
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
302
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
303
+ fileMenu.add("-");
272304 if (client.parent != null)
273305 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
306
+ fileMenu.add(closeItem = new MenuItem("Close"));
275307 } else
276308 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
309
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278310 }
279311
312
+ newItem.addActionListener(this);
280313 loadItem.addActionListener(this);
281314 saveItem.addActionListener(this);
282315 saveAsItem.addActionListener(this);
....@@ -285,77 +318,26 @@
285318 //povItem.addActionListener(this);
286319 closeItem.addActionListener(this);
287320
288
- menuBar.add(cameraMenu = new Menu("View"));
289
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
290
- //zBufferItem.addActionListener(this);
291
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
292
- //normalLensItem.addActionListener(this);
293
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
294
- revertCameraItem.addActionListener(this);
295
- cameraMenu.add(toggleFullItem = new CheckboxMenuItem("Full Screen"));
296
- toggleFullItem.addItemListener(this);
297
- toggleFullItem.setState(CameraPane.FULLSCREEN);
298
- cameraMenu.add("-");
299
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
300
- toggleTextureItem.addItemListener(this);
301
- toggleTextureItem.setState(CameraPane.textureon);
302
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
303
- toggleLiveItem.addItemListener(this);
304
- toggleLiveItem.setState(CameraPane.isLIVE());
305
- cameraMenu.add(stepItem = new MenuItem("Step"));
306
- stepItem.addActionListener(this);
307
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
308
-// toggleDLItem.addItemListener(this);
309
-// toggleDLItem.setState(false);
310
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
311
- toggleRenderItem.addItemListener(this);
312
- toggleRenderItem.setState(!CameraPane.frozen);
313
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
314
- toggleDebugItem.addItemListener(this);
315
- toggleDebugItem.setState(CameraPane.DEBUG);
316
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
317
- toggleFrustumItem.addItemListener(this);
318
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
319
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
320
- toggleFootContactItem.addItemListener(this);
321
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
322
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
323
- toggleRandomItem.addItemListener(this);
324
- toggleRandomItem.setState(CameraPane.RANDOM);
325
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
326
- toggleHandleItem.addItemListener(this);
327
- toggleHandleItem.setState(CameraPane.HANDLES);
328
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
329
- togglePaintItem.addItemListener(this);
330
- togglePaintItem.setState(CameraPane.PAINTMODE);
331
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
332
-// toggleRootItem.addItemListener(this);
333
-// toggleRootItem.setState(false);
334
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
335
-// animationItem.addItemListener(this);
336
-// animationItem.setState(CameraPane.ANIMATION);
337
- cameraMenu.add("-");
338
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
339
- editCameraItem.addActionListener(this);
340
-
341321 objectPanel = new JTabbedPane();
342322 toolbarPanel = new JPanel();
343323 toolbarPanel.setName("Toolbar");
344
- treePanel = new JPanel();
324
+ treePanel = new cGridBag();
345325 treePanel.setName("Tree");
346
- ctrlPanel = new JPanel(); // new GridBagLayout());
326
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
347327 ctrlPanel.setName("Edit");
348
- materialPanel = new JPanel();
328
+ materialPanel = new cGridBag().setVertical(true);
349329 materialPanel.setName("Material");
350330 /*JTextPane*/
351331 infoarea = createTextPane();
332
+ doc = infoarea.getStyledDocument();
333
+
352334 infoarea.setEditable(true);
353335 SetText();
354336 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
355337 // infoarea.setOpaque(false);
356338 // //infoarea.setForeground(textcolor);
357
- infoarea.setLineWrap(true);
358
- infoarea.setWrapStyleWord(true);
339
+// TEXTAREA infoarea.setLineWrap(true);
340
+// TEXTAREA infoarea.setWrapStyleWord(true);
359341 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
360342 infoPanel.setPreferredSize(new Dimension(50, 200));
361343 infoPanel.setName("Info");
....@@ -366,16 +348,16 @@
366348 mainPanel.setName("Main");
367349 mainPanel.setContinuousLayout(true);
368350 mainPanel.setOneTouchExpandable(true);
369
- mainPanel.setDividerLocation(1.0);
370351 mainPanel.setDividerSize(9);
371
- mainPanel.setResizeWeight(0);
352
+ mainPanel.setDividerLocation(0.5); //1.0);
353
+ mainPanel.setResizeWeight(0.5);
372354
373355 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
374356 //mainPanel.setLayout(new GridBagLayout());
375357 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
376
- treePanel.setLayout(new GridBagLayout());
377
- ctrlPanel.setLayout(new GridBagLayout());
378
- materialPanel.setLayout(new GridBagLayout());
358
+// treePanel.setLayout(new GridBagLayout());
359
+ //ctrlPanel.setLayout(new GridBagLayout());
360
+ //materialPanel.setLayout(new GridBagLayout());
379361
380362 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
381363 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -414,7 +396,7 @@
414396 static String newline = "\n";
415397 protected static final String buttonString = "JButton";
416398 StyledDocument doc;
417
- JTextArea infoarea;
399
+ JTextPane infoarea;
418400
419401 void ClearInfo()
420402 {
....@@ -437,10 +419,10 @@
437419 e.printStackTrace();
438420 }
439421
440
- String selection = infoarea.getText();
441
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
442
- java.awt.datatransfer.Clipboard clipboard =
443
- Toolkit.getDefaultToolkit().getSystemClipboard();
422
+// String selection = infoarea.getText();
423
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
424
+// java.awt.datatransfer.Clipboard clipboard =
425
+// Toolkit.getDefaultToolkit().getSystemClipboard();
444426 //clipboard.setContents(data, data);
445427 }
446428
....@@ -463,13 +445,13 @@
463445 //SendInfo("Name:", "bold");
464446 if (sel.GetTextures() != null || debug)
465447 {
466
- si.SendInfo(sel.toString(), "bold");
448
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
467449 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
468450 if (sel.Size() > 0)
469451 {
470452 si.SendInfo("#children = " + sel.Size(), "regular");
471453 }
472
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
454
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
473455 if (debug)
474456 {
475457 try
....@@ -481,7 +463,10 @@
481463 }
482464
483465 if (full)
484
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
466
+ {
467
+ si.SendInfo(" BBox min: " + minima, "regular");
468
+ si.SendInfo(" BBox max: " + maxima, "regular");
469
+ }
485470
486471 if (sel.bRep != null)
487472 {
....@@ -508,7 +493,7 @@
508493 }
509494 if (sel.support != null)
510495 {
511
- si.SendInfo(" support: " + sel.support, "regular");
496
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
512497 }
513498 if (sel.scriptnode != null)
514499 {
....@@ -579,6 +564,9 @@
579564 {
580565 CameraPane.pointflow = (PointFlow) sel;
581566 }
567
+
568
+ si.SendInfo("_____________________", "regular");
569
+ si.SendInfo("", "regular");
582570 }
583571 }
584572
....@@ -594,52 +582,68 @@
594582 }
595583 }
596584
597
- private JTextArea createTextPane()
598
- {
599
- String[] initString =
585
+ void ToggleFullScreen()
600586 {
601
- "This is an editable JTextPane, ", //regular
602
- "another ", //italic
603
- "styled ", //bold
604
- "text ", //small
605
- "component, ", //large
606
- "which supports embedded components..." + newline,//regular
607
- " " + newline, //button
608
- "...and embedded icons..." + newline, //regular
609
- " ", //icon
610
- newline + "JTextPane is a subclass of JEditorPane that "
611
- + "uses a StyledEditorKit and StyledDocument, and provides "
612
- + "cover methods for interacting with those objects."
613
- };
614
-
615
- String[] initStyles =
616
- {
617
- "regular", "italic", "bold", "small", "large",
618
- "regular", "button", "regular", "icon",
619
- "regular"
620
- };
621
-
622
- JTextPane textPane = new JTextPane();
623
- textPane.setEditable(true);
624
- /*StyledDocument*/ doc = textPane.getStyledDocument();
625
- addStylesToDocument(doc);
626
-
627
- try
628
- {
629
- for (int j = 0; j < 2; j++)
630
- {
631
- for (int i = 0; i < initString.length; i++)
587
+ if (CameraPane.FULLSCREEN)
632588 {
633
- doc.insertString(doc.getLength(), initString[i],
634
- doc.getStyle(initStyles[i]));
589
+ frame.getContentPane().remove(/*"Center",*/bigThree);
590
+ framePanel.add(bigThree);
591
+ frame.getContentPane().add(/*"Center",*/framePanel);
592
+ } else
593
+ {
594
+ frame.getContentPane().remove(/*"Center",*/framePanel);
595
+ framePanel.remove(bigThree);
596
+ frame.getContentPane().add(/*"Center",*/bigThree);
635597 }
636
- }
637
- } catch (BadLocationException ble)
638
- {
639
- System.err.println("Couldn't insert initial text into text pane.");
598
+ cameraView.ToggleFullScreen();
640599 }
641600
642
- return new JTextArea(); // textPane;
601
+ private JTextPane createTextPane()
602
+ {
603
+// TEXTAREA String[] initString =
604
+// {
605
+// "This is an editable JTextPane, ", //regular
606
+// "another ", //italic
607
+// "styled ", //bold
608
+// "text ", //small
609
+// "component, ", //large
610
+// "which supports embedded components..." + newline,//regular
611
+// " " + newline, //button
612
+// "...and embedded icons..." + newline, //regular
613
+// " ", //icon
614
+// newline + "JTextPane is a subclass of JEditorPane that "
615
+// + "uses a StyledEditorKit and StyledDocument, and provides "
616
+// + "cover methods for interacting with those objects."
617
+// };
618
+//
619
+// String[] initStyles =
620
+// {
621
+// "regular", "italic", "bold", "small", "large",
622
+// "regular", "button", "regular", "icon",
623
+// "regular"
624
+// };
625
+//
626
+// JTextPane textPane = new JTextPane();
627
+// textPane.setEditable(true);
628
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
629
+// addStylesToDocument(doc);
630
+//
631
+// try
632
+// {
633
+// for (int j = 0; j < 2; j++)
634
+// {
635
+// for (int i = 0; i < initString.length; i++)
636
+// {
637
+// doc.insertString(doc.getLength(), initString[i],
638
+// doc.getStyle(initStyles[i]));
639
+// }
640
+// }
641
+// } catch (BadLocationException ble)
642
+// {
643
+// System.err.println("Couldn't insert initial text into text pane.");
644
+// }
645
+
646
+ return new JTextPane(); // textPane;
643647 }
644648
645649 protected void addStylesToDocument(StyledDocument doc)
....@@ -692,7 +696,7 @@
692696 protected static ImageIcon createImageIcon(String path,
693697 String description)
694698 {
695
- java.net.URL imgURL = GrafreeD.class.getResource(path);
699
+ java.net.URL imgURL = Grafreed.class.getResource(path);
696700 if (imgURL != null)
697701 {
698702 return new ImageIcon(imgURL, description);
....@@ -724,6 +728,7 @@
724728 // NumberSlider vDivsField;
725729 // JCheckBox endcaps;
726730 JCheckBox liveCB;
731
+ JCheckBox selectCB;
727732 JCheckBox hideCB;
728733 JCheckBox link2masterCB;
729734 JCheckBox markCB;
....@@ -739,115 +744,83 @@
739744 JButton slowerButton;
740745 JButton fasterButton;
741746 JButton remarkButton;
747
+
748
+ cGridBag namePanel;
749
+ cGridBag setupPanel;
750
+ cGridBag commandsPanel;
751
+ cGridBag pushPanel;
752
+ cGridBag fillPanel;
742753
743
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
754
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
744755 {
745756 JCheckBox cb;
746757
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);
758
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
752759 cb.addItemListener(this);
753
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
754
- oe.aConstraints.gridwidth = 1;
755
- oe.aConstraints.gridx += 1;
756760
757761 return cb;
758762 }
759763
760
- cButton AddButton(ObjEditor oe, String label)
764
+ cButton AddButton(cGridBag panel, String label)
761765 {
762766 cButton cb;
763767
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);
768
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
769769 cb.addActionListener(this);
770
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
771
- oe.aConstraints.gridwidth = 1;
772
- oe.aConstraints.gridx += 1;
773770
774771 return cb;
775772 }
776773
777
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
774
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
778775 {
779776 JComboBox combo;
780777
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;
778
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
784779 combo.addActionListener(this);
785780
786781 return combo;
787782 }
788783
789
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
784
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
790785 {
791
- NumberSlider combo;
786
+ cGridBag control = new cGridBag();
787
+
788
+ cNumberSlider combo;
792789
793790 JLabel jlabel = new JLabel(label);
794
-
795
- aConstraints.fill = GridBagConstraints.VERTICAL;
796791 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
-
792
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
793
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
806794 combo.setFloat(current);
807
-
808
- combo.label = jlabel;
809
-
810
- combo.addChangeListener(this);
811
-
812
- return combo;
795
+
796
+ panel.add(control);
797
+
798
+ return control;
813799 }
814800
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
801
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
816802 {
817
- NumberSlider combo;
803
+ cGridBag control = new cGridBag();
804
+
805
+ cNumberSlider combo;
818806
819807 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
822808 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
-
809
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
810
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
832811 combo.setInteger(current);
833812
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
813
+ panel.add(control);
814
+
815
+ return control;
839816 }
840817
841
- JTextArea AddText(JPanel ctrlPanel, String name)
818
+ JTextArea AddText(cGridBag ctrlPanel, String name)
842819 {
843820 JTextArea text;
844821
845
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
846
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
847
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
822
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
848823 text.addCaretListener(this);
849
- aConstraints.gridx += 1;
850
- aConstraints.gridwidth = 1;
851824
852825 return text;
853826 }
....@@ -877,9 +850,16 @@
877850 objEditor.ctrlPanel.remove(j);
878851 }
879852
853
+ void Remove(cNumberSlider j)
854
+ {
855
+ j.removeChangeListener(this);
856
+ //objEditor.ctrlPanel.remove(j.label);
857
+ objEditor.ctrlPanel.remove(j);
858
+ }
859
+
880860 /*
881861 */
882
- void Return() // ObjEditor oe)
862
+ void Return0() // ObjEditor oe)
883863 {
884864 aConstraints.gridy += 1;
885865 aConstraints.gridx = 0;
....@@ -934,35 +914,73 @@
934914
935915 void SetupUI2(ObjEditor oe)
936916 {
937
-// oe.aConstraints.weightx = 0;
938
-// oe.aConstraints.weighty = 0;
939
-// oe.aConstraints.gridx = 0;
940
-// oe.aConstraints.gridy = 0;
941
- SetupName(oe);
917
+ //SetupName(oe);
918
+
919
+ namePanel = new cGridBag();
920
+
921
+ nameField = AddText(namePanel, copy.GetName());
922
+ namePanel.add(nameField);
923
+ oe.ctrlPanel.add(namePanel);
924
+
925
+ oe.ctrlPanel.Return();
942926
943927 if (!GroupEditor.allparams)
944928 return;
945929
946
- liveCB = AddCheckBox(oe, "Live", copy.live);
947
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
948
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
930
+ setupPanel = new cGridBag().setVertical(false);
931
+
932
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
933
+ liveCB.setToolTipText("Animate object");
934
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
935
+ selectCB.setToolTipText("Make object selectable");
949936 // 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");
937
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
938
+ hideCB.setToolTipText("Hide object");
939
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
940
+ markCB.setToolTipText("Set the animation target transform");
941
+
942
+ rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind);
943
+ rewindCB.setToolTipText("Rewind animation");
944
+
945
+ randomCB = AddCheckBox(setupPanel, "Random", copy.random);
946
+ randomCB.setToolTipText("Option for switch node");
947
+
948
+ if (Globals.ADVANCED)
949
+ {
950
+ link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master);
951
+ link2masterCB.setToolTipText("Attach to support");
952
+ speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup);
953
+ speedupCB.setToolTipText("Option motion capture");
954
+ }
955
+
956
+ oe.ctrlPanel.add(setupPanel);
957
+ oe.ctrlPanel.Return();
958
+
959
+ commandsPanel = new cGridBag().setVertical(false);
960
+
961
+ resetButton = AddButton(commandsPanel, "Reset");
962
+ resetButton.setToolTipText("Jump to frame zero");
963
+ stepButton = AddButton(commandsPanel, "Step");
964
+ stepButton.setToolTipText("Step one frame");
956965 // resetAllButton = AddButton(oe, "Reset All");
957966 // stepAllButton = AddButton(oe, "Step All");
958
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
959967 // Return();
960
- slowerButton = AddButton(oe, "Slow");
961
- fasterButton = AddButton(oe, "Fast");
962
- remarkButton = AddButton(oe, "Rem");
968
+ slowerButton = AddButton(commandsPanel, "Slow");
969
+ slowerButton.setToolTipText("Decrease animation speed");
970
+ fasterButton = AddButton(commandsPanel, "Fast");
971
+ fasterButton.setToolTipText("Increase animation speed");
972
+ remarkButton = AddButton(commandsPanel, "Remark");
973
+ remarkButton.setToolTipText("Set the current transform as the target");
963974
964
- Return();
975
+ oe.ctrlPanel.add(commandsPanel);
976
+ oe.ctrlPanel.Return();
965977
978
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
979
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
980
+ //Return();
981
+
982
+ oe.ctrlPanel.Return();
983
+
966984 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
967985 // ObjEditor.aConstraints.gridx += 1;
968986
....@@ -1056,7 +1074,7 @@
10561074 oe.aConstraints.gridwidth = 1;
10571075 /**/
10581076 nameField = AddText(oe.ctrlPanel, copy.GetName());
1059
- Return();
1077
+ oe.ctrlPanel.Return();
10601078
10611079 //ctrlPanel.add(textureButton = new Button("Texture..."));
10621080 //textureButton.setEnabled(false);
....@@ -1158,11 +1176,22 @@
11581176 //JPanel worldPanel =
11591177 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11601178 //worldPanel.setName("World");
1161
- /*JPanel*/ cameraPanel =
1162
- new JPanel(new BorderLayout());
1163
- cameraPanel.add(cameraView);
1164
- //new timeflow.app.TimeflowApp().TimeFlowWindow(cameraPanel, frame);
1179
+ centralPanel = new cGridBag();
1180
+ centralPanel.preferredWidth = 20;
1181
+ timelinePanel = new JPanel(new BorderLayout());
1182
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11651183
1184
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1185
+ cameraPanel.setContinuousLayout(true);
1186
+ cameraPanel.setOneTouchExpandable(true);
1187
+// cameraPanel.setDividerLocation(0.9);
1188
+// cameraPanel.setDividerSize(9);
1189
+ cameraPanel.setResizeWeight(1.0);
1190
+
1191
+ centralPanel.add(cameraView);
1192
+ //frame.setJMenuBar(timelineMenubar);
1193
+ //centralPanel.add(timelinePanel);
1194
+
11661195 //topView.camera = ;
11671196 //frontView.camera = new Camera(2);
11681197 //sideView.camera = new Camera(3);
....@@ -1178,12 +1207,13 @@
11781207 //frontView.object = copy;
11791208 //sideView.object = copy;
11801209
1181
- XYZPanel = new JPanel();
1182
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1210
+ XYZPanel = new cGridBag().setVertical(true);
1211
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11831212
1184
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1185
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1186
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1213
+ XYZPanel.preferredWidth = 5;
1214
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1215
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1216
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
11871217
11881218 /*
11891219 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1192,7 +1222,7 @@
11921222 gridPanel.add(cameraView);
11931223 gridPanel.add(XYZPanel);
11941224 */
1195
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout());
1225
+ gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
11961226 gridPanel.setContinuousLayout(true);
11971227 gridPanel.setOneTouchExpandable(true);
11981228 gridPanel.setDividerLocation(1.0);
....@@ -1221,10 +1251,11 @@
12211251 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12221252 //tmp.setName("Edit");
12231253 objectPanel.add(materialPanel);
1224
- JPanel north = new JPanel(new BorderLayout());
1225
- north.setName("Edit");
1226
- north.add(ctrlPanel, BorderLayout.NORTH);
1227
- objectPanel.add(north);
1254
+// JPanel north = new JPanel(new BorderLayout());
1255
+// north.setName("Edit");
1256
+// north.add(ctrlPanel, BorderLayout.NORTH);
1257
+// objectPanel.add(north);
1258
+ objectPanel.add(ctrlPanel);
12281259 objectPanel.add(infoPanel);
12291260
12301261 /*
....@@ -1245,16 +1276,23 @@
12451276 scrollpane.setWheelScrollingEnabled(true);
12461277 scrollpane.addMouseWheelListener(this); // Default not fast enough
12471278
1248
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1249
- scenePanel.add(scrollpane);
1279
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1280
+ scenePanel.preferredWidth = 6;
1281
+
1282
+ JTabbedPane tabbedPane = new JTabbedPane();
1283
+ tabbedPane.add(scrollpane);
12501284
1251
- scenePanel.add(FSPane = new cFileSystemPane(this));
1285
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12521286
1253
- optionsPanel = new JPanel(new GridBagLayout());
1287
+ optionsPanel = new cGridBag().setVertical(true);
12541288
12551289 optionsPanel.setName("Options");
1256
- scenePanel.add(optionsPanel);
1257
-
1290
+
1291
+ AddOptions(optionsPanel); //, aConstraints);
1292
+
1293
+ tabbedPane.add(optionsPanel);
1294
+
1295
+ scenePanel.add(tabbedPane);
12581296
12591297 /*
12601298 cTree jTree = new cTree(null);
....@@ -1288,6 +1326,7 @@
12881326 //bigPanel.setSize(new Dimension(10,10));
12891327 //bigPanel.add(ctrlPanel);
12901328 //bigPanel.add(gridPanel);
1329
+ /**
12911330 bigThree = new JPanel();
12921331 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12931332 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1304,14 +1343,20 @@
13041343 // aConstraints.gridheight = 3;
13051344 aWindowConstraints.gridx = 1;
13061345 aWindowConstraints.fill = GridBagConstraints.BOTH;
1307
- bigThree.add(cameraPanel, aWindowConstraints);
1346
+ bigThree.add(centralPanel, aWindowConstraints);
13081347 aWindowConstraints.weightx = 0;
13091348 aWindowConstraints.gridx = 4;
13101349 aWindowConstraints.gridwidth = 1;
13111350 // aConstraints.gridheight = 3;
13121351 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13131352 bigThree.add(XYZPanel, aWindowConstraints);
1353
+ /**/
13141354
1355
+ bigThree = new cGridBag();
1356
+ bigThree.addComponent(scenePanel);
1357
+ bigThree.addComponent(centralPanel);
1358
+ bigThree.addComponent(XYZPanel);
1359
+
13151360 // // SIDE EFFECT!!!
13161361 // aConstraints.gridx = 0;
13171362 // aConstraints.gridy = 0;
....@@ -1332,13 +1377,14 @@
13321377 //worldPane.add(bigPanel);
13331378 //worldPane.add(worldPanel);
13341379 /**/
1335
- frame.getContentPane().add(/*"Center",*/framePanel);
1380
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1381
+ frame.add(/*"Center",*/framePanel);
13361382 //frame.getContentPane().add(/*"Center",*/ worldPane);
13371383
13381384 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13391385
1340
- frame.setSize(1024, 768);
1341
- frame.show();
1386
+ frame.setSize(1280, 860);
1387
+ frame.setVisible(true);
13421388
13431389 gridPanel.setDividerLocation(1.0);
13441390
....@@ -1353,6 +1399,10 @@
13531399 });
13541400 }
13551401
1402
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1403
+ {
1404
+ }
1405
+
13561406 JTree GetTree()
13571407 {
13581408 return objEditor.jTree;
....@@ -1364,260 +1414,173 @@
13641414 ctrlPanel.removeAll();
13651415 }
13661416
1367
- void SetupMaterial(JPanel ctrlPanel)
1417
+ void SetupMaterial(cGridBag panel)
13681418 {
1369
- aConstraints.weighty = 0;
1370
- //aConstraints.weightx = 1;
1371
- /*
1419
+ /*
13721420 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13731421 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1374
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1375
- aConstraints.gridx += 1;
13761422 */
13771423
1378
- aConstraints.gridwidth = 1;
1379
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1380
- aConstraints.gridx += 1;
1381
- aConstraints.weighty = 0;
1382
- aConstraints.gridwidth = 1;
1424
+ cGridBag editBar = new cGridBag().setVertical(false);
1425
+
1426
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1427
+ createMaterialButton.setToolTipText("Create material");
13831428
13841429 /*
13851430 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1386
- aConstraints.gridx += 1;
1387
- aConstraints.weighty = 0;
1388
- aConstraints.gridwidth = 1;
13891431 */
13901432
1391
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1392
- aConstraints.gridx += 1;
1433
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1434
+ clearMaterialButton.setToolTipText("Clear material");
1435
+
1436
+ if (Globals.ADVANCED)
1437
+ {
1438
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1439
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1440
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1441
+ }
13931442
1394
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1395
-
1396
- aConstraints.gridx += 1;
1397
-
1398
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1399
-
1400
- aConstraints.gridx += 1;
1401
-
1402
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1403
-
1404
- aConstraints.gridx = 0;
1405
- aConstraints.gridy += 1;
1406
- aConstraints.weighty = 0;
1407
- aConstraints.gridwidth = 1;
1443
+ editBar.preferredHeight = 15;
1444
+
1445
+ panel.add(editBar);
1446
+
14081447 /**/
14091448 //aConstraints.weighty = 0;
14101449 ////aConstraints.weightx = 1;
14111450 //aConstraints.weighty = 1;
14121451 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14131452 //aConstraints.gridx += 1;
1414
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1415
- aConstraints.weighty = 0;
1416
- aConstraints.gridx = 0;
1417
- aConstraints.gridy += 1;
1418
- aConstraints.gridwidth = 1;
1453
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14191454
1420
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1421
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1422
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1423
- aConstraints.gridx += 1;
1424
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1425
- //aConstraints.weightx = 0;
1426
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1427
- aConstraints.gridx = 0;
1428
- aConstraints.gridy += 1;
1429
- aConstraints.gridwidth = 1;
1455
+ cGridBag colorSection = new cGridBag().setVertical(true);
1456
+
1457
+ cGridBag color = new cGridBag();
1458
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1459
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1460
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1461
+ //colorField.preferredWidth = 200;
1462
+ colorSection.add(color);
14301463
1431
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1432
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1433
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1434
- aConstraints.gridx += 1;
1435
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1436
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1437
- aConstraints.gridx = 0;
1438
- aConstraints.gridy += 1;
1439
- aConstraints.gridwidth = 1;
1464
+ cGridBag modulation = new cGridBag();
1465
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1466
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1467
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1468
+ colorSection.add(modulation);
14401469
1441
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1442
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1443
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1444
- aConstraints.gridx += 1;
1445
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1446
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1447
- aConstraints.gridx = 0;
1448
- aConstraints.gridy += 1;
1449
- aConstraints.gridwidth = 1;
1470
+ cGridBag texture = new cGridBag();
1471
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1472
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1473
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1474
+ colorSection.add(texture);
14501475
1451
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1452
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1453
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1454
- aConstraints.gridx += 1;
1455
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1456
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1457
- aConstraints.gridx = 0;
1458
- aConstraints.gridy += 1;
1459
- aConstraints.gridwidth = 1;
1476
+ cGridBag anisoU = new cGridBag();
1477
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1478
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1479
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1480
+ colorSection.add(anisoU);
14601481
1461
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1462
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1463
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1464
- aConstraints.gridx += 1;
1465
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1466
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1467
- aConstraints.gridx = 0;
1468
- aConstraints.gridy += 1;
1469
- aConstraints.gridwidth = 1;
1482
+ cGridBag anisoV = new cGridBag();
1483
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1484
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1485
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1486
+ colorSection.add(anisoV);
14701487
1471
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1472
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1473
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1474
- aConstraints.gridx += 1;
1475
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1476
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1477
- aConstraints.gridx = 0;
1478
- aConstraints.gridy += 1;
1479
- aConstraints.gridwidth = 1;
1488
+ cGridBag shadowbias = new cGridBag();
1489
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1490
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1492
+ colorSection.add(shadowbias);
14801493
1481
- //aConstraints.weighty = 1;
1482
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1483
- //aConstraints.gridx += 1;
1484
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1485
- aConstraints.weighty = 0;
1486
- aConstraints.gridx = 0;
1487
- aConstraints.gridy += 1;
1488
- aConstraints.gridwidth = 1;
1494
+ panel.add(new JSeparator());
1495
+
1496
+ panel.add(colorSection);
1497
+
1498
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1499
+
1500
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1501
+
1502
+ cGridBag diffuse = new cGridBag();
1503
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1504
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1505
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1506
+ diffuseSection.add(diffuse);
14891507
1490
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1491
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1492
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1493
- aConstraints.gridx += 1;
1494
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1495
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1496
- aConstraints.gridx = 0;
1497
- aConstraints.gridy += 1;
1498
- aConstraints.gridwidth = 1;
1508
+ cGridBag diffuseness = new cGridBag();
1509
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1510
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1511
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1512
+ diffuseSection.add(diffuseness);
14991513
1500
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1501
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1502
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1503
- aConstraints.gridx += 1;
1504
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1505
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1506
- aConstraints.gridx = 0;
1507
- aConstraints.gridy += 1;
1508
- aConstraints.gridwidth = 1;
1514
+ cGridBag selfshadow = new cGridBag();
1515
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1516
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1517
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1518
+ diffuseSection.add(selfshadow);
15091519
1510
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1511
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1512
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1513
- aConstraints.gridx += 1;
1514
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1515
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1516
- aConstraints.gridx = 0;
1517
- aConstraints.gridy += 1;
1518
- aConstraints.gridwidth = 1;
1520
+ cGridBag sheen = new cGridBag();
1521
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1522
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1523
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1524
+ diffuseSection.add(sheen);
15191525
1520
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1521
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1522
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1523
- aConstraints.gridx += 1;
1524
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1525
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1526
- aConstraints.gridx = 0;
1527
- aConstraints.gridy += 1;
1528
- aConstraints.gridwidth = 1;
1526
+ cGridBag subsurface = new cGridBag();
1527
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1528
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1529
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1530
+ diffuseSection.add(subsurface);
15291531
1530
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1531
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1532
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1533
- aConstraints.gridx += 1;
1534
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1535
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1536
- aConstraints.gridx = 0;
1537
- aConstraints.gridy += 1;
1538
- aConstraints.gridwidth = 1;
1532
+ cGridBag shadow = new cGridBag();
1533
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1534
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1535
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1536
+ diffuseSection.add(shadow);
15391537
1540
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1541
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1542
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1543
- aConstraints.gridx += 1;
1544
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1545
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1546
- aConstraints.gridx = 0;
1547
- aConstraints.gridy += 1;
1548
- aConstraints.gridwidth = 1;
1538
+ cGridBag fakedepth = new cGridBag();
1539
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1540
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1541
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1542
+ diffuseSection.add(fakedepth);
15491543
1550
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1551
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1552
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1553
- aConstraints.gridx += 1;
1554
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1555
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1556
- aConstraints.gridx = 0;
1557
- aConstraints.gridy += 1;
1558
- aConstraints.gridwidth = 1;
1544
+ panel.add(new JSeparator());
1545
+
1546
+ panel.add(diffuseSection);
1547
+
1548
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1549
+
1550
+ cGridBag specularSection = new cGridBag().setVertical(true);
15591551
1560
- //aConstraints.weighty = 1;
1561
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1562
- //aConstraints.gridx += 1;
1563
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1564
- aConstraints.weighty = 0;
1565
- aConstraints.gridx = 0;
1566
- aConstraints.gridy += 1;
1567
- aConstraints.gridwidth = 1;
1552
+ cGridBag specular = new cGridBag();
1553
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1554
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1555
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1556
+ specularSection.add(specular);
15681557
1569
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1570
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1571
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1572
- aConstraints.gridx += 1;
1573
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1574
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1575
- aConstraints.gridx = 0;
1576
- aConstraints.gridy += 1;
1577
- aConstraints.gridwidth = 1;
1558
+ cGridBag lightarea = new cGridBag();
1559
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1560
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1561
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1562
+ specularSection.add(lightarea);
15781563
1579
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1580
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1581
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1582
- aConstraints.gridx += 1;
1583
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1584
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1585
- aConstraints.gridx = 0;
1586
- aConstraints.gridy += 1;
1587
- aConstraints.gridwidth = 1;
1564
+ cGridBag shininess = new cGridBag();
1565
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1566
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1567
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1568
+ specularSection.add(shininess);
15881569
1589
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1590
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1591
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1592
- aConstraints.gridx += 1;
1593
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1594
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1595
- aConstraints.gridx = 0;
1596
- aConstraints.gridy += 1;
1597
- aConstraints.gridwidth = 1;
1570
+ cGridBag metalness = new cGridBag();
1571
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1572
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1573
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1574
+ specularSection.add(metalness);
15981575
1599
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1600
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1601
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1602
- aConstraints.gridx += 1;
1603
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1604
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1605
- aConstraints.gridx = 0;
1606
- aConstraints.gridy += 1;
1607
- aConstraints.gridwidth = 1;
1576
+ cGridBag velvet = new cGridBag();
1577
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1578
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1579
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1580
+ specularSection.add(velvet);
16081581
1609
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1610
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1611
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1612
- aConstraints.gridx += 1;
1613
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1614
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1615
- aConstraints.gridx = 0;
1616
- aConstraints.gridy += 1;
1617
- aConstraints.gridwidth = 1;
1618
-
1619
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1620
- Return();
1582
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1583
+ //Return();
16211584 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16221585 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16231586 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1628,130 +1591,93 @@
16281591 // aConstraints.gridy += 1;
16291592 // aConstraints.gridwidth = 1;
16301593
1631
- //aConstraints.weighty = 1;
1632
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1633
- //aConstraints.gridx += 1;
1634
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1635
- aConstraints.weighty = 0;
1636
- aConstraints.gridx = 0;
1637
- aConstraints.gridy += 1;
1638
- aConstraints.gridwidth = 1;
16391594
1640
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1641
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1642
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1643
- aConstraints.gridx += 1;
1644
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1645
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1646
- aConstraints.gridx = 0;
1647
- aConstraints.gridy += 1;
1648
- aConstraints.gridwidth = 1;
1595
+ panel.add(new JSeparator());
1596
+
1597
+ panel.add(specularSection);
1598
+
1599
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1600
+
1601
+ cGridBag globalSection = new cGridBag().setVertical(true);
16491602
1650
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1651
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1652
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1653
- aConstraints.gridx += 1;
1654
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1655
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1656
- aConstraints.gridx = 0;
1657
- aConstraints.gridy += 1;
1658
- aConstraints.gridwidth = 1;
1603
+ cGridBag camera = new cGridBag();
1604
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1605
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1606
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1607
+ globalSection.add(camera);
16591608
1660
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1661
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1662
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1663
- aConstraints.gridx += 1;
1664
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1665
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1666
- aConstraints.gridx = 0;
1667
- aConstraints.gridy += 1;
1668
- aConstraints.gridwidth = 1;
1609
+ cGridBag ambient = new cGridBag();
1610
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1611
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1612
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1613
+ globalSection.add(ambient);
16691614
1670
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1671
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1672
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1673
- aConstraints.gridx += 1;
1674
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1675
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1676
- aConstraints.gridx = 0;
1677
- aConstraints.gridy += 1;
1678
- aConstraints.gridwidth = 1;
1679
- aConstraints.weighty = 0;
1615
+ cGridBag backlit = new cGridBag();
1616
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1617
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1618
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1619
+ globalSection.add(backlit);
16801620
1681
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1682
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1683
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1684
- aConstraints.gridx += 1;
1685
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1686
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1687
- aConstraints.gridx = 0;
1688
- aConstraints.gridy += 1;
1689
- aConstraints.gridwidth = 1;
1621
+ cGridBag opacity = new cGridBag();
1622
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1623
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1624
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1625
+ globalSection.add(opacity);
16901626
1691
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1692
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1693
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1694
- aConstraints.gridx += 1;
1695
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1696
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1697
- aConstraints.gridx = 0;
1698
- aConstraints.gridy += 1;
1699
- aConstraints.gridwidth = 1;
1627
+ panel.add(new JSeparator());
1628
+
1629
+ panel.add(globalSection);
1630
+
1631
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1632
+
1633
+ cGridBag textureSection = new cGridBag().setVertical(true);
17001634
1701
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1702
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1703
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1704
- aConstraints.gridx += 1;
1705
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1706
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1707
- aConstraints.gridx = 0;
1708
- aConstraints.gridy += 1;
1709
- aConstraints.gridwidth = 1;
1635
+ cGridBag bump = new cGridBag();
1636
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1637
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1638
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1639
+ textureSection.add(bump);
17101640
1711
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1712
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1713
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1714
- aConstraints.gridx += 1;
1715
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1716
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1717
- aConstraints.gridx = 0;
1718
- aConstraints.gridy += 1;
1719
- aConstraints.gridwidth = 1;
1641
+ cGridBag noise = new cGridBag();
1642
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1643
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1644
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1645
+ textureSection.add(noise);
17201646
1721
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1722
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1723
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1724
- aConstraints.gridx += 1;
1725
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1726
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1727
- aConstraints.gridx = 0;
1728
- aConstraints.gridy += 1;
1729
- aConstraints.gridwidth = 1;
1647
+ cGridBag power = new cGridBag();
1648
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1649
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1650
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1651
+ textureSection.add(power);
17301652
1731
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1732
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1733
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1734
- aConstraints.gridx += 1;
1735
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1736
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1737
- aConstraints.gridx = 0;
1738
- aConstraints.gridy += 1;
1739
- aConstraints.gridwidth = 1;
1653
+ cGridBag borderfade = new cGridBag();
1654
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1655
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1656
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1657
+ textureSection.add(borderfade);
17401658
1741
- //aConstraints.weighty = 1;
1742
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1743
- //aConstraints.gridx += 1;
1744
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1745
- aConstraints.weighty = 0;
1659
+ cGridBag fog = new cGridBag();
1660
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1661
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1662
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1663
+ textureSection.add(fog);
17461664
1747
- aConstraints.gridx = 0;
1748
- aConstraints.gridy = 0;
1749
- aConstraints.gridwidth = 1;
1665
+ cGridBag opacityPower = new cGridBag();
1666
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1667
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1668
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1669
+ textureSection.add(opacityPower);
1670
+
1671
+ panel.add(new JSeparator());
1672
+
1673
+ panel.add(textureSection);
1674
+
1675
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17501676
17511677 SetMaterial(copy); // .GetMaterial());
17521678
1753
- colorField.addChangeListener(this);
1754
- modulationField.addChangeListener(this);
1679
+ //colorField.addChangeListener(this);
1680
+// modulationField.addChangeListener(this);
17551681 metalnessField.addChangeListener(this);
17561682 diffuseField.addChangeListener(this);
17571683 specularField.addChangeListener(this);
....@@ -1781,12 +1707,15 @@
17811707 opacityPowerField.addChangeListener(this);
17821708 /**/
17831709
1784
- resetSlidersButton.addActionListener(this);
17851710 clearMaterialButton.addActionListener(this);
17861711 createMaterialButton.addActionListener(this);
1787
-
1788
- propagateToggle.addItemListener(this);
1789
- multiplyToggle.addItemListener(this);
1712
+
1713
+ if (Globals.ADVANCED)
1714
+ {
1715
+ resetSlidersButton.addActionListener(this);
1716
+ propagateToggle.addItemListener(this);
1717
+ multiplyToggle.addItemListener(this);
1718
+ }
17901719 }
17911720
17921721 void DropFile(java.io.File[] files, boolean textures)
....@@ -1957,7 +1886,7 @@
19571886
19581887 //? flashIt = false;
19591888 CameraPane pane = (CameraPane) cameraView;
1960
- pane.clickStart(location.x, location.y, 0);
1889
+ pane.clickStart(location.x, location.y, 0, 0);
19611890 pane.clickEnd(location.x, location.y, 0, true);
19621891
19631892 if (group.selection.size() == 1)
....@@ -2006,6 +1935,7 @@
20061935 e2.printStackTrace();
20071936 }
20081937 }
1938
+
20091939 LoadJMEThread loadThread;
20101940
20111941 class LoadJMEThread extends Thread
....@@ -2063,6 +1993,7 @@
20631993 //LoadFile0(filename, converter);
20641994 }
20651995 }
1996
+
20661997 LoadOBJThread loadObjThread;
20671998
20681999 class LoadOBJThread extends Thread
....@@ -2141,19 +2072,19 @@
21412072
21422073 void LoadObjFile(String fullname)
21432074 {
2144
- /*
2075
+ System.out.println("Loading " + fullname);
2076
+ /**/
21452077 //lastFilename = fullname;
21462078 if(loadObjThread == null)
21472079 {
2148
- loadObjThread = new LoadOBJThread();
2149
- loadObjThread.start();
2080
+ loadObjThread = new LoadOBJThread();
2081
+ loadObjThread.start();
21502082 }
21512083
21522084 loadObjThread.add(fullname);
2153
- */
2085
+ /**/
21542086
2155
- System.out.println("Loading " + fullname);
2156
- makeSomething(new FileObject(fullname, true), true);
2087
+ //makeSomething(new FileObject(fullname, true), true);
21572088 }
21582089
21592090 void LoadGFDFile(String fullname)
....@@ -2414,11 +2345,11 @@
24142345
24152346 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24162347 {
2417
- if (GrafreeD.standAlone)
2348
+ if (Grafreed.standAlone)
24182349 {
24192350 /**/
24202351 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2421
- browser.show();
2352
+ browser.setVisible(true);
24222353 String filename = browser.getFile();
24232354 if (filename != null && filename.length() > 0)
24242355 {
....@@ -2563,6 +2494,7 @@
25632494 }
25642495 if (input == null)
25652496 {
2497
+ new Exception().printStackTrace();
25662498 System.exit(0);
25672499 }
25682500
....@@ -2777,7 +2709,8 @@
27772709 return;
27782710 }
27792711
2780
- multiplyToggle.setSelected(mat.multiply);
2712
+ if (multiplyToggle != null)
2713
+ multiplyToggle.setSelected(mat.multiply);
27812714
27822715 assert (object.projectedVertices != null);
27832716
....@@ -2959,25 +2892,42 @@
29592892 // june 2013 copy.HardTouch();
29602893 cameraView.repaint();
29612894 return;
2962
- } else if (event.getSource() == toggleFullItem)
2895
+ } else if (event.getSource() == toggleTimelineItem)
29632896 {
2964
- if (CameraPane.FULLSCREEN)
2897
+ timeline ^= true;
2898
+
2899
+ if (timeline)
29652900 {
2966
- frame.getContentPane().remove(/*"Center",*/bigThree);
2967
- framePanel.add(bigThree);
2968
- frame.getContentPane().add(/*"Center",*/framePanel);
2969
- } else
2970
- {
2971
- frame.getContentPane().remove(/*"Center",*/framePanel);
2972
- frame.getContentPane().add(/*"Center",*/bigThree);
2901
+ centralPanel.remove(cameraView);
2902
+ cameraPanel.add(cameraView);
2903
+ centralPanel.add(cameraPanel);
2904
+ frame.setJMenuBar(timelineMenubar);
2905
+ wasFullScreen = CameraPane.FULLSCREEN;
2906
+ if (!CameraPane.FULLSCREEN)
2907
+ ToggleFullScreen();
2908
+ toggleFullScreenItem.setEnabled(false);
29732909 }
2910
+ else
2911
+ {
2912
+ centralPanel.remove(cameraPanel);
2913
+ centralPanel.add(cameraView);
2914
+ frame.setJMenuBar(null);
2915
+ if (!wasFullScreen)
2916
+ ToggleFullScreen();
2917
+ toggleFullScreenItem.setEnabled(true);
2918
+ }
2919
+
29742920 frame.validate();
2975
- cameraView.ToggleFullScreen();
2921
+ return;
2922
+ } else if (event.getSource() == toggleFullScreenItem)
2923
+ {
2924
+ ToggleFullScreen();
2925
+ frame.validate();
29762926
29772927 return;
2978
- } else if (event.getSource() == toggleRandomItem)
2928
+ } else if (event.getSource() == toggleSwitchItem)
29792929 {
2980
- cameraView.ToggleRandom();
2930
+ cameraView.ToggleSwitch();
29812931 cameraView.repaint();
29822932 return;
29832933 } else if (event.getSource() == toggleHandleItem)
....@@ -3006,6 +2956,10 @@
30062956 {
30072957 copy.live ^= true;
30082958 return;
2959
+ } else if (event.getSource() == selectCB)
2960
+ {
2961
+ copy.dontselect ^= true;
2962
+ return;
30092963 } else if (event.getSource() == hideCB)
30102964 {
30112965 copy.hide ^= true;
....@@ -3020,6 +2974,7 @@
30202974 if (event.getSource() == randomCB)
30212975 {
30222976 copy.random ^= true;
2977
+ objEditor.refreshContents();
30232978 return;
30242979 }
30252980 if (event.getSource() == speedupCB)
....@@ -3043,8 +2998,9 @@
30432998
30442999 public void actionPerformed(ActionEvent event)
30453000 {
3001
+ Object source = event.getSource();
30463002 // SCRIPT DIALOG
3047
- if (event.getSource() == okbutton)
3003
+ if (source == okbutton)
30483004 {
30493005 textpanel.setVisible(false);
30503006 textpanel.remove(textarea);
....@@ -3056,7 +3012,7 @@
30563012 textarea = null;
30573013 textpanel = null;
30583014 }
3059
- if (event.getSource() == cancelbutton)
3015
+ if (source == cancelbutton)
30603016 {
30613017 textpanel.setVisible(false);
30623018 textpanel.remove(textarea);
....@@ -3068,49 +3024,50 @@
30683024 //applySelf();
30693025 //client.refreshEditWindow();
30703026 //refreshContents();
3071
- if (event.getSource() == nameField)
3027
+ if (source == nameField)
30723028 {
30733029 //System.out.println("ObjEditor " + event);
30743030 applySelf0(true);
30753031 //parent.applySelf();
30763032 objEditor.refreshContents();
3077
- } else if (event.getSource() == resetButton)
3033
+ } else if (source == resetButton)
30783034 {
30793035 CameraPane.fullreset = true;
30803036 copy.Reset(); // ResetMeshes();
30813037 copy.Touch();
30823038 objEditor.refreshContents();
3083
- } else if (event.getSource() == stepItem)
3039
+ } else if (source == stepItem)
30843040 {
3085
- cameraView.ONESTEP = true;
3041
+ //cameraView.ONESTEP = true;
3042
+ Globals.ONESTEP = true;
30863043 cameraView.repaint();
30873044 return;
3088
- } else if (event.getSource() == stepButton)
3045
+ } else if (source == stepButton)
30893046 {
30903047 copy.Step();
30913048 copy.Touch();
30923049 objEditor.refreshContents();
3093
- } else if (event.getSource() == slowerButton)
3050
+ } else if (source == slowerButton)
30943051 {
30953052 copy.Slower();
30963053 copy.Touch();
30973054 objEditor.refreshContents();
3098
- } else if (event.getSource() == fasterButton)
3055
+ } else if (source == fasterButton)
30993056 {
31003057 copy.Faster();
31013058 copy.Touch();
31023059 objEditor.refreshContents();
3103
- } else if (event.getSource() == remarkButton)
3060
+ } else if (source == remarkButton)
31043061 {
31053062 copy.Remark();
31063063 copy.Touch();
31073064 objEditor.refreshContents();
3108
- } else if (event.getSource() == stepAllButton)
3065
+ } else if (source == stepAllButton)
31093066 {
31103067 copy.StepAll();
31113068 copy.Touch();
31123069 objEditor.refreshContents();
3113
- } else if (event.getSource() == resetAllButton)
3070
+ } else if (source == resetAllButton)
31143071 {
31153072 //CameraPane.fullreset = true;
31163073 copy.ResetAll(); // ResetMeshes();
....@@ -3143,53 +3100,75 @@
31433100 // Close();
31443101 // }
31453102 // else
3146
- if (event.getSource() == resetSlidersButton)
3103
+ if (source == resetSlidersButton)
31473104 {
31483105 ResetSliders();
3149
- } else if (event.getSource() == clearMaterialButton)
3106
+ } else if (source == clearMaterialButton)
31503107 {
31513108 ClearMaterial();
3152
- } else if (event.getSource() == createMaterialButton)
3109
+ } else if (source == createMaterialButton)
31533110 {
31543111 CreateMaterial();
3155
- } else if (event.getSource() == clearPanelButton)
3112
+ } else if (source == clearPanelButton)
31563113 {
31573114 copy.ClearUI();
31583115 refreshContents(true);
3159
- } /*
3160
- }
3161
-
3162
- public boolean action(Event event, Object arg)
3163
- {
3164
- */ else if (event.getSource() == closeItem)
3116
+ } else if (source == importGFDItem)
3117
+ {
3118
+ ImportGFD();
3119
+ } else
3120
+ if (source == importVRMLX3DItem)
3121
+ {
3122
+ ImportVRMLX3D();
3123
+ } else
3124
+ if (source == import3DSItem)
3125
+ {
3126
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3127
+ } else
3128
+ if (source == importOBJItem)
3129
+ {
3130
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3131
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3132
+ browser.setVisible(true);
3133
+ String filename = browser.getFile();
3134
+ if (filename != null && filename.length() > 0)
3135
+ {
3136
+ String fullname = browser.getDirectory() + filename;
3137
+ makeSomething(ReadOBJ(fullname), true);
3138
+ }
3139
+ } else
3140
+ if (source == closeItem)
31653141 {
31663142 Close();
31673143 //return true;
3168
- } else if (event.getSource() == loadItem)
3144
+ } else if (source == loadItem)
31693145 {
31703146 load();
31713147 //return true;
3172
- } else if (event.getSource() == saveItem)
3148
+ } else if (source == newItem)
3149
+ {
3150
+ New();
3151
+ } else if (source == saveItem)
31733152 {
31743153 save();
31753154 //return true;
3176
- } else if (event.getSource() == saveAsItem)
3155
+ } else if (source == saveAsItem)
31773156 {
31783157 saveAs();
31793158 //return true;
3180
- } else if (event.getSource() == reexportItem)
3159
+ } else if (source == reexportItem)
31813160 {
31823161 reexport();
31833162 //return true;
3184
- } else if (event.getSource() == exportAsItem)
3163
+ } else if (source == exportAsItem)
31853164 {
31863165 export();
31873166 //return true;
3188
- } else if (event.getSource() == povItem)
3167
+ } else if (source == povItem)
31893168 {
31903169 generatePOV();
31913170 //return true;
3192
- } else if (event.getSource() == zBufferItem)
3171
+ } else if (source == zBufferItem)
31933172 {
31943173 try
31953174 {
....@@ -3211,21 +3190,8 @@
32113190 cameraView.repaint();
32123191 //return true;
32133192 }
3214
- */ else if (event.getSource() == editCameraItem)
3215
- {
3216
- cameraView.ProtectCamera();
3217
- cameraView.repaint();
3218
- return;
3219
- } else if (event.getSource() == revertCameraItem)
3220
- {
3221
- cameraView.RevertCamera();
3222
- cameraView.repaint();
3223
- return;
3224
- } else if (event.getSource() == textureButton)
3225
- {
3226
- return; // true;
3227
- } else // combos...
3228
- if (event.getSource() == texresMenu)
3193
+ */ else // combos...
3194
+ if (source == texresMenu)
32293195 {
32303196 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32313197 copy.texres = texresMenu.getSelectedIndex();
....@@ -3237,27 +3203,283 @@
32373203 }
32383204 }
32393205
3240
- void ToggleAnimation()
3206
+ void New()
32413207 {
3242
- if (!CameraPane.ANIMATION)
3208
+ while (copy.Size() > 1)
32433209 {
3244
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3210
+ copy.remove(1);
3211
+ }
3212
+
3213
+ ResetModel();
3214
+ objEditor.refreshContents();
3215
+ }
3216
+
3217
+ static public byte[] Compress(Object3D o)
3218
+ {
3219
+ try
3220
+ {
3221
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3222
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3223
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3224
+
3225
+ Object3D parent = o.parent;
3226
+ o.parent = null;
3227
+
3228
+ out.writeObject(o);
3229
+
3230
+ o.parent = parent;
3231
+
3232
+ out.flush();
3233
+
3234
+ zstream.close();
3235
+ out.close();
3236
+
3237
+ return baos.toByteArray();
3238
+ } catch (Exception e)
3239
+ {
3240
+ System.err.println(e);
3241
+ return null;
3242
+ }
3243
+ }
3244
+
3245
+ static public Object Uncompress(byte[] bytes)
3246
+ {
3247
+ System.out.println("#bytes = " + bytes.length);
3248
+ try
3249
+ {
3250
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3251
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3252
+ ObjectInputStream in = new ObjectInputStream(istream);
3253
+ Object obj = in.readObject();
3254
+ in.close();
3255
+
3256
+ return obj;
3257
+ } catch (Exception e)
3258
+ {
3259
+ System.err.println(e);
3260
+ return null;
3261
+ }
3262
+ }
3263
+
3264
+ static public Object clone(Object o)
3265
+ {
3266
+ try
3267
+ {
3268
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3269
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3270
+
3271
+ out.writeObject(o);
3272
+
3273
+ out.flush();
3274
+ out.close();
3275
+
3276
+ byte[] bytes = baos.toByteArray();
3277
+
3278
+ System.out.println("clone = " + bytes.length);
3279
+
3280
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3281
+ ObjectInputStream in = new ObjectInputStream(bais);
3282
+ Object obj = in.readObject();
3283
+ in.close();
3284
+
3285
+ return obj;
3286
+ } catch (Exception e)
3287
+ {
3288
+ System.err.println(e);
3289
+ return null;
3290
+ }
3291
+ }
3292
+
3293
+ cRadio GetCurrentTab()
3294
+ {
3295
+ cRadio ab;
3296
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3297
+ {
3298
+ ab = (cRadio)e.nextElement();
3299
+ if(ab.GetObject() == copy)
3300
+ {
3301
+ return ab;
3302
+ }
3303
+ }
3304
+
3305
+ return null;
3306
+ }
3307
+
3308
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3309
+
3310
+ public void Save()
3311
+ {
3312
+ cRadio tab = GetCurrentTab();
3313
+
3314
+ boolean temp = CameraPane.SWITCH;
3315
+ CameraPane.SWITCH = false;
3316
+
3317
+ copy.ExtractBigData(hashtable);
3318
+
3319
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3320
+ tab.graphs[tab.undoindex++] = Compress(copy);
3321
+
3322
+ copy.RestoreBigData(hashtable);
3323
+
3324
+ CameraPane.SWITCH = temp;
3325
+
3326
+ //assert(hashtable.isEmpty());
3327
+
3328
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3329
+ {
3330
+ tab.graphs[i] = null;
3331
+ }
3332
+
3333
+ // test save
3334
+ if (false)
3335
+ {
3336
+ try
3337
+ {
3338
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3339
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3340
+
3341
+ p.writeObject(copy);
3342
+
3343
+ p.flush();
3344
+
3345
+ ostream.close();
3346
+ } catch (Exception e)
3347
+ {
3348
+ e.printStackTrace();
3349
+ }
3350
+ }
3351
+ }
3352
+
3353
+ void CopyChanged(Object3D obj)
3354
+ {
3355
+ boolean temp = CameraPane.SWITCH;
3356
+ CameraPane.SWITCH = false;
3357
+
3358
+ copy.ExtractBigData(hashtable);
3359
+
3360
+ copy.clear();
3361
+
3362
+ for (int i=0; i<obj.Size(); i++)
3363
+ {
3364
+ copy.add(obj.get(i));
3365
+ }
3366
+
3367
+ copy.RestoreBigData(hashtable);
3368
+
3369
+ CameraPane.SWITCH = temp;
3370
+
3371
+ //assert(hashtable.isEmpty());
3372
+
3373
+ copy.Touch();
3374
+
3375
+ ResetModel();
3376
+ copy.HardTouch(); // recompile?
3377
+
3378
+ cRadio ab;
3379
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3380
+ {
3381
+ ab = (cRadio)e.nextElement();
3382
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3383
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3384
+ if (test != null)
3385
+ {
3386
+ test.editWindow = ab.object.editWindow;
3387
+ ab.object = test;
3388
+ }
3389
+ }
3390
+
3391
+ refreshContents();
3392
+ }
3393
+
3394
+ public void Undo()
3395
+ {
3396
+ cRadio tab = GetCurrentTab();
3397
+
3398
+ if (tab.undoindex == 0)
3399
+ {
3400
+ java.awt.Toolkit.getDefaultToolkit().beep();
3401
+ return;
3402
+ }
3403
+
3404
+ if (tab.graphs[tab.undoindex] == null)
3405
+ {
3406
+ Save();
3407
+ tab.undoindex -= 1;
3408
+ }
3409
+
3410
+ tab.undoindex -= 1;
3411
+
3412
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3413
+ }
3414
+
3415
+ public void Redo()
3416
+ {
3417
+ cRadio tab = GetCurrentTab();
3418
+
3419
+ if (tab.graphs[tab.undoindex + 1] == null)
3420
+ {
3421
+ java.awt.Toolkit.getDefaultToolkit().beep();
3422
+ return;
3423
+ }
3424
+
3425
+ tab.undoindex += 1;
3426
+
3427
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3428
+ }
3429
+
3430
+ void ImportGFD()
3431
+ {
3432
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32453433 browser.show();
32463434 String filename = browser.getFile();
32473435 if (filename != null && filename.length() > 0)
32483436 {
3249
- CameraPane.filename = browser.getDirectory() + filename;
3437
+ String fullname = browser.getDirectory() + filename;
3438
+
3439
+ //Object3D readobj =
3440
+ objEditor.ReadGFD(fullname, objEditor);
3441
+ //makeSomething(readobj);
3442
+ }
3443
+ }
3444
+
3445
+ void ImportVRMLX3D()
3446
+ {
3447
+ if (Grafreed.standAlone)
3448
+ {
3449
+ /**/
3450
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3451
+ browser.show();
3452
+ String filename = browser.getFile();
3453
+ if (filename != null && filename.length() > 0)
3454
+ {
3455
+ String fullname = browser.getDirectory() + filename;
3456
+ LoadVRMLX3D(fullname);
3457
+ }
3458
+ /**/
3459
+ }
3460
+ }
3461
+
3462
+ void ToggleAnimation()
3463
+ {
3464
+ if (!Globals.ANIMATION)
3465
+ {
3466
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3467
+ browser.setVisible(true);
3468
+ String filename = browser.getFile();
3469
+ if (filename != null && filename.length() > 0)
3470
+ {
3471
+ Globals.filename = browser.getDirectory() + filename;
32503472 //CameraPane.framecount = 0;
3251
- CameraPane.imagecount = 0;
3473
+ Globals.imagecount = 0;
32523474
3253
- CameraPane.ANIMATION ^= true;
3475
+ Globals.ANIMATION ^= true;
32543476
3255
- GrafreeD.wav.cursor = 0;
3256
- GrafreeD.wav.loop = 0;
3477
+ Grafreed.wav.cursor = 0;
3478
+ Grafreed.wav.loop = 0;
32573479 }
32583480 } else
32593481 {
3260
- CameraPane.ANIMATION ^= true;
3482
+ Globals.ANIMATION ^= true;
32613483 }
32623484 }
32633485
....@@ -3303,7 +3525,7 @@
33033525 void CreateMaterial()
33043526 {
33053527 //copy.ClearMaterial(); // PATCH
3306
- copy.CreateMaterialS(multiplyToggle.isSelected());
3528
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33073529 if (copy.selection.size() > 0)
33083530 //SetMaterial(copy);
33093531 {
....@@ -3362,11 +3584,11 @@
33623584 {
33633585 copy.ResetBlockLoop(); // temporary problem
33643586
3365
- boolean random = CameraPane.RANDOM;
3366
- CameraPane.RANDOM = false; // parse everything
3587
+ boolean random = CameraPane.SWITCH;
3588
+ CameraPane.SWITCH = false; // parse everything
33673589 copy.ResetDisplayList();
33683590 copy.HardTouch();
3369
- CameraPane.RANDOM = random;
3591
+ CameraPane.SWITCH = random;
33703592 }
33713593
33723594 // public void applySelf()
....@@ -3436,10 +3658,40 @@
34363658 current.fakedepth = (float) fakedepthField.getFloat();
34373659 current.shadowbias = (float) shadowbiasField.getFloat();
34383660
3439
- if (!NumberSlider.frozen)
3661
+ if (!cNumberSlider.frozen)
34403662 {
34413663 //System.out.println("Propagate = " + propagate);
34423664 copy.UpdateMaterial(anchor, current, propagate);
3665
+
3666
+ if (copy.material != null)
3667
+ {
3668
+ cMaterial mat = copy.material;
3669
+
3670
+ colorField.SetToolTipValue((mat.color));
3671
+ modulationField.SetToolTipValue((mat.modulation));
3672
+ metalnessField.SetToolTipValue((mat.metalness));
3673
+ diffuseField.SetToolTipValue((mat.diffuse));
3674
+ specularField.SetToolTipValue((mat.specular));
3675
+ shininessField.SetToolTipValue((mat.shininess));
3676
+ shiftField.SetToolTipValue((mat.shift));
3677
+ ambientField.SetToolTipValue((mat.ambient));
3678
+ lightareaField.SetToolTipValue((mat.lightarea));
3679
+ diffusenessField.SetToolTipValue((mat.factor));
3680
+ velvetField.SetToolTipValue((mat.velvet));
3681
+ sheenField.SetToolTipValue((mat.sheen));
3682
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3683
+ backlitField.SetToolTipValue((mat.bump));
3684
+ anisoField.SetToolTipValue((mat.aniso));
3685
+ anisoVField.SetToolTipValue((mat.anisoV));
3686
+ cameraField.SetToolTipValue((mat.cameralight));
3687
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3688
+ shadowField.SetToolTipValue((mat.shadow));
3689
+ textureField.SetToolTipValue((mat.texture));
3690
+ opacityField.SetToolTipValue((mat.opacity));
3691
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3692
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3693
+ }
3694
+
34433695 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34443696 {
34453697 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3484,6 +3736,7 @@
34843736 || e.getSource() == apertureField
34853737 || e.getSource() == shadowblurField)
34863738 {
3739
+ new Exception().printStackTrace();
34873740 System.exit(0);
34883741 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34893742 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3510,7 +3763,13 @@
35103763 //System.out.println("PARENT = " + parent);
35113764 //if (parent != null)
35123765 // parent.applySelf();
3513
- refreshContents();
3766
+ if (e.getSource() == normalpushField)
3767
+ {
3768
+ objEditor.refreshContents();
3769
+ //Refresh();
3770
+ }
3771
+ else
3772
+ refreshContents();
35143773 // ??? client.refreshEditWindow();
35153774 }
35163775 //else
....@@ -3522,7 +3781,7 @@
35223781 //group.name = nameField.getText();
35233782 //objEditor.applySelf();
35243783
3525
- assert (objEditor == this);
3784
+ // OCT2018: assert (objEditor == this);
35263785 if (copy.selection == null || copy.selection.size() == 0)
35273786 //super.applySelf()
35283787 ; else
....@@ -3546,12 +3805,18 @@
35463805 objEditor.copy = keep;
35473806 }
35483807 }
3808
+
3809
+ if (normalpushField != null)
3810
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35493811 }
35503812
35513813 void SnapObject()
35523814 {
3553
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3554
- SnapObject(obj);
3815
+ if (copy.selection.size() > 0)
3816
+ {
3817
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
3818
+ SnapObject(obj);
3819
+ }
35553820 }
35563821
35573822 void SnapObject(Object3D obj)
....@@ -3797,7 +4062,7 @@
37974062
37984063 radioPanel.revalidate();
37994064 radioPanel.repaint();
3800
- ctrlPanel.revalidate(); // ? new
4065
+ ctrlPanel.validate(); // ? new
38014066 ctrlPanel.repaint();
38024067 }
38034068 }
....@@ -3806,6 +4071,7 @@
38064071
38074072 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38084073 {
4074
+ Save();
38094075 //Tween.set(thing, 0).target(1).start(tweenManager);
38104076 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38114077 // if (thing instanceof GenericJointDemo)
....@@ -4009,6 +4275,7 @@
40094275 }
40104276 }
40114277 }
4278
+
40124279 LoadGFDThread loadGFDThread;
40134280
40144281 void ReadGFD(String fullname, iCallBack cb)
....@@ -4028,8 +4295,10 @@
40284295
40294296 try
40304297 {
4298
+ // Try compressed version first.
40314299 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4032
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4300
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4301
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40334302
40344303 readobj = (Object3D) p.readObject();
40354304 istream.close();
....@@ -4037,7 +4306,20 @@
40374306 readobj.ResetDisplayList();
40384307 } catch (Exception e)
40394308 {
4040
- e.printStackTrace();
4309
+ //e.printStackTrace();
4310
+ try
4311
+ {
4312
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4313
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4314
+
4315
+ readobj = (Object3D) p.readObject();
4316
+ istream.close();
4317
+
4318
+ readobj.ResetDisplayList();
4319
+ } catch (Exception e2)
4320
+ {
4321
+ e2.printStackTrace();
4322
+ }
40414323 }
40424324 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40434325 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4083,6 +4365,12 @@
40834365
40844366 void LoadIt(Object obj)
40854367 {
4368
+ if (obj == null)
4369
+ {
4370
+ // Invalid file
4371
+ return;
4372
+ }
4373
+
40864374 System.out.println("Loaded " + obj);
40874375 //new Exception().printStackTrace();
40884376 Object3D readobj = (Object3D) obj;
....@@ -4092,6 +4380,7 @@
40924380
40934381 if (readobj != null)
40944382 {
4383
+ Save();
40954384 try
40964385 {
40974386 //readobj.deepCopySelf(copy);
....@@ -4154,7 +4443,7 @@
41544443
41554444 void load() // throws ClassNotFoundException
41564445 {
4157
- if (GrafreeD.standAlone)
4446
+ if (Grafreed.standAlone)
41584447 {
41594448 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41604449 browser.show();
....@@ -4241,11 +4530,13 @@
42414530 try
42424531 {
42434532 FileOutputStream ostream = new FileOutputStream(lastname);
4244
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4533
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4534
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42454535
42464536 p.writeObject(copy);
42474537 p.flush();
42484538
4539
+ zstream.close();
42494540 ostream.close();
42504541
42514542 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4255,11 +4546,12 @@
42554546 {
42564547 }
42574548 }
4549
+
42584550 String lastname;
42594551
42604552 void saveAs()
42614553 {
4262
- if (GrafreeD.standAlone)
4554
+ if (Grafreed.standAlone)
42634555 {
42644556 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42654557 browser.setVisible(true);
....@@ -4364,13 +4656,13 @@
43644656 try
43654657 {
43664658 FileOutputStream ostream = new FileOutputStream(filename);
4367
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4368
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4659
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4660
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43694661
43704662 Object3D objectparent = obj.parent;
43714663 obj.parent = null;
43724664
4373
- Object3D object = (Object3D) GrafreeD.clone(obj);
4665
+ Object3D object = (Object3D) Grafreed.clone(obj);
43744666
43754667 obj.parent = objectparent;
43764668
....@@ -4382,8 +4674,8 @@
43824674 p.writeObject(object);
43834675 p.flush();
43844676
4677
+ zstream.close();
43854678 ostream.close();
4386
- // zstream.close();
43874679
43884680 // group.selection.get(0).parent = parent;
43894681 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4404,7 +4696,7 @@
44044696 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44054697 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44064698 copy.generatePOV(buffer);
4407
- if (GrafreeD.standAlone)
4699
+ if (Grafreed.standAlone)
44084700 {
44094701 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44104702 browser.show();
....@@ -4430,7 +4722,8 @@
44304722 Object3D client;
44314723 Object3D copy;
44324724 MenuBar menuBar;
4433
- Menu windowMenu;
4725
+ Menu fileMenu;
4726
+ MenuItem newItem;
44344727 MenuItem loadItem;
44354728 MenuItem saveItem;
44364729 MenuItem saveAsItem;
....@@ -4438,21 +4731,20 @@
44384731 MenuItem reexportItem;
44394732 MenuItem povItem;
44404733 MenuItem closeItem;
4441
- Menu cameraMenu;
4734
+
44424735 CheckboxMenuItem zBufferItem;
44434736 //MenuItem normalLensItem;
4444
- MenuItem editCameraItem;
4445
- MenuItem revertCameraItem;
4446
- CheckboxMenuItem toggleLiveItem;
44474737 MenuItem stepItem;
4448
- CheckboxMenuItem toggleFullItem;
4738
+ CheckboxMenuItem toggleLiveItem;
4739
+ CheckboxMenuItem toggleFullScreenItem;
4740
+ CheckboxMenuItem toggleTimelineItem;
44494741 CheckboxMenuItem toggleRenderItem;
44504742 CheckboxMenuItem toggleDebugItem;
44514743 CheckboxMenuItem toggleFrustumItem;
44524744 CheckboxMenuItem toggleFootContactItem;
44534745 CheckboxMenuItem toggleDLItem;
44544746 CheckboxMenuItem toggleTextureItem;
4455
- CheckboxMenuItem toggleRandomItem;
4747
+ CheckboxMenuItem toggleSwitchItem;
44564748 CheckboxMenuItem toggleRootItem;
44574749 CheckboxMenuItem animationItem;
44584750 CheckboxMenuItem toggleHandleItem;
....@@ -4460,23 +4752,26 @@
44604752 JSplitPane mainPanel;
44614753 JScrollPane scrollpane;
44624754 JPanel toolbarPanel;
4463
- JPanel treePanel;
4755
+ cGridBag treePanel;
44644756 JPanel radioPanel;
44654757 ButtonGroup buttonGroup;
4466
- JPanel ctrlPanel;
4467
- JPanel materialPanel;
4758
+ cGridBag ctrlPanel;
4759
+ cGridBag materialPanel;
44684760 JScrollPane infoPanel;
4469
- JPanel optionsPanel;
4761
+ cGridBag optionsPanel;
44704762 JTabbedPane objectPanel;
4471
- JPanel XYZPanel;
4763
+ cGridBag XYZPanel;
44724764 JSplitPane gridPanel;
44734765 JSplitPane bigPanel;
4474
- JPanel bigThree;
4475
- JTabbedPane scenePanel;
4476
- JPanel cameraPanel;
4766
+ cGridBag bigThree;
4767
+ cGridBag scenePanel;
4768
+ cGridBag centralPanel;
4769
+ JSplitPane cameraPanel;
4770
+ JPanel timelinePanel;
4771
+ JMenuBar timelineMenubar;
44774772 JSplitPane framePanel;
44784773 JTextArea/*Field*/ nameField;
4479
- cButton textureButton;
4774
+ //cButton textureButton;
44804775 cButton okButton;
44814776 cButton applyButton;
44824777 cButton cancelButton;
....@@ -4523,65 +4818,72 @@
45234818 // MATERIAL
45244819 JLabel materialLabel;
45254820 JLabel colorLabel;
4526
- NumberSlider colorField;
4821
+ cNumberSlider colorField;
45274822 JLabel modulationLabel;
4528
- NumberSlider modulationField;
4823
+ cNumberSlider modulationField;
45294824 JLabel metalnessLabel;
4530
- NumberSlider metalnessField;
4825
+ cNumberSlider metalnessField;
45314826 JLabel diffuseLabel;
4532
- NumberSlider diffuseField;
4827
+ cNumberSlider diffuseField;
45334828 JLabel specularLabel;
4534
- NumberSlider specularField;
4829
+ cNumberSlider specularField;
45354830 JLabel shininessLabel;
4536
- NumberSlider shininessField;
4831
+ cNumberSlider shininessField;
45374832 JLabel shiftLabel;
4538
- NumberSlider shiftField;
4833
+ cNumberSlider shiftField;
45394834 JLabel ambientLabel;
4540
- NumberSlider ambientField;
4835
+ cNumberSlider ambientField;
45414836 JLabel lightareaLabel;
4542
- NumberSlider lightareaField;
4837
+ cNumberSlider lightareaField;
45434838 JLabel diffusenessLabel;
4544
- NumberSlider diffusenessField;
4839
+ cNumberSlider diffusenessField;
45454840 JLabel velvetLabel;
4546
- NumberSlider velvetField;
4841
+ cNumberSlider velvetField;
45474842 JLabel sheenLabel;
4548
- NumberSlider sheenField;
4843
+ cNumberSlider sheenField;
45494844 JLabel subsurfaceLabel;
4550
- NumberSlider subsurfaceField;
4845
+ cNumberSlider subsurfaceField;
45514846 //JLabel bumpLabel;
45524847 //NumberSlider bumpField;
45534848 JLabel backlitLabel;
4554
- NumberSlider backlitField;
4849
+ cNumberSlider backlitField;
45554850 JLabel anisoLabel;
4556
- NumberSlider anisoField;
4851
+ cNumberSlider anisoField;
45574852 JLabel anisoVLabel;
4558
- NumberSlider anisoVField;
4853
+ cNumberSlider anisoVField;
45594854 JLabel cameraLabel;
4560
- NumberSlider cameraField;
4855
+ cNumberSlider cameraField;
45614856 JLabel selfshadowLabel;
4562
- NumberSlider selfshadowField;
4857
+ cNumberSlider selfshadowField;
45634858 JLabel shadowLabel;
4564
- NumberSlider shadowField;
4859
+ cNumberSlider shadowField;
45654860 JLabel textureLabel;
4566
- NumberSlider textureField;
4861
+ cNumberSlider textureField;
45674862 JLabel opacityLabel;
4568
- NumberSlider opacityField;
4863
+ cNumberSlider opacityField;
45694864 JLabel fakedepthLabel;
4570
- NumberSlider fakedepthField;
4865
+ cNumberSlider fakedepthField;
45714866 JLabel shadowbiasLabel;
4572
- NumberSlider shadowbiasField;
4867
+ cNumberSlider shadowbiasField;
45734868 JLabel bumpLabel;
4574
- NumberSlider bumpField;
4869
+ cNumberSlider bumpField;
45754870 JLabel noiseLabel;
4576
- NumberSlider noiseField;
4871
+ cNumberSlider noiseField;
45774872 JLabel powerLabel;
4578
- NumberSlider powerField;
4873
+ cNumberSlider powerField;
45794874 JLabel borderfadeLabel;
4580
- NumberSlider borderfadeField;
4875
+ cNumberSlider borderfadeField;
45814876 JLabel fogLabel;
4582
- NumberSlider fogField;
4877
+ cNumberSlider fogField;
45834878 JLabel opacityPowerLabel;
4584
- NumberSlider opacityPowerField;
4879
+ cNumberSlider opacityPowerField;
45854880 JTree jTree;
45864881 //ObjectUI parent;
4882
+
4883
+ cNumberSlider normalpushField;
4884
+
4885
+ private MenuItem importGFDItem;
4886
+ private MenuItem importVRMLX3DItem;
4887
+ private MenuItem import3DSItem;
4888
+ private MenuItem importOBJItem;
45874889 }