Normand Briere
2019-08-18 480ad70047e54b2b92f974e6c2ac5a6c0bdc5a5c
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,147 @@
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 Composite CreateCameras()
76
+ {
77
+ Composite cams = new cTemplate();
78
+ cams.name = "Cameras";
79
+ copy.insertElementAt(cams, 0);
80
+
81
+ cams.addChild(new Camera());
82
+ cams.addChild(new Camera(1));
83
+ cams.addChild(new Camera(2));
84
+ cams.addChild(new Camera(3));
85
+ cams.addChild(new Camera(4));
86
+
87
+ return cams;
88
+ }
89
+
90
+ public cGridBag GetSeparator()
91
+ {
92
+ cGridBag separator = new cGridBag();
93
+ separator.add(new JSeparator());
94
+ separator.preferredHeight = 5;
95
+ return separator;
96
+ }
97
+
98
+ cButton GetButton(String name, boolean border)
99
+ {
100
+ ImageIcon icon = GetIcon(name);
101
+ if (icon != null || name.contains("/"))
102
+ return new cButton(icon, border);
103
+ else
104
+ return new cButton(name, border);
105
+ }
106
+
107
+ cLabel GetLabel(String name, boolean border)
108
+ {
109
+ //ImageIcon icon = GetIcon(name);
110
+ return new cLabel(GetImage(name), border);
111
+ }
112
+
113
+ cToggleButton GetToggleButton(String name, boolean border)
114
+ {
115
+ ImageIcon icon = GetIcon(name);
116
+ return new cToggleButton(icon, border);
117
+ }
118
+
119
+ cCheckBox GetCheckBox(String name, boolean border)
120
+ {
121
+ ImageIcon icon = GetIcon(name);
122
+ return new cCheckBox(icon, border);
123
+ }
124
+
125
+ static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>();
126
+
127
+ static ImageIcon GetIcon(String name)
128
+ {
129
+ javax.swing.ImageIcon iconCache = icons.get(name);
130
+ if (iconCache != null)
131
+ {
132
+ return iconCache;
133
+ }
134
+
135
+ try
136
+ {
137
+ BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
138
+
139
+// if (image.getWidth() > 48 && image.getHeight() > 48)
140
+// {
141
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
142
+// Graphics2D g = resized.createGraphics();
143
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
144
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
145
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
146
+// g.dispose();
147
+//
148
+// image = resized;
149
+// }
150
+
151
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
152
+
153
+ icons.put(name, icon);
154
+
155
+ return icon;
156
+ }
157
+ catch (Exception e)
158
+ {
159
+ //icons.put(name, null);
160
+ return null;
161
+ }
162
+ }
163
+
164
+ BufferedImage GetImage(String name)
165
+ {
166
+ try
167
+ {
168
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
169
+
170
+ return image;
171
+ }
172
+ catch (Exception e)
173
+ {
174
+ return null;
175
+ }
176
+ }
177
+
32178 // SCRIPT
33179
34180 transient JFrame textpanel = null;
....@@ -119,51 +265,62 @@
119265 void keyPressed(int key, int modifiers)
120266 {
121267 System.out.println("KEY PRESSED");
122
- CameraPane.theRenderer.keyPressed(key, modifiers);
268
+ Globals.theRenderer.keyPressed(key, modifiers);
123269 }
124270 */
125271
126272 static GridBagConstraints aConstraints;
127273 static GridBagConstraints aWindowConstraints;
128
- GroupEditor callee;
129
- JFrame frame;
274
+
130275 static int GRIDWIDTH = 100; // 4;
131276
132277 public void closeUI()
133278 {
134279 //new Exception().printStackTrace();
135
- System.out.println("this = " + this);
136
- System.out.println("objEditor = " + objEditor);
280
+// System.out.println("this = " + this);
281
+// System.out.println("objEditor = " + objEditor);
137282 //nameField.removeActionListener(this);
138
- objEditor.ctrlPanel.remove(nameField);
283
+// objEditor.ctrlPanel.remove(nameField);
139284
140
- if (!GroupEditor.allparams)
285
+ objEditor.ctrlPanel.remove(namePanel);
286
+
287
+ if (!allparams)
141288 return;
142289
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);
290
+// objEditor.ctrlPanel.remove(liveCB);
291
+// objEditor.ctrlPanel.remove(hideCB);
292
+// objEditor.ctrlPanel.remove(markCB);
293
+//
294
+// objEditor.ctrlPanel.remove(randomCB);
295
+// objEditor.ctrlPanel.remove(speedupCB);
296
+// objEditor.ctrlPanel.remove(rewindCB);
297
+//
298
+// objEditor.ctrlPanel.remove(resetButton);
299
+// objEditor.ctrlPanel.remove(stepButton);
300
+//// objEditor.ctrlPanel.remove(stepAllButton);
301
+//// objEditor.ctrlPanel.remove(resetAllButton);
302
+// objEditor.ctrlPanel.remove(link2masterCB);
303
+// //objEditor.ctrlPanel.remove(flipVCB);
304
+// //objEditor.ctrlPanel.remove(texresMenu);
305
+// objEditor.ctrlPanel.remove(slowerButton);
306
+// objEditor.ctrlPanel.remove(fasterButton);
307
+// objEditor.ctrlPanel.remove(remarkButton);
308
+
309
+ objEditor.ctrlPanel.remove(setupPanel);
310
+ objEditor.ctrlPanel.remove(setupPanel2);
311
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
312
+ objEditor.ctrlPanel.remove(pushPanel);
313
+ //objEditor.ctrlPanel.remove(fillPanel);
314
+
315
+ //Remove(normalpushField);
161316 }
162317
163318 public ObjEditor GetEditor()
164319 {
165320 return objEditor; //.GetEditor();
166321 }
322
+
323
+ // Sometimes myself, sometimes my callee's.
167324 ObjEditor objEditor;
168325
169326 /*
....@@ -199,6 +356,14 @@
199356 client = inClient;
200357 copy = client;
201358
359
+// if (copy.versionlist == null)
360
+// {
361
+// copy.versionlist = new Object3D[100];
362
+// copy.versionindex = -1;
363
+//
364
+// callee.Save(true);
365
+// }
366
+
202367 // "this" is not called: SetupUI2(objEditor);
203368 }
204369
....@@ -212,6 +377,14 @@
212377 client = inClient;
213378 copy = client;
214379
380
+ if (copy.versionlist == null)
381
+ {
382
+ copy.versionlist = new Object3D[100];
383
+ copy.versionindex = -1;
384
+
385
+// Save(true);
386
+ }
387
+
215388 SetupUI2(callee.GetEditor());
216389 }
217390
....@@ -226,23 +399,33 @@
226399 //localCopy.parent = null;
227400
228401 frame = new JFrame();
402
+ frame.setUndecorated(false);
229403 objEditor = this;
230404 this.callee = callee;
231405
232406 //parent = p;
233407
234408 GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
235
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
409
+ if (Globals.DEBUG)
410
+ System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
236411 //gd.setFullScreenWindow(this);
237412 //setResizable(false);
238413 //if (!isDisplayable())
239414 //setUndecorated(true);
240415
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
416
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242417 client = inClient;
243418 copy = localCopy;
244419 copy.editWindow = this;
245420
421
+// if (copy.versionlist == null)
422
+// {
423
+// copy.versionlist = new Object3D[100];
424
+// copy.versionindex = -1;
425
+//
426
+// Save(true);
427
+// }
428
+
246429 SetupMenu();
247430
248431 //SetupName(objEditor); // new
....@@ -256,28 +439,52 @@
256439 return frame.action(event, obj);
257440 }
258441
442
+ // Cannot work without static
443
+ static boolean allparams = true;
444
+
445
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
446
+
447
+ // This is to refresh the UI of the material panel.
448
+ boolean patchMaterial;
449
+
259450 void SetupMenu()
260451 {
261452 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..."));
453
+ menuBar.add(fileMenu = new Menu("File"));
454
+ fileMenu.add(newItem = new MenuItem("New"));
455
+ fileMenu.add(openItem = new MenuItem("Open..."));
456
+
457
+ //oe.menuBar.add(menu = new Menu("Include"));
458
+ Menu menu = new Menu("Import");
459
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
460
+ importOBJItem.addActionListener(this);
461
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
462
+ import3DSItem.addActionListener(this);
463
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
464
+ importVRMLX3DItem.addActionListener(this);
465
+ menu.add("-");
466
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
467
+ importGFDItem.addActionListener(this);
468
+ fileMenu.add(menu);
469
+ fileMenu.add("-");
470
+
471
+ fileMenu.add(saveItem = new MenuItem("Save"));
472
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267473 //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("-");
474
+ fileMenu.add("-");
475
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
476
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
477
+ fileMenu.add("-");
272478 if (client.parent != null)
273479 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
480
+ fileMenu.add(closeItem = new MenuItem("Close"));
275481 } else
276482 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
483
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278484 }
279485
280
- loadItem.addActionListener(this);
486
+ newItem.addActionListener(this);
487
+ openItem.addActionListener(this);
281488 saveItem.addActionListener(this);
282489 saveAsItem.addActionListener(this);
283490 exportAsItem.addActionListener(this);
....@@ -285,82 +492,103 @@
285492 //povItem.addActionListener(this);
286493 closeItem.addActionListener(this);
287494
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(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
296
- toggleFullScreenItem.addItemListener(this);
297
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
298
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
299
- toggleTimelineItem.addItemListener(this);
300
- cameraMenu.add("-");
301
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
302
- toggleTextureItem.addItemListener(this);
303
- toggleTextureItem.setState(CameraPane.textureon);
304
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
305
- toggleLiveItem.addItemListener(this);
306
- toggleLiveItem.setState(CameraPane.isLIVE());
307
- cameraMenu.add(stepItem = new MenuItem("Step"));
308
- stepItem.addActionListener(this);
309
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
310
-// toggleDLItem.addItemListener(this);
311
-// toggleDLItem.setState(false);
312
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
313
- toggleRenderItem.addItemListener(this);
314
- toggleRenderItem.setState(!CameraPane.frozen);
315
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
316
- toggleDebugItem.addItemListener(this);
317
- toggleDebugItem.setState(CameraPane.DEBUG);
318
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
319
- toggleFrustumItem.addItemListener(this);
320
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
321
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
322
- toggleFootContactItem.addItemListener(this);
323
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
324
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
325
- toggleRandomItem.addItemListener(this);
326
- toggleRandomItem.setState(CameraPane.RANDOM);
327
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
328
- toggleHandleItem.addItemListener(this);
329
- toggleHandleItem.setState(CameraPane.HANDLES);
330
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
331
- togglePaintItem.addItemListener(this);
332
- togglePaintItem.setState(CameraPane.PAINTMODE);
333
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
334
-// toggleRootItem.addItemListener(this);
335
-// toggleRootItem.setState(false);
336
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
337
-// animationItem.addItemListener(this);
338
-// animationItem.setState(CameraPane.ANIMATION);
339
- cameraMenu.add("-");
340
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
341
- editCameraItem.addActionListener(this);
342
-
343495 objectPanel = new JTabbedPane();
496
+
497
+ ChangeListener changeListener = new ChangeListener()
498
+ {
499
+ //String name;
500
+
501
+ public void stateChanged(ChangeEvent changeEvent)
502
+ {
503
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
504
+// {
505
+// if (latestObject != null)
506
+// {
507
+// refreshContents(true);
508
+// SetMaterial(latestObject);
509
+// }
510
+//
511
+// materialFlushed = true;
512
+// }
513
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
514
+// {
515
+// if (listUI.size() == 0)
516
+// EditSelection(false);
517
+// }
518
+
519
+// if (objectPanel.getSelectedIndex() == 4)
520
+// {
521
+// name = copy.skyboxname;
522
+//
523
+// if (name == null)
524
+// {
525
+// name = "";
526
+// }
527
+//
528
+// copy.skyboxname = "cubemaps/default-skyboxes/rgb";
529
+// copy.skyboxext = "jpg";
530
+// }
531
+// else
532
+// {
533
+// if (name != null)
534
+// {
535
+// if (name.equals(""))
536
+// {
537
+// copy.skyboxname = null;
538
+// copy.skyboxext = null;
539
+// }
540
+// else
541
+// {
542
+// copy.skyboxname = name;
543
+// }
544
+// }
545
+// }
546
+ cameraView.transformMode = objectPanel.getSelectedIndex() == 4;
547
+
548
+// refreshContents(false); // To refresh Info tab
549
+ cameraView.repaint();
550
+ }
551
+ };
552
+ objectPanel.addChangeListener(changeListener);
553
+
344554 toolbarPanel = new JPanel();
345555 toolbarPanel.setName("Toolbar");
346
- treePanel = new JPanel();
556
+
557
+ treePanel = new cGridBag();
347558 treePanel.setName("Tree");
348
- ctrlPanel = new JPanel(); // new GridBagLayout());
349
- ctrlPanel.setName("Edit");
350
- materialPanel = new JPanel();
351
- materialPanel.setName("Material");
559
+
560
+ editPanel = new cGridBag().setVertical(true);
561
+ //editPanel.setName("Edit");
562
+
563
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
564
+
565
+ editCommandsPanel = new cGridBag();
566
+ editPanel.add(editCommandsPanel);
567
+ editPanel.add(ctrlPanel);
568
+
569
+ toolboxPanel = new cGridBag().setVertical(true);
570
+ //toolboxPanel.setName("Toolbox");
571
+
572
+ skyboxPanel = new cGridBag().setVertical(true);
573
+
574
+ materialPanel = new cGridBag().setVertical(false);
575
+ //materialPanel.setName("Material");
576
+
352577 /*JTextPane*/
353578 infoarea = createTextPane();
579
+ doc = infoarea.getStyledDocument();
580
+
354581 infoarea.setEditable(true);
355582 SetText();
583
+
356584 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
357585 // infoarea.setOpaque(false);
358586 // //infoarea.setForeground(textcolor);
359
- infoarea.setLineWrap(true);
360
- infoarea.setWrapStyleWord(true);
587
+// TEXTAREA infoarea.setLineWrap(true);
588
+// TEXTAREA infoarea.setWrapStyleWord(true);
361589 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
362
- infoPanel.setPreferredSize(new Dimension(50, 200));
363
- infoPanel.setName("Info");
590
+ infoPanel.setPreferredSize(new Dimension(1, 1));
591
+ //infoPanel.setName("Info");
364592 //infoPanel.setLayout(new BorderLayout());
365593 //infoPanel.add(createTextPane());
366594
....@@ -368,16 +596,23 @@
368596 mainPanel.setName("Main");
369597 mainPanel.setContinuousLayout(true);
370598 mainPanel.setOneTouchExpandable(true);
371
- mainPanel.setDividerLocation(1.0);
372599 mainPanel.setDividerSize(9);
373
- mainPanel.setResizeWeight(0);
374
-
600
+ mainPanel.setDividerLocation(0.5); //1.0);
601
+ mainPanel.setResizeWeight(0.5);
602
+
603
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
604
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
605
+ divider.setDividerSize(15);
606
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
607
+
608
+ mainPanel.setUI(new BasicSplitPaneUI());
609
+
375610 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
376611 //mainPanel.setLayout(new GridBagLayout());
377612 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
378
- treePanel.setLayout(new GridBagLayout());
379
- ctrlPanel.setLayout(new GridBagLayout());
380
- materialPanel.setLayout(new GridBagLayout());
613
+// treePanel.setLayout(new GridBagLayout());
614
+ //ctrlPanel.setLayout(new GridBagLayout());
615
+ //materialPanel.setLayout(new GridBagLayout());
381616
382617 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
383618 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -416,7 +651,7 @@
416651 static String newline = "\n";
417652 protected static final String buttonString = "JButton";
418653 StyledDocument doc;
419
- JTextArea infoarea;
654
+ JTextPane infoarea;
420655
421656 void ClearInfo()
422657 {
....@@ -439,10 +674,10 @@
439674 e.printStackTrace();
440675 }
441676
442
- String selection = infoarea.getText();
443
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
444
- java.awt.datatransfer.Clipboard clipboard =
445
- Toolkit.getDefaultToolkit().getSystemClipboard();
677
+// String selection = infoarea.getText();
678
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
679
+// java.awt.datatransfer.Clipboard clipboard =
680
+// Toolkit.getDefaultToolkit().getSystemClipboard();
446681 //clipboard.setContents(data, data);
447682 }
448683
....@@ -465,13 +700,13 @@
465700 //SendInfo("Name:", "bold");
466701 if (sel.GetTextures() != null || debug)
467702 {
468
- si.SendInfo(sel.toString(), "bold");
703
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
469704 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
470705 if (sel.Size() > 0)
471706 {
472707 si.SendInfo("#children = " + sel.Size(), "regular");
473708 }
474
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
709
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
475710 if (debug)
476711 {
477712 try
....@@ -483,7 +718,10 @@
483718 }
484719
485720 if (full)
486
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
721
+ {
722
+ si.SendInfo(" BBox min: " + minima, "regular");
723
+ si.SendInfo(" BBox max: " + maxima, "regular");
724
+ }
487725
488726 if (sel.bRep != null)
489727 {
....@@ -510,7 +748,7 @@
510748 }
511749 if (sel.support != null)
512750 {
513
- si.SendInfo(" support: " + sel.support, "regular");
751
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
514752 }
515753 if (sel.scriptnode != null)
516754 {
....@@ -581,6 +819,9 @@
581819 {
582820 CameraPane.pointflow = (PointFlow) sel;
583821 }
822
+
823
+ si.SendInfo("_____________________", "regular");
824
+ si.SendInfo("", "regular");
584825 }
585826 }
586827
....@@ -596,52 +837,216 @@
596837 }
597838 }
598839
599
- private JTextArea createTextPane()
600
- {
601
- String[] initString =
602
- {
603
- "This is an editable JTextPane, ", //regular
604
- "another ", //italic
605
- "styled ", //bold
606
- "text ", //small
607
- "component, ", //large
608
- "which supports embedded components..." + newline,//regular
609
- " " + newline, //button
610
- "...and embedded icons..." + newline, //regular
611
- " ", //icon
612
- newline + "JTextPane is a subclass of JEditorPane that "
613
- + "uses a StyledEditorKit and StyledDocument, and provides "
614
- + "cover methods for interacting with those objects."
615
- };
840
+//static GraphicsDevice device = GraphicsEnvironment
841
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
616842
617
- String[] initStyles =
618
- {
619
- "regular", "italic", "bold", "small", "large",
620
- "regular", "button", "regular", "icon",
621
- "regular"
622
- };
843
+ Rectangle keeprect;
844
+ cRadio radio;
845
+
846
+cButton keepButton;
847
+ cButton twoButton; // Full 3D
848
+ cButton sixButton;
849
+ cButton threeButton;
850
+ cButton sevenButton;
851
+ cButton fourButton; // full panel
852
+ cButton oneButton; // full XYZ
853
+ //cButton currentLayout;
854
+
855
+ boolean maximized;
856
+
857
+ cButton fullscreenLayout;
858
+ cButton expandedLayout;
623859
624
- JTextPane textPane = new JTextPane();
625
- textPane.setEditable(true);
626
- /*StyledDocument*/ doc = textPane.getStyledDocument();
627
- addStylesToDocument(doc);
628
-
629
- try
860
+ void Minimize()
630861 {
631
- for (int j = 0; j < 2; j++)
862
+ frame.setState(Frame.ICONIFIED);
863
+ frame.validate();
864
+ }
865
+
866
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
867
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
868
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
869
+ void Maximize()
870
+ {
871
+ if (CameraPane.FULLSCREEN)
632872 {
633
- for (int i = 0; i < initString.length; i++)
634
- {
635
- doc.insertString(doc.getLength(), initString[i],
636
- doc.getStyle(initStyles[i]));
637
- }
873
+ ToggleFullScreen();
638874 }
639
- } catch (BadLocationException ble)
875
+
876
+ if (maximized)
877
+ {
878
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
879
+ }
880
+ else
881
+ {
882
+ keeprect = frame.getBounds();
883
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
884
+// Dimension rect2 = frame.getToolkit().getScreenSize();
885
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
886
+// frame.setState(Frame.MAXIMIZED_BOTH);
887
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
888
+ }
889
+
890
+ maximized ^= true;
891
+
892
+ frame.validate();
893
+ }
894
+
895
+ cButton minButton;
896
+ cButton maxButton;
897
+ cButton fullButton;
898
+ cButton collapseButton;
899
+ cButton maximize3DButton;
900
+
901
+ void ToggleFullScreen()
640902 {
641
- System.err.println("Couldn't insert initial text into text pane.");
903
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
904
+
905
+ cameraView.ToggleFullScreen();
906
+
907
+ if (!CameraPane.FULLSCREEN)
908
+ {
909
+ device.setFullScreenWindow(null);
910
+ frame.dispose();
911
+ frame.setUndecorated(false);
912
+ frame.validate();
913
+ frame.setVisible(true);
914
+
915
+ //frame.setVisible(false);
916
+// frame.removeNotify();
917
+// frame.setUndecorated(false);
918
+// frame.addNotify();
919
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
920
+
921
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
922
+// X framePanel.add(bigThree);
923
+// X frame.getContentPane().add(/*"Center",*/framePanel);
924
+// framePanel.setDividerLocation(46); // icons are 24x24
925
+
926
+ //frame.setVisible(true);
927
+// radio.layout = keepButton;
928
+ //theFrame = null;
929
+ keepButton = null;
930
+// radio.layout.doClick();
931
+
932
+ } else
933
+ {
934
+ keepButton = radio.layout;
935
+ //keeprect = frame.getBounds();
936
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
937
+// frame.getToolkit().getScreenSize().height);
938
+ //frame.setVisible(false);
939
+
940
+ frame.dispose();
941
+ frame.setUndecorated(true);
942
+ device.setFullScreenWindow(frame);
943
+ frame.validate();
944
+ frame.setVisible(true);
945
+// frame.removeNotify();
946
+// frame.setUndecorated(true);
947
+// frame.addNotify();
948
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
949
+// X framePanel.remove(bigThree);
950
+// X frame.getContentPane().add(/*"Center",*/bigThree);
951
+// framePanel.setDividerLocation(0);
952
+
953
+// radio.layout = fullscreenLayout;
954
+// radio.layout.doClick();
955
+ //frame.setVisible(true);
956
+ }
957
+ frame.validate();
958
+
959
+ cameraView.requestFocusInWindow();
642960 }
643961
644
- return new JTextArea(); // textPane;
962
+ void CollapseToolbar()
963
+ {
964
+ framePanel.setDividerLocation(0);
965
+ //frame.validate();
966
+
967
+ cameraView.requestFocusInWindow();
968
+ }
969
+
970
+ private Object3D Duplicate(Object3D object)
971
+ {
972
+ boolean temp = CameraPane.SWITCH;
973
+ CameraPane.SWITCH = false;
974
+
975
+ if (Grafreed.grafreed.universe.versiontable == null)
976
+ Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
977
+
978
+ object.ExtractBigData(Grafreed.grafreed.universe.versiontable);
979
+ // if (copy == client)
980
+
981
+ Object3D versions[] = object.versionlist;
982
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe
983
+ object.versionlist = null;
984
+ object.versiontable = null;
985
+
986
+ Object3D parent = object.parent;
987
+ object.parent = null;
988
+
989
+ //byte[] compress = Compress(copy);
990
+ Object3D compress = (Object3D)Grafreed.clone(object);
991
+
992
+ object.parent = parent;
993
+
994
+ object.versionlist = versions;
995
+ object.versiontable = versiontable; // if Grafreed.grafreed.universe
996
+
997
+ object.RestoreBigData(Grafreed.grafreed.universe.versiontable);
998
+
999
+ CameraPane.SWITCH = temp;
1000
+
1001
+ return compress;
1002
+ }
1003
+
1004
+ private JTextPane createTextPane()
1005
+ {
1006
+// TEXTAREA String[] initString =
1007
+// {
1008
+// "This is an editable JTextPane, ", //regular
1009
+// "another ", //italic
1010
+// "styled ", //bold
1011
+// "text ", //small
1012
+// "component, ", //large
1013
+// "which supports embedded components..." + newline,//regular
1014
+// " " + newline, //button
1015
+// "...and embedded icons..." + newline, //regular
1016
+// " ", //icon
1017
+// newline + "JTextPane is a subclass of JEditorPane that "
1018
+// + "uses a StyledEditorKit and StyledDocument, and provides "
1019
+// + "cover methods for interacting with those objects."
1020
+// };
1021
+//
1022
+// String[] initStyles =
1023
+// {
1024
+// "regular", "italic", "bold", "small", "large",
1025
+// "regular", "button", "regular", "icon",
1026
+// "regular"
1027
+// };
1028
+//
1029
+// JTextPane textPane = new JTextPane();
1030
+// textPane.setEditable(true);
1031
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
1032
+// addStylesToDocument(doc);
1033
+//
1034
+// try
1035
+// {
1036
+// for (int j = 0; j < 2; j++)
1037
+// {
1038
+// for (int i = 0; i < initString.length; i++)
1039
+// {
1040
+// doc.insertString(doc.getLength(), initString[i],
1041
+// doc.getStyle(initStyles[i]));
1042
+// }
1043
+// }
1044
+// } catch (BadLocationException ble)
1045
+// {
1046
+// System.err.println("Couldn't insert initial text into text pane.");
1047
+// }
1048
+
1049
+ return new JTextPane(); // textPane;
6451050 }
6461051
6471052 protected void addStylesToDocument(StyledDocument doc)
....@@ -694,7 +1099,7 @@
6941099 protected static ImageIcon createImageIcon(String path,
6951100 String description)
6961101 {
697
- java.net.URL imgURL = GrafreeD.class.getResource(path);
1102
+ java.net.URL imgURL = Grafreed.class.getResource(path);
6981103 if (imgURL != null)
6991104 {
7001105 return new ImageIcon(imgURL, description);
....@@ -717,6 +1122,7 @@
7171122 {
7181123 SetupMaterial(materialPanel);
7191124 }
1125
+
7201126 //SetupName();
7211127 //SetupViews();
7221128 }
....@@ -726,6 +1132,7 @@
7261132 // NumberSlider vDivsField;
7271133 // JCheckBox endcaps;
7281134 JCheckBox liveCB;
1135
+ JCheckBox selectableCB;
7291136 JCheckBox hideCB;
7301137 JCheckBox link2masterCB;
7311138 JCheckBox markCB;
....@@ -733,7 +1140,12 @@
7331140 JCheckBox speedupCB;
7341141 JCheckBox rewindCB;
7351142 JCheckBox flipVCB;
1143
+
1144
+ cCheckBox toggleTextureCB;
1145
+ cCheckBox toggleSwitchCB;
1146
+
7361147 JComboBox texresMenu;
1148
+
7371149 JButton resetButton;
7381150 JButton stepButton;
7391151 JButton stepAllButton;
....@@ -741,115 +1153,87 @@
7411153 JButton slowerButton;
7421154 JButton fasterButton;
7431155 JButton remarkButton;
1156
+
1157
+ cGridBag editPanel;
1158
+ cGridBag editCommandsPanel;
1159
+
1160
+ cGridBag namePanel;
1161
+ cGridBag setupPanel;
1162
+ cGridBag setupPanel2;
1163
+ cGridBag objectCommandsPanel;
1164
+ cGridBag pushPanel;
1165
+ cGridBag fillPanel;
7441166
745
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1167
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7461168 {
7471169 JCheckBox cb;
7481170
749
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
750
- oe.aConstraints.gridwidth = 1; // 3;
751
-// oe.aConstraints.weightx = 1;
752
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
753
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1171
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7541172 cb.addItemListener(this);
755
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
756
- oe.aConstraints.gridwidth = 1;
757
- oe.aConstraints.gridx += 1;
7581173
7591174 return cb;
7601175 }
7611176
762
- cButton AddButton(ObjEditor oe, String label)
1177
+ cButton AddButton(cGridBag panel, String label)
7631178 {
7641179 cButton cb;
7651180
766
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
767
- oe.aConstraints.gridwidth = 1;
768
-// oe.aConstraints.weightx = 1;
769
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
770
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1181
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7711182 cb.addActionListener(this);
772
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
773
- oe.aConstraints.gridwidth = 1;
774
- oe.aConstraints.gridx += 1;
7751183
7761184 return cb;
7771185 }
7781186
779
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1187
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
7801188 {
7811189 JComboBox combo;
7821190
783
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
784
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
785
- oe.aConstraints.gridx += 1;
1191
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7861192 combo.addActionListener(this);
7871193
7881194 return combo;
7891195 }
7901196
791
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
1197
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
7921198 {
793
- NumberSlider combo;
1199
+ cGridBag control = new cGridBag();
1200
+
1201
+ cNumberSlider combo;
7941202
7951203 JLabel jlabel = new JLabel(label);
796
-
797
- aConstraints.fill = GridBagConstraints.VERTICAL;
7981204 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
799
- aConstraints.gridwidth = 2;
800
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
801
- aConstraints.gridx += 1;
802
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
803
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
804
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
805
- aConstraints.gridx += 1;
806
- aConstraints.gridwidth = 1;
807
-
1205
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1206
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8081207 combo.setFloat(current);
809
-
810
- combo.label = jlabel;
811
-
812
- combo.addChangeListener(this);
813
-
814
- return combo;
1208
+
1209
+ panel.add(control);
1210
+
1211
+ return control;
8151212 }
8161213
817
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
1214
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8181215 {
819
- NumberSlider combo;
1216
+ cGridBag control = new cGridBag();
1217
+
1218
+ cNumberSlider combo;
8201219
8211220 JLabel jlabel = new JLabel(label);
822
-
823
- aConstraints.fill = GridBagConstraints.VERTICAL;
8241221 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
825
- aConstraints.gridwidth = 2;
826
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827
- aConstraints.gridx += 1;
828
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
829
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
830
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
831
- aConstraints.gridx += 1;
832
- aConstraints.gridwidth = 1;
833
-
1222
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1223
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8341224 combo.setInteger(current);
8351225
836
- combo.label = jlabel;
837
-
838
- combo.addChangeListener(this);
839
-
840
- return combo;
1226
+ panel.add(control);
1227
+
1228
+ return control;
8411229 }
8421230
843
- JTextArea AddText(JPanel ctrlPanel, String name)
1231
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8441232 {
8451233 JTextArea text;
8461234
847
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
848
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
849
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1235
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8501236 text.addCaretListener(this);
851
- aConstraints.gridx += 1;
852
- aConstraints.gridwidth = 1;
8531237
8541238 return text;
8551239 }
....@@ -879,9 +1263,16 @@
8791263 objEditor.ctrlPanel.remove(j);
8801264 }
8811265
1266
+ void Remove(cNumberSlider j)
1267
+ {
1268
+ j.removeChangeListener(this);
1269
+ //objEditor.ctrlPanel.remove(j.label);
1270
+ objEditor.ctrlPanel.remove(j);
1271
+ }
1272
+
8821273 /*
8831274 */
884
- void Return() // ObjEditor oe)
1275
+ void Return0() // ObjEditor oe)
8851276 {
8861277 aConstraints.gridy += 1;
8871278 aConstraints.gridx = 0;
....@@ -936,35 +1327,93 @@
9361327
9371328 void SetupUI2(ObjEditor oe)
9381329 {
939
-// oe.aConstraints.weightx = 0;
940
-// oe.aConstraints.weighty = 0;
941
-// oe.aConstraints.gridx = 0;
942
-// oe.aConstraints.gridy = 0;
943
- SetupName(oe);
1330
+ //SetupName(oe);
9441331
945
- if (!GroupEditor.allparams)
1332
+ namePanel = new cGridBag();
1333
+
1334
+ //if (copy.pinned)
1335
+ {
1336
+ pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF);
1337
+ pinButton.setSelected(copy.pinned);
1338
+ cGridBag t = new cGridBag();
1339
+ t.preferredWidth = 2;
1340
+ t.add(pinButton);
1341
+ namePanel.add(t);
1342
+
1343
+ pinButton.addItemListener(this);
1344
+ }
1345
+
1346
+ nameField = AddText(namePanel, copy.GetName());
1347
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
1348
+ oe.ctrlPanel.add(namePanel);
1349
+
1350
+ oe.ctrlPanel.Return();
1351
+
1352
+ if (!allparams)
9461353 return;
9471354
948
- liveCB = AddCheckBox(oe, "Live", copy.live);
949
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
950
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1355
+ setupPanel = new cGridBag().setVertical(false);
1356
+
1357
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1358
+ liveCB.setToolTipText("Animate object");
1359
+ markCB = AddCheckBox(setupPanel, "Anim", copy.marked);
1360
+ markCB.setToolTipText("Set target transform");
1361
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1362
+ selectableCB.setToolTipText("Make object selectable");
9511363 // Return();
952
- markCB = AddCheckBox(oe, "Mark", copy.marked);
953
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
954
- randomCB = AddCheckBox(oe, "Rand", copy.random);
955
- Return();
956
- resetButton = AddButton(oe, "Reset");
957
- stepButton = AddButton(oe, "Step");
1364
+
1365
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1366
+ hideCB.setToolTipText("Hide object");
1367
+
1368
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
1369
+
1370
+ setupPanel2 = new cGridBag().setVertical(false);
1371
+
1372
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1373
+ rewindCB.setToolTipText("Rewind animation");
1374
+
1375
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1376
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1377
+
1378
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1379
+ link2masterCB.setToolTipText("Attach to support");
1380
+
1381
+ if (Globals.ADVANCED)
1382
+ {
1383
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1384
+ speedupCB.setToolTipText("Option motion capture");
1385
+ }
1386
+
1387
+ oe.ctrlPanel.add(setupPanel);
1388
+ oe.ctrlPanel.Return();
1389
+ oe.ctrlPanel.add(setupPanel2);
1390
+ oe.ctrlPanel.Return();
1391
+
1392
+ objectCommandsPanel = new cGridBag().setVertical(false);
1393
+
1394
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1395
+ resetButton.setToolTipText("Jump to frame zero");
1396
+ stepButton = AddButton(objectCommandsPanel, "Step");
1397
+ stepButton.setToolTipText("Step one frame");
9581398 // resetAllButton = AddButton(oe, "Reset All");
9591399 // stepAllButton = AddButton(oe, "Step All");
960
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9611400 // Return();
962
- slowerButton = AddButton(oe, "Slow");
963
- fasterButton = AddButton(oe, "Fast");
964
- remarkButton = AddButton(oe, "Rem");
1401
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1402
+ slowerButton.setToolTipText("Decrease animation speed");
1403
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1404
+ fasterButton.setToolTipText("Increase animation speed");
1405
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1406
+ remarkButton.setToolTipText("Set the current transform as the target");
9651407
966
- Return();
1408
+ oe.ctrlPanel.add(objectCommandsPanel);
1409
+ oe.ctrlPanel.Return();
9671410
1411
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1412
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1413
+ //Return();
1414
+
1415
+ oe.ctrlPanel.Return();
1416
+
9681417 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9691418 // ObjEditor.aConstraints.gridx += 1;
9701419
....@@ -1058,7 +1507,7 @@
10581507 oe.aConstraints.gridwidth = 1;
10591508 /**/
10601509 nameField = AddText(oe.ctrlPanel, copy.GetName());
1061
- Return();
1510
+ oe.ctrlPanel.Return();
10621511
10631512 //ctrlPanel.add(textureButton = new Button("Texture..."));
10641513 //textureButton.setEnabled(false);
....@@ -1116,22 +1565,9 @@
11161565
11171566 if (cam == null || !(copy.get(0) instanceof cGroup))
11181567 {
1119
- System.out.println("CREATE CAMERAS");
1120
- cams = new cTemplate();
1121
- cams.name = "Cameras";
1122
- copy.insertElementAt(cams, 0);
1123
- //cams.parent = copy;
1124
-
1125
- cam = new Camera(); // LA.newVector(3, 2, 1));
1126
- cams.addChild(cam);
1127
- cam = new Camera(1);
1128
- cams.addChild(cam);
1129
- cam = new Camera(2);
1130
- cams.addChild(cam);
1131
- cam = new Camera(3);
1132
- cams.addChild(cam);
1133
- cam = new Camera(4); // Light
1134
- cams.addChild(cam);
1568
+ if (Globals.DEBUG)
1569
+ System.out.println("CREATE CAMERAS");
1570
+ cams = CreateCameras();
11351571 } else
11361572 {
11371573 cams = (cGroup) copy.get(0);
....@@ -1160,11 +1596,25 @@
11601596 //JPanel worldPanel =
11611597 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11621598 //worldPanel.setName("World");
1163
- centralPanel = new JPanel(new BorderLayout());
1164
- timelinePanel = new JPanel(new BorderLayout());
1165
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1599
+ centralPanel = new cGridBag();
1600
+ centralPanel.preferredWidth = 20;
1601
+
1602
+ if (Globals.ADVANCED)
1603
+ {
1604
+ timelinePanel = new JPanel(new BorderLayout());
1605
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11661606
1607
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1608
+ cameraPanel.setContinuousLayout(true);
1609
+ cameraPanel.setOneTouchExpandable(true);
1610
+// cameraPanel.setDividerLocation(0.9);
1611
+// cameraPanel.setDividerSize(9);
1612
+ cameraPanel.setResizeWeight(1.0);
1613
+
1614
+ }
1615
+
11671616 centralPanel.add(cameraView);
1617
+ centralPanel.setFocusable(true);
11681618 //frame.setJMenuBar(timelineMenubar);
11691619 //centralPanel.add(timelinePanel);
11701620
....@@ -1183,13 +1633,57 @@
11831633 //frontView.object = copy;
11841634 //sideView.object = copy;
11851635
1186
- XYZPanel = new JPanel();
1187
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1636
+ transformPanel = new cGridBag().setVertical(true);
1637
+
1638
+ cGridBag resetTransformPanel = new cGridBag();
1639
+
1640
+ resetTransformPanel.preferredHeight = 2;
1641
+
1642
+ cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF);
1643
+ resetTransform.setToolTipText("Reset Translation, Rotation and Scale");
1644
+ resetTransform.addMouseListener(new MouseAdapter()
1645
+ {
1646
+ public void mouseClicked(MouseEvent e)
1647
+ {
1648
+ ResetTransform();
1649
+ }
1650
+ });
1651
+ resetTransformPanel.add(resetTransform);
1652
+
1653
+ resetTransform = GetButton("T only", !Globals.NIMBUSLAF);
1654
+ resetTransform.setToolTipText("Reset Translation only");
1655
+ resetTransform.addMouseListener(new MouseAdapter()
1656
+ {
1657
+ public void mouseClicked(MouseEvent e)
1658
+ {
1659
+ ResetTransform(1);
1660
+ }
1661
+ });
1662
+ resetTransformPanel.add(resetTransform);
1663
+
1664
+ resetTransform = GetButton("RS only", !Globals.NIMBUSLAF);
1665
+ resetTransform.setToolTipText("Reset Rotation and Scale only");
1666
+ resetTransform.addMouseListener(new MouseAdapter()
1667
+ {
1668
+ public void mouseClicked(MouseEvent e)
1669
+ {
1670
+ ResetTransform(2);
1671
+ }
1672
+ });
1673
+ resetTransformPanel.add(resetTransform);
1674
+
1675
+ XYZPanel = new cGridBag().setVertical(true);
1676
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11881677
1189
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1190
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1191
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1678
+ XYZPanel.preferredWidth = 5;
1679
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1680
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1681
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1682
+ //XYZPanel.setName("XYZ");
11921683
1684
+ transformPanel.add(resetTransformPanel);
1685
+ transformPanel.add(XYZPanel);
1686
+
11931687 /*
11941688 gridPanel = new JPanel(); //new BorderLayout());
11951689 gridPanel.setLayout(new GridLayout(1, 2));
....@@ -1197,12 +1691,12 @@
11971691 gridPanel.add(cameraView);
11981692 gridPanel.add(XYZPanel);
11991693 */
1200
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1201
- gridPanel.setContinuousLayout(true);
1202
- gridPanel.setOneTouchExpandable(true);
1203
- gridPanel.setDividerLocation(1.0);
1204
- gridPanel.setDividerSize(9);
1205
- gridPanel.setResizeWeight(0.85);
1694
+// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1695
+// gridPanel.setContinuousLayout(true);
1696
+// gridPanel.setOneTouchExpandable(true);
1697
+// gridPanel.setDividerLocation(1.0);
1698
+// gridPanel.setDividerSize(9);
1699
+// gridPanel.setResizeWeight(0.85);
12061700
12071701 // aConstraints.weighty = 0;
12081702 //System.out.println("THIS = " + this);
....@@ -1225,13 +1719,34 @@
12251719
12261720 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12271721 //tmp.setName("Edit");
1228
- objectPanel.add(materialPanel);
1229
- JPanel north = new JPanel(new BorderLayout());
1230
- north.setName("Edit");
1231
- north.add(ctrlPanel, BorderLayout.NORTH);
1232
- objectPanel.add(north);
1233
- objectPanel.add(infoPanel);
1722
+ objectPanel.add(skyboxPanel);
1723
+ objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg"));
1724
+ objectPanel.setToolTipTextAt(0, "Backgrounds");
1725
+
1726
+ objectPanel.add(toolboxPanel);
1727
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1728
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
12341729
1730
+ objectPanel.add(materialPanel);
1731
+ objectPanel.setIconAt(2, GetIcon("icons/material.png"));
1732
+ objectPanel.setToolTipTextAt(2, "Material");
1733
+
1734
+// JPanel north = new JPanel(new BorderLayout());
1735
+// north.setName("Edit");
1736
+// north.add(ctrlPanel, BorderLayout.NORTH);
1737
+// objectPanel.add(north);
1738
+ objectPanel.add(editPanel);
1739
+ objectPanel.setIconAt(3, GetIcon("icons/writewhite.png"));
1740
+ objectPanel.setToolTipTextAt(3, "Edit controls");
1741
+
1742
+ objectPanel.add(transformPanel);
1743
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1744
+ objectPanel.setToolTipTextAt(4, "TRS transform");
1745
+
1746
+ patchMaterial = true;
1747
+ cameraView.patchMaterial = this;
1748
+ objectPanel.setSelectedIndex(2);
1749
+
12351750 /*
12361751 aConstraints.gridx = 0;
12371752 aConstraints.gridwidth = 1;
....@@ -1239,7 +1754,7 @@
12391754 aConstraints.gridy += 1;
12401755 aConstraints.gridwidth = 1;
12411756 mainPanel.add(objectPanel, aConstraints);
1242
- */
1757
+ */
12431758
12441759 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12451760 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1250,16 +1765,63 @@
12501765 scrollpane.setWheelScrollingEnabled(true);
12511766 scrollpane.addMouseWheelListener(this); // Default not fast enough
12521767
1253
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1254
- scenePanel.add(scrollpane);
1768
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1769
+ scenePanel.preferredWidth = 6;
1770
+
1771
+ JTabbedPane tabbedPane = new JTabbedPane();
1772
+ tabbedPane.add(scrollpane);
12551773
1256
- scenePanel.add(FSPane = new cFileSystemPane(this));
1257
-
1258
- optionsPanel = new JPanel(new GridBagLayout());
1774
+ optionsPanel = new cGridBag().setVertical(false);
12591775
12601776 optionsPanel.setName("Options");
1261
- scenePanel.add(optionsPanel);
1777
+
1778
+ AddOptions(optionsPanel); //, aConstraints);
1779
+
1780
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12621781
1782
+ tabbedPane.add(optionsPanel);
1783
+
1784
+ scenePanel.add(tabbedPane);
1785
+
1786
+ cGridBag creditsPanel = new cGridBag().setVertical(true);
1787
+ creditsPanel.setName("Credits");
1788
+
1789
+ cLabel ogaLabel = new cLabel(" Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
1790
+ creditsPanel.add(ogaLabel);
1791
+
1792
+ cButton opengameartButton;
1793
+ creditsPanel.add(opengameartButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF));
1794
+ opengameartButton.setToolTipText("https://opengameart.org");
1795
+
1796
+ opengameartButton.addMouseListener(new MouseAdapter()
1797
+ {
1798
+ public void mouseClicked(MouseEvent e)
1799
+ {
1800
+ try
1801
+ {
1802
+ Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/"));
1803
+ } catch (Exception e1)
1804
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1805
+ {
1806
+ e1.printStackTrace();
1807
+ }
1808
+ }
1809
+ });
1810
+
1811
+ for (int i=10; --i>=0;)
1812
+ {
1813
+ creditsPanel.add(new cGridBag());
1814
+ }
1815
+
1816
+ tabbedPane.add(creditsPanel);
1817
+ tabbedPane.setToolTipTextAt(3, "Credits");
1818
+
1819
+ if (Globals.ADVANCED)
1820
+ {
1821
+ tabbedPane.add(infoPanel);
1822
+ tabbedPane.setIconAt(4, GetIcon("icons/info.png"));
1823
+ tabbedPane.setToolTipTextAt(4, "Information");
1824
+ }
12631825
12641826 /*
12651827 cTree jTree = new cTree(null);
....@@ -1281,18 +1843,19 @@
12811843 jtp.add(tree);
12821844 */
12831845
1284
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1285
- bigPanel.setContinuousLayout(true);
1286
- bigPanel.setOneTouchExpandable(true);
1287
- bigPanel.setDividerLocation(0.8);
1288
- bigPanel.setDividerSize(15);
1289
- bigPanel.setResizeWeight(0.15);
1290
- bigPanel.setName("Scene");
1846
+// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1847
+// bigPanel.setContinuousLayout(true);
1848
+// bigPanel.setOneTouchExpandable(true);
1849
+// bigPanel.setDividerLocation(0.8);
1850
+// bigPanel.setDividerSize(15);
1851
+// bigPanel.setResizeWeight(0.15);
1852
+// bigPanel.setName("Scene");
12911853
12921854 //bigPanel.setLayout(new BorderLayout());
12931855 //bigPanel.setSize(new Dimension(10,10));
12941856 //bigPanel.add(ctrlPanel);
12951857 //bigPanel.add(gridPanel);
1858
+ /**
12961859 bigThree = new JPanel();
12971860 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12981861 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1316,7 +1879,13 @@
13161879 // aConstraints.gridheight = 3;
13171880 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13181881 bigThree.add(XYZPanel, aWindowConstraints);
1882
+ /**/
13191883
1884
+ bigThree = new cGridBag();
1885
+ bigThree.addComponent(scenePanel);
1886
+ bigThree.addComponent(centralPanel);
1887
+ //bigThree.addComponent(XYZPanel);
1888
+
13201889 // // SIDE EFFECT!!!
13211890 // aConstraints.gridx = 0;
13221891 // aConstraints.gridy = 0;
....@@ -1324,33 +1893,55 @@
13241893 // aConstraints.gridheight = 1;
13251894
13261895 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1327
- framePanel.setContinuousLayout(true);
1328
- framePanel.setOneTouchExpandable(true);
1329
- framePanel.setDividerLocation(0.8);
1896
+
1897
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
1898
+ new java.beans.PropertyChangeListener()
1899
+ {
1900
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
1901
+ {
1902
+ if ((Integer)pce.getOldValue() == 1)
1903
+ {
1904
+ if (radio.layout != expandedLayout)
1905
+ {
1906
+ radio.layout = expandedLayout;
1907
+ radio.layout.doClick();
1908
+ }
1909
+ }
1910
+ }
1911
+ });
1912
+
1913
+ framePanel.setContinuousLayout(false);
1914
+ framePanel.setOneTouchExpandable(false);
1915
+ //.setDividerLocation(0.8);
13301916 //framePanel.setDividerSize(15);
13311917 //framePanel.setResizeWeight(0.15);
13321918 framePanel.setName("Frame");
13331919
13341920 frame.getContentPane().setLayout(new BorderLayout());
13351921 /**/
1336
- JTabbedPane worldPane = new JTabbedPane();
1922
+ //JTabbedPane worldPane = new JTabbedPane();
13371923 //worldPane.add(bigPanel);
13381924 //worldPane.add(worldPanel);
13391925 /**/
1340
- frame.getContentPane().add(/*"Center",*/framePanel);
1926
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1927
+ frame.add(/*"Center",*/framePanel);
13411928 //frame.getContentPane().add(/*"Center",*/ worldPane);
13421929
13431930 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13441931
1345
- frame.setSize(1024, 768);
1346
- frame.show();
1932
+ frame.setSize(1280, 860);
1933
+
1934
+ cameraView.requestFocusInWindow();
1935
+
1936
+// gridPanel.setDividerLocation(1.0);
1937
+
1938
+ frame.validate();
13471939
1348
- gridPanel.setDividerLocation(1.0);
1940
+ frame.setVisible(true);
13491941
13501942 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13511943 frame.addWindowListener(new WindowAdapter()
13521944 {
1353
-
13541945 public void windowClosing(WindowEvent e)
13551946 {
13561947 Close();
....@@ -1358,6 +1949,10 @@
13581949 });
13591950 }
13601951
1952
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1953
+ {
1954
+ }
1955
+
13611956 JTree GetTree()
13621957 {
13631958 return objEditor.jTree;
....@@ -1369,260 +1964,609 @@
13691964 ctrlPanel.removeAll();
13701965 }
13711966
1372
- void SetupMaterial(JPanel ctrlPanel)
1967
+ void SetupMaterial(cGridBag materialpanel)
13731968 {
1374
- aConstraints.weighty = 0;
1375
- //aConstraints.weightx = 1;
1376
- /*
1969
+ cGridBag presetpanel = new cGridBag().setVertical(true);
1970
+
1971
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF);
1972
+ skin.setToolTipText("Skin");
1973
+ skin.addMouseListener(new MouseAdapter()
1974
+ {
1975
+ public void mouseClicked(MouseEvent e)
1976
+ {
1977
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
1978
+ cMaterial material = object.material;
1979
+
1980
+ // Skin
1981
+ colorField.setFloat(material.color);
1982
+ float saturation = material.modulation;
1983
+
1984
+ if (!cameraView.Skinshader)
1985
+ {
1986
+ saturation /= 1.5;
1987
+ }
1988
+
1989
+ saturationField.setFloat(saturation);
1990
+
1991
+ subsurfaceField.setFloat(material.subsurface);
1992
+ selfshadowField.setFloat(material.diffuseness);
1993
+ diffusenessField.setFloat(material.factor);
1994
+ shininessField.setFloat(material.shininess);
1995
+ shadowbiasField.setFloat(material.shadowbias);
1996
+ diffuseField.setFloat(material.diffuse);
1997
+ specularField.setFloat(material.specular);
1998
+
1999
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2000
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2001
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2002
+
2003
+ materialtouched = true;
2004
+ applySelf();
2005
+ }
2006
+ });
2007
+ presetpanel.add(skin);
2008
+
2009
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF);
2010
+ lambert.setToolTipText("Diffuse");
2011
+ lambert.addMouseListener(new MouseAdapter()
2012
+ {
2013
+ public void mouseClicked(MouseEvent e)
2014
+ {
2015
+ Object3D object = Grafreed.materials.versionlist[2].get(0);
2016
+ cMaterial material = object.material;
2017
+
2018
+ diffusenessField.setFloat(material.factor);
2019
+ selfshadowField.setFloat(material.diffuseness);
2020
+
2021
+ materialtouched = true;
2022
+ applySelf();
2023
+ }
2024
+ });
2025
+ presetpanel.add(lambert);
2026
+
2027
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF);
2028
+ diffuse2.setToolTipText("Diffuse2");
2029
+ diffuse2.addMouseListener(new MouseAdapter()
2030
+ {
2031
+ public void mouseClicked(MouseEvent e)
2032
+ {
2033
+ Object3D object = Grafreed.materials.versionlist[3].get(0);
2034
+ cMaterial material = object.material;
2035
+
2036
+ diffusenessField.setFloat(material.factor);
2037
+ selfshadowField.setFloat(material.diffuseness);
2038
+
2039
+ materialtouched = true;
2040
+ applySelf();
2041
+ }
2042
+ });
2043
+ presetpanel.add(diffuse2);
2044
+
2045
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF);
2046
+ diffusemoon.setToolTipText("Moon");
2047
+ diffusemoon.addMouseListener(new MouseAdapter()
2048
+ {
2049
+ public void mouseClicked(MouseEvent e)
2050
+ {
2051
+ Object3D object = Grafreed.materials.versionlist[4].get(0);
2052
+ cMaterial material = object.material;
2053
+
2054
+ diffusenessField.setFloat(material.factor);
2055
+ selfshadowField.setFloat(material.diffuseness);
2056
+
2057
+ materialtouched = true;
2058
+ applySelf();
2059
+ }
2060
+ });
2061
+ presetpanel.add(diffusemoon);
2062
+
2063
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF);
2064
+ diffusemoon2.setToolTipText("Moon2");
2065
+ diffusemoon2.addMouseListener(new MouseAdapter()
2066
+ {
2067
+ public void mouseClicked(MouseEvent e)
2068
+ {
2069
+ Object3D object = Grafreed.materials.versionlist[5].get(0);
2070
+ cMaterial material = object.material;
2071
+
2072
+ diffusenessField.setFloat(material.factor);
2073
+ selfshadowField.setFloat(material.diffuseness);
2074
+
2075
+ materialtouched = true;
2076
+ applySelf();
2077
+ }
2078
+ });
2079
+ presetpanel.add(diffusemoon2);
2080
+
2081
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF);
2082
+ diffusemoon3.setToolTipText("Moon3");
2083
+ diffusemoon3.addMouseListener(new MouseAdapter()
2084
+ {
2085
+ public void mouseClicked(MouseEvent e)
2086
+ {
2087
+ Object3D object = Grafreed.materials.versionlist[6].get(0);
2088
+ cMaterial material = object.material;
2089
+
2090
+ diffusenessField.setFloat(material.factor);
2091
+ selfshadowField.setFloat(material.diffuseness);
2092
+
2093
+ materialtouched = true;
2094
+ applySelf();
2095
+ }
2096
+ });
2097
+ presetpanel.add(diffusemoon3);
2098
+
2099
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF);
2100
+ diffusesheen.setToolTipText("Sheen");
2101
+ diffusesheen.addMouseListener(new MouseAdapter()
2102
+ {
2103
+ public void mouseClicked(MouseEvent e)
2104
+ {
2105
+ Object3D object = Grafreed.materials.versionlist[7].get(0);
2106
+ cMaterial material = object.material;
2107
+
2108
+ sheenField.setFloat(material.sheen);
2109
+
2110
+ materialtouched = true;
2111
+ applySelf();
2112
+ }
2113
+ });
2114
+ presetpanel.add(diffusesheen);
2115
+
2116
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF);
2117
+ rough.setToolTipText("Rough metal");
2118
+ rough.addMouseListener(new MouseAdapter()
2119
+ {
2120
+ public void mouseClicked(MouseEvent e)
2121
+ {
2122
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
2123
+ cMaterial material = object.material;
2124
+
2125
+ shininessField.setFloat(material.shininess);
2126
+ velvetField.setFloat(material.velvet);
2127
+
2128
+ materialtouched = true;
2129
+ applySelf();
2130
+ }
2131
+ });
2132
+ presetpanel.add(rough);
2133
+
2134
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF);
2135
+ rough2.setToolTipText("Medium metal");
2136
+ rough2.addMouseListener(new MouseAdapter()
2137
+ {
2138
+ public void mouseClicked(MouseEvent e)
2139
+ {
2140
+ Object3D object = Grafreed.materials.versionlist[13].get(0);
2141
+ cMaterial material = object.material;
2142
+
2143
+ shininessField.setFloat(material.shininess);
2144
+ lightareaField.setFloat(material.lightarea);
2145
+
2146
+ materialtouched = true;
2147
+ applySelf();
2148
+ }
2149
+ });
2150
+ presetpanel.add(rough2);
2151
+
2152
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF);
2153
+ shini0.setToolTipText("Shiny");
2154
+ shini0.addMouseListener(new MouseAdapter()
2155
+ {
2156
+ public void mouseClicked(MouseEvent e)
2157
+ {
2158
+ Object3D object = Grafreed.materials.versionlist[14].get(0);
2159
+ cMaterial material = object.material;
2160
+
2161
+ shininessField.setFloat(material.shininess);
2162
+ lightareaField.setFloat(material.lightarea);
2163
+
2164
+ materialtouched = true;
2165
+ applySelf();
2166
+ }
2167
+ });
2168
+ presetpanel.add(shini0);
2169
+
2170
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF);
2171
+ shini1.setToolTipText("Shiny2");
2172
+ shini1.addMouseListener(new MouseAdapter()
2173
+ {
2174
+ public void mouseClicked(MouseEvent e)
2175
+ {
2176
+ Object3D object = Grafreed.materials.versionlist[11].get(0);
2177
+ cMaterial material = object.material;
2178
+
2179
+ shininessField.setFloat(material.shininess);
2180
+ lightareaField.setFloat(material.lightarea);
2181
+
2182
+ materialtouched = true;
2183
+ applySelf();
2184
+ }
2185
+ });
2186
+ presetpanel.add(shini1);
2187
+
2188
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF);
2189
+ shini2.setToolTipText("Shiny3");
2190
+ shini2.addMouseListener(new MouseAdapter()
2191
+ {
2192
+ public void mouseClicked(MouseEvent e)
2193
+ {
2194
+ Object3D object = Grafreed.materials.versionlist[12].get(0);
2195
+ cMaterial material = object.material;
2196
+
2197
+ shininessField.setFloat(material.shininess);
2198
+ lightareaField.setFloat(material.lightarea);
2199
+
2200
+ materialtouched = true;
2201
+ applySelf();
2202
+ }
2203
+ });
2204
+ presetpanel.add(shini2);
2205
+
2206
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF);
2207
+ aniso.setToolTipText("AnisoU");
2208
+ aniso.addMouseListener(new MouseAdapter()
2209
+ {
2210
+ public void mouseClicked(MouseEvent e)
2211
+ {
2212
+ Object3D object = Grafreed.materials.versionlist[8].get(0);
2213
+ cMaterial material = object.material;
2214
+
2215
+ anisoField.setFloat(material.aniso);
2216
+ anisoVField.setFloat(material.anisoV);
2217
+
2218
+ materialtouched = true;
2219
+ applySelf();
2220
+ }
2221
+ });
2222
+ presetpanel.add(aniso);
2223
+
2224
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF);
2225
+ aniso2.setToolTipText("AnisoV");
2226
+ aniso2.addMouseListener(new MouseAdapter()
2227
+ {
2228
+ public void mouseClicked(MouseEvent e)
2229
+ {
2230
+ Object3D object = Grafreed.materials.versionlist[9].get(0);
2231
+ cMaterial material = object.material;
2232
+
2233
+ anisoField.setFloat(material.aniso);
2234
+ anisoVField.setFloat(material.anisoV);
2235
+
2236
+ materialtouched = true;
2237
+ applySelf();
2238
+ }
2239
+ });
2240
+ presetpanel.add(aniso2);
2241
+
2242
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF);
2243
+ aniso3.setToolTipText("AnisoUV");
2244
+ aniso3.addMouseListener(new MouseAdapter()
2245
+ {
2246
+ public void mouseClicked(MouseEvent e)
2247
+ {
2248
+ Object3D object = Grafreed.materials.versionlist[10].get(0);
2249
+ cMaterial material = object.material;
2250
+
2251
+ anisoField.setFloat(material.aniso);
2252
+ anisoVField.setFloat(material.anisoV);
2253
+
2254
+ materialtouched = true;
2255
+ applySelf();
2256
+ }
2257
+ });
2258
+ presetpanel.add(aniso3);
2259
+
2260
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF);
2261
+ velvet0.setToolTipText("Velvet");
2262
+ velvet0.addMouseListener(new MouseAdapter()
2263
+ {
2264
+ public void mouseClicked(MouseEvent e)
2265
+ {
2266
+ Object3D object = Grafreed.materials.versionlist[15].get(0);
2267
+ cMaterial material = object.material;
2268
+
2269
+ diffusenessField.setFloat(material.factor);
2270
+ selfshadowField.setFloat(material.diffuseness);
2271
+ sheenField.setFloat(material.sheen);
2272
+ shininessField.setFloat(material.shininess);
2273
+ velvetField.setFloat(material.velvet);
2274
+ shiftField.setFloat(material.shift);
2275
+
2276
+ materialtouched = true;
2277
+ applySelf();
2278
+ }
2279
+ });
2280
+ presetpanel.add(velvet0);
2281
+
2282
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF);
2283
+ bump0.setToolTipText("Bump texture");
2284
+ bump0.addMouseListener(new MouseAdapter()
2285
+ {
2286
+ public void mouseClicked(MouseEvent e)
2287
+ {
2288
+ Object3D object = Grafreed.materials.versionlist[16].get(0);
2289
+ cMaterial material = object.material;
2290
+
2291
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2292
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2293
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2294
+
2295
+ materialtouched = true;
2296
+ applySelf();
2297
+ }
2298
+ });
2299
+ presetpanel.add(bump0);
2300
+
2301
+ cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF);
2302
+ borderShader.setToolTipText("Border fade");
2303
+ borderShader.addMouseListener(new MouseAdapter()
2304
+ {
2305
+ public void mouseClicked(MouseEvent e)
2306
+ {
2307
+ borderfadeField.setFloat(0.5);
2308
+ opacityField.setFloat(0.75);
2309
+
2310
+ materialtouched = true;
2311
+ applySelf();
2312
+ }
2313
+ });
2314
+ presetpanel.add(borderShader);
2315
+
2316
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF);
2317
+ halo.setToolTipText("Halo");
2318
+ halo.addMouseListener(new MouseAdapter()
2319
+ {
2320
+ public void mouseClicked(MouseEvent e)
2321
+ {
2322
+ Object3D object = Grafreed.materials.versionlist[17].get(0);
2323
+ cMaterial material = object.material;
2324
+
2325
+ opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
2326
+
2327
+ materialtouched = true;
2328
+ applySelf();
2329
+ }
2330
+ });
2331
+ presetpanel.add(halo);
2332
+
2333
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF);
2334
+ candle.setToolTipText("Candle");
2335
+ candle.addMouseListener(new MouseAdapter()
2336
+ {
2337
+ public void mouseClicked(MouseEvent e)
2338
+ {
2339
+ Object3D object = Grafreed.materials.versionlist[18].get(0);
2340
+ cMaterial material = object.material;
2341
+
2342
+ subsurfaceField.setFloat(material.subsurface);
2343
+ shadowbiasField.setFloat(material.shadowbias);
2344
+ ambientField.setFloat(material.ambient);
2345
+ specularField.setFloat(material.specular);
2346
+ lightareaField.setFloat(material.lightarea);
2347
+ shininessField.setFloat(material.shininess);
2348
+
2349
+ materialtouched = true;
2350
+ applySelf();
2351
+ }
2352
+ });
2353
+ presetpanel.add(candle);
2354
+
2355
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF);
2356
+ shadowShader.setToolTipText("Shadow");
2357
+ shadowShader.addMouseListener(new MouseAdapter()
2358
+ {
2359
+ public void mouseClicked(MouseEvent e)
2360
+ {
2361
+ diffuseField.setFloat(0.001);
2362
+ ambientField.setFloat(0.001);
2363
+ cameraField.setFloat(0.001);
2364
+ specularField.setFloat(0.001);
2365
+ fakedepthField.setFloat(0.001);
2366
+ opacityField.setFloat(0.6);
2367
+
2368
+ materialtouched = true;
2369
+ applySelf();
2370
+ }
2371
+ });
2372
+ presetpanel.add(shadowShader);
2373
+
2374
+ cGridBag panel = new cGridBag().setVertical(true);
2375
+
2376
+ presetpanel.preferredWidth = 1;
2377
+
2378
+ materialpanel.add(presetpanel);
2379
+ materialpanel.add(panel);
2380
+
2381
+ panel.preferredWidth = 8;
2382
+
2383
+ /*
13772384 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13782385 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1379
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1380
- aConstraints.gridx += 1;
1381
- */
2386
+ */
13822387
1383
- aConstraints.gridwidth = 1;
1384
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- aConstraints.gridwidth = 1;
2388
+ cGridBag editBar = new cGridBag().setVertical(false);
2389
+
2390
+ editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints);
2391
+ createMaterialButton.setToolTipText("Create material");
13882392
13892393 /*
13902394 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1391
- aConstraints.gridx += 1;
1392
- aConstraints.weighty = 0;
1393
- aConstraints.gridwidth = 1;
13942395 */
13952396
1396
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1397
- aConstraints.gridx += 1;
2397
+ editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints);
2398
+ clearMaterialButton.setToolTipText("Clear material");
2399
+
2400
+ if (Globals.ADVANCED)
2401
+ {
2402
+ editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints);
2403
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
2404
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
2405
+ }
13982406
1399
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1400
-
1401
- aConstraints.gridx += 1;
1402
-
1403
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1404
-
1405
- aConstraints.gridx += 1;
1406
-
1407
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1408
-
1409
- aConstraints.gridx = 0;
1410
- aConstraints.gridy += 1;
1411
- aConstraints.weighty = 0;
1412
- aConstraints.gridwidth = 1;
2407
+ editBar.preferredHeight = 15;
2408
+
2409
+ panel.add(editBar);
2410
+
14132411 /**/
14142412 //aConstraints.weighty = 0;
14152413 ////aConstraints.weightx = 1;
14162414 //aConstraints.weighty = 1;
14172415 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14182416 //aConstraints.gridx += 1;
1419
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1420
- aConstraints.weighty = 0;
1421
- aConstraints.gridx = 0;
1422
- aConstraints.gridy += 1;
1423
- aConstraints.gridwidth = 1;
2417
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14242418
1425
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1426
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1427
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1428
- aConstraints.gridx += 1;
1429
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1430
- //aConstraints.weightx = 0;
1431
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1432
- aConstraints.gridx = 0;
1433
- aConstraints.gridy += 1;
1434
- aConstraints.gridwidth = 1;
2419
+ cGridBag colorSection = new cGridBag().setVertical(true);
14352420
1436
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1437
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1438
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1439
- aConstraints.gridx += 1;
1440
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1441
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1442
- aConstraints.gridx = 0;
1443
- aConstraints.gridy += 1;
1444
- aConstraints.gridwidth = 1;
2421
+ cGridBag huepanel = new cGridBag();
2422
+ cGridBag huelabel = new cGridBag();
2423
+ cLabel hue = GetLabel("icons/hue.png", false);
2424
+ hue.fit = true;
2425
+
2426
+ hue.addMouseListener(new MouseAdapter()
2427
+ {
2428
+ public void mousePressed(MouseEvent e)
2429
+ {
2430
+ int x = e.getX();
2431
+
2432
+ colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth());
2433
+ }
2434
+ });
2435
+
2436
+ huelabel.add(hue);
2437
+ huelabel.preferredWidth = 20;
2438
+ huepanel.add(new cGridBag()); // Label
2439
+ huepanel.add(huelabel); // Field/slider
2440
+
2441
+ huepanel.preferredHeight = 7;
14452442
1446
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1447
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1448
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1449
- aConstraints.gridx += 1;
1450
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1451
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1452
- aConstraints.gridx = 0;
1453
- aConstraints.gridy += 1;
1454
- aConstraints.gridwidth = 1;
2443
+ colorSection.add(huepanel);
2444
+
2445
+ cGridBag color = new cGridBag();
2446
+
2447
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
2448
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2449
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
14552450
1456
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1457
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1458
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1459
- aConstraints.gridx += 1;
1460
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1461
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1462
- aConstraints.gridx = 0;
1463
- aConstraints.gridy += 1;
1464
- aConstraints.gridwidth = 1;
2451
+ //colorField.preferredWidth = 200;
2452
+ colorSection.add(color);
14652453
1466
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1467
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1468
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1469
- aConstraints.gridx += 1;
1470
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1471
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1472
- aConstraints.gridx = 0;
1473
- aConstraints.gridy += 1;
1474
- aConstraints.gridwidth = 1;
2454
+ cGridBag modulation = new cGridBag();
2455
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
2456
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2457
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2458
+ colorSection.add(modulation);
14752459
1476
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1477
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1478
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1479
- aConstraints.gridx += 1;
1480
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1481
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1482
- aConstraints.gridx = 0;
1483
- aConstraints.gridy += 1;
1484
- aConstraints.gridwidth = 1;
2460
+ cGridBag opacity = new cGridBag();
2461
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
2462
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2463
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2464
+ colorSection.add(opacity);
14852465
1486
- //aConstraints.weighty = 1;
1487
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1488
- //aConstraints.gridx += 1;
1489
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1490
- aConstraints.weighty = 0;
1491
- aConstraints.gridx = 0;
1492
- aConstraints.gridy += 1;
1493
- aConstraints.gridwidth = 1;
2466
+ colorSection.add(GetSeparator());
2467
+
2468
+ cGridBag texture = new cGridBag();
2469
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
2470
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2471
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2472
+ colorSection.add(texture);
14942473
1495
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1496
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1497
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1498
- aConstraints.gridx += 1;
1499
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1500
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1501
- aConstraints.gridx = 0;
1502
- aConstraints.gridy += 1;
1503
- aConstraints.gridwidth = 1;
2474
+ panel.add(GetSeparator());
2475
+
2476
+ panel.add(colorSection);
2477
+
2478
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2479
+
2480
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
2481
+
2482
+ cGridBag diffuse = new cGridBag();
2483
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
2484
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2485
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2486
+ diffuseSection.add(diffuse);
15042487
1505
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1506
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1507
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1508
- aConstraints.gridx += 1;
1509
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1510
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1511
- aConstraints.gridx = 0;
1512
- aConstraints.gridy += 1;
1513
- aConstraints.gridwidth = 1;
2488
+ cGridBag diffuseness = new cGridBag();
2489
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
2490
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2491
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2492
+ diffuseSection.add(diffuseness);
15142493
1515
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1516
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1517
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1518
- aConstraints.gridx += 1;
1519
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1520
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1521
- aConstraints.gridx = 0;
1522
- aConstraints.gridy += 1;
1523
- aConstraints.gridwidth = 1;
2494
+ cGridBag selfshadow = new cGridBag();
2495
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
2496
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2497
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2498
+ diffuseSection.add(selfshadow);
15242499
1525
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1526
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1527
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1528
- aConstraints.gridx += 1;
1529
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1530
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1531
- aConstraints.gridx = 0;
1532
- aConstraints.gridy += 1;
1533
- aConstraints.gridwidth = 1;
2500
+ cGridBag sheen = new cGridBag();
2501
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
2502
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2503
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2504
+ diffuseSection.add(sheen);
15342505
1535
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1536
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1537
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1538
- aConstraints.gridx += 1;
1539
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1540
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1541
- aConstraints.gridx = 0;
1542
- aConstraints.gridy += 1;
1543
- aConstraints.gridwidth = 1;
2506
+ cGridBag subsurface = new cGridBag();
2507
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
2508
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2509
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2510
+ diffuseSection.add(subsurface);
15442511
1545
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1546
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1547
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1548
- aConstraints.gridx += 1;
1549
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1550
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1551
- aConstraints.gridx = 0;
1552
- aConstraints.gridy += 1;
1553
- aConstraints.gridwidth = 1;
2512
+ cGridBag shadow = new cGridBag();
2513
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
2514
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2515
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2516
+ diffuseSection.add(shadow);
15542517
1555
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1556
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1557
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1558
- aConstraints.gridx += 1;
1559
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1560
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1561
- aConstraints.gridx = 0;
1562
- aConstraints.gridy += 1;
1563
- aConstraints.gridwidth = 1;
2518
+ cGridBag fakedepth = new cGridBag();
2519
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
2520
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2521
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2522
+ diffuseSection.add(fakedepth);
15642523
1565
- //aConstraints.weighty = 1;
1566
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1567
- //aConstraints.gridx += 1;
1568
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1569
- aConstraints.weighty = 0;
1570
- aConstraints.gridx = 0;
1571
- aConstraints.gridy += 1;
1572
- aConstraints.gridwidth = 1;
2524
+ cGridBag shadowbias = new cGridBag();
2525
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
2526
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2527
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2528
+ diffuseSection.add(shadowbias);
15732529
1574
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1575
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1576
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1577
- aConstraints.gridx += 1;
1578
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1579
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1580
- aConstraints.gridx = 0;
1581
- aConstraints.gridy += 1;
1582
- aConstraints.gridwidth = 1;
2530
+ panel.add(GetSeparator());
2531
+
2532
+ panel.add(diffuseSection);
2533
+
2534
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2535
+
2536
+ cGridBag specularSection = new cGridBag().setVertical(true);
15832537
1584
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1585
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1586
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1587
- aConstraints.gridx += 1;
1588
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1589
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1590
- aConstraints.gridx = 0;
1591
- aConstraints.gridy += 1;
1592
- aConstraints.gridwidth = 1;
2538
+ cGridBag specular = new cGridBag();
2539
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
2540
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2541
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2542
+ specularSection.add(specular);
15932543
1594
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1595
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1596
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1597
- aConstraints.gridx += 1;
1598
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1599
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1600
- aConstraints.gridx = 0;
1601
- aConstraints.gridy += 1;
1602
- aConstraints.gridwidth = 1;
2544
+ cGridBag lightarea = new cGridBag();
2545
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
2546
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2547
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2548
+ specularSection.add(lightarea);
16032549
1604
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1605
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1606
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1607
- aConstraints.gridx += 1;
1608
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1609
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1610
- aConstraints.gridx = 0;
1611
- aConstraints.gridy += 1;
1612
- aConstraints.gridwidth = 1;
2550
+ cGridBag shininess = new cGridBag();
2551
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
2552
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2553
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2554
+ specularSection.add(shininess);
16132555
1614
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1615
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1616
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1617
- aConstraints.gridx += 1;
1618
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1619
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1620
- aConstraints.gridx = 0;
1621
- aConstraints.gridy += 1;
1622
- aConstraints.gridwidth = 1;
2556
+ cGridBag metalness = new cGridBag();
2557
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
2558
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2559
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2560
+ specularSection.add(metalness);
16232561
1624
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1625
- Return();
2562
+ cGridBag velvet = new cGridBag();
2563
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
2564
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2565
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2566
+ specularSection.add(velvet);
2567
+
2568
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
2569
+ //Return();
16262570 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16272571 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16282572 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1633,130 +2577,99 @@
16332577 // aConstraints.gridy += 1;
16342578 // aConstraints.gridwidth = 1;
16352579
1636
- //aConstraints.weighty = 1;
1637
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1638
- //aConstraints.gridx += 1;
1639
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1640
- aConstraints.weighty = 0;
1641
- aConstraints.gridx = 0;
1642
- aConstraints.gridy += 1;
1643
- aConstraints.gridwidth = 1;
2580
+ cGridBag anisoU = new cGridBag();
2581
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
2582
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2583
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2584
+ specularSection.add(anisoU);
16442585
1645
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1646
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1647
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1648
- aConstraints.gridx += 1;
1649
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1650
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1651
- aConstraints.gridx = 0;
1652
- aConstraints.gridy += 1;
1653
- aConstraints.gridwidth = 1;
2586
+ cGridBag anisoV = new cGridBag();
2587
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
2588
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2589
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2590
+ specularSection.add(anisoV);
16542591
1655
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1656
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1657
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1658
- aConstraints.gridx += 1;
1659
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1660
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1661
- aConstraints.gridx = 0;
1662
- aConstraints.gridy += 1;
1663
- aConstraints.gridwidth = 1;
16642592
1665
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1666
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1667
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1668
- aConstraints.gridx += 1;
1669
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1670
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1671
- aConstraints.gridx = 0;
1672
- aConstraints.gridy += 1;
1673
- aConstraints.gridwidth = 1;
2593
+ panel.add(GetSeparator());
2594
+
2595
+ panel.add(specularSection);
2596
+
2597
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2598
+
2599
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16742600
1675
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1676
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1677
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1678
- aConstraints.gridx += 1;
1679
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1680
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1681
- aConstraints.gridx = 0;
1682
- aConstraints.gridy += 1;
1683
- aConstraints.gridwidth = 1;
1684
- aConstraints.weighty = 0;
2601
+ cGridBag camera = new cGridBag();
2602
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
2603
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2604
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2605
+ colorSection.add(camera);
16852606
1686
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1687
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1688
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1689
- aConstraints.gridx += 1;
1690
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1691
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1692
- aConstraints.gridx = 0;
1693
- aConstraints.gridy += 1;
1694
- aConstraints.gridwidth = 1;
2607
+ cGridBag ambient = new cGridBag();
2608
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
2609
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2610
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2611
+ colorSection.add(ambient);
16952612
1696
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1697
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1698
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1699
- aConstraints.gridx += 1;
1700
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1701
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1702
- aConstraints.gridx = 0;
1703
- aConstraints.gridy += 1;
1704
- aConstraints.gridwidth = 1;
2613
+ cGridBag backlit = new cGridBag();
2614
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
2615
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2616
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2617
+ colorSection.add(backlit);
17052618
1706
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1707
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1708
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1709
- aConstraints.gridx += 1;
1710
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1711
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1712
- aConstraints.gridx = 0;
1713
- aConstraints.gridy += 1;
1714
- aConstraints.gridwidth = 1;
2619
+ //panel.add(new JSeparator());
2620
+
2621
+ //panel.add(globalSection);
2622
+
2623
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2624
+
2625
+ cGridBag textureSection = new cGridBag().setVertical(true);
17152626
1716
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1717
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1718
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1719
- aConstraints.gridx += 1;
1720
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1721
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1722
- aConstraints.gridx = 0;
1723
- aConstraints.gridy += 1;
1724
- aConstraints.gridwidth = 1;
2627
+ cGridBag bump = new cGridBag();
2628
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
2629
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2630
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
2631
+ textureSection.add(bump);
17252632
1726
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1727
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1728
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1729
- aConstraints.gridx += 1;
1730
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1731
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1732
- aConstraints.gridx = 0;
1733
- aConstraints.gridy += 1;
1734
- aConstraints.gridwidth = 1;
2633
+ cGridBag noise = new cGridBag();
2634
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
2635
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2636
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
2637
+ textureSection.add(noise);
17352638
1736
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1737
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1738
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1739
- aConstraints.gridx += 1;
1740
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1741
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1742
- aConstraints.gridx = 0;
1743
- aConstraints.gridy += 1;
1744
- aConstraints.gridwidth = 1;
2639
+ cGridBag power = new cGridBag();
2640
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
2641
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2642
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
2643
+ textureSection.add(power);
17452644
1746
- //aConstraints.weighty = 1;
1747
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1748
- //aConstraints.gridx += 1;
1749
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1750
- aConstraints.weighty = 0;
2645
+ cGridBag borderfade = new cGridBag();
2646
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
2647
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2648
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
2649
+ textureSection.add(borderfade);
17512650
1752
- aConstraints.gridx = 0;
1753
- aConstraints.gridy = 0;
1754
- aConstraints.gridwidth = 1;
2651
+ cGridBag fog = new cGridBag();
2652
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
2653
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2654
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
2655
+ textureSection.add(fog);
2656
+
2657
+ cGridBag opacityPower = new cGridBag();
2658
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
2659
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2660
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
2661
+ textureSection.add(opacityPower);
2662
+
2663
+ panel.add(GetSeparator());
2664
+
2665
+ panel.add(textureSection);
2666
+
2667
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17552668
17562669 SetMaterial(copy); // .GetMaterial());
17572670
1758
- colorField.addChangeListener(this);
1759
- modulationField.addChangeListener(this);
2671
+ //colorField.addChangeListener(this);
2672
+// modulationField.addChangeListener(this);
17602673 metalnessField.addChangeListener(this);
17612674 diffuseField.addChangeListener(this);
17622675 specularField.addChangeListener(this);
....@@ -1786,12 +2699,15 @@
17862699 opacityPowerField.addChangeListener(this);
17872700 /**/
17882701
1789
- resetSlidersButton.addActionListener(this);
17902702 clearMaterialButton.addActionListener(this);
17912703 createMaterialButton.addActionListener(this);
1792
-
1793
- propagateToggle.addItemListener(this);
1794
- multiplyToggle.addItemListener(this);
2704
+
2705
+ if (Globals.ADVANCED)
2706
+ {
2707
+ resetSlidersButton.addActionListener(this);
2708
+ propagateToggle.addItemListener(this);
2709
+ multiplyToggle.addItemListener(this);
2710
+ }
17952711 }
17962712
17972713 void DropFile(java.io.File[] files, boolean textures)
....@@ -1809,8 +2725,9 @@
18092725 // 3D models
18102726 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18112727 {
1812
- lastConverter = new com.jmex.model.converters.MaxToJme();
1813
- LoadFile(filename, lastConverter);
2728
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2729
+ //LoadFile(filename, lastConverter);
2730
+ LoadObjFile(filename); // New 3ds loader
18142731 continue;
18152732 }
18162733 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1962,7 +2879,7 @@
19622879
19632880 //? flashIt = false;
19642881 CameraPane pane = (CameraPane) cameraView;
1965
- pane.clickStart(location.x, location.y, 0);
2882
+ pane.clickStart(location.x, location.y, 0, 0);
19662883 pane.clickEnd(location.x, location.y, 0, true);
19672884
19682885 if (group.selection.size() == 1)
....@@ -2011,6 +2928,7 @@
20112928 e2.printStackTrace();
20122929 }
20132930 }
2931
+
20142932 LoadJMEThread loadThread;
20152933
20162934 class LoadJMEThread extends Thread
....@@ -2068,6 +2986,7 @@
20682986 //LoadFile0(filename, converter);
20692987 }
20702988 }
2989
+
20712990 LoadOBJThread loadObjThread;
20722991
20732992 class LoadOBJThread extends Thread
....@@ -2146,19 +3065,19 @@
21463065
21473066 void LoadObjFile(String fullname)
21483067 {
2149
- /*
3068
+ System.out.println("Loading " + fullname);
3069
+ /**/
21503070 //lastFilename = fullname;
21513071 if(loadObjThread == null)
21523072 {
2153
- loadObjThread = new LoadOBJThread();
2154
- loadObjThread.start();
3073
+ loadObjThread = new LoadOBJThread();
3074
+ loadObjThread.start();
21553075 }
21563076
21573077 loadObjThread.add(fullname);
2158
- */
3078
+ /**/
21593079
2160
- System.out.println("Loading " + fullname);
2161
- makeSomething(new FileObject(fullname, true), true);
3080
+ //makeSomething(new FileObject(fullname, true), true);
21623081 }
21633082
21643083 void LoadGFDFile(String fullname)
....@@ -2419,11 +3338,11 @@
24193338
24203339 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24213340 {
2422
- if (GrafreeD.standAlone)
3341
+ if (Grafreed.standAlone)
24233342 {
24243343 /**/
24253344 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2426
- browser.show();
3345
+ browser.setVisible(true);
24273346 String filename = browser.getFile();
24283347 if (filename != null && filename.length() > 0)
24293348 {
....@@ -2534,6 +3453,7 @@
25343453 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25353454 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25363455 }
3456
+
25373457 //cJME.count++;
25383458 //cJME.count %= 12;
25393459 if (gc)
....@@ -2568,6 +3488,7 @@
25683488 }
25693489 if (input == null)
25703490 {
3491
+ new Exception().printStackTrace();
25713492 System.exit(0);
25723493 }
25733494
....@@ -2716,6 +3637,7 @@
27163637 }
27173638 }
27183639 }
3640
+
27193641 cFileSystemPane FSPane;
27203642
27213643 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2725,7 +3647,7 @@
27253647
27263648 freezematerial = true;
27273649 colorField.setFloat(mat.color);
2728
- modulationField.setFloat(mat.modulation);
3650
+ saturationField.setFloat(mat.modulation);
27293651 metalnessField.setFloat(mat.metalness);
27303652 diffuseField.setFloat(mat.diffuse);
27313653 specularField.setFloat(mat.specular);
....@@ -2769,11 +3691,14 @@
27693691 }
27703692 }
27713693 }
3694
+
27723695 freezematerial = false;
27733696 }
27743697
27753698 void SetMaterial(Object3D object)
27763699 {
3700
+ latestObject = object;
3701
+
27773702 cMaterial mat = object.material;
27783703
27793704 if (mat == null)
....@@ -2782,33 +3707,10 @@
27823707 return;
27833708 }
27843709
2785
- multiplyToggle.setSelected(mat.multiply);
2786
-
2787
- assert (object.projectedVertices != null);
2788
-
2789
- if (object.projectedVertices.length <= 2)
2790
- {
2791
- // Side effect...
2792
- Object3D.cVector2[] keep = object.projectedVertices;
2793
- object.projectedVertices = new Object3D.cVector2[3];
2794
- for (int i = 0; i < 3; i++)
2795
- {
2796
- if (i < keep.length)
2797
- {
2798
- object.projectedVertices[i] = keep[i];
2799
- } else
2800
- {
2801
- object.projectedVertices[i] = new Object3D.cVector2();
2802
- }
2803
- /*
2804
- if(keep.length == 0)
2805
- object.projectedVertices[0] = new Object3D.cVector2();
2806
- else
2807
- object.projectedVertices[0] = keep[0];
2808
- object.projectedVertices[1] = new Object3D.cVector2();
2809
- */
2810
- }
2811
- }
3710
+ if (multiplyToggle != null)
3711
+ multiplyToggle.setSelected(mat.multiply);
3712
+
3713
+ AllocProjectedVertices(object);
28123714
28133715 SetMaterial(mat, object.projectedVertices);
28143716 }
....@@ -2884,12 +3786,17 @@
28843786 // }
28853787
28863788 /**/
2887
- if (deselect)
3789
+ if (deselect || child == null)
28883790 {
28893791 //group.deselectAll();
28903792 //freeze = true;
28913793 GetTree().clearSelection();
28923794 //freeze = false;
3795
+
3796
+ if (child == null)
3797
+ {
3798
+ return;
3799
+ }
28933800 }
28943801
28953802 //group.addSelectee(child);
....@@ -2923,6 +3830,17 @@
29233830 public void itemStateChanged(ItemEvent event)
29243831 {
29253832 // System.out.println("Propagate = " + propagate);
3833
+ if (event.getSource() == pinButton)
3834
+ {
3835
+ copy.pinned ^= true;
3836
+ if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
3837
+ {
3838
+ ((GroupEditor)copy.editWindow).listUI.remove(copy);
3839
+ copy.CloseUI();
3840
+ //copy.editWindow.refreshContents();
3841
+ }
3842
+ }
3843
+ else
29263844 if (event.getSource() == propagateToggle)
29273845 {
29283846 propagate ^= true;
....@@ -2958,7 +3876,7 @@
29583876 cameraView.ToggleDL();
29593877 cameraView.repaint();
29603878 return;
2961
- } else if (event.getSource() == toggleTextureItem)
3879
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29623880 {
29633881 cameraView.ToggleTexture();
29643882 // june 2013 copy.HardTouch();
....@@ -2966,42 +3884,40 @@
29663884 return;
29673885 } else if (event.getSource() == toggleTimelineItem)
29683886 {
2969
- copy.timeline ^= true;
3887
+ timeline ^= true;
29703888
2971
- if (copy.timeline)
3889
+ if (timeline)
29723890 {
29733891 centralPanel.remove(cameraView);
2974
- centralPanel.add(timelinePanel);
3892
+ cameraPanel.add(cameraView);
3893
+ centralPanel.add(cameraPanel);
29753894 frame.setJMenuBar(timelineMenubar);
3895
+ wasFullScreen = CameraPane.FULLSCREEN;
3896
+ if (!CameraPane.FULLSCREEN)
3897
+ ToggleFullScreen();
3898
+ toggleFullScreenItem.setEnabled(false);
29763899 }
29773900 else
29783901 {
2979
- centralPanel.remove(timelinePanel);
3902
+ centralPanel.remove(cameraPanel);
29803903 centralPanel.add(cameraView);
29813904 frame.setJMenuBar(null);
3905
+ if (!wasFullScreen)
3906
+ ToggleFullScreen();
3907
+ toggleFullScreenItem.setEnabled(true);
29823908 }
29833909
29843910 frame.validate();
29853911 return;
29863912 } else if (event.getSource() == toggleFullScreenItem)
29873913 {
2988
- if (CameraPane.FULLSCREEN)
2989
- {
2990
- frame.getContentPane().remove(/*"Center",*/bigThree);
2991
- framePanel.add(bigThree);
2992
- frame.getContentPane().add(/*"Center",*/framePanel);
2993
- } else
2994
- {
2995
- frame.getContentPane().remove(/*"Center",*/framePanel);
2996
- frame.getContentPane().add(/*"Center",*/bigThree);
2997
- }
3914
+ ToggleFullScreen();
29983915 frame.validate();
2999
- cameraView.ToggleFullScreen();
30003916
30013917 return;
3002
- } else if (event.getSource() == toggleRandomItem)
3918
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30033919 {
3004
- cameraView.ToggleRandom();
3920
+ cameraView.ToggleSwitch();
30053921 cameraView.repaint();
30063922 return;
30073923 } else if (event.getSource() == toggleHandleItem)
....@@ -3029,12 +3945,17 @@
30293945 } else if (event.getSource() == liveCB)
30303946 {
30313947 copy.live ^= true;
3948
+ objEditor.refreshContents(true); // To show item colors
3949
+ return;
3950
+ } else if (event.getSource() == selectableCB)
3951
+ {
3952
+ copy.dontselect ^= true;
30323953 return;
30333954 } else if (event.getSource() == hideCB)
30343955 {
30353956 copy.hide ^= true;
30363957 copy.Touch(); // display list issue
3037
- objEditor.refreshContents();
3958
+ objEditor.refreshContents(true); // To show item colors
30383959 return;
30393960 } else if (event.getSource() == link2masterCB)
30403961 {
....@@ -3044,6 +3965,7 @@
30443965 if (event.getSource() == randomCB)
30453966 {
30463967 copy.random ^= true;
3968
+ objEditor.refreshContents();
30473969 return;
30483970 }
30493971 if (event.getSource() == speedupCB)
....@@ -3067,8 +3989,9 @@
30673989
30683990 public void actionPerformed(ActionEvent event)
30693991 {
3992
+ Object source = event.getSource();
30703993 // SCRIPT DIALOG
3071
- if (event.getSource() == okbutton)
3994
+ if (source == okbutton)
30723995 {
30733996 textpanel.setVisible(false);
30743997 textpanel.remove(textarea);
....@@ -3080,7 +4003,7 @@
30804003 textarea = null;
30814004 textpanel = null;
30824005 }
3083
- if (event.getSource() == cancelbutton)
4006
+ if (source == cancelbutton)
30844007 {
30854008 textpanel.setVisible(false);
30864009 textpanel.remove(textarea);
....@@ -3092,49 +4015,50 @@
30924015 //applySelf();
30934016 //client.refreshEditWindow();
30944017 //refreshContents();
3095
- if (event.getSource() == nameField)
4018
+ if (source == nameField)
30964019 {
30974020 //System.out.println("ObjEditor " + event);
30984021 applySelf0(true);
30994022 //parent.applySelf();
3100
- objEditor.refreshContents();
3101
- } else if (event.getSource() == resetButton)
4023
+ // conflicts with requestFocus objEditor.refreshContents();
4024
+ } else if (source == resetButton)
31024025 {
31034026 CameraPane.fullreset = true;
31044027 copy.Reset(); // ResetMeshes();
31054028 copy.Touch();
31064029 objEditor.refreshContents();
3107
- } else if (event.getSource() == stepItem)
4030
+ } else if (source == stepItem)
31084031 {
3109
- cameraView.ONESTEP = true;
4032
+ //cameraView.ONESTEP = true;
4033
+ Globals.ONESTEP = true;
31104034 cameraView.repaint();
31114035 return;
3112
- } else if (event.getSource() == stepButton)
4036
+ } else if (source == stepButton)
31134037 {
31144038 copy.Step();
31154039 copy.Touch();
31164040 objEditor.refreshContents();
3117
- } else if (event.getSource() == slowerButton)
4041
+ } else if (source == slowerButton)
31184042 {
31194043 copy.Slower();
31204044 copy.Touch();
31214045 objEditor.refreshContents();
3122
- } else if (event.getSource() == fasterButton)
4046
+ } else if (source == fasterButton)
31234047 {
31244048 copy.Faster();
31254049 copy.Touch();
31264050 objEditor.refreshContents();
3127
- } else if (event.getSource() == remarkButton)
4051
+ } else if (source == remarkButton)
31284052 {
31294053 copy.Remark();
31304054 copy.Touch();
31314055 objEditor.refreshContents();
3132
- } else if (event.getSource() == stepAllButton)
4056
+ } else if (source == stepAllButton)
31334057 {
31344058 copy.StepAll();
31354059 copy.Touch();
31364060 objEditor.refreshContents();
3137
- } else if (event.getSource() == resetAllButton)
4061
+ } else if (source == resetAllButton)
31384062 {
31394063 //CameraPane.fullreset = true;
31404064 copy.ResetAll(); // ResetMeshes();
....@@ -3167,53 +4091,79 @@
31674091 // Close();
31684092 // }
31694093 // else
3170
- if (event.getSource() == resetSlidersButton)
4094
+ if (source == resetSlidersButton)
31714095 {
31724096 ResetSliders();
3173
- } else if (event.getSource() == clearMaterialButton)
4097
+ } else if (source == clearMaterialButton)
31744098 {
31754099 ClearMaterial();
3176
- } else if (event.getSource() == createMaterialButton)
4100
+ } else if (source == createMaterialButton)
31774101 {
31784102 CreateMaterial();
3179
- } else if (event.getSource() == clearPanelButton)
4103
+ } else if (source == clearPanelButton)
31804104 {
31814105 copy.ClearUI();
31824106 refreshContents(true);
3183
- } /*
3184
- }
3185
-
3186
- public boolean action(Event event, Object arg)
3187
- {
3188
- */ else if (event.getSource() == closeItem)
4107
+ } else if (source == importGFDItem)
4108
+ {
4109
+ ImportGFD();
4110
+ } else
4111
+ if (source == importVRMLX3DItem)
4112
+ {
4113
+ ImportVRMLX3D();
4114
+ } else
4115
+ if (source == import3DSItem)
4116
+ {
4117
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
4118
+ } else
4119
+ if (source == importOBJItem)
4120
+ {
4121
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
4122
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
4123
+ browser.setVisible(true);
4124
+ String filename = browser.getFile();
4125
+ if (filename != null && filename.length() > 0)
4126
+ {
4127
+ String fullname = browser.getDirectory() + filename;
4128
+ makeSomething(ReadOBJ(fullname), true);
4129
+ }
4130
+ } else
4131
+ if (source == closeItem)
31894132 {
31904133 Close();
31914134 //return true;
3192
- } else if (event.getSource() == loadItem)
4135
+ } else if (source == openItem)
31934136 {
3194
- load();
4137
+ Open();
31954138 //return true;
3196
- } else if (event.getSource() == saveItem)
4139
+ } else if (source == newItem)
4140
+ {
4141
+ New();
4142
+ } else if (source == saveItem)
31974143 {
31984144 save();
31994145 //return true;
3200
- } else if (event.getSource() == saveAsItem)
4146
+ } else if (source == saveAsItem)
32014147 {
32024148 saveAs();
32034149 //return true;
3204
- } else if (event.getSource() == reexportItem)
4150
+ } else if (source == reexportItem)
32054151 {
32064152 reexport();
32074153 //return true;
3208
- } else if (event.getSource() == exportAsItem)
4154
+ } else if (source == exportAsItem)
32094155 {
32104156 export();
32114157 //return true;
3212
- } else if (event.getSource() == povItem)
4158
+ } else if (source == povItem)
32134159 {
32144160 generatePOV();
32154161 //return true;
3216
- } else if (event.getSource() == zBufferItem)
4162
+ } else if (event.getSource() == archiveItem)
4163
+ {
4164
+ cTools.Archive(frame);
4165
+ return;
4166
+ } else if (source == zBufferItem)
32174167 {
32184168 try
32194169 {
....@@ -3235,21 +4185,8 @@
32354185 cameraView.repaint();
32364186 //return true;
32374187 }
3238
- */ else if (event.getSource() == editCameraItem)
3239
- {
3240
- cameraView.ProtectCamera();
3241
- cameraView.repaint();
3242
- return;
3243
- } else if (event.getSource() == revertCameraItem)
3244
- {
3245
- cameraView.RevertCamera();
3246
- cameraView.repaint();
3247
- return;
3248
-// } else if (event.getSource() == textureButton)
3249
-// {
3250
-// return; // true;
3251
- } else // combos...
3252
- if (event.getSource() == texresMenu)
4188
+ */ else // combos...
4189
+ if (source == texresMenu)
32534190 {
32544191 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32554192 copy.texres = texresMenu.getSelectedIndex();
....@@ -3261,27 +4198,518 @@
32614198 }
32624199 }
32634200
3264
- void ToggleAnimation()
4201
+ void New()
32654202 {
3266
- if (!CameraPane.ANIMATION)
4203
+ while (copy.Size() > 0)
32674204 {
3268
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
4205
+ copy.remove(0);
4206
+ }
4207
+
4208
+ copy.selection.clear();
4209
+
4210
+ if (copy == Grafreed.grafreed.universe)
4211
+ {
4212
+ CreateCameras();
4213
+ cameraView.SetCamera(GetCamera(copy, 0));
4214
+ }
4215
+ ResetModel();
4216
+ objEditor.refreshContents();
4217
+ }
4218
+
4219
+ static public byte[] Compress(Object3D o)
4220
+ {
4221
+ // Slower to actually compress.
4222
+ try
4223
+ {
4224
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
4225
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
4226
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
4227
+
4228
+ Object3D parent = o.parent;
4229
+ o.parent = null;
4230
+
4231
+ out.writeObject(o);
4232
+
4233
+ o.parent = parent;
4234
+
4235
+ out.flush();
4236
+
4237
+ baos //zstream
4238
+ .close();
4239
+ out.close();
4240
+
4241
+ byte[] bytes = baos.toByteArray();
4242
+
4243
+ System.out.println("save #bytes = " + bytes.length);
4244
+ return bytes;
4245
+ } catch (Exception e)
4246
+ {
4247
+ System.err.println(e);
4248
+ return null;
4249
+ }
4250
+ }
4251
+
4252
+ static public Object Uncompress(byte[] bytes)
4253
+ {
4254
+ System.out.println("restore #bytes = " + bytes.length);
4255
+ try
4256
+ {
4257
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
4258
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
4259
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
4260
+ Object obj = in.readObject();
4261
+
4262
+ bais //istream
4263
+ .close();
4264
+ in.close();
4265
+
4266
+ return obj;
4267
+ } catch (Exception e)
4268
+ {
4269
+ System.err.println(e);
4270
+ return null;
4271
+ }
4272
+ }
4273
+
4274
+ static public Object clone(Object o)
4275
+ {
4276
+ try
4277
+ {
4278
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
4279
+ ObjectOutputStream out = new ObjectOutputStream(baos);
4280
+
4281
+ out.writeObject(o);
4282
+
4283
+ out.flush();
4284
+ out.close();
4285
+
4286
+ byte[] bytes = baos.toByteArray();
4287
+
4288
+ System.out.println("clone = " + bytes.length);
4289
+
4290
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
4291
+ ObjectInputStream in = new ObjectInputStream(bais);
4292
+ Object obj = in.readObject();
4293
+ in.close();
4294
+
4295
+ return obj;
4296
+ } catch (Exception e)
4297
+ {
4298
+ System.err.println(e);
4299
+ return null;
4300
+ }
4301
+ }
4302
+
4303
+ cRadio GetCurrentTab()
4304
+ {
4305
+ cRadio ab;
4306
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
4307
+ {
4308
+ ab = (cRadio)e.nextElement();
4309
+ if(ab.GetObject() == copy)
4310
+ {
4311
+ return ab;
4312
+ }
4313
+ }
4314
+
4315
+ return null;
4316
+ }
4317
+
4318
+
4319
+ public void Save()
4320
+ {
4321
+ //Save(true);
4322
+ Replace();
4323
+ SetVersionStates();
4324
+ }
4325
+
4326
+ private boolean Equal(byte[] compress, byte[] name)
4327
+ {
4328
+ if (compress.length != name.length)
4329
+ {
4330
+ return false;
4331
+ }
4332
+
4333
+ for (int i=compress.length; --i>=0;)
4334
+ {
4335
+ if (compress[i] != name[i])
4336
+ return false;
4337
+ }
4338
+
4339
+ return true;
4340
+ }
4341
+
4342
+ void DeleteVersion()
4343
+ {
4344
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
4345
+ {
4346
+ copy.versionlist[i] = copy.versionlist[i+1];
4347
+ }
4348
+
4349
+ if (copy.versionlist[copy.versionindex] == null)
4350
+ copy.versionindex -= 1;
4351
+
4352
+ if (copy.versionindex != -1)
4353
+ CopyChanged();
4354
+
4355
+ SetVersionStates();
4356
+ }
4357
+
4358
+ public boolean Save(boolean user)
4359
+ {
4360
+ System.err.println("Save");
4361
+ Replace();
4362
+
4363
+ //cRadio tab = GetCurrentTab();
4364
+
4365
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
4366
+
4367
+ boolean thesame = false;
4368
+
4369
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
4370
+// {
4371
+// thesame = true;
4372
+// }
4373
+
4374
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
4375
+ if (!thesame)
4376
+ {
4377
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4378
+ {
4379
+ copy.versionlist[i] = copy.versionlist[i-1];
4380
+ }
4381
+
4382
+ //tab.user[tab.versionindex] = user;
4383
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
4384
+
4385
+ copy.versionlist[++copy.versionindex] = compress;
4386
+
4387
+ // if (increment)
4388
+ // tab.versionindex++;
4389
+ }
4390
+
4391
+ //copy.RestoreBigData(versiontable);
4392
+
4393
+ //assert(hashtable.isEmpty());
4394
+
4395
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4396
+// {
4397
+// //tab.user[i] = false;
4398
+// copy.versionlist[i] = null;
4399
+// }
4400
+
4401
+ SetVersionStates();
4402
+
4403
+ // test save
4404
+ if (false)
4405
+ {
4406
+ try
4407
+ {
4408
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
4409
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
4410
+
4411
+ p.writeObject(copy);
4412
+
4413
+ p.flush();
4414
+
4415
+ ostream.close();
4416
+ } catch (Exception e)
4417
+ {
4418
+ e.printStackTrace();
4419
+ }
4420
+ }
4421
+
4422
+ return !thesame;
4423
+ }
4424
+
4425
+ boolean flashIt = true;
4426
+
4427
+ void RefreshSelection()
4428
+ {
4429
+ Object3D selection = new Object3D();
4430
+
4431
+ for (int i = 0; i < copy.selection.size(); i++)
4432
+ {
4433
+ Object3D elem = copy.selection.elementAt(i);
4434
+
4435
+ Object3D obj = copy.GetObject(elem.GetUUID());
4436
+
4437
+ if (obj == null)
4438
+ {
4439
+ copy.selection.remove(i--);
4440
+ }
4441
+ else
4442
+ {
4443
+ selection.add(obj);
4444
+ copy.selection.setElementAt(obj, i);
4445
+ }
4446
+ }
4447
+
4448
+ flashIt = false;
4449
+ GetTree().clearSelection();
4450
+ for (int i = 0; i < selection.size(); i++)
4451
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
4452
+ flashIt = true;
4453
+
4454
+ //refreshContents(false);
4455
+ }
4456
+
4457
+ void CopyChanged()
4458
+ {
4459
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4460
+
4461
+ SetVersionStates();
4462
+
4463
+ boolean temp = CameraPane.SWITCH;
4464
+ CameraPane.SWITCH = false;
4465
+
4466
+ copy.ExtractBigData(Grafreed.grafreed.universe.versiontable);
4467
+
4468
+ copy.clear();
4469
+
4470
+ copy.skyboxname = obj.skyboxname;
4471
+ copy.skyboxext = obj.skyboxext;
4472
+
4473
+ for (int i=0; i<obj.Size(); i++)
4474
+ {
4475
+ copy.add(obj.get(i));
4476
+ }
4477
+
4478
+ copy.RestoreBigData(Grafreed.grafreed.universe.versiontable);
4479
+
4480
+ CameraPane.SWITCH = temp;
4481
+
4482
+ RefreshSelection();
4483
+ //assert(hashtable.isEmpty());
4484
+
4485
+ copy.Touch();
4486
+
4487
+ ResetModel();
4488
+ copy.HardTouch(); // recompile?
4489
+
4490
+ cRadio ab;
4491
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
4492
+ {
4493
+ ab = (cRadio)e.nextElement();
4494
+ Object3D test = copy.GetObject(ab.object.GetUUID());
4495
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
4496
+ if (test != null)
4497
+ {
4498
+ test.editWindow = ab.object.editWindow;
4499
+ ab.object = test;
4500
+ }
4501
+ }
4502
+
4503
+ refreshContents(true);
4504
+ }
4505
+
4506
+ cButton previousVersionButton;
4507
+ cButton restoreButton;
4508
+ cButton replaceButton;
4509
+ cButton nextVersionButton;
4510
+ cButton saveVersionButton;
4511
+ cButton deleteVersionButton;
4512
+
4513
+ boolean muteSlider;
4514
+
4515
+ int VersionCount()
4516
+ {
4517
+ int count = 0;
4518
+
4519
+ for (int i = copy.versionlist.length; --i >= 0;)
4520
+ {
4521
+ if (copy.versionlist[i] != null)
4522
+ count++;
4523
+ }
4524
+
4525
+ return count;
4526
+ }
4527
+
4528
+ public cGridBag versionSliderPane;
4529
+
4530
+ void SetVersionStates()
4531
+ {
4532
+ //if (true)
4533
+ // return;
4534
+
4535
+ //cRadio tab = GetCurrentTab();
4536
+
4537
+ if (copy.versionlist == null)
4538
+ {
4539
+ saveVersionButton.setEnabled(false);
4540
+ restoreButton.setEnabled(false);
4541
+ replaceButton.setEnabled(false);
4542
+ previousVersionButton.setEnabled(false);
4543
+ nextVersionButton.setEnabled(false);
4544
+ deleteVersionButton.setEnabled(false);
4545
+ versionSliderPane.setVisible(false);
4546
+ }
4547
+ else
4548
+ {
4549
+ restoreButton.setEnabled(copy.versionindex != -1);
4550
+ replaceButton.setEnabled(copy.versionindex != -1);
4551
+
4552
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4553
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4554
+
4555
+ deleteVersionButton.setEnabled(copy.versionindex != -1);
4556
+ //copy.versionlist[copy.versionindex + 1] != null);
4557
+
4558
+ muteSlider = true;
4559
+ versionSlider.setMinimum(0);
4560
+ versionSlider.setMaximum(VersionCount() - 1);
4561
+ versionSlider.setInteger(copy.versionindex);
4562
+ versionSlider.setEnabled(copy.versionindex != -1);
4563
+ muteSlider = false;
4564
+
4565
+ versionSliderPane.setVisible(true);
4566
+ }
4567
+ }
4568
+
4569
+ public boolean PreviousVersion()
4570
+ {
4571
+ // Option?
4572
+ Replace();
4573
+
4574
+ System.err.println("Undo");
4575
+
4576
+ //cRadio tab = GetCurrentTab();
4577
+
4578
+ if (copy.versionindex == 0)
4579
+ {
4580
+ java.awt.Toolkit.getDefaultToolkit().beep();
4581
+ return false;
4582
+ }
4583
+
4584
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
4585
+// {
4586
+// if (Save(false))
4587
+// tab.versionindex -= 1;
4588
+// else
4589
+// {
4590
+// if (tab.versionindex <= 0)
4591
+// return false;
4592
+// else
4593
+// tab.versionindex -= 1;
4594
+// }
4595
+// }
4596
+
4597
+ copy.versionindex -= 1;
4598
+
4599
+ CopyChanged();
4600
+
4601
+ return true;
4602
+ }
4603
+
4604
+ public boolean Restore()
4605
+ {
4606
+ System.err.println("Restore");
4607
+
4608
+ //cRadio tab = GetCurrentTab();
4609
+
4610
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4611
+ {
4612
+ java.awt.Toolkit.getDefaultToolkit().beep();
4613
+ return false;
4614
+ }
4615
+
4616
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4617
+ CopyChanged();
4618
+
4619
+ return true;
4620
+ }
4621
+
4622
+ public boolean Replace()
4623
+ {
4624
+ //System.err.println("Replace");
4625
+
4626
+ //cRadio tab = GetCurrentTab();
4627
+
4628
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4629
+ {
4630
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
4631
+ return false;
4632
+ }
4633
+
4634
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
4635
+
4636
+ return true;
4637
+ }
4638
+
4639
+ public void NextVersion()
4640
+ {
4641
+ // Option?
4642
+ Replace();
4643
+
4644
+ //cRadio tab = GetCurrentTab();
4645
+
4646
+ if (copy.versionlist[copy.versionindex + 1] == null)
4647
+ {
4648
+ java.awt.Toolkit.getDefaultToolkit().beep();
4649
+ return;
4650
+ }
4651
+
4652
+ copy.versionindex += 1;
4653
+
4654
+ CopyChanged();
4655
+
4656
+ //if (!tab.user[tab.versionindex])
4657
+ // tab.graphs[tab.versionindex] = null;
4658
+ }
4659
+
4660
+ void ImportGFD()
4661
+ {
4662
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32694663 browser.show();
32704664 String filename = browser.getFile();
32714665 if (filename != null && filename.length() > 0)
32724666 {
3273
- CameraPane.filename = browser.getDirectory() + filename;
4667
+ String fullname = browser.getDirectory() + filename;
4668
+
4669
+ //Object3D readobj =
4670
+ objEditor.ReadGFD(fullname, objEditor);
4671
+ //makeSomething(readobj);
4672
+ }
4673
+ }
4674
+
4675
+ void ImportVRMLX3D()
4676
+ {
4677
+ if (Grafreed.standAlone)
4678
+ {
4679
+ /**/
4680
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4681
+ browser.show();
4682
+ String filename = browser.getFile();
4683
+ if (filename != null && filename.length() > 0)
4684
+ {
4685
+ String fullname = browser.getDirectory() + filename;
4686
+ LoadVRMLX3D(fullname);
4687
+ }
4688
+ /**/
4689
+ }
4690
+ }
4691
+
4692
+ void ToggleAnimation()
4693
+ {
4694
+ if (!Globals.ANIMATION)
4695
+ {
4696
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
4697
+ browser.setVisible(true);
4698
+ String filename = browser.getFile();
4699
+ if (filename != null && filename.length() > 0)
4700
+ {
4701
+ Globals.filename = browser.getDirectory() + filename;
32744702 //CameraPane.framecount = 0;
3275
- CameraPane.imagecount = 0;
4703
+ Globals.imagecount = 0;
32764704
3277
- CameraPane.ANIMATION ^= true;
4705
+ Globals.ANIMATION ^= true;
32784706
3279
- GrafreeD.wav.cursor = 0;
3280
- GrafreeD.wav.loop = 0;
4707
+ Grafreed.wav.cursor = 0;
4708
+ Grafreed.wav.loop = 0;
32814709 }
32824710 } else
32834711 {
3284
- CameraPane.ANIMATION ^= true;
4712
+ Globals.ANIMATION ^= true;
32854713 }
32864714 }
32874715
....@@ -3327,7 +4755,7 @@
33274755 void CreateMaterial()
33284756 {
33294757 //copy.ClearMaterial(); // PATCH
3330
- copy.CreateMaterialS(multiplyToggle.isSelected());
4758
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33314759 if (copy.selection.size() > 0)
33324760 //SetMaterial(copy);
33334761 {
....@@ -3378,7 +4806,7 @@
33784806 assert false;
33794807 }
33804808
3381
- void EditSelection()
4809
+ void EditSelection(boolean newWindow)
33824810 {
33834811 }
33844812
....@@ -3386,11 +4814,11 @@
33864814 {
33874815 copy.ResetBlockLoop(); // temporary problem
33884816
3389
- boolean random = CameraPane.RANDOM;
3390
- CameraPane.RANDOM = false; // parse everything
4817
+ boolean random = CameraPane.SWITCH;
4818
+ CameraPane.SWITCH = false; // parse everything
33914819 copy.ResetDisplayList();
33924820 copy.HardTouch();
3393
- CameraPane.RANDOM = random;
4821
+ CameraPane.SWITCH = random;
33944822 }
33954823
33964824 // public void applySelf()
....@@ -3420,6 +4848,12 @@
34204848 // else
34214849 // applySelf(true);
34224850 // }
4851
+
4852
+ boolean Equal(double a, double b)
4853
+ {
4854
+ return Math.abs(a - b) < 0.001;
4855
+ }
4856
+
34234857 void applySelf0(boolean name)
34244858 {
34254859 if (name)
....@@ -3437,7 +4871,7 @@
34374871 //copy.material = new cMaterial(copy.GetMaterial());
34384872
34394873 current.color = (float) colorField.getFloat();
3440
- current.modulation = (float) modulationField.getFloat();
4874
+ current.modulation = (float) saturationField.getFloat();
34414875 current.metalness = (float) metalnessField.getFloat();
34424876 current.diffuse = (float) diffuseField.getFloat();
34434877 current.specular = (float) specularField.getFloat();
....@@ -3460,10 +4894,63 @@
34604894 current.fakedepth = (float) fakedepthField.getFloat();
34614895 current.shadowbias = (float) shadowbiasField.getFloat();
34624896
3463
- if (!NumberSlider.frozen)
4897
+ if (!cNumberSlider.frozen)
34644898 {
34654899 //System.out.println("Propagate = " + propagate);
34664900 copy.UpdateMaterial(anchor, current, propagate);
4901
+
4902
+ if (copy.material != null)
4903
+ {
4904
+ cMaterial mat = copy.material;
4905
+
4906
+ if (!Equal(colorField.getFloat(), mat.color))
4907
+ colorField.SetToolTipValue((mat.color));
4908
+ if (!Equal(saturationField.getFloat(), mat.modulation))
4909
+ saturationField.SetToolTipValue((mat.modulation));
4910
+ if (!Equal(metalnessField.getFloat(), mat.metalness))
4911
+ metalnessField.SetToolTipValue((mat.metalness));
4912
+ if (!Equal(diffuseField.getFloat(), mat.diffuse))
4913
+ diffuseField.SetToolTipValue((mat.diffuse));
4914
+ if (!Equal(specularField.getFloat(), mat.specular))
4915
+ specularField.SetToolTipValue((mat.specular));
4916
+ if (!Equal(shininessField.getFloat(), mat.shininess))
4917
+ shininessField.SetToolTipValue((mat.shininess));
4918
+ if (!Equal(shiftField.getFloat(), mat.shift))
4919
+ shiftField.SetToolTipValue((mat.shift));
4920
+ if (!Equal(ambientField.getFloat(), mat.ambient))
4921
+ ambientField.SetToolTipValue((mat.ambient));
4922
+ if (!Equal(lightareaField.getFloat(), mat.lightarea))
4923
+ lightareaField.SetToolTipValue((mat.lightarea));
4924
+ if (!Equal(diffusenessField.getFloat(), mat.factor))
4925
+ diffusenessField.SetToolTipValue((mat.factor));
4926
+ if (!Equal(velvetField.getFloat(), mat.velvet))
4927
+ velvetField.SetToolTipValue((mat.velvet));
4928
+ if (!Equal(sheenField.getFloat(), mat.sheen))
4929
+ sheenField.SetToolTipValue((mat.sheen));
4930
+ if (!Equal(subsurfaceField.getFloat(), mat.subsurface))
4931
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4932
+ if (!Equal(backlitField.getFloat(), mat.bump))
4933
+ backlitField.SetToolTipValue((mat.bump));
4934
+ if (!Equal(anisoField.getFloat(), mat.aniso))
4935
+ anisoField.SetToolTipValue((mat.aniso));
4936
+ if (!Equal(anisoVField.getFloat(), mat.anisoV))
4937
+ anisoVField.SetToolTipValue((mat.anisoV));
4938
+ if (!Equal(cameraField.getFloat(), mat.cameralight))
4939
+ cameraField.SetToolTipValue((mat.cameralight));
4940
+ if (!Equal(selfshadowField.getFloat(), mat.diffuseness))
4941
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4942
+ if (!Equal(shadowField.getFloat(), mat.shadow))
4943
+ shadowField.SetToolTipValue((mat.shadow));
4944
+ if (!Equal(textureField.getFloat(), mat.texture))
4945
+ textureField.SetToolTipValue((mat.texture));
4946
+ if (!Equal(opacityField.getFloat(), mat.opacity))
4947
+ opacityField.SetToolTipValue((mat.opacity));
4948
+ if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
4949
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4950
+ if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
4951
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4952
+ }
4953
+
34674954 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34684955 {
34694956 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3492,9 +4979,28 @@
34924979 //copy.Touch();
34934980 }
34944981
4982
+ cNumberSlider versionSlider;
4983
+
34954984 public void stateChanged(ChangeEvent e)
34964985 {
3497
- // assert(false);
4986
+ // assert(false);
4987
+ if (e.getSource() == versionSlider)
4988
+ {
4989
+ if (muteSlider)
4990
+ return;
4991
+
4992
+ Replace();
4993
+
4994
+ int version = versionSlider.getInteger();
4995
+
4996
+ if (version != -1 && copy.versionlist[version] != null)
4997
+ {
4998
+ copy.versionindex = version;
4999
+ CopyChanged();
5000
+ }
5001
+
5002
+ return;
5003
+ }
34985004
34995005 if (freezematerial)
35005006 {
....@@ -3508,6 +5014,7 @@
35085014 || e.getSource() == apertureField
35095015 || e.getSource() == shadowblurField)
35105016 {
5017
+ new Exception().printStackTrace();
35115018 System.exit(0);
35125019 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35135020 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3529,12 +5036,24 @@
35295036 {
35305037 //System.out.println("stateChanged = " + this);
35315038 materialtouched = true;
5039
+
5040
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
5041
+ {
5042
+ saturationField.setFloat(1);
5043
+ }
5044
+
35325045 applySelf();
35335046 //System.out.println("this = " + this);
35345047 //System.out.println("PARENT = " + parent);
35355048 //if (parent != null)
35365049 // parent.applySelf();
3537
- refreshContents();
5050
+ if (e.getSource() == normalpushField)
5051
+ {
5052
+ objEditor.refreshContents();
5053
+ //Refresh();
5054
+ }
5055
+ else
5056
+ refreshContents();
35385057 // ??? client.refreshEditWindow();
35395058 }
35405059 //else
....@@ -3546,7 +5065,7 @@
35465065 //group.name = nameField.getText();
35475066 //objEditor.applySelf();
35485067
3549
- assert (objEditor == this);
5068
+ // OCT2018: assert (objEditor == this);
35505069 if (copy.selection == null || copy.selection.size() == 0)
35515070 //super.applySelf()
35525071 ; else
....@@ -3570,12 +5089,18 @@
35705089 objEditor.copy = keep;
35715090 }
35725091 }
5092
+
5093
+ if (normalpushField != null)
5094
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35735095 }
35745096
35755097 void SnapObject()
35765098 {
3577
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3578
- SnapObject(obj);
5099
+ if (copy.selection.size() > 0)
5100
+ {
5101
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
5102
+ SnapObject(obj);
5103
+ }
35795104 }
35805105
35815106 void SnapObject(Object3D obj)
....@@ -3816,20 +5341,28 @@
38165341 {
38175342 if (GetTree() != null)
38185343 {
5344
+ GetTree().revalidate();
38195345 GetTree().repaint();
38205346 }
38215347
38225348 radioPanel.revalidate();
38235349 radioPanel.repaint();
3824
- ctrlPanel.revalidate(); // ? new
5350
+ ctrlPanel.validate(); // ? new
38255351 ctrlPanel.repaint();
38265352 }
5353
+
5354
+ if (previousVersionButton != null && copy.versionlist != null)
5355
+ SetVersionStates();
5356
+
5357
+ cameraView.requestFocusInWindow();
38275358 }
38285359
38295360 static TweenManager tweenManager = new TweenManager();
38305361
38315362 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38325363 {
5364
+ if (Globals.REPLACEONMAKE) // && resetmodel)
5365
+ Save();
38335366 //Tween.set(thing, 0).target(1).start(tweenManager);
38345367 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38355368 // if (thing instanceof GenericJointDemo)
....@@ -3853,7 +5386,7 @@
38535386 // group = (Composite) group.get(0);
38545387 // }
38555388
3856
- System.out.println("makeSomething of " + thing);
5389
+ //System.out.println("makeSomething of " + thing);
38575390
38585391 /*
38595392 if (deselect && jList != null)
....@@ -3916,6 +5449,12 @@
39165449 {
39175450 ResetModel();
39185451 Select(thing.GetTreePath(), true, false); // unselect... false);
5452
+
5453
+ if (thing.Size() == 0)
5454
+ {
5455
+ //EditSelection(false);
5456
+ }
5457
+
39195458 refreshContents();
39205459 }
39215460
....@@ -4033,6 +5572,7 @@
40335572 }
40345573 }
40355574 }
5575
+
40365576 LoadGFDThread loadGFDThread;
40375577
40385578 void ReadGFD(String fullname, iCallBack cb)
....@@ -4052,8 +5592,10 @@
40525592
40535593 try
40545594 {
5595
+ // Try compressed version first.
40555596 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4056
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
5597
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
5598
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40575599
40585600 readobj = (Object3D) p.readObject();
40595601 istream.close();
....@@ -4061,7 +5603,22 @@
40615603 readobj.ResetDisplayList();
40625604 } catch (Exception e)
40635605 {
4064
- e.printStackTrace();
5606
+ if (!e.toString().contains("GZIP"))
5607
+ e.printStackTrace();
5608
+
5609
+ try
5610
+ {
5611
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
5612
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
5613
+
5614
+ readobj = (Object3D) p.readObject();
5615
+ istream.close();
5616
+
5617
+ readobj.ResetDisplayList();
5618
+ } catch (Exception e2)
5619
+ {
5620
+ e2.printStackTrace();
5621
+ }
40655622 }
40665623 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40675624 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4107,6 +5664,12 @@
41075664
41085665 void LoadIt(Object obj)
41095666 {
5667
+ if (obj == null)
5668
+ {
5669
+ // Invalid file
5670
+ return;
5671
+ }
5672
+
41105673 System.out.println("Loaded " + obj);
41115674 //new Exception().printStackTrace();
41125675 Object3D readobj = (Object3D) obj;
....@@ -4116,10 +5679,14 @@
41165679
41175680 if (readobj != null)
41185681 {
5682
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
5683
+ // Save();
41195684 try
41205685 {
41215686 //readobj.deepCopySelf(copy);
41225687 copy.clear(); // june 2014
5688
+ copy.skyboxname = readobj.skyboxname;
5689
+ copy.skyboxext = readobj.skyboxext;
41235690 for (int i = 0; i < readobj.size(); i++)
41245691 {
41255692 Object3D child = readobj.get(i); // reserve(i);
....@@ -4160,6 +5727,7 @@
41605727 }
41615728 } catch (ClassCastException e)
41625729 {
5730
+ e.printStackTrace();
41635731 assert (false);
41645732 Composite c = (Composite) copy;
41655733 c.children.clear();
....@@ -4170,17 +5738,32 @@
41705738 c.addChild(csg);
41715739 }
41725740
5741
+ copy.versionlist = readobj.versionlist;
5742
+ copy.versionindex = readobj.versionindex;
5743
+ copy.versiontable = readobj.versiontable;
5744
+
5745
+ if (copy.versionlist == null)
5746
+ {
5747
+ // Backward compatibility
5748
+ copy.versionlist = new Object3D[100];
5749
+ copy.versionindex = -1;
5750
+
5751
+ //Save(true);
5752
+ }
5753
+
5754
+ //? SetUndoStates();
5755
+
41735756 ResetModel();
41745757 copy.HardTouch(); // recompile?
41755758 refreshContents();
41765759 }
41775760 }
41785761
4179
- void load() // throws ClassNotFoundException
5762
+ void Open() // throws ClassNotFoundException
41805763 {
4181
- if (GrafreeD.standAlone)
5764
+ if (Grafreed.standAlone)
41825765 {
4183
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5766
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
41845767 browser.show();
41855768 String filename = browser.getFile();
41865769 if (filename != null && filename.length() > 0)
....@@ -4257,6 +5840,8 @@
42575840
42585841 void save()
42595842 {
5843
+ Replace();
5844
+
42605845 if (lastname == null)
42615846 {
42625847 return;
....@@ -4265,11 +5850,13 @@
42655850 try
42665851 {
42675852 FileOutputStream ostream = new FileOutputStream(lastname);
4268
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5853
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5854
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42695855
42705856 p.writeObject(copy);
42715857 p.flush();
42725858
5859
+ zstream.close();
42735860 ostream.close();
42745861
42755862 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4277,19 +5864,23 @@
42775864 //ps.print(buffer.toString());
42785865 } catch (IOException e)
42795866 {
5867
+ e.printStackTrace();
42805868 }
42815869 }
5870
+
42825871 String lastname;
42835872
42845873 void saveAs()
42855874 {
4286
- if (GrafreeD.standAlone)
5875
+ if (Grafreed.standAlone)
42875876 {
42885877 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42895878 browser.setVisible(true);
42905879 String filename = browser.getFile();
42915880 if (filename != null && filename.length() > 0)
42925881 {
5882
+ if (!filename.endsWith(".gfd"))
5883
+ filename += ".gfd";
42935884 lastname = browser.getDirectory() + filename;
42945885 save();
42955886 }
....@@ -4388,13 +5979,13 @@
43885979 try
43895980 {
43905981 FileOutputStream ostream = new FileOutputStream(filename);
4391
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4392
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5982
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5983
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43935984
43945985 Object3D objectparent = obj.parent;
43955986 obj.parent = null;
43965987
4397
- Object3D object = (Object3D) GrafreeD.clone(obj);
5988
+ Object3D object = (Object3D) Grafreed.clone(obj);
43985989
43995990 obj.parent = objectparent;
44005991
....@@ -4406,8 +5997,8 @@
44065997 p.writeObject(object);
44075998 p.flush();
44085999
6000
+ zstream.close();
44096001 ostream.close();
4410
- // zstream.close();
44116002
44126003 // group.selection.get(0).parent = parent;
44136004 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4428,7 +6019,7 @@
44286019 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44296020 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44306021 copy.generatePOV(buffer);
4431
- if (GrafreeD.standAlone)
6022
+ if (Grafreed.standAlone)
44326023 {
44336024 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44346025 browser.show();
....@@ -4454,21 +6045,20 @@
44546045 Object3D client;
44556046 Object3D copy;
44566047 MenuBar menuBar;
4457
- Menu windowMenu;
4458
- MenuItem loadItem;
6048
+ Menu fileMenu;
6049
+ MenuItem newItem;
6050
+ MenuItem openItem;
44596051 MenuItem saveItem;
44606052 MenuItem saveAsItem;
44616053 MenuItem exportAsItem;
44626054 MenuItem reexportItem;
44636055 MenuItem povItem;
44646056 MenuItem closeItem;
4465
- Menu cameraMenu;
6057
+
44666058 CheckboxMenuItem zBufferItem;
44676059 //MenuItem normalLensItem;
4468
- MenuItem editCameraItem;
4469
- MenuItem revertCameraItem;
4470
- CheckboxMenuItem toggleLiveItem;
44716060 MenuItem stepItem;
6061
+ CheckboxMenuItem toggleLiveItem;
44726062 CheckboxMenuItem toggleFullScreenItem;
44736063 CheckboxMenuItem toggleTimelineItem;
44746064 CheckboxMenuItem toggleRenderItem;
....@@ -4477,28 +6067,45 @@
44776067 CheckboxMenuItem toggleFootContactItem;
44786068 CheckboxMenuItem toggleDLItem;
44796069 CheckboxMenuItem toggleTextureItem;
4480
- CheckboxMenuItem toggleRandomItem;
6070
+ CheckboxMenuItem toggleSwitchItem;
44816071 CheckboxMenuItem toggleRootItem;
44826072 CheckboxMenuItem animationItem;
6073
+ MenuItem archiveItem;
44836074 CheckboxMenuItem toggleHandleItem;
44846075 CheckboxMenuItem togglePaintItem;
44856076 JSplitPane mainPanel;
44866077 JScrollPane scrollpane;
6078
+
44876079 JPanel toolbarPanel;
4488
- JPanel treePanel;
6080
+
6081
+ cGridBag treePanel;
6082
+
44896083 JPanel radioPanel;
44906084 ButtonGroup buttonGroup;
4491
- JPanel ctrlPanel;
4492
- JPanel materialPanel;
6085
+
6086
+ cGridBag toolboxPanel;
6087
+ cGridBag skyboxPanel;
6088
+ cGridBag materialPanel;
6089
+ cGridBag ctrlPanel;
6090
+
44936091 JScrollPane infoPanel;
4494
- JPanel optionsPanel;
6092
+
6093
+ cGridBag optionsPanel;
6094
+
44956095 JTabbedPane objectPanel;
4496
- JPanel XYZPanel;
6096
+ boolean materialFlushed;
6097
+ Object3D latestObject;
6098
+
6099
+ cGridBag transformPanel;
6100
+ cGridBag XYZPanel;
6101
+
44976102 JSplitPane gridPanel;
44986103 JSplitPane bigPanel;
4499
- JPanel bigThree;
4500
- JTabbedPane scenePanel;
4501
- JPanel centralPanel;
6104
+
6105
+ cGridBag bigThree;
6106
+ cGridBag scenePanel;
6107
+ cGridBag centralPanel;
6108
+ JSplitPane cameraPanel;
45026109 JPanel timelinePanel;
45036110 JMenuBar timelineMenubar;
45046111 JSplitPane framePanel;
....@@ -4550,65 +6157,74 @@
45506157 // MATERIAL
45516158 JLabel materialLabel;
45526159 JLabel colorLabel;
4553
- NumberSlider colorField;
6160
+ cNumberSlider colorField;
45546161 JLabel modulationLabel;
4555
- NumberSlider modulationField;
6162
+ cNumberSlider saturationField;
45566163 JLabel metalnessLabel;
4557
- NumberSlider metalnessField;
6164
+ cNumberSlider metalnessField;
45586165 JLabel diffuseLabel;
4559
- NumberSlider diffuseField;
6166
+ cNumberSlider diffuseField;
45606167 JLabel specularLabel;
4561
- NumberSlider specularField;
6168
+ cNumberSlider specularField;
45626169 JLabel shininessLabel;
4563
- NumberSlider shininessField;
6170
+ cNumberSlider shininessField;
45646171 JLabel shiftLabel;
4565
- NumberSlider shiftField;
6172
+ cNumberSlider shiftField;
45666173 JLabel ambientLabel;
4567
- NumberSlider ambientField;
6174
+ cNumberSlider ambientField;
45686175 JLabel lightareaLabel;
4569
- NumberSlider lightareaField;
6176
+ cNumberSlider lightareaField;
45706177 JLabel diffusenessLabel;
4571
- NumberSlider diffusenessField;
6178
+ cNumberSlider diffusenessField;
45726179 JLabel velvetLabel;
4573
- NumberSlider velvetField;
6180
+ cNumberSlider velvetField;
45746181 JLabel sheenLabel;
4575
- NumberSlider sheenField;
6182
+ cNumberSlider sheenField;
45766183 JLabel subsurfaceLabel;
4577
- NumberSlider subsurfaceField;
6184
+ cNumberSlider subsurfaceField;
45786185 //JLabel bumpLabel;
45796186 //NumberSlider bumpField;
45806187 JLabel backlitLabel;
4581
- NumberSlider backlitField;
6188
+ cNumberSlider backlitField;
45826189 JLabel anisoLabel;
4583
- NumberSlider anisoField;
6190
+ cNumberSlider anisoField;
45846191 JLabel anisoVLabel;
4585
- NumberSlider anisoVField;
6192
+ cNumberSlider anisoVField;
6193
+
45866194 JLabel cameraLabel;
4587
- NumberSlider cameraField;
6195
+ cNumberSlider cameraField;
45886196 JLabel selfshadowLabel;
4589
- NumberSlider selfshadowField;
6197
+ cNumberSlider selfshadowField;
45906198 JLabel shadowLabel;
4591
- NumberSlider shadowField;
6199
+ cNumberSlider shadowField;
45926200 JLabel textureLabel;
4593
- NumberSlider textureField;
6201
+ cNumberSlider textureField;
45946202 JLabel opacityLabel;
4595
- NumberSlider opacityField;
6203
+ cNumberSlider opacityField;
45966204 JLabel fakedepthLabel;
4597
- NumberSlider fakedepthField;
6205
+ cNumberSlider fakedepthField;
45986206 JLabel shadowbiasLabel;
4599
- NumberSlider shadowbiasField;
6207
+ cNumberSlider shadowbiasField;
6208
+
46006209 JLabel bumpLabel;
4601
- NumberSlider bumpField;
6210
+ cNumberSlider bumpField;
46026211 JLabel noiseLabel;
4603
- NumberSlider noiseField;
6212
+ cNumberSlider noiseField;
46046213 JLabel powerLabel;
4605
- NumberSlider powerField;
6214
+ cNumberSlider powerField;
46066215 JLabel borderfadeLabel;
4607
- NumberSlider borderfadeField;
6216
+ cNumberSlider borderfadeField;
46086217 JLabel fogLabel;
4609
- NumberSlider fogField;
6218
+ cNumberSlider fogField;
46106219 JLabel opacityPowerLabel;
4611
- NumberSlider opacityPowerField;
4612
- JTree jTree;
6220
+ cNumberSlider opacityPowerField;
6221
+ cTree jTree;
46136222 //ObjectUI parent;
6223
+
6224
+ cNumberSlider normalpushField;
6225
+
6226
+ private MenuItem importGFDItem;
6227
+ private MenuItem importVRMLX3DItem;
6228
+ private MenuItem import3DSItem;
6229
+ private MenuItem importOBJItem;
46146230 }