Normand Briere
2019-06-23 8088590686a45e71278f9a52bb9cc37943dc0c37
GroupEditor.java
....@@ -246,7 +246,7 @@
246246
247247 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248248 toggleDebugItem.addItemListener(this);
249
- toggleDebugItem.setState(CameraPane.DEBUG);
249
+ toggleDebugItem.setState(Globals.DEBUG);
250250
251251 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252252 toggleFrustumItem.addItemListener(this);
....@@ -470,6 +470,14 @@
470470 markleavesItem.addActionListener(this);
471471 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
472472 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);
473481 menu.add("-");
474482 flipVItem = menu.add(new MenuItem("Flip V"));
475483 flipVItem.addActionListener(this);
....@@ -527,6 +535,18 @@
527535
528536 void SetupUI2(ObjEditor oe)
529537 {
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
+
530550 //new Exception().printStackTrace();
531551
532552 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -557,15 +577,27 @@
557577 */
558578 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
559579
560
- oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
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);
561593 undoButton.setToolTipText("Undo changes");
562594 undoButton.addActionListener(this);
563595
564
- oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565597 redoButton.setToolTipText("Redo changes");
566598 redoButton.addActionListener(this);
567599
568
- oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569601 saveButton.setToolTipText("Save changes");
570602 saveButton.addActionListener(this);
571603
....@@ -573,7 +605,7 @@
573605 liveCB.setToolTipText("Enable animation");
574606 liveCB.addItemListener(this);
575607
576
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577609 oneStepButton.setToolTipText("Animate one step forward");
578610 oneStepButton.addActionListener(this);
579611
....@@ -581,7 +613,7 @@
581613 fastCB.setToolTipText("Fast mode");
582614 fastCB.addItemListener(this);
583615
584
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
616
+ oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
585617 trackCB.setToolTipText("Enable tracking");
586618 trackCB.addItemListener(this);
587619
....@@ -809,6 +841,8 @@
809841
810842 void SetupViews(ObjEditor oe)
811843 {
844
+ theFrame = this;
845
+
812846 oe.SetupViews();
813847
814848 System.out.println("SetupViews");
....@@ -871,6 +905,7 @@
871905 } else if(e.getSource() == liveCB)
872906 {
873907 cameraView.ToggleLive();
908
+ refreshContents(false);
874909 }
875910 else if(e.getSource() == supportCB)
876911 {
....@@ -1278,7 +1313,7 @@
12781313 memoryItem.addActionListener(this);
12791314 menu.add(analyzeItem = new MenuItem("Analyze"));
12801315 analyzeItem.addActionListener(this);
1281
- menu.add(dumpItem = new MenuItem("Dump"));
1316
+ menu.add(dumpItem = new MenuItem("Print"));
12821317 dumpItem.addActionListener(this);
12831318 // menu.add(pathItem = new MenuItem("From-to path"));
12841319 // pathItem.addActionListener(this);
....@@ -1969,6 +2004,18 @@
19692004 {
19702005 DumpObject();
19712006 } 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
19722019 if (source == undoButton)
19732020 {
19742021 Undo();
....@@ -2542,7 +2589,7 @@
25422589 } else
25432590 if (source == genNormalsMESHItem)
25442591 {
2545
- GenNormals(true); // TODO
2592
+ GenNormalsMESH();
25462593 } else
25472594 if (source == genNormalsORGANItem)
25482595 {
....@@ -2607,6 +2654,22 @@
26072654 if (source == unmarkleavesItem)
26082655 {
26092656 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);
26102673 } else
26112674 if (source == flipVItem)
26122675 {
....@@ -2874,6 +2937,24 @@
28742937 bigThree.ClearUI();
28752938 bigThree.add(centralPanel);
28762939 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
+
28772958 } else
28782959 if (source == threeButton)
28792960 {
....@@ -2910,6 +2991,8 @@
29102991 bigThree.add(centralPanel);
29112992 bigThree.add(XYZPanel);
29122993 bigThree.FlushUI();
2994
+
2995
+ cameraView.requestFocusInWindow();
29132996 } else
29142997 if (source == fourButton)
29152998 {
....@@ -2945,6 +3028,8 @@
29453028 bigThree.ClearUI();
29463029 bigThree.add(scenePanel);
29473030 bigThree.FlushUI();
3031
+
3032
+ cameraView.requestFocusInWindow();
29483033 } else
29493034 if (source == sixButton)
29503035 {
....@@ -2981,6 +3066,8 @@
29813066 bigThree.add(scenePanel);
29823067 bigThree.add(centralPanel);
29833068 bigThree.FlushUI();
3069
+
3070
+ cameraView.requestFocusInWindow();
29843071 } else
29853072 if (source == sevenButton)
29863073 {
....@@ -3018,6 +3105,8 @@
30183105 bigThree.add(centralPanel);
30193106 bigThree.add(XYZPanel);
30203107 bigThree.FlushUI();
3108
+
3109
+ cameraView.requestFocusInWindow();
30213110 } else
30223111 if (source == rootButton)
30233112 {
....@@ -3029,6 +3118,7 @@
30293118 EditObject(obj);
30303119 }
30313120
3121
+ cameraView.requestFocusInWindow();
30323122 refreshContents(true);
30333123 } else
30343124 if (source == closeButton)
....@@ -3050,6 +3140,8 @@
30503140 break;
30513141 }
30523142 }
3143
+
3144
+ cameraView.requestFocusInWindow();
30533145 refreshContents(true);
30543146 } else
30553147 if (source == editItem || source == editButton)
....@@ -3154,7 +3246,7 @@
31543246 }
31553247
31563248 // fix "+" issue
3157
- group.editWindow = this;
3249
+ //group.editWindow = this;
31583250
31593251 /*
31603252 currentLayout = radio.layout;
....@@ -3167,6 +3259,8 @@
31673259 //group.parent = null; // ROOT
31683260 //group.attributes = -1;
31693261 ResetModel();
3262
+
3263
+ cameraView.requestFocusInWindow();
31703264 refreshContents(true);
31713265 } else if (event.getSource() == editCameraItem)
31723266 {
....@@ -3190,7 +3284,6 @@
31903284 }
31913285
31923286 boolean useclient = false;
3193
- cRadio radio;
31943287
31953288 void ToggleRoot()
31963289 {
....@@ -3429,7 +3522,8 @@
34293522
34303523 int size = obj.MemorySize();
34313524
3432
- 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)");
34333527 }
34343528 }
34353529 catch (Exception e)
....@@ -3510,6 +3604,13 @@
35103604 void GenNormals(boolean crease)
35113605 {
35123606 group.GenNormalsS(crease);
3607
+
3608
+ refreshContents();
3609
+ }
3610
+
3611
+ void GenNormalsMESH()
3612
+ {
3613
+ group.GenNormalsMeshS();
35133614
35143615 refreshContents();
35153616 }
....@@ -4137,6 +4238,18 @@
41374238 refreshContents();
41384239 }
41394240
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
+
41404253 void SetTexRes(int tr)
41414254 {
41424255 group.selection.SetTexRes(tr);
....@@ -4312,7 +4425,6 @@
43124425 //case 702: // Event.LIST_DESELECT
43134426 group.deselectAll();
43144427 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4315
- objEditor.ClearInfo(); // .GetMaterial());
43164428 if (tps != null)
43174429 {
43184430 for (int i=0; i < tps.length; i++)
....@@ -4321,10 +4433,8 @@
43214433
43224434 //if (child.parent != null)
43234435 //child.parent.addSelectee(child);
4436
+ objEditor.SetMaterial(child);
43244437 group.addSelectee(child);
4325
- objEditor.SetMaterial(child); // .GetMaterial());
4326
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4327
- System.err.println("info : " + child.GetPath());
43284438 }
43294439 }
43304440 // else
....@@ -4334,8 +4444,6 @@
43344444 // System.err.println("info : " + group.GetPath());
43354445 // }
43364446
4337
- objEditor.SetText(); // jan 2014
4338
-
43394447 if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43404448 CameraPane.flash = true;
43414449
....@@ -4359,6 +4467,26 @@
43594467
43604468 freezemodel = false;
43614469 }
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
+ }
43624490
43634491 void linkSomething(Object3D thing)
43644492 {
....@@ -5159,9 +5287,12 @@
51595287 cButton clearpanelButton;
51605288 cButton unselectButton;
51615289
5162
- cButton saveButton;
5290
+ cButton minButton;
5291
+ cButton maxButton;
5292
+ cButton fullButton;
51635293 cButton undoButton;
51645294 cButton redoButton;
5295
+ cButton saveButton;
51655296 cButton oneStepButton;
51665297
51675298 cButton screenfitButton;
....@@ -5174,14 +5305,6 @@
51745305 cButton closeButton;
51755306
51765307 cButton setsupportButton;
5177
-
5178
- cButton twoButton;
5179
- cButton sixButton;
5180
- cButton threeButton;
5181
- cButton sevenButton;
5182
- cButton fourButton; // full panel
5183
- cButton oneButton; // full XYZ
5184
- //cButton currentLayout;
51855308
51865309 //
51875310 //Composite
....@@ -5259,6 +5382,10 @@
52595382 private MenuItem showleavesItem;
52605383 private MenuItem markleavesItem;
52615384 private MenuItem unmarkleavesItem;
5385
+ private MenuItem rewindleavesItem;
5386
+ private MenuItem unrewindleavesItem;
5387
+ private MenuItem randomleavesItem;
5388
+ private MenuItem unrandomleavesItem;
52625389
52635390 private MenuItem flipVItem;
52645391 private MenuItem unflipVItem;