Normand Briere
2019-08-23 60cec91731a350fe67e9b5ffe7a00d70e9026314
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,11 +34,152 @@
2834 iSendInfo
2935 //KeyListener
3036 {
37
+ public cToggleButton pinButton;
3138 boolean timeline;
3239 boolean wasFullScreen;
3340
3441 GroupEditor callee;
3542 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;
138
+
139
+ if (name.endsWith("jpg"))
140
+ // Much faster!
141
+ image = new sun.awt.image.codec.JPEGImageDecoderImpl(ObjEditor.class.getClassLoader().getResourceAsStream(name)).decodeAsBufferedImage();
142
+ else
143
+ image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
144
+
145
+// if (image.getWidth() > 48 && image.getHeight() > 48)
146
+// {
147
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
148
+// Graphics2D g = resized.createGraphics();
149
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
150
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
151
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
152
+// g.dispose();
153
+//
154
+// image = resized;
155
+// }
156
+
157
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
158
+
159
+ icons.put(name, icon);
160
+
161
+ return icon;
162
+ }
163
+ catch (Exception e)
164
+ {
165
+ //icons.put(name, null);
166
+ return null;
167
+ }
168
+ }
169
+
170
+ BufferedImage GetImage(String name)
171
+ {
172
+ try
173
+ {
174
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
175
+
176
+ return image;
177
+ }
178
+ catch (Exception e)
179
+ {
180
+ return null;
181
+ }
182
+ }
36183
37184 // SCRIPT
38185
....@@ -124,7 +271,7 @@
124271 void keyPressed(int key, int modifiers)
125272 {
126273 System.out.println("KEY PRESSED");
127
- CameraPane.theRenderer.keyPressed(key, modifiers);
274
+ Globals.theRenderer.keyPressed(key, modifiers);
128275 }
129276 */
130277
....@@ -136,34 +283,42 @@
136283 public void closeUI()
137284 {
138285 //new Exception().printStackTrace();
139
- System.out.println("this = " + this);
140
- System.out.println("objEditor = " + objEditor);
286
+// System.out.println("this = " + this);
287
+// System.out.println("objEditor = " + objEditor);
141288 //nameField.removeActionListener(this);
142
- objEditor.ctrlPanel.remove(nameField);
289
+// objEditor.ctrlPanel.remove(nameField);
143290
144
- if (!GroupEditor.allparams)
291
+ objEditor.ctrlPanel.remove(namePanel);
292
+
293
+ if (!allparams)
145294 return;
146295
147
- objEditor.ctrlPanel.remove(liveCB);
148
- objEditor.ctrlPanel.remove(hideCB);
149
- objEditor.ctrlPanel.remove(markCB);
150
-
151
- objEditor.ctrlPanel.remove(randomCB);
152
- objEditor.ctrlPanel.remove(speedupCB);
153
- objEditor.ctrlPanel.remove(rewindCB);
154
-
155
- objEditor.ctrlPanel.remove(resetButton);
156
- objEditor.ctrlPanel.remove(stepButton);
157
-// objEditor.ctrlPanel.remove(stepAllButton);
158
-// objEditor.ctrlPanel.remove(resetAllButton);
159
- objEditor.ctrlPanel.remove(link2masterCB);
160
- //objEditor.ctrlPanel.remove(flipVCB);
161
- //objEditor.ctrlPanel.remove(texresMenu);
162
- objEditor.ctrlPanel.remove(slowerButton);
163
- objEditor.ctrlPanel.remove(fasterButton);
164
- objEditor.ctrlPanel.remove(remarkButton);
296
+// objEditor.ctrlPanel.remove(liveCB);
297
+// objEditor.ctrlPanel.remove(hideCB);
298
+// objEditor.ctrlPanel.remove(markCB);
299
+//
300
+// objEditor.ctrlPanel.remove(randomCB);
301
+// objEditor.ctrlPanel.remove(speedupCB);
302
+// objEditor.ctrlPanel.remove(rewindCB);
303
+//
304
+// objEditor.ctrlPanel.remove(resetButton);
305
+// objEditor.ctrlPanel.remove(stepButton);
306
+//// objEditor.ctrlPanel.remove(stepAllButton);
307
+//// objEditor.ctrlPanel.remove(resetAllButton);
308
+// objEditor.ctrlPanel.remove(link2masterCB);
309
+// //objEditor.ctrlPanel.remove(flipVCB);
310
+// //objEditor.ctrlPanel.remove(texresMenu);
311
+// objEditor.ctrlPanel.remove(slowerButton);
312
+// objEditor.ctrlPanel.remove(fasterButton);
313
+// objEditor.ctrlPanel.remove(remarkButton);
165314
166
- Remove(normalpushField);
315
+ objEditor.ctrlPanel.remove(setupPanel);
316
+ objEditor.ctrlPanel.remove(setupPanel2);
317
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
318
+ objEditor.ctrlPanel.remove(pushPanel);
319
+ //objEditor.ctrlPanel.remove(fillPanel);
320
+
321
+ //Remove(normalpushField);
167322 }
168323
169324 public ObjEditor GetEditor()
....@@ -207,6 +362,14 @@
207362 client = inClient;
208363 copy = client;
209364
365
+// if (copy.versionlist == null)
366
+// {
367
+// copy.versionlist = new Object3D[100];
368
+// copy.versionindex = -1;
369
+//
370
+// callee.Save(true);
371
+// }
372
+
210373 // "this" is not called: SetupUI2(objEditor);
211374 }
212375
....@@ -234,13 +397,15 @@
234397 //localCopy.parent = null;
235398
236399 frame = new JFrame();
400
+ frame.setUndecorated(false);
237401 objEditor = this;
238402 this.callee = callee;
239403
240404 //parent = p;
241405
242406 GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
243
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
407
+ if (Globals.DEBUG)
408
+ System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
244409 //gd.setFullScreenWindow(this);
245410 //setResizable(false);
246411 //if (!isDisplayable())
....@@ -251,6 +416,14 @@
251416 copy = localCopy;
252417 copy.editWindow = this;
253418
419
+// if (copy.versionlist == null)
420
+// {
421
+// copy.versionlist = new Object3D[100];
422
+// copy.versionindex = -1;
423
+//
424
+// Save(true);
425
+// }
426
+
254427 SetupMenu();
255428
256429 //SetupName(objEditor); // new
....@@ -264,28 +437,55 @@
264437 return frame.action(event, obj);
265438 }
266439
440
+ // Cannot work without static
441
+ static boolean allparams = true;
442
+
443
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
444
+
445
+ // This is to refresh the UI of the material panel.
446
+ boolean patchMaterial;
447
+
267448 void SetupMenu()
268449 {
269450 frame.setMenuBar(menuBar = new MenuBar());
270
- menuBar.add(windowMenu = new Menu("File"));
271
- windowMenu.add(loadItem = new MenuItem("Load..."));
272
- windowMenu.add("-");
273
- windowMenu.add(saveItem = new MenuItem("Save"));
274
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
451
+ menuBar.add(fileMenu = new Menu("File"));
452
+ fileMenu.add(newItem = new MenuItem("New"));
453
+ fileMenu.add(openItem = new MenuItem("Open..."));
454
+
455
+ //oe.menuBar.add(menu = new Menu("Include"));
456
+ Menu menu = new Menu("Import");
457
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
458
+ importOBJItem.addActionListener(this);
459
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
460
+ import3DSItem.addActionListener(this);
461
+ if (Globals.ADVANCED)
462
+ {
463
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
464
+ importVRMLX3DItem.addActionListener(this);
465
+ }
466
+ menu.add("-");
467
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
468
+ importGFDItem.addActionListener(this);
469
+ fileMenu.add(menu);
470
+ fileMenu.add("-");
471
+
472
+ fileMenu.add(saveItem = new MenuItem("Save"));
473
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
275474 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
276
- windowMenu.add("-");
277
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
278
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
279
- windowMenu.add("-");
475
+ fileMenu.add("-");
476
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
477
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
478
+ fileMenu.add("-");
280479 if (client.parent != null)
281480 {
282
- windowMenu.add(closeItem = new MenuItem("Close"));
481
+ fileMenu.add(closeItem = new MenuItem("Close"));
283482 } else
284483 {
285
- windowMenu.add(closeItem = new MenuItem("Exit"));
484
+ fileMenu.add(closeItem = new MenuItem("Exit"));
286485 }
287486
288
- loadItem.addActionListener(this);
487
+ newItem.addActionListener(this);
488
+ openItem.addActionListener(this);
289489 saveItem.addActionListener(this);
290490 saveAsItem.addActionListener(this);
291491 exportAsItem.addActionListener(this);
....@@ -293,82 +493,103 @@
293493 //povItem.addActionListener(this);
294494 closeItem.addActionListener(this);
295495
296
- menuBar.add(cameraMenu = new Menu("View"));
297
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
298
- //zBufferItem.addActionListener(this);
299
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
300
- //normalLensItem.addActionListener(this);
301
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
302
- revertCameraItem.addActionListener(this);
303
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
304
- toggleTimelineItem.addItemListener(this);
305
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
306
- toggleFullScreenItem.addItemListener(this);
307
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
308
- cameraMenu.add("-");
309
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
310
- toggleTextureItem.addItemListener(this);
311
- toggleTextureItem.setState(CameraPane.textureon);
312
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
313
- toggleLiveItem.addItemListener(this);
314
- toggleLiveItem.setState(CameraPane.isLIVE());
315
- cameraMenu.add(stepItem = new MenuItem("Step"));
316
- stepItem.addActionListener(this);
317
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
318
-// toggleDLItem.addItemListener(this);
319
-// toggleDLItem.setState(false);
320
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
321
- toggleRenderItem.addItemListener(this);
322
- toggleRenderItem.setState(!CameraPane.frozen);
323
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
324
- toggleDebugItem.addItemListener(this);
325
- toggleDebugItem.setState(CameraPane.DEBUG);
326
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
327
- toggleFrustumItem.addItemListener(this);
328
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
329
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
330
- toggleFootContactItem.addItemListener(this);
331
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
332
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
333
- toggleRandomItem.addItemListener(this);
334
- toggleRandomItem.setState(CameraPane.RANDOM);
335
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
336
- toggleHandleItem.addItemListener(this);
337
- toggleHandleItem.setState(CameraPane.HANDLES);
338
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
339
- togglePaintItem.addItemListener(this);
340
- togglePaintItem.setState(CameraPane.PAINTMODE);
341
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
342
-// toggleRootItem.addItemListener(this);
343
-// toggleRootItem.setState(false);
344
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
345
-// animationItem.addItemListener(this);
346
-// animationItem.setState(CameraPane.ANIMATION);
347
- cameraMenu.add("-");
348
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
349
- editCameraItem.addActionListener(this);
350
-
351496 objectPanel = new JTabbedPane();
497
+
498
+ ChangeListener changeListener = new ChangeListener()
499
+ {
500
+ //String name;
501
+
502
+ public void stateChanged(ChangeEvent changeEvent)
503
+ {
504
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
505
+// {
506
+// if (latestObject != null)
507
+// {
508
+// refreshContents(true);
509
+// SetMaterial(latestObject);
510
+// }
511
+//
512
+// materialFlushed = true;
513
+// }
514
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
515
+// {
516
+// if (listUI.size() == 0)
517
+// EditSelection(false);
518
+// }
519
+
520
+// if (objectPanel.getSelectedIndex() == 4)
521
+// {
522
+// name = copy.skyboxname;
523
+//
524
+// if (name == null)
525
+// {
526
+// name = "";
527
+// }
528
+//
529
+// copy.skyboxname = "cubemaps/default-skyboxes/rgb";
530
+// copy.skyboxext = "jpg";
531
+// }
532
+// else
533
+// {
534
+// if (name != null)
535
+// {
536
+// if (name.equals(""))
537
+// {
538
+// copy.skyboxname = null;
539
+// copy.skyboxext = null;
540
+// }
541
+// else
542
+// {
543
+// copy.skyboxname = name;
544
+// }
545
+// }
546
+// }
547
+ cameraView.transformMode = objectPanel.getSelectedIndex() == 4;
548
+
549
+// refreshContents(false); // To refresh Info tab
550
+ cameraView.repaint();
551
+ }
552
+ };
553
+ objectPanel.addChangeListener(changeListener);
554
+
352555 toolbarPanel = new JPanel();
353556 toolbarPanel.setName("Toolbar");
354
- treePanel = new JPanel();
557
+
558
+ treePanel = new cGridBag();
355559 treePanel.setName("Tree");
356
- ctrlPanel = new JPanel(); // new GridBagLayout());
357
- ctrlPanel.setName("Edit");
358
- materialPanel = new JPanel();
359
- materialPanel.setName("Material");
560
+
561
+ editPanel = new cGridBag().setVertical(true);
562
+ //editPanel.setName("Edit");
563
+
564
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
565
+
566
+ editCommandsPanel = new cGridBag();
567
+ editPanel.add(editCommandsPanel);
568
+ editPanel.add(ctrlPanel);
569
+
570
+ toolboxPanel = new cGridBag().setVertical(true);
571
+ //toolboxPanel.setName("Toolbox");
572
+
573
+ skyboxPanel = new cGridBag().setVertical(true);
574
+
575
+ materialPanel = new cGridBag().setVertical(false);
576
+ //materialPanel.setName("Material");
577
+
360578 /*JTextPane*/
361579 infoarea = createTextPane();
580
+ doc = infoarea.getStyledDocument();
581
+
362582 infoarea.setEditable(true);
363583 SetText();
584
+
364585 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
365586 // infoarea.setOpaque(false);
366587 // //infoarea.setForeground(textcolor);
367
- infoarea.setLineWrap(true);
368
- infoarea.setWrapStyleWord(true);
588
+// TEXTAREA infoarea.setLineWrap(true);
589
+// TEXTAREA infoarea.setWrapStyleWord(true);
369590 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
370
- infoPanel.setPreferredSize(new Dimension(50, 200));
371
- infoPanel.setName("Info");
591
+ infoPanel.setPreferredSize(new Dimension(1, 1));
592
+ //infoPanel.setName("Info");
372593 //infoPanel.setLayout(new BorderLayout());
373594 //infoPanel.add(createTextPane());
374595
....@@ -376,16 +597,23 @@
376597 mainPanel.setName("Main");
377598 mainPanel.setContinuousLayout(true);
378599 mainPanel.setOneTouchExpandable(true);
379
- mainPanel.setDividerLocation(1.0);
380600 mainPanel.setDividerSize(9);
381
- mainPanel.setResizeWeight(0);
382
-
601
+ mainPanel.setDividerLocation(0.5); //1.0);
602
+ mainPanel.setResizeWeight(0.5);
603
+
604
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
605
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
606
+ divider.setDividerSize(15);
607
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
608
+
609
+ mainPanel.setUI(new BasicSplitPaneUI());
610
+
383611 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
384612 //mainPanel.setLayout(new GridBagLayout());
385613 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
386
- treePanel.setLayout(new GridBagLayout());
387
- ctrlPanel.setLayout(new GridBagLayout());
388
- materialPanel.setLayout(new GridBagLayout());
614
+// treePanel.setLayout(new GridBagLayout());
615
+ //ctrlPanel.setLayout(new GridBagLayout());
616
+ //materialPanel.setLayout(new GridBagLayout());
389617
390618 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
391619 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -424,7 +652,7 @@
424652 static String newline = "\n";
425653 protected static final String buttonString = "JButton";
426654 StyledDocument doc;
427
- JTextArea infoarea;
655
+ JTextPane infoarea;
428656
429657 void ClearInfo()
430658 {
....@@ -447,10 +675,10 @@
447675 e.printStackTrace();
448676 }
449677
450
- String selection = infoarea.getText();
451
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
452
- java.awt.datatransfer.Clipboard clipboard =
453
- Toolkit.getDefaultToolkit().getSystemClipboard();
678
+// String selection = infoarea.getText();
679
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
680
+// java.awt.datatransfer.Clipboard clipboard =
681
+// Toolkit.getDefaultToolkit().getSystemClipboard();
454682 //clipboard.setContents(data, data);
455683 }
456684
....@@ -473,13 +701,13 @@
473701 //SendInfo("Name:", "bold");
474702 if (sel.GetTextures() != null || debug)
475703 {
476
- si.SendInfo(sel.toString(), "bold");
704
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
477705 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
478706 if (sel.Size() > 0)
479707 {
480708 si.SendInfo("#children = " + sel.Size(), "regular");
481709 }
482
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
710
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
483711 if (debug)
484712 {
485713 try
....@@ -491,7 +719,10 @@
491719 }
492720
493721 if (full)
494
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
722
+ {
723
+ si.SendInfo(" BBox min: " + minima, "regular");
724
+ si.SendInfo(" BBox max: " + maxima, "regular");
725
+ }
495726
496727 if (sel.bRep != null)
497728 {
....@@ -518,7 +749,7 @@
518749 }
519750 if (sel.support != null)
520751 {
521
- si.SendInfo(" support: " + sel.support, "regular");
752
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
522753 }
523754 if (sel.scriptnode != null)
524755 {
....@@ -589,6 +820,9 @@
589820 {
590821 CameraPane.pointflow = (PointFlow) sel;
591822 }
823
+
824
+ si.SendInfo("_____________________", "regular");
825
+ si.SendInfo("", "regular");
592826 }
593827 }
594828
....@@ -604,68 +838,216 @@
604838 }
605839 }
606840
841
+//static GraphicsDevice device = GraphicsEnvironment
842
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
843
+
844
+ Rectangle keeprect;
845
+ cRadio radio;
846
+
847
+cButton keepButton;
848
+ cButton twoButton; // Full 3D
849
+ cButton sixButton;
850
+ cButton threeButton;
851
+ cButton sevenButton;
852
+ cButton fourButton; // full panel
853
+ cButton oneButton; // full XYZ
854
+ //cButton currentLayout;
855
+
856
+ boolean maximized;
857
+
858
+ cButton fullscreenLayout;
859
+ cButton expandedLayout;
860
+
861
+ void Minimize()
862
+ {
863
+ frame.setState(Frame.ICONIFIED);
864
+ frame.validate();
865
+ }
866
+
867
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
868
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
869
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
870
+ void Maximize()
871
+ {
872
+ if (CameraPane.FULLSCREEN)
873
+ {
874
+ ToggleFullScreen();
875
+ }
876
+
877
+ if (maximized)
878
+ {
879
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
880
+ }
881
+ else
882
+ {
883
+ keeprect = frame.getBounds();
884
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
885
+// Dimension rect2 = frame.getToolkit().getScreenSize();
886
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
887
+// frame.setState(Frame.MAXIMIZED_BOTH);
888
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
889
+ }
890
+
891
+ maximized ^= true;
892
+
893
+ frame.validate();
894
+ }
895
+
896
+ cButton minButton;
897
+ cButton maxButton;
898
+ cButton fullButton;
899
+ cButton collapseButton;
900
+ cButton maximize3DButton;
901
+
607902 void ToggleFullScreen()
608903 {
609
- if (CameraPane.FULLSCREEN)
904
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
905
+
906
+ cameraView.ToggleFullScreen();
907
+
908
+ if (!CameraPane.FULLSCREEN)
610909 {
611
- frame.getContentPane().remove(/*"Center",*/bigThree);
612
- framePanel.add(bigThree);
613
- frame.getContentPane().add(/*"Center",*/framePanel);
910
+ device.setFullScreenWindow(null);
911
+ frame.dispose();
912
+ frame.setUndecorated(false);
913
+ frame.validate();
914
+ frame.setVisible(true);
915
+
916
+ //frame.setVisible(false);
917
+// frame.removeNotify();
918
+// frame.setUndecorated(false);
919
+// frame.addNotify();
920
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
921
+
922
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
923
+// X framePanel.add(bigThree);
924
+// X frame.getContentPane().add(/*"Center",*/framePanel);
925
+// framePanel.setDividerLocation(46); // icons are 24x24
926
+
927
+ //frame.setVisible(true);
928
+// radio.layout = keepButton;
929
+ //theFrame = null;
930
+ keepButton = null;
931
+// radio.layout.doClick();
932
+
614933 } else
615934 {
616
- frame.getContentPane().remove(/*"Center",*/framePanel);
617
- framePanel.remove(bigThree);
618
- frame.getContentPane().add(/*"Center",*/bigThree);
935
+ keepButton = radio.layout;
936
+ //keeprect = frame.getBounds();
937
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
938
+// frame.getToolkit().getScreenSize().height);
939
+ //frame.setVisible(false);
940
+
941
+ frame.dispose();
942
+ frame.setUndecorated(true);
943
+ device.setFullScreenWindow(frame);
944
+ frame.validate();
945
+ frame.setVisible(true);
946
+// frame.removeNotify();
947
+// frame.setUndecorated(true);
948
+// frame.addNotify();
949
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
950
+// X framePanel.remove(bigThree);
951
+// X frame.getContentPane().add(/*"Center",*/bigThree);
952
+// framePanel.setDividerLocation(0);
953
+
954
+// radio.layout = fullscreenLayout;
955
+// radio.layout.doClick();
956
+ //frame.setVisible(true);
619957 }
620
- cameraView.ToggleFullScreen();
958
+ frame.validate();
959
+
960
+ cameraView.requestFocusInWindow();
621961 }
622962
623
- private JTextArea createTextPane()
963
+ void CollapseToolbar()
964
+ {
965
+ framePanel.setDividerLocation(0);
966
+ //frame.validate();
967
+
968
+ cameraView.requestFocusInWindow();
969
+ }
970
+
971
+ private Object3D Duplicate(Object3D object)
624972 {
625
- String[] initString =
626
- {
627
- "This is an editable JTextPane, ", //regular
628
- "another ", //italic
629
- "styled ", //bold
630
- "text ", //small
631
- "component, ", //large
632
- "which supports embedded components..." + newline,//regular
633
- " " + newline, //button
634
- "...and embedded icons..." + newline, //regular
635
- " ", //icon
636
- newline + "JTextPane is a subclass of JEditorPane that "
637
- + "uses a StyledEditorKit and StyledDocument, and provides "
638
- + "cover methods for interacting with those objects."
639
- };
973
+ boolean temp = CameraPane.SWITCH;
974
+ CameraPane.SWITCH = false;
975
+
976
+ if (Grafreed.grafreed.universe.versiontable == null)
977
+ Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
978
+
979
+ object.ExtractBigData(Grafreed.grafreed.universe.versiontable);
980
+ // if (copy == client)
981
+
982
+ Object3D versions[] = object.versionlist;
983
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe
984
+ object.versionlist = null;
985
+ object.versiontable = null;
986
+
987
+ Object3D parent = object.parent;
988
+ object.parent = null;
989
+
990
+ //byte[] compress = Compress(copy);
991
+ Object3D compress = (Object3D)Grafreed.clone(object);
992
+
993
+ object.parent = parent;
994
+
995
+ object.versionlist = versions;
996
+ object.versiontable = versiontable; // if Grafreed.grafreed.universe
997
+
998
+ object.RestoreBigData(Grafreed.grafreed.universe.versiontable);
999
+
1000
+ CameraPane.SWITCH = temp;
1001
+
1002
+ return compress;
1003
+ }
6401004
641
- String[] initStyles =
642
- {
643
- "regular", "italic", "bold", "small", "large",
644
- "regular", "button", "regular", "icon",
645
- "regular"
646
- };
1005
+ private JTextPane createTextPane()
1006
+ {
1007
+// TEXTAREA String[] initString =
1008
+// {
1009
+// "This is an editable JTextPane, ", //regular
1010
+// "another ", //italic
1011
+// "styled ", //bold
1012
+// "text ", //small
1013
+// "component, ", //large
1014
+// "which supports embedded components..." + newline,//regular
1015
+// " " + newline, //button
1016
+// "...and embedded icons..." + newline, //regular
1017
+// " ", //icon
1018
+// newline + "JTextPane is a subclass of JEditorPane that "
1019
+// + "uses a StyledEditorKit and StyledDocument, and provides "
1020
+// + "cover methods for interacting with those objects."
1021
+// };
1022
+//
1023
+// String[] initStyles =
1024
+// {
1025
+// "regular", "italic", "bold", "small", "large",
1026
+// "regular", "button", "regular", "icon",
1027
+// "regular"
1028
+// };
1029
+//
1030
+// JTextPane textPane = new JTextPane();
1031
+// textPane.setEditable(true);
1032
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
1033
+// addStylesToDocument(doc);
1034
+//
1035
+// try
1036
+// {
1037
+// for (int j = 0; j < 2; j++)
1038
+// {
1039
+// for (int i = 0; i < initString.length; i++)
1040
+// {
1041
+// doc.insertString(doc.getLength(), initString[i],
1042
+// doc.getStyle(initStyles[i]));
1043
+// }
1044
+// }
1045
+// } catch (BadLocationException ble)
1046
+// {
1047
+// System.err.println("Couldn't insert initial text into text pane.");
1048
+// }
6471049
648
- JTextPane textPane = new JTextPane();
649
- textPane.setEditable(true);
650
- /*StyledDocument*/ doc = textPane.getStyledDocument();
651
- addStylesToDocument(doc);
652
-
653
- try
654
- {
655
- for (int j = 0; j < 2; j++)
656
- {
657
- for (int i = 0; i < initString.length; i++)
658
- {
659
- doc.insertString(doc.getLength(), initString[i],
660
- doc.getStyle(initStyles[i]));
661
- }
662
- }
663
- } catch (BadLocationException ble)
664
- {
665
- System.err.println("Couldn't insert initial text into text pane.");
666
- }
667
-
668
- return new JTextArea(); // textPane;
1050
+ return new JTextPane(); // textPane;
6691051 }
6701052
6711053 protected void addStylesToDocument(StyledDocument doc)
....@@ -718,7 +1100,7 @@
7181100 protected static ImageIcon createImageIcon(String path,
7191101 String description)
7201102 {
721
- java.net.URL imgURL = GrafreeD.class.getResource(path);
1103
+ java.net.URL imgURL = Grafreed.class.getResource(path);
7221104 if (imgURL != null)
7231105 {
7241106 return new ImageIcon(imgURL, description);
....@@ -741,6 +1123,7 @@
7411123 {
7421124 SetupMaterial(materialPanel);
7431125 }
1126
+
7441127 //SetupName();
7451128 //SetupViews();
7461129 }
....@@ -750,6 +1133,7 @@
7501133 // NumberSlider vDivsField;
7511134 // JCheckBox endcaps;
7521135 JCheckBox liveCB;
1136
+ JCheckBox selectableCB;
7531137 JCheckBox hideCB;
7541138 JCheckBox link2masterCB;
7551139 JCheckBox markCB;
....@@ -757,7 +1141,12 @@
7571141 JCheckBox speedupCB;
7581142 JCheckBox rewindCB;
7591143 JCheckBox flipVCB;
1144
+
1145
+ cCheckBox toggleTextureCB;
1146
+ cCheckBox toggleSwitchCB;
1147
+
7601148 JComboBox texresMenu;
1149
+
7611150 JButton resetButton;
7621151 JButton stepButton;
7631152 JButton stepAllButton;
....@@ -765,115 +1154,87 @@
7651154 JButton slowerButton;
7661155 JButton fasterButton;
7671156 JButton remarkButton;
1157
+
1158
+ cGridBag editPanel;
1159
+ cGridBag editCommandsPanel;
1160
+
1161
+ cGridBag namePanel;
1162
+ cGridBag setupPanel;
1163
+ cGridBag setupPanel2;
1164
+ cGridBag objectCommandsPanel;
1165
+ cGridBag pushPanel;
1166
+ cGridBag fillPanel;
7681167
769
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1168
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7701169 {
7711170 JCheckBox cb;
7721171
773
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
774
- oe.aConstraints.gridwidth = 1; // 3;
775
-// oe.aConstraints.weightx = 1;
776
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
777
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1172
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7781173 cb.addItemListener(this);
779
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
780
- oe.aConstraints.gridwidth = 1;
781
- oe.aConstraints.gridx += 1;
7821174
7831175 return cb;
7841176 }
7851177
786
- cButton AddButton(ObjEditor oe, String label)
1178
+ cButton AddButton(cGridBag panel, String label)
7871179 {
7881180 cButton cb;
7891181
790
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
791
- oe.aConstraints.gridwidth = 1;
792
-// oe.aConstraints.weightx = 1;
793
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
794
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1182
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7951183 cb.addActionListener(this);
796
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
797
- oe.aConstraints.gridwidth = 1;
798
- oe.aConstraints.gridx += 1;
7991184
8001185 return cb;
8011186 }
8021187
803
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1188
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
8041189 {
8051190 JComboBox combo;
8061191
807
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
808
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
809
- oe.aConstraints.gridx += 1;
1192
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8101193 combo.addActionListener(this);
8111194
8121195 return combo;
8131196 }
8141197
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
1198
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
8161199 {
817
- NumberSlider combo;
1200
+ cGridBag control = new cGridBag();
1201
+
1202
+ cNumberSlider combo;
8181203
8191204 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
8221205 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
823
- aConstraints.gridwidth = 1;
824
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
825
- aConstraints.gridx += 1;
826
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
827
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
828
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
829
- aConstraints.gridx += 1;
830
- aConstraints.gridwidth = 1;
831
-
1206
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1207
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8321208 combo.setFloat(current);
833
-
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
1209
+
1210
+ panel.add(control);
1211
+
1212
+ return control;
8391213 }
8401214
841
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
1215
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8421216 {
843
- NumberSlider combo;
1217
+ cGridBag control = new cGridBag();
1218
+
1219
+ cNumberSlider combo;
8441220
8451221 JLabel jlabel = new JLabel(label);
846
-
847
- aConstraints.fill = GridBagConstraints.VERTICAL;
8481222 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
849
- aConstraints.gridwidth = 2;
850
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
851
- aConstraints.gridx += 1;
852
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
853
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
854
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
855
- aConstraints.gridx += 1;
856
- aConstraints.gridwidth = 1;
857
-
1223
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1224
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8581225 combo.setInteger(current);
8591226
860
- combo.label = jlabel;
861
-
862
- combo.addChangeListener(this);
863
-
864
- return combo;
1227
+ panel.add(control);
1228
+
1229
+ return control;
8651230 }
8661231
867
- JTextArea AddText(JPanel ctrlPanel, String name)
1232
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8681233 {
8691234 JTextArea text;
8701235
871
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
872
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
873
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1236
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8741237 text.addCaretListener(this);
875
- aConstraints.gridx += 1;
876
- aConstraints.gridwidth = 1;
8771238
8781239 return text;
8791240 }
....@@ -903,9 +1264,16 @@
9031264 objEditor.ctrlPanel.remove(j);
9041265 }
9051266
1267
+ void Remove(cNumberSlider j)
1268
+ {
1269
+ j.removeChangeListener(this);
1270
+ //objEditor.ctrlPanel.remove(j.label);
1271
+ objEditor.ctrlPanel.remove(j);
1272
+ }
1273
+
9061274 /*
9071275 */
908
- void Return() // ObjEditor oe)
1276
+ void Return0() // ObjEditor oe)
9091277 {
9101278 aConstraints.gridy += 1;
9111279 aConstraints.gridx = 0;
....@@ -960,37 +1328,92 @@
9601328
9611329 void SetupUI2(ObjEditor oe)
9621330 {
963
-// oe.aConstraints.weightx = 0;
964
-// oe.aConstraints.weighty = 0;
965
-// oe.aConstraints.gridx = 0;
966
-// oe.aConstraints.gridy = 0;
967
- SetupName(oe);
1331
+ //SetupName(oe);
9681332
969
- if (!GroupEditor.allparams)
1333
+ namePanel = new cGridBag();
1334
+
1335
+ //if (copy.pinned)
1336
+ {
1337
+ pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF);
1338
+ pinButton.setSelected(copy.pinned);
1339
+ cGridBag t = new cGridBag();
1340
+ t.preferredWidth = 2;
1341
+ t.add(pinButton);
1342
+ namePanel.add(t);
1343
+
1344
+ pinButton.addItemListener(this);
1345
+ }
1346
+
1347
+ nameField = AddText(namePanel, copy.GetName());
1348
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
1349
+ oe.ctrlPanel.add(namePanel);
1350
+
1351
+ oe.ctrlPanel.Return();
1352
+
1353
+ if (!allparams)
9701354 return;
9711355
972
- liveCB = AddCheckBox(oe, "Live", copy.live);
973
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
974
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1356
+ setupPanel = new cGridBag().setVertical(false);
1357
+
1358
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1359
+ liveCB.setToolTipText("Animate object");
1360
+ markCB = AddCheckBox(setupPanel, "Anim", copy.marked);
1361
+ markCB.setToolTipText("Set target transform");
1362
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1363
+ selectableCB.setToolTipText("Make object selectable");
9751364 // Return();
976
- markCB = AddCheckBox(oe, "Mark", copy.marked);
977
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
978
- randomCB = AddCheckBox(oe, "Rand", copy.random);
979
- Return();
980
- resetButton = AddButton(oe, "Reset");
981
- stepButton = AddButton(oe, "Step");
1365
+
1366
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1367
+ hideCB.setToolTipText("Hide object");
1368
+
1369
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
1370
+
1371
+ setupPanel2 = new cGridBag().setVertical(false);
1372
+
1373
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1374
+ rewindCB.setToolTipText("Rewind animation");
1375
+
1376
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1377
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1378
+
1379
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1380
+ link2masterCB.setToolTipText("Attach to support");
1381
+
1382
+ if (Globals.ADVANCED)
1383
+ {
1384
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1385
+ speedupCB.setToolTipText("Option motion capture");
1386
+ }
1387
+
1388
+ oe.ctrlPanel.add(setupPanel);
1389
+ oe.ctrlPanel.Return();
1390
+ oe.ctrlPanel.add(setupPanel2);
1391
+ oe.ctrlPanel.Return();
1392
+
1393
+ objectCommandsPanel = new cGridBag().setVertical(false);
1394
+
1395
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1396
+ resetButton.setToolTipText("Jump to frame zero");
1397
+ stepButton = AddButton(objectCommandsPanel, "Step");
1398
+ stepButton.setToolTipText("Step one frame");
9821399 // resetAllButton = AddButton(oe, "Reset All");
9831400 // stepAllButton = AddButton(oe, "Step All");
984
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9851401 // Return();
986
- slowerButton = AddButton(oe, "Slow");
987
- fasterButton = AddButton(oe, "Fast");
988
- remarkButton = AddButton(oe, "Rem");
1402
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1403
+ slowerButton.setToolTipText("Decrease animation speed");
1404
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1405
+ fasterButton.setToolTipText("Increase animation speed");
1406
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1407
+ remarkButton.setToolTipText("Set the current transform as the target");
9891408
990
- Return();
1409
+ oe.ctrlPanel.add(objectCommandsPanel);
1410
+ oe.ctrlPanel.Return();
9911411
992
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
993
- Return();
1412
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1413
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1414
+ //Return();
1415
+
1416
+ oe.ctrlPanel.Return();
9941417
9951418 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9961419 // ObjEditor.aConstraints.gridx += 1;
....@@ -1085,7 +1508,7 @@
10851508 oe.aConstraints.gridwidth = 1;
10861509 /**/
10871510 nameField = AddText(oe.ctrlPanel, copy.GetName());
1088
- Return();
1511
+ oe.ctrlPanel.Return();
10891512
10901513 //ctrlPanel.add(textureButton = new Button("Texture..."));
10911514 //textureButton.setEnabled(false);
....@@ -1143,22 +1566,9 @@
11431566
11441567 if (cam == null || !(copy.get(0) instanceof cGroup))
11451568 {
1146
- System.out.println("CREATE CAMERAS");
1147
- cams = new cTemplate();
1148
- cams.name = "Cameras";
1149
- copy.insertElementAt(cams, 0);
1150
- //cams.parent = copy;
1151
-
1152
- cam = new Camera(); // LA.newVector(3, 2, 1));
1153
- cams.addChild(cam);
1154
- cam = new Camera(1);
1155
- cams.addChild(cam);
1156
- cam = new Camera(2);
1157
- cams.addChild(cam);
1158
- cam = new Camera(3);
1159
- cams.addChild(cam);
1160
- cam = new Camera(4); // Light
1161
- cams.addChild(cam);
1569
+ if (Globals.DEBUG)
1570
+ System.out.println("CREATE CAMERAS");
1571
+ cams = CreateCameras();
11621572 } else
11631573 {
11641574 cams = (cGroup) copy.get(0);
....@@ -1187,9 +1597,13 @@
11871597 //JPanel worldPanel =
11881598 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11891599 //worldPanel.setName("World");
1190
- centralPanel = new JPanel(new BorderLayout());
1191
- timelinePanel = new JPanel(new BorderLayout());
1192
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1600
+ centralPanel = new cGridBag();
1601
+ centralPanel.preferredWidth = 20;
1602
+
1603
+ if (Globals.ADVANCED)
1604
+ {
1605
+ timelinePanel = new JPanel(new BorderLayout());
1606
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11931607
11941608 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11951609 cameraPanel.setContinuousLayout(true);
....@@ -1198,7 +1612,10 @@
11981612 // cameraPanel.setDividerSize(9);
11991613 cameraPanel.setResizeWeight(1.0);
12001614
1615
+ }
1616
+
12011617 centralPanel.add(cameraView);
1618
+ centralPanel.setFocusable(true);
12021619 //frame.setJMenuBar(timelineMenubar);
12031620 //centralPanel.add(timelinePanel);
12041621
....@@ -1217,13 +1634,57 @@
12171634 //frontView.object = copy;
12181635 //sideView.object = copy;
12191636
1220
- XYZPanel = new JPanel();
1221
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1637
+ transformPanel = new cGridBag().setVertical(true);
1638
+
1639
+ cGridBag resetTransformPanel = new cGridBag();
1640
+
1641
+ resetTransformPanel.preferredHeight = 2;
1642
+
1643
+ cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF);
1644
+ resetTransform.setToolTipText("Reset Translation, Rotation and Scale");
1645
+ resetTransform.addMouseListener(new MouseAdapter()
1646
+ {
1647
+ public void mouseClicked(MouseEvent e)
1648
+ {
1649
+ ResetTransform();
1650
+ }
1651
+ });
1652
+ resetTransformPanel.add(resetTransform);
1653
+
1654
+ resetTransform = GetButton("T only", !Globals.NIMBUSLAF);
1655
+ resetTransform.setToolTipText("Reset Translation only");
1656
+ resetTransform.addMouseListener(new MouseAdapter()
1657
+ {
1658
+ public void mouseClicked(MouseEvent e)
1659
+ {
1660
+ ResetTransform(1);
1661
+ }
1662
+ });
1663
+ resetTransformPanel.add(resetTransform);
1664
+
1665
+ resetTransform = GetButton("RS only", !Globals.NIMBUSLAF);
1666
+ resetTransform.setToolTipText("Reset Rotation and Scale only");
1667
+ resetTransform.addMouseListener(new MouseAdapter()
1668
+ {
1669
+ public void mouseClicked(MouseEvent e)
1670
+ {
1671
+ ResetTransform(2);
1672
+ }
1673
+ });
1674
+ resetTransformPanel.add(resetTransform);
1675
+
1676
+ XYZPanel = new cGridBag().setVertical(true);
1677
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12221678
1223
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1224
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1225
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1679
+ XYZPanel.preferredWidth = 5;
1680
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1681
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1682
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1683
+ //XYZPanel.setName("XYZ");
12261684
1685
+ transformPanel.add(resetTransformPanel);
1686
+ transformPanel.add(XYZPanel);
1687
+
12271688 /*
12281689 gridPanel = new JPanel(); //new BorderLayout());
12291690 gridPanel.setLayout(new GridLayout(1, 2));
....@@ -1231,12 +1692,12 @@
12311692 gridPanel.add(cameraView);
12321693 gridPanel.add(XYZPanel);
12331694 */
1234
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1235
- gridPanel.setContinuousLayout(true);
1236
- gridPanel.setOneTouchExpandable(true);
1237
- gridPanel.setDividerLocation(1.0);
1238
- gridPanel.setDividerSize(9);
1239
- gridPanel.setResizeWeight(0.85);
1695
+// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1696
+// gridPanel.setContinuousLayout(true);
1697
+// gridPanel.setOneTouchExpandable(true);
1698
+// gridPanel.setDividerLocation(1.0);
1699
+// gridPanel.setDividerSize(9);
1700
+// gridPanel.setResizeWeight(0.85);
12401701
12411702 // aConstraints.weighty = 0;
12421703 //System.out.println("THIS = " + this);
....@@ -1259,13 +1720,34 @@
12591720
12601721 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12611722 //tmp.setName("Edit");
1262
- objectPanel.add(materialPanel);
1263
- JPanel north = new JPanel(new BorderLayout());
1264
- north.setName("Edit");
1265
- north.add(ctrlPanel, BorderLayout.NORTH);
1266
- objectPanel.add(north);
1267
- objectPanel.add(infoPanel);
1723
+ objectPanel.add(skyboxPanel);
1724
+ objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg"));
1725
+ objectPanel.setToolTipTextAt(0, "Backgrounds");
1726
+
1727
+ objectPanel.add(toolboxPanel);
1728
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1729
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
12681730
1731
+ objectPanel.add(materialPanel);
1732
+ objectPanel.setIconAt(2, GetIcon("icons/material.png"));
1733
+ objectPanel.setToolTipTextAt(2, "Material");
1734
+
1735
+// JPanel north = new JPanel(new BorderLayout());
1736
+// north.setName("Edit");
1737
+// north.add(ctrlPanel, BorderLayout.NORTH);
1738
+// objectPanel.add(north);
1739
+ objectPanel.add(editPanel);
1740
+ objectPanel.setIconAt(3, GetIcon("icons/writewhite.png"));
1741
+ objectPanel.setToolTipTextAt(3, "Edit controls");
1742
+
1743
+ objectPanel.add(transformPanel);
1744
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1745
+ objectPanel.setToolTipTextAt(4, "TRS transform");
1746
+
1747
+ patchMaterial = true;
1748
+ cameraView.patchMaterial = this;
1749
+ objectPanel.setSelectedIndex(2);
1750
+
12691751 /*
12701752 aConstraints.gridx = 0;
12711753 aConstraints.gridwidth = 1;
....@@ -1273,7 +1755,7 @@
12731755 aConstraints.gridy += 1;
12741756 aConstraints.gridwidth = 1;
12751757 mainPanel.add(objectPanel, aConstraints);
1276
- */
1758
+ */
12771759
12781760 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12791761 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1284,16 +1766,120 @@
12841766 scrollpane.setWheelScrollingEnabled(true);
12851767 scrollpane.addMouseWheelListener(this); // Default not fast enough
12861768
1287
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1288
- scenePanel.add(scrollpane);
1769
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1770
+ scenePanel.preferredWidth = 5;
1771
+
1772
+ JTabbedPane tabbedPane = new JTabbedPane();
1773
+ tabbedPane.add(scrollpane);
12891774
1290
- scenePanel.add(FSPane = new cFileSystemPane(this));
1291
-
1292
- optionsPanel = new JPanel(new GridBagLayout());
1775
+ optionsPanel = new cGridBag().setVertical(false);
12931776
12941777 optionsPanel.setName("Options");
1295
- scenePanel.add(optionsPanel);
1778
+
1779
+ AddOptions(optionsPanel); //, aConstraints);
1780
+
1781
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12961782
1783
+ tabbedPane.add(optionsPanel);
1784
+
1785
+ scenePanel.add(tabbedPane);
1786
+
1787
+ cGridBag creditsPanel = new cGridBag().setVertical(true);
1788
+ creditsPanel.setName("Credits");
1789
+
1790
+ cLabel ogaLabel = new cLabel(" Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
1791
+ creditsPanel.add(ogaLabel);
1792
+
1793
+ cButton creditButton;
1794
+ creditsPanel.add(creditButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF));
1795
+ creditButton.setToolTipText("https://opengameart.org");
1796
+
1797
+ creditButton.addMouseListener(new MouseAdapter()
1798
+ {
1799
+ public void mouseClicked(MouseEvent e)
1800
+ {
1801
+ try
1802
+ {
1803
+ Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/"));
1804
+ } catch (Exception e1)
1805
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1806
+ {
1807
+ e1.printStackTrace();
1808
+ }
1809
+ }
1810
+ });
1811
+
1812
+ ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF);
1813
+ creditsPanel.add(ogaLabel);
1814
+
1815
+ creditsPanel.add(creditButton = GetButton("icons/3delicious.png", !Globals.NIMBUSLAF));
1816
+ creditButton.setToolTipText("https://3delicious.net");
1817
+
1818
+ creditButton.addMouseListener(new MouseAdapter()
1819
+ {
1820
+ public void mouseClicked(MouseEvent e)
1821
+ {
1822
+ try
1823
+ {
1824
+ Desktop.getDesktop().browse(new java.net.URI("https://3delicious.net"));
1825
+ } catch (Exception e1)
1826
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1827
+ {
1828
+ e1.printStackTrace();
1829
+ }
1830
+ }
1831
+ });
1832
+
1833
+ creditsPanel.add(creditButton = GetButton("icons/archive3d.png", !Globals.NIMBUSLAF));
1834
+ creditButton.setToolTipText("https://archive3d.net");
1835
+
1836
+ creditButton.addMouseListener(new MouseAdapter()
1837
+ {
1838
+ public void mouseClicked(MouseEvent e)
1839
+ {
1840
+ try
1841
+ {
1842
+ Desktop.getDesktop().browse(new java.net.URI("https://archive3d.net"));
1843
+ } catch (Exception e1)
1844
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1845
+ {
1846
+ e1.printStackTrace();
1847
+ }
1848
+ }
1849
+ });
1850
+
1851
+ creditsPanel.add(creditButton = GetButton("icons/turbosquid.png", !Globals.NIMBUSLAF));
1852
+ creditButton.setToolTipText("https://turbosquid.com");
1853
+
1854
+ creditButton.addMouseListener(new MouseAdapter()
1855
+ {
1856
+ public void mouseClicked(MouseEvent e)
1857
+ {
1858
+ try
1859
+ {
1860
+ Desktop.getDesktop().browse(new java.net.URI("https://www.turbosquid.com/Search/3D-Models/free"));
1861
+ } catch (Exception e1)
1862
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1863
+ {
1864
+ e1.printStackTrace();
1865
+ }
1866
+ }
1867
+ });
1868
+
1869
+ for (int i=6; --i>=0;)
1870
+ {
1871
+ creditsPanel.add(new cGridBag());
1872
+ }
1873
+
1874
+ tabbedPane.add(creditsPanel);
1875
+ tabbedPane.setToolTipTextAt(3, "Credits");
1876
+
1877
+ if (Globals.ADVANCED)
1878
+ {
1879
+ objectPanel.add(infoPanel);
1880
+ objectPanel.setIconAt(5, GetIcon("icons/info.png"));
1881
+ objectPanel.setToolTipTextAt(4, "Information");
1882
+ }
12971883
12981884 /*
12991885 cTree jTree = new cTree(null);
....@@ -1315,18 +1901,19 @@
13151901 jtp.add(tree);
13161902 */
13171903
1318
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1319
- bigPanel.setContinuousLayout(true);
1320
- bigPanel.setOneTouchExpandable(true);
1321
- bigPanel.setDividerLocation(0.8);
1322
- bigPanel.setDividerSize(15);
1323
- bigPanel.setResizeWeight(0.15);
1324
- bigPanel.setName("Scene");
1904
+// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1905
+// bigPanel.setContinuousLayout(true);
1906
+// bigPanel.setOneTouchExpandable(true);
1907
+// bigPanel.setDividerLocation(0.8);
1908
+// bigPanel.setDividerSize(15);
1909
+// bigPanel.setResizeWeight(0.15);
1910
+// bigPanel.setName("Scene");
13251911
13261912 //bigPanel.setLayout(new BorderLayout());
13271913 //bigPanel.setSize(new Dimension(10,10));
13281914 //bigPanel.add(ctrlPanel);
13291915 //bigPanel.add(gridPanel);
1916
+ /**
13301917 bigThree = new JPanel();
13311918 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
13321919 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1350,7 +1937,13 @@
13501937 // aConstraints.gridheight = 3;
13511938 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13521939 bigThree.add(XYZPanel, aWindowConstraints);
1940
+ /**/
13531941
1942
+ bigThree = new cGridBag();
1943
+ bigThree.addComponent(scenePanel);
1944
+ bigThree.addComponent(centralPanel);
1945
+ //bigThree.addComponent(XYZPanel);
1946
+
13541947 // // SIDE EFFECT!!!
13551948 // aConstraints.gridx = 0;
13561949 // aConstraints.gridy = 0;
....@@ -1358,16 +1951,33 @@
13581951 // aConstraints.gridheight = 1;
13591952
13601953 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1361
- framePanel.setContinuousLayout(true);
1362
- framePanel.setOneTouchExpandable(true);
1363
- framePanel.setDividerLocation(0.8);
1954
+
1955
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
1956
+ new java.beans.PropertyChangeListener()
1957
+ {
1958
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
1959
+ {
1960
+ if ((Integer)pce.getOldValue() == 1)
1961
+ {
1962
+ if (radio.layout != expandedLayout)
1963
+ {
1964
+ radio.layout = expandedLayout;
1965
+ radio.layout.doClick();
1966
+ }
1967
+ }
1968
+ }
1969
+ });
1970
+
1971
+ framePanel.setContinuousLayout(false);
1972
+ framePanel.setOneTouchExpandable(false);
1973
+ //.setDividerLocation(0.8);
13641974 //framePanel.setDividerSize(15);
13651975 //framePanel.setResizeWeight(0.15);
13661976 framePanel.setName("Frame");
13671977
13681978 frame.getContentPane().setLayout(new BorderLayout());
13691979 /**/
1370
- JTabbedPane worldPane = new JTabbedPane();
1980
+ //JTabbedPane worldPane = new JTabbedPane();
13711981 //worldPane.add(bigPanel);
13721982 //worldPane.add(worldPanel);
13731983 /**/
....@@ -1377,15 +1987,19 @@
13771987
13781988 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13791989
1380
- frame.setSize(1024, 768);
1381
- frame.show();
1990
+ frame.setSize(1280, 860);
1991
+
1992
+ cameraView.requestFocusInWindow();
1993
+
1994
+// gridPanel.setDividerLocation(1.0);
1995
+
1996
+ frame.validate();
13821997
1383
- gridPanel.setDividerLocation(1.0);
1998
+ frame.setVisible(true);
13841999
13852000 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13862001 frame.addWindowListener(new WindowAdapter()
13872002 {
1388
-
13892003 public void windowClosing(WindowEvent e)
13902004 {
13912005 Close();
....@@ -1393,6 +2007,10 @@
13932007 });
13942008 }
13952009
2010
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
2011
+ {
2012
+ }
2013
+
13962014 JTree GetTree()
13972015 {
13982016 return objEditor.jTree;
....@@ -1404,260 +2022,651 @@
14042022 ctrlPanel.removeAll();
14052023 }
14062024
1407
- void SetupMaterial(JPanel ctrlPanel)
2025
+ void SetupMaterial(cGridBag materialpanel)
14082026 {
1409
- aConstraints.weighty = 0;
1410
- //aConstraints.weightx = 1;
1411
- /*
2027
+ cGridBag presetpanel = new cGridBag().setVertical(true);
2028
+
2029
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF);
2030
+ skin.setToolTipText("Skin");
2031
+ skin.addMouseListener(new MouseAdapter()
2032
+ {
2033
+ public void mouseClicked(MouseEvent e)
2034
+ {
2035
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
2036
+ cMaterial material = object.material;
2037
+
2038
+ // Skin
2039
+ colorField.setFloat(material.color);
2040
+ float saturation = material.modulation;
2041
+
2042
+ if (!cameraView.Skinshader)
2043
+ {
2044
+ saturation /= 1.5;
2045
+ }
2046
+
2047
+ saturationField.setFloat(saturation);
2048
+
2049
+ subsurfaceField.setFloat(material.subsurface);
2050
+ selfshadowField.setFloat(material.diffuseness);
2051
+ diffusenessField.setFloat(material.factor);
2052
+ shininessField.setFloat(material.shininess);
2053
+ shadowbiasField.setFloat(material.shadowbias);
2054
+ diffuseField.setFloat(material.diffuse);
2055
+ specularField.setFloat(material.specular);
2056
+
2057
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2058
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2059
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2060
+
2061
+ materialtouched = true;
2062
+ applySelf();
2063
+ }
2064
+ });
2065
+ presetpanel.add(skin);
2066
+
2067
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF);
2068
+ lambert.setToolTipText("Diffuse");
2069
+ lambert.addMouseListener(new MouseAdapter()
2070
+ {
2071
+ public void mouseClicked(MouseEvent e)
2072
+ {
2073
+ Object3D object = Grafreed.materials.versionlist[2].get(0);
2074
+ cMaterial material = object.material;
2075
+
2076
+ diffusenessField.setFloat(material.factor);
2077
+ selfshadowField.setFloat(material.diffuseness);
2078
+
2079
+ materialtouched = true;
2080
+ applySelf();
2081
+ }
2082
+ });
2083
+ presetpanel.add(lambert);
2084
+
2085
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF);
2086
+ diffuse2.setToolTipText("Diffuse2");
2087
+ diffuse2.addMouseListener(new MouseAdapter()
2088
+ {
2089
+ public void mouseClicked(MouseEvent e)
2090
+ {
2091
+ Object3D object = Grafreed.materials.versionlist[3].get(0);
2092
+ cMaterial material = object.material;
2093
+
2094
+ diffusenessField.setFloat(material.factor);
2095
+ selfshadowField.setFloat(material.diffuseness);
2096
+
2097
+ materialtouched = true;
2098
+ applySelf();
2099
+ }
2100
+ });
2101
+ presetpanel.add(diffuse2);
2102
+
2103
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF);
2104
+ diffusemoon.setToolTipText("Moon");
2105
+ diffusemoon.addMouseListener(new MouseAdapter()
2106
+ {
2107
+ public void mouseClicked(MouseEvent e)
2108
+ {
2109
+ Object3D object = Grafreed.materials.versionlist[4].get(0);
2110
+ cMaterial material = object.material;
2111
+
2112
+ diffusenessField.setFloat(material.factor);
2113
+ selfshadowField.setFloat(material.diffuseness);
2114
+
2115
+ materialtouched = true;
2116
+ applySelf();
2117
+ }
2118
+ });
2119
+ presetpanel.add(diffusemoon);
2120
+
2121
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF);
2122
+ diffusemoon2.setToolTipText("Moon2");
2123
+ diffusemoon2.addMouseListener(new MouseAdapter()
2124
+ {
2125
+ public void mouseClicked(MouseEvent e)
2126
+ {
2127
+ Object3D object = Grafreed.materials.versionlist[5].get(0);
2128
+ cMaterial material = object.material;
2129
+
2130
+ diffusenessField.setFloat(material.factor);
2131
+ selfshadowField.setFloat(material.diffuseness);
2132
+
2133
+ materialtouched = true;
2134
+ applySelf();
2135
+ }
2136
+ });
2137
+ presetpanel.add(diffusemoon2);
2138
+
2139
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF);
2140
+ diffusemoon3.setToolTipText("Moon3");
2141
+ diffusemoon3.addMouseListener(new MouseAdapter()
2142
+ {
2143
+ public void mouseClicked(MouseEvent e)
2144
+ {
2145
+ Object3D object = Grafreed.materials.versionlist[6].get(0);
2146
+ cMaterial material = object.material;
2147
+
2148
+ diffusenessField.setFloat(material.factor);
2149
+ selfshadowField.setFloat(material.diffuseness);
2150
+
2151
+ materialtouched = true;
2152
+ applySelf();
2153
+ }
2154
+ });
2155
+ presetpanel.add(diffusemoon3);
2156
+
2157
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF);
2158
+ diffusesheen.setToolTipText("Sheen");
2159
+ diffusesheen.addMouseListener(new MouseAdapter()
2160
+ {
2161
+ public void mouseClicked(MouseEvent e)
2162
+ {
2163
+ Object3D object = Grafreed.materials.versionlist[7].get(0);
2164
+ cMaterial material = object.material;
2165
+
2166
+ sheenField.setFloat(material.sheen);
2167
+
2168
+ materialtouched = true;
2169
+ applySelf();
2170
+ }
2171
+ });
2172
+ presetpanel.add(diffusesheen);
2173
+
2174
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF);
2175
+ rough.setToolTipText("Rough metal");
2176
+ rough.addMouseListener(new MouseAdapter()
2177
+ {
2178
+ public void mouseClicked(MouseEvent e)
2179
+ {
2180
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
2181
+ cMaterial material = object.material;
2182
+
2183
+ shininessField.setFloat(material.shininess);
2184
+ velvetField.setFloat(material.velvet);
2185
+
2186
+ materialtouched = true;
2187
+ applySelf();
2188
+ }
2189
+ });
2190
+ presetpanel.add(rough);
2191
+
2192
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF);
2193
+ rough2.setToolTipText("Medium metal");
2194
+ rough2.addMouseListener(new MouseAdapter()
2195
+ {
2196
+ public void mouseClicked(MouseEvent e)
2197
+ {
2198
+ Object3D object = Grafreed.materials.versionlist[13].get(0);
2199
+ cMaterial material = object.material;
2200
+
2201
+ shininessField.setFloat(material.shininess);
2202
+ lightareaField.setFloat(material.lightarea);
2203
+
2204
+ materialtouched = true;
2205
+ applySelf();
2206
+ }
2207
+ });
2208
+ presetpanel.add(rough2);
2209
+
2210
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF);
2211
+ shini0.setToolTipText("Shiny");
2212
+ shini0.addMouseListener(new MouseAdapter()
2213
+ {
2214
+ public void mouseClicked(MouseEvent e)
2215
+ {
2216
+ Object3D object = Grafreed.materials.versionlist[14].get(0);
2217
+ cMaterial material = object.material;
2218
+
2219
+ shininessField.setFloat(material.shininess);
2220
+ lightareaField.setFloat(material.lightarea);
2221
+
2222
+ materialtouched = true;
2223
+ applySelf();
2224
+ }
2225
+ });
2226
+ presetpanel.add(shini0);
2227
+
2228
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF);
2229
+ shini1.setToolTipText("Shiny2");
2230
+ shini1.addMouseListener(new MouseAdapter()
2231
+ {
2232
+ public void mouseClicked(MouseEvent e)
2233
+ {
2234
+ Object3D object = Grafreed.materials.versionlist[11].get(0);
2235
+ cMaterial material = object.material;
2236
+
2237
+ shininessField.setFloat(material.shininess);
2238
+ lightareaField.setFloat(material.lightarea);
2239
+
2240
+ materialtouched = true;
2241
+ applySelf();
2242
+ }
2243
+ });
2244
+ presetpanel.add(shini1);
2245
+
2246
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF);
2247
+ shini2.setToolTipText("Shiny3");
2248
+ shini2.addMouseListener(new MouseAdapter()
2249
+ {
2250
+ public void mouseClicked(MouseEvent e)
2251
+ {
2252
+ Object3D object = Grafreed.materials.versionlist[12].get(0);
2253
+ cMaterial material = object.material;
2254
+
2255
+ shininessField.setFloat(material.shininess);
2256
+ lightareaField.setFloat(material.lightarea);
2257
+
2258
+ materialtouched = true;
2259
+ applySelf();
2260
+ }
2261
+ });
2262
+ presetpanel.add(shini2);
2263
+
2264
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF);
2265
+ aniso.setToolTipText("AnisoU");
2266
+ aniso.addMouseListener(new MouseAdapter()
2267
+ {
2268
+ public void mouseClicked(MouseEvent e)
2269
+ {
2270
+ Object3D object = Grafreed.materials.versionlist[8].get(0);
2271
+ cMaterial material = object.material;
2272
+
2273
+ anisoField.setFloat(material.aniso);
2274
+ anisoVField.setFloat(material.anisoV);
2275
+
2276
+ materialtouched = true;
2277
+ applySelf();
2278
+ }
2279
+ });
2280
+ presetpanel.add(aniso);
2281
+
2282
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF);
2283
+ aniso2.setToolTipText("AnisoV");
2284
+ aniso2.addMouseListener(new MouseAdapter()
2285
+ {
2286
+ public void mouseClicked(MouseEvent e)
2287
+ {
2288
+ Object3D object = Grafreed.materials.versionlist[9].get(0);
2289
+ cMaterial material = object.material;
2290
+
2291
+ anisoField.setFloat(material.aniso);
2292
+ anisoVField.setFloat(material.anisoV);
2293
+
2294
+ materialtouched = true;
2295
+ applySelf();
2296
+ }
2297
+ });
2298
+ presetpanel.add(aniso2);
2299
+
2300
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF);
2301
+ aniso3.setToolTipText("AnisoUV");
2302
+ aniso3.addMouseListener(new MouseAdapter()
2303
+ {
2304
+ public void mouseClicked(MouseEvent e)
2305
+ {
2306
+ Object3D object = Grafreed.materials.versionlist[10].get(0);
2307
+ cMaterial material = object.material;
2308
+
2309
+ anisoField.setFloat(material.aniso);
2310
+ anisoVField.setFloat(material.anisoV);
2311
+
2312
+ materialtouched = true;
2313
+ applySelf();
2314
+ }
2315
+ });
2316
+ presetpanel.add(aniso3);
2317
+
2318
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF);
2319
+ velvet0.setToolTipText("Velvet");
2320
+ velvet0.addMouseListener(new MouseAdapter()
2321
+ {
2322
+ public void mouseClicked(MouseEvent e)
2323
+ {
2324
+ Object3D object = Grafreed.materials.versionlist[15].get(0);
2325
+ cMaterial material = object.material;
2326
+
2327
+ diffusenessField.setFloat(material.factor);
2328
+ selfshadowField.setFloat(material.diffuseness);
2329
+ sheenField.setFloat(material.sheen);
2330
+ shininessField.setFloat(material.shininess);
2331
+ velvetField.setFloat(material.velvet);
2332
+ shiftField.setFloat(material.shift);
2333
+
2334
+ materialtouched = true;
2335
+ applySelf();
2336
+ }
2337
+ });
2338
+ presetpanel.add(velvet0);
2339
+
2340
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF);
2341
+ bump0.setToolTipText("Bump texture");
2342
+ bump0.addMouseListener(new MouseAdapter()
2343
+ {
2344
+ public void mouseClicked(MouseEvent e)
2345
+ {
2346
+ Object3D object = Grafreed.materials.versionlist[16].get(0);
2347
+ cMaterial material = object.material;
2348
+
2349
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2350
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2351
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2352
+
2353
+ materialtouched = true;
2354
+ applySelf();
2355
+ }
2356
+ });
2357
+ presetpanel.add(bump0);
2358
+
2359
+ cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF);
2360
+ borderShader.setToolTipText("Border fade");
2361
+ borderShader.addMouseListener(new MouseAdapter()
2362
+ {
2363
+ public void mouseClicked(MouseEvent e)
2364
+ {
2365
+ borderfadeField.setFloat(0.4);
2366
+ opacityField.setFloat(0.75);
2367
+
2368
+ materialtouched = true;
2369
+ applySelf();
2370
+ }
2371
+ });
2372
+ presetpanel.add(borderShader);
2373
+
2374
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF);
2375
+ halo.setToolTipText("Halo");
2376
+ halo.addMouseListener(new MouseAdapter()
2377
+ {
2378
+ public void mouseClicked(MouseEvent e)
2379
+ {
2380
+ Object3D object = Grafreed.materials.versionlist[17].get(0);
2381
+ cMaterial material = object.material;
2382
+
2383
+ opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
2384
+
2385
+ materialtouched = true;
2386
+ applySelf();
2387
+ }
2388
+ });
2389
+ presetpanel.add(halo);
2390
+
2391
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF);
2392
+ candle.setToolTipText("Candle");
2393
+ candle.addMouseListener(new MouseAdapter()
2394
+ {
2395
+ public void mouseClicked(MouseEvent e)
2396
+ {
2397
+ Object3D object = Grafreed.materials.versionlist[18].get(0);
2398
+ cMaterial material = object.material;
2399
+
2400
+ subsurfaceField.setFloat(material.subsurface);
2401
+ shadowbiasField.setFloat(material.shadowbias);
2402
+ ambientField.setFloat(material.ambient);
2403
+ specularField.setFloat(material.specular);
2404
+ lightareaField.setFloat(material.lightarea);
2405
+ shininessField.setFloat(material.shininess);
2406
+
2407
+ materialtouched = true;
2408
+ applySelf();
2409
+ }
2410
+ });
2411
+ presetpanel.add(candle);
2412
+
2413
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF);
2414
+ shadowShader.setToolTipText("Shadow");
2415
+ shadowShader.addMouseListener(new MouseAdapter()
2416
+ {
2417
+ public void mouseClicked(MouseEvent e)
2418
+ {
2419
+ diffuseField.setFloat(0.001);
2420
+ ambientField.setFloat(0.001);
2421
+ cameraField.setFloat(0.001);
2422
+ specularField.setFloat(0.001);
2423
+ fakedepthField.setFloat(0.001);
2424
+ opacityField.setFloat(0.6);
2425
+
2426
+ materialtouched = true;
2427
+ applySelf();
2428
+ }
2429
+ });
2430
+ presetpanel.add(shadowShader);
2431
+
2432
+ cLabel para0 = GetLabel("icons/shadericons/parallax0.png", !Globals.NIMBUSLAF);
2433
+ para0.setToolTipText("No parallax");
2434
+ para0.addMouseListener(new MouseAdapter()
2435
+ {
2436
+ public void mouseClicked(MouseEvent e)
2437
+ {
2438
+ parallaxField.setFloat(0.125);
2439
+
2440
+ materialtouched = true;
2441
+ applySelf();
2442
+ }
2443
+ });
2444
+ presetpanel.add(para0);
2445
+
2446
+ cLabel para1 = GetLabel("icons/shadericons/parallax1.png", !Globals.NIMBUSLAF);
2447
+ para1.setToolTipText("With parallax");
2448
+ para1.addMouseListener(new MouseAdapter()
2449
+ {
2450
+ public void mouseClicked(MouseEvent e)
2451
+ {
2452
+ parallaxField.setFloat(0.13);
2453
+
2454
+ materialtouched = true;
2455
+ applySelf();
2456
+ }
2457
+ });
2458
+ presetpanel.add(para1);
2459
+
2460
+ cLabel para2 = GetLabel("icons/shadericons/parallax2.png", !Globals.NIMBUSLAF);
2461
+ para2.setToolTipText("Reset parallax");
2462
+ para2.addMouseListener(new MouseAdapter()
2463
+ {
2464
+ public void mouseClicked(MouseEvent e)
2465
+ {
2466
+ parallaxField.setFloat(0.14);
2467
+
2468
+ materialtouched = true;
2469
+ applySelf();
2470
+ }
2471
+ });
2472
+ presetpanel.add(para2);
2473
+
2474
+ cGridBag panel = new cGridBag().setVertical(true);
2475
+
2476
+ presetpanel.preferredWidth = 1;
2477
+
2478
+ materialpanel.add(presetpanel);
2479
+ materialpanel.add(panel);
2480
+
2481
+ panel.preferredWidth = 8;
2482
+
2483
+ /*
14122484 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14132485 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1414
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1415
- aConstraints.gridx += 1;
1416
- */
2486
+ */
14172487
1418
- aConstraints.gridwidth = 1;
1419
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1420
- aConstraints.gridx += 1;
1421
- aConstraints.weighty = 0;
1422
- aConstraints.gridwidth = 1;
2488
+ cGridBag editBar = new cGridBag().setVertical(false);
2489
+
2490
+ editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints);
2491
+ createMaterialButton.setToolTipText("Create material");
14232492
14242493 /*
14252494 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1426
- aConstraints.gridx += 1;
1427
- aConstraints.weighty = 0;
1428
- aConstraints.gridwidth = 1;
14292495 */
14302496
1431
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1432
- aConstraints.gridx += 1;
2497
+ editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints);
2498
+ clearMaterialButton.setToolTipText("Clear material");
2499
+
2500
+ if (Globals.ADVANCED)
2501
+ {
2502
+ editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints);
2503
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
2504
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
2505
+ }
14332506
1434
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1435
-
1436
- aConstraints.gridx += 1;
1437
-
1438
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1439
-
1440
- aConstraints.gridx += 1;
1441
-
1442
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1443
-
1444
- aConstraints.gridx = 0;
1445
- aConstraints.gridy += 1;
1446
- aConstraints.weighty = 0;
1447
- aConstraints.gridwidth = 1;
2507
+ editBar.preferredHeight = 15;
2508
+
2509
+ panel.add(editBar);
2510
+
14482511 /**/
14492512 //aConstraints.weighty = 0;
14502513 ////aConstraints.weightx = 1;
14512514 //aConstraints.weighty = 1;
14522515 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14532516 //aConstraints.gridx += 1;
1454
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1455
- aConstraints.weighty = 0;
1456
- aConstraints.gridx = 0;
1457
- aConstraints.gridy += 1;
1458
- aConstraints.gridwidth = 1;
2517
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14592518
1460
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1461
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1462
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1463
- aConstraints.gridx += 1;
1464
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1465
- //aConstraints.weightx = 0;
1466
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1467
- aConstraints.gridx = 0;
1468
- aConstraints.gridy += 1;
1469
- aConstraints.gridwidth = 1;
2519
+ cGridBag colorSection = new cGridBag().setVertical(true);
14702520
1471
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1472
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1473
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1474
- aConstraints.gridx += 1;
1475
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1476
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1477
- aConstraints.gridx = 0;
1478
- aConstraints.gridy += 1;
1479
- aConstraints.gridwidth = 1;
2521
+ cGridBag huepanel = new cGridBag();
2522
+ cGridBag huelabel = new cGridBag();
2523
+ cLabel hue = GetLabel("icons/hue.png", false);
2524
+ hue.fit = true;
2525
+
2526
+ hue.addMouseListener(new MouseAdapter()
2527
+ {
2528
+ public void mousePressed(MouseEvent e)
2529
+ {
2530
+ int x = e.getX();
2531
+
2532
+ colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth());
2533
+ }
2534
+ });
2535
+
2536
+ huelabel.add(hue);
2537
+ huelabel.preferredWidth = 20;
2538
+ huepanel.add(new cGridBag()); // Label
2539
+ huepanel.add(huelabel); // Field/slider
2540
+
2541
+ huepanel.preferredHeight = 7;
14802542
1481
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1482
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1483
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1484
- aConstraints.gridx += 1;
1485
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1486
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1487
- aConstraints.gridx = 0;
1488
- aConstraints.gridy += 1;
1489
- aConstraints.gridwidth = 1;
2543
+ colorSection.add(huepanel);
2544
+
2545
+ cGridBag color = new cGridBag();
2546
+
2547
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
2548
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2549
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
14902550
1491
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1492
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1493
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1494
- aConstraints.gridx += 1;
1495
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1496
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1497
- aConstraints.gridx = 0;
1498
- aConstraints.gridy += 1;
1499
- aConstraints.gridwidth = 1;
2551
+ //colorField.preferredWidth = 200;
2552
+ colorSection.add(color);
15002553
1501
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1502
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1503
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1504
- aConstraints.gridx += 1;
1505
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1506
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1507
- aConstraints.gridx = 0;
1508
- aConstraints.gridy += 1;
1509
- aConstraints.gridwidth = 1;
2554
+ cGridBag modulation = new cGridBag();
2555
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
2556
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2557
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2558
+ colorSection.add(modulation);
15102559
1511
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1512
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1513
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1514
- aConstraints.gridx += 1;
1515
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1516
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1517
- aConstraints.gridx = 0;
1518
- aConstraints.gridy += 1;
1519
- aConstraints.gridwidth = 1;
2560
+ cGridBag opacity = new cGridBag();
2561
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
2562
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2563
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2564
+ colorSection.add(opacity);
15202565
1521
- //aConstraints.weighty = 1;
1522
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1523
- //aConstraints.gridx += 1;
1524
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1525
- aConstraints.weighty = 0;
1526
- aConstraints.gridx = 0;
1527
- aConstraints.gridy += 1;
1528
- aConstraints.gridwidth = 1;
2566
+ colorSection.add(GetSeparator());
2567
+
2568
+ cGridBag texture = new cGridBag();
2569
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
2570
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2571
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2572
+ colorSection.add(texture);
15292573
1530
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1531
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1532
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1533
- aConstraints.gridx += 1;
1534
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1535
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1536
- aConstraints.gridx = 0;
1537
- aConstraints.gridy += 1;
1538
- aConstraints.gridwidth = 1;
2574
+ panel.add(GetSeparator());
2575
+
2576
+ panel.add(colorSection);
2577
+
2578
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2579
+
2580
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
2581
+
2582
+ cGridBag diffuse = new cGridBag();
2583
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
2584
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2585
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2586
+ diffuseSection.add(diffuse);
15392587
1540
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1541
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1542
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1543
- aConstraints.gridx += 1;
1544
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1545
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1546
- aConstraints.gridx = 0;
1547
- aConstraints.gridy += 1;
1548
- aConstraints.gridwidth = 1;
2588
+ cGridBag diffuseness = new cGridBag();
2589
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
2590
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2591
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2592
+ diffuseSection.add(diffuseness);
15492593
1550
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1551
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1552
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1553
- aConstraints.gridx += 1;
1554
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1555
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1556
- aConstraints.gridx = 0;
1557
- aConstraints.gridy += 1;
1558
- aConstraints.gridwidth = 1;
2594
+ cGridBag selfshadow = new cGridBag();
2595
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
2596
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2597
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2598
+ diffuseSection.add(selfshadow);
15592599
1560
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1561
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1562
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1563
- aConstraints.gridx += 1;
1564
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1565
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1566
- aConstraints.gridx = 0;
1567
- aConstraints.gridy += 1;
1568
- aConstraints.gridwidth = 1;
2600
+ cGridBag sheen = new cGridBag();
2601
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
2602
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2603
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2604
+ diffuseSection.add(sheen);
15692605
1570
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1571
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1572
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1573
- aConstraints.gridx += 1;
1574
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1575
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1576
- aConstraints.gridx = 0;
1577
- aConstraints.gridy += 1;
1578
- aConstraints.gridwidth = 1;
2606
+ cGridBag subsurface = new cGridBag();
2607
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
2608
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2609
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2610
+ diffuseSection.add(subsurface);
15792611
1580
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1581
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1582
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1583
- aConstraints.gridx += 1;
1584
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1585
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1586
- aConstraints.gridx = 0;
1587
- aConstraints.gridy += 1;
1588
- aConstraints.gridwidth = 1;
2612
+ cGridBag shadow = new cGridBag();
2613
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
2614
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2615
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2616
+ diffuseSection.add(shadow);
15892617
1590
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1591
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1592
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1593
- aConstraints.gridx += 1;
1594
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1595
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1596
- aConstraints.gridx = 0;
1597
- aConstraints.gridy += 1;
1598
- aConstraints.gridwidth = 1;
2618
+ cGridBag fakedepth = new cGridBag();
2619
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
2620
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2621
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2622
+ diffuseSection.add(fakedepth);
15992623
1600
- //aConstraints.weighty = 1;
1601
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1602
- //aConstraints.gridx += 1;
1603
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1604
- aConstraints.weighty = 0;
1605
- aConstraints.gridx = 0;
1606
- aConstraints.gridy += 1;
1607
- aConstraints.gridwidth = 1;
2624
+ cGridBag shadowbias = new cGridBag();
2625
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
2626
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2627
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2628
+ diffuseSection.add(shadowbias);
16082629
1609
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1610
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1611
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1612
- aConstraints.gridx += 1;
1613
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1614
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1615
- aConstraints.gridx = 0;
1616
- aConstraints.gridy += 1;
1617
- aConstraints.gridwidth = 1;
2630
+ panel.add(GetSeparator());
2631
+
2632
+ panel.add(diffuseSection);
2633
+
2634
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2635
+
2636
+ cGridBag specularSection = new cGridBag().setVertical(true);
16182637
1619
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1620
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1621
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1622
- aConstraints.gridx += 1;
1623
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1624
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1625
- aConstraints.gridx = 0;
1626
- aConstraints.gridy += 1;
1627
- aConstraints.gridwidth = 1;
2638
+ cGridBag specular = new cGridBag();
2639
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
2640
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2641
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2642
+ specularSection.add(specular);
16282643
1629
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1630
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1631
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1632
- aConstraints.gridx += 1;
1633
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1634
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1635
- aConstraints.gridx = 0;
1636
- aConstraints.gridy += 1;
1637
- aConstraints.gridwidth = 1;
2644
+ cGridBag lightarea = new cGridBag();
2645
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
2646
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2647
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2648
+ specularSection.add(lightarea);
16382649
1639
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1640
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1641
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1642
- aConstraints.gridx += 1;
1643
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1644
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1645
- aConstraints.gridx = 0;
1646
- aConstraints.gridy += 1;
1647
- aConstraints.gridwidth = 1;
2650
+ cGridBag shininess = new cGridBag();
2651
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
2652
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2653
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2654
+ specularSection.add(shininess);
16482655
1649
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1650
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1651
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1652
- aConstraints.gridx += 1;
1653
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1654
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1655
- aConstraints.gridx = 0;
1656
- aConstraints.gridy += 1;
1657
- aConstraints.gridwidth = 1;
2656
+ cGridBag metalness = new cGridBag();
2657
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
2658
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2659
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2660
+ specularSection.add(metalness);
16582661
1659
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1660
- Return();
2662
+ cGridBag velvet = new cGridBag();
2663
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
2664
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2665
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2666
+ specularSection.add(velvet);
2667
+
2668
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
2669
+ //Return();
16612670 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16622671 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16632672 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1668,130 +2677,105 @@
16682677 // aConstraints.gridy += 1;
16692678 // aConstraints.gridwidth = 1;
16702679
1671
- //aConstraints.weighty = 1;
1672
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1673
- //aConstraints.gridx += 1;
1674
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1675
- aConstraints.weighty = 0;
1676
- aConstraints.gridx = 0;
1677
- aConstraints.gridy += 1;
1678
- aConstraints.gridwidth = 1;
2680
+ cGridBag anisoU = new cGridBag();
2681
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
2682
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2683
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2684
+ specularSection.add(anisoU);
16792685
1680
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1681
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1683
- aConstraints.gridx += 1;
1684
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1685
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1686
- aConstraints.gridx = 0;
1687
- aConstraints.gridy += 1;
1688
- aConstraints.gridwidth = 1;
2686
+ cGridBag anisoV = new cGridBag();
2687
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
2688
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2689
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2690
+ specularSection.add(anisoV);
16892691
1690
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1691
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1692
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1693
- aConstraints.gridx += 1;
1694
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1695
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1696
- aConstraints.gridx = 0;
1697
- aConstraints.gridy += 1;
1698
- aConstraints.gridwidth = 1;
16992692
1700
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1701
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1702
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1703
- aConstraints.gridx += 1;
1704
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1705
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1706
- aConstraints.gridx = 0;
1707
- aConstraints.gridy += 1;
1708
- aConstraints.gridwidth = 1;
2693
+ panel.add(GetSeparator());
2694
+
2695
+ panel.add(specularSection);
2696
+
2697
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2698
+
2699
+ //cGridBag globalSection = new cGridBag().setVertical(true);
17092700
1710
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1711
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1712
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1713
- aConstraints.gridx += 1;
1714
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1715
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1716
- aConstraints.gridx = 0;
1717
- aConstraints.gridy += 1;
1718
- aConstraints.gridwidth = 1;
1719
- aConstraints.weighty = 0;
2701
+ cGridBag camera = new cGridBag();
2702
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
2703
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2704
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2705
+ colorSection.add(camera);
17202706
1721
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1722
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1723
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1724
- aConstraints.gridx += 1;
1725
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1726
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1727
- aConstraints.gridx = 0;
1728
- aConstraints.gridy += 1;
1729
- aConstraints.gridwidth = 1;
2707
+ cGridBag ambient = new cGridBag();
2708
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
2709
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2710
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2711
+ colorSection.add(ambient);
17302712
1731
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1732
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1733
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1734
- aConstraints.gridx += 1;
1735
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1736
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1737
- aConstraints.gridx = 0;
1738
- aConstraints.gridy += 1;
1739
- aConstraints.gridwidth = 1;
2713
+ cGridBag backlit = new cGridBag();
2714
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
2715
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2716
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2717
+ colorSection.add(backlit);
17402718
1741
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1742
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1743
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1744
- aConstraints.gridx += 1;
1745
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1746
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1747
- aConstraints.gridx = 0;
1748
- aConstraints.gridy += 1;
1749
- aConstraints.gridwidth = 1;
2719
+ cGridBag parallax = new cGridBag();
2720
+ parallax.add(parallaxLabel = new JLabel("Parallax")); // , aConstraints);
2721
+ parallaxLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2722
+ parallax.add(parallaxField = new cNumberSlider(this, 0.001, 0.25, -0.125)); // , aConstraints);
2723
+ colorSection.add(parallax);
2724
+
2725
+ //panel.add(new JSeparator());
2726
+
2727
+ //panel.add(globalSection);
2728
+
2729
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2730
+
2731
+ cGridBag textureSection = new cGridBag().setVertical(true);
17502732
1751
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1752
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1753
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1754
- aConstraints.gridx += 1;
1755
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1756
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1757
- aConstraints.gridx = 0;
1758
- aConstraints.gridy += 1;
1759
- aConstraints.gridwidth = 1;
2733
+ cGridBag bump = new cGridBag();
2734
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
2735
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2736
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
2737
+ textureSection.add(bump);
17602738
1761
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1762
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1763
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1764
- aConstraints.gridx += 1;
1765
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1766
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1767
- aConstraints.gridx = 0;
1768
- aConstraints.gridy += 1;
1769
- aConstraints.gridwidth = 1;
2739
+ cGridBag noise = new cGridBag();
2740
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
2741
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2742
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
2743
+ textureSection.add(noise);
17702744
1771
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1772
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1773
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1774
- aConstraints.gridx += 1;
1775
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1776
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1777
- aConstraints.gridx = 0;
1778
- aConstraints.gridy += 1;
1779
- aConstraints.gridwidth = 1;
2745
+ cGridBag power = new cGridBag();
2746
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
2747
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2748
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
2749
+ textureSection.add(power);
17802750
1781
- //aConstraints.weighty = 1;
1782
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1783
- //aConstraints.gridx += 1;
1784
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1785
- aConstraints.weighty = 0;
2751
+ cGridBag borderfade = new cGridBag();
2752
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
2753
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2754
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
2755
+ textureSection.add(borderfade);
17862756
1787
- aConstraints.gridx = 0;
1788
- aConstraints.gridy = 0;
1789
- aConstraints.gridwidth = 1;
2757
+ cGridBag fog = new cGridBag();
2758
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
2759
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2760
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
2761
+ textureSection.add(fog);
2762
+
2763
+ cGridBag opacityPower = new cGridBag();
2764
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
2765
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2766
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
2767
+ textureSection.add(opacityPower);
2768
+
2769
+ panel.add(GetSeparator());
2770
+
2771
+ panel.add(textureSection);
2772
+
2773
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17902774
17912775 SetMaterial(copy); // .GetMaterial());
17922776
1793
- colorField.addChangeListener(this);
1794
- modulationField.addChangeListener(this);
2777
+ //colorField.addChangeListener(this);
2778
+// modulationField.addChangeListener(this);
17952779 metalnessField.addChangeListener(this);
17962780 diffuseField.addChangeListener(this);
17972781 specularField.addChangeListener(this);
....@@ -1821,12 +2805,15 @@
18212805 opacityPowerField.addChangeListener(this);
18222806 /**/
18232807
1824
- resetSlidersButton.addActionListener(this);
18252808 clearMaterialButton.addActionListener(this);
18262809 createMaterialButton.addActionListener(this);
1827
-
1828
- propagateToggle.addItemListener(this);
1829
- multiplyToggle.addItemListener(this);
2810
+
2811
+ if (Globals.ADVANCED)
2812
+ {
2813
+ resetSlidersButton.addActionListener(this);
2814
+ propagateToggle.addItemListener(this);
2815
+ multiplyToggle.addItemListener(this);
2816
+ }
18302817 }
18312818
18322819 void DropFile(java.io.File[] files, boolean textures)
....@@ -1844,8 +2831,9 @@
18442831 // 3D models
18452832 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18462833 {
1847
- lastConverter = new com.jmex.model.converters.MaxToJme();
1848
- LoadFile(filename, lastConverter);
2834
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2835
+ //LoadFile(filename, lastConverter);
2836
+ LoadObjFile(filename); // New 3ds loader
18492837 continue;
18502838 }
18512839 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1997,7 +2985,7 @@
19972985
19982986 //? flashIt = false;
19992987 CameraPane pane = (CameraPane) cameraView;
2000
- pane.clickStart(location.x, location.y, 0);
2988
+ pane.clickStart(location.x, location.y, 0, 0);
20012989 pane.clickEnd(location.x, location.y, 0, true);
20022990
20032991 if (group.selection.size() == 1)
....@@ -2046,6 +3034,7 @@
20463034 e2.printStackTrace();
20473035 }
20483036 }
3037
+
20493038 LoadJMEThread loadThread;
20503039
20513040 class LoadJMEThread extends Thread
....@@ -2103,6 +3092,7 @@
21033092 //LoadFile0(filename, converter);
21043093 }
21053094 }
3095
+
21063096 LoadOBJThread loadObjThread;
21073097
21083098 class LoadOBJThread extends Thread
....@@ -2181,19 +3171,19 @@
21813171
21823172 void LoadObjFile(String fullname)
21833173 {
2184
- /*
3174
+ System.out.println("Loading " + fullname);
3175
+ /**/
21853176 //lastFilename = fullname;
21863177 if(loadObjThread == null)
21873178 {
2188
- loadObjThread = new LoadOBJThread();
2189
- loadObjThread.start();
3179
+ loadObjThread = new LoadOBJThread();
3180
+ loadObjThread.start();
21903181 }
21913182
21923183 loadObjThread.add(fullname);
2193
- */
3184
+ /**/
21943185
2195
- System.out.println("Loading " + fullname);
2196
- makeSomething(new FileObject(fullname, true), true);
3186
+ //makeSomething(new FileObject(fullname, true), true);
21973187 }
21983188
21993189 void LoadGFDFile(String fullname)
....@@ -2454,11 +3444,11 @@
24543444
24553445 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24563446 {
2457
- if (GrafreeD.standAlone)
3447
+ if (Grafreed.standAlone)
24583448 {
24593449 /**/
24603450 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2461
- browser.show();
3451
+ browser.setVisible(true);
24623452 String filename = browser.getFile();
24633453 if (filename != null && filename.length() > 0)
24643454 {
....@@ -2569,6 +3559,7 @@
25693559 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25703560 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25713561 }
3562
+
25723563 //cJME.count++;
25733564 //cJME.count %= 12;
25743565 if (gc)
....@@ -2603,6 +3594,7 @@
26033594 }
26043595 if (input == null)
26053596 {
3597
+ new Exception().printStackTrace();
26063598 System.exit(0);
26073599 }
26083600
....@@ -2751,6 +3743,7 @@
27513743 }
27523744 }
27533745 }
3746
+
27543747 cFileSystemPane FSPane;
27553748
27563749 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2760,7 +3753,7 @@
27603753
27613754 freezematerial = true;
27623755 colorField.setFloat(mat.color);
2763
- modulationField.setFloat(mat.modulation);
3756
+ saturationField.setFloat(mat.modulation);
27643757 metalnessField.setFloat(mat.metalness);
27653758 diffuseField.setFloat(mat.diffuse);
27663759 specularField.setFloat(mat.specular);
....@@ -2780,6 +3773,7 @@
27803773 shadowField.setFloat(mat.shadow);
27813774 textureField.setFloat(mat.texture);
27823775 opacityField.setFloat(mat.opacity);
3776
+ parallaxField.setFloat(mat.parallax + 0.125f);
27833777 fakedepthField.setFloat(mat.fakedepth);
27843778 shadowbiasField.setFloat(mat.shadowbias);
27853779 bumpField.setInteger(1); // dec 2013
....@@ -2804,11 +3798,14 @@
28043798 }
28053799 }
28063800 }
3801
+
28073802 freezematerial = false;
28083803 }
28093804
28103805 void SetMaterial(Object3D object)
28113806 {
3807
+ latestObject = object;
3808
+
28123809 cMaterial mat = object.material;
28133810
28143811 if (mat == null)
....@@ -2817,33 +3814,10 @@
28173814 return;
28183815 }
28193816
2820
- multiplyToggle.setSelected(mat.multiply);
2821
-
2822
- assert (object.projectedVertices != null);
2823
-
2824
- if (object.projectedVertices.length <= 2)
2825
- {
2826
- // Side effect...
2827
- Object3D.cVector2[] keep = object.projectedVertices;
2828
- object.projectedVertices = new Object3D.cVector2[3];
2829
- for (int i = 0; i < 3; i++)
2830
- {
2831
- if (i < keep.length)
2832
- {
2833
- object.projectedVertices[i] = keep[i];
2834
- } else
2835
- {
2836
- object.projectedVertices[i] = new Object3D.cVector2();
2837
- }
2838
- /*
2839
- if(keep.length == 0)
2840
- object.projectedVertices[0] = new Object3D.cVector2();
2841
- else
2842
- object.projectedVertices[0] = keep[0];
2843
- object.projectedVertices[1] = new Object3D.cVector2();
2844
- */
2845
- }
2846
- }
3817
+ if (multiplyToggle != null)
3818
+ multiplyToggle.setSelected(mat.multiply);
3819
+
3820
+ AllocProjectedVertices(object);
28473821
28483822 SetMaterial(mat, object.projectedVertices);
28493823 }
....@@ -2919,12 +3893,17 @@
29193893 // }
29203894
29213895 /**/
2922
- if (deselect)
3896
+ if (deselect || child == null)
29233897 {
29243898 //group.deselectAll();
29253899 //freeze = true;
29263900 GetTree().clearSelection();
29273901 //freeze = false;
3902
+
3903
+ if (child == null)
3904
+ {
3905
+ return;
3906
+ }
29283907 }
29293908
29303909 //group.addSelectee(child);
....@@ -2958,6 +3937,17 @@
29583937 public void itemStateChanged(ItemEvent event)
29593938 {
29603939 // System.out.println("Propagate = " + propagate);
3940
+ if (event.getSource() == pinButton)
3941
+ {
3942
+ copy.pinned ^= true;
3943
+ if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
3944
+ {
3945
+ ((GroupEditor)copy.editWindow).listUI.remove(copy);
3946
+ copy.CloseUI();
3947
+ //copy.editWindow.refreshContents();
3948
+ }
3949
+ }
3950
+ else
29613951 if (event.getSource() == propagateToggle)
29623952 {
29633953 propagate ^= true;
....@@ -2993,7 +3983,7 @@
29933983 cameraView.ToggleDL();
29943984 cameraView.repaint();
29953985 return;
2996
- } else if (event.getSource() == toggleTextureItem)
3986
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29973987 {
29983988 cameraView.ToggleTexture();
29993989 // june 2013 copy.HardTouch();
....@@ -3032,9 +4022,9 @@
30324022 frame.validate();
30334023
30344024 return;
3035
- } else if (event.getSource() == toggleRandomItem)
4025
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30364026 {
3037
- cameraView.ToggleRandom();
4027
+ cameraView.ToggleSwitch();
30384028 cameraView.repaint();
30394029 return;
30404030 } else if (event.getSource() == toggleHandleItem)
....@@ -3062,12 +4052,17 @@
30624052 } else if (event.getSource() == liveCB)
30634053 {
30644054 copy.live ^= true;
4055
+ objEditor.refreshContents(true); // To show item colors
4056
+ return;
4057
+ } else if (event.getSource() == selectableCB)
4058
+ {
4059
+ copy.dontselect ^= true;
30654060 return;
30664061 } else if (event.getSource() == hideCB)
30674062 {
30684063 copy.hide ^= true;
30694064 copy.Touch(); // display list issue
3070
- objEditor.refreshContents();
4065
+ objEditor.refreshContents(true); // To show item colors
30714066 return;
30724067 } else if (event.getSource() == link2masterCB)
30734068 {
....@@ -3077,6 +4072,7 @@
30774072 if (event.getSource() == randomCB)
30784073 {
30794074 copy.random ^= true;
4075
+ objEditor.refreshContents();
30804076 return;
30814077 }
30824078 if (event.getSource() == speedupCB)
....@@ -3100,8 +4096,9 @@
31004096
31014097 public void actionPerformed(ActionEvent event)
31024098 {
4099
+ Object source = event.getSource();
31034100 // SCRIPT DIALOG
3104
- if (event.getSource() == okbutton)
4101
+ if (source == okbutton)
31054102 {
31064103 textpanel.setVisible(false);
31074104 textpanel.remove(textarea);
....@@ -3113,7 +4110,7 @@
31134110 textarea = null;
31144111 textpanel = null;
31154112 }
3116
- if (event.getSource() == cancelbutton)
4113
+ if (source == cancelbutton)
31174114 {
31184115 textpanel.setVisible(false);
31194116 textpanel.remove(textarea);
....@@ -3125,49 +4122,50 @@
31254122 //applySelf();
31264123 //client.refreshEditWindow();
31274124 //refreshContents();
3128
- if (event.getSource() == nameField)
4125
+ if (source == nameField)
31294126 {
31304127 //System.out.println("ObjEditor " + event);
31314128 applySelf0(true);
31324129 //parent.applySelf();
3133
- objEditor.refreshContents();
3134
- } else if (event.getSource() == resetButton)
4130
+ // conflicts with requestFocus objEditor.refreshContents();
4131
+ } else if (source == resetButton)
31354132 {
31364133 CameraPane.fullreset = true;
31374134 copy.Reset(); // ResetMeshes();
31384135 copy.Touch();
31394136 objEditor.refreshContents();
3140
- } else if (event.getSource() == stepItem)
4137
+ } else if (source == stepItem)
31414138 {
3142
- cameraView.ONESTEP = true;
4139
+ //cameraView.ONESTEP = true;
4140
+ Globals.ONESTEP = true;
31434141 cameraView.repaint();
31444142 return;
3145
- } else if (event.getSource() == stepButton)
4143
+ } else if (source == stepButton)
31464144 {
31474145 copy.Step();
31484146 copy.Touch();
31494147 objEditor.refreshContents();
3150
- } else if (event.getSource() == slowerButton)
4148
+ } else if (source == slowerButton)
31514149 {
31524150 copy.Slower();
31534151 copy.Touch();
31544152 objEditor.refreshContents();
3155
- } else if (event.getSource() == fasterButton)
4153
+ } else if (source == fasterButton)
31564154 {
31574155 copy.Faster();
31584156 copy.Touch();
31594157 objEditor.refreshContents();
3160
- } else if (event.getSource() == remarkButton)
4158
+ } else if (source == remarkButton)
31614159 {
31624160 copy.Remark();
31634161 copy.Touch();
31644162 objEditor.refreshContents();
3165
- } else if (event.getSource() == stepAllButton)
4163
+ } else if (source == stepAllButton)
31664164 {
31674165 copy.StepAll();
31684166 copy.Touch();
31694167 objEditor.refreshContents();
3170
- } else if (event.getSource() == resetAllButton)
4168
+ } else if (source == resetAllButton)
31714169 {
31724170 //CameraPane.fullreset = true;
31734171 copy.ResetAll(); // ResetMeshes();
....@@ -3200,53 +4198,79 @@
32004198 // Close();
32014199 // }
32024200 // else
3203
- if (event.getSource() == resetSlidersButton)
4201
+ if (source == resetSlidersButton)
32044202 {
32054203 ResetSliders();
3206
- } else if (event.getSource() == clearMaterialButton)
4204
+ } else if (source == clearMaterialButton)
32074205 {
32084206 ClearMaterial();
3209
- } else if (event.getSource() == createMaterialButton)
4207
+ } else if (source == createMaterialButton)
32104208 {
32114209 CreateMaterial();
3212
- } else if (event.getSource() == clearPanelButton)
4210
+ } else if (source == clearPanelButton)
32134211 {
32144212 copy.ClearUI();
32154213 refreshContents(true);
3216
- } /*
3217
- }
3218
-
3219
- public boolean action(Event event, Object arg)
3220
- {
3221
- */ else if (event.getSource() == closeItem)
4214
+ } else if (source == importGFDItem)
4215
+ {
4216
+ ImportGFD();
4217
+ } else
4218
+ if (source == importVRMLX3DItem)
4219
+ {
4220
+ ImportVRMLX3D();
4221
+ } else
4222
+ if (source == import3DSItem)
4223
+ {
4224
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
4225
+ } else
4226
+ if (source == importOBJItem)
4227
+ {
4228
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
4229
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
4230
+ browser.setVisible(true);
4231
+ String filename = browser.getFile();
4232
+ if (filename != null && filename.length() > 0)
4233
+ {
4234
+ String fullname = browser.getDirectory() + filename;
4235
+ makeSomething(ReadOBJ(fullname), true);
4236
+ }
4237
+ } else
4238
+ if (source == closeItem)
32224239 {
32234240 Close();
32244241 //return true;
3225
- } else if (event.getSource() == loadItem)
4242
+ } else if (source == openItem)
32264243 {
3227
- load();
4244
+ Open();
32284245 //return true;
3229
- } else if (event.getSource() == saveItem)
4246
+ } else if (source == newItem)
4247
+ {
4248
+ New();
4249
+ } else if (source == saveItem)
32304250 {
32314251 save();
32324252 //return true;
3233
- } else if (event.getSource() == saveAsItem)
4253
+ } else if (source == saveAsItem)
32344254 {
32354255 saveAs();
32364256 //return true;
3237
- } else if (event.getSource() == reexportItem)
4257
+ } else if (source == reexportItem)
32384258 {
32394259 reexport();
32404260 //return true;
3241
- } else if (event.getSource() == exportAsItem)
4261
+ } else if (source == exportAsItem)
32424262 {
32434263 export();
32444264 //return true;
3245
- } else if (event.getSource() == povItem)
4265
+ } else if (source == povItem)
32464266 {
32474267 generatePOV();
32484268 //return true;
3249
- } else if (event.getSource() == zBufferItem)
4269
+ } else if (event.getSource() == archiveItem)
4270
+ {
4271
+ cTools.Archive(frame);
4272
+ return;
4273
+ } else if (source == zBufferItem)
32504274 {
32514275 try
32524276 {
....@@ -3268,21 +4292,8 @@
32684292 cameraView.repaint();
32694293 //return true;
32704294 }
3271
- */ else if (event.getSource() == editCameraItem)
3272
- {
3273
- cameraView.ProtectCamera();
3274
- cameraView.repaint();
3275
- return;
3276
- } else if (event.getSource() == revertCameraItem)
3277
- {
3278
- cameraView.RevertCamera();
3279
- cameraView.repaint();
3280
- return;
3281
-// } else if (event.getSource() == textureButton)
3282
-// {
3283
-// return; // true;
3284
- } else // combos...
3285
- if (event.getSource() == texresMenu)
4295
+ */ else // combos...
4296
+ if (source == texresMenu)
32864297 {
32874298 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32884299 copy.texres = texresMenu.getSelectedIndex();
....@@ -3294,27 +4305,522 @@
32944305 }
32954306 }
32964307
3297
- void ToggleAnimation()
4308
+ void New()
32984309 {
3299
- if (!CameraPane.ANIMATION)
4310
+ while (copy.Size() > 0)
33004311 {
3301
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
4312
+ copy.remove(0);
4313
+ }
4314
+
4315
+ copy.selection.clear();
4316
+
4317
+ if (copy == Grafreed.grafreed.universe)
4318
+ {
4319
+ CreateCameras();
4320
+ cameraView.SetCamera(GetCamera(copy, 0));
4321
+ }
4322
+ ResetModel();
4323
+ objEditor.refreshContents();
4324
+ }
4325
+
4326
+ static public byte[] Compress(Object3D o)
4327
+ {
4328
+ // Slower to actually compress.
4329
+ try
4330
+ {
4331
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
4332
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
4333
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
4334
+
4335
+ Object3D parent = o.parent;
4336
+ o.parent = null;
4337
+
4338
+ out.writeObject(o);
4339
+
4340
+ o.parent = parent;
4341
+
4342
+ out.flush();
4343
+
4344
+ baos //zstream
4345
+ .close();
4346
+ out.close();
4347
+
4348
+ byte[] bytes = baos.toByteArray();
4349
+
4350
+ System.out.println("save #bytes = " + bytes.length);
4351
+ return bytes;
4352
+ } catch (Exception e)
4353
+ {
4354
+ System.err.println(e);
4355
+ return null;
4356
+ }
4357
+ }
4358
+
4359
+ static public Object Uncompress(byte[] bytes)
4360
+ {
4361
+ System.out.println("restore #bytes = " + bytes.length);
4362
+ try
4363
+ {
4364
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
4365
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
4366
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
4367
+ Object obj = in.readObject();
4368
+
4369
+ bais //istream
4370
+ .close();
4371
+ in.close();
4372
+
4373
+ return obj;
4374
+ } catch (Exception e)
4375
+ {
4376
+ System.err.println(e);
4377
+ return null;
4378
+ }
4379
+ }
4380
+
4381
+ static public Object clone(Object o)
4382
+ {
4383
+ try
4384
+ {
4385
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
4386
+ ObjectOutputStream out = new ObjectOutputStream(baos);
4387
+
4388
+ out.writeObject(o);
4389
+
4390
+ out.flush();
4391
+ out.close();
4392
+
4393
+ byte[] bytes = baos.toByteArray();
4394
+
4395
+ System.out.println("clone = " + bytes.length);
4396
+
4397
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
4398
+ ObjectInputStream in = new ObjectInputStream(bais);
4399
+ Object obj = in.readObject();
4400
+ in.close();
4401
+
4402
+ return obj;
4403
+ } catch (Exception e)
4404
+ {
4405
+ System.err.println(e);
4406
+ return null;
4407
+ }
4408
+ }
4409
+
4410
+ cRadio GetCurrentTab()
4411
+ {
4412
+ cRadio ab;
4413
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
4414
+ {
4415
+ ab = (cRadio)e.nextElement();
4416
+ if(ab.GetObject() == copy)
4417
+ {
4418
+ return ab;
4419
+ }
4420
+ }
4421
+
4422
+ return null;
4423
+ }
4424
+
4425
+
4426
+ public void Save()
4427
+ {
4428
+ //Save(true);
4429
+ Replace();
4430
+ SetVersionStates();
4431
+ }
4432
+
4433
+ private boolean Equal(byte[] compress, byte[] name)
4434
+ {
4435
+ if (compress.length != name.length)
4436
+ {
4437
+ return false;
4438
+ }
4439
+
4440
+ for (int i=compress.length; --i>=0;)
4441
+ {
4442
+ if (compress[i] != name[i])
4443
+ return false;
4444
+ }
4445
+
4446
+ return true;
4447
+ }
4448
+
4449
+ void DeleteVersion()
4450
+ {
4451
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
4452
+ {
4453
+ copy.versionlist[i] = copy.versionlist[i+1];
4454
+ }
4455
+
4456
+ if (copy.versionlist[copy.versionindex] == null)
4457
+ copy.versionindex -= 1;
4458
+
4459
+ if (copy.versionindex != -1)
4460
+ CopyChanged();
4461
+
4462
+ SetVersionStates();
4463
+ }
4464
+
4465
+ public boolean Save(boolean user)
4466
+ {
4467
+ System.err.println("Save");
4468
+ Replace();
4469
+
4470
+ if (copy.versionlist == null)
4471
+ {
4472
+ copy.versionlist = new Object3D[100];
4473
+ copy.versionindex = -1;
4474
+ }
4475
+
4476
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
4477
+
4478
+ boolean thesame = false;
4479
+
4480
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
4481
+// {
4482
+// thesame = true;
4483
+// }
4484
+
4485
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
4486
+ if (!thesame)
4487
+ {
4488
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4489
+ {
4490
+ copy.versionlist[i] = copy.versionlist[i-1];
4491
+ }
4492
+
4493
+ //tab.user[tab.versionindex] = user;
4494
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
4495
+
4496
+ copy.versionlist[++copy.versionindex] = compress;
4497
+
4498
+ // if (increment)
4499
+ // tab.versionindex++;
4500
+ }
4501
+
4502
+ //copy.RestoreBigData(versiontable);
4503
+
4504
+ //assert(hashtable.isEmpty());
4505
+
4506
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4507
+// {
4508
+// //tab.user[i] = false;
4509
+// copy.versionlist[i] = null;
4510
+// }
4511
+
4512
+ SetVersionStates();
4513
+
4514
+ // test save
4515
+ if (false)
4516
+ {
4517
+ try
4518
+ {
4519
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
4520
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
4521
+
4522
+ p.writeObject(copy);
4523
+
4524
+ p.flush();
4525
+
4526
+ ostream.close();
4527
+ } catch (Exception e)
4528
+ {
4529
+ e.printStackTrace();
4530
+ }
4531
+ }
4532
+
4533
+ return !thesame;
4534
+ }
4535
+
4536
+ boolean flashIt = true;
4537
+
4538
+ void RefreshSelection()
4539
+ {
4540
+ Object3D selection = new Object3D();
4541
+
4542
+ for (int i = 0; i < copy.selection.size(); i++)
4543
+ {
4544
+ Object3D elem = copy.selection.elementAt(i);
4545
+
4546
+ Object3D obj = copy.GetObject(elem.GetUUID());
4547
+
4548
+ if (obj == null)
4549
+ {
4550
+ copy.selection.remove(i--);
4551
+ }
4552
+ else
4553
+ {
4554
+ selection.add(obj);
4555
+ copy.selection.setElementAt(obj, i);
4556
+ }
4557
+ }
4558
+
4559
+ flashIt = false;
4560
+ GetTree().clearSelection();
4561
+ for (int i = 0; i < selection.size(); i++)
4562
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
4563
+ flashIt = true;
4564
+
4565
+ //refreshContents(false);
4566
+ }
4567
+
4568
+ void CopyChanged()
4569
+ {
4570
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4571
+
4572
+ SetVersionStates();
4573
+
4574
+ boolean temp = CameraPane.SWITCH;
4575
+ CameraPane.SWITCH = false;
4576
+
4577
+ copy.ExtractBigData(Grafreed.grafreed.universe.versiontable);
4578
+
4579
+ copy.clear();
4580
+
4581
+ copy.skyboxname = obj.skyboxname;
4582
+ copy.skyboxext = obj.skyboxext;
4583
+
4584
+ for (int i=0; i<obj.Size(); i++)
4585
+ {
4586
+ copy.add(obj.get(i));
4587
+ }
4588
+
4589
+ copy.RestoreBigData(Grafreed.grafreed.universe.versiontable);
4590
+
4591
+ CameraPane.SWITCH = temp;
4592
+
4593
+ RefreshSelection();
4594
+ //assert(hashtable.isEmpty());
4595
+
4596
+ copy.Touch();
4597
+
4598
+ ResetModel();
4599
+ copy.HardTouch(); // recompile?
4600
+
4601
+ cRadio ab;
4602
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
4603
+ {
4604
+ ab = (cRadio)e.nextElement();
4605
+ Object3D test = copy.GetObject(ab.object.GetUUID());
4606
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
4607
+ if (test != null)
4608
+ {
4609
+ test.editWindow = ab.object.editWindow;
4610
+ ab.object = test;
4611
+ }
4612
+ }
4613
+
4614
+ refreshContents(true);
4615
+ }
4616
+
4617
+ cButton previousVersionButton;
4618
+ cButton restoreButton;
4619
+ cButton replaceButton;
4620
+ cButton nextVersionButton;
4621
+ cButton saveVersionButton;
4622
+ cButton deleteVersionButton;
4623
+
4624
+ boolean muteSlider;
4625
+
4626
+ int VersionCount()
4627
+ {
4628
+ int count = 0;
4629
+
4630
+ for (int i = copy.versionlist.length; --i >= 0;)
4631
+ {
4632
+ if (copy.versionlist[i] != null)
4633
+ count++;
4634
+ }
4635
+
4636
+ return count;
4637
+ }
4638
+
4639
+ public cGridBag versionSliderPane;
4640
+
4641
+ void SetVersionStates()
4642
+ {
4643
+ //if (true)
4644
+ // return;
4645
+
4646
+ //cRadio tab = GetCurrentTab();
4647
+
4648
+ if (copy.versionindex == -2)
4649
+ {
4650
+ saveVersionButton.setEnabled(false);
4651
+ restoreButton.setEnabled(false);
4652
+ replaceButton.setEnabled(false);
4653
+ previousVersionButton.setEnabled(false);
4654
+ nextVersionButton.setEnabled(false);
4655
+ deleteVersionButton.setEnabled(false);
4656
+ versionSliderPane.setVisible(false);
4657
+ }
4658
+ else
4659
+ {
4660
+ restoreButton.setEnabled(copy.versionindex != -1);
4661
+ replaceButton.setEnabled(copy.versionindex != -1);
4662
+
4663
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4664
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4665
+
4666
+ deleteVersionButton.setEnabled(copy.versionindex != -1);
4667
+ //copy.versionlist[copy.versionindex + 1] != null);
4668
+
4669
+ muteSlider = true;
4670
+ versionSlider.setMinimum(0);
4671
+ versionSlider.setMaximum(VersionCount() - 1);
4672
+ versionSlider.setInteger(copy.versionindex);
4673
+ versionSlider.setEnabled(copy.versionindex != -1);
4674
+ muteSlider = false;
4675
+
4676
+ versionSliderPane.setVisible(true);
4677
+ }
4678
+ }
4679
+
4680
+ public boolean PreviousVersion()
4681
+ {
4682
+ // Option?
4683
+ Replace();
4684
+
4685
+ System.err.println("Undo");
4686
+
4687
+ //cRadio tab = GetCurrentTab();
4688
+
4689
+ if (copy.versionindex == 0)
4690
+ {
4691
+ java.awt.Toolkit.getDefaultToolkit().beep();
4692
+ return false;
4693
+ }
4694
+
4695
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
4696
+// {
4697
+// if (Save(false))
4698
+// tab.versionindex -= 1;
4699
+// else
4700
+// {
4701
+// if (tab.versionindex <= 0)
4702
+// return false;
4703
+// else
4704
+// tab.versionindex -= 1;
4705
+// }
4706
+// }
4707
+
4708
+ copy.versionindex -= 1;
4709
+
4710
+ CopyChanged();
4711
+
4712
+ return true;
4713
+ }
4714
+
4715
+ public boolean Restore()
4716
+ {
4717
+ System.err.println("Restore");
4718
+
4719
+ //cRadio tab = GetCurrentTab();
4720
+
4721
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4722
+ {
4723
+ java.awt.Toolkit.getDefaultToolkit().beep();
4724
+ return false;
4725
+ }
4726
+
4727
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4728
+ CopyChanged();
4729
+
4730
+ return true;
4731
+ }
4732
+
4733
+ public boolean Replace()
4734
+ {
4735
+ //System.err.println("Replace");
4736
+
4737
+ //cRadio tab = GetCurrentTab();
4738
+
4739
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4740
+ {
4741
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
4742
+ return false;
4743
+ }
4744
+
4745
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
4746
+
4747
+ return true;
4748
+ }
4749
+
4750
+ public void NextVersion()
4751
+ {
4752
+ // Option?
4753
+ Replace();
4754
+
4755
+ //cRadio tab = GetCurrentTab();
4756
+
4757
+ if (copy.versionlist[copy.versionindex + 1] == null)
4758
+ {
4759
+ java.awt.Toolkit.getDefaultToolkit().beep();
4760
+ return;
4761
+ }
4762
+
4763
+ copy.versionindex += 1;
4764
+
4765
+ CopyChanged();
4766
+
4767
+ //if (!tab.user[tab.versionindex])
4768
+ // tab.graphs[tab.versionindex] = null;
4769
+ }
4770
+
4771
+ void ImportGFD()
4772
+ {
4773
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
33024774 browser.show();
33034775 String filename = browser.getFile();
33044776 if (filename != null && filename.length() > 0)
33054777 {
3306
- CameraPane.filename = browser.getDirectory() + filename;
4778
+ String fullname = browser.getDirectory() + filename;
4779
+
4780
+ //Object3D readobj =
4781
+ objEditor.ReadGFD(fullname, objEditor);
4782
+ //makeSomething(readobj);
4783
+ }
4784
+ }
4785
+
4786
+ void ImportVRMLX3D()
4787
+ {
4788
+ if (Grafreed.standAlone)
4789
+ {
4790
+ /**/
4791
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4792
+ browser.show();
4793
+ String filename = browser.getFile();
4794
+ if (filename != null && filename.length() > 0)
4795
+ {
4796
+ String fullname = browser.getDirectory() + filename;
4797
+ LoadVRMLX3D(fullname);
4798
+ }
4799
+ /**/
4800
+ }
4801
+ }
4802
+
4803
+ void ToggleAnimation()
4804
+ {
4805
+ if (!Globals.ANIMATION)
4806
+ {
4807
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
4808
+ browser.setVisible(true);
4809
+ String filename = browser.getFile();
4810
+ if (filename != null && filename.length() > 0)
4811
+ {
4812
+ Globals.filename = browser.getDirectory() + filename;
33074813 //CameraPane.framecount = 0;
3308
- CameraPane.imagecount = 0;
4814
+ Globals.imagecount = 0;
33094815
3310
- CameraPane.ANIMATION ^= true;
4816
+ Globals.ANIMATION ^= true;
33114817
3312
- GrafreeD.wav.cursor = 0;
3313
- GrafreeD.wav.loop = 0;
4818
+ Grafreed.wav.cursor = 0;
4819
+ Grafreed.wav.loop = 0;
33144820 }
33154821 } else
33164822 {
3317
- CameraPane.ANIMATION ^= true;
4823
+ Globals.ANIMATION ^= true;
33184824 }
33194825 }
33204826
....@@ -3360,7 +4866,7 @@
33604866 void CreateMaterial()
33614867 {
33624868 //copy.ClearMaterial(); // PATCH
3363
- copy.CreateMaterialS(multiplyToggle.isSelected());
4869
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33644870 if (copy.selection.size() > 0)
33654871 //SetMaterial(copy);
33664872 {
....@@ -3411,7 +4917,7 @@
34114917 assert false;
34124918 }
34134919
3414
- void EditSelection()
4920
+ void EditSelection(boolean newWindow)
34154921 {
34164922 }
34174923
....@@ -3419,11 +4925,11 @@
34194925 {
34204926 copy.ResetBlockLoop(); // temporary problem
34214927
3422
- boolean random = CameraPane.RANDOM;
3423
- CameraPane.RANDOM = false; // parse everything
4928
+ boolean random = CameraPane.SWITCH;
4929
+ CameraPane.SWITCH = false; // parse everything
34244930 copy.ResetDisplayList();
34254931 copy.HardTouch();
3426
- CameraPane.RANDOM = random;
4932
+ CameraPane.SWITCH = random;
34274933 }
34284934
34294935 // public void applySelf()
....@@ -3453,6 +4959,12 @@
34534959 // else
34544960 // applySelf(true);
34554961 // }
4962
+
4963
+ boolean Equal(double a, double b)
4964
+ {
4965
+ return Math.abs(a - b) < 0.001;
4966
+ }
4967
+
34564968 void applySelf0(boolean name)
34574969 {
34584970 if (name)
....@@ -3470,7 +4982,7 @@
34704982 //copy.material = new cMaterial(copy.GetMaterial());
34714983
34724984 current.color = (float) colorField.getFloat();
3473
- current.modulation = (float) modulationField.getFloat();
4985
+ current.modulation = (float) saturationField.getFloat();
34744986 current.metalness = (float) metalnessField.getFloat();
34754987 current.diffuse = (float) diffuseField.getFloat();
34764988 current.specular = (float) specularField.getFloat();
....@@ -3490,13 +5002,69 @@
34905002 current.shadow = (float) shadowField.getFloat();
34915003 current.texture = (float) textureField.getFloat();
34925004 current.opacity = (float) opacityField.getFloat();
5005
+ current.parallax = (float) parallaxField.getFloat() - 0.125f;
34935006 current.fakedepth = (float) fakedepthField.getFloat();
34945007 current.shadowbias = (float) shadowbiasField.getFloat();
34955008
3496
- if (!NumberSlider.frozen)
5009
+ if (!cNumberSlider.frozen)
34975010 {
34985011 //System.out.println("Propagate = " + propagate);
34995012 copy.UpdateMaterial(anchor, current, propagate);
5013
+
5014
+ if (copy.material != null)
5015
+ {
5016
+ cMaterial mat = copy.material;
5017
+
5018
+ if (!Equal(colorField.getFloat(), mat.color))
5019
+ colorField.SetToolTipValue((mat.color));
5020
+ if (!Equal(saturationField.getFloat(), mat.modulation))
5021
+ saturationField.SetToolTipValue((mat.modulation));
5022
+ if (!Equal(metalnessField.getFloat(), mat.metalness))
5023
+ metalnessField.SetToolTipValue((mat.metalness));
5024
+ if (!Equal(diffuseField.getFloat(), mat.diffuse))
5025
+ diffuseField.SetToolTipValue((mat.diffuse));
5026
+ if (!Equal(specularField.getFloat(), mat.specular))
5027
+ specularField.SetToolTipValue((mat.specular));
5028
+ if (!Equal(shininessField.getFloat(), mat.shininess))
5029
+ shininessField.SetToolTipValue((mat.shininess));
5030
+ if (!Equal(shiftField.getFloat(), mat.shift))
5031
+ shiftField.SetToolTipValue((mat.shift));
5032
+ if (!Equal(ambientField.getFloat(), mat.ambient))
5033
+ ambientField.SetToolTipValue((mat.ambient));
5034
+ if (!Equal(lightareaField.getFloat(), mat.lightarea))
5035
+ lightareaField.SetToolTipValue((mat.lightarea));
5036
+ if (!Equal(diffusenessField.getFloat(), mat.factor))
5037
+ diffusenessField.SetToolTipValue((mat.factor));
5038
+ if (!Equal(velvetField.getFloat(), mat.velvet))
5039
+ velvetField.SetToolTipValue((mat.velvet));
5040
+ if (!Equal(sheenField.getFloat(), mat.sheen))
5041
+ sheenField.SetToolTipValue((mat.sheen));
5042
+ if (!Equal(subsurfaceField.getFloat(), mat.subsurface))
5043
+ subsurfaceField.SetToolTipValue((mat.subsurface));
5044
+ if (!Equal(backlitField.getFloat(), mat.bump))
5045
+ backlitField.SetToolTipValue((mat.bump));
5046
+ if (!Equal(anisoField.getFloat(), mat.aniso))
5047
+ anisoField.SetToolTipValue((mat.aniso));
5048
+ if (!Equal(anisoVField.getFloat(), mat.anisoV))
5049
+ anisoVField.SetToolTipValue((mat.anisoV));
5050
+ if (!Equal(cameraField.getFloat(), mat.cameralight))
5051
+ cameraField.SetToolTipValue((mat.cameralight));
5052
+ if (!Equal(selfshadowField.getFloat(), mat.diffuseness))
5053
+ selfshadowField.SetToolTipValue((mat.diffuseness));
5054
+ if (!Equal(shadowField.getFloat(), mat.shadow))
5055
+ shadowField.SetToolTipValue((mat.shadow));
5056
+ if (!Equal(textureField.getFloat(), mat.texture))
5057
+ textureField.SetToolTipValue((mat.texture));
5058
+ if (!Equal(opacityField.getFloat(), mat.opacity))
5059
+ opacityField.SetToolTipValue((mat.opacity));
5060
+ //if (!Equal(parallaxField.getFloat(), mat.parallax))
5061
+ parallaxField.SetToolTipValue((mat.parallax));
5062
+ if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
5063
+ fakedepthField.SetToolTipValue((mat.fakedepth));
5064
+ if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
5065
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
5066
+ }
5067
+
35005068 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35015069 {
35025070 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3525,9 +5093,28 @@
35255093 //copy.Touch();
35265094 }
35275095
5096
+ cNumberSlider versionSlider;
5097
+
35285098 public void stateChanged(ChangeEvent e)
35295099 {
3530
- // assert(false);
5100
+ // assert(false);
5101
+ if (e.getSource() == versionSlider)
5102
+ {
5103
+ if (muteSlider)
5104
+ return;
5105
+
5106
+ Replace();
5107
+
5108
+ int version = versionSlider.getInteger();
5109
+
5110
+ if (version != -1 && copy.versionlist[version] != null)
5111
+ {
5112
+ copy.versionindex = version;
5113
+ CopyChanged();
5114
+ }
5115
+
5116
+ return;
5117
+ }
35315118
35325119 if (freezematerial)
35335120 {
....@@ -3541,6 +5128,7 @@
35415128 || e.getSource() == apertureField
35425129 || e.getSource() == shadowblurField)
35435130 {
5131
+ new Exception().printStackTrace();
35445132 System.exit(0);
35455133 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35465134 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3562,6 +5150,12 @@
35625150 {
35635151 //System.out.println("stateChanged = " + this);
35645152 materialtouched = true;
5153
+
5154
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
5155
+ {
5156
+ saturationField.setFloat(1);
5157
+ }
5158
+
35655159 applySelf();
35665160 //System.out.println("this = " + this);
35675161 //System.out.println("PARENT = " + parent);
....@@ -3611,7 +5205,7 @@
36115205 }
36125206
36135207 if (normalpushField != null)
3614
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
5208
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36155209 }
36165210
36175211 void SnapObject()
....@@ -3861,20 +5455,28 @@
38615455 {
38625456 if (GetTree() != null)
38635457 {
5458
+ GetTree().revalidate();
38645459 GetTree().repaint();
38655460 }
38665461
38675462 radioPanel.revalidate();
38685463 radioPanel.repaint();
3869
- ctrlPanel.revalidate(); // ? new
5464
+ ctrlPanel.validate(); // ? new
38705465 ctrlPanel.repaint();
38715466 }
5467
+
5468
+ if (previousVersionButton != null && copy.versionlist != null)
5469
+ SetVersionStates();
5470
+
5471
+ cameraView.requestFocusInWindow();
38725472 }
38735473
38745474 static TweenManager tweenManager = new TweenManager();
38755475
38765476 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38775477 {
5478
+ if (Globals.REPLACEONMAKE) // && resetmodel)
5479
+ Save();
38785480 //Tween.set(thing, 0).target(1).start(tweenManager);
38795481 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38805482 // if (thing instanceof GenericJointDemo)
....@@ -3898,7 +5500,7 @@
38985500 // group = (Composite) group.get(0);
38995501 // }
39005502
3901
- System.out.println("makeSomething of " + thing);
5503
+ //System.out.println("makeSomething of " + thing);
39025504
39035505 /*
39045506 if (deselect && jList != null)
....@@ -3961,6 +5563,12 @@
39615563 {
39625564 ResetModel();
39635565 Select(thing.GetTreePath(), true, false); // unselect... false);
5566
+
5567
+ if (thing.Size() == 0)
5568
+ {
5569
+ //EditSelection(false);
5570
+ }
5571
+
39645572 refreshContents();
39655573 }
39665574
....@@ -4078,6 +5686,7 @@
40785686 }
40795687 }
40805688 }
5689
+
40815690 LoadGFDThread loadGFDThread;
40825691
40835692 void ReadGFD(String fullname, iCallBack cb)
....@@ -4097,8 +5706,10 @@
40975706
40985707 try
40995708 {
5709
+ // Try compressed version first.
41005710 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4101
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
5711
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
5712
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
41025713
41035714 readobj = (Object3D) p.readObject();
41045715 istream.close();
....@@ -4106,7 +5717,22 @@
41065717 readobj.ResetDisplayList();
41075718 } catch (Exception e)
41085719 {
4109
- e.printStackTrace();
5720
+ if (!e.toString().contains("GZIP"))
5721
+ e.printStackTrace();
5722
+
5723
+ try
5724
+ {
5725
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
5726
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
5727
+
5728
+ readobj = (Object3D) p.readObject();
5729
+ istream.close();
5730
+
5731
+ readobj.ResetDisplayList();
5732
+ } catch (Exception e2)
5733
+ {
5734
+ e2.printStackTrace();
5735
+ }
41105736 }
41115737 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41125738 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4152,6 +5778,12 @@
41525778
41535779 void LoadIt(Object obj)
41545780 {
5781
+ if (obj == null)
5782
+ {
5783
+ // Invalid file
5784
+ return;
5785
+ }
5786
+
41555787 System.out.println("Loaded " + obj);
41565788 //new Exception().printStackTrace();
41575789 Object3D readobj = (Object3D) obj;
....@@ -4161,10 +5793,14 @@
41615793
41625794 if (readobj != null)
41635795 {
5796
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
5797
+ // Save();
41645798 try
41655799 {
41665800 //readobj.deepCopySelf(copy);
41675801 copy.clear(); // june 2014
5802
+ copy.skyboxname = readobj.skyboxname;
5803
+ copy.skyboxext = readobj.skyboxext;
41685804 for (int i = 0; i < readobj.size(); i++)
41695805 {
41705806 Object3D child = readobj.get(i); // reserve(i);
....@@ -4205,6 +5841,7 @@
42055841 }
42065842 } catch (ClassCastException e)
42075843 {
5844
+ e.printStackTrace();
42085845 assert (false);
42095846 Composite c = (Composite) copy;
42105847 c.children.clear();
....@@ -4215,17 +5852,32 @@
42155852 c.addChild(csg);
42165853 }
42175854
5855
+ copy.versionlist = readobj.versionlist;
5856
+ copy.versionindex = readobj.versionindex;
5857
+ copy.versiontable = readobj.versiontable;
5858
+
5859
+ if (copy.versionlist == null)
5860
+ {
5861
+ // Backward compatibility
5862
+ copy.versionlist = new Object3D[100];
5863
+ copy.versionindex = -1;
5864
+
5865
+ //Save(true);
5866
+ }
5867
+
5868
+ //? SetUndoStates();
5869
+
42185870 ResetModel();
42195871 copy.HardTouch(); // recompile?
42205872 refreshContents();
42215873 }
42225874 }
42235875
4224
- void load() // throws ClassNotFoundException
5876
+ void Open() // throws ClassNotFoundException
42255877 {
4226
- if (GrafreeD.standAlone)
5878
+ if (Grafreed.standAlone)
42275879 {
4228
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5880
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
42295881 browser.show();
42305882 String filename = browser.getFile();
42315883 if (filename != null && filename.length() > 0)
....@@ -4302,6 +5954,8 @@
43025954
43035955 void save()
43045956 {
5957
+ Replace();
5958
+
43055959 if (lastname == null)
43065960 {
43075961 return;
....@@ -4310,11 +5964,13 @@
43105964 try
43115965 {
43125966 FileOutputStream ostream = new FileOutputStream(lastname);
4313
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5967
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5968
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43145969
43155970 p.writeObject(copy);
43165971 p.flush();
43175972
5973
+ zstream.close();
43185974 ostream.close();
43195975
43205976 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4322,19 +5978,23 @@
43225978 //ps.print(buffer.toString());
43235979 } catch (IOException e)
43245980 {
5981
+ e.printStackTrace();
43255982 }
43265983 }
5984
+
43275985 String lastname;
43285986
43295987 void saveAs()
43305988 {
4331
- if (GrafreeD.standAlone)
5989
+ if (Grafreed.standAlone)
43325990 {
43335991 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43345992 browser.setVisible(true);
43355993 String filename = browser.getFile();
43365994 if (filename != null && filename.length() > 0)
43375995 {
5996
+ if (!filename.endsWith(".gfd"))
5997
+ filename += ".gfd";
43385998 lastname = browser.getDirectory() + filename;
43395999 save();
43406000 }
....@@ -4433,13 +6093,13 @@
44336093 try
44346094 {
44356095 FileOutputStream ostream = new FileOutputStream(filename);
4436
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4437
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
6096
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
6097
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44386098
44396099 Object3D objectparent = obj.parent;
44406100 obj.parent = null;
44416101
4442
- Object3D object = (Object3D) GrafreeD.clone(obj);
6102
+ Object3D object = (Object3D) Grafreed.clone(obj);
44436103
44446104 obj.parent = objectparent;
44456105
....@@ -4451,8 +6111,8 @@
44516111 p.writeObject(object);
44526112 p.flush();
44536113
6114
+ zstream.close();
44546115 ostream.close();
4455
- // zstream.close();
44566116
44576117 // group.selection.get(0).parent = parent;
44586118 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4473,7 +6133,7 @@
44736133 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44746134 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44756135 copy.generatePOV(buffer);
4476
- if (GrafreeD.standAlone)
6136
+ if (Grafreed.standAlone)
44776137 {
44786138 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44796139 browser.show();
....@@ -4499,21 +6159,20 @@
44996159 Object3D client;
45006160 Object3D copy;
45016161 MenuBar menuBar;
4502
- Menu windowMenu;
4503
- MenuItem loadItem;
6162
+ Menu fileMenu;
6163
+ MenuItem newItem;
6164
+ MenuItem openItem;
45046165 MenuItem saveItem;
45056166 MenuItem saveAsItem;
45066167 MenuItem exportAsItem;
45076168 MenuItem reexportItem;
45086169 MenuItem povItem;
45096170 MenuItem closeItem;
4510
- Menu cameraMenu;
6171
+
45116172 CheckboxMenuItem zBufferItem;
45126173 //MenuItem normalLensItem;
4513
- MenuItem editCameraItem;
4514
- MenuItem revertCameraItem;
4515
- CheckboxMenuItem toggleLiveItem;
45166174 MenuItem stepItem;
6175
+ CheckboxMenuItem toggleLiveItem;
45176176 CheckboxMenuItem toggleFullScreenItem;
45186177 CheckboxMenuItem toggleTimelineItem;
45196178 CheckboxMenuItem toggleRenderItem;
....@@ -4522,28 +6181,44 @@
45226181 CheckboxMenuItem toggleFootContactItem;
45236182 CheckboxMenuItem toggleDLItem;
45246183 CheckboxMenuItem toggleTextureItem;
4525
- CheckboxMenuItem toggleRandomItem;
6184
+ CheckboxMenuItem toggleSwitchItem;
45266185 CheckboxMenuItem toggleRootItem;
45276186 CheckboxMenuItem animationItem;
6187
+ MenuItem archiveItem;
45286188 CheckboxMenuItem toggleHandleItem;
45296189 CheckboxMenuItem togglePaintItem;
45306190 JSplitPane mainPanel;
45316191 JScrollPane scrollpane;
6192
+
45326193 JPanel toolbarPanel;
4533
- JPanel treePanel;
6194
+
6195
+ cGridBag treePanel;
6196
+
45346197 JPanel radioPanel;
45356198 ButtonGroup buttonGroup;
4536
- JPanel ctrlPanel;
4537
- JPanel materialPanel;
6199
+
6200
+ cGridBag toolboxPanel;
6201
+ cGridBag skyboxPanel;
6202
+ cGridBag materialPanel;
6203
+ cGridBag ctrlPanel;
6204
+
45386205 JScrollPane infoPanel;
4539
- JPanel optionsPanel;
6206
+
6207
+ cGridBag optionsPanel;
6208
+
45406209 JTabbedPane objectPanel;
4541
- JPanel XYZPanel;
6210
+ boolean materialFlushed;
6211
+ Object3D latestObject;
6212
+
6213
+ cGridBag transformPanel;
6214
+ cGridBag XYZPanel;
6215
+
45426216 JSplitPane gridPanel;
45436217 JSplitPane bigPanel;
4544
- JPanel bigThree;
4545
- JTabbedPane scenePanel;
4546
- JPanel centralPanel;
6218
+
6219
+ cGridBag bigThree;
6220
+ cGridBag scenePanel;
6221
+ cGridBag centralPanel;
45476222 JSplitPane cameraPanel;
45486223 JPanel timelinePanel;
45496224 JMenuBar timelineMenubar;
....@@ -4596,67 +6271,76 @@
45966271 // MATERIAL
45976272 JLabel materialLabel;
45986273 JLabel colorLabel;
4599
- NumberSlider colorField;
6274
+ cNumberSlider colorField;
46006275 JLabel modulationLabel;
4601
- NumberSlider modulationField;
6276
+ cNumberSlider saturationField;
46026277 JLabel metalnessLabel;
4603
- NumberSlider metalnessField;
6278
+ cNumberSlider metalnessField;
46046279 JLabel diffuseLabel;
4605
- NumberSlider diffuseField;
6280
+ cNumberSlider diffuseField;
46066281 JLabel specularLabel;
4607
- NumberSlider specularField;
6282
+ cNumberSlider specularField;
46086283 JLabel shininessLabel;
4609
- NumberSlider shininessField;
6284
+ cNumberSlider shininessField;
46106285 JLabel shiftLabel;
4611
- NumberSlider shiftField;
6286
+ cNumberSlider shiftField;
46126287 JLabel ambientLabel;
4613
- NumberSlider ambientField;
6288
+ cNumberSlider ambientField;
46146289 JLabel lightareaLabel;
4615
- NumberSlider lightareaField;
6290
+ cNumberSlider lightareaField;
46166291 JLabel diffusenessLabel;
4617
- NumberSlider diffusenessField;
6292
+ cNumberSlider diffusenessField;
46186293 JLabel velvetLabel;
4619
- NumberSlider velvetField;
6294
+ cNumberSlider velvetField;
46206295 JLabel sheenLabel;
4621
- NumberSlider sheenField;
6296
+ cNumberSlider sheenField;
46226297 JLabel subsurfaceLabel;
4623
- NumberSlider subsurfaceField;
6298
+ cNumberSlider subsurfaceField;
46246299 //JLabel bumpLabel;
46256300 //NumberSlider bumpField;
46266301 JLabel backlitLabel;
4627
- NumberSlider backlitField;
6302
+ cNumberSlider backlitField;
46286303 JLabel anisoLabel;
4629
- NumberSlider anisoField;
6304
+ cNumberSlider anisoField;
46306305 JLabel anisoVLabel;
4631
- NumberSlider anisoVField;
6306
+ cNumberSlider anisoVField;
6307
+
46326308 JLabel cameraLabel;
4633
- NumberSlider cameraField;
6309
+ cNumberSlider cameraField;
46346310 JLabel selfshadowLabel;
4635
- NumberSlider selfshadowField;
6311
+ cNumberSlider selfshadowField;
46366312 JLabel shadowLabel;
4637
- NumberSlider shadowField;
6313
+ cNumberSlider shadowField;
46386314 JLabel textureLabel;
4639
- NumberSlider textureField;
6315
+ cNumberSlider textureField;
46406316 JLabel opacityLabel;
4641
- NumberSlider opacityField;
6317
+ cNumberSlider opacityField;
6318
+ JLabel parallaxLabel;
6319
+ cNumberSlider parallaxField;
46426320 JLabel fakedepthLabel;
4643
- NumberSlider fakedepthField;
6321
+ cNumberSlider fakedepthField;
46446322 JLabel shadowbiasLabel;
4645
- NumberSlider shadowbiasField;
6323
+ cNumberSlider shadowbiasField;
6324
+
46466325 JLabel bumpLabel;
4647
- NumberSlider bumpField;
6326
+ cNumberSlider bumpField;
46486327 JLabel noiseLabel;
4649
- NumberSlider noiseField;
6328
+ cNumberSlider noiseField;
46506329 JLabel powerLabel;
4651
- NumberSlider powerField;
6330
+ cNumberSlider powerField;
46526331 JLabel borderfadeLabel;
4653
- NumberSlider borderfadeField;
6332
+ cNumberSlider borderfadeField;
46546333 JLabel fogLabel;
4655
- NumberSlider fogField;
6334
+ cNumberSlider fogField;
46566335 JLabel opacityPowerLabel;
4657
- NumberSlider opacityPowerField;
4658
- JTree jTree;
6336
+ cNumberSlider opacityPowerField;
6337
+ cTree jTree;
46596338 //ObjectUI parent;
46606339
4661
- NumberSlider normalpushField;
6340
+ cNumberSlider normalpushField;
6341
+
6342
+ private MenuItem importGFDItem;
6343
+ private MenuItem importVRMLX3DItem;
6344
+ private MenuItem import3DSItem;
6345
+ private MenuItem importOBJItem;
46626346 }