Normand Briere
2019-06-23 f1382bc839a74ef1d1534c61ea94e53cf54716df
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,
....@@ -31,6 +33,11 @@
3133 boolean timeline;
3234 boolean wasFullScreen;
3335
36
+ GroupEditor callee;
37
+ JFrame frame;
38
+
39
+ static ObjEditor theFrame;
40
+
3441 // SCRIPT
3542
3643 transient JFrame textpanel = null;
....@@ -121,51 +128,62 @@
121128 void keyPressed(int key, int modifiers)
122129 {
123130 System.out.println("KEY PRESSED");
124
- CameraPane.theRenderer.keyPressed(key, modifiers);
131
+ Globals.theRenderer.keyPressed(key, modifiers);
125132 }
126133 */
127134
128135 static GridBagConstraints aConstraints;
129136 static GridBagConstraints aWindowConstraints;
130
- GroupEditor callee;
131
- JFrame frame;
137
+
132138 static int GRIDWIDTH = 100; // 4;
133139
134140 public void closeUI()
135141 {
136142 //new Exception().printStackTrace();
137
- System.out.println("this = " + this);
138
- System.out.println("objEditor = " + objEditor);
143
+// System.out.println("this = " + this);
144
+// System.out.println("objEditor = " + objEditor);
139145 //nameField.removeActionListener(this);
140
- objEditor.ctrlPanel.remove(nameField);
146
+// objEditor.ctrlPanel.remove(nameField);
147
+
148
+ objEditor.ctrlPanel.remove(namePanel);
141149
142150 if (!GroupEditor.allparams)
143151 return;
144152
145
- objEditor.ctrlPanel.remove(liveCB);
146
- objEditor.ctrlPanel.remove(hideCB);
147
- objEditor.ctrlPanel.remove(markCB);
148
-
149
- objEditor.ctrlPanel.remove(randomCB);
150
- objEditor.ctrlPanel.remove(speedupCB);
151
- objEditor.ctrlPanel.remove(rewindCB);
152
-
153
- objEditor.ctrlPanel.remove(resetButton);
154
- objEditor.ctrlPanel.remove(stepButton);
155
-// objEditor.ctrlPanel.remove(stepAllButton);
156
-// objEditor.ctrlPanel.remove(resetAllButton);
157
- objEditor.ctrlPanel.remove(link2masterCB);
158
- //objEditor.ctrlPanel.remove(flipVCB);
159
- //objEditor.ctrlPanel.remove(texresMenu);
160
- objEditor.ctrlPanel.remove(slowerButton);
161
- objEditor.ctrlPanel.remove(fasterButton);
162
- objEditor.ctrlPanel.remove(remarkButton);
153
+// objEditor.ctrlPanel.remove(liveCB);
154
+// objEditor.ctrlPanel.remove(hideCB);
155
+// objEditor.ctrlPanel.remove(markCB);
156
+//
157
+// objEditor.ctrlPanel.remove(randomCB);
158
+// objEditor.ctrlPanel.remove(speedupCB);
159
+// objEditor.ctrlPanel.remove(rewindCB);
160
+//
161
+// objEditor.ctrlPanel.remove(resetButton);
162
+// objEditor.ctrlPanel.remove(stepButton);
163
+//// objEditor.ctrlPanel.remove(stepAllButton);
164
+//// objEditor.ctrlPanel.remove(resetAllButton);
165
+// objEditor.ctrlPanel.remove(link2masterCB);
166
+// //objEditor.ctrlPanel.remove(flipVCB);
167
+// //objEditor.ctrlPanel.remove(texresMenu);
168
+// objEditor.ctrlPanel.remove(slowerButton);
169
+// objEditor.ctrlPanel.remove(fasterButton);
170
+// objEditor.ctrlPanel.remove(remarkButton);
171
+
172
+ objEditor.ctrlPanel.remove(setupPanel);
173
+ objEditor.ctrlPanel.remove(setupPanel2);
174
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
175
+ objEditor.ctrlPanel.remove(pushPanel);
176
+ //objEditor.ctrlPanel.remove(fillPanel);
177
+
178
+ //Remove(normalpushField);
163179 }
164180
165181 public ObjEditor GetEditor()
166182 {
167183 return objEditor; //.GetEditor();
168184 }
185
+
186
+ // Sometimes myself, sometimes my callee's.
169187 ObjEditor objEditor;
170188
171189 /*
....@@ -228,6 +246,7 @@
228246 //localCopy.parent = null;
229247
230248 frame = new JFrame();
249
+ frame.setUndecorated(true);
231250 objEditor = this;
232251 this.callee = callee;
233252
....@@ -261,24 +280,40 @@
261280 void SetupMenu()
262281 {
263282 frame.setMenuBar(menuBar = new MenuBar());
264
- menuBar.add(windowMenu = new Menu("File"));
265
- windowMenu.add(loadItem = new MenuItem("Load..."));
266
- windowMenu.add("-");
267
- windowMenu.add(saveItem = new MenuItem("Save"));
268
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
283
+ menuBar.add(fileMenu = new Menu("File"));
284
+ fileMenu.add(newItem = new MenuItem("New"));
285
+ fileMenu.add(loadItem = new MenuItem("Open..."));
286
+
287
+ //oe.menuBar.add(menu = new Menu("Include"));
288
+ Menu menu = new Menu("Import");
289
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
290
+ importOBJItem.addActionListener(this);
291
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
292
+ import3DSItem.addActionListener(this);
293
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
294
+ importVRMLX3DItem.addActionListener(this);
295
+ menu.add("-");
296
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
297
+ importGFDItem.addActionListener(this);
298
+ fileMenu.add(menu);
299
+ fileMenu.add("-");
300
+
301
+ fileMenu.add(saveItem = new MenuItem("Save"));
302
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
269303 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
270
- windowMenu.add("-");
271
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
272
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
273
- windowMenu.add("-");
304
+ fileMenu.add("-");
305
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
306
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
307
+ fileMenu.add("-");
274308 if (client.parent != null)
275309 {
276
- windowMenu.add(closeItem = new MenuItem("Close"));
310
+ fileMenu.add(closeItem = new MenuItem("Close"));
277311 } else
278312 {
279
- windowMenu.add(closeItem = new MenuItem("Exit"));
313
+ fileMenu.add(closeItem = new MenuItem("Exit"));
280314 }
281315
316
+ newItem.addActionListener(this);
282317 loadItem.addActionListener(this);
283318 saveItem.addActionListener(this);
284319 saveAsItem.addActionListener(this);
....@@ -287,79 +322,35 @@
287322 //povItem.addActionListener(this);
288323 closeItem.addActionListener(this);
289324
290
- menuBar.add(cameraMenu = new Menu("View"));
291
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
292
- //zBufferItem.addActionListener(this);
293
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
294
- //normalLensItem.addActionListener(this);
295
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
296
- revertCameraItem.addActionListener(this);
297
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
298
- toggleTimelineItem.addItemListener(this);
299
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
300
- toggleFullScreenItem.addItemListener(this);
301
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
302
- cameraMenu.add("-");
303
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
304
- toggleTextureItem.addItemListener(this);
305
- toggleTextureItem.setState(CameraPane.textureon);
306
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
307
- toggleLiveItem.addItemListener(this);
308
- toggleLiveItem.setState(CameraPane.isLIVE());
309
- cameraMenu.add(stepItem = new MenuItem("Step"));
310
- stepItem.addActionListener(this);
311
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
312
-// toggleDLItem.addItemListener(this);
313
-// toggleDLItem.setState(false);
314
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
315
- toggleRenderItem.addItemListener(this);
316
- toggleRenderItem.setState(!CameraPane.frozen);
317
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
318
- toggleDebugItem.addItemListener(this);
319
- toggleDebugItem.setState(CameraPane.DEBUG);
320
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
321
- toggleFrustumItem.addItemListener(this);
322
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
323
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
324
- toggleFootContactItem.addItemListener(this);
325
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
326
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
327
- toggleRandomItem.addItemListener(this);
328
- toggleRandomItem.setState(CameraPane.RANDOM);
329
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
330
- toggleHandleItem.addItemListener(this);
331
- toggleHandleItem.setState(CameraPane.HANDLES);
332
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
333
- togglePaintItem.addItemListener(this);
334
- togglePaintItem.setState(CameraPane.PAINTMODE);
335
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
336
-// toggleRootItem.addItemListener(this);
337
-// toggleRootItem.setState(false);
338
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
339
-// animationItem.addItemListener(this);
340
-// animationItem.setState(CameraPane.ANIMATION);
341
- cameraMenu.add("-");
342
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
343
- editCameraItem.addActionListener(this);
344
-
345325 objectPanel = new JTabbedPane();
346326 toolbarPanel = new JPanel();
347327 toolbarPanel.setName("Toolbar");
348
- treePanel = new JPanel();
328
+ treePanel = new cGridBag();
349329 treePanel.setName("Tree");
350
- ctrlPanel = new JPanel(); // new GridBagLayout());
351
- ctrlPanel.setName("Edit");
352
- materialPanel = new JPanel();
330
+
331
+ editPanel = new cGridBag().setVertical(true);
332
+ editPanel.setName("Edit");
333
+
334
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
335
+
336
+ editCommandsPanel = new cGridBag();
337
+ editPanel.add(editCommandsPanel);
338
+ editPanel.add(ctrlPanel);
339
+
340
+ materialPanel = new cGridBag().setVertical(true);
341
+
353342 materialPanel.setName("Material");
354343 /*JTextPane*/
355344 infoarea = createTextPane();
345
+ doc = infoarea.getStyledDocument();
346
+
356347 infoarea.setEditable(true);
357348 SetText();
358349 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
359350 // infoarea.setOpaque(false);
360351 // //infoarea.setForeground(textcolor);
361
- infoarea.setLineWrap(true);
362
- infoarea.setWrapStyleWord(true);
352
+// TEXTAREA infoarea.setLineWrap(true);
353
+// TEXTAREA infoarea.setWrapStyleWord(true);
363354 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
364355 infoPanel.setPreferredSize(new Dimension(50, 200));
365356 infoPanel.setName("Info");
....@@ -370,16 +361,16 @@
370361 mainPanel.setName("Main");
371362 mainPanel.setContinuousLayout(true);
372363 mainPanel.setOneTouchExpandable(true);
373
- mainPanel.setDividerLocation(1.0);
374364 mainPanel.setDividerSize(9);
375
- mainPanel.setResizeWeight(0);
365
+ mainPanel.setDividerLocation(0.5); //1.0);
366
+ mainPanel.setResizeWeight(0.5);
376367
377368 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
378369 //mainPanel.setLayout(new GridBagLayout());
379370 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
380
- treePanel.setLayout(new GridBagLayout());
381
- ctrlPanel.setLayout(new GridBagLayout());
382
- materialPanel.setLayout(new GridBagLayout());
371
+// treePanel.setLayout(new GridBagLayout());
372
+ //ctrlPanel.setLayout(new GridBagLayout());
373
+ //materialPanel.setLayout(new GridBagLayout());
383374
384375 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
385376 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -418,7 +409,7 @@
418409 static String newline = "\n";
419410 protected static final String buttonString = "JButton";
420411 StyledDocument doc;
421
- JTextArea infoarea;
412
+ JTextPane infoarea;
422413
423414 void ClearInfo()
424415 {
....@@ -441,10 +432,10 @@
441432 e.printStackTrace();
442433 }
443434
444
- String selection = infoarea.getText();
445
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
446
- java.awt.datatransfer.Clipboard clipboard =
447
- Toolkit.getDefaultToolkit().getSystemClipboard();
435
+// String selection = infoarea.getText();
436
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
437
+// java.awt.datatransfer.Clipboard clipboard =
438
+// Toolkit.getDefaultToolkit().getSystemClipboard();
448439 //clipboard.setContents(data, data);
449440 }
450441
....@@ -467,13 +458,13 @@
467458 //SendInfo("Name:", "bold");
468459 if (sel.GetTextures() != null || debug)
469460 {
470
- si.SendInfo(sel.toString(), "bold");
461
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
471462 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
472463 if (sel.Size() > 0)
473464 {
474465 si.SendInfo("#children = " + sel.Size(), "regular");
475466 }
476
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
467
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
477468 if (debug)
478469 {
479470 try
....@@ -485,7 +476,10 @@
485476 }
486477
487478 if (full)
488
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
479
+ {
480
+ si.SendInfo(" BBox min: " + minima, "regular");
481
+ si.SendInfo(" BBox max: " + maxima, "regular");
482
+ }
489483
490484 if (sel.bRep != null)
491485 {
....@@ -512,7 +506,7 @@
512506 }
513507 if (sel.support != null)
514508 {
515
- si.SendInfo(" support: " + sel.support, "regular");
509
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
516510 }
517511 if (sel.scriptnode != null)
518512 {
....@@ -583,6 +577,9 @@
583577 {
584578 CameraPane.pointflow = (PointFlow) sel;
585579 }
580
+
581
+ si.SendInfo("_____________________", "regular");
582
+ si.SendInfo("", "regular");
586583 }
587584 }
588585
....@@ -598,68 +595,138 @@
598595 }
599596 }
600597
598
+static GraphicsDevice device = GraphicsEnvironment
599
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
600
+
601
+ Rectangle keeprect;
602
+ cRadio radio;
603
+
604
+cButton keepButton;
605
+ cButton twoButton; // Full 3D
606
+ cButton sixButton;
607
+ cButton threeButton;
608
+ cButton sevenButton;
609
+ cButton fourButton; // full panel
610
+ cButton oneButton; // full XYZ
611
+ //cButton currentLayout;
612
+
613
+ boolean maximized;
614
+
615
+ void Minimize()
616
+ {
617
+ frame.setState(Frame.ICONIFIED);
618
+ }
619
+
620
+ void Maximize()
621
+ {
622
+ if (maximized)
623
+ {
624
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
625
+ }
626
+ else
627
+ {
628
+ keeprect = frame.getBounds();
629
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
630
+ Dimension rect2 = frame.getToolkit().getScreenSize();
631
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
632
+// frame.setState(Frame.MAXIMIZED_BOTH);
633
+ }
634
+
635
+ maximized ^= true;
636
+ }
637
+
601638 void ToggleFullScreen()
602639 {
603640 if (CameraPane.FULLSCREEN)
604641 {
605
- frame.getContentPane().remove(/*"Center",*/bigThree);
606
- framePanel.add(bigThree);
607
- frame.getContentPane().add(/*"Center",*/framePanel);
642
+ device.setFullScreenWindow(null);
643
+ //frame.setVisible(false);
644
+// frame.removeNotify();
645
+// frame.setUndecorated(false);
646
+// frame.addNotify();
647
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
648
+
649
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
650
+// X framePanel.add(bigThree);
651
+// X frame.getContentPane().add(/*"Center",*/framePanel);
652
+ framePanel.setDividerLocation(1);
653
+
654
+ //frame.setVisible(true);
655
+ radio.layout = keepButton;
656
+ //theFrame = null;
657
+ keepButton = null;
658
+ radio.layout.doClick();
659
+
608660 } else
609661 {
610
- frame.getContentPane().remove(/*"Center",*/framePanel);
611
- framePanel.remove(bigThree);
612
- frame.getContentPane().add(/*"Center",*/bigThree);
662
+ keepButton = radio.layout;
663
+ //keeprect = frame.getBounds();
664
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
665
+// frame.getToolkit().getScreenSize().height);
666
+ //frame.setVisible(false);
667
+ device.setFullScreenWindow(frame);
668
+// frame.removeNotify();
669
+// frame.setUndecorated(true);
670
+// frame.addNotify();
671
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
672
+// X framePanel.remove(bigThree);
673
+// X frame.getContentPane().add(/*"Center",*/bigThree);
674
+ framePanel.setDividerLocation(0);
675
+
676
+ radio.layout = twoButton;
677
+ radio.layout.doClick();
678
+ //frame.setVisible(true);
613679 }
680
+
614681 cameraView.ToggleFullScreen();
615682 }
616683
617
- private JTextArea createTextPane()
684
+ private JTextPane createTextPane()
618685 {
619
- String[] initString =
620
- {
621
- "This is an editable JTextPane, ", //regular
622
- "another ", //italic
623
- "styled ", //bold
624
- "text ", //small
625
- "component, ", //large
626
- "which supports embedded components..." + newline,//regular
627
- " " + newline, //button
628
- "...and embedded icons..." + newline, //regular
629
- " ", //icon
630
- newline + "JTextPane is a subclass of JEditorPane that "
631
- + "uses a StyledEditorKit and StyledDocument, and provides "
632
- + "cover methods for interacting with those objects."
633
- };
686
+// TEXTAREA String[] initString =
687
+// {
688
+// "This is an editable JTextPane, ", //regular
689
+// "another ", //italic
690
+// "styled ", //bold
691
+// "text ", //small
692
+// "component, ", //large
693
+// "which supports embedded components..." + newline,//regular
694
+// " " + newline, //button
695
+// "...and embedded icons..." + newline, //regular
696
+// " ", //icon
697
+// newline + "JTextPane is a subclass of JEditorPane that "
698
+// + "uses a StyledEditorKit and StyledDocument, and provides "
699
+// + "cover methods for interacting with those objects."
700
+// };
701
+//
702
+// String[] initStyles =
703
+// {
704
+// "regular", "italic", "bold", "small", "large",
705
+// "regular", "button", "regular", "icon",
706
+// "regular"
707
+// };
708
+//
709
+// JTextPane textPane = new JTextPane();
710
+// textPane.setEditable(true);
711
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
712
+// addStylesToDocument(doc);
713
+//
714
+// try
715
+// {
716
+// for (int j = 0; j < 2; j++)
717
+// {
718
+// for (int i = 0; i < initString.length; i++)
719
+// {
720
+// doc.insertString(doc.getLength(), initString[i],
721
+// doc.getStyle(initStyles[i]));
722
+// }
723
+// }
724
+// } catch (BadLocationException ble)
725
+// {
726
+// System.err.println("Couldn't insert initial text into text pane.");
727
+// }
634728
635
- String[] initStyles =
636
- {
637
- "regular", "italic", "bold", "small", "large",
638
- "regular", "button", "regular", "icon",
639
- "regular"
640
- };
641
-
642
- JTextPane textPane = new JTextPane();
643
- textPane.setEditable(true);
644
- /*StyledDocument*/ doc = textPane.getStyledDocument();
645
- addStylesToDocument(doc);
646
-
647
- try
648
- {
649
- for (int j = 0; j < 2; j++)
650
- {
651
- for (int i = 0; i < initString.length; i++)
652
- {
653
- doc.insertString(doc.getLength(), initString[i],
654
- doc.getStyle(initStyles[i]));
655
- }
656
- }
657
- } catch (BadLocationException ble)
658
- {
659
- System.err.println("Couldn't insert initial text into text pane.");
660
- }
661
-
662
- return new JTextArea(); // textPane;
729
+ return new JTextPane(); // textPane;
663730 }
664731
665732 protected void addStylesToDocument(StyledDocument doc)
....@@ -712,7 +779,7 @@
712779 protected static ImageIcon createImageIcon(String path,
713780 String description)
714781 {
715
- java.net.URL imgURL = GrafreeD.class.getResource(path);
782
+ java.net.URL imgURL = Grafreed.class.getResource(path);
716783 if (imgURL != null)
717784 {
718785 return new ImageIcon(imgURL, description);
....@@ -744,6 +811,7 @@
744811 // NumberSlider vDivsField;
745812 // JCheckBox endcaps;
746813 JCheckBox liveCB;
814
+ JCheckBox selectCB;
747815 JCheckBox hideCB;
748816 JCheckBox link2masterCB;
749817 JCheckBox markCB;
....@@ -759,115 +827,87 @@
759827 JButton slowerButton;
760828 JButton fasterButton;
761829 JButton remarkButton;
830
+
831
+ cGridBag editPanel;
832
+ cGridBag editCommandsPanel;
833
+
834
+ cGridBag namePanel;
835
+ cGridBag setupPanel;
836
+ cGridBag setupPanel2;
837
+ cGridBag objectCommandsPanel;
838
+ cGridBag pushPanel;
839
+ cGridBag fillPanel;
762840
763
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
841
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
764842 {
765843 JCheckBox cb;
766844
767
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
768
- oe.aConstraints.gridwidth = 1; // 3;
769
-// oe.aConstraints.weightx = 1;
770
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
771
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
845
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
772846 cb.addItemListener(this);
773
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
774
- oe.aConstraints.gridwidth = 1;
775
- oe.aConstraints.gridx += 1;
776847
777848 return cb;
778849 }
779850
780
- cButton AddButton(ObjEditor oe, String label)
851
+ cButton AddButton(cGridBag panel, String label)
781852 {
782853 cButton cb;
783854
784
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
785
- oe.aConstraints.gridwidth = 1;
786
-// oe.aConstraints.weightx = 1;
787
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
788
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
855
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
789856 cb.addActionListener(this);
790
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
791
- oe.aConstraints.gridwidth = 1;
792
- oe.aConstraints.gridx += 1;
793857
794858 return cb;
795859 }
796860
797
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
861
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
798862 {
799863 JComboBox combo;
800864
801
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
802
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
803
- oe.aConstraints.gridx += 1;
865
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
804866 combo.addActionListener(this);
805867
806868 return combo;
807869 }
808870
809
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
871
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
810872 {
811
- NumberSlider combo;
873
+ cGridBag control = new cGridBag();
874
+
875
+ cNumberSlider combo;
812876
813877 JLabel jlabel = new JLabel(label);
814
-
815
- aConstraints.fill = GridBagConstraints.VERTICAL;
816878 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
817
- aConstraints.gridwidth = 2;
818
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
819
- aConstraints.gridx += 1;
820
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
821
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
822
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
823
- aConstraints.gridx += 1;
824
- aConstraints.gridwidth = 1;
825
-
879
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
880
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
826881 combo.setFloat(current);
827
-
828
- combo.label = jlabel;
829
-
830
- combo.addChangeListener(this);
831
-
832
- return combo;
882
+
883
+ panel.add(control);
884
+
885
+ return control;
833886 }
834887
835
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
888
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
836889 {
837
- NumberSlider combo;
890
+ cGridBag control = new cGridBag();
891
+
892
+ cNumberSlider combo;
838893
839894 JLabel jlabel = new JLabel(label);
840
-
841
- aConstraints.fill = GridBagConstraints.VERTICAL;
842895 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
843
- aConstraints.gridwidth = 2;
844
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
845
- aConstraints.gridx += 1;
846
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
847
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
848
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
849
- aConstraints.gridx += 1;
850
- aConstraints.gridwidth = 1;
851
-
896
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
897
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
852898 combo.setInteger(current);
853899
854
- combo.label = jlabel;
855
-
856
- combo.addChangeListener(this);
857
-
858
- return combo;
900
+ panel.add(control);
901
+
902
+ return control;
859903 }
860904
861
- JTextArea AddText(JPanel ctrlPanel, String name)
905
+ JTextArea AddText(cGridBag ctrlPanel, String name)
862906 {
863907 JTextArea text;
864908
865
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
866
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
867
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
909
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
868910 text.addCaretListener(this);
869
- aConstraints.gridx += 1;
870
- aConstraints.gridwidth = 1;
871911
872912 return text;
873913 }
....@@ -897,9 +937,16 @@
897937 objEditor.ctrlPanel.remove(j);
898938 }
899939
940
+ void Remove(cNumberSlider j)
941
+ {
942
+ j.removeChangeListener(this);
943
+ //objEditor.ctrlPanel.remove(j.label);
944
+ objEditor.ctrlPanel.remove(j);
945
+ }
946
+
900947 /*
901948 */
902
- void Return() // ObjEditor oe)
949
+ void Return0() // ObjEditor oe)
903950 {
904951 aConstraints.gridy += 1;
905952 aConstraints.gridx = 0;
....@@ -954,35 +1001,77 @@
9541001
9551002 void SetupUI2(ObjEditor oe)
9561003 {
957
-// oe.aConstraints.weightx = 0;
958
-// oe.aConstraints.weighty = 0;
959
-// oe.aConstraints.gridx = 0;
960
-// oe.aConstraints.gridy = 0;
961
- SetupName(oe);
1004
+ //SetupName(oe);
1005
+
1006
+ namePanel = new cGridBag();
1007
+
1008
+ nameField = AddText(namePanel, copy.GetName());
1009
+ namePanel.add(nameField);
1010
+ oe.ctrlPanel.add(namePanel);
1011
+
1012
+ oe.ctrlPanel.Return();
9621013
9631014 if (!GroupEditor.allparams)
9641015 return;
9651016
966
- liveCB = AddCheckBox(oe, "Live", copy.live);
967
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
968
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1017
+ setupPanel = new cGridBag().setVertical(false);
1018
+
1019
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1020
+ liveCB.setToolTipText("Animate object");
1021
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1022
+ selectCB.setToolTipText("Make object selectable");
9691023 // Return();
970
- markCB = AddCheckBox(oe, "Mark", copy.marked);
971
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
972
- randomCB = AddCheckBox(oe, "Rand", copy.random);
973
- Return();
974
- resetButton = AddButton(oe, "Reset");
975
- stepButton = AddButton(oe, "Step");
1024
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1025
+ hideCB.setToolTipText("Hide object");
1026
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1027
+ markCB.setToolTipText("Set the animation target transform");
1028
+
1029
+ setupPanel2 = new cGridBag().setVertical(false);
1030
+
1031
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1032
+ rewindCB.setToolTipText("Rewind animation");
1033
+
1034
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1035
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1036
+
1037
+ if (Globals.ADVANCED)
1038
+ {
1039
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1040
+ link2masterCB.setToolTipText("Attach to support");
1041
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1042
+ speedupCB.setToolTipText("Option motion capture");
1043
+ }
1044
+
1045
+ oe.ctrlPanel.add(setupPanel);
1046
+ oe.ctrlPanel.Return();
1047
+ oe.ctrlPanel.add(setupPanel2);
1048
+ oe.ctrlPanel.Return();
1049
+
1050
+ objectCommandsPanel = new cGridBag().setVertical(false);
1051
+
1052
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1053
+ resetButton.setToolTipText("Jump to frame zero");
1054
+ stepButton = AddButton(objectCommandsPanel, "Step");
1055
+ stepButton.setToolTipText("Step one frame");
9761056 // resetAllButton = AddButton(oe, "Reset All");
9771057 // stepAllButton = AddButton(oe, "Step All");
978
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9791058 // Return();
980
- slowerButton = AddButton(oe, "Slow");
981
- fasterButton = AddButton(oe, "Fast");
982
- remarkButton = AddButton(oe, "Rem");
1059
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1060
+ slowerButton.setToolTipText("Decrease animation speed");
1061
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1062
+ fasterButton.setToolTipText("Increase animation speed");
1063
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1064
+ remarkButton.setToolTipText("Set the current transform as the target");
9831065
984
- Return();
1066
+ oe.ctrlPanel.add(objectCommandsPanel);
1067
+ oe.ctrlPanel.Return();
9851068
1069
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1070
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1071
+ //Return();
1072
+
1073
+ oe.ctrlPanel.Return();
1074
+
9861075 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9871076 // ObjEditor.aConstraints.gridx += 1;
9881077
....@@ -1076,7 +1165,7 @@
10761165 oe.aConstraints.gridwidth = 1;
10771166 /**/
10781167 nameField = AddText(oe.ctrlPanel, copy.GetName());
1079
- Return();
1168
+ oe.ctrlPanel.Return();
10801169
10811170 //ctrlPanel.add(textureButton = new Button("Texture..."));
10821171 //textureButton.setEnabled(false);
....@@ -1178,11 +1267,25 @@
11781267 //JPanel worldPanel =
11791268 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11801269 //worldPanel.setName("World");
1181
- centralPanel = new JPanel(new BorderLayout());
1182
- timelinePanel = new JPanel(new BorderLayout());
1183
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1270
+ centralPanel = new cGridBag();
1271
+ centralPanel.preferredWidth = 20;
1272
+
1273
+ if (Globals.ADVANCED)
1274
+ {
1275
+ timelinePanel = new JPanel(new BorderLayout());
1276
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11841277
1278
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1279
+ cameraPanel.setContinuousLayout(true);
1280
+ cameraPanel.setOneTouchExpandable(true);
1281
+// cameraPanel.setDividerLocation(0.9);
1282
+// cameraPanel.setDividerSize(9);
1283
+ cameraPanel.setResizeWeight(1.0);
1284
+
1285
+ }
1286
+
11851287 centralPanel.add(cameraView);
1288
+ centralPanel.setFocusable(true);
11861289 //frame.setJMenuBar(timelineMenubar);
11871290 //centralPanel.add(timelinePanel);
11881291
....@@ -1201,12 +1304,13 @@
12011304 //frontView.object = copy;
12021305 //sideView.object = copy;
12031306
1204
- XYZPanel = new JPanel();
1205
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1307
+ XYZPanel = new cGridBag().setVertical(true);
1308
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12061309
1207
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1208
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1209
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1310
+ XYZPanel.preferredWidth = 5;
1311
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1312
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1313
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
12101314
12111315 /*
12121316 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1244,10 +1348,11 @@
12441348 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12451349 //tmp.setName("Edit");
12461350 objectPanel.add(materialPanel);
1247
- JPanel north = new JPanel(new BorderLayout());
1248
- north.setName("Edit");
1249
- north.add(ctrlPanel, BorderLayout.NORTH);
1250
- objectPanel.add(north);
1351
+// JPanel north = new JPanel(new BorderLayout());
1352
+// north.setName("Edit");
1353
+// north.add(ctrlPanel, BorderLayout.NORTH);
1354
+// objectPanel.add(north);
1355
+ objectPanel.add(editPanel);
12511356 objectPanel.add(infoPanel);
12521357
12531358 /*
....@@ -1268,16 +1373,23 @@
12681373 scrollpane.setWheelScrollingEnabled(true);
12691374 scrollpane.addMouseWheelListener(this); // Default not fast enough
12701375
1271
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1272
- scenePanel.add(scrollpane);
1376
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1377
+ scenePanel.preferredWidth = 6;
1378
+
1379
+ JTabbedPane tabbedPane = new JTabbedPane();
1380
+ tabbedPane.add(scrollpane);
12731381
1274
- scenePanel.add(FSPane = new cFileSystemPane(this));
1382
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12751383
1276
- optionsPanel = new JPanel(new GridBagLayout());
1384
+ optionsPanel = new cGridBag().setVertical(true);
12771385
12781386 optionsPanel.setName("Options");
1279
- scenePanel.add(optionsPanel);
1280
-
1387
+
1388
+ AddOptions(optionsPanel); //, aConstraints);
1389
+
1390
+ tabbedPane.add(optionsPanel);
1391
+
1392
+ scenePanel.add(tabbedPane);
12811393
12821394 /*
12831395 cTree jTree = new cTree(null);
....@@ -1311,6 +1423,7 @@
13111423 //bigPanel.setSize(new Dimension(10,10));
13121424 //bigPanel.add(ctrlPanel);
13131425 //bigPanel.add(gridPanel);
1426
+ /**
13141427 bigThree = new JPanel();
13151428 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
13161429 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1334,7 +1447,13 @@
13341447 // aConstraints.gridheight = 3;
13351448 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13361449 bigThree.add(XYZPanel, aWindowConstraints);
1450
+ /**/
13371451
1452
+ bigThree = new cGridBag();
1453
+ bigThree.addComponent(scenePanel);
1454
+ bigThree.addComponent(centralPanel);
1455
+ bigThree.addComponent(XYZPanel);
1456
+
13381457 // // SIDE EFFECT!!!
13391458 // aConstraints.gridx = 0;
13401459 // aConstraints.gridy = 0;
....@@ -1355,14 +1474,17 @@
13551474 //worldPane.add(bigPanel);
13561475 //worldPane.add(worldPanel);
13571476 /**/
1358
- frame.getContentPane().add(/*"Center",*/framePanel);
1477
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1478
+ frame.add(/*"Center",*/framePanel);
13591479 //frame.getContentPane().add(/*"Center",*/ worldPane);
13601480
13611481 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13621482
1363
- frame.setSize(1024, 768);
1364
- frame.show();
1483
+ frame.setSize(1280, 860);
1484
+ frame.setVisible(true);
13651485
1486
+ cameraView.requestFocusInWindow();
1487
+
13661488 gridPanel.setDividerLocation(1.0);
13671489
13681490 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1376,6 +1498,10 @@
13761498 });
13771499 }
13781500
1501
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1502
+ {
1503
+ }
1504
+
13791505 JTree GetTree()
13801506 {
13811507 return objEditor.jTree;
....@@ -1387,260 +1513,173 @@
13871513 ctrlPanel.removeAll();
13881514 }
13891515
1390
- void SetupMaterial(JPanel ctrlPanel)
1516
+ void SetupMaterial(cGridBag panel)
13911517 {
1392
- aConstraints.weighty = 0;
1393
- //aConstraints.weightx = 1;
1394
- /*
1518
+ /*
13951519 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13961520 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1397
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1398
- aConstraints.gridx += 1;
13991521 */
14001522
1401
- aConstraints.gridwidth = 1;
1402
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1403
- aConstraints.gridx += 1;
1404
- aConstraints.weighty = 0;
1405
- aConstraints.gridwidth = 1;
1523
+ cGridBag editBar = new cGridBag().setVertical(false);
1524
+
1525
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1526
+ createMaterialButton.setToolTipText("Create material");
14061527
14071528 /*
14081529 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1409
- aConstraints.gridx += 1;
1410
- aConstraints.weighty = 0;
1411
- aConstraints.gridwidth = 1;
14121530 */
14131531
1414
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1415
- aConstraints.gridx += 1;
1532
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1533
+ clearMaterialButton.setToolTipText("Clear material");
1534
+
1535
+ if (Globals.ADVANCED)
1536
+ {
1537
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1538
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1539
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1540
+ }
14161541
1417
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1418
-
1419
- aConstraints.gridx += 1;
1420
-
1421
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1422
-
1423
- aConstraints.gridx += 1;
1424
-
1425
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1426
-
1427
- aConstraints.gridx = 0;
1428
- aConstraints.gridy += 1;
1429
- aConstraints.weighty = 0;
1430
- aConstraints.gridwidth = 1;
1542
+ editBar.preferredHeight = 15;
1543
+
1544
+ panel.add(editBar);
1545
+
14311546 /**/
14321547 //aConstraints.weighty = 0;
14331548 ////aConstraints.weightx = 1;
14341549 //aConstraints.weighty = 1;
14351550 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14361551 //aConstraints.gridx += 1;
1437
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1438
- aConstraints.weighty = 0;
1439
- aConstraints.gridx = 0;
1440
- aConstraints.gridy += 1;
1441
- aConstraints.gridwidth = 1;
1552
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14421553
1443
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1444
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1445
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1446
- aConstraints.gridx += 1;
1447
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1448
- //aConstraints.weightx = 0;
1449
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1450
- aConstraints.gridx = 0;
1451
- aConstraints.gridy += 1;
1452
- aConstraints.gridwidth = 1;
1554
+ cGridBag colorSection = new cGridBag().setVertical(true);
1555
+
1556
+ cGridBag color = new cGridBag();
1557
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1558
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1559
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1560
+ //colorField.preferredWidth = 200;
1561
+ colorSection.add(color);
14531562
1454
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1455
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1456
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1457
- aConstraints.gridx += 1;
1458
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1459
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1460
- aConstraints.gridx = 0;
1461
- aConstraints.gridy += 1;
1462
- aConstraints.gridwidth = 1;
1563
+ cGridBag modulation = new cGridBag();
1564
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1565
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1566
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1567
+ colorSection.add(modulation);
14631568
1464
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1465
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1466
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1467
- aConstraints.gridx += 1;
1468
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1469
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1470
- aConstraints.gridx = 0;
1471
- aConstraints.gridy += 1;
1472
- aConstraints.gridwidth = 1;
1569
+ cGridBag texture = new cGridBag();
1570
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1571
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1572
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1573
+ colorSection.add(texture);
14731574
1474
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1475
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1476
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1477
- aConstraints.gridx += 1;
1478
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1479
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1480
- aConstraints.gridx = 0;
1481
- aConstraints.gridy += 1;
1482
- aConstraints.gridwidth = 1;
1575
+ cGridBag anisoU = new cGridBag();
1576
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1577
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1578
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1579
+ colorSection.add(anisoU);
14831580
1484
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1485
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1486
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1487
- aConstraints.gridx += 1;
1488
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1489
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1490
- aConstraints.gridx = 0;
1491
- aConstraints.gridy += 1;
1492
- aConstraints.gridwidth = 1;
1581
+ cGridBag anisoV = new cGridBag();
1582
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1583
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1584
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1585
+ colorSection.add(anisoV);
14931586
1494
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1495
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1496
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1497
- aConstraints.gridx += 1;
1498
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1499
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1500
- aConstraints.gridx = 0;
1501
- aConstraints.gridy += 1;
1502
- aConstraints.gridwidth = 1;
1587
+ cGridBag shadowbias = new cGridBag();
1588
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1589
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1590
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1591
+ colorSection.add(shadowbias);
15031592
1504
- //aConstraints.weighty = 1;
1505
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1506
- //aConstraints.gridx += 1;
1507
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1508
- aConstraints.weighty = 0;
1509
- aConstraints.gridx = 0;
1510
- aConstraints.gridy += 1;
1511
- aConstraints.gridwidth = 1;
1593
+ panel.add(new JSeparator());
1594
+
1595
+ panel.add(colorSection);
1596
+
1597
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1598
+
1599
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1600
+
1601
+ cGridBag diffuse = new cGridBag();
1602
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1603
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1604
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1605
+ diffuseSection.add(diffuse);
15121606
1513
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1514
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1515
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1516
- aConstraints.gridx += 1;
1517
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1518
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1519
- aConstraints.gridx = 0;
1520
- aConstraints.gridy += 1;
1521
- aConstraints.gridwidth = 1;
1607
+ cGridBag diffuseness = new cGridBag();
1608
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1609
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1610
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1611
+ diffuseSection.add(diffuseness);
15221612
1523
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1524
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1525
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1526
- aConstraints.gridx += 1;
1527
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1528
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1529
- aConstraints.gridx = 0;
1530
- aConstraints.gridy += 1;
1531
- aConstraints.gridwidth = 1;
1613
+ cGridBag selfshadow = new cGridBag();
1614
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1615
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1616
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1617
+ diffuseSection.add(selfshadow);
15321618
1533
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1534
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1535
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1536
- aConstraints.gridx += 1;
1537
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1538
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1539
- aConstraints.gridx = 0;
1540
- aConstraints.gridy += 1;
1541
- aConstraints.gridwidth = 1;
1619
+ cGridBag sheen = new cGridBag();
1620
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1621
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1622
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1623
+ diffuseSection.add(sheen);
15421624
1543
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1544
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1545
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1546
- aConstraints.gridx += 1;
1547
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1548
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1549
- aConstraints.gridx = 0;
1550
- aConstraints.gridy += 1;
1551
- aConstraints.gridwidth = 1;
1625
+ cGridBag subsurface = new cGridBag();
1626
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1627
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1628
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1629
+ diffuseSection.add(subsurface);
15521630
1553
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1554
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1555
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1556
- aConstraints.gridx += 1;
1557
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1558
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1559
- aConstraints.gridx = 0;
1560
- aConstraints.gridy += 1;
1561
- aConstraints.gridwidth = 1;
1631
+ cGridBag shadow = new cGridBag();
1632
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1633
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1634
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1635
+ diffuseSection.add(shadow);
15621636
1563
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1564
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1565
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1566
- aConstraints.gridx += 1;
1567
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1568
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1569
- aConstraints.gridx = 0;
1570
- aConstraints.gridy += 1;
1571
- aConstraints.gridwidth = 1;
1637
+ cGridBag fakedepth = new cGridBag();
1638
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1639
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1640
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1641
+ diffuseSection.add(fakedepth);
15721642
1573
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1574
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1575
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1576
- aConstraints.gridx += 1;
1577
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1578
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1579
- aConstraints.gridx = 0;
1580
- aConstraints.gridy += 1;
1581
- aConstraints.gridwidth = 1;
1643
+ panel.add(new JSeparator());
1644
+
1645
+ panel.add(diffuseSection);
1646
+
1647
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1648
+
1649
+ cGridBag specularSection = new cGridBag().setVertical(true);
15821650
1583
- //aConstraints.weighty = 1;
1584
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1585
- //aConstraints.gridx += 1;
1586
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1587
- aConstraints.weighty = 0;
1588
- aConstraints.gridx = 0;
1589
- aConstraints.gridy += 1;
1590
- aConstraints.gridwidth = 1;
1651
+ cGridBag specular = new cGridBag();
1652
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1653
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1654
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1655
+ specularSection.add(specular);
15911656
1592
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1593
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1594
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1595
- aConstraints.gridx += 1;
1596
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1597
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1598
- aConstraints.gridx = 0;
1599
- aConstraints.gridy += 1;
1600
- aConstraints.gridwidth = 1;
1657
+ cGridBag lightarea = new cGridBag();
1658
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1659
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1660
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1661
+ specularSection.add(lightarea);
16011662
1602
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1603
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1604
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1605
- aConstraints.gridx += 1;
1606
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1607
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1608
- aConstraints.gridx = 0;
1609
- aConstraints.gridy += 1;
1610
- aConstraints.gridwidth = 1;
1663
+ cGridBag shininess = new cGridBag();
1664
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1665
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1666
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1667
+ specularSection.add(shininess);
16111668
1612
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1613
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1614
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1615
- aConstraints.gridx += 1;
1616
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1617
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1618
- aConstraints.gridx = 0;
1619
- aConstraints.gridy += 1;
1620
- aConstraints.gridwidth = 1;
1669
+ cGridBag metalness = new cGridBag();
1670
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1671
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1672
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1673
+ specularSection.add(metalness);
16211674
1622
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1623
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1624
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1625
- aConstraints.gridx += 1;
1626
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1627
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1628
- aConstraints.gridx = 0;
1629
- aConstraints.gridy += 1;
1630
- aConstraints.gridwidth = 1;
1675
+ cGridBag velvet = new cGridBag();
1676
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1677
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1678
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1679
+ specularSection.add(velvet);
16311680
1632
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1633
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1634
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1635
- aConstraints.gridx += 1;
1636
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1637
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1638
- aConstraints.gridx = 0;
1639
- aConstraints.gridy += 1;
1640
- aConstraints.gridwidth = 1;
1641
-
1642
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1643
- Return();
1681
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1682
+ //Return();
16441683 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16451684 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16461685 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1651,130 +1690,93 @@
16511690 // aConstraints.gridy += 1;
16521691 // aConstraints.gridwidth = 1;
16531692
1654
- //aConstraints.weighty = 1;
1655
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1656
- //aConstraints.gridx += 1;
1657
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1658
- aConstraints.weighty = 0;
1659
- aConstraints.gridx = 0;
1660
- aConstraints.gridy += 1;
1661
- aConstraints.gridwidth = 1;
16621693
1663
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1664
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1665
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1666
- aConstraints.gridx += 1;
1667
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1668
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1669
- aConstraints.gridx = 0;
1670
- aConstraints.gridy += 1;
1671
- aConstraints.gridwidth = 1;
1694
+ panel.add(new JSeparator());
1695
+
1696
+ panel.add(specularSection);
1697
+
1698
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1699
+
1700
+ cGridBag globalSection = new cGridBag().setVertical(true);
16721701
1673
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1674
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1675
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1676
- aConstraints.gridx += 1;
1677
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1678
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1679
- aConstraints.gridx = 0;
1680
- aConstraints.gridy += 1;
1681
- aConstraints.gridwidth = 1;
1702
+ cGridBag camera = new cGridBag();
1703
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1704
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1705
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1706
+ globalSection.add(camera);
16821707
1683
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1684
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1685
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1686
- aConstraints.gridx += 1;
1687
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1688
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1689
- aConstraints.gridx = 0;
1690
- aConstraints.gridy += 1;
1691
- aConstraints.gridwidth = 1;
1708
+ cGridBag ambient = new cGridBag();
1709
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1710
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1711
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1712
+ globalSection.add(ambient);
16921713
1693
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1694
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1695
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1696
- aConstraints.gridx += 1;
1697
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1698
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1699
- aConstraints.gridx = 0;
1700
- aConstraints.gridy += 1;
1701
- aConstraints.gridwidth = 1;
1702
- aConstraints.weighty = 0;
1714
+ cGridBag backlit = new cGridBag();
1715
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1716
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1717
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1718
+ globalSection.add(backlit);
17031719
1704
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1705
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1706
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1707
- aConstraints.gridx += 1;
1708
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1709
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1710
- aConstraints.gridx = 0;
1711
- aConstraints.gridy += 1;
1712
- aConstraints.gridwidth = 1;
1720
+ cGridBag opacity = new cGridBag();
1721
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1722
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1723
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1724
+ globalSection.add(opacity);
17131725
1714
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1715
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1716
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1717
- aConstraints.gridx += 1;
1718
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1719
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1720
- aConstraints.gridx = 0;
1721
- aConstraints.gridy += 1;
1722
- aConstraints.gridwidth = 1;
1726
+ panel.add(new JSeparator());
1727
+
1728
+ panel.add(globalSection);
1729
+
1730
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1731
+
1732
+ cGridBag textureSection = new cGridBag().setVertical(true);
17231733
1724
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1725
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1726
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1727
- aConstraints.gridx += 1;
1728
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1729
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1730
- aConstraints.gridx = 0;
1731
- aConstraints.gridy += 1;
1732
- aConstraints.gridwidth = 1;
1734
+ cGridBag bump = new cGridBag();
1735
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1736
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1737
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1738
+ textureSection.add(bump);
17331739
1734
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1735
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1736
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1737
- aConstraints.gridx += 1;
1738
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1739
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1740
- aConstraints.gridx = 0;
1741
- aConstraints.gridy += 1;
1742
- aConstraints.gridwidth = 1;
1740
+ cGridBag noise = new cGridBag();
1741
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1742
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1743
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1744
+ textureSection.add(noise);
17431745
1744
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1745
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1746
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1747
- aConstraints.gridx += 1;
1748
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1749
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1750
- aConstraints.gridx = 0;
1751
- aConstraints.gridy += 1;
1752
- aConstraints.gridwidth = 1;
1746
+ cGridBag power = new cGridBag();
1747
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1748
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1749
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1750
+ textureSection.add(power);
17531751
1754
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1755
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1756
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1757
- aConstraints.gridx += 1;
1758
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1759
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1760
- aConstraints.gridx = 0;
1761
- aConstraints.gridy += 1;
1762
- aConstraints.gridwidth = 1;
1752
+ cGridBag borderfade = new cGridBag();
1753
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1754
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1755
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1756
+ textureSection.add(borderfade);
17631757
1764
- //aConstraints.weighty = 1;
1765
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1766
- //aConstraints.gridx += 1;
1767
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1768
- aConstraints.weighty = 0;
1758
+ cGridBag fog = new cGridBag();
1759
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1760
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1761
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1762
+ textureSection.add(fog);
17691763
1770
- aConstraints.gridx = 0;
1771
- aConstraints.gridy = 0;
1772
- aConstraints.gridwidth = 1;
1764
+ cGridBag opacityPower = new cGridBag();
1765
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1766
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1767
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1768
+ textureSection.add(opacityPower);
1769
+
1770
+ panel.add(new JSeparator());
1771
+
1772
+ panel.add(textureSection);
1773
+
1774
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17731775
17741776 SetMaterial(copy); // .GetMaterial());
17751777
1776
- colorField.addChangeListener(this);
1777
- modulationField.addChangeListener(this);
1778
+ //colorField.addChangeListener(this);
1779
+// modulationField.addChangeListener(this);
17781780 metalnessField.addChangeListener(this);
17791781 diffuseField.addChangeListener(this);
17801782 specularField.addChangeListener(this);
....@@ -1804,12 +1806,15 @@
18041806 opacityPowerField.addChangeListener(this);
18051807 /**/
18061808
1807
- resetSlidersButton.addActionListener(this);
18081809 clearMaterialButton.addActionListener(this);
18091810 createMaterialButton.addActionListener(this);
1810
-
1811
- propagateToggle.addItemListener(this);
1812
- multiplyToggle.addItemListener(this);
1811
+
1812
+ if (Globals.ADVANCED)
1813
+ {
1814
+ resetSlidersButton.addActionListener(this);
1815
+ propagateToggle.addItemListener(this);
1816
+ multiplyToggle.addItemListener(this);
1817
+ }
18131818 }
18141819
18151820 void DropFile(java.io.File[] files, boolean textures)
....@@ -1980,7 +1985,7 @@
19801985
19811986 //? flashIt = false;
19821987 CameraPane pane = (CameraPane) cameraView;
1983
- pane.clickStart(location.x, location.y, 0);
1988
+ pane.clickStart(location.x, location.y, 0, 0);
19841989 pane.clickEnd(location.x, location.y, 0, true);
19851990
19861991 if (group.selection.size() == 1)
....@@ -2029,6 +2034,7 @@
20292034 e2.printStackTrace();
20302035 }
20312036 }
2037
+
20322038 LoadJMEThread loadThread;
20332039
20342040 class LoadJMEThread extends Thread
....@@ -2086,6 +2092,7 @@
20862092 //LoadFile0(filename, converter);
20872093 }
20882094 }
2095
+
20892096 LoadOBJThread loadObjThread;
20902097
20912098 class LoadOBJThread extends Thread
....@@ -2164,19 +2171,19 @@
21642171
21652172 void LoadObjFile(String fullname)
21662173 {
2167
- /*
2174
+ System.out.println("Loading " + fullname);
2175
+ /**/
21682176 //lastFilename = fullname;
21692177 if(loadObjThread == null)
21702178 {
2171
- loadObjThread = new LoadOBJThread();
2172
- loadObjThread.start();
2179
+ loadObjThread = new LoadOBJThread();
2180
+ loadObjThread.start();
21732181 }
21742182
21752183 loadObjThread.add(fullname);
2176
- */
2184
+ /**/
21772185
2178
- System.out.println("Loading " + fullname);
2179
- makeSomething(new FileObject(fullname, true), true);
2186
+ //makeSomething(new FileObject(fullname, true), true);
21802187 }
21812188
21822189 void LoadGFDFile(String fullname)
....@@ -2437,11 +2444,11 @@
24372444
24382445 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24392446 {
2440
- if (GrafreeD.standAlone)
2447
+ if (Grafreed.standAlone)
24412448 {
24422449 /**/
24432450 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2444
- browser.show();
2451
+ browser.setVisible(true);
24452452 String filename = browser.getFile();
24462453 if (filename != null && filename.length() > 0)
24472454 {
....@@ -2586,6 +2593,7 @@
25862593 }
25872594 if (input == null)
25882595 {
2596
+ new Exception().printStackTrace();
25892597 System.exit(0);
25902598 }
25912599
....@@ -2800,7 +2808,8 @@
28002808 return;
28012809 }
28022810
2803
- multiplyToggle.setSelected(mat.multiply);
2811
+ if (multiplyToggle != null)
2812
+ multiplyToggle.setSelected(mat.multiply);
28042813
28052814 assert (object.projectedVertices != null);
28062815
....@@ -2989,7 +2998,8 @@
29892998 if (timeline)
29902999 {
29913000 centralPanel.remove(cameraView);
2992
- centralPanel.add(timelinePanel);
3001
+ cameraPanel.add(cameraView);
3002
+ centralPanel.add(cameraPanel);
29933003 frame.setJMenuBar(timelineMenubar);
29943004 wasFullScreen = CameraPane.FULLSCREEN;
29953005 if (!CameraPane.FULLSCREEN)
....@@ -2998,7 +3008,7 @@
29983008 }
29993009 else
30003010 {
3001
- centralPanel.remove(timelinePanel);
3011
+ centralPanel.remove(cameraPanel);
30023012 centralPanel.add(cameraView);
30033013 frame.setJMenuBar(null);
30043014 if (!wasFullScreen)
....@@ -3014,9 +3024,9 @@
30143024 frame.validate();
30153025
30163026 return;
3017
- } else if (event.getSource() == toggleRandomItem)
3027
+ } else if (event.getSource() == toggleSwitchItem)
30183028 {
3019
- cameraView.ToggleRandom();
3029
+ cameraView.ToggleSwitch();
30203030 cameraView.repaint();
30213031 return;
30223032 } else if (event.getSource() == toggleHandleItem)
....@@ -3045,6 +3055,10 @@
30453055 {
30463056 copy.live ^= true;
30473057 return;
3058
+ } else if (event.getSource() == selectCB)
3059
+ {
3060
+ copy.dontselect ^= true;
3061
+ return;
30483062 } else if (event.getSource() == hideCB)
30493063 {
30503064 copy.hide ^= true;
....@@ -3059,6 +3073,7 @@
30593073 if (event.getSource() == randomCB)
30603074 {
30613075 copy.random ^= true;
3076
+ objEditor.refreshContents();
30623077 return;
30633078 }
30643079 if (event.getSource() == speedupCB)
....@@ -3082,8 +3097,9 @@
30823097
30833098 public void actionPerformed(ActionEvent event)
30843099 {
3100
+ Object source = event.getSource();
30853101 // SCRIPT DIALOG
3086
- if (event.getSource() == okbutton)
3102
+ if (source == okbutton)
30873103 {
30883104 textpanel.setVisible(false);
30893105 textpanel.remove(textarea);
....@@ -3095,7 +3111,7 @@
30953111 textarea = null;
30963112 textpanel = null;
30973113 }
3098
- if (event.getSource() == cancelbutton)
3114
+ if (source == cancelbutton)
30993115 {
31003116 textpanel.setVisible(false);
31013117 textpanel.remove(textarea);
....@@ -3107,49 +3123,50 @@
31073123 //applySelf();
31083124 //client.refreshEditWindow();
31093125 //refreshContents();
3110
- if (event.getSource() == nameField)
3126
+ if (source == nameField)
31113127 {
31123128 //System.out.println("ObjEditor " + event);
31133129 applySelf0(true);
31143130 //parent.applySelf();
31153131 objEditor.refreshContents();
3116
- } else if (event.getSource() == resetButton)
3132
+ } else if (source == resetButton)
31173133 {
31183134 CameraPane.fullreset = true;
31193135 copy.Reset(); // ResetMeshes();
31203136 copy.Touch();
31213137 objEditor.refreshContents();
3122
- } else if (event.getSource() == stepItem)
3138
+ } else if (source == stepItem)
31233139 {
3124
- cameraView.ONESTEP = true;
3140
+ //cameraView.ONESTEP = true;
3141
+ Globals.ONESTEP = true;
31253142 cameraView.repaint();
31263143 return;
3127
- } else if (event.getSource() == stepButton)
3144
+ } else if (source == stepButton)
31283145 {
31293146 copy.Step();
31303147 copy.Touch();
31313148 objEditor.refreshContents();
3132
- } else if (event.getSource() == slowerButton)
3149
+ } else if (source == slowerButton)
31333150 {
31343151 copy.Slower();
31353152 copy.Touch();
31363153 objEditor.refreshContents();
3137
- } else if (event.getSource() == fasterButton)
3154
+ } else if (source == fasterButton)
31383155 {
31393156 copy.Faster();
31403157 copy.Touch();
31413158 objEditor.refreshContents();
3142
- } else if (event.getSource() == remarkButton)
3159
+ } else if (source == remarkButton)
31433160 {
31443161 copy.Remark();
31453162 copy.Touch();
31463163 objEditor.refreshContents();
3147
- } else if (event.getSource() == stepAllButton)
3164
+ } else if (source == stepAllButton)
31483165 {
31493166 copy.StepAll();
31503167 copy.Touch();
31513168 objEditor.refreshContents();
3152
- } else if (event.getSource() == resetAllButton)
3169
+ } else if (source == resetAllButton)
31533170 {
31543171 //CameraPane.fullreset = true;
31553172 copy.ResetAll(); // ResetMeshes();
....@@ -3182,53 +3199,75 @@
31823199 // Close();
31833200 // }
31843201 // else
3185
- if (event.getSource() == resetSlidersButton)
3202
+ if (source == resetSlidersButton)
31863203 {
31873204 ResetSliders();
3188
- } else if (event.getSource() == clearMaterialButton)
3205
+ } else if (source == clearMaterialButton)
31893206 {
31903207 ClearMaterial();
3191
- } else if (event.getSource() == createMaterialButton)
3208
+ } else if (source == createMaterialButton)
31923209 {
31933210 CreateMaterial();
3194
- } else if (event.getSource() == clearPanelButton)
3211
+ } else if (source == clearPanelButton)
31953212 {
31963213 copy.ClearUI();
31973214 refreshContents(true);
3198
- } /*
3199
- }
3200
-
3201
- public boolean action(Event event, Object arg)
3202
- {
3203
- */ else if (event.getSource() == closeItem)
3215
+ } else if (source == importGFDItem)
3216
+ {
3217
+ ImportGFD();
3218
+ } else
3219
+ if (source == importVRMLX3DItem)
3220
+ {
3221
+ ImportVRMLX3D();
3222
+ } else
3223
+ if (source == import3DSItem)
3224
+ {
3225
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3226
+ } else
3227
+ if (source == importOBJItem)
3228
+ {
3229
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3230
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3231
+ browser.setVisible(true);
3232
+ String filename = browser.getFile();
3233
+ if (filename != null && filename.length() > 0)
3234
+ {
3235
+ String fullname = browser.getDirectory() + filename;
3236
+ makeSomething(ReadOBJ(fullname), true);
3237
+ }
3238
+ } else
3239
+ if (source == closeItem)
32043240 {
32053241 Close();
32063242 //return true;
3207
- } else if (event.getSource() == loadItem)
3243
+ } else if (source == loadItem)
32083244 {
32093245 load();
32103246 //return true;
3211
- } else if (event.getSource() == saveItem)
3247
+ } else if (source == newItem)
3248
+ {
3249
+ New();
3250
+ } else if (source == saveItem)
32123251 {
32133252 save();
32143253 //return true;
3215
- } else if (event.getSource() == saveAsItem)
3254
+ } else if (source == saveAsItem)
32163255 {
32173256 saveAs();
32183257 //return true;
3219
- } else if (event.getSource() == reexportItem)
3258
+ } else if (source == reexportItem)
32203259 {
32213260 reexport();
32223261 //return true;
3223
- } else if (event.getSource() == exportAsItem)
3262
+ } else if (source == exportAsItem)
32243263 {
32253264 export();
32263265 //return true;
3227
- } else if (event.getSource() == povItem)
3266
+ } else if (source == povItem)
32283267 {
32293268 generatePOV();
32303269 //return true;
3231
- } else if (event.getSource() == zBufferItem)
3270
+ } else if (source == zBufferItem)
32323271 {
32333272 try
32343273 {
....@@ -3250,21 +3289,8 @@
32503289 cameraView.repaint();
32513290 //return true;
32523291 }
3253
- */ else if (event.getSource() == editCameraItem)
3254
- {
3255
- cameraView.ProtectCamera();
3256
- cameraView.repaint();
3257
- return;
3258
- } else if (event.getSource() == revertCameraItem)
3259
- {
3260
- cameraView.RevertCamera();
3261
- cameraView.repaint();
3262
- return;
3263
-// } else if (event.getSource() == textureButton)
3264
-// {
3265
-// return; // true;
3266
- } else // combos...
3267
- if (event.getSource() == texresMenu)
3292
+ */ else // combos...
3293
+ if (source == texresMenu)
32683294 {
32693295 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32703296 copy.texres = texresMenu.getSelectedIndex();
....@@ -3276,27 +3302,283 @@
32763302 }
32773303 }
32783304
3279
- void ToggleAnimation()
3305
+ void New()
32803306 {
3281
- if (!CameraPane.ANIMATION)
3307
+ while (copy.Size() > 1)
32823308 {
3283
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3309
+ copy.remove(1);
3310
+ }
3311
+
3312
+ ResetModel();
3313
+ objEditor.refreshContents();
3314
+ }
3315
+
3316
+ static public byte[] Compress(Object3D o)
3317
+ {
3318
+ try
3319
+ {
3320
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3321
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3322
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3323
+
3324
+ Object3D parent = o.parent;
3325
+ o.parent = null;
3326
+
3327
+ out.writeObject(o);
3328
+
3329
+ o.parent = parent;
3330
+
3331
+ out.flush();
3332
+
3333
+ zstream.close();
3334
+ out.close();
3335
+
3336
+ return baos.toByteArray();
3337
+ } catch (Exception e)
3338
+ {
3339
+ System.err.println(e);
3340
+ return null;
3341
+ }
3342
+ }
3343
+
3344
+ static public Object Uncompress(byte[] bytes)
3345
+ {
3346
+ System.out.println("#bytes = " + bytes.length);
3347
+ try
3348
+ {
3349
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3350
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3351
+ ObjectInputStream in = new ObjectInputStream(istream);
3352
+ Object obj = in.readObject();
3353
+ in.close();
3354
+
3355
+ return obj;
3356
+ } catch (Exception e)
3357
+ {
3358
+ System.err.println(e);
3359
+ return null;
3360
+ }
3361
+ }
3362
+
3363
+ static public Object clone(Object o)
3364
+ {
3365
+ try
3366
+ {
3367
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3368
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3369
+
3370
+ out.writeObject(o);
3371
+
3372
+ out.flush();
3373
+ out.close();
3374
+
3375
+ byte[] bytes = baos.toByteArray();
3376
+
3377
+ System.out.println("clone = " + bytes.length);
3378
+
3379
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3380
+ ObjectInputStream in = new ObjectInputStream(bais);
3381
+ Object obj = in.readObject();
3382
+ in.close();
3383
+
3384
+ return obj;
3385
+ } catch (Exception e)
3386
+ {
3387
+ System.err.println(e);
3388
+ return null;
3389
+ }
3390
+ }
3391
+
3392
+ cRadio GetCurrentTab()
3393
+ {
3394
+ cRadio ab;
3395
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3396
+ {
3397
+ ab = (cRadio)e.nextElement();
3398
+ if(ab.GetObject() == copy)
3399
+ {
3400
+ return ab;
3401
+ }
3402
+ }
3403
+
3404
+ return null;
3405
+ }
3406
+
3407
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3408
+
3409
+ public void Save()
3410
+ {
3411
+ cRadio tab = GetCurrentTab();
3412
+
3413
+ boolean temp = CameraPane.SWITCH;
3414
+ CameraPane.SWITCH = false;
3415
+
3416
+ copy.ExtractBigData(hashtable);
3417
+
3418
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3419
+ tab.graphs[tab.undoindex++] = Compress(copy);
3420
+
3421
+ copy.RestoreBigData(hashtable);
3422
+
3423
+ CameraPane.SWITCH = temp;
3424
+
3425
+ //assert(hashtable.isEmpty());
3426
+
3427
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3428
+ {
3429
+ tab.graphs[i] = null;
3430
+ }
3431
+
3432
+ // test save
3433
+ if (false)
3434
+ {
3435
+ try
3436
+ {
3437
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3438
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3439
+
3440
+ p.writeObject(copy);
3441
+
3442
+ p.flush();
3443
+
3444
+ ostream.close();
3445
+ } catch (Exception e)
3446
+ {
3447
+ e.printStackTrace();
3448
+ }
3449
+ }
3450
+ }
3451
+
3452
+ void CopyChanged(Object3D obj)
3453
+ {
3454
+ boolean temp = CameraPane.SWITCH;
3455
+ CameraPane.SWITCH = false;
3456
+
3457
+ copy.ExtractBigData(hashtable);
3458
+
3459
+ copy.clear();
3460
+
3461
+ for (int i=0; i<obj.Size(); i++)
3462
+ {
3463
+ copy.add(obj.get(i));
3464
+ }
3465
+
3466
+ copy.RestoreBigData(hashtable);
3467
+
3468
+ CameraPane.SWITCH = temp;
3469
+
3470
+ //assert(hashtable.isEmpty());
3471
+
3472
+ copy.Touch();
3473
+
3474
+ ResetModel();
3475
+ copy.HardTouch(); // recompile?
3476
+
3477
+ cRadio ab;
3478
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3479
+ {
3480
+ ab = (cRadio)e.nextElement();
3481
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3482
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3483
+ if (test != null)
3484
+ {
3485
+ test.editWindow = ab.object.editWindow;
3486
+ ab.object = test;
3487
+ }
3488
+ }
3489
+
3490
+ refreshContents();
3491
+ }
3492
+
3493
+ public void Undo()
3494
+ {
3495
+ cRadio tab = GetCurrentTab();
3496
+
3497
+ if (tab.undoindex == 0)
3498
+ {
3499
+ java.awt.Toolkit.getDefaultToolkit().beep();
3500
+ return;
3501
+ }
3502
+
3503
+ if (tab.graphs[tab.undoindex] == null)
3504
+ {
3505
+ Save();
3506
+ tab.undoindex -= 1;
3507
+ }
3508
+
3509
+ tab.undoindex -= 1;
3510
+
3511
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3512
+ }
3513
+
3514
+ public void Redo()
3515
+ {
3516
+ cRadio tab = GetCurrentTab();
3517
+
3518
+ if (tab.graphs[tab.undoindex + 1] == null)
3519
+ {
3520
+ java.awt.Toolkit.getDefaultToolkit().beep();
3521
+ return;
3522
+ }
3523
+
3524
+ tab.undoindex += 1;
3525
+
3526
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3527
+ }
3528
+
3529
+ void ImportGFD()
3530
+ {
3531
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32843532 browser.show();
32853533 String filename = browser.getFile();
32863534 if (filename != null && filename.length() > 0)
32873535 {
3288
- CameraPane.filename = browser.getDirectory() + filename;
3536
+ String fullname = browser.getDirectory() + filename;
3537
+
3538
+ //Object3D readobj =
3539
+ objEditor.ReadGFD(fullname, objEditor);
3540
+ //makeSomething(readobj);
3541
+ }
3542
+ }
3543
+
3544
+ void ImportVRMLX3D()
3545
+ {
3546
+ if (Grafreed.standAlone)
3547
+ {
3548
+ /**/
3549
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3550
+ browser.show();
3551
+ String filename = browser.getFile();
3552
+ if (filename != null && filename.length() > 0)
3553
+ {
3554
+ String fullname = browser.getDirectory() + filename;
3555
+ LoadVRMLX3D(fullname);
3556
+ }
3557
+ /**/
3558
+ }
3559
+ }
3560
+
3561
+ void ToggleAnimation()
3562
+ {
3563
+ if (!Globals.ANIMATION)
3564
+ {
3565
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3566
+ browser.setVisible(true);
3567
+ String filename = browser.getFile();
3568
+ if (filename != null && filename.length() > 0)
3569
+ {
3570
+ Globals.filename = browser.getDirectory() + filename;
32893571 //CameraPane.framecount = 0;
3290
- CameraPane.imagecount = 0;
3572
+ Globals.imagecount = 0;
32913573
3292
- CameraPane.ANIMATION ^= true;
3574
+ Globals.ANIMATION ^= true;
32933575
3294
- GrafreeD.wav.cursor = 0;
3295
- GrafreeD.wav.loop = 0;
3576
+ Grafreed.wav.cursor = 0;
3577
+ Grafreed.wav.loop = 0;
32963578 }
32973579 } else
32983580 {
3299
- CameraPane.ANIMATION ^= true;
3581
+ Globals.ANIMATION ^= true;
33003582 }
33013583 }
33023584
....@@ -3342,7 +3624,7 @@
33423624 void CreateMaterial()
33433625 {
33443626 //copy.ClearMaterial(); // PATCH
3345
- copy.CreateMaterialS(multiplyToggle.isSelected());
3627
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33463628 if (copy.selection.size() > 0)
33473629 //SetMaterial(copy);
33483630 {
....@@ -3401,11 +3683,11 @@
34013683 {
34023684 copy.ResetBlockLoop(); // temporary problem
34033685
3404
- boolean random = CameraPane.RANDOM;
3405
- CameraPane.RANDOM = false; // parse everything
3686
+ boolean random = CameraPane.SWITCH;
3687
+ CameraPane.SWITCH = false; // parse everything
34063688 copy.ResetDisplayList();
34073689 copy.HardTouch();
3408
- CameraPane.RANDOM = random;
3690
+ CameraPane.SWITCH = random;
34093691 }
34103692
34113693 // public void applySelf()
....@@ -3475,10 +3757,40 @@
34753757 current.fakedepth = (float) fakedepthField.getFloat();
34763758 current.shadowbias = (float) shadowbiasField.getFloat();
34773759
3478
- if (!NumberSlider.frozen)
3760
+ if (!cNumberSlider.frozen)
34793761 {
34803762 //System.out.println("Propagate = " + propagate);
34813763 copy.UpdateMaterial(anchor, current, propagate);
3764
+
3765
+ if (copy.material != null)
3766
+ {
3767
+ cMaterial mat = copy.material;
3768
+
3769
+ colorField.SetToolTipValue((mat.color));
3770
+ modulationField.SetToolTipValue((mat.modulation));
3771
+ metalnessField.SetToolTipValue((mat.metalness));
3772
+ diffuseField.SetToolTipValue((mat.diffuse));
3773
+ specularField.SetToolTipValue((mat.specular));
3774
+ shininessField.SetToolTipValue((mat.shininess));
3775
+ shiftField.SetToolTipValue((mat.shift));
3776
+ ambientField.SetToolTipValue((mat.ambient));
3777
+ lightareaField.SetToolTipValue((mat.lightarea));
3778
+ diffusenessField.SetToolTipValue((mat.factor));
3779
+ velvetField.SetToolTipValue((mat.velvet));
3780
+ sheenField.SetToolTipValue((mat.sheen));
3781
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3782
+ backlitField.SetToolTipValue((mat.bump));
3783
+ anisoField.SetToolTipValue((mat.aniso));
3784
+ anisoVField.SetToolTipValue((mat.anisoV));
3785
+ cameraField.SetToolTipValue((mat.cameralight));
3786
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3787
+ shadowField.SetToolTipValue((mat.shadow));
3788
+ textureField.SetToolTipValue((mat.texture));
3789
+ opacityField.SetToolTipValue((mat.opacity));
3790
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3791
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3792
+ }
3793
+
34823794 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34833795 {
34843796 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3523,6 +3835,7 @@
35233835 || e.getSource() == apertureField
35243836 || e.getSource() == shadowblurField)
35253837 {
3838
+ new Exception().printStackTrace();
35263839 System.exit(0);
35273840 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35283841 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3549,7 +3862,13 @@
35493862 //System.out.println("PARENT = " + parent);
35503863 //if (parent != null)
35513864 // parent.applySelf();
3552
- refreshContents();
3865
+ if (e.getSource() == normalpushField)
3866
+ {
3867
+ objEditor.refreshContents();
3868
+ //Refresh();
3869
+ }
3870
+ else
3871
+ refreshContents();
35533872 // ??? client.refreshEditWindow();
35543873 }
35553874 //else
....@@ -3561,7 +3880,7 @@
35613880 //group.name = nameField.getText();
35623881 //objEditor.applySelf();
35633882
3564
- assert (objEditor == this);
3883
+ // OCT2018: assert (objEditor == this);
35653884 if (copy.selection == null || copy.selection.size() == 0)
35663885 //super.applySelf()
35673886 ; else
....@@ -3585,6 +3904,9 @@
35853904 objEditor.copy = keep;
35863905 }
35873906 }
3907
+
3908
+ if (normalpushField != null)
3909
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35883910 }
35893911
35903912 void SnapObject()
....@@ -3839,7 +4161,7 @@
38394161
38404162 radioPanel.revalidate();
38414163 radioPanel.repaint();
3842
- ctrlPanel.revalidate(); // ? new
4164
+ ctrlPanel.validate(); // ? new
38434165 ctrlPanel.repaint();
38444166 }
38454167 }
....@@ -3848,6 +4170,7 @@
38484170
38494171 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38504172 {
4173
+ Save();
38514174 //Tween.set(thing, 0).target(1).start(tweenManager);
38524175 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38534176 // if (thing instanceof GenericJointDemo)
....@@ -4051,6 +4374,7 @@
40514374 }
40524375 }
40534376 }
4377
+
40544378 LoadGFDThread loadGFDThread;
40554379
40564380 void ReadGFD(String fullname, iCallBack cb)
....@@ -4070,8 +4394,10 @@
40704394
40714395 try
40724396 {
4397
+ // Try compressed version first.
40734398 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4074
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4399
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4400
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40754401
40764402 readobj = (Object3D) p.readObject();
40774403 istream.close();
....@@ -4079,7 +4405,20 @@
40794405 readobj.ResetDisplayList();
40804406 } catch (Exception e)
40814407 {
4082
- e.printStackTrace();
4408
+ //e.printStackTrace();
4409
+ try
4410
+ {
4411
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4412
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4413
+
4414
+ readobj = (Object3D) p.readObject();
4415
+ istream.close();
4416
+
4417
+ readobj.ResetDisplayList();
4418
+ } catch (Exception e2)
4419
+ {
4420
+ e2.printStackTrace();
4421
+ }
40834422 }
40844423 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40854424 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4125,6 +4464,12 @@
41254464
41264465 void LoadIt(Object obj)
41274466 {
4467
+ if (obj == null)
4468
+ {
4469
+ // Invalid file
4470
+ return;
4471
+ }
4472
+
41284473 System.out.println("Loaded " + obj);
41294474 //new Exception().printStackTrace();
41304475 Object3D readobj = (Object3D) obj;
....@@ -4134,6 +4479,7 @@
41344479
41354480 if (readobj != null)
41364481 {
4482
+ Save();
41374483 try
41384484 {
41394485 //readobj.deepCopySelf(copy);
....@@ -4196,7 +4542,7 @@
41964542
41974543 void load() // throws ClassNotFoundException
41984544 {
4199
- if (GrafreeD.standAlone)
4545
+ if (Grafreed.standAlone)
42004546 {
42014547 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42024548 browser.show();
....@@ -4283,11 +4629,13 @@
42834629 try
42844630 {
42854631 FileOutputStream ostream = new FileOutputStream(lastname);
4286
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4632
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4633
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42874634
42884635 p.writeObject(copy);
42894636 p.flush();
42904637
4638
+ zstream.close();
42914639 ostream.close();
42924640
42934641 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4297,11 +4645,12 @@
42974645 {
42984646 }
42994647 }
4648
+
43004649 String lastname;
43014650
43024651 void saveAs()
43034652 {
4304
- if (GrafreeD.standAlone)
4653
+ if (Grafreed.standAlone)
43054654 {
43064655 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43074656 browser.setVisible(true);
....@@ -4406,13 +4755,13 @@
44064755 try
44074756 {
44084757 FileOutputStream ostream = new FileOutputStream(filename);
4409
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4410
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4758
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4759
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44114760
44124761 Object3D objectparent = obj.parent;
44134762 obj.parent = null;
44144763
4415
- Object3D object = (Object3D) GrafreeD.clone(obj);
4764
+ Object3D object = (Object3D) Grafreed.clone(obj);
44164765
44174766 obj.parent = objectparent;
44184767
....@@ -4424,8 +4773,8 @@
44244773 p.writeObject(object);
44254774 p.flush();
44264775
4776
+ zstream.close();
44274777 ostream.close();
4428
- // zstream.close();
44294778
44304779 // group.selection.get(0).parent = parent;
44314780 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4446,7 +4795,7 @@
44464795 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44474796 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44484797 copy.generatePOV(buffer);
4449
- if (GrafreeD.standAlone)
4798
+ if (Grafreed.standAlone)
44504799 {
44514800 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44524801 browser.show();
....@@ -4472,7 +4821,8 @@
44724821 Object3D client;
44734822 Object3D copy;
44744823 MenuBar menuBar;
4475
- Menu windowMenu;
4824
+ Menu fileMenu;
4825
+ MenuItem newItem;
44764826 MenuItem loadItem;
44774827 MenuItem saveItem;
44784828 MenuItem saveAsItem;
....@@ -4480,13 +4830,11 @@
44804830 MenuItem reexportItem;
44814831 MenuItem povItem;
44824832 MenuItem closeItem;
4483
- Menu cameraMenu;
4833
+
44844834 CheckboxMenuItem zBufferItem;
44854835 //MenuItem normalLensItem;
4486
- MenuItem editCameraItem;
4487
- MenuItem revertCameraItem;
4488
- CheckboxMenuItem toggleLiveItem;
44894836 MenuItem stepItem;
4837
+ CheckboxMenuItem toggleLiveItem;
44904838 CheckboxMenuItem toggleFullScreenItem;
44914839 CheckboxMenuItem toggleTimelineItem;
44924840 CheckboxMenuItem toggleRenderItem;
....@@ -4495,7 +4843,7 @@
44954843 CheckboxMenuItem toggleFootContactItem;
44964844 CheckboxMenuItem toggleDLItem;
44974845 CheckboxMenuItem toggleTextureItem;
4498
- CheckboxMenuItem toggleRandomItem;
4846
+ CheckboxMenuItem toggleSwitchItem;
44994847 CheckboxMenuItem toggleRootItem;
45004848 CheckboxMenuItem animationItem;
45014849 CheckboxMenuItem toggleHandleItem;
....@@ -4503,20 +4851,21 @@
45034851 JSplitPane mainPanel;
45044852 JScrollPane scrollpane;
45054853 JPanel toolbarPanel;
4506
- JPanel treePanel;
4854
+ cGridBag treePanel;
45074855 JPanel radioPanel;
45084856 ButtonGroup buttonGroup;
4509
- JPanel ctrlPanel;
4510
- JPanel materialPanel;
4857
+ cGridBag ctrlPanel;
4858
+ cGridBag materialPanel;
45114859 JScrollPane infoPanel;
4512
- JPanel optionsPanel;
4860
+ cGridBag optionsPanel;
45134861 JTabbedPane objectPanel;
4514
- JPanel XYZPanel;
4862
+ cGridBag XYZPanel;
45154863 JSplitPane gridPanel;
45164864 JSplitPane bigPanel;
4517
- JPanel bigThree;
4518
- JTabbedPane scenePanel;
4519
- JPanel centralPanel;
4865
+ cGridBag bigThree;
4866
+ cGridBag scenePanel;
4867
+ cGridBag centralPanel;
4868
+ JSplitPane cameraPanel;
45204869 JPanel timelinePanel;
45214870 JMenuBar timelineMenubar;
45224871 JSplitPane framePanel;
....@@ -4568,65 +4917,72 @@
45684917 // MATERIAL
45694918 JLabel materialLabel;
45704919 JLabel colorLabel;
4571
- NumberSlider colorField;
4920
+ cNumberSlider colorField;
45724921 JLabel modulationLabel;
4573
- NumberSlider modulationField;
4922
+ cNumberSlider modulationField;
45744923 JLabel metalnessLabel;
4575
- NumberSlider metalnessField;
4924
+ cNumberSlider metalnessField;
45764925 JLabel diffuseLabel;
4577
- NumberSlider diffuseField;
4926
+ cNumberSlider diffuseField;
45784927 JLabel specularLabel;
4579
- NumberSlider specularField;
4928
+ cNumberSlider specularField;
45804929 JLabel shininessLabel;
4581
- NumberSlider shininessField;
4930
+ cNumberSlider shininessField;
45824931 JLabel shiftLabel;
4583
- NumberSlider shiftField;
4932
+ cNumberSlider shiftField;
45844933 JLabel ambientLabel;
4585
- NumberSlider ambientField;
4934
+ cNumberSlider ambientField;
45864935 JLabel lightareaLabel;
4587
- NumberSlider lightareaField;
4936
+ cNumberSlider lightareaField;
45884937 JLabel diffusenessLabel;
4589
- NumberSlider diffusenessField;
4938
+ cNumberSlider diffusenessField;
45904939 JLabel velvetLabel;
4591
- NumberSlider velvetField;
4940
+ cNumberSlider velvetField;
45924941 JLabel sheenLabel;
4593
- NumberSlider sheenField;
4942
+ cNumberSlider sheenField;
45944943 JLabel subsurfaceLabel;
4595
- NumberSlider subsurfaceField;
4944
+ cNumberSlider subsurfaceField;
45964945 //JLabel bumpLabel;
45974946 //NumberSlider bumpField;
45984947 JLabel backlitLabel;
4599
- NumberSlider backlitField;
4948
+ cNumberSlider backlitField;
46004949 JLabel anisoLabel;
4601
- NumberSlider anisoField;
4950
+ cNumberSlider anisoField;
46024951 JLabel anisoVLabel;
4603
- NumberSlider anisoVField;
4952
+ cNumberSlider anisoVField;
46044953 JLabel cameraLabel;
4605
- NumberSlider cameraField;
4954
+ cNumberSlider cameraField;
46064955 JLabel selfshadowLabel;
4607
- NumberSlider selfshadowField;
4956
+ cNumberSlider selfshadowField;
46084957 JLabel shadowLabel;
4609
- NumberSlider shadowField;
4958
+ cNumberSlider shadowField;
46104959 JLabel textureLabel;
4611
- NumberSlider textureField;
4960
+ cNumberSlider textureField;
46124961 JLabel opacityLabel;
4613
- NumberSlider opacityField;
4962
+ cNumberSlider opacityField;
46144963 JLabel fakedepthLabel;
4615
- NumberSlider fakedepthField;
4964
+ cNumberSlider fakedepthField;
46164965 JLabel shadowbiasLabel;
4617
- NumberSlider shadowbiasField;
4966
+ cNumberSlider shadowbiasField;
46184967 JLabel bumpLabel;
4619
- NumberSlider bumpField;
4968
+ cNumberSlider bumpField;
46204969 JLabel noiseLabel;
4621
- NumberSlider noiseField;
4970
+ cNumberSlider noiseField;
46224971 JLabel powerLabel;
4623
- NumberSlider powerField;
4972
+ cNumberSlider powerField;
46244973 JLabel borderfadeLabel;
4625
- NumberSlider borderfadeField;
4974
+ cNumberSlider borderfadeField;
46264975 JLabel fogLabel;
4627
- NumberSlider fogField;
4976
+ cNumberSlider fogField;
46284977 JLabel opacityPowerLabel;
4629
- NumberSlider opacityPowerField;
4978
+ cNumberSlider opacityPowerField;
46304979 JTree jTree;
46314980 //ObjectUI parent;
4981
+
4982
+ cNumberSlider normalpushField;
4983
+
4984
+ private MenuItem importGFDItem;
4985
+ private MenuItem importVRMLX3DItem;
4986
+ private MenuItem import3DSItem;
4987
+ private MenuItem importOBJItem;
46324988 }