Normand Briere
2019-08-17 07c0c67b88160b51e61c5c1d2b9b602daafa44a9
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.*;
....@@ -13,6 +14,9 @@
1314 import javax.swing.plaf.metal.MetalLookAndFeel;
1415 //import javax.swing.plaf.ColorUIResource;
1516 //import javax.swing.plaf.metal.DefaultMetalTheme;
17
+
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
1620
1721 //import javax.media.opengl.GLCanvas;
1822
....@@ -30,11 +34,128 @@
3034 iSendInfo
3135 //KeyListener
3236 {
37
+ public cToggleButton pinButton;
3338 boolean timeline;
3439 boolean wasFullScreen;
3540
3641 GroupEditor callee;
3742 JFrame frame;
43
+
44
+ static ObjEditor theFrame;
45
+
46
+ public void AllocProjectedVertices(Object3D object)
47
+ {
48
+ assert (object.projectedVertices != null);
49
+
50
+ if (object.projectedVertices.length <= 2)
51
+ {
52
+ // Side effect...
53
+ Object3D.cVector2[] keep = object.projectedVertices;
54
+ object.projectedVertices = new Object3D.cVector2[3];
55
+ for (int i = 0; i < 3; i++)
56
+ {
57
+ if (i < keep.length)
58
+ {
59
+ object.projectedVertices[i] = keep[i];
60
+ } else
61
+ {
62
+ object.projectedVertices[i] = new Object3D.cVector2();
63
+ }
64
+ /*
65
+ if(keep.length == 0)
66
+ object.projectedVertices[0] = new Object3D.cVector2();
67
+ else
68
+ object.projectedVertices[0] = keep[0];
69
+ object.projectedVertices[1] = new Object3D.cVector2();
70
+ */
71
+ }
72
+ }
73
+ }
74
+
75
+ public cGridBag GetSeparator()
76
+ {
77
+ cGridBag separator = new cGridBag();
78
+ separator.add(new JSeparator());
79
+ separator.preferredHeight = 5;
80
+ return separator;
81
+ }
82
+
83
+ cButton GetButton(String name, boolean border)
84
+ {
85
+ ImageIcon icon = GetIcon(name);
86
+ return new cButton(icon, border);
87
+ }
88
+
89
+ cLabel GetLabel(String name, boolean border)
90
+ {
91
+ //ImageIcon icon = GetIcon(name);
92
+ return new cLabel(GetImage(name), border);
93
+ }
94
+
95
+ cToggleButton GetToggleButton(String name, boolean border)
96
+ {
97
+ ImageIcon icon = GetIcon(name);
98
+ return new cToggleButton(icon, border);
99
+ }
100
+
101
+ cCheckBox GetCheckBox(String name, boolean border)
102
+ {
103
+ ImageIcon icon = GetIcon(name);
104
+ return new cCheckBox(icon, border);
105
+ }
106
+
107
+ static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>();
108
+
109
+ ImageIcon GetIcon(String name)
110
+ {
111
+ javax.swing.ImageIcon iconCache = icons.get(name);
112
+ if (iconCache != null)
113
+ {
114
+ return iconCache;
115
+ }
116
+
117
+ try
118
+ {
119
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
120
+
121
+// if (image.getWidth() > 48 && image.getHeight() > 48)
122
+// {
123
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
124
+// Graphics2D g = resized.createGraphics();
125
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
126
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
127
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
128
+// g.dispose();
129
+//
130
+// image = resized;
131
+// }
132
+
133
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
134
+
135
+ icons.put(name, icon);
136
+
137
+ return icon;
138
+ }
139
+ catch (Exception e)
140
+ {
141
+ //icons.put(name, null);
142
+ return null;
143
+ }
144
+ }
145
+
146
+ BufferedImage GetImage(String name)
147
+ {
148
+ try
149
+ {
150
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
151
+
152
+ return image;
153
+ }
154
+ catch (Exception e)
155
+ {
156
+ return null;
157
+ }
158
+ }
38159
39160 // SCRIPT
40161
....@@ -138,34 +259,42 @@
138259 public void closeUI()
139260 {
140261 //new Exception().printStackTrace();
141
- System.out.println("this = " + this);
142
- System.out.println("objEditor = " + objEditor);
262
+// System.out.println("this = " + this);
263
+// System.out.println("objEditor = " + objEditor);
143264 //nameField.removeActionListener(this);
144
- objEditor.ctrlPanel.remove(nameField);
265
+// objEditor.ctrlPanel.remove(nameField);
145266
146
- if (!GroupEditor.allparams)
267
+ objEditor.ctrlPanel.remove(namePanel);
268
+
269
+ if (!allparams)
147270 return;
148271
149
- objEditor.ctrlPanel.remove(liveCB);
150
- objEditor.ctrlPanel.remove(hideCB);
151
- objEditor.ctrlPanel.remove(markCB);
152
-
153
- objEditor.ctrlPanel.remove(randomCB);
154
- objEditor.ctrlPanel.remove(speedupCB);
155
- objEditor.ctrlPanel.remove(rewindCB);
156
-
157
- objEditor.ctrlPanel.remove(resetButton);
158
- objEditor.ctrlPanel.remove(stepButton);
159
-// objEditor.ctrlPanel.remove(stepAllButton);
160
-// objEditor.ctrlPanel.remove(resetAllButton);
161
- objEditor.ctrlPanel.remove(link2masterCB);
162
- //objEditor.ctrlPanel.remove(flipVCB);
163
- //objEditor.ctrlPanel.remove(texresMenu);
164
- objEditor.ctrlPanel.remove(slowerButton);
165
- objEditor.ctrlPanel.remove(fasterButton);
166
- objEditor.ctrlPanel.remove(remarkButton);
272
+// objEditor.ctrlPanel.remove(liveCB);
273
+// objEditor.ctrlPanel.remove(hideCB);
274
+// objEditor.ctrlPanel.remove(markCB);
275
+//
276
+// objEditor.ctrlPanel.remove(randomCB);
277
+// objEditor.ctrlPanel.remove(speedupCB);
278
+// objEditor.ctrlPanel.remove(rewindCB);
279
+//
280
+// objEditor.ctrlPanel.remove(resetButton);
281
+// objEditor.ctrlPanel.remove(stepButton);
282
+//// objEditor.ctrlPanel.remove(stepAllButton);
283
+//// objEditor.ctrlPanel.remove(resetAllButton);
284
+// objEditor.ctrlPanel.remove(link2masterCB);
285
+// //objEditor.ctrlPanel.remove(flipVCB);
286
+// //objEditor.ctrlPanel.remove(texresMenu);
287
+// objEditor.ctrlPanel.remove(slowerButton);
288
+// objEditor.ctrlPanel.remove(fasterButton);
289
+// objEditor.ctrlPanel.remove(remarkButton);
167290
168
- Remove(normalpushField);
291
+ objEditor.ctrlPanel.remove(setupPanel);
292
+ objEditor.ctrlPanel.remove(setupPanel2);
293
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
294
+ objEditor.ctrlPanel.remove(pushPanel);
295
+ //objEditor.ctrlPanel.remove(fillPanel);
296
+
297
+ //Remove(normalpushField);
169298 }
170299
171300 public ObjEditor GetEditor()
....@@ -209,6 +338,14 @@
209338 client = inClient;
210339 copy = client;
211340
341
+// if (copy.versionlist == null)
342
+// {
343
+// copy.versionlist = new Object3D[100];
344
+// copy.versionindex = -1;
345
+//
346
+// callee.Save(true);
347
+// }
348
+
212349 // "this" is not called: SetupUI2(objEditor);
213350 }
214351
....@@ -222,6 +359,14 @@
222359 client = inClient;
223360 copy = client;
224361
362
+ if (copy.versionlist == null)
363
+ {
364
+ copy.versionlist = new Object3D[100];
365
+ copy.versionindex = -1;
366
+
367
+// Save(true);
368
+ }
369
+
225370 SetupUI2(callee.GetEditor());
226371 }
227372
....@@ -236,13 +381,15 @@
236381 //localCopy.parent = null;
237382
238383 frame = new JFrame();
384
+ frame.setUndecorated(false);
239385 objEditor = this;
240386 this.callee = callee;
241387
242388 //parent = p;
243389
244390 GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
245
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
391
+ if (Globals.DEBUG)
392
+ System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
246393 //gd.setFullScreenWindow(this);
247394 //setResizable(false);
248395 //if (!isDisplayable())
....@@ -253,6 +400,14 @@
253400 copy = localCopy;
254401 copy.editWindow = this;
255402
403
+// if (copy.versionlist == null)
404
+// {
405
+// copy.versionlist = new Object3D[100];
406
+// copy.versionindex = -1;
407
+//
408
+// Save(true);
409
+// }
410
+
256411 SetupMenu();
257412
258413 //SetupName(objEditor); // new
....@@ -266,28 +421,52 @@
266421 return frame.action(event, obj);
267422 }
268423
424
+ // Cannot work without static
425
+ static boolean allparams = true;
426
+
427
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
428
+
429
+ // This is to refresh the UI of the material panel.
430
+ boolean patchMaterial;
431
+
269432 void SetupMenu()
270433 {
271434 frame.setMenuBar(menuBar = new MenuBar());
272
- menuBar.add(windowMenu = new Menu("File"));
273
- windowMenu.add(loadItem = new MenuItem("Load..."));
274
- windowMenu.add("-");
275
- windowMenu.add(saveItem = new MenuItem("Save"));
276
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
435
+ menuBar.add(fileMenu = new Menu("File"));
436
+ fileMenu.add(newItem = new MenuItem("New"));
437
+ fileMenu.add(openItem = new MenuItem("Open..."));
438
+
439
+ //oe.menuBar.add(menu = new Menu("Include"));
440
+ Menu menu = new Menu("Import");
441
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
442
+ importOBJItem.addActionListener(this);
443
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
444
+ import3DSItem.addActionListener(this);
445
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
446
+ importVRMLX3DItem.addActionListener(this);
447
+ menu.add("-");
448
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
449
+ importGFDItem.addActionListener(this);
450
+ fileMenu.add(menu);
451
+ fileMenu.add("-");
452
+
453
+ fileMenu.add(saveItem = new MenuItem("Save"));
454
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
277455 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
278
- windowMenu.add("-");
279
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
280
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
281
- windowMenu.add("-");
456
+ fileMenu.add("-");
457
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
458
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
459
+ fileMenu.add("-");
282460 if (client.parent != null)
283461 {
284
- windowMenu.add(closeItem = new MenuItem("Close"));
462
+ fileMenu.add(closeItem = new MenuItem("Close"));
285463 } else
286464 {
287
- windowMenu.add(closeItem = new MenuItem("Exit"));
465
+ fileMenu.add(closeItem = new MenuItem("Exit"));
288466 }
289467
290
- loadItem.addActionListener(this);
468
+ newItem.addActionListener(this);
469
+ openItem.addActionListener(this);
291470 saveItem.addActionListener(this);
292471 saveAsItem.addActionListener(this);
293472 exportAsItem.addActionListener(this);
....@@ -295,82 +474,103 @@
295474 //povItem.addActionListener(this);
296475 closeItem.addActionListener(this);
297476
298
- menuBar.add(cameraMenu = new Menu("View"));
299
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
300
- //zBufferItem.addActionListener(this);
301
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
302
- //normalLensItem.addActionListener(this);
303
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
304
- revertCameraItem.addActionListener(this);
305
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
306
- toggleTimelineItem.addItemListener(this);
307
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
308
- toggleFullScreenItem.addItemListener(this);
309
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
310
- cameraMenu.add("-");
311
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
312
- toggleTextureItem.addItemListener(this);
313
- toggleTextureItem.setState(CameraPane.textureon);
314
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
315
- toggleLiveItem.addItemListener(this);
316
- toggleLiveItem.setState(Globals.isLIVE());
317
- cameraMenu.add(stepItem = new MenuItem("Step"));
318
- stepItem.addActionListener(this);
319
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
320
-// toggleDLItem.addItemListener(this);
321
-// toggleDLItem.setState(false);
322
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
323
- toggleRenderItem.addItemListener(this);
324
- toggleRenderItem.setState(!CameraPane.frozen);
325
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
326
- toggleDebugItem.addItemListener(this);
327
- toggleDebugItem.setState(CameraPane.DEBUG);
328
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
329
- toggleFrustumItem.addItemListener(this);
330
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
331
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
332
- toggleFootContactItem.addItemListener(this);
333
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
334
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
335
- toggleRandomItem.addItemListener(this);
336
- toggleRandomItem.setState(CameraPane.RANDOM);
337
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
338
- toggleHandleItem.addItemListener(this);
339
- toggleHandleItem.setState(CameraPane.HANDLES);
340
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
341
- togglePaintItem.addItemListener(this);
342
- togglePaintItem.setState(CameraPane.PAINTMODE);
343
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
344
-// toggleRootItem.addItemListener(this);
345
-// toggleRootItem.setState(false);
346
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
347
-// animationItem.addItemListener(this);
348
-// animationItem.setState(CameraPane.ANIMATION);
349
- cameraMenu.add("-");
350
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
351
- editCameraItem.addActionListener(this);
352
-
353477 objectPanel = new JTabbedPane();
478
+
479
+ ChangeListener changeListener = new ChangeListener()
480
+ {
481
+ //String name;
482
+
483
+ public void stateChanged(ChangeEvent changeEvent)
484
+ {
485
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
486
+// {
487
+// if (latestObject != null)
488
+// {
489
+// refreshContents(true);
490
+// SetMaterial(latestObject);
491
+// }
492
+//
493
+// materialFlushed = true;
494
+// }
495
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
496
+// {
497
+// if (listUI.size() == 0)
498
+// EditSelection(false);
499
+// }
500
+
501
+// if (objectPanel.getSelectedIndex() == 4)
502
+// {
503
+// name = copy.skyboxname;
504
+//
505
+// if (name == null)
506
+// {
507
+// name = "";
508
+// }
509
+//
510
+// copy.skyboxname = "cubemaps/default-skyboxes/rgb";
511
+// copy.skyboxext = "jpg";
512
+// }
513
+// else
514
+// {
515
+// if (name != null)
516
+// {
517
+// if (name.equals(""))
518
+// {
519
+// copy.skyboxname = null;
520
+// copy.skyboxext = null;
521
+// }
522
+// else
523
+// {
524
+// copy.skyboxname = name;
525
+// }
526
+// }
527
+// }
528
+ cameraView.transformMode = objectPanel.getSelectedIndex() == 4;
529
+
530
+// refreshContents(false); // To refresh Info tab
531
+ cameraView.repaint();
532
+ }
533
+ };
534
+ objectPanel.addChangeListener(changeListener);
535
+
354536 toolbarPanel = new JPanel();
355537 toolbarPanel.setName("Toolbar");
356
- treePanel = new JPanel();
538
+
539
+ treePanel = new cGridBag();
357540 treePanel.setName("Tree");
358
- ctrlPanel = new JPanel(); // new GridBagLayout());
359
- ctrlPanel.setName("Edit");
360
- materialPanel = new JPanel();
361
- materialPanel.setName("Material");
541
+
542
+ editPanel = new cGridBag().setVertical(true);
543
+ //editPanel.setName("Edit");
544
+
545
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
546
+
547
+ editCommandsPanel = new cGridBag();
548
+ editPanel.add(editCommandsPanel);
549
+ editPanel.add(ctrlPanel);
550
+
551
+ toolboxPanel = new cGridBag().setVertical(true);
552
+ //toolboxPanel.setName("Toolbox");
553
+
554
+ skyboxPanel = new cGridBag().setVertical(true);
555
+
556
+ materialPanel = new cGridBag().setVertical(false);
557
+ //materialPanel.setName("Material");
558
+
362559 /*JTextPane*/
363560 infoarea = createTextPane();
561
+ doc = infoarea.getStyledDocument();
562
+
364563 infoarea.setEditable(true);
365564 SetText();
565
+
366566 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
367567 // infoarea.setOpaque(false);
368568 // //infoarea.setForeground(textcolor);
369
- infoarea.setLineWrap(true);
370
- infoarea.setWrapStyleWord(true);
569
+// TEXTAREA infoarea.setLineWrap(true);
570
+// TEXTAREA infoarea.setWrapStyleWord(true);
371571 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
372
- infoPanel.setPreferredSize(new Dimension(50, 200));
373
- infoPanel.setName("Info");
572
+ infoPanel.setPreferredSize(new Dimension(1, 1));
573
+ //infoPanel.setName("Info");
374574 //infoPanel.setLayout(new BorderLayout());
375575 //infoPanel.add(createTextPane());
376576
....@@ -378,16 +578,23 @@
378578 mainPanel.setName("Main");
379579 mainPanel.setContinuousLayout(true);
380580 mainPanel.setOneTouchExpandable(true);
381
- mainPanel.setDividerLocation(1.0);
382581 mainPanel.setDividerSize(9);
383
- mainPanel.setResizeWeight(0);
384
-
582
+ mainPanel.setDividerLocation(0.5); //1.0);
583
+ mainPanel.setResizeWeight(0.5);
584
+
585
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
586
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
587
+ divider.setDividerSize(15);
588
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
589
+
590
+ mainPanel.setUI(new BasicSplitPaneUI());
591
+
385592 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
386593 //mainPanel.setLayout(new GridBagLayout());
387594 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
388
- treePanel.setLayout(new GridBagLayout());
389
- ctrlPanel.setLayout(new GridBagLayout());
390
- materialPanel.setLayout(new GridBagLayout());
595
+// treePanel.setLayout(new GridBagLayout());
596
+ //ctrlPanel.setLayout(new GridBagLayout());
597
+ //materialPanel.setLayout(new GridBagLayout());
391598
392599 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
393600 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -426,7 +633,7 @@
426633 static String newline = "\n";
427634 protected static final String buttonString = "JButton";
428635 StyledDocument doc;
429
- JTextArea infoarea;
636
+ JTextPane infoarea;
430637
431638 void ClearInfo()
432639 {
....@@ -449,10 +656,10 @@
449656 e.printStackTrace();
450657 }
451658
452
- String selection = infoarea.getText();
453
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
454
- java.awt.datatransfer.Clipboard clipboard =
455
- Toolkit.getDefaultToolkit().getSystemClipboard();
659
+// String selection = infoarea.getText();
660
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
661
+// java.awt.datatransfer.Clipboard clipboard =
662
+// Toolkit.getDefaultToolkit().getSystemClipboard();
456663 //clipboard.setContents(data, data);
457664 }
458665
....@@ -475,13 +682,13 @@
475682 //SendInfo("Name:", "bold");
476683 if (sel.GetTextures() != null || debug)
477684 {
478
- si.SendInfo(sel.toString(), "bold");
685
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
479686 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
480687 if (sel.Size() > 0)
481688 {
482689 si.SendInfo("#children = " + sel.Size(), "regular");
483690 }
484
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
691
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
485692 if (debug)
486693 {
487694 try
....@@ -493,7 +700,10 @@
493700 }
494701
495702 if (full)
496
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
703
+ {
704
+ si.SendInfo(" BBox min: " + minima, "regular");
705
+ si.SendInfo(" BBox max: " + maxima, "regular");
706
+ }
497707
498708 if (sel.bRep != null)
499709 {
....@@ -520,7 +730,7 @@
520730 }
521731 if (sel.support != null)
522732 {
523
- si.SendInfo(" support: " + sel.support, "regular");
733
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
524734 }
525735 if (sel.scriptnode != null)
526736 {
....@@ -591,6 +801,9 @@
591801 {
592802 CameraPane.pointflow = (PointFlow) sel;
593803 }
804
+
805
+ si.SendInfo("_____________________", "regular");
806
+ si.SendInfo("", "regular");
594807 }
595808 }
596809
....@@ -606,68 +819,211 @@
606819 }
607820 }
608821
822
+//static GraphicsDevice device = GraphicsEnvironment
823
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
824
+
825
+ Rectangle keeprect;
826
+ cRadio radio;
827
+
828
+cButton keepButton;
829
+ cButton twoButton; // Full 3D
830
+ cButton sixButton;
831
+ cButton threeButton;
832
+ cButton sevenButton;
833
+ cButton fourButton; // full panel
834
+ cButton oneButton; // full XYZ
835
+ //cButton currentLayout;
836
+
837
+ boolean maximized;
838
+
839
+ cButton fullscreenLayout;
840
+ cButton expandedLayout;
841
+
842
+ void Minimize()
843
+ {
844
+ frame.setState(Frame.ICONIFIED);
845
+ frame.validate();
846
+ }
847
+
848
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
849
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
850
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
851
+ void Maximize()
852
+ {
853
+ if (CameraPane.FULLSCREEN)
854
+ {
855
+ ToggleFullScreen();
856
+ }
857
+
858
+ if (maximized)
859
+ {
860
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
861
+ }
862
+ else
863
+ {
864
+ keeprect = frame.getBounds();
865
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
866
+// Dimension rect2 = frame.getToolkit().getScreenSize();
867
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
868
+// frame.setState(Frame.MAXIMIZED_BOTH);
869
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
870
+ }
871
+
872
+ maximized ^= true;
873
+
874
+ frame.validate();
875
+ }
876
+
877
+ cButton minButton;
878
+ cButton maxButton;
879
+ cButton fullButton;
880
+ cButton collapseButton;
881
+ cButton maximize3DButton;
882
+
609883 void ToggleFullScreen()
610884 {
611
- if (CameraPane.FULLSCREEN)
885
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
886
+
887
+ cameraView.ToggleFullScreen();
888
+
889
+ if (!CameraPane.FULLSCREEN)
612890 {
613
- frame.getContentPane().remove(/*"Center",*/bigThree);
614
- framePanel.add(bigThree);
615
- frame.getContentPane().add(/*"Center",*/framePanel);
891
+ device.setFullScreenWindow(null);
892
+ frame.dispose();
893
+ frame.setUndecorated(false);
894
+ frame.validate();
895
+ frame.setVisible(true);
896
+
897
+ //frame.setVisible(false);
898
+// frame.removeNotify();
899
+// frame.setUndecorated(false);
900
+// frame.addNotify();
901
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
902
+
903
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
904
+// X framePanel.add(bigThree);
905
+// X frame.getContentPane().add(/*"Center",*/framePanel);
906
+// framePanel.setDividerLocation(46); // icons are 24x24
907
+
908
+ //frame.setVisible(true);
909
+// radio.layout = keepButton;
910
+ //theFrame = null;
911
+ keepButton = null;
912
+// radio.layout.doClick();
913
+
616914 } else
617915 {
618
- frame.getContentPane().remove(/*"Center",*/framePanel);
619
- framePanel.remove(bigThree);
620
- frame.getContentPane().add(/*"Center",*/bigThree);
916
+ keepButton = radio.layout;
917
+ //keeprect = frame.getBounds();
918
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
919
+// frame.getToolkit().getScreenSize().height);
920
+ //frame.setVisible(false);
921
+
922
+ frame.dispose();
923
+ frame.setUndecorated(true);
924
+ device.setFullScreenWindow(frame);
925
+ frame.validate();
926
+ frame.setVisible(true);
927
+// frame.removeNotify();
928
+// frame.setUndecorated(true);
929
+// frame.addNotify();
930
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
931
+// X framePanel.remove(bigThree);
932
+// X frame.getContentPane().add(/*"Center",*/bigThree);
933
+// framePanel.setDividerLocation(0);
934
+
935
+// radio.layout = fullscreenLayout;
936
+// radio.layout.doClick();
937
+ //frame.setVisible(true);
621938 }
622
- cameraView.ToggleFullScreen();
939
+ frame.validate();
940
+
941
+ cameraView.requestFocusInWindow();
623942 }
624943
625
- private JTextArea createTextPane()
944
+ void CollapseToolbar()
945
+ {
946
+ framePanel.setDividerLocation(0);
947
+ //frame.validate();
948
+
949
+ cameraView.requestFocusInWindow();
950
+ }
951
+
952
+ private Object3D Duplicate(Object3D object)
626953 {
627
- String[] initString =
628
- {
629
- "This is an editable JTextPane, ", //regular
630
- "another ", //italic
631
- "styled ", //bold
632
- "text ", //small
633
- "component, ", //large
634
- "which supports embedded components..." + newline,//regular
635
- " " + newline, //button
636
- "...and embedded icons..." + newline, //regular
637
- " ", //icon
638
- newline + "JTextPane is a subclass of JEditorPane that "
639
- + "uses a StyledEditorKit and StyledDocument, and provides "
640
- + "cover methods for interacting with those objects."
641
- };
954
+ boolean temp = CameraPane.SWITCH;
955
+ CameraPane.SWITCH = false;
956
+
957
+ if (Grafreed.grafreed.universe.versiontable == null)
958
+ Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
959
+
960
+ object.ExtractBigData(Grafreed.grafreed.universe.versiontable);
961
+ // if (copy == client)
962
+
963
+ Object3D versions[] = object.versionlist;
964
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe
965
+ object.versionlist = null;
966
+ object.versiontable = null;
967
+
968
+ //byte[] compress = Compress(copy);
969
+ Object3D compress = (Object3D)Grafreed.clone(object);
970
+
971
+ object.versionlist = versions;
972
+ object.versiontable = versiontable; // if Grafreed.grafreed.universe
973
+
974
+ object.RestoreBigData(Grafreed.grafreed.universe.versiontable);
975
+
976
+ CameraPane.SWITCH = temp;
977
+
978
+ return compress;
979
+ }
642980
643
- String[] initStyles =
644
- {
645
- "regular", "italic", "bold", "small", "large",
646
- "regular", "button", "regular", "icon",
647
- "regular"
648
- };
981
+ private JTextPane createTextPane()
982
+ {
983
+// TEXTAREA String[] initString =
984
+// {
985
+// "This is an editable JTextPane, ", //regular
986
+// "another ", //italic
987
+// "styled ", //bold
988
+// "text ", //small
989
+// "component, ", //large
990
+// "which supports embedded components..." + newline,//regular
991
+// " " + newline, //button
992
+// "...and embedded icons..." + newline, //regular
993
+// " ", //icon
994
+// newline + "JTextPane is a subclass of JEditorPane that "
995
+// + "uses a StyledEditorKit and StyledDocument, and provides "
996
+// + "cover methods for interacting with those objects."
997
+// };
998
+//
999
+// String[] initStyles =
1000
+// {
1001
+// "regular", "italic", "bold", "small", "large",
1002
+// "regular", "button", "regular", "icon",
1003
+// "regular"
1004
+// };
1005
+//
1006
+// JTextPane textPane = new JTextPane();
1007
+// textPane.setEditable(true);
1008
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
1009
+// addStylesToDocument(doc);
1010
+//
1011
+// try
1012
+// {
1013
+// for (int j = 0; j < 2; j++)
1014
+// {
1015
+// for (int i = 0; i < initString.length; i++)
1016
+// {
1017
+// doc.insertString(doc.getLength(), initString[i],
1018
+// doc.getStyle(initStyles[i]));
1019
+// }
1020
+// }
1021
+// } catch (BadLocationException ble)
1022
+// {
1023
+// System.err.println("Couldn't insert initial text into text pane.");
1024
+// }
6491025
650
- JTextPane textPane = new JTextPane();
651
- textPane.setEditable(true);
652
- /*StyledDocument*/ doc = textPane.getStyledDocument();
653
- addStylesToDocument(doc);
654
-
655
- try
656
- {
657
- for (int j = 0; j < 2; j++)
658
- {
659
- for (int i = 0; i < initString.length; i++)
660
- {
661
- doc.insertString(doc.getLength(), initString[i],
662
- doc.getStyle(initStyles[i]));
663
- }
664
- }
665
- } catch (BadLocationException ble)
666
- {
667
- System.err.println("Couldn't insert initial text into text pane.");
668
- }
669
-
670
- return new JTextArea(); // textPane;
1026
+ return new JTextPane(); // textPane;
6711027 }
6721028
6731029 protected void addStylesToDocument(StyledDocument doc)
....@@ -720,7 +1076,7 @@
7201076 protected static ImageIcon createImageIcon(String path,
7211077 String description)
7221078 {
723
- java.net.URL imgURL = GrafreeD.class.getResource(path);
1079
+ java.net.URL imgURL = Grafreed.class.getResource(path);
7241080 if (imgURL != null)
7251081 {
7261082 return new ImageIcon(imgURL, description);
....@@ -743,6 +1099,7 @@
7431099 {
7441100 SetupMaterial(materialPanel);
7451101 }
1102
+
7461103 //SetupName();
7471104 //SetupViews();
7481105 }
....@@ -752,6 +1109,7 @@
7521109 // NumberSlider vDivsField;
7531110 // JCheckBox endcaps;
7541111 JCheckBox liveCB;
1112
+ JCheckBox selectableCB;
7551113 JCheckBox hideCB;
7561114 JCheckBox link2masterCB;
7571115 JCheckBox markCB;
....@@ -759,7 +1117,12 @@
7591117 JCheckBox speedupCB;
7601118 JCheckBox rewindCB;
7611119 JCheckBox flipVCB;
1120
+
1121
+ cCheckBox toggleTextureCB;
1122
+ cCheckBox toggleSwitchCB;
1123
+
7621124 JComboBox texresMenu;
1125
+
7631126 JButton resetButton;
7641127 JButton stepButton;
7651128 JButton stepAllButton;
....@@ -767,115 +1130,87 @@
7671130 JButton slowerButton;
7681131 JButton fasterButton;
7691132 JButton remarkButton;
1133
+
1134
+ cGridBag editPanel;
1135
+ cGridBag editCommandsPanel;
1136
+
1137
+ cGridBag namePanel;
1138
+ cGridBag setupPanel;
1139
+ cGridBag setupPanel2;
1140
+ cGridBag objectCommandsPanel;
1141
+ cGridBag pushPanel;
1142
+ cGridBag fillPanel;
7701143
771
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1144
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7721145 {
7731146 JCheckBox cb;
7741147
775
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
776
- oe.aConstraints.gridwidth = 1; // 3;
777
-// oe.aConstraints.weightx = 1;
778
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
779
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1148
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7801149 cb.addItemListener(this);
781
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
782
- oe.aConstraints.gridwidth = 1;
783
- oe.aConstraints.gridx += 1;
7841150
7851151 return cb;
7861152 }
7871153
788
- cButton AddButton(ObjEditor oe, String label)
1154
+ cButton AddButton(cGridBag panel, String label)
7891155 {
7901156 cButton cb;
7911157
792
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
793
- oe.aConstraints.gridwidth = 1;
794
-// oe.aConstraints.weightx = 1;
795
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
796
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1158
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7971159 cb.addActionListener(this);
798
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
799
- oe.aConstraints.gridwidth = 1;
800
- oe.aConstraints.gridx += 1;
8011160
8021161 return cb;
8031162 }
8041163
805
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1164
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
8061165 {
8071166 JComboBox combo;
8081167
809
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
810
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
811
- oe.aConstraints.gridx += 1;
1168
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8121169 combo.addActionListener(this);
8131170
8141171 return combo;
8151172 }
8161173
817
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
1174
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
8181175 {
819
- NumberSlider combo;
1176
+ cGridBag control = new cGridBag();
1177
+
1178
+ cNumberSlider combo;
8201179
8211180 JLabel jlabel = new JLabel(label);
822
-
823
- aConstraints.fill = GridBagConstraints.VERTICAL;
8241181 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
825
- aConstraints.gridwidth = 1;
826
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827
- aConstraints.gridx += 1;
828
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
829
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
830
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
831
- aConstraints.gridx += 1;
832
- aConstraints.gridwidth = 1;
833
-
1182
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1183
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8341184 combo.setFloat(current);
835
-
836
- combo.label = jlabel;
837
-
838
- combo.addChangeListener(this);
839
-
840
- return combo;
1185
+
1186
+ panel.add(control);
1187
+
1188
+ return control;
8411189 }
8421190
843
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
1191
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8441192 {
845
- NumberSlider combo;
1193
+ cGridBag control = new cGridBag();
1194
+
1195
+ cNumberSlider combo;
8461196
8471197 JLabel jlabel = new JLabel(label);
848
-
849
- aConstraints.fill = GridBagConstraints.VERTICAL;
8501198 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
851
- aConstraints.gridwidth = 2;
852
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
853
- aConstraints.gridx += 1;
854
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
855
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
856
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
857
- aConstraints.gridx += 1;
858
- aConstraints.gridwidth = 1;
859
-
1199
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1200
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8601201 combo.setInteger(current);
8611202
862
- combo.label = jlabel;
863
-
864
- combo.addChangeListener(this);
865
-
866
- return combo;
1203
+ panel.add(control);
1204
+
1205
+ return control;
8671206 }
8681207
869
- JTextArea AddText(JPanel ctrlPanel, String name)
1208
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8701209 {
8711210 JTextArea text;
8721211
873
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
874
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
875
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1212
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8761213 text.addCaretListener(this);
877
- aConstraints.gridx += 1;
878
- aConstraints.gridwidth = 1;
8791214
8801215 return text;
8811216 }
....@@ -905,9 +1240,16 @@
9051240 objEditor.ctrlPanel.remove(j);
9061241 }
9071242
1243
+ void Remove(cNumberSlider j)
1244
+ {
1245
+ j.removeChangeListener(this);
1246
+ //objEditor.ctrlPanel.remove(j.label);
1247
+ objEditor.ctrlPanel.remove(j);
1248
+ }
1249
+
9081250 /*
9091251 */
910
- void Return() // ObjEditor oe)
1252
+ void Return0() // ObjEditor oe)
9111253 {
9121254 aConstraints.gridy += 1;
9131255 aConstraints.gridx = 0;
....@@ -962,37 +1304,92 @@
9621304
9631305 void SetupUI2(ObjEditor oe)
9641306 {
965
-// oe.aConstraints.weightx = 0;
966
-// oe.aConstraints.weighty = 0;
967
-// oe.aConstraints.gridx = 0;
968
-// oe.aConstraints.gridy = 0;
969
- SetupName(oe);
1307
+ //SetupName(oe);
9701308
971
- if (!GroupEditor.allparams)
1309
+ namePanel = new cGridBag();
1310
+
1311
+ //if (copy.pinned)
1312
+ {
1313
+ pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1314
+ pinButton.setSelected(copy.pinned);
1315
+ cGridBag t = new cGridBag();
1316
+ t.preferredWidth = 2;
1317
+ t.add(pinButton);
1318
+ namePanel.add(t);
1319
+
1320
+ pinButton.addItemListener(this);
1321
+ }
1322
+
1323
+ nameField = AddText(namePanel, copy.GetName());
1324
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
1325
+ oe.ctrlPanel.add(namePanel);
1326
+
1327
+ oe.ctrlPanel.Return();
1328
+
1329
+ if (!allparams)
9721330 return;
9731331
974
- liveCB = AddCheckBox(oe, "Live", copy.live);
975
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
976
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1332
+ setupPanel = new cGridBag().setVertical(false);
1333
+
1334
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1335
+ liveCB.setToolTipText("Animate object");
1336
+ markCB = AddCheckBox(setupPanel, "Anim", copy.marked);
1337
+ markCB.setToolTipText("Set target transform");
1338
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1339
+ selectableCB.setToolTipText("Make object selectable");
9771340 // Return();
978
- markCB = AddCheckBox(oe, "Mark", copy.marked);
979
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
980
- randomCB = AddCheckBox(oe, "Rand", copy.random);
981
- Return();
982
- resetButton = AddButton(oe, "Reset");
983
- stepButton = AddButton(oe, "Step");
1341
+
1342
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1343
+ hideCB.setToolTipText("Hide object");
1344
+
1345
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
1346
+
1347
+ setupPanel2 = new cGridBag().setVertical(false);
1348
+
1349
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1350
+ rewindCB.setToolTipText("Rewind animation");
1351
+
1352
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1353
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1354
+
1355
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1356
+ link2masterCB.setToolTipText("Attach to support");
1357
+
1358
+ if (Globals.ADVANCED)
1359
+ {
1360
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1361
+ speedupCB.setToolTipText("Option motion capture");
1362
+ }
1363
+
1364
+ oe.ctrlPanel.add(setupPanel);
1365
+ oe.ctrlPanel.Return();
1366
+ oe.ctrlPanel.add(setupPanel2);
1367
+ oe.ctrlPanel.Return();
1368
+
1369
+ objectCommandsPanel = new cGridBag().setVertical(false);
1370
+
1371
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1372
+ resetButton.setToolTipText("Jump to frame zero");
1373
+ stepButton = AddButton(objectCommandsPanel, "Step");
1374
+ stepButton.setToolTipText("Step one frame");
9841375 // resetAllButton = AddButton(oe, "Reset All");
9851376 // stepAllButton = AddButton(oe, "Step All");
986
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9871377 // Return();
988
- slowerButton = AddButton(oe, "Slow");
989
- fasterButton = AddButton(oe, "Fast");
990
- remarkButton = AddButton(oe, "Rem");
1378
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1379
+ slowerButton.setToolTipText("Decrease animation speed");
1380
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1381
+ fasterButton.setToolTipText("Increase animation speed");
1382
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1383
+ remarkButton.setToolTipText("Set the current transform as the target");
9911384
992
- Return();
1385
+ oe.ctrlPanel.add(objectCommandsPanel);
1386
+ oe.ctrlPanel.Return();
9931387
994
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
995
- Return();
1388
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1389
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1390
+ //Return();
1391
+
1392
+ oe.ctrlPanel.Return();
9961393
9971394 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9981395 // ObjEditor.aConstraints.gridx += 1;
....@@ -1087,7 +1484,7 @@
10871484 oe.aConstraints.gridwidth = 1;
10881485 /**/
10891486 nameField = AddText(oe.ctrlPanel, copy.GetName());
1090
- Return();
1487
+ oe.ctrlPanel.Return();
10911488
10921489 //ctrlPanel.add(textureButton = new Button("Texture..."));
10931490 //textureButton.setEnabled(false);
....@@ -1145,6 +1542,7 @@
11451542
11461543 if (cam == null || !(copy.get(0) instanceof cGroup))
11471544 {
1545
+ if (Globals.DEBUG)
11481546 System.out.println("CREATE CAMERAS");
11491547 cams = new cTemplate();
11501548 cams.name = "Cameras";
....@@ -1189,9 +1587,13 @@
11891587 //JPanel worldPanel =
11901588 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11911589 //worldPanel.setName("World");
1192
- centralPanel = new JPanel(new BorderLayout());
1193
- timelinePanel = new JPanel(new BorderLayout());
1194
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1590
+ centralPanel = new cGridBag();
1591
+ centralPanel.preferredWidth = 20;
1592
+
1593
+ if (Globals.ADVANCED)
1594
+ {
1595
+ timelinePanel = new JPanel(new BorderLayout());
1596
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11951597
11961598 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11971599 cameraPanel.setContinuousLayout(true);
....@@ -1200,7 +1602,10 @@
12001602 // cameraPanel.setDividerSize(9);
12011603 cameraPanel.setResizeWeight(1.0);
12021604
1605
+ }
1606
+
12031607 centralPanel.add(cameraView);
1608
+ centralPanel.setFocusable(true);
12041609 //frame.setJMenuBar(timelineMenubar);
12051610 //centralPanel.add(timelinePanel);
12061611
....@@ -1222,9 +1627,11 @@
12221627 XYZPanel = new cGridBag().setVertical(true);
12231628 //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12241629
1630
+ XYZPanel.preferredWidth = 5;
12251631 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
12261632 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
12271633 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1634
+ //XYZPanel.setName("XYZ");
12281635
12291636 /*
12301637 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1261,13 +1668,34 @@
12611668
12621669 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12631670 //tmp.setName("Edit");
1264
- objectPanel.add(materialPanel);
1265
- JPanel north = new JPanel(new BorderLayout());
1266
- north.setName("Edit");
1267
- north.add(ctrlPanel, BorderLayout.NORTH);
1268
- objectPanel.add(north);
1269
- objectPanel.add(infoPanel);
1671
+ objectPanel.add(toolboxPanel);
1672
+ objectPanel.setIconAt(0, GetIcon("icons/primitives.png"));
1673
+ objectPanel.setToolTipTextAt(0, "Objects & textures");
12701674
1675
+ objectPanel.add(materialPanel);
1676
+ objectPanel.setIconAt(1, GetIcon("icons/material.png"));
1677
+ objectPanel.setToolTipTextAt(1, "Material");
1678
+
1679
+ objectPanel.add(skyboxPanel);
1680
+ objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1681
+ objectPanel.setToolTipTextAt(2, "Backgrounds");
1682
+
1683
+// JPanel north = new JPanel(new BorderLayout());
1684
+// north.setName("Edit");
1685
+// north.add(ctrlPanel, BorderLayout.NORTH);
1686
+// objectPanel.add(north);
1687
+ objectPanel.add(editPanel);
1688
+ objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1689
+ objectPanel.setToolTipTextAt(3, "Edit controls");
1690
+
1691
+ objectPanel.add(XYZPanel);
1692
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1693
+ objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
1694
+
1695
+ patchMaterial = true;
1696
+ cameraView.patchMaterial = this;
1697
+ objectPanel.setSelectedIndex(1);
1698
+
12711699 /*
12721700 aConstraints.gridx = 0;
12731701 aConstraints.gridwidth = 1;
....@@ -1275,7 +1703,7 @@
12751703 aConstraints.gridy += 1;
12761704 aConstraints.gridwidth = 1;
12771705 mainPanel.add(objectPanel, aConstraints);
1278
- */
1706
+ */
12791707
12801708 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12811709 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1286,20 +1714,29 @@
12861714 scrollpane.setWheelScrollingEnabled(true);
12871715 scrollpane.addMouseWheelListener(this); // Default not fast enough
12881716
1289
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1290
- scenePanel.add(scrollpane);
1717
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1718
+ scenePanel.preferredWidth = 5;
1719
+
1720
+ JTabbedPane tabbedPane = new JTabbedPane();
1721
+ tabbedPane.add(scrollpane);
12911722
1292
- scenePanel.add(FSPane = new cFileSystemPane(this));
1293
-
1294
- optionsPanel = new JPanel(new GridBagLayout());
1723
+ optionsPanel = new cGridBag().setVertical(false);
12951724
12961725 optionsPanel.setName("Options");
12971726
1298
- AddOptions(optionsPanel, aConstraints);
1727
+ AddOptions(optionsPanel); //, aConstraints);
12991728
1300
- scenePanel.add(optionsPanel);
1729
+ tabbedPane.add(optionsPanel);
1730
+
1731
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
13011732
1733
+ scenePanel.add(tabbedPane);
13021734
1735
+ //if (Globals.ADVANCED)
1736
+// tabbedPane.add(infoPanel);
1737
+// tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1738
+// tabbedPane.setToolTipTextAt(3, "Information");
1739
+
13031740 /*
13041741 cTree jTree = new cTree(null);
13051742 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1361,7 +1798,7 @@
13611798 bigThree = new cGridBag();
13621799 bigThree.addComponent(scenePanel);
13631800 bigThree.addComponent(centralPanel);
1364
- bigThree.addComponent(XYZPanel);
1801
+ //bigThree.addComponent(XYZPanel);
13651802
13661803 // // SIDE EFFECT!!!
13671804 // aConstraints.gridx = 0;
....@@ -1370,16 +1807,33 @@
13701807 // aConstraints.gridheight = 1;
13711808
13721809 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1373
- framePanel.setContinuousLayout(true);
1374
- framePanel.setOneTouchExpandable(true);
1375
- framePanel.setDividerLocation(0.8);
1810
+
1811
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
1812
+ new java.beans.PropertyChangeListener()
1813
+ {
1814
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
1815
+ {
1816
+ if ((Integer)pce.getOldValue() == 1)
1817
+ {
1818
+ if (radio.layout != expandedLayout)
1819
+ {
1820
+ radio.layout = expandedLayout;
1821
+ radio.layout.doClick();
1822
+ }
1823
+ }
1824
+ }
1825
+ });
1826
+
1827
+ framePanel.setContinuousLayout(false);
1828
+ framePanel.setOneTouchExpandable(false);
1829
+ //.setDividerLocation(0.8);
13761830 //framePanel.setDividerSize(15);
13771831 //framePanel.setResizeWeight(0.15);
13781832 framePanel.setName("Frame");
13791833
13801834 frame.getContentPane().setLayout(new BorderLayout());
13811835 /**/
1382
- JTabbedPane worldPane = new JTabbedPane();
1836
+ //JTabbedPane worldPane = new JTabbedPane();
13831837 //worldPane.add(bigPanel);
13841838 //worldPane.add(worldPanel);
13851839 /**/
....@@ -1389,15 +1843,19 @@
13891843
13901844 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13911845
1392
- frame.setSize(1024, 768);
1393
- frame.show();
1394
-
1846
+ frame.setSize(1280, 860);
1847
+
1848
+ cameraView.requestFocusInWindow();
1849
+
13951850 gridPanel.setDividerLocation(1.0);
1851
+
1852
+ frame.validate();
1853
+
1854
+ frame.setVisible(true);
13961855
13971856 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13981857 frame.addWindowListener(new WindowAdapter()
13991858 {
1400
-
14011859 public void windowClosing(WindowEvent e)
14021860 {
14031861 Close();
....@@ -1405,7 +1863,7 @@
14051863 });
14061864 }
14071865
1408
- void AddOptions(JPanel panel, GridBagConstraints constraints)
1866
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
14091867 {
14101868 }
14111869
....@@ -1420,260 +1878,609 @@
14201878 ctrlPanel.removeAll();
14211879 }
14221880
1423
- void SetupMaterial(JPanel ctrlPanel)
1881
+ void SetupMaterial(cGridBag materialpanel)
14241882 {
1425
- aConstraints.weighty = 0;
1426
- //aConstraints.weightx = 1;
1427
- /*
1883
+ cGridBag presetpanel = new cGridBag().setVertical(true);
1884
+
1885
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1886
+ skin.setToolTipText("Skin");
1887
+ skin.addMouseListener(new MouseAdapter()
1888
+ {
1889
+ public void mouseClicked(MouseEvent e)
1890
+ {
1891
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
1892
+ cMaterial material = object.material;
1893
+
1894
+ // Skin
1895
+ colorField.setFloat(material.color);
1896
+ float saturation = material.modulation;
1897
+
1898
+ if (!cameraView.Skinshader)
1899
+ {
1900
+ saturation /= 1.5;
1901
+ }
1902
+
1903
+ saturationField.setFloat(saturation);
1904
+
1905
+ subsurfaceField.setFloat(material.subsurface);
1906
+ selfshadowField.setFloat(material.diffuseness);
1907
+ diffusenessField.setFloat(material.factor);
1908
+ shininessField.setFloat(material.shininess);
1909
+ shadowbiasField.setFloat(material.shadowbias);
1910
+ diffuseField.setFloat(material.diffuse);
1911
+ specularField.setFloat(material.specular);
1912
+
1913
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
1914
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
1915
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
1916
+
1917
+ materialtouched = true;
1918
+ applySelf();
1919
+ }
1920
+ });
1921
+ presetpanel.add(skin);
1922
+
1923
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
1924
+ lambert.setToolTipText("Diffuse");
1925
+ lambert.addMouseListener(new MouseAdapter()
1926
+ {
1927
+ public void mouseClicked(MouseEvent e)
1928
+ {
1929
+ Object3D object = Grafreed.materials.versionlist[2].get(0);
1930
+ cMaterial material = object.material;
1931
+
1932
+ diffusenessField.setFloat(material.factor);
1933
+ selfshadowField.setFloat(material.diffuseness);
1934
+
1935
+ materialtouched = true;
1936
+ applySelf();
1937
+ }
1938
+ });
1939
+ presetpanel.add(lambert);
1940
+
1941
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
1942
+ diffuse2.setToolTipText("Diffuse2");
1943
+ diffuse2.addMouseListener(new MouseAdapter()
1944
+ {
1945
+ public void mouseClicked(MouseEvent e)
1946
+ {
1947
+ Object3D object = Grafreed.materials.versionlist[3].get(0);
1948
+ cMaterial material = object.material;
1949
+
1950
+ diffusenessField.setFloat(material.factor);
1951
+ selfshadowField.setFloat(material.diffuseness);
1952
+
1953
+ materialtouched = true;
1954
+ applySelf();
1955
+ }
1956
+ });
1957
+ presetpanel.add(diffuse2);
1958
+
1959
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
1960
+ diffusemoon.setToolTipText("Moon");
1961
+ diffusemoon.addMouseListener(new MouseAdapter()
1962
+ {
1963
+ public void mouseClicked(MouseEvent e)
1964
+ {
1965
+ Object3D object = Grafreed.materials.versionlist[4].get(0);
1966
+ cMaterial material = object.material;
1967
+
1968
+ diffusenessField.setFloat(material.factor);
1969
+ selfshadowField.setFloat(material.diffuseness);
1970
+
1971
+ materialtouched = true;
1972
+ applySelf();
1973
+ }
1974
+ });
1975
+ presetpanel.add(diffusemoon);
1976
+
1977
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
1978
+ diffusemoon2.setToolTipText("Moon2");
1979
+ diffusemoon2.addMouseListener(new MouseAdapter()
1980
+ {
1981
+ public void mouseClicked(MouseEvent e)
1982
+ {
1983
+ Object3D object = Grafreed.materials.versionlist[5].get(0);
1984
+ cMaterial material = object.material;
1985
+
1986
+ diffusenessField.setFloat(material.factor);
1987
+ selfshadowField.setFloat(material.diffuseness);
1988
+
1989
+ materialtouched = true;
1990
+ applySelf();
1991
+ }
1992
+ });
1993
+ presetpanel.add(diffusemoon2);
1994
+
1995
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
1996
+ diffusemoon3.setToolTipText("Moon3");
1997
+ diffusemoon3.addMouseListener(new MouseAdapter()
1998
+ {
1999
+ public void mouseClicked(MouseEvent e)
2000
+ {
2001
+ Object3D object = Grafreed.materials.versionlist[6].get(0);
2002
+ cMaterial material = object.material;
2003
+
2004
+ diffusenessField.setFloat(material.factor);
2005
+ selfshadowField.setFloat(material.diffuseness);
2006
+
2007
+ materialtouched = true;
2008
+ applySelf();
2009
+ }
2010
+ });
2011
+ presetpanel.add(diffusemoon3);
2012
+
2013
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
2014
+ diffusesheen.setToolTipText("Sheen");
2015
+ diffusesheen.addMouseListener(new MouseAdapter()
2016
+ {
2017
+ public void mouseClicked(MouseEvent e)
2018
+ {
2019
+ Object3D object = Grafreed.materials.versionlist[7].get(0);
2020
+ cMaterial material = object.material;
2021
+
2022
+ sheenField.setFloat(material.sheen);
2023
+
2024
+ materialtouched = true;
2025
+ applySelf();
2026
+ }
2027
+ });
2028
+ presetpanel.add(diffusesheen);
2029
+
2030
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
2031
+ rough.setToolTipText("Rough metal");
2032
+ rough.addMouseListener(new MouseAdapter()
2033
+ {
2034
+ public void mouseClicked(MouseEvent e)
2035
+ {
2036
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
2037
+ cMaterial material = object.material;
2038
+
2039
+ shininessField.setFloat(material.shininess);
2040
+ velvetField.setFloat(material.velvet);
2041
+
2042
+ materialtouched = true;
2043
+ applySelf();
2044
+ }
2045
+ });
2046
+ presetpanel.add(rough);
2047
+
2048
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
2049
+ rough2.setToolTipText("Medium metal");
2050
+ rough2.addMouseListener(new MouseAdapter()
2051
+ {
2052
+ public void mouseClicked(MouseEvent e)
2053
+ {
2054
+ Object3D object = Grafreed.materials.versionlist[13].get(0);
2055
+ cMaterial material = object.material;
2056
+
2057
+ shininessField.setFloat(material.shininess);
2058
+ lightareaField.setFloat(material.lightarea);
2059
+
2060
+ materialtouched = true;
2061
+ applySelf();
2062
+ }
2063
+ });
2064
+ presetpanel.add(rough2);
2065
+
2066
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
2067
+ shini0.setToolTipText("Shiny");
2068
+ shini0.addMouseListener(new MouseAdapter()
2069
+ {
2070
+ public void mouseClicked(MouseEvent e)
2071
+ {
2072
+ Object3D object = Grafreed.materials.versionlist[14].get(0);
2073
+ cMaterial material = object.material;
2074
+
2075
+ shininessField.setFloat(material.shininess);
2076
+ lightareaField.setFloat(material.lightarea);
2077
+
2078
+ materialtouched = true;
2079
+ applySelf();
2080
+ }
2081
+ });
2082
+ presetpanel.add(shini0);
2083
+
2084
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
2085
+ shini1.setToolTipText("Shiny2");
2086
+ shini1.addMouseListener(new MouseAdapter()
2087
+ {
2088
+ public void mouseClicked(MouseEvent e)
2089
+ {
2090
+ Object3D object = Grafreed.materials.versionlist[11].get(0);
2091
+ cMaterial material = object.material;
2092
+
2093
+ shininessField.setFloat(material.shininess);
2094
+ lightareaField.setFloat(material.lightarea);
2095
+
2096
+ materialtouched = true;
2097
+ applySelf();
2098
+ }
2099
+ });
2100
+ presetpanel.add(shini1);
2101
+
2102
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2103
+ shini2.setToolTipText("Shiny3");
2104
+ shini2.addMouseListener(new MouseAdapter()
2105
+ {
2106
+ public void mouseClicked(MouseEvent e)
2107
+ {
2108
+ Object3D object = Grafreed.materials.versionlist[12].get(0);
2109
+ cMaterial material = object.material;
2110
+
2111
+ shininessField.setFloat(material.shininess);
2112
+ lightareaField.setFloat(material.lightarea);
2113
+
2114
+ materialtouched = true;
2115
+ applySelf();
2116
+ }
2117
+ });
2118
+ presetpanel.add(shini2);
2119
+
2120
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2121
+ aniso.setToolTipText("AnisoU");
2122
+ aniso.addMouseListener(new MouseAdapter()
2123
+ {
2124
+ public void mouseClicked(MouseEvent e)
2125
+ {
2126
+ Object3D object = Grafreed.materials.versionlist[8].get(0);
2127
+ cMaterial material = object.material;
2128
+
2129
+ anisoField.setFloat(material.aniso);
2130
+ anisoVField.setFloat(material.anisoV);
2131
+
2132
+ materialtouched = true;
2133
+ applySelf();
2134
+ }
2135
+ });
2136
+ presetpanel.add(aniso);
2137
+
2138
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2139
+ aniso2.setToolTipText("AnisoV");
2140
+ aniso2.addMouseListener(new MouseAdapter()
2141
+ {
2142
+ public void mouseClicked(MouseEvent e)
2143
+ {
2144
+ Object3D object = Grafreed.materials.versionlist[9].get(0);
2145
+ cMaterial material = object.material;
2146
+
2147
+ anisoField.setFloat(material.aniso);
2148
+ anisoVField.setFloat(material.anisoV);
2149
+
2150
+ materialtouched = true;
2151
+ applySelf();
2152
+ }
2153
+ });
2154
+ presetpanel.add(aniso2);
2155
+
2156
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2157
+ aniso3.setToolTipText("AnisoUV");
2158
+ aniso3.addMouseListener(new MouseAdapter()
2159
+ {
2160
+ public void mouseClicked(MouseEvent e)
2161
+ {
2162
+ Object3D object = Grafreed.materials.versionlist[10].get(0);
2163
+ cMaterial material = object.material;
2164
+
2165
+ anisoField.setFloat(material.aniso);
2166
+ anisoVField.setFloat(material.anisoV);
2167
+
2168
+ materialtouched = true;
2169
+ applySelf();
2170
+ }
2171
+ });
2172
+ presetpanel.add(aniso3);
2173
+
2174
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2175
+ velvet0.setToolTipText("Velvet");
2176
+ velvet0.addMouseListener(new MouseAdapter()
2177
+ {
2178
+ public void mouseClicked(MouseEvent e)
2179
+ {
2180
+ Object3D object = Grafreed.materials.versionlist[15].get(0);
2181
+ cMaterial material = object.material;
2182
+
2183
+ diffusenessField.setFloat(material.factor);
2184
+ selfshadowField.setFloat(material.diffuseness);
2185
+ sheenField.setFloat(material.sheen);
2186
+ shininessField.setFloat(material.shininess);
2187
+ velvetField.setFloat(material.velvet);
2188
+ shiftField.setFloat(material.shift);
2189
+
2190
+ materialtouched = true;
2191
+ applySelf();
2192
+ }
2193
+ });
2194
+ presetpanel.add(velvet0);
2195
+
2196
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2197
+ bump0.setToolTipText("Bump texture");
2198
+ bump0.addMouseListener(new MouseAdapter()
2199
+ {
2200
+ public void mouseClicked(MouseEvent e)
2201
+ {
2202
+ Object3D object = Grafreed.materials.versionlist[16].get(0);
2203
+ cMaterial material = object.material;
2204
+
2205
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2206
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2207
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2208
+
2209
+ materialtouched = true;
2210
+ applySelf();
2211
+ }
2212
+ });
2213
+ presetpanel.add(bump0);
2214
+
2215
+ cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF);
2216
+ borderShader.setToolTipText("Border fade");
2217
+ borderShader.addMouseListener(new MouseAdapter()
2218
+ {
2219
+ public void mouseClicked(MouseEvent e)
2220
+ {
2221
+ borderfadeField.setFloat(0.5);
2222
+ opacityField.setFloat(0.75);
2223
+
2224
+ materialtouched = true;
2225
+ applySelf();
2226
+ }
2227
+ });
2228
+ presetpanel.add(borderShader);
2229
+
2230
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2231
+ halo.setToolTipText("Halo");
2232
+ halo.addMouseListener(new MouseAdapter()
2233
+ {
2234
+ public void mouseClicked(MouseEvent e)
2235
+ {
2236
+ Object3D object = Grafreed.materials.versionlist[17].get(0);
2237
+ cMaterial material = object.material;
2238
+
2239
+ opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
2240
+
2241
+ materialtouched = true;
2242
+ applySelf();
2243
+ }
2244
+ });
2245
+ presetpanel.add(halo);
2246
+
2247
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2248
+ candle.setToolTipText("Candle");
2249
+ candle.addMouseListener(new MouseAdapter()
2250
+ {
2251
+ public void mouseClicked(MouseEvent e)
2252
+ {
2253
+ Object3D object = Grafreed.materials.versionlist[18].get(0);
2254
+ cMaterial material = object.material;
2255
+
2256
+ subsurfaceField.setFloat(material.subsurface);
2257
+ shadowbiasField.setFloat(material.shadowbias);
2258
+ ambientField.setFloat(material.ambient);
2259
+ specularField.setFloat(material.specular);
2260
+ lightareaField.setFloat(material.lightarea);
2261
+ shininessField.setFloat(material.shininess);
2262
+
2263
+ materialtouched = true;
2264
+ applySelf();
2265
+ }
2266
+ });
2267
+ presetpanel.add(candle);
2268
+
2269
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2270
+ shadowShader.setToolTipText("Shadow");
2271
+ shadowShader.addMouseListener(new MouseAdapter()
2272
+ {
2273
+ public void mouseClicked(MouseEvent e)
2274
+ {
2275
+ diffuseField.setFloat(0.001);
2276
+ ambientField.setFloat(0.001);
2277
+ cameraField.setFloat(0.001);
2278
+ specularField.setFloat(0.001);
2279
+ fakedepthField.setFloat(0.001);
2280
+ opacityField.setFloat(0.6);
2281
+
2282
+ materialtouched = true;
2283
+ applySelf();
2284
+ }
2285
+ });
2286
+ presetpanel.add(shadowShader);
2287
+
2288
+ cGridBag panel = new cGridBag().setVertical(true);
2289
+
2290
+ presetpanel.preferredWidth = 1;
2291
+
2292
+ materialpanel.add(presetpanel);
2293
+ materialpanel.add(panel);
2294
+
2295
+ panel.preferredWidth = 8;
2296
+
2297
+ /*
14282298 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14292299 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1430
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1431
- aConstraints.gridx += 1;
1432
- */
2300
+ */
14332301
1434
- aConstraints.gridwidth = 1;
1435
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1436
- aConstraints.gridx += 1;
1437
- aConstraints.weighty = 0;
1438
- aConstraints.gridwidth = 1;
2302
+ cGridBag editBar = new cGridBag().setVertical(false);
2303
+
2304
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
2305
+ createMaterialButton.setToolTipText("Create material");
14392306
14402307 /*
14412308 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1442
- aConstraints.gridx += 1;
1443
- aConstraints.weighty = 0;
1444
- aConstraints.gridwidth = 1;
14452309 */
14462310
1447
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1448
- aConstraints.gridx += 1;
2311
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
2312
+ clearMaterialButton.setToolTipText("Clear material");
2313
+
2314
+ if (Globals.ADVANCED)
2315
+ {
2316
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
2317
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
2318
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
2319
+ }
14492320
1450
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1451
-
1452
- aConstraints.gridx += 1;
1453
-
1454
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1455
-
1456
- aConstraints.gridx += 1;
1457
-
1458
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1459
-
1460
- aConstraints.gridx = 0;
1461
- aConstraints.gridy += 1;
1462
- aConstraints.weighty = 0;
1463
- aConstraints.gridwidth = 1;
2321
+ editBar.preferredHeight = 15;
2322
+
2323
+ panel.add(editBar);
2324
+
14642325 /**/
14652326 //aConstraints.weighty = 0;
14662327 ////aConstraints.weightx = 1;
14672328 //aConstraints.weighty = 1;
14682329 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14692330 //aConstraints.gridx += 1;
1470
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1471
- aConstraints.weighty = 0;
1472
- aConstraints.gridx = 0;
1473
- aConstraints.gridy += 1;
1474
- aConstraints.gridwidth = 1;
2331
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14752332
1476
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1477
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1478
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1479
- aConstraints.gridx += 1;
1480
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1481
- //aConstraints.weightx = 0;
1482
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1483
- aConstraints.gridx = 0;
1484
- aConstraints.gridy += 1;
1485
- aConstraints.gridwidth = 1;
2333
+ cGridBag colorSection = new cGridBag().setVertical(true);
14862334
1487
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1488
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1489
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1490
- aConstraints.gridx += 1;
1491
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1492
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1493
- aConstraints.gridx = 0;
1494
- aConstraints.gridy += 1;
1495
- aConstraints.gridwidth = 1;
2335
+ cGridBag huepanel = new cGridBag();
2336
+ cGridBag huelabel = new cGridBag();
2337
+ cLabel hue = GetLabel("icons/hue.png", false);
2338
+ hue.fit = true;
2339
+
2340
+ hue.addMouseListener(new MouseAdapter()
2341
+ {
2342
+ public void mousePressed(MouseEvent e)
2343
+ {
2344
+ int x = e.getX();
2345
+
2346
+ colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth());
2347
+ }
2348
+ });
2349
+
2350
+ huelabel.add(hue);
2351
+ huelabel.preferredWidth = 20;
2352
+ huepanel.add(new cGridBag()); // Label
2353
+ huepanel.add(huelabel); // Field/slider
2354
+
2355
+ huepanel.preferredHeight = 7;
14962356
1497
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1498
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1499
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1500
- aConstraints.gridx += 1;
1501
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1502
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1503
- aConstraints.gridx = 0;
1504
- aConstraints.gridy += 1;
1505
- aConstraints.gridwidth = 1;
2357
+ colorSection.add(huepanel);
2358
+
2359
+ cGridBag color = new cGridBag();
2360
+
2361
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
2362
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2363
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
15062364
1507
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1508
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1509
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1510
- aConstraints.gridx += 1;
1511
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1512
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1513
- aConstraints.gridx = 0;
1514
- aConstraints.gridy += 1;
1515
- aConstraints.gridwidth = 1;
2365
+ //colorField.preferredWidth = 200;
2366
+ colorSection.add(color);
15162367
1517
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1518
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1519
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1520
- aConstraints.gridx += 1;
1521
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1522
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1523
- aConstraints.gridx = 0;
1524
- aConstraints.gridy += 1;
1525
- aConstraints.gridwidth = 1;
2368
+ cGridBag modulation = new cGridBag();
2369
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
2370
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2371
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2372
+ colorSection.add(modulation);
15262373
1527
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1528
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1529
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1530
- aConstraints.gridx += 1;
1531
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1532
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1533
- aConstraints.gridx = 0;
1534
- aConstraints.gridy += 1;
1535
- aConstraints.gridwidth = 1;
2374
+ cGridBag opacity = new cGridBag();
2375
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
2376
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2377
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2378
+ colorSection.add(opacity);
15362379
1537
- //aConstraints.weighty = 1;
1538
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1539
- //aConstraints.gridx += 1;
1540
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1541
- aConstraints.weighty = 0;
1542
- aConstraints.gridx = 0;
1543
- aConstraints.gridy += 1;
1544
- aConstraints.gridwidth = 1;
2380
+ colorSection.add(GetSeparator());
2381
+
2382
+ cGridBag texture = new cGridBag();
2383
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
2384
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2385
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2386
+ colorSection.add(texture);
15452387
1546
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1547
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1548
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1549
- aConstraints.gridx += 1;
1550
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1551
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1552
- aConstraints.gridx = 0;
1553
- aConstraints.gridy += 1;
1554
- aConstraints.gridwidth = 1;
2388
+ panel.add(GetSeparator());
2389
+
2390
+ panel.add(colorSection);
2391
+
2392
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2393
+
2394
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
2395
+
2396
+ cGridBag diffuse = new cGridBag();
2397
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
2398
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2399
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2400
+ diffuseSection.add(diffuse);
15552401
1556
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1557
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1558
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1559
- aConstraints.gridx += 1;
1560
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1561
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1562
- aConstraints.gridx = 0;
1563
- aConstraints.gridy += 1;
1564
- aConstraints.gridwidth = 1;
2402
+ cGridBag diffuseness = new cGridBag();
2403
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
2404
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2405
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2406
+ diffuseSection.add(diffuseness);
15652407
1566
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1567
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1568
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1569
- aConstraints.gridx += 1;
1570
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1571
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1572
- aConstraints.gridx = 0;
1573
- aConstraints.gridy += 1;
1574
- aConstraints.gridwidth = 1;
2408
+ cGridBag selfshadow = new cGridBag();
2409
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
2410
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2411
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2412
+ diffuseSection.add(selfshadow);
15752413
1576
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1577
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1578
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1579
- aConstraints.gridx += 1;
1580
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1581
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1582
- aConstraints.gridx = 0;
1583
- aConstraints.gridy += 1;
1584
- aConstraints.gridwidth = 1;
2414
+ cGridBag sheen = new cGridBag();
2415
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
2416
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2417
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2418
+ diffuseSection.add(sheen);
15852419
1586
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1587
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1588
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1589
- aConstraints.gridx += 1;
1590
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1591
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1592
- aConstraints.gridx = 0;
1593
- aConstraints.gridy += 1;
1594
- aConstraints.gridwidth = 1;
2420
+ cGridBag subsurface = new cGridBag();
2421
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
2422
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2423
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2424
+ diffuseSection.add(subsurface);
15952425
1596
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1597
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1598
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1599
- aConstraints.gridx += 1;
1600
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1601
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1602
- aConstraints.gridx = 0;
1603
- aConstraints.gridy += 1;
1604
- aConstraints.gridwidth = 1;
2426
+ cGridBag shadow = new cGridBag();
2427
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
2428
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2429
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2430
+ diffuseSection.add(shadow);
16052431
1606
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1607
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1608
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1609
- aConstraints.gridx += 1;
1610
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1611
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1612
- aConstraints.gridx = 0;
1613
- aConstraints.gridy += 1;
1614
- aConstraints.gridwidth = 1;
2432
+ cGridBag fakedepth = new cGridBag();
2433
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
2434
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2435
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2436
+ diffuseSection.add(fakedepth);
16152437
1616
- //aConstraints.weighty = 1;
1617
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1618
- //aConstraints.gridx += 1;
1619
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1620
- aConstraints.weighty = 0;
1621
- aConstraints.gridx = 0;
1622
- aConstraints.gridy += 1;
1623
- aConstraints.gridwidth = 1;
2438
+ cGridBag shadowbias = new cGridBag();
2439
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
2440
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2441
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2442
+ diffuseSection.add(shadowbias);
16242443
1625
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1626
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1627
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1628
- aConstraints.gridx += 1;
1629
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1630
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1631
- aConstraints.gridx = 0;
1632
- aConstraints.gridy += 1;
1633
- aConstraints.gridwidth = 1;
2444
+ panel.add(GetSeparator());
2445
+
2446
+ panel.add(diffuseSection);
2447
+
2448
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2449
+
2450
+ cGridBag specularSection = new cGridBag().setVertical(true);
16342451
1635
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1636
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1637
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1638
- aConstraints.gridx += 1;
1639
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1640
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1641
- aConstraints.gridx = 0;
1642
- aConstraints.gridy += 1;
1643
- aConstraints.gridwidth = 1;
2452
+ cGridBag specular = new cGridBag();
2453
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
2454
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2455
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2456
+ specularSection.add(specular);
16442457
1645
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1646
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1647
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1648
- aConstraints.gridx += 1;
1649
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1650
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1651
- aConstraints.gridx = 0;
1652
- aConstraints.gridy += 1;
1653
- aConstraints.gridwidth = 1;
2458
+ cGridBag lightarea = new cGridBag();
2459
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
2460
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2461
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2462
+ specularSection.add(lightarea);
16542463
1655
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1656
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1657
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1658
- aConstraints.gridx += 1;
1659
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1660
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1661
- aConstraints.gridx = 0;
1662
- aConstraints.gridy += 1;
1663
- aConstraints.gridwidth = 1;
2464
+ cGridBag shininess = new cGridBag();
2465
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
2466
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2467
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2468
+ specularSection.add(shininess);
16642469
1665
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1666
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1667
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1668
- aConstraints.gridx += 1;
1669
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1670
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1671
- aConstraints.gridx = 0;
1672
- aConstraints.gridy += 1;
1673
- aConstraints.gridwidth = 1;
2470
+ cGridBag metalness = new cGridBag();
2471
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
2472
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2473
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2474
+ specularSection.add(metalness);
16742475
1675
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1676
- Return();
2476
+ cGridBag velvet = new cGridBag();
2477
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
2478
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2479
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2480
+ specularSection.add(velvet);
2481
+
2482
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
2483
+ //Return();
16772484 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16782485 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16792486 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1684,130 +2491,99 @@
16842491 // aConstraints.gridy += 1;
16852492 // aConstraints.gridwidth = 1;
16862493
1687
- //aConstraints.weighty = 1;
1688
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1689
- //aConstraints.gridx += 1;
1690
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1691
- aConstraints.weighty = 0;
1692
- aConstraints.gridx = 0;
1693
- aConstraints.gridy += 1;
1694
- aConstraints.gridwidth = 1;
2494
+ cGridBag anisoU = new cGridBag();
2495
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
2496
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2497
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2498
+ specularSection.add(anisoU);
16952499
1696
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1697
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1698
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1699
- aConstraints.gridx += 1;
1700
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1701
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1702
- aConstraints.gridx = 0;
1703
- aConstraints.gridy += 1;
1704
- aConstraints.gridwidth = 1;
2500
+ cGridBag anisoV = new cGridBag();
2501
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
2502
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2503
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2504
+ specularSection.add(anisoV);
17052505
1706
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1707
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1708
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1709
- aConstraints.gridx += 1;
1710
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1711
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1712
- aConstraints.gridx = 0;
1713
- aConstraints.gridy += 1;
1714
- aConstraints.gridwidth = 1;
17152506
1716
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1717
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1718
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1719
- aConstraints.gridx += 1;
1720
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1721
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1722
- aConstraints.gridx = 0;
1723
- aConstraints.gridy += 1;
1724
- aConstraints.gridwidth = 1;
2507
+ panel.add(GetSeparator());
2508
+
2509
+ panel.add(specularSection);
2510
+
2511
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2512
+
2513
+ //cGridBag globalSection = new cGridBag().setVertical(true);
17252514
1726
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1727
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1728
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1729
- aConstraints.gridx += 1;
1730
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1731
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1732
- aConstraints.gridx = 0;
1733
- aConstraints.gridy += 1;
1734
- aConstraints.gridwidth = 1;
1735
- aConstraints.weighty = 0;
2515
+ cGridBag camera = new cGridBag();
2516
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
2517
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2518
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2519
+ colorSection.add(camera);
17362520
1737
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1738
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1739
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1740
- aConstraints.gridx += 1;
1741
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1742
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1743
- aConstraints.gridx = 0;
1744
- aConstraints.gridy += 1;
1745
- aConstraints.gridwidth = 1;
2521
+ cGridBag ambient = new cGridBag();
2522
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
2523
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2524
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2525
+ colorSection.add(ambient);
17462526
1747
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1748
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1749
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1750
- aConstraints.gridx += 1;
1751
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1752
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1753
- aConstraints.gridx = 0;
1754
- aConstraints.gridy += 1;
1755
- aConstraints.gridwidth = 1;
2527
+ cGridBag backlit = new cGridBag();
2528
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
2529
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2530
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2531
+ colorSection.add(backlit);
17562532
1757
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1758
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1759
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1760
- aConstraints.gridx += 1;
1761
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1762
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1763
- aConstraints.gridx = 0;
1764
- aConstraints.gridy += 1;
1765
- aConstraints.gridwidth = 1;
2533
+ //panel.add(new JSeparator());
2534
+
2535
+ //panel.add(globalSection);
2536
+
2537
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2538
+
2539
+ cGridBag textureSection = new cGridBag().setVertical(true);
17662540
1767
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1768
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1769
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1770
- aConstraints.gridx += 1;
1771
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1772
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1773
- aConstraints.gridx = 0;
1774
- aConstraints.gridy += 1;
1775
- aConstraints.gridwidth = 1;
2541
+ cGridBag bump = new cGridBag();
2542
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
2543
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2544
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
2545
+ textureSection.add(bump);
17762546
1777
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1778
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1779
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1780
- aConstraints.gridx += 1;
1781
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1782
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1783
- aConstraints.gridx = 0;
1784
- aConstraints.gridy += 1;
1785
- aConstraints.gridwidth = 1;
2547
+ cGridBag noise = new cGridBag();
2548
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
2549
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2550
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
2551
+ textureSection.add(noise);
17862552
1787
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1788
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1789
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1790
- aConstraints.gridx += 1;
1791
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1792
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1793
- aConstraints.gridx = 0;
1794
- aConstraints.gridy += 1;
1795
- aConstraints.gridwidth = 1;
2553
+ cGridBag power = new cGridBag();
2554
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
2555
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2556
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
2557
+ textureSection.add(power);
17962558
1797
- //aConstraints.weighty = 1;
1798
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1799
- //aConstraints.gridx += 1;
1800
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1801
- aConstraints.weighty = 0;
2559
+ cGridBag borderfade = new cGridBag();
2560
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
2561
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2562
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
2563
+ textureSection.add(borderfade);
18022564
1803
- aConstraints.gridx = 0;
1804
- aConstraints.gridy = 0;
1805
- aConstraints.gridwidth = 1;
2565
+ cGridBag fog = new cGridBag();
2566
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
2567
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2568
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
2569
+ textureSection.add(fog);
2570
+
2571
+ cGridBag opacityPower = new cGridBag();
2572
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
2573
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2574
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
2575
+ textureSection.add(opacityPower);
2576
+
2577
+ panel.add(GetSeparator());
2578
+
2579
+ panel.add(textureSection);
2580
+
2581
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18062582
18072583 SetMaterial(copy); // .GetMaterial());
18082584
1809
- colorField.addChangeListener(this);
1810
- modulationField.addChangeListener(this);
2585
+ //colorField.addChangeListener(this);
2586
+// modulationField.addChangeListener(this);
18112587 metalnessField.addChangeListener(this);
18122588 diffuseField.addChangeListener(this);
18132589 specularField.addChangeListener(this);
....@@ -1837,12 +2613,15 @@
18372613 opacityPowerField.addChangeListener(this);
18382614 /**/
18392615
1840
- resetSlidersButton.addActionListener(this);
18412616 clearMaterialButton.addActionListener(this);
18422617 createMaterialButton.addActionListener(this);
1843
-
1844
- propagateToggle.addItemListener(this);
1845
- multiplyToggle.addItemListener(this);
2618
+
2619
+ if (Globals.ADVANCED)
2620
+ {
2621
+ resetSlidersButton.addActionListener(this);
2622
+ propagateToggle.addItemListener(this);
2623
+ multiplyToggle.addItemListener(this);
2624
+ }
18462625 }
18472626
18482627 void DropFile(java.io.File[] files, boolean textures)
....@@ -1860,8 +2639,9 @@
18602639 // 3D models
18612640 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18622641 {
1863
- lastConverter = new com.jmex.model.converters.MaxToJme();
1864
- LoadFile(filename, lastConverter);
2642
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2643
+ //LoadFile(filename, lastConverter);
2644
+ LoadObjFile(filename); // New 3ds loader
18652645 continue;
18662646 }
18672647 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2013,7 +2793,7 @@
20132793
20142794 //? flashIt = false;
20152795 CameraPane pane = (CameraPane) cameraView;
2016
- pane.clickStart(location.x, location.y, 0);
2796
+ pane.clickStart(location.x, location.y, 0, 0);
20172797 pane.clickEnd(location.x, location.y, 0, true);
20182798
20192799 if (group.selection.size() == 1)
....@@ -2062,6 +2842,7 @@
20622842 e2.printStackTrace();
20632843 }
20642844 }
2845
+
20652846 LoadJMEThread loadThread;
20662847
20672848 class LoadJMEThread extends Thread
....@@ -2119,6 +2900,7 @@
21192900 //LoadFile0(filename, converter);
21202901 }
21212902 }
2903
+
21222904 LoadOBJThread loadObjThread;
21232905
21242906 class LoadOBJThread extends Thread
....@@ -2197,19 +2979,19 @@
21972979
21982980 void LoadObjFile(String fullname)
21992981 {
2200
- /*
2982
+ System.out.println("Loading " + fullname);
2983
+ /**/
22012984 //lastFilename = fullname;
22022985 if(loadObjThread == null)
22032986 {
2204
- loadObjThread = new LoadOBJThread();
2205
- loadObjThread.start();
2987
+ loadObjThread = new LoadOBJThread();
2988
+ loadObjThread.start();
22062989 }
22072990
22082991 loadObjThread.add(fullname);
2209
- */
2992
+ /**/
22102993
2211
- System.out.println("Loading " + fullname);
2212
- makeSomething(new FileObject(fullname, true), true);
2994
+ //makeSomething(new FileObject(fullname, true), true);
22132995 }
22142996
22152997 void LoadGFDFile(String fullname)
....@@ -2470,11 +3252,11 @@
24703252
24713253 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24723254 {
2473
- if (GrafreeD.standAlone)
3255
+ if (Grafreed.standAlone)
24743256 {
24753257 /**/
24763258 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2477
- browser.show();
3259
+ browser.setVisible(true);
24783260 String filename = browser.getFile();
24793261 if (filename != null && filename.length() > 0)
24803262 {
....@@ -2585,6 +3367,7 @@
25853367 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25863368 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25873369 }
3370
+
25883371 //cJME.count++;
25893372 //cJME.count %= 12;
25903373 if (gc)
....@@ -2619,6 +3402,7 @@
26193402 }
26203403 if (input == null)
26213404 {
3405
+ new Exception().printStackTrace();
26223406 System.exit(0);
26233407 }
26243408
....@@ -2767,6 +3551,7 @@
27673551 }
27683552 }
27693553 }
3554
+
27703555 cFileSystemPane FSPane;
27713556
27723557 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2776,7 +3561,7 @@
27763561
27773562 freezematerial = true;
27783563 colorField.setFloat(mat.color);
2779
- modulationField.setFloat(mat.modulation);
3564
+ saturationField.setFloat(mat.modulation);
27803565 metalnessField.setFloat(mat.metalness);
27813566 diffuseField.setFloat(mat.diffuse);
27823567 specularField.setFloat(mat.specular);
....@@ -2820,11 +3605,14 @@
28203605 }
28213606 }
28223607 }
3608
+
28233609 freezematerial = false;
28243610 }
28253611
28263612 void SetMaterial(Object3D object)
28273613 {
3614
+ latestObject = object;
3615
+
28283616 cMaterial mat = object.material;
28293617
28303618 if (mat == null)
....@@ -2833,33 +3621,10 @@
28333621 return;
28343622 }
28353623
2836
- multiplyToggle.setSelected(mat.multiply);
2837
-
2838
- assert (object.projectedVertices != null);
2839
-
2840
- if (object.projectedVertices.length <= 2)
2841
- {
2842
- // Side effect...
2843
- Object3D.cVector2[] keep = object.projectedVertices;
2844
- object.projectedVertices = new Object3D.cVector2[3];
2845
- for (int i = 0; i < 3; i++)
2846
- {
2847
- if (i < keep.length)
2848
- {
2849
- object.projectedVertices[i] = keep[i];
2850
- } else
2851
- {
2852
- object.projectedVertices[i] = new Object3D.cVector2();
2853
- }
2854
- /*
2855
- if(keep.length == 0)
2856
- object.projectedVertices[0] = new Object3D.cVector2();
2857
- else
2858
- object.projectedVertices[0] = keep[0];
2859
- object.projectedVertices[1] = new Object3D.cVector2();
2860
- */
2861
- }
2862
- }
3624
+ if (multiplyToggle != null)
3625
+ multiplyToggle.setSelected(mat.multiply);
3626
+
3627
+ AllocProjectedVertices(object);
28633628
28643629 SetMaterial(mat, object.projectedVertices);
28653630 }
....@@ -2935,12 +3700,17 @@
29353700 // }
29363701
29373702 /**/
2938
- if (deselect)
3703
+ if (deselect || child == null)
29393704 {
29403705 //group.deselectAll();
29413706 //freeze = true;
29423707 GetTree().clearSelection();
29433708 //freeze = false;
3709
+
3710
+ if (child == null)
3711
+ {
3712
+ return;
3713
+ }
29443714 }
29453715
29463716 //group.addSelectee(child);
....@@ -2974,6 +3744,17 @@
29743744 public void itemStateChanged(ItemEvent event)
29753745 {
29763746 // System.out.println("Propagate = " + propagate);
3747
+ if (event.getSource() == pinButton)
3748
+ {
3749
+ copy.pinned ^= true;
3750
+ if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
3751
+ {
3752
+ ((GroupEditor)copy.editWindow).listUI.remove(copy);
3753
+ copy.CloseUI();
3754
+ //copy.editWindow.refreshContents();
3755
+ }
3756
+ }
3757
+ else
29773758 if (event.getSource() == propagateToggle)
29783759 {
29793760 propagate ^= true;
....@@ -3009,7 +3790,7 @@
30093790 cameraView.ToggleDL();
30103791 cameraView.repaint();
30113792 return;
3012
- } else if (event.getSource() == toggleTextureItem)
3793
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
30133794 {
30143795 cameraView.ToggleTexture();
30153796 // june 2013 copy.HardTouch();
....@@ -3048,9 +3829,9 @@
30483829 frame.validate();
30493830
30503831 return;
3051
- } else if (event.getSource() == toggleRandomItem)
3832
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30523833 {
3053
- cameraView.ToggleRandom();
3834
+ cameraView.ToggleSwitch();
30543835 cameraView.repaint();
30553836 return;
30563837 } else if (event.getSource() == toggleHandleItem)
....@@ -3078,12 +3859,17 @@
30783859 } else if (event.getSource() == liveCB)
30793860 {
30803861 copy.live ^= true;
3862
+ objEditor.refreshContents(true); // To show item colors
3863
+ return;
3864
+ } else if (event.getSource() == selectableCB)
3865
+ {
3866
+ copy.dontselect ^= true;
30813867 return;
30823868 } else if (event.getSource() == hideCB)
30833869 {
30843870 copy.hide ^= true;
30853871 copy.Touch(); // display list issue
3086
- objEditor.refreshContents();
3872
+ objEditor.refreshContents(true); // To show item colors
30873873 return;
30883874 } else if (event.getSource() == link2masterCB)
30893875 {
....@@ -3093,6 +3879,7 @@
30933879 if (event.getSource() == randomCB)
30943880 {
30953881 copy.random ^= true;
3882
+ objEditor.refreshContents();
30963883 return;
30973884 }
30983885 if (event.getSource() == speedupCB)
....@@ -3116,8 +3903,9 @@
31163903
31173904 public void actionPerformed(ActionEvent event)
31183905 {
3906
+ Object source = event.getSource();
31193907 // SCRIPT DIALOG
3120
- if (event.getSource() == okbutton)
3908
+ if (source == okbutton)
31213909 {
31223910 textpanel.setVisible(false);
31233911 textpanel.remove(textarea);
....@@ -3129,7 +3917,7 @@
31293917 textarea = null;
31303918 textpanel = null;
31313919 }
3132
- if (event.getSource() == cancelbutton)
3920
+ if (source == cancelbutton)
31333921 {
31343922 textpanel.setVisible(false);
31353923 textpanel.remove(textarea);
....@@ -3141,50 +3929,50 @@
31413929 //applySelf();
31423930 //client.refreshEditWindow();
31433931 //refreshContents();
3144
- if (event.getSource() == nameField)
3932
+ if (source == nameField)
31453933 {
31463934 //System.out.println("ObjEditor " + event);
31473935 applySelf0(true);
31483936 //parent.applySelf();
3149
- objEditor.refreshContents();
3150
- } else if (event.getSource() == resetButton)
3937
+ // conflicts with requestFocus objEditor.refreshContents();
3938
+ } else if (source == resetButton)
31513939 {
31523940 CameraPane.fullreset = true;
31533941 copy.Reset(); // ResetMeshes();
31543942 copy.Touch();
31553943 objEditor.refreshContents();
3156
- } else if (event.getSource() == stepItem)
3944
+ } else if (source == stepItem)
31573945 {
31583946 //cameraView.ONESTEP = true;
31593947 Globals.ONESTEP = true;
31603948 cameraView.repaint();
31613949 return;
3162
- } else if (event.getSource() == stepButton)
3950
+ } else if (source == stepButton)
31633951 {
31643952 copy.Step();
31653953 copy.Touch();
31663954 objEditor.refreshContents();
3167
- } else if (event.getSource() == slowerButton)
3955
+ } else if (source == slowerButton)
31683956 {
31693957 copy.Slower();
31703958 copy.Touch();
31713959 objEditor.refreshContents();
3172
- } else if (event.getSource() == fasterButton)
3960
+ } else if (source == fasterButton)
31733961 {
31743962 copy.Faster();
31753963 copy.Touch();
31763964 objEditor.refreshContents();
3177
- } else if (event.getSource() == remarkButton)
3965
+ } else if (source == remarkButton)
31783966 {
31793967 copy.Remark();
31803968 copy.Touch();
31813969 objEditor.refreshContents();
3182
- } else if (event.getSource() == stepAllButton)
3970
+ } else if (source == stepAllButton)
31833971 {
31843972 copy.StepAll();
31853973 copy.Touch();
31863974 objEditor.refreshContents();
3187
- } else if (event.getSource() == resetAllButton)
3975
+ } else if (source == resetAllButton)
31883976 {
31893977 //CameraPane.fullreset = true;
31903978 copy.ResetAll(); // ResetMeshes();
....@@ -3217,53 +4005,79 @@
32174005 // Close();
32184006 // }
32194007 // else
3220
- if (event.getSource() == resetSlidersButton)
4008
+ if (source == resetSlidersButton)
32214009 {
32224010 ResetSliders();
3223
- } else if (event.getSource() == clearMaterialButton)
4011
+ } else if (source == clearMaterialButton)
32244012 {
32254013 ClearMaterial();
3226
- } else if (event.getSource() == createMaterialButton)
4014
+ } else if (source == createMaterialButton)
32274015 {
32284016 CreateMaterial();
3229
- } else if (event.getSource() == clearPanelButton)
4017
+ } else if (source == clearPanelButton)
32304018 {
32314019 copy.ClearUI();
32324020 refreshContents(true);
3233
- } /*
3234
- }
3235
-
3236
- public boolean action(Event event, Object arg)
3237
- {
3238
- */ else if (event.getSource() == closeItem)
4021
+ } else if (source == importGFDItem)
4022
+ {
4023
+ ImportGFD();
4024
+ } else
4025
+ if (source == importVRMLX3DItem)
4026
+ {
4027
+ ImportVRMLX3D();
4028
+ } else
4029
+ if (source == import3DSItem)
4030
+ {
4031
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
4032
+ } else
4033
+ if (source == importOBJItem)
4034
+ {
4035
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
4036
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
4037
+ browser.setVisible(true);
4038
+ String filename = browser.getFile();
4039
+ if (filename != null && filename.length() > 0)
4040
+ {
4041
+ String fullname = browser.getDirectory() + filename;
4042
+ makeSomething(ReadOBJ(fullname), true);
4043
+ }
4044
+ } else
4045
+ if (source == closeItem)
32394046 {
32404047 Close();
32414048 //return true;
3242
- } else if (event.getSource() == loadItem)
4049
+ } else if (source == openItem)
32434050 {
3244
- load();
4051
+ Open();
32454052 //return true;
3246
- } else if (event.getSource() == saveItem)
4053
+ } else if (source == newItem)
4054
+ {
4055
+ New();
4056
+ } else if (source == saveItem)
32474057 {
32484058 save();
32494059 //return true;
3250
- } else if (event.getSource() == saveAsItem)
4060
+ } else if (source == saveAsItem)
32514061 {
32524062 saveAs();
32534063 //return true;
3254
- } else if (event.getSource() == reexportItem)
4064
+ } else if (source == reexportItem)
32554065 {
32564066 reexport();
32574067 //return true;
3258
- } else if (event.getSource() == exportAsItem)
4068
+ } else if (source == exportAsItem)
32594069 {
32604070 export();
32614071 //return true;
3262
- } else if (event.getSource() == povItem)
4072
+ } else if (source == povItem)
32634073 {
32644074 generatePOV();
32654075 //return true;
3266
- } else if (event.getSource() == zBufferItem)
4076
+ } else if (event.getSource() == archiveItem)
4077
+ {
4078
+ cTools.Archive(frame);
4079
+ return;
4080
+ } else if (source == zBufferItem)
32674081 {
32684082 try
32694083 {
....@@ -3285,21 +4099,8 @@
32854099 cameraView.repaint();
32864100 //return true;
32874101 }
3288
- */ else if (event.getSource() == editCameraItem)
3289
- {
3290
- cameraView.ProtectCamera();
3291
- cameraView.repaint();
3292
- return;
3293
- } else if (event.getSource() == revertCameraItem)
3294
- {
3295
- cameraView.RevertCamera();
3296
- cameraView.repaint();
3297
- return;
3298
-// } else if (event.getSource() == textureButton)
3299
-// {
3300
-// return; // true;
3301
- } else // combos...
3302
- if (event.getSource() == texresMenu)
4102
+ */ else // combos...
4103
+ if (source == texresMenu)
33034104 {
33044105 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
33054106 copy.texres = texresMenu.getSelectedIndex();
....@@ -3311,12 +4112,479 @@
33114112 }
33124113 }
33134114
4115
+ void New()
4116
+ {
4117
+ while (copy.Size() > 1)
4118
+ {
4119
+ copy.remove(1);
4120
+ }
4121
+
4122
+ ResetModel();
4123
+ objEditor.refreshContents();
4124
+ }
4125
+
4126
+ static public byte[] Compress(Object3D o)
4127
+ {
4128
+ // Slower to actually compress.
4129
+ try
4130
+ {
4131
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
4132
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
4133
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
4134
+
4135
+ Object3D parent = o.parent;
4136
+ o.parent = null;
4137
+
4138
+ out.writeObject(o);
4139
+
4140
+ o.parent = parent;
4141
+
4142
+ out.flush();
4143
+
4144
+ baos //zstream
4145
+ .close();
4146
+ out.close();
4147
+
4148
+ byte[] bytes = baos.toByteArray();
4149
+
4150
+ System.out.println("save #bytes = " + bytes.length);
4151
+ return bytes;
4152
+ } catch (Exception e)
4153
+ {
4154
+ System.err.println(e);
4155
+ return null;
4156
+ }
4157
+ }
4158
+
4159
+ static public Object Uncompress(byte[] bytes)
4160
+ {
4161
+ System.out.println("restore #bytes = " + bytes.length);
4162
+ try
4163
+ {
4164
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
4165
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
4166
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
4167
+ Object obj = in.readObject();
4168
+
4169
+ bais //istream
4170
+ .close();
4171
+ in.close();
4172
+
4173
+ return obj;
4174
+ } catch (Exception e)
4175
+ {
4176
+ System.err.println(e);
4177
+ return null;
4178
+ }
4179
+ }
4180
+
4181
+ static public Object clone(Object o)
4182
+ {
4183
+ try
4184
+ {
4185
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
4186
+ ObjectOutputStream out = new ObjectOutputStream(baos);
4187
+
4188
+ out.writeObject(o);
4189
+
4190
+ out.flush();
4191
+ out.close();
4192
+
4193
+ byte[] bytes = baos.toByteArray();
4194
+
4195
+ System.out.println("clone = " + bytes.length);
4196
+
4197
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
4198
+ ObjectInputStream in = new ObjectInputStream(bais);
4199
+ Object obj = in.readObject();
4200
+ in.close();
4201
+
4202
+ return obj;
4203
+ } catch (Exception e)
4204
+ {
4205
+ System.err.println(e);
4206
+ return null;
4207
+ }
4208
+ }
4209
+
4210
+ cRadio GetCurrentTab()
4211
+ {
4212
+ cRadio ab;
4213
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
4214
+ {
4215
+ ab = (cRadio)e.nextElement();
4216
+ if(ab.GetObject() == copy)
4217
+ {
4218
+ return ab;
4219
+ }
4220
+ }
4221
+
4222
+ return null;
4223
+ }
4224
+
4225
+
4226
+ public void Save()
4227
+ {
4228
+ //Save(true);
4229
+ Replace();
4230
+ SetVersionStates();
4231
+ }
4232
+
4233
+ private boolean Equal(byte[] compress, byte[] name)
4234
+ {
4235
+ if (compress.length != name.length)
4236
+ {
4237
+ return false;
4238
+ }
4239
+
4240
+ for (int i=compress.length; --i>=0;)
4241
+ {
4242
+ if (compress[i] != name[i])
4243
+ return false;
4244
+ }
4245
+
4246
+ return true;
4247
+ }
4248
+
4249
+ void DeleteVersion()
4250
+ {
4251
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
4252
+ {
4253
+ copy.versionlist[i] = copy.versionlist[i+1];
4254
+ }
4255
+
4256
+ if (copy.versionlist[copy.versionindex] == null)
4257
+ copy.versionindex -= 1;
4258
+
4259
+ if (copy.versionindex != -1)
4260
+ CopyChanged();
4261
+
4262
+ SetVersionStates();
4263
+ }
4264
+
4265
+ public boolean Save(boolean user)
4266
+ {
4267
+ System.err.println("Save");
4268
+ Replace();
4269
+
4270
+ //cRadio tab = GetCurrentTab();
4271
+
4272
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
4273
+
4274
+ boolean thesame = false;
4275
+
4276
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
4277
+// {
4278
+// thesame = true;
4279
+// }
4280
+
4281
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
4282
+ if (!thesame)
4283
+ {
4284
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4285
+ {
4286
+ copy.versionlist[i] = copy.versionlist[i-1];
4287
+ }
4288
+
4289
+ //tab.user[tab.versionindex] = user;
4290
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
4291
+
4292
+ copy.versionlist[++copy.versionindex] = compress;
4293
+
4294
+ // if (increment)
4295
+ // tab.versionindex++;
4296
+ }
4297
+
4298
+ //copy.RestoreBigData(versiontable);
4299
+
4300
+ //assert(hashtable.isEmpty());
4301
+
4302
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4303
+// {
4304
+// //tab.user[i] = false;
4305
+// copy.versionlist[i] = null;
4306
+// }
4307
+
4308
+ SetVersionStates();
4309
+
4310
+ // test save
4311
+ if (false)
4312
+ {
4313
+ try
4314
+ {
4315
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
4316
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
4317
+
4318
+ p.writeObject(copy);
4319
+
4320
+ p.flush();
4321
+
4322
+ ostream.close();
4323
+ } catch (Exception e)
4324
+ {
4325
+ e.printStackTrace();
4326
+ }
4327
+ }
4328
+
4329
+ return !thesame;
4330
+ }
4331
+
4332
+ boolean flashIt = true;
4333
+
4334
+ void RefreshSelection()
4335
+ {
4336
+ Object3D selection = new Object3D();
4337
+
4338
+ for (int i = 0; i < copy.selection.size(); i++)
4339
+ {
4340
+ Object3D elem = copy.selection.elementAt(i);
4341
+
4342
+ Object3D obj = copy.GetObject(elem.GetUUID());
4343
+
4344
+ if (obj == null)
4345
+ {
4346
+ copy.selection.remove(i--);
4347
+ }
4348
+ else
4349
+ {
4350
+ selection.add(obj);
4351
+ copy.selection.setElementAt(obj, i);
4352
+ }
4353
+ }
4354
+
4355
+ flashIt = false;
4356
+ GetTree().clearSelection();
4357
+ for (int i = 0; i < selection.size(); i++)
4358
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
4359
+ flashIt = true;
4360
+
4361
+ //refreshContents(false);
4362
+ }
4363
+
4364
+ void CopyChanged()
4365
+ {
4366
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4367
+
4368
+ SetVersionStates();
4369
+
4370
+ boolean temp = CameraPane.SWITCH;
4371
+ CameraPane.SWITCH = false;
4372
+
4373
+ copy.ExtractBigData(Grafreed.grafreed.universe.versiontable);
4374
+
4375
+ copy.clear();
4376
+
4377
+ copy.skyboxname = obj.skyboxname;
4378
+ copy.skyboxext = obj.skyboxext;
4379
+
4380
+ for (int i=0; i<obj.Size(); i++)
4381
+ {
4382
+ copy.add(obj.get(i));
4383
+ }
4384
+
4385
+ copy.RestoreBigData(Grafreed.grafreed.universe.versiontable);
4386
+
4387
+ CameraPane.SWITCH = temp;
4388
+
4389
+ RefreshSelection();
4390
+ //assert(hashtable.isEmpty());
4391
+
4392
+ copy.Touch();
4393
+
4394
+ ResetModel();
4395
+ copy.HardTouch(); // recompile?
4396
+
4397
+ cRadio ab;
4398
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
4399
+ {
4400
+ ab = (cRadio)e.nextElement();
4401
+ Object3D test = copy.GetObject(ab.object.GetUUID());
4402
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
4403
+ if (test != null)
4404
+ {
4405
+ test.editWindow = ab.object.editWindow;
4406
+ ab.object = test;
4407
+ }
4408
+ }
4409
+
4410
+ refreshContents(true);
4411
+ }
4412
+
4413
+ cButton previousVersionButton;
4414
+ cButton restoreButton;
4415
+ cButton replaceButton;
4416
+ cButton nextVersionButton;
4417
+ cButton saveVersionButton;
4418
+ cButton deleteVersionButton;
4419
+
4420
+ boolean muteSlider;
4421
+
4422
+ int VersionCount()
4423
+ {
4424
+ int count = 0;
4425
+
4426
+ for (int i = copy.versionlist.length; --i >= 0;)
4427
+ {
4428
+ if (copy.versionlist[i] != null)
4429
+ count++;
4430
+ }
4431
+
4432
+ return count;
4433
+ }
4434
+
4435
+ void SetVersionStates()
4436
+ {
4437
+ //if (true)
4438
+ // return;
4439
+
4440
+ //cRadio tab = GetCurrentTab();
4441
+
4442
+ restoreButton.setEnabled(copy.versionindex != -1);
4443
+ replaceButton.setEnabled(copy.versionindex != -1);
4444
+
4445
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4446
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4447
+
4448
+ deleteVersionButton.setEnabled(copy.versionindex != -1);
4449
+ //copy.versionlist[copy.versionindex + 1] != null);
4450
+
4451
+ muteSlider = true;
4452
+ versionSlider.setMinimum(0);
4453
+ versionSlider.setMaximum(VersionCount() - 1);
4454
+ versionSlider.setInteger(copy.versionindex);
4455
+ versionSlider.setEnabled(copy.versionindex != -1);
4456
+ muteSlider = false;
4457
+ }
4458
+
4459
+ public boolean PreviousVersion()
4460
+ {
4461
+ // Option?
4462
+ Replace();
4463
+
4464
+ System.err.println("Undo");
4465
+
4466
+ //cRadio tab = GetCurrentTab();
4467
+
4468
+ if (copy.versionindex == 0)
4469
+ {
4470
+ java.awt.Toolkit.getDefaultToolkit().beep();
4471
+ return false;
4472
+ }
4473
+
4474
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
4475
+// {
4476
+// if (Save(false))
4477
+// tab.versionindex -= 1;
4478
+// else
4479
+// {
4480
+// if (tab.versionindex <= 0)
4481
+// return false;
4482
+// else
4483
+// tab.versionindex -= 1;
4484
+// }
4485
+// }
4486
+
4487
+ copy.versionindex -= 1;
4488
+
4489
+ CopyChanged();
4490
+
4491
+ return true;
4492
+ }
4493
+
4494
+ public boolean Restore()
4495
+ {
4496
+ System.err.println("Restore");
4497
+
4498
+ //cRadio tab = GetCurrentTab();
4499
+
4500
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4501
+ {
4502
+ java.awt.Toolkit.getDefaultToolkit().beep();
4503
+ return false;
4504
+ }
4505
+
4506
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4507
+ CopyChanged();
4508
+
4509
+ return true;
4510
+ }
4511
+
4512
+ public boolean Replace()
4513
+ {
4514
+ //System.err.println("Replace");
4515
+
4516
+ //cRadio tab = GetCurrentTab();
4517
+
4518
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4519
+ {
4520
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
4521
+ return false;
4522
+ }
4523
+
4524
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
4525
+
4526
+ return true;
4527
+ }
4528
+
4529
+ public void NextVersion()
4530
+ {
4531
+ // Option?
4532
+ Replace();
4533
+
4534
+ //cRadio tab = GetCurrentTab();
4535
+
4536
+ if (copy.versionlist[copy.versionindex + 1] == null)
4537
+ {
4538
+ java.awt.Toolkit.getDefaultToolkit().beep();
4539
+ return;
4540
+ }
4541
+
4542
+ copy.versionindex += 1;
4543
+
4544
+ CopyChanged();
4545
+
4546
+ //if (!tab.user[tab.versionindex])
4547
+ // tab.graphs[tab.versionindex] = null;
4548
+ }
4549
+
4550
+ void ImportGFD()
4551
+ {
4552
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4553
+ browser.show();
4554
+ String filename = browser.getFile();
4555
+ if (filename != null && filename.length() > 0)
4556
+ {
4557
+ String fullname = browser.getDirectory() + filename;
4558
+
4559
+ //Object3D readobj =
4560
+ objEditor.ReadGFD(fullname, objEditor);
4561
+ //makeSomething(readobj);
4562
+ }
4563
+ }
4564
+
4565
+ void ImportVRMLX3D()
4566
+ {
4567
+ if (Grafreed.standAlone)
4568
+ {
4569
+ /**/
4570
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4571
+ browser.show();
4572
+ String filename = browser.getFile();
4573
+ if (filename != null && filename.length() > 0)
4574
+ {
4575
+ String fullname = browser.getDirectory() + filename;
4576
+ LoadVRMLX3D(fullname);
4577
+ }
4578
+ /**/
4579
+ }
4580
+ }
4581
+
33144582 void ToggleAnimation()
33154583 {
33164584 if (!Globals.ANIMATION)
33174585 {
33184586 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3319
- browser.show();
4587
+ browser.setVisible(true);
33204588 String filename = browser.getFile();
33214589 if (filename != null && filename.length() > 0)
33224590 {
....@@ -3326,8 +4594,8 @@
33264594
33274595 Globals.ANIMATION ^= true;
33284596
3329
- GrafreeD.wav.cursor = 0;
3330
- GrafreeD.wav.loop = 0;
4597
+ Grafreed.wav.cursor = 0;
4598
+ Grafreed.wav.loop = 0;
33314599 }
33324600 } else
33334601 {
....@@ -3377,7 +4645,7 @@
33774645 void CreateMaterial()
33784646 {
33794647 //copy.ClearMaterial(); // PATCH
3380
- copy.CreateMaterialS(multiplyToggle.isSelected());
4648
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33814649 if (copy.selection.size() > 0)
33824650 //SetMaterial(copy);
33834651 {
....@@ -3428,7 +4696,7 @@
34284696 assert false;
34294697 }
34304698
3431
- void EditSelection()
4699
+ void EditSelection(boolean newWindow)
34324700 {
34334701 }
34344702
....@@ -3436,11 +4704,11 @@
34364704 {
34374705 copy.ResetBlockLoop(); // temporary problem
34384706
3439
- boolean random = CameraPane.RANDOM;
3440
- CameraPane.RANDOM = false; // parse everything
4707
+ boolean random = CameraPane.SWITCH;
4708
+ CameraPane.SWITCH = false; // parse everything
34414709 copy.ResetDisplayList();
34424710 copy.HardTouch();
3443
- CameraPane.RANDOM = random;
4711
+ CameraPane.SWITCH = random;
34444712 }
34454713
34464714 // public void applySelf()
....@@ -3487,7 +4755,7 @@
34874755 //copy.material = new cMaterial(copy.GetMaterial());
34884756
34894757 current.color = (float) colorField.getFloat();
3490
- current.modulation = (float) modulationField.getFloat();
4758
+ current.modulation = (float) saturationField.getFloat();
34914759 current.metalness = (float) metalnessField.getFloat();
34924760 current.diffuse = (float) diffuseField.getFloat();
34934761 current.specular = (float) specularField.getFloat();
....@@ -3510,10 +4778,40 @@
35104778 current.fakedepth = (float) fakedepthField.getFloat();
35114779 current.shadowbias = (float) shadowbiasField.getFloat();
35124780
3513
- if (!NumberSlider.frozen)
4781
+ if (!cNumberSlider.frozen)
35144782 {
35154783 //System.out.println("Propagate = " + propagate);
35164784 copy.UpdateMaterial(anchor, current, propagate);
4785
+
4786
+ if (copy.material != null)
4787
+ {
4788
+ cMaterial mat = copy.material;
4789
+
4790
+ colorField.SetToolTipValue((mat.color));
4791
+ saturationField.SetToolTipValue((mat.modulation));
4792
+ metalnessField.SetToolTipValue((mat.metalness));
4793
+ diffuseField.SetToolTipValue((mat.diffuse));
4794
+ specularField.SetToolTipValue((mat.specular));
4795
+ shininessField.SetToolTipValue((mat.shininess));
4796
+ shiftField.SetToolTipValue((mat.shift));
4797
+ ambientField.SetToolTipValue((mat.ambient));
4798
+ lightareaField.SetToolTipValue((mat.lightarea));
4799
+ diffusenessField.SetToolTipValue((mat.factor));
4800
+ velvetField.SetToolTipValue((mat.velvet));
4801
+ sheenField.SetToolTipValue((mat.sheen));
4802
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4803
+ backlitField.SetToolTipValue((mat.bump));
4804
+ anisoField.SetToolTipValue((mat.aniso));
4805
+ anisoVField.SetToolTipValue((mat.anisoV));
4806
+ cameraField.SetToolTipValue((mat.cameralight));
4807
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4808
+ shadowField.SetToolTipValue((mat.shadow));
4809
+ textureField.SetToolTipValue((mat.texture));
4810
+ opacityField.SetToolTipValue((mat.opacity));
4811
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4812
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4813
+ }
4814
+
35174815 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35184816 {
35194817 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3542,9 +4840,28 @@
35424840 //copy.Touch();
35434841 }
35444842
4843
+ cNumberSlider versionSlider;
4844
+
35454845 public void stateChanged(ChangeEvent e)
35464846 {
35474847 // assert(false);
4848
+ if (e.getSource() == versionSlider)
4849
+ {
4850
+ if (muteSlider)
4851
+ return;
4852
+
4853
+ Replace();
4854
+
4855
+ int version = versionSlider.getInteger();
4856
+
4857
+ if (version != -1 && copy.versionlist[version] != null)
4858
+ {
4859
+ copy.versionindex = version;
4860
+ CopyChanged();
4861
+ }
4862
+
4863
+ return;
4864
+ }
35484865
35494866 if (freezematerial)
35504867 {
....@@ -3558,6 +4875,7 @@
35584875 || e.getSource() == apertureField
35594876 || e.getSource() == shadowblurField)
35604877 {
4878
+ new Exception().printStackTrace();
35614879 System.exit(0);
35624880 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35634881 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3579,6 +4897,12 @@
35794897 {
35804898 //System.out.println("stateChanged = " + this);
35814899 materialtouched = true;
4900
+
4901
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
4902
+ {
4903
+ saturationField.setFloat(1);
4904
+ }
4905
+
35824906 applySelf();
35834907 //System.out.println("this = " + this);
35844908 //System.out.println("PARENT = " + parent);
....@@ -3628,7 +4952,7 @@
36284952 }
36294953
36304954 if (normalpushField != null)
3631
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
4955
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36324956 }
36334957
36344958 void SnapObject()
....@@ -3878,20 +5202,28 @@
38785202 {
38795203 if (GetTree() != null)
38805204 {
5205
+ GetTree().revalidate();
38815206 GetTree().repaint();
38825207 }
38835208
38845209 radioPanel.revalidate();
38855210 radioPanel.repaint();
3886
- ctrlPanel.revalidate(); // ? new
5211
+ ctrlPanel.validate(); // ? new
38875212 ctrlPanel.repaint();
38885213 }
5214
+
5215
+ if (previousVersionButton != null && copy.versionlist != null)
5216
+ SetVersionStates();
5217
+
5218
+ cameraView.requestFocusInWindow();
38895219 }
38905220
38915221 static TweenManager tweenManager = new TweenManager();
38925222
38935223 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38945224 {
5225
+ if (Globals.REPLACEONMAKE) // && resetmodel)
5226
+ Save();
38955227 //Tween.set(thing, 0).target(1).start(tweenManager);
38965228 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38975229 // if (thing instanceof GenericJointDemo)
....@@ -3915,7 +5247,7 @@
39155247 // group = (Composite) group.get(0);
39165248 // }
39175249
3918
- System.out.println("makeSomething of " + thing);
5250
+ //System.out.println("makeSomething of " + thing);
39195251
39205252 /*
39215253 if (deselect && jList != null)
....@@ -3978,6 +5310,12 @@
39785310 {
39795311 ResetModel();
39805312 Select(thing.GetTreePath(), true, false); // unselect... false);
5313
+
5314
+ if (thing.Size() == 0)
5315
+ {
5316
+ //EditSelection(false);
5317
+ }
5318
+
39815319 refreshContents();
39825320 }
39835321
....@@ -4095,6 +5433,7 @@
40955433 }
40965434 }
40975435 }
5436
+
40985437 LoadGFDThread loadGFDThread;
40995438
41005439 void ReadGFD(String fullname, iCallBack cb)
....@@ -4114,8 +5453,10 @@
41145453
41155454 try
41165455 {
5456
+ // Try compressed version first.
41175457 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4118
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
5458
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
5459
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
41195460
41205461 readobj = (Object3D) p.readObject();
41215462 istream.close();
....@@ -4123,7 +5464,22 @@
41235464 readobj.ResetDisplayList();
41245465 } catch (Exception e)
41255466 {
4126
- e.printStackTrace();
5467
+ if (!e.toString().contains("GZIP"))
5468
+ e.printStackTrace();
5469
+
5470
+ try
5471
+ {
5472
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
5473
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
5474
+
5475
+ readobj = (Object3D) p.readObject();
5476
+ istream.close();
5477
+
5478
+ readobj.ResetDisplayList();
5479
+ } catch (Exception e2)
5480
+ {
5481
+ e2.printStackTrace();
5482
+ }
41275483 }
41285484 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41295485 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4169,6 +5525,12 @@
41695525
41705526 void LoadIt(Object obj)
41715527 {
5528
+ if (obj == null)
5529
+ {
5530
+ // Invalid file
5531
+ return;
5532
+ }
5533
+
41725534 System.out.println("Loaded " + obj);
41735535 //new Exception().printStackTrace();
41745536 Object3D readobj = (Object3D) obj;
....@@ -4178,10 +5540,14 @@
41785540
41795541 if (readobj != null)
41805542 {
5543
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
5544
+ // Save();
41815545 try
41825546 {
41835547 //readobj.deepCopySelf(copy);
41845548 copy.clear(); // june 2014
5549
+ copy.skyboxname = readobj.skyboxname;
5550
+ copy.skyboxext = readobj.skyboxext;
41855551 for (int i = 0; i < readobj.size(); i++)
41865552 {
41875553 Object3D child = readobj.get(i); // reserve(i);
....@@ -4222,6 +5588,7 @@
42225588 }
42235589 } catch (ClassCastException e)
42245590 {
5591
+ e.printStackTrace();
42255592 assert (false);
42265593 Composite c = (Composite) copy;
42275594 c.children.clear();
....@@ -4232,17 +5599,32 @@
42325599 c.addChild(csg);
42335600 }
42345601
5602
+ copy.versionlist = readobj.versionlist;
5603
+ copy.versionindex = readobj.versionindex;
5604
+ copy.versiontable = readobj.versiontable;
5605
+
5606
+ if (copy.versionlist == null)
5607
+ {
5608
+ // Backward compatibility
5609
+ copy.versionlist = new Object3D[100];
5610
+ copy.versionindex = -1;
5611
+
5612
+ //Save(true);
5613
+ }
5614
+
5615
+ //? SetUndoStates();
5616
+
42355617 ResetModel();
42365618 copy.HardTouch(); // recompile?
42375619 refreshContents();
42385620 }
42395621 }
42405622
4241
- void load() // throws ClassNotFoundException
5623
+ void Open() // throws ClassNotFoundException
42425624 {
4243
- if (GrafreeD.standAlone)
5625
+ if (Grafreed.standAlone)
42445626 {
4245
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5627
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
42465628 browser.show();
42475629 String filename = browser.getFile();
42485630 if (filename != null && filename.length() > 0)
....@@ -4319,6 +5701,8 @@
43195701
43205702 void save()
43215703 {
5704
+ Replace();
5705
+
43225706 if (lastname == null)
43235707 {
43245708 return;
....@@ -4327,11 +5711,13 @@
43275711 try
43285712 {
43295713 FileOutputStream ostream = new FileOutputStream(lastname);
4330
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5714
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5715
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43315716
43325717 p.writeObject(copy);
43335718 p.flush();
43345719
5720
+ zstream.close();
43355721 ostream.close();
43365722
43375723 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4339,19 +5725,23 @@
43395725 //ps.print(buffer.toString());
43405726 } catch (IOException e)
43415727 {
5728
+ e.printStackTrace();
43425729 }
43435730 }
5731
+
43445732 String lastname;
43455733
43465734 void saveAs()
43475735 {
4348
- if (GrafreeD.standAlone)
5736
+ if (Grafreed.standAlone)
43495737 {
43505738 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43515739 browser.setVisible(true);
43525740 String filename = browser.getFile();
43535741 if (filename != null && filename.length() > 0)
43545742 {
5743
+ if (!filename.endsWith(".gfd"))
5744
+ filename += ".gfd";
43555745 lastname = browser.getDirectory() + filename;
43565746 save();
43575747 }
....@@ -4450,13 +5840,13 @@
44505840 try
44515841 {
44525842 FileOutputStream ostream = new FileOutputStream(filename);
4453
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4454
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5843
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5844
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44555845
44565846 Object3D objectparent = obj.parent;
44575847 obj.parent = null;
44585848
4459
- Object3D object = (Object3D) GrafreeD.clone(obj);
5849
+ Object3D object = (Object3D) Grafreed.clone(obj);
44605850
44615851 obj.parent = objectparent;
44625852
....@@ -4468,8 +5858,8 @@
44685858 p.writeObject(object);
44695859 p.flush();
44705860
5861
+ zstream.close();
44715862 ostream.close();
4472
- // zstream.close();
44735863
44745864 // group.selection.get(0).parent = parent;
44755865 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4490,7 +5880,7 @@
44905880 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44915881 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44925882 copy.generatePOV(buffer);
4493
- if (GrafreeD.standAlone)
5883
+ if (Grafreed.standAlone)
44945884 {
44955885 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44965886 browser.show();
....@@ -4516,21 +5906,20 @@
45165906 Object3D client;
45175907 Object3D copy;
45185908 MenuBar menuBar;
4519
- Menu windowMenu;
4520
- MenuItem loadItem;
5909
+ Menu fileMenu;
5910
+ MenuItem newItem;
5911
+ MenuItem openItem;
45215912 MenuItem saveItem;
45225913 MenuItem saveAsItem;
45235914 MenuItem exportAsItem;
45245915 MenuItem reexportItem;
45255916 MenuItem povItem;
45265917 MenuItem closeItem;
4527
- Menu cameraMenu;
5918
+
45285919 CheckboxMenuItem zBufferItem;
45295920 //MenuItem normalLensItem;
4530
- MenuItem editCameraItem;
4531
- MenuItem revertCameraItem;
4532
- CheckboxMenuItem toggleLiveItem;
45335921 MenuItem stepItem;
5922
+ CheckboxMenuItem toggleLiveItem;
45345923 CheckboxMenuItem toggleFullScreenItem;
45355924 CheckboxMenuItem toggleTimelineItem;
45365925 CheckboxMenuItem toggleRenderItem;
....@@ -4539,28 +5928,43 @@
45395928 CheckboxMenuItem toggleFootContactItem;
45405929 CheckboxMenuItem toggleDLItem;
45415930 CheckboxMenuItem toggleTextureItem;
4542
- CheckboxMenuItem toggleRandomItem;
5931
+ CheckboxMenuItem toggleSwitchItem;
45435932 CheckboxMenuItem toggleRootItem;
45445933 CheckboxMenuItem animationItem;
5934
+ MenuItem archiveItem;
45455935 CheckboxMenuItem toggleHandleItem;
45465936 CheckboxMenuItem togglePaintItem;
45475937 JSplitPane mainPanel;
45485938 JScrollPane scrollpane;
5939
+
45495940 JPanel toolbarPanel;
4550
- JPanel treePanel;
5941
+
5942
+ cGridBag treePanel;
5943
+
45515944 JPanel radioPanel;
45525945 ButtonGroup buttonGroup;
4553
- JPanel ctrlPanel;
4554
- JPanel materialPanel;
5946
+
5947
+ cGridBag toolboxPanel;
5948
+ cGridBag skyboxPanel;
5949
+ cGridBag materialPanel;
5950
+ cGridBag ctrlPanel;
5951
+
45555952 JScrollPane infoPanel;
4556
- JPanel optionsPanel;
5953
+
5954
+ cGridBag optionsPanel;
5955
+
45575956 JTabbedPane objectPanel;
5957
+ boolean materialFlushed;
5958
+ Object3D latestObject;
5959
+
45585960 cGridBag XYZPanel;
5961
+
45595962 JSplitPane gridPanel;
45605963 JSplitPane bigPanel;
5964
+
45615965 cGridBag bigThree;
4562
- JTabbedPane scenePanel;
4563
- JPanel centralPanel;
5966
+ cGridBag scenePanel;
5967
+ cGridBag centralPanel;
45645968 JSplitPane cameraPanel;
45655969 JPanel timelinePanel;
45665970 JMenuBar timelineMenubar;
....@@ -4613,67 +6017,74 @@
46136017 // MATERIAL
46146018 JLabel materialLabel;
46156019 JLabel colorLabel;
4616
- NumberSlider colorField;
6020
+ cNumberSlider colorField;
46176021 JLabel modulationLabel;
4618
- NumberSlider modulationField;
6022
+ cNumberSlider saturationField;
46196023 JLabel metalnessLabel;
4620
- NumberSlider metalnessField;
6024
+ cNumberSlider metalnessField;
46216025 JLabel diffuseLabel;
4622
- NumberSlider diffuseField;
6026
+ cNumberSlider diffuseField;
46236027 JLabel specularLabel;
4624
- NumberSlider specularField;
6028
+ cNumberSlider specularField;
46256029 JLabel shininessLabel;
4626
- NumberSlider shininessField;
6030
+ cNumberSlider shininessField;
46276031 JLabel shiftLabel;
4628
- NumberSlider shiftField;
6032
+ cNumberSlider shiftField;
46296033 JLabel ambientLabel;
4630
- NumberSlider ambientField;
6034
+ cNumberSlider ambientField;
46316035 JLabel lightareaLabel;
4632
- NumberSlider lightareaField;
6036
+ cNumberSlider lightareaField;
46336037 JLabel diffusenessLabel;
4634
- NumberSlider diffusenessField;
6038
+ cNumberSlider diffusenessField;
46356039 JLabel velvetLabel;
4636
- NumberSlider velvetField;
6040
+ cNumberSlider velvetField;
46376041 JLabel sheenLabel;
4638
- NumberSlider sheenField;
6042
+ cNumberSlider sheenField;
46396043 JLabel subsurfaceLabel;
4640
- NumberSlider subsurfaceField;
6044
+ cNumberSlider subsurfaceField;
46416045 //JLabel bumpLabel;
46426046 //NumberSlider bumpField;
46436047 JLabel backlitLabel;
4644
- NumberSlider backlitField;
6048
+ cNumberSlider backlitField;
46456049 JLabel anisoLabel;
4646
- NumberSlider anisoField;
6050
+ cNumberSlider anisoField;
46476051 JLabel anisoVLabel;
4648
- NumberSlider anisoVField;
6052
+ cNumberSlider anisoVField;
6053
+
46496054 JLabel cameraLabel;
4650
- NumberSlider cameraField;
6055
+ cNumberSlider cameraField;
46516056 JLabel selfshadowLabel;
4652
- NumberSlider selfshadowField;
6057
+ cNumberSlider selfshadowField;
46536058 JLabel shadowLabel;
4654
- NumberSlider shadowField;
6059
+ cNumberSlider shadowField;
46556060 JLabel textureLabel;
4656
- NumberSlider textureField;
6061
+ cNumberSlider textureField;
46576062 JLabel opacityLabel;
4658
- NumberSlider opacityField;
6063
+ cNumberSlider opacityField;
46596064 JLabel fakedepthLabel;
4660
- NumberSlider fakedepthField;
6065
+ cNumberSlider fakedepthField;
46616066 JLabel shadowbiasLabel;
4662
- NumberSlider shadowbiasField;
6067
+ cNumberSlider shadowbiasField;
6068
+
46636069 JLabel bumpLabel;
4664
- NumberSlider bumpField;
6070
+ cNumberSlider bumpField;
46656071 JLabel noiseLabel;
4666
- NumberSlider noiseField;
6072
+ cNumberSlider noiseField;
46676073 JLabel powerLabel;
4668
- NumberSlider powerField;
6074
+ cNumberSlider powerField;
46696075 JLabel borderfadeLabel;
4670
- NumberSlider borderfadeField;
6076
+ cNumberSlider borderfadeField;
46716077 JLabel fogLabel;
4672
- NumberSlider fogField;
6078
+ cNumberSlider fogField;
46736079 JLabel opacityPowerLabel;
4674
- NumberSlider opacityPowerField;
4675
- JTree jTree;
6080
+ cNumberSlider opacityPowerField;
6081
+ cTree jTree;
46766082 //ObjectUI parent;
46776083
4678
- NumberSlider normalpushField;
6084
+ cNumberSlider normalpushField;
6085
+
6086
+ private MenuItem importGFDItem;
6087
+ private MenuItem importVRMLX3DItem;
6088
+ private MenuItem import3DSItem;
6089
+ private MenuItem importOBJItem;
46796090 }