Normand Briere
2019-07-27 1af7d3700724834e40ad8636bc9a56cdc3b19b15
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,59 @@
2834 iSendInfo
2935 //KeyListener
3036 {
37
+ boolean timeline;
38
+ boolean wasFullScreen;
3139
40
+ GroupEditor callee;
41
+ JFrame frame;
42
+
43
+ static ObjEditor theFrame;
44
+
45
+ cButton GetButton(String name, boolean border)
46
+ {
47
+ ImageIcon icon = GetIcon(name);
48
+ return new cButton(icon, border);
49
+ }
50
+
51
+ cToggleButton GetToggleButton(String name, boolean border)
52
+ {
53
+ ImageIcon icon = GetIcon(name);
54
+ return new cToggleButton(icon, border);
55
+ }
56
+
57
+ cCheckBox GetCheckBox(String name, boolean border)
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cCheckBox(icon, border);
61
+ }
62
+
63
+ private ImageIcon GetIcon(String name)
64
+ {
65
+ try
66
+ {
67
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
68
+
69
+ if (image.getWidth() != 24 && image.getHeight() != 24)
70
+ {
71
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
72
+ Graphics2D g = resized.createGraphics();
73
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
74
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
75
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
76
+ g.dispose();
77
+
78
+ image = resized;
79
+ }
80
+
81
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
82
+ return icon;
83
+ }
84
+ catch (Exception e)
85
+ {
86
+ return null;
87
+ }
88
+ }
89
+
3290 // SCRIPT
3391
3492 transient JFrame textpanel = null;
....@@ -119,51 +177,62 @@
119177 void keyPressed(int key, int modifiers)
120178 {
121179 System.out.println("KEY PRESSED");
122
- CameraPane.theRenderer.keyPressed(key, modifiers);
180
+ Globals.theRenderer.keyPressed(key, modifiers);
123181 }
124182 */
125183
126184 static GridBagConstraints aConstraints;
127185 static GridBagConstraints aWindowConstraints;
128
- GroupEditor callee;
129
- JFrame frame;
186
+
130187 static int GRIDWIDTH = 100; // 4;
131188
132189 public void closeUI()
133190 {
134191 //new Exception().printStackTrace();
135
- System.out.println("this = " + this);
136
- System.out.println("objEditor = " + objEditor);
192
+// System.out.println("this = " + this);
193
+// System.out.println("objEditor = " + objEditor);
137194 //nameField.removeActionListener(this);
138
- objEditor.ctrlPanel.remove(nameField);
195
+// objEditor.ctrlPanel.remove(nameField);
139196
140
- if (!GroupEditor.allparams)
197
+ objEditor.ctrlPanel.remove(namePanel);
198
+
199
+ if (!allparams)
141200 return;
142201
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);
202
+// objEditor.ctrlPanel.remove(liveCB);
203
+// objEditor.ctrlPanel.remove(hideCB);
204
+// objEditor.ctrlPanel.remove(markCB);
205
+//
206
+// objEditor.ctrlPanel.remove(randomCB);
207
+// objEditor.ctrlPanel.remove(speedupCB);
208
+// objEditor.ctrlPanel.remove(rewindCB);
209
+//
210
+// objEditor.ctrlPanel.remove(resetButton);
211
+// objEditor.ctrlPanel.remove(stepButton);
212
+//// objEditor.ctrlPanel.remove(stepAllButton);
213
+//// objEditor.ctrlPanel.remove(resetAllButton);
214
+// objEditor.ctrlPanel.remove(link2masterCB);
215
+// //objEditor.ctrlPanel.remove(flipVCB);
216
+// //objEditor.ctrlPanel.remove(texresMenu);
217
+// objEditor.ctrlPanel.remove(slowerButton);
218
+// objEditor.ctrlPanel.remove(fasterButton);
219
+// objEditor.ctrlPanel.remove(remarkButton);
220
+
221
+ objEditor.ctrlPanel.remove(setupPanel);
222
+ objEditor.ctrlPanel.remove(setupPanel2);
223
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
224
+ objEditor.ctrlPanel.remove(pushPanel);
225
+ //objEditor.ctrlPanel.remove(fillPanel);
226
+
227
+ //Remove(normalpushField);
161228 }
162229
163230 public ObjEditor GetEditor()
164231 {
165232 return objEditor; //.GetEditor();
166233 }
234
+
235
+ // Sometimes myself, sometimes my callee's.
167236 ObjEditor objEditor;
168237
169238 /*
....@@ -199,6 +268,12 @@
199268 client = inClient;
200269 copy = client;
201270
271
+ if (copy.versions == null)
272
+ {
273
+ copy.versions = new byte[100][];
274
+ copy.versionindex = -1;
275
+ }
276
+
202277 // "this" is not called: SetupUI2(objEditor);
203278 }
204279
....@@ -212,6 +287,12 @@
212287 client = inClient;
213288 copy = client;
214289
290
+ if (copy.versions == null)
291
+ {
292
+ copy.versions = new byte[100][];
293
+ copy.versionindex = -1;
294
+ }
295
+
215296 SetupUI2(callee.GetEditor());
216297 }
217298
....@@ -226,6 +307,7 @@
226307 //localCopy.parent = null;
227308
228309 frame = new JFrame();
310
+ frame.setUndecorated(false);
229311 objEditor = this;
230312 this.callee = callee;
231313
....@@ -238,11 +320,17 @@
238320 //if (!isDisplayable())
239321 //setUndecorated(true);
240322
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
323
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242324 client = inClient;
243325 copy = localCopy;
244326 copy.editWindow = this;
245327
328
+ if (copy.versions == null)
329
+ {
330
+// copy.versions = new byte[100][];
331
+// copy.versionindex = -1;
332
+ }
333
+
246334 SetupMenu();
247335
248336 //SetupName(objEditor); // new
....@@ -256,28 +344,49 @@
256344 return frame.action(event, obj);
257345 }
258346
347
+ // Cannot work without static
348
+ static boolean allparams = true;
349
+
350
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
351
+
259352 void SetupMenu()
260353 {
261354 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..."));
355
+ menuBar.add(fileMenu = new Menu("File"));
356
+ fileMenu.add(newItem = new MenuItem("New"));
357
+ fileMenu.add(openItem = new MenuItem("Open..."));
358
+
359
+ //oe.menuBar.add(menu = new Menu("Include"));
360
+ Menu menu = new Menu("Import");
361
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
362
+ importOBJItem.addActionListener(this);
363
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
364
+ import3DSItem.addActionListener(this);
365
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
366
+ importVRMLX3DItem.addActionListener(this);
367
+ menu.add("-");
368
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
369
+ importGFDItem.addActionListener(this);
370
+ fileMenu.add(menu);
371
+ fileMenu.add("-");
372
+
373
+ fileMenu.add(saveItem = new MenuItem("Save"));
374
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267375 //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("-");
376
+ fileMenu.add("-");
377
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
378
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
379
+ fileMenu.add("-");
272380 if (client.parent != null)
273381 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
382
+ fileMenu.add(closeItem = new MenuItem("Close"));
275383 } else
276384 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
385
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278386 }
279387
280
- loadItem.addActionListener(this);
388
+ newItem.addActionListener(this);
389
+ openItem.addActionListener(this);
281390 saveItem.addActionListener(this);
282391 saveAsItem.addActionListener(this);
283392 exportAsItem.addActionListener(this);
....@@ -285,80 +394,69 @@
285394 //povItem.addActionListener(this);
286395 closeItem.addActionListener(this);
287396
288
- menuBar.add(cameraMenu = new Menu("View"));
289
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
290
- //zBufferItem.addActionListener(this);
291
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
292
- //normalLensItem.addActionListener(this);
293
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
294
- revertCameraItem.addActionListener(this);
295
- cameraMenu.add(toggleFullItem = new CheckboxMenuItem("Full Screen"));
296
- toggleFullItem.addItemListener(this);
297
- toggleFullItem.setState(CameraPane.FULLSCREEN);
298
- cameraMenu.add("-");
299
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
300
- toggleTextureItem.addItemListener(this);
301
- toggleTextureItem.setState(CameraPane.textureon);
302
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
303
- toggleLiveItem.addItemListener(this);
304
- toggleLiveItem.setState(CameraPane.isLIVE());
305
- cameraMenu.add(stepItem = new MenuItem("Step"));
306
- stepItem.addActionListener(this);
307
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
308
-// toggleDLItem.addItemListener(this);
309
-// toggleDLItem.setState(false);
310
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
311
- toggleRenderItem.addItemListener(this);
312
- toggleRenderItem.setState(!CameraPane.frozen);
313
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
314
- toggleDebugItem.addItemListener(this);
315
- toggleDebugItem.setState(CameraPane.DEBUG);
316
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
317
- toggleFrustumItem.addItemListener(this);
318
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
319
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
320
- toggleFootContactItem.addItemListener(this);
321
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
322
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
323
- toggleRandomItem.addItemListener(this);
324
- toggleRandomItem.setState(CameraPane.RANDOM);
325
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
326
- toggleHandleItem.addItemListener(this);
327
- toggleHandleItem.setState(CameraPane.HANDLES);
328
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
329
- togglePaintItem.addItemListener(this);
330
- togglePaintItem.setState(CameraPane.PAINTMODE);
331
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
332
-// toggleRootItem.addItemListener(this);
333
-// toggleRootItem.setState(false);
334
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
335
-// animationItem.addItemListener(this);
336
-// animationItem.setState(CameraPane.ANIMATION);
337
- cameraMenu.add("-");
338
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
339
- editCameraItem.addActionListener(this);
340
-
341397 objectPanel = new JTabbedPane();
398
+
399
+ ChangeListener changeListener = new ChangeListener()
400
+ {
401
+ public void stateChanged(ChangeEvent changeEvent)
402
+ {
403
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
404
+// {
405
+// if (latestObject != null)
406
+// {
407
+// refreshContents(true);
408
+// SetMaterial(latestObject);
409
+// }
410
+//
411
+// materialFlushed = true;
412
+// }
413
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
414
+// {
415
+// if (listUI.size() == 0)
416
+// EditSelection(false);
417
+// }
418
+
419
+ refreshContents(false); // To refresh Info tab
420
+ }
421
+ };
422
+ objectPanel.addChangeListener(changeListener);
423
+
342424 toolbarPanel = new JPanel();
343425 toolbarPanel.setName("Toolbar");
344
- treePanel = new JPanel();
426
+
427
+ treePanel = new cGridBag();
345428 treePanel.setName("Tree");
346
- ctrlPanel = new JPanel(); // new GridBagLayout());
347
- ctrlPanel.setName("Edit");
348
- materialPanel = new JPanel();
349
- materialPanel.setName("Material");
429
+
430
+ editPanel = new cGridBag().setVertical(true);
431
+ //editPanel.setName("Edit");
432
+
433
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
434
+
435
+ editCommandsPanel = new cGridBag();
436
+ editPanel.add(editCommandsPanel);
437
+ editPanel.add(ctrlPanel);
438
+
439
+ toolboxPanel = new cGridBag().setVertical(false);
440
+ //toolboxPanel.setName("Toolbox");
441
+
442
+ materialPanel = new cGridBag().setVertical(true);
443
+ //materialPanel.setName("Material");
444
+
350445 /*JTextPane*/
351446 infoarea = createTextPane();
447
+ doc = infoarea.getStyledDocument();
448
+
352449 infoarea.setEditable(true);
353450 SetText();
451
+
354452 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
355453 // infoarea.setOpaque(false);
356454 // //infoarea.setForeground(textcolor);
357
- infoarea.setLineWrap(true);
358
- infoarea.setWrapStyleWord(true);
455
+// TEXTAREA infoarea.setLineWrap(true);
456
+// TEXTAREA infoarea.setWrapStyleWord(true);
359457 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
360
- infoPanel.setPreferredSize(new Dimension(50, 200));
361
- infoPanel.setName("Info");
458
+ infoPanel.setPreferredSize(new Dimension(1, 1));
459
+ //infoPanel.setName("Info");
362460 //infoPanel.setLayout(new BorderLayout());
363461 //infoPanel.add(createTextPane());
364462
....@@ -366,16 +464,23 @@
366464 mainPanel.setName("Main");
367465 mainPanel.setContinuousLayout(true);
368466 mainPanel.setOneTouchExpandable(true);
369
- mainPanel.setDividerLocation(1.0);
370467 mainPanel.setDividerSize(9);
371
- mainPanel.setResizeWeight(0);
372
-
468
+ mainPanel.setDividerLocation(0.5); //1.0);
469
+ mainPanel.setResizeWeight(0.5);
470
+
471
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
472
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
473
+ divider.setDividerSize(15);
474
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
475
+
476
+ mainPanel.setUI(new BasicSplitPaneUI());
477
+
373478 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
374479 //mainPanel.setLayout(new GridBagLayout());
375480 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
376
- treePanel.setLayout(new GridBagLayout());
377
- ctrlPanel.setLayout(new GridBagLayout());
378
- materialPanel.setLayout(new GridBagLayout());
481
+// treePanel.setLayout(new GridBagLayout());
482
+ //ctrlPanel.setLayout(new GridBagLayout());
483
+ //materialPanel.setLayout(new GridBagLayout());
379484
380485 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
381486 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -414,7 +519,7 @@
414519 static String newline = "\n";
415520 protected static final String buttonString = "JButton";
416521 StyledDocument doc;
417
- JTextArea infoarea;
522
+ JTextPane infoarea;
418523
419524 void ClearInfo()
420525 {
....@@ -437,10 +542,10 @@
437542 e.printStackTrace();
438543 }
439544
440
- String selection = infoarea.getText();
441
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
442
- java.awt.datatransfer.Clipboard clipboard =
443
- Toolkit.getDefaultToolkit().getSystemClipboard();
545
+// String selection = infoarea.getText();
546
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
547
+// java.awt.datatransfer.Clipboard clipboard =
548
+// Toolkit.getDefaultToolkit().getSystemClipboard();
444549 //clipboard.setContents(data, data);
445550 }
446551
....@@ -463,13 +568,13 @@
463568 //SendInfo("Name:", "bold");
464569 if (sel.GetTextures() != null || debug)
465570 {
466
- si.SendInfo(sel.toString(), "bold");
571
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
467572 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
468573 if (sel.Size() > 0)
469574 {
470575 si.SendInfo("#children = " + sel.Size(), "regular");
471576 }
472
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
577
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
473578 if (debug)
474579 {
475580 try
....@@ -481,7 +586,10 @@
481586 }
482587
483588 if (full)
484
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
589
+ {
590
+ si.SendInfo(" BBox min: " + minima, "regular");
591
+ si.SendInfo(" BBox max: " + maxima, "regular");
592
+ }
485593
486594 if (sel.bRep != null)
487595 {
....@@ -508,7 +616,7 @@
508616 }
509617 if (sel.support != null)
510618 {
511
- si.SendInfo(" support: " + sel.support, "regular");
619
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
512620 }
513621 if (sel.scriptnode != null)
514622 {
....@@ -579,6 +687,9 @@
579687 {
580688 CameraPane.pointflow = (PointFlow) sel;
581689 }
690
+
691
+ si.SendInfo("_____________________", "regular");
692
+ si.SendInfo("", "regular");
582693 }
583694 }
584695
....@@ -594,52 +705,191 @@
594705 }
595706 }
596707
597
- private JTextArea createTextPane()
598
- {
599
- String[] initString =
600
- {
601
- "This is an editable JTextPane, ", //regular
602
- "another ", //italic
603
- "styled ", //bold
604
- "text ", //small
605
- "component, ", //large
606
- "which supports embedded components..." + newline,//regular
607
- " " + newline, //button
608
- "...and embedded icons..." + newline, //regular
609
- " ", //icon
610
- newline + "JTextPane is a subclass of JEditorPane that "
611
- + "uses a StyledEditorKit and StyledDocument, and provides "
612
- + "cover methods for interacting with those objects."
613
- };
708
+//static GraphicsDevice device = GraphicsEnvironment
709
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
614710
615
- String[] initStyles =
616
- {
617
- "regular", "italic", "bold", "small", "large",
618
- "regular", "button", "regular", "icon",
619
- "regular"
620
- };
711
+ Rectangle keeprect;
712
+ cRadio radio;
713
+
714
+cButton keepButton;
715
+ cButton twoButton; // Full 3D
716
+ cButton sixButton;
717
+ cButton threeButton;
718
+ cButton sevenButton;
719
+ cButton fourButton; // full panel
720
+ cButton oneButton; // full XYZ
721
+ //cButton currentLayout;
722
+
723
+ boolean maximized;
724
+
725
+ cButton fullscreenLayout;
621726
622
- JTextPane textPane = new JTextPane();
623
- textPane.setEditable(true);
624
- /*StyledDocument*/ doc = textPane.getStyledDocument();
625
- addStylesToDocument(doc);
626
-
627
- try
727
+ void Minimize()
628728 {
629
- for (int j = 0; j < 2; j++)
729
+ frame.setState(Frame.ICONIFIED);
730
+ frame.validate();
731
+ }
732
+
733
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
734
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
735
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
736
+ void Maximize()
737
+ {
738
+ if (CameraPane.FULLSCREEN)
630739 {
631
- for (int i = 0; i < initString.length; i++)
632
- {
633
- doc.insertString(doc.getLength(), initString[i],
634
- doc.getStyle(initStyles[i]));
635
- }
740
+ ToggleFullScreen();
636741 }
637
- } catch (BadLocationException ble)
742
+
743
+ if (maximized)
744
+ {
745
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
746
+ }
747
+ else
748
+ {
749
+ keeprect = frame.getBounds();
750
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
751
+// Dimension rect2 = frame.getToolkit().getScreenSize();
752
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
753
+// frame.setState(Frame.MAXIMIZED_BOTH);
754
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
755
+ }
756
+
757
+ maximized ^= true;
758
+
759
+ frame.validate();
760
+ }
761
+
762
+ cButton minButton;
763
+ cButton maxButton;
764
+ cButton fullButton;
765
+
766
+ void ToggleFullScreen()
638767 {
639
- System.err.println("Couldn't insert initial text into text pane.");
768
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
769
+
770
+ cameraView.ToggleFullScreen();
771
+
772
+ if (!CameraPane.FULLSCREEN)
773
+ {
774
+ device.setFullScreenWindow(null);
775
+ frame.dispose();
776
+ frame.setUndecorated(false);
777
+ frame.validate();
778
+ frame.setVisible(true);
779
+
780
+ //frame.setVisible(false);
781
+// frame.removeNotify();
782
+// frame.setUndecorated(false);
783
+// frame.addNotify();
784
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
785
+
786
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
787
+// X framePanel.add(bigThree);
788
+// X frame.getContentPane().add(/*"Center",*/framePanel);
789
+ framePanel.setDividerLocation(46);
790
+
791
+ //frame.setVisible(true);
792
+ radio.layout = keepButton;
793
+ //theFrame = null;
794
+ keepButton = null;
795
+ radio.layout.doClick();
796
+
797
+ } else
798
+ {
799
+ keepButton = radio.layout;
800
+ //keeprect = frame.getBounds();
801
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
802
+// frame.getToolkit().getScreenSize().height);
803
+ //frame.setVisible(false);
804
+
805
+ frame.dispose();
806
+ frame.setUndecorated(true);
807
+ device.setFullScreenWindow(frame);
808
+ frame.validate();
809
+ frame.setVisible(true);
810
+// frame.removeNotify();
811
+// frame.setUndecorated(true);
812
+// frame.addNotify();
813
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
814
+// X framePanel.remove(bigThree);
815
+// X frame.getContentPane().add(/*"Center",*/bigThree);
816
+ framePanel.setDividerLocation(0);
817
+
818
+ radio.layout = fullscreenLayout;
819
+ radio.layout.doClick();
820
+ //frame.setVisible(true);
821
+ }
822
+ frame.validate();
640823 }
641824
642
- return new JTextArea(); // textPane;
825
+ private byte[] CompressCopy()
826
+ {
827
+ boolean temp = CameraPane.SWITCH;
828
+ CameraPane.SWITCH = false;
829
+
830
+ copy.ExtractBigData(versiontable);
831
+ // if (copy == client)
832
+
833
+ byte[] versions[] = copy.versions;
834
+ copy.versions = null;
835
+
836
+ byte[] compress = Compress(copy);
837
+
838
+ copy.versions = versions;
839
+
840
+ copy.RestoreBigData(versiontable);
841
+
842
+ CameraPane.SWITCH = temp;
843
+
844
+ return compress;
845
+ }
846
+
847
+ private JTextPane createTextPane()
848
+ {
849
+// TEXTAREA String[] initString =
850
+// {
851
+// "This is an editable JTextPane, ", //regular
852
+// "another ", //italic
853
+// "styled ", //bold
854
+// "text ", //small
855
+// "component, ", //large
856
+// "which supports embedded components..." + newline,//regular
857
+// " " + newline, //button
858
+// "...and embedded icons..." + newline, //regular
859
+// " ", //icon
860
+// newline + "JTextPane is a subclass of JEditorPane that "
861
+// + "uses a StyledEditorKit and StyledDocument, and provides "
862
+// + "cover methods for interacting with those objects."
863
+// };
864
+//
865
+// String[] initStyles =
866
+// {
867
+// "regular", "italic", "bold", "small", "large",
868
+// "regular", "button", "regular", "icon",
869
+// "regular"
870
+// };
871
+//
872
+// JTextPane textPane = new JTextPane();
873
+// textPane.setEditable(true);
874
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
875
+// addStylesToDocument(doc);
876
+//
877
+// try
878
+// {
879
+// for (int j = 0; j < 2; j++)
880
+// {
881
+// for (int i = 0; i < initString.length; i++)
882
+// {
883
+// doc.insertString(doc.getLength(), initString[i],
884
+// doc.getStyle(initStyles[i]));
885
+// }
886
+// }
887
+// } catch (BadLocationException ble)
888
+// {
889
+// System.err.println("Couldn't insert initial text into text pane.");
890
+// }
891
+
892
+ return new JTextPane(); // textPane;
643893 }
644894
645895 protected void addStylesToDocument(StyledDocument doc)
....@@ -692,7 +942,7 @@
692942 protected static ImageIcon createImageIcon(String path,
693943 String description)
694944 {
695
- java.net.URL imgURL = GrafreeD.class.getResource(path);
945
+ java.net.URL imgURL = Grafreed.class.getResource(path);
696946 if (imgURL != null)
697947 {
698948 return new ImageIcon(imgURL, description);
....@@ -724,6 +974,7 @@
724974 // NumberSlider vDivsField;
725975 // JCheckBox endcaps;
726976 JCheckBox liveCB;
977
+ JCheckBox selectableCB;
727978 JCheckBox hideCB;
728979 JCheckBox link2masterCB;
729980 JCheckBox markCB;
....@@ -731,7 +982,12 @@
731982 JCheckBox speedupCB;
732983 JCheckBox rewindCB;
733984 JCheckBox flipVCB;
985
+
986
+ cCheckBox toggleTextureCB;
987
+ cCheckBox toggleSwitchCB;
988
+
734989 JComboBox texresMenu;
990
+
735991 JButton resetButton;
736992 JButton stepButton;
737993 JButton stepAllButton;
....@@ -739,115 +995,87 @@
739995 JButton slowerButton;
740996 JButton fasterButton;
741997 JButton remarkButton;
998
+
999
+ cGridBag editPanel;
1000
+ cGridBag editCommandsPanel;
1001
+
1002
+ cGridBag namePanel;
1003
+ cGridBag setupPanel;
1004
+ cGridBag setupPanel2;
1005
+ cGridBag objectCommandsPanel;
1006
+ cGridBag pushPanel;
1007
+ cGridBag fillPanel;
7421008
743
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1009
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7441010 {
7451011 JCheckBox cb;
7461012
747
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
748
- oe.aConstraints.gridwidth = 1; // 3;
749
-// oe.aConstraints.weightx = 1;
750
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
751
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1013
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7521014 cb.addItemListener(this);
753
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
754
- oe.aConstraints.gridwidth = 1;
755
- oe.aConstraints.gridx += 1;
7561015
7571016 return cb;
7581017 }
7591018
760
- cButton AddButton(ObjEditor oe, String label)
1019
+ cButton AddButton(cGridBag panel, String label)
7611020 {
7621021 cButton cb;
7631022
764
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
765
- oe.aConstraints.gridwidth = 1;
766
-// oe.aConstraints.weightx = 1;
767
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
768
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1023
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7691024 cb.addActionListener(this);
770
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
771
- oe.aConstraints.gridwidth = 1;
772
- oe.aConstraints.gridx += 1;
7731025
7741026 return cb;
7751027 }
7761028
777
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1029
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
7781030 {
7791031 JComboBox combo;
7801032
781
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
782
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
783
- oe.aConstraints.gridx += 1;
1033
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7841034 combo.addActionListener(this);
7851035
7861036 return combo;
7871037 }
7881038
789
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
1039
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
7901040 {
791
- NumberSlider combo;
1041
+ cGridBag control = new cGridBag();
1042
+
1043
+ cNumberSlider combo;
7921044
7931045 JLabel jlabel = new JLabel(label);
794
-
795
- aConstraints.fill = GridBagConstraints.VERTICAL;
7961046 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
797
- aConstraints.gridwidth = 2;
798
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
799
- aConstraints.gridx += 1;
800
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
801
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
802
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
803
- aConstraints.gridx += 1;
804
- aConstraints.gridwidth = 1;
805
-
1047
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1048
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8061049 combo.setFloat(current);
807
-
808
- combo.label = jlabel;
809
-
810
- combo.addChangeListener(this);
811
-
812
- return combo;
1050
+
1051
+ panel.add(control);
1052
+
1053
+ return control;
8131054 }
8141055
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
1056
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8161057 {
817
- NumberSlider combo;
1058
+ cGridBag control = new cGridBag();
1059
+
1060
+ cNumberSlider combo;
8181061
8191062 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
8221063 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
823
- aConstraints.gridwidth = 2;
824
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
825
- aConstraints.gridx += 1;
826
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
827
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
828
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
829
- aConstraints.gridx += 1;
830
- aConstraints.gridwidth = 1;
831
-
1064
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1065
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8321066 combo.setInteger(current);
8331067
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
1068
+ panel.add(control);
1069
+
1070
+ return control;
8391071 }
8401072
841
- JTextArea AddText(JPanel ctrlPanel, String name)
1073
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8421074 {
8431075 JTextArea text;
8441076
845
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
846
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
847
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1077
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8481078 text.addCaretListener(this);
849
- aConstraints.gridx += 1;
850
- aConstraints.gridwidth = 1;
8511079
8521080 return text;
8531081 }
....@@ -877,9 +1105,16 @@
8771105 objEditor.ctrlPanel.remove(j);
8781106 }
8791107
1108
+ void Remove(cNumberSlider j)
1109
+ {
1110
+ j.removeChangeListener(this);
1111
+ //objEditor.ctrlPanel.remove(j.label);
1112
+ objEditor.ctrlPanel.remove(j);
1113
+ }
1114
+
8801115 /*
8811116 */
882
- void Return() // ObjEditor oe)
1117
+ void Return0() // ObjEditor oe)
8831118 {
8841119 aConstraints.gridy += 1;
8851120 aConstraints.gridx = 0;
....@@ -934,35 +1169,79 @@
9341169
9351170 void SetupUI2(ObjEditor oe)
9361171 {
937
-// oe.aConstraints.weightx = 0;
938
-// oe.aConstraints.weighty = 0;
939
-// oe.aConstraints.gridx = 0;
940
-// oe.aConstraints.gridy = 0;
941
- SetupName(oe);
1172
+ //SetupName(oe);
9421173
943
- if (!GroupEditor.allparams)
1174
+ namePanel = new cGridBag();
1175
+
1176
+ nameField = AddText(namePanel, copy.GetName());
1177
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
1178
+ oe.ctrlPanel.add(namePanel);
1179
+
1180
+ oe.ctrlPanel.Return();
1181
+
1182
+ if (!allparams)
9441183 return;
9451184
946
- liveCB = AddCheckBox(oe, "Live", copy.live);
947
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
948
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1185
+ setupPanel = new cGridBag().setVertical(false);
1186
+
1187
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1188
+ liveCB.setToolTipText("Animate object");
1189
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1190
+ selectableCB.setToolTipText("Make object selectable");
9491191 // Return();
950
- markCB = AddCheckBox(oe, "Mark", copy.marked);
951
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
952
- randomCB = AddCheckBox(oe, "Rand", copy.random);
953
- Return();
954
- resetButton = AddButton(oe, "Reset");
955
- stepButton = AddButton(oe, "Step");
1192
+
1193
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1194
+ hideCB.setToolTipText("Hide object");
1195
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1196
+ markCB.setToolTipText("As animation target transform");
1197
+
1198
+ setupPanel2 = new cGridBag().setVertical(false);
1199
+
1200
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1201
+ rewindCB.setToolTipText("Rewind animation");
1202
+
1203
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1204
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1205
+
1206
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1207
+ link2masterCB.setToolTipText("Attach to support");
1208
+
1209
+ if (Globals.ADVANCED)
1210
+ {
1211
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1212
+ speedupCB.setToolTipText("Option motion capture");
1213
+ }
1214
+
1215
+ oe.ctrlPanel.add(setupPanel);
1216
+ oe.ctrlPanel.Return();
1217
+ oe.ctrlPanel.add(setupPanel2);
1218
+ oe.ctrlPanel.Return();
1219
+
1220
+ objectCommandsPanel = new cGridBag().setVertical(false);
1221
+
1222
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1223
+ resetButton.setToolTipText("Jump to frame zero");
1224
+ stepButton = AddButton(objectCommandsPanel, "Step");
1225
+ stepButton.setToolTipText("Step one frame");
9561226 // resetAllButton = AddButton(oe, "Reset All");
9571227 // stepAllButton = AddButton(oe, "Step All");
958
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9591228 // Return();
960
- slowerButton = AddButton(oe, "Slow");
961
- fasterButton = AddButton(oe, "Fast");
962
- remarkButton = AddButton(oe, "Rem");
1229
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1230
+ slowerButton.setToolTipText("Decrease animation speed");
1231
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1232
+ fasterButton.setToolTipText("Increase animation speed");
1233
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1234
+ remarkButton.setToolTipText("Set the current transform as the target");
9631235
964
- Return();
1236
+ oe.ctrlPanel.add(objectCommandsPanel);
1237
+ oe.ctrlPanel.Return();
9651238
1239
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1240
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1241
+ //Return();
1242
+
1243
+ oe.ctrlPanel.Return();
1244
+
9661245 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9671246 // ObjEditor.aConstraints.gridx += 1;
9681247
....@@ -1056,7 +1335,7 @@
10561335 oe.aConstraints.gridwidth = 1;
10571336 /**/
10581337 nameField = AddText(oe.ctrlPanel, copy.GetName());
1059
- Return();
1338
+ oe.ctrlPanel.Return();
10601339
10611340 //ctrlPanel.add(textureButton = new Button("Texture..."));
10621341 //textureButton.setEnabled(false);
....@@ -1158,10 +1437,28 @@
11581437 //JPanel worldPanel =
11591438 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11601439 //worldPanel.setName("World");
1161
- /*JPanel*/ cameraPanel =
1162
- new JPanel(new BorderLayout());
1163
- cameraPanel.add(cameraView);
1440
+ centralPanel = new cGridBag();
1441
+ centralPanel.preferredWidth = 20;
1442
+
1443
+ if (Globals.ADVANCED)
1444
+ {
1445
+ timelinePanel = new JPanel(new BorderLayout());
1446
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11641447
1448
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1449
+ cameraPanel.setContinuousLayout(true);
1450
+ cameraPanel.setOneTouchExpandable(true);
1451
+// cameraPanel.setDividerLocation(0.9);
1452
+// cameraPanel.setDividerSize(9);
1453
+ cameraPanel.setResizeWeight(1.0);
1454
+
1455
+ }
1456
+
1457
+ centralPanel.add(cameraView);
1458
+ centralPanel.setFocusable(true);
1459
+ //frame.setJMenuBar(timelineMenubar);
1460
+ //centralPanel.add(timelinePanel);
1461
+
11651462 //topView.camera = ;
11661463 //frontView.camera = new Camera(2);
11671464 //sideView.camera = new Camera(3);
....@@ -1177,12 +1474,14 @@
11771474 //frontView.object = copy;
11781475 //sideView.object = copy;
11791476
1180
- XYZPanel = new JPanel();
1181
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1477
+ XYZPanel = new cGridBag().setVertical(true);
1478
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11821479
1183
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1184
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1185
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1480
+ XYZPanel.preferredWidth = 5;
1481
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1482
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1483
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1484
+ //XYZPanel.setName("XYZ");
11861485
11871486 /*
11881487 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1191,7 +1490,7 @@
11911490 gridPanel.add(cameraView);
11921491 gridPanel.add(XYZPanel);
11931492 */
1194
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout());
1493
+ gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
11951494 gridPanel.setContinuousLayout(true);
11961495 gridPanel.setOneTouchExpandable(true);
11971496 gridPanel.setDividerLocation(1.0);
....@@ -1220,11 +1519,23 @@
12201519 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12211520 //tmp.setName("Edit");
12221521 objectPanel.add(materialPanel);
1223
- JPanel north = new JPanel(new BorderLayout());
1224
- north.setName("Edit");
1225
- north.add(ctrlPanel, BorderLayout.NORTH);
1226
- objectPanel.add(north);
1227
- objectPanel.add(infoPanel);
1522
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1523
+// JPanel north = new JPanel(new BorderLayout());
1524
+// north.setName("Edit");
1525
+// north.add(ctrlPanel, BorderLayout.NORTH);
1526
+// objectPanel.add(north);
1527
+ objectPanel.add(editPanel);
1528
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1529
+
1530
+ //if (Globals.ADVANCED)
1531
+ objectPanel.add(infoPanel);
1532
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1533
+
1534
+ objectPanel.add(XYZPanel);
1535
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1536
+
1537
+ objectPanel.add(toolboxPanel);
1538
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
12281539
12291540 /*
12301541 aConstraints.gridx = 0;
....@@ -1233,7 +1544,7 @@
12331544 aConstraints.gridy += 1;
12341545 aConstraints.gridwidth = 1;
12351546 mainPanel.add(objectPanel, aConstraints);
1236
- */
1547
+ */
12371548
12381549 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12391550 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1244,16 +1555,23 @@
12441555 scrollpane.setWheelScrollingEnabled(true);
12451556 scrollpane.addMouseWheelListener(this); // Default not fast enough
12461557
1247
- /*JTabbedPane*/ jtp = new JTabbedPane();
1248
- jtp.add(scrollpane);
1558
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1559
+ scenePanel.preferredWidth = 5;
1560
+
1561
+ JTabbedPane tabbedPane = new JTabbedPane();
1562
+ tabbedPane.add(scrollpane);
12491563
1250
- jtp.add(FSPane = new cFileSystemPane(this));
1251
-
1252
- optionsPanel = new JPanel(new GridBagLayout());
1564
+ optionsPanel = new cGridBag().setVertical(false);
12531565
12541566 optionsPanel.setName("Options");
1255
- jtp.add(optionsPanel);
1567
+
1568
+ AddOptions(optionsPanel); //, aConstraints);
1569
+
1570
+ tabbedPane.add(optionsPanel);
1571
+
1572
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12561573
1574
+ scenePanel.add(tabbedPane);
12571575
12581576 /*
12591577 cTree jTree = new cTree(null);
....@@ -1275,7 +1593,7 @@
12751593 jtp.add(tree);
12761594 */
12771595
1278
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel);
1596
+ bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
12791597 bigPanel.setContinuousLayout(true);
12801598 bigPanel.setOneTouchExpandable(true);
12811599 bigPanel.setDividerLocation(0.8);
....@@ -1287,6 +1605,7 @@
12871605 //bigPanel.setSize(new Dimension(10,10));
12881606 //bigPanel.add(ctrlPanel);
12891607 //bigPanel.add(gridPanel);
1608
+ /**
12901609 bigThree = new JPanel();
12911610 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12921611 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1297,20 +1616,26 @@
12971616 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
12981617 aWindowConstraints.weightx = 0;
12991618 aWindowConstraints.weighty = 1;
1300
- bigThree.add(jtp, aWindowConstraints);
1619
+ bigThree.add(scenePanel, aWindowConstraints);
13011620 aWindowConstraints.weightx = 1;
13021621 aWindowConstraints.gridwidth = 3;
13031622 // aConstraints.gridheight = 3;
13041623 aWindowConstraints.gridx = 1;
13051624 aWindowConstraints.fill = GridBagConstraints.BOTH;
1306
- bigThree.add(cameraPanel, aWindowConstraints);
1625
+ bigThree.add(centralPanel, aWindowConstraints);
13071626 aWindowConstraints.weightx = 0;
13081627 aWindowConstraints.gridx = 4;
13091628 aWindowConstraints.gridwidth = 1;
13101629 // aConstraints.gridheight = 3;
13111630 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13121631 bigThree.add(XYZPanel, aWindowConstraints);
1632
+ /**/
13131633
1634
+ bigThree = new cGridBag();
1635
+ bigThree.addComponent(centralPanel);
1636
+ bigThree.addComponent(scenePanel);
1637
+ //bigThree.addComponent(XYZPanel);
1638
+
13141639 // // SIDE EFFECT!!!
13151640 // aConstraints.gridx = 0;
13161641 // aConstraints.gridy = 0;
....@@ -1318,9 +1643,9 @@
13181643 // aConstraints.gridheight = 1;
13191644
13201645 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1321
- framePanel.setContinuousLayout(true);
1322
- framePanel.setOneTouchExpandable(true);
1323
- framePanel.setDividerLocation(0.8);
1646
+ framePanel.setContinuousLayout(false);
1647
+ framePanel.setOneTouchExpandable(false);
1648
+ //.setDividerLocation(0.8);
13241649 //framePanel.setDividerSize(15);
13251650 //framePanel.setResizeWeight(0.15);
13261651 framePanel.setName("Frame");
....@@ -1331,15 +1656,21 @@
13311656 //worldPane.add(bigPanel);
13321657 //worldPane.add(worldPanel);
13331658 /**/
1334
- frame.getContentPane().add(/*"Center",*/framePanel);
1659
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1660
+ frame.add(/*"Center",*/framePanel);
13351661 //frame.getContentPane().add(/*"Center",*/ worldPane);
13361662
13371663 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13381664
1339
- frame.setSize(1024, 768);
1340
- frame.show();
1341
-
1665
+ frame.setSize(1280, 860);
1666
+
1667
+ cameraView.requestFocusInWindow();
1668
+
13421669 gridPanel.setDividerLocation(1.0);
1670
+
1671
+ frame.validate();
1672
+
1673
+ frame.setVisible(true);
13431674
13441675 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13451676 frame.addWindowListener(new WindowAdapter()
....@@ -1352,6 +1683,10 @@
13521683 });
13531684 }
13541685
1686
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1687
+ {
1688
+ }
1689
+
13551690 JTree GetTree()
13561691 {
13571692 return objEditor.jTree;
....@@ -1363,260 +1698,161 @@
13631698 ctrlPanel.removeAll();
13641699 }
13651700
1366
- void SetupMaterial(JPanel ctrlPanel)
1701
+ void SetupMaterial(cGridBag panel)
13671702 {
1368
- aConstraints.weighty = 0;
1369
- //aConstraints.weightx = 1;
1370
- /*
1703
+ /*
13711704 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13721705 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1373
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1374
- aConstraints.gridx += 1;
13751706 */
13761707
1377
- aConstraints.gridwidth = 1;
1378
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1379
- aConstraints.gridx += 1;
1380
- aConstraints.weighty = 0;
1381
- aConstraints.gridwidth = 1;
1708
+ cGridBag editBar = new cGridBag().setVertical(false);
1709
+
1710
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1711
+ createMaterialButton.setToolTipText("Create material");
13821712
13831713 /*
13841714 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- aConstraints.gridwidth = 1;
13881715 */
13891716
1390
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1391
- aConstraints.gridx += 1;
1717
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1718
+ clearMaterialButton.setToolTipText("Clear material");
1719
+
1720
+ if (Globals.ADVANCED)
1721
+ {
1722
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1723
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1724
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1725
+ }
13921726
1393
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1394
-
1395
- aConstraints.gridx += 1;
1396
-
1397
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1398
-
1399
- aConstraints.gridx += 1;
1400
-
1401
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1402
-
1403
- aConstraints.gridx = 0;
1404
- aConstraints.gridy += 1;
1405
- aConstraints.weighty = 0;
1406
- aConstraints.gridwidth = 1;
1727
+ editBar.preferredHeight = 15;
1728
+
1729
+ panel.add(editBar);
1730
+
14071731 /**/
14081732 //aConstraints.weighty = 0;
14091733 ////aConstraints.weightx = 1;
14101734 //aConstraints.weighty = 1;
14111735 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14121736 //aConstraints.gridx += 1;
1413
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1414
- aConstraints.weighty = 0;
1415
- aConstraints.gridx = 0;
1416
- aConstraints.gridy += 1;
1417
- aConstraints.gridwidth = 1;
1737
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14181738
1419
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1420
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1421
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1422
- aConstraints.gridx += 1;
1423
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1424
- //aConstraints.weightx = 0;
1425
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1426
- aConstraints.gridx = 0;
1427
- aConstraints.gridy += 1;
1428
- aConstraints.gridwidth = 1;
1739
+ cGridBag colorSection = new cGridBag().setVertical(true);
1740
+
1741
+ cGridBag color = new cGridBag();
1742
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1743
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1744
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1745
+ //colorField.preferredWidth = 200;
1746
+ colorSection.add(color);
14291747
1430
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1431
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1432
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1433
- aConstraints.gridx += 1;
1434
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1435
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1436
- aConstraints.gridx = 0;
1437
- aConstraints.gridy += 1;
1438
- aConstraints.gridwidth = 1;
1748
+ cGridBag modulation = new cGridBag();
1749
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1750
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1751
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1752
+ colorSection.add(modulation);
14391753
1440
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1441
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1442
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1443
- aConstraints.gridx += 1;
1444
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1445
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1446
- aConstraints.gridx = 0;
1447
- aConstraints.gridy += 1;
1448
- aConstraints.gridwidth = 1;
1754
+ cGridBag texture = new cGridBag();
1755
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1756
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1757
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1758
+ colorSection.add(texture);
14491759
1450
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1451
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1452
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1453
- aConstraints.gridx += 1;
1454
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1455
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1456
- aConstraints.gridx = 0;
1457
- aConstraints.gridy += 1;
1458
- aConstraints.gridwidth = 1;
1760
+ panel.add(new JSeparator());
1761
+
1762
+ panel.add(colorSection);
1763
+
1764
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1765
+
1766
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1767
+
1768
+ cGridBag diffuse = new cGridBag();
1769
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1770
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1771
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1772
+ diffuseSection.add(diffuse);
14591773
1460
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1461
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1462
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1463
- aConstraints.gridx += 1;
1464
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1465
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1466
- aConstraints.gridx = 0;
1467
- aConstraints.gridy += 1;
1468
- aConstraints.gridwidth = 1;
1774
+ cGridBag diffuseness = new cGridBag();
1775
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1776
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1777
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1778
+ diffuseSection.add(diffuseness);
14691779
1470
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1471
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1472
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1473
- aConstraints.gridx += 1;
1474
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1475
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1476
- aConstraints.gridx = 0;
1477
- aConstraints.gridy += 1;
1478
- aConstraints.gridwidth = 1;
1780
+ cGridBag selfshadow = new cGridBag();
1781
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1782
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1783
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1784
+ diffuseSection.add(selfshadow);
14791785
1480
- //aConstraints.weighty = 1;
1481
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1482
- //aConstraints.gridx += 1;
1483
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1484
- aConstraints.weighty = 0;
1485
- aConstraints.gridx = 0;
1486
- aConstraints.gridy += 1;
1487
- aConstraints.gridwidth = 1;
1786
+ cGridBag sheen = new cGridBag();
1787
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1788
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1789
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1790
+ diffuseSection.add(sheen);
14881791
1489
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1490
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1492
- aConstraints.gridx += 1;
1493
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1494
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1495
- aConstraints.gridx = 0;
1496
- aConstraints.gridy += 1;
1497
- aConstraints.gridwidth = 1;
1792
+ cGridBag subsurface = new cGridBag();
1793
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1794
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1795
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1796
+ diffuseSection.add(subsurface);
14981797
1499
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1500
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1501
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1502
- aConstraints.gridx += 1;
1503
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1504
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1505
- aConstraints.gridx = 0;
1506
- aConstraints.gridy += 1;
1507
- aConstraints.gridwidth = 1;
1798
+ cGridBag shadow = new cGridBag();
1799
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1800
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1801
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1802
+ diffuseSection.add(shadow);
15081803
1509
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1510
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1511
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1512
- aConstraints.gridx += 1;
1513
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1514
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1515
- aConstraints.gridx = 0;
1516
- aConstraints.gridy += 1;
1517
- aConstraints.gridwidth = 1;
1804
+ cGridBag fakedepth = new cGridBag();
1805
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1806
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1807
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1808
+ diffuseSection.add(fakedepth);
15181809
1519
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1520
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1521
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1522
- aConstraints.gridx += 1;
1523
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1524
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1525
- aConstraints.gridx = 0;
1526
- aConstraints.gridy += 1;
1527
- aConstraints.gridwidth = 1;
1810
+ cGridBag shadowbias = new cGridBag();
1811
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1812
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1813
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1814
+ diffuseSection.add(shadowbias);
15281815
1529
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1530
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1531
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1532
- aConstraints.gridx += 1;
1533
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1534
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1535
- aConstraints.gridx = 0;
1536
- aConstraints.gridy += 1;
1537
- aConstraints.gridwidth = 1;
1816
+ panel.add(new JSeparator());
1817
+
1818
+ panel.add(diffuseSection);
1819
+
1820
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1821
+
1822
+ cGridBag specularSection = new cGridBag().setVertical(true);
15381823
1539
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1540
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1541
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1542
- aConstraints.gridx += 1;
1543
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1544
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1545
- aConstraints.gridx = 0;
1546
- aConstraints.gridy += 1;
1547
- aConstraints.gridwidth = 1;
1824
+ cGridBag specular = new cGridBag();
1825
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1826
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1827
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1828
+ specularSection.add(specular);
15481829
1549
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1550
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1551
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1552
- aConstraints.gridx += 1;
1553
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1554
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1555
- aConstraints.gridx = 0;
1556
- aConstraints.gridy += 1;
1557
- aConstraints.gridwidth = 1;
1830
+ cGridBag lightarea = new cGridBag();
1831
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1832
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1833
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1834
+ specularSection.add(lightarea);
15581835
1559
- //aConstraints.weighty = 1;
1560
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1561
- //aConstraints.gridx += 1;
1562
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1563
- aConstraints.weighty = 0;
1564
- aConstraints.gridx = 0;
1565
- aConstraints.gridy += 1;
1566
- aConstraints.gridwidth = 1;
1836
+ cGridBag shininess = new cGridBag();
1837
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1838
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1839
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1840
+ specularSection.add(shininess);
15671841
1568
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1569
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1570
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1571
- aConstraints.gridx += 1;
1572
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1573
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1574
- aConstraints.gridx = 0;
1575
- aConstraints.gridy += 1;
1576
- aConstraints.gridwidth = 1;
1842
+ cGridBag metalness = new cGridBag();
1843
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1844
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1845
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1846
+ specularSection.add(metalness);
15771847
1578
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1579
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1580
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1581
- aConstraints.gridx += 1;
1582
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1583
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1584
- aConstraints.gridx = 0;
1585
- aConstraints.gridy += 1;
1586
- aConstraints.gridwidth = 1;
1848
+ cGridBag velvet = new cGridBag();
1849
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1850
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1851
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1852
+ specularSection.add(velvet);
15871853
1588
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1589
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1590
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1591
- aConstraints.gridx += 1;
1592
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1593
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1594
- aConstraints.gridx = 0;
1595
- aConstraints.gridy += 1;
1596
- aConstraints.gridwidth = 1;
1597
-
1598
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1599
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1600
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1601
- aConstraints.gridx += 1;
1602
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1603
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1604
- aConstraints.gridx = 0;
1605
- aConstraints.gridy += 1;
1606
- aConstraints.gridwidth = 1;
1607
-
1608
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1609
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1610
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1611
- aConstraints.gridx += 1;
1612
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1613
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1614
- aConstraints.gridx = 0;
1615
- aConstraints.gridy += 1;
1616
- aConstraints.gridwidth = 1;
1617
-
1618
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1619
- Return();
1854
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1855
+ //Return();
16201856 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16211857 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16221858 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1627,130 +1863,105 @@
16271863 // aConstraints.gridy += 1;
16281864 // aConstraints.gridwidth = 1;
16291865
1630
- //aConstraints.weighty = 1;
1631
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1632
- //aConstraints.gridx += 1;
1633
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1634
- aConstraints.weighty = 0;
1635
- aConstraints.gridx = 0;
1636
- aConstraints.gridy += 1;
1637
- aConstraints.gridwidth = 1;
1866
+ cGridBag anisoU = new cGridBag();
1867
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1868
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1869
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1870
+ specularSection.add(anisoU);
16381871
1639
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1640
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1641
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1642
- aConstraints.gridx += 1;
1643
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1644
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1645
- aConstraints.gridx = 0;
1646
- aConstraints.gridy += 1;
1647
- aConstraints.gridwidth = 1;
1872
+ cGridBag anisoV = new cGridBag();
1873
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1874
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1875
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1876
+ specularSection.add(anisoV);
16481877
1649
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1650
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1651
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1652
- aConstraints.gridx += 1;
1653
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1654
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1655
- aConstraints.gridx = 0;
1656
- aConstraints.gridy += 1;
1657
- aConstraints.gridwidth = 1;
16581878
1659
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1660
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1661
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1662
- aConstraints.gridx += 1;
1663
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1664
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1665
- aConstraints.gridx = 0;
1666
- aConstraints.gridy += 1;
1667
- aConstraints.gridwidth = 1;
1879
+ panel.add(new JSeparator());
1880
+
1881
+ panel.add(specularSection);
1882
+
1883
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1884
+
1885
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16681886
1669
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1670
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1671
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1672
- aConstraints.gridx += 1;
1673
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1674
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1675
- aConstraints.gridx = 0;
1676
- aConstraints.gridy += 1;
1677
- aConstraints.gridwidth = 1;
1678
- aConstraints.weighty = 0;
1887
+ cGridBag camera = new cGridBag();
1888
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1889
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1890
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1891
+ colorSection.add(camera);
16791892
1680
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1681
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1683
- aConstraints.gridx += 1;
1684
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1685
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1686
- aConstraints.gridx = 0;
1687
- aConstraints.gridy += 1;
1688
- aConstraints.gridwidth = 1;
1893
+ cGridBag ambient = new cGridBag();
1894
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1895
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1896
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1897
+ colorSection.add(ambient);
16891898
1690
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1691
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1692
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1693
- aConstraints.gridx += 1;
1694
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1695
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1696
- aConstraints.gridx = 0;
1697
- aConstraints.gridy += 1;
1698
- aConstraints.gridwidth = 1;
1899
+ cGridBag backlit = new cGridBag();
1900
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1901
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1902
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1903
+ colorSection.add(backlit);
16991904
1700
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1701
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1702
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1703
- aConstraints.gridx += 1;
1704
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1705
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1706
- aConstraints.gridx = 0;
1707
- aConstraints.gridy += 1;
1708
- aConstraints.gridwidth = 1;
1905
+ cGridBag opacity = new cGridBag();
1906
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1907
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1908
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1909
+ colorSection.add(opacity);
17091910
1710
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1711
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1712
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1713
- aConstraints.gridx += 1;
1714
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1715
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1716
- aConstraints.gridx = 0;
1717
- aConstraints.gridy += 1;
1718
- aConstraints.gridwidth = 1;
1911
+ //panel.add(new JSeparator());
1912
+
1913
+ //panel.add(globalSection);
1914
+
1915
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1916
+
1917
+ cGridBag textureSection = new cGridBag().setVertical(true);
17191918
1720
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1721
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1722
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1723
- aConstraints.gridx += 1;
1724
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1725
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1726
- aConstraints.gridx = 0;
1727
- aConstraints.gridy += 1;
1728
- aConstraints.gridwidth = 1;
1919
+ cGridBag bump = new cGridBag();
1920
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1921
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1922
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1923
+ textureSection.add(bump);
17291924
1730
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1731
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1732
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1733
- aConstraints.gridx += 1;
1734
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1735
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1736
- aConstraints.gridx = 0;
1737
- aConstraints.gridy += 1;
1738
- aConstraints.gridwidth = 1;
1925
+ cGridBag noise = new cGridBag();
1926
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1927
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1928
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1929
+ textureSection.add(noise);
17391930
1740
- //aConstraints.weighty = 1;
1741
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1742
- //aConstraints.gridx += 1;
1743
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1744
- aConstraints.weighty = 0;
1931
+ cGridBag power = new cGridBag();
1932
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1933
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1934
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1935
+ textureSection.add(power);
17451936
1746
- aConstraints.gridx = 0;
1747
- aConstraints.gridy = 0;
1748
- aConstraints.gridwidth = 1;
1937
+ cGridBag borderfade = new cGridBag();
1938
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1939
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1940
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1941
+ textureSection.add(borderfade);
1942
+
1943
+ cGridBag fog = new cGridBag();
1944
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1945
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1946
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1947
+ textureSection.add(fog);
1948
+
1949
+ cGridBag opacityPower = new cGridBag();
1950
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1951
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1952
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1953
+ textureSection.add(opacityPower);
1954
+
1955
+ panel.add(new JSeparator());
1956
+
1957
+ panel.add(textureSection);
1958
+
1959
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17491960
17501961 SetMaterial(copy); // .GetMaterial());
17511962
1752
- colorField.addChangeListener(this);
1753
- modulationField.addChangeListener(this);
1963
+ //colorField.addChangeListener(this);
1964
+// modulationField.addChangeListener(this);
17541965 metalnessField.addChangeListener(this);
17551966 diffuseField.addChangeListener(this);
17561967 specularField.addChangeListener(this);
....@@ -1780,12 +1991,15 @@
17801991 opacityPowerField.addChangeListener(this);
17811992 /**/
17821993
1783
- resetSlidersButton.addActionListener(this);
17841994 clearMaterialButton.addActionListener(this);
17851995 createMaterialButton.addActionListener(this);
1786
-
1787
- propagateToggle.addItemListener(this);
1788
- multiplyToggle.addItemListener(this);
1996
+
1997
+ if (Globals.ADVANCED)
1998
+ {
1999
+ resetSlidersButton.addActionListener(this);
2000
+ propagateToggle.addItemListener(this);
2001
+ multiplyToggle.addItemListener(this);
2002
+ }
17892003 }
17902004
17912005 void DropFile(java.io.File[] files, boolean textures)
....@@ -1803,8 +2017,9 @@
18032017 // 3D models
18042018 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18052019 {
1806
- lastConverter = new com.jmex.model.converters.MaxToJme();
1807
- LoadFile(filename, lastConverter);
2020
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2021
+ //LoadFile(filename, lastConverter);
2022
+ LoadObjFile(filename); // New 3ds loader
18082023 continue;
18092024 }
18102025 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1956,7 +2171,7 @@
19562171
19572172 //? flashIt = false;
19582173 CameraPane pane = (CameraPane) cameraView;
1959
- pane.clickStart(location.x, location.y, 0);
2174
+ pane.clickStart(location.x, location.y, 0, 0);
19602175 pane.clickEnd(location.x, location.y, 0, true);
19612176
19622177 if (group.selection.size() == 1)
....@@ -2005,6 +2220,7 @@
20052220 e2.printStackTrace();
20062221 }
20072222 }
2223
+
20082224 LoadJMEThread loadThread;
20092225
20102226 class LoadJMEThread extends Thread
....@@ -2062,6 +2278,7 @@
20622278 //LoadFile0(filename, converter);
20632279 }
20642280 }
2281
+
20652282 LoadOBJThread loadObjThread;
20662283
20672284 class LoadOBJThread extends Thread
....@@ -2140,19 +2357,19 @@
21402357
21412358 void LoadObjFile(String fullname)
21422359 {
2143
- /*
2360
+ System.out.println("Loading " + fullname);
2361
+ /**/
21442362 //lastFilename = fullname;
21452363 if(loadObjThread == null)
21462364 {
2147
- loadObjThread = new LoadOBJThread();
2148
- loadObjThread.start();
2365
+ loadObjThread = new LoadOBJThread();
2366
+ loadObjThread.start();
21492367 }
21502368
21512369 loadObjThread.add(fullname);
2152
- */
2370
+ /**/
21532371
2154
- System.out.println("Loading " + fullname);
2155
- makeSomething(new FileObject(fullname, true), true);
2372
+ //makeSomething(new FileObject(fullname, true), true);
21562373 }
21572374
21582375 void LoadGFDFile(String fullname)
....@@ -2194,6 +2411,8 @@
21942411 {
21952412 Mocap sel = (Mocap) copy.selection.get(0);
21962413
2414
+ sel.SetCurrentBones(sel.frame);
2415
+
21972416 sel.fullname = fullname;
21982417
21992418 if (changename)
....@@ -2245,6 +2464,8 @@
22452464 {
22462465 Mocap sel = (Mocap) select;
22472466
2467
+ sel.SetCurrentBones(sel.frame);
2468
+
22482469 File file = new File(fullname);
22492470
22502471 // Mocap mocap = new Mocap("Mocap" + file.getName());
....@@ -2409,11 +2630,11 @@
24092630
24102631 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24112632 {
2412
- if (GrafreeD.standAlone)
2633
+ if (Grafreed.standAlone)
24132634 {
24142635 /**/
24152636 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2416
- browser.show();
2637
+ browser.setVisible(true);
24172638 String filename = browser.getFile();
24182639 if (filename != null && filename.length() > 0)
24192640 {
....@@ -2524,6 +2745,7 @@
25242745 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25252746 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25262747 }
2748
+
25272749 //cJME.count++;
25282750 //cJME.count %= 12;
25292751 if (gc)
....@@ -2558,6 +2780,7 @@
25582780 }
25592781 if (input == null)
25602782 {
2783
+ new Exception().printStackTrace();
25612784 System.exit(0);
25622785 }
25632786
....@@ -2706,6 +2929,7 @@
27062929 }
27072930 }
27082931 }
2932
+
27092933 cFileSystemPane FSPane;
27102934
27112935 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2759,11 +2983,14 @@
27592983 }
27602984 }
27612985 }
2986
+
27622987 freezematerial = false;
27632988 }
27642989
27652990 void SetMaterial(Object3D object)
27662991 {
2992
+ latestObject = object;
2993
+
27672994 cMaterial mat = object.material;
27682995
27692996 if (mat == null)
....@@ -2772,7 +2999,8 @@
27722999 return;
27733000 }
27743001
2775
- multiplyToggle.setSelected(mat.multiply);
3002
+ if (multiplyToggle != null)
3003
+ multiplyToggle.setSelected(mat.multiply);
27763004
27773005 assert (object.projectedVertices != null);
27783006
....@@ -2874,12 +3102,17 @@
28743102 // }
28753103
28763104 /**/
2877
- if (deselect)
3105
+ if (deselect || child == null)
28783106 {
28793107 //group.deselectAll();
28803108 //freeze = true;
28813109 GetTree().clearSelection();
28823110 //freeze = false;
3111
+
3112
+ if (child == null)
3113
+ {
3114
+ return;
3115
+ }
28833116 }
28843117
28853118 //group.addSelectee(child);
....@@ -2948,31 +3181,48 @@
29483181 cameraView.ToggleDL();
29493182 cameraView.repaint();
29503183 return;
2951
- } else if (event.getSource() == toggleTextureItem)
3184
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29523185 {
29533186 cameraView.ToggleTexture();
29543187 // june 2013 copy.HardTouch();
29553188 cameraView.repaint();
29563189 return;
2957
- } else if (event.getSource() == toggleFullItem)
3190
+ } else if (event.getSource() == toggleTimelineItem)
29583191 {
2959
- if (CameraPane.FULLSCREEN)
3192
+ timeline ^= true;
3193
+
3194
+ if (timeline)
29603195 {
2961
- frame.getContentPane().remove(/*"Center",*/bigThree);
2962
- framePanel.add(bigThree);
2963
- frame.getContentPane().add(/*"Center",*/framePanel);
2964
- } else
2965
- {
2966
- frame.getContentPane().remove(/*"Center",*/framePanel);
2967
- frame.getContentPane().add(/*"Center",*/bigThree);
3196
+ centralPanel.remove(cameraView);
3197
+ cameraPanel.add(cameraView);
3198
+ centralPanel.add(cameraPanel);
3199
+ frame.setJMenuBar(timelineMenubar);
3200
+ wasFullScreen = CameraPane.FULLSCREEN;
3201
+ if (!CameraPane.FULLSCREEN)
3202
+ ToggleFullScreen();
3203
+ toggleFullScreenItem.setEnabled(false);
29683204 }
3205
+ else
3206
+ {
3207
+ centralPanel.remove(cameraPanel);
3208
+ centralPanel.add(cameraView);
3209
+ frame.setJMenuBar(null);
3210
+ if (!wasFullScreen)
3211
+ ToggleFullScreen();
3212
+ toggleFullScreenItem.setEnabled(true);
3213
+ }
3214
+
29693215 frame.validate();
2970
- cameraView.ToggleFullScreen();
3216
+ return;
3217
+ } else if (event.getSource() == toggleFullScreenItem)
3218
+ {
3219
+ ToggleFullScreen();
3220
+ frame.validate();
29713221
29723222 return;
2973
- } else if (event.getSource() == toggleRandomItem)
3223
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
29743224 {
2975
- cameraView.ToggleRandom();
3225
+ cameraView.ToggleSwitch();
29763226 cameraView.repaint();
29773227 return;
29783228 } else if (event.getSource() == toggleHandleItem)
....@@ -3001,6 +3251,10 @@
30013251 {
30023252 copy.live ^= true;
30033253 return;
3254
+ } else if (event.getSource() == selectableCB)
3255
+ {
3256
+ copy.dontselect ^= true;
3257
+ return;
30043258 } else if (event.getSource() == hideCB)
30053259 {
30063260 copy.hide ^= true;
....@@ -3015,6 +3269,7 @@
30153269 if (event.getSource() == randomCB)
30163270 {
30173271 copy.random ^= true;
3272
+ objEditor.refreshContents();
30183273 return;
30193274 }
30203275 if (event.getSource() == speedupCB)
....@@ -3038,8 +3293,9 @@
30383293
30393294 public void actionPerformed(ActionEvent event)
30403295 {
3296
+ Object source = event.getSource();
30413297 // SCRIPT DIALOG
3042
- if (event.getSource() == okbutton)
3298
+ if (source == okbutton)
30433299 {
30443300 textpanel.setVisible(false);
30453301 textpanel.remove(textarea);
....@@ -3051,7 +3307,7 @@
30513307 textarea = null;
30523308 textpanel = null;
30533309 }
3054
- if (event.getSource() == cancelbutton)
3310
+ if (source == cancelbutton)
30553311 {
30563312 textpanel.setVisible(false);
30573313 textpanel.remove(textarea);
....@@ -3063,49 +3319,50 @@
30633319 //applySelf();
30643320 //client.refreshEditWindow();
30653321 //refreshContents();
3066
- if (event.getSource() == nameField)
3322
+ if (source == nameField)
30673323 {
30683324 //System.out.println("ObjEditor " + event);
30693325 applySelf0(true);
30703326 //parent.applySelf();
30713327 objEditor.refreshContents();
3072
- } else if (event.getSource() == resetButton)
3328
+ } else if (source == resetButton)
30733329 {
30743330 CameraPane.fullreset = true;
30753331 copy.Reset(); // ResetMeshes();
30763332 copy.Touch();
30773333 objEditor.refreshContents();
3078
- } else if (event.getSource() == stepItem)
3334
+ } else if (source == stepItem)
30793335 {
3080
- cameraView.ONESTEP = true;
3336
+ //cameraView.ONESTEP = true;
3337
+ Globals.ONESTEP = true;
30813338 cameraView.repaint();
30823339 return;
3083
- } else if (event.getSource() == stepButton)
3340
+ } else if (source == stepButton)
30843341 {
30853342 copy.Step();
30863343 copy.Touch();
30873344 objEditor.refreshContents();
3088
- } else if (event.getSource() == slowerButton)
3345
+ } else if (source == slowerButton)
30893346 {
30903347 copy.Slower();
30913348 copy.Touch();
30923349 objEditor.refreshContents();
3093
- } else if (event.getSource() == fasterButton)
3350
+ } else if (source == fasterButton)
30943351 {
30953352 copy.Faster();
30963353 copy.Touch();
30973354 objEditor.refreshContents();
3098
- } else if (event.getSource() == remarkButton)
3355
+ } else if (source == remarkButton)
30993356 {
31003357 copy.Remark();
31013358 copy.Touch();
31023359 objEditor.refreshContents();
3103
- } else if (event.getSource() == stepAllButton)
3360
+ } else if (source == stepAllButton)
31043361 {
31053362 copy.StepAll();
31063363 copy.Touch();
31073364 objEditor.refreshContents();
3108
- } else if (event.getSource() == resetAllButton)
3365
+ } else if (source == resetAllButton)
31093366 {
31103367 //CameraPane.fullreset = true;
31113368 copy.ResetAll(); // ResetMeshes();
....@@ -3138,53 +3395,79 @@
31383395 // Close();
31393396 // }
31403397 // else
3141
- if (event.getSource() == resetSlidersButton)
3398
+ if (source == resetSlidersButton)
31423399 {
31433400 ResetSliders();
3144
- } else if (event.getSource() == clearMaterialButton)
3401
+ } else if (source == clearMaterialButton)
31453402 {
31463403 ClearMaterial();
3147
- } else if (event.getSource() == createMaterialButton)
3404
+ } else if (source == createMaterialButton)
31483405 {
31493406 CreateMaterial();
3150
- } else if (event.getSource() == clearPanelButton)
3407
+ } else if (source == clearPanelButton)
31513408 {
31523409 copy.ClearUI();
31533410 refreshContents(true);
3154
- } /*
3155
- }
3156
-
3157
- public boolean action(Event event, Object arg)
3158
- {
3159
- */ else if (event.getSource() == closeItem)
3411
+ } else if (source == importGFDItem)
3412
+ {
3413
+ ImportGFD();
3414
+ } else
3415
+ if (source == importVRMLX3DItem)
3416
+ {
3417
+ ImportVRMLX3D();
3418
+ } else
3419
+ if (source == import3DSItem)
3420
+ {
3421
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3422
+ } else
3423
+ if (source == importOBJItem)
3424
+ {
3425
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3426
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3427
+ browser.setVisible(true);
3428
+ String filename = browser.getFile();
3429
+ if (filename != null && filename.length() > 0)
3430
+ {
3431
+ String fullname = browser.getDirectory() + filename;
3432
+ makeSomething(ReadOBJ(fullname), true);
3433
+ }
3434
+ } else
3435
+ if (source == closeItem)
31603436 {
31613437 Close();
31623438 //return true;
3163
- } else if (event.getSource() == loadItem)
3439
+ } else if (source == openItem)
31643440 {
3165
- load();
3441
+ Open();
31663442 //return true;
3167
- } else if (event.getSource() == saveItem)
3443
+ } else if (source == newItem)
3444
+ {
3445
+ New();
3446
+ } else if (source == saveItem)
31683447 {
31693448 save();
31703449 //return true;
3171
- } else if (event.getSource() == saveAsItem)
3450
+ } else if (source == saveAsItem)
31723451 {
31733452 saveAs();
31743453 //return true;
3175
- } else if (event.getSource() == reexportItem)
3454
+ } else if (source == reexportItem)
31763455 {
31773456 reexport();
31783457 //return true;
3179
- } else if (event.getSource() == exportAsItem)
3458
+ } else if (source == exportAsItem)
31803459 {
31813460 export();
31823461 //return true;
3183
- } else if (event.getSource() == povItem)
3462
+ } else if (source == povItem)
31843463 {
31853464 generatePOV();
31863465 //return true;
3187
- } else if (event.getSource() == zBufferItem)
3466
+ } else if (event.getSource() == archiveItem)
3467
+ {
3468
+ cTools.Archive(frame);
3469
+ return;
3470
+ } else if (source == zBufferItem)
31883471 {
31893472 try
31903473 {
....@@ -3206,21 +3489,8 @@
32063489 cameraView.repaint();
32073490 //return true;
32083491 }
3209
- */ else if (event.getSource() == editCameraItem)
3210
- {
3211
- cameraView.ProtectCamera();
3212
- cameraView.repaint();
3213
- return;
3214
- } else if (event.getSource() == revertCameraItem)
3215
- {
3216
- cameraView.RevertCamera();
3217
- cameraView.repaint();
3218
- return;
3219
- } else if (event.getSource() == textureButton)
3220
- {
3221
- return; // true;
3222
- } else // combos...
3223
- if (event.getSource() == texresMenu)
3492
+ */ else // combos...
3493
+ if (source == texresMenu)
32243494 {
32253495 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32263496 copy.texres = texresMenu.getSelectedIndex();
....@@ -3232,27 +3502,424 @@
32323502 }
32333503 }
32343504
3235
- void ToggleAnimation()
3505
+ void New()
32363506 {
3237
- if (!CameraPane.ANIMATION)
3507
+ while (copy.Size() > 1)
32383508 {
3239
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3509
+ copy.remove(1);
3510
+ }
3511
+
3512
+ ResetModel();
3513
+ objEditor.refreshContents();
3514
+ }
3515
+
3516
+ static public byte[] Compress(Object3D o)
3517
+ {
3518
+ try
3519
+ {
3520
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3521
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3522
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
3523
+
3524
+ Object3D parent = o.parent;
3525
+ o.parent = null;
3526
+
3527
+ out.writeObject(o);
3528
+
3529
+ o.parent = parent;
3530
+
3531
+ out.flush();
3532
+
3533
+ baos //zstream
3534
+ .close();
3535
+ out.close();
3536
+
3537
+ byte[] bytes = baos.toByteArray();
3538
+
3539
+ System.out.println("save #bytes = " + bytes.length);
3540
+ return bytes;
3541
+ } catch (Exception e)
3542
+ {
3543
+ System.err.println(e);
3544
+ return null;
3545
+ }
3546
+ }
3547
+
3548
+ static public Object Uncompress(byte[] bytes)
3549
+ {
3550
+ System.out.println("restore #bytes = " + bytes.length);
3551
+ try
3552
+ {
3553
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3554
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3555
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
3556
+ Object obj = in.readObject();
3557
+
3558
+ bais //istream
3559
+ .close();
3560
+ in.close();
3561
+
3562
+ return obj;
3563
+ } catch (Exception e)
3564
+ {
3565
+ System.err.println(e);
3566
+ return null;
3567
+ }
3568
+ }
3569
+
3570
+ static public Object clone(Object o)
3571
+ {
3572
+ try
3573
+ {
3574
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3575
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3576
+
3577
+ out.writeObject(o);
3578
+
3579
+ out.flush();
3580
+ out.close();
3581
+
3582
+ byte[] bytes = baos.toByteArray();
3583
+
3584
+ System.out.println("clone = " + bytes.length);
3585
+
3586
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3587
+ ObjectInputStream in = new ObjectInputStream(bais);
3588
+ Object obj = in.readObject();
3589
+ in.close();
3590
+
3591
+ return obj;
3592
+ } catch (Exception e)
3593
+ {
3594
+ System.err.println(e);
3595
+ return null;
3596
+ }
3597
+ }
3598
+
3599
+ cRadio GetCurrentTab()
3600
+ {
3601
+ cRadio ab;
3602
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3603
+ {
3604
+ ab = (cRadio)e.nextElement();
3605
+ if(ab.GetObject() == copy)
3606
+ {
3607
+ return ab;
3608
+ }
3609
+ }
3610
+
3611
+ return null;
3612
+ }
3613
+
3614
+
3615
+ public void Save()
3616
+ {
3617
+ //Save(true);
3618
+ Replace();
3619
+ }
3620
+
3621
+ private boolean Equal(byte[] compress, byte[] name)
3622
+ {
3623
+ if (compress.length != name.length)
3624
+ {
3625
+ return false;
3626
+ }
3627
+
3628
+ for (int i=compress.length; --i>=0;)
3629
+ {
3630
+ if (compress[i] != name[i])
3631
+ return false;
3632
+ }
3633
+
3634
+ return true;
3635
+ }
3636
+
3637
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3638
+
3639
+ public boolean Save(boolean user)
3640
+ {
3641
+ System.err.println("Save");
3642
+
3643
+ cRadio tab = GetCurrentTab();
3644
+
3645
+ byte[] compress = CompressCopy();
3646
+
3647
+ boolean thesame = false;
3648
+
3649
+ // Quick heuristic using length. Works only when stream is compressed.
3650
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3651
+ {
3652
+ thesame = true;
3653
+ }
3654
+
3655
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3656
+ if (!thesame)
3657
+ {
3658
+ //tab.user[tab.versionindex] = user;
3659
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3660
+
3661
+ copy.versions[++copy.versionindex] = compress;
3662
+
3663
+ // if (increment)
3664
+ // tab.versionindex++;
3665
+ }
3666
+
3667
+ //copy.RestoreBigData(versiontable);
3668
+
3669
+ //assert(hashtable.isEmpty());
3670
+
3671
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3672
+ {
3673
+ //tab.user[i] = false;
3674
+ copy.versions[i] = null;
3675
+ }
3676
+
3677
+ SetUndoStates();
3678
+
3679
+ // test save
3680
+ if (false)
3681
+ {
3682
+ try
3683
+ {
3684
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
3685
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3686
+
3687
+ p.writeObject(copy);
3688
+
3689
+ p.flush();
3690
+
3691
+ ostream.close();
3692
+ } catch (Exception e)
3693
+ {
3694
+ e.printStackTrace();
3695
+ }
3696
+ }
3697
+
3698
+ return !thesame;
3699
+ }
3700
+
3701
+ void CopyChanged(Object3D obj)
3702
+ {
3703
+ SetUndoStates();
3704
+
3705
+ boolean temp = CameraPane.SWITCH;
3706
+ CameraPane.SWITCH = false;
3707
+
3708
+ copy.ExtractBigData(versiontable);
3709
+
3710
+ copy.clear();
3711
+
3712
+ for (int i=0; i<obj.Size(); i++)
3713
+ {
3714
+ copy.add(obj.get(i));
3715
+ }
3716
+
3717
+ copy.RestoreBigData(versiontable);
3718
+
3719
+ CameraPane.SWITCH = temp;
3720
+
3721
+ //assert(hashtable.isEmpty());
3722
+
3723
+ copy.Touch();
3724
+
3725
+ ResetModel();
3726
+ copy.HardTouch(); // recompile?
3727
+
3728
+ cRadio ab;
3729
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3730
+ {
3731
+ ab = (cRadio)e.nextElement();
3732
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3733
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3734
+ if (test != null)
3735
+ {
3736
+ test.editWindow = ab.object.editWindow;
3737
+ ab.object = test;
3738
+ }
3739
+ }
3740
+
3741
+ refreshContents();
3742
+ }
3743
+
3744
+ cButton undoButton;
3745
+ cButton restoreButton;
3746
+ cButton replaceButton;
3747
+ cButton redoButton;
3748
+
3749
+ boolean muteSlider;
3750
+
3751
+ int VersionCount()
3752
+ {
3753
+ int count = 0;
3754
+
3755
+ for (int i = copy.versions.length; --i >= 0;)
3756
+ {
3757
+ if (copy.versions[i] != null)
3758
+ count++;
3759
+ }
3760
+
3761
+ return count;
3762
+ }
3763
+
3764
+ void SetUndoStates()
3765
+ {
3766
+ cRadio tab = GetCurrentTab();
3767
+
3768
+ restoreButton.setEnabled(copy.versionindex != -1);
3769
+ replaceButton.setEnabled(copy.versionindex != -1);
3770
+
3771
+ undoButton.setEnabled(copy.versionindex > 0);
3772
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3773
+
3774
+ muteSlider = true;
3775
+ versionSlider.setMaximum(VersionCount() - 1);
3776
+ versionSlider.setInteger(copy.versionindex);
3777
+ muteSlider = false;
3778
+ }
3779
+
3780
+ public boolean Undo()
3781
+ {
3782
+ // Option?
3783
+ Replace();
3784
+
3785
+ System.err.println("Undo");
3786
+
3787
+ cRadio tab = GetCurrentTab();
3788
+
3789
+ if (copy.versionindex == 0)
3790
+ {
3791
+ java.awt.Toolkit.getDefaultToolkit().beep();
3792
+ return false;
3793
+ }
3794
+
3795
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3796
+// {
3797
+// if (Save(false))
3798
+// tab.versionindex -= 1;
3799
+// else
3800
+// {
3801
+// if (tab.versionindex <= 0)
3802
+// return false;
3803
+// else
3804
+// tab.versionindex -= 1;
3805
+// }
3806
+// }
3807
+
3808
+ copy.versionindex -= 1;
3809
+
3810
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3811
+
3812
+ return true;
3813
+ }
3814
+
3815
+ public boolean Restore()
3816
+ {
3817
+ System.err.println("Restore");
3818
+
3819
+ cRadio tab = GetCurrentTab();
3820
+
3821
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3822
+ {
3823
+ java.awt.Toolkit.getDefaultToolkit().beep();
3824
+ return false;
3825
+ }
3826
+
3827
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3828
+
3829
+ return true;
3830
+ }
3831
+
3832
+ public boolean Replace()
3833
+ {
3834
+ System.err.println("Replace");
3835
+
3836
+ cRadio tab = GetCurrentTab();
3837
+
3838
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3839
+ {
3840
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3841
+ return false;
3842
+ }
3843
+
3844
+ copy.versions[copy.versionindex] = CompressCopy();
3845
+
3846
+ return true;
3847
+ }
3848
+
3849
+ public void Redo()
3850
+ {
3851
+ // Option?
3852
+ Replace();
3853
+
3854
+ cRadio tab = GetCurrentTab();
3855
+
3856
+ if (copy.versions[copy.versionindex + 1] == null)
3857
+ {
3858
+ java.awt.Toolkit.getDefaultToolkit().beep();
3859
+ return;
3860
+ }
3861
+
3862
+ copy.versionindex += 1;
3863
+
3864
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3865
+
3866
+ //if (!tab.user[tab.versionindex])
3867
+ // tab.graphs[tab.versionindex] = null;
3868
+ }
3869
+
3870
+ void ImportGFD()
3871
+ {
3872
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32403873 browser.show();
32413874 String filename = browser.getFile();
32423875 if (filename != null && filename.length() > 0)
32433876 {
3244
- CameraPane.filename = browser.getDirectory() + filename;
3877
+ String fullname = browser.getDirectory() + filename;
3878
+
3879
+ //Object3D readobj =
3880
+ objEditor.ReadGFD(fullname, objEditor);
3881
+ //makeSomething(readobj);
3882
+ }
3883
+ }
3884
+
3885
+ void ImportVRMLX3D()
3886
+ {
3887
+ if (Grafreed.standAlone)
3888
+ {
3889
+ /**/
3890
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3891
+ browser.show();
3892
+ String filename = browser.getFile();
3893
+ if (filename != null && filename.length() > 0)
3894
+ {
3895
+ String fullname = browser.getDirectory() + filename;
3896
+ LoadVRMLX3D(fullname);
3897
+ }
3898
+ /**/
3899
+ }
3900
+ }
3901
+
3902
+ void ToggleAnimation()
3903
+ {
3904
+ if (!Globals.ANIMATION)
3905
+ {
3906
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3907
+ browser.setVisible(true);
3908
+ String filename = browser.getFile();
3909
+ if (filename != null && filename.length() > 0)
3910
+ {
3911
+ Globals.filename = browser.getDirectory() + filename;
32453912 //CameraPane.framecount = 0;
3246
- CameraPane.imagecount = 0;
3913
+ Globals.imagecount = 0;
32473914
3248
- CameraPane.ANIMATION ^= true;
3915
+ Globals.ANIMATION ^= true;
32493916
3250
- GrafreeD.wav.cursor = 0;
3251
- GrafreeD.wav.loop = 0;
3917
+ Grafreed.wav.cursor = 0;
3918
+ Grafreed.wav.loop = 0;
32523919 }
32533920 } else
32543921 {
3255
- CameraPane.ANIMATION ^= true;
3922
+ Globals.ANIMATION ^= true;
32563923 }
32573924 }
32583925
....@@ -3298,7 +3965,7 @@
32983965 void CreateMaterial()
32993966 {
33003967 //copy.ClearMaterial(); // PATCH
3301
- copy.CreateMaterialS(multiplyToggle.isSelected());
3968
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33023969 if (copy.selection.size() > 0)
33033970 //SetMaterial(copy);
33043971 {
....@@ -3349,7 +4016,7 @@
33494016 assert false;
33504017 }
33514018
3352
- void EditSelection()
4019
+ void EditSelection(boolean newWindow)
33534020 {
33544021 }
33554022
....@@ -3357,11 +4024,11 @@
33574024 {
33584025 copy.ResetBlockLoop(); // temporary problem
33594026
3360
- boolean random = CameraPane.RANDOM;
3361
- CameraPane.RANDOM = false; // parse everything
4027
+ boolean random = CameraPane.SWITCH;
4028
+ CameraPane.SWITCH = false; // parse everything
33624029 copy.ResetDisplayList();
33634030 copy.HardTouch();
3364
- CameraPane.RANDOM = random;
4031
+ CameraPane.SWITCH = random;
33654032 }
33664033
33674034 // public void applySelf()
....@@ -3431,10 +4098,40 @@
34314098 current.fakedepth = (float) fakedepthField.getFloat();
34324099 current.shadowbias = (float) shadowbiasField.getFloat();
34334100
3434
- if (!NumberSlider.frozen)
4101
+ if (!cNumberSlider.frozen)
34354102 {
34364103 //System.out.println("Propagate = " + propagate);
34374104 copy.UpdateMaterial(anchor, current, propagate);
4105
+
4106
+ if (copy.material != null)
4107
+ {
4108
+ cMaterial mat = copy.material;
4109
+
4110
+ colorField.SetToolTipValue((mat.color));
4111
+ modulationField.SetToolTipValue((mat.modulation));
4112
+ metalnessField.SetToolTipValue((mat.metalness));
4113
+ diffuseField.SetToolTipValue((mat.diffuse));
4114
+ specularField.SetToolTipValue((mat.specular));
4115
+ shininessField.SetToolTipValue((mat.shininess));
4116
+ shiftField.SetToolTipValue((mat.shift));
4117
+ ambientField.SetToolTipValue((mat.ambient));
4118
+ lightareaField.SetToolTipValue((mat.lightarea));
4119
+ diffusenessField.SetToolTipValue((mat.factor));
4120
+ velvetField.SetToolTipValue((mat.velvet));
4121
+ sheenField.SetToolTipValue((mat.sheen));
4122
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4123
+ backlitField.SetToolTipValue((mat.bump));
4124
+ anisoField.SetToolTipValue((mat.aniso));
4125
+ anisoVField.SetToolTipValue((mat.anisoV));
4126
+ cameraField.SetToolTipValue((mat.cameralight));
4127
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4128
+ shadowField.SetToolTipValue((mat.shadow));
4129
+ textureField.SetToolTipValue((mat.texture));
4130
+ opacityField.SetToolTipValue((mat.opacity));
4131
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4132
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4133
+ }
4134
+
34384135 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34394136 {
34404137 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3463,9 +4160,25 @@
34634160 //copy.Touch();
34644161 }
34654162
4163
+ cNumberSlider versionSlider;
4164
+
34664165 public void stateChanged(ChangeEvent e)
34674166 {
34684167 // assert(false);
4168
+ if (e.getSource() == versionSlider)
4169
+ {
4170
+ if (muteSlider)
4171
+ return;
4172
+
4173
+ int version = versionSlider.getInteger();
4174
+
4175
+ if (copy.versions[version] != null)
4176
+ {
4177
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4178
+ }
4179
+
4180
+ return;
4181
+ }
34694182
34704183 if (freezematerial)
34714184 {
....@@ -3479,6 +4192,7 @@
34794192 || e.getSource() == apertureField
34804193 || e.getSource() == shadowblurField)
34814194 {
4195
+ new Exception().printStackTrace();
34824196 System.exit(0);
34834197 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34844198 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3505,7 +4219,13 @@
35054219 //System.out.println("PARENT = " + parent);
35064220 //if (parent != null)
35074221 // parent.applySelf();
3508
- refreshContents();
4222
+ if (e.getSource() == normalpushField)
4223
+ {
4224
+ objEditor.refreshContents();
4225
+ //Refresh();
4226
+ }
4227
+ else
4228
+ refreshContents();
35094229 // ??? client.refreshEditWindow();
35104230 }
35114231 //else
....@@ -3517,7 +4237,7 @@
35174237 //group.name = nameField.getText();
35184238 //objEditor.applySelf();
35194239
3520
- assert (objEditor == this);
4240
+ // OCT2018: assert (objEditor == this);
35214241 if (copy.selection == null || copy.selection.size() == 0)
35224242 //super.applySelf()
35234243 ; else
....@@ -3541,12 +4261,18 @@
35414261 objEditor.copy = keep;
35424262 }
35434263 }
4264
+
4265
+ if (normalpushField != null)
4266
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35444267 }
35454268
35464269 void SnapObject()
35474270 {
3548
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3549
- SnapObject(obj);
4271
+ if (copy.selection.size() > 0)
4272
+ {
4273
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
4274
+ SnapObject(obj);
4275
+ }
35504276 }
35514277
35524278 void SnapObject(Object3D obj)
....@@ -3660,7 +4386,7 @@
36604386
36614387 if (obj.parent != null)
36624388 {
3663
- obj.parent.TransformToWorld(interest);
4389
+// obj.parent.TransformToWorld(interest);
36644390 }
36654391
36664392 if (!CameraPane.TRACK)
....@@ -3792,7 +4518,7 @@
37924518
37934519 radioPanel.revalidate();
37944520 radioPanel.repaint();
3795
- ctrlPanel.revalidate(); // ? new
4521
+ ctrlPanel.validate(); // ? new
37964522 ctrlPanel.repaint();
37974523 }
37984524 }
....@@ -3801,6 +4527,8 @@
38014527
38024528 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38034529 {
4530
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4531
+ Save();
38044532 //Tween.set(thing, 0).target(1).start(tweenManager);
38054533 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38064534 // if (thing instanceof GenericJointDemo)
....@@ -3887,6 +4615,12 @@
38874615 {
38884616 ResetModel();
38894617 Select(thing.GetTreePath(), true, false); // unselect... false);
4618
+
4619
+ if (thing.Size() == 0)
4620
+ {
4621
+ //EditSelection(false);
4622
+ }
4623
+
38904624 refreshContents();
38914625 }
38924626
....@@ -4004,6 +4738,7 @@
40044738 }
40054739 }
40064740 }
4741
+
40074742 LoadGFDThread loadGFDThread;
40084743
40094744 void ReadGFD(String fullname, iCallBack cb)
....@@ -4023,8 +4758,10 @@
40234758
40244759 try
40254760 {
4761
+ // Try compressed version first.
40264762 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4027
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4763
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4764
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40284765
40294766 readobj = (Object3D) p.readObject();
40304767 istream.close();
....@@ -4032,7 +4769,22 @@
40324769 readobj.ResetDisplayList();
40334770 } catch (Exception e)
40344771 {
4035
- e.printStackTrace();
4772
+ if (!e.toString().contains("GZIP"))
4773
+ e.printStackTrace();
4774
+
4775
+ try
4776
+ {
4777
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4778
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4779
+
4780
+ readobj = (Object3D) p.readObject();
4781
+ istream.close();
4782
+
4783
+ readobj.ResetDisplayList();
4784
+ } catch (Exception e2)
4785
+ {
4786
+ e2.printStackTrace();
4787
+ }
40364788 }
40374789 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40384790 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4078,6 +4830,12 @@
40784830
40794831 void LoadIt(Object obj)
40804832 {
4833
+ if (obj == null)
4834
+ {
4835
+ // Invalid file
4836
+ return;
4837
+ }
4838
+
40814839 System.out.println("Loaded " + obj);
40824840 //new Exception().printStackTrace();
40834841 Object3D readobj = (Object3D) obj;
....@@ -4087,6 +4845,8 @@
40874845
40884846 if (readobj != null)
40894847 {
4848
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4849
+ // Save();
40904850 try
40914851 {
40924852 //readobj.deepCopySelf(copy);
....@@ -4131,6 +4891,7 @@
41314891 }
41324892 } catch (ClassCastException e)
41334893 {
4894
+ e.printStackTrace();
41344895 assert (false);
41354896 Composite c = (Composite) copy;
41364897 c.children.clear();
....@@ -4141,15 +4902,26 @@
41414902 c.addChild(csg);
41424903 }
41434904
4905
+ copy.versions = readobj.versions;
4906
+ copy.versionindex = readobj.versionindex;
4907
+
4908
+ if (copy.versions == null)
4909
+ {
4910
+ copy.versions = new byte[100][];
4911
+ copy.versionindex = -1;
4912
+ }
4913
+
4914
+ //? SetUndoStates();
4915
+
41444916 ResetModel();
41454917 copy.HardTouch(); // recompile?
41464918 refreshContents();
41474919 }
41484920 }
41494921
4150
- void load() // throws ClassNotFoundException
4922
+ void Open() // throws ClassNotFoundException
41514923 {
4152
- if (GrafreeD.standAlone)
4924
+ if (Grafreed.standAlone)
41534925 {
41544926 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41554927 browser.show();
....@@ -4236,11 +5008,13 @@
42365008 try
42375009 {
42385010 FileOutputStream ostream = new FileOutputStream(lastname);
4239
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5011
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5012
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42405013
42415014 p.writeObject(copy);
42425015 p.flush();
42435016
5017
+ zstream.close();
42445018 ostream.close();
42455019
42465020 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4248,19 +5022,23 @@
42485022 //ps.print(buffer.toString());
42495023 } catch (IOException e)
42505024 {
5025
+ e.printStackTrace();
42515026 }
42525027 }
5028
+
42535029 String lastname;
42545030
42555031 void saveAs()
42565032 {
4257
- if (GrafreeD.standAlone)
5033
+ if (Grafreed.standAlone)
42585034 {
42595035 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42605036 browser.setVisible(true);
42615037 String filename = browser.getFile();
42625038 if (filename != null && filename.length() > 0)
42635039 {
5040
+ if (!filename.endsWith(".gfd"))
5041
+ filename += ".gfd";
42645042 lastname = browser.getDirectory() + filename;
42655043 save();
42665044 }
....@@ -4359,13 +5137,13 @@
43595137 try
43605138 {
43615139 FileOutputStream ostream = new FileOutputStream(filename);
4362
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4363
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5140
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5141
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43645142
43655143 Object3D objectparent = obj.parent;
43665144 obj.parent = null;
43675145
4368
- Object3D object = (Object3D) GrafreeD.clone(obj);
5146
+ Object3D object = (Object3D) Grafreed.clone(obj);
43695147
43705148 obj.parent = objectparent;
43715149
....@@ -4377,8 +5155,8 @@
43775155 p.writeObject(object);
43785156 p.flush();
43795157
5158
+ zstream.close();
43805159 ostream.close();
4381
- // zstream.close();
43825160
43835161 // group.selection.get(0).parent = parent;
43845162 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4399,7 +5177,7 @@
43995177 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44005178 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44015179 copy.generatePOV(buffer);
4402
- if (GrafreeD.standAlone)
5180
+ if (Grafreed.standAlone)
44035181 {
44045182 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44055183 browser.show();
....@@ -4425,53 +5203,70 @@
44255203 Object3D client;
44265204 Object3D copy;
44275205 MenuBar menuBar;
4428
- Menu windowMenu;
4429
- MenuItem loadItem;
5206
+ Menu fileMenu;
5207
+ MenuItem newItem;
5208
+ MenuItem openItem;
44305209 MenuItem saveItem;
44315210 MenuItem saveAsItem;
44325211 MenuItem exportAsItem;
44335212 MenuItem reexportItem;
44345213 MenuItem povItem;
44355214 MenuItem closeItem;
4436
- Menu cameraMenu;
5215
+
44375216 CheckboxMenuItem zBufferItem;
44385217 //MenuItem normalLensItem;
4439
- MenuItem editCameraItem;
4440
- MenuItem revertCameraItem;
4441
- CheckboxMenuItem toggleLiveItem;
44425218 MenuItem stepItem;
4443
- CheckboxMenuItem toggleFullItem;
5219
+ CheckboxMenuItem toggleLiveItem;
5220
+ CheckboxMenuItem toggleFullScreenItem;
5221
+ CheckboxMenuItem toggleTimelineItem;
44445222 CheckboxMenuItem toggleRenderItem;
44455223 CheckboxMenuItem toggleDebugItem;
44465224 CheckboxMenuItem toggleFrustumItem;
44475225 CheckboxMenuItem toggleFootContactItem;
44485226 CheckboxMenuItem toggleDLItem;
44495227 CheckboxMenuItem toggleTextureItem;
4450
- CheckboxMenuItem toggleRandomItem;
5228
+ CheckboxMenuItem toggleSwitchItem;
44515229 CheckboxMenuItem toggleRootItem;
44525230 CheckboxMenuItem animationItem;
5231
+ MenuItem archiveItem;
44535232 CheckboxMenuItem toggleHandleItem;
44545233 CheckboxMenuItem togglePaintItem;
44555234 JSplitPane mainPanel;
44565235 JScrollPane scrollpane;
5236
+
44575237 JPanel toolbarPanel;
4458
- JPanel treePanel;
5238
+
5239
+ cGridBag treePanel;
5240
+
44595241 JPanel radioPanel;
44605242 ButtonGroup buttonGroup;
4461
- JPanel ctrlPanel;
4462
- JPanel materialPanel;
5243
+
5244
+ cGridBag toolboxPanel;
5245
+ cGridBag materialPanel;
5246
+ cGridBag ctrlPanel;
5247
+
44635248 JScrollPane infoPanel;
4464
- JPanel optionsPanel;
5249
+
5250
+ cGridBag optionsPanel;
5251
+
44655252 JTabbedPane objectPanel;
4466
- JPanel XYZPanel;
5253
+ boolean materialFlushed;
5254
+ Object3D latestObject;
5255
+
5256
+ cGridBag XYZPanel;
5257
+
44675258 JSplitPane gridPanel;
44685259 JSplitPane bigPanel;
4469
- JPanel bigThree;
4470
- JTabbedPane jtp;
4471
- JPanel cameraPanel;
5260
+
5261
+ cGridBag bigThree;
5262
+ cGridBag scenePanel;
5263
+ cGridBag centralPanel;
5264
+ JSplitPane cameraPanel;
5265
+ JPanel timelinePanel;
5266
+ JMenuBar timelineMenubar;
44725267 JSplitPane framePanel;
44735268 JTextArea/*Field*/ nameField;
4474
- cButton textureButton;
5269
+ //cButton textureButton;
44755270 cButton okButton;
44765271 cButton applyButton;
44775272 cButton cancelButton;
....@@ -4518,65 +5313,72 @@
45185313 // MATERIAL
45195314 JLabel materialLabel;
45205315 JLabel colorLabel;
4521
- NumberSlider colorField;
5316
+ cNumberSlider colorField;
45225317 JLabel modulationLabel;
4523
- NumberSlider modulationField;
5318
+ cNumberSlider modulationField;
45245319 JLabel metalnessLabel;
4525
- NumberSlider metalnessField;
5320
+ cNumberSlider metalnessField;
45265321 JLabel diffuseLabel;
4527
- NumberSlider diffuseField;
5322
+ cNumberSlider diffuseField;
45285323 JLabel specularLabel;
4529
- NumberSlider specularField;
5324
+ cNumberSlider specularField;
45305325 JLabel shininessLabel;
4531
- NumberSlider shininessField;
5326
+ cNumberSlider shininessField;
45325327 JLabel shiftLabel;
4533
- NumberSlider shiftField;
5328
+ cNumberSlider shiftField;
45345329 JLabel ambientLabel;
4535
- NumberSlider ambientField;
5330
+ cNumberSlider ambientField;
45365331 JLabel lightareaLabel;
4537
- NumberSlider lightareaField;
5332
+ cNumberSlider lightareaField;
45385333 JLabel diffusenessLabel;
4539
- NumberSlider diffusenessField;
5334
+ cNumberSlider diffusenessField;
45405335 JLabel velvetLabel;
4541
- NumberSlider velvetField;
5336
+ cNumberSlider velvetField;
45425337 JLabel sheenLabel;
4543
- NumberSlider sheenField;
5338
+ cNumberSlider sheenField;
45445339 JLabel subsurfaceLabel;
4545
- NumberSlider subsurfaceField;
5340
+ cNumberSlider subsurfaceField;
45465341 //JLabel bumpLabel;
45475342 //NumberSlider bumpField;
45485343 JLabel backlitLabel;
4549
- NumberSlider backlitField;
5344
+ cNumberSlider backlitField;
45505345 JLabel anisoLabel;
4551
- NumberSlider anisoField;
5346
+ cNumberSlider anisoField;
45525347 JLabel anisoVLabel;
4553
- NumberSlider anisoVField;
5348
+ cNumberSlider anisoVField;
45545349 JLabel cameraLabel;
4555
- NumberSlider cameraField;
5350
+ cNumberSlider cameraField;
45565351 JLabel selfshadowLabel;
4557
- NumberSlider selfshadowField;
5352
+ cNumberSlider selfshadowField;
45585353 JLabel shadowLabel;
4559
- NumberSlider shadowField;
5354
+ cNumberSlider shadowField;
45605355 JLabel textureLabel;
4561
- NumberSlider textureField;
5356
+ cNumberSlider textureField;
45625357 JLabel opacityLabel;
4563
- NumberSlider opacityField;
5358
+ cNumberSlider opacityField;
45645359 JLabel fakedepthLabel;
4565
- NumberSlider fakedepthField;
5360
+ cNumberSlider fakedepthField;
45665361 JLabel shadowbiasLabel;
4567
- NumberSlider shadowbiasField;
5362
+ cNumberSlider shadowbiasField;
45685363 JLabel bumpLabel;
4569
- NumberSlider bumpField;
5364
+ cNumberSlider bumpField;
45705365 JLabel noiseLabel;
4571
- NumberSlider noiseField;
5366
+ cNumberSlider noiseField;
45725367 JLabel powerLabel;
4573
- NumberSlider powerField;
5368
+ cNumberSlider powerField;
45745369 JLabel borderfadeLabel;
4575
- NumberSlider borderfadeField;
5370
+ cNumberSlider borderfadeField;
45765371 JLabel fogLabel;
4577
- NumberSlider fogField;
5372
+ cNumberSlider fogField;
45785373 JLabel opacityPowerLabel;
4579
- NumberSlider opacityPowerField;
4580
- JTree jTree;
5374
+ cNumberSlider opacityPowerField;
5375
+ cTree jTree;
45815376 //ObjectUI parent;
5377
+
5378
+ cNumberSlider normalpushField;
5379
+
5380
+ private MenuItem importGFDItem;
5381
+ private MenuItem importVRMLX3DItem;
5382
+ private MenuItem import3DSItem;
5383
+ private MenuItem importOBJItem;
45825384 }