Normand Briere
2019-08-17 d5d6485126da83b06645e90e3e4ce66659a56009
ObjEditor.java
....@@ -4,6 +4,7 @@
44
55 import java.awt.*;
66 import java.awt.event.*;
7
+import java.awt.image.BufferedImage;
78 import javax.swing.*;
89 import javax.swing.event.*;
910 import javax.swing.text.*;
....@@ -14,10 +15,15 @@
1415 //import javax.swing.plaf.ColorUIResource;
1516 //import javax.swing.plaf.metal.DefaultMetalTheme;
1617
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
20
+
1721 //import javax.media.opengl.GLCanvas;
1822
1923 import //weka.core.
2024 matrix.Matrix;
25
+
26
+import grafeme.ui.*;
2127
2228 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
2329 ActionListener, ChangeListener,
....@@ -28,7 +34,132 @@
2834 iSendInfo
2935 //KeyListener
3036 {
37
+ public cToggleButton pinButton;
38
+ boolean timeline;
39
+ boolean wasFullScreen;
3140
41
+ GroupEditor callee;
42
+ JFrame frame;
43
+
44
+ static ObjEditor theFrame;
45
+
46
+ public void AllocProjectedVertices(Object3D object)
47
+ {
48
+ assert (object.projectedVertices != null);
49
+
50
+ if (object.projectedVertices.length <= 2)
51
+ {
52
+ // Side effect...
53
+ Object3D.cVector2[] keep = object.projectedVertices;
54
+ object.projectedVertices = new Object3D.cVector2[3];
55
+ for (int i = 0; i < 3; i++)
56
+ {
57
+ if (i < keep.length)
58
+ {
59
+ object.projectedVertices[i] = keep[i];
60
+ } else
61
+ {
62
+ object.projectedVertices[i] = new Object3D.cVector2();
63
+ }
64
+ /*
65
+ if(keep.length == 0)
66
+ object.projectedVertices[0] = new Object3D.cVector2();
67
+ else
68
+ object.projectedVertices[0] = keep[0];
69
+ object.projectedVertices[1] = new Object3D.cVector2();
70
+ */
71
+ }
72
+ }
73
+ }
74
+
75
+ public cGridBag GetSeparator()
76
+ {
77
+ cGridBag separator = new cGridBag();
78
+ separator.add(new JSeparator());
79
+ separator.preferredHeight = 5;
80
+ return separator;
81
+ }
82
+
83
+ cButton GetButton(String name, boolean border)
84
+ {
85
+ ImageIcon icon = GetIcon(name);
86
+ if (icon != null)
87
+ return new cButton(icon, border);
88
+ else
89
+ return new cButton(name, border);
90
+ }
91
+
92
+ cLabel GetLabel(String name, boolean border)
93
+ {
94
+ //ImageIcon icon = GetIcon(name);
95
+ return new cLabel(GetImage(name), border);
96
+ }
97
+
98
+ cToggleButton GetToggleButton(String name, boolean border)
99
+ {
100
+ ImageIcon icon = GetIcon(name);
101
+ return new cToggleButton(icon, border);
102
+ }
103
+
104
+ cCheckBox GetCheckBox(String name, boolean border)
105
+ {
106
+ ImageIcon icon = GetIcon(name);
107
+ return new cCheckBox(icon, border);
108
+ }
109
+
110
+ static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>();
111
+
112
+ static ImageIcon GetIcon(String name)
113
+ {
114
+ javax.swing.ImageIcon iconCache = icons.get(name);
115
+ if (iconCache != null)
116
+ {
117
+ return iconCache;
118
+ }
119
+
120
+ try
121
+ {
122
+ BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
123
+
124
+// if (image.getWidth() > 48 && image.getHeight() > 48)
125
+// {
126
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
127
+// Graphics2D g = resized.createGraphics();
128
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
129
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
130
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
131
+// g.dispose();
132
+//
133
+// image = resized;
134
+// }
135
+
136
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
137
+
138
+ icons.put(name, icon);
139
+
140
+ return icon;
141
+ }
142
+ catch (Exception e)
143
+ {
144
+ //icons.put(name, null);
145
+ return null;
146
+ }
147
+ }
148
+
149
+ BufferedImage GetImage(String name)
150
+ {
151
+ try
152
+ {
153
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
154
+
155
+ return image;
156
+ }
157
+ catch (Exception e)
158
+ {
159
+ return null;
160
+ }
161
+ }
162
+
32163 // SCRIPT
33164
34165 transient JFrame textpanel = null;
....@@ -119,51 +250,62 @@
119250 void keyPressed(int key, int modifiers)
120251 {
121252 System.out.println("KEY PRESSED");
122
- CameraPane.theRenderer.keyPressed(key, modifiers);
253
+ Globals.theRenderer.keyPressed(key, modifiers);
123254 }
124255 */
125256
126257 static GridBagConstraints aConstraints;
127258 static GridBagConstraints aWindowConstraints;
128
- GroupEditor callee;
129
- JFrame frame;
259
+
130260 static int GRIDWIDTH = 100; // 4;
131261
132262 public void closeUI()
133263 {
134264 //new Exception().printStackTrace();
135
- System.out.println("this = " + this);
136
- System.out.println("objEditor = " + objEditor);
265
+// System.out.println("this = " + this);
266
+// System.out.println("objEditor = " + objEditor);
137267 //nameField.removeActionListener(this);
138
- objEditor.ctrlPanel.remove(nameField);
268
+// objEditor.ctrlPanel.remove(nameField);
139269
140
- if (!GroupEditor.allparams)
270
+ objEditor.ctrlPanel.remove(namePanel);
271
+
272
+ if (!allparams)
141273 return;
142274
143
- objEditor.ctrlPanel.remove(liveCB);
144
- objEditor.ctrlPanel.remove(hideCB);
145
- objEditor.ctrlPanel.remove(markCB);
146
-
147
- objEditor.ctrlPanel.remove(randomCB);
148
- objEditor.ctrlPanel.remove(speedupCB);
149
- objEditor.ctrlPanel.remove(rewindCB);
150
-
151
- objEditor.ctrlPanel.remove(resetButton);
152
- objEditor.ctrlPanel.remove(stepButton);
153
-// objEditor.ctrlPanel.remove(stepAllButton);
154
-// objEditor.ctrlPanel.remove(resetAllButton);
155
- objEditor.ctrlPanel.remove(link2masterCB);
156
- //objEditor.ctrlPanel.remove(flipVCB);
157
- //objEditor.ctrlPanel.remove(texresMenu);
158
- objEditor.ctrlPanel.remove(slowerButton);
159
- objEditor.ctrlPanel.remove(fasterButton);
160
- objEditor.ctrlPanel.remove(remarkButton);
275
+// objEditor.ctrlPanel.remove(liveCB);
276
+// objEditor.ctrlPanel.remove(hideCB);
277
+// objEditor.ctrlPanel.remove(markCB);
278
+//
279
+// objEditor.ctrlPanel.remove(randomCB);
280
+// objEditor.ctrlPanel.remove(speedupCB);
281
+// objEditor.ctrlPanel.remove(rewindCB);
282
+//
283
+// objEditor.ctrlPanel.remove(resetButton);
284
+// objEditor.ctrlPanel.remove(stepButton);
285
+//// objEditor.ctrlPanel.remove(stepAllButton);
286
+//// objEditor.ctrlPanel.remove(resetAllButton);
287
+// objEditor.ctrlPanel.remove(link2masterCB);
288
+// //objEditor.ctrlPanel.remove(flipVCB);
289
+// //objEditor.ctrlPanel.remove(texresMenu);
290
+// objEditor.ctrlPanel.remove(slowerButton);
291
+// objEditor.ctrlPanel.remove(fasterButton);
292
+// objEditor.ctrlPanel.remove(remarkButton);
293
+
294
+ objEditor.ctrlPanel.remove(setupPanel);
295
+ objEditor.ctrlPanel.remove(setupPanel2);
296
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
297
+ objEditor.ctrlPanel.remove(pushPanel);
298
+ //objEditor.ctrlPanel.remove(fillPanel);
299
+
300
+ //Remove(normalpushField);
161301 }
162302
163303 public ObjEditor GetEditor()
164304 {
165305 return objEditor; //.GetEditor();
166306 }
307
+
308
+ // Sometimes myself, sometimes my callee's.
167309 ObjEditor objEditor;
168310
169311 /*
....@@ -199,6 +341,14 @@
199341 client = inClient;
200342 copy = client;
201343
344
+// if (copy.versionlist == null)
345
+// {
346
+// copy.versionlist = new Object3D[100];
347
+// copy.versionindex = -1;
348
+//
349
+// callee.Save(true);
350
+// }
351
+
202352 // "this" is not called: SetupUI2(objEditor);
203353 }
204354
....@@ -212,6 +362,14 @@
212362 client = inClient;
213363 copy = client;
214364
365
+ if (copy.versionlist == null)
366
+ {
367
+ copy.versionlist = new Object3D[100];
368
+ copy.versionindex = -1;
369
+
370
+// Save(true);
371
+ }
372
+
215373 SetupUI2(callee.GetEditor());
216374 }
217375
....@@ -226,23 +384,33 @@
226384 //localCopy.parent = null;
227385
228386 frame = new JFrame();
387
+ frame.setUndecorated(false);
229388 objEditor = this;
230389 this.callee = callee;
231390
232391 //parent = p;
233392
234393 GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
235
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
394
+ if (Globals.DEBUG)
395
+ System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
236396 //gd.setFullScreenWindow(this);
237397 //setResizable(false);
238398 //if (!isDisplayable())
239399 //setUndecorated(true);
240400
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
401
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242402 client = inClient;
243403 copy = localCopy;
244404 copy.editWindow = this;
245405
406
+// if (copy.versionlist == null)
407
+// {
408
+// copy.versionlist = new Object3D[100];
409
+// copy.versionindex = -1;
410
+//
411
+// Save(true);
412
+// }
413
+
246414 SetupMenu();
247415
248416 //SetupName(objEditor); // new
....@@ -256,28 +424,52 @@
256424 return frame.action(event, obj);
257425 }
258426
427
+ // Cannot work without static
428
+ static boolean allparams = true;
429
+
430
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
431
+
432
+ // This is to refresh the UI of the material panel.
433
+ boolean patchMaterial;
434
+
259435 void SetupMenu()
260436 {
261437 frame.setMenuBar(menuBar = new MenuBar());
262
- menuBar.add(windowMenu = new Menu("File"));
263
- windowMenu.add(loadItem = new MenuItem("Load..."));
264
- windowMenu.add("-");
265
- windowMenu.add(saveItem = new MenuItem("Save"));
266
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
438
+ menuBar.add(fileMenu = new Menu("File"));
439
+ fileMenu.add(newItem = new MenuItem("New"));
440
+ fileMenu.add(openItem = new MenuItem("Open..."));
441
+
442
+ //oe.menuBar.add(menu = new Menu("Include"));
443
+ Menu menu = new Menu("Import");
444
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
445
+ importOBJItem.addActionListener(this);
446
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
447
+ import3DSItem.addActionListener(this);
448
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
449
+ importVRMLX3DItem.addActionListener(this);
450
+ menu.add("-");
451
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
452
+ importGFDItem.addActionListener(this);
453
+ fileMenu.add(menu);
454
+ fileMenu.add("-");
455
+
456
+ fileMenu.add(saveItem = new MenuItem("Save"));
457
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267458 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
268
- windowMenu.add("-");
269
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
270
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
271
- windowMenu.add("-");
459
+ fileMenu.add("-");
460
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
461
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
462
+ fileMenu.add("-");
272463 if (client.parent != null)
273464 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
465
+ fileMenu.add(closeItem = new MenuItem("Close"));
275466 } else
276467 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
468
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278469 }
279470
280
- loadItem.addActionListener(this);
471
+ newItem.addActionListener(this);
472
+ openItem.addActionListener(this);
281473 saveItem.addActionListener(this);
282474 saveAsItem.addActionListener(this);
283475 exportAsItem.addActionListener(this);
....@@ -285,80 +477,103 @@
285477 //povItem.addActionListener(this);
286478 closeItem.addActionListener(this);
287479
288
- menuBar.add(cameraMenu = new Menu("View"));
289
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
290
- //zBufferItem.addActionListener(this);
291
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
292
- //normalLensItem.addActionListener(this);
293
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
294
- revertCameraItem.addActionListener(this);
295
- cameraMenu.add(toggleFullItem = new CheckboxMenuItem("Full Screen"));
296
- toggleFullItem.addItemListener(this);
297
- toggleFullItem.setState(CameraPane.FULLSCREEN);
298
- cameraMenu.add("-");
299
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
300
- toggleTextureItem.addItemListener(this);
301
- toggleTextureItem.setState(CameraPane.textureon);
302
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
303
- toggleLiveItem.addItemListener(this);
304
- toggleLiveItem.setState(CameraPane.isLIVE());
305
- cameraMenu.add(stepItem = new MenuItem("Step"));
306
- stepItem.addActionListener(this);
307
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
308
-// toggleDLItem.addItemListener(this);
309
-// toggleDLItem.setState(false);
310
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
311
- toggleRenderItem.addItemListener(this);
312
- toggleRenderItem.setState(!CameraPane.frozen);
313
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
314
- toggleDebugItem.addItemListener(this);
315
- toggleDebugItem.setState(CameraPane.DEBUG);
316
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
317
- toggleFrustumItem.addItemListener(this);
318
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
319
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
320
- toggleFootContactItem.addItemListener(this);
321
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
322
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
323
- toggleRandomItem.addItemListener(this);
324
- toggleRandomItem.setState(CameraPane.RANDOM);
325
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
326
- toggleHandleItem.addItemListener(this);
327
- toggleHandleItem.setState(CameraPane.HANDLES);
328
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
329
- togglePaintItem.addItemListener(this);
330
- togglePaintItem.setState(CameraPane.PAINTMODE);
331
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
332
-// toggleRootItem.addItemListener(this);
333
-// toggleRootItem.setState(false);
334
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
335
-// animationItem.addItemListener(this);
336
-// animationItem.setState(CameraPane.ANIMATION);
337
- cameraMenu.add("-");
338
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
339
- editCameraItem.addActionListener(this);
340
-
341480 objectPanel = new JTabbedPane();
481
+
482
+ ChangeListener changeListener = new ChangeListener()
483
+ {
484
+ //String name;
485
+
486
+ public void stateChanged(ChangeEvent changeEvent)
487
+ {
488
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
489
+// {
490
+// if (latestObject != null)
491
+// {
492
+// refreshContents(true);
493
+// SetMaterial(latestObject);
494
+// }
495
+//
496
+// materialFlushed = true;
497
+// }
498
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
499
+// {
500
+// if (listUI.size() == 0)
501
+// EditSelection(false);
502
+// }
503
+
504
+// if (objectPanel.getSelectedIndex() == 4)
505
+// {
506
+// name = copy.skyboxname;
507
+//
508
+// if (name == null)
509
+// {
510
+// name = "";
511
+// }
512
+//
513
+// copy.skyboxname = "cubemaps/default-skyboxes/rgb";
514
+// copy.skyboxext = "jpg";
515
+// }
516
+// else
517
+// {
518
+// if (name != null)
519
+// {
520
+// if (name.equals(""))
521
+// {
522
+// copy.skyboxname = null;
523
+// copy.skyboxext = null;
524
+// }
525
+// else
526
+// {
527
+// copy.skyboxname = name;
528
+// }
529
+// }
530
+// }
531
+ cameraView.transformMode = objectPanel.getSelectedIndex() == 4;
532
+
533
+// refreshContents(false); // To refresh Info tab
534
+ cameraView.repaint();
535
+ }
536
+ };
537
+ objectPanel.addChangeListener(changeListener);
538
+
342539 toolbarPanel = new JPanel();
343540 toolbarPanel.setName("Toolbar");
344
- treePanel = new JPanel();
541
+
542
+ treePanel = new cGridBag();
345543 treePanel.setName("Tree");
346
- ctrlPanel = new JPanel(); // new GridBagLayout());
347
- ctrlPanel.setName("Edit");
348
- materialPanel = new JPanel();
349
- materialPanel.setName("Material");
544
+
545
+ editPanel = new cGridBag().setVertical(true);
546
+ //editPanel.setName("Edit");
547
+
548
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
549
+
550
+ editCommandsPanel = new cGridBag();
551
+ editPanel.add(editCommandsPanel);
552
+ editPanel.add(ctrlPanel);
553
+
554
+ toolboxPanel = new cGridBag().setVertical(true);
555
+ //toolboxPanel.setName("Toolbox");
556
+
557
+ skyboxPanel = new cGridBag().setVertical(true);
558
+
559
+ materialPanel = new cGridBag().setVertical(false);
560
+ //materialPanel.setName("Material");
561
+
350562 /*JTextPane*/
351563 infoarea = createTextPane();
564
+ doc = infoarea.getStyledDocument();
565
+
352566 infoarea.setEditable(true);
353567 SetText();
568
+
354569 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
355570 // infoarea.setOpaque(false);
356571 // //infoarea.setForeground(textcolor);
357
- infoarea.setLineWrap(true);
358
- infoarea.setWrapStyleWord(true);
572
+// TEXTAREA infoarea.setLineWrap(true);
573
+// TEXTAREA infoarea.setWrapStyleWord(true);
359574 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
360
- infoPanel.setPreferredSize(new Dimension(50, 200));
361
- infoPanel.setName("Info");
575
+ infoPanel.setPreferredSize(new Dimension(1, 1));
576
+ //infoPanel.setName("Info");
362577 //infoPanel.setLayout(new BorderLayout());
363578 //infoPanel.add(createTextPane());
364579
....@@ -366,16 +581,23 @@
366581 mainPanel.setName("Main");
367582 mainPanel.setContinuousLayout(true);
368583 mainPanel.setOneTouchExpandable(true);
369
- mainPanel.setDividerLocation(1.0);
370584 mainPanel.setDividerSize(9);
371
- mainPanel.setResizeWeight(0);
372
-
585
+ mainPanel.setDividerLocation(0.5); //1.0);
586
+ mainPanel.setResizeWeight(0.5);
587
+
588
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
589
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
590
+ divider.setDividerSize(15);
591
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
592
+
593
+ mainPanel.setUI(new BasicSplitPaneUI());
594
+
373595 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
374596 //mainPanel.setLayout(new GridBagLayout());
375597 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
376
- treePanel.setLayout(new GridBagLayout());
377
- ctrlPanel.setLayout(new GridBagLayout());
378
- materialPanel.setLayout(new GridBagLayout());
598
+// treePanel.setLayout(new GridBagLayout());
599
+ //ctrlPanel.setLayout(new GridBagLayout());
600
+ //materialPanel.setLayout(new GridBagLayout());
379601
380602 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
381603 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -414,7 +636,7 @@
414636 static String newline = "\n";
415637 protected static final String buttonString = "JButton";
416638 StyledDocument doc;
417
- JTextArea infoarea;
639
+ JTextPane infoarea;
418640
419641 void ClearInfo()
420642 {
....@@ -437,10 +659,10 @@
437659 e.printStackTrace();
438660 }
439661
440
- String selection = infoarea.getText();
441
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
442
- java.awt.datatransfer.Clipboard clipboard =
443
- Toolkit.getDefaultToolkit().getSystemClipboard();
662
+// String selection = infoarea.getText();
663
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
664
+// java.awt.datatransfer.Clipboard clipboard =
665
+// Toolkit.getDefaultToolkit().getSystemClipboard();
444666 //clipboard.setContents(data, data);
445667 }
446668
....@@ -463,13 +685,13 @@
463685 //SendInfo("Name:", "bold");
464686 if (sel.GetTextures() != null || debug)
465687 {
466
- si.SendInfo(sel.toString(), "bold");
688
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
467689 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
468690 if (sel.Size() > 0)
469691 {
470692 si.SendInfo("#children = " + sel.Size(), "regular");
471693 }
472
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
694
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
473695 if (debug)
474696 {
475697 try
....@@ -481,7 +703,10 @@
481703 }
482704
483705 if (full)
484
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
706
+ {
707
+ si.SendInfo(" BBox min: " + minima, "regular");
708
+ si.SendInfo(" BBox max: " + maxima, "regular");
709
+ }
485710
486711 if (sel.bRep != null)
487712 {
....@@ -508,7 +733,7 @@
508733 }
509734 if (sel.support != null)
510735 {
511
- si.SendInfo(" support: " + sel.support, "regular");
736
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
512737 }
513738 if (sel.scriptnode != null)
514739 {
....@@ -579,6 +804,9 @@
579804 {
580805 CameraPane.pointflow = (PointFlow) sel;
581806 }
807
+
808
+ si.SendInfo("_____________________", "regular");
809
+ si.SendInfo("", "regular");
582810 }
583811 }
584812
....@@ -594,52 +822,216 @@
594822 }
595823 }
596824
597
- private JTextArea createTextPane()
598
- {
599
- String[] initString =
600
- {
601
- "This is an editable JTextPane, ", //regular
602
- "another ", //italic
603
- "styled ", //bold
604
- "text ", //small
605
- "component, ", //large
606
- "which supports embedded components..." + newline,//regular
607
- " " + newline, //button
608
- "...and embedded icons..." + newline, //regular
609
- " ", //icon
610
- newline + "JTextPane is a subclass of JEditorPane that "
611
- + "uses a StyledEditorKit and StyledDocument, and provides "
612
- + "cover methods for interacting with those objects."
613
- };
825
+//static GraphicsDevice device = GraphicsEnvironment
826
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
614827
615
- String[] initStyles =
616
- {
617
- "regular", "italic", "bold", "small", "large",
618
- "regular", "button", "regular", "icon",
619
- "regular"
620
- };
828
+ Rectangle keeprect;
829
+ cRadio radio;
830
+
831
+cButton keepButton;
832
+ cButton twoButton; // Full 3D
833
+ cButton sixButton;
834
+ cButton threeButton;
835
+ cButton sevenButton;
836
+ cButton fourButton; // full panel
837
+ cButton oneButton; // full XYZ
838
+ //cButton currentLayout;
839
+
840
+ boolean maximized;
841
+
842
+ cButton fullscreenLayout;
843
+ cButton expandedLayout;
621844
622
- JTextPane textPane = new JTextPane();
623
- textPane.setEditable(true);
624
- /*StyledDocument*/ doc = textPane.getStyledDocument();
625
- addStylesToDocument(doc);
626
-
627
- try
845
+ void Minimize()
628846 {
629
- for (int j = 0; j < 2; j++)
847
+ frame.setState(Frame.ICONIFIED);
848
+ frame.validate();
849
+ }
850
+
851
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
852
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
853
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
854
+ void Maximize()
855
+ {
856
+ if (CameraPane.FULLSCREEN)
630857 {
631
- for (int i = 0; i < initString.length; i++)
632
- {
633
- doc.insertString(doc.getLength(), initString[i],
634
- doc.getStyle(initStyles[i]));
635
- }
858
+ ToggleFullScreen();
636859 }
637
- } catch (BadLocationException ble)
860
+
861
+ if (maximized)
862
+ {
863
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
864
+ }
865
+ else
866
+ {
867
+ keeprect = frame.getBounds();
868
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
869
+// Dimension rect2 = frame.getToolkit().getScreenSize();
870
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
871
+// frame.setState(Frame.MAXIMIZED_BOTH);
872
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
873
+ }
874
+
875
+ maximized ^= true;
876
+
877
+ frame.validate();
878
+ }
879
+
880
+ cButton minButton;
881
+ cButton maxButton;
882
+ cButton fullButton;
883
+ cButton collapseButton;
884
+ cButton maximize3DButton;
885
+
886
+ void ToggleFullScreen()
638887 {
639
- System.err.println("Couldn't insert initial text into text pane.");
888
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
889
+
890
+ cameraView.ToggleFullScreen();
891
+
892
+ if (!CameraPane.FULLSCREEN)
893
+ {
894
+ device.setFullScreenWindow(null);
895
+ frame.dispose();
896
+ frame.setUndecorated(false);
897
+ frame.validate();
898
+ frame.setVisible(true);
899
+
900
+ //frame.setVisible(false);
901
+// frame.removeNotify();
902
+// frame.setUndecorated(false);
903
+// frame.addNotify();
904
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
905
+
906
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
907
+// X framePanel.add(bigThree);
908
+// X frame.getContentPane().add(/*"Center",*/framePanel);
909
+// framePanel.setDividerLocation(46); // icons are 24x24
910
+
911
+ //frame.setVisible(true);
912
+// radio.layout = keepButton;
913
+ //theFrame = null;
914
+ keepButton = null;
915
+// radio.layout.doClick();
916
+
917
+ } else
918
+ {
919
+ keepButton = radio.layout;
920
+ //keeprect = frame.getBounds();
921
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
922
+// frame.getToolkit().getScreenSize().height);
923
+ //frame.setVisible(false);
924
+
925
+ frame.dispose();
926
+ frame.setUndecorated(true);
927
+ device.setFullScreenWindow(frame);
928
+ frame.validate();
929
+ frame.setVisible(true);
930
+// frame.removeNotify();
931
+// frame.setUndecorated(true);
932
+// frame.addNotify();
933
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
934
+// X framePanel.remove(bigThree);
935
+// X frame.getContentPane().add(/*"Center",*/bigThree);
936
+// framePanel.setDividerLocation(0);
937
+
938
+// radio.layout = fullscreenLayout;
939
+// radio.layout.doClick();
940
+ //frame.setVisible(true);
941
+ }
942
+ frame.validate();
943
+
944
+ cameraView.requestFocusInWindow();
640945 }
641946
642
- return new JTextArea(); // textPane;
947
+ void CollapseToolbar()
948
+ {
949
+ framePanel.setDividerLocation(0);
950
+ //frame.validate();
951
+
952
+ cameraView.requestFocusInWindow();
953
+ }
954
+
955
+ private Object3D Duplicate(Object3D object)
956
+ {
957
+ boolean temp = CameraPane.SWITCH;
958
+ CameraPane.SWITCH = false;
959
+
960
+ if (Grafreed.grafreed.universe.versiontable == null)
961
+ Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
962
+
963
+ object.ExtractBigData(Grafreed.grafreed.universe.versiontable);
964
+ // if (copy == client)
965
+
966
+ Object3D versions[] = object.versionlist;
967
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe
968
+ object.versionlist = null;
969
+ object.versiontable = null;
970
+
971
+ Object3D parent = object.parent;
972
+ object.parent = null;
973
+
974
+ //byte[] compress = Compress(copy);
975
+ Object3D compress = (Object3D)Grafreed.clone(object);
976
+
977
+ object.parent = parent;
978
+
979
+ object.versionlist = versions;
980
+ object.versiontable = versiontable; // if Grafreed.grafreed.universe
981
+
982
+ object.RestoreBigData(Grafreed.grafreed.universe.versiontable);
983
+
984
+ CameraPane.SWITCH = temp;
985
+
986
+ return compress;
987
+ }
988
+
989
+ private JTextPane createTextPane()
990
+ {
991
+// TEXTAREA String[] initString =
992
+// {
993
+// "This is an editable JTextPane, ", //regular
994
+// "another ", //italic
995
+// "styled ", //bold
996
+// "text ", //small
997
+// "component, ", //large
998
+// "which supports embedded components..." + newline,//regular
999
+// " " + newline, //button
1000
+// "...and embedded icons..." + newline, //regular
1001
+// " ", //icon
1002
+// newline + "JTextPane is a subclass of JEditorPane that "
1003
+// + "uses a StyledEditorKit and StyledDocument, and provides "
1004
+// + "cover methods for interacting with those objects."
1005
+// };
1006
+//
1007
+// String[] initStyles =
1008
+// {
1009
+// "regular", "italic", "bold", "small", "large",
1010
+// "regular", "button", "regular", "icon",
1011
+// "regular"
1012
+// };
1013
+//
1014
+// JTextPane textPane = new JTextPane();
1015
+// textPane.setEditable(true);
1016
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
1017
+// addStylesToDocument(doc);
1018
+//
1019
+// try
1020
+// {
1021
+// for (int j = 0; j < 2; j++)
1022
+// {
1023
+// for (int i = 0; i < initString.length; i++)
1024
+// {
1025
+// doc.insertString(doc.getLength(), initString[i],
1026
+// doc.getStyle(initStyles[i]));
1027
+// }
1028
+// }
1029
+// } catch (BadLocationException ble)
1030
+// {
1031
+// System.err.println("Couldn't insert initial text into text pane.");
1032
+// }
1033
+
1034
+ return new JTextPane(); // textPane;
6431035 }
6441036
6451037 protected void addStylesToDocument(StyledDocument doc)
....@@ -692,7 +1084,7 @@
6921084 protected static ImageIcon createImageIcon(String path,
6931085 String description)
6941086 {
695
- java.net.URL imgURL = GrafreeD.class.getResource(path);
1087
+ java.net.URL imgURL = Grafreed.class.getResource(path);
6961088 if (imgURL != null)
6971089 {
6981090 return new ImageIcon(imgURL, description);
....@@ -715,6 +1107,7 @@
7151107 {
7161108 SetupMaterial(materialPanel);
7171109 }
1110
+
7181111 //SetupName();
7191112 //SetupViews();
7201113 }
....@@ -724,6 +1117,7 @@
7241117 // NumberSlider vDivsField;
7251118 // JCheckBox endcaps;
7261119 JCheckBox liveCB;
1120
+ JCheckBox selectableCB;
7271121 JCheckBox hideCB;
7281122 JCheckBox link2masterCB;
7291123 JCheckBox markCB;
....@@ -731,7 +1125,12 @@
7311125 JCheckBox speedupCB;
7321126 JCheckBox rewindCB;
7331127 JCheckBox flipVCB;
1128
+
1129
+ cCheckBox toggleTextureCB;
1130
+ cCheckBox toggleSwitchCB;
1131
+
7341132 JComboBox texresMenu;
1133
+
7351134 JButton resetButton;
7361135 JButton stepButton;
7371136 JButton stepAllButton;
....@@ -739,115 +1138,87 @@
7391138 JButton slowerButton;
7401139 JButton fasterButton;
7411140 JButton remarkButton;
1141
+
1142
+ cGridBag editPanel;
1143
+ cGridBag editCommandsPanel;
1144
+
1145
+ cGridBag namePanel;
1146
+ cGridBag setupPanel;
1147
+ cGridBag setupPanel2;
1148
+ cGridBag objectCommandsPanel;
1149
+ cGridBag pushPanel;
1150
+ cGridBag fillPanel;
7421151
743
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1152
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7441153 {
7451154 JCheckBox cb;
7461155
747
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
748
- oe.aConstraints.gridwidth = 1; // 3;
749
-// oe.aConstraints.weightx = 1;
750
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
751
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1156
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7521157 cb.addItemListener(this);
753
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
754
- oe.aConstraints.gridwidth = 1;
755
- oe.aConstraints.gridx += 1;
7561158
7571159 return cb;
7581160 }
7591161
760
- cButton AddButton(ObjEditor oe, String label)
1162
+ cButton AddButton(cGridBag panel, String label)
7611163 {
7621164 cButton cb;
7631165
764
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
765
- oe.aConstraints.gridwidth = 1;
766
-// oe.aConstraints.weightx = 1;
767
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
768
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1166
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7691167 cb.addActionListener(this);
770
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
771
- oe.aConstraints.gridwidth = 1;
772
- oe.aConstraints.gridx += 1;
7731168
7741169 return cb;
7751170 }
7761171
777
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1172
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
7781173 {
7791174 JComboBox combo;
7801175
781
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
782
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
783
- oe.aConstraints.gridx += 1;
1176
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7841177 combo.addActionListener(this);
7851178
7861179 return combo;
7871180 }
7881181
789
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
1182
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
7901183 {
791
- NumberSlider combo;
1184
+ cGridBag control = new cGridBag();
1185
+
1186
+ cNumberSlider combo;
7921187
7931188 JLabel jlabel = new JLabel(label);
794
-
795
- aConstraints.fill = GridBagConstraints.VERTICAL;
7961189 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
797
- aConstraints.gridwidth = 2;
798
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
799
- aConstraints.gridx += 1;
800
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
801
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
802
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
803
- aConstraints.gridx += 1;
804
- aConstraints.gridwidth = 1;
805
-
1190
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1191
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8061192 combo.setFloat(current);
807
-
808
- combo.label = jlabel;
809
-
810
- combo.addChangeListener(this);
811
-
812
- return combo;
1193
+
1194
+ panel.add(control);
1195
+
1196
+ return control;
8131197 }
8141198
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
1199
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8161200 {
817
- NumberSlider combo;
1201
+ cGridBag control = new cGridBag();
1202
+
1203
+ cNumberSlider combo;
8181204
8191205 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
8221206 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
823
- aConstraints.gridwidth = 2;
824
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
825
- aConstraints.gridx += 1;
826
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
827
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
828
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
829
- aConstraints.gridx += 1;
830
- aConstraints.gridwidth = 1;
831
-
1207
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1208
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8321209 combo.setInteger(current);
8331210
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
1211
+ panel.add(control);
1212
+
1213
+ return control;
8391214 }
8401215
841
- JTextArea AddText(JPanel ctrlPanel, String name)
1216
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8421217 {
8431218 JTextArea text;
8441219
845
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
846
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
847
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1220
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8481221 text.addCaretListener(this);
849
- aConstraints.gridx += 1;
850
- aConstraints.gridwidth = 1;
8511222
8521223 return text;
8531224 }
....@@ -877,9 +1248,16 @@
8771248 objEditor.ctrlPanel.remove(j);
8781249 }
8791250
1251
+ void Remove(cNumberSlider j)
1252
+ {
1253
+ j.removeChangeListener(this);
1254
+ //objEditor.ctrlPanel.remove(j.label);
1255
+ objEditor.ctrlPanel.remove(j);
1256
+ }
1257
+
8801258 /*
8811259 */
882
- void Return() // ObjEditor oe)
1260
+ void Return0() // ObjEditor oe)
8831261 {
8841262 aConstraints.gridy += 1;
8851263 aConstraints.gridx = 0;
....@@ -934,35 +1312,93 @@
9341312
9351313 void SetupUI2(ObjEditor oe)
9361314 {
937
-// oe.aConstraints.weightx = 0;
938
-// oe.aConstraints.weighty = 0;
939
-// oe.aConstraints.gridx = 0;
940
-// oe.aConstraints.gridy = 0;
941
- SetupName(oe);
1315
+ //SetupName(oe);
9421316
943
- if (!GroupEditor.allparams)
1317
+ namePanel = new cGridBag();
1318
+
1319
+ //if (copy.pinned)
1320
+ {
1321
+ pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1322
+ pinButton.setSelected(copy.pinned);
1323
+ cGridBag t = new cGridBag();
1324
+ t.preferredWidth = 2;
1325
+ t.add(pinButton);
1326
+ namePanel.add(t);
1327
+
1328
+ pinButton.addItemListener(this);
1329
+ }
1330
+
1331
+ nameField = AddText(namePanel, copy.GetName());
1332
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
1333
+ oe.ctrlPanel.add(namePanel);
1334
+
1335
+ oe.ctrlPanel.Return();
1336
+
1337
+ if (!allparams)
9441338 return;
9451339
946
- liveCB = AddCheckBox(oe, "Live", copy.live);
947
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
948
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1340
+ setupPanel = new cGridBag().setVertical(false);
1341
+
1342
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1343
+ liveCB.setToolTipText("Animate object");
1344
+ markCB = AddCheckBox(setupPanel, "Anim", copy.marked);
1345
+ markCB.setToolTipText("Set target transform");
1346
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1347
+ selectableCB.setToolTipText("Make object selectable");
9491348 // Return();
950
- markCB = AddCheckBox(oe, "Mark", copy.marked);
951
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
952
- randomCB = AddCheckBox(oe, "Rand", copy.random);
953
- Return();
954
- resetButton = AddButton(oe, "Reset");
955
- stepButton = AddButton(oe, "Step");
1349
+
1350
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1351
+ hideCB.setToolTipText("Hide object");
1352
+
1353
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
1354
+
1355
+ setupPanel2 = new cGridBag().setVertical(false);
1356
+
1357
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1358
+ rewindCB.setToolTipText("Rewind animation");
1359
+
1360
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1361
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1362
+
1363
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1364
+ link2masterCB.setToolTipText("Attach to support");
1365
+
1366
+ if (Globals.ADVANCED)
1367
+ {
1368
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1369
+ speedupCB.setToolTipText("Option motion capture");
1370
+ }
1371
+
1372
+ oe.ctrlPanel.add(setupPanel);
1373
+ oe.ctrlPanel.Return();
1374
+ oe.ctrlPanel.add(setupPanel2);
1375
+ oe.ctrlPanel.Return();
1376
+
1377
+ objectCommandsPanel = new cGridBag().setVertical(false);
1378
+
1379
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1380
+ resetButton.setToolTipText("Jump to frame zero");
1381
+ stepButton = AddButton(objectCommandsPanel, "Step");
1382
+ stepButton.setToolTipText("Step one frame");
9561383 // resetAllButton = AddButton(oe, "Reset All");
9571384 // stepAllButton = AddButton(oe, "Step All");
958
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9591385 // Return();
960
- slowerButton = AddButton(oe, "Slow");
961
- fasterButton = AddButton(oe, "Fast");
962
- remarkButton = AddButton(oe, "Rem");
1386
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1387
+ slowerButton.setToolTipText("Decrease animation speed");
1388
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1389
+ fasterButton.setToolTipText("Increase animation speed");
1390
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1391
+ remarkButton.setToolTipText("Set the current transform as the target");
9631392
964
- Return();
1393
+ oe.ctrlPanel.add(objectCommandsPanel);
1394
+ oe.ctrlPanel.Return();
9651395
1396
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1397
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1398
+ //Return();
1399
+
1400
+ oe.ctrlPanel.Return();
1401
+
9661402 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9671403 // ObjEditor.aConstraints.gridx += 1;
9681404
....@@ -1056,7 +1492,7 @@
10561492 oe.aConstraints.gridwidth = 1;
10571493 /**/
10581494 nameField = AddText(oe.ctrlPanel, copy.GetName());
1059
- Return();
1495
+ oe.ctrlPanel.Return();
10601496
10611497 //ctrlPanel.add(textureButton = new Button("Texture..."));
10621498 //textureButton.setEnabled(false);
....@@ -1114,6 +1550,7 @@
11141550
11151551 if (cam == null || !(copy.get(0) instanceof cGroup))
11161552 {
1553
+ if (Globals.DEBUG)
11171554 System.out.println("CREATE CAMERAS");
11181555 cams = new cTemplate();
11191556 cams.name = "Cameras";
....@@ -1158,10 +1595,28 @@
11581595 //JPanel worldPanel =
11591596 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11601597 //worldPanel.setName("World");
1161
- /*JPanel*/ cameraPanel =
1162
- new JPanel(new BorderLayout());
1163
- cameraPanel.add(cameraView);
1598
+ centralPanel = new cGridBag();
1599
+ centralPanel.preferredWidth = 20;
1600
+
1601
+ if (Globals.ADVANCED)
1602
+ {
1603
+ timelinePanel = new JPanel(new BorderLayout());
1604
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11641605
1606
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1607
+ cameraPanel.setContinuousLayout(true);
1608
+ cameraPanel.setOneTouchExpandable(true);
1609
+// cameraPanel.setDividerLocation(0.9);
1610
+// cameraPanel.setDividerSize(9);
1611
+ cameraPanel.setResizeWeight(1.0);
1612
+
1613
+ }
1614
+
1615
+ centralPanel.add(cameraView);
1616
+ centralPanel.setFocusable(true);
1617
+ //frame.setJMenuBar(timelineMenubar);
1618
+ //centralPanel.add(timelinePanel);
1619
+
11651620 //topView.camera = ;
11661621 //frontView.camera = new Camera(2);
11671622 //sideView.camera = new Camera(3);
....@@ -1177,13 +1632,54 @@
11771632 //frontView.object = copy;
11781633 //sideView.object = copy;
11791634
1180
- XYZPanel = new JPanel();
1181
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1635
+ transformPanel = new cGridBag().setVertical(true);
1636
+
1637
+ cGridBag resetTransformPanel = new cGridBag();
1638
+
1639
+ resetTransformPanel.preferredHeight = 2;
1640
+
1641
+ cButton resetTransform = GetButton("Reset all", !Grafreed.NIMBUSLAF);
1642
+ resetTransform.addMouseListener(new MouseAdapter()
1643
+ {
1644
+ public void mouseClicked(MouseEvent e)
1645
+ {
1646
+ ResetTransform();
1647
+ }
1648
+ });
1649
+ resetTransformPanel.add(resetTransform);
1650
+
1651
+ resetTransform = GetButton("T only", !Grafreed.NIMBUSLAF);
1652
+ resetTransform.addMouseListener(new MouseAdapter()
1653
+ {
1654
+ public void mouseClicked(MouseEvent e)
1655
+ {
1656
+ ResetTransform(1);
1657
+ }
1658
+ });
1659
+ resetTransformPanel.add(resetTransform);
1660
+
1661
+ resetTransform = GetButton("RS only", !Grafreed.NIMBUSLAF);
1662
+ resetTransform.addMouseListener(new MouseAdapter()
1663
+ {
1664
+ public void mouseClicked(MouseEvent e)
1665
+ {
1666
+ ResetTransform(2);
1667
+ }
1668
+ });
1669
+ resetTransformPanel.add(resetTransform);
1670
+
1671
+ XYZPanel = new cGridBag().setVertical(true);
1672
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11821673
1183
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1184
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1185
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1674
+ XYZPanel.preferredWidth = 5;
1675
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1676
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1677
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1678
+ //XYZPanel.setName("XYZ");
11861679
1680
+ transformPanel.add(resetTransformPanel);
1681
+ transformPanel.add(XYZPanel);
1682
+
11871683 /*
11881684 gridPanel = new JPanel(); //new BorderLayout());
11891685 gridPanel.setLayout(new GridLayout(1, 2));
....@@ -1191,12 +1687,12 @@
11911687 gridPanel.add(cameraView);
11921688 gridPanel.add(XYZPanel);
11931689 */
1194
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout());
1195
- gridPanel.setContinuousLayout(true);
1196
- gridPanel.setOneTouchExpandable(true);
1197
- gridPanel.setDividerLocation(1.0);
1198
- gridPanel.setDividerSize(9);
1199
- gridPanel.setResizeWeight(0.85);
1690
+// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1691
+// gridPanel.setContinuousLayout(true);
1692
+// gridPanel.setOneTouchExpandable(true);
1693
+// gridPanel.setDividerLocation(1.0);
1694
+// gridPanel.setDividerSize(9);
1695
+// gridPanel.setResizeWeight(0.85);
12001696
12011697 // aConstraints.weighty = 0;
12021698 //System.out.println("THIS = " + this);
....@@ -1219,13 +1715,34 @@
12191715
12201716 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12211717 //tmp.setName("Edit");
1222
- objectPanel.add(materialPanel);
1223
- JPanel north = new JPanel(new BorderLayout());
1224
- north.setName("Edit");
1225
- north.add(ctrlPanel, BorderLayout.NORTH);
1226
- objectPanel.add(north);
1227
- objectPanel.add(infoPanel);
1718
+ objectPanel.add(toolboxPanel);
1719
+ objectPanel.setIconAt(0, GetIcon("icons/primitives.png"));
1720
+ objectPanel.setToolTipTextAt(0, "Objects & textures");
12281721
1722
+ objectPanel.add(materialPanel);
1723
+ objectPanel.setIconAt(1, GetIcon("icons/material.png"));
1724
+ objectPanel.setToolTipTextAt(1, "Material");
1725
+
1726
+ objectPanel.add(skyboxPanel);
1727
+ objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1728
+ objectPanel.setToolTipTextAt(2, "Backgrounds");
1729
+
1730
+// JPanel north = new JPanel(new BorderLayout());
1731
+// north.setName("Edit");
1732
+// north.add(ctrlPanel, BorderLayout.NORTH);
1733
+// objectPanel.add(north);
1734
+ objectPanel.add(editPanel);
1735
+ objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1736
+ objectPanel.setToolTipTextAt(3, "Edit controls");
1737
+
1738
+ objectPanel.add(transformPanel);
1739
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1740
+ objectPanel.setToolTipTextAt(4, "TRS transform");
1741
+
1742
+ patchMaterial = true;
1743
+ cameraView.patchMaterial = this;
1744
+ objectPanel.setSelectedIndex(1);
1745
+
12291746 /*
12301747 aConstraints.gridx = 0;
12311748 aConstraints.gridwidth = 1;
....@@ -1233,7 +1750,7 @@
12331750 aConstraints.gridy += 1;
12341751 aConstraints.gridwidth = 1;
12351752 mainPanel.add(objectPanel, aConstraints);
1236
- */
1753
+ */
12371754
12381755 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12391756 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1244,17 +1761,29 @@
12441761 scrollpane.setWheelScrollingEnabled(true);
12451762 scrollpane.addMouseWheelListener(this); // Default not fast enough
12461763
1247
- /*JTabbedPane*/ jtp = new JTabbedPane();
1248
- jtp.add(scrollpane);
1764
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1765
+ scenePanel.preferredWidth = 6;
1766
+
1767
+ JTabbedPane tabbedPane = new JTabbedPane();
1768
+ tabbedPane.add(scrollpane);
12491769
1250
- jtp.add(FSPane = new cFileSystemPane(this));
1251
-
1252
- optionsPanel = new JPanel(new GridBagLayout());
1770
+ optionsPanel = new cGridBag().setVertical(false);
12531771
12541772 optionsPanel.setName("Options");
1255
- jtp.add(optionsPanel);
1773
+
1774
+ AddOptions(optionsPanel); //, aConstraints);
1775
+
1776
+ tabbedPane.add(optionsPanel);
1777
+
1778
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12561779
1780
+ scenePanel.add(tabbedPane);
12571781
1782
+ //if (Globals.ADVANCED)
1783
+// tabbedPane.add(infoPanel);
1784
+// tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1785
+// tabbedPane.setToolTipTextAt(3, "Information");
1786
+
12581787 /*
12591788 cTree jTree = new cTree(null);
12601789 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1275,18 +1804,19 @@
12751804 jtp.add(tree);
12761805 */
12771806
1278
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel);
1279
- bigPanel.setContinuousLayout(true);
1280
- bigPanel.setOneTouchExpandable(true);
1281
- bigPanel.setDividerLocation(0.8);
1282
- bigPanel.setDividerSize(15);
1283
- bigPanel.setResizeWeight(0.15);
1284
- bigPanel.setName("Scene");
1807
+// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1808
+// bigPanel.setContinuousLayout(true);
1809
+// bigPanel.setOneTouchExpandable(true);
1810
+// bigPanel.setDividerLocation(0.8);
1811
+// bigPanel.setDividerSize(15);
1812
+// bigPanel.setResizeWeight(0.15);
1813
+// bigPanel.setName("Scene");
12851814
12861815 //bigPanel.setLayout(new BorderLayout());
12871816 //bigPanel.setSize(new Dimension(10,10));
12881817 //bigPanel.add(ctrlPanel);
12891818 //bigPanel.add(gridPanel);
1819
+ /**
12901820 bigThree = new JPanel();
12911821 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12921822 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1297,20 +1827,26 @@
12971827 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
12981828 aWindowConstraints.weightx = 0;
12991829 aWindowConstraints.weighty = 1;
1300
- bigThree.add(jtp, aWindowConstraints);
1830
+ bigThree.add(scenePanel, aWindowConstraints);
13011831 aWindowConstraints.weightx = 1;
13021832 aWindowConstraints.gridwidth = 3;
13031833 // aConstraints.gridheight = 3;
13041834 aWindowConstraints.gridx = 1;
13051835 aWindowConstraints.fill = GridBagConstraints.BOTH;
1306
- bigThree.add(cameraPanel, aWindowConstraints);
1836
+ bigThree.add(centralPanel, aWindowConstraints);
13071837 aWindowConstraints.weightx = 0;
13081838 aWindowConstraints.gridx = 4;
13091839 aWindowConstraints.gridwidth = 1;
13101840 // aConstraints.gridheight = 3;
13111841 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13121842 bigThree.add(XYZPanel, aWindowConstraints);
1843
+ /**/
13131844
1845
+ bigThree = new cGridBag();
1846
+ bigThree.addComponent(scenePanel);
1847
+ bigThree.addComponent(centralPanel);
1848
+ //bigThree.addComponent(XYZPanel);
1849
+
13141850 // // SIDE EFFECT!!!
13151851 // aConstraints.gridx = 0;
13161852 // aConstraints.gridy = 0;
....@@ -1318,33 +1854,55 @@
13181854 // aConstraints.gridheight = 1;
13191855
13201856 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1321
- framePanel.setContinuousLayout(true);
1322
- framePanel.setOneTouchExpandable(true);
1323
- framePanel.setDividerLocation(0.8);
1857
+
1858
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
1859
+ new java.beans.PropertyChangeListener()
1860
+ {
1861
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
1862
+ {
1863
+ if ((Integer)pce.getOldValue() == 1)
1864
+ {
1865
+ if (radio.layout != expandedLayout)
1866
+ {
1867
+ radio.layout = expandedLayout;
1868
+ radio.layout.doClick();
1869
+ }
1870
+ }
1871
+ }
1872
+ });
1873
+
1874
+ framePanel.setContinuousLayout(false);
1875
+ framePanel.setOneTouchExpandable(false);
1876
+ //.setDividerLocation(0.8);
13241877 //framePanel.setDividerSize(15);
13251878 //framePanel.setResizeWeight(0.15);
13261879 framePanel.setName("Frame");
13271880
13281881 frame.getContentPane().setLayout(new BorderLayout());
13291882 /**/
1330
- JTabbedPane worldPane = new JTabbedPane();
1883
+ //JTabbedPane worldPane = new JTabbedPane();
13311884 //worldPane.add(bigPanel);
13321885 //worldPane.add(worldPanel);
13331886 /**/
1334
- frame.getContentPane().add(/*"Center",*/framePanel);
1887
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1888
+ frame.add(/*"Center",*/framePanel);
13351889 //frame.getContentPane().add(/*"Center",*/ worldPane);
13361890
13371891 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13381892
1339
- frame.setSize(1024, 768);
1340
- frame.show();
1893
+ frame.setSize(1280, 860);
1894
+
1895
+ cameraView.requestFocusInWindow();
1896
+
1897
+// gridPanel.setDividerLocation(1.0);
1898
+
1899
+ frame.validate();
13411900
1342
- gridPanel.setDividerLocation(1.0);
1901
+ frame.setVisible(true);
13431902
13441903 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13451904 frame.addWindowListener(new WindowAdapter()
13461905 {
1347
-
13481906 public void windowClosing(WindowEvent e)
13491907 {
13501908 Close();
....@@ -1352,6 +1910,10 @@
13521910 });
13531911 }
13541912
1913
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1914
+ {
1915
+ }
1916
+
13551917 JTree GetTree()
13561918 {
13571919 return objEditor.jTree;
....@@ -1363,260 +1925,609 @@
13631925 ctrlPanel.removeAll();
13641926 }
13651927
1366
- void SetupMaterial(JPanel ctrlPanel)
1928
+ void SetupMaterial(cGridBag materialpanel)
13671929 {
1368
- aConstraints.weighty = 0;
1369
- //aConstraints.weightx = 1;
1370
- /*
1930
+ cGridBag presetpanel = new cGridBag().setVertical(true);
1931
+
1932
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1933
+ skin.setToolTipText("Skin");
1934
+ skin.addMouseListener(new MouseAdapter()
1935
+ {
1936
+ public void mouseClicked(MouseEvent e)
1937
+ {
1938
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
1939
+ cMaterial material = object.material;
1940
+
1941
+ // Skin
1942
+ colorField.setFloat(material.color);
1943
+ float saturation = material.modulation;
1944
+
1945
+ if (!cameraView.Skinshader)
1946
+ {
1947
+ saturation /= 1.5;
1948
+ }
1949
+
1950
+ saturationField.setFloat(saturation);
1951
+
1952
+ subsurfaceField.setFloat(material.subsurface);
1953
+ selfshadowField.setFloat(material.diffuseness);
1954
+ diffusenessField.setFloat(material.factor);
1955
+ shininessField.setFloat(material.shininess);
1956
+ shadowbiasField.setFloat(material.shadowbias);
1957
+ diffuseField.setFloat(material.diffuse);
1958
+ specularField.setFloat(material.specular);
1959
+
1960
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
1961
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
1962
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
1963
+
1964
+ materialtouched = true;
1965
+ applySelf();
1966
+ }
1967
+ });
1968
+ presetpanel.add(skin);
1969
+
1970
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
1971
+ lambert.setToolTipText("Diffuse");
1972
+ lambert.addMouseListener(new MouseAdapter()
1973
+ {
1974
+ public void mouseClicked(MouseEvent e)
1975
+ {
1976
+ Object3D object = Grafreed.materials.versionlist[2].get(0);
1977
+ cMaterial material = object.material;
1978
+
1979
+ diffusenessField.setFloat(material.factor);
1980
+ selfshadowField.setFloat(material.diffuseness);
1981
+
1982
+ materialtouched = true;
1983
+ applySelf();
1984
+ }
1985
+ });
1986
+ presetpanel.add(lambert);
1987
+
1988
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
1989
+ diffuse2.setToolTipText("Diffuse2");
1990
+ diffuse2.addMouseListener(new MouseAdapter()
1991
+ {
1992
+ public void mouseClicked(MouseEvent e)
1993
+ {
1994
+ Object3D object = Grafreed.materials.versionlist[3].get(0);
1995
+ cMaterial material = object.material;
1996
+
1997
+ diffusenessField.setFloat(material.factor);
1998
+ selfshadowField.setFloat(material.diffuseness);
1999
+
2000
+ materialtouched = true;
2001
+ applySelf();
2002
+ }
2003
+ });
2004
+ presetpanel.add(diffuse2);
2005
+
2006
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
2007
+ diffusemoon.setToolTipText("Moon");
2008
+ diffusemoon.addMouseListener(new MouseAdapter()
2009
+ {
2010
+ public void mouseClicked(MouseEvent e)
2011
+ {
2012
+ Object3D object = Grafreed.materials.versionlist[4].get(0);
2013
+ cMaterial material = object.material;
2014
+
2015
+ diffusenessField.setFloat(material.factor);
2016
+ selfshadowField.setFloat(material.diffuseness);
2017
+
2018
+ materialtouched = true;
2019
+ applySelf();
2020
+ }
2021
+ });
2022
+ presetpanel.add(diffusemoon);
2023
+
2024
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
2025
+ diffusemoon2.setToolTipText("Moon2");
2026
+ diffusemoon2.addMouseListener(new MouseAdapter()
2027
+ {
2028
+ public void mouseClicked(MouseEvent e)
2029
+ {
2030
+ Object3D object = Grafreed.materials.versionlist[5].get(0);
2031
+ cMaterial material = object.material;
2032
+
2033
+ diffusenessField.setFloat(material.factor);
2034
+ selfshadowField.setFloat(material.diffuseness);
2035
+
2036
+ materialtouched = true;
2037
+ applySelf();
2038
+ }
2039
+ });
2040
+ presetpanel.add(diffusemoon2);
2041
+
2042
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
2043
+ diffusemoon3.setToolTipText("Moon3");
2044
+ diffusemoon3.addMouseListener(new MouseAdapter()
2045
+ {
2046
+ public void mouseClicked(MouseEvent e)
2047
+ {
2048
+ Object3D object = Grafreed.materials.versionlist[6].get(0);
2049
+ cMaterial material = object.material;
2050
+
2051
+ diffusenessField.setFloat(material.factor);
2052
+ selfshadowField.setFloat(material.diffuseness);
2053
+
2054
+ materialtouched = true;
2055
+ applySelf();
2056
+ }
2057
+ });
2058
+ presetpanel.add(diffusemoon3);
2059
+
2060
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
2061
+ diffusesheen.setToolTipText("Sheen");
2062
+ diffusesheen.addMouseListener(new MouseAdapter()
2063
+ {
2064
+ public void mouseClicked(MouseEvent e)
2065
+ {
2066
+ Object3D object = Grafreed.materials.versionlist[7].get(0);
2067
+ cMaterial material = object.material;
2068
+
2069
+ sheenField.setFloat(material.sheen);
2070
+
2071
+ materialtouched = true;
2072
+ applySelf();
2073
+ }
2074
+ });
2075
+ presetpanel.add(diffusesheen);
2076
+
2077
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
2078
+ rough.setToolTipText("Rough metal");
2079
+ rough.addMouseListener(new MouseAdapter()
2080
+ {
2081
+ public void mouseClicked(MouseEvent e)
2082
+ {
2083
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
2084
+ cMaterial material = object.material;
2085
+
2086
+ shininessField.setFloat(material.shininess);
2087
+ velvetField.setFloat(material.velvet);
2088
+
2089
+ materialtouched = true;
2090
+ applySelf();
2091
+ }
2092
+ });
2093
+ presetpanel.add(rough);
2094
+
2095
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
2096
+ rough2.setToolTipText("Medium metal");
2097
+ rough2.addMouseListener(new MouseAdapter()
2098
+ {
2099
+ public void mouseClicked(MouseEvent e)
2100
+ {
2101
+ Object3D object = Grafreed.materials.versionlist[13].get(0);
2102
+ cMaterial material = object.material;
2103
+
2104
+ shininessField.setFloat(material.shininess);
2105
+ lightareaField.setFloat(material.lightarea);
2106
+
2107
+ materialtouched = true;
2108
+ applySelf();
2109
+ }
2110
+ });
2111
+ presetpanel.add(rough2);
2112
+
2113
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
2114
+ shini0.setToolTipText("Shiny");
2115
+ shini0.addMouseListener(new MouseAdapter()
2116
+ {
2117
+ public void mouseClicked(MouseEvent e)
2118
+ {
2119
+ Object3D object = Grafreed.materials.versionlist[14].get(0);
2120
+ cMaterial material = object.material;
2121
+
2122
+ shininessField.setFloat(material.shininess);
2123
+ lightareaField.setFloat(material.lightarea);
2124
+
2125
+ materialtouched = true;
2126
+ applySelf();
2127
+ }
2128
+ });
2129
+ presetpanel.add(shini0);
2130
+
2131
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
2132
+ shini1.setToolTipText("Shiny2");
2133
+ shini1.addMouseListener(new MouseAdapter()
2134
+ {
2135
+ public void mouseClicked(MouseEvent e)
2136
+ {
2137
+ Object3D object = Grafreed.materials.versionlist[11].get(0);
2138
+ cMaterial material = object.material;
2139
+
2140
+ shininessField.setFloat(material.shininess);
2141
+ lightareaField.setFloat(material.lightarea);
2142
+
2143
+ materialtouched = true;
2144
+ applySelf();
2145
+ }
2146
+ });
2147
+ presetpanel.add(shini1);
2148
+
2149
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2150
+ shini2.setToolTipText("Shiny3");
2151
+ shini2.addMouseListener(new MouseAdapter()
2152
+ {
2153
+ public void mouseClicked(MouseEvent e)
2154
+ {
2155
+ Object3D object = Grafreed.materials.versionlist[12].get(0);
2156
+ cMaterial material = object.material;
2157
+
2158
+ shininessField.setFloat(material.shininess);
2159
+ lightareaField.setFloat(material.lightarea);
2160
+
2161
+ materialtouched = true;
2162
+ applySelf();
2163
+ }
2164
+ });
2165
+ presetpanel.add(shini2);
2166
+
2167
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2168
+ aniso.setToolTipText("AnisoU");
2169
+ aniso.addMouseListener(new MouseAdapter()
2170
+ {
2171
+ public void mouseClicked(MouseEvent e)
2172
+ {
2173
+ Object3D object = Grafreed.materials.versionlist[8].get(0);
2174
+ cMaterial material = object.material;
2175
+
2176
+ anisoField.setFloat(material.aniso);
2177
+ anisoVField.setFloat(material.anisoV);
2178
+
2179
+ materialtouched = true;
2180
+ applySelf();
2181
+ }
2182
+ });
2183
+ presetpanel.add(aniso);
2184
+
2185
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2186
+ aniso2.setToolTipText("AnisoV");
2187
+ aniso2.addMouseListener(new MouseAdapter()
2188
+ {
2189
+ public void mouseClicked(MouseEvent e)
2190
+ {
2191
+ Object3D object = Grafreed.materials.versionlist[9].get(0);
2192
+ cMaterial material = object.material;
2193
+
2194
+ anisoField.setFloat(material.aniso);
2195
+ anisoVField.setFloat(material.anisoV);
2196
+
2197
+ materialtouched = true;
2198
+ applySelf();
2199
+ }
2200
+ });
2201
+ presetpanel.add(aniso2);
2202
+
2203
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2204
+ aniso3.setToolTipText("AnisoUV");
2205
+ aniso3.addMouseListener(new MouseAdapter()
2206
+ {
2207
+ public void mouseClicked(MouseEvent e)
2208
+ {
2209
+ Object3D object = Grafreed.materials.versionlist[10].get(0);
2210
+ cMaterial material = object.material;
2211
+
2212
+ anisoField.setFloat(material.aniso);
2213
+ anisoVField.setFloat(material.anisoV);
2214
+
2215
+ materialtouched = true;
2216
+ applySelf();
2217
+ }
2218
+ });
2219
+ presetpanel.add(aniso3);
2220
+
2221
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2222
+ velvet0.setToolTipText("Velvet");
2223
+ velvet0.addMouseListener(new MouseAdapter()
2224
+ {
2225
+ public void mouseClicked(MouseEvent e)
2226
+ {
2227
+ Object3D object = Grafreed.materials.versionlist[15].get(0);
2228
+ cMaterial material = object.material;
2229
+
2230
+ diffusenessField.setFloat(material.factor);
2231
+ selfshadowField.setFloat(material.diffuseness);
2232
+ sheenField.setFloat(material.sheen);
2233
+ shininessField.setFloat(material.shininess);
2234
+ velvetField.setFloat(material.velvet);
2235
+ shiftField.setFloat(material.shift);
2236
+
2237
+ materialtouched = true;
2238
+ applySelf();
2239
+ }
2240
+ });
2241
+ presetpanel.add(velvet0);
2242
+
2243
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2244
+ bump0.setToolTipText("Bump texture");
2245
+ bump0.addMouseListener(new MouseAdapter()
2246
+ {
2247
+ public void mouseClicked(MouseEvent e)
2248
+ {
2249
+ Object3D object = Grafreed.materials.versionlist[16].get(0);
2250
+ cMaterial material = object.material;
2251
+
2252
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2253
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2254
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2255
+
2256
+ materialtouched = true;
2257
+ applySelf();
2258
+ }
2259
+ });
2260
+ presetpanel.add(bump0);
2261
+
2262
+ cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF);
2263
+ borderShader.setToolTipText("Border fade");
2264
+ borderShader.addMouseListener(new MouseAdapter()
2265
+ {
2266
+ public void mouseClicked(MouseEvent e)
2267
+ {
2268
+ borderfadeField.setFloat(0.5);
2269
+ opacityField.setFloat(0.75);
2270
+
2271
+ materialtouched = true;
2272
+ applySelf();
2273
+ }
2274
+ });
2275
+ presetpanel.add(borderShader);
2276
+
2277
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2278
+ halo.setToolTipText("Halo");
2279
+ halo.addMouseListener(new MouseAdapter()
2280
+ {
2281
+ public void mouseClicked(MouseEvent e)
2282
+ {
2283
+ Object3D object = Grafreed.materials.versionlist[17].get(0);
2284
+ cMaterial material = object.material;
2285
+
2286
+ opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
2287
+
2288
+ materialtouched = true;
2289
+ applySelf();
2290
+ }
2291
+ });
2292
+ presetpanel.add(halo);
2293
+
2294
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2295
+ candle.setToolTipText("Candle");
2296
+ candle.addMouseListener(new MouseAdapter()
2297
+ {
2298
+ public void mouseClicked(MouseEvent e)
2299
+ {
2300
+ Object3D object = Grafreed.materials.versionlist[18].get(0);
2301
+ cMaterial material = object.material;
2302
+
2303
+ subsurfaceField.setFloat(material.subsurface);
2304
+ shadowbiasField.setFloat(material.shadowbias);
2305
+ ambientField.setFloat(material.ambient);
2306
+ specularField.setFloat(material.specular);
2307
+ lightareaField.setFloat(material.lightarea);
2308
+ shininessField.setFloat(material.shininess);
2309
+
2310
+ materialtouched = true;
2311
+ applySelf();
2312
+ }
2313
+ });
2314
+ presetpanel.add(candle);
2315
+
2316
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2317
+ shadowShader.setToolTipText("Shadow");
2318
+ shadowShader.addMouseListener(new MouseAdapter()
2319
+ {
2320
+ public void mouseClicked(MouseEvent e)
2321
+ {
2322
+ diffuseField.setFloat(0.001);
2323
+ ambientField.setFloat(0.001);
2324
+ cameraField.setFloat(0.001);
2325
+ specularField.setFloat(0.001);
2326
+ fakedepthField.setFloat(0.001);
2327
+ opacityField.setFloat(0.6);
2328
+
2329
+ materialtouched = true;
2330
+ applySelf();
2331
+ }
2332
+ });
2333
+ presetpanel.add(shadowShader);
2334
+
2335
+ cGridBag panel = new cGridBag().setVertical(true);
2336
+
2337
+ presetpanel.preferredWidth = 1;
2338
+
2339
+ materialpanel.add(presetpanel);
2340
+ materialpanel.add(panel);
2341
+
2342
+ panel.preferredWidth = 8;
2343
+
2344
+ /*
13712345 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13722346 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1373
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1374
- aConstraints.gridx += 1;
1375
- */
2347
+ */
13762348
1377
- aConstraints.gridwidth = 1;
1378
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1379
- aConstraints.gridx += 1;
1380
- aConstraints.weighty = 0;
1381
- aConstraints.gridwidth = 1;
2349
+ cGridBag editBar = new cGridBag().setVertical(false);
2350
+
2351
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
2352
+ createMaterialButton.setToolTipText("Create material");
13822353
13832354 /*
13842355 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- aConstraints.gridwidth = 1;
13882356 */
13892357
1390
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1391
- aConstraints.gridx += 1;
2358
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
2359
+ clearMaterialButton.setToolTipText("Clear material");
2360
+
2361
+ if (Globals.ADVANCED)
2362
+ {
2363
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
2364
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
2365
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
2366
+ }
13922367
1393
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1394
-
1395
- aConstraints.gridx += 1;
1396
-
1397
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1398
-
1399
- aConstraints.gridx += 1;
1400
-
1401
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1402
-
1403
- aConstraints.gridx = 0;
1404
- aConstraints.gridy += 1;
1405
- aConstraints.weighty = 0;
1406
- aConstraints.gridwidth = 1;
2368
+ editBar.preferredHeight = 15;
2369
+
2370
+ panel.add(editBar);
2371
+
14072372 /**/
14082373 //aConstraints.weighty = 0;
14092374 ////aConstraints.weightx = 1;
14102375 //aConstraints.weighty = 1;
14112376 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14122377 //aConstraints.gridx += 1;
1413
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1414
- aConstraints.weighty = 0;
1415
- aConstraints.gridx = 0;
1416
- aConstraints.gridy += 1;
1417
- aConstraints.gridwidth = 1;
2378
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14182379
1419
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1420
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1421
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1422
- aConstraints.gridx += 1;
1423
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1424
- //aConstraints.weightx = 0;
1425
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1426
- aConstraints.gridx = 0;
1427
- aConstraints.gridy += 1;
1428
- aConstraints.gridwidth = 1;
2380
+ cGridBag colorSection = new cGridBag().setVertical(true);
14292381
1430
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1431
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1432
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1433
- aConstraints.gridx += 1;
1434
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1435
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1436
- aConstraints.gridx = 0;
1437
- aConstraints.gridy += 1;
1438
- aConstraints.gridwidth = 1;
2382
+ cGridBag huepanel = new cGridBag();
2383
+ cGridBag huelabel = new cGridBag();
2384
+ cLabel hue = GetLabel("icons/hue.png", false);
2385
+ hue.fit = true;
2386
+
2387
+ hue.addMouseListener(new MouseAdapter()
2388
+ {
2389
+ public void mousePressed(MouseEvent e)
2390
+ {
2391
+ int x = e.getX();
2392
+
2393
+ colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth());
2394
+ }
2395
+ });
2396
+
2397
+ huelabel.add(hue);
2398
+ huelabel.preferredWidth = 20;
2399
+ huepanel.add(new cGridBag()); // Label
2400
+ huepanel.add(huelabel); // Field/slider
2401
+
2402
+ huepanel.preferredHeight = 7;
14392403
1440
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1441
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1442
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1443
- aConstraints.gridx += 1;
1444
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1445
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1446
- aConstraints.gridx = 0;
1447
- aConstraints.gridy += 1;
1448
- aConstraints.gridwidth = 1;
2404
+ colorSection.add(huepanel);
2405
+
2406
+ cGridBag color = new cGridBag();
2407
+
2408
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
2409
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2410
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
14492411
1450
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1451
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1452
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1453
- aConstraints.gridx += 1;
1454
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1455
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1456
- aConstraints.gridx = 0;
1457
- aConstraints.gridy += 1;
1458
- aConstraints.gridwidth = 1;
2412
+ //colorField.preferredWidth = 200;
2413
+ colorSection.add(color);
14592414
1460
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1461
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1462
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1463
- aConstraints.gridx += 1;
1464
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1465
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1466
- aConstraints.gridx = 0;
1467
- aConstraints.gridy += 1;
1468
- aConstraints.gridwidth = 1;
2415
+ cGridBag modulation = new cGridBag();
2416
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
2417
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2418
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2419
+ colorSection.add(modulation);
14692420
1470
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1471
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1472
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1473
- aConstraints.gridx += 1;
1474
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1475
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1476
- aConstraints.gridx = 0;
1477
- aConstraints.gridy += 1;
1478
- aConstraints.gridwidth = 1;
2421
+ cGridBag opacity = new cGridBag();
2422
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
2423
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2424
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2425
+ colorSection.add(opacity);
14792426
1480
- //aConstraints.weighty = 1;
1481
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1482
- //aConstraints.gridx += 1;
1483
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1484
- aConstraints.weighty = 0;
1485
- aConstraints.gridx = 0;
1486
- aConstraints.gridy += 1;
1487
- aConstraints.gridwidth = 1;
2427
+ colorSection.add(GetSeparator());
2428
+
2429
+ cGridBag texture = new cGridBag();
2430
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
2431
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2432
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2433
+ colorSection.add(texture);
14882434
1489
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1490
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1492
- aConstraints.gridx += 1;
1493
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1494
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1495
- aConstraints.gridx = 0;
1496
- aConstraints.gridy += 1;
1497
- aConstraints.gridwidth = 1;
2435
+ panel.add(GetSeparator());
2436
+
2437
+ panel.add(colorSection);
2438
+
2439
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2440
+
2441
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
2442
+
2443
+ cGridBag diffuse = new cGridBag();
2444
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
2445
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2446
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2447
+ diffuseSection.add(diffuse);
14982448
1499
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1500
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1501
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1502
- aConstraints.gridx += 1;
1503
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1504
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1505
- aConstraints.gridx = 0;
1506
- aConstraints.gridy += 1;
1507
- aConstraints.gridwidth = 1;
2449
+ cGridBag diffuseness = new cGridBag();
2450
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
2451
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2452
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2453
+ diffuseSection.add(diffuseness);
15082454
1509
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1510
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1511
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1512
- aConstraints.gridx += 1;
1513
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1514
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1515
- aConstraints.gridx = 0;
1516
- aConstraints.gridy += 1;
1517
- aConstraints.gridwidth = 1;
2455
+ cGridBag selfshadow = new cGridBag();
2456
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
2457
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2458
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2459
+ diffuseSection.add(selfshadow);
15182460
1519
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1520
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1521
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1522
- aConstraints.gridx += 1;
1523
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1524
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1525
- aConstraints.gridx = 0;
1526
- aConstraints.gridy += 1;
1527
- aConstraints.gridwidth = 1;
2461
+ cGridBag sheen = new cGridBag();
2462
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
2463
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2464
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2465
+ diffuseSection.add(sheen);
15282466
1529
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1530
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1531
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1532
- aConstraints.gridx += 1;
1533
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1534
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1535
- aConstraints.gridx = 0;
1536
- aConstraints.gridy += 1;
1537
- aConstraints.gridwidth = 1;
2467
+ cGridBag subsurface = new cGridBag();
2468
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
2469
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2470
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2471
+ diffuseSection.add(subsurface);
15382472
1539
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1540
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1541
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1542
- aConstraints.gridx += 1;
1543
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1544
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1545
- aConstraints.gridx = 0;
1546
- aConstraints.gridy += 1;
1547
- aConstraints.gridwidth = 1;
2473
+ cGridBag shadow = new cGridBag();
2474
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
2475
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2476
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2477
+ diffuseSection.add(shadow);
15482478
1549
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1550
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1551
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1552
- aConstraints.gridx += 1;
1553
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1554
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1555
- aConstraints.gridx = 0;
1556
- aConstraints.gridy += 1;
1557
- aConstraints.gridwidth = 1;
2479
+ cGridBag fakedepth = new cGridBag();
2480
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
2481
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2482
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2483
+ diffuseSection.add(fakedepth);
15582484
1559
- //aConstraints.weighty = 1;
1560
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1561
- //aConstraints.gridx += 1;
1562
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1563
- aConstraints.weighty = 0;
1564
- aConstraints.gridx = 0;
1565
- aConstraints.gridy += 1;
1566
- aConstraints.gridwidth = 1;
2485
+ cGridBag shadowbias = new cGridBag();
2486
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
2487
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2488
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2489
+ diffuseSection.add(shadowbias);
15672490
1568
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1569
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1570
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1571
- aConstraints.gridx += 1;
1572
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1573
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1574
- aConstraints.gridx = 0;
1575
- aConstraints.gridy += 1;
1576
- aConstraints.gridwidth = 1;
2491
+ panel.add(GetSeparator());
2492
+
2493
+ panel.add(diffuseSection);
2494
+
2495
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2496
+
2497
+ cGridBag specularSection = new cGridBag().setVertical(true);
15772498
1578
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1579
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1580
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1581
- aConstraints.gridx += 1;
1582
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1583
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1584
- aConstraints.gridx = 0;
1585
- aConstraints.gridy += 1;
1586
- aConstraints.gridwidth = 1;
2499
+ cGridBag specular = new cGridBag();
2500
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
2501
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2502
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2503
+ specularSection.add(specular);
15872504
1588
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1589
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1590
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1591
- aConstraints.gridx += 1;
1592
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1593
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1594
- aConstraints.gridx = 0;
1595
- aConstraints.gridy += 1;
1596
- aConstraints.gridwidth = 1;
2505
+ cGridBag lightarea = new cGridBag();
2506
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
2507
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2508
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2509
+ specularSection.add(lightarea);
15972510
1598
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1599
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1600
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1601
- aConstraints.gridx += 1;
1602
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1603
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1604
- aConstraints.gridx = 0;
1605
- aConstraints.gridy += 1;
1606
- aConstraints.gridwidth = 1;
2511
+ cGridBag shininess = new cGridBag();
2512
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
2513
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2514
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2515
+ specularSection.add(shininess);
16072516
1608
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1609
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1610
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1611
- aConstraints.gridx += 1;
1612
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1613
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1614
- aConstraints.gridx = 0;
1615
- aConstraints.gridy += 1;
1616
- aConstraints.gridwidth = 1;
2517
+ cGridBag metalness = new cGridBag();
2518
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
2519
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2520
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2521
+ specularSection.add(metalness);
16172522
1618
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1619
- Return();
2523
+ cGridBag velvet = new cGridBag();
2524
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
2525
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2526
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2527
+ specularSection.add(velvet);
2528
+
2529
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
2530
+ //Return();
16202531 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16212532 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16222533 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1627,130 +2538,99 @@
16272538 // aConstraints.gridy += 1;
16282539 // aConstraints.gridwidth = 1;
16292540
1630
- //aConstraints.weighty = 1;
1631
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1632
- //aConstraints.gridx += 1;
1633
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1634
- aConstraints.weighty = 0;
1635
- aConstraints.gridx = 0;
1636
- aConstraints.gridy += 1;
1637
- aConstraints.gridwidth = 1;
2541
+ cGridBag anisoU = new cGridBag();
2542
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
2543
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2544
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2545
+ specularSection.add(anisoU);
16382546
1639
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1640
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1641
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1642
- aConstraints.gridx += 1;
1643
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1644
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1645
- aConstraints.gridx = 0;
1646
- aConstraints.gridy += 1;
1647
- aConstraints.gridwidth = 1;
2547
+ cGridBag anisoV = new cGridBag();
2548
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
2549
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2550
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2551
+ specularSection.add(anisoV);
16482552
1649
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1650
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1651
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1652
- aConstraints.gridx += 1;
1653
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1654
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1655
- aConstraints.gridx = 0;
1656
- aConstraints.gridy += 1;
1657
- aConstraints.gridwidth = 1;
16582553
1659
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1660
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1661
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1662
- aConstraints.gridx += 1;
1663
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1664
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1665
- aConstraints.gridx = 0;
1666
- aConstraints.gridy += 1;
1667
- aConstraints.gridwidth = 1;
2554
+ panel.add(GetSeparator());
2555
+
2556
+ panel.add(specularSection);
2557
+
2558
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2559
+
2560
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16682561
1669
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1670
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1671
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1672
- aConstraints.gridx += 1;
1673
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1674
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1675
- aConstraints.gridx = 0;
1676
- aConstraints.gridy += 1;
1677
- aConstraints.gridwidth = 1;
1678
- aConstraints.weighty = 0;
2562
+ cGridBag camera = new cGridBag();
2563
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
2564
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2565
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2566
+ colorSection.add(camera);
16792567
1680
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1681
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1683
- aConstraints.gridx += 1;
1684
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1685
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1686
- aConstraints.gridx = 0;
1687
- aConstraints.gridy += 1;
1688
- aConstraints.gridwidth = 1;
2568
+ cGridBag ambient = new cGridBag();
2569
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
2570
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2571
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2572
+ colorSection.add(ambient);
16892573
1690
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1691
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1692
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1693
- aConstraints.gridx += 1;
1694
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1695
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1696
- aConstraints.gridx = 0;
1697
- aConstraints.gridy += 1;
1698
- aConstraints.gridwidth = 1;
2574
+ cGridBag backlit = new cGridBag();
2575
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
2576
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2577
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2578
+ colorSection.add(backlit);
16992579
1700
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1701
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1702
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1703
- aConstraints.gridx += 1;
1704
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1705
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1706
- aConstraints.gridx = 0;
1707
- aConstraints.gridy += 1;
1708
- aConstraints.gridwidth = 1;
2580
+ //panel.add(new JSeparator());
2581
+
2582
+ //panel.add(globalSection);
2583
+
2584
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2585
+
2586
+ cGridBag textureSection = new cGridBag().setVertical(true);
17092587
1710
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1711
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1712
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1713
- aConstraints.gridx += 1;
1714
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1715
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1716
- aConstraints.gridx = 0;
1717
- aConstraints.gridy += 1;
1718
- aConstraints.gridwidth = 1;
2588
+ cGridBag bump = new cGridBag();
2589
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
2590
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2591
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
2592
+ textureSection.add(bump);
17192593
1720
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1721
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1722
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1723
- aConstraints.gridx += 1;
1724
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1725
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1726
- aConstraints.gridx = 0;
1727
- aConstraints.gridy += 1;
1728
- aConstraints.gridwidth = 1;
2594
+ cGridBag noise = new cGridBag();
2595
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
2596
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2597
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
2598
+ textureSection.add(noise);
17292599
1730
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1731
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1732
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1733
- aConstraints.gridx += 1;
1734
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1735
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1736
- aConstraints.gridx = 0;
1737
- aConstraints.gridy += 1;
1738
- aConstraints.gridwidth = 1;
2600
+ cGridBag power = new cGridBag();
2601
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
2602
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2603
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
2604
+ textureSection.add(power);
17392605
1740
- //aConstraints.weighty = 1;
1741
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1742
- //aConstraints.gridx += 1;
1743
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1744
- aConstraints.weighty = 0;
2606
+ cGridBag borderfade = new cGridBag();
2607
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
2608
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2609
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
2610
+ textureSection.add(borderfade);
17452611
1746
- aConstraints.gridx = 0;
1747
- aConstraints.gridy = 0;
1748
- aConstraints.gridwidth = 1;
2612
+ cGridBag fog = new cGridBag();
2613
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
2614
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2615
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
2616
+ textureSection.add(fog);
2617
+
2618
+ cGridBag opacityPower = new cGridBag();
2619
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
2620
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2621
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
2622
+ textureSection.add(opacityPower);
2623
+
2624
+ panel.add(GetSeparator());
2625
+
2626
+ panel.add(textureSection);
2627
+
2628
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17492629
17502630 SetMaterial(copy); // .GetMaterial());
17512631
1752
- colorField.addChangeListener(this);
1753
- modulationField.addChangeListener(this);
2632
+ //colorField.addChangeListener(this);
2633
+// modulationField.addChangeListener(this);
17542634 metalnessField.addChangeListener(this);
17552635 diffuseField.addChangeListener(this);
17562636 specularField.addChangeListener(this);
....@@ -1780,12 +2660,15 @@
17802660 opacityPowerField.addChangeListener(this);
17812661 /**/
17822662
1783
- resetSlidersButton.addActionListener(this);
17842663 clearMaterialButton.addActionListener(this);
17852664 createMaterialButton.addActionListener(this);
1786
-
1787
- propagateToggle.addItemListener(this);
1788
- multiplyToggle.addItemListener(this);
2665
+
2666
+ if (Globals.ADVANCED)
2667
+ {
2668
+ resetSlidersButton.addActionListener(this);
2669
+ propagateToggle.addItemListener(this);
2670
+ multiplyToggle.addItemListener(this);
2671
+ }
17892672 }
17902673
17912674 void DropFile(java.io.File[] files, boolean textures)
....@@ -1803,8 +2686,9 @@
18032686 // 3D models
18042687 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18052688 {
1806
- lastConverter = new com.jmex.model.converters.MaxToJme();
1807
- LoadFile(filename, lastConverter);
2689
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2690
+ //LoadFile(filename, lastConverter);
2691
+ LoadObjFile(filename); // New 3ds loader
18082692 continue;
18092693 }
18102694 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1956,7 +2840,7 @@
19562840
19572841 //? flashIt = false;
19582842 CameraPane pane = (CameraPane) cameraView;
1959
- pane.clickStart(location.x, location.y, 0);
2843
+ pane.clickStart(location.x, location.y, 0, 0);
19602844 pane.clickEnd(location.x, location.y, 0, true);
19612845
19622846 if (group.selection.size() == 1)
....@@ -2005,6 +2889,7 @@
20052889 e2.printStackTrace();
20062890 }
20072891 }
2892
+
20082893 LoadJMEThread loadThread;
20092894
20102895 class LoadJMEThread extends Thread
....@@ -2062,6 +2947,7 @@
20622947 //LoadFile0(filename, converter);
20632948 }
20642949 }
2950
+
20652951 LoadOBJThread loadObjThread;
20662952
20672953 class LoadOBJThread extends Thread
....@@ -2140,19 +3026,19 @@
21403026
21413027 void LoadObjFile(String fullname)
21423028 {
2143
- /*
3029
+ System.out.println("Loading " + fullname);
3030
+ /**/
21443031 //lastFilename = fullname;
21453032 if(loadObjThread == null)
21463033 {
2147
- loadObjThread = new LoadOBJThread();
2148
- loadObjThread.start();
3034
+ loadObjThread = new LoadOBJThread();
3035
+ loadObjThread.start();
21493036 }
21503037
21513038 loadObjThread.add(fullname);
2152
- */
3039
+ /**/
21533040
2154
- System.out.println("Loading " + fullname);
2155
- makeSomething(new FileObject(fullname, true), true);
3041
+ //makeSomething(new FileObject(fullname, true), true);
21563042 }
21573043
21583044 void LoadGFDFile(String fullname)
....@@ -2194,6 +3080,8 @@
21943080 {
21953081 Mocap sel = (Mocap) copy.selection.get(0);
21963082
3083
+ sel.SetCurrentBones(sel.frame);
3084
+
21973085 sel.fullname = fullname;
21983086
21993087 if (changename)
....@@ -2245,6 +3133,8 @@
22453133 {
22463134 Mocap sel = (Mocap) select;
22473135
3136
+ sel.SetCurrentBones(sel.frame);
3137
+
22483138 File file = new File(fullname);
22493139
22503140 // Mocap mocap = new Mocap("Mocap" + file.getName());
....@@ -2409,11 +3299,11 @@
24093299
24103300 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24113301 {
2412
- if (GrafreeD.standAlone)
3302
+ if (Grafreed.standAlone)
24133303 {
24143304 /**/
24153305 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2416
- browser.show();
3306
+ browser.setVisible(true);
24173307 String filename = browser.getFile();
24183308 if (filename != null && filename.length() > 0)
24193309 {
....@@ -2524,6 +3414,7 @@
25243414 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25253415 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25263416 }
3417
+
25273418 //cJME.count++;
25283419 //cJME.count %= 12;
25293420 if (gc)
....@@ -2558,6 +3449,7 @@
25583449 }
25593450 if (input == null)
25603451 {
3452
+ new Exception().printStackTrace();
25613453 System.exit(0);
25623454 }
25633455
....@@ -2706,6 +3598,7 @@
27063598 }
27073599 }
27083600 }
3601
+
27093602 cFileSystemPane FSPane;
27103603
27113604 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2715,7 +3608,7 @@
27153608
27163609 freezematerial = true;
27173610 colorField.setFloat(mat.color);
2718
- modulationField.setFloat(mat.modulation);
3611
+ saturationField.setFloat(mat.modulation);
27193612 metalnessField.setFloat(mat.metalness);
27203613 diffuseField.setFloat(mat.diffuse);
27213614 specularField.setFloat(mat.specular);
....@@ -2759,11 +3652,14 @@
27593652 }
27603653 }
27613654 }
3655
+
27623656 freezematerial = false;
27633657 }
27643658
27653659 void SetMaterial(Object3D object)
27663660 {
3661
+ latestObject = object;
3662
+
27673663 cMaterial mat = object.material;
27683664
27693665 if (mat == null)
....@@ -2772,33 +3668,10 @@
27723668 return;
27733669 }
27743670
2775
- multiplyToggle.setSelected(mat.multiply);
2776
-
2777
- assert (object.projectedVertices != null);
2778
-
2779
- if (object.projectedVertices.length <= 2)
2780
- {
2781
- // Side effect...
2782
- Object3D.cVector2[] keep = object.projectedVertices;
2783
- object.projectedVertices = new Object3D.cVector2[3];
2784
- for (int i = 0; i < 3; i++)
2785
- {
2786
- if (i < keep.length)
2787
- {
2788
- object.projectedVertices[i] = keep[i];
2789
- } else
2790
- {
2791
- object.projectedVertices[i] = new Object3D.cVector2();
2792
- }
2793
- /*
2794
- if(keep.length == 0)
2795
- object.projectedVertices[0] = new Object3D.cVector2();
2796
- else
2797
- object.projectedVertices[0] = keep[0];
2798
- object.projectedVertices[1] = new Object3D.cVector2();
2799
- */
2800
- }
2801
- }
3671
+ if (multiplyToggle != null)
3672
+ multiplyToggle.setSelected(mat.multiply);
3673
+
3674
+ AllocProjectedVertices(object);
28023675
28033676 SetMaterial(mat, object.projectedVertices);
28043677 }
....@@ -2874,12 +3747,17 @@
28743747 // }
28753748
28763749 /**/
2877
- if (deselect)
3750
+ if (deselect || child == null)
28783751 {
28793752 //group.deselectAll();
28803753 //freeze = true;
28813754 GetTree().clearSelection();
28823755 //freeze = false;
3756
+
3757
+ if (child == null)
3758
+ {
3759
+ return;
3760
+ }
28833761 }
28843762
28853763 //group.addSelectee(child);
....@@ -2913,6 +3791,17 @@
29133791 public void itemStateChanged(ItemEvent event)
29143792 {
29153793 // System.out.println("Propagate = " + propagate);
3794
+ if (event.getSource() == pinButton)
3795
+ {
3796
+ copy.pinned ^= true;
3797
+ if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
3798
+ {
3799
+ ((GroupEditor)copy.editWindow).listUI.remove(copy);
3800
+ copy.CloseUI();
3801
+ //copy.editWindow.refreshContents();
3802
+ }
3803
+ }
3804
+ else
29163805 if (event.getSource() == propagateToggle)
29173806 {
29183807 propagate ^= true;
....@@ -2948,31 +3837,48 @@
29483837 cameraView.ToggleDL();
29493838 cameraView.repaint();
29503839 return;
2951
- } else if (event.getSource() == toggleTextureItem)
3840
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29523841 {
29533842 cameraView.ToggleTexture();
29543843 // june 2013 copy.HardTouch();
29553844 cameraView.repaint();
29563845 return;
2957
- } else if (event.getSource() == toggleFullItem)
3846
+ } else if (event.getSource() == toggleTimelineItem)
29583847 {
2959
- if (CameraPane.FULLSCREEN)
3848
+ timeline ^= true;
3849
+
3850
+ if (timeline)
29603851 {
2961
- frame.getContentPane().remove(/*"Center",*/bigThree);
2962
- framePanel.add(bigThree);
2963
- frame.getContentPane().add(/*"Center",*/framePanel);
2964
- } else
2965
- {
2966
- frame.getContentPane().remove(/*"Center",*/framePanel);
2967
- frame.getContentPane().add(/*"Center",*/bigThree);
3852
+ centralPanel.remove(cameraView);
3853
+ cameraPanel.add(cameraView);
3854
+ centralPanel.add(cameraPanel);
3855
+ frame.setJMenuBar(timelineMenubar);
3856
+ wasFullScreen = CameraPane.FULLSCREEN;
3857
+ if (!CameraPane.FULLSCREEN)
3858
+ ToggleFullScreen();
3859
+ toggleFullScreenItem.setEnabled(false);
29683860 }
3861
+ else
3862
+ {
3863
+ centralPanel.remove(cameraPanel);
3864
+ centralPanel.add(cameraView);
3865
+ frame.setJMenuBar(null);
3866
+ if (!wasFullScreen)
3867
+ ToggleFullScreen();
3868
+ toggleFullScreenItem.setEnabled(true);
3869
+ }
3870
+
29693871 frame.validate();
2970
- cameraView.ToggleFullScreen();
3872
+ return;
3873
+ } else if (event.getSource() == toggleFullScreenItem)
3874
+ {
3875
+ ToggleFullScreen();
3876
+ frame.validate();
29713877
29723878 return;
2973
- } else if (event.getSource() == toggleRandomItem)
3879
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
29743880 {
2975
- cameraView.ToggleRandom();
3881
+ cameraView.ToggleSwitch();
29763882 cameraView.repaint();
29773883 return;
29783884 } else if (event.getSource() == toggleHandleItem)
....@@ -3000,12 +3906,17 @@
30003906 } else if (event.getSource() == liveCB)
30013907 {
30023908 copy.live ^= true;
3909
+ objEditor.refreshContents(true); // To show item colors
3910
+ return;
3911
+ } else if (event.getSource() == selectableCB)
3912
+ {
3913
+ copy.dontselect ^= true;
30033914 return;
30043915 } else if (event.getSource() == hideCB)
30053916 {
30063917 copy.hide ^= true;
30073918 copy.Touch(); // display list issue
3008
- objEditor.refreshContents();
3919
+ objEditor.refreshContents(true); // To show item colors
30093920 return;
30103921 } else if (event.getSource() == link2masterCB)
30113922 {
....@@ -3015,6 +3926,7 @@
30153926 if (event.getSource() == randomCB)
30163927 {
30173928 copy.random ^= true;
3929
+ objEditor.refreshContents();
30183930 return;
30193931 }
30203932 if (event.getSource() == speedupCB)
....@@ -3038,8 +3950,9 @@
30383950
30393951 public void actionPerformed(ActionEvent event)
30403952 {
3953
+ Object source = event.getSource();
30413954 // SCRIPT DIALOG
3042
- if (event.getSource() == okbutton)
3955
+ if (source == okbutton)
30433956 {
30443957 textpanel.setVisible(false);
30453958 textpanel.remove(textarea);
....@@ -3051,7 +3964,7 @@
30513964 textarea = null;
30523965 textpanel = null;
30533966 }
3054
- if (event.getSource() == cancelbutton)
3967
+ if (source == cancelbutton)
30553968 {
30563969 textpanel.setVisible(false);
30573970 textpanel.remove(textarea);
....@@ -3063,49 +3976,50 @@
30633976 //applySelf();
30643977 //client.refreshEditWindow();
30653978 //refreshContents();
3066
- if (event.getSource() == nameField)
3979
+ if (source == nameField)
30673980 {
30683981 //System.out.println("ObjEditor " + event);
30693982 applySelf0(true);
30703983 //parent.applySelf();
3071
- objEditor.refreshContents();
3072
- } else if (event.getSource() == resetButton)
3984
+ // conflicts with requestFocus objEditor.refreshContents();
3985
+ } else if (source == resetButton)
30733986 {
30743987 CameraPane.fullreset = true;
30753988 copy.Reset(); // ResetMeshes();
30763989 copy.Touch();
30773990 objEditor.refreshContents();
3078
- } else if (event.getSource() == stepItem)
3991
+ } else if (source == stepItem)
30793992 {
3080
- cameraView.ONESTEP = true;
3993
+ //cameraView.ONESTEP = true;
3994
+ Globals.ONESTEP = true;
30813995 cameraView.repaint();
30823996 return;
3083
- } else if (event.getSource() == stepButton)
3997
+ } else if (source == stepButton)
30843998 {
30853999 copy.Step();
30864000 copy.Touch();
30874001 objEditor.refreshContents();
3088
- } else if (event.getSource() == slowerButton)
4002
+ } else if (source == slowerButton)
30894003 {
30904004 copy.Slower();
30914005 copy.Touch();
30924006 objEditor.refreshContents();
3093
- } else if (event.getSource() == fasterButton)
4007
+ } else if (source == fasterButton)
30944008 {
30954009 copy.Faster();
30964010 copy.Touch();
30974011 objEditor.refreshContents();
3098
- } else if (event.getSource() == remarkButton)
4012
+ } else if (source == remarkButton)
30994013 {
31004014 copy.Remark();
31014015 copy.Touch();
31024016 objEditor.refreshContents();
3103
- } else if (event.getSource() == stepAllButton)
4017
+ } else if (source == stepAllButton)
31044018 {
31054019 copy.StepAll();
31064020 copy.Touch();
31074021 objEditor.refreshContents();
3108
- } else if (event.getSource() == resetAllButton)
4022
+ } else if (source == resetAllButton)
31094023 {
31104024 //CameraPane.fullreset = true;
31114025 copy.ResetAll(); // ResetMeshes();
....@@ -3138,53 +4052,79 @@
31384052 // Close();
31394053 // }
31404054 // else
3141
- if (event.getSource() == resetSlidersButton)
4055
+ if (source == resetSlidersButton)
31424056 {
31434057 ResetSliders();
3144
- } else if (event.getSource() == clearMaterialButton)
4058
+ } else if (source == clearMaterialButton)
31454059 {
31464060 ClearMaterial();
3147
- } else if (event.getSource() == createMaterialButton)
4061
+ } else if (source == createMaterialButton)
31484062 {
31494063 CreateMaterial();
3150
- } else if (event.getSource() == clearPanelButton)
4064
+ } else if (source == clearPanelButton)
31514065 {
31524066 copy.ClearUI();
31534067 refreshContents(true);
3154
- } /*
3155
- }
3156
-
3157
- public boolean action(Event event, Object arg)
3158
- {
3159
- */ else if (event.getSource() == closeItem)
4068
+ } else if (source == importGFDItem)
4069
+ {
4070
+ ImportGFD();
4071
+ } else
4072
+ if (source == importVRMLX3DItem)
4073
+ {
4074
+ ImportVRMLX3D();
4075
+ } else
4076
+ if (source == import3DSItem)
4077
+ {
4078
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
4079
+ } else
4080
+ if (source == importOBJItem)
4081
+ {
4082
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
4083
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
4084
+ browser.setVisible(true);
4085
+ String filename = browser.getFile();
4086
+ if (filename != null && filename.length() > 0)
4087
+ {
4088
+ String fullname = browser.getDirectory() + filename;
4089
+ makeSomething(ReadOBJ(fullname), true);
4090
+ }
4091
+ } else
4092
+ if (source == closeItem)
31604093 {
31614094 Close();
31624095 //return true;
3163
- } else if (event.getSource() == loadItem)
4096
+ } else if (source == openItem)
31644097 {
3165
- load();
4098
+ Open();
31664099 //return true;
3167
- } else if (event.getSource() == saveItem)
4100
+ } else if (source == newItem)
4101
+ {
4102
+ New();
4103
+ } else if (source == saveItem)
31684104 {
31694105 save();
31704106 //return true;
3171
- } else if (event.getSource() == saveAsItem)
4107
+ } else if (source == saveAsItem)
31724108 {
31734109 saveAs();
31744110 //return true;
3175
- } else if (event.getSource() == reexportItem)
4111
+ } else if (source == reexportItem)
31764112 {
31774113 reexport();
31784114 //return true;
3179
- } else if (event.getSource() == exportAsItem)
4115
+ } else if (source == exportAsItem)
31804116 {
31814117 export();
31824118 //return true;
3183
- } else if (event.getSource() == povItem)
4119
+ } else if (source == povItem)
31844120 {
31854121 generatePOV();
31864122 //return true;
3187
- } else if (event.getSource() == zBufferItem)
4123
+ } else if (event.getSource() == archiveItem)
4124
+ {
4125
+ cTools.Archive(frame);
4126
+ return;
4127
+ } else if (source == zBufferItem)
31884128 {
31894129 try
31904130 {
....@@ -3206,21 +4146,8 @@
32064146 cameraView.repaint();
32074147 //return true;
32084148 }
3209
- */ else if (event.getSource() == editCameraItem)
3210
- {
3211
- cameraView.ProtectCamera();
3212
- cameraView.repaint();
3213
- return;
3214
- } else if (event.getSource() == revertCameraItem)
3215
- {
3216
- cameraView.RevertCamera();
3217
- cameraView.repaint();
3218
- return;
3219
- } else if (event.getSource() == textureButton)
3220
- {
3221
- return; // true;
3222
- } else // combos...
3223
- if (event.getSource() == texresMenu)
4149
+ */ else // combos...
4150
+ if (source == texresMenu)
32244151 {
32254152 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32264153 copy.texres = texresMenu.getSelectedIndex();
....@@ -3232,27 +4159,511 @@
32324159 }
32334160 }
32344161
3235
- void ToggleAnimation()
4162
+ void New()
32364163 {
3237
- if (!CameraPane.ANIMATION)
4164
+ while (copy.Size() > 1)
32384165 {
3239
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
4166
+ copy.remove(1);
4167
+ }
4168
+
4169
+ ResetModel();
4170
+ objEditor.refreshContents();
4171
+ }
4172
+
4173
+ static public byte[] Compress(Object3D o)
4174
+ {
4175
+ // Slower to actually compress.
4176
+ try
4177
+ {
4178
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
4179
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
4180
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
4181
+
4182
+ Object3D parent = o.parent;
4183
+ o.parent = null;
4184
+
4185
+ out.writeObject(o);
4186
+
4187
+ o.parent = parent;
4188
+
4189
+ out.flush();
4190
+
4191
+ baos //zstream
4192
+ .close();
4193
+ out.close();
4194
+
4195
+ byte[] bytes = baos.toByteArray();
4196
+
4197
+ System.out.println("save #bytes = " + bytes.length);
4198
+ return bytes;
4199
+ } catch (Exception e)
4200
+ {
4201
+ System.err.println(e);
4202
+ return null;
4203
+ }
4204
+ }
4205
+
4206
+ static public Object Uncompress(byte[] bytes)
4207
+ {
4208
+ System.out.println("restore #bytes = " + bytes.length);
4209
+ try
4210
+ {
4211
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
4212
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
4213
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
4214
+ Object obj = in.readObject();
4215
+
4216
+ bais //istream
4217
+ .close();
4218
+ in.close();
4219
+
4220
+ return obj;
4221
+ } catch (Exception e)
4222
+ {
4223
+ System.err.println(e);
4224
+ return null;
4225
+ }
4226
+ }
4227
+
4228
+ static public Object clone(Object o)
4229
+ {
4230
+ try
4231
+ {
4232
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
4233
+ ObjectOutputStream out = new ObjectOutputStream(baos);
4234
+
4235
+ out.writeObject(o);
4236
+
4237
+ out.flush();
4238
+ out.close();
4239
+
4240
+ byte[] bytes = baos.toByteArray();
4241
+
4242
+ System.out.println("clone = " + bytes.length);
4243
+
4244
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
4245
+ ObjectInputStream in = new ObjectInputStream(bais);
4246
+ Object obj = in.readObject();
4247
+ in.close();
4248
+
4249
+ return obj;
4250
+ } catch (Exception e)
4251
+ {
4252
+ System.err.println(e);
4253
+ return null;
4254
+ }
4255
+ }
4256
+
4257
+ cRadio GetCurrentTab()
4258
+ {
4259
+ cRadio ab;
4260
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
4261
+ {
4262
+ ab = (cRadio)e.nextElement();
4263
+ if(ab.GetObject() == copy)
4264
+ {
4265
+ return ab;
4266
+ }
4267
+ }
4268
+
4269
+ return null;
4270
+ }
4271
+
4272
+
4273
+ public void Save()
4274
+ {
4275
+ //Save(true);
4276
+ Replace();
4277
+ SetVersionStates();
4278
+ }
4279
+
4280
+ private boolean Equal(byte[] compress, byte[] name)
4281
+ {
4282
+ if (compress.length != name.length)
4283
+ {
4284
+ return false;
4285
+ }
4286
+
4287
+ for (int i=compress.length; --i>=0;)
4288
+ {
4289
+ if (compress[i] != name[i])
4290
+ return false;
4291
+ }
4292
+
4293
+ return true;
4294
+ }
4295
+
4296
+ void DeleteVersion()
4297
+ {
4298
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
4299
+ {
4300
+ copy.versionlist[i] = copy.versionlist[i+1];
4301
+ }
4302
+
4303
+ if (copy.versionlist[copy.versionindex] == null)
4304
+ copy.versionindex -= 1;
4305
+
4306
+ if (copy.versionindex != -1)
4307
+ CopyChanged();
4308
+
4309
+ SetVersionStates();
4310
+ }
4311
+
4312
+ public boolean Save(boolean user)
4313
+ {
4314
+ System.err.println("Save");
4315
+ Replace();
4316
+
4317
+ //cRadio tab = GetCurrentTab();
4318
+
4319
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
4320
+
4321
+ boolean thesame = false;
4322
+
4323
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
4324
+// {
4325
+// thesame = true;
4326
+// }
4327
+
4328
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
4329
+ if (!thesame)
4330
+ {
4331
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4332
+ {
4333
+ copy.versionlist[i] = copy.versionlist[i-1];
4334
+ }
4335
+
4336
+ //tab.user[tab.versionindex] = user;
4337
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
4338
+
4339
+ copy.versionlist[++copy.versionindex] = compress;
4340
+
4341
+ // if (increment)
4342
+ // tab.versionindex++;
4343
+ }
4344
+
4345
+ //copy.RestoreBigData(versiontable);
4346
+
4347
+ //assert(hashtable.isEmpty());
4348
+
4349
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4350
+// {
4351
+// //tab.user[i] = false;
4352
+// copy.versionlist[i] = null;
4353
+// }
4354
+
4355
+ SetVersionStates();
4356
+
4357
+ // test save
4358
+ if (false)
4359
+ {
4360
+ try
4361
+ {
4362
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
4363
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
4364
+
4365
+ p.writeObject(copy);
4366
+
4367
+ p.flush();
4368
+
4369
+ ostream.close();
4370
+ } catch (Exception e)
4371
+ {
4372
+ e.printStackTrace();
4373
+ }
4374
+ }
4375
+
4376
+ return !thesame;
4377
+ }
4378
+
4379
+ boolean flashIt = true;
4380
+
4381
+ void RefreshSelection()
4382
+ {
4383
+ Object3D selection = new Object3D();
4384
+
4385
+ for (int i = 0; i < copy.selection.size(); i++)
4386
+ {
4387
+ Object3D elem = copy.selection.elementAt(i);
4388
+
4389
+ Object3D obj = copy.GetObject(elem.GetUUID());
4390
+
4391
+ if (obj == null)
4392
+ {
4393
+ copy.selection.remove(i--);
4394
+ }
4395
+ else
4396
+ {
4397
+ selection.add(obj);
4398
+ copy.selection.setElementAt(obj, i);
4399
+ }
4400
+ }
4401
+
4402
+ flashIt = false;
4403
+ GetTree().clearSelection();
4404
+ for (int i = 0; i < selection.size(); i++)
4405
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
4406
+ flashIt = true;
4407
+
4408
+ //refreshContents(false);
4409
+ }
4410
+
4411
+ void CopyChanged()
4412
+ {
4413
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4414
+
4415
+ SetVersionStates();
4416
+
4417
+ boolean temp = CameraPane.SWITCH;
4418
+ CameraPane.SWITCH = false;
4419
+
4420
+ copy.ExtractBigData(Grafreed.grafreed.universe.versiontable);
4421
+
4422
+ copy.clear();
4423
+
4424
+ copy.skyboxname = obj.skyboxname;
4425
+ copy.skyboxext = obj.skyboxext;
4426
+
4427
+ for (int i=0; i<obj.Size(); i++)
4428
+ {
4429
+ copy.add(obj.get(i));
4430
+ }
4431
+
4432
+ copy.RestoreBigData(Grafreed.grafreed.universe.versiontable);
4433
+
4434
+ CameraPane.SWITCH = temp;
4435
+
4436
+ RefreshSelection();
4437
+ //assert(hashtable.isEmpty());
4438
+
4439
+ copy.Touch();
4440
+
4441
+ ResetModel();
4442
+ copy.HardTouch(); // recompile?
4443
+
4444
+ cRadio ab;
4445
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
4446
+ {
4447
+ ab = (cRadio)e.nextElement();
4448
+ Object3D test = copy.GetObject(ab.object.GetUUID());
4449
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
4450
+ if (test != null)
4451
+ {
4452
+ test.editWindow = ab.object.editWindow;
4453
+ ab.object = test;
4454
+ }
4455
+ }
4456
+
4457
+ refreshContents(true);
4458
+ }
4459
+
4460
+ cButton previousVersionButton;
4461
+ cButton restoreButton;
4462
+ cButton replaceButton;
4463
+ cButton nextVersionButton;
4464
+ cButton saveVersionButton;
4465
+ cButton deleteVersionButton;
4466
+
4467
+ boolean muteSlider;
4468
+
4469
+ int VersionCount()
4470
+ {
4471
+ int count = 0;
4472
+
4473
+ for (int i = copy.versionlist.length; --i >= 0;)
4474
+ {
4475
+ if (copy.versionlist[i] != null)
4476
+ count++;
4477
+ }
4478
+
4479
+ return count;
4480
+ }
4481
+
4482
+ public cGridBag versionSliderPane;
4483
+
4484
+ void SetVersionStates()
4485
+ {
4486
+ //if (true)
4487
+ // return;
4488
+
4489
+ //cRadio tab = GetCurrentTab();
4490
+
4491
+ if (copy.versionlist == null)
4492
+ {
4493
+ saveVersionButton.setEnabled(false);
4494
+ restoreButton.setEnabled(false);
4495
+ replaceButton.setEnabled(false);
4496
+ previousVersionButton.setEnabled(false);
4497
+ nextVersionButton.setEnabled(false);
4498
+ deleteVersionButton.setEnabled(false);
4499
+ versionSliderPane.setVisible(false);
4500
+ }
4501
+ else
4502
+ {
4503
+ restoreButton.setEnabled(copy.versionindex != -1);
4504
+ replaceButton.setEnabled(copy.versionindex != -1);
4505
+
4506
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4507
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4508
+
4509
+ deleteVersionButton.setEnabled(copy.versionindex != -1);
4510
+ //copy.versionlist[copy.versionindex + 1] != null);
4511
+
4512
+ muteSlider = true;
4513
+ versionSlider.setMinimum(0);
4514
+ versionSlider.setMaximum(VersionCount() - 1);
4515
+ versionSlider.setInteger(copy.versionindex);
4516
+ versionSlider.setEnabled(copy.versionindex != -1);
4517
+ muteSlider = false;
4518
+
4519
+ versionSliderPane.setVisible(true);
4520
+ }
4521
+ }
4522
+
4523
+ public boolean PreviousVersion()
4524
+ {
4525
+ // Option?
4526
+ Replace();
4527
+
4528
+ System.err.println("Undo");
4529
+
4530
+ //cRadio tab = GetCurrentTab();
4531
+
4532
+ if (copy.versionindex == 0)
4533
+ {
4534
+ java.awt.Toolkit.getDefaultToolkit().beep();
4535
+ return false;
4536
+ }
4537
+
4538
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
4539
+// {
4540
+// if (Save(false))
4541
+// tab.versionindex -= 1;
4542
+// else
4543
+// {
4544
+// if (tab.versionindex <= 0)
4545
+// return false;
4546
+// else
4547
+// tab.versionindex -= 1;
4548
+// }
4549
+// }
4550
+
4551
+ copy.versionindex -= 1;
4552
+
4553
+ CopyChanged();
4554
+
4555
+ return true;
4556
+ }
4557
+
4558
+ public boolean Restore()
4559
+ {
4560
+ System.err.println("Restore");
4561
+
4562
+ //cRadio tab = GetCurrentTab();
4563
+
4564
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4565
+ {
4566
+ java.awt.Toolkit.getDefaultToolkit().beep();
4567
+ return false;
4568
+ }
4569
+
4570
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4571
+ CopyChanged();
4572
+
4573
+ return true;
4574
+ }
4575
+
4576
+ public boolean Replace()
4577
+ {
4578
+ //System.err.println("Replace");
4579
+
4580
+ //cRadio tab = GetCurrentTab();
4581
+
4582
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4583
+ {
4584
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
4585
+ return false;
4586
+ }
4587
+
4588
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
4589
+
4590
+ return true;
4591
+ }
4592
+
4593
+ public void NextVersion()
4594
+ {
4595
+ // Option?
4596
+ Replace();
4597
+
4598
+ //cRadio tab = GetCurrentTab();
4599
+
4600
+ if (copy.versionlist[copy.versionindex + 1] == null)
4601
+ {
4602
+ java.awt.Toolkit.getDefaultToolkit().beep();
4603
+ return;
4604
+ }
4605
+
4606
+ copy.versionindex += 1;
4607
+
4608
+ CopyChanged();
4609
+
4610
+ //if (!tab.user[tab.versionindex])
4611
+ // tab.graphs[tab.versionindex] = null;
4612
+ }
4613
+
4614
+ void ImportGFD()
4615
+ {
4616
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32404617 browser.show();
32414618 String filename = browser.getFile();
32424619 if (filename != null && filename.length() > 0)
32434620 {
3244
- CameraPane.filename = browser.getDirectory() + filename;
4621
+ String fullname = browser.getDirectory() + filename;
4622
+
4623
+ //Object3D readobj =
4624
+ objEditor.ReadGFD(fullname, objEditor);
4625
+ //makeSomething(readobj);
4626
+ }
4627
+ }
4628
+
4629
+ void ImportVRMLX3D()
4630
+ {
4631
+ if (Grafreed.standAlone)
4632
+ {
4633
+ /**/
4634
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4635
+ browser.show();
4636
+ String filename = browser.getFile();
4637
+ if (filename != null && filename.length() > 0)
4638
+ {
4639
+ String fullname = browser.getDirectory() + filename;
4640
+ LoadVRMLX3D(fullname);
4641
+ }
4642
+ /**/
4643
+ }
4644
+ }
4645
+
4646
+ void ToggleAnimation()
4647
+ {
4648
+ if (!Globals.ANIMATION)
4649
+ {
4650
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
4651
+ browser.setVisible(true);
4652
+ String filename = browser.getFile();
4653
+ if (filename != null && filename.length() > 0)
4654
+ {
4655
+ Globals.filename = browser.getDirectory() + filename;
32454656 //CameraPane.framecount = 0;
3246
- CameraPane.imagecount = 0;
4657
+ Globals.imagecount = 0;
32474658
3248
- CameraPane.ANIMATION ^= true;
4659
+ Globals.ANIMATION ^= true;
32494660
3250
- GrafreeD.wav.cursor = 0;
3251
- GrafreeD.wav.loop = 0;
4661
+ Grafreed.wav.cursor = 0;
4662
+ Grafreed.wav.loop = 0;
32524663 }
32534664 } else
32544665 {
3255
- CameraPane.ANIMATION ^= true;
4666
+ Globals.ANIMATION ^= true;
32564667 }
32574668 }
32584669
....@@ -3298,7 +4709,7 @@
32984709 void CreateMaterial()
32994710 {
33004711 //copy.ClearMaterial(); // PATCH
3301
- copy.CreateMaterialS(multiplyToggle.isSelected());
4712
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33024713 if (copy.selection.size() > 0)
33034714 //SetMaterial(copy);
33044715 {
....@@ -3349,7 +4760,7 @@
33494760 assert false;
33504761 }
33514762
3352
- void EditSelection()
4763
+ void EditSelection(boolean newWindow)
33534764 {
33544765 }
33554766
....@@ -3357,11 +4768,11 @@
33574768 {
33584769 copy.ResetBlockLoop(); // temporary problem
33594770
3360
- boolean random = CameraPane.RANDOM;
3361
- CameraPane.RANDOM = false; // parse everything
4771
+ boolean random = CameraPane.SWITCH;
4772
+ CameraPane.SWITCH = false; // parse everything
33624773 copy.ResetDisplayList();
33634774 copy.HardTouch();
3364
- CameraPane.RANDOM = random;
4775
+ CameraPane.SWITCH = random;
33654776 }
33664777
33674778 // public void applySelf()
....@@ -3391,6 +4802,12 @@
33914802 // else
33924803 // applySelf(true);
33934804 // }
4805
+
4806
+ boolean Equal(double a, double b)
4807
+ {
4808
+ return Math.abs(a - b) < 0.001;
4809
+ }
4810
+
33944811 void applySelf0(boolean name)
33954812 {
33964813 if (name)
....@@ -3408,7 +4825,7 @@
34084825 //copy.material = new cMaterial(copy.GetMaterial());
34094826
34104827 current.color = (float) colorField.getFloat();
3411
- current.modulation = (float) modulationField.getFloat();
4828
+ current.modulation = (float) saturationField.getFloat();
34124829 current.metalness = (float) metalnessField.getFloat();
34134830 current.diffuse = (float) diffuseField.getFloat();
34144831 current.specular = (float) specularField.getFloat();
....@@ -3431,10 +4848,63 @@
34314848 current.fakedepth = (float) fakedepthField.getFloat();
34324849 current.shadowbias = (float) shadowbiasField.getFloat();
34334850
3434
- if (!NumberSlider.frozen)
4851
+ if (!cNumberSlider.frozen)
34354852 {
34364853 //System.out.println("Propagate = " + propagate);
34374854 copy.UpdateMaterial(anchor, current, propagate);
4855
+
4856
+ if (copy.material != null)
4857
+ {
4858
+ cMaterial mat = copy.material;
4859
+
4860
+ if (!Equal(colorField.getFloat(), mat.color))
4861
+ colorField.SetToolTipValue((mat.color));
4862
+ if (!Equal(saturationField.getFloat(), mat.modulation))
4863
+ saturationField.SetToolTipValue((mat.modulation));
4864
+ if (!Equal(metalnessField.getFloat(), mat.metalness))
4865
+ metalnessField.SetToolTipValue((mat.metalness));
4866
+ if (!Equal(diffuseField.getFloat(), mat.diffuse))
4867
+ diffuseField.SetToolTipValue((mat.diffuse));
4868
+ if (!Equal(specularField.getFloat(), mat.specular))
4869
+ specularField.SetToolTipValue((mat.specular));
4870
+ if (!Equal(shininessField.getFloat(), mat.shininess))
4871
+ shininessField.SetToolTipValue((mat.shininess));
4872
+ if (!Equal(shiftField.getFloat(), mat.shift))
4873
+ shiftField.SetToolTipValue((mat.shift));
4874
+ if (!Equal(ambientField.getFloat(), mat.ambient))
4875
+ ambientField.SetToolTipValue((mat.ambient));
4876
+ if (!Equal(lightareaField.getFloat(), mat.lightarea))
4877
+ lightareaField.SetToolTipValue((mat.lightarea));
4878
+ if (!Equal(diffusenessField.getFloat(), mat.factor))
4879
+ diffusenessField.SetToolTipValue((mat.factor));
4880
+ if (!Equal(velvetField.getFloat(), mat.velvet))
4881
+ velvetField.SetToolTipValue((mat.velvet));
4882
+ if (!Equal(sheenField.getFloat(), mat.sheen))
4883
+ sheenField.SetToolTipValue((mat.sheen));
4884
+ if (!Equal(subsurfaceField.getFloat(), mat.subsurface))
4885
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4886
+ if (!Equal(backlitField.getFloat(), mat.bump))
4887
+ backlitField.SetToolTipValue((mat.bump));
4888
+ if (!Equal(anisoField.getFloat(), mat.aniso))
4889
+ anisoField.SetToolTipValue((mat.aniso));
4890
+ if (!Equal(anisoVField.getFloat(), mat.anisoV))
4891
+ anisoVField.SetToolTipValue((mat.anisoV));
4892
+ if (!Equal(cameraField.getFloat(), mat.cameralight))
4893
+ cameraField.SetToolTipValue((mat.cameralight));
4894
+ if (!Equal(selfshadowField.getFloat(), mat.diffuseness))
4895
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4896
+ if (!Equal(shadowField.getFloat(), mat.shadow))
4897
+ shadowField.SetToolTipValue((mat.shadow));
4898
+ if (!Equal(textureField.getFloat(), mat.texture))
4899
+ textureField.SetToolTipValue((mat.texture));
4900
+ if (!Equal(opacityField.getFloat(), mat.opacity))
4901
+ opacityField.SetToolTipValue((mat.opacity));
4902
+ if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
4903
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4904
+ if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
4905
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4906
+ }
4907
+
34384908 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34394909 {
34404910 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3463,9 +4933,28 @@
34634933 //copy.Touch();
34644934 }
34654935
4936
+ cNumberSlider versionSlider;
4937
+
34664938 public void stateChanged(ChangeEvent e)
34674939 {
3468
- // assert(false);
4940
+ // assert(false);
4941
+ if (e.getSource() == versionSlider)
4942
+ {
4943
+ if (muteSlider)
4944
+ return;
4945
+
4946
+ Replace();
4947
+
4948
+ int version = versionSlider.getInteger();
4949
+
4950
+ if (version != -1 && copy.versionlist[version] != null)
4951
+ {
4952
+ copy.versionindex = version;
4953
+ CopyChanged();
4954
+ }
4955
+
4956
+ return;
4957
+ }
34694958
34704959 if (freezematerial)
34714960 {
....@@ -3479,6 +4968,7 @@
34794968 || e.getSource() == apertureField
34804969 || e.getSource() == shadowblurField)
34814970 {
4971
+ new Exception().printStackTrace();
34824972 System.exit(0);
34834973 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34844974 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3500,12 +4990,24 @@
35004990 {
35014991 //System.out.println("stateChanged = " + this);
35024992 materialtouched = true;
4993
+
4994
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
4995
+ {
4996
+ saturationField.setFloat(1);
4997
+ }
4998
+
35034999 applySelf();
35045000 //System.out.println("this = " + this);
35055001 //System.out.println("PARENT = " + parent);
35065002 //if (parent != null)
35075003 // parent.applySelf();
3508
- refreshContents();
5004
+ if (e.getSource() == normalpushField)
5005
+ {
5006
+ objEditor.refreshContents();
5007
+ //Refresh();
5008
+ }
5009
+ else
5010
+ refreshContents();
35095011 // ??? client.refreshEditWindow();
35105012 }
35115013 //else
....@@ -3517,7 +5019,7 @@
35175019 //group.name = nameField.getText();
35185020 //objEditor.applySelf();
35195021
3520
- assert (objEditor == this);
5022
+ // OCT2018: assert (objEditor == this);
35215023 if (copy.selection == null || copy.selection.size() == 0)
35225024 //super.applySelf()
35235025 ; else
....@@ -3541,12 +5043,18 @@
35415043 objEditor.copy = keep;
35425044 }
35435045 }
5046
+
5047
+ if (normalpushField != null)
5048
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35445049 }
35455050
35465051 void SnapObject()
35475052 {
3548
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3549
- SnapObject(obj);
5053
+ if (copy.selection.size() > 0)
5054
+ {
5055
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
5056
+ SnapObject(obj);
5057
+ }
35505058 }
35515059
35525060 void SnapObject(Object3D obj)
....@@ -3660,7 +5168,7 @@
36605168
36615169 if (obj.parent != null)
36625170 {
3663
- obj.parent.TransformToWorld(interest);
5171
+// obj.parent.TransformToWorld(interest);
36645172 }
36655173
36665174 if (!CameraPane.TRACK)
....@@ -3787,20 +5295,28 @@
37875295 {
37885296 if (GetTree() != null)
37895297 {
5298
+ GetTree().revalidate();
37905299 GetTree().repaint();
37915300 }
37925301
37935302 radioPanel.revalidate();
37945303 radioPanel.repaint();
3795
- ctrlPanel.revalidate(); // ? new
5304
+ ctrlPanel.validate(); // ? new
37965305 ctrlPanel.repaint();
37975306 }
5307
+
5308
+ if (previousVersionButton != null && copy.versionlist != null)
5309
+ SetVersionStates();
5310
+
5311
+ cameraView.requestFocusInWindow();
37985312 }
37995313
38005314 static TweenManager tweenManager = new TweenManager();
38015315
38025316 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38035317 {
5318
+ if (Globals.REPLACEONMAKE) // && resetmodel)
5319
+ Save();
38045320 //Tween.set(thing, 0).target(1).start(tweenManager);
38055321 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38065322 // if (thing instanceof GenericJointDemo)
....@@ -3824,7 +5340,7 @@
38245340 // group = (Composite) group.get(0);
38255341 // }
38265342
3827
- System.out.println("makeSomething of " + thing);
5343
+ //System.out.println("makeSomething of " + thing);
38285344
38295345 /*
38305346 if (deselect && jList != null)
....@@ -3887,6 +5403,12 @@
38875403 {
38885404 ResetModel();
38895405 Select(thing.GetTreePath(), true, false); // unselect... false);
5406
+
5407
+ if (thing.Size() == 0)
5408
+ {
5409
+ //EditSelection(false);
5410
+ }
5411
+
38905412 refreshContents();
38915413 }
38925414
....@@ -4004,6 +5526,7 @@
40045526 }
40055527 }
40065528 }
5529
+
40075530 LoadGFDThread loadGFDThread;
40085531
40095532 void ReadGFD(String fullname, iCallBack cb)
....@@ -4023,8 +5546,10 @@
40235546
40245547 try
40255548 {
5549
+ // Try compressed version first.
40265550 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4027
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
5551
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
5552
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40285553
40295554 readobj = (Object3D) p.readObject();
40305555 istream.close();
....@@ -4032,7 +5557,22 @@
40325557 readobj.ResetDisplayList();
40335558 } catch (Exception e)
40345559 {
4035
- e.printStackTrace();
5560
+ if (!e.toString().contains("GZIP"))
5561
+ e.printStackTrace();
5562
+
5563
+ try
5564
+ {
5565
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
5566
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
5567
+
5568
+ readobj = (Object3D) p.readObject();
5569
+ istream.close();
5570
+
5571
+ readobj.ResetDisplayList();
5572
+ } catch (Exception e2)
5573
+ {
5574
+ e2.printStackTrace();
5575
+ }
40365576 }
40375577 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40385578 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4078,6 +5618,12 @@
40785618
40795619 void LoadIt(Object obj)
40805620 {
5621
+ if (obj == null)
5622
+ {
5623
+ // Invalid file
5624
+ return;
5625
+ }
5626
+
40815627 System.out.println("Loaded " + obj);
40825628 //new Exception().printStackTrace();
40835629 Object3D readobj = (Object3D) obj;
....@@ -4087,10 +5633,14 @@
40875633
40885634 if (readobj != null)
40895635 {
5636
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
5637
+ // Save();
40905638 try
40915639 {
40925640 //readobj.deepCopySelf(copy);
40935641 copy.clear(); // june 2014
5642
+ copy.skyboxname = readobj.skyboxname;
5643
+ copy.skyboxext = readobj.skyboxext;
40945644 for (int i = 0; i < readobj.size(); i++)
40955645 {
40965646 Object3D child = readobj.get(i); // reserve(i);
....@@ -4131,6 +5681,7 @@
41315681 }
41325682 } catch (ClassCastException e)
41335683 {
5684
+ e.printStackTrace();
41345685 assert (false);
41355686 Composite c = (Composite) copy;
41365687 c.children.clear();
....@@ -4141,17 +5692,32 @@
41415692 c.addChild(csg);
41425693 }
41435694
5695
+ copy.versionlist = readobj.versionlist;
5696
+ copy.versionindex = readobj.versionindex;
5697
+ copy.versiontable = readobj.versiontable;
5698
+
5699
+ if (copy.versionlist == null)
5700
+ {
5701
+ // Backward compatibility
5702
+ copy.versionlist = new Object3D[100];
5703
+ copy.versionindex = -1;
5704
+
5705
+ //Save(true);
5706
+ }
5707
+
5708
+ //? SetUndoStates();
5709
+
41445710 ResetModel();
41455711 copy.HardTouch(); // recompile?
41465712 refreshContents();
41475713 }
41485714 }
41495715
4150
- void load() // throws ClassNotFoundException
5716
+ void Open() // throws ClassNotFoundException
41515717 {
4152
- if (GrafreeD.standAlone)
5718
+ if (Grafreed.standAlone)
41535719 {
4154
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5720
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
41555721 browser.show();
41565722 String filename = browser.getFile();
41575723 if (filename != null && filename.length() > 0)
....@@ -4228,6 +5794,8 @@
42285794
42295795 void save()
42305796 {
5797
+ Replace();
5798
+
42315799 if (lastname == null)
42325800 {
42335801 return;
....@@ -4236,11 +5804,13 @@
42365804 try
42375805 {
42385806 FileOutputStream ostream = new FileOutputStream(lastname);
4239
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5807
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5808
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42405809
42415810 p.writeObject(copy);
42425811 p.flush();
42435812
5813
+ zstream.close();
42445814 ostream.close();
42455815
42465816 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4248,19 +5818,23 @@
42485818 //ps.print(buffer.toString());
42495819 } catch (IOException e)
42505820 {
5821
+ e.printStackTrace();
42515822 }
42525823 }
5824
+
42535825 String lastname;
42545826
42555827 void saveAs()
42565828 {
4257
- if (GrafreeD.standAlone)
5829
+ if (Grafreed.standAlone)
42585830 {
42595831 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42605832 browser.setVisible(true);
42615833 String filename = browser.getFile();
42625834 if (filename != null && filename.length() > 0)
42635835 {
5836
+ if (!filename.endsWith(".gfd"))
5837
+ filename += ".gfd";
42645838 lastname = browser.getDirectory() + filename;
42655839 save();
42665840 }
....@@ -4359,13 +5933,13 @@
43595933 try
43605934 {
43615935 FileOutputStream ostream = new FileOutputStream(filename);
4362
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4363
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5936
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5937
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43645938
43655939 Object3D objectparent = obj.parent;
43665940 obj.parent = null;
43675941
4368
- Object3D object = (Object3D) GrafreeD.clone(obj);
5942
+ Object3D object = (Object3D) Grafreed.clone(obj);
43695943
43705944 obj.parent = objectparent;
43715945
....@@ -4377,8 +5951,8 @@
43775951 p.writeObject(object);
43785952 p.flush();
43795953
5954
+ zstream.close();
43805955 ostream.close();
4381
- // zstream.close();
43825956
43835957 // group.selection.get(0).parent = parent;
43845958 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4399,7 +5973,7 @@
43995973 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44005974 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44015975 copy.generatePOV(buffer);
4402
- if (GrafreeD.standAlone)
5976
+ if (Grafreed.standAlone)
44035977 {
44045978 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44055979 browser.show();
....@@ -4425,53 +5999,72 @@
44255999 Object3D client;
44266000 Object3D copy;
44276001 MenuBar menuBar;
4428
- Menu windowMenu;
4429
- MenuItem loadItem;
6002
+ Menu fileMenu;
6003
+ MenuItem newItem;
6004
+ MenuItem openItem;
44306005 MenuItem saveItem;
44316006 MenuItem saveAsItem;
44326007 MenuItem exportAsItem;
44336008 MenuItem reexportItem;
44346009 MenuItem povItem;
44356010 MenuItem closeItem;
4436
- Menu cameraMenu;
6011
+
44376012 CheckboxMenuItem zBufferItem;
44386013 //MenuItem normalLensItem;
4439
- MenuItem editCameraItem;
4440
- MenuItem revertCameraItem;
4441
- CheckboxMenuItem toggleLiveItem;
44426014 MenuItem stepItem;
4443
- CheckboxMenuItem toggleFullItem;
6015
+ CheckboxMenuItem toggleLiveItem;
6016
+ CheckboxMenuItem toggleFullScreenItem;
6017
+ CheckboxMenuItem toggleTimelineItem;
44446018 CheckboxMenuItem toggleRenderItem;
44456019 CheckboxMenuItem toggleDebugItem;
44466020 CheckboxMenuItem toggleFrustumItem;
44476021 CheckboxMenuItem toggleFootContactItem;
44486022 CheckboxMenuItem toggleDLItem;
44496023 CheckboxMenuItem toggleTextureItem;
4450
- CheckboxMenuItem toggleRandomItem;
6024
+ CheckboxMenuItem toggleSwitchItem;
44516025 CheckboxMenuItem toggleRootItem;
44526026 CheckboxMenuItem animationItem;
6027
+ MenuItem archiveItem;
44536028 CheckboxMenuItem toggleHandleItem;
44546029 CheckboxMenuItem togglePaintItem;
44556030 JSplitPane mainPanel;
44566031 JScrollPane scrollpane;
6032
+
44576033 JPanel toolbarPanel;
4458
- JPanel treePanel;
6034
+
6035
+ cGridBag treePanel;
6036
+
44596037 JPanel radioPanel;
44606038 ButtonGroup buttonGroup;
4461
- JPanel ctrlPanel;
4462
- JPanel materialPanel;
6039
+
6040
+ cGridBag toolboxPanel;
6041
+ cGridBag skyboxPanel;
6042
+ cGridBag materialPanel;
6043
+ cGridBag ctrlPanel;
6044
+
44636045 JScrollPane infoPanel;
4464
- JPanel optionsPanel;
6046
+
6047
+ cGridBag optionsPanel;
6048
+
44656049 JTabbedPane objectPanel;
4466
- JPanel XYZPanel;
6050
+ boolean materialFlushed;
6051
+ Object3D latestObject;
6052
+
6053
+ cGridBag transformPanel;
6054
+ cGridBag XYZPanel;
6055
+
44676056 JSplitPane gridPanel;
44686057 JSplitPane bigPanel;
4469
- JPanel bigThree;
4470
- JTabbedPane jtp;
4471
- JPanel cameraPanel;
6058
+
6059
+ cGridBag bigThree;
6060
+ cGridBag scenePanel;
6061
+ cGridBag centralPanel;
6062
+ JSplitPane cameraPanel;
6063
+ JPanel timelinePanel;
6064
+ JMenuBar timelineMenubar;
44726065 JSplitPane framePanel;
44736066 JTextArea/*Field*/ nameField;
4474
- cButton textureButton;
6067
+ //cButton textureButton;
44756068 cButton okButton;
44766069 cButton applyButton;
44776070 cButton cancelButton;
....@@ -4518,65 +6111,74 @@
45186111 // MATERIAL
45196112 JLabel materialLabel;
45206113 JLabel colorLabel;
4521
- NumberSlider colorField;
6114
+ cNumberSlider colorField;
45226115 JLabel modulationLabel;
4523
- NumberSlider modulationField;
6116
+ cNumberSlider saturationField;
45246117 JLabel metalnessLabel;
4525
- NumberSlider metalnessField;
6118
+ cNumberSlider metalnessField;
45266119 JLabel diffuseLabel;
4527
- NumberSlider diffuseField;
6120
+ cNumberSlider diffuseField;
45286121 JLabel specularLabel;
4529
- NumberSlider specularField;
6122
+ cNumberSlider specularField;
45306123 JLabel shininessLabel;
4531
- NumberSlider shininessField;
6124
+ cNumberSlider shininessField;
45326125 JLabel shiftLabel;
4533
- NumberSlider shiftField;
6126
+ cNumberSlider shiftField;
45346127 JLabel ambientLabel;
4535
- NumberSlider ambientField;
6128
+ cNumberSlider ambientField;
45366129 JLabel lightareaLabel;
4537
- NumberSlider lightareaField;
6130
+ cNumberSlider lightareaField;
45386131 JLabel diffusenessLabel;
4539
- NumberSlider diffusenessField;
6132
+ cNumberSlider diffusenessField;
45406133 JLabel velvetLabel;
4541
- NumberSlider velvetField;
6134
+ cNumberSlider velvetField;
45426135 JLabel sheenLabel;
4543
- NumberSlider sheenField;
6136
+ cNumberSlider sheenField;
45446137 JLabel subsurfaceLabel;
4545
- NumberSlider subsurfaceField;
6138
+ cNumberSlider subsurfaceField;
45466139 //JLabel bumpLabel;
45476140 //NumberSlider bumpField;
45486141 JLabel backlitLabel;
4549
- NumberSlider backlitField;
6142
+ cNumberSlider backlitField;
45506143 JLabel anisoLabel;
4551
- NumberSlider anisoField;
6144
+ cNumberSlider anisoField;
45526145 JLabel anisoVLabel;
4553
- NumberSlider anisoVField;
6146
+ cNumberSlider anisoVField;
6147
+
45546148 JLabel cameraLabel;
4555
- NumberSlider cameraField;
6149
+ cNumberSlider cameraField;
45566150 JLabel selfshadowLabel;
4557
- NumberSlider selfshadowField;
6151
+ cNumberSlider selfshadowField;
45586152 JLabel shadowLabel;
4559
- NumberSlider shadowField;
6153
+ cNumberSlider shadowField;
45606154 JLabel textureLabel;
4561
- NumberSlider textureField;
6155
+ cNumberSlider textureField;
45626156 JLabel opacityLabel;
4563
- NumberSlider opacityField;
6157
+ cNumberSlider opacityField;
45646158 JLabel fakedepthLabel;
4565
- NumberSlider fakedepthField;
6159
+ cNumberSlider fakedepthField;
45666160 JLabel shadowbiasLabel;
4567
- NumberSlider shadowbiasField;
6161
+ cNumberSlider shadowbiasField;
6162
+
45686163 JLabel bumpLabel;
4569
- NumberSlider bumpField;
6164
+ cNumberSlider bumpField;
45706165 JLabel noiseLabel;
4571
- NumberSlider noiseField;
6166
+ cNumberSlider noiseField;
45726167 JLabel powerLabel;
4573
- NumberSlider powerField;
6168
+ cNumberSlider powerField;
45746169 JLabel borderfadeLabel;
4575
- NumberSlider borderfadeField;
6170
+ cNumberSlider borderfadeField;
45766171 JLabel fogLabel;
4577
- NumberSlider fogField;
6172
+ cNumberSlider fogField;
45786173 JLabel opacityPowerLabel;
4579
- NumberSlider opacityPowerField;
4580
- JTree jTree;
6174
+ cNumberSlider opacityPowerField;
6175
+ cTree jTree;
45816176 //ObjectUI parent;
6177
+
6178
+ cNumberSlider normalpushField;
6179
+
6180
+ private MenuItem importGFDItem;
6181
+ private MenuItem importVRMLX3DItem;
6182
+ private MenuItem import3DSItem;
6183
+ private MenuItem importOBJItem;
45826184 }