Normand Briere
2019-08-05 de0d8d87447fea5faea469ccf8072a7aead35b6d
ObjEditor.java
....@@ -4,6 +4,7 @@
44
55 import java.awt.*;
66 import java.awt.event.*;
7
+import java.awt.image.BufferedImage;
78 import javax.swing.*;
89 import javax.swing.event.*;
910 import javax.swing.text.*;
....@@ -14,10 +15,15 @@
1415 //import javax.swing.plaf.ColorUIResource;
1516 //import javax.swing.plaf.metal.DefaultMetalTheme;
1617
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
20
+
1721 //import javax.media.opengl.GLCanvas;
1822
1923 import //weka.core.
2024 matrix.Matrix;
25
+
26
+import grafeme.ui.*;
2127
2228 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
2329 ActionListener, ChangeListener,
....@@ -28,7 +34,87 @@
2834 iSendInfo
2935 //KeyListener
3036 {
37
+ boolean timeline;
38
+ boolean wasFullScreen;
3139
40
+ GroupEditor callee;
41
+ JFrame frame;
42
+
43
+ static ObjEditor theFrame;
44
+
45
+ public cGridBag GetSeparator()
46
+ {
47
+ cGridBag separator = new cGridBag();
48
+ separator.add(new JSeparator());
49
+ separator.preferredHeight = 5;
50
+ return separator;
51
+ }
52
+
53
+ cButton GetButton(String name, boolean border)
54
+ {
55
+ ImageIcon icon = GetIcon(name);
56
+ return new cButton(icon, border);
57
+ }
58
+
59
+ cLabel GetLabel(String name, boolean border)
60
+ {
61
+ //ImageIcon icon = GetIcon(name);
62
+ return new cLabel(GetImage(name), border);
63
+ }
64
+
65
+ cToggleButton GetToggleButton(String name, boolean border)
66
+ {
67
+ ImageIcon icon = GetIcon(name);
68
+ return new cToggleButton(icon, border);
69
+ }
70
+
71
+ cCheckBox GetCheckBox(String name, boolean border)
72
+ {
73
+ ImageIcon icon = GetIcon(name);
74
+ return new cCheckBox(icon, border);
75
+ }
76
+
77
+ ImageIcon GetIcon(String name)
78
+ {
79
+ try
80
+ {
81
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
82
+
83
+// if (image.getWidth() > 48 && image.getHeight() > 48)
84
+// {
85
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
86
+// Graphics2D g = resized.createGraphics();
87
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
88
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
89
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
90
+// g.dispose();
91
+//
92
+// image = resized;
93
+// }
94
+
95
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
96
+ return icon;
97
+ }
98
+ catch (Exception e)
99
+ {
100
+ return null;
101
+ }
102
+ }
103
+
104
+ BufferedImage GetImage(String name)
105
+ {
106
+ try
107
+ {
108
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
109
+
110
+ return image;
111
+ }
112
+ catch (Exception e)
113
+ {
114
+ return null;
115
+ }
116
+ }
117
+
32118 // SCRIPT
33119
34120 transient JFrame textpanel = null;
....@@ -119,51 +205,62 @@
119205 void keyPressed(int key, int modifiers)
120206 {
121207 System.out.println("KEY PRESSED");
122
- CameraPane.theRenderer.keyPressed(key, modifiers);
208
+ Globals.theRenderer.keyPressed(key, modifiers);
123209 }
124210 */
125211
126212 static GridBagConstraints aConstraints;
127213 static GridBagConstraints aWindowConstraints;
128
- GroupEditor callee;
129
- JFrame frame;
214
+
130215 static int GRIDWIDTH = 100; // 4;
131216
132217 public void closeUI()
133218 {
134219 //new Exception().printStackTrace();
135
- System.out.println("this = " + this);
136
- System.out.println("objEditor = " + objEditor);
220
+// System.out.println("this = " + this);
221
+// System.out.println("objEditor = " + objEditor);
137222 //nameField.removeActionListener(this);
138
- objEditor.ctrlPanel.remove(nameField);
223
+// objEditor.ctrlPanel.remove(nameField);
139224
140
- if (!GroupEditor.allparams)
225
+ objEditor.ctrlPanel.remove(namePanel);
226
+
227
+ if (!allparams)
141228 return;
142229
143
- objEditor.ctrlPanel.remove(liveCB);
144
- objEditor.ctrlPanel.remove(hideCB);
145
- objEditor.ctrlPanel.remove(markCB);
146
-
147
- objEditor.ctrlPanel.remove(randomCB);
148
- objEditor.ctrlPanel.remove(speedupCB);
149
- objEditor.ctrlPanel.remove(rewindCB);
150
-
151
- objEditor.ctrlPanel.remove(resetButton);
152
- objEditor.ctrlPanel.remove(stepButton);
153
-// objEditor.ctrlPanel.remove(stepAllButton);
154
-// objEditor.ctrlPanel.remove(resetAllButton);
155
- objEditor.ctrlPanel.remove(link2masterCB);
156
- //objEditor.ctrlPanel.remove(flipVCB);
157
- //objEditor.ctrlPanel.remove(texresMenu);
158
- objEditor.ctrlPanel.remove(slowerButton);
159
- objEditor.ctrlPanel.remove(fasterButton);
160
- objEditor.ctrlPanel.remove(remarkButton);
230
+// objEditor.ctrlPanel.remove(liveCB);
231
+// objEditor.ctrlPanel.remove(hideCB);
232
+// objEditor.ctrlPanel.remove(markCB);
233
+//
234
+// objEditor.ctrlPanel.remove(randomCB);
235
+// objEditor.ctrlPanel.remove(speedupCB);
236
+// objEditor.ctrlPanel.remove(rewindCB);
237
+//
238
+// objEditor.ctrlPanel.remove(resetButton);
239
+// objEditor.ctrlPanel.remove(stepButton);
240
+//// objEditor.ctrlPanel.remove(stepAllButton);
241
+//// objEditor.ctrlPanel.remove(resetAllButton);
242
+// objEditor.ctrlPanel.remove(link2masterCB);
243
+// //objEditor.ctrlPanel.remove(flipVCB);
244
+// //objEditor.ctrlPanel.remove(texresMenu);
245
+// objEditor.ctrlPanel.remove(slowerButton);
246
+// objEditor.ctrlPanel.remove(fasterButton);
247
+// objEditor.ctrlPanel.remove(remarkButton);
248
+
249
+ objEditor.ctrlPanel.remove(setupPanel);
250
+ objEditor.ctrlPanel.remove(setupPanel2);
251
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
252
+ objEditor.ctrlPanel.remove(pushPanel);
253
+ //objEditor.ctrlPanel.remove(fillPanel);
254
+
255
+ //Remove(normalpushField);
161256 }
162257
163258 public ObjEditor GetEditor()
164259 {
165260 return objEditor; //.GetEditor();
166261 }
262
+
263
+ // Sometimes myself, sometimes my callee's.
167264 ObjEditor objEditor;
168265
169266 /*
....@@ -199,6 +296,12 @@
199296 client = inClient;
200297 copy = client;
201298
299
+ if (copy.versionlist == null)
300
+ {
301
+ copy.versionlist = new Object3D[100];
302
+ copy.versionindex = -1;
303
+ }
304
+
202305 // "this" is not called: SetupUI2(objEditor);
203306 }
204307
....@@ -212,6 +315,12 @@
212315 client = inClient;
213316 copy = client;
214317
318
+ if (copy.versionlist == null)
319
+ {
320
+ copy.versionlist = new Object3D[100];
321
+ copy.versionindex = -1;
322
+ }
323
+
215324 SetupUI2(callee.GetEditor());
216325 }
217326
....@@ -226,6 +335,7 @@
226335 //localCopy.parent = null;
227336
228337 frame = new JFrame();
338
+ frame.setUndecorated(false);
229339 objEditor = this;
230340 this.callee = callee;
231341
....@@ -238,11 +348,17 @@
238348 //if (!isDisplayable())
239349 //setUndecorated(true);
240350
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
351
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242352 client = inClient;
243353 copy = localCopy;
244354 copy.editWindow = this;
245355
356
+ if (copy.versionlist == null)
357
+ {
358
+// copy.versions = new byte[100][];
359
+// copy.versionindex = -1;
360
+ }
361
+
246362 SetupMenu();
247363
248364 //SetupName(objEditor); // new
....@@ -256,28 +372,49 @@
256372 return frame.action(event, obj);
257373 }
258374
375
+ // Cannot work without static
376
+ static boolean allparams = true;
377
+
378
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
379
+
259380 void SetupMenu()
260381 {
261382 frame.setMenuBar(menuBar = new MenuBar());
262
- menuBar.add(windowMenu = new Menu("File"));
263
- windowMenu.add(loadItem = new MenuItem("Load..."));
264
- windowMenu.add("-");
265
- windowMenu.add(saveItem = new MenuItem("Save"));
266
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
383
+ menuBar.add(fileMenu = new Menu("File"));
384
+ fileMenu.add(newItem = new MenuItem("New"));
385
+ fileMenu.add(openItem = new MenuItem("Open..."));
386
+
387
+ //oe.menuBar.add(menu = new Menu("Include"));
388
+ Menu menu = new Menu("Import");
389
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
390
+ importOBJItem.addActionListener(this);
391
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
392
+ import3DSItem.addActionListener(this);
393
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
394
+ importVRMLX3DItem.addActionListener(this);
395
+ menu.add("-");
396
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
397
+ importGFDItem.addActionListener(this);
398
+ fileMenu.add(menu);
399
+ fileMenu.add("-");
400
+
401
+ fileMenu.add(saveItem = new MenuItem("Save"));
402
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267403 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
268
- windowMenu.add("-");
269
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
270
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
271
- windowMenu.add("-");
404
+ fileMenu.add("-");
405
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
406
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
407
+ fileMenu.add("-");
272408 if (client.parent != null)
273409 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
410
+ fileMenu.add(closeItem = new MenuItem("Close"));
275411 } else
276412 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
413
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278414 }
279415
280
- loadItem.addActionListener(this);
416
+ newItem.addActionListener(this);
417
+ openItem.addActionListener(this);
281418 saveItem.addActionListener(this);
282419 saveAsItem.addActionListener(this);
283420 exportAsItem.addActionListener(this);
....@@ -285,80 +422,69 @@
285422 //povItem.addActionListener(this);
286423 closeItem.addActionListener(this);
287424
288
- menuBar.add(cameraMenu = new Menu("View"));
289
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
290
- //zBufferItem.addActionListener(this);
291
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
292
- //normalLensItem.addActionListener(this);
293
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
294
- revertCameraItem.addActionListener(this);
295
- cameraMenu.add(toggleFullItem = new CheckboxMenuItem("Full Screen"));
296
- toggleFullItem.addItemListener(this);
297
- toggleFullItem.setState(CameraPane.FULLSCREEN);
298
- cameraMenu.add("-");
299
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
300
- toggleTextureItem.addItemListener(this);
301
- toggleTextureItem.setState(CameraPane.textureon);
302
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
303
- toggleLiveItem.addItemListener(this);
304
- toggleLiveItem.setState(CameraPane.isLIVE());
305
- cameraMenu.add(stepItem = new MenuItem("Step"));
306
- stepItem.addActionListener(this);
307
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
308
-// toggleDLItem.addItemListener(this);
309
-// toggleDLItem.setState(false);
310
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
311
- toggleRenderItem.addItemListener(this);
312
- toggleRenderItem.setState(!CameraPane.frozen);
313
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
314
- toggleDebugItem.addItemListener(this);
315
- toggleDebugItem.setState(CameraPane.DEBUG);
316
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
317
- toggleFrustumItem.addItemListener(this);
318
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
319
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
320
- toggleFootContactItem.addItemListener(this);
321
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
322
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
323
- toggleRandomItem.addItemListener(this);
324
- toggleRandomItem.setState(CameraPane.RANDOM);
325
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
326
- toggleHandleItem.addItemListener(this);
327
- toggleHandleItem.setState(CameraPane.HANDLES);
328
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
329
- togglePaintItem.addItemListener(this);
330
- togglePaintItem.setState(CameraPane.PAINTMODE);
331
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
332
-// toggleRootItem.addItemListener(this);
333
-// toggleRootItem.setState(false);
334
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
335
-// animationItem.addItemListener(this);
336
-// animationItem.setState(CameraPane.ANIMATION);
337
- cameraMenu.add("-");
338
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
339
- editCameraItem.addActionListener(this);
340
-
341425 objectPanel = new JTabbedPane();
426
+
427
+ ChangeListener changeListener = new ChangeListener()
428
+ {
429
+ public void stateChanged(ChangeEvent changeEvent)
430
+ {
431
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
432
+// {
433
+// if (latestObject != null)
434
+// {
435
+// refreshContents(true);
436
+// SetMaterial(latestObject);
437
+// }
438
+//
439
+// materialFlushed = true;
440
+// }
441
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
442
+// {
443
+// if (listUI.size() == 0)
444
+// EditSelection(false);
445
+// }
446
+
447
+ refreshContents(false); // To refresh Info tab
448
+ }
449
+ };
450
+ objectPanel.addChangeListener(changeListener);
451
+
342452 toolbarPanel = new JPanel();
343453 toolbarPanel.setName("Toolbar");
344
- treePanel = new JPanel();
454
+
455
+ treePanel = new cGridBag();
345456 treePanel.setName("Tree");
346
- ctrlPanel = new JPanel(); // new GridBagLayout());
347
- ctrlPanel.setName("Edit");
348
- materialPanel = new JPanel();
349
- materialPanel.setName("Material");
457
+
458
+ editPanel = new cGridBag().setVertical(true);
459
+ //editPanel.setName("Edit");
460
+
461
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
462
+
463
+ editCommandsPanel = new cGridBag();
464
+ editPanel.add(editCommandsPanel);
465
+ editPanel.add(ctrlPanel);
466
+
467
+ toolboxPanel = new cGridBag().setVertical(true);
468
+ //toolboxPanel.setName("Toolbox");
469
+
470
+ materialPanel = new cGridBag().setVertical(false);
471
+ //materialPanel.setName("Material");
472
+
350473 /*JTextPane*/
351474 infoarea = createTextPane();
475
+ doc = infoarea.getStyledDocument();
476
+
352477 infoarea.setEditable(true);
353478 SetText();
479
+
354480 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
355481 // infoarea.setOpaque(false);
356482 // //infoarea.setForeground(textcolor);
357
- infoarea.setLineWrap(true);
358
- infoarea.setWrapStyleWord(true);
483
+// TEXTAREA infoarea.setLineWrap(true);
484
+// TEXTAREA infoarea.setWrapStyleWord(true);
359485 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
360
- infoPanel.setPreferredSize(new Dimension(50, 200));
361
- infoPanel.setName("Info");
486
+ infoPanel.setPreferredSize(new Dimension(1, 1));
487
+ //infoPanel.setName("Info");
362488 //infoPanel.setLayout(new BorderLayout());
363489 //infoPanel.add(createTextPane());
364490
....@@ -366,16 +492,23 @@
366492 mainPanel.setName("Main");
367493 mainPanel.setContinuousLayout(true);
368494 mainPanel.setOneTouchExpandable(true);
369
- mainPanel.setDividerLocation(1.0);
370495 mainPanel.setDividerSize(9);
371
- mainPanel.setResizeWeight(0);
372
-
496
+ mainPanel.setDividerLocation(0.5); //1.0);
497
+ mainPanel.setResizeWeight(0.5);
498
+
499
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
500
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
501
+ divider.setDividerSize(15);
502
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
503
+
504
+ mainPanel.setUI(new BasicSplitPaneUI());
505
+
373506 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
374507 //mainPanel.setLayout(new GridBagLayout());
375508 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
376
- treePanel.setLayout(new GridBagLayout());
377
- ctrlPanel.setLayout(new GridBagLayout());
378
- materialPanel.setLayout(new GridBagLayout());
509
+// treePanel.setLayout(new GridBagLayout());
510
+ //ctrlPanel.setLayout(new GridBagLayout());
511
+ //materialPanel.setLayout(new GridBagLayout());
379512
380513 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
381514 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -414,7 +547,7 @@
414547 static String newline = "\n";
415548 protected static final String buttonString = "JButton";
416549 StyledDocument doc;
417
- JTextArea infoarea;
550
+ JTextPane infoarea;
418551
419552 void ClearInfo()
420553 {
....@@ -437,10 +570,10 @@
437570 e.printStackTrace();
438571 }
439572
440
- String selection = infoarea.getText();
441
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
442
- java.awt.datatransfer.Clipboard clipboard =
443
- Toolkit.getDefaultToolkit().getSystemClipboard();
573
+// String selection = infoarea.getText();
574
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
575
+// java.awt.datatransfer.Clipboard clipboard =
576
+// Toolkit.getDefaultToolkit().getSystemClipboard();
444577 //clipboard.setContents(data, data);
445578 }
446579
....@@ -463,13 +596,13 @@
463596 //SendInfo("Name:", "bold");
464597 if (sel.GetTextures() != null || debug)
465598 {
466
- si.SendInfo(sel.toString(), "bold");
599
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
467600 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
468601 if (sel.Size() > 0)
469602 {
470603 si.SendInfo("#children = " + sel.Size(), "regular");
471604 }
472
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
605
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
473606 if (debug)
474607 {
475608 try
....@@ -481,7 +614,10 @@
481614 }
482615
483616 if (full)
484
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
617
+ {
618
+ si.SendInfo(" BBox min: " + minima, "regular");
619
+ si.SendInfo(" BBox max: " + maxima, "regular");
620
+ }
485621
486622 if (sel.bRep != null)
487623 {
....@@ -508,7 +644,7 @@
508644 }
509645 if (sel.support != null)
510646 {
511
- si.SendInfo(" support: " + sel.support, "regular");
647
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
512648 }
513649 if (sel.scriptnode != null)
514650 {
....@@ -522,18 +658,18 @@
522658 maxima.y = sel.toParent[3][1];
523659 maxima.z = sel.toParent[3][2];
524660 si.SendInfo(" Orig: " + maxima, "regular");
525
- maxima.x = sel.globalTransform[3][0];
526
- maxima.y = sel.globalTransform[3][1];
527
- maxima.z = sel.globalTransform[3][2];
528
- if (full)
529
- si.SendInfo(" Global Orig: " + maxima, "regular");
530661 maxima.x = sel.toParent[0][0];
531662 maxima.y = sel.toParent[1][1];
532663 maxima.z = sel.toParent[2][2];
533664 si.SendInfo(" Scale: " + maxima, "regular");
534
- maxima.x = sel.globalTransform[0][0];
535
- maxima.y = sel.globalTransform[1][1];
536
- maxima.z = sel.globalTransform[2][2];
665
+ maxima.x = sel.globalTransform[3][0];
666
+ maxima.y = sel.globalTransform[3][1];
667
+ maxima.z = sel.globalTransform[3][2];
668
+ if (full)
669
+ si.SendInfo(" Global Orig: " + maxima, "regular");
670
+ maxima.x = sel.globalTransform[0][0];
671
+ maxima.y = sel.globalTransform[1][1];
672
+ maxima.z = sel.globalTransform[2][2];
537673 if (full)
538674 si.SendInfo(" Global Scale: " + maxima, "regular");
539675 }
....@@ -579,6 +715,9 @@
579715 {
580716 CameraPane.pointflow = (PointFlow) sel;
581717 }
718
+
719
+ si.SendInfo("_____________________", "regular");
720
+ si.SendInfo("", "regular");
582721 }
583722 }
584723
....@@ -594,52 +733,194 @@
594733 }
595734 }
596735
597
- private JTextArea createTextPane()
598
- {
599
- String[] initString =
600
- {
601
- "This is an editable JTextPane, ", //regular
602
- "another ", //italic
603
- "styled ", //bold
604
- "text ", //small
605
- "component, ", //large
606
- "which supports embedded components..." + newline,//regular
607
- " " + newline, //button
608
- "...and embedded icons..." + newline, //regular
609
- " ", //icon
610
- newline + "JTextPane is a subclass of JEditorPane that "
611
- + "uses a StyledEditorKit and StyledDocument, and provides "
612
- + "cover methods for interacting with those objects."
613
- };
736
+//static GraphicsDevice device = GraphicsEnvironment
737
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
614738
615
- String[] initStyles =
616
- {
617
- "regular", "italic", "bold", "small", "large",
618
- "regular", "button", "regular", "icon",
619
- "regular"
620
- };
739
+ Rectangle keeprect;
740
+ cRadio radio;
741
+
742
+cButton keepButton;
743
+ cButton twoButton; // Full 3D
744
+ cButton sixButton;
745
+ cButton threeButton;
746
+ cButton sevenButton;
747
+ cButton fourButton; // full panel
748
+ cButton oneButton; // full XYZ
749
+ //cButton currentLayout;
750
+
751
+ boolean maximized;
752
+
753
+ cButton fullscreenLayout;
621754
622
- JTextPane textPane = new JTextPane();
623
- textPane.setEditable(true);
624
- /*StyledDocument*/ doc = textPane.getStyledDocument();
625
- addStylesToDocument(doc);
626
-
627
- try
755
+ void Minimize()
628756 {
629
- for (int j = 0; j < 2; j++)
757
+ frame.setState(Frame.ICONIFIED);
758
+ frame.validate();
759
+ }
760
+
761
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
762
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
763
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
764
+ void Maximize()
765
+ {
766
+ if (CameraPane.FULLSCREEN)
630767 {
631
- for (int i = 0; i < initString.length; i++)
632
- {
633
- doc.insertString(doc.getLength(), initString[i],
634
- doc.getStyle(initStyles[i]));
635
- }
768
+ ToggleFullScreen();
636769 }
637
- } catch (BadLocationException ble)
770
+
771
+ if (maximized)
772
+ {
773
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
774
+ }
775
+ else
776
+ {
777
+ keeprect = frame.getBounds();
778
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
779
+// Dimension rect2 = frame.getToolkit().getScreenSize();
780
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
781
+// frame.setState(Frame.MAXIMIZED_BOTH);
782
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
783
+ }
784
+
785
+ maximized ^= true;
786
+
787
+ frame.validate();
788
+ }
789
+
790
+ cButton minButton;
791
+ cButton maxButton;
792
+ cButton fullButton;
793
+
794
+ void ToggleFullScreen()
638795 {
639
- System.err.println("Couldn't insert initial text into text pane.");
796
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
797
+
798
+ cameraView.ToggleFullScreen();
799
+
800
+ if (!CameraPane.FULLSCREEN)
801
+ {
802
+ device.setFullScreenWindow(null);
803
+ frame.dispose();
804
+ frame.setUndecorated(false);
805
+ frame.validate();
806
+ frame.setVisible(true);
807
+
808
+ //frame.setVisible(false);
809
+// frame.removeNotify();
810
+// frame.setUndecorated(false);
811
+// frame.addNotify();
812
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
813
+
814
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
815
+// X framePanel.add(bigThree);
816
+// X frame.getContentPane().add(/*"Center",*/framePanel);
817
+ framePanel.setDividerLocation(46);
818
+
819
+ //frame.setVisible(true);
820
+ radio.layout = keepButton;
821
+ //theFrame = null;
822
+ keepButton = null;
823
+ radio.layout.doClick();
824
+
825
+ } else
826
+ {
827
+ keepButton = radio.layout;
828
+ //keeprect = frame.getBounds();
829
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
830
+// frame.getToolkit().getScreenSize().height);
831
+ //frame.setVisible(false);
832
+
833
+ frame.dispose();
834
+ frame.setUndecorated(true);
835
+ device.setFullScreenWindow(frame);
836
+ frame.validate();
837
+ frame.setVisible(true);
838
+// frame.removeNotify();
839
+// frame.setUndecorated(true);
840
+// frame.addNotify();
841
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
842
+// X framePanel.remove(bigThree);
843
+// X frame.getContentPane().add(/*"Center",*/bigThree);
844
+ framePanel.setDividerLocation(0);
845
+
846
+ radio.layout = fullscreenLayout;
847
+ radio.layout.doClick();
848
+ //frame.setVisible(true);
849
+ }
850
+ frame.validate();
851
+
852
+ cameraView.requestFocusInWindow();
640853 }
641854
642
- return new JTextArea(); // textPane;
855
+ private Object3D CompressCopy()
856
+ {
857
+ boolean temp = CameraPane.SWITCH;
858
+ CameraPane.SWITCH = false;
859
+
860
+ copy.ExtractBigData(versiontable);
861
+ // if (copy == client)
862
+
863
+ Object3D versions[] = copy.versionlist;
864
+ copy.versionlist = null;
865
+
866
+ //byte[] compress = Compress(copy);
867
+ Object3D compress = (Object3D)Grafreed.clone(copy);
868
+
869
+ copy.versionlist = versions;
870
+
871
+ copy.RestoreBigData(versiontable);
872
+
873
+ CameraPane.SWITCH = temp;
874
+
875
+ return compress;
876
+ }
877
+
878
+ private JTextPane createTextPane()
879
+ {
880
+// TEXTAREA String[] initString =
881
+// {
882
+// "This is an editable JTextPane, ", //regular
883
+// "another ", //italic
884
+// "styled ", //bold
885
+// "text ", //small
886
+// "component, ", //large
887
+// "which supports embedded components..." + newline,//regular
888
+// " " + newline, //button
889
+// "...and embedded icons..." + newline, //regular
890
+// " ", //icon
891
+// newline + "JTextPane is a subclass of JEditorPane that "
892
+// + "uses a StyledEditorKit and StyledDocument, and provides "
893
+// + "cover methods for interacting with those objects."
894
+// };
895
+//
896
+// String[] initStyles =
897
+// {
898
+// "regular", "italic", "bold", "small", "large",
899
+// "regular", "button", "regular", "icon",
900
+// "regular"
901
+// };
902
+//
903
+// JTextPane textPane = new JTextPane();
904
+// textPane.setEditable(true);
905
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
906
+// addStylesToDocument(doc);
907
+//
908
+// try
909
+// {
910
+// for (int j = 0; j < 2; j++)
911
+// {
912
+// for (int i = 0; i < initString.length; i++)
913
+// {
914
+// doc.insertString(doc.getLength(), initString[i],
915
+// doc.getStyle(initStyles[i]));
916
+// }
917
+// }
918
+// } catch (BadLocationException ble)
919
+// {
920
+// System.err.println("Couldn't insert initial text into text pane.");
921
+// }
922
+
923
+ return new JTextPane(); // textPane;
643924 }
644925
645926 protected void addStylesToDocument(StyledDocument doc)
....@@ -692,7 +973,7 @@
692973 protected static ImageIcon createImageIcon(String path,
693974 String description)
694975 {
695
- java.net.URL imgURL = GraphreeD.class.getResource(path);
976
+ java.net.URL imgURL = Grafreed.class.getResource(path);
696977 if (imgURL != null)
697978 {
698979 return new ImageIcon(imgURL, description);
....@@ -715,6 +996,7 @@
715996 {
716997 SetupMaterial(materialPanel);
717998 }
999
+
7181000 //SetupName();
7191001 //SetupViews();
7201002 }
....@@ -724,6 +1006,7 @@
7241006 // NumberSlider vDivsField;
7251007 // JCheckBox endcaps;
7261008 JCheckBox liveCB;
1009
+ JCheckBox selectableCB;
7271010 JCheckBox hideCB;
7281011 JCheckBox link2masterCB;
7291012 JCheckBox markCB;
....@@ -731,7 +1014,12 @@
7311014 JCheckBox speedupCB;
7321015 JCheckBox rewindCB;
7331016 JCheckBox flipVCB;
1017
+
1018
+ cCheckBox toggleTextureCB;
1019
+ cCheckBox toggleSwitchCB;
1020
+
7341021 JComboBox texresMenu;
1022
+
7351023 JButton resetButton;
7361024 JButton stepButton;
7371025 JButton stepAllButton;
....@@ -739,115 +1027,87 @@
7391027 JButton slowerButton;
7401028 JButton fasterButton;
7411029 JButton remarkButton;
1030
+
1031
+ cGridBag editPanel;
1032
+ cGridBag editCommandsPanel;
1033
+
1034
+ cGridBag namePanel;
1035
+ cGridBag setupPanel;
1036
+ cGridBag setupPanel2;
1037
+ cGridBag objectCommandsPanel;
1038
+ cGridBag pushPanel;
1039
+ cGridBag fillPanel;
7421040
743
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1041
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7441042 {
7451043 JCheckBox cb;
7461044
747
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
748
- oe.aConstraints.gridwidth = 1; // 3;
749
-// oe.aConstraints.weightx = 1;
750
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
751
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1045
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7521046 cb.addItemListener(this);
753
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
754
- oe.aConstraints.gridwidth = 1;
755
- oe.aConstraints.gridx += 1;
7561047
7571048 return cb;
7581049 }
7591050
760
- cButton AddButton(ObjEditor oe, String label)
1051
+ cButton AddButton(cGridBag panel, String label)
7611052 {
7621053 cButton cb;
7631054
764
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
765
- oe.aConstraints.gridwidth = 1;
766
-// oe.aConstraints.weightx = 1;
767
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
768
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1055
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7691056 cb.addActionListener(this);
770
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
771
- oe.aConstraints.gridwidth = 1;
772
- oe.aConstraints.gridx += 1;
7731057
7741058 return cb;
7751059 }
7761060
777
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1061
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
7781062 {
7791063 JComboBox combo;
7801064
781
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
782
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
783
- oe.aConstraints.gridx += 1;
1065
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7841066 combo.addActionListener(this);
7851067
7861068 return combo;
7871069 }
7881070
789
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
1071
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
7901072 {
791
- NumberSlider combo;
1073
+ cGridBag control = new cGridBag();
1074
+
1075
+ cNumberSlider combo;
7921076
7931077 JLabel jlabel = new JLabel(label);
794
-
795
- aConstraints.fill = GridBagConstraints.VERTICAL;
7961078 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
797
- aConstraints.gridwidth = 2;
798
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
799
- aConstraints.gridx += 1;
800
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
801
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
802
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
803
- aConstraints.gridx += 1;
804
- aConstraints.gridwidth = 1;
805
-
1079
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1080
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8061081 combo.setFloat(current);
807
-
808
- combo.label = jlabel;
809
-
810
- combo.addChangeListener(this);
811
-
812
- return combo;
1082
+
1083
+ panel.add(control);
1084
+
1085
+ return control;
8131086 }
8141087
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
1088
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8161089 {
817
- NumberSlider combo;
1090
+ cGridBag control = new cGridBag();
1091
+
1092
+ cNumberSlider combo;
8181093
8191094 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
8221095 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
823
- aConstraints.gridwidth = 2;
824
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
825
- aConstraints.gridx += 1;
826
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
827
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
828
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
829
- aConstraints.gridx += 1;
830
- aConstraints.gridwidth = 1;
831
-
1096
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1097
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8321098 combo.setInteger(current);
8331099
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
1100
+ panel.add(control);
1101
+
1102
+ return control;
8391103 }
8401104
841
- JTextArea AddText(JPanel ctrlPanel, String name)
1105
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8421106 {
8431107 JTextArea text;
8441108
845
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
846
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
847
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1109
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8481110 text.addCaretListener(this);
849
- aConstraints.gridx += 1;
850
- aConstraints.gridwidth = 1;
8511111
8521112 return text;
8531113 }
....@@ -877,9 +1137,16 @@
8771137 objEditor.ctrlPanel.remove(j);
8781138 }
8791139
1140
+ void Remove(cNumberSlider j)
1141
+ {
1142
+ j.removeChangeListener(this);
1143
+ //objEditor.ctrlPanel.remove(j.label);
1144
+ objEditor.ctrlPanel.remove(j);
1145
+ }
1146
+
8801147 /*
8811148 */
882
- void Return() // ObjEditor oe)
1149
+ void Return0() // ObjEditor oe)
8831150 {
8841151 aConstraints.gridy += 1;
8851152 aConstraints.gridx = 0;
....@@ -934,35 +1201,81 @@
9341201
9351202 void SetupUI2(ObjEditor oe)
9361203 {
937
-// oe.aConstraints.weightx = 0;
938
-// oe.aConstraints.weighty = 0;
939
-// oe.aConstraints.gridx = 0;
940
-// oe.aConstraints.gridy = 0;
941
- SetupName(oe);
1204
+ //SetupName(oe);
9421205
943
- if (!GroupEditor.allparams)
1206
+ namePanel = new cGridBag();
1207
+
1208
+ nameField = AddText(namePanel, copy.GetName());
1209
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
1210
+ oe.ctrlPanel.add(namePanel);
1211
+
1212
+ oe.ctrlPanel.Return();
1213
+
1214
+ if (!allparams)
9441215 return;
9451216
946
- liveCB = AddCheckBox(oe, "Live", copy.live);
947
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
948
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1217
+ setupPanel = new cGridBag().setVertical(false);
1218
+
1219
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1220
+ liveCB.setToolTipText("Animate object");
1221
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1222
+ selectableCB.setToolTipText("Make object selectable");
9491223 // Return();
950
- markCB = AddCheckBox(oe, "Mark", copy.marked);
951
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
952
- randomCB = AddCheckBox(oe, "Rand", copy.random);
953
- Return();
954
- resetButton = AddButton(oe, "Reset");
955
- stepButton = AddButton(oe, "Step");
1224
+
1225
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1226
+ hideCB.setToolTipText("Hide object");
1227
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1228
+ markCB.setToolTipText("As animation target transform");
1229
+
1230
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
1231
+
1232
+ setupPanel2 = new cGridBag().setVertical(false);
1233
+
1234
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1235
+ rewindCB.setToolTipText("Rewind animation");
1236
+
1237
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1238
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1239
+
1240
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1241
+ link2masterCB.setToolTipText("Attach to support");
1242
+
1243
+ if (Globals.ADVANCED)
1244
+ {
1245
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1246
+ speedupCB.setToolTipText("Option motion capture");
1247
+ }
1248
+
1249
+ oe.ctrlPanel.add(setupPanel);
1250
+ oe.ctrlPanel.Return();
1251
+ oe.ctrlPanel.add(setupPanel2);
1252
+ oe.ctrlPanel.Return();
1253
+
1254
+ objectCommandsPanel = new cGridBag().setVertical(false);
1255
+
1256
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1257
+ resetButton.setToolTipText("Jump to frame zero");
1258
+ stepButton = AddButton(objectCommandsPanel, "Step");
1259
+ stepButton.setToolTipText("Step one frame");
9561260 // resetAllButton = AddButton(oe, "Reset All");
9571261 // stepAllButton = AddButton(oe, "Step All");
958
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9591262 // Return();
960
- slowerButton = AddButton(oe, "Slow");
961
- fasterButton = AddButton(oe, "Fast");
962
- remarkButton = AddButton(oe, "Rem");
1263
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1264
+ slowerButton.setToolTipText("Decrease animation speed");
1265
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1266
+ fasterButton.setToolTipText("Increase animation speed");
1267
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1268
+ remarkButton.setToolTipText("Set the current transform as the target");
9631269
964
- Return();
1270
+ oe.ctrlPanel.add(objectCommandsPanel);
1271
+ oe.ctrlPanel.Return();
9651272
1273
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1274
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1275
+ //Return();
1276
+
1277
+ oe.ctrlPanel.Return();
1278
+
9661279 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9671280 // ObjEditor.aConstraints.gridx += 1;
9681281
....@@ -1056,7 +1369,7 @@
10561369 oe.aConstraints.gridwidth = 1;
10571370 /**/
10581371 nameField = AddText(oe.ctrlPanel, copy.GetName());
1059
- Return();
1372
+ oe.ctrlPanel.Return();
10601373
10611374 //ctrlPanel.add(textureButton = new Button("Texture..."));
10621375 //textureButton.setEnabled(false);
....@@ -1107,7 +1420,7 @@
11071420 //frontScroll.setLabel("------------------------------ XZ (front) ---------------------------------------------------");
11081421 //sideScroll.setLabel("------------------------------- YZ (side) ---------------------------------------------------");
11091422
1110
-// GridBagConstraints gbc = (GridBagConstraints) GraphreeD.clone(aConstraints);
1423
+// GridBagConstraints gbc = (GridBagConstraints) GrafreeD.clone(aConstraints);
11111424 Camera cam = GetCamera(copy, 0);
11121425
11131426 Composite cams = null;
....@@ -1158,10 +1471,28 @@
11581471 //JPanel worldPanel =
11591472 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11601473 //worldPanel.setName("World");
1161
- /*JPanel*/ cameraPanel =
1162
- new JPanel(new BorderLayout());
1163
- cameraPanel.add(cameraView);
1474
+ centralPanel = new cGridBag();
1475
+ centralPanel.preferredWidth = 20;
1476
+
1477
+ if (Globals.ADVANCED)
1478
+ {
1479
+ timelinePanel = new JPanel(new BorderLayout());
1480
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11641481
1482
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1483
+ cameraPanel.setContinuousLayout(true);
1484
+ cameraPanel.setOneTouchExpandable(true);
1485
+// cameraPanel.setDividerLocation(0.9);
1486
+// cameraPanel.setDividerSize(9);
1487
+ cameraPanel.setResizeWeight(1.0);
1488
+
1489
+ }
1490
+
1491
+ centralPanel.add(cameraView);
1492
+ centralPanel.setFocusable(true);
1493
+ //frame.setJMenuBar(timelineMenubar);
1494
+ //centralPanel.add(timelinePanel);
1495
+
11651496 //topView.camera = ;
11661497 //frontView.camera = new Camera(2);
11671498 //sideView.camera = new Camera(3);
....@@ -1177,12 +1508,14 @@
11771508 //frontView.object = copy;
11781509 //sideView.object = copy;
11791510
1180
- XYZPanel = new JPanel();
1181
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1511
+ XYZPanel = new cGridBag().setVertical(true);
1512
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11821513
1183
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1184
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1185
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1514
+ XYZPanel.preferredWidth = 5;
1515
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1516
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1517
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1518
+ //XYZPanel.setName("XYZ");
11861519
11871520 /*
11881521 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1191,7 +1524,7 @@
11911524 gridPanel.add(cameraView);
11921525 gridPanel.add(XYZPanel);
11931526 */
1194
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout());
1527
+ gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
11951528 gridPanel.setContinuousLayout(true);
11961529 gridPanel.setOneTouchExpandable(true);
11971530 gridPanel.setDividerLocation(1.0);
....@@ -1220,11 +1553,29 @@
12201553 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12211554 //tmp.setName("Edit");
12221555 objectPanel.add(materialPanel);
1223
- JPanel north = new JPanel(new BorderLayout());
1224
- north.setName("Edit");
1225
- north.add(ctrlPanel, BorderLayout.NORTH);
1226
- objectPanel.add(north);
1227
- objectPanel.add(infoPanel);
1556
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1557
+ objectPanel.setToolTipTextAt(0, "Material");
1558
+
1559
+// JPanel north = new JPanel(new BorderLayout());
1560
+// north.setName("Edit");
1561
+// north.add(ctrlPanel, BorderLayout.NORTH);
1562
+// objectPanel.add(north);
1563
+ objectPanel.add(editPanel);
1564
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1565
+ objectPanel.setToolTipTextAt(1, "Edit controls");
1566
+
1567
+ //if (Globals.ADVANCED)
1568
+ objectPanel.add(infoPanel);
1569
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1570
+ objectPanel.setToolTipTextAt(2, "Information");
1571
+
1572
+ objectPanel.add(XYZPanel);
1573
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1574
+ objectPanel.setToolTipTextAt(3, "XYZ/RGB transform");
1575
+
1576
+ objectPanel.add(toolboxPanel);
1577
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
1578
+ objectPanel.setToolTipTextAt(4, "Objects & backgrounds");
12281579
12291580 /*
12301581 aConstraints.gridx = 0;
....@@ -1233,7 +1584,7 @@
12331584 aConstraints.gridy += 1;
12341585 aConstraints.gridwidth = 1;
12351586 mainPanel.add(objectPanel, aConstraints);
1236
- */
1587
+ */
12371588
12381589 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12391590 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1244,16 +1595,23 @@
12441595 scrollpane.setWheelScrollingEnabled(true);
12451596 scrollpane.addMouseWheelListener(this); // Default not fast enough
12461597
1247
- /*JTabbedPane*/ jtp = new JTabbedPane();
1248
- jtp.add(scrollpane);
1598
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1599
+ scenePanel.preferredWidth = 5;
1600
+
1601
+ JTabbedPane tabbedPane = new JTabbedPane();
1602
+ tabbedPane.add(scrollpane);
12491603
1250
- jtp.add(FSPane = new cFileSystemPane(this));
1251
-
1252
- optionsPanel = new JPanel(new GridBagLayout());
1604
+ optionsPanel = new cGridBag().setVertical(false);
12531605
12541606 optionsPanel.setName("Options");
1255
- jtp.add(optionsPanel);
1607
+
1608
+ AddOptions(optionsPanel); //, aConstraints);
1609
+
1610
+ tabbedPane.add(optionsPanel);
1611
+
1612
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12561613
1614
+ scenePanel.add(tabbedPane);
12571615
12581616 /*
12591617 cTree jTree = new cTree(null);
....@@ -1275,7 +1633,7 @@
12751633 jtp.add(tree);
12761634 */
12771635
1278
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel);
1636
+ bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
12791637 bigPanel.setContinuousLayout(true);
12801638 bigPanel.setOneTouchExpandable(true);
12811639 bigPanel.setDividerLocation(0.8);
....@@ -1287,6 +1645,7 @@
12871645 //bigPanel.setSize(new Dimension(10,10));
12881646 //bigPanel.add(ctrlPanel);
12891647 //bigPanel.add(gridPanel);
1648
+ /**
12901649 bigThree = new JPanel();
12911650 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12921651 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1297,20 +1656,26 @@
12971656 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
12981657 aWindowConstraints.weightx = 0;
12991658 aWindowConstraints.weighty = 1;
1300
- bigThree.add(jtp, aWindowConstraints);
1659
+ bigThree.add(scenePanel, aWindowConstraints);
13011660 aWindowConstraints.weightx = 1;
13021661 aWindowConstraints.gridwidth = 3;
13031662 // aConstraints.gridheight = 3;
13041663 aWindowConstraints.gridx = 1;
13051664 aWindowConstraints.fill = GridBagConstraints.BOTH;
1306
- bigThree.add(cameraPanel, aWindowConstraints);
1665
+ bigThree.add(centralPanel, aWindowConstraints);
13071666 aWindowConstraints.weightx = 0;
13081667 aWindowConstraints.gridx = 4;
13091668 aWindowConstraints.gridwidth = 1;
13101669 // aConstraints.gridheight = 3;
13111670 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13121671 bigThree.add(XYZPanel, aWindowConstraints);
1672
+ /**/
13131673
1674
+ bigThree = new cGridBag();
1675
+ bigThree.addComponent(scenePanel);
1676
+ bigThree.addComponent(centralPanel);
1677
+ //bigThree.addComponent(XYZPanel);
1678
+
13141679 // // SIDE EFFECT!!!
13151680 // aConstraints.gridx = 0;
13161681 // aConstraints.gridy = 0;
....@@ -1318,9 +1683,9 @@
13181683 // aConstraints.gridheight = 1;
13191684
13201685 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1321
- framePanel.setContinuousLayout(true);
1322
- framePanel.setOneTouchExpandable(true);
1323
- framePanel.setDividerLocation(0.8);
1686
+ framePanel.setContinuousLayout(false);
1687
+ framePanel.setOneTouchExpandable(false);
1688
+ //.setDividerLocation(0.8);
13241689 //framePanel.setDividerSize(15);
13251690 //framePanel.setResizeWeight(0.15);
13261691 framePanel.setName("Frame");
....@@ -1331,20 +1696,25 @@
13311696 //worldPane.add(bigPanel);
13321697 //worldPane.add(worldPanel);
13331698 /**/
1334
- frame.getContentPane().add(/*"Center",*/framePanel);
1699
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1700
+ frame.add(/*"Center",*/framePanel);
13351701 //frame.getContentPane().add(/*"Center",*/ worldPane);
13361702
1337
-// aConstraints = gbc; // (GridBagConstraints) GraphreeD.clone(gbc);
1703
+// aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13381704
1339
- frame.setSize(800, 600);
1340
- frame.show();
1341
-
1705
+ frame.setSize(1280, 860);
1706
+
1707
+ cameraView.requestFocusInWindow();
1708
+
13421709 gridPanel.setDividerLocation(1.0);
1710
+
1711
+ frame.validate();
1712
+
1713
+ frame.setVisible(true);
13431714
13441715 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13451716 frame.addWindowListener(new WindowAdapter()
13461717 {
1347
-
13481718 public void windowClosing(WindowEvent e)
13491719 {
13501720 Close();
....@@ -1352,6 +1722,10 @@
13521722 });
13531723 }
13541724
1725
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1726
+ {
1727
+ }
1728
+
13551729 JTree GetTree()
13561730 {
13571731 return objEditor.jTree;
....@@ -1363,260 +1737,257 @@
13631737 ctrlPanel.removeAll();
13641738 }
13651739
1366
- void SetupMaterial(JPanel ctrlPanel)
1740
+ void SetupMaterial(cGridBag materialpanel)
13671741 {
1368
- aConstraints.weighty = 0;
1369
- //aConstraints.weightx = 1;
1370
- /*
1742
+ cGridBag presetpanel = new cGridBag().setVertical(true);
1743
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1744
+ skin.addMouseListener(new MouseAdapter()
1745
+ {
1746
+ public void mouseClicked(MouseEvent e)
1747
+ {
1748
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
1749
+ cMaterial material = object.material;
1750
+
1751
+ // Skin
1752
+ colorField.setFloat(material.color);
1753
+ saturationField.setFloat(material.modulation);
1754
+ subsurfaceField.setFloat(material.subsurface);
1755
+ selfshadowField.setFloat(material.diffuseness);
1756
+ diffusenessField.setFloat(material.factor);
1757
+ shininessField.setFloat(material.shininess);
1758
+ shadowbiasField.setFloat(material.shadowbias);
1759
+ diffuseField.setFloat(material.diffuse);
1760
+ specularField.setFloat(material.specular);
1761
+
1762
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
1763
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
1764
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
1765
+
1766
+ materialtouched = true;
1767
+ applySelf();
1768
+ }
1769
+ });
1770
+ presetpanel.add(skin);
1771
+
1772
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
1773
+ rough2.addMouseListener(new MouseAdapter()
1774
+ {
1775
+ public void mouseClicked(MouseEvent e)
1776
+ {
1777
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
1778
+ cMaterial material = object.material;
1779
+
1780
+ shininessField.setFloat(material.shininess);
1781
+ velvetField.setFloat(material.velvet);
1782
+
1783
+ materialtouched = true;
1784
+ applySelf();
1785
+ }
1786
+ });
1787
+ presetpanel.add(rough2);
1788
+
1789
+ presetpanel.add(GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF));
1790
+ presetpanel.add(GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF));
1791
+ presetpanel.add(GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF));
1792
+ presetpanel.add(GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF));
1793
+ presetpanel.add(GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF));
1794
+ presetpanel.add(GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF));
1795
+ presetpanel.add(GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF));
1796
+ presetpanel.add(GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF));
1797
+ presetpanel.add(GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF));
1798
+ presetpanel.add(GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF));
1799
+ presetpanel.add(GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF));
1800
+ presetpanel.add(GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF));
1801
+ presetpanel.add(GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF));
1802
+ presetpanel.add(GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF));
1803
+ presetpanel.add(GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF));
1804
+ presetpanel.add(GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF));
1805
+
1806
+ cGridBag panel = new cGridBag().setVertical(true);
1807
+
1808
+ presetpanel.preferredWidth = 1;
1809
+
1810
+ materialpanel.add(panel);
1811
+ materialpanel.add(presetpanel);
1812
+
1813
+ panel.preferredWidth = 8;
1814
+
1815
+ /*
13711816 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13721817 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1373
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1374
- aConstraints.gridx += 1;
1375
- */
1818
+ */
13761819
1377
- aConstraints.gridwidth = 1;
1378
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1379
- aConstraints.gridx += 1;
1380
- aConstraints.weighty = 0;
1381
- aConstraints.gridwidth = 1;
1820
+ cGridBag editBar = new cGridBag().setVertical(false);
1821
+
1822
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1823
+ createMaterialButton.setToolTipText("Create material");
13821824
13831825 /*
13841826 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- aConstraints.gridwidth = 1;
13881827 */
13891828
1390
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1391
- aConstraints.gridx += 1;
1829
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1830
+ clearMaterialButton.setToolTipText("Clear material");
1831
+
1832
+ if (Globals.ADVANCED)
1833
+ {
1834
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1835
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1836
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1837
+ }
13921838
1393
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1394
-
1395
- aConstraints.gridx += 1;
1396
-
1397
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1398
-
1399
- aConstraints.gridx += 1;
1400
-
1401
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1402
-
1403
- aConstraints.gridx = 0;
1404
- aConstraints.gridy += 1;
1405
- aConstraints.weighty = 0;
1406
- aConstraints.gridwidth = 1;
1839
+ editBar.preferredHeight = 15;
1840
+
1841
+ panel.add(editBar);
1842
+
14071843 /**/
14081844 //aConstraints.weighty = 0;
14091845 ////aConstraints.weightx = 1;
14101846 //aConstraints.weighty = 1;
14111847 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14121848 //aConstraints.gridx += 1;
1413
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1414
- aConstraints.weighty = 0;
1415
- aConstraints.gridx = 0;
1416
- aConstraints.gridy += 1;
1417
- aConstraints.gridwidth = 1;
1849
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14181850
1419
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1420
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1421
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1422
- aConstraints.gridx += 1;
1423
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1424
- //aConstraints.weightx = 0;
1425
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1426
- aConstraints.gridx = 0;
1427
- aConstraints.gridy += 1;
1428
- aConstraints.gridwidth = 1;
1851
+ cGridBag colorSection = new cGridBag().setVertical(true);
14291852
1430
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1431
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1432
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1433
- aConstraints.gridx += 1;
1434
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1435
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1436
- aConstraints.gridx = 0;
1437
- aConstraints.gridy += 1;
1438
- aConstraints.gridwidth = 1;
1853
+ cGridBag huepanel = new cGridBag();
1854
+ cGridBag huelabel = new cGridBag();
1855
+ skin = GetLabel("icons/hue.png", false);
1856
+ skin.fit = true;
1857
+ huelabel.add(skin);
1858
+ huelabel.preferredWidth = 20;
1859
+ huepanel.add(new cGridBag()); // Label
1860
+ huepanel.add(huelabel); // Field/slider
1861
+
1862
+ huepanel.preferredHeight = 7;
14391863
1440
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1441
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1442
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1443
- aConstraints.gridx += 1;
1444
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1445
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1446
- aConstraints.gridx = 0;
1447
- aConstraints.gridy += 1;
1448
- aConstraints.gridwidth = 1;
1864
+ colorSection.add(huepanel);
1865
+
1866
+ cGridBag color = new cGridBag();
1867
+
1868
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1869
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1870
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
14491871
1450
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1451
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1452
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1453
- aConstraints.gridx += 1;
1454
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1455
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1456
- aConstraints.gridx = 0;
1457
- aConstraints.gridy += 1;
1458
- aConstraints.gridwidth = 1;
1872
+ //colorField.preferredWidth = 200;
1873
+ colorSection.add(color);
14591874
1460
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1461
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1462
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1463
- aConstraints.gridx += 1;
1464
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1465
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1466
- aConstraints.gridx = 0;
1467
- aConstraints.gridy += 1;
1468
- aConstraints.gridwidth = 1;
1875
+ cGridBag modulation = new cGridBag();
1876
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1877
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1878
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
1879
+ colorSection.add(modulation);
14691880
1470
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1471
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1472
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1473
- aConstraints.gridx += 1;
1474
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1475
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1476
- aConstraints.gridx = 0;
1477
- aConstraints.gridy += 1;
1478
- aConstraints.gridwidth = 1;
1881
+ cGridBag opacity = new cGridBag();
1882
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1883
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1884
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
1885
+ colorSection.add(opacity);
14791886
1480
- //aConstraints.weighty = 1;
1481
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1482
- //aConstraints.gridx += 1;
1483
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1484
- aConstraints.weighty = 0;
1485
- aConstraints.gridx = 0;
1486
- aConstraints.gridy += 1;
1487
- aConstraints.gridwidth = 1;
1887
+ colorSection.add(GetSeparator());
1888
+
1889
+ cGridBag texture = new cGridBag();
1890
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1891
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1892
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1893
+ colorSection.add(texture);
14881894
1489
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1490
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1492
- aConstraints.gridx += 1;
1493
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1494
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1495
- aConstraints.gridx = 0;
1496
- aConstraints.gridy += 1;
1497
- aConstraints.gridwidth = 1;
1895
+ panel.add(GetSeparator());
1896
+
1897
+ panel.add(colorSection);
1898
+
1899
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1900
+
1901
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1902
+
1903
+ cGridBag diffuse = new cGridBag();
1904
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1905
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1906
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1907
+ diffuseSection.add(diffuse);
14981908
1499
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1500
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1501
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1502
- aConstraints.gridx += 1;
1503
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1504
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1505
- aConstraints.gridx = 0;
1506
- aConstraints.gridy += 1;
1507
- aConstraints.gridwidth = 1;
1909
+ cGridBag diffuseness = new cGridBag();
1910
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1911
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1912
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1913
+ diffuseSection.add(diffuseness);
15081914
1509
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1510
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1511
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1512
- aConstraints.gridx += 1;
1513
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1514
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1515
- aConstraints.gridx = 0;
1516
- aConstraints.gridy += 1;
1517
- aConstraints.gridwidth = 1;
1915
+ cGridBag selfshadow = new cGridBag();
1916
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1917
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1918
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1919
+ diffuseSection.add(selfshadow);
15181920
1519
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1520
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1521
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1522
- aConstraints.gridx += 1;
1523
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1524
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1525
- aConstraints.gridx = 0;
1526
- aConstraints.gridy += 1;
1527
- aConstraints.gridwidth = 1;
1921
+ cGridBag sheen = new cGridBag();
1922
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1923
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1924
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1925
+ diffuseSection.add(sheen);
15281926
1529
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1530
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1531
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1532
- aConstraints.gridx += 1;
1533
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1534
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1535
- aConstraints.gridx = 0;
1536
- aConstraints.gridy += 1;
1537
- aConstraints.gridwidth = 1;
1927
+ cGridBag subsurface = new cGridBag();
1928
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1929
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1930
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1931
+ diffuseSection.add(subsurface);
15381932
1539
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1540
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1541
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1542
- aConstraints.gridx += 1;
1543
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1544
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1545
- aConstraints.gridx = 0;
1546
- aConstraints.gridy += 1;
1547
- aConstraints.gridwidth = 1;
1933
+ cGridBag shadow = new cGridBag();
1934
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1935
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1936
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1937
+ diffuseSection.add(shadow);
15481938
1549
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1550
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1551
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1552
- aConstraints.gridx += 1;
1553
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1554
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1555
- aConstraints.gridx = 0;
1556
- aConstraints.gridy += 1;
1557
- aConstraints.gridwidth = 1;
1939
+ cGridBag fakedepth = new cGridBag();
1940
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1941
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1942
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1943
+ diffuseSection.add(fakedepth);
15581944
1559
- //aConstraints.weighty = 1;
1560
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1561
- //aConstraints.gridx += 1;
1562
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1563
- aConstraints.weighty = 0;
1564
- aConstraints.gridx = 0;
1565
- aConstraints.gridy += 1;
1566
- aConstraints.gridwidth = 1;
1945
+ cGridBag shadowbias = new cGridBag();
1946
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1947
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1948
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1949
+ diffuseSection.add(shadowbias);
15671950
1568
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1569
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1570
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1571
- aConstraints.gridx += 1;
1572
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1573
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1574
- aConstraints.gridx = 0;
1575
- aConstraints.gridy += 1;
1576
- aConstraints.gridwidth = 1;
1951
+ panel.add(GetSeparator());
1952
+
1953
+ panel.add(diffuseSection);
1954
+
1955
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1956
+
1957
+ cGridBag specularSection = new cGridBag().setVertical(true);
15771958
1578
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1579
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1580
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1581
- aConstraints.gridx += 1;
1582
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1583
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1584
- aConstraints.gridx = 0;
1585
- aConstraints.gridy += 1;
1586
- aConstraints.gridwidth = 1;
1959
+ cGridBag specular = new cGridBag();
1960
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1961
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1962
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1963
+ specularSection.add(specular);
15871964
1588
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1589
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1590
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1591
- aConstraints.gridx += 1;
1592
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1593
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1594
- aConstraints.gridx = 0;
1595
- aConstraints.gridy += 1;
1596
- aConstraints.gridwidth = 1;
1965
+ cGridBag lightarea = new cGridBag();
1966
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1967
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1968
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1969
+ specularSection.add(lightarea);
15971970
1598
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1599
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1600
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1601
- aConstraints.gridx += 1;
1602
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1603
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1604
- aConstraints.gridx = 0;
1605
- aConstraints.gridy += 1;
1606
- aConstraints.gridwidth = 1;
1971
+ cGridBag shininess = new cGridBag();
1972
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1973
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1974
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1975
+ specularSection.add(shininess);
16071976
1608
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1609
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1610
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1611
- aConstraints.gridx += 1;
1612
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1613
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1614
- aConstraints.gridx = 0;
1615
- aConstraints.gridy += 1;
1616
- aConstraints.gridwidth = 1;
1977
+ cGridBag metalness = new cGridBag();
1978
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1979
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1980
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1981
+ specularSection.add(metalness);
16171982
1618
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1619
- Return();
1983
+ cGridBag velvet = new cGridBag();
1984
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1985
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1986
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1987
+ specularSection.add(velvet);
1988
+
1989
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1990
+ //Return();
16201991 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16211992 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16221993 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1627,130 +1998,99 @@
16271998 // aConstraints.gridy += 1;
16281999 // aConstraints.gridwidth = 1;
16292000
1630
- //aConstraints.weighty = 1;
1631
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1632
- //aConstraints.gridx += 1;
1633
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1634
- aConstraints.weighty = 0;
1635
- aConstraints.gridx = 0;
1636
- aConstraints.gridy += 1;
1637
- aConstraints.gridwidth = 1;
2001
+ cGridBag anisoU = new cGridBag();
2002
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
2003
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2004
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2005
+ specularSection.add(anisoU);
16382006
1639
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1640
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1641
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1642
- aConstraints.gridx += 1;
1643
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1644
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1645
- aConstraints.gridx = 0;
1646
- aConstraints.gridy += 1;
1647
- aConstraints.gridwidth = 1;
2007
+ cGridBag anisoV = new cGridBag();
2008
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
2009
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2010
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2011
+ specularSection.add(anisoV);
16482012
1649
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1650
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1651
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1652
- aConstraints.gridx += 1;
1653
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1654
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1655
- aConstraints.gridx = 0;
1656
- aConstraints.gridy += 1;
1657
- aConstraints.gridwidth = 1;
16582013
1659
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1660
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1661
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1662
- aConstraints.gridx += 1;
1663
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1664
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1665
- aConstraints.gridx = 0;
1666
- aConstraints.gridy += 1;
1667
- aConstraints.gridwidth = 1;
2014
+ panel.add(GetSeparator());
2015
+
2016
+ panel.add(specularSection);
2017
+
2018
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2019
+
2020
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16682021
1669
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1670
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1671
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1672
- aConstraints.gridx += 1;
1673
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1674
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1675
- aConstraints.gridx = 0;
1676
- aConstraints.gridy += 1;
1677
- aConstraints.gridwidth = 1;
1678
- aConstraints.weighty = 0;
2022
+ cGridBag camera = new cGridBag();
2023
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
2024
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2025
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2026
+ colorSection.add(camera);
16792027
1680
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1681
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1683
- aConstraints.gridx += 1;
1684
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1685
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1686
- aConstraints.gridx = 0;
1687
- aConstraints.gridy += 1;
1688
- aConstraints.gridwidth = 1;
2028
+ cGridBag ambient = new cGridBag();
2029
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
2030
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2031
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2032
+ colorSection.add(ambient);
16892033
1690
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1691
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1692
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1693
- aConstraints.gridx += 1;
1694
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1695
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1696
- aConstraints.gridx = 0;
1697
- aConstraints.gridy += 1;
1698
- aConstraints.gridwidth = 1;
2034
+ cGridBag backlit = new cGridBag();
2035
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
2036
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2037
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2038
+ colorSection.add(backlit);
16992039
1700
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1701
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1702
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1703
- aConstraints.gridx += 1;
1704
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1705
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1706
- aConstraints.gridx = 0;
1707
- aConstraints.gridy += 1;
1708
- aConstraints.gridwidth = 1;
2040
+ //panel.add(new JSeparator());
2041
+
2042
+ //panel.add(globalSection);
2043
+
2044
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2045
+
2046
+ cGridBag textureSection = new cGridBag().setVertical(true);
17092047
1710
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1711
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1712
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1713
- aConstraints.gridx += 1;
1714
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1715
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1716
- aConstraints.gridx = 0;
1717
- aConstraints.gridy += 1;
1718
- aConstraints.gridwidth = 1;
2048
+ cGridBag bump = new cGridBag();
2049
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
2050
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2051
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
2052
+ textureSection.add(bump);
17192053
1720
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1721
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1722
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1723
- aConstraints.gridx += 1;
1724
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1725
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1726
- aConstraints.gridx = 0;
1727
- aConstraints.gridy += 1;
1728
- aConstraints.gridwidth = 1;
2054
+ cGridBag noise = new cGridBag();
2055
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
2056
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2057
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
2058
+ textureSection.add(noise);
17292059
1730
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1731
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1732
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1733
- aConstraints.gridx += 1;
1734
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1735
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1736
- aConstraints.gridx = 0;
1737
- aConstraints.gridy += 1;
1738
- aConstraints.gridwidth = 1;
2060
+ cGridBag power = new cGridBag();
2061
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
2062
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2063
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
2064
+ textureSection.add(power);
17392065
1740
- //aConstraints.weighty = 1;
1741
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1742
- //aConstraints.gridx += 1;
1743
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1744
- aConstraints.weighty = 0;
2066
+ cGridBag borderfade = new cGridBag();
2067
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
2068
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2069
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
2070
+ textureSection.add(borderfade);
17452071
1746
- aConstraints.gridx = 0;
1747
- aConstraints.gridy = 0;
1748
- aConstraints.gridwidth = 1;
2072
+ cGridBag fog = new cGridBag();
2073
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
2074
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2075
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
2076
+ textureSection.add(fog);
2077
+
2078
+ cGridBag opacityPower = new cGridBag();
2079
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
2080
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2081
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
2082
+ textureSection.add(opacityPower);
2083
+
2084
+ panel.add(GetSeparator());
2085
+
2086
+ panel.add(textureSection);
2087
+
2088
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17492089
17502090 SetMaterial(copy); // .GetMaterial());
17512091
1752
- colorField.addChangeListener(this);
1753
- modulationField.addChangeListener(this);
2092
+ //colorField.addChangeListener(this);
2093
+// modulationField.addChangeListener(this);
17542094 metalnessField.addChangeListener(this);
17552095 diffuseField.addChangeListener(this);
17562096 specularField.addChangeListener(this);
....@@ -1780,12 +2120,15 @@
17802120 opacityPowerField.addChangeListener(this);
17812121 /**/
17822122
1783
- resetSlidersButton.addActionListener(this);
17842123 clearMaterialButton.addActionListener(this);
17852124 createMaterialButton.addActionListener(this);
1786
-
1787
- propagateToggle.addItemListener(this);
1788
- multiplyToggle.addItemListener(this);
2125
+
2126
+ if (Globals.ADVANCED)
2127
+ {
2128
+ resetSlidersButton.addActionListener(this);
2129
+ propagateToggle.addItemListener(this);
2130
+ multiplyToggle.addItemListener(this);
2131
+ }
17892132 }
17902133
17912134 void DropFile(java.io.File[] files, boolean textures)
....@@ -1803,8 +2146,9 @@
18032146 // 3D models
18042147 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18052148 {
1806
- lastConverter = new com.jmex.model.converters.MaxToJme();
1807
- LoadFile(filename, lastConverter);
2149
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2150
+ //LoadFile(filename, lastConverter);
2151
+ LoadObjFile(filename); // New 3ds loader
18082152 continue;
18092153 }
18102154 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1859,19 +2203,21 @@
18592203 }
18602204
18612205 // Images/textures
1862
- if (textures
1863
- && (filename.toLowerCase().endsWith(".jpg")
1864
- || filename.toLowerCase().endsWith(".jpeg")
1865
- || filename.toLowerCase().endsWith(".gif")
1866
- || filename.toLowerCase().endsWith(".png")
1867
- || filename.toLowerCase().endsWith(".tre")
1868
- || filename.toLowerCase().endsWith(".bmp")
1869
- || filename.toLowerCase().endsWith(".tga")
1870
- || filename.toLowerCase().endsWith(".sgi")
1871
- || filename.toLowerCase().endsWith(".tif")
1872
- || filename.toLowerCase().endsWith(".tiff")))
2206
+ if (filename.toLowerCase().endsWith(".jpg")
2207
+ || filename.toLowerCase().endsWith(".jpeg")
2208
+ || filename.toLowerCase().endsWith(".gif")
2209
+ || filename.toLowerCase().endsWith(".png")
2210
+ || filename.toLowerCase().endsWith(".tre")
2211
+ || filename.toLowerCase().endsWith(".bmp")
2212
+ || filename.toLowerCase().endsWith(".tga")
2213
+ || filename.toLowerCase().endsWith(".sgi")
2214
+ || filename.toLowerCase().endsWith(".tif")
2215
+ || filename.toLowerCase().endsWith(".tiff"))
18732216 {
1874
- DropTexture(filename);
2217
+ if (textures)
2218
+ DropTexture(filename);
2219
+ else
2220
+ CreateBillboard(filename);
18752221 continue;
18762222 }
18772223
....@@ -1880,6 +2226,60 @@
18802226 }
18812227
18822228 ResetModel();
2229
+ }
2230
+
2231
+ void CreateBillboard(String filename)
2232
+ {
2233
+ Object3D source = null;
2234
+ Object3D group = copy;
2235
+
2236
+ if (group.selection.size() > 0)
2237
+ {
2238
+ source = group.selection.get(0);
2239
+ }
2240
+
2241
+ Grid grid = new Grid(1,1);
2242
+ grid.material = null;
2243
+
2244
+ grid.toParent = LA.newMatrix();
2245
+ grid.fromParent = LA.newMatrix();
2246
+ LA.matYRotate(grid.toParent, Math.PI/2);
2247
+ LA.matXRotate(grid.toParent, -Math.PI/2);
2248
+ LA.matXRotate(grid.fromParent, Math.PI/2);
2249
+ LA.matYRotate(grid.fromParent, -Math.PI/2);
2250
+
2251
+ BillboardNode bb = new BillboardNode();
2252
+ bb.addChild(grid);
2253
+
2254
+ Object3D newgroup = new Object3D();
2255
+ newgroup.CreateMaterial();
2256
+
2257
+ File file = new File(filename);
2258
+ newgroup.name = file.getName();
2259
+ newgroup.addChild(bb);
2260
+
2261
+ Object3D main = newgroup;
2262
+
2263
+ main.SetPigmentTexture(filename);
2264
+
2265
+ if (source != null)
2266
+ {
2267
+ main.material = new cMaterial(source.material);
2268
+ if (main.projectedVertices.length < source.projectedVertices.length)
2269
+ {
2270
+ main.projectedVertices = new Object3D.cVector2[source.projectedVertices.length];
2271
+ }
2272
+
2273
+ for (int i=0; i<source.projectedVertices.length; i++)
2274
+ {
2275
+ main.projectedVertices[i].x = source.projectedVertices[i].x;
2276
+ main.projectedVertices[i].y = source.projectedVertices[i].y;
2277
+ }
2278
+
2279
+ main.texres = source.texres;
2280
+ }
2281
+
2282
+ makeSomething(newgroup, false);
18832283 }
18842284
18852285 Point location;
....@@ -1900,7 +2300,7 @@
19002300
19012301 //? flashIt = false;
19022302 CameraPane pane = (CameraPane) cameraView;
1903
- pane.clickStart(location.x, location.y, 0);
2303
+ pane.clickStart(location.x, location.y, 0, 0);
19042304 pane.clickEnd(location.x, location.y, 0, true);
19052305
19062306 if (group.selection.size() == 1)
....@@ -1949,6 +2349,7 @@
19492349 e2.printStackTrace();
19502350 }
19512351 }
2352
+
19522353 LoadJMEThread loadThread;
19532354
19542355 class LoadJMEThread extends Thread
....@@ -2006,6 +2407,7 @@
20062407 //LoadFile0(filename, converter);
20072408 }
20082409 }
2410
+
20092411 LoadOBJThread loadObjThread;
20102412
20112413 class LoadOBJThread extends Thread
....@@ -2084,19 +2486,19 @@
20842486
20852487 void LoadObjFile(String fullname)
20862488 {
2087
- /*
2489
+ System.out.println("Loading " + fullname);
2490
+ /**/
20882491 //lastFilename = fullname;
20892492 if(loadObjThread == null)
20902493 {
2091
- loadObjThread = new LoadOBJThread();
2092
- loadObjThread.start();
2494
+ loadObjThread = new LoadOBJThread();
2495
+ loadObjThread.start();
20932496 }
20942497
20952498 loadObjThread.add(fullname);
2096
- */
2499
+ /**/
20972500
2098
- System.out.println("Loading " + fullname);
2099
- makeSomething(new FileObject(fullname, true), true);
2501
+ //makeSomething(new FileObject(fullname, true), true);
21002502 }
21012503
21022504 void LoadGFDFile(String fullname)
....@@ -2138,6 +2540,8 @@
21382540 {
21392541 Mocap sel = (Mocap) copy.selection.get(0);
21402542
2543
+ sel.SetCurrentBones(sel.frame);
2544
+
21412545 sel.fullname = fullname;
21422546
21432547 if (changename)
....@@ -2151,14 +2555,18 @@
21512555 sel.smoothed = false;
21522556
21532557 // if (!changename)
2154
- sel.SetPositionDelta(false, true, true, true/*?*/); // false
2558
+ //sel.SetPositionDelta(false, true, true, true/*?*/); // false
2559
+ sel.SetGlobalTransform();
2560
+ sel.LoadData();
2561
+ sel.Rewind();
2562
+ sel.Fade();
21552563 // sel.setPose(0);
21562564 refreshContents();
21572565 } else
21582566 {
21592567 mocap.Reset();
21602568 // new skeleton
2161
- makeSomething(mocap, false); // true);
2569
+ makeSomething(mocap, true); // true);
21622570 }
21632571 } catch (Exception e)
21642572 {
....@@ -2185,6 +2593,8 @@
21852593 {
21862594 Mocap sel = (Mocap) select;
21872595
2596
+ sel.SetCurrentBones(sel.frame);
2597
+
21882598 File file = new File(fullname);
21892599
21902600 // Mocap mocap = new Mocap("Mocap" + file.getName());
....@@ -2251,7 +2661,11 @@
22512661
22522662 if (!changename)
22532663 {
2254
- sel.SetPositionDelta(false, true, true, true/*?*/);
2664
+ //sel.SetPositionDelta(false, true, true, true/*?*/);
2665
+ sel.SetGlobalTransform();
2666
+ sel.LoadData();
2667
+ sel.Rewind();
2668
+ sel.Fade();
22552669 }
22562670
22572671 // sel.setPose(0);
....@@ -2345,11 +2759,11 @@
23452759
23462760 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23472761 {
2348
- if (GraphreeD.standAlone)
2762
+ if (Grafreed.standAlone)
23492763 {
23502764 /**/
23512765 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2352
- browser.show();
2766
+ browser.setVisible(true);
23532767 String filename = browser.getFile();
23542768 if (filename != null && filename.length() > 0)
23552769 {
....@@ -2460,6 +2874,7 @@
24602874 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
24612875 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
24622876 }
2877
+
24632878 //cJME.count++;
24642879 //cJME.count %= 12;
24652880 if (gc)
....@@ -2494,6 +2909,7 @@
24942909 }
24952910 if (input == null)
24962911 {
2912
+ new Exception().printStackTrace();
24972913 System.exit(0);
24982914 }
24992915
....@@ -2642,6 +3058,7 @@
26423058 }
26433059 }
26443060 }
3061
+
26453062 cFileSystemPane FSPane;
26463063
26473064 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2651,7 +3068,7 @@
26513068
26523069 freezematerial = true;
26533070 colorField.setFloat(mat.color);
2654
- modulationField.setFloat(mat.modulation);
3071
+ saturationField.setFloat(mat.modulation);
26553072 metalnessField.setFloat(mat.metalness);
26563073 diffuseField.setFloat(mat.diffuse);
26573074 specularField.setFloat(mat.specular);
....@@ -2695,11 +3112,14 @@
26953112 }
26963113 }
26973114 }
3115
+
26983116 freezematerial = false;
26993117 }
27003118
27013119 void SetMaterial(Object3D object)
27023120 {
3121
+ latestObject = object;
3122
+
27033123 cMaterial mat = object.material;
27043124
27053125 if (mat == null)
....@@ -2708,7 +3128,8 @@
27083128 return;
27093129 }
27103130
2711
- multiplyToggle.setSelected(mat.multiply);
3131
+ if (multiplyToggle != null)
3132
+ multiplyToggle.setSelected(mat.multiply);
27123133
27133134 assert (object.projectedVertices != null);
27143135
....@@ -2810,12 +3231,17 @@
28103231 // }
28113232
28123233 /**/
2813
- if (deselect)
3234
+ if (deselect || child == null)
28143235 {
28153236 //group.deselectAll();
28163237 //freeze = true;
28173238 GetTree().clearSelection();
28183239 //freeze = false;
3240
+
3241
+ if (child == null)
3242
+ {
3243
+ return;
3244
+ }
28193245 }
28203246
28213247 //group.addSelectee(child);
....@@ -2884,31 +3310,48 @@
28843310 cameraView.ToggleDL();
28853311 cameraView.repaint();
28863312 return;
2887
- } else if (event.getSource() == toggleTextureItem)
3313
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
28883314 {
28893315 cameraView.ToggleTexture();
28903316 // june 2013 copy.HardTouch();
28913317 cameraView.repaint();
28923318 return;
2893
- } else if (event.getSource() == toggleFullItem)
3319
+ } else if (event.getSource() == toggleTimelineItem)
28943320 {
2895
- if (CameraPane.FULLSCREEN)
3321
+ timeline ^= true;
3322
+
3323
+ if (timeline)
28963324 {
2897
- frame.getContentPane().remove(/*"Center",*/bigThree);
2898
- framePanel.add(bigThree);
2899
- frame.getContentPane().add(/*"Center",*/framePanel);
2900
- } else
2901
- {
2902
- frame.getContentPane().remove(/*"Center",*/framePanel);
2903
- frame.getContentPane().add(/*"Center",*/bigThree);
3325
+ centralPanel.remove(cameraView);
3326
+ cameraPanel.add(cameraView);
3327
+ centralPanel.add(cameraPanel);
3328
+ frame.setJMenuBar(timelineMenubar);
3329
+ wasFullScreen = CameraPane.FULLSCREEN;
3330
+ if (!CameraPane.FULLSCREEN)
3331
+ ToggleFullScreen();
3332
+ toggleFullScreenItem.setEnabled(false);
29043333 }
3334
+ else
3335
+ {
3336
+ centralPanel.remove(cameraPanel);
3337
+ centralPanel.add(cameraView);
3338
+ frame.setJMenuBar(null);
3339
+ if (!wasFullScreen)
3340
+ ToggleFullScreen();
3341
+ toggleFullScreenItem.setEnabled(true);
3342
+ }
3343
+
29053344 frame.validate();
2906
- cameraView.ToggleFullScreen();
3345
+ return;
3346
+ } else if (event.getSource() == toggleFullScreenItem)
3347
+ {
3348
+ ToggleFullScreen();
3349
+ frame.validate();
29073350
29083351 return;
2909
- } else if (event.getSource() == toggleRandomItem)
3352
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
29103353 {
2911
- cameraView.ToggleRandom();
3354
+ cameraView.ToggleSwitch();
29123355 cameraView.repaint();
29133356 return;
29143357 } else if (event.getSource() == toggleHandleItem)
....@@ -2936,12 +3379,17 @@
29363379 } else if (event.getSource() == liveCB)
29373380 {
29383381 copy.live ^= true;
3382
+ objEditor.refreshContents(true); // To show item colors
3383
+ return;
3384
+ } else if (event.getSource() == selectableCB)
3385
+ {
3386
+ copy.dontselect ^= true;
29393387 return;
29403388 } else if (event.getSource() == hideCB)
29413389 {
29423390 copy.hide ^= true;
29433391 copy.Touch(); // display list issue
2944
- objEditor.refreshContents();
3392
+ objEditor.refreshContents(true); // To show item colors
29453393 return;
29463394 } else if (event.getSource() == link2masterCB)
29473395 {
....@@ -2951,6 +3399,7 @@
29513399 if (event.getSource() == randomCB)
29523400 {
29533401 copy.random ^= true;
3402
+ objEditor.refreshContents();
29543403 return;
29553404 }
29563405 if (event.getSource() == speedupCB)
....@@ -2974,8 +3423,9 @@
29743423
29753424 public void actionPerformed(ActionEvent event)
29763425 {
3426
+ Object source = event.getSource();
29773427 // SCRIPT DIALOG
2978
- if (event.getSource() == okbutton)
3428
+ if (source == okbutton)
29793429 {
29803430 textpanel.setVisible(false);
29813431 textpanel.remove(textarea);
....@@ -2987,7 +3437,7 @@
29873437 textarea = null;
29883438 textpanel = null;
29893439 }
2990
- if (event.getSource() == cancelbutton)
3440
+ if (source == cancelbutton)
29913441 {
29923442 textpanel.setVisible(false);
29933443 textpanel.remove(textarea);
....@@ -2999,49 +3449,50 @@
29993449 //applySelf();
30003450 //client.refreshEditWindow();
30013451 //refreshContents();
3002
- if (event.getSource() == nameField)
3452
+ if (source == nameField)
30033453 {
30043454 //System.out.println("ObjEditor " + event);
30053455 applySelf0(true);
30063456 //parent.applySelf();
30073457 objEditor.refreshContents();
3008
- } else if (event.getSource() == resetButton)
3458
+ } else if (source == resetButton)
30093459 {
30103460 CameraPane.fullreset = true;
30113461 copy.Reset(); // ResetMeshes();
30123462 copy.Touch();
30133463 objEditor.refreshContents();
3014
- } else if (event.getSource() == stepItem)
3464
+ } else if (source == stepItem)
30153465 {
3016
- cameraView.ONESTEP = true;
3466
+ //cameraView.ONESTEP = true;
3467
+ Globals.ONESTEP = true;
30173468 cameraView.repaint();
30183469 return;
3019
- } else if (event.getSource() == stepButton)
3470
+ } else if (source == stepButton)
30203471 {
30213472 copy.Step();
30223473 copy.Touch();
30233474 objEditor.refreshContents();
3024
- } else if (event.getSource() == slowerButton)
3475
+ } else if (source == slowerButton)
30253476 {
30263477 copy.Slower();
30273478 copy.Touch();
30283479 objEditor.refreshContents();
3029
- } else if (event.getSource() == fasterButton)
3480
+ } else if (source == fasterButton)
30303481 {
30313482 copy.Faster();
30323483 copy.Touch();
30333484 objEditor.refreshContents();
3034
- } else if (event.getSource() == remarkButton)
3485
+ } else if (source == remarkButton)
30353486 {
30363487 copy.Remark();
30373488 copy.Touch();
30383489 objEditor.refreshContents();
3039
- } else if (event.getSource() == stepAllButton)
3490
+ } else if (source == stepAllButton)
30403491 {
30413492 copy.StepAll();
30423493 copy.Touch();
30433494 objEditor.refreshContents();
3044
- } else if (event.getSource() == resetAllButton)
3495
+ } else if (source == resetAllButton)
30453496 {
30463497 //CameraPane.fullreset = true;
30473498 copy.ResetAll(); // ResetMeshes();
....@@ -3074,53 +3525,79 @@
30743525 // Close();
30753526 // }
30763527 // else
3077
- if (event.getSource() == resetSlidersButton)
3528
+ if (source == resetSlidersButton)
30783529 {
30793530 ResetSliders();
3080
- } else if (event.getSource() == clearMaterialButton)
3531
+ } else if (source == clearMaterialButton)
30813532 {
30823533 ClearMaterial();
3083
- } else if (event.getSource() == createMaterialButton)
3534
+ } else if (source == createMaterialButton)
30843535 {
30853536 CreateMaterial();
3086
- } else if (event.getSource() == clearPanelButton)
3537
+ } else if (source == clearPanelButton)
30873538 {
30883539 copy.ClearUI();
30893540 refreshContents(true);
3090
- } /*
3091
- }
3092
-
3093
- public boolean action(Event event, Object arg)
3094
- {
3095
- */ else if (event.getSource() == closeItem)
3541
+ } else if (source == importGFDItem)
3542
+ {
3543
+ ImportGFD();
3544
+ } else
3545
+ if (source == importVRMLX3DItem)
3546
+ {
3547
+ ImportVRMLX3D();
3548
+ } else
3549
+ if (source == import3DSItem)
3550
+ {
3551
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3552
+ } else
3553
+ if (source == importOBJItem)
3554
+ {
3555
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3556
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3557
+ browser.setVisible(true);
3558
+ String filename = browser.getFile();
3559
+ if (filename != null && filename.length() > 0)
3560
+ {
3561
+ String fullname = browser.getDirectory() + filename;
3562
+ makeSomething(ReadOBJ(fullname), true);
3563
+ }
3564
+ } else
3565
+ if (source == closeItem)
30963566 {
30973567 Close();
30983568 //return true;
3099
- } else if (event.getSource() == loadItem)
3569
+ } else if (source == openItem)
31003570 {
3101
- load();
3571
+ Open();
31023572 //return true;
3103
- } else if (event.getSource() == saveItem)
3573
+ } else if (source == newItem)
3574
+ {
3575
+ New();
3576
+ } else if (source == saveItem)
31043577 {
31053578 save();
31063579 //return true;
3107
- } else if (event.getSource() == saveAsItem)
3580
+ } else if (source == saveAsItem)
31083581 {
31093582 saveAs();
31103583 //return true;
3111
- } else if (event.getSource() == reexportItem)
3584
+ } else if (source == reexportItem)
31123585 {
31133586 reexport();
31143587 //return true;
3115
- } else if (event.getSource() == exportAsItem)
3588
+ } else if (source == exportAsItem)
31163589 {
31173590 export();
31183591 //return true;
3119
- } else if (event.getSource() == povItem)
3592
+ } else if (source == povItem)
31203593 {
31213594 generatePOV();
31223595 //return true;
3123
- } else if (event.getSource() == zBufferItem)
3596
+ } else if (event.getSource() == archiveItem)
3597
+ {
3598
+ cTools.Archive(frame);
3599
+ return;
3600
+ } else if (source == zBufferItem)
31243601 {
31253602 try
31263603 {
....@@ -3142,21 +3619,8 @@
31423619 cameraView.repaint();
31433620 //return true;
31443621 }
3145
- */ else if (event.getSource() == editCameraItem)
3146
- {
3147
- cameraView.ProtectCamera();
3148
- cameraView.repaint();
3149
- return;
3150
- } else if (event.getSource() == revertCameraItem)
3151
- {
3152
- cameraView.RevertCamera();
3153
- cameraView.repaint();
3154
- return;
3155
- } else if (event.getSource() == textureButton)
3156
- {
3157
- return; // true;
3158
- } else // combos...
3159
- if (event.getSource() == texresMenu)
3622
+ */ else // combos...
3623
+ if (source == texresMenu)
31603624 {
31613625 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
31623626 copy.texres = texresMenu.getSelectedIndex();
....@@ -3168,27 +3632,487 @@
31683632 }
31693633 }
31703634
3171
- void ToggleAnimation()
3635
+ void New()
31723636 {
3173
- if (!CameraPane.ANIMATION)
3637
+ while (copy.Size() > 1)
31743638 {
3175
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3639
+ copy.remove(1);
3640
+ }
3641
+
3642
+ ResetModel();
3643
+ objEditor.refreshContents();
3644
+ }
3645
+
3646
+ static public byte[] Compress(Object3D o)
3647
+ {
3648
+ // Slower to actually compress.
3649
+ try
3650
+ {
3651
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3652
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3653
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
3654
+
3655
+ Object3D parent = o.parent;
3656
+ o.parent = null;
3657
+
3658
+ out.writeObject(o);
3659
+
3660
+ o.parent = parent;
3661
+
3662
+ out.flush();
3663
+
3664
+ baos //zstream
3665
+ .close();
3666
+ out.close();
3667
+
3668
+ byte[] bytes = baos.toByteArray();
3669
+
3670
+ System.out.println("save #bytes = " + bytes.length);
3671
+ return bytes;
3672
+ } catch (Exception e)
3673
+ {
3674
+ System.err.println(e);
3675
+ return null;
3676
+ }
3677
+ }
3678
+
3679
+ static public Object Uncompress(byte[] bytes)
3680
+ {
3681
+ System.out.println("restore #bytes = " + bytes.length);
3682
+ try
3683
+ {
3684
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3685
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3686
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
3687
+ Object obj = in.readObject();
3688
+
3689
+ bais //istream
3690
+ .close();
3691
+ in.close();
3692
+
3693
+ return obj;
3694
+ } catch (Exception e)
3695
+ {
3696
+ System.err.println(e);
3697
+ return null;
3698
+ }
3699
+ }
3700
+
3701
+ static public Object clone(Object o)
3702
+ {
3703
+ try
3704
+ {
3705
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3706
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3707
+
3708
+ out.writeObject(o);
3709
+
3710
+ out.flush();
3711
+ out.close();
3712
+
3713
+ byte[] bytes = baos.toByteArray();
3714
+
3715
+ System.out.println("clone = " + bytes.length);
3716
+
3717
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3718
+ ObjectInputStream in = new ObjectInputStream(bais);
3719
+ Object obj = in.readObject();
3720
+ in.close();
3721
+
3722
+ return obj;
3723
+ } catch (Exception e)
3724
+ {
3725
+ System.err.println(e);
3726
+ return null;
3727
+ }
3728
+ }
3729
+
3730
+ cRadio GetCurrentTab()
3731
+ {
3732
+ cRadio ab;
3733
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3734
+ {
3735
+ ab = (cRadio)e.nextElement();
3736
+ if(ab.GetObject() == copy)
3737
+ {
3738
+ return ab;
3739
+ }
3740
+ }
3741
+
3742
+ return null;
3743
+ }
3744
+
3745
+
3746
+ public void Save()
3747
+ {
3748
+ //Save(true);
3749
+ Replace();
3750
+ SetUndoStates();
3751
+ }
3752
+
3753
+ private boolean Equal(byte[] compress, byte[] name)
3754
+ {
3755
+ if (compress.length != name.length)
3756
+ {
3757
+ return false;
3758
+ }
3759
+
3760
+ for (int i=compress.length; --i>=0;)
3761
+ {
3762
+ if (compress[i] != name[i])
3763
+ return false;
3764
+ }
3765
+
3766
+ return true;
3767
+ }
3768
+
3769
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3770
+
3771
+ void DeleteVersion()
3772
+ {
3773
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
3774
+ {
3775
+ copy.versionlist[i] = copy.versionlist[i+1];
3776
+ }
3777
+
3778
+ CopyChanged();
3779
+
3780
+ SetUndoStates();
3781
+ }
3782
+
3783
+ public boolean Save(boolean user)
3784
+ {
3785
+ System.err.println("Save");
3786
+ //Replace();
3787
+
3788
+ cRadio tab = GetCurrentTab();
3789
+
3790
+ Object3D compress = CompressCopy(); // Saved version. No need for "Replace"?
3791
+
3792
+ boolean thesame = false;
3793
+
3794
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3795
+// {
3796
+// thesame = true;
3797
+// }
3798
+
3799
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3800
+ if (!thesame)
3801
+ {
3802
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
3803
+ {
3804
+ copy.versionlist[i] = copy.versionlist[i-1];
3805
+ }
3806
+
3807
+ //tab.user[tab.versionindex] = user;
3808
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3809
+
3810
+ copy.versionlist[++copy.versionindex] = compress;
3811
+
3812
+ // if (increment)
3813
+ // tab.versionindex++;
3814
+ }
3815
+
3816
+ //copy.RestoreBigData(versiontable);
3817
+
3818
+ //assert(hashtable.isEmpty());
3819
+
3820
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
3821
+// {
3822
+// //tab.user[i] = false;
3823
+// copy.versionlist[i] = null;
3824
+// }
3825
+
3826
+ SetUndoStates();
3827
+
3828
+ // test save
3829
+ if (false)
3830
+ {
3831
+ try
3832
+ {
3833
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
3834
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3835
+
3836
+ p.writeObject(copy);
3837
+
3838
+ p.flush();
3839
+
3840
+ ostream.close();
3841
+ } catch (Exception e)
3842
+ {
3843
+ e.printStackTrace();
3844
+ }
3845
+ }
3846
+
3847
+ return !thesame;
3848
+ }
3849
+
3850
+ boolean flashIt = true;
3851
+
3852
+ void RefreshSelection()
3853
+ {
3854
+ Object3D selection = new Object3D();
3855
+
3856
+ for (int i = 0; i < copy.selection.size(); i++)
3857
+ {
3858
+ Object3D elem = copy.selection.elementAt(i);
3859
+
3860
+ Object3D obj = copy.GetObject(elem.GetUUID());
3861
+
3862
+ if (obj == null)
3863
+ {
3864
+ copy.selection.remove(i--);
3865
+ }
3866
+ else
3867
+ {
3868
+ selection.add(obj);
3869
+ copy.selection.setElementAt(obj, i);
3870
+ }
3871
+ }
3872
+
3873
+ flashIt = false;
3874
+ GetTree().clearSelection();
3875
+ for (int i = 0; i < selection.size(); i++)
3876
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
3877
+ flashIt = true;
3878
+
3879
+ //refreshContents(false);
3880
+ }
3881
+
3882
+ void CopyChanged()
3883
+ {
3884
+ Object3D obj = copy.versionlist[copy.versionindex];
3885
+
3886
+ SetUndoStates();
3887
+
3888
+ boolean temp = CameraPane.SWITCH;
3889
+ CameraPane.SWITCH = false;
3890
+
3891
+ copy.ExtractBigData(versiontable);
3892
+
3893
+ copy.clear();
3894
+
3895
+ copy.skyboxname = obj.skyboxname;
3896
+ copy.skyboxext = obj.skyboxext;
3897
+
3898
+ for (int i=0; i<obj.Size(); i++)
3899
+ {
3900
+ copy.add(obj.get(i));
3901
+ }
3902
+
3903
+ copy.RestoreBigData(versiontable);
3904
+
3905
+ CameraPane.SWITCH = temp;
3906
+
3907
+ RefreshSelection();
3908
+ //assert(hashtable.isEmpty());
3909
+
3910
+ copy.Touch();
3911
+
3912
+ ResetModel();
3913
+ copy.HardTouch(); // recompile?
3914
+
3915
+ cRadio ab;
3916
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3917
+ {
3918
+ ab = (cRadio)e.nextElement();
3919
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3920
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3921
+ if (test != null)
3922
+ {
3923
+ test.editWindow = ab.object.editWindow;
3924
+ ab.object = test;
3925
+ }
3926
+ }
3927
+
3928
+ refreshContents(true);
3929
+ }
3930
+
3931
+ cButton previousVersionButton;
3932
+ cButton restoreButton;
3933
+ cButton replaceButton;
3934
+ cButton nextVersionButton;
3935
+ cButton saveVersionButton;
3936
+ cButton deleteVersionButton;
3937
+
3938
+ boolean muteSlider;
3939
+
3940
+ int VersionCount()
3941
+ {
3942
+ int count = 0;
3943
+
3944
+ for (int i = copy.versionlist.length; --i >= 0;)
3945
+ {
3946
+ if (copy.versionlist[i] != null)
3947
+ count++;
3948
+ }
3949
+
3950
+ return count;
3951
+ }
3952
+
3953
+ void SetUndoStates()
3954
+ {
3955
+ cRadio tab = GetCurrentTab();
3956
+
3957
+ restoreButton.setEnabled(true); // copy.versionindex != -1);
3958
+ replaceButton.setEnabled(true); // copy.versionindex != -1);
3959
+
3960
+ previousVersionButton.setEnabled(copy.versionindex > 0);
3961
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
3962
+
3963
+ deleteVersionButton.setEnabled(//copy.versionindex > 0 &&
3964
+ copy.versionlist[copy.versionindex + 1] != null);
3965
+
3966
+ muteSlider = true;
3967
+ versionSlider.setMaximum(VersionCount() - 1);
3968
+ versionSlider.setInteger(copy.versionindex);
3969
+ muteSlider = false;
3970
+ }
3971
+
3972
+ public boolean PreviousVersion()
3973
+ {
3974
+ // Option?
3975
+ Replace();
3976
+
3977
+ System.err.println("Undo");
3978
+
3979
+ cRadio tab = GetCurrentTab();
3980
+
3981
+ if (copy.versionindex == 0)
3982
+ {
3983
+ java.awt.Toolkit.getDefaultToolkit().beep();
3984
+ return false;
3985
+ }
3986
+
3987
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3988
+// {
3989
+// if (Save(false))
3990
+// tab.versionindex -= 1;
3991
+// else
3992
+// {
3993
+// if (tab.versionindex <= 0)
3994
+// return false;
3995
+// else
3996
+// tab.versionindex -= 1;
3997
+// }
3998
+// }
3999
+
4000
+ copy.versionindex -= 1;
4001
+
4002
+ CopyChanged();
4003
+
4004
+ return true;
4005
+ }
4006
+
4007
+ public boolean Restore()
4008
+ {
4009
+ System.err.println("Restore");
4010
+
4011
+ cRadio tab = GetCurrentTab();
4012
+
4013
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4014
+ {
4015
+ java.awt.Toolkit.getDefaultToolkit().beep();
4016
+ return false;
4017
+ }
4018
+
4019
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4020
+ CopyChanged();
4021
+
4022
+ return true;
4023
+ }
4024
+
4025
+ public boolean Replace()
4026
+ {
4027
+ System.err.println("Replace");
4028
+
4029
+ cRadio tab = GetCurrentTab();
4030
+
4031
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4032
+ {
4033
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
4034
+ return false;
4035
+ }
4036
+
4037
+ copy.versionlist[copy.versionindex] = CompressCopy();
4038
+
4039
+ return true;
4040
+ }
4041
+
4042
+ public void NextVersion()
4043
+ {
4044
+ // Option?
4045
+ Replace();
4046
+
4047
+ cRadio tab = GetCurrentTab();
4048
+
4049
+ if (copy.versionlist[copy.versionindex + 1] == null)
4050
+ {
4051
+ java.awt.Toolkit.getDefaultToolkit().beep();
4052
+ return;
4053
+ }
4054
+
4055
+ copy.versionindex += 1;
4056
+
4057
+ CopyChanged();
4058
+
4059
+ //if (!tab.user[tab.versionindex])
4060
+ // tab.graphs[tab.versionindex] = null;
4061
+ }
4062
+
4063
+ void ImportGFD()
4064
+ {
4065
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
31764066 browser.show();
31774067 String filename = browser.getFile();
31784068 if (filename != null && filename.length() > 0)
31794069 {
3180
- CameraPane.filename = browser.getDirectory() + filename;
4070
+ String fullname = browser.getDirectory() + filename;
4071
+
4072
+ //Object3D readobj =
4073
+ objEditor.ReadGFD(fullname, objEditor);
4074
+ //makeSomething(readobj);
4075
+ }
4076
+ }
4077
+
4078
+ void ImportVRMLX3D()
4079
+ {
4080
+ if (Grafreed.standAlone)
4081
+ {
4082
+ /**/
4083
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4084
+ browser.show();
4085
+ String filename = browser.getFile();
4086
+ if (filename != null && filename.length() > 0)
4087
+ {
4088
+ String fullname = browser.getDirectory() + filename;
4089
+ LoadVRMLX3D(fullname);
4090
+ }
4091
+ /**/
4092
+ }
4093
+ }
4094
+
4095
+ void ToggleAnimation()
4096
+ {
4097
+ if (!Globals.ANIMATION)
4098
+ {
4099
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
4100
+ browser.setVisible(true);
4101
+ String filename = browser.getFile();
4102
+ if (filename != null && filename.length() > 0)
4103
+ {
4104
+ Globals.filename = browser.getDirectory() + filename;
31814105 //CameraPane.framecount = 0;
3182
- CameraPane.imagecount = 0;
4106
+ Globals.imagecount = 0;
31834107
3184
- CameraPane.ANIMATION ^= true;
4108
+ Globals.ANIMATION ^= true;
31854109
3186
- GraphreeD.wav.cursor = 0;
3187
- GraphreeD.wav.loop = 0;
4110
+ Grafreed.wav.cursor = 0;
4111
+ Grafreed.wav.loop = 0;
31884112 }
31894113 } else
31904114 {
3191
- CameraPane.ANIMATION ^= true;
4115
+ Globals.ANIMATION ^= true;
31924116 }
31934117 }
31944118
....@@ -3234,7 +4158,7 @@
32344158 void CreateMaterial()
32354159 {
32364160 //copy.ClearMaterial(); // PATCH
3237
- copy.CreateMaterialS(multiplyToggle.isSelected());
4161
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
32384162 if (copy.selection.size() > 0)
32394163 //SetMaterial(copy);
32404164 {
....@@ -3285,7 +4209,7 @@
32854209 assert false;
32864210 }
32874211
3288
- void EditSelection()
4212
+ void EditSelection(boolean newWindow)
32894213 {
32904214 }
32914215
....@@ -3293,11 +4217,11 @@
32934217 {
32944218 copy.ResetBlockLoop(); // temporary problem
32954219
3296
- boolean random = CameraPane.RANDOM;
3297
- CameraPane.RANDOM = false; // parse everything
4220
+ boolean random = CameraPane.SWITCH;
4221
+ CameraPane.SWITCH = false; // parse everything
32984222 copy.ResetDisplayList();
32994223 copy.HardTouch();
3300
- CameraPane.RANDOM = random;
4224
+ CameraPane.SWITCH = random;
33014225 }
33024226
33034227 // public void applySelf()
....@@ -3344,7 +4268,7 @@
33444268 //copy.material = new cMaterial(copy.GetMaterial());
33454269
33464270 current.color = (float) colorField.getFloat();
3347
- current.modulation = (float) modulationField.getFloat();
4271
+ current.modulation = (float) saturationField.getFloat();
33484272 current.metalness = (float) metalnessField.getFloat();
33494273 current.diffuse = (float) diffuseField.getFloat();
33504274 current.specular = (float) specularField.getFloat();
....@@ -3367,10 +4291,40 @@
33674291 current.fakedepth = (float) fakedepthField.getFloat();
33684292 current.shadowbias = (float) shadowbiasField.getFloat();
33694293
3370
- if (!NumberSlider.frozen)
4294
+ if (!cNumberSlider.frozen)
33714295 {
33724296 //System.out.println("Propagate = " + propagate);
33734297 copy.UpdateMaterial(anchor, current, propagate);
4298
+
4299
+ if (copy.material != null)
4300
+ {
4301
+ cMaterial mat = copy.material;
4302
+
4303
+ colorField.SetToolTipValue((mat.color));
4304
+ saturationField.SetToolTipValue((mat.modulation));
4305
+ metalnessField.SetToolTipValue((mat.metalness));
4306
+ diffuseField.SetToolTipValue((mat.diffuse));
4307
+ specularField.SetToolTipValue((mat.specular));
4308
+ shininessField.SetToolTipValue((mat.shininess));
4309
+ shiftField.SetToolTipValue((mat.shift));
4310
+ ambientField.SetToolTipValue((mat.ambient));
4311
+ lightareaField.SetToolTipValue((mat.lightarea));
4312
+ diffusenessField.SetToolTipValue((mat.factor));
4313
+ velvetField.SetToolTipValue((mat.velvet));
4314
+ sheenField.SetToolTipValue((mat.sheen));
4315
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4316
+ backlitField.SetToolTipValue((mat.bump));
4317
+ anisoField.SetToolTipValue((mat.aniso));
4318
+ anisoVField.SetToolTipValue((mat.anisoV));
4319
+ cameraField.SetToolTipValue((mat.cameralight));
4320
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4321
+ shadowField.SetToolTipValue((mat.shadow));
4322
+ textureField.SetToolTipValue((mat.texture));
4323
+ opacityField.SetToolTipValue((mat.opacity));
4324
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4325
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4326
+ }
4327
+
33744328 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
33754329 {
33764330 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3399,9 +4353,26 @@
33994353 //copy.Touch();
34004354 }
34014355
4356
+ cNumberSlider versionSlider;
4357
+
34024358 public void stateChanged(ChangeEvent e)
34034359 {
34044360 // assert(false);
4361
+ if (e.getSource() == versionSlider)
4362
+ {
4363
+ if (muteSlider)
4364
+ return;
4365
+
4366
+ int version = versionSlider.getInteger();
4367
+
4368
+ if (copy.versionlist[version] != null)
4369
+ {
4370
+ copy.versionindex = version;
4371
+ CopyChanged();
4372
+ }
4373
+
4374
+ return;
4375
+ }
34054376
34064377 if (freezematerial)
34074378 {
....@@ -3415,6 +4386,7 @@
34154386 || e.getSource() == apertureField
34164387 || e.getSource() == shadowblurField)
34174388 {
4389
+ new Exception().printStackTrace();
34184390 System.exit(0);
34194391 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34204392 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3436,12 +4408,24 @@
34364408 {
34374409 //System.out.println("stateChanged = " + this);
34384410 materialtouched = true;
4411
+
4412
+ if (e.getSource() == colorField && saturationField.getFloat() == 0.001)
4413
+ {
4414
+ saturationField.setFloat(1);
4415
+ }
4416
+
34394417 applySelf();
34404418 //System.out.println("this = " + this);
34414419 //System.out.println("PARENT = " + parent);
34424420 //if (parent != null)
34434421 // parent.applySelf();
3444
- refreshContents();
4422
+ if (e.getSource() == normalpushField)
4423
+ {
4424
+ objEditor.refreshContents();
4425
+ //Refresh();
4426
+ }
4427
+ else
4428
+ refreshContents();
34454429 // ??? client.refreshEditWindow();
34464430 }
34474431 //else
....@@ -3453,7 +4437,7 @@
34534437 //group.name = nameField.getText();
34544438 //objEditor.applySelf();
34554439
3456
- assert (objEditor == this);
4440
+ // OCT2018: assert (objEditor == this);
34574441 if (copy.selection == null || copy.selection.size() == 0)
34584442 //super.applySelf()
34594443 ; else
....@@ -3477,12 +4461,18 @@
34774461 objEditor.copy = keep;
34784462 }
34794463 }
4464
+
4465
+ if (normalpushField != null)
4466
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
34804467 }
34814468
34824469 void SnapObject()
34834470 {
3484
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3485
- SnapObject(obj);
4471
+ if (copy.selection.size() > 0)
4472
+ {
4473
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
4474
+ SnapObject(obj);
4475
+ }
34864476 }
34874477
34884478 void SnapObject(Object3D obj)
....@@ -3596,7 +4586,7 @@
35964586
35974587 if (obj.parent != null)
35984588 {
3599
- obj.parent.TransformToWorld(interest);
4589
+// obj.parent.TransformToWorld(interest);
36004590 }
36014591
36024592 if (!CameraPane.TRACK)
....@@ -3723,20 +4713,26 @@
37234713 {
37244714 if (GetTree() != null)
37254715 {
4716
+ GetTree().revalidate();
37264717 GetTree().repaint();
37274718 }
37284719
37294720 radioPanel.revalidate();
37304721 radioPanel.repaint();
3731
- ctrlPanel.revalidate(); // ? new
4722
+ ctrlPanel.validate(); // ? new
37324723 ctrlPanel.repaint();
37334724 }
4725
+
4726
+ if (previousVersionButton != null && copy.versionlist != null)
4727
+ SetUndoStates();
37344728 }
37354729
37364730 static TweenManager tweenManager = new TweenManager();
37374731
37384732 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
37394733 {
4734
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4735
+ Save();
37404736 //Tween.set(thing, 0).target(1).start(tweenManager);
37414737 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
37424738 // if (thing instanceof GenericJointDemo)
....@@ -3823,6 +4819,12 @@
38234819 {
38244820 ResetModel();
38254821 Select(thing.GetTreePath(), true, false); // unselect... false);
4822
+
4823
+ if (thing.Size() == 0)
4824
+ {
4825
+ //EditSelection(false);
4826
+ }
4827
+
38264828 refreshContents();
38274829 }
38284830
....@@ -3940,6 +4942,7 @@
39404942 }
39414943 }
39424944 }
4945
+
39434946 LoadGFDThread loadGFDThread;
39444947
39454948 void ReadGFD(String fullname, iCallBack cb)
....@@ -3959,8 +4962,10 @@
39594962
39604963 try
39614964 {
4965
+ // Try compressed version first.
39624966 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
3963
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4967
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4968
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
39644969
39654970 readobj = (Object3D) p.readObject();
39664971 istream.close();
....@@ -3968,7 +4973,22 @@
39684973 readobj.ResetDisplayList();
39694974 } catch (Exception e)
39704975 {
3971
- e.printStackTrace();
4976
+ if (!e.toString().contains("GZIP"))
4977
+ e.printStackTrace();
4978
+
4979
+ try
4980
+ {
4981
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4982
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4983
+
4984
+ readobj = (Object3D) p.readObject();
4985
+ istream.close();
4986
+
4987
+ readobj.ResetDisplayList();
4988
+ } catch (Exception e2)
4989
+ {
4990
+ e2.printStackTrace();
4991
+ }
39724992 }
39734993 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
39744994 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4014,6 +5034,12 @@
40145034
40155035 void LoadIt(Object obj)
40165036 {
5037
+ if (obj == null)
5038
+ {
5039
+ // Invalid file
5040
+ return;
5041
+ }
5042
+
40175043 System.out.println("Loaded " + obj);
40185044 //new Exception().printStackTrace();
40195045 Object3D readobj = (Object3D) obj;
....@@ -4023,10 +5049,14 @@
40235049
40245050 if (readobj != null)
40255051 {
5052
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
5053
+ // Save();
40265054 try
40275055 {
40285056 //readobj.deepCopySelf(copy);
40295057 copy.clear(); // june 2014
5058
+ copy.skyboxname = readobj.skyboxname;
5059
+ copy.skyboxext = readobj.skyboxext;
40305060 for (int i = 0; i < readobj.size(); i++)
40315061 {
40325062 Object3D child = readobj.get(i); // reserve(i);
....@@ -4067,6 +5097,7 @@
40675097 }
40685098 } catch (ClassCastException e)
40695099 {
5100
+ e.printStackTrace();
40705101 assert (false);
40715102 Composite c = (Composite) copy;
40725103 c.children.clear();
....@@ -4077,17 +5108,28 @@
40775108 c.addChild(csg);
40785109 }
40795110
5111
+ copy.versionlist = readobj.versionlist;
5112
+ copy.versionindex = readobj.versionindex;
5113
+
5114
+ if (copy.versionlist == null)
5115
+ {
5116
+ copy.versionlist = new Object3D[100];
5117
+ copy.versionindex = -1;
5118
+ }
5119
+
5120
+ //? SetUndoStates();
5121
+
40805122 ResetModel();
40815123 copy.HardTouch(); // recompile?
40825124 refreshContents();
40835125 }
40845126 }
40855127
4086
- void load() // throws ClassNotFoundException
5128
+ void Open() // throws ClassNotFoundException
40875129 {
4088
- if (GraphreeD.standAlone)
5130
+ if (Grafreed.standAlone)
40895131 {
4090
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5132
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
40915133 browser.show();
40925134 String filename = browser.getFile();
40935135 if (filename != null && filename.length() > 0)
....@@ -4172,11 +5214,13 @@
41725214 try
41735215 {
41745216 FileOutputStream ostream = new FileOutputStream(lastname);
4175
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5217
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5218
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
41765219
41775220 p.writeObject(copy);
41785221 p.flush();
41795222
5223
+ zstream.close();
41805224 ostream.close();
41815225
41825226 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4184,19 +5228,23 @@
41845228 //ps.print(buffer.toString());
41855229 } catch (IOException e)
41865230 {
5231
+ e.printStackTrace();
41875232 }
41885233 }
5234
+
41895235 String lastname;
41905236
41915237 void saveAs()
41925238 {
4193
- if (GraphreeD.standAlone)
5239
+ if (Grafreed.standAlone)
41945240 {
41955241 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
41965242 browser.setVisible(true);
41975243 String filename = browser.getFile();
41985244 if (filename != null && filename.length() > 0)
41995245 {
5246
+ if (!filename.endsWith(".gfd"))
5247
+ filename += ".gfd";
42005248 lastname = browser.getDirectory() + filename;
42015249 save();
42025250 }
....@@ -4213,10 +5261,20 @@
42135261
42145262 Object3D object = copy.selection.get(0);
42155263
5264
+ FileObject fileobj = null;
5265
+
5266
+ if (object instanceof FileObject)
5267
+ fileobj = (FileObject)object;
5268
+
42165269 if (object.fileparent != null)
42175270 {
4218
- FileObject fileobj = (FileObject) object.fileparent;
5271
+ assert(fileobj == null);
42195272
5273
+ fileobj = (FileObject) object.fileparent;
5274
+ }
5275
+
5276
+ if (fileobj != null)
5277
+ {
42205278 System.out.println("WriteObject " + object + " : " + fileobj.name);
42215279 WriteObject(object, fileobj.name);
42225280 }
....@@ -4259,7 +5317,7 @@
42595317 }
42605318 }
42615319 else
4262
- //if (GraphreeD.standAlone)
5320
+ //if (GrafreeD.standAlone)
42635321 {
42645322 FileDialog browser = new FileDialog(frame, "Export", FileDialog.SAVE);
42655323 browser.setVisible(true);
....@@ -4285,13 +5343,13 @@
42855343 try
42865344 {
42875345 FileOutputStream ostream = new FileOutputStream(filename);
4288
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4289
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5346
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5347
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42905348
42915349 Object3D objectparent = obj.parent;
42925350 obj.parent = null;
42935351
4294
- Object3D object = (Object3D) GraphreeD.clone(obj);
5352
+ Object3D object = (Object3D) Grafreed.clone(obj);
42955353
42965354 obj.parent = objectparent;
42975355
....@@ -4303,8 +5361,8 @@
43035361 p.writeObject(object);
43045362 p.flush();
43055363
5364
+ zstream.close();
43065365 ostream.close();
4307
- // zstream.close();
43085366
43095367 // group.selection.get(0).parent = parent;
43105368 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4325,7 +5383,7 @@
43255383 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43265384 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43275385 copy.generatePOV(buffer);
4328
- if (GraphreeD.standAlone)
5386
+ if (Grafreed.standAlone)
43295387 {
43305388 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43315389 browser.show();
....@@ -4351,53 +5409,70 @@
43515409 Object3D client;
43525410 Object3D copy;
43535411 MenuBar menuBar;
4354
- Menu windowMenu;
4355
- MenuItem loadItem;
5412
+ Menu fileMenu;
5413
+ MenuItem newItem;
5414
+ MenuItem openItem;
43565415 MenuItem saveItem;
43575416 MenuItem saveAsItem;
43585417 MenuItem exportAsItem;
43595418 MenuItem reexportItem;
43605419 MenuItem povItem;
43615420 MenuItem closeItem;
4362
- Menu cameraMenu;
5421
+
43635422 CheckboxMenuItem zBufferItem;
43645423 //MenuItem normalLensItem;
4365
- MenuItem editCameraItem;
4366
- MenuItem revertCameraItem;
4367
- CheckboxMenuItem toggleLiveItem;
43685424 MenuItem stepItem;
4369
- CheckboxMenuItem toggleFullItem;
5425
+ CheckboxMenuItem toggleLiveItem;
5426
+ CheckboxMenuItem toggleFullScreenItem;
5427
+ CheckboxMenuItem toggleTimelineItem;
43705428 CheckboxMenuItem toggleRenderItem;
43715429 CheckboxMenuItem toggleDebugItem;
43725430 CheckboxMenuItem toggleFrustumItem;
43735431 CheckboxMenuItem toggleFootContactItem;
43745432 CheckboxMenuItem toggleDLItem;
43755433 CheckboxMenuItem toggleTextureItem;
4376
- CheckboxMenuItem toggleRandomItem;
5434
+ CheckboxMenuItem toggleSwitchItem;
43775435 CheckboxMenuItem toggleRootItem;
43785436 CheckboxMenuItem animationItem;
5437
+ MenuItem archiveItem;
43795438 CheckboxMenuItem toggleHandleItem;
43805439 CheckboxMenuItem togglePaintItem;
43815440 JSplitPane mainPanel;
43825441 JScrollPane scrollpane;
5442
+
43835443 JPanel toolbarPanel;
4384
- JPanel treePanel;
5444
+
5445
+ cGridBag treePanel;
5446
+
43855447 JPanel radioPanel;
43865448 ButtonGroup buttonGroup;
4387
- JPanel ctrlPanel;
4388
- JPanel materialPanel;
5449
+
5450
+ cGridBag toolboxPanel;
5451
+ cGridBag materialPanel;
5452
+ cGridBag ctrlPanel;
5453
+
43895454 JScrollPane infoPanel;
4390
- JPanel optionsPanel;
5455
+
5456
+ cGridBag optionsPanel;
5457
+
43915458 JTabbedPane objectPanel;
4392
- JPanel XYZPanel;
5459
+ boolean materialFlushed;
5460
+ Object3D latestObject;
5461
+
5462
+ cGridBag XYZPanel;
5463
+
43935464 JSplitPane gridPanel;
43945465 JSplitPane bigPanel;
4395
- JPanel bigThree;
4396
- JTabbedPane jtp;
4397
- JPanel cameraPanel;
5466
+
5467
+ cGridBag bigThree;
5468
+ cGridBag scenePanel;
5469
+ cGridBag centralPanel;
5470
+ JSplitPane cameraPanel;
5471
+ JPanel timelinePanel;
5472
+ JMenuBar timelineMenubar;
43985473 JSplitPane framePanel;
43995474 JTextArea/*Field*/ nameField;
4400
- cButton textureButton;
5475
+ //cButton textureButton;
44015476 cButton okButton;
44025477 cButton applyButton;
44035478 cButton cancelButton;
....@@ -4444,65 +5519,72 @@
44445519 // MATERIAL
44455520 JLabel materialLabel;
44465521 JLabel colorLabel;
4447
- NumberSlider colorField;
5522
+ cNumberSlider colorField;
44485523 JLabel modulationLabel;
4449
- NumberSlider modulationField;
5524
+ cNumberSlider saturationField;
44505525 JLabel metalnessLabel;
4451
- NumberSlider metalnessField;
5526
+ cNumberSlider metalnessField;
44525527 JLabel diffuseLabel;
4453
- NumberSlider diffuseField;
5528
+ cNumberSlider diffuseField;
44545529 JLabel specularLabel;
4455
- NumberSlider specularField;
5530
+ cNumberSlider specularField;
44565531 JLabel shininessLabel;
4457
- NumberSlider shininessField;
5532
+ cNumberSlider shininessField;
44585533 JLabel shiftLabel;
4459
- NumberSlider shiftField;
5534
+ cNumberSlider shiftField;
44605535 JLabel ambientLabel;
4461
- NumberSlider ambientField;
5536
+ cNumberSlider ambientField;
44625537 JLabel lightareaLabel;
4463
- NumberSlider lightareaField;
5538
+ cNumberSlider lightareaField;
44645539 JLabel diffusenessLabel;
4465
- NumberSlider diffusenessField;
5540
+ cNumberSlider diffusenessField;
44665541 JLabel velvetLabel;
4467
- NumberSlider velvetField;
5542
+ cNumberSlider velvetField;
44685543 JLabel sheenLabel;
4469
- NumberSlider sheenField;
5544
+ cNumberSlider sheenField;
44705545 JLabel subsurfaceLabel;
4471
- NumberSlider subsurfaceField;
5546
+ cNumberSlider subsurfaceField;
44725547 //JLabel bumpLabel;
44735548 //NumberSlider bumpField;
44745549 JLabel backlitLabel;
4475
- NumberSlider backlitField;
5550
+ cNumberSlider backlitField;
44765551 JLabel anisoLabel;
4477
- NumberSlider anisoField;
5552
+ cNumberSlider anisoField;
44785553 JLabel anisoVLabel;
4479
- NumberSlider anisoVField;
5554
+ cNumberSlider anisoVField;
44805555 JLabel cameraLabel;
4481
- NumberSlider cameraField;
5556
+ cNumberSlider cameraField;
44825557 JLabel selfshadowLabel;
4483
- NumberSlider selfshadowField;
5558
+ cNumberSlider selfshadowField;
44845559 JLabel shadowLabel;
4485
- NumberSlider shadowField;
5560
+ cNumberSlider shadowField;
44865561 JLabel textureLabel;
4487
- NumberSlider textureField;
5562
+ cNumberSlider textureField;
44885563 JLabel opacityLabel;
4489
- NumberSlider opacityField;
5564
+ cNumberSlider opacityField;
44905565 JLabel fakedepthLabel;
4491
- NumberSlider fakedepthField;
5566
+ cNumberSlider fakedepthField;
44925567 JLabel shadowbiasLabel;
4493
- NumberSlider shadowbiasField;
5568
+ cNumberSlider shadowbiasField;
44945569 JLabel bumpLabel;
4495
- NumberSlider bumpField;
5570
+ cNumberSlider bumpField;
44965571 JLabel noiseLabel;
4497
- NumberSlider noiseField;
5572
+ cNumberSlider noiseField;
44985573 JLabel powerLabel;
4499
- NumberSlider powerField;
5574
+ cNumberSlider powerField;
45005575 JLabel borderfadeLabel;
4501
- NumberSlider borderfadeField;
5576
+ cNumberSlider borderfadeField;
45025577 JLabel fogLabel;
4503
- NumberSlider fogField;
5578
+ cNumberSlider fogField;
45045579 JLabel opacityPowerLabel;
4505
- NumberSlider opacityPowerField;
4506
- JTree jTree;
5580
+ cNumberSlider opacityPowerField;
5581
+ cTree jTree;
45075582 //ObjectUI parent;
5583
+
5584
+ cNumberSlider normalpushField;
5585
+
5586
+ private MenuItem importGFDItem;
5587
+ private MenuItem importVRMLX3DItem;
5588
+ private MenuItem import3DSItem;
5589
+ private MenuItem importOBJItem;
45085590 }