Normand Briere
2019-08-15 24a2a946b35279605e645349bd6b82e9e60aac88
ObjEditor.java
....@@ -4,6 +4,7 @@
44
55 import java.awt.*;
66 import java.awt.event.*;
7
+import java.awt.image.BufferedImage;
78 import javax.swing.*;
89 import javax.swing.event.*;
910 import javax.swing.text.*;
....@@ -14,10 +15,15 @@
1415 //import javax.swing.plaf.ColorUIResource;
1516 //import javax.swing.plaf.metal.DefaultMetalTheme;
1617
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
20
+
1721 //import javax.media.opengl.GLCanvas;
1822
1923 import //weka.core.
2024 matrix.Matrix;
25
+
26
+import grafeme.ui.*;
2127
2228 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
2329 ActionListener, ChangeListener,
....@@ -28,7 +34,100 @@
2834 iSendInfo
2935 //KeyListener
3036 {
37
+ public cToggleButton pinButton;
38
+ boolean timeline;
39
+ boolean wasFullScreen;
3140
41
+ GroupEditor callee;
42
+ JFrame frame;
43
+
44
+ static ObjEditor theFrame;
45
+
46
+ public cGridBag GetSeparator()
47
+ {
48
+ cGridBag separator = new cGridBag();
49
+ separator.add(new JSeparator());
50
+ separator.preferredHeight = 5;
51
+ return separator;
52
+ }
53
+
54
+ cButton GetButton(String name, boolean border)
55
+ {
56
+ ImageIcon icon = GetIcon(name);
57
+ return new cButton(icon, border);
58
+ }
59
+
60
+ cLabel GetLabel(String name, boolean border)
61
+ {
62
+ //ImageIcon icon = GetIcon(name);
63
+ return new cLabel(GetImage(name), border);
64
+ }
65
+
66
+ cToggleButton GetToggleButton(String name, boolean border)
67
+ {
68
+ ImageIcon icon = GetIcon(name);
69
+ return new cToggleButton(icon, border);
70
+ }
71
+
72
+ cCheckBox GetCheckBox(String name, boolean border)
73
+ {
74
+ ImageIcon icon = GetIcon(name);
75
+ return new cCheckBox(icon, border);
76
+ }
77
+
78
+ static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>();
79
+
80
+ ImageIcon GetIcon(String name)
81
+ {
82
+ javax.swing.ImageIcon iconCache = icons.get(name);
83
+ if (iconCache != null)
84
+ {
85
+ return iconCache;
86
+ }
87
+
88
+ try
89
+ {
90
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
91
+
92
+// if (image.getWidth() > 48 && image.getHeight() > 48)
93
+// {
94
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
95
+// Graphics2D g = resized.createGraphics();
96
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
97
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
98
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
99
+// g.dispose();
100
+//
101
+// image = resized;
102
+// }
103
+
104
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
105
+
106
+ icons.put(name, icon);
107
+
108
+ return icon;
109
+ }
110
+ catch (Exception e)
111
+ {
112
+ //icons.put(name, null);
113
+ return null;
114
+ }
115
+ }
116
+
117
+ BufferedImage GetImage(String name)
118
+ {
119
+ try
120
+ {
121
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
122
+
123
+ return image;
124
+ }
125
+ catch (Exception e)
126
+ {
127
+ return null;
128
+ }
129
+ }
130
+
32131 // SCRIPT
33132
34133 transient JFrame textpanel = null;
....@@ -119,51 +218,62 @@
119218 void keyPressed(int key, int modifiers)
120219 {
121220 System.out.println("KEY PRESSED");
122
- CameraPane.theRenderer.keyPressed(key, modifiers);
221
+ Globals.theRenderer.keyPressed(key, modifiers);
123222 }
124223 */
125224
126225 static GridBagConstraints aConstraints;
127226 static GridBagConstraints aWindowConstraints;
128
- GroupEditor callee;
129
- JFrame frame;
227
+
130228 static int GRIDWIDTH = 100; // 4;
131229
132230 public void closeUI()
133231 {
134232 //new Exception().printStackTrace();
135
- System.out.println("this = " + this);
136
- System.out.println("objEditor = " + objEditor);
233
+// System.out.println("this = " + this);
234
+// System.out.println("objEditor = " + objEditor);
137235 //nameField.removeActionListener(this);
138
- objEditor.ctrlPanel.remove(nameField);
236
+// objEditor.ctrlPanel.remove(nameField);
139237
140
- if (!GroupEditor.allparams)
238
+ objEditor.ctrlPanel.remove(namePanel);
239
+
240
+ if (!allparams)
141241 return;
142242
143
- objEditor.ctrlPanel.remove(liveCB);
144
- objEditor.ctrlPanel.remove(hideCB);
145
- objEditor.ctrlPanel.remove(markCB);
146
-
147
- objEditor.ctrlPanel.remove(randomCB);
148
- objEditor.ctrlPanel.remove(speedupCB);
149
- objEditor.ctrlPanel.remove(rewindCB);
150
-
151
- objEditor.ctrlPanel.remove(resetButton);
152
- objEditor.ctrlPanel.remove(stepButton);
153
-// objEditor.ctrlPanel.remove(stepAllButton);
154
-// objEditor.ctrlPanel.remove(resetAllButton);
155
- objEditor.ctrlPanel.remove(link2masterCB);
156
- //objEditor.ctrlPanel.remove(flipVCB);
157
- //objEditor.ctrlPanel.remove(texresMenu);
158
- objEditor.ctrlPanel.remove(slowerButton);
159
- objEditor.ctrlPanel.remove(fasterButton);
160
- objEditor.ctrlPanel.remove(remarkButton);
243
+// objEditor.ctrlPanel.remove(liveCB);
244
+// objEditor.ctrlPanel.remove(hideCB);
245
+// objEditor.ctrlPanel.remove(markCB);
246
+//
247
+// objEditor.ctrlPanel.remove(randomCB);
248
+// objEditor.ctrlPanel.remove(speedupCB);
249
+// objEditor.ctrlPanel.remove(rewindCB);
250
+//
251
+// objEditor.ctrlPanel.remove(resetButton);
252
+// objEditor.ctrlPanel.remove(stepButton);
253
+//// objEditor.ctrlPanel.remove(stepAllButton);
254
+//// objEditor.ctrlPanel.remove(resetAllButton);
255
+// objEditor.ctrlPanel.remove(link2masterCB);
256
+// //objEditor.ctrlPanel.remove(flipVCB);
257
+// //objEditor.ctrlPanel.remove(texresMenu);
258
+// objEditor.ctrlPanel.remove(slowerButton);
259
+// objEditor.ctrlPanel.remove(fasterButton);
260
+// objEditor.ctrlPanel.remove(remarkButton);
261
+
262
+ objEditor.ctrlPanel.remove(setupPanel);
263
+ objEditor.ctrlPanel.remove(setupPanel2);
264
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
265
+ objEditor.ctrlPanel.remove(pushPanel);
266
+ //objEditor.ctrlPanel.remove(fillPanel);
267
+
268
+ //Remove(normalpushField);
161269 }
162270
163271 public ObjEditor GetEditor()
164272 {
165273 return objEditor; //.GetEditor();
166274 }
275
+
276
+ // Sometimes myself, sometimes my callee's.
167277 ObjEditor objEditor;
168278
169279 /*
....@@ -199,6 +309,14 @@
199309 client = inClient;
200310 copy = client;
201311
312
+// if (copy.versionlist == null)
313
+// {
314
+// copy.versionlist = new Object3D[100];
315
+// copy.versionindex = -1;
316
+//
317
+// callee.Save(true);
318
+// }
319
+
202320 // "this" is not called: SetupUI2(objEditor);
203321 }
204322
....@@ -212,6 +330,14 @@
212330 client = inClient;
213331 copy = client;
214332
333
+ if (copy.versionlist == null)
334
+ {
335
+ copy.versionlist = new Object3D[100];
336
+ copy.versionindex = -1;
337
+
338
+// Save(true);
339
+ }
340
+
215341 SetupUI2(callee.GetEditor());
216342 }
217343
....@@ -226,6 +352,7 @@
226352 //localCopy.parent = null;
227353
228354 frame = new JFrame();
355
+ frame.setUndecorated(false);
229356 objEditor = this;
230357 this.callee = callee;
231358
....@@ -238,11 +365,19 @@
238365 //if (!isDisplayable())
239366 //setUndecorated(true);
240367
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
368
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242369 client = inClient;
243370 copy = localCopy;
244371 copy.editWindow = this;
245372
373
+// if (copy.versionlist == null)
374
+// {
375
+// copy.versionlist = new Object3D[100];
376
+// copy.versionindex = -1;
377
+//
378
+// Save(true);
379
+// }
380
+
246381 SetupMenu();
247382
248383 //SetupName(objEditor); // new
....@@ -256,28 +391,49 @@
256391 return frame.action(event, obj);
257392 }
258393
394
+ // Cannot work without static
395
+ static boolean allparams = true;
396
+
397
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
398
+
259399 void SetupMenu()
260400 {
261401 frame.setMenuBar(menuBar = new MenuBar());
262
- menuBar.add(windowMenu = new Menu("File"));
263
- windowMenu.add(loadItem = new MenuItem("Load..."));
264
- windowMenu.add("-");
265
- windowMenu.add(saveItem = new MenuItem("Save"));
266
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
402
+ menuBar.add(fileMenu = new Menu("File"));
403
+ fileMenu.add(newItem = new MenuItem("New"));
404
+ fileMenu.add(openItem = new MenuItem("Open..."));
405
+
406
+ //oe.menuBar.add(menu = new Menu("Include"));
407
+ Menu menu = new Menu("Import");
408
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
409
+ importOBJItem.addActionListener(this);
410
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
411
+ import3DSItem.addActionListener(this);
412
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
413
+ importVRMLX3DItem.addActionListener(this);
414
+ menu.add("-");
415
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
416
+ importGFDItem.addActionListener(this);
417
+ fileMenu.add(menu);
418
+ fileMenu.add("-");
419
+
420
+ fileMenu.add(saveItem = new MenuItem("Save"));
421
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267422 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
268
- windowMenu.add("-");
269
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
270
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
271
- windowMenu.add("-");
423
+ fileMenu.add("-");
424
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
425
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
426
+ fileMenu.add("-");
272427 if (client.parent != null)
273428 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
429
+ fileMenu.add(closeItem = new MenuItem("Close"));
275430 } else
276431 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
432
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278433 }
279434
280
- loadItem.addActionListener(this);
435
+ newItem.addActionListener(this);
436
+ openItem.addActionListener(this);
281437 saveItem.addActionListener(this);
282438 saveAsItem.addActionListener(this);
283439 exportAsItem.addActionListener(this);
....@@ -285,82 +441,103 @@
285441 //povItem.addActionListener(this);
286442 closeItem.addActionListener(this);
287443
288
- menuBar.add(cameraMenu = new Menu("View"));
289
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
290
- //zBufferItem.addActionListener(this);
291
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
292
- //normalLensItem.addActionListener(this);
293
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
294
- revertCameraItem.addActionListener(this);
295
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
296
- toggleFullScreenItem.addItemListener(this);
297
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
298
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
299
- toggleTimelineItem.addItemListener(this);
300
- cameraMenu.add("-");
301
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
302
- toggleTextureItem.addItemListener(this);
303
- toggleTextureItem.setState(CameraPane.textureon);
304
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
305
- toggleLiveItem.addItemListener(this);
306
- toggleLiveItem.setState(CameraPane.isLIVE());
307
- cameraMenu.add(stepItem = new MenuItem("Step"));
308
- stepItem.addActionListener(this);
309
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
310
-// toggleDLItem.addItemListener(this);
311
-// toggleDLItem.setState(false);
312
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
313
- toggleRenderItem.addItemListener(this);
314
- toggleRenderItem.setState(!CameraPane.frozen);
315
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
316
- toggleDebugItem.addItemListener(this);
317
- toggleDebugItem.setState(CameraPane.DEBUG);
318
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
319
- toggleFrustumItem.addItemListener(this);
320
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
321
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
322
- toggleFootContactItem.addItemListener(this);
323
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
324
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
325
- toggleRandomItem.addItemListener(this);
326
- toggleRandomItem.setState(CameraPane.RANDOM);
327
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
328
- toggleHandleItem.addItemListener(this);
329
- toggleHandleItem.setState(CameraPane.HANDLES);
330
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
331
- togglePaintItem.addItemListener(this);
332
- togglePaintItem.setState(CameraPane.PAINTMODE);
333
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
334
-// toggleRootItem.addItemListener(this);
335
-// toggleRootItem.setState(false);
336
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
337
-// animationItem.addItemListener(this);
338
-// animationItem.setState(CameraPane.ANIMATION);
339
- cameraMenu.add("-");
340
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
341
- editCameraItem.addActionListener(this);
342
-
343444 objectPanel = new JTabbedPane();
445
+
446
+ ChangeListener changeListener = new ChangeListener()
447
+ {
448
+ //String name;
449
+
450
+ public void stateChanged(ChangeEvent changeEvent)
451
+ {
452
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
453
+// {
454
+// if (latestObject != null)
455
+// {
456
+// refreshContents(true);
457
+// SetMaterial(latestObject);
458
+// }
459
+//
460
+// materialFlushed = true;
461
+// }
462
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
463
+// {
464
+// if (listUI.size() == 0)
465
+// EditSelection(false);
466
+// }
467
+
468
+// if (objectPanel.getSelectedIndex() == 4)
469
+// {
470
+// name = copy.skyboxname;
471
+//
472
+// if (name == null)
473
+// {
474
+// name = "";
475
+// }
476
+//
477
+// copy.skyboxname = "cubemaps/default-skyboxes/rgb";
478
+// copy.skyboxext = "jpg";
479
+// }
480
+// else
481
+// {
482
+// if (name != null)
483
+// {
484
+// if (name.equals(""))
485
+// {
486
+// copy.skyboxname = null;
487
+// copy.skyboxext = null;
488
+// }
489
+// else
490
+// {
491
+// copy.skyboxname = name;
492
+// }
493
+// }
494
+// }
495
+ cameraView.transformMode = objectPanel.getSelectedIndex() == 4;
496
+
497
+// refreshContents(false); // To refresh Info tab
498
+ cameraView.repaint();
499
+ }
500
+ };
501
+ objectPanel.addChangeListener(changeListener);
502
+
344503 toolbarPanel = new JPanel();
345504 toolbarPanel.setName("Toolbar");
346
- treePanel = new JPanel();
505
+
506
+ treePanel = new cGridBag();
347507 treePanel.setName("Tree");
348
- ctrlPanel = new JPanel(); // new GridBagLayout());
349
- ctrlPanel.setName("Edit");
350
- materialPanel = new JPanel();
351
- materialPanel.setName("Material");
508
+
509
+ editPanel = new cGridBag().setVertical(true);
510
+ //editPanel.setName("Edit");
511
+
512
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
513
+
514
+ editCommandsPanel = new cGridBag();
515
+ editPanel.add(editCommandsPanel);
516
+ editPanel.add(ctrlPanel);
517
+
518
+ toolboxPanel = new cGridBag().setVertical(true);
519
+ //toolboxPanel.setName("Toolbox");
520
+
521
+ skyboxPanel = new cGridBag().setVertical(true);
522
+
523
+ materialPanel = new cGridBag().setVertical(false);
524
+ //materialPanel.setName("Material");
525
+
352526 /*JTextPane*/
353527 infoarea = createTextPane();
528
+ doc = infoarea.getStyledDocument();
529
+
354530 infoarea.setEditable(true);
355531 SetText();
532
+
356533 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
357534 // infoarea.setOpaque(false);
358535 // //infoarea.setForeground(textcolor);
359
- infoarea.setLineWrap(true);
360
- infoarea.setWrapStyleWord(true);
536
+// TEXTAREA infoarea.setLineWrap(true);
537
+// TEXTAREA infoarea.setWrapStyleWord(true);
361538 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
362
- infoPanel.setPreferredSize(new Dimension(50, 200));
363
- infoPanel.setName("Info");
539
+ infoPanel.setPreferredSize(new Dimension(1, 1));
540
+ //infoPanel.setName("Info");
364541 //infoPanel.setLayout(new BorderLayout());
365542 //infoPanel.add(createTextPane());
366543
....@@ -368,16 +545,23 @@
368545 mainPanel.setName("Main");
369546 mainPanel.setContinuousLayout(true);
370547 mainPanel.setOneTouchExpandable(true);
371
- mainPanel.setDividerLocation(1.0);
372548 mainPanel.setDividerSize(9);
373
- mainPanel.setResizeWeight(0);
374
-
549
+ mainPanel.setDividerLocation(0.5); //1.0);
550
+ mainPanel.setResizeWeight(0.5);
551
+
552
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
553
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
554
+ divider.setDividerSize(15);
555
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
556
+
557
+ mainPanel.setUI(new BasicSplitPaneUI());
558
+
375559 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
376560 //mainPanel.setLayout(new GridBagLayout());
377561 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
378
- treePanel.setLayout(new GridBagLayout());
379
- ctrlPanel.setLayout(new GridBagLayout());
380
- materialPanel.setLayout(new GridBagLayout());
562
+// treePanel.setLayout(new GridBagLayout());
563
+ //ctrlPanel.setLayout(new GridBagLayout());
564
+ //materialPanel.setLayout(new GridBagLayout());
381565
382566 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
383567 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -416,7 +600,7 @@
416600 static String newline = "\n";
417601 protected static final String buttonString = "JButton";
418602 StyledDocument doc;
419
- JTextArea infoarea;
603
+ JTextPane infoarea;
420604
421605 void ClearInfo()
422606 {
....@@ -439,10 +623,10 @@
439623 e.printStackTrace();
440624 }
441625
442
- String selection = infoarea.getText();
443
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
444
- java.awt.datatransfer.Clipboard clipboard =
445
- Toolkit.getDefaultToolkit().getSystemClipboard();
626
+// String selection = infoarea.getText();
627
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
628
+// java.awt.datatransfer.Clipboard clipboard =
629
+// Toolkit.getDefaultToolkit().getSystemClipboard();
446630 //clipboard.setContents(data, data);
447631 }
448632
....@@ -465,13 +649,13 @@
465649 //SendInfo("Name:", "bold");
466650 if (sel.GetTextures() != null || debug)
467651 {
468
- si.SendInfo(sel.toString(), "bold");
652
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
469653 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
470654 if (sel.Size() > 0)
471655 {
472656 si.SendInfo("#children = " + sel.Size(), "regular");
473657 }
474
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
658
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
475659 if (debug)
476660 {
477661 try
....@@ -483,7 +667,10 @@
483667 }
484668
485669 if (full)
486
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
670
+ {
671
+ si.SendInfo(" BBox min: " + minima, "regular");
672
+ si.SendInfo(" BBox max: " + maxima, "regular");
673
+ }
487674
488675 if (sel.bRep != null)
489676 {
....@@ -510,7 +697,7 @@
510697 }
511698 if (sel.support != null)
512699 {
513
- si.SendInfo(" support: " + sel.support, "regular");
700
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
514701 }
515702 if (sel.scriptnode != null)
516703 {
....@@ -581,6 +768,9 @@
581768 {
582769 CameraPane.pointflow = (PointFlow) sel;
583770 }
771
+
772
+ si.SendInfo("_____________________", "regular");
773
+ si.SendInfo("", "regular");
584774 }
585775 }
586776
....@@ -596,52 +786,205 @@
596786 }
597787 }
598788
599
- private JTextArea createTextPane()
600
- {
601
- String[] initString =
602
- {
603
- "This is an editable JTextPane, ", //regular
604
- "another ", //italic
605
- "styled ", //bold
606
- "text ", //small
607
- "component, ", //large
608
- "which supports embedded components..." + newline,//regular
609
- " " + newline, //button
610
- "...and embedded icons..." + newline, //regular
611
- " ", //icon
612
- newline + "JTextPane is a subclass of JEditorPane that "
613
- + "uses a StyledEditorKit and StyledDocument, and provides "
614
- + "cover methods for interacting with those objects."
615
- };
789
+//static GraphicsDevice device = GraphicsEnvironment
790
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
616791
617
- String[] initStyles =
618
- {
619
- "regular", "italic", "bold", "small", "large",
620
- "regular", "button", "regular", "icon",
621
- "regular"
622
- };
792
+ Rectangle keeprect;
793
+ cRadio radio;
794
+
795
+cButton keepButton;
796
+ cButton twoButton; // Full 3D
797
+ cButton sixButton;
798
+ cButton threeButton;
799
+ cButton sevenButton;
800
+ cButton fourButton; // full panel
801
+ cButton oneButton; // full XYZ
802
+ //cButton currentLayout;
803
+
804
+ boolean maximized;
805
+
806
+ cButton fullscreenLayout;
807
+ cButton expandedLayout;
623808
624
- JTextPane textPane = new JTextPane();
625
- textPane.setEditable(true);
626
- /*StyledDocument*/ doc = textPane.getStyledDocument();
627
- addStylesToDocument(doc);
628
-
629
- try
809
+ void Minimize()
630810 {
631
- for (int j = 0; j < 2; j++)
811
+ frame.setState(Frame.ICONIFIED);
812
+ frame.validate();
813
+ }
814
+
815
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
816
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
817
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
818
+ void Maximize()
819
+ {
820
+ if (CameraPane.FULLSCREEN)
632821 {
633
- for (int i = 0; i < initString.length; i++)
634
- {
635
- doc.insertString(doc.getLength(), initString[i],
636
- doc.getStyle(initStyles[i]));
637
- }
822
+ ToggleFullScreen();
638823 }
639
- } catch (BadLocationException ble)
824
+
825
+ if (maximized)
826
+ {
827
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
828
+ }
829
+ else
830
+ {
831
+ keeprect = frame.getBounds();
832
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
833
+// Dimension rect2 = frame.getToolkit().getScreenSize();
834
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
835
+// frame.setState(Frame.MAXIMIZED_BOTH);
836
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
837
+ }
838
+
839
+ maximized ^= true;
840
+
841
+ frame.validate();
842
+ }
843
+
844
+ cButton minButton;
845
+ cButton maxButton;
846
+ cButton fullButton;
847
+ cButton collapseButton;
848
+ cButton maximize3DButton;
849
+
850
+ void ToggleFullScreen()
640851 {
641
- System.err.println("Couldn't insert initial text into text pane.");
852
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
853
+
854
+ cameraView.ToggleFullScreen();
855
+
856
+ if (!CameraPane.FULLSCREEN)
857
+ {
858
+ device.setFullScreenWindow(null);
859
+ frame.dispose();
860
+ frame.setUndecorated(false);
861
+ frame.validate();
862
+ frame.setVisible(true);
863
+
864
+ //frame.setVisible(false);
865
+// frame.removeNotify();
866
+// frame.setUndecorated(false);
867
+// frame.addNotify();
868
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
869
+
870
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
871
+// X framePanel.add(bigThree);
872
+// X frame.getContentPane().add(/*"Center",*/framePanel);
873
+// framePanel.setDividerLocation(46); // icons are 24x24
874
+
875
+ //frame.setVisible(true);
876
+// radio.layout = keepButton;
877
+ //theFrame = null;
878
+ keepButton = null;
879
+// radio.layout.doClick();
880
+
881
+ } else
882
+ {
883
+ keepButton = radio.layout;
884
+ //keeprect = frame.getBounds();
885
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
886
+// frame.getToolkit().getScreenSize().height);
887
+ //frame.setVisible(false);
888
+
889
+ frame.dispose();
890
+ frame.setUndecorated(true);
891
+ device.setFullScreenWindow(frame);
892
+ frame.validate();
893
+ frame.setVisible(true);
894
+// frame.removeNotify();
895
+// frame.setUndecorated(true);
896
+// frame.addNotify();
897
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
898
+// X framePanel.remove(bigThree);
899
+// X frame.getContentPane().add(/*"Center",*/bigThree);
900
+// framePanel.setDividerLocation(0);
901
+
902
+// radio.layout = fullscreenLayout;
903
+// radio.layout.doClick();
904
+ //frame.setVisible(true);
905
+ }
906
+ frame.validate();
907
+
908
+ cameraView.requestFocusInWindow();
642909 }
643910
644
- return new JTextArea(); // textPane;
911
+ void CollapseToolbar()
912
+ {
913
+ framePanel.setDividerLocation(0);
914
+ //frame.validate();
915
+
916
+ cameraView.requestFocusInWindow();
917
+ }
918
+
919
+ private Object3D Duplicate(Object3D object)
920
+ {
921
+ boolean temp = CameraPane.SWITCH;
922
+ CameraPane.SWITCH = false;
923
+
924
+ object.ExtractBigData(versiontable);
925
+ // if (copy == client)
926
+
927
+ Object3D versions[] = object.versionlist;
928
+ object.versionlist = null;
929
+
930
+ //byte[] compress = Compress(copy);
931
+ Object3D compress = (Object3D)Grafreed.clone(object);
932
+
933
+ object.versionlist = versions;
934
+
935
+ object.RestoreBigData(versiontable);
936
+
937
+ CameraPane.SWITCH = temp;
938
+
939
+ return compress;
940
+ }
941
+
942
+ private JTextPane createTextPane()
943
+ {
944
+// TEXTAREA String[] initString =
945
+// {
946
+// "This is an editable JTextPane, ", //regular
947
+// "another ", //italic
948
+// "styled ", //bold
949
+// "text ", //small
950
+// "component, ", //large
951
+// "which supports embedded components..." + newline,//regular
952
+// " " + newline, //button
953
+// "...and embedded icons..." + newline, //regular
954
+// " ", //icon
955
+// newline + "JTextPane is a subclass of JEditorPane that "
956
+// + "uses a StyledEditorKit and StyledDocument, and provides "
957
+// + "cover methods for interacting with those objects."
958
+// };
959
+//
960
+// String[] initStyles =
961
+// {
962
+// "regular", "italic", "bold", "small", "large",
963
+// "regular", "button", "regular", "icon",
964
+// "regular"
965
+// };
966
+//
967
+// JTextPane textPane = new JTextPane();
968
+// textPane.setEditable(true);
969
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
970
+// addStylesToDocument(doc);
971
+//
972
+// try
973
+// {
974
+// for (int j = 0; j < 2; j++)
975
+// {
976
+// for (int i = 0; i < initString.length; i++)
977
+// {
978
+// doc.insertString(doc.getLength(), initString[i],
979
+// doc.getStyle(initStyles[i]));
980
+// }
981
+// }
982
+// } catch (BadLocationException ble)
983
+// {
984
+// System.err.println("Couldn't insert initial text into text pane.");
985
+// }
986
+
987
+ return new JTextPane(); // textPane;
645988 }
646989
647990 protected void addStylesToDocument(StyledDocument doc)
....@@ -694,7 +1037,7 @@
6941037 protected static ImageIcon createImageIcon(String path,
6951038 String description)
6961039 {
697
- java.net.URL imgURL = GrafreeD.class.getResource(path);
1040
+ java.net.URL imgURL = Grafreed.class.getResource(path);
6981041 if (imgURL != null)
6991042 {
7001043 return new ImageIcon(imgURL, description);
....@@ -717,6 +1060,7 @@
7171060 {
7181061 SetupMaterial(materialPanel);
7191062 }
1063
+
7201064 //SetupName();
7211065 //SetupViews();
7221066 }
....@@ -726,6 +1070,7 @@
7261070 // NumberSlider vDivsField;
7271071 // JCheckBox endcaps;
7281072 JCheckBox liveCB;
1073
+ JCheckBox selectableCB;
7291074 JCheckBox hideCB;
7301075 JCheckBox link2masterCB;
7311076 JCheckBox markCB;
....@@ -733,7 +1078,12 @@
7331078 JCheckBox speedupCB;
7341079 JCheckBox rewindCB;
7351080 JCheckBox flipVCB;
1081
+
1082
+ cCheckBox toggleTextureCB;
1083
+ cCheckBox toggleSwitchCB;
1084
+
7361085 JComboBox texresMenu;
1086
+
7371087 JButton resetButton;
7381088 JButton stepButton;
7391089 JButton stepAllButton;
....@@ -741,115 +1091,87 @@
7411091 JButton slowerButton;
7421092 JButton fasterButton;
7431093 JButton remarkButton;
1094
+
1095
+ cGridBag editPanel;
1096
+ cGridBag editCommandsPanel;
1097
+
1098
+ cGridBag namePanel;
1099
+ cGridBag setupPanel;
1100
+ cGridBag setupPanel2;
1101
+ cGridBag objectCommandsPanel;
1102
+ cGridBag pushPanel;
1103
+ cGridBag fillPanel;
7441104
745
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1105
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7461106 {
7471107 JCheckBox cb;
7481108
749
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
750
- oe.aConstraints.gridwidth = 1; // 3;
751
-// oe.aConstraints.weightx = 1;
752
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
753
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1109
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7541110 cb.addItemListener(this);
755
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
756
- oe.aConstraints.gridwidth = 1;
757
- oe.aConstraints.gridx += 1;
7581111
7591112 return cb;
7601113 }
7611114
762
- cButton AddButton(ObjEditor oe, String label)
1115
+ cButton AddButton(cGridBag panel, String label)
7631116 {
7641117 cButton cb;
7651118
766
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
767
- oe.aConstraints.gridwidth = 1;
768
-// oe.aConstraints.weightx = 1;
769
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
770
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1119
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7711120 cb.addActionListener(this);
772
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
773
- oe.aConstraints.gridwidth = 1;
774
- oe.aConstraints.gridx += 1;
7751121
7761122 return cb;
7771123 }
7781124
779
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1125
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
7801126 {
7811127 JComboBox combo;
7821128
783
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
784
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
785
- oe.aConstraints.gridx += 1;
1129
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7861130 combo.addActionListener(this);
7871131
7881132 return combo;
7891133 }
7901134
791
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
1135
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
7921136 {
793
- NumberSlider combo;
1137
+ cGridBag control = new cGridBag();
1138
+
1139
+ cNumberSlider combo;
7941140
7951141 JLabel jlabel = new JLabel(label);
796
-
797
- aConstraints.fill = GridBagConstraints.VERTICAL;
7981142 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
799
- aConstraints.gridwidth = 2;
800
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
801
- aConstraints.gridx += 1;
802
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
803
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
804
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
805
- aConstraints.gridx += 1;
806
- aConstraints.gridwidth = 1;
807
-
1143
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1144
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8081145 combo.setFloat(current);
809
-
810
- combo.label = jlabel;
811
-
812
- combo.addChangeListener(this);
813
-
814
- return combo;
1146
+
1147
+ panel.add(control);
1148
+
1149
+ return control;
8151150 }
8161151
817
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
1152
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8181153 {
819
- NumberSlider combo;
1154
+ cGridBag control = new cGridBag();
1155
+
1156
+ cNumberSlider combo;
8201157
8211158 JLabel jlabel = new JLabel(label);
822
-
823
- aConstraints.fill = GridBagConstraints.VERTICAL;
8241159 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
825
- aConstraints.gridwidth = 2;
826
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827
- aConstraints.gridx += 1;
828
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
829
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
830
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
831
- aConstraints.gridx += 1;
832
- aConstraints.gridwidth = 1;
833
-
1160
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1161
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8341162 combo.setInteger(current);
8351163
836
- combo.label = jlabel;
837
-
838
- combo.addChangeListener(this);
839
-
840
- return combo;
1164
+ panel.add(control);
1165
+
1166
+ return control;
8411167 }
8421168
843
- JTextArea AddText(JPanel ctrlPanel, String name)
1169
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8441170 {
8451171 JTextArea text;
8461172
847
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
848
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
849
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1173
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8501174 text.addCaretListener(this);
851
- aConstraints.gridx += 1;
852
- aConstraints.gridwidth = 1;
8531175
8541176 return text;
8551177 }
....@@ -879,9 +1201,16 @@
8791201 objEditor.ctrlPanel.remove(j);
8801202 }
8811203
1204
+ void Remove(cNumberSlider j)
1205
+ {
1206
+ j.removeChangeListener(this);
1207
+ //objEditor.ctrlPanel.remove(j.label);
1208
+ objEditor.ctrlPanel.remove(j);
1209
+ }
1210
+
8821211 /*
8831212 */
884
- void Return() // ObjEditor oe)
1213
+ void Return0() // ObjEditor oe)
8851214 {
8861215 aConstraints.gridy += 1;
8871216 aConstraints.gridx = 0;
....@@ -936,35 +1265,93 @@
9361265
9371266 void SetupUI2(ObjEditor oe)
9381267 {
939
-// oe.aConstraints.weightx = 0;
940
-// oe.aConstraints.weighty = 0;
941
-// oe.aConstraints.gridx = 0;
942
-// oe.aConstraints.gridy = 0;
943
- SetupName(oe);
1268
+ //SetupName(oe);
9441269
945
- if (!GroupEditor.allparams)
1270
+ namePanel = new cGridBag();
1271
+
1272
+ //if (copy.pinned)
1273
+ {
1274
+ pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1275
+ pinButton.setSelected(copy.pinned);
1276
+ cGridBag t = new cGridBag();
1277
+ t.preferredWidth = 2;
1278
+ t.add(pinButton);
1279
+ namePanel.add(t);
1280
+
1281
+ pinButton.addItemListener(this);
1282
+ }
1283
+
1284
+ nameField = AddText(namePanel, copy.GetName());
1285
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
1286
+ oe.ctrlPanel.add(namePanel);
1287
+
1288
+ oe.ctrlPanel.Return();
1289
+
1290
+ if (!allparams)
9461291 return;
9471292
948
- liveCB = AddCheckBox(oe, "Live", copy.live);
949
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
950
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1293
+ setupPanel = new cGridBag().setVertical(false);
1294
+
1295
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1296
+ liveCB.setToolTipText("Animate object");
1297
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1298
+ selectableCB.setToolTipText("Make object selectable");
9511299 // Return();
952
- markCB = AddCheckBox(oe, "Mark", copy.marked);
953
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
954
- randomCB = AddCheckBox(oe, "Rand", copy.random);
955
- Return();
956
- resetButton = AddButton(oe, "Reset");
957
- stepButton = AddButton(oe, "Step");
1300
+
1301
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1302
+ hideCB.setToolTipText("Hide object");
1303
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1304
+ markCB.setToolTipText("As animation target transform");
1305
+
1306
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
1307
+
1308
+ setupPanel2 = new cGridBag().setVertical(false);
1309
+
1310
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1311
+ rewindCB.setToolTipText("Rewind animation");
1312
+
1313
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1314
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1315
+
1316
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1317
+ link2masterCB.setToolTipText("Attach to support");
1318
+
1319
+ if (Globals.ADVANCED)
1320
+ {
1321
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1322
+ speedupCB.setToolTipText("Option motion capture");
1323
+ }
1324
+
1325
+ oe.ctrlPanel.add(setupPanel);
1326
+ oe.ctrlPanel.Return();
1327
+ oe.ctrlPanel.add(setupPanel2);
1328
+ oe.ctrlPanel.Return();
1329
+
1330
+ objectCommandsPanel = new cGridBag().setVertical(false);
1331
+
1332
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1333
+ resetButton.setToolTipText("Jump to frame zero");
1334
+ stepButton = AddButton(objectCommandsPanel, "Step");
1335
+ stepButton.setToolTipText("Step one frame");
9581336 // resetAllButton = AddButton(oe, "Reset All");
9591337 // stepAllButton = AddButton(oe, "Step All");
960
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9611338 // Return();
962
- slowerButton = AddButton(oe, "Slow");
963
- fasterButton = AddButton(oe, "Fast");
964
- remarkButton = AddButton(oe, "Rem");
1339
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1340
+ slowerButton.setToolTipText("Decrease animation speed");
1341
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1342
+ fasterButton.setToolTipText("Increase animation speed");
1343
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1344
+ remarkButton.setToolTipText("Set the current transform as the target");
9651345
966
- Return();
1346
+ oe.ctrlPanel.add(objectCommandsPanel);
1347
+ oe.ctrlPanel.Return();
9671348
1349
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1350
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1351
+ //Return();
1352
+
1353
+ oe.ctrlPanel.Return();
1354
+
9681355 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9691356 // ObjEditor.aConstraints.gridx += 1;
9701357
....@@ -1058,7 +1445,7 @@
10581445 oe.aConstraints.gridwidth = 1;
10591446 /**/
10601447 nameField = AddText(oe.ctrlPanel, copy.GetName());
1061
- Return();
1448
+ oe.ctrlPanel.Return();
10621449
10631450 //ctrlPanel.add(textureButton = new Button("Texture..."));
10641451 //textureButton.setEnabled(false);
....@@ -1160,11 +1547,25 @@
11601547 //JPanel worldPanel =
11611548 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11621549 //worldPanel.setName("World");
1163
- centralPanel = new JPanel(new BorderLayout());
1164
- timelinePanel = new JPanel(new BorderLayout());
1165
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1550
+ centralPanel = new cGridBag();
1551
+ centralPanel.preferredWidth = 20;
1552
+
1553
+ if (Globals.ADVANCED)
1554
+ {
1555
+ timelinePanel = new JPanel(new BorderLayout());
1556
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11661557
1558
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1559
+ cameraPanel.setContinuousLayout(true);
1560
+ cameraPanel.setOneTouchExpandable(true);
1561
+// cameraPanel.setDividerLocation(0.9);
1562
+// cameraPanel.setDividerSize(9);
1563
+ cameraPanel.setResizeWeight(1.0);
1564
+
1565
+ }
1566
+
11671567 centralPanel.add(cameraView);
1568
+ centralPanel.setFocusable(true);
11681569 //frame.setJMenuBar(timelineMenubar);
11691570 //centralPanel.add(timelinePanel);
11701571
....@@ -1183,12 +1584,14 @@
11831584 //frontView.object = copy;
11841585 //sideView.object = copy;
11851586
1186
- XYZPanel = new JPanel();
1187
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1587
+ XYZPanel = new cGridBag().setVertical(true);
1588
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11881589
1189
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1190
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1191
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1590
+ XYZPanel.preferredWidth = 5;
1591
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1592
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1593
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1594
+ //XYZPanel.setName("XYZ");
11921595
11931596 /*
11941597 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1226,12 +1629,29 @@
12261629 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12271630 //tmp.setName("Edit");
12281631 objectPanel.add(materialPanel);
1229
- JPanel north = new JPanel(new BorderLayout());
1230
- north.setName("Edit");
1231
- north.add(ctrlPanel, BorderLayout.NORTH);
1232
- objectPanel.add(north);
1233
- objectPanel.add(infoPanel);
1632
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1633
+ objectPanel.setToolTipTextAt(0, "Material");
1634
+
1635
+ objectPanel.add(toolboxPanel);
1636
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1637
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
12341638
1639
+ objectPanel.add(skyboxPanel);
1640
+ objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1641
+ objectPanel.setToolTipTextAt(2, "Backgrounds");
1642
+
1643
+// JPanel north = new JPanel(new BorderLayout());
1644
+// north.setName("Edit");
1645
+// north.add(ctrlPanel, BorderLayout.NORTH);
1646
+// objectPanel.add(north);
1647
+ objectPanel.add(editPanel);
1648
+ objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1649
+ objectPanel.setToolTipTextAt(3, "Edit controls");
1650
+
1651
+ objectPanel.add(XYZPanel);
1652
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1653
+ objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
1654
+
12351655 /*
12361656 aConstraints.gridx = 0;
12371657 aConstraints.gridwidth = 1;
....@@ -1239,7 +1659,7 @@
12391659 aConstraints.gridy += 1;
12401660 aConstraints.gridwidth = 1;
12411661 mainPanel.add(objectPanel, aConstraints);
1242
- */
1662
+ */
12431663
12441664 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12451665 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1250,17 +1670,29 @@
12501670 scrollpane.setWheelScrollingEnabled(true);
12511671 scrollpane.addMouseWheelListener(this); // Default not fast enough
12521672
1253
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1254
- scenePanel.add(scrollpane);
1673
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1674
+ scenePanel.preferredWidth = 5;
1675
+
1676
+ JTabbedPane tabbedPane = new JTabbedPane();
1677
+ tabbedPane.add(scrollpane);
12551678
1256
- scenePanel.add(FSPane = new cFileSystemPane(this));
1257
-
1258
- optionsPanel = new JPanel(new GridBagLayout());
1679
+ optionsPanel = new cGridBag().setVertical(false);
12591680
12601681 optionsPanel.setName("Options");
1261
- scenePanel.add(optionsPanel);
1682
+
1683
+ AddOptions(optionsPanel); //, aConstraints);
1684
+
1685
+ tabbedPane.add(optionsPanel);
1686
+
1687
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12621688
1689
+ scenePanel.add(tabbedPane);
12631690
1691
+ //if (Globals.ADVANCED)
1692
+// tabbedPane.add(infoPanel);
1693
+// tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1694
+// tabbedPane.setToolTipTextAt(3, "Information");
1695
+
12641696 /*
12651697 cTree jTree = new cTree(null);
12661698 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1293,6 +1725,7 @@
12931725 //bigPanel.setSize(new Dimension(10,10));
12941726 //bigPanel.add(ctrlPanel);
12951727 //bigPanel.add(gridPanel);
1728
+ /**
12961729 bigThree = new JPanel();
12971730 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12981731 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1316,7 +1749,13 @@
13161749 // aConstraints.gridheight = 3;
13171750 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13181751 bigThree.add(XYZPanel, aWindowConstraints);
1752
+ /**/
13191753
1754
+ bigThree = new cGridBag();
1755
+ bigThree.addComponent(scenePanel);
1756
+ bigThree.addComponent(centralPanel);
1757
+ //bigThree.addComponent(XYZPanel);
1758
+
13201759 // // SIDE EFFECT!!!
13211760 // aConstraints.gridx = 0;
13221761 // aConstraints.gridy = 0;
....@@ -1324,33 +1763,55 @@
13241763 // aConstraints.gridheight = 1;
13251764
13261765 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1327
- framePanel.setContinuousLayout(true);
1328
- framePanel.setOneTouchExpandable(true);
1329
- framePanel.setDividerLocation(0.8);
1766
+
1767
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
1768
+ new java.beans.PropertyChangeListener()
1769
+ {
1770
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
1771
+ {
1772
+ if ((Integer)pce.getOldValue() == 1)
1773
+ {
1774
+ if (radio.layout != expandedLayout)
1775
+ {
1776
+ radio.layout = expandedLayout;
1777
+ radio.layout.doClick();
1778
+ }
1779
+ }
1780
+ }
1781
+ });
1782
+
1783
+ framePanel.setContinuousLayout(false);
1784
+ framePanel.setOneTouchExpandable(false);
1785
+ //.setDividerLocation(0.8);
13301786 //framePanel.setDividerSize(15);
13311787 //framePanel.setResizeWeight(0.15);
13321788 framePanel.setName("Frame");
13331789
13341790 frame.getContentPane().setLayout(new BorderLayout());
13351791 /**/
1336
- JTabbedPane worldPane = new JTabbedPane();
1792
+ //JTabbedPane worldPane = new JTabbedPane();
13371793 //worldPane.add(bigPanel);
13381794 //worldPane.add(worldPanel);
13391795 /**/
1340
- frame.getContentPane().add(/*"Center",*/framePanel);
1796
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1797
+ frame.add(/*"Center",*/framePanel);
13411798 //frame.getContentPane().add(/*"Center",*/ worldPane);
13421799
13431800 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13441801
1345
- frame.setSize(1024, 768);
1346
- frame.show();
1347
-
1802
+ frame.setSize(1280, 860);
1803
+
1804
+ cameraView.requestFocusInWindow();
1805
+
13481806 gridPanel.setDividerLocation(1.0);
1807
+
1808
+ frame.validate();
1809
+
1810
+ frame.setVisible(true);
13491811
13501812 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13511813 frame.addWindowListener(new WindowAdapter()
13521814 {
1353
-
13541815 public void windowClosing(WindowEvent e)
13551816 {
13561817 Close();
....@@ -1358,6 +1819,10 @@
13581819 });
13591820 }
13601821
1822
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1823
+ {
1824
+ }
1825
+
13611826 JTree GetTree()
13621827 {
13631828 return objEditor.jTree;
....@@ -1369,260 +1834,575 @@
13691834 ctrlPanel.removeAll();
13701835 }
13711836
1372
- void SetupMaterial(JPanel ctrlPanel)
1837
+ void SetupMaterial(cGridBag materialpanel)
13731838 {
1374
- aConstraints.weighty = 0;
1375
- //aConstraints.weightx = 1;
1376
- /*
1839
+ cGridBag presetpanel = new cGridBag().setVertical(true);
1840
+
1841
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1842
+ skin.setToolTipText("Skin");
1843
+ skin.addMouseListener(new MouseAdapter()
1844
+ {
1845
+ public void mouseClicked(MouseEvent e)
1846
+ {
1847
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
1848
+ cMaterial material = object.material;
1849
+
1850
+ // Skin
1851
+ colorField.setFloat(material.color);
1852
+ saturationField.setFloat(material.modulation);
1853
+ subsurfaceField.setFloat(material.subsurface);
1854
+ selfshadowField.setFloat(material.diffuseness);
1855
+ diffusenessField.setFloat(material.factor);
1856
+ shininessField.setFloat(material.shininess);
1857
+ shadowbiasField.setFloat(material.shadowbias);
1858
+ diffuseField.setFloat(material.diffuse);
1859
+ specularField.setFloat(material.specular);
1860
+
1861
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
1862
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
1863
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
1864
+
1865
+ materialtouched = true;
1866
+ applySelf();
1867
+ }
1868
+ });
1869
+ presetpanel.add(skin);
1870
+
1871
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
1872
+ lambert.setToolTipText("Diffuse");
1873
+ lambert.addMouseListener(new MouseAdapter()
1874
+ {
1875
+ public void mouseClicked(MouseEvent e)
1876
+ {
1877
+ Object3D object = Grafreed.materials.versionlist[2].get(0);
1878
+ cMaterial material = object.material;
1879
+
1880
+ diffusenessField.setFloat(material.factor);
1881
+ selfshadowField.setFloat(material.diffuseness);
1882
+
1883
+ materialtouched = true;
1884
+ applySelf();
1885
+ }
1886
+ });
1887
+ presetpanel.add(lambert);
1888
+
1889
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
1890
+ diffuse2.setToolTipText("Diffuse2");
1891
+ diffuse2.addMouseListener(new MouseAdapter()
1892
+ {
1893
+ public void mouseClicked(MouseEvent e)
1894
+ {
1895
+ Object3D object = Grafreed.materials.versionlist[3].get(0);
1896
+ cMaterial material = object.material;
1897
+
1898
+ diffusenessField.setFloat(material.factor);
1899
+ selfshadowField.setFloat(material.diffuseness);
1900
+
1901
+ materialtouched = true;
1902
+ applySelf();
1903
+ }
1904
+ });
1905
+ presetpanel.add(diffuse2);
1906
+
1907
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
1908
+ diffusemoon.setToolTipText("Moon");
1909
+ diffusemoon.addMouseListener(new MouseAdapter()
1910
+ {
1911
+ public void mouseClicked(MouseEvent e)
1912
+ {
1913
+ Object3D object = Grafreed.materials.versionlist[4].get(0);
1914
+ cMaterial material = object.material;
1915
+
1916
+ diffusenessField.setFloat(material.factor);
1917
+ selfshadowField.setFloat(material.diffuseness);
1918
+
1919
+ materialtouched = true;
1920
+ applySelf();
1921
+ }
1922
+ });
1923
+ presetpanel.add(diffusemoon);
1924
+
1925
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
1926
+ diffusemoon2.setToolTipText("Moon2");
1927
+ diffusemoon2.addMouseListener(new MouseAdapter()
1928
+ {
1929
+ public void mouseClicked(MouseEvent e)
1930
+ {
1931
+ Object3D object = Grafreed.materials.versionlist[5].get(0);
1932
+ cMaterial material = object.material;
1933
+
1934
+ diffusenessField.setFloat(material.factor);
1935
+ selfshadowField.setFloat(material.diffuseness);
1936
+
1937
+ materialtouched = true;
1938
+ applySelf();
1939
+ }
1940
+ });
1941
+ presetpanel.add(diffusemoon2);
1942
+
1943
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
1944
+ diffusemoon3.setToolTipText("Moon3");
1945
+ diffusemoon3.addMouseListener(new MouseAdapter()
1946
+ {
1947
+ public void mouseClicked(MouseEvent e)
1948
+ {
1949
+ Object3D object = Grafreed.materials.versionlist[6].get(0);
1950
+ cMaterial material = object.material;
1951
+
1952
+ diffusenessField.setFloat(material.factor);
1953
+ selfshadowField.setFloat(material.diffuseness);
1954
+
1955
+ materialtouched = true;
1956
+ applySelf();
1957
+ }
1958
+ });
1959
+ presetpanel.add(diffusemoon3);
1960
+
1961
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
1962
+ diffusesheen.setToolTipText("Sheen");
1963
+ diffusesheen.addMouseListener(new MouseAdapter()
1964
+ {
1965
+ public void mouseClicked(MouseEvent e)
1966
+ {
1967
+ Object3D object = Grafreed.materials.versionlist[7].get(0);
1968
+ cMaterial material = object.material;
1969
+
1970
+ sheenField.setFloat(material.sheen);
1971
+
1972
+ materialtouched = true;
1973
+ applySelf();
1974
+ }
1975
+ });
1976
+ presetpanel.add(diffusesheen);
1977
+
1978
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
1979
+ rough.setToolTipText("Rough metal");
1980
+ rough.addMouseListener(new MouseAdapter()
1981
+ {
1982
+ public void mouseClicked(MouseEvent e)
1983
+ {
1984
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
1985
+ cMaterial material = object.material;
1986
+
1987
+ shininessField.setFloat(material.shininess);
1988
+ velvetField.setFloat(material.velvet);
1989
+
1990
+ materialtouched = true;
1991
+ applySelf();
1992
+ }
1993
+ });
1994
+ presetpanel.add(rough);
1995
+
1996
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
1997
+ rough2.setToolTipText("Medium metal");
1998
+ rough2.addMouseListener(new MouseAdapter()
1999
+ {
2000
+ public void mouseClicked(MouseEvent e)
2001
+ {
2002
+ Object3D object = Grafreed.materials.versionlist[13].get(0);
2003
+ cMaterial material = object.material;
2004
+
2005
+ shininessField.setFloat(material.shininess);
2006
+ lightareaField.setFloat(material.lightarea);
2007
+
2008
+ materialtouched = true;
2009
+ applySelf();
2010
+ }
2011
+ });
2012
+ presetpanel.add(rough2);
2013
+
2014
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
2015
+ shini0.setToolTipText("Shiny");
2016
+ shini0.addMouseListener(new MouseAdapter()
2017
+ {
2018
+ public void mouseClicked(MouseEvent e)
2019
+ {
2020
+ Object3D object = Grafreed.materials.versionlist[14].get(0);
2021
+ cMaterial material = object.material;
2022
+
2023
+ shininessField.setFloat(material.shininess);
2024
+ lightareaField.setFloat(material.lightarea);
2025
+
2026
+ materialtouched = true;
2027
+ applySelf();
2028
+ }
2029
+ });
2030
+ presetpanel.add(shini0);
2031
+
2032
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
2033
+ shini1.setToolTipText("Shiny2");
2034
+ shini1.addMouseListener(new MouseAdapter()
2035
+ {
2036
+ public void mouseClicked(MouseEvent e)
2037
+ {
2038
+ Object3D object = Grafreed.materials.versionlist[11].get(0);
2039
+ cMaterial material = object.material;
2040
+
2041
+ shininessField.setFloat(material.shininess);
2042
+ lightareaField.setFloat(material.lightarea);
2043
+
2044
+ materialtouched = true;
2045
+ applySelf();
2046
+ }
2047
+ });
2048
+ presetpanel.add(shini1);
2049
+
2050
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2051
+ shini2.setToolTipText("Shiny3");
2052
+ shini2.addMouseListener(new MouseAdapter()
2053
+ {
2054
+ public void mouseClicked(MouseEvent e)
2055
+ {
2056
+ Object3D object = Grafreed.materials.versionlist[12].get(0);
2057
+ cMaterial material = object.material;
2058
+
2059
+ shininessField.setFloat(material.shininess);
2060
+ lightareaField.setFloat(material.lightarea);
2061
+
2062
+ materialtouched = true;
2063
+ applySelf();
2064
+ }
2065
+ });
2066
+ presetpanel.add(shini2);
2067
+
2068
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2069
+ aniso.setToolTipText("AnisoU");
2070
+ aniso.addMouseListener(new MouseAdapter()
2071
+ {
2072
+ public void mouseClicked(MouseEvent e)
2073
+ {
2074
+ Object3D object = Grafreed.materials.versionlist[8].get(0);
2075
+ cMaterial material = object.material;
2076
+
2077
+ anisoField.setFloat(material.aniso);
2078
+ anisoVField.setFloat(material.anisoV);
2079
+
2080
+ materialtouched = true;
2081
+ applySelf();
2082
+ }
2083
+ });
2084
+ presetpanel.add(aniso);
2085
+
2086
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2087
+ aniso2.setToolTipText("AnisoV");
2088
+ aniso2.addMouseListener(new MouseAdapter()
2089
+ {
2090
+ public void mouseClicked(MouseEvent e)
2091
+ {
2092
+ Object3D object = Grafreed.materials.versionlist[9].get(0);
2093
+ cMaterial material = object.material;
2094
+
2095
+ anisoField.setFloat(material.aniso);
2096
+ anisoVField.setFloat(material.anisoV);
2097
+
2098
+ materialtouched = true;
2099
+ applySelf();
2100
+ }
2101
+ });
2102
+ presetpanel.add(aniso2);
2103
+
2104
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2105
+ aniso3.setToolTipText("AnisoUV");
2106
+ aniso3.addMouseListener(new MouseAdapter()
2107
+ {
2108
+ public void mouseClicked(MouseEvent e)
2109
+ {
2110
+ Object3D object = Grafreed.materials.versionlist[10].get(0);
2111
+ cMaterial material = object.material;
2112
+
2113
+ anisoField.setFloat(material.aniso);
2114
+ anisoVField.setFloat(material.anisoV);
2115
+
2116
+ materialtouched = true;
2117
+ applySelf();
2118
+ }
2119
+ });
2120
+ presetpanel.add(aniso3);
2121
+
2122
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2123
+ velvet0.setToolTipText("Velvet");
2124
+ velvet0.addMouseListener(new MouseAdapter()
2125
+ {
2126
+ public void mouseClicked(MouseEvent e)
2127
+ {
2128
+ Object3D object = Grafreed.materials.versionlist[15].get(0);
2129
+ cMaterial material = object.material;
2130
+
2131
+ diffusenessField.setFloat(material.factor);
2132
+ selfshadowField.setFloat(material.diffuseness);
2133
+ sheenField.setFloat(material.sheen);
2134
+ shininessField.setFloat(material.shininess);
2135
+ velvetField.setFloat(material.velvet);
2136
+ shiftField.setFloat(material.shift);
2137
+
2138
+ materialtouched = true;
2139
+ applySelf();
2140
+ }
2141
+ });
2142
+ presetpanel.add(velvet0);
2143
+
2144
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2145
+ bump0.setToolTipText("Bump texture");
2146
+ bump0.addMouseListener(new MouseAdapter()
2147
+ {
2148
+ public void mouseClicked(MouseEvent e)
2149
+ {
2150
+ Object3D object = Grafreed.materials.versionlist[16].get(0);
2151
+ cMaterial material = object.material;
2152
+
2153
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2154
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2155
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2156
+
2157
+ materialtouched = true;
2158
+ applySelf();
2159
+ }
2160
+ });
2161
+ presetpanel.add(bump0);
2162
+
2163
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2164
+ halo.setToolTipText("Halo");
2165
+ halo.addMouseListener(new MouseAdapter()
2166
+ {
2167
+ public void mouseClicked(MouseEvent e)
2168
+ {
2169
+ Object3D object = Grafreed.materials.versionlist[17].get(0);
2170
+ cMaterial material = object.material;
2171
+
2172
+ opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
2173
+
2174
+ materialtouched = true;
2175
+ applySelf();
2176
+ }
2177
+ });
2178
+ presetpanel.add(halo);
2179
+
2180
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2181
+ candle.setToolTipText("Candle");
2182
+ candle.addMouseListener(new MouseAdapter()
2183
+ {
2184
+ public void mouseClicked(MouseEvent e)
2185
+ {
2186
+ Object3D object = Grafreed.materials.versionlist[18].get(0);
2187
+ cMaterial material = object.material;
2188
+
2189
+ subsurfaceField.setFloat(material.subsurface);
2190
+ shadowbiasField.setFloat(material.shadowbias);
2191
+ ambientField.setFloat(material.ambient);
2192
+ specularField.setFloat(material.specular);
2193
+ lightareaField.setFloat(material.lightarea);
2194
+ shininessField.setFloat(material.shininess);
2195
+
2196
+ materialtouched = true;
2197
+ applySelf();
2198
+ }
2199
+ });
2200
+ presetpanel.add(candle);
2201
+
2202
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2203
+ shadowShader.setToolTipText("Shadow");
2204
+ shadowShader.addMouseListener(new MouseAdapter()
2205
+ {
2206
+ public void mouseClicked(MouseEvent e)
2207
+ {
2208
+ diffuseField.setFloat(0.001);
2209
+ ambientField.setFloat(0.001);
2210
+ cameraField.setFloat(0.001);
2211
+ specularField.setFloat(0.001);
2212
+ fakedepthField.setFloat(0.001);
2213
+ opacityField.setFloat(0.6);
2214
+
2215
+ materialtouched = true;
2216
+ applySelf();
2217
+ }
2218
+ });
2219
+ presetpanel.add(shadowShader);
2220
+
2221
+ cGridBag panel = new cGridBag().setVertical(true);
2222
+
2223
+ presetpanel.preferredWidth = 1;
2224
+
2225
+ materialpanel.add(presetpanel);
2226
+ materialpanel.add(panel);
2227
+
2228
+ panel.preferredWidth = 8;
2229
+
2230
+ /*
13772231 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13782232 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1379
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1380
- aConstraints.gridx += 1;
1381
- */
2233
+ */
13822234
1383
- aConstraints.gridwidth = 1;
1384
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- aConstraints.gridwidth = 1;
2235
+ cGridBag editBar = new cGridBag().setVertical(false);
2236
+
2237
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
2238
+ createMaterialButton.setToolTipText("Create material");
13882239
13892240 /*
13902241 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1391
- aConstraints.gridx += 1;
1392
- aConstraints.weighty = 0;
1393
- aConstraints.gridwidth = 1;
13942242 */
13952243
1396
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1397
- aConstraints.gridx += 1;
2244
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
2245
+ clearMaterialButton.setToolTipText("Clear material");
2246
+
2247
+ if (Globals.ADVANCED)
2248
+ {
2249
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
2250
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
2251
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
2252
+ }
13982253
1399
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1400
-
1401
- aConstraints.gridx += 1;
1402
-
1403
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1404
-
1405
- aConstraints.gridx += 1;
1406
-
1407
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1408
-
1409
- aConstraints.gridx = 0;
1410
- aConstraints.gridy += 1;
1411
- aConstraints.weighty = 0;
1412
- aConstraints.gridwidth = 1;
2254
+ editBar.preferredHeight = 15;
2255
+
2256
+ panel.add(editBar);
2257
+
14132258 /**/
14142259 //aConstraints.weighty = 0;
14152260 ////aConstraints.weightx = 1;
14162261 //aConstraints.weighty = 1;
14172262 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14182263 //aConstraints.gridx += 1;
1419
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1420
- aConstraints.weighty = 0;
1421
- aConstraints.gridx = 0;
1422
- aConstraints.gridy += 1;
1423
- aConstraints.gridwidth = 1;
2264
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14242265
1425
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1426
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1427
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1428
- aConstraints.gridx += 1;
1429
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1430
- //aConstraints.weightx = 0;
1431
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1432
- aConstraints.gridx = 0;
1433
- aConstraints.gridy += 1;
1434
- aConstraints.gridwidth = 1;
2266
+ cGridBag colorSection = new cGridBag().setVertical(true);
14352267
1436
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1437
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1438
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1439
- aConstraints.gridx += 1;
1440
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1441
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1442
- aConstraints.gridx = 0;
1443
- aConstraints.gridy += 1;
1444
- aConstraints.gridwidth = 1;
2268
+ cGridBag huepanel = new cGridBag();
2269
+ cGridBag huelabel = new cGridBag();
2270
+ skin = GetLabel("icons/hue.png", false);
2271
+ skin.fit = true;
2272
+ huelabel.add(skin);
2273
+ huelabel.preferredWidth = 20;
2274
+ huepanel.add(new cGridBag()); // Label
2275
+ huepanel.add(huelabel); // Field/slider
2276
+
2277
+ huepanel.preferredHeight = 7;
14452278
1446
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1447
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1448
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1449
- aConstraints.gridx += 1;
1450
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1451
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1452
- aConstraints.gridx = 0;
1453
- aConstraints.gridy += 1;
1454
- aConstraints.gridwidth = 1;
2279
+ colorSection.add(huepanel);
2280
+
2281
+ cGridBag color = new cGridBag();
2282
+
2283
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
2284
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2285
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
14552286
1456
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1457
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1458
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1459
- aConstraints.gridx += 1;
1460
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1461
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1462
- aConstraints.gridx = 0;
1463
- aConstraints.gridy += 1;
1464
- aConstraints.gridwidth = 1;
2287
+ //colorField.preferredWidth = 200;
2288
+ colorSection.add(color);
14652289
1466
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1467
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1468
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1469
- aConstraints.gridx += 1;
1470
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1471
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1472
- aConstraints.gridx = 0;
1473
- aConstraints.gridy += 1;
1474
- aConstraints.gridwidth = 1;
2290
+ cGridBag modulation = new cGridBag();
2291
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
2292
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2293
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2294
+ colorSection.add(modulation);
14752295
1476
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1477
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1478
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1479
- aConstraints.gridx += 1;
1480
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1481
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1482
- aConstraints.gridx = 0;
1483
- aConstraints.gridy += 1;
1484
- aConstraints.gridwidth = 1;
2296
+ cGridBag opacity = new cGridBag();
2297
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
2298
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2299
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2300
+ colorSection.add(opacity);
14852301
1486
- //aConstraints.weighty = 1;
1487
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1488
- //aConstraints.gridx += 1;
1489
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1490
- aConstraints.weighty = 0;
1491
- aConstraints.gridx = 0;
1492
- aConstraints.gridy += 1;
1493
- aConstraints.gridwidth = 1;
2302
+ colorSection.add(GetSeparator());
2303
+
2304
+ cGridBag texture = new cGridBag();
2305
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
2306
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2307
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2308
+ colorSection.add(texture);
14942309
1495
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1496
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1497
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1498
- aConstraints.gridx += 1;
1499
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1500
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1501
- aConstraints.gridx = 0;
1502
- aConstraints.gridy += 1;
1503
- aConstraints.gridwidth = 1;
2310
+ panel.add(GetSeparator());
2311
+
2312
+ panel.add(colorSection);
2313
+
2314
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2315
+
2316
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
2317
+
2318
+ cGridBag diffuse = new cGridBag();
2319
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
2320
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2321
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2322
+ diffuseSection.add(diffuse);
15042323
1505
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1506
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1507
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1508
- aConstraints.gridx += 1;
1509
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1510
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1511
- aConstraints.gridx = 0;
1512
- aConstraints.gridy += 1;
1513
- aConstraints.gridwidth = 1;
2324
+ cGridBag diffuseness = new cGridBag();
2325
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
2326
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2327
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2328
+ diffuseSection.add(diffuseness);
15142329
1515
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1516
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1517
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1518
- aConstraints.gridx += 1;
1519
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1520
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1521
- aConstraints.gridx = 0;
1522
- aConstraints.gridy += 1;
1523
- aConstraints.gridwidth = 1;
2330
+ cGridBag selfshadow = new cGridBag();
2331
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
2332
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2333
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2334
+ diffuseSection.add(selfshadow);
15242335
1525
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1526
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1527
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1528
- aConstraints.gridx += 1;
1529
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1530
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1531
- aConstraints.gridx = 0;
1532
- aConstraints.gridy += 1;
1533
- aConstraints.gridwidth = 1;
2336
+ cGridBag sheen = new cGridBag();
2337
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
2338
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2339
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2340
+ diffuseSection.add(sheen);
15342341
1535
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1536
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1537
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1538
- aConstraints.gridx += 1;
1539
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1540
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1541
- aConstraints.gridx = 0;
1542
- aConstraints.gridy += 1;
1543
- aConstraints.gridwidth = 1;
2342
+ cGridBag subsurface = new cGridBag();
2343
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
2344
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2345
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2346
+ diffuseSection.add(subsurface);
15442347
1545
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1546
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1547
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1548
- aConstraints.gridx += 1;
1549
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1550
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1551
- aConstraints.gridx = 0;
1552
- aConstraints.gridy += 1;
1553
- aConstraints.gridwidth = 1;
2348
+ cGridBag shadow = new cGridBag();
2349
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
2350
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2351
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2352
+ diffuseSection.add(shadow);
15542353
1555
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1556
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1557
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1558
- aConstraints.gridx += 1;
1559
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1560
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1561
- aConstraints.gridx = 0;
1562
- aConstraints.gridy += 1;
1563
- aConstraints.gridwidth = 1;
2354
+ cGridBag fakedepth = new cGridBag();
2355
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
2356
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2357
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2358
+ diffuseSection.add(fakedepth);
15642359
1565
- //aConstraints.weighty = 1;
1566
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1567
- //aConstraints.gridx += 1;
1568
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1569
- aConstraints.weighty = 0;
1570
- aConstraints.gridx = 0;
1571
- aConstraints.gridy += 1;
1572
- aConstraints.gridwidth = 1;
2360
+ cGridBag shadowbias = new cGridBag();
2361
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
2362
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2363
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2364
+ diffuseSection.add(shadowbias);
15732365
1574
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1575
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1576
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1577
- aConstraints.gridx += 1;
1578
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1579
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1580
- aConstraints.gridx = 0;
1581
- aConstraints.gridy += 1;
1582
- aConstraints.gridwidth = 1;
2366
+ panel.add(GetSeparator());
2367
+
2368
+ panel.add(diffuseSection);
2369
+
2370
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2371
+
2372
+ cGridBag specularSection = new cGridBag().setVertical(true);
15832373
1584
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1585
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1586
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1587
- aConstraints.gridx += 1;
1588
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1589
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1590
- aConstraints.gridx = 0;
1591
- aConstraints.gridy += 1;
1592
- aConstraints.gridwidth = 1;
2374
+ cGridBag specular = new cGridBag();
2375
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
2376
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2377
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2378
+ specularSection.add(specular);
15932379
1594
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1595
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1596
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1597
- aConstraints.gridx += 1;
1598
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1599
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1600
- aConstraints.gridx = 0;
1601
- aConstraints.gridy += 1;
1602
- aConstraints.gridwidth = 1;
2380
+ cGridBag lightarea = new cGridBag();
2381
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
2382
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2383
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2384
+ specularSection.add(lightarea);
16032385
1604
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1605
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1606
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1607
- aConstraints.gridx += 1;
1608
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1609
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1610
- aConstraints.gridx = 0;
1611
- aConstraints.gridy += 1;
1612
- aConstraints.gridwidth = 1;
2386
+ cGridBag shininess = new cGridBag();
2387
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
2388
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2389
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2390
+ specularSection.add(shininess);
16132391
1614
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1615
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1616
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1617
- aConstraints.gridx += 1;
1618
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1619
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1620
- aConstraints.gridx = 0;
1621
- aConstraints.gridy += 1;
1622
- aConstraints.gridwidth = 1;
2392
+ cGridBag metalness = new cGridBag();
2393
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
2394
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2395
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2396
+ specularSection.add(metalness);
16232397
1624
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1625
- Return();
2398
+ cGridBag velvet = new cGridBag();
2399
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
2400
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2401
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2402
+ specularSection.add(velvet);
2403
+
2404
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
2405
+ //Return();
16262406 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16272407 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16282408 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1633,130 +2413,99 @@
16332413 // aConstraints.gridy += 1;
16342414 // aConstraints.gridwidth = 1;
16352415
1636
- //aConstraints.weighty = 1;
1637
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1638
- //aConstraints.gridx += 1;
1639
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1640
- aConstraints.weighty = 0;
1641
- aConstraints.gridx = 0;
1642
- aConstraints.gridy += 1;
1643
- aConstraints.gridwidth = 1;
2416
+ cGridBag anisoU = new cGridBag();
2417
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
2418
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2419
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2420
+ specularSection.add(anisoU);
16442421
1645
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1646
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1647
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1648
- aConstraints.gridx += 1;
1649
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1650
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1651
- aConstraints.gridx = 0;
1652
- aConstraints.gridy += 1;
1653
- aConstraints.gridwidth = 1;
2422
+ cGridBag anisoV = new cGridBag();
2423
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
2424
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2425
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2426
+ specularSection.add(anisoV);
16542427
1655
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1656
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1657
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1658
- aConstraints.gridx += 1;
1659
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1660
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1661
- aConstraints.gridx = 0;
1662
- aConstraints.gridy += 1;
1663
- aConstraints.gridwidth = 1;
16642428
1665
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1666
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1667
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1668
- aConstraints.gridx += 1;
1669
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1670
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1671
- aConstraints.gridx = 0;
1672
- aConstraints.gridy += 1;
1673
- aConstraints.gridwidth = 1;
2429
+ panel.add(GetSeparator());
2430
+
2431
+ panel.add(specularSection);
2432
+
2433
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2434
+
2435
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16742436
1675
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1676
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1677
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1678
- aConstraints.gridx += 1;
1679
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1680
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1681
- aConstraints.gridx = 0;
1682
- aConstraints.gridy += 1;
1683
- aConstraints.gridwidth = 1;
1684
- aConstraints.weighty = 0;
2437
+ cGridBag camera = new cGridBag();
2438
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
2439
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2440
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2441
+ colorSection.add(camera);
16852442
1686
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1687
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1688
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1689
- aConstraints.gridx += 1;
1690
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1691
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1692
- aConstraints.gridx = 0;
1693
- aConstraints.gridy += 1;
1694
- aConstraints.gridwidth = 1;
2443
+ cGridBag ambient = new cGridBag();
2444
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
2445
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2446
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2447
+ colorSection.add(ambient);
16952448
1696
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1697
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1698
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1699
- aConstraints.gridx += 1;
1700
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1701
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1702
- aConstraints.gridx = 0;
1703
- aConstraints.gridy += 1;
1704
- aConstraints.gridwidth = 1;
2449
+ cGridBag backlit = new cGridBag();
2450
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
2451
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2452
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2453
+ colorSection.add(backlit);
17052454
1706
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1707
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1708
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1709
- aConstraints.gridx += 1;
1710
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1711
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1712
- aConstraints.gridx = 0;
1713
- aConstraints.gridy += 1;
1714
- aConstraints.gridwidth = 1;
2455
+ //panel.add(new JSeparator());
2456
+
2457
+ //panel.add(globalSection);
2458
+
2459
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
2460
+
2461
+ cGridBag textureSection = new cGridBag().setVertical(true);
17152462
1716
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1717
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1718
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1719
- aConstraints.gridx += 1;
1720
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1721
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1722
- aConstraints.gridx = 0;
1723
- aConstraints.gridy += 1;
1724
- aConstraints.gridwidth = 1;
2463
+ cGridBag bump = new cGridBag();
2464
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
2465
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2466
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
2467
+ textureSection.add(bump);
17252468
1726
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1727
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1728
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1729
- aConstraints.gridx += 1;
1730
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1731
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1732
- aConstraints.gridx = 0;
1733
- aConstraints.gridy += 1;
1734
- aConstraints.gridwidth = 1;
2469
+ cGridBag noise = new cGridBag();
2470
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
2471
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2472
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
2473
+ textureSection.add(noise);
17352474
1736
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1737
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1738
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1739
- aConstraints.gridx += 1;
1740
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1741
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1742
- aConstraints.gridx = 0;
1743
- aConstraints.gridy += 1;
1744
- aConstraints.gridwidth = 1;
2475
+ cGridBag power = new cGridBag();
2476
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
2477
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2478
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
2479
+ textureSection.add(power);
17452480
1746
- //aConstraints.weighty = 1;
1747
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1748
- //aConstraints.gridx += 1;
1749
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1750
- aConstraints.weighty = 0;
2481
+ cGridBag borderfade = new cGridBag();
2482
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
2483
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2484
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
2485
+ textureSection.add(borderfade);
17512486
1752
- aConstraints.gridx = 0;
1753
- aConstraints.gridy = 0;
1754
- aConstraints.gridwidth = 1;
2487
+ cGridBag fog = new cGridBag();
2488
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
2489
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2490
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
2491
+ textureSection.add(fog);
2492
+
2493
+ cGridBag opacityPower = new cGridBag();
2494
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
2495
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2496
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
2497
+ textureSection.add(opacityPower);
2498
+
2499
+ panel.add(GetSeparator());
2500
+
2501
+ panel.add(textureSection);
2502
+
2503
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17552504
17562505 SetMaterial(copy); // .GetMaterial());
17572506
1758
- colorField.addChangeListener(this);
1759
- modulationField.addChangeListener(this);
2507
+ //colorField.addChangeListener(this);
2508
+// modulationField.addChangeListener(this);
17602509 metalnessField.addChangeListener(this);
17612510 diffuseField.addChangeListener(this);
17622511 specularField.addChangeListener(this);
....@@ -1786,12 +2535,15 @@
17862535 opacityPowerField.addChangeListener(this);
17872536 /**/
17882537
1789
- resetSlidersButton.addActionListener(this);
17902538 clearMaterialButton.addActionListener(this);
17912539 createMaterialButton.addActionListener(this);
1792
-
1793
- propagateToggle.addItemListener(this);
1794
- multiplyToggle.addItemListener(this);
2540
+
2541
+ if (Globals.ADVANCED)
2542
+ {
2543
+ resetSlidersButton.addActionListener(this);
2544
+ propagateToggle.addItemListener(this);
2545
+ multiplyToggle.addItemListener(this);
2546
+ }
17952547 }
17962548
17972549 void DropFile(java.io.File[] files, boolean textures)
....@@ -1809,8 +2561,9 @@
18092561 // 3D models
18102562 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18112563 {
1812
- lastConverter = new com.jmex.model.converters.MaxToJme();
1813
- LoadFile(filename, lastConverter);
2564
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2565
+ //LoadFile(filename, lastConverter);
2566
+ LoadObjFile(filename); // New 3ds loader
18142567 continue;
18152568 }
18162569 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1962,7 +2715,7 @@
19622715
19632716 //? flashIt = false;
19642717 CameraPane pane = (CameraPane) cameraView;
1965
- pane.clickStart(location.x, location.y, 0);
2718
+ pane.clickStart(location.x, location.y, 0, 0);
19662719 pane.clickEnd(location.x, location.y, 0, true);
19672720
19682721 if (group.selection.size() == 1)
....@@ -2011,6 +2764,7 @@
20112764 e2.printStackTrace();
20122765 }
20132766 }
2767
+
20142768 LoadJMEThread loadThread;
20152769
20162770 class LoadJMEThread extends Thread
....@@ -2068,6 +2822,7 @@
20682822 //LoadFile0(filename, converter);
20692823 }
20702824 }
2825
+
20712826 LoadOBJThread loadObjThread;
20722827
20732828 class LoadOBJThread extends Thread
....@@ -2146,19 +2901,19 @@
21462901
21472902 void LoadObjFile(String fullname)
21482903 {
2149
- /*
2904
+ System.out.println("Loading " + fullname);
2905
+ /**/
21502906 //lastFilename = fullname;
21512907 if(loadObjThread == null)
21522908 {
2153
- loadObjThread = new LoadOBJThread();
2154
- loadObjThread.start();
2909
+ loadObjThread = new LoadOBJThread();
2910
+ loadObjThread.start();
21552911 }
21562912
21572913 loadObjThread.add(fullname);
2158
- */
2914
+ /**/
21592915
2160
- System.out.println("Loading " + fullname);
2161
- makeSomething(new FileObject(fullname, true), true);
2916
+ //makeSomething(new FileObject(fullname, true), true);
21622917 }
21632918
21642919 void LoadGFDFile(String fullname)
....@@ -2419,11 +3174,11 @@
24193174
24203175 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24213176 {
2422
- if (GrafreeD.standAlone)
3177
+ if (Grafreed.standAlone)
24233178 {
24243179 /**/
24253180 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2426
- browser.show();
3181
+ browser.setVisible(true);
24273182 String filename = browser.getFile();
24283183 if (filename != null && filename.length() > 0)
24293184 {
....@@ -2534,6 +3289,7 @@
25343289 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25353290 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25363291 }
3292
+
25373293 //cJME.count++;
25383294 //cJME.count %= 12;
25393295 if (gc)
....@@ -2568,6 +3324,7 @@
25683324 }
25693325 if (input == null)
25703326 {
3327
+ new Exception().printStackTrace();
25713328 System.exit(0);
25723329 }
25733330
....@@ -2716,6 +3473,7 @@
27163473 }
27173474 }
27183475 }
3476
+
27193477 cFileSystemPane FSPane;
27203478
27213479 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2725,7 +3483,7 @@
27253483
27263484 freezematerial = true;
27273485 colorField.setFloat(mat.color);
2728
- modulationField.setFloat(mat.modulation);
3486
+ saturationField.setFloat(mat.modulation);
27293487 metalnessField.setFloat(mat.metalness);
27303488 diffuseField.setFloat(mat.diffuse);
27313489 specularField.setFloat(mat.specular);
....@@ -2769,11 +3527,14 @@
27693527 }
27703528 }
27713529 }
3530
+
27723531 freezematerial = false;
27733532 }
27743533
27753534 void SetMaterial(Object3D object)
27763535 {
3536
+ latestObject = object;
3537
+
27773538 cMaterial mat = object.material;
27783539
27793540 if (mat == null)
....@@ -2782,7 +3543,8 @@
27823543 return;
27833544 }
27843545
2785
- multiplyToggle.setSelected(mat.multiply);
3546
+ if (multiplyToggle != null)
3547
+ multiplyToggle.setSelected(mat.multiply);
27863548
27873549 assert (object.projectedVertices != null);
27883550
....@@ -2884,12 +3646,17 @@
28843646 // }
28853647
28863648 /**/
2887
- if (deselect)
3649
+ if (deselect || child == null)
28883650 {
28893651 //group.deselectAll();
28903652 //freeze = true;
28913653 GetTree().clearSelection();
28923654 //freeze = false;
3655
+
3656
+ if (child == null)
3657
+ {
3658
+ return;
3659
+ }
28933660 }
28943661
28953662 //group.addSelectee(child);
....@@ -2923,6 +3690,17 @@
29233690 public void itemStateChanged(ItemEvent event)
29243691 {
29253692 // System.out.println("Propagate = " + propagate);
3693
+ if (event.getSource() == pinButton)
3694
+ {
3695
+ copy.pinned ^= true;
3696
+ if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
3697
+ {
3698
+ ((GroupEditor)copy.editWindow).listUI.remove(copy);
3699
+ copy.CloseUI();
3700
+ //copy.editWindow.refreshContents();
3701
+ }
3702
+ }
3703
+ else
29263704 if (event.getSource() == propagateToggle)
29273705 {
29283706 propagate ^= true;
....@@ -2958,7 +3736,7 @@
29583736 cameraView.ToggleDL();
29593737 cameraView.repaint();
29603738 return;
2961
- } else if (event.getSource() == toggleTextureItem)
3739
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29623740 {
29633741 cameraView.ToggleTexture();
29643742 // june 2013 copy.HardTouch();
....@@ -2966,42 +3744,40 @@
29663744 return;
29673745 } else if (event.getSource() == toggleTimelineItem)
29683746 {
2969
- copy.timeline ^= true;
3747
+ timeline ^= true;
29703748
2971
- if (copy.timeline)
3749
+ if (timeline)
29723750 {
29733751 centralPanel.remove(cameraView);
2974
- centralPanel.add(timelinePanel);
3752
+ cameraPanel.add(cameraView);
3753
+ centralPanel.add(cameraPanel);
29753754 frame.setJMenuBar(timelineMenubar);
3755
+ wasFullScreen = CameraPane.FULLSCREEN;
3756
+ if (!CameraPane.FULLSCREEN)
3757
+ ToggleFullScreen();
3758
+ toggleFullScreenItem.setEnabled(false);
29763759 }
29773760 else
29783761 {
2979
- centralPanel.remove(timelinePanel);
3762
+ centralPanel.remove(cameraPanel);
29803763 centralPanel.add(cameraView);
29813764 frame.setJMenuBar(null);
3765
+ if (!wasFullScreen)
3766
+ ToggleFullScreen();
3767
+ toggleFullScreenItem.setEnabled(true);
29823768 }
29833769
29843770 frame.validate();
29853771 return;
29863772 } else if (event.getSource() == toggleFullScreenItem)
29873773 {
2988
- if (CameraPane.FULLSCREEN)
2989
- {
2990
- frame.getContentPane().remove(/*"Center",*/bigThree);
2991
- framePanel.add(bigThree);
2992
- frame.getContentPane().add(/*"Center",*/framePanel);
2993
- } else
2994
- {
2995
- frame.getContentPane().remove(/*"Center",*/framePanel);
2996
- frame.getContentPane().add(/*"Center",*/bigThree);
2997
- }
3774
+ ToggleFullScreen();
29983775 frame.validate();
2999
- cameraView.ToggleFullScreen();
30003776
30013777 return;
3002
- } else if (event.getSource() == toggleRandomItem)
3778
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30033779 {
3004
- cameraView.ToggleRandom();
3780
+ cameraView.ToggleSwitch();
30053781 cameraView.repaint();
30063782 return;
30073783 } else if (event.getSource() == toggleHandleItem)
....@@ -3029,12 +3805,17 @@
30293805 } else if (event.getSource() == liveCB)
30303806 {
30313807 copy.live ^= true;
3808
+ objEditor.refreshContents(true); // To show item colors
3809
+ return;
3810
+ } else if (event.getSource() == selectableCB)
3811
+ {
3812
+ copy.dontselect ^= true;
30323813 return;
30333814 } else if (event.getSource() == hideCB)
30343815 {
30353816 copy.hide ^= true;
30363817 copy.Touch(); // display list issue
3037
- objEditor.refreshContents();
3818
+ objEditor.refreshContents(true); // To show item colors
30383819 return;
30393820 } else if (event.getSource() == link2masterCB)
30403821 {
....@@ -3044,6 +3825,7 @@
30443825 if (event.getSource() == randomCB)
30453826 {
30463827 copy.random ^= true;
3828
+ objEditor.refreshContents();
30473829 return;
30483830 }
30493831 if (event.getSource() == speedupCB)
....@@ -3067,8 +3849,9 @@
30673849
30683850 public void actionPerformed(ActionEvent event)
30693851 {
3852
+ Object source = event.getSource();
30703853 // SCRIPT DIALOG
3071
- if (event.getSource() == okbutton)
3854
+ if (source == okbutton)
30723855 {
30733856 textpanel.setVisible(false);
30743857 textpanel.remove(textarea);
....@@ -3080,7 +3863,7 @@
30803863 textarea = null;
30813864 textpanel = null;
30823865 }
3083
- if (event.getSource() == cancelbutton)
3866
+ if (source == cancelbutton)
30843867 {
30853868 textpanel.setVisible(false);
30863869 textpanel.remove(textarea);
....@@ -3092,49 +3875,50 @@
30923875 //applySelf();
30933876 //client.refreshEditWindow();
30943877 //refreshContents();
3095
- if (event.getSource() == nameField)
3878
+ if (source == nameField)
30963879 {
30973880 //System.out.println("ObjEditor " + event);
30983881 applySelf0(true);
30993882 //parent.applySelf();
31003883 objEditor.refreshContents();
3101
- } else if (event.getSource() == resetButton)
3884
+ } else if (source == resetButton)
31023885 {
31033886 CameraPane.fullreset = true;
31043887 copy.Reset(); // ResetMeshes();
31053888 copy.Touch();
31063889 objEditor.refreshContents();
3107
- } else if (event.getSource() == stepItem)
3890
+ } else if (source == stepItem)
31083891 {
3109
- cameraView.ONESTEP = true;
3892
+ //cameraView.ONESTEP = true;
3893
+ Globals.ONESTEP = true;
31103894 cameraView.repaint();
31113895 return;
3112
- } else if (event.getSource() == stepButton)
3896
+ } else if (source == stepButton)
31133897 {
31143898 copy.Step();
31153899 copy.Touch();
31163900 objEditor.refreshContents();
3117
- } else if (event.getSource() == slowerButton)
3901
+ } else if (source == slowerButton)
31183902 {
31193903 copy.Slower();
31203904 copy.Touch();
31213905 objEditor.refreshContents();
3122
- } else if (event.getSource() == fasterButton)
3906
+ } else if (source == fasterButton)
31233907 {
31243908 copy.Faster();
31253909 copy.Touch();
31263910 objEditor.refreshContents();
3127
- } else if (event.getSource() == remarkButton)
3911
+ } else if (source == remarkButton)
31283912 {
31293913 copy.Remark();
31303914 copy.Touch();
31313915 objEditor.refreshContents();
3132
- } else if (event.getSource() == stepAllButton)
3916
+ } else if (source == stepAllButton)
31333917 {
31343918 copy.StepAll();
31353919 copy.Touch();
31363920 objEditor.refreshContents();
3137
- } else if (event.getSource() == resetAllButton)
3921
+ } else if (source == resetAllButton)
31383922 {
31393923 //CameraPane.fullreset = true;
31403924 copy.ResetAll(); // ResetMeshes();
....@@ -3167,53 +3951,79 @@
31673951 // Close();
31683952 // }
31693953 // else
3170
- if (event.getSource() == resetSlidersButton)
3954
+ if (source == resetSlidersButton)
31713955 {
31723956 ResetSliders();
3173
- } else if (event.getSource() == clearMaterialButton)
3957
+ } else if (source == clearMaterialButton)
31743958 {
31753959 ClearMaterial();
3176
- } else if (event.getSource() == createMaterialButton)
3960
+ } else if (source == createMaterialButton)
31773961 {
31783962 CreateMaterial();
3179
- } else if (event.getSource() == clearPanelButton)
3963
+ } else if (source == clearPanelButton)
31803964 {
31813965 copy.ClearUI();
31823966 refreshContents(true);
3183
- } /*
3184
- }
3185
-
3186
- public boolean action(Event event, Object arg)
3187
- {
3188
- */ else if (event.getSource() == closeItem)
3967
+ } else if (source == importGFDItem)
3968
+ {
3969
+ ImportGFD();
3970
+ } else
3971
+ if (source == importVRMLX3DItem)
3972
+ {
3973
+ ImportVRMLX3D();
3974
+ } else
3975
+ if (source == import3DSItem)
3976
+ {
3977
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3978
+ } else
3979
+ if (source == importOBJItem)
3980
+ {
3981
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3982
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3983
+ browser.setVisible(true);
3984
+ String filename = browser.getFile();
3985
+ if (filename != null && filename.length() > 0)
3986
+ {
3987
+ String fullname = browser.getDirectory() + filename;
3988
+ makeSomething(ReadOBJ(fullname), true);
3989
+ }
3990
+ } else
3991
+ if (source == closeItem)
31893992 {
31903993 Close();
31913994 //return true;
3192
- } else if (event.getSource() == loadItem)
3995
+ } else if (source == openItem)
31933996 {
3194
- load();
3997
+ Open();
31953998 //return true;
3196
- } else if (event.getSource() == saveItem)
3999
+ } else if (source == newItem)
4000
+ {
4001
+ New();
4002
+ } else if (source == saveItem)
31974003 {
31984004 save();
31994005 //return true;
3200
- } else if (event.getSource() == saveAsItem)
4006
+ } else if (source == saveAsItem)
32014007 {
32024008 saveAs();
32034009 //return true;
3204
- } else if (event.getSource() == reexportItem)
4010
+ } else if (source == reexportItem)
32054011 {
32064012 reexport();
32074013 //return true;
3208
- } else if (event.getSource() == exportAsItem)
4014
+ } else if (source == exportAsItem)
32094015 {
32104016 export();
32114017 //return true;
3212
- } else if (event.getSource() == povItem)
4018
+ } else if (source == povItem)
32134019 {
32144020 generatePOV();
32154021 //return true;
3216
- } else if (event.getSource() == zBufferItem)
4022
+ } else if (event.getSource() == archiveItem)
4023
+ {
4024
+ cTools.Archive(frame);
4025
+ return;
4026
+ } else if (source == zBufferItem)
32174027 {
32184028 try
32194029 {
....@@ -3235,21 +4045,8 @@
32354045 cameraView.repaint();
32364046 //return true;
32374047 }
3238
- */ else if (event.getSource() == editCameraItem)
3239
- {
3240
- cameraView.ProtectCamera();
3241
- cameraView.repaint();
3242
- return;
3243
- } else if (event.getSource() == revertCameraItem)
3244
- {
3245
- cameraView.RevertCamera();
3246
- cameraView.repaint();
3247
- return;
3248
-// } else if (event.getSource() == textureButton)
3249
-// {
3250
-// return; // true;
3251
- } else // combos...
3252
- if (event.getSource() == texresMenu)
4048
+ */ else // combos...
4049
+ if (source == texresMenu)
32534050 {
32544051 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32554052 copy.texres = texresMenu.getSelectedIndex();
....@@ -3261,27 +4058,492 @@
32614058 }
32624059 }
32634060
3264
- void ToggleAnimation()
4061
+ void New()
32654062 {
3266
- if (!CameraPane.ANIMATION)
4063
+ while (copy.Size() > 1)
32674064 {
3268
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
4065
+ copy.remove(1);
4066
+ }
4067
+
4068
+ ResetModel();
4069
+ objEditor.refreshContents();
4070
+ }
4071
+
4072
+ static public byte[] Compress(Object3D o)
4073
+ {
4074
+ // Slower to actually compress.
4075
+ try
4076
+ {
4077
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
4078
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
4079
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
4080
+
4081
+ Object3D parent = o.parent;
4082
+ o.parent = null;
4083
+
4084
+ out.writeObject(o);
4085
+
4086
+ o.parent = parent;
4087
+
4088
+ out.flush();
4089
+
4090
+ baos //zstream
4091
+ .close();
4092
+ out.close();
4093
+
4094
+ byte[] bytes = baos.toByteArray();
4095
+
4096
+ System.out.println("save #bytes = " + bytes.length);
4097
+ return bytes;
4098
+ } catch (Exception e)
4099
+ {
4100
+ System.err.println(e);
4101
+ return null;
4102
+ }
4103
+ }
4104
+
4105
+ static public Object Uncompress(byte[] bytes)
4106
+ {
4107
+ System.out.println("restore #bytes = " + bytes.length);
4108
+ try
4109
+ {
4110
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
4111
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
4112
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
4113
+ Object obj = in.readObject();
4114
+
4115
+ bais //istream
4116
+ .close();
4117
+ in.close();
4118
+
4119
+ return obj;
4120
+ } catch (Exception e)
4121
+ {
4122
+ System.err.println(e);
4123
+ return null;
4124
+ }
4125
+ }
4126
+
4127
+ static public Object clone(Object o)
4128
+ {
4129
+ try
4130
+ {
4131
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
4132
+ ObjectOutputStream out = new ObjectOutputStream(baos);
4133
+
4134
+ out.writeObject(o);
4135
+
4136
+ out.flush();
4137
+ out.close();
4138
+
4139
+ byte[] bytes = baos.toByteArray();
4140
+
4141
+ System.out.println("clone = " + bytes.length);
4142
+
4143
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
4144
+ ObjectInputStream in = new ObjectInputStream(bais);
4145
+ Object obj = in.readObject();
4146
+ in.close();
4147
+
4148
+ return obj;
4149
+ } catch (Exception e)
4150
+ {
4151
+ System.err.println(e);
4152
+ return null;
4153
+ }
4154
+ }
4155
+
4156
+ cRadio GetCurrentTab()
4157
+ {
4158
+ cRadio ab;
4159
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
4160
+ {
4161
+ ab = (cRadio)e.nextElement();
4162
+ if(ab.GetObject() == copy)
4163
+ {
4164
+ return ab;
4165
+ }
4166
+ }
4167
+
4168
+ return null;
4169
+ }
4170
+
4171
+
4172
+ public void Save()
4173
+ {
4174
+ //Save(true);
4175
+ Replace();
4176
+ SetVersionStates();
4177
+ }
4178
+
4179
+ private boolean Equal(byte[] compress, byte[] name)
4180
+ {
4181
+ if (compress.length != name.length)
4182
+ {
4183
+ return false;
4184
+ }
4185
+
4186
+ for (int i=compress.length; --i>=0;)
4187
+ {
4188
+ if (compress[i] != name[i])
4189
+ return false;
4190
+ }
4191
+
4192
+ return true;
4193
+ }
4194
+
4195
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
4196
+
4197
+ void DeleteVersion()
4198
+ {
4199
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
4200
+ {
4201
+ copy.versionlist[i] = copy.versionlist[i+1];
4202
+ }
4203
+
4204
+ CopyChanged();
4205
+
4206
+ SetVersionStates();
4207
+ }
4208
+
4209
+ public boolean Save(boolean user)
4210
+ {
4211
+ System.err.println("Save");
4212
+ Replace();
4213
+
4214
+ //cRadio tab = GetCurrentTab();
4215
+
4216
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
4217
+
4218
+ boolean thesame = false;
4219
+
4220
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
4221
+// {
4222
+// thesame = true;
4223
+// }
4224
+
4225
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
4226
+ if (!thesame)
4227
+ {
4228
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4229
+ {
4230
+ copy.versionlist[i] = copy.versionlist[i-1];
4231
+ }
4232
+
4233
+ //tab.user[tab.versionindex] = user;
4234
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
4235
+
4236
+ copy.versionlist[++copy.versionindex] = compress;
4237
+
4238
+ // if (increment)
4239
+ // tab.versionindex++;
4240
+ }
4241
+
4242
+ //copy.RestoreBigData(versiontable);
4243
+
4244
+ //assert(hashtable.isEmpty());
4245
+
4246
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4247
+// {
4248
+// //tab.user[i] = false;
4249
+// copy.versionlist[i] = null;
4250
+// }
4251
+
4252
+ SetVersionStates();
4253
+
4254
+ // test save
4255
+ if (false)
4256
+ {
4257
+ try
4258
+ {
4259
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
4260
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
4261
+
4262
+ p.writeObject(copy);
4263
+
4264
+ p.flush();
4265
+
4266
+ ostream.close();
4267
+ } catch (Exception e)
4268
+ {
4269
+ e.printStackTrace();
4270
+ }
4271
+ }
4272
+
4273
+ return !thesame;
4274
+ }
4275
+
4276
+ boolean flashIt = true;
4277
+
4278
+ void RefreshSelection()
4279
+ {
4280
+ Object3D selection = new Object3D();
4281
+
4282
+ for (int i = 0; i < copy.selection.size(); i++)
4283
+ {
4284
+ Object3D elem = copy.selection.elementAt(i);
4285
+
4286
+ Object3D obj = copy.GetObject(elem.GetUUID());
4287
+
4288
+ if (obj == null)
4289
+ {
4290
+ copy.selection.remove(i--);
4291
+ }
4292
+ else
4293
+ {
4294
+ selection.add(obj);
4295
+ copy.selection.setElementAt(obj, i);
4296
+ }
4297
+ }
4298
+
4299
+ flashIt = false;
4300
+ GetTree().clearSelection();
4301
+ for (int i = 0; i < selection.size(); i++)
4302
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
4303
+ flashIt = true;
4304
+
4305
+ //refreshContents(false);
4306
+ }
4307
+
4308
+ void CopyChanged()
4309
+ {
4310
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4311
+
4312
+ SetVersionStates();
4313
+
4314
+ boolean temp = CameraPane.SWITCH;
4315
+ CameraPane.SWITCH = false;
4316
+
4317
+ copy.ExtractBigData(versiontable);
4318
+
4319
+ copy.clear();
4320
+
4321
+ copy.skyboxname = obj.skyboxname;
4322
+ copy.skyboxext = obj.skyboxext;
4323
+
4324
+ for (int i=0; i<obj.Size(); i++)
4325
+ {
4326
+ copy.add(obj.get(i));
4327
+ }
4328
+
4329
+ copy.RestoreBigData(versiontable);
4330
+
4331
+ CameraPane.SWITCH = temp;
4332
+
4333
+ RefreshSelection();
4334
+ //assert(hashtable.isEmpty());
4335
+
4336
+ copy.Touch();
4337
+
4338
+ ResetModel();
4339
+ copy.HardTouch(); // recompile?
4340
+
4341
+ cRadio ab;
4342
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
4343
+ {
4344
+ ab = (cRadio)e.nextElement();
4345
+ Object3D test = copy.GetObject(ab.object.GetUUID());
4346
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
4347
+ if (test != null)
4348
+ {
4349
+ test.editWindow = ab.object.editWindow;
4350
+ ab.object = test;
4351
+ }
4352
+ }
4353
+
4354
+ refreshContents(true);
4355
+ }
4356
+
4357
+ cButton previousVersionButton;
4358
+ cButton restoreButton;
4359
+ cButton replaceButton;
4360
+ cButton nextVersionButton;
4361
+ cButton saveVersionButton;
4362
+ cButton deleteVersionButton;
4363
+
4364
+ boolean muteSlider;
4365
+
4366
+ int VersionCount()
4367
+ {
4368
+ int count = 0;
4369
+
4370
+ for (int i = copy.versionlist.length; --i >= 0;)
4371
+ {
4372
+ if (copy.versionlist[i] != null)
4373
+ count++;
4374
+ }
4375
+
4376
+ return count;
4377
+ }
4378
+
4379
+ void SetVersionStates()
4380
+ {
4381
+ //if (true)
4382
+ // return;
4383
+
4384
+ //cRadio tab = GetCurrentTab();
4385
+
4386
+ restoreButton.setEnabled(copy.versionindex != -1);
4387
+ replaceButton.setEnabled(copy.versionindex != -1);
4388
+
4389
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4390
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4391
+
4392
+ deleteVersionButton.setEnabled(//copy.versionindex > 0 &&
4393
+ copy.versionlist[copy.versionindex + 1] != null);
4394
+
4395
+ muteSlider = true;
4396
+ versionSlider.setMinimum(0);
4397
+ versionSlider.setMaximum(VersionCount() - 1);
4398
+ versionSlider.setInteger(copy.versionindex);
4399
+ versionSlider.setEnabled(copy.versionindex != -1);
4400
+ muteSlider = false;
4401
+ }
4402
+
4403
+ public boolean PreviousVersion()
4404
+ {
4405
+ // Option?
4406
+ Replace();
4407
+
4408
+ System.err.println("Undo");
4409
+
4410
+ //cRadio tab = GetCurrentTab();
4411
+
4412
+ if (copy.versionindex == 0)
4413
+ {
4414
+ java.awt.Toolkit.getDefaultToolkit().beep();
4415
+ return false;
4416
+ }
4417
+
4418
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
4419
+// {
4420
+// if (Save(false))
4421
+// tab.versionindex -= 1;
4422
+// else
4423
+// {
4424
+// if (tab.versionindex <= 0)
4425
+// return false;
4426
+// else
4427
+// tab.versionindex -= 1;
4428
+// }
4429
+// }
4430
+
4431
+ copy.versionindex -= 1;
4432
+
4433
+ CopyChanged();
4434
+
4435
+ return true;
4436
+ }
4437
+
4438
+ public boolean Restore()
4439
+ {
4440
+ System.err.println("Restore");
4441
+
4442
+ //cRadio tab = GetCurrentTab();
4443
+
4444
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4445
+ {
4446
+ java.awt.Toolkit.getDefaultToolkit().beep();
4447
+ return false;
4448
+ }
4449
+
4450
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4451
+ CopyChanged();
4452
+
4453
+ return true;
4454
+ }
4455
+
4456
+ public boolean Replace()
4457
+ {
4458
+ System.err.println("Replace");
4459
+
4460
+ //cRadio tab = GetCurrentTab();
4461
+
4462
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4463
+ {
4464
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
4465
+ return false;
4466
+ }
4467
+
4468
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
4469
+
4470
+ return true;
4471
+ }
4472
+
4473
+ public void NextVersion()
4474
+ {
4475
+ // Option?
4476
+ Replace();
4477
+
4478
+ //cRadio tab = GetCurrentTab();
4479
+
4480
+ if (copy.versionlist[copy.versionindex + 1] == null)
4481
+ {
4482
+ java.awt.Toolkit.getDefaultToolkit().beep();
4483
+ return;
4484
+ }
4485
+
4486
+ copy.versionindex += 1;
4487
+
4488
+ CopyChanged();
4489
+
4490
+ //if (!tab.user[tab.versionindex])
4491
+ // tab.graphs[tab.versionindex] = null;
4492
+ }
4493
+
4494
+ void ImportGFD()
4495
+ {
4496
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32694497 browser.show();
32704498 String filename = browser.getFile();
32714499 if (filename != null && filename.length() > 0)
32724500 {
3273
- CameraPane.filename = browser.getDirectory() + filename;
4501
+ String fullname = browser.getDirectory() + filename;
4502
+
4503
+ //Object3D readobj =
4504
+ objEditor.ReadGFD(fullname, objEditor);
4505
+ //makeSomething(readobj);
4506
+ }
4507
+ }
4508
+
4509
+ void ImportVRMLX3D()
4510
+ {
4511
+ if (Grafreed.standAlone)
4512
+ {
4513
+ /**/
4514
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4515
+ browser.show();
4516
+ String filename = browser.getFile();
4517
+ if (filename != null && filename.length() > 0)
4518
+ {
4519
+ String fullname = browser.getDirectory() + filename;
4520
+ LoadVRMLX3D(fullname);
4521
+ }
4522
+ /**/
4523
+ }
4524
+ }
4525
+
4526
+ void ToggleAnimation()
4527
+ {
4528
+ if (!Globals.ANIMATION)
4529
+ {
4530
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
4531
+ browser.setVisible(true);
4532
+ String filename = browser.getFile();
4533
+ if (filename != null && filename.length() > 0)
4534
+ {
4535
+ Globals.filename = browser.getDirectory() + filename;
32744536 //CameraPane.framecount = 0;
3275
- CameraPane.imagecount = 0;
4537
+ Globals.imagecount = 0;
32764538
3277
- CameraPane.ANIMATION ^= true;
4539
+ Globals.ANIMATION ^= true;
32784540
3279
- GrafreeD.wav.cursor = 0;
3280
- GrafreeD.wav.loop = 0;
4541
+ Grafreed.wav.cursor = 0;
4542
+ Grafreed.wav.loop = 0;
32814543 }
32824544 } else
32834545 {
3284
- CameraPane.ANIMATION ^= true;
4546
+ Globals.ANIMATION ^= true;
32854547 }
32864548 }
32874549
....@@ -3327,7 +4589,7 @@
33274589 void CreateMaterial()
33284590 {
33294591 //copy.ClearMaterial(); // PATCH
3330
- copy.CreateMaterialS(multiplyToggle.isSelected());
4592
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33314593 if (copy.selection.size() > 0)
33324594 //SetMaterial(copy);
33334595 {
....@@ -3378,7 +4640,7 @@
33784640 assert false;
33794641 }
33804642
3381
- void EditSelection()
4643
+ void EditSelection(boolean newWindow)
33824644 {
33834645 }
33844646
....@@ -3386,11 +4648,11 @@
33864648 {
33874649 copy.ResetBlockLoop(); // temporary problem
33884650
3389
- boolean random = CameraPane.RANDOM;
3390
- CameraPane.RANDOM = false; // parse everything
4651
+ boolean random = CameraPane.SWITCH;
4652
+ CameraPane.SWITCH = false; // parse everything
33914653 copy.ResetDisplayList();
33924654 copy.HardTouch();
3393
- CameraPane.RANDOM = random;
4655
+ CameraPane.SWITCH = random;
33944656 }
33954657
33964658 // public void applySelf()
....@@ -3437,7 +4699,7 @@
34374699 //copy.material = new cMaterial(copy.GetMaterial());
34384700
34394701 current.color = (float) colorField.getFloat();
3440
- current.modulation = (float) modulationField.getFloat();
4702
+ current.modulation = (float) saturationField.getFloat();
34414703 current.metalness = (float) metalnessField.getFloat();
34424704 current.diffuse = (float) diffuseField.getFloat();
34434705 current.specular = (float) specularField.getFloat();
....@@ -3460,10 +4722,40 @@
34604722 current.fakedepth = (float) fakedepthField.getFloat();
34614723 current.shadowbias = (float) shadowbiasField.getFloat();
34624724
3463
- if (!NumberSlider.frozen)
4725
+ if (!cNumberSlider.frozen)
34644726 {
34654727 //System.out.println("Propagate = " + propagate);
34664728 copy.UpdateMaterial(anchor, current, propagate);
4729
+
4730
+ if (copy.material != null)
4731
+ {
4732
+ cMaterial mat = copy.material;
4733
+
4734
+ colorField.SetToolTipValue((mat.color));
4735
+ saturationField.SetToolTipValue((mat.modulation));
4736
+ metalnessField.SetToolTipValue((mat.metalness));
4737
+ diffuseField.SetToolTipValue((mat.diffuse));
4738
+ specularField.SetToolTipValue((mat.specular));
4739
+ shininessField.SetToolTipValue((mat.shininess));
4740
+ shiftField.SetToolTipValue((mat.shift));
4741
+ ambientField.SetToolTipValue((mat.ambient));
4742
+ lightareaField.SetToolTipValue((mat.lightarea));
4743
+ diffusenessField.SetToolTipValue((mat.factor));
4744
+ velvetField.SetToolTipValue((mat.velvet));
4745
+ sheenField.SetToolTipValue((mat.sheen));
4746
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4747
+ backlitField.SetToolTipValue((mat.bump));
4748
+ anisoField.SetToolTipValue((mat.aniso));
4749
+ anisoVField.SetToolTipValue((mat.anisoV));
4750
+ cameraField.SetToolTipValue((mat.cameralight));
4751
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4752
+ shadowField.SetToolTipValue((mat.shadow));
4753
+ textureField.SetToolTipValue((mat.texture));
4754
+ opacityField.SetToolTipValue((mat.opacity));
4755
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4756
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4757
+ }
4758
+
34674759 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34684760 {
34694761 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3492,9 +4784,28 @@
34924784 //copy.Touch();
34934785 }
34944786
4787
+ cNumberSlider versionSlider;
4788
+
34954789 public void stateChanged(ChangeEvent e)
34964790 {
34974791 // assert(false);
4792
+ if (e.getSource() == versionSlider)
4793
+ {
4794
+ if (muteSlider)
4795
+ return;
4796
+
4797
+ Replace();
4798
+
4799
+ int version = versionSlider.getInteger();
4800
+
4801
+ if (version != -1 && copy.versionlist[version] != null)
4802
+ {
4803
+ copy.versionindex = version;
4804
+ CopyChanged();
4805
+ }
4806
+
4807
+ return;
4808
+ }
34984809
34994810 if (freezematerial)
35004811 {
....@@ -3508,6 +4819,7 @@
35084819 || e.getSource() == apertureField
35094820 || e.getSource() == shadowblurField)
35104821 {
4822
+ new Exception().printStackTrace();
35114823 System.exit(0);
35124824 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35134825 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3529,12 +4841,24 @@
35294841 {
35304842 //System.out.println("stateChanged = " + this);
35314843 materialtouched = true;
4844
+
4845
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
4846
+ {
4847
+ saturationField.setFloat(1);
4848
+ }
4849
+
35324850 applySelf();
35334851 //System.out.println("this = " + this);
35344852 //System.out.println("PARENT = " + parent);
35354853 //if (parent != null)
35364854 // parent.applySelf();
3537
- refreshContents();
4855
+ if (e.getSource() == normalpushField)
4856
+ {
4857
+ objEditor.refreshContents();
4858
+ //Refresh();
4859
+ }
4860
+ else
4861
+ refreshContents();
35384862 // ??? client.refreshEditWindow();
35394863 }
35404864 //else
....@@ -3546,7 +4870,7 @@
35464870 //group.name = nameField.getText();
35474871 //objEditor.applySelf();
35484872
3549
- assert (objEditor == this);
4873
+ // OCT2018: assert (objEditor == this);
35504874 if (copy.selection == null || copy.selection.size() == 0)
35514875 //super.applySelf()
35524876 ; else
....@@ -3570,12 +4894,18 @@
35704894 objEditor.copy = keep;
35714895 }
35724896 }
4897
+
4898
+ if (normalpushField != null)
4899
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35734900 }
35744901
35754902 void SnapObject()
35764903 {
3577
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3578
- SnapObject(obj);
4904
+ if (copy.selection.size() > 0)
4905
+ {
4906
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
4907
+ SnapObject(obj);
4908
+ }
35794909 }
35804910
35814911 void SnapObject(Object3D obj)
....@@ -3816,20 +5146,26 @@
38165146 {
38175147 if (GetTree() != null)
38185148 {
5149
+ GetTree().revalidate();
38195150 GetTree().repaint();
38205151 }
38215152
38225153 radioPanel.revalidate();
38235154 radioPanel.repaint();
3824
- ctrlPanel.revalidate(); // ? new
5155
+ ctrlPanel.validate(); // ? new
38255156 ctrlPanel.repaint();
38265157 }
5158
+
5159
+ if (previousVersionButton != null && copy.versionlist != null)
5160
+ SetVersionStates();
38275161 }
38285162
38295163 static TweenManager tweenManager = new TweenManager();
38305164
38315165 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38325166 {
5167
+ if (Globals.REPLACEONMAKE) // && resetmodel)
5168
+ Save();
38335169 //Tween.set(thing, 0).target(1).start(tweenManager);
38345170 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38355171 // if (thing instanceof GenericJointDemo)
....@@ -3916,6 +5252,12 @@
39165252 {
39175253 ResetModel();
39185254 Select(thing.GetTreePath(), true, false); // unselect... false);
5255
+
5256
+ if (thing.Size() == 0)
5257
+ {
5258
+ //EditSelection(false);
5259
+ }
5260
+
39195261 refreshContents();
39205262 }
39215263
....@@ -4033,6 +5375,7 @@
40335375 }
40345376 }
40355377 }
5378
+
40365379 LoadGFDThread loadGFDThread;
40375380
40385381 void ReadGFD(String fullname, iCallBack cb)
....@@ -4052,8 +5395,10 @@
40525395
40535396 try
40545397 {
5398
+ // Try compressed version first.
40555399 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4056
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
5400
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
5401
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40575402
40585403 readobj = (Object3D) p.readObject();
40595404 istream.close();
....@@ -4061,7 +5406,22 @@
40615406 readobj.ResetDisplayList();
40625407 } catch (Exception e)
40635408 {
4064
- e.printStackTrace();
5409
+ if (!e.toString().contains("GZIP"))
5410
+ e.printStackTrace();
5411
+
5412
+ try
5413
+ {
5414
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
5415
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
5416
+
5417
+ readobj = (Object3D) p.readObject();
5418
+ istream.close();
5419
+
5420
+ readobj.ResetDisplayList();
5421
+ } catch (Exception e2)
5422
+ {
5423
+ e2.printStackTrace();
5424
+ }
40655425 }
40665426 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40675427 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4107,6 +5467,12 @@
41075467
41085468 void LoadIt(Object obj)
41095469 {
5470
+ if (obj == null)
5471
+ {
5472
+ // Invalid file
5473
+ return;
5474
+ }
5475
+
41105476 System.out.println("Loaded " + obj);
41115477 //new Exception().printStackTrace();
41125478 Object3D readobj = (Object3D) obj;
....@@ -4116,10 +5482,14 @@
41165482
41175483 if (readobj != null)
41185484 {
5485
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
5486
+ // Save();
41195487 try
41205488 {
41215489 //readobj.deepCopySelf(copy);
41225490 copy.clear(); // june 2014
5491
+ copy.skyboxname = readobj.skyboxname;
5492
+ copy.skyboxext = readobj.skyboxext;
41235493 for (int i = 0; i < readobj.size(); i++)
41245494 {
41255495 Object3D child = readobj.get(i); // reserve(i);
....@@ -4160,6 +5530,7 @@
41605530 }
41615531 } catch (ClassCastException e)
41625532 {
5533
+ e.printStackTrace();
41635534 assert (false);
41645535 Composite c = (Composite) copy;
41655536 c.children.clear();
....@@ -4170,17 +5541,31 @@
41705541 c.addChild(csg);
41715542 }
41725543
5544
+ copy.versionlist = readobj.versionlist;
5545
+ copy.versionindex = readobj.versionindex;
5546
+
5547
+ if (copy.versionlist == null)
5548
+ {
5549
+ // Backward compatibility
5550
+ copy.versionlist = new Object3D[100];
5551
+ copy.versionindex = -1;
5552
+
5553
+ //Save(true);
5554
+ }
5555
+
5556
+ //? SetUndoStates();
5557
+
41735558 ResetModel();
41745559 copy.HardTouch(); // recompile?
41755560 refreshContents();
41765561 }
41775562 }
41785563
4179
- void load() // throws ClassNotFoundException
5564
+ void Open() // throws ClassNotFoundException
41805565 {
4181
- if (GrafreeD.standAlone)
5566
+ if (Grafreed.standAlone)
41825567 {
4183
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5568
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
41845569 browser.show();
41855570 String filename = browser.getFile();
41865571 if (filename != null && filename.length() > 0)
....@@ -4257,6 +5642,8 @@
42575642
42585643 void save()
42595644 {
5645
+ Replace();
5646
+
42605647 if (lastname == null)
42615648 {
42625649 return;
....@@ -4265,11 +5652,13 @@
42655652 try
42665653 {
42675654 FileOutputStream ostream = new FileOutputStream(lastname);
4268
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5655
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5656
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42695657
42705658 p.writeObject(copy);
42715659 p.flush();
42725660
5661
+ zstream.close();
42735662 ostream.close();
42745663
42755664 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4277,19 +5666,23 @@
42775666 //ps.print(buffer.toString());
42785667 } catch (IOException e)
42795668 {
5669
+ e.printStackTrace();
42805670 }
42815671 }
5672
+
42825673 String lastname;
42835674
42845675 void saveAs()
42855676 {
4286
- if (GrafreeD.standAlone)
5677
+ if (Grafreed.standAlone)
42875678 {
42885679 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42895680 browser.setVisible(true);
42905681 String filename = browser.getFile();
42915682 if (filename != null && filename.length() > 0)
42925683 {
5684
+ if (!filename.endsWith(".gfd"))
5685
+ filename += ".gfd";
42935686 lastname = browser.getDirectory() + filename;
42945687 save();
42955688 }
....@@ -4388,13 +5781,13 @@
43885781 try
43895782 {
43905783 FileOutputStream ostream = new FileOutputStream(filename);
4391
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4392
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5784
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5785
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43935786
43945787 Object3D objectparent = obj.parent;
43955788 obj.parent = null;
43965789
4397
- Object3D object = (Object3D) GrafreeD.clone(obj);
5790
+ Object3D object = (Object3D) Grafreed.clone(obj);
43985791
43995792 obj.parent = objectparent;
44005793
....@@ -4406,8 +5799,8 @@
44065799 p.writeObject(object);
44075800 p.flush();
44085801
5802
+ zstream.close();
44095803 ostream.close();
4410
- // zstream.close();
44115804
44125805 // group.selection.get(0).parent = parent;
44135806 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4428,7 +5821,7 @@
44285821 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44295822 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44305823 copy.generatePOV(buffer);
4431
- if (GrafreeD.standAlone)
5824
+ if (Grafreed.standAlone)
44325825 {
44335826 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44345827 browser.show();
....@@ -4454,21 +5847,20 @@
44545847 Object3D client;
44555848 Object3D copy;
44565849 MenuBar menuBar;
4457
- Menu windowMenu;
4458
- MenuItem loadItem;
5850
+ Menu fileMenu;
5851
+ MenuItem newItem;
5852
+ MenuItem openItem;
44595853 MenuItem saveItem;
44605854 MenuItem saveAsItem;
44615855 MenuItem exportAsItem;
44625856 MenuItem reexportItem;
44635857 MenuItem povItem;
44645858 MenuItem closeItem;
4465
- Menu cameraMenu;
5859
+
44665860 CheckboxMenuItem zBufferItem;
44675861 //MenuItem normalLensItem;
4468
- MenuItem editCameraItem;
4469
- MenuItem revertCameraItem;
4470
- CheckboxMenuItem toggleLiveItem;
44715862 MenuItem stepItem;
5863
+ CheckboxMenuItem toggleLiveItem;
44725864 CheckboxMenuItem toggleFullScreenItem;
44735865 CheckboxMenuItem toggleTimelineItem;
44745866 CheckboxMenuItem toggleRenderItem;
....@@ -4477,28 +5869,44 @@
44775869 CheckboxMenuItem toggleFootContactItem;
44785870 CheckboxMenuItem toggleDLItem;
44795871 CheckboxMenuItem toggleTextureItem;
4480
- CheckboxMenuItem toggleRandomItem;
5872
+ CheckboxMenuItem toggleSwitchItem;
44815873 CheckboxMenuItem toggleRootItem;
44825874 CheckboxMenuItem animationItem;
5875
+ MenuItem archiveItem;
44835876 CheckboxMenuItem toggleHandleItem;
44845877 CheckboxMenuItem togglePaintItem;
44855878 JSplitPane mainPanel;
44865879 JScrollPane scrollpane;
5880
+
44875881 JPanel toolbarPanel;
4488
- JPanel treePanel;
5882
+
5883
+ cGridBag treePanel;
5884
+
44895885 JPanel radioPanel;
44905886 ButtonGroup buttonGroup;
4491
- JPanel ctrlPanel;
4492
- JPanel materialPanel;
5887
+
5888
+ cGridBag toolboxPanel;
5889
+ cGridBag skyboxPanel;
5890
+ cGridBag materialPanel;
5891
+ cGridBag ctrlPanel;
5892
+
44935893 JScrollPane infoPanel;
4494
- JPanel optionsPanel;
5894
+
5895
+ cGridBag optionsPanel;
5896
+
44955897 JTabbedPane objectPanel;
4496
- JPanel XYZPanel;
5898
+ boolean materialFlushed;
5899
+ Object3D latestObject;
5900
+
5901
+ cGridBag XYZPanel;
5902
+
44975903 JSplitPane gridPanel;
44985904 JSplitPane bigPanel;
4499
- JPanel bigThree;
4500
- JTabbedPane scenePanel;
4501
- JPanel centralPanel;
5905
+
5906
+ cGridBag bigThree;
5907
+ cGridBag scenePanel;
5908
+ cGridBag centralPanel;
5909
+ JSplitPane cameraPanel;
45025910 JPanel timelinePanel;
45035911 JMenuBar timelineMenubar;
45045912 JSplitPane framePanel;
....@@ -4550,65 +5958,74 @@
45505958 // MATERIAL
45515959 JLabel materialLabel;
45525960 JLabel colorLabel;
4553
- NumberSlider colorField;
5961
+ cNumberSlider colorField;
45545962 JLabel modulationLabel;
4555
- NumberSlider modulationField;
5963
+ cNumberSlider saturationField;
45565964 JLabel metalnessLabel;
4557
- NumberSlider metalnessField;
5965
+ cNumberSlider metalnessField;
45585966 JLabel diffuseLabel;
4559
- NumberSlider diffuseField;
5967
+ cNumberSlider diffuseField;
45605968 JLabel specularLabel;
4561
- NumberSlider specularField;
5969
+ cNumberSlider specularField;
45625970 JLabel shininessLabel;
4563
- NumberSlider shininessField;
5971
+ cNumberSlider shininessField;
45645972 JLabel shiftLabel;
4565
- NumberSlider shiftField;
5973
+ cNumberSlider shiftField;
45665974 JLabel ambientLabel;
4567
- NumberSlider ambientField;
5975
+ cNumberSlider ambientField;
45685976 JLabel lightareaLabel;
4569
- NumberSlider lightareaField;
5977
+ cNumberSlider lightareaField;
45705978 JLabel diffusenessLabel;
4571
- NumberSlider diffusenessField;
5979
+ cNumberSlider diffusenessField;
45725980 JLabel velvetLabel;
4573
- NumberSlider velvetField;
5981
+ cNumberSlider velvetField;
45745982 JLabel sheenLabel;
4575
- NumberSlider sheenField;
5983
+ cNumberSlider sheenField;
45765984 JLabel subsurfaceLabel;
4577
- NumberSlider subsurfaceField;
5985
+ cNumberSlider subsurfaceField;
45785986 //JLabel bumpLabel;
45795987 //NumberSlider bumpField;
45805988 JLabel backlitLabel;
4581
- NumberSlider backlitField;
5989
+ cNumberSlider backlitField;
45825990 JLabel anisoLabel;
4583
- NumberSlider anisoField;
5991
+ cNumberSlider anisoField;
45845992 JLabel anisoVLabel;
4585
- NumberSlider anisoVField;
5993
+ cNumberSlider anisoVField;
5994
+
45865995 JLabel cameraLabel;
4587
- NumberSlider cameraField;
5996
+ cNumberSlider cameraField;
45885997 JLabel selfshadowLabel;
4589
- NumberSlider selfshadowField;
5998
+ cNumberSlider selfshadowField;
45905999 JLabel shadowLabel;
4591
- NumberSlider shadowField;
6000
+ cNumberSlider shadowField;
45926001 JLabel textureLabel;
4593
- NumberSlider textureField;
6002
+ cNumberSlider textureField;
45946003 JLabel opacityLabel;
4595
- NumberSlider opacityField;
6004
+ cNumberSlider opacityField;
45966005 JLabel fakedepthLabel;
4597
- NumberSlider fakedepthField;
6006
+ cNumberSlider fakedepthField;
45986007 JLabel shadowbiasLabel;
4599
- NumberSlider shadowbiasField;
6008
+ cNumberSlider shadowbiasField;
6009
+
46006010 JLabel bumpLabel;
4601
- NumberSlider bumpField;
6011
+ cNumberSlider bumpField;
46026012 JLabel noiseLabel;
4603
- NumberSlider noiseField;
6013
+ cNumberSlider noiseField;
46046014 JLabel powerLabel;
4605
- NumberSlider powerField;
6015
+ cNumberSlider powerField;
46066016 JLabel borderfadeLabel;
4607
- NumberSlider borderfadeField;
6017
+ cNumberSlider borderfadeField;
46086018 JLabel fogLabel;
4609
- NumberSlider fogField;
6019
+ cNumberSlider fogField;
46106020 JLabel opacityPowerLabel;
4611
- NumberSlider opacityPowerField;
4612
- JTree jTree;
6021
+ cNumberSlider opacityPowerField;
6022
+ cTree jTree;
46136023 //ObjectUI parent;
6024
+
6025
+ cNumberSlider normalpushField;
6026
+
6027
+ private MenuItem importGFDItem;
6028
+ private MenuItem importVRMLX3DItem;
6029
+ private MenuItem import3DSItem;
6030
+ private MenuItem importOBJItem;
46146031 }