Normand Briere
2019-06-23 8088590686a45e71278f9a52bb9cc37943dc0c37
GroupEditor.java
....@@ -154,11 +154,12 @@
154154 oe.menuBar.add(menu = new Menu("Edit"));
155155 //editItem = menu.add(new MenuItem("Edit"));
156156 //editItem.addActionListener(this);
157
- undoItem = menu.add(new MenuItem("Undo"));
158
- undoItem.addActionListener(this);
159
- redoItem = menu.add(new MenuItem("Redo"));
160
- redoItem.addActionListener(this);
161
- menu.add("-");
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("-");
162163 duplicateItem = menu.add(new MenuItem("Duplicate"));
163164 duplicateItem.addActionListener(this);
164165 cloneItem = menu.add(new MenuItem("Clone"));
....@@ -202,7 +203,7 @@
202203 //zBufferItem.addActionListener(this);
203204 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204205 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Camera"));
206
+ cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206207 revertCameraItem.addActionListener(this);
207208
208209 cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
....@@ -245,7 +246,7 @@
245246
246247 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
247248 toggleDebugItem.addItemListener(this);
248
- toggleDebugItem.setState(CameraPane.DEBUG);
249
+ toggleDebugItem.setState(Globals.DEBUG);
249250
250251 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
251252 toggleFrustumItem.addItemListener(this);
....@@ -266,7 +267,7 @@
266267 // animationItem.addItemListener(this);
267268 // animationItem.setState(CameraPane.ANIMATION);
268269 cameraMenu.add("-");
269
- cameraMenu.add(editCameraItem = new MenuItem("Save Camera"));
270
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
270271 editCameraItem.addActionListener(this);
271272
272273 if (Globals.ADVANCED)
....@@ -469,6 +470,14 @@
469470 markleavesItem.addActionListener(this);
470471 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
471472 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);
472481 menu.add("-");
473482 flipVItem = menu.add(new MenuItem("Flip V"));
474483 flipVItem.addActionListener(this);
....@@ -526,6 +535,18 @@
526535
527536 void SetupUI2(ObjEditor oe)
528537 {
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
+
529550 //new Exception().printStackTrace();
530551
531552 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -556,11 +577,35 @@
556577 */
557578 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
558579
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
+
559604 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
560605 liveCB.setToolTipText("Enable animation");
561606 liveCB.addItemListener(this);
562607
563
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
564609 oneStepButton.setToolTipText("Animate one step forward");
565610 oneStepButton.addActionListener(this);
566611
....@@ -568,7 +613,7 @@
568613 fastCB.setToolTipText("Fast mode");
569614 fastCB.addItemListener(this);
570615
571
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
616
+ oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
572617 trackCB.setToolTipText("Enable tracking");
573618 trackCB.addItemListener(this);
574619
....@@ -796,6 +841,8 @@
796841
797842 void SetupViews(ObjEditor oe)
798843 {
844
+ theFrame = this;
845
+
799846 oe.SetupViews();
800847
801848 System.out.println("SetupViews");
....@@ -858,6 +905,7 @@
858905 } else if(e.getSource() == liveCB)
859906 {
860907 cameraView.ToggleLive();
908
+ refreshContents(false);
861909 }
862910 else if(e.getSource() == supportCB)
863911 {
....@@ -1265,7 +1313,7 @@
12651313 memoryItem.addActionListener(this);
12661314 menu.add(analyzeItem = new MenuItem("Analyze"));
12671315 analyzeItem.addActionListener(this);
1268
- menu.add(dumpItem = new MenuItem("Dump"));
1316
+ menu.add(dumpItem = new MenuItem("Print"));
12691317 dumpItem.addActionListener(this);
12701318 // menu.add(pathItem = new MenuItem("From-to path"));
12711319 // pathItem.addActionListener(this);
....@@ -1956,6 +2004,30 @@
19562004 {
19572005 DumpObject();
19582006 } 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
19592031 if (source == oneStepButton)
19602032 {
19612033 Globals.ONESTEP = true;
....@@ -2517,7 +2589,7 @@
25172589 } else
25182590 if (source == genNormalsMESHItem)
25192591 {
2520
- GenNormals(true); // TODO
2592
+ GenNormalsMESH();
25212593 } else
25222594 if (source == genNormalsORGANItem)
25232595 {
....@@ -2582,6 +2654,22 @@
25822654 if (source == unmarkleavesItem)
25832655 {
25842656 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);
25852673 } else
25862674 if (source == flipVItem)
25872675 {
....@@ -2849,6 +2937,24 @@
28492937 bigThree.ClearUI();
28502938 bigThree.add(centralPanel);
28512939 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
+
28522958 } else
28532959 if (source == threeButton)
28542960 {
....@@ -2885,6 +2991,8 @@
28852991 bigThree.add(centralPanel);
28862992 bigThree.add(XYZPanel);
28872993 bigThree.FlushUI();
2994
+
2995
+ cameraView.requestFocusInWindow();
28882996 } else
28892997 if (source == fourButton)
28902998 {
....@@ -2920,6 +3028,8 @@
29203028 bigThree.ClearUI();
29213029 bigThree.add(scenePanel);
29223030 bigThree.FlushUI();
3031
+
3032
+ cameraView.requestFocusInWindow();
29233033 } else
29243034 if (source == sixButton)
29253035 {
....@@ -2956,6 +3066,8 @@
29563066 bigThree.add(scenePanel);
29573067 bigThree.add(centralPanel);
29583068 bigThree.FlushUI();
3069
+
3070
+ cameraView.requestFocusInWindow();
29593071 } else
29603072 if (source == sevenButton)
29613073 {
....@@ -2993,6 +3105,8 @@
29933105 bigThree.add(centralPanel);
29943106 bigThree.add(XYZPanel);
29953107 bigThree.FlushUI();
3108
+
3109
+ cameraView.requestFocusInWindow();
29963110 } else
29973111 if (source == rootButton)
29983112 {
....@@ -3004,6 +3118,7 @@
30043118 EditObject(obj);
30053119 }
30063120
3121
+ cameraView.requestFocusInWindow();
30073122 refreshContents(true);
30083123 } else
30093124 if (source == closeButton)
....@@ -3025,6 +3140,8 @@
30253140 break;
30263141 }
30273142 }
3143
+
3144
+ cameraView.requestFocusInWindow();
30283145 refreshContents(true);
30293146 } else
30303147 if (source == editItem || source == editButton)
....@@ -3041,7 +3158,7 @@
30413158 child.CloseUI();
30423159 listUI.remove(child);
30433160
3044
- child.editWindow = null; // ???????????
3161
+ //child.editWindow = null; // ???????????
30453162 }
30463163 objEditor.ctrlPanel.FlushUI();
30473164 //objEditor.jTree.clearSelection();
....@@ -3128,7 +3245,8 @@
31283245 sideView.object = group;
31293246 }
31303247
3131
-// fix "+" issue group.editWindow = this;
3248
+// fix "+" issue
3249
+ //group.editWindow = this;
31323250
31333251 /*
31343252 currentLayout = radio.layout;
....@@ -3141,6 +3259,8 @@
31413259 //group.parent = null; // ROOT
31423260 //group.attributes = -1;
31433261 ResetModel();
3262
+
3263
+ cameraView.requestFocusInWindow();
31443264 refreshContents(true);
31453265 } else if (event.getSource() == editCameraItem)
31463266 {
....@@ -3164,7 +3284,6 @@
31643284 }
31653285
31663286 boolean useclient = false;
3167
- cRadio radio;
31683287
31693288 void ToggleRoot()
31703289 {
....@@ -3403,7 +3522,8 @@
34033522
34043523 int size = obj.MemorySize();
34053524
3406
- 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)");
34073527 }
34083528 }
34093529 catch (Exception e)
....@@ -3484,6 +3604,13 @@
34843604 void GenNormals(boolean crease)
34853605 {
34863606 group.GenNormalsS(crease);
3607
+
3608
+ refreshContents();
3609
+ }
3610
+
3611
+ void GenNormalsMESH()
3612
+ {
3613
+ group.GenNormalsMeshS();
34873614
34883615 refreshContents();
34893616 }
....@@ -4111,6 +4238,18 @@
41114238 refreshContents();
41124239 }
41134240
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
+
41144253 void SetTexRes(int tr)
41154254 {
41164255 group.selection.SetTexRes(tr);
....@@ -4286,7 +4425,6 @@
42864425 //case 702: // Event.LIST_DESELECT
42874426 group.deselectAll();
42884427 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4289
- objEditor.ClearInfo(); // .GetMaterial());
42904428 if (tps != null)
42914429 {
42924430 for (int i=0; i < tps.length; i++)
....@@ -4295,10 +4433,8 @@
42954433
42964434 //if (child.parent != null)
42974435 //child.parent.addSelectee(child);
4436
+ objEditor.SetMaterial(child);
42984437 group.addSelectee(child);
4299
- objEditor.SetMaterial(child); // .GetMaterial());
4300
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4301
- System.err.println("info : " + child.GetPath());
43024438 }
43034439 }
43044440 // else
....@@ -4308,17 +4444,13 @@
43084444 // System.err.println("info : " + group.GetPath());
43094445 // }
43104446
4311
- objEditor.SetText(); // jan 2014
4312
-
4313
- Object3D object = (Object3D) tps[0].getLastPathComponent();
4314
-
4315
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(object instanceof Camera))
4447
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43164448 CameraPane.flash = true;
43174449
4318
- if (tps != null && tps.length > 0 && object instanceof Camera)
4450
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43194451 // a camera
43204452 {
4321
- if (object != Globals.theRenderer.LightCamera())
4453
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
43224454 {
43234455 CameraPane.camerachangeframe = 0; // don't refuse it
43244456 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4335,6 +4467,26 @@
43354467
43364468 freezemodel = false;
43374469 }
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
+ }
43384490
43394491 void linkSomething(Object3D thing)
43404492 {
....@@ -4406,6 +4558,7 @@
44064558 {
44074559 if (group.selection.isEmpty())
44084560 return;
4561
+
44094562 Grafreed.clipboardIsTempGroup = false;
44104563 Composite tGroup = null;
44114564 if (group.selection.size() > 0) // 1)
....@@ -4416,6 +4569,7 @@
44164569
44174570 if (cut)
44184571 {
4572
+ Save();
44194573 //int indices[] = jList.getSelectedIndices();
44204574 //for (int i = indices.length - 1; i >= 0; i--)
44214575 //jList.remove(indices[i]);
....@@ -4505,8 +4659,10 @@
45054659 }
45064660
45074661 }
4662
+
45084663 if (Grafreed.clipboardIsTempGroup)
45094664 Grafreed.clipboard = tGroup;
4665
+
45104666 if (cut)
45114667 {
45124668 ResetModel();
....@@ -5131,6 +5287,12 @@
51315287 cButton clearpanelButton;
51325288 cButton unselectButton;
51335289
5290
+ cButton minButton;
5291
+ cButton maxButton;
5292
+ cButton fullButton;
5293
+ cButton undoButton;
5294
+ cButton redoButton;
5295
+ cButton saveButton;
51345296 cButton oneStepButton;
51355297
51365298 cButton screenfitButton;
....@@ -5143,14 +5305,6 @@
51435305 cButton closeButton;
51445306
51455307 cButton setsupportButton;
5146
-
5147
- cButton twoButton;
5148
- cButton sixButton;
5149
- cButton threeButton;
5150
- cButton sevenButton;
5151
- cButton fourButton; // full panel
5152
- cButton oneButton; // full XYZ
5153
- //cButton currentLayout;
51545308
51555309 //
51565310 //Composite
....@@ -5228,6 +5382,10 @@
52285382 private MenuItem showleavesItem;
52295383 private MenuItem markleavesItem;
52305384 private MenuItem unmarkleavesItem;
5385
+ private MenuItem rewindleavesItem;
5386
+ private MenuItem unrewindleavesItem;
5387
+ private MenuItem randomleavesItem;
5388
+ private MenuItem unrandomleavesItem;
52315389
52325390 private MenuItem flipVItem;
52335391 private MenuItem unflipVItem;