Normand Briere
2019-08-13 c67de8aca04d988179191ccb52461af00125920e
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,9 +34,88 @@
2834 iSendInfo
2935 //KeyListener
3036 {
37
+ public cToggleButton pinButton;
3138 boolean timeline;
3239 boolean wasFullScreen;
3340
41
+ GroupEditor callee;
42
+ JFrame frame;
43
+
44
+ static ObjEditor theFrame;
45
+
46
+ public cGridBag GetSeparator()
47
+ {
48
+ cGridBag separator = new cGridBag();
49
+ separator.add(new JSeparator());
50
+ separator.preferredHeight = 5;
51
+ return separator;
52
+ }
53
+
54
+ cButton GetButton(String name, boolean border)
55
+ {
56
+ ImageIcon icon = GetIcon(name);
57
+ return new cButton(icon, border);
58
+ }
59
+
60
+ cLabel GetLabel(String name, boolean border)
61
+ {
62
+ //ImageIcon icon = GetIcon(name);
63
+ return new cLabel(GetImage(name), border);
64
+ }
65
+
66
+ cToggleButton GetToggleButton(String name, boolean border)
67
+ {
68
+ ImageIcon icon = GetIcon(name);
69
+ return new cToggleButton(icon, border);
70
+ }
71
+
72
+ cCheckBox GetCheckBox(String name, boolean border)
73
+ {
74
+ ImageIcon icon = GetIcon(name);
75
+ return new cCheckBox(icon, border);
76
+ }
77
+
78
+ ImageIcon GetIcon(String name)
79
+ {
80
+ try
81
+ {
82
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
83
+
84
+// if (image.getWidth() > 48 && image.getHeight() > 48)
85
+// {
86
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
87
+// Graphics2D g = resized.createGraphics();
88
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
89
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
90
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
91
+// g.dispose();
92
+//
93
+// image = resized;
94
+// }
95
+
96
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
97
+ return icon;
98
+ }
99
+ catch (Exception e)
100
+ {
101
+ return null;
102
+ }
103
+ }
104
+
105
+ BufferedImage GetImage(String name)
106
+ {
107
+ try
108
+ {
109
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
110
+
111
+ return image;
112
+ }
113
+ catch (Exception e)
114
+ {
115
+ return null;
116
+ }
117
+ }
118
+
34119 // SCRIPT
35120
36121 transient JFrame textpanel = null;
....@@ -121,47 +206,54 @@
121206 void keyPressed(int key, int modifiers)
122207 {
123208 System.out.println("KEY PRESSED");
124
- CameraPane.theRenderer.keyPressed(key, modifiers);
209
+ Globals.theRenderer.keyPressed(key, modifiers);
125210 }
126211 */
127212
128213 static GridBagConstraints aConstraints;
129214 static GridBagConstraints aWindowConstraints;
130
- GroupEditor callee;
131
- JFrame frame;
215
+
132216 static int GRIDWIDTH = 100; // 4;
133217
134218 public void closeUI()
135219 {
136220 //new Exception().printStackTrace();
137
- System.out.println("this = " + this);
138
- System.out.println("objEditor = " + objEditor);
221
+// System.out.println("this = " + this);
222
+// System.out.println("objEditor = " + objEditor);
139223 //nameField.removeActionListener(this);
140
- objEditor.ctrlPanel.remove(nameField);
224
+// objEditor.ctrlPanel.remove(nameField);
141225
142
- if (!GroupEditor.allparams)
226
+ objEditor.ctrlPanel.remove(namePanel);
227
+
228
+ if (!allparams)
143229 return;
144230
145
- objEditor.ctrlPanel.remove(liveCB);
146
- objEditor.ctrlPanel.remove(hideCB);
147
- objEditor.ctrlPanel.remove(markCB);
148
-
149
- objEditor.ctrlPanel.remove(randomCB);
150
- objEditor.ctrlPanel.remove(speedupCB);
151
- objEditor.ctrlPanel.remove(rewindCB);
152
-
153
- objEditor.ctrlPanel.remove(resetButton);
154
- objEditor.ctrlPanel.remove(stepButton);
155
-// objEditor.ctrlPanel.remove(stepAllButton);
156
-// objEditor.ctrlPanel.remove(resetAllButton);
157
- objEditor.ctrlPanel.remove(link2masterCB);
158
- //objEditor.ctrlPanel.remove(flipVCB);
159
- //objEditor.ctrlPanel.remove(texresMenu);
160
- objEditor.ctrlPanel.remove(slowerButton);
161
- objEditor.ctrlPanel.remove(fasterButton);
162
- objEditor.ctrlPanel.remove(remarkButton);
231
+// objEditor.ctrlPanel.remove(liveCB);
232
+// objEditor.ctrlPanel.remove(hideCB);
233
+// objEditor.ctrlPanel.remove(markCB);
234
+//
235
+// objEditor.ctrlPanel.remove(randomCB);
236
+// objEditor.ctrlPanel.remove(speedupCB);
237
+// objEditor.ctrlPanel.remove(rewindCB);
238
+//
239
+// objEditor.ctrlPanel.remove(resetButton);
240
+// objEditor.ctrlPanel.remove(stepButton);
241
+//// objEditor.ctrlPanel.remove(stepAllButton);
242
+//// objEditor.ctrlPanel.remove(resetAllButton);
243
+// objEditor.ctrlPanel.remove(link2masterCB);
244
+// //objEditor.ctrlPanel.remove(flipVCB);
245
+// //objEditor.ctrlPanel.remove(texresMenu);
246
+// objEditor.ctrlPanel.remove(slowerButton);
247
+// objEditor.ctrlPanel.remove(fasterButton);
248
+// objEditor.ctrlPanel.remove(remarkButton);
163249
164
- Remove(normalpushField);
250
+ objEditor.ctrlPanel.remove(setupPanel);
251
+ objEditor.ctrlPanel.remove(setupPanel2);
252
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
253
+ objEditor.ctrlPanel.remove(pushPanel);
254
+ //objEditor.ctrlPanel.remove(fillPanel);
255
+
256
+ //Remove(normalpushField);
165257 }
166258
167259 public ObjEditor GetEditor()
....@@ -205,6 +297,14 @@
205297 client = inClient;
206298 copy = client;
207299
300
+// if (copy.versionlist == null)
301
+// {
302
+// copy.versionlist = new Object3D[100];
303
+// copy.versionindex = -1;
304
+//
305
+// callee.Save(true);
306
+// }
307
+
208308 // "this" is not called: SetupUI2(objEditor);
209309 }
210310
....@@ -218,6 +318,14 @@
218318 client = inClient;
219319 copy = client;
220320
321
+ if (copy.versionlist == null)
322
+ {
323
+ copy.versionlist = new Object3D[100];
324
+ copy.versionindex = -1;
325
+
326
+// Save(true);
327
+ }
328
+
221329 SetupUI2(callee.GetEditor());
222330 }
223331
....@@ -232,6 +340,7 @@
232340 //localCopy.parent = null;
233341
234342 frame = new JFrame();
343
+ frame.setUndecorated(false);
235344 objEditor = this;
236345 this.callee = callee;
237346
....@@ -249,6 +358,14 @@
249358 copy = localCopy;
250359 copy.editWindow = this;
251360
361
+// if (copy.versionlist == null)
362
+// {
363
+// copy.versionlist = new Object3D[100];
364
+// copy.versionindex = -1;
365
+//
366
+// Save(true);
367
+// }
368
+
252369 SetupMenu();
253370
254371 //SetupName(objEditor); // new
....@@ -262,28 +379,49 @@
262379 return frame.action(event, obj);
263380 }
264381
382
+ // Cannot work without static
383
+ static boolean allparams = true;
384
+
385
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
386
+
265387 void SetupMenu()
266388 {
267389 frame.setMenuBar(menuBar = new MenuBar());
268
- menuBar.add(windowMenu = new Menu("File"));
269
- windowMenu.add(loadItem = new MenuItem("Load..."));
270
- windowMenu.add("-");
271
- windowMenu.add(saveItem = new MenuItem("Save"));
272
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
390
+ menuBar.add(fileMenu = new Menu("File"));
391
+ fileMenu.add(newItem = new MenuItem("New"));
392
+ fileMenu.add(openItem = new MenuItem("Open..."));
393
+
394
+ //oe.menuBar.add(menu = new Menu("Include"));
395
+ Menu menu = new Menu("Import");
396
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
397
+ importOBJItem.addActionListener(this);
398
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
399
+ import3DSItem.addActionListener(this);
400
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
401
+ importVRMLX3DItem.addActionListener(this);
402
+ menu.add("-");
403
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
404
+ importGFDItem.addActionListener(this);
405
+ fileMenu.add(menu);
406
+ fileMenu.add("-");
407
+
408
+ fileMenu.add(saveItem = new MenuItem("Save"));
409
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
273410 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
274
- windowMenu.add("-");
275
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
276
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
277
- windowMenu.add("-");
411
+ fileMenu.add("-");
412
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
413
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
414
+ fileMenu.add("-");
278415 if (client.parent != null)
279416 {
280
- windowMenu.add(closeItem = new MenuItem("Close"));
417
+ fileMenu.add(closeItem = new MenuItem("Close"));
281418 } else
282419 {
283
- windowMenu.add(closeItem = new MenuItem("Exit"));
420
+ fileMenu.add(closeItem = new MenuItem("Exit"));
284421 }
285422
286
- loadItem.addActionListener(this);
423
+ newItem.addActionListener(this);
424
+ openItem.addActionListener(this);
287425 saveItem.addActionListener(this);
288426 saveAsItem.addActionListener(this);
289427 exportAsItem.addActionListener(this);
....@@ -291,82 +429,102 @@
291429 //povItem.addActionListener(this);
292430 closeItem.addActionListener(this);
293431
294
- menuBar.add(cameraMenu = new Menu("View"));
295
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
296
- //zBufferItem.addActionListener(this);
297
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
298
- //normalLensItem.addActionListener(this);
299
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
300
- revertCameraItem.addActionListener(this);
301
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
302
- toggleTimelineItem.addItemListener(this);
303
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
304
- toggleFullScreenItem.addItemListener(this);
305
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
306
- cameraMenu.add("-");
307
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
308
- toggleTextureItem.addItemListener(this);
309
- toggleTextureItem.setState(CameraPane.textureon);
310
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
311
- toggleLiveItem.addItemListener(this);
312
- toggleLiveItem.setState(CameraPane.isLIVE());
313
- cameraMenu.add(stepItem = new MenuItem("Step"));
314
- stepItem.addActionListener(this);
315
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
316
-// toggleDLItem.addItemListener(this);
317
-// toggleDLItem.setState(false);
318
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
319
- toggleRenderItem.addItemListener(this);
320
- toggleRenderItem.setState(!CameraPane.frozen);
321
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
322
- toggleDebugItem.addItemListener(this);
323
- toggleDebugItem.setState(CameraPane.DEBUG);
324
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
325
- toggleFrustumItem.addItemListener(this);
326
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
327
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
328
- toggleFootContactItem.addItemListener(this);
329
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
330
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
331
- toggleRandomItem.addItemListener(this);
332
- toggleRandomItem.setState(CameraPane.RANDOM);
333
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
334
- toggleHandleItem.addItemListener(this);
335
- toggleHandleItem.setState(CameraPane.HANDLES);
336
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
337
- togglePaintItem.addItemListener(this);
338
- togglePaintItem.setState(CameraPane.PAINTMODE);
339
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
340
-// toggleRootItem.addItemListener(this);
341
-// toggleRootItem.setState(false);
342
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
343
-// animationItem.addItemListener(this);
344
-// animationItem.setState(CameraPane.ANIMATION);
345
- cameraMenu.add("-");
346
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
347
- editCameraItem.addActionListener(this);
348
-
349432 objectPanel = new JTabbedPane();
433
+
434
+ ChangeListener changeListener = new ChangeListener()
435
+ {
436
+ String name;
437
+
438
+ public void stateChanged(ChangeEvent changeEvent)
439
+ {
440
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
441
+// {
442
+// if (latestObject != null)
443
+// {
444
+// refreshContents(true);
445
+// SetMaterial(latestObject);
446
+// }
447
+//
448
+// materialFlushed = true;
449
+// }
450
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
451
+// {
452
+// if (listUI.size() == 0)
453
+// EditSelection(false);
454
+// }
455
+
456
+ if (objectPanel.getSelectedIndex() == 4)
457
+ {
458
+ name = copy.skyboxname;
459
+
460
+ if (name == null)
461
+ {
462
+ name = "";
463
+ }
464
+
465
+ copy.skyboxname = "cubemaps/default-skyboxes/rgb";
466
+ copy.skyboxext = "jpg";
467
+ }
468
+ else
469
+ {
470
+ if (name != null)
471
+ {
472
+ if (name.equals(""))
473
+ {
474
+ copy.skyboxname = null;
475
+ copy.skyboxext = null;
476
+ }
477
+ else
478
+ {
479
+ copy.skyboxname = name;
480
+ }
481
+ }
482
+ }
483
+
484
+// refreshContents(false); // To refresh Info tab
485
+ cameraView.repaint();
486
+ }
487
+ };
488
+ objectPanel.addChangeListener(changeListener);
489
+
350490 toolbarPanel = new JPanel();
351491 toolbarPanel.setName("Toolbar");
352
- treePanel = new JPanel();
492
+
493
+ treePanel = new cGridBag();
353494 treePanel.setName("Tree");
354
- ctrlPanel = new JPanel(); // new GridBagLayout());
355
- ctrlPanel.setName("Edit");
356
- materialPanel = new JPanel();
357
- materialPanel.setName("Material");
495
+
496
+ editPanel = new cGridBag().setVertical(true);
497
+ //editPanel.setName("Edit");
498
+
499
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
500
+
501
+ editCommandsPanel = new cGridBag();
502
+ editPanel.add(editCommandsPanel);
503
+ editPanel.add(ctrlPanel);
504
+
505
+ toolboxPanel = new cGridBag().setVertical(true);
506
+ //toolboxPanel.setName("Toolbox");
507
+
508
+ skyboxPanel = new cGridBag().setVertical(true);
509
+
510
+ materialPanel = new cGridBag().setVertical(false);
511
+ //materialPanel.setName("Material");
512
+
358513 /*JTextPane*/
359514 infoarea = createTextPane();
515
+ doc = infoarea.getStyledDocument();
516
+
360517 infoarea.setEditable(true);
361518 SetText();
519
+
362520 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
363521 // infoarea.setOpaque(false);
364522 // //infoarea.setForeground(textcolor);
365
- infoarea.setLineWrap(true);
366
- infoarea.setWrapStyleWord(true);
523
+// TEXTAREA infoarea.setLineWrap(true);
524
+// TEXTAREA infoarea.setWrapStyleWord(true);
367525 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
368
- infoPanel.setPreferredSize(new Dimension(50, 200));
369
- infoPanel.setName("Info");
526
+ infoPanel.setPreferredSize(new Dimension(1, 1));
527
+ //infoPanel.setName("Info");
370528 //infoPanel.setLayout(new BorderLayout());
371529 //infoPanel.add(createTextPane());
372530
....@@ -374,16 +532,23 @@
374532 mainPanel.setName("Main");
375533 mainPanel.setContinuousLayout(true);
376534 mainPanel.setOneTouchExpandable(true);
377
- mainPanel.setDividerLocation(1.0);
378535 mainPanel.setDividerSize(9);
379
- mainPanel.setResizeWeight(0);
380
-
536
+ mainPanel.setDividerLocation(0.5); //1.0);
537
+ mainPanel.setResizeWeight(0.5);
538
+
539
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
540
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
541
+ divider.setDividerSize(15);
542
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
543
+
544
+ mainPanel.setUI(new BasicSplitPaneUI());
545
+
381546 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
382547 //mainPanel.setLayout(new GridBagLayout());
383548 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
384
- treePanel.setLayout(new GridBagLayout());
385
- ctrlPanel.setLayout(new GridBagLayout());
386
- materialPanel.setLayout(new GridBagLayout());
549
+// treePanel.setLayout(new GridBagLayout());
550
+ //ctrlPanel.setLayout(new GridBagLayout());
551
+ //materialPanel.setLayout(new GridBagLayout());
387552
388553 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
389554 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -422,7 +587,7 @@
422587 static String newline = "\n";
423588 protected static final String buttonString = "JButton";
424589 StyledDocument doc;
425
- JTextArea infoarea;
590
+ JTextPane infoarea;
426591
427592 void ClearInfo()
428593 {
....@@ -445,10 +610,10 @@
445610 e.printStackTrace();
446611 }
447612
448
- String selection = infoarea.getText();
449
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
450
- java.awt.datatransfer.Clipboard clipboard =
451
- Toolkit.getDefaultToolkit().getSystemClipboard();
613
+// String selection = infoarea.getText();
614
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
615
+// java.awt.datatransfer.Clipboard clipboard =
616
+// Toolkit.getDefaultToolkit().getSystemClipboard();
452617 //clipboard.setContents(data, data);
453618 }
454619
....@@ -471,13 +636,13 @@
471636 //SendInfo("Name:", "bold");
472637 if (sel.GetTextures() != null || debug)
473638 {
474
- si.SendInfo(sel.toString(), "bold");
639
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
475640 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
476641 if (sel.Size() > 0)
477642 {
478643 si.SendInfo("#children = " + sel.Size(), "regular");
479644 }
480
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
645
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
481646 if (debug)
482647 {
483648 try
....@@ -489,7 +654,10 @@
489654 }
490655
491656 if (full)
492
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
657
+ {
658
+ si.SendInfo(" BBox min: " + minima, "regular");
659
+ si.SendInfo(" BBox max: " + maxima, "regular");
660
+ }
493661
494662 if (sel.bRep != null)
495663 {
....@@ -516,7 +684,7 @@
516684 }
517685 if (sel.support != null)
518686 {
519
- si.SendInfo(" support: " + sel.support, "regular");
687
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
520688 }
521689 if (sel.scriptnode != null)
522690 {
....@@ -587,6 +755,9 @@
587755 {
588756 CameraPane.pointflow = (PointFlow) sel;
589757 }
758
+
759
+ si.SendInfo("_____________________", "regular");
760
+ si.SendInfo("", "regular");
590761 }
591762 }
592763
....@@ -602,68 +773,205 @@
602773 }
603774 }
604775
776
+//static GraphicsDevice device = GraphicsEnvironment
777
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
778
+
779
+ Rectangle keeprect;
780
+ cRadio radio;
781
+
782
+cButton keepButton;
783
+ cButton twoButton; // Full 3D
784
+ cButton sixButton;
785
+ cButton threeButton;
786
+ cButton sevenButton;
787
+ cButton fourButton; // full panel
788
+ cButton oneButton; // full XYZ
789
+ //cButton currentLayout;
790
+
791
+ boolean maximized;
792
+
793
+ cButton fullscreenLayout;
794
+ cButton expandedLayout;
795
+
796
+ void Minimize()
797
+ {
798
+ frame.setState(Frame.ICONIFIED);
799
+ frame.validate();
800
+ }
801
+
802
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
803
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
804
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
805
+ void Maximize()
806
+ {
807
+ if (CameraPane.FULLSCREEN)
808
+ {
809
+ ToggleFullScreen();
810
+ }
811
+
812
+ if (maximized)
813
+ {
814
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
815
+ }
816
+ else
817
+ {
818
+ keeprect = frame.getBounds();
819
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
820
+// Dimension rect2 = frame.getToolkit().getScreenSize();
821
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
822
+// frame.setState(Frame.MAXIMIZED_BOTH);
823
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
824
+ }
825
+
826
+ maximized ^= true;
827
+
828
+ frame.validate();
829
+ }
830
+
831
+ cButton minButton;
832
+ cButton maxButton;
833
+ cButton fullButton;
834
+ cButton collapseButton;
835
+ cButton maximize3DButton;
836
+
605837 void ToggleFullScreen()
606838 {
607
- if (CameraPane.FULLSCREEN)
839
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
840
+
841
+ cameraView.ToggleFullScreen();
842
+
843
+ if (!CameraPane.FULLSCREEN)
608844 {
609
- frame.getContentPane().remove(/*"Center",*/bigThree);
610
- framePanel.add(bigThree);
611
- frame.getContentPane().add(/*"Center",*/framePanel);
845
+ device.setFullScreenWindow(null);
846
+ frame.dispose();
847
+ frame.setUndecorated(false);
848
+ frame.validate();
849
+ frame.setVisible(true);
850
+
851
+ //frame.setVisible(false);
852
+// frame.removeNotify();
853
+// frame.setUndecorated(false);
854
+// frame.addNotify();
855
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
856
+
857
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
858
+// X framePanel.add(bigThree);
859
+// X frame.getContentPane().add(/*"Center",*/framePanel);
860
+// framePanel.setDividerLocation(46); // icons are 24x24
861
+
862
+ //frame.setVisible(true);
863
+// radio.layout = keepButton;
864
+ //theFrame = null;
865
+ keepButton = null;
866
+// radio.layout.doClick();
867
+
612868 } else
613869 {
614
- frame.getContentPane().remove(/*"Center",*/framePanel);
615
- framePanel.remove(bigThree);
616
- frame.getContentPane().add(/*"Center",*/bigThree);
870
+ keepButton = radio.layout;
871
+ //keeprect = frame.getBounds();
872
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
873
+// frame.getToolkit().getScreenSize().height);
874
+ //frame.setVisible(false);
875
+
876
+ frame.dispose();
877
+ frame.setUndecorated(true);
878
+ device.setFullScreenWindow(frame);
879
+ frame.validate();
880
+ frame.setVisible(true);
881
+// frame.removeNotify();
882
+// frame.setUndecorated(true);
883
+// frame.addNotify();
884
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
885
+// X framePanel.remove(bigThree);
886
+// X frame.getContentPane().add(/*"Center",*/bigThree);
887
+// framePanel.setDividerLocation(0);
888
+
889
+// radio.layout = fullscreenLayout;
890
+// radio.layout.doClick();
891
+ //frame.setVisible(true);
617892 }
618
- cameraView.ToggleFullScreen();
893
+ frame.validate();
894
+
895
+ cameraView.requestFocusInWindow();
619896 }
620897
621
- private JTextArea createTextPane()
898
+ void CollapseToolbar()
899
+ {
900
+ framePanel.setDividerLocation(0);
901
+ //frame.validate();
902
+
903
+ cameraView.requestFocusInWindow();
904
+ }
905
+
906
+ private Object3D Duplicate(Object3D object)
622907 {
623
- String[] initString =
624
- {
625
- "This is an editable JTextPane, ", //regular
626
- "another ", //italic
627
- "styled ", //bold
628
- "text ", //small
629
- "component, ", //large
630
- "which supports embedded components..." + newline,//regular
631
- " " + newline, //button
632
- "...and embedded icons..." + newline, //regular
633
- " ", //icon
634
- newline + "JTextPane is a subclass of JEditorPane that "
635
- + "uses a StyledEditorKit and StyledDocument, and provides "
636
- + "cover methods for interacting with those objects."
637
- };
908
+ boolean temp = CameraPane.SWITCH;
909
+ CameraPane.SWITCH = false;
910
+
911
+ object.ExtractBigData(versiontable);
912
+ // if (copy == client)
913
+
914
+ Object3D versions[] = object.versionlist;
915
+ object.versionlist = null;
916
+
917
+ //byte[] compress = Compress(copy);
918
+ Object3D compress = (Object3D)Grafreed.clone(object);
919
+
920
+ object.versionlist = versions;
921
+
922
+ object.RestoreBigData(versiontable);
923
+
924
+ CameraPane.SWITCH = temp;
925
+
926
+ return compress;
927
+ }
638928
639
- String[] initStyles =
640
- {
641
- "regular", "italic", "bold", "small", "large",
642
- "regular", "button", "regular", "icon",
643
- "regular"
644
- };
929
+ private JTextPane createTextPane()
930
+ {
931
+// TEXTAREA String[] initString =
932
+// {
933
+// "This is an editable JTextPane, ", //regular
934
+// "another ", //italic
935
+// "styled ", //bold
936
+// "text ", //small
937
+// "component, ", //large
938
+// "which supports embedded components..." + newline,//regular
939
+// " " + newline, //button
940
+// "...and embedded icons..." + newline, //regular
941
+// " ", //icon
942
+// newline + "JTextPane is a subclass of JEditorPane that "
943
+// + "uses a StyledEditorKit and StyledDocument, and provides "
944
+// + "cover methods for interacting with those objects."
945
+// };
946
+//
947
+// String[] initStyles =
948
+// {
949
+// "regular", "italic", "bold", "small", "large",
950
+// "regular", "button", "regular", "icon",
951
+// "regular"
952
+// };
953
+//
954
+// JTextPane textPane = new JTextPane();
955
+// textPane.setEditable(true);
956
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
957
+// addStylesToDocument(doc);
958
+//
959
+// try
960
+// {
961
+// for (int j = 0; j < 2; j++)
962
+// {
963
+// for (int i = 0; i < initString.length; i++)
964
+// {
965
+// doc.insertString(doc.getLength(), initString[i],
966
+// doc.getStyle(initStyles[i]));
967
+// }
968
+// }
969
+// } catch (BadLocationException ble)
970
+// {
971
+// System.err.println("Couldn't insert initial text into text pane.");
972
+// }
645973
646
- JTextPane textPane = new JTextPane();
647
- textPane.setEditable(true);
648
- /*StyledDocument*/ doc = textPane.getStyledDocument();
649
- addStylesToDocument(doc);
650
-
651
- try
652
- {
653
- for (int j = 0; j < 2; j++)
654
- {
655
- for (int i = 0; i < initString.length; i++)
656
- {
657
- doc.insertString(doc.getLength(), initString[i],
658
- doc.getStyle(initStyles[i]));
659
- }
660
- }
661
- } catch (BadLocationException ble)
662
- {
663
- System.err.println("Couldn't insert initial text into text pane.");
664
- }
665
-
666
- return new JTextArea(); // textPane;
974
+ return new JTextPane(); // textPane;
667975 }
668976
669977 protected void addStylesToDocument(StyledDocument doc)
....@@ -716,7 +1024,7 @@
7161024 protected static ImageIcon createImageIcon(String path,
7171025 String description)
7181026 {
719
- java.net.URL imgURL = GrafreeD.class.getResource(path);
1027
+ java.net.URL imgURL = Grafreed.class.getResource(path);
7201028 if (imgURL != null)
7211029 {
7221030 return new ImageIcon(imgURL, description);
....@@ -739,6 +1047,7 @@
7391047 {
7401048 SetupMaterial(materialPanel);
7411049 }
1050
+
7421051 //SetupName();
7431052 //SetupViews();
7441053 }
....@@ -748,6 +1057,7 @@
7481057 // NumberSlider vDivsField;
7491058 // JCheckBox endcaps;
7501059 JCheckBox liveCB;
1060
+ JCheckBox selectableCB;
7511061 JCheckBox hideCB;
7521062 JCheckBox link2masterCB;
7531063 JCheckBox markCB;
....@@ -755,7 +1065,12 @@
7551065 JCheckBox speedupCB;
7561066 JCheckBox rewindCB;
7571067 JCheckBox flipVCB;
1068
+
1069
+ cCheckBox toggleTextureCB;
1070
+ cCheckBox toggleSwitchCB;
1071
+
7581072 JComboBox texresMenu;
1073
+
7591074 JButton resetButton;
7601075 JButton stepButton;
7611076 JButton stepAllButton;
....@@ -763,115 +1078,87 @@
7631078 JButton slowerButton;
7641079 JButton fasterButton;
7651080 JButton remarkButton;
1081
+
1082
+ cGridBag editPanel;
1083
+ cGridBag editCommandsPanel;
1084
+
1085
+ cGridBag namePanel;
1086
+ cGridBag setupPanel;
1087
+ cGridBag setupPanel2;
1088
+ cGridBag objectCommandsPanel;
1089
+ cGridBag pushPanel;
1090
+ cGridBag fillPanel;
7661091
767
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1092
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7681093 {
7691094 JCheckBox cb;
7701095
771
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
772
- oe.aConstraints.gridwidth = 1; // 3;
773
-// oe.aConstraints.weightx = 1;
774
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
775
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1096
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7761097 cb.addItemListener(this);
777
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
778
- oe.aConstraints.gridwidth = 1;
779
- oe.aConstraints.gridx += 1;
7801098
7811099 return cb;
7821100 }
7831101
784
- cButton AddButton(ObjEditor oe, String label)
1102
+ cButton AddButton(cGridBag panel, String label)
7851103 {
7861104 cButton cb;
7871105
788
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
789
- oe.aConstraints.gridwidth = 1;
790
-// oe.aConstraints.weightx = 1;
791
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
792
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1106
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7931107 cb.addActionListener(this);
794
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
795
- oe.aConstraints.gridwidth = 1;
796
- oe.aConstraints.gridx += 1;
7971108
7981109 return cb;
7991110 }
8001111
801
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1112
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
8021113 {
8031114 JComboBox combo;
8041115
805
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
806
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
807
- oe.aConstraints.gridx += 1;
1116
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8081117 combo.addActionListener(this);
8091118
8101119 return combo;
8111120 }
8121121
813
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
1122
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
8141123 {
815
- NumberSlider combo;
1124
+ cGridBag control = new cGridBag();
1125
+
1126
+ cNumberSlider combo;
8161127
8171128 JLabel jlabel = new JLabel(label);
818
-
819
- aConstraints.fill = GridBagConstraints.VERTICAL;
8201129 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
821
- aConstraints.gridwidth = 1;
822
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
823
- aConstraints.gridx += 1;
824
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
825
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
826
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827
- aConstraints.gridx += 1;
828
- aConstraints.gridwidth = 1;
829
-
1130
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1131
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8301132 combo.setFloat(current);
831
-
832
- combo.label = jlabel;
833
-
834
- combo.addChangeListener(this);
835
-
836
- return combo;
1133
+
1134
+ panel.add(control);
1135
+
1136
+ return control;
8371137 }
8381138
839
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
1139
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8401140 {
841
- NumberSlider combo;
1141
+ cGridBag control = new cGridBag();
1142
+
1143
+ cNumberSlider combo;
8421144
8431145 JLabel jlabel = new JLabel(label);
844
-
845
- aConstraints.fill = GridBagConstraints.VERTICAL;
8461146 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
847
- aConstraints.gridwidth = 2;
848
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
849
- aConstraints.gridx += 1;
850
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
851
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
852
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
853
- aConstraints.gridx += 1;
854
- aConstraints.gridwidth = 1;
855
-
1147
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1148
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8561149 combo.setInteger(current);
8571150
858
- combo.label = jlabel;
859
-
860
- combo.addChangeListener(this);
861
-
862
- return combo;
1151
+ panel.add(control);
1152
+
1153
+ return control;
8631154 }
8641155
865
- JTextArea AddText(JPanel ctrlPanel, String name)
1156
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8661157 {
8671158 JTextArea text;
8681159
869
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
870
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
871
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1160
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8721161 text.addCaretListener(this);
873
- aConstraints.gridx += 1;
874
- aConstraints.gridwidth = 1;
8751162
8761163 return text;
8771164 }
....@@ -901,9 +1188,16 @@
9011188 objEditor.ctrlPanel.remove(j);
9021189 }
9031190
1191
+ void Remove(cNumberSlider j)
1192
+ {
1193
+ j.removeChangeListener(this);
1194
+ //objEditor.ctrlPanel.remove(j.label);
1195
+ objEditor.ctrlPanel.remove(j);
1196
+ }
1197
+
9041198 /*
9051199 */
906
- void Return() // ObjEditor oe)
1200
+ void Return0() // ObjEditor oe)
9071201 {
9081202 aConstraints.gridy += 1;
9091203 aConstraints.gridx = 0;
....@@ -958,37 +1252,92 @@
9581252
9591253 void SetupUI2(ObjEditor oe)
9601254 {
961
-// oe.aConstraints.weightx = 0;
962
-// oe.aConstraints.weighty = 0;
963
-// oe.aConstraints.gridx = 0;
964
-// oe.aConstraints.gridy = 0;
965
- SetupName(oe);
1255
+ //SetupName(oe);
9661256
967
- if (!GroupEditor.allparams)
1257
+ namePanel = new cGridBag();
1258
+
1259
+ //if (copy.pinned)
1260
+ {
1261
+ pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1262
+ pinButton.setSelected(copy.pinned);
1263
+ cGridBag t = new cGridBag();
1264
+ t.preferredWidth = 2;
1265
+ t.add(pinButton);
1266
+ namePanel.add(t);
1267
+
1268
+ pinButton.addItemListener(this);
1269
+ }
1270
+
1271
+ nameField = AddText(namePanel, copy.GetName());
1272
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
1273
+ oe.ctrlPanel.add(namePanel);
1274
+
1275
+ oe.ctrlPanel.Return();
1276
+
1277
+ if (!allparams)
9681278 return;
9691279
970
- liveCB = AddCheckBox(oe, "Live", copy.live);
971
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
972
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1280
+ setupPanel = new cGridBag().setVertical(false);
1281
+
1282
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1283
+ liveCB.setToolTipText("Animate object");
1284
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1285
+ selectableCB.setToolTipText("Make object selectable");
9731286 // Return();
974
- markCB = AddCheckBox(oe, "Mark", copy.marked);
975
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
976
- randomCB = AddCheckBox(oe, "Rand", copy.random);
977
- Return();
978
- resetButton = AddButton(oe, "Reset");
979
- stepButton = AddButton(oe, "Step");
1287
+
1288
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1289
+ hideCB.setToolTipText("Hide object");
1290
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1291
+ markCB.setToolTipText("As animation target transform");
1292
+
1293
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
1294
+
1295
+ setupPanel2 = new cGridBag().setVertical(false);
1296
+
1297
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1298
+ rewindCB.setToolTipText("Rewind animation");
1299
+
1300
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1301
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1302
+
1303
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1304
+ link2masterCB.setToolTipText("Attach to support");
1305
+
1306
+ if (Globals.ADVANCED)
1307
+ {
1308
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1309
+ speedupCB.setToolTipText("Option motion capture");
1310
+ }
1311
+
1312
+ oe.ctrlPanel.add(setupPanel);
1313
+ oe.ctrlPanel.Return();
1314
+ oe.ctrlPanel.add(setupPanel2);
1315
+ oe.ctrlPanel.Return();
1316
+
1317
+ objectCommandsPanel = new cGridBag().setVertical(false);
1318
+
1319
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1320
+ resetButton.setToolTipText("Jump to frame zero");
1321
+ stepButton = AddButton(objectCommandsPanel, "Step");
1322
+ stepButton.setToolTipText("Step one frame");
9801323 // resetAllButton = AddButton(oe, "Reset All");
9811324 // stepAllButton = AddButton(oe, "Step All");
982
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9831325 // Return();
984
- slowerButton = AddButton(oe, "Slow");
985
- fasterButton = AddButton(oe, "Fast");
986
- remarkButton = AddButton(oe, "Rem");
1326
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1327
+ slowerButton.setToolTipText("Decrease animation speed");
1328
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1329
+ fasterButton.setToolTipText("Increase animation speed");
1330
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1331
+ remarkButton.setToolTipText("Set the current transform as the target");
9871332
988
- Return();
1333
+ oe.ctrlPanel.add(objectCommandsPanel);
1334
+ oe.ctrlPanel.Return();
9891335
990
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
991
- Return();
1336
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1337
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1338
+ //Return();
1339
+
1340
+ oe.ctrlPanel.Return();
9921341
9931342 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9941343 // ObjEditor.aConstraints.gridx += 1;
....@@ -1083,7 +1432,7 @@
10831432 oe.aConstraints.gridwidth = 1;
10841433 /**/
10851434 nameField = AddText(oe.ctrlPanel, copy.GetName());
1086
- Return();
1435
+ oe.ctrlPanel.Return();
10871436
10881437 //ctrlPanel.add(textureButton = new Button("Texture..."));
10891438 //textureButton.setEnabled(false);
....@@ -1185,11 +1534,25 @@
11851534 //JPanel worldPanel =
11861535 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11871536 //worldPanel.setName("World");
1188
- centralPanel = new JPanel(new BorderLayout());
1189
- timelinePanel = new JPanel(new BorderLayout());
1190
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1537
+ centralPanel = new cGridBag();
1538
+ centralPanel.preferredWidth = 20;
1539
+
1540
+ if (Globals.ADVANCED)
1541
+ {
1542
+ timelinePanel = new JPanel(new BorderLayout());
1543
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11911544
1545
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1546
+ cameraPanel.setContinuousLayout(true);
1547
+ cameraPanel.setOneTouchExpandable(true);
1548
+// cameraPanel.setDividerLocation(0.9);
1549
+// cameraPanel.setDividerSize(9);
1550
+ cameraPanel.setResizeWeight(1.0);
1551
+
1552
+ }
1553
+
11921554 centralPanel.add(cameraView);
1555
+ centralPanel.setFocusable(true);
11931556 //frame.setJMenuBar(timelineMenubar);
11941557 //centralPanel.add(timelinePanel);
11951558
....@@ -1208,12 +1571,14 @@
12081571 //frontView.object = copy;
12091572 //sideView.object = copy;
12101573
1211
- XYZPanel = new JPanel();
1212
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1574
+ XYZPanel = new cGridBag().setVertical(true);
1575
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12131576
1214
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1215
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1216
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1577
+ XYZPanel.preferredWidth = 5;
1578
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1579
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1580
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1581
+ //XYZPanel.setName("XYZ");
12171582
12181583 /*
12191584 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1251,12 +1616,29 @@
12511616 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12521617 //tmp.setName("Edit");
12531618 objectPanel.add(materialPanel);
1254
- JPanel north = new JPanel(new BorderLayout());
1255
- north.setName("Edit");
1256
- north.add(ctrlPanel, BorderLayout.NORTH);
1257
- objectPanel.add(north);
1258
- objectPanel.add(infoPanel);
1619
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1620
+ objectPanel.setToolTipTextAt(0, "Material");
1621
+
1622
+ objectPanel.add(toolboxPanel);
1623
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1624
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
12591625
1626
+ objectPanel.add(skyboxPanel);
1627
+ objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1628
+ objectPanel.setToolTipTextAt(2, "Backgrounds");
1629
+
1630
+// JPanel north = new JPanel(new BorderLayout());
1631
+// north.setName("Edit");
1632
+// north.add(ctrlPanel, BorderLayout.NORTH);
1633
+// objectPanel.add(north);
1634
+ objectPanel.add(editPanel);
1635
+ objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1636
+ objectPanel.setToolTipTextAt(3, "Edit controls");
1637
+
1638
+ objectPanel.add(XYZPanel);
1639
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1640
+ objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
1641
+
12601642 /*
12611643 aConstraints.gridx = 0;
12621644 aConstraints.gridwidth = 1;
....@@ -1264,7 +1646,7 @@
12641646 aConstraints.gridy += 1;
12651647 aConstraints.gridwidth = 1;
12661648 mainPanel.add(objectPanel, aConstraints);
1267
- */
1649
+ */
12681650
12691651 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12701652 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1275,17 +1657,29 @@
12751657 scrollpane.setWheelScrollingEnabled(true);
12761658 scrollpane.addMouseWheelListener(this); // Default not fast enough
12771659
1278
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1279
- scenePanel.add(scrollpane);
1660
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1661
+ scenePanel.preferredWidth = 5;
1662
+
1663
+ JTabbedPane tabbedPane = new JTabbedPane();
1664
+ tabbedPane.add(scrollpane);
12801665
1281
- scenePanel.add(FSPane = new cFileSystemPane(this));
1282
-
1283
- optionsPanel = new JPanel(new GridBagLayout());
1666
+ optionsPanel = new cGridBag().setVertical(false);
12841667
12851668 optionsPanel.setName("Options");
1286
- scenePanel.add(optionsPanel);
1669
+
1670
+ AddOptions(optionsPanel); //, aConstraints);
1671
+
1672
+ tabbedPane.add(optionsPanel);
1673
+
1674
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12871675
1676
+ scenePanel.add(tabbedPane);
12881677
1678
+ //if (Globals.ADVANCED)
1679
+ tabbedPane.add(infoPanel);
1680
+ tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1681
+ tabbedPane.setToolTipTextAt(3, "Information");
1682
+
12891683 /*
12901684 cTree jTree = new cTree(null);
12911685 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1318,6 +1712,7 @@
13181712 //bigPanel.setSize(new Dimension(10,10));
13191713 //bigPanel.add(ctrlPanel);
13201714 //bigPanel.add(gridPanel);
1715
+ /**
13211716 bigThree = new JPanel();
13221717 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
13231718 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1341,7 +1736,13 @@
13411736 // aConstraints.gridheight = 3;
13421737 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13431738 bigThree.add(XYZPanel, aWindowConstraints);
1739
+ /**/
13441740
1741
+ bigThree = new cGridBag();
1742
+ bigThree.addComponent(scenePanel);
1743
+ bigThree.addComponent(centralPanel);
1744
+ //bigThree.addComponent(XYZPanel);
1745
+
13451746 // // SIDE EFFECT!!!
13461747 // aConstraints.gridx = 0;
13471748 // aConstraints.gridy = 0;
....@@ -1349,9 +1750,26 @@
13491750 // aConstraints.gridheight = 1;
13501751
13511752 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1352
- framePanel.setContinuousLayout(true);
1353
- framePanel.setOneTouchExpandable(true);
1354
- framePanel.setDividerLocation(0.8);
1753
+
1754
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
1755
+ new java.beans.PropertyChangeListener()
1756
+ {
1757
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
1758
+ {
1759
+ if ((Integer)pce.getOldValue() == 1)
1760
+ {
1761
+ if (radio.layout != expandedLayout)
1762
+ {
1763
+ radio.layout = expandedLayout;
1764
+ radio.layout.doClick();
1765
+ }
1766
+ }
1767
+ }
1768
+ });
1769
+
1770
+ framePanel.setContinuousLayout(false);
1771
+ framePanel.setOneTouchExpandable(false);
1772
+ //.setDividerLocation(0.8);
13551773 //framePanel.setDividerSize(15);
13561774 //framePanel.setResizeWeight(0.15);
13571775 framePanel.setName("Frame");
....@@ -1362,20 +1780,25 @@
13621780 //worldPane.add(bigPanel);
13631781 //worldPane.add(worldPanel);
13641782 /**/
1365
- frame.getContentPane().add(/*"Center",*/framePanel);
1783
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1784
+ frame.add(/*"Center",*/framePanel);
13661785 //frame.getContentPane().add(/*"Center",*/ worldPane);
13671786
13681787 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13691788
1370
- frame.setSize(1024, 768);
1371
- frame.show();
1372
-
1789
+ frame.setSize(1280, 860);
1790
+
1791
+ cameraView.requestFocusInWindow();
1792
+
13731793 gridPanel.setDividerLocation(1.0);
1794
+
1795
+ frame.validate();
1796
+
1797
+ frame.setVisible(true);
13741798
13751799 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13761800 frame.addWindowListener(new WindowAdapter()
13771801 {
1378
-
13791802 public void windowClosing(WindowEvent e)
13801803 {
13811804 Close();
....@@ -1383,6 +1806,10 @@
13831806 });
13841807 }
13851808
1809
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1810
+ {
1811
+ }
1812
+
13861813 JTree GetTree()
13871814 {
13881815 return objEditor.jTree;
....@@ -1394,260 +1821,575 @@
13941821 ctrlPanel.removeAll();
13951822 }
13961823
1397
- void SetupMaterial(JPanel ctrlPanel)
1824
+ void SetupMaterial(cGridBag materialpanel)
13981825 {
1399
- aConstraints.weighty = 0;
1400
- //aConstraints.weightx = 1;
1401
- /*
1826
+ cGridBag presetpanel = new cGridBag().setVertical(true);
1827
+
1828
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1829
+ skin.setToolTipText("Skin");
1830
+ skin.addMouseListener(new MouseAdapter()
1831
+ {
1832
+ public void mouseClicked(MouseEvent e)
1833
+ {
1834
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
1835
+ cMaterial material = object.material;
1836
+
1837
+ // Skin
1838
+ colorField.setFloat(material.color);
1839
+ saturationField.setFloat(material.modulation);
1840
+ subsurfaceField.setFloat(material.subsurface);
1841
+ selfshadowField.setFloat(material.diffuseness);
1842
+ diffusenessField.setFloat(material.factor);
1843
+ shininessField.setFloat(material.shininess);
1844
+ shadowbiasField.setFloat(material.shadowbias);
1845
+ diffuseField.setFloat(material.diffuse);
1846
+ specularField.setFloat(material.specular);
1847
+
1848
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
1849
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
1850
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
1851
+
1852
+ materialtouched = true;
1853
+ applySelf();
1854
+ }
1855
+ });
1856
+ presetpanel.add(skin);
1857
+
1858
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
1859
+ lambert.setToolTipText("Diffuse");
1860
+ lambert.addMouseListener(new MouseAdapter()
1861
+ {
1862
+ public void mouseClicked(MouseEvent e)
1863
+ {
1864
+ Object3D object = Grafreed.materials.versionlist[2].get(0);
1865
+ cMaterial material = object.material;
1866
+
1867
+ diffusenessField.setFloat(material.factor);
1868
+ selfshadowField.setFloat(material.diffuseness);
1869
+
1870
+ materialtouched = true;
1871
+ applySelf();
1872
+ }
1873
+ });
1874
+ presetpanel.add(lambert);
1875
+
1876
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
1877
+ diffuse2.setToolTipText("Diffuse2");
1878
+ diffuse2.addMouseListener(new MouseAdapter()
1879
+ {
1880
+ public void mouseClicked(MouseEvent e)
1881
+ {
1882
+ Object3D object = Grafreed.materials.versionlist[3].get(0);
1883
+ cMaterial material = object.material;
1884
+
1885
+ diffusenessField.setFloat(material.factor);
1886
+ selfshadowField.setFloat(material.diffuseness);
1887
+
1888
+ materialtouched = true;
1889
+ applySelf();
1890
+ }
1891
+ });
1892
+ presetpanel.add(diffuse2);
1893
+
1894
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
1895
+ diffusemoon.setToolTipText("Moon");
1896
+ diffusemoon.addMouseListener(new MouseAdapter()
1897
+ {
1898
+ public void mouseClicked(MouseEvent e)
1899
+ {
1900
+ Object3D object = Grafreed.materials.versionlist[4].get(0);
1901
+ cMaterial material = object.material;
1902
+
1903
+ diffusenessField.setFloat(material.factor);
1904
+ selfshadowField.setFloat(material.diffuseness);
1905
+
1906
+ materialtouched = true;
1907
+ applySelf();
1908
+ }
1909
+ });
1910
+ presetpanel.add(diffusemoon);
1911
+
1912
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
1913
+ diffusemoon2.setToolTipText("Moon2");
1914
+ diffusemoon2.addMouseListener(new MouseAdapter()
1915
+ {
1916
+ public void mouseClicked(MouseEvent e)
1917
+ {
1918
+ Object3D object = Grafreed.materials.versionlist[5].get(0);
1919
+ cMaterial material = object.material;
1920
+
1921
+ diffusenessField.setFloat(material.factor);
1922
+ selfshadowField.setFloat(material.diffuseness);
1923
+
1924
+ materialtouched = true;
1925
+ applySelf();
1926
+ }
1927
+ });
1928
+ presetpanel.add(diffusemoon2);
1929
+
1930
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
1931
+ diffusemoon3.setToolTipText("Moon3");
1932
+ diffusemoon3.addMouseListener(new MouseAdapter()
1933
+ {
1934
+ public void mouseClicked(MouseEvent e)
1935
+ {
1936
+ Object3D object = Grafreed.materials.versionlist[6].get(0);
1937
+ cMaterial material = object.material;
1938
+
1939
+ diffusenessField.setFloat(material.factor);
1940
+ selfshadowField.setFloat(material.diffuseness);
1941
+
1942
+ materialtouched = true;
1943
+ applySelf();
1944
+ }
1945
+ });
1946
+ presetpanel.add(diffusemoon3);
1947
+
1948
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
1949
+ diffusesheen.setToolTipText("Sheen");
1950
+ diffusesheen.addMouseListener(new MouseAdapter()
1951
+ {
1952
+ public void mouseClicked(MouseEvent e)
1953
+ {
1954
+ Object3D object = Grafreed.materials.versionlist[7].get(0);
1955
+ cMaterial material = object.material;
1956
+
1957
+ sheenField.setFloat(material.sheen);
1958
+
1959
+ materialtouched = true;
1960
+ applySelf();
1961
+ }
1962
+ });
1963
+ presetpanel.add(diffusesheen);
1964
+
1965
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
1966
+ rough.setToolTipText("Rough metal");
1967
+ rough.addMouseListener(new MouseAdapter()
1968
+ {
1969
+ public void mouseClicked(MouseEvent e)
1970
+ {
1971
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
1972
+ cMaterial material = object.material;
1973
+
1974
+ shininessField.setFloat(material.shininess);
1975
+ velvetField.setFloat(material.velvet);
1976
+
1977
+ materialtouched = true;
1978
+ applySelf();
1979
+ }
1980
+ });
1981
+ presetpanel.add(rough);
1982
+
1983
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
1984
+ rough2.setToolTipText("Medium metal");
1985
+ rough2.addMouseListener(new MouseAdapter()
1986
+ {
1987
+ public void mouseClicked(MouseEvent e)
1988
+ {
1989
+ Object3D object = Grafreed.materials.versionlist[13].get(0);
1990
+ cMaterial material = object.material;
1991
+
1992
+ shininessField.setFloat(material.shininess);
1993
+ lightareaField.setFloat(material.lightarea);
1994
+
1995
+ materialtouched = true;
1996
+ applySelf();
1997
+ }
1998
+ });
1999
+ presetpanel.add(rough2);
2000
+
2001
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
2002
+ shini0.setToolTipText("Shiny");
2003
+ shini0.addMouseListener(new MouseAdapter()
2004
+ {
2005
+ public void mouseClicked(MouseEvent e)
2006
+ {
2007
+ Object3D object = Grafreed.materials.versionlist[14].get(0);
2008
+ cMaterial material = object.material;
2009
+
2010
+ shininessField.setFloat(material.shininess);
2011
+ lightareaField.setFloat(material.lightarea);
2012
+
2013
+ materialtouched = true;
2014
+ applySelf();
2015
+ }
2016
+ });
2017
+ presetpanel.add(shini0);
2018
+
2019
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
2020
+ shini1.setToolTipText("Shiny2");
2021
+ shini1.addMouseListener(new MouseAdapter()
2022
+ {
2023
+ public void mouseClicked(MouseEvent e)
2024
+ {
2025
+ Object3D object = Grafreed.materials.versionlist[11].get(0);
2026
+ cMaterial material = object.material;
2027
+
2028
+ shininessField.setFloat(material.shininess);
2029
+ lightareaField.setFloat(material.lightarea);
2030
+
2031
+ materialtouched = true;
2032
+ applySelf();
2033
+ }
2034
+ });
2035
+ presetpanel.add(shini1);
2036
+
2037
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2038
+ shini2.setToolTipText("Shiny3");
2039
+ shini2.addMouseListener(new MouseAdapter()
2040
+ {
2041
+ public void mouseClicked(MouseEvent e)
2042
+ {
2043
+ Object3D object = Grafreed.materials.versionlist[12].get(0);
2044
+ cMaterial material = object.material;
2045
+
2046
+ shininessField.setFloat(material.shininess);
2047
+ lightareaField.setFloat(material.lightarea);
2048
+
2049
+ materialtouched = true;
2050
+ applySelf();
2051
+ }
2052
+ });
2053
+ presetpanel.add(shini2);
2054
+
2055
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2056
+ aniso.setToolTipText("AnisoU");
2057
+ aniso.addMouseListener(new MouseAdapter()
2058
+ {
2059
+ public void mouseClicked(MouseEvent e)
2060
+ {
2061
+ Object3D object = Grafreed.materials.versionlist[8].get(0);
2062
+ cMaterial material = object.material;
2063
+
2064
+ anisoField.setFloat(material.aniso);
2065
+ anisoVField.setFloat(material.anisoV);
2066
+
2067
+ materialtouched = true;
2068
+ applySelf();
2069
+ }
2070
+ });
2071
+ presetpanel.add(aniso);
2072
+
2073
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2074
+ aniso2.setToolTipText("AnisoV");
2075
+ aniso2.addMouseListener(new MouseAdapter()
2076
+ {
2077
+ public void mouseClicked(MouseEvent e)
2078
+ {
2079
+ Object3D object = Grafreed.materials.versionlist[9].get(0);
2080
+ cMaterial material = object.material;
2081
+
2082
+ anisoField.setFloat(material.aniso);
2083
+ anisoVField.setFloat(material.anisoV);
2084
+
2085
+ materialtouched = true;
2086
+ applySelf();
2087
+ }
2088
+ });
2089
+ presetpanel.add(aniso2);
2090
+
2091
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2092
+ aniso3.setToolTipText("AnisoUV");
2093
+ aniso3.addMouseListener(new MouseAdapter()
2094
+ {
2095
+ public void mouseClicked(MouseEvent e)
2096
+ {
2097
+ Object3D object = Grafreed.materials.versionlist[10].get(0);
2098
+ cMaterial material = object.material;
2099
+
2100
+ anisoField.setFloat(material.aniso);
2101
+ anisoVField.setFloat(material.anisoV);
2102
+
2103
+ materialtouched = true;
2104
+ applySelf();
2105
+ }
2106
+ });
2107
+ presetpanel.add(aniso3);
2108
+
2109
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2110
+ velvet0.setToolTipText("Velvet");
2111
+ velvet0.addMouseListener(new MouseAdapter()
2112
+ {
2113
+ public void mouseClicked(MouseEvent e)
2114
+ {
2115
+ Object3D object = Grafreed.materials.versionlist[15].get(0);
2116
+ cMaterial material = object.material;
2117
+
2118
+ diffusenessField.setFloat(material.factor);
2119
+ selfshadowField.setFloat(material.diffuseness);
2120
+ sheenField.setFloat(material.sheen);
2121
+ shininessField.setFloat(material.shininess);
2122
+ velvetField.setFloat(material.velvet);
2123
+ shiftField.setFloat(material.shift);
2124
+
2125
+ materialtouched = true;
2126
+ applySelf();
2127
+ }
2128
+ });
2129
+ presetpanel.add(velvet0);
2130
+
2131
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2132
+ bump0.setToolTipText("Bump texture");
2133
+ bump0.addMouseListener(new MouseAdapter()
2134
+ {
2135
+ public void mouseClicked(MouseEvent e)
2136
+ {
2137
+ Object3D object = Grafreed.materials.versionlist[16].get(0);
2138
+ cMaterial material = object.material;
2139
+
2140
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2141
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2142
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2143
+
2144
+ materialtouched = true;
2145
+ applySelf();
2146
+ }
2147
+ });
2148
+ presetpanel.add(bump0);
2149
+
2150
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2151
+ halo.setToolTipText("Halo");
2152
+ halo.addMouseListener(new MouseAdapter()
2153
+ {
2154
+ public void mouseClicked(MouseEvent e)
2155
+ {
2156
+ Object3D object = Grafreed.materials.versionlist[17].get(0);
2157
+ cMaterial material = object.material;
2158
+
2159
+ opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
2160
+
2161
+ materialtouched = true;
2162
+ applySelf();
2163
+ }
2164
+ });
2165
+ presetpanel.add(halo);
2166
+
2167
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2168
+ candle.setToolTipText("Candle");
2169
+ candle.addMouseListener(new MouseAdapter()
2170
+ {
2171
+ public void mouseClicked(MouseEvent e)
2172
+ {
2173
+ Object3D object = Grafreed.materials.versionlist[18].get(0);
2174
+ cMaterial material = object.material;
2175
+
2176
+ subsurfaceField.setFloat(material.subsurface);
2177
+ shadowbiasField.setFloat(material.shadowbias);
2178
+ ambientField.setFloat(material.ambient);
2179
+ specularField.setFloat(material.specular);
2180
+ lightareaField.setFloat(material.lightarea);
2181
+ shininessField.setFloat(material.shininess);
2182
+
2183
+ materialtouched = true;
2184
+ applySelf();
2185
+ }
2186
+ });
2187
+ presetpanel.add(candle);
2188
+
2189
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2190
+ shadowShader.setToolTipText("Shadow");
2191
+ shadowShader.addMouseListener(new MouseAdapter()
2192
+ {
2193
+ public void mouseClicked(MouseEvent e)
2194
+ {
2195
+ diffuseField.setFloat(0.001);
2196
+ ambientField.setFloat(0.001);
2197
+ cameraField.setFloat(0.001);
2198
+ specularField.setFloat(0.001);
2199
+ fakedepthField.setFloat(0.001);
2200
+ opacityField.setFloat(0.6);
2201
+
2202
+ materialtouched = true;
2203
+ applySelf();
2204
+ }
2205
+ });
2206
+ presetpanel.add(shadowShader);
2207
+
2208
+ cGridBag panel = new cGridBag().setVertical(true);
2209
+
2210
+ presetpanel.preferredWidth = 1;
2211
+
2212
+ materialpanel.add(presetpanel);
2213
+ materialpanel.add(panel);
2214
+
2215
+ panel.preferredWidth = 8;
2216
+
2217
+ /*
14022218 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14032219 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1404
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1405
- aConstraints.gridx += 1;
1406
- */
2220
+ */
14072221
1408
- aConstraints.gridwidth = 1;
1409
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1410
- aConstraints.gridx += 1;
1411
- aConstraints.weighty = 0;
1412
- aConstraints.gridwidth = 1;
2222
+ cGridBag editBar = new cGridBag().setVertical(false);
2223
+
2224
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
2225
+ createMaterialButton.setToolTipText("Create material");
14132226
14142227 /*
14152228 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1416
- aConstraints.gridx += 1;
1417
- aConstraints.weighty = 0;
1418
- aConstraints.gridwidth = 1;
14192229 */
14202230
1421
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1422
- aConstraints.gridx += 1;
2231
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
2232
+ clearMaterialButton.setToolTipText("Clear material");
2233
+
2234
+ if (Globals.ADVANCED)
2235
+ {
2236
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
2237
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
2238
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
2239
+ }
14232240
1424
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1425
-
1426
- aConstraints.gridx += 1;
1427
-
1428
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1429
-
1430
- aConstraints.gridx += 1;
1431
-
1432
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1433
-
1434
- aConstraints.gridx = 0;
1435
- aConstraints.gridy += 1;
1436
- aConstraints.weighty = 0;
1437
- aConstraints.gridwidth = 1;
2241
+ editBar.preferredHeight = 15;
2242
+
2243
+ panel.add(editBar);
2244
+
14382245 /**/
14392246 //aConstraints.weighty = 0;
14402247 ////aConstraints.weightx = 1;
14412248 //aConstraints.weighty = 1;
14422249 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14432250 //aConstraints.gridx += 1;
1444
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1445
- aConstraints.weighty = 0;
1446
- aConstraints.gridx = 0;
1447
- aConstraints.gridy += 1;
1448
- aConstraints.gridwidth = 1;
2251
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14492252
1450
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1451
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1452
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1453
- aConstraints.gridx += 1;
1454
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1455
- //aConstraints.weightx = 0;
1456
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1457
- aConstraints.gridx = 0;
1458
- aConstraints.gridy += 1;
1459
- aConstraints.gridwidth = 1;
2253
+ cGridBag colorSection = new cGridBag().setVertical(true);
14602254
1461
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1462
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1463
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1464
- aConstraints.gridx += 1;
1465
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1466
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1467
- aConstraints.gridx = 0;
1468
- aConstraints.gridy += 1;
1469
- aConstraints.gridwidth = 1;
2255
+ cGridBag huepanel = new cGridBag();
2256
+ cGridBag huelabel = new cGridBag();
2257
+ skin = GetLabel("icons/hue.png", false);
2258
+ skin.fit = true;
2259
+ huelabel.add(skin);
2260
+ huelabel.preferredWidth = 20;
2261
+ huepanel.add(new cGridBag()); // Label
2262
+ huepanel.add(huelabel); // Field/slider
2263
+
2264
+ huepanel.preferredHeight = 7;
14702265
1471
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1472
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1473
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1474
- aConstraints.gridx += 1;
1475
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1476
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1477
- aConstraints.gridx = 0;
1478
- aConstraints.gridy += 1;
1479
- aConstraints.gridwidth = 1;
2266
+ colorSection.add(huepanel);
2267
+
2268
+ cGridBag color = new cGridBag();
2269
+
2270
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
2271
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2272
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
14802273
1481
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1482
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1483
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1484
- aConstraints.gridx += 1;
1485
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1486
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1487
- aConstraints.gridx = 0;
1488
- aConstraints.gridy += 1;
1489
- aConstraints.gridwidth = 1;
2274
+ //colorField.preferredWidth = 200;
2275
+ colorSection.add(color);
14902276
1491
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1492
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1493
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1494
- aConstraints.gridx += 1;
1495
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1496
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1497
- aConstraints.gridx = 0;
1498
- aConstraints.gridy += 1;
1499
- aConstraints.gridwidth = 1;
2277
+ cGridBag modulation = new cGridBag();
2278
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
2279
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2280
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2281
+ colorSection.add(modulation);
15002282
1501
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1502
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1503
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1504
- aConstraints.gridx += 1;
1505
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1506
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1507
- aConstraints.gridx = 0;
1508
- aConstraints.gridy += 1;
1509
- aConstraints.gridwidth = 1;
2283
+ cGridBag opacity = new cGridBag();
2284
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
2285
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2286
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2287
+ colorSection.add(opacity);
15102288
1511
- //aConstraints.weighty = 1;
1512
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1513
- //aConstraints.gridx += 1;
1514
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1515
- aConstraints.weighty = 0;
1516
- aConstraints.gridx = 0;
1517
- aConstraints.gridy += 1;
1518
- aConstraints.gridwidth = 1;
2289
+ colorSection.add(GetSeparator());
2290
+
2291
+ cGridBag texture = new cGridBag();
2292
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
2293
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2294
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2295
+ colorSection.add(texture);
15192296
1520
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1521
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1522
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1523
- aConstraints.gridx += 1;
1524
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1525
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1526
- aConstraints.gridx = 0;
1527
- aConstraints.gridy += 1;
1528
- aConstraints.gridwidth = 1;
2297
+ panel.add(GetSeparator());
2298
+
2299
+ panel.add(colorSection);
2300
+
2301
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2302
+
2303
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
2304
+
2305
+ cGridBag diffuse = new cGridBag();
2306
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
2307
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2308
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2309
+ diffuseSection.add(diffuse);
15292310
1530
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1531
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1532
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1533
- aConstraints.gridx += 1;
1534
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1535
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1536
- aConstraints.gridx = 0;
1537
- aConstraints.gridy += 1;
1538
- aConstraints.gridwidth = 1;
2311
+ cGridBag diffuseness = new cGridBag();
2312
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
2313
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2314
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2315
+ diffuseSection.add(diffuseness);
15392316
1540
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1541
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1542
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1543
- aConstraints.gridx += 1;
1544
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1545
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1546
- aConstraints.gridx = 0;
1547
- aConstraints.gridy += 1;
1548
- aConstraints.gridwidth = 1;
2317
+ cGridBag selfshadow = new cGridBag();
2318
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
2319
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2320
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2321
+ diffuseSection.add(selfshadow);
15492322
1550
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1551
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1552
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1553
- aConstraints.gridx += 1;
1554
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1555
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1556
- aConstraints.gridx = 0;
1557
- aConstraints.gridy += 1;
1558
- aConstraints.gridwidth = 1;
2323
+ cGridBag sheen = new cGridBag();
2324
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
2325
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2326
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2327
+ diffuseSection.add(sheen);
15592328
1560
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1561
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1562
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1563
- aConstraints.gridx += 1;
1564
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1565
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1566
- aConstraints.gridx = 0;
1567
- aConstraints.gridy += 1;
1568
- aConstraints.gridwidth = 1;
2329
+ cGridBag subsurface = new cGridBag();
2330
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
2331
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2332
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2333
+ diffuseSection.add(subsurface);
15692334
1570
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1571
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1572
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1573
- aConstraints.gridx += 1;
1574
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1575
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1576
- aConstraints.gridx = 0;
1577
- aConstraints.gridy += 1;
1578
- aConstraints.gridwidth = 1;
2335
+ cGridBag shadow = new cGridBag();
2336
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
2337
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2338
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2339
+ diffuseSection.add(shadow);
15792340
1580
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1581
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1582
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1583
- aConstraints.gridx += 1;
1584
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1585
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1586
- aConstraints.gridx = 0;
1587
- aConstraints.gridy += 1;
1588
- aConstraints.gridwidth = 1;
2341
+ cGridBag fakedepth = new cGridBag();
2342
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
2343
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2344
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2345
+ diffuseSection.add(fakedepth);
15892346
1590
- //aConstraints.weighty = 1;
1591
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1592
- //aConstraints.gridx += 1;
1593
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1594
- aConstraints.weighty = 0;
1595
- aConstraints.gridx = 0;
1596
- aConstraints.gridy += 1;
1597
- aConstraints.gridwidth = 1;
2347
+ cGridBag shadowbias = new cGridBag();
2348
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
2349
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2350
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2351
+ diffuseSection.add(shadowbias);
15982352
1599
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1600
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1601
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1602
- aConstraints.gridx += 1;
1603
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1604
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1605
- aConstraints.gridx = 0;
1606
- aConstraints.gridy += 1;
1607
- aConstraints.gridwidth = 1;
2353
+ panel.add(GetSeparator());
2354
+
2355
+ panel.add(diffuseSection);
2356
+
2357
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2358
+
2359
+ cGridBag specularSection = new cGridBag().setVertical(true);
16082360
1609
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1610
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1611
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1612
- aConstraints.gridx += 1;
1613
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1614
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1615
- aConstraints.gridx = 0;
1616
- aConstraints.gridy += 1;
1617
- aConstraints.gridwidth = 1;
2361
+ cGridBag specular = new cGridBag();
2362
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
2363
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2364
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2365
+ specularSection.add(specular);
16182366
1619
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1620
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1621
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1622
- aConstraints.gridx += 1;
1623
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1624
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1625
- aConstraints.gridx = 0;
1626
- aConstraints.gridy += 1;
1627
- aConstraints.gridwidth = 1;
2367
+ cGridBag lightarea = new cGridBag();
2368
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
2369
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2370
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2371
+ specularSection.add(lightarea);
16282372
1629
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1630
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1631
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1632
- aConstraints.gridx += 1;
1633
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1634
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1635
- aConstraints.gridx = 0;
1636
- aConstraints.gridy += 1;
1637
- aConstraints.gridwidth = 1;
2373
+ cGridBag shininess = new cGridBag();
2374
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
2375
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2376
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2377
+ specularSection.add(shininess);
16382378
1639
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1640
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1641
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1642
- aConstraints.gridx += 1;
1643
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1644
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1645
- aConstraints.gridx = 0;
1646
- aConstraints.gridy += 1;
1647
- aConstraints.gridwidth = 1;
2379
+ cGridBag metalness = new cGridBag();
2380
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
2381
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2382
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2383
+ specularSection.add(metalness);
16482384
1649
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1650
- Return();
2385
+ cGridBag velvet = new cGridBag();
2386
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
2387
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2388
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2389
+ specularSection.add(velvet);
2390
+
2391
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
2392
+ //Return();
16512393 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16522394 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16532395 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1658,130 +2400,99 @@
16582400 // aConstraints.gridy += 1;
16592401 // aConstraints.gridwidth = 1;
16602402
1661
- //aConstraints.weighty = 1;
1662
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1663
- //aConstraints.gridx += 1;
1664
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1665
- aConstraints.weighty = 0;
1666
- aConstraints.gridx = 0;
1667
- aConstraints.gridy += 1;
1668
- aConstraints.gridwidth = 1;
2403
+ cGridBag anisoU = new cGridBag();
2404
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
2405
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2406
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2407
+ specularSection.add(anisoU);
16692408
1670
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1671
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1672
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1673
- aConstraints.gridx += 1;
1674
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1675
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1676
- aConstraints.gridx = 0;
1677
- aConstraints.gridy += 1;
1678
- aConstraints.gridwidth = 1;
2409
+ cGridBag anisoV = new cGridBag();
2410
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
2411
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2412
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2413
+ specularSection.add(anisoV);
16792414
1680
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1681
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1683
- aConstraints.gridx += 1;
1684
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1685
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1686
- aConstraints.gridx = 0;
1687
- aConstraints.gridy += 1;
1688
- aConstraints.gridwidth = 1;
16892415
1690
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1691
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1692
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1693
- aConstraints.gridx += 1;
1694
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1695
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1696
- aConstraints.gridx = 0;
1697
- aConstraints.gridy += 1;
1698
- aConstraints.gridwidth = 1;
2416
+ panel.add(GetSeparator());
2417
+
2418
+ panel.add(specularSection);
2419
+
2420
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2421
+
2422
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16992423
1700
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1701
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1702
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1703
- aConstraints.gridx += 1;
1704
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1705
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1706
- aConstraints.gridx = 0;
1707
- aConstraints.gridy += 1;
1708
- aConstraints.gridwidth = 1;
1709
- aConstraints.weighty = 0;
2424
+ cGridBag camera = new cGridBag();
2425
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
2426
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2427
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2428
+ colorSection.add(camera);
17102429
1711
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1712
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1713
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1714
- aConstraints.gridx += 1;
1715
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1716
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1717
- aConstraints.gridx = 0;
1718
- aConstraints.gridy += 1;
1719
- aConstraints.gridwidth = 1;
2430
+ cGridBag ambient = new cGridBag();
2431
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
2432
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2433
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2434
+ colorSection.add(ambient);
17202435
1721
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1722
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1723
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1724
- aConstraints.gridx += 1;
1725
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1726
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1727
- aConstraints.gridx = 0;
1728
- aConstraints.gridy += 1;
1729
- aConstraints.gridwidth = 1;
2436
+ cGridBag backlit = new cGridBag();
2437
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
2438
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2439
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2440
+ colorSection.add(backlit);
17302441
1731
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1732
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1733
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1734
- aConstraints.gridx += 1;
1735
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1736
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1737
- aConstraints.gridx = 0;
1738
- aConstraints.gridy += 1;
1739
- aConstraints.gridwidth = 1;
2442
+ //panel.add(new JSeparator());
2443
+
2444
+ //panel.add(globalSection);
2445
+
2446
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2447
+
2448
+ cGridBag textureSection = new cGridBag().setVertical(true);
17402449
1741
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1742
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1743
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1744
- aConstraints.gridx += 1;
1745
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1746
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1747
- aConstraints.gridx = 0;
1748
- aConstraints.gridy += 1;
1749
- aConstraints.gridwidth = 1;
2450
+ cGridBag bump = new cGridBag();
2451
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
2452
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2453
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
2454
+ textureSection.add(bump);
17502455
1751
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1752
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1753
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1754
- aConstraints.gridx += 1;
1755
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1756
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1757
- aConstraints.gridx = 0;
1758
- aConstraints.gridy += 1;
1759
- aConstraints.gridwidth = 1;
2456
+ cGridBag noise = new cGridBag();
2457
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
2458
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2459
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
2460
+ textureSection.add(noise);
17602461
1761
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1762
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1763
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1764
- aConstraints.gridx += 1;
1765
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1766
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1767
- aConstraints.gridx = 0;
1768
- aConstraints.gridy += 1;
1769
- aConstraints.gridwidth = 1;
2462
+ cGridBag power = new cGridBag();
2463
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
2464
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2465
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
2466
+ textureSection.add(power);
17702467
1771
- //aConstraints.weighty = 1;
1772
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1773
- //aConstraints.gridx += 1;
1774
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1775
- aConstraints.weighty = 0;
2468
+ cGridBag borderfade = new cGridBag();
2469
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
2470
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2471
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
2472
+ textureSection.add(borderfade);
17762473
1777
- aConstraints.gridx = 0;
1778
- aConstraints.gridy = 0;
1779
- aConstraints.gridwidth = 1;
2474
+ cGridBag fog = new cGridBag();
2475
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
2476
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2477
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
2478
+ textureSection.add(fog);
2479
+
2480
+ cGridBag opacityPower = new cGridBag();
2481
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
2482
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2483
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
2484
+ textureSection.add(opacityPower);
2485
+
2486
+ panel.add(GetSeparator());
2487
+
2488
+ panel.add(textureSection);
2489
+
2490
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17802491
17812492 SetMaterial(copy); // .GetMaterial());
17822493
1783
- colorField.addChangeListener(this);
1784
- modulationField.addChangeListener(this);
2494
+ //colorField.addChangeListener(this);
2495
+// modulationField.addChangeListener(this);
17852496 metalnessField.addChangeListener(this);
17862497 diffuseField.addChangeListener(this);
17872498 specularField.addChangeListener(this);
....@@ -1811,12 +2522,15 @@
18112522 opacityPowerField.addChangeListener(this);
18122523 /**/
18132524
1814
- resetSlidersButton.addActionListener(this);
18152525 clearMaterialButton.addActionListener(this);
18162526 createMaterialButton.addActionListener(this);
1817
-
1818
- propagateToggle.addItemListener(this);
1819
- multiplyToggle.addItemListener(this);
2527
+
2528
+ if (Globals.ADVANCED)
2529
+ {
2530
+ resetSlidersButton.addActionListener(this);
2531
+ propagateToggle.addItemListener(this);
2532
+ multiplyToggle.addItemListener(this);
2533
+ }
18202534 }
18212535
18222536 void DropFile(java.io.File[] files, boolean textures)
....@@ -1834,8 +2548,9 @@
18342548 // 3D models
18352549 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18362550 {
1837
- lastConverter = new com.jmex.model.converters.MaxToJme();
1838
- LoadFile(filename, lastConverter);
2551
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2552
+ //LoadFile(filename, lastConverter);
2553
+ LoadObjFile(filename); // New 3ds loader
18392554 continue;
18402555 }
18412556 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1987,7 +2702,7 @@
19872702
19882703 //? flashIt = false;
19892704 CameraPane pane = (CameraPane) cameraView;
1990
- pane.clickStart(location.x, location.y, 0);
2705
+ pane.clickStart(location.x, location.y, 0, 0);
19912706 pane.clickEnd(location.x, location.y, 0, true);
19922707
19932708 if (group.selection.size() == 1)
....@@ -2036,6 +2751,7 @@
20362751 e2.printStackTrace();
20372752 }
20382753 }
2754
+
20392755 LoadJMEThread loadThread;
20402756
20412757 class LoadJMEThread extends Thread
....@@ -2093,6 +2809,7 @@
20932809 //LoadFile0(filename, converter);
20942810 }
20952811 }
2812
+
20962813 LoadOBJThread loadObjThread;
20972814
20982815 class LoadOBJThread extends Thread
....@@ -2171,19 +2888,19 @@
21712888
21722889 void LoadObjFile(String fullname)
21732890 {
2174
- /*
2891
+ System.out.println("Loading " + fullname);
2892
+ /**/
21752893 //lastFilename = fullname;
21762894 if(loadObjThread == null)
21772895 {
2178
- loadObjThread = new LoadOBJThread();
2179
- loadObjThread.start();
2896
+ loadObjThread = new LoadOBJThread();
2897
+ loadObjThread.start();
21802898 }
21812899
21822900 loadObjThread.add(fullname);
2183
- */
2901
+ /**/
21842902
2185
- System.out.println("Loading " + fullname);
2186
- makeSomething(new FileObject(fullname, true), true);
2903
+ //makeSomething(new FileObject(fullname, true), true);
21872904 }
21882905
21892906 void LoadGFDFile(String fullname)
....@@ -2444,11 +3161,11 @@
24443161
24453162 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24463163 {
2447
- if (GrafreeD.standAlone)
3164
+ if (Grafreed.standAlone)
24483165 {
24493166 /**/
24503167 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2451
- browser.show();
3168
+ browser.setVisible(true);
24523169 String filename = browser.getFile();
24533170 if (filename != null && filename.length() > 0)
24543171 {
....@@ -2559,6 +3276,7 @@
25593276 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25603277 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25613278 }
3279
+
25623280 //cJME.count++;
25633281 //cJME.count %= 12;
25643282 if (gc)
....@@ -2593,6 +3311,7 @@
25933311 }
25943312 if (input == null)
25953313 {
3314
+ new Exception().printStackTrace();
25963315 System.exit(0);
25973316 }
25983317
....@@ -2741,6 +3460,7 @@
27413460 }
27423461 }
27433462 }
3463
+
27443464 cFileSystemPane FSPane;
27453465
27463466 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2750,7 +3470,7 @@
27503470
27513471 freezematerial = true;
27523472 colorField.setFloat(mat.color);
2753
- modulationField.setFloat(mat.modulation);
3473
+ saturationField.setFloat(mat.modulation);
27543474 metalnessField.setFloat(mat.metalness);
27553475 diffuseField.setFloat(mat.diffuse);
27563476 specularField.setFloat(mat.specular);
....@@ -2794,11 +3514,14 @@
27943514 }
27953515 }
27963516 }
3517
+
27973518 freezematerial = false;
27983519 }
27993520
28003521 void SetMaterial(Object3D object)
28013522 {
3523
+ latestObject = object;
3524
+
28023525 cMaterial mat = object.material;
28033526
28043527 if (mat == null)
....@@ -2807,7 +3530,8 @@
28073530 return;
28083531 }
28093532
2810
- multiplyToggle.setSelected(mat.multiply);
3533
+ if (multiplyToggle != null)
3534
+ multiplyToggle.setSelected(mat.multiply);
28113535
28123536 assert (object.projectedVertices != null);
28133537
....@@ -2909,12 +3633,17 @@
29093633 // }
29103634
29113635 /**/
2912
- if (deselect)
3636
+ if (deselect || child == null)
29133637 {
29143638 //group.deselectAll();
29153639 //freeze = true;
29163640 GetTree().clearSelection();
29173641 //freeze = false;
3642
+
3643
+ if (child == null)
3644
+ {
3645
+ return;
3646
+ }
29183647 }
29193648
29203649 //group.addSelectee(child);
....@@ -2948,6 +3677,17 @@
29483677 public void itemStateChanged(ItemEvent event)
29493678 {
29503679 // System.out.println("Propagate = " + propagate);
3680
+ if (event.getSource() == pinButton)
3681
+ {
3682
+ copy.pinned ^= true;
3683
+ if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
3684
+ {
3685
+ ((GroupEditor)copy.editWindow).listUI.remove(copy);
3686
+ copy.CloseUI();
3687
+ //copy.editWindow.refreshContents();
3688
+ }
3689
+ }
3690
+ else
29513691 if (event.getSource() == propagateToggle)
29523692 {
29533693 propagate ^= true;
....@@ -2983,7 +3723,7 @@
29833723 cameraView.ToggleDL();
29843724 cameraView.repaint();
29853725 return;
2986
- } else if (event.getSource() == toggleTextureItem)
3726
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29873727 {
29883728 cameraView.ToggleTexture();
29893729 // june 2013 copy.HardTouch();
....@@ -2996,7 +3736,8 @@
29963736 if (timeline)
29973737 {
29983738 centralPanel.remove(cameraView);
2999
- centralPanel.add(timelinePanel);
3739
+ cameraPanel.add(cameraView);
3740
+ centralPanel.add(cameraPanel);
30003741 frame.setJMenuBar(timelineMenubar);
30013742 wasFullScreen = CameraPane.FULLSCREEN;
30023743 if (!CameraPane.FULLSCREEN)
....@@ -3005,7 +3746,7 @@
30053746 }
30063747 else
30073748 {
3008
- centralPanel.remove(timelinePanel);
3749
+ centralPanel.remove(cameraPanel);
30093750 centralPanel.add(cameraView);
30103751 frame.setJMenuBar(null);
30113752 if (!wasFullScreen)
....@@ -3021,9 +3762,9 @@
30213762 frame.validate();
30223763
30233764 return;
3024
- } else if (event.getSource() == toggleRandomItem)
3765
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30253766 {
3026
- cameraView.ToggleRandom();
3767
+ cameraView.ToggleSwitch();
30273768 cameraView.repaint();
30283769 return;
30293770 } else if (event.getSource() == toggleHandleItem)
....@@ -3051,12 +3792,17 @@
30513792 } else if (event.getSource() == liveCB)
30523793 {
30533794 copy.live ^= true;
3795
+ objEditor.refreshContents(true); // To show item colors
3796
+ return;
3797
+ } else if (event.getSource() == selectableCB)
3798
+ {
3799
+ copy.dontselect ^= true;
30543800 return;
30553801 } else if (event.getSource() == hideCB)
30563802 {
30573803 copy.hide ^= true;
30583804 copy.Touch(); // display list issue
3059
- objEditor.refreshContents();
3805
+ objEditor.refreshContents(true); // To show item colors
30603806 return;
30613807 } else if (event.getSource() == link2masterCB)
30623808 {
....@@ -3066,6 +3812,7 @@
30663812 if (event.getSource() == randomCB)
30673813 {
30683814 copy.random ^= true;
3815
+ objEditor.refreshContents();
30693816 return;
30703817 }
30713818 if (event.getSource() == speedupCB)
....@@ -3089,8 +3836,9 @@
30893836
30903837 public void actionPerformed(ActionEvent event)
30913838 {
3839
+ Object source = event.getSource();
30923840 // SCRIPT DIALOG
3093
- if (event.getSource() == okbutton)
3841
+ if (source == okbutton)
30943842 {
30953843 textpanel.setVisible(false);
30963844 textpanel.remove(textarea);
....@@ -3102,7 +3850,7 @@
31023850 textarea = null;
31033851 textpanel = null;
31043852 }
3105
- if (event.getSource() == cancelbutton)
3853
+ if (source == cancelbutton)
31063854 {
31073855 textpanel.setVisible(false);
31083856 textpanel.remove(textarea);
....@@ -3114,49 +3862,50 @@
31143862 //applySelf();
31153863 //client.refreshEditWindow();
31163864 //refreshContents();
3117
- if (event.getSource() == nameField)
3865
+ if (source == nameField)
31183866 {
31193867 //System.out.println("ObjEditor " + event);
31203868 applySelf0(true);
31213869 //parent.applySelf();
31223870 objEditor.refreshContents();
3123
- } else if (event.getSource() == resetButton)
3871
+ } else if (source == resetButton)
31243872 {
31253873 CameraPane.fullreset = true;
31263874 copy.Reset(); // ResetMeshes();
31273875 copy.Touch();
31283876 objEditor.refreshContents();
3129
- } else if (event.getSource() == stepItem)
3877
+ } else if (source == stepItem)
31303878 {
3131
- cameraView.ONESTEP = true;
3879
+ //cameraView.ONESTEP = true;
3880
+ Globals.ONESTEP = true;
31323881 cameraView.repaint();
31333882 return;
3134
- } else if (event.getSource() == stepButton)
3883
+ } else if (source == stepButton)
31353884 {
31363885 copy.Step();
31373886 copy.Touch();
31383887 objEditor.refreshContents();
3139
- } else if (event.getSource() == slowerButton)
3888
+ } else if (source == slowerButton)
31403889 {
31413890 copy.Slower();
31423891 copy.Touch();
31433892 objEditor.refreshContents();
3144
- } else if (event.getSource() == fasterButton)
3893
+ } else if (source == fasterButton)
31453894 {
31463895 copy.Faster();
31473896 copy.Touch();
31483897 objEditor.refreshContents();
3149
- } else if (event.getSource() == remarkButton)
3898
+ } else if (source == remarkButton)
31503899 {
31513900 copy.Remark();
31523901 copy.Touch();
31533902 objEditor.refreshContents();
3154
- } else if (event.getSource() == stepAllButton)
3903
+ } else if (source == stepAllButton)
31553904 {
31563905 copy.StepAll();
31573906 copy.Touch();
31583907 objEditor.refreshContents();
3159
- } else if (event.getSource() == resetAllButton)
3908
+ } else if (source == resetAllButton)
31603909 {
31613910 //CameraPane.fullreset = true;
31623911 copy.ResetAll(); // ResetMeshes();
....@@ -3189,53 +3938,79 @@
31893938 // Close();
31903939 // }
31913940 // else
3192
- if (event.getSource() == resetSlidersButton)
3941
+ if (source == resetSlidersButton)
31933942 {
31943943 ResetSliders();
3195
- } else if (event.getSource() == clearMaterialButton)
3944
+ } else if (source == clearMaterialButton)
31963945 {
31973946 ClearMaterial();
3198
- } else if (event.getSource() == createMaterialButton)
3947
+ } else if (source == createMaterialButton)
31993948 {
32003949 CreateMaterial();
3201
- } else if (event.getSource() == clearPanelButton)
3950
+ } else if (source == clearPanelButton)
32023951 {
32033952 copy.ClearUI();
32043953 refreshContents(true);
3205
- } /*
3206
- }
3207
-
3208
- public boolean action(Event event, Object arg)
3209
- {
3210
- */ else if (event.getSource() == closeItem)
3954
+ } else if (source == importGFDItem)
3955
+ {
3956
+ ImportGFD();
3957
+ } else
3958
+ if (source == importVRMLX3DItem)
3959
+ {
3960
+ ImportVRMLX3D();
3961
+ } else
3962
+ if (source == import3DSItem)
3963
+ {
3964
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3965
+ } else
3966
+ if (source == importOBJItem)
3967
+ {
3968
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3969
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3970
+ browser.setVisible(true);
3971
+ String filename = browser.getFile();
3972
+ if (filename != null && filename.length() > 0)
3973
+ {
3974
+ String fullname = browser.getDirectory() + filename;
3975
+ makeSomething(ReadOBJ(fullname), true);
3976
+ }
3977
+ } else
3978
+ if (source == closeItem)
32113979 {
32123980 Close();
32133981 //return true;
3214
- } else if (event.getSource() == loadItem)
3982
+ } else if (source == openItem)
32153983 {
3216
- load();
3984
+ Open();
32173985 //return true;
3218
- } else if (event.getSource() == saveItem)
3986
+ } else if (source == newItem)
3987
+ {
3988
+ New();
3989
+ } else if (source == saveItem)
32193990 {
32203991 save();
32213992 //return true;
3222
- } else if (event.getSource() == saveAsItem)
3993
+ } else if (source == saveAsItem)
32233994 {
32243995 saveAs();
32253996 //return true;
3226
- } else if (event.getSource() == reexportItem)
3997
+ } else if (source == reexportItem)
32273998 {
32283999 reexport();
32294000 //return true;
3230
- } else if (event.getSource() == exportAsItem)
4001
+ } else if (source == exportAsItem)
32314002 {
32324003 export();
32334004 //return true;
3234
- } else if (event.getSource() == povItem)
4005
+ } else if (source == povItem)
32354006 {
32364007 generatePOV();
32374008 //return true;
3238
- } else if (event.getSource() == zBufferItem)
4009
+ } else if (event.getSource() == archiveItem)
4010
+ {
4011
+ cTools.Archive(frame);
4012
+ return;
4013
+ } else if (source == zBufferItem)
32394014 {
32404015 try
32414016 {
....@@ -3257,21 +4032,8 @@
32574032 cameraView.repaint();
32584033 //return true;
32594034 }
3260
- */ else if (event.getSource() == editCameraItem)
3261
- {
3262
- cameraView.ProtectCamera();
3263
- cameraView.repaint();
3264
- return;
3265
- } else if (event.getSource() == revertCameraItem)
3266
- {
3267
- cameraView.RevertCamera();
3268
- cameraView.repaint();
3269
- return;
3270
-// } else if (event.getSource() == textureButton)
3271
-// {
3272
-// return; // true;
3273
- } else // combos...
3274
- if (event.getSource() == texresMenu)
4035
+ */ else // combos...
4036
+ if (source == texresMenu)
32754037 {
32764038 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32774039 copy.texres = texresMenu.getSelectedIndex();
....@@ -3283,27 +4045,492 @@
32834045 }
32844046 }
32854047
3286
- void ToggleAnimation()
4048
+ void New()
32874049 {
3288
- if (!CameraPane.ANIMATION)
4050
+ while (copy.Size() > 1)
32894051 {
3290
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
4052
+ copy.remove(1);
4053
+ }
4054
+
4055
+ ResetModel();
4056
+ objEditor.refreshContents();
4057
+ }
4058
+
4059
+ static public byte[] Compress(Object3D o)
4060
+ {
4061
+ // Slower to actually compress.
4062
+ try
4063
+ {
4064
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
4065
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
4066
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
4067
+
4068
+ Object3D parent = o.parent;
4069
+ o.parent = null;
4070
+
4071
+ out.writeObject(o);
4072
+
4073
+ o.parent = parent;
4074
+
4075
+ out.flush();
4076
+
4077
+ baos //zstream
4078
+ .close();
4079
+ out.close();
4080
+
4081
+ byte[] bytes = baos.toByteArray();
4082
+
4083
+ System.out.println("save #bytes = " + bytes.length);
4084
+ return bytes;
4085
+ } catch (Exception e)
4086
+ {
4087
+ System.err.println(e);
4088
+ return null;
4089
+ }
4090
+ }
4091
+
4092
+ static public Object Uncompress(byte[] bytes)
4093
+ {
4094
+ System.out.println("restore #bytes = " + bytes.length);
4095
+ try
4096
+ {
4097
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
4098
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
4099
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
4100
+ Object obj = in.readObject();
4101
+
4102
+ bais //istream
4103
+ .close();
4104
+ in.close();
4105
+
4106
+ return obj;
4107
+ } catch (Exception e)
4108
+ {
4109
+ System.err.println(e);
4110
+ return null;
4111
+ }
4112
+ }
4113
+
4114
+ static public Object clone(Object o)
4115
+ {
4116
+ try
4117
+ {
4118
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
4119
+ ObjectOutputStream out = new ObjectOutputStream(baos);
4120
+
4121
+ out.writeObject(o);
4122
+
4123
+ out.flush();
4124
+ out.close();
4125
+
4126
+ byte[] bytes = baos.toByteArray();
4127
+
4128
+ System.out.println("clone = " + bytes.length);
4129
+
4130
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
4131
+ ObjectInputStream in = new ObjectInputStream(bais);
4132
+ Object obj = in.readObject();
4133
+ in.close();
4134
+
4135
+ return obj;
4136
+ } catch (Exception e)
4137
+ {
4138
+ System.err.println(e);
4139
+ return null;
4140
+ }
4141
+ }
4142
+
4143
+ cRadio GetCurrentTab()
4144
+ {
4145
+ cRadio ab;
4146
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
4147
+ {
4148
+ ab = (cRadio)e.nextElement();
4149
+ if(ab.GetObject() == copy)
4150
+ {
4151
+ return ab;
4152
+ }
4153
+ }
4154
+
4155
+ return null;
4156
+ }
4157
+
4158
+
4159
+ public void Save()
4160
+ {
4161
+ //Save(true);
4162
+ Replace();
4163
+ SetVersionStates();
4164
+ }
4165
+
4166
+ private boolean Equal(byte[] compress, byte[] name)
4167
+ {
4168
+ if (compress.length != name.length)
4169
+ {
4170
+ return false;
4171
+ }
4172
+
4173
+ for (int i=compress.length; --i>=0;)
4174
+ {
4175
+ if (compress[i] != name[i])
4176
+ return false;
4177
+ }
4178
+
4179
+ return true;
4180
+ }
4181
+
4182
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
4183
+
4184
+ void DeleteVersion()
4185
+ {
4186
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
4187
+ {
4188
+ copy.versionlist[i] = copy.versionlist[i+1];
4189
+ }
4190
+
4191
+ CopyChanged();
4192
+
4193
+ SetVersionStates();
4194
+ }
4195
+
4196
+ public boolean Save(boolean user)
4197
+ {
4198
+ System.err.println("Save");
4199
+ Replace();
4200
+
4201
+ //cRadio tab = GetCurrentTab();
4202
+
4203
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
4204
+
4205
+ boolean thesame = false;
4206
+
4207
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
4208
+// {
4209
+// thesame = true;
4210
+// }
4211
+
4212
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
4213
+ if (!thesame)
4214
+ {
4215
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4216
+ {
4217
+ copy.versionlist[i] = copy.versionlist[i-1];
4218
+ }
4219
+
4220
+ //tab.user[tab.versionindex] = user;
4221
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
4222
+
4223
+ copy.versionlist[++copy.versionindex] = compress;
4224
+
4225
+ // if (increment)
4226
+ // tab.versionindex++;
4227
+ }
4228
+
4229
+ //copy.RestoreBigData(versiontable);
4230
+
4231
+ //assert(hashtable.isEmpty());
4232
+
4233
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4234
+// {
4235
+// //tab.user[i] = false;
4236
+// copy.versionlist[i] = null;
4237
+// }
4238
+
4239
+ SetVersionStates();
4240
+
4241
+ // test save
4242
+ if (false)
4243
+ {
4244
+ try
4245
+ {
4246
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
4247
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
4248
+
4249
+ p.writeObject(copy);
4250
+
4251
+ p.flush();
4252
+
4253
+ ostream.close();
4254
+ } catch (Exception e)
4255
+ {
4256
+ e.printStackTrace();
4257
+ }
4258
+ }
4259
+
4260
+ return !thesame;
4261
+ }
4262
+
4263
+ boolean flashIt = true;
4264
+
4265
+ void RefreshSelection()
4266
+ {
4267
+ Object3D selection = new Object3D();
4268
+
4269
+ for (int i = 0; i < copy.selection.size(); i++)
4270
+ {
4271
+ Object3D elem = copy.selection.elementAt(i);
4272
+
4273
+ Object3D obj = copy.GetObject(elem.GetUUID());
4274
+
4275
+ if (obj == null)
4276
+ {
4277
+ copy.selection.remove(i--);
4278
+ }
4279
+ else
4280
+ {
4281
+ selection.add(obj);
4282
+ copy.selection.setElementAt(obj, i);
4283
+ }
4284
+ }
4285
+
4286
+ flashIt = false;
4287
+ GetTree().clearSelection();
4288
+ for (int i = 0; i < selection.size(); i++)
4289
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
4290
+ flashIt = true;
4291
+
4292
+ //refreshContents(false);
4293
+ }
4294
+
4295
+ void CopyChanged()
4296
+ {
4297
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4298
+
4299
+ SetVersionStates();
4300
+
4301
+ boolean temp = CameraPane.SWITCH;
4302
+ CameraPane.SWITCH = false;
4303
+
4304
+ copy.ExtractBigData(versiontable);
4305
+
4306
+ copy.clear();
4307
+
4308
+ copy.skyboxname = obj.skyboxname;
4309
+ copy.skyboxext = obj.skyboxext;
4310
+
4311
+ for (int i=0; i<obj.Size(); i++)
4312
+ {
4313
+ copy.add(obj.get(i));
4314
+ }
4315
+
4316
+ copy.RestoreBigData(versiontable);
4317
+
4318
+ CameraPane.SWITCH = temp;
4319
+
4320
+ RefreshSelection();
4321
+ //assert(hashtable.isEmpty());
4322
+
4323
+ copy.Touch();
4324
+
4325
+ ResetModel();
4326
+ copy.HardTouch(); // recompile?
4327
+
4328
+ cRadio ab;
4329
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
4330
+ {
4331
+ ab = (cRadio)e.nextElement();
4332
+ Object3D test = copy.GetObject(ab.object.GetUUID());
4333
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
4334
+ if (test != null)
4335
+ {
4336
+ test.editWindow = ab.object.editWindow;
4337
+ ab.object = test;
4338
+ }
4339
+ }
4340
+
4341
+ refreshContents(true);
4342
+ }
4343
+
4344
+ cButton previousVersionButton;
4345
+ cButton restoreButton;
4346
+ cButton replaceButton;
4347
+ cButton nextVersionButton;
4348
+ cButton saveVersionButton;
4349
+ cButton deleteVersionButton;
4350
+
4351
+ boolean muteSlider;
4352
+
4353
+ int VersionCount()
4354
+ {
4355
+ int count = 0;
4356
+
4357
+ for (int i = copy.versionlist.length; --i >= 0;)
4358
+ {
4359
+ if (copy.versionlist[i] != null)
4360
+ count++;
4361
+ }
4362
+
4363
+ return count;
4364
+ }
4365
+
4366
+ void SetVersionStates()
4367
+ {
4368
+ //if (true)
4369
+ // return;
4370
+
4371
+ //cRadio tab = GetCurrentTab();
4372
+
4373
+ restoreButton.setEnabled(copy.versionindex != -1);
4374
+ replaceButton.setEnabled(copy.versionindex != -1);
4375
+
4376
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4377
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4378
+
4379
+ deleteVersionButton.setEnabled(//copy.versionindex > 0 &&
4380
+ copy.versionlist[copy.versionindex + 1] != null);
4381
+
4382
+ muteSlider = true;
4383
+ versionSlider.setMinimum(0);
4384
+ versionSlider.setMaximum(VersionCount() - 1);
4385
+ versionSlider.setInteger(copy.versionindex);
4386
+ versionSlider.setEnabled(copy.versionindex != -1);
4387
+ muteSlider = false;
4388
+ }
4389
+
4390
+ public boolean PreviousVersion()
4391
+ {
4392
+ // Option?
4393
+ Replace();
4394
+
4395
+ System.err.println("Undo");
4396
+
4397
+ //cRadio tab = GetCurrentTab();
4398
+
4399
+ if (copy.versionindex == 0)
4400
+ {
4401
+ java.awt.Toolkit.getDefaultToolkit().beep();
4402
+ return false;
4403
+ }
4404
+
4405
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
4406
+// {
4407
+// if (Save(false))
4408
+// tab.versionindex -= 1;
4409
+// else
4410
+// {
4411
+// if (tab.versionindex <= 0)
4412
+// return false;
4413
+// else
4414
+// tab.versionindex -= 1;
4415
+// }
4416
+// }
4417
+
4418
+ copy.versionindex -= 1;
4419
+
4420
+ CopyChanged();
4421
+
4422
+ return true;
4423
+ }
4424
+
4425
+ public boolean Restore()
4426
+ {
4427
+ System.err.println("Restore");
4428
+
4429
+ //cRadio tab = GetCurrentTab();
4430
+
4431
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4432
+ {
4433
+ java.awt.Toolkit.getDefaultToolkit().beep();
4434
+ return false;
4435
+ }
4436
+
4437
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4438
+ CopyChanged();
4439
+
4440
+ return true;
4441
+ }
4442
+
4443
+ public boolean Replace()
4444
+ {
4445
+ System.err.println("Replace");
4446
+
4447
+ //cRadio tab = GetCurrentTab();
4448
+
4449
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4450
+ {
4451
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
4452
+ return false;
4453
+ }
4454
+
4455
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
4456
+
4457
+ return true;
4458
+ }
4459
+
4460
+ public void NextVersion()
4461
+ {
4462
+ // Option?
4463
+ Replace();
4464
+
4465
+ //cRadio tab = GetCurrentTab();
4466
+
4467
+ if (copy.versionlist[copy.versionindex + 1] == null)
4468
+ {
4469
+ java.awt.Toolkit.getDefaultToolkit().beep();
4470
+ return;
4471
+ }
4472
+
4473
+ copy.versionindex += 1;
4474
+
4475
+ CopyChanged();
4476
+
4477
+ //if (!tab.user[tab.versionindex])
4478
+ // tab.graphs[tab.versionindex] = null;
4479
+ }
4480
+
4481
+ void ImportGFD()
4482
+ {
4483
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32914484 browser.show();
32924485 String filename = browser.getFile();
32934486 if (filename != null && filename.length() > 0)
32944487 {
3295
- CameraPane.filename = browser.getDirectory() + filename;
4488
+ String fullname = browser.getDirectory() + filename;
4489
+
4490
+ //Object3D readobj =
4491
+ objEditor.ReadGFD(fullname, objEditor);
4492
+ //makeSomething(readobj);
4493
+ }
4494
+ }
4495
+
4496
+ void ImportVRMLX3D()
4497
+ {
4498
+ if (Grafreed.standAlone)
4499
+ {
4500
+ /**/
4501
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4502
+ browser.show();
4503
+ String filename = browser.getFile();
4504
+ if (filename != null && filename.length() > 0)
4505
+ {
4506
+ String fullname = browser.getDirectory() + filename;
4507
+ LoadVRMLX3D(fullname);
4508
+ }
4509
+ /**/
4510
+ }
4511
+ }
4512
+
4513
+ void ToggleAnimation()
4514
+ {
4515
+ if (!Globals.ANIMATION)
4516
+ {
4517
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
4518
+ browser.setVisible(true);
4519
+ String filename = browser.getFile();
4520
+ if (filename != null && filename.length() > 0)
4521
+ {
4522
+ Globals.filename = browser.getDirectory() + filename;
32964523 //CameraPane.framecount = 0;
3297
- CameraPane.imagecount = 0;
4524
+ Globals.imagecount = 0;
32984525
3299
- CameraPane.ANIMATION ^= true;
4526
+ Globals.ANIMATION ^= true;
33004527
3301
- GrafreeD.wav.cursor = 0;
3302
- GrafreeD.wav.loop = 0;
4528
+ Grafreed.wav.cursor = 0;
4529
+ Grafreed.wav.loop = 0;
33034530 }
33044531 } else
33054532 {
3306
- CameraPane.ANIMATION ^= true;
4533
+ Globals.ANIMATION ^= true;
33074534 }
33084535 }
33094536
....@@ -3349,7 +4576,7 @@
33494576 void CreateMaterial()
33504577 {
33514578 //copy.ClearMaterial(); // PATCH
3352
- copy.CreateMaterialS(multiplyToggle.isSelected());
4579
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33534580 if (copy.selection.size() > 0)
33544581 //SetMaterial(copy);
33554582 {
....@@ -3400,7 +4627,7 @@
34004627 assert false;
34014628 }
34024629
3403
- void EditSelection()
4630
+ void EditSelection(boolean newWindow)
34044631 {
34054632 }
34064633
....@@ -3408,11 +4635,11 @@
34084635 {
34094636 copy.ResetBlockLoop(); // temporary problem
34104637
3411
- boolean random = CameraPane.RANDOM;
3412
- CameraPane.RANDOM = false; // parse everything
4638
+ boolean random = CameraPane.SWITCH;
4639
+ CameraPane.SWITCH = false; // parse everything
34134640 copy.ResetDisplayList();
34144641 copy.HardTouch();
3415
- CameraPane.RANDOM = random;
4642
+ CameraPane.SWITCH = random;
34164643 }
34174644
34184645 // public void applySelf()
....@@ -3459,7 +4686,7 @@
34594686 //copy.material = new cMaterial(copy.GetMaterial());
34604687
34614688 current.color = (float) colorField.getFloat();
3462
- current.modulation = (float) modulationField.getFloat();
4689
+ current.modulation = (float) saturationField.getFloat();
34634690 current.metalness = (float) metalnessField.getFloat();
34644691 current.diffuse = (float) diffuseField.getFloat();
34654692 current.specular = (float) specularField.getFloat();
....@@ -3482,10 +4709,40 @@
34824709 current.fakedepth = (float) fakedepthField.getFloat();
34834710 current.shadowbias = (float) shadowbiasField.getFloat();
34844711
3485
- if (!NumberSlider.frozen)
4712
+ if (!cNumberSlider.frozen)
34864713 {
34874714 //System.out.println("Propagate = " + propagate);
34884715 copy.UpdateMaterial(anchor, current, propagate);
4716
+
4717
+ if (copy.material != null)
4718
+ {
4719
+ cMaterial mat = copy.material;
4720
+
4721
+ colorField.SetToolTipValue((mat.color));
4722
+ saturationField.SetToolTipValue((mat.modulation));
4723
+ metalnessField.SetToolTipValue((mat.metalness));
4724
+ diffuseField.SetToolTipValue((mat.diffuse));
4725
+ specularField.SetToolTipValue((mat.specular));
4726
+ shininessField.SetToolTipValue((mat.shininess));
4727
+ shiftField.SetToolTipValue((mat.shift));
4728
+ ambientField.SetToolTipValue((mat.ambient));
4729
+ lightareaField.SetToolTipValue((mat.lightarea));
4730
+ diffusenessField.SetToolTipValue((mat.factor));
4731
+ velvetField.SetToolTipValue((mat.velvet));
4732
+ sheenField.SetToolTipValue((mat.sheen));
4733
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4734
+ backlitField.SetToolTipValue((mat.bump));
4735
+ anisoField.SetToolTipValue((mat.aniso));
4736
+ anisoVField.SetToolTipValue((mat.anisoV));
4737
+ cameraField.SetToolTipValue((mat.cameralight));
4738
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4739
+ shadowField.SetToolTipValue((mat.shadow));
4740
+ textureField.SetToolTipValue((mat.texture));
4741
+ opacityField.SetToolTipValue((mat.opacity));
4742
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4743
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4744
+ }
4745
+
34894746 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34904747 {
34914748 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3514,9 +4771,26 @@
35144771 //copy.Touch();
35154772 }
35164773
4774
+ cNumberSlider versionSlider;
4775
+
35174776 public void stateChanged(ChangeEvent e)
35184777 {
35194778 // assert(false);
4779
+ if (e.getSource() == versionSlider)
4780
+ {
4781
+ if (muteSlider)
4782
+ return;
4783
+
4784
+ int version = versionSlider.getInteger();
4785
+
4786
+ if (version != -1 && copy.versionlist[version] != null)
4787
+ {
4788
+ copy.versionindex = version;
4789
+ CopyChanged();
4790
+ }
4791
+
4792
+ return;
4793
+ }
35204794
35214795 if (freezematerial)
35224796 {
....@@ -3530,6 +4804,7 @@
35304804 || e.getSource() == apertureField
35314805 || e.getSource() == shadowblurField)
35324806 {
4807
+ new Exception().printStackTrace();
35334808 System.exit(0);
35344809 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35354810 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3551,6 +4826,12 @@
35514826 {
35524827 //System.out.println("stateChanged = " + this);
35534828 materialtouched = true;
4829
+
4830
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
4831
+ {
4832
+ saturationField.setFloat(1);
4833
+ }
4834
+
35544835 applySelf();
35554836 //System.out.println("this = " + this);
35564837 //System.out.println("PARENT = " + parent);
....@@ -3600,7 +4881,7 @@
36004881 }
36014882
36024883 if (normalpushField != null)
3603
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
4884
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36044885 }
36054886
36064887 void SnapObject()
....@@ -3850,20 +5131,26 @@
38505131 {
38515132 if (GetTree() != null)
38525133 {
5134
+ GetTree().revalidate();
38535135 GetTree().repaint();
38545136 }
38555137
38565138 radioPanel.revalidate();
38575139 radioPanel.repaint();
3858
- ctrlPanel.revalidate(); // ? new
5140
+ ctrlPanel.validate(); // ? new
38595141 ctrlPanel.repaint();
38605142 }
5143
+
5144
+ if (previousVersionButton != null && copy.versionlist != null)
5145
+ SetVersionStates();
38615146 }
38625147
38635148 static TweenManager tweenManager = new TweenManager();
38645149
38655150 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38665151 {
5152
+ if (Globals.REPLACEONMAKE) // && resetmodel)
5153
+ Save();
38675154 //Tween.set(thing, 0).target(1).start(tweenManager);
38685155 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38695156 // if (thing instanceof GenericJointDemo)
....@@ -3950,6 +5237,12 @@
39505237 {
39515238 ResetModel();
39525239 Select(thing.GetTreePath(), true, false); // unselect... false);
5240
+
5241
+ if (thing.Size() == 0)
5242
+ {
5243
+ //EditSelection(false);
5244
+ }
5245
+
39535246 refreshContents();
39545247 }
39555248
....@@ -4067,6 +5360,7 @@
40675360 }
40685361 }
40695362 }
5363
+
40705364 LoadGFDThread loadGFDThread;
40715365
40725366 void ReadGFD(String fullname, iCallBack cb)
....@@ -4086,8 +5380,10 @@
40865380
40875381 try
40885382 {
5383
+ // Try compressed version first.
40895384 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4090
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
5385
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
5386
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40915387
40925388 readobj = (Object3D) p.readObject();
40935389 istream.close();
....@@ -4095,7 +5391,22 @@
40955391 readobj.ResetDisplayList();
40965392 } catch (Exception e)
40975393 {
4098
- e.printStackTrace();
5394
+ if (!e.toString().contains("GZIP"))
5395
+ e.printStackTrace();
5396
+
5397
+ try
5398
+ {
5399
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
5400
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
5401
+
5402
+ readobj = (Object3D) p.readObject();
5403
+ istream.close();
5404
+
5405
+ readobj.ResetDisplayList();
5406
+ } catch (Exception e2)
5407
+ {
5408
+ e2.printStackTrace();
5409
+ }
40995410 }
41005411 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41015412 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4141,6 +5452,12 @@
41415452
41425453 void LoadIt(Object obj)
41435454 {
5455
+ if (obj == null)
5456
+ {
5457
+ // Invalid file
5458
+ return;
5459
+ }
5460
+
41445461 System.out.println("Loaded " + obj);
41455462 //new Exception().printStackTrace();
41465463 Object3D readobj = (Object3D) obj;
....@@ -4150,10 +5467,14 @@
41505467
41515468 if (readobj != null)
41525469 {
5470
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
5471
+ // Save();
41535472 try
41545473 {
41555474 //readobj.deepCopySelf(copy);
41565475 copy.clear(); // june 2014
5476
+ copy.skyboxname = readobj.skyboxname;
5477
+ copy.skyboxext = readobj.skyboxext;
41575478 for (int i = 0; i < readobj.size(); i++)
41585479 {
41595480 Object3D child = readobj.get(i); // reserve(i);
....@@ -4194,6 +5515,7 @@
41945515 }
41955516 } catch (ClassCastException e)
41965517 {
5518
+ e.printStackTrace();
41975519 assert (false);
41985520 Composite c = (Composite) copy;
41995521 c.children.clear();
....@@ -4204,17 +5526,31 @@
42045526 c.addChild(csg);
42055527 }
42065528
5529
+ copy.versionlist = readobj.versionlist;
5530
+ copy.versionindex = readobj.versionindex;
5531
+
5532
+ if (copy.versionlist == null)
5533
+ {
5534
+ // Backward compatibility
5535
+ copy.versionlist = new Object3D[100];
5536
+ copy.versionindex = -1;
5537
+
5538
+ Save(true);
5539
+ }
5540
+
5541
+ //? SetUndoStates();
5542
+
42075543 ResetModel();
42085544 copy.HardTouch(); // recompile?
42095545 refreshContents();
42105546 }
42115547 }
42125548
4213
- void load() // throws ClassNotFoundException
5549
+ void Open() // throws ClassNotFoundException
42145550 {
4215
- if (GrafreeD.standAlone)
5551
+ if (Grafreed.standAlone)
42165552 {
4217
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5553
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
42185554 browser.show();
42195555 String filename = browser.getFile();
42205556 if (filename != null && filename.length() > 0)
....@@ -4291,6 +5627,8 @@
42915627
42925628 void save()
42935629 {
5630
+ Replace();
5631
+
42945632 if (lastname == null)
42955633 {
42965634 return;
....@@ -4299,11 +5637,13 @@
42995637 try
43005638 {
43015639 FileOutputStream ostream = new FileOutputStream(lastname);
4302
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5640
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5641
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43035642
43045643 p.writeObject(copy);
43055644 p.flush();
43065645
5646
+ zstream.close();
43075647 ostream.close();
43085648
43095649 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4311,19 +5651,23 @@
43115651 //ps.print(buffer.toString());
43125652 } catch (IOException e)
43135653 {
5654
+ e.printStackTrace();
43145655 }
43155656 }
5657
+
43165658 String lastname;
43175659
43185660 void saveAs()
43195661 {
4320
- if (GrafreeD.standAlone)
5662
+ if (Grafreed.standAlone)
43215663 {
43225664 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43235665 browser.setVisible(true);
43245666 String filename = browser.getFile();
43255667 if (filename != null && filename.length() > 0)
43265668 {
5669
+ if (!filename.endsWith(".gfd"))
5670
+ filename += ".gfd";
43275671 lastname = browser.getDirectory() + filename;
43285672 save();
43295673 }
....@@ -4422,13 +5766,13 @@
44225766 try
44235767 {
44245768 FileOutputStream ostream = new FileOutputStream(filename);
4425
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4426
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5769
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5770
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44275771
44285772 Object3D objectparent = obj.parent;
44295773 obj.parent = null;
44305774
4431
- Object3D object = (Object3D) GrafreeD.clone(obj);
5775
+ Object3D object = (Object3D) Grafreed.clone(obj);
44325776
44335777 obj.parent = objectparent;
44345778
....@@ -4440,8 +5784,8 @@
44405784 p.writeObject(object);
44415785 p.flush();
44425786
5787
+ zstream.close();
44435788 ostream.close();
4444
- // zstream.close();
44455789
44465790 // group.selection.get(0).parent = parent;
44475791 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4462,7 +5806,7 @@
44625806 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44635807 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44645808 copy.generatePOV(buffer);
4465
- if (GrafreeD.standAlone)
5809
+ if (Grafreed.standAlone)
44665810 {
44675811 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44685812 browser.show();
....@@ -4488,21 +5832,20 @@
44885832 Object3D client;
44895833 Object3D copy;
44905834 MenuBar menuBar;
4491
- Menu windowMenu;
4492
- MenuItem loadItem;
5835
+ Menu fileMenu;
5836
+ MenuItem newItem;
5837
+ MenuItem openItem;
44935838 MenuItem saveItem;
44945839 MenuItem saveAsItem;
44955840 MenuItem exportAsItem;
44965841 MenuItem reexportItem;
44975842 MenuItem povItem;
44985843 MenuItem closeItem;
4499
- Menu cameraMenu;
5844
+
45005845 CheckboxMenuItem zBufferItem;
45015846 //MenuItem normalLensItem;
4502
- MenuItem editCameraItem;
4503
- MenuItem revertCameraItem;
4504
- CheckboxMenuItem toggleLiveItem;
45055847 MenuItem stepItem;
5848
+ CheckboxMenuItem toggleLiveItem;
45065849 CheckboxMenuItem toggleFullScreenItem;
45075850 CheckboxMenuItem toggleTimelineItem;
45085851 CheckboxMenuItem toggleRenderItem;
....@@ -4511,28 +5854,44 @@
45115854 CheckboxMenuItem toggleFootContactItem;
45125855 CheckboxMenuItem toggleDLItem;
45135856 CheckboxMenuItem toggleTextureItem;
4514
- CheckboxMenuItem toggleRandomItem;
5857
+ CheckboxMenuItem toggleSwitchItem;
45155858 CheckboxMenuItem toggleRootItem;
45165859 CheckboxMenuItem animationItem;
5860
+ MenuItem archiveItem;
45175861 CheckboxMenuItem toggleHandleItem;
45185862 CheckboxMenuItem togglePaintItem;
45195863 JSplitPane mainPanel;
45205864 JScrollPane scrollpane;
5865
+
45215866 JPanel toolbarPanel;
4522
- JPanel treePanel;
5867
+
5868
+ cGridBag treePanel;
5869
+
45235870 JPanel radioPanel;
45245871 ButtonGroup buttonGroup;
4525
- JPanel ctrlPanel;
4526
- JPanel materialPanel;
5872
+
5873
+ cGridBag toolboxPanel;
5874
+ cGridBag skyboxPanel;
5875
+ cGridBag materialPanel;
5876
+ cGridBag ctrlPanel;
5877
+
45275878 JScrollPane infoPanel;
4528
- JPanel optionsPanel;
5879
+
5880
+ cGridBag optionsPanel;
5881
+
45295882 JTabbedPane objectPanel;
4530
- JPanel XYZPanel;
5883
+ boolean materialFlushed;
5884
+ Object3D latestObject;
5885
+
5886
+ cGridBag XYZPanel;
5887
+
45315888 JSplitPane gridPanel;
45325889 JSplitPane bigPanel;
4533
- JPanel bigThree;
4534
- JTabbedPane scenePanel;
4535
- JPanel centralPanel;
5890
+
5891
+ cGridBag bigThree;
5892
+ cGridBag scenePanel;
5893
+ cGridBag centralPanel;
5894
+ JSplitPane cameraPanel;
45365895 JPanel timelinePanel;
45375896 JMenuBar timelineMenubar;
45385897 JSplitPane framePanel;
....@@ -4584,67 +5943,74 @@
45845943 // MATERIAL
45855944 JLabel materialLabel;
45865945 JLabel colorLabel;
4587
- NumberSlider colorField;
5946
+ cNumberSlider colorField;
45885947 JLabel modulationLabel;
4589
- NumberSlider modulationField;
5948
+ cNumberSlider saturationField;
45905949 JLabel metalnessLabel;
4591
- NumberSlider metalnessField;
5950
+ cNumberSlider metalnessField;
45925951 JLabel diffuseLabel;
4593
- NumberSlider diffuseField;
5952
+ cNumberSlider diffuseField;
45945953 JLabel specularLabel;
4595
- NumberSlider specularField;
5954
+ cNumberSlider specularField;
45965955 JLabel shininessLabel;
4597
- NumberSlider shininessField;
5956
+ cNumberSlider shininessField;
45985957 JLabel shiftLabel;
4599
- NumberSlider shiftField;
5958
+ cNumberSlider shiftField;
46005959 JLabel ambientLabel;
4601
- NumberSlider ambientField;
5960
+ cNumberSlider ambientField;
46025961 JLabel lightareaLabel;
4603
- NumberSlider lightareaField;
5962
+ cNumberSlider lightareaField;
46045963 JLabel diffusenessLabel;
4605
- NumberSlider diffusenessField;
5964
+ cNumberSlider diffusenessField;
46065965 JLabel velvetLabel;
4607
- NumberSlider velvetField;
5966
+ cNumberSlider velvetField;
46085967 JLabel sheenLabel;
4609
- NumberSlider sheenField;
5968
+ cNumberSlider sheenField;
46105969 JLabel subsurfaceLabel;
4611
- NumberSlider subsurfaceField;
5970
+ cNumberSlider subsurfaceField;
46125971 //JLabel bumpLabel;
46135972 //NumberSlider bumpField;
46145973 JLabel backlitLabel;
4615
- NumberSlider backlitField;
5974
+ cNumberSlider backlitField;
46165975 JLabel anisoLabel;
4617
- NumberSlider anisoField;
5976
+ cNumberSlider anisoField;
46185977 JLabel anisoVLabel;
4619
- NumberSlider anisoVField;
5978
+ cNumberSlider anisoVField;
5979
+
46205980 JLabel cameraLabel;
4621
- NumberSlider cameraField;
5981
+ cNumberSlider cameraField;
46225982 JLabel selfshadowLabel;
4623
- NumberSlider selfshadowField;
5983
+ cNumberSlider selfshadowField;
46245984 JLabel shadowLabel;
4625
- NumberSlider shadowField;
5985
+ cNumberSlider shadowField;
46265986 JLabel textureLabel;
4627
- NumberSlider textureField;
5987
+ cNumberSlider textureField;
46285988 JLabel opacityLabel;
4629
- NumberSlider opacityField;
5989
+ cNumberSlider opacityField;
46305990 JLabel fakedepthLabel;
4631
- NumberSlider fakedepthField;
5991
+ cNumberSlider fakedepthField;
46325992 JLabel shadowbiasLabel;
4633
- NumberSlider shadowbiasField;
5993
+ cNumberSlider shadowbiasField;
5994
+
46345995 JLabel bumpLabel;
4635
- NumberSlider bumpField;
5996
+ cNumberSlider bumpField;
46365997 JLabel noiseLabel;
4637
- NumberSlider noiseField;
5998
+ cNumberSlider noiseField;
46385999 JLabel powerLabel;
4639
- NumberSlider powerField;
6000
+ cNumberSlider powerField;
46406001 JLabel borderfadeLabel;
4641
- NumberSlider borderfadeField;
6002
+ cNumberSlider borderfadeField;
46426003 JLabel fogLabel;
4643
- NumberSlider fogField;
6004
+ cNumberSlider fogField;
46446005 JLabel opacityPowerLabel;
4645
- NumberSlider opacityPowerField;
4646
- JTree jTree;
6006
+ cNumberSlider opacityPowerField;
6007
+ cTree jTree;
46476008 //ObjectUI parent;
46486009
4649
- NumberSlider normalpushField;
6010
+ cNumberSlider normalpushField;
6011
+
6012
+ private MenuItem importGFDItem;
6013
+ private MenuItem importVRMLX3DItem;
6014
+ private MenuItem import3DSItem;
6015
+ private MenuItem importOBJItem;
46506016 }