Normand Briere
2019-06-23 8088590686a45e71278f9a52bb9cc37943dc0c37
GroupEditor.java
....@@ -154,6 +154,12 @@
154154 oe.menuBar.add(menu = new Menu("Edit"));
155155 //editItem = menu.add(new MenuItem("Edit"));
156156 //editItem.addActionListener(this);
157
+
158
+// undoItem = menu.add(new MenuItem("Undo"));
159
+// undoItem.addActionListener(this);
160
+// redoItem = menu.add(new MenuItem("Redo"));
161
+// redoItem.addActionListener(this);
162
+// menu.add("-");
157163 duplicateItem = menu.add(new MenuItem("Duplicate"));
158164 duplicateItem.addActionListener(this);
159165 cloneItem = menu.add(new MenuItem("Clone"));
....@@ -197,7 +203,7 @@
197203 //zBufferItem.addActionListener(this);
198204 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
199205 //normalLensItem.addActionListener(this);
200
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
206
+ cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
201207 revertCameraItem.addActionListener(this);
202208
203209 cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
....@@ -240,7 +246,7 @@
240246
241247 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
242248 toggleDebugItem.addItemListener(this);
243
- toggleDebugItem.setState(CameraPane.DEBUG);
249
+ toggleDebugItem.setState(Globals.DEBUG);
244250
245251 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
246252 toggleFrustumItem.addItemListener(this);
....@@ -261,7 +267,7 @@
261267 // animationItem.addItemListener(this);
262268 // animationItem.setState(CameraPane.ANIMATION);
263269 cameraMenu.add("-");
264
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
270
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
265271 editCameraItem.addActionListener(this);
266272
267273 if (Globals.ADVANCED)
....@@ -464,6 +470,14 @@
464470 markleavesItem.addActionListener(this);
465471 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
466472 unmarkleavesItem.addActionListener(this);
473
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
474
+ rewindleavesItem.addActionListener(this);
475
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
476
+ unrewindleavesItem.addActionListener(this);
477
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
478
+ randomleavesItem.addActionListener(this);
479
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
480
+ unrandomleavesItem.addActionListener(this);
467481 menu.add("-");
468482 flipVItem = menu.add(new MenuItem("Flip V"));
469483 flipVItem.addActionListener(this);
....@@ -521,6 +535,18 @@
521535
522536 void SetupUI2(ObjEditor oe)
523537 {
538
+ // June 2019
539
+ if (oe == null)
540
+ {
541
+ //super.SetupUI2(this);
542
+ //return;
543
+ }
544
+
545
+ if (copy != group)
546
+ {
547
+ //super.SetupUI2(this);
548
+ }
549
+
524550 //new Exception().printStackTrace();
525551
526552 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -551,11 +577,35 @@
551577 */
552578 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
553579
580
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
581
+ //minButton.setToolTipText("Minimize window");
582
+ //minButton.addActionListener(this);
583
+
584
+ oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
+ maxButton.setToolTipText("Maximize window");
586
+ maxButton.addActionListener(this);
587
+
588
+ oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589
+ fullButton.setToolTipText("Full-screen window");
590
+ fullButton.addActionListener(this);
591
+
592
+ oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
593
+ undoButton.setToolTipText("Undo changes");
594
+ undoButton.addActionListener(this);
595
+
596
+ oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
+ redoButton.setToolTipText("Redo changes");
598
+ redoButton.addActionListener(this);
599
+
600
+ oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
601
+ saveButton.setToolTipText("Save changes");
602
+ saveButton.addActionListener(this);
603
+
554604 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
555605 liveCB.setToolTipText("Enable animation");
556606 liveCB.addItemListener(this);
557607
558
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
559609 oneStepButton.setToolTipText("Animate one step forward");
560610 oneStepButton.addActionListener(this);
561611
....@@ -563,7 +613,7 @@
563613 fastCB.setToolTipText("Fast mode");
564614 fastCB.addItemListener(this);
565615
566
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
616
+ oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
567617 trackCB.setToolTipText("Enable tracking");
568618 trackCB.addItemListener(this);
569619
....@@ -791,6 +841,8 @@
791841
792842 void SetupViews(ObjEditor oe)
793843 {
844
+ theFrame = this;
845
+
794846 oe.SetupViews();
795847
796848 System.out.println("SetupViews");
....@@ -853,6 +905,7 @@
853905 } else if(e.getSource() == liveCB)
854906 {
855907 cameraView.ToggleLive();
908
+ refreshContents(false);
856909 }
857910 else if(e.getSource() == supportCB)
858911 {
....@@ -1260,7 +1313,7 @@
12601313 memoryItem.addActionListener(this);
12611314 menu.add(analyzeItem = new MenuItem("Analyze"));
12621315 analyzeItem.addActionListener(this);
1263
- menu.add(dumpItem = new MenuItem("Dump"));
1316
+ menu.add(dumpItem = new MenuItem("Print"));
12641317 dumpItem.addActionListener(this);
12651318 // menu.add(pathItem = new MenuItem("From-to path"));
12661319 // pathItem.addActionListener(this);
....@@ -1951,6 +2004,30 @@
19512004 {
19522005 DumpObject();
19532006 } else
2007
+ if (source == minButton)
2008
+ {
2009
+ Minimize();
2010
+ } else
2011
+ if (source == maxButton)
2012
+ {
2013
+ Maximize();
2014
+ } else
2015
+ if (source == fullButton)
2016
+ {
2017
+ ToggleFullScreen();
2018
+ } else
2019
+ if (source == undoButton)
2020
+ {
2021
+ Undo();
2022
+ } else
2023
+ if (source == redoButton)
2024
+ {
2025
+ Redo();
2026
+ } else
2027
+ if (source == saveButton)
2028
+ {
2029
+ Save();
2030
+ } else
19542031 if (source == oneStepButton)
19552032 {
19562033 Globals.ONESTEP = true;
....@@ -2004,6 +2081,14 @@
20042081 if (source == cutItem || source == clearButton)
20052082 {
20062083 loadClipboard(true);
2084
+ } else
2085
+ if (source == undoItem)
2086
+ {
2087
+ Undo();
2088
+ } else
2089
+ if (source == redoItem)
2090
+ {
2091
+ Redo();
20072092 } else
20082093 if (source == duplicateItem)
20092094 {
....@@ -2504,7 +2589,7 @@
25042589 } else
25052590 if (source == genNormalsMESHItem)
25062591 {
2507
- GenNormals(true); // TODO
2592
+ GenNormalsMESH();
25082593 } else
25092594 if (source == genNormalsORGANItem)
25102595 {
....@@ -2569,6 +2654,22 @@
25692654 if (source == unmarkleavesItem)
25702655 {
25712656 MarkLeaves(false);
2657
+ } else
2658
+ if (source == rewindleavesItem)
2659
+ {
2660
+ RewindLeaves(true);
2661
+ } else
2662
+ if (source == unrewindleavesItem)
2663
+ {
2664
+ RewindLeaves(false);
2665
+ } else
2666
+ if (source == randomleavesItem)
2667
+ {
2668
+ RandomLeaves(true);
2669
+ } else
2670
+ if (source == unrandomleavesItem)
2671
+ {
2672
+ RandomLeaves(false);
25722673 } else
25732674 if (source == flipVItem)
25742675 {
....@@ -2836,6 +2937,24 @@
28362937 bigThree.ClearUI();
28372938 bigThree.add(centralPanel);
28382939 bigThree.FlushUI();
2940
+
2941
+ cameraView.requestFocusInWindow();
2942
+
2943
+// refreshContents(true);
2944
+//
2945
+// try
2946
+// {
2947
+// java.awt.Robot bot = new java.awt.Robot();
2948
+// int mask = InputEvent.BUTTON1_MASK;
2949
+// bot.mouseMove(100, 100);
2950
+// bot.mousePress(mask);
2951
+// bot.mouseRelease(mask);
2952
+// }
2953
+// catch (Exception e)
2954
+// {
2955
+//
2956
+// }
2957
+
28392958 } else
28402959 if (source == threeButton)
28412960 {
....@@ -2872,6 +2991,8 @@
28722991 bigThree.add(centralPanel);
28732992 bigThree.add(XYZPanel);
28742993 bigThree.FlushUI();
2994
+
2995
+ cameraView.requestFocusInWindow();
28752996 } else
28762997 if (source == fourButton)
28772998 {
....@@ -2907,6 +3028,8 @@
29073028 bigThree.ClearUI();
29083029 bigThree.add(scenePanel);
29093030 bigThree.FlushUI();
3031
+
3032
+ cameraView.requestFocusInWindow();
29103033 } else
29113034 if (source == sixButton)
29123035 {
....@@ -2943,6 +3066,8 @@
29433066 bigThree.add(scenePanel);
29443067 bigThree.add(centralPanel);
29453068 bigThree.FlushUI();
3069
+
3070
+ cameraView.requestFocusInWindow();
29463071 } else
29473072 if (source == sevenButton)
29483073 {
....@@ -2980,6 +3105,8 @@
29803105 bigThree.add(centralPanel);
29813106 bigThree.add(XYZPanel);
29823107 bigThree.FlushUI();
3108
+
3109
+ cameraView.requestFocusInWindow();
29833110 } else
29843111 if (source == rootButton)
29853112 {
....@@ -2991,6 +3118,7 @@
29913118 EditObject(obj);
29923119 }
29933120
3121
+ cameraView.requestFocusInWindow();
29943122 refreshContents(true);
29953123 } else
29963124 if (source == closeButton)
....@@ -3012,6 +3140,8 @@
30123140 break;
30133141 }
30143142 }
3143
+
3144
+ cameraView.requestFocusInWindow();
30153145 refreshContents(true);
30163146 } else
30173147 if (source == editItem || source == editButton)
....@@ -3028,7 +3158,7 @@
30283158 child.CloseUI();
30293159 listUI.remove(child);
30303160
3031
- child.editWindow = null; // ???????????
3161
+ //child.editWindow = null; // ???????????
30323162 }
30333163 objEditor.ctrlPanel.FlushUI();
30343164 //objEditor.jTree.clearSelection();
....@@ -3115,7 +3245,8 @@
31153245 sideView.object = group;
31163246 }
31173247
3118
-// fix "+" issue group.editWindow = this;
3248
+// fix "+" issue
3249
+ //group.editWindow = this;
31193250
31203251 /*
31213252 currentLayout = radio.layout;
....@@ -3128,6 +3259,8 @@
31283259 //group.parent = null; // ROOT
31293260 //group.attributes = -1;
31303261 ResetModel();
3262
+
3263
+ cameraView.requestFocusInWindow();
31313264 refreshContents(true);
31323265 } else if (event.getSource() == editCameraItem)
31333266 {
....@@ -3151,7 +3284,6 @@
31513284 }
31523285
31533286 boolean useclient = false;
3154
- cRadio radio;
31553287
31563288 void ToggleRoot()
31573289 {
....@@ -3390,7 +3522,8 @@
33903522
33913523 int size = obj.MemorySize();
33923524
3393
- System.err.println((size/1024) + " KB is the size of " + obj);
3525
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3526
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33943527 }
33953528 }
33963529 catch (Exception e)
....@@ -3471,6 +3604,13 @@
34713604 void GenNormals(boolean crease)
34723605 {
34733606 group.GenNormalsS(crease);
3607
+
3608
+ refreshContents();
3609
+ }
3610
+
3611
+ void GenNormalsMESH()
3612
+ {
3613
+ group.GenNormalsMeshS();
34743614
34753615 refreshContents();
34763616 }
....@@ -4098,6 +4238,18 @@
40984238 refreshContents();
40994239 }
41004240
4241
+ void RewindLeaves(boolean hide)
4242
+ {
4243
+ group.selection.RewindLeaves(hide);
4244
+ refreshContents();
4245
+ }
4246
+
4247
+ void RandomLeaves(boolean hide)
4248
+ {
4249
+ group.selection.RandomLeaves(hide);
4250
+ refreshContents();
4251
+ }
4252
+
41014253 void SetTexRes(int tr)
41024254 {
41034255 group.selection.SetTexRes(tr);
....@@ -4273,7 +4425,6 @@
42734425 //case 702: // Event.LIST_DESELECT
42744426 group.deselectAll();
42754427 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4276
- objEditor.ClearInfo(); // .GetMaterial());
42774428 if (tps != null)
42784429 {
42794430 for (int i=0; i < tps.length; i++)
....@@ -4282,10 +4433,8 @@
42824433
42834434 //if (child.parent != null)
42844435 //child.parent.addSelectee(child);
4436
+ objEditor.SetMaterial(child);
42854437 group.addSelectee(child);
4286
- objEditor.SetMaterial(child); // .GetMaterial());
4287
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4288
- System.err.println("info : " + child.GetPath());
42894438 }
42904439 }
42914440 // else
....@@ -4295,16 +4444,17 @@
42954444 // System.err.println("info : " + group.GetPath());
42964445 // }
42974446
4298
- objEditor.SetText(); // jan 2014
4299
-
4300
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4447
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43014448 CameraPane.flash = true;
43024449
4303
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4450
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43044451 // a camera
43054452 {
4306
- CameraPane.camerachangeframe = 0; // don't refuse it
4307
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4453
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4454
+ {
4455
+ CameraPane.camerachangeframe = 0; // don't refuse it
4456
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4457
+ }
43084458 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
43094459 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43104460 }
....@@ -4317,6 +4467,26 @@
43174467
43184468 freezemodel = false;
43194469 }
4470
+
4471
+ void refreshContents(boolean cp)
4472
+ {
4473
+ if (!Globals.MOUSEDRAGGED)
4474
+ {
4475
+ objEditor.ClearInfo(); // .GetMaterial());
4476
+
4477
+ for (int i=0; i < group.selection.Size(); i++)
4478
+ {
4479
+ Object3D child = (Object3D) group.selection.get(i);
4480
+
4481
+ objEditor.AddInfo(child, this, true);
4482
+ System.err.println("info : " + child.GetPath());
4483
+ }
4484
+
4485
+ objEditor.SetText(); // jan 2014
4486
+ }
4487
+
4488
+ super.refreshContents(cp);
4489
+ }
43204490
43214491 void linkSomething(Object3D thing)
43224492 {
....@@ -4388,6 +4558,7 @@
43884558 {
43894559 if (group.selection.isEmpty())
43904560 return;
4561
+
43914562 Grafreed.clipboardIsTempGroup = false;
43924563 Composite tGroup = null;
43934564 if (group.selection.size() > 0) // 1)
....@@ -4398,6 +4569,7 @@
43984569
43994570 if (cut)
44004571 {
4572
+ Save();
44014573 //int indices[] = jList.getSelectedIndices();
44024574 //for (int i = indices.length - 1; i >= 0; i--)
44034575 //jList.remove(indices[i]);
....@@ -4487,8 +4659,10 @@
44874659 }
44884660
44894661 }
4662
+
44904663 if (Grafreed.clipboardIsTempGroup)
44914664 Grafreed.clipboard = tGroup;
4665
+
44924666 if (cut)
44934667 {
44944668 ResetModel();
....@@ -5113,6 +5287,12 @@
51135287 cButton clearpanelButton;
51145288 cButton unselectButton;
51155289
5290
+ cButton minButton;
5291
+ cButton maxButton;
5292
+ cButton fullButton;
5293
+ cButton undoButton;
5294
+ cButton redoButton;
5295
+ cButton saveButton;
51165296 cButton oneStepButton;
51175297
51185298 cButton screenfitButton;
....@@ -5126,14 +5306,6 @@
51265306
51275307 cButton setsupportButton;
51285308
5129
- cButton twoButton;
5130
- cButton sixButton;
5131
- cButton threeButton;
5132
- cButton sevenButton;
5133
- cButton fourButton; // full panel
5134
- cButton oneButton; // full XYZ
5135
- //cButton currentLayout;
5136
-
51375309 //
51385310 //Composite
51395311 Object3D // to do !!
....@@ -5145,6 +5317,8 @@
51455317 private MenuItem lookFromItem;
51465318 private MenuItem switchItem;
51475319 private MenuItem cutItem;
5320
+ private MenuItem undoItem;
5321
+ private MenuItem redoItem;
51485322 private MenuItem duplicateItem;
51495323 private MenuItem cloneItem;
51505324 private MenuItem cloneSupportItem;
....@@ -5208,6 +5382,10 @@
52085382 private MenuItem showleavesItem;
52095383 private MenuItem markleavesItem;
52105384 private MenuItem unmarkleavesItem;
5385
+ private MenuItem rewindleavesItem;
5386
+ private MenuItem unrewindleavesItem;
5387
+ private MenuItem randomleavesItem;
5388
+ private MenuItem unrandomleavesItem;
52115389
52125390 private MenuItem flipVItem;
52135391 private MenuItem unflipVItem;